(Heading, {
- types: HeadingTypeEnum,
- weights: HeadingWeightEnum,
- align: TypographyAlignEnum,
- colors: TypographyColorEnum
-});
+export default Heading;
diff --git a/packages/components/typography/src/Heading/HeadingConstants.ts b/packages/components/typography/src/Heading/HeadingConstants.ts
deleted file mode 100644
index 7a9b676854..0000000000
--- a/packages/components/typography/src/Heading/HeadingConstants.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * @deprecated
- */
-export enum HeadingType {
- H1 = "h1",
- H2 = "h2",
- H3 = "h3"
-}
-
-/**
- * @deprecated
- */
-export enum HeadingWeight {
- BOLD = "bold",
- MEDIUM = "medium",
- NORMAL = "normal",
- LIGHT = "light"
-}
diff --git a/packages/components/typography/src/Text/Text.module.scss b/packages/components/typography/src/Text/Text.module.scss
index db1465f307..f2aca2c9dd 100644
--- a/packages/components/typography/src/Text/Text.module.scss
+++ b/packages/components/typography/src/Text/Text.module.scss
@@ -7,7 +7,7 @@ p:first-of-type.text {
}
p.text + p {
- margin-block-start: var(--spacing-large);
+ margin-block-start: var(--space-24);
margin-block-end: 0;
}
diff --git a/packages/components/typography/src/Text/Text.tsx b/packages/components/typography/src/Text/Text.tsx
index 965bcc5b9c..077ce6c55a 100644
--- a/packages/components/typography/src/Text/Text.tsx
+++ b/packages/components/typography/src/Text/Text.tsx
@@ -1,13 +1,8 @@
import React, { forwardRef, type ReactNode } from "react";
import cx from "classnames";
import { camelCase } from "es-toolkit";
-import { getStyle, withStaticProps } from "@vibe/shared";
-import { TextType as TextTypeEnum, TextWeight as TextWeightEnum } from "./TextConstants";
+import { getStyle } from "@vibe/shared";
import Typography, { type TypographyProps } from "../Typography/Typography";
-import {
- TypographyAlign as TypographyAlignEnum,
- TypographyColor as TypographyColorEnum
-} from "../Typography/TypographyConstants";
import { type TextType, type TextWeight } from "./Text.types";
import styles from "./Text.module.scss";
@@ -54,16 +49,4 @@ const Text = forwardRef(
}
);
-interface TextStaticProps {
- types: typeof TextTypeEnum;
- weights: typeof TextWeightEnum;
- colors: typeof TypographyColorEnum;
- align: typeof TypographyAlignEnum;
-}
-
-export default withStaticProps(Text, {
- types: TextTypeEnum,
- weights: TextWeightEnum,
- colors: TypographyColorEnum,
- align: TypographyAlignEnum
-});
+export default Text;
diff --git a/packages/components/typography/src/Text/TextConstants.ts b/packages/components/typography/src/Text/TextConstants.ts
deleted file mode 100644
index 39a8c9d10c..0000000000
--- a/packages/components/typography/src/Text/TextConstants.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
- * @deprecated
- */
-export enum TextType {
- TEXT1 = "text1",
- TEXT2 = "text2",
- TEXT3 = "text3"
-}
-
-/**
- * @deprecated
- */
-export enum TextWeight {
- BOLD = "bold",
- MEDIUM = "medium",
- NORMAL = "normal"
-}
diff --git a/packages/components/typography/src/Typography/Typography.module.scss b/packages/components/typography/src/Typography/Typography.module.scss
index f13a4bac31..510658abbd 100644
--- a/packages/components/typography/src/Typography/Typography.module.scss
+++ b/packages/components/typography/src/Typography/Typography.module.scss
@@ -1,4 +1,4 @@
-@import "~monday-ui-style/dist/mixins";
+@import "~@vibe/style/dist/mixins";
.typography {
// TODO: [breaking] remove anchor styles
diff --git a/packages/components/typography/src/Typography/TypographyConstants.ts b/packages/components/typography/src/Typography/TypographyConstants.ts
deleted file mode 100644
index fa7b861abb..0000000000
--- a/packages/components/typography/src/Typography/TypographyConstants.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * @deprecated
- */
-export enum TypographyColor {
- PRIMARY = "primary",
- SECONDARY = "secondary",
- ON_PRIMARY = "onPrimary",
- ON_INVERTED = "onInverted",
- FIXED_LIGHT = "fixedLight",
- FIXED_DARK = "fixedDark",
- INHERIT = "inherit",
- NEGATIVE = "negative"
-}
-
-/**
- * @deprecated
- */
-export enum TypographyAlign {
- START = "start",
- CENTER = "center",
- END = "end",
- INHERIT = "inherit"
-}
diff --git a/packages/components/typography/src/index.ts b/packages/components/typography/src/index.ts
index 21a1426fc3..f9a4b77a71 100644
--- a/packages/components/typography/src/index.ts
+++ b/packages/components/typography/src/index.ts
@@ -1,7 +1,4 @@
export { Text, type TextProps, type TextType, type TextWeight } from "./Text";
export { Heading, type HeadingProps, type HeadingType, type HeadingWeight } from "./Heading";
-export { TextType as TextTypeEnum, TextWeight as TextWeightEnum } from "./Text/TextConstants";
-export { HeadingType as HeadingTypeEnum, HeadingWeight as HeadingWeightEnum } from "./Heading/HeadingConstants";
-
export type { TypographyColor, TypographyAlign } from "./Typography";
diff --git a/packages/components/typography/src/styles/typography.scss b/packages/components/typography/src/styles/typography.scss
index 0752cd3170..8bbac7bbf9 100644
--- a/packages/components/typography/src/styles/typography.scss
+++ b/packages/components/typography/src/styles/typography.scss
@@ -1,6 +1,6 @@
@use "sass:string";
-@import "~monday-ui-style/dist/mixins";
-@import "~monday-ui-style/dist/functions";
+@import "~@vibe/style/dist/mixins";
+@import "~@vibe/style/dist/functions";
@mixin create-text-classes() {
@include create-typography-classes($textClasses, text);
diff --git a/packages/config/package.json b/packages/config/package.json
index 3d1381861a..b86f758d34 100644
--- a/packages/config/package.json
+++ b/packages/config/package.json
@@ -1,6 +1,6 @@
{
"name": "@vibe/config",
- "version": "3.0.5",
+ "version": "4.0.0-rc.0",
"private": true,
"description": "Shared configurations for Vibe packages",
"repository": {
@@ -23,7 +23,7 @@
"./vitest.config": "./vitest.config.mjs"
},
"devDependencies": {
- "typescript": "^4.7.3"
+ "typescript": "^5.9.3"
},
"dependencies": {
"@rollup/plugin-babel": "^6.0.2",
diff --git a/packages/config/rollup.config.mjs b/packages/config/rollup.config.mjs
index e716ceb351..287b9ef12e 100644
--- a/packages/config/rollup.config.mjs
+++ b/packages/config/rollup.config.mjs
@@ -64,7 +64,7 @@ export default {
},
input: path.join(SRC_PATH, "index.ts"),
external: [
- /node_modules\/(?!monday-ui-style)(.*)/,
+ /node_modules\/(?!@vibe\/style)(.*)/,
/@vibe\/.*/ // Externalize all @vibe packages
],
plugins: [
diff --git a/packages/core/.stylelintrc.json b/packages/core/.stylelintrc.json
index bb25e4a2db..d3bf4c00ba 100644
--- a/packages/core/.stylelintrc.json
+++ b/packages/core/.stylelintrc.json
@@ -1,15 +1,15 @@
{
- "extends": ["stylelint-config-recommended-scss", "monday-ui-style/stylelint-config"],
+ "extends": ["stylelint-config-recommended-scss", "@vibe/style/stylelint-config"],
"plugins": ["stylelint-use-logical", "stylelint-no-unsupported-browser-features"],
"rules": {
"no-descending-specificity": null,
- "monday-ui-style/use-defined-css-var-when-available": [
+ "@vibe/style/use-defined-css-var-when-available": [
true,
{
"severity": "warning"
}
],
- "monday-ui-style/use-new-spacing-tokens": [
+ "@vibe/style/use-new-spacing-tokens": [
null,
{
"severity": "warning"
diff --git a/packages/core/README.md b/packages/core/README.md
index d97fe65534..67e979a6d0 100644
--- a/packages/core/README.md
+++ b/packages/core/README.md
@@ -13,6 +13,18 @@ Components are imported from the library's root entry:
import { Button } from "@vibe/core";
```
+### Global CSS Setup
+
+Vibe components require `box-sizing: border-box` to be applied globally. Add the following to your root stylesheet:
+
+```css
+*,
+*::before,
+*::after {
+ box-sizing: border-box;
+}
+```
+
### Font installation
We don't import fonts ourselves, we work best with the following fonts -
diff --git a/packages/core/package.json b/packages/core/package.json
index e50d2dc6f0..e66a266f4c 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -1,6 +1,6 @@
{
"name": "@vibe/core",
- "version": "3.88.0",
+ "version": "4.0.0-rc.0",
"description": "Official monday.com UI resources for application development in React.js",
"repository": {
"type": "git",
@@ -90,42 +90,34 @@
},
"dependencies": {
"@floating-ui/react-dom": "^2.1.2",
- "@popperjs/core": "2.11.6",
- "@vibe/base": "3.0.5",
- "@vibe/button": "3.0.16",
- "@vibe/clickable": "3.0.3",
- "@vibe/dialog": "3.0.12",
- "@vibe/hooks": "3.0.3",
- "@vibe/icon": "3.0.11",
- "@vibe/icon-button": "3.0.5",
- "@vibe/icons": "1.16.0",
- "@vibe/layer": "3.0.10",
- "@vibe/layout": "3.0.3",
- "@vibe/loader": "3.0.11",
- "@vibe/shared": "3.0.8",
- "@vibe/tooltip": "3.0.5",
- "@vibe/typography": "3.0.5",
- "a11y-dialog": "^7.5.2",
- "body-scroll-lock": "^4.0.0-beta.0",
+ "@vibe/base": "^4.0.0-rc.0",
+ "@vibe/button": "^4.0.0-rc.0",
+ "@vibe/clickable": "^4.0.0-rc.0",
+ "@vibe/dialog": "^4.0.0-rc.0",
+ "@vibe/hooks": "^4.0.0-rc.0",
+ "@vibe/icon": "^4.0.0-rc.0",
+ "@vibe/icon-button": "^4.0.0-rc.0",
+ "@vibe/icons": "^4.0.0-rc.0",
+ "@vibe/layer": "^4.0.0-rc.0",
+ "@vibe/layout": "^4.0.0-rc.0",
+ "@vibe/loader": "^4.0.0-rc.0",
+ "@vibe/shared": "^4.0.0-rc.0",
+ "@vibe/style": "^4.0.0-rc.0",
+ "@vibe/tooltip": "^4.0.0-rc.0",
+ "@vibe/typography": "^4.0.0-rc.0",
"browserslist-config-monday": "1.0.6",
"classnames": "^2.3.2",
"date-fns": "^2.30.0",
"downshift": "^9.0.8",
"es-toolkit": "^1.39.10",
- "framer-motion": "^6.5.1",
- "monday-ui-style": "0.26.2",
- "react-dates": "21.8.0",
"react-day-picker": "^8.8.0",
"react-focus-lock": "^2.13.2",
"react-inlinesvg": "^4.1.3",
"react-is": "^16.9.0",
- "react-popper": "^2.3.0",
"react-remove-scroll": "^2.6.0",
- "react-select": "npm:react-select-module@3.4.0",
"react-transition-group": "^4.4.5",
"react-virtualized-auto-sizer": "^1.0.7",
"react-window": "^1.8.7",
- "react-windowed-select": "^2.0.4",
"style-inject": "^0.3.0"
},
"devDependencies": {
@@ -177,13 +169,10 @@
"@testing-library/react-hooks": "^7.0.2",
"@testing-library/user-event": "^13.5.0",
"@types/babel__standalone": "^7.1.7",
- "@types/body-scroll-lock": "^3.1.0",
"@types/jest-axe": "^3.5.9",
"@types/react": "^18.0.25",
- "@types/react-dates": "^21.8.3",
"@types/react-is": "^16.7.5",
"@types/react-resizable": "^3.0.7",
- "@types/react-select": "^3.1.2",
"@types/react-syntax-highlighter": "^11.0.5",
"@types/react-test-renderer": "^16.9.0",
"@types/react-transition-group": "^4.4.5",
@@ -194,7 +183,7 @@
"@uiw/codemirror-extensions-langs": "^4.21.25",
"@uiw/codemirror-theme-github": "^4.21.25",
"@uiw/react-codemirror": "^4.21.25",
- "@vibe/config": "3.0.5",
+ "@vibe/config": "^4.0.0-rc.0",
"@vitejs/plugin-react": "^4.3.1",
"@vitest/coverage-v8": "^1.6.0",
"@vitest/ui": "^1.6.0",
@@ -265,14 +254,13 @@
"ts-morph": "^25.0.1",
"ts-node": "^10.9.2",
"tsx": "^4.20.3",
- "typescript": "^4.7.3",
+ "typescript": "^5.9.3",
"typescript-plugin-css-modules": "^4.2.1",
- "vibe-storybook-components": "1.0.7",
+ "vibe-storybook-components": "^4.0.0-rc.0",
"vite": "^5.3.1",
"vitest": "^1.6.0"
},
"peerDependencies": {
- "moment": "^2.29.1",
"react": ">=16.9.0",
"react-dom": ">=16.9.0"
},
diff --git a/packages/core/rollup.config.js b/packages/core/rollup.config.js
index 1894a5e643..b186c6bad3 100644
--- a/packages/core/rollup.config.js
+++ b/packages/core/rollup.config.js
@@ -100,7 +100,7 @@ export default {
testIds: path.join(SRC_PATH, "tests/test-ids-utils.ts"),
next: path.join(SRC_PATH, "components/next.ts")
},
- external: [/node_modules\/(?!monday-ui-style)(.*)/],
+ external: [/node_modules\/(?!@vibe\/style)(.*)/],
plugins: [
...(shouldMockModularClassnames
? [
@@ -176,7 +176,7 @@ export default {
copy({
targets: [
{
- src: "../../node_modules/monday-ui-style/dist/index.min.css",
+ src: "../../node_modules/@vibe/style/dist/index.min.css",
dest: "dist/tokens",
rename: () => "tokens.css"
},
diff --git a/packages/core/src/__tests__/__snapshots__/exports.test.ts.snap b/packages/core/src/__tests__/__snapshots__/exports.test.ts.snap
index 19a9c9df72..b2ee49832e 100644
--- a/packages/core/src/__tests__/__snapshots__/exports.test.ts.snap
+++ b/packages/core/src/__tests__/__snapshots__/exports.test.ts.snap
@@ -9,7 +9,6 @@ exports[`exports > should export all components 1`] = `
"AlertBannerLink",
"AlertBannerText",
"AttentionBox",
- "AttentionBoxLink",
"Avatar",
"AvatarGroup",
"Badge",
@@ -34,9 +33,6 @@ exports[`exports > should export all components 1`] = `
"DialogContentContainer",
"Divider",
"Dropdown",
- "DropdownMenu",
- "DropdownOption",
- "DropdownSingleValue",
"EditableHeading",
"EditableText",
"EmptyState",
@@ -51,7 +47,6 @@ exports[`exports > should export all components 1`] = `
"Info",
"Label",
"LayerProvider",
- "LinearProgressBar",
"Link",
"List",
"ListItem",
@@ -67,12 +62,17 @@ exports[`exports > should export all components 1`] = `
"MenuItemButton",
"MenuTitle",
"Modal",
+ "ModalBasicLayout",
"ModalContent",
"ModalFooter",
- "ModalFooterButtons",
+ "ModalFooterWizard",
"ModalHeader",
+ "ModalMedia",
+ "ModalMediaLayout",
+ "ModalSideBySideLayout",
"MultiStepIndicator",
"NumberField",
+ "ProgressBar",
"RadioButton",
"Search",
"Skeleton",
@@ -101,7 +101,6 @@ exports[`exports > should export all components 1`] = `
"ThemeProvider",
"Tipseen",
"TipseenContent",
- "TipseenImage",
"TipseenMedia",
"TipseenWizard",
"Toast",
@@ -130,9 +129,7 @@ exports[`exports > should export all hooks 1`] = `
"useIsMouseOver",
"useIsOverflowing",
"useKeyEvent",
- "useListenFocusTriggers",
"useMediaQuery",
- "useMergeRefs",
"usePrevious",
"useResizeObserver",
"useSetFocus",
@@ -145,21 +142,8 @@ exports[`exports > should export all hooks 1`] = `
exports[`exports > should export next all components 1`] = `
[
- "AttentionBox",
- "DatePicker",
- "Dialog",
- "Dropdown",
"List",
"ListItem",
"ListTitle",
- "Modal",
- "ModalBasicLayout",
- "ModalContent",
- "ModalFooter",
- "ModalFooterWizard",
- "ModalHeader",
- "ModalMedia",
- "ModalMediaLayout",
- "ModalSideBySideLayout",
]
`;
diff --git a/packages/core/src/components/Accordion/Accordion/Accordion.module.scss b/packages/core/src/components/Accordion/Accordion/Accordion.module.scss
index 77403e2ef7..1d89f50726 100644
--- a/packages/core/src/components/Accordion/Accordion/Accordion.module.scss
+++ b/packages/core/src/components/Accordion/Accordion/Accordion.module.scss
@@ -8,8 +8,7 @@
.accordion .accordionItemExpandCollapse {
border-radius: 0;
border-top: none;
- border-left: none;
- border-right: none;
+ border-inline: none;
border-color: var(--ui-border-color);
}
diff --git a/packages/core/src/components/AlertBanner/AlertBanner.module.scss b/packages/core/src/components/AlertBanner/AlertBanner.module.scss
index 595c0f409e..c85bf0dac1 100644
--- a/packages/core/src/components/AlertBanner/AlertBanner.module.scss
+++ b/packages/core/src/components/AlertBanner/AlertBanner.module.scss
@@ -38,7 +38,7 @@
min-width: 0;
align-items: center;
justify-content: center;
- padding-left: var(--spacing-medium);
+ padding-inline-start: var(--space-16);
}
.closeButtonWrapper {
@@ -50,7 +50,7 @@
.closeBtn {
position: absolute;
- right: 4px;
+ inset-inline-end: 4px;
top: 4px;
}
diff --git a/packages/core/src/components/AlertBanner/AlertBanner.tsx b/packages/core/src/components/AlertBanner/AlertBanner.tsx
index 2f1d78da06..3accbbdecb 100644
--- a/packages/core/src/components/AlertBanner/AlertBanner.tsx
+++ b/packages/core/src/components/AlertBanner/AlertBanner.tsx
@@ -3,7 +3,6 @@ import cx from "classnames";
import React, { type ForwardedRef, forwardRef, type ReactElement, useMemo } from "react";
import { IconButton } from "@vibe/icon-button";
import { CloseSmall } from "@vibe/icons";
-import { AlertBannerBackgroundColor as AlertBannerBackgroundColorEnum } from "./AlertBannerConstants";
import { type AlertBannerBackgroundColor } from "./AlertBanner.types";
import { NOOP } from "../../utils/function-utils";
import { type AlertBannerLinkProps } from "./AlertBannerLink/AlertBannerLink";
@@ -11,7 +10,7 @@ import { type AlertBannerButtonProps } from "./AlertBannerButton/AlertBannerButt
import { type AlertBannerTextProps } from "./AlertBannerText/AlertBannerText";
import { ComponentDefaultTestId, ComponentVibeId } from "../../tests/constants";
import { getTestId } from "../../tests/test-ids-utils";
-import { type VibeComponentProps, withStaticProps } from "../../types";
+import { type VibeComponentProps } from "../../types";
import styles from "./AlertBanner.module.scss";
import { Text } from "@vibe/typography";
import { AlertBannerContext } from "./AlertBannerContext";
@@ -30,7 +29,7 @@ export interface AlertBannerProps extends VibeComponentProps {
/**
* The ARIA label of the alert banner for accessibility.
*/
- ariaLabel?: string;
+ "aria-label"?: string;
/**
* The ARIA label of the close button for accessibility.
*/
@@ -52,7 +51,7 @@ const AlertBanner = forwardRef(
className,
backgroundColor = "primary",
onClose = NOOP,
- ariaLabel = "",
+ "aria-label": ariaLabel = "",
closeButtonAriaLabel = "Close",
isCloseHidden = false,
id,
@@ -145,7 +144,7 @@ const AlertBanner = forwardRef(
size="small"
kind="tertiary"
color={isDarkBackground ? "on-inverted-background" : "on-primary-color"}
- ariaLabel={closeButtonAriaLabel}
+ aria-label={closeButtonAriaLabel}
/>
)}
@@ -154,10 +153,4 @@ const AlertBanner = forwardRef(
}
);
-interface AlertBannerStaticProps {
- backgroundColors: typeof AlertBannerBackgroundColorEnum;
-}
-
-export default withStaticProps(AlertBanner, {
- backgroundColors: AlertBannerBackgroundColorEnum
-});
+export default AlertBanner;
diff --git a/packages/core/src/components/AlertBanner/AlertBannerButton/AlertBannerButton.module.scss b/packages/core/src/components/AlertBanner/AlertBannerButton/AlertBannerButton.module.scss
index 074d4ae115..9048472310 100644
--- a/packages/core/src/components/AlertBanner/AlertBannerButton/AlertBannerButton.module.scss
+++ b/packages/core/src/components/AlertBanner/AlertBannerButton/AlertBannerButton.module.scss
@@ -9,5 +9,5 @@
}
.marginLeft {
- margin-left: var(--spacing-small);
+ margin-inline-start: var(--space-8);
}
diff --git a/packages/core/src/components/AlertBanner/AlertBannerConstants.ts b/packages/core/src/components/AlertBanner/AlertBannerConstants.ts
deleted file mode 100644
index 5b717f02d3..0000000000
--- a/packages/core/src/components/AlertBanner/AlertBannerConstants.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-/**
- * @deprecated
- */
-export enum AlertBannerBackgroundColor {
- PRIMARY = "primary",
- POSITIVE = "positive",
- NEGATIVE = "negative",
- DARK = "dark",
- WARNING = "warning"
-}
diff --git a/packages/core/src/components/AlertBanner/AlertBannerLink/AlertBannerLink.module.scss b/packages/core/src/components/AlertBanner/AlertBannerLink/AlertBannerLink.module.scss
index 53596f03f5..b0311f19c4 100644
--- a/packages/core/src/components/AlertBanner/AlertBannerLink/AlertBannerLink.module.scss
+++ b/packages/core/src/components/AlertBanner/AlertBannerLink/AlertBannerLink.module.scss
@@ -13,5 +13,5 @@
}
.marginLeft {
- margin-left: var(--spacing-small);
+ margin-inline-start: var(--space-8);
}
diff --git a/packages/core/src/components/AlertBanner/AlertBannerText/AlertBannerText.module.scss b/packages/core/src/components/AlertBanner/AlertBannerText/AlertBannerText.module.scss
index 6d5b90525f..6689e502f2 100644
--- a/packages/core/src/components/AlertBanner/AlertBannerText/AlertBannerText.module.scss
+++ b/packages/core/src/components/AlertBanner/AlertBannerText/AlertBannerText.module.scss
@@ -5,5 +5,5 @@
}
.marginLeft {
- margin-left: var(--spacing-small);
+ margin-inline-start: var(--space-8);
}
diff --git a/packages/core/src/components/AlertBanner/__tests__/AlertBanner.snapshot.test.tsx b/packages/core/src/components/AlertBanner/__tests__/AlertBanner.snapshot.test.tsx
index 36672e4873..5cbde309b0 100644
--- a/packages/core/src/components/AlertBanner/__tests__/AlertBanner.snapshot.test.tsx
+++ b/packages/core/src/components/AlertBanner/__tests__/AlertBanner.snapshot.test.tsx
@@ -19,7 +19,7 @@ describe("AlertBanner", () => {
diff --git a/packages/core/src/components/AlertBanner/__tests__/AlertBanner.test.tsx b/packages/core/src/components/AlertBanner/__tests__/AlertBanner.test.tsx
index 2777b5018f..5b89ece55e 100644
--- a/packages/core/src/components/AlertBanner/__tests__/AlertBanner.test.tsx
+++ b/packages/core/src/components/AlertBanner/__tests__/AlertBanner.test.tsx
@@ -39,7 +39,7 @@ describe("", () => {
describe("a11y", () => {
it("should add the label", () => {
const ariaLabel = "Lable Name";
- const { getByLabelText } = render();
+ const { getByLabelText } = render();
const alertBannerComponentLabel = getByLabelText(ariaLabel);
expect(alertBannerComponentLabel).toBeTruthy();
});
diff --git a/packages/core/src/components/AttentionBox/AttentionBox.module.scss b/packages/core/src/components/AttentionBox/AttentionBox.module.scss
index 94425c6bad..48de2c4698 100644
--- a/packages/core/src/components/AttentionBox/AttentionBox.module.scss
+++ b/packages/core/src/components/AttentionBox/AttentionBox.module.scss
@@ -1,100 +1,45 @@
-@keyframes entryAnimation {
+@keyframes attentionBoxAnimation {
0% {
- transform: translateY(-10px);
opacity: 0;
+ transform: translateY(-10px);
}
50% {
opacity: 1;
}
100% {
- transform: translateX(0);
opacity: 1;
+ transform: translateY(0);
}
}
-.attentionBox {
- position: relative;
- padding: 12px var(--spacing-medium);
+.attention {
+ width: 100%;
border-radius: var(--border-radius-medium);
- width: fit-content;
- max-width: 100%;
- height: fit-content;
+ padding: var(--space-12) var(--space-16);
+ position: relative;
+ overflow: hidden;
- &.entryAnimation {
- animation: entryAnimation 200ms cubic-bezier(0.00, 0.00, 0.40, 1.00) forwards;
+ &.animate {
+ animation: attentionBoxAnimation 200ms var(--motion-timing-transition);
}
- // Overriding on primary icon color should be with bigger specificity than the original color
- & .closeIconWrapper .closeIcon {
- color: var(--primary-text-color);
+ &.primary {
+ background-color: var(--primary-selected-color);
}
- .icon {
- flex-shrink: 0;
+ &.positive {
+ background-color: var(--positive-color-selected);
}
-}
-
-.title {
- margin: 0;
- padding-right: var(--spacing-xl);
-}
-
-.text,
-.titleContainer {
- color: var(--primary-text-color);
-}
-
-.typePrimary {
- color: var(--primary-text-color);
- background-color: var(--primary-selected-color);
-}
-
-.typeDanger {
- background-color: var(--negative-color-selected);
-}
-
-.typeSuccess {
- background-color: var(--positive-color-selected);
-}
-
-.typeDark {
- background-color: var(--ui-background-color);
- color: var(--primary-text-color);
-}
-
-.typeWarning {
- background-color: var(--warning-color-selected);
- color: var(--primary-text-color);
-}
-
-.titleContainer {
- margin-bottom: var(--spacing-xs);
-}
-.titleContainer:empty {
- margin-bottom: 0;
-}
-
-.closeIconWrapper {
- position: absolute;
- top: 12px;
- right: 12px;
-}
-
-.closeIconCompact {
- top: calc(50% - 16px);
-}
-
-.text {
- &.compact {
- flex: 1;
+ &.negative {
+ background-color: var(--negative-color-selected);
+ }
- &.dismissible {
- padding-right: var(--spacing-xl);
- }
+ &.warning {
+ background-color: var(--warning-color-selected);
}
- &.paragraph {
- margin: 0 var(--spacing-medium) 0 0;
+ &.neutral {
+ background-color: var(--allgrey-background-color);
}
}
diff --git a/packages/core/src/components/AttentionBox/AttentionBox.tsx b/packages/core/src/components/AttentionBox/AttentionBox.tsx
index 0cd4d501b2..c6edae9356 100644
--- a/packages/core/src/components/AttentionBox/AttentionBox.tsx
+++ b/packages/core/src/components/AttentionBox/AttentionBox.tsx
@@ -1,167 +1,74 @@
+import React, { forwardRef } from "react";
import cx from "classnames";
-import React, { useMemo } from "react";
-import { camelCase } from "es-toolkit";
-import { getStyle } from "../../helpers/typesciptCssModulesHelper";
-import { ComponentDefaultTestId, getTestId } from "../../tests/test-ids-utils";
-import { Icon, type SubIcon } from "@vibe/icon";
-import { IconButton } from "@vibe/icon-button";
-import { CloseSmall, Alert as AlertIcon, Info as InfoIcon } from "@vibe/icons";
-import { AttentionBoxType as AttentionBoxTypeEnum, IconTypeEnum } from "./AttentionBoxConstants";
-import { type AttentionBoxType } from "./AttentionBox.types";
-import { type VibeComponentProps, type ElementContent, withStaticPropsWithoutForwardRef } from "../../types";
-import { Text } from "@vibe/typography";
-import { Flex } from "@vibe/layout";
+import type { AttentionBoxProps, AttentionBoxRole } from "./AttentionBox.types";
+import AttentionBoxDefault from "./layouts/AttentionBoxDefault/AttentionBoxDefault";
+import AttentionBoxCompact from "./layouts/AttentionBoxCompact/AttentionBoxCompact";
+import { resolveAttentionBoxIcon } from "./utils/iconUtils";
+import { ComponentDefaultTestId, ComponentVibeId } from "../../tests/constants";
+import { getTestId } from "../../tests/test-ids-utils";
import styles from "./AttentionBox.module.scss";
-import { ComponentVibeId } from "../../tests/constants";
-/**
- * @deprecated AttentionBox is deprecated. Please use AttentionBox from "@vibe/core/next" instead.
- */
-export interface AttentionBoxProps extends VibeComponentProps {
- // TODO: [breaking] remove prop
- /**
- * If true, displays an icon even when no header is provided.
- */
- withIconWithoutHeader?: boolean;
- /**
- * The type of the AttentionBox.
- */
- type?: AttentionBoxType;
- /**
- * The icon displayed next to the title or text.
- */
- icon?: SubIcon;
- /**
- * The type of the icon.
- */
- iconType?: "svg" | "font";
- /**
- * The title of the component.
- */
- title?: string;
- /**
- * The text content displayed inside.
- */
- text?: string;
- /**
- * The content of the component.
- */
- children?: ElementContent;
- // TODO: [breaking] remove prop
- /**
- * If true, the icon is not displayed.
- */
- withoutIcon?: boolean;
- /**
- * Callback fired when the close button is clicked.
- */
- onClose?: (event: React.MouseEvent) => void;
- /**
- * If true, renders in compact mode.
- */
- compact?: boolean;
- /**
- * The label of the close button.
- */
- closeButtonAriaLabel?: string;
- /**
- * If true, an entry animation is applied when the component appears.
- */
- entryAnimation?: boolean;
-}
+const AttentionBox = forwardRef(
+ (
+ {
+ compact = false,
+ title,
+ animate = true,
+ icon,
+ iconType = "svg",
+ type = "primary",
+ children,
+ text,
+ action,
+ link,
+ id,
+ onClose,
+ closeButtonAriaLabel,
+ className,
+ "data-testid": dataTestId
+ }: AttentionBoxProps,
+ ref: React.ForwardedRef
+ ) => {
+ const role: AttentionBoxRole = type === "negative" ? "alert" : "status";
+ const displayIcon = resolveAttentionBoxIcon(icon, type);
+ const content = children || text;
-/**
- * @deprecated AttentionBox is deprecated. Please use AttentionBox from "@vibe/core/next" instead.
- */
-const AttentionBox = ({
- className,
- withIconWithoutHeader = false,
- type = "primary",
- icon,
- iconType = "svg",
- title,
- text,
- children,
- withoutIcon = false,
- onClose,
- compact = false,
- id,
- "data-testid": dataTestId,
- closeButtonAriaLabel = "Close",
- entryAnimation = false
-}: AttentionBoxProps) => {
- const defaultIcon = useMemo(() => {
- return type === "primary" ? InfoIcon : AlertIcon;
- }, [type]);
+ const baseClasses = cx(
+ styles.attention,
+ styles[type],
+ {
+ [styles.animate]: animate
+ },
+ className
+ );
- const overrideIcon = icon === undefined ? defaultIcon : icon;
+ const layoutSharedProps = {
+ onClose,
+ closeButtonAriaLabel,
+ action,
+ link,
+ icon: displayIcon,
+ iconType,
+ content
+ };
- return (
-