diff --git a/apps/website/screens/common/StatusBadge.tsx b/apps/website/screens/common/StatusBadge.tsx index 36eff8b26..6a1e30a64 100644 --- a/apps/website/screens/common/StatusBadge.tsx +++ b/apps/website/screens/common/StatusBadge.tsx @@ -9,17 +9,17 @@ type StatusBadgeProps = { const getBadgeColor = (status: StatusBadgeProps["status"]) => { switch (status) { case "required": - return "orange"; + return "warning"; case "experimental": - return "blue"; + return "secondary"; case "new": - return "purple"; + return "primary"; case "stable": - return "green"; + return "success"; case "legacy": - return "yellow"; + return "tertiary"; default: - return "grey"; + return "neutral"; } }; diff --git a/apps/website/screens/common/sidenav/SidenavLogo.tsx b/apps/website/screens/common/sidenav/SidenavLogo.tsx index acaa8d207..8be159388 100644 --- a/apps/website/screens/common/sidenav/SidenavLogo.tsx +++ b/apps/website/screens/common/sidenav/SidenavLogo.tsx @@ -42,7 +42,7 @@ const SidenavLogo = ({ subtitle = "Design System" }: { subtitle?: string }) => { {subtitle} diff --git a/apps/website/screens/components/accordion/code/examples/accordions.tsx b/apps/website/screens/components/accordion/code/examples/accordions.tsx index ff6402a32..28fe9f6f4 100644 --- a/apps/website/screens/components/accordion/code/examples/accordions.tsx +++ b/apps/website/screens/components/accordion/code/examples/accordions.tsx @@ -7,7 +7,7 @@ const code = `() => { }} + badge={{ position: "before", element: }} statusLight={} > @@ -17,7 +17,7 @@ const code = `() => { }} + badge={{ position: "before", element: }} defaultIsExpanded > @@ -26,7 +26,7 @@ const code = `() => { }} + badge={{ position: "before", element: }} statusLight={} defaultIsExpanded > diff --git a/apps/website/screens/components/accordion/code/examples/badgeStatusLight.tsx b/apps/website/screens/components/accordion/code/examples/badgeStatusLight.tsx index ca034c1f2..cc09cdc7c 100644 --- a/apps/website/screens/components/accordion/code/examples/badgeStatusLight.tsx +++ b/apps/website/screens/components/accordion/code/examples/badgeStatusLight.tsx @@ -7,7 +7,7 @@ const code = `() => { }} + badge={{ position: "before", element: }} statusLight={} > diff --git a/apps/website/screens/components/accordion/overview/AccordionOverviewPage.tsx b/apps/website/screens/components/accordion/overview/AccordionOverviewPage.tsx index d25c10ce4..7835c3bae 100644 --- a/apps/website/screens/components/accordion/overview/AccordionOverviewPage.tsx +++ b/apps/website/screens/components/accordion/overview/AccordionOverviewPage.tsx @@ -256,8 +256,8 @@ const sections = [ Always prioritize the visibility of mandatory elements like the title over optional elements. - If both a badge and a status light are present, avoid applying semantic colors (e.g., red, green) to the - badge to prevent visual conflict with the status indicator. + If both a badge and a status light are present, avoid applying semantic colors to the badge to prevent + visual conflict with the status indicator. Maintain consistency in layout and alignment to support content scanning, especially when multiple diff --git a/apps/website/screens/components/accordion/overview/examples/basicExample.tsx b/apps/website/screens/components/accordion/overview/examples/basicExample.tsx index 093825814..be7d6eb7a 100644 --- a/apps/website/screens/components/accordion/overview/examples/basicExample.tsx +++ b/apps/website/screens/components/accordion/overview/examples/basicExample.tsx @@ -48,7 +48,7 @@ const code = `() => { }} + badge={{ position: "after", element: }} label="Life Policy" subLabel="Ref — 1236554546" > diff --git a/apps/website/screens/components/badge/code/BadgeCodePage.tsx b/apps/website/screens/components/badge/code/BadgeCodePage.tsx index 4ecb5b374..7c63d52a7 100644 --- a/apps/website/screens/components/badge/code/BadgeCodePage.tsx +++ b/apps/website/screens/components/badge/code/BadgeCodePage.tsx @@ -6,6 +6,7 @@ import Example from "@/common/example/Example"; import contextual from "./examples/contextual"; import notification from "./examples/notification"; import icons from "./examples/icons"; +import StatusBadge from "@/common/StatusBadge"; const sections = [ { @@ -22,13 +23,20 @@ const sections = [ - color - 'grey' | 'blue' | 'green' | 'orange' | 'red' | 'yellow' | 'purple' + + + color + + + + + 'primary' | 'secondary' | 'tertiary' | 'success' | 'info' | 'neutral' | 'warning' | 'error' + Affects the visual style of the badge. It can be used following semantic purposes or not. - 'grey' + 'neutral' diff --git a/apps/website/screens/components/badge/code/examples/contextual.tsx b/apps/website/screens/components/badge/code/examples/contextual.tsx index 058353dc0..b5d1120bc 100644 --- a/apps/website/screens/components/badge/code/examples/contextual.tsx +++ b/apps/website/screens/components/badge/code/examples/contextual.tsx @@ -6,12 +6,12 @@ const code = `() => { - - - - - - + + + + + + ); diff --git a/apps/website/screens/components/badge/code/examples/icons.tsx b/apps/website/screens/components/badge/code/examples/icons.tsx index 389e2f973..67a03ac10 100644 --- a/apps/website/screens/components/badge/code/examples/icons.tsx +++ b/apps/website/screens/components/badge/code/examples/icons.tsx @@ -20,12 +20,12 @@ const code = `() => { - - - - - - + + + + + + ); diff --git a/apps/website/screens/components/badge/overview/BadgeOverviewPage.tsx b/apps/website/screens/components/badge/overview/BadgeOverviewPage.tsx index f607c7093..7874e9f6d 100644 --- a/apps/website/screens/components/badge/overview/BadgeOverviewPage.tsx +++ b/apps/website/screens/components/badge/overview/BadgeOverviewPage.tsx @@ -64,7 +64,8 @@ const sections = [ have been made to a certain section of the interface. - Only one color is allowed for this badge, which is red, and cannot be changed by any means. + Only one color is allowed for this badge, which is the semantic error (generally red), and cannot be + changed by any means. ), @@ -94,14 +95,14 @@ const sections = [ colors are available: - Green: positive actions, such as approved, completed, success... + Success: positive actions, such as approved, completed, success... - Blue: informative actions, such as published, in use... + Info: informative actions, such as published, in use... - Red: negative actions, such as error, rejection, incomplete... + Warning: alert actions, such as pending or paused actions... - Orange: alert actions, such as pending or paused actions... + Error: negative actions, such as error, rejection, incomplete... diff --git a/apps/website/screens/components/badge/overview/examples/contextual.tsx b/apps/website/screens/components/badge/overview/examples/contextual.tsx index 0fe4b0c6d..5a2475e7e 100644 --- a/apps/website/screens/components/badge/overview/examples/contextual.tsx +++ b/apps/website/screens/components/badge/overview/examples/contextual.tsx @@ -6,21 +6,21 @@ const code = `() => { - - - - - - + + + + + + - - - - - - + + + + + + diff --git a/apps/website/screens/components/button/overview/ButtonOverviewPage.tsx b/apps/website/screens/components/button/overview/ButtonOverviewPage.tsx index 45a934713..5eca38f50 100644 --- a/apps/website/screens/components/button/overview/ButtonOverviewPage.tsx +++ b/apps/website/screens/components/button/overview/ButtonOverviewPage.tsx @@ -168,8 +168,8 @@ const sections = [ - Indicates a destructive action or highlights a critical issue. Styled in red. Use for actions like - "Delete", "Remove" or "Cancel Subscription.". + Indicates a destructive action or highlights a critical issue. Use for actions like "Delete", "Remove" + or "Cancel Subscription.". @@ -179,8 +179,8 @@ const sections = [ - Provides additional information or context. Shown in blue, the brand's secondary color. Use for actions - like "More Info", "Details" or "Learn More.". + Provides additional information or context. Use for actions like "More Info", "Details" or "Learn + More.". @@ -190,8 +190,8 @@ const sections = [ - Represents a positive action or confirms the completion of a task. Styled in green. Use for actions like - "Confirm", "Complete" or "Approve.". + Represents a positive action or confirms the completion of a task. Use for actions like "Confirm", + "Complete" or "Approve.". @@ -201,8 +201,8 @@ const sections = [ - Alerts the user to potential issues or actions that need caution. Styled in orange. Use for actions like - "Warning" or "Attention Needed.". + Alerts the user to potential issues or actions that need caution. Use for actions like "Warning" or + "Attention Needed.". diff --git a/apps/website/screens/components/contextual-menu/code/examples/navigationMenu.tsx b/apps/website/screens/components/contextual-menu/code/examples/navigationMenu.tsx index ad5b27aad..25583e915 100644 --- a/apps/website/screens/components/contextual-menu/code/examples/navigationMenu.tsx +++ b/apps/website/screens/components/contextual-menu/code/examples/navigationMenu.tsx @@ -15,7 +15,7 @@ const code = `() => { items: [ { label: "Sales data module", - badge: , + badge: , }, { label: "Central platform" }, ], diff --git a/apps/website/screens/components/radio-group/overview/examples/stacking.tsx b/apps/website/screens/components/radio-group/overview/examples/stacking.tsx index a1ff47f98..89e69a246 100644 --- a/apps/website/screens/components/radio-group/overview/examples/stacking.tsx +++ b/apps/website/screens/components/radio-group/overview/examples/stacking.tsx @@ -4,7 +4,7 @@ const code = `() => { const options = [ { label: "Red", value: "red" }, { label: "Blue", value: "blue" }, - { label: "Green", value: "gree" }, + { label: "Green", value: "green" }, ]; return ( diff --git a/apps/website/screens/foundations/color/ColorPage.tsx b/apps/website/screens/foundations/color/ColorPage.tsx index 43635d480..f98df32d8 100644 --- a/apps/website/screens/foundations/color/ColorPage.tsx +++ b/apps/website/screens/foundations/color/ColorPage.tsx @@ -184,16 +184,20 @@ const sections = [ - Green — Success: Communicates successful operations, confirmations, or valid states. It + Success: Communicates successful operations, confirmations, or valid states. It reassures users and reinforces positive outcomes. - Orange — Warning: Used for cautionary messages or potential risks that don't block - progress but may require attention. + Info: Provides additional information, guidance, or context that helps users understand + the current state or available options. - Red — Error: Indicates destructive actions, form validation errors, or system failures. - It draws immediate attention and signals that something needs user correction or caution. + Warning: Used for cautionary messages or potential risks that don't block progress but + may require attention. + + + Error: Indicates destructive actions, form validation errors, or system failures. It + draws immediate attention and signals that something needs user correction or caution. diff --git a/packages/lib/src/accordion/Accordion.stories.tsx b/packages/lib/src/accordion/Accordion.stories.tsx index b67f380ee..6cbaa6bb9 100644 --- a/packages/lib/src/accordion/Accordion.stories.tsx +++ b/packages/lib/src/accordion/Accordion.stories.tsx @@ -238,7 +238,7 @@ const Accordion = () => ( }} + badge={{ position: "before", element: }} statusLight={} > @@ -249,7 +249,7 @@ const Accordion = () => ( }} + badge={{ position: "before", element: }} > Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit @@ -258,7 +258,7 @@ const Accordion = () => ( }} + badge={{ position: "before", element: }} statusLight={} > @@ -337,7 +337,7 @@ const Accordion = () => ( }} + badge={{ position: "after", element: }} > To edit your profile you need to go to Settings and click on Profile. @@ -416,7 +416,7 @@ const Accordion = () => ( label="Assure Claims" subLabel="Jan, 09 2025" disabled - badge={{ position: "before", element: }} + badge={{ position: "before", element: }} statusLight={} > @@ -431,7 +431,7 @@ const Accordion = () => ( subLabel="Jan, 09 2025" icon="heart_plus" disabled - badge={{ position: "after", element: }} + badge={{ position: "after", element: }} > Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit @@ -445,7 +445,7 @@ const Accordion = () => ( }} + badge={{ position: "before", element: }} statusLight={} > @@ -456,7 +456,7 @@ const Accordion = () => ( }} + badge={{ position: "before", element: }} > Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit @@ -465,7 +465,7 @@ const Accordion = () => ( }} + badge={{ position: "before", element: }} statusLight={} > diff --git a/packages/lib/src/accordion/AccordionItem.tsx b/packages/lib/src/accordion/AccordionItem.tsx index 51323530c..cbae646b3 100644 --- a/packages/lib/src/accordion/AccordionItem.tsx +++ b/packages/lib/src/accordion/AccordionItem.tsx @@ -186,7 +186,7 @@ const AccordionItem = ({ ) : ( - {disabled ? cloneElement(badge?.element as ReactElement, { color: "grey" }) : badge?.element} + {disabled ? cloneElement(badge?.element as ReactElement, { color: "neutral" }) : badge?.element} )} @@ -204,7 +204,7 @@ const AccordionItem = ({ )} {badge && badge?.position === "after" && !assistiveText && ( - {disabled ? cloneElement(badge.element as ReactElement, { color: "grey" }) : badge.element} + {disabled ? cloneElement(badge.element as ReactElement, { color: "neutral" }) : badge.element} )} {badge?.position !== "after" && statusLight && !assistiveText && ( diff --git a/packages/lib/src/badge/Badge.accessibility.test.tsx b/packages/lib/src/badge/Badge.accessibility.test.tsx index 1d2bf440e..10973058f 100644 --- a/packages/lib/src/badge/Badge.accessibility.test.tsx +++ b/packages/lib/src/badge/Badge.accessibility.test.tsx @@ -15,13 +15,13 @@ describe("Badge component accessibility tests", () => { it("Should not have basic accessibility issues for contextual mode", async () => { const { container } = render( - - - - - - - + + + + + + + ); const results = await axe(container); diff --git a/packages/lib/src/badge/Badge.stories.tsx b/packages/lib/src/badge/Badge.stories.tsx index a27a98444..c262cec79 100644 --- a/packages/lib/src/badge/Badge.stories.tsx +++ b/packages/lib/src/badge/Badge.stories.tsx @@ -54,158 +54,180 @@ const Badge = () => ( - <Title title="Grey" theme="light" level={3} /> + <Title title="Primary" theme="light" level={3} /> <ExampleContainer> <Title title="Small" theme="light" level={4} /> <DxcFlex gap="var(--spacing-gap-xl)" alignItems="center"> - <DxcBadge label="Label" size="small" /> - <DxcBadge label="Label" size="small" icon={icon} /> + <DxcBadge color="primary" label="Label" size="small" /> + <DxcBadge color="primary" label="Label" size="small" icon="done" /> </DxcFlex> </ExampleContainer> <ExampleContainer> <Title title="Medium" theme="light" level={4} /> <DxcFlex gap="var(--spacing-gap-xl)" alignItems="center"> - <DxcBadge label="Label" /> - <DxcBadge label="Label" icon="done" /> + <DxcBadge color="primary" label="Label" /> + <DxcBadge color="primary" label="Label" icon={icon} /> </DxcFlex> </ExampleContainer> <ExampleContainer> <Title title="Large" theme="light" level={4} /> <DxcFlex gap="var(--spacing-gap-xl)" alignItems="center"> - <DxcBadge label="Label" size="large" /> - <DxcBadge label="Label" size="large" icon="done" /> + <DxcBadge color="primary" label="Label" size="large" /> + <DxcBadge color="primary" label="Label" size="large" icon={icon} /> </DxcFlex> </ExampleContainer> - <Title title="Blue" theme="light" level={3} /> + <Title title="Secondary" theme="light" level={3} /> <ExampleContainer> <Title title="Small" theme="light" level={4} /> <DxcFlex gap="var(--spacing-gap-xl)" alignItems="center"> - <DxcBadge color="blue" label="Label" size="small" /> - <DxcBadge color="blue" label="Label" size="small" icon="done" /> + <DxcBadge color="secondary" label="Label" size="small" /> + <DxcBadge color="secondary" label="Label" size="small" icon="done" /> + </DxcFlex> + <ExampleContainer> + <Title title="Medium" theme="light" level={4} /> + <DxcFlex gap="var(--spacing-gap-xl)" alignItems="center"> + <DxcBadge color="secondary" label="Label" /> + <DxcBadge color="secondary" label="Label" icon={icon} /> + </DxcFlex> + </ExampleContainer> + <ExampleContainer> + <Title title="Large" theme="light" level={4} /> + <DxcFlex gap="var(--spacing-gap-xl)" alignItems="center"> + <DxcBadge color="secondary" label="Label" size="large" /> + <DxcBadge color="secondary" label="Label" size="large" icon={icon} /> + </DxcFlex> + </ExampleContainer> + </ExampleContainer> + <Title title="Tertiary" theme="light" level={3} /> + <ExampleContainer> + <Title title="Small" theme="light" level={4} /> + <DxcFlex gap="var(--spacing-gap-xl)" alignItems="center"> + <DxcBadge color="tertiary" label="Label" size="small" /> + <DxcBadge color="tertiary" label="Label" size="small" icon="done" /> </DxcFlex> </ExampleContainer> <ExampleContainer> <Title title="Medium" theme="light" level={4} /> <DxcFlex gap="var(--spacing-gap-xl)" alignItems="center"> - <DxcBadge color="blue" label="Label" /> - <DxcBadge color="blue" label="Label" icon={icon} /> + <DxcBadge color="tertiary" label="Label" /> + <DxcBadge color="tertiary" label="Label" icon={icon} /> </DxcFlex> </ExampleContainer> <ExampleContainer> <Title title="Large" theme="light" level={4} /> <DxcFlex gap="var(--spacing-gap-xl)" alignItems="center"> - <DxcBadge color="blue" label="Label" size="large" /> - <DxcBadge color="blue" label="Label" size="large" icon={icon} /> + <DxcBadge color="tertiary" label="Label" size="large" /> + <DxcBadge color="tertiary" label="Label" size="large" icon="done" /> </DxcFlex> </ExampleContainer> - <Title title="Green" theme="light" level={3} /> + <Title title="Success" theme="light" level={3} /> <ExampleContainer> <Title title="Small" theme="light" level={4} /> <DxcFlex gap="var(--spacing-gap-xl)" alignItems="center"> - <DxcBadge color="green" label="Label" size="small" /> - <DxcBadge color="green" label="Label" size="small" icon="done" /> + <DxcBadge color="success" label="Label" size="small" /> + <DxcBadge color="success" label="Label" size="small" icon="done" /> </DxcFlex> </ExampleContainer> <ExampleContainer> <Title title="Medium" theme="light" level={4} /> <DxcFlex gap="var(--spacing-gap-xl)" alignItems="center"> - <DxcBadge color="green" label="Label" /> - <DxcBadge color="green" label="Label" icon="done" /> + <DxcBadge color="success" label="Label" /> + <DxcBadge color="success" label="Label" icon="done" /> </DxcFlex> </ExampleContainer> <ExampleContainer> <Title title="Large" theme="light" level={4} /> <DxcFlex gap="var(--spacing-gap-xl)" alignItems="center"> - <DxcBadge color="green" label="Label" size="large" /> - <DxcBadge color="green" label="Label" size="large" icon={icon} /> + <DxcBadge color="success" label="Label" size="large" /> + <DxcBadge color="success" label="Label" size="large" icon={icon} /> </DxcFlex> </ExampleContainer> - <Title title="Orange" theme="light" level={3} /> + <Title title="Info" theme="light" level={3} /> <ExampleContainer> <Title title="Small" theme="light" level={4} /> <DxcFlex gap="var(--spacing-gap-xl)" alignItems="center"> - <DxcBadge color="orange" label="Label" size="small" /> - <DxcBadge color="orange" label="Label" size="small" icon="done" /> + <DxcBadge color="info" label="Label" size="small" /> + <DxcBadge color="info" label="Label" size="small" icon={icon} /> </DxcFlex> </ExampleContainer> <ExampleContainer> <Title title="Medium" theme="light" level={4} /> <DxcFlex gap="var(--spacing-gap-xl)" alignItems="center"> - <DxcBadge color="orange" label="Label" /> - <DxcBadge color="orange" label="Label" icon={icon} /> + <DxcBadge color="info" label="Label" /> + <DxcBadge color="info" label="Label" icon="done" /> </DxcFlex> </ExampleContainer> <ExampleContainer> <Title title="Large" theme="light" level={4} /> <DxcFlex gap="var(--spacing-gap-xl)" alignItems="center"> - <DxcBadge color="orange" label="Label" size="large" /> - <DxcBadge color="orange" label="Label" size="large" icon={icon} /> + <DxcBadge color="info" label="Label" size="large" /> + <DxcBadge color="info" label="Label" size="large" icon={icon} /> </DxcFlex> </ExampleContainer> - <Title title="Red" theme="light" level={3} /> + <Title title="Neutral" theme="light" level={3} /> <ExampleContainer> <Title title="Small" theme="light" level={4} /> <DxcFlex gap="var(--spacing-gap-xl)" alignItems="center"> - <DxcBadge color="red" label="Label" size="small" /> - <DxcBadge color="red" label="Label" size="small" icon="done" /> + <DxcBadge label="Label" size="small" /> + <DxcBadge label="Label" size="small" icon={icon} /> </DxcFlex> </ExampleContainer> <ExampleContainer> <Title title="Medium" theme="light" level={4} /> <DxcFlex gap="var(--spacing-gap-xl)" alignItems="center"> - <DxcBadge color="red" label="Label" /> - <DxcBadge color="red" label="Label" icon="done" /> + <DxcBadge label="Label" /> + <DxcBadge label="Label" icon="done" /> </DxcFlex> </ExampleContainer> <ExampleContainer> <Title title="Large" theme="light" level={4} /> <DxcFlex gap="var(--spacing-gap-xl)" alignItems="center"> - <DxcBadge color="red" label="Label" size="large" /> - <DxcBadge color="red" label="Label" size="large" icon={icon} /> + <DxcBadge label="Label" size="large" /> + <DxcBadge label="Label" size="large" icon="done" /> </DxcFlex> </ExampleContainer> - <Title title="Yellow" theme="light" level={3} /> + <Title title="Warning" theme="light" level={3} /> <ExampleContainer> <Title title="Small" theme="light" level={4} /> <DxcFlex gap="var(--spacing-gap-xl)" alignItems="center"> - <DxcBadge color="yellow" label="Label" size="small" /> - <DxcBadge color="yellow" label="Label" size="small" icon="done" /> + <DxcBadge color="warning" label="Label" size="small" /> + <DxcBadge color="warning" label="Label" size="small" icon="done" /> </DxcFlex> </ExampleContainer> <ExampleContainer> <Title title="Medium" theme="light" level={4} /> <DxcFlex gap="var(--spacing-gap-xl)" alignItems="center"> - <DxcBadge color="yellow" label="Label" /> - <DxcBadge color="yellow" label="Label" icon={icon} /> + <DxcBadge color="warning" label="Label" /> + <DxcBadge color="warning" label="Label" icon={icon} /> </DxcFlex> </ExampleContainer> <ExampleContainer> <Title title="Large" theme="light" level={4} /> <DxcFlex gap="var(--spacing-gap-xl)" alignItems="center"> - <DxcBadge color="yellow" label="Label" size="large" /> - <DxcBadge color="yellow" label="Label" size="large" icon="done" /> + <DxcBadge color="warning" label="Label" size="large" /> + <DxcBadge color="warning" label="Label" size="large" icon={icon} /> </DxcFlex> </ExampleContainer> - <Title title="Purple" theme="light" level={3} /> + <Title title="Error" theme="light" level={3} /> <ExampleContainer> <Title title="Small" theme="light" level={4} /> <DxcFlex gap="var(--spacing-gap-xl)" alignItems="center"> - <DxcBadge color="purple" label="Label" size="small" /> - <DxcBadge color="purple" label="Label" size="small" icon="done" /> + <DxcBadge color="error" label="Label" size="small" /> + <DxcBadge color="error" label="Label" size="small" icon="done" /> </DxcFlex> </ExampleContainer> <ExampleContainer> <Title title="Medium" theme="light" level={4} /> <DxcFlex gap="var(--spacing-gap-xl)" alignItems="center"> - <DxcBadge color="purple" label="Label" /> - <DxcBadge color="purple" label="Label" icon={icon} /> + <DxcBadge color="error" label="Label" /> + <DxcBadge color="error" label="Label" icon="done" /> </DxcFlex> </ExampleContainer> <ExampleContainer> <Title title="Large" theme="light" level={4} /> <DxcFlex gap="var(--spacing-gap-xl)" alignItems="center"> - <DxcBadge color="purple" label="Label" size="large" /> - <DxcBadge color="purple" label="Label" size="large" icon={icon} /> + <DxcBadge color="error" label="Label" size="large" /> + <DxcBadge color="error" label="Label" size="large" icon={icon} /> </DxcFlex> </ExampleContainer> </> diff --git a/packages/lib/src/badge/Badge.tsx b/packages/lib/src/badge/Badge.tsx index 2e9d4039b..cdcb0e892 100644 --- a/packages/lib/src/badge/Badge.tsx +++ b/packages/lib/src/badge/Badge.tsx @@ -4,34 +4,38 @@ import DxcIcon from "../icon/Icon"; import { Tooltip } from "../tooltip/Tooltip"; const contextualColorMap = { - grey: { - background: "var(--color-bg-neutral-light)", - text: "var(--color-fg-neutral-strongest)", + primary: { + background: "var(--color-bg-primary-lighter)", + text: "var(--color-fg-primary-stronger)", }, - blue: { + secondary: { background: "var(--color-bg-secondary-lighter)", text: "var(--color-fg-secondary-stronger)", }, - green: { + tertiary: { + background: "var(--color-bg-yellow-light)", + text: "var(--color-fg-neutral-yellow-dark)", + }, + success: { background: "var(--color-bg-success-lighter)", text: "var(--color-fg-success-stronger)", }, - orange: { + info: { + background: "var(--color-bg-info-lighter)", + text: "var(--color-fg-info-stronger)", + }, + neutral: { + background: "var(--color-bg-neutral-light)", + text: "var(--color-fg-neutral-strongest)", + }, + warning: { background: "var(--color-bg-warning-lighter)", text: "var(--color-fg-warning-stronger)", }, - red: { + error: { background: "var(--color-bg-error-lighter)", text: "var(--color-fg-error-stronger)", }, - yellow: { - background: "var(--color-bg-yellow-light)", - text: "var(--color-fg-neutral-yellow-dark)", - }, - purple: { - background: "var(--color-bg-primary-lighter)", - text: "var(--color-fg-primary-stronger)", - }, }; const notificationColor = { @@ -136,7 +140,7 @@ const DxcBadge = ({ label, title, mode = "contextual", - color = "grey", + color = "neutral", icon, notificationLimit = 99, size = "medium", diff --git a/packages/lib/src/badge/types.ts b/packages/lib/src/badge/types.ts index 5a16f89cf..d9c3b7c59 100644 --- a/packages/lib/src/badge/types.ts +++ b/packages/lib/src/badge/types.ts @@ -16,7 +16,7 @@ export type ContextualProps = { /** * Affects the visual style of the badge. It can be used following semantic purposes or not. */ - color?: "grey" | "blue" | "green" | "orange" | "red" | "yellow" | "purple"; + color?: "primary" | "secondary" | "tertiary" | "success" | "info" | "neutral" | "warning" | "error"; }; export type NotificationProps = { diff --git a/packages/lib/src/contextual-menu/ContextualMenu.accessibility.test.tsx b/packages/lib/src/contextual-menu/ContextualMenu.accessibility.test.tsx index 5f546dbcf..1dab5f698 100644 --- a/packages/lib/src/contextual-menu/ContextualMenu.accessibility.test.tsx +++ b/packages/lib/src/contextual-menu/ContextualMenu.accessibility.test.tsx @@ -26,7 +26,7 @@ const favIcon = ( const itemsWithTruncatedText = [ { label: "Item with a very long label that should be truncated", - slot: <DxcBadge color="blue" mode="contextual" label="Label" size="small" icon={badgeIcon} title="Badge" />, + slot: <DxcBadge color="secondary" mode="contextual" label="Label" size="small" icon={badgeIcon} title="Badge" />, icon: keyIcon, }, { @@ -57,7 +57,7 @@ const items = [ items: [ { label: "Sales data module", - badge: <DxcBadge color="purple" label="Experimental" />, + badge: <DxcBadge color="primary" label="Experimental" />, }, { label: "Central platform" }, ], diff --git a/packages/lib/src/contextual-menu/ContextualMenu.stories.tsx b/packages/lib/src/contextual-menu/ContextualMenu.stories.tsx index b7f09bbc6..4255e61d3 100644 --- a/packages/lib/src/contextual-menu/ContextualMenu.stories.tsx +++ b/packages/lib/src/contextual-menu/ContextualMenu.stories.tsx @@ -40,13 +40,13 @@ const groupItems = [ { label: "Item 2", icon: "bookmark", - badge: <DxcBadge color="purple" label="Experimental" />, + badge: <DxcBadge color="primary" label="Experimental" />, }, { label: "Selected Item 3", selectedByDefault: true }, ], }, ], - badge: <DxcBadge color="green" label="New" />, + badge: <DxcBadge color="success" label="New" />, }, { label: "Item 4", icon: "key" }, ], @@ -79,11 +79,11 @@ const itemsWithIcon = [ const itemsWithBadge = [ { label: "Item 1", - badge: <DxcBadge color="green" label="New" />, + badge: <DxcBadge color="success" label="New" />, }, { label: "Item 2", - badge: <DxcBadge color="purple" label="Experimental" />, + badge: <DxcBadge color="primary" label="Experimental" />, }, ]; @@ -110,7 +110,7 @@ const sectionsWithScroll = [ const itemsWithTruncatedText = [ { label: "Item with a very long label that should be truncated", - badge: <DxcBadge color="green" label="New" />, + badge: <DxcBadge color="success" label="New" />, icon: ( <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24" fill="currentColor"> <path d="M200-120v-640q0-33 23.5-56.5T280-840h400q33 0 56.5 23.5T760-760v640L480-240 200-120Zm80-122 200-86 200 86v-518H280v518Zm0-518h400-400Z" />