diff --git a/apps/website/pages/components/inset/code.tsx b/apps/website/pages/components/inset/code.tsx new file mode 100644 index 0000000000..7a44f328af --- /dev/null +++ b/apps/website/pages/components/inset/code.tsx @@ -0,0 +1,17 @@ +import Head from "next/head"; +import type { ReactElement } from "react"; +import InsetCodePage from "screens/components/inset/code/InsetCodePage"; +import InsetPageLayout from "screens/components/inset/InsetPageLayout"; + +const Code = () => ( + <> + + Inset code — Halstack Design System + + + +); + +Code.getLayout = (page: ReactElement) => {page}; + +export default Code; diff --git a/apps/website/pages/components/inset/index.tsx b/apps/website/pages/components/inset/index.tsx index 6f63356a15..50ecc9992f 100644 --- a/apps/website/pages/components/inset/index.tsx +++ b/apps/website/pages/components/inset/index.tsx @@ -1,21 +1,17 @@ import Head from "next/head"; import type { ReactElement } from "react"; import InsetPageLayout from "screens/components/inset/InsetPageLayout"; -import InsetCodePage from "screens/components/inset/code/InsetCodePage"; +import InsetOverviewPage from "screens/components/inset/overview/InsetOverviewPage"; -const Index = () => { - return ( - <> - - Inset — Halstack Design System - - - - ); -}; +const Index = () => ( + <> + + Inset — Halstack Design System + + + +); -Index.getLayout = function getLayout(page: ReactElement) { - return {page}; -}; +Index.getLayout = (page: ReactElement) => {page}; export default Index; diff --git a/apps/website/pages/components/inset/specifications.tsx b/apps/website/pages/components/inset/specifications.tsx deleted file mode 100644 index 4a19621e36..0000000000 --- a/apps/website/pages/components/inset/specifications.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import Head from "next/head"; -import type { ReactElement } from "react"; -import InsetPageLayout from "screens/components/inset/InsetPageLayout"; -import InsetSpecsPage from "screens/components/inset/specs/InsetSpecsPage"; - -const Specifications = () => { - return ( - <> - - Inset Specs — Halstack Design System - - - - ); -}; - -Specifications.getLayout = function getLayout(page: ReactElement) { - return {page}; -}; - -export default Specifications; diff --git a/apps/website/pages/components/inset/usage.tsx b/apps/website/pages/components/inset/usage.tsx deleted file mode 100644 index 6c6bfcc69d..0000000000 --- a/apps/website/pages/components/inset/usage.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import Head from "next/head"; -import type { ReactElement } from "react"; -import InsetPageLayout from "screens/components/inset/InsetPageLayout"; -import InsetUsagePage from "screens/components/inset/usage/InsetUsagePage"; - -const Usage = () => { - return ( - <> - - Inset Usage — Halstack Design System - - - - ); -}; - -Usage.getLayout = function getLayout(page: ReactElement) { - return {page}; -}; - -export default Usage; diff --git a/apps/website/screens/common/CodeBlock.tsx b/apps/website/screens/common/CodeBlock.tsx index 9de7130467..cf5e886598 100644 --- a/apps/website/screens/common/CodeBlock.tsx +++ b/apps/website/screens/common/CodeBlock.tsx @@ -51,7 +51,7 @@ export default function CodeBlock({ children }: { children: ReactNode; language? {children} {copyActionIsVisible && ( - + - - Name - Type - Description - Default - - - background - - {backgroundTypeString} -

- being CoreColorTokens the color tokens provided by Halstack Design System. See our{" "} - - Color palette - {" "} - for further knowledge. -

- - - Based on the CSS property background allows configuring all properties related to the - background of a container. See{" "} - - MDN - {" "} - for further information. - - - - - - border - - - {borderTypeString} + + + Name + Type + Description + Default + + + + + background + + {backgroundTypeString} + + + Based on the CSS property background allows configuring all properties related to the + background of a container. See{" "} + + MDN + {" "} + for further information. + + - + + + border + + + {borderTypeString} +

+ being BorderProperties an object with the following properties: +

+ {borderPropertiesTypeString} +

+ and LineStyleValues an enum with the following possible values: +

+ + 'none' | 'dotted' | 'dashed' | 'solid' | 'double' | 'groove' | 'ridge' | 'inset' | 'outset' + +
+ + + Based on the CSS property border allows configuring all properties related to the border of a + container. + + - + + + borderRadius + + string + + + Sets the border-radius CSS property. See{" "} + + MDN + {" "} + for further information. + + - + + + boxShadow + + string + + + Sets the box-shadow CSS property. See{" "} + + MDN + {" "} + for further information. + + + 'none' + + + + boxSizing + + 'content-box' | 'border-box' + + + Sets the box-sizing CSS property. See{" "} + + MDN + {" "} + for further information. + + + 'content-box' + + + + children + + React.ReactNode + + Custom content inside the container. + - + + + display + + 'block' | 'inline-block' | 'inline' | 'none' + + + Sets the display CSS property. See{" "} + + MDN + {" "} + for further information. The set of values is limited to the ones related to the outer display type. If + you want to apply any pattern from the inner box and how the children are laid out, we recommend you to + use the Flex and Grid components. + + + 'block' + + + + float + + 'left' | 'right' | 'none' + + + Sets the float CSS property. See{" "} + + MDN + {" "} + for further information. + + + 'none' + + + + height + + string + + + Sets the height CSS property. See{" "} + + MDN + {" "} + for further information. + + + 'auto' + + + + inset + + {insetTypeString} + + + Based on the CSS property inset this prop is a shorthand that corresponds to the{" "} + top, right, bottom, and/or left properties. + + + 'auto' + + + + margin + + string | Space +

+ being Space an object with the following properties: +

+ {spaceTypeString} + + Size of the margin to be applied to the container. + - + + + maxHeight + + string + + + Sets the max-height CSS property. See{" "} + + MDN + {" "} + for further information. + + + 'none' + + + + maxWidth + + string + + + Sets the max-width CSS property. See{" "} + + MDN + {" "} + for further information. + + + 'none' + + + + minHeight + + string + + + Sets the min-height CSS property. See{" "} + + MDN + {" "} + for further information. + + + 'auto' + + + + minWidth + + string + + + Sets the min-width CSS property. See{" "} + + MDN + {" "} + for further information. + + + 'auto' + + + + outline + + {outlineTypeString} + + + Based on the CSS property outline allows configuring all properties related to the outline of + a container. + + - + + + overflow + + {overflowTypeString}

- being BorderProperties an object with the following properties: + being OverflowValues an enum with the following possible values:

- {borderPropertiesTypeString} + 'visible' | 'hidden' | 'clip' | 'scroll' | 'auto' + + + Sets the overflow CSS property. See{" "} + + MDN + {" "} + for further information. + + + 'visible' + + + + padding + + string | Space

- and LineStyleValues an enum with the following possible values: + being Space an object with the following properties:

- - 'none' | 'dotted' | 'dashed' | 'solid' | 'double' | 'groove' | 'ridge' | 'inset' | 'outset' - -
- - - Based on the CSS property border allows configuring all properties related to the border of a - container. - - - - - - borderRadius - - string - - - Sets the border-radius CSS property. See{" "} - - MDN - {" "} - for further information. - - - - - - boxShadow - - string - - - Sets the box-shadow CSS property. See{" "} - - MDN - {" "} - for further information. - - - 'none' - - - - boxSizing - - 'content-box' | 'border-box' - - - Sets the box-sizing CSS property. See{" "} - - MDN - {" "} - for further information. - - - 'content-box' - - - - - - - children - - - - React.ReactNode - - Custom content inside the container. - - - - - display - - 'block' | 'inline-block' | 'inline' | 'none' - - - Sets the display CSS property. See{" "} - - MDN - {" "} - for further information. The set of values is limited to the ones related to the outer display type. If you - want to apply any pattern from the inner box and how the children are laid out, we recommend you to use the - Flex and Grid components. - - - 'block' - - - - float - - 'left' | 'right' | 'none' - - - Sets the float CSS property. See{" "} - - MDN - {" "} - for further information. - - - 'none' - - - - height - - string - - - Sets the height CSS property. See{" "} - - MDN - {" "} - for further information. - - - 'auto' - - - - inset - - {insetTypeString} - - - Based on the CSS property inset this prop is a shorthand that corresponds to the{" "} - top, right, bottom, and/or left properties. - - - 'auto' - - - - margin - - 'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge' | Space - - - Size of the margin to be applied to the component. You can pass an object with 'top', 'bottom', 'left' and - 'right' properties in order to specify different margin sizes. - - - - - - maxHeight - - string - - - Sets the max-height CSS property. See{" "} - - MDN - {" "} - for further information. - - - 'none' - - - - maxWidth - - string - - - Sets the max-width CSS property. See{" "} - - MDN - {" "} - for further information. - - - 'none' - - - - minHeight - - string - - - Sets the min-height CSS property. See{" "} - - MDN - {" "} - for further information. - - - 'auto' - - - - minWidth - - string - - - Sets the min-width CSS property. See{" "} - - MDN - {" "} - for further information. - - - 'auto' - - - - outline - - {outlineTypeString} - - - Based on the CSS property outline allows configuring all properties related to the outline of a - container. - - - - - - overflow - - {overflowTypeString} -

- being OverflowValues an enum with the following possible values: -

- 'visible' | 'hidden' | 'clip' | 'scroll' | 'auto' - - - Sets the overflow CSS property. See{" "} - - MDN - {" "} - for further information. - - - 'visible' - - - - padding - - 'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge' | Space - - - Size of the margin to be applied to the component. You can pass an object with 'top', 'bottom', 'left' and - 'right' properties in order to specify different margin sizes. - - - - - - position - - 'static' | 'relative' | 'absolute' | 'fixed' | 'sticky' - - - Sets the position CSS property. See{" "} - - MDN - {" "} - for further information. - - - 'static' - - - - width - - string - - - Sets the width CSS property. See{" "} - - MDN - {" "} - for further information. - - - 'auto' - - - - zIndex - - 'auto' | number - - - Sets the z-index CSS property. See{" "} - - MDN - {" "} - for further information. - - - 'auto' - - + {spaceTypeString} + + Size of the padding to be applied to the container. + - + + + position + + 'static' | 'relative' | 'absolute' | 'fixed' | 'sticky' + + + Sets the position CSS property. See{" "} + + MDN + {" "} + for further information. + + + 'static' + + + + width + + string + + + Sets the width CSS property. See{" "} + + MDN + {" "} + for further information. + + + 'auto' + + + + zIndex + + 'auto' | number + + + Sets the z-index CSS property. See{" "} + + MDN + {" "} + for further information. + + + 'auto' + + + ), }, @@ -408,8 +413,8 @@ const sections = [ <> This code provides an illustration of a custom component created exclusively with the{" "} - DxcContainer. You should not copy this code, but use instead our{" "} - DxcSelect. + DxcContainer. You should not copy this code, use our DxcSelect{" "} + instead. It is imperative to exclusively utilize Halstack components for optimal compatibility and adherence to our @@ -417,7 +422,7 @@ const sections = [ reach out to our development team {" "} - first to discuss your particular situation. + first to discuss your particular scenario. diff --git a/apps/website/screens/components/container/code/examples/basicUsage.ts b/apps/website/screens/components/container/code/examples/basicUsage.ts index a0c582d7ad..a5163e14c3 100644 --- a/apps/website/screens/components/container/code/examples/basicUsage.ts +++ b/apps/website/screens/components/container/code/examples/basicUsage.ts @@ -4,9 +4,13 @@ const code = `() => { return ( Example text diff --git a/apps/website/screens/components/container/code/examples/listbox.ts b/apps/website/screens/components/container/code/examples/listbox.ts index 07a861df6d..00953231f0 100644 --- a/apps/website/screens/components/container/code/examples/listbox.ts +++ b/apps/website/screens/components/container/code/examples/listbox.ts @@ -6,28 +6,38 @@ const code = `() => { return ( {suggestions.map((suggestion, index) => ( - + - + {suggestion} diff --git a/apps/website/screens/components/container/overview/examples/alternateBoxModel.ts b/apps/website/screens/components/container/overview/examples/alternateBoxModel.ts deleted file mode 100644 index c06ccf534c..0000000000 --- a/apps/website/screens/components/container/overview/examples/alternateBoxModel.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { DxcContainer, DxcInset } from "@dxc-technology/halstack-react"; - -const code = `() => { - return ( - - -

Container with default box model "border-box"

-
-
- ); -}`; - -const scope = { - DxcContainer, - DxcInset, -}; - -export default { code, scope }; diff --git a/apps/website/screens/components/container/overview/examples/defaultBoxModel.ts b/apps/website/screens/components/container/overview/examples/defaultBoxModel.ts deleted file mode 100644 index ba94f390fc..0000000000 --- a/apps/website/screens/components/container/overview/examples/defaultBoxModel.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { DxcContainer, DxcInset } from "@dxc-technology/halstack-react"; - -const code = `() => { - return ( - - -

Container with default box model "content-box"

-
-
- ); -}`; - -const scope = { - DxcContainer, - DxcInset, -}; - -export default { code, scope }; diff --git a/apps/website/screens/components/data-grid/usage/examples/expandedContent.ts b/apps/website/screens/components/data-grid/usage/examples/expandedContent.ts index 7c7bdbb6a6..cd3b7b9d0c 100644 --- a/apps/website/screens/components/data-grid/usage/examples/expandedContent.ts +++ b/apps/website/screens/components/data-grid/usage/examples/expandedContent.ts @@ -22,7 +22,7 @@ const code = `() => { { id: "Row 2", complete: 51, - expandedContent: + expandedContent: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras laoreet vulputate augue, non cursus justo eleifend non. Nam ante erat, finibus at tincidunt ut, convallis sed tortor. Proin commodo vestibulum sagittis. diff --git a/apps/website/screens/components/flex/overview/FlexOverviewPage.tsx b/apps/website/screens/components/flex/overview/FlexOverviewPage.tsx index a22788098f..ea7e5f80fb 100644 --- a/apps/website/screens/components/flex/overview/FlexOverviewPage.tsx +++ b/apps/website/screens/components/flex/overview/FlexOverviewPage.tsx @@ -64,11 +64,6 @@ const sections = [ they can lead to layout issues on different devices. Instead, leverage flex properties like grow, shrink, and basis to create scalable designs. - - Ensure consistency with design tokens: whenever possible, use the design tokens provided by - the Halstack Design System to maintain visual and functional consistency across applications, even though the - component allows custom values. - Leverage alignment and justification: use justifyContent and{" "} alignItems strategically to control content positioning within the flex container, ensuring a @@ -79,6 +74,11 @@ const sections = [ excessive nesting can reduce readability and maintainability. Consider alternative layout strategies when appropriate. + + Ensure consistency with design tokens: whenever possible, use the design tokens provided by + the Halstack Design System to maintain visual and functional consistency across applications, even though the + component allows custom values. + Combine with other layout techniques: flexbox is powerful but not always the best tool for every scenario. Consider using the{" "} diff --git a/apps/website/screens/components/inset/InsetPageLayout.tsx b/apps/website/screens/components/inset/InsetPageLayout.tsx index 4e97fae4e0..53e6d8f296 100644 --- a/apps/website/screens/components/inset/InsetPageLayout.tsx +++ b/apps/website/screens/components/inset/InsetPageLayout.tsx @@ -6,9 +6,8 @@ import { ReactNode } from "react"; const InsetPageHeading = ({ children }: { children: ReactNode }) => { const tabs = [ - { label: "Code", path: "/components/inset" }, - { label: "Usage", path: "/components/inset/usage" }, - { label: "Specifications", path: "/components/inset/specifications" }, + { label: "Overview", path: "/components/inset" }, + { label: "Code", path: "/components/inset/code" }, ]; return ( @@ -17,7 +16,7 @@ const InsetPageHeading = ({ children }: { children: ReactNode }) => { Inset layout applies positive spacing scale to its child nodes. - + {children} diff --git a/apps/website/screens/components/inset/code/InsetCodePage.tsx b/apps/website/screens/components/inset/code/InsetCodePage.tsx index a4771d553a..c9ec682699 100644 --- a/apps/website/screens/components/inset/code/InsetCodePage.tsx +++ b/apps/website/screens/components/inset/code/InsetCodePage.tsx @@ -8,89 +8,90 @@ import customSides from "./examples/customSides"; import TableCode from "@/common/TableCode"; import StatusBadge from "@/common/StatusBadge"; -const coreSpacingTokensTypeString = `'0rem' | '0.125rem' | '0.25rem' | '0.5rem' | '0.75rem' | '1rem' | '1.5rem' | '2rem' | '2.5rem' | '3rem' | '3.5rem' | '4rem' | '5rem' | '6rem' | '7rem'`; - const sections = [ { title: "Props", content: ( - - Name - Type - Description - Default - - - space - - {coreSpacingTokensTypeString} - - Applies the spacing scale to all sides. - - - - - horizontal - - {coreSpacingTokensTypeString} - - Applies the spacing scale to the left and right sides. - - - - - vertical - - {coreSpacingTokensTypeString} - - Applies the spacing scale to the top and bottom sides. - - - - - top - - {coreSpacingTokensTypeString} - - Applies the spacing scale to the top side. - - - - - right - - {coreSpacingTokensTypeString} - - Applies the spacing scale to the right side. - - - - - bottom - - {coreSpacingTokensTypeString} - - Applies the spacing scale to the bottom side. - - - - - - left - - {coreSpacingTokensTypeString} - - Applies the spacing scale to the left side. - - - - - - - - children - - - - React.ReactNode - - Custom content inside the inset. - - - + + + Name + Type + Description + Default + + + + + bottom + + string + + Applies the spacing scale to the bottom side. + - + + + + + + children + + + + React.ReactNode + + Custom content inside the inset. + - + + + horizontal + + string + + Applies the spacing scale to the left and right sides. + - + + + left + + string + + Applies the spacing scale to the left side. + - + + + right + + string + + Applies the spacing scale to the right side. + - + + + space + + string + + Applies the spacing scale to all sides. + - + + + top + + string + + Applies the spacing scale to the top side. + - + + + vertical + + string + + Applies the spacing scale to the top and bottom sides. + - + + ), }, @@ -109,15 +110,13 @@ const sections = [ }, ]; -const InsetCodePage = () => { - return ( - - - - - - - ); -}; +const InsetCodePage = () => ( + + + + + + +); export default InsetCodePage; diff --git a/apps/website/screens/components/inset/code/examples/basicUsage.ts b/apps/website/screens/components/inset/code/examples/basicUsage.ts index 7ceb8e705e..3d46c84331 100644 --- a/apps/website/screens/components/inset/code/examples/basicUsage.ts +++ b/apps/website/screens/components/inset/code/examples/basicUsage.ts @@ -3,13 +3,13 @@ import Placeholder from "@/common/Placeholder"; const code = `() => { return ( - - - - - + + + + + - + ); diff --git a/apps/website/screens/components/inset/code/examples/customSides.ts b/apps/website/screens/components/inset/code/examples/customSides.ts index 8c5a252f9a..b870d743cb 100644 --- a/apps/website/screens/components/inset/code/examples/customSides.ts +++ b/apps/website/screens/components/inset/code/examples/customSides.ts @@ -3,13 +3,18 @@ import Placeholder from "@/common/Placeholder"; const code = `() => { return ( - - - - - + + + + + - + ); diff --git a/apps/website/screens/components/inset/overview/InsetOverviewPage.tsx b/apps/website/screens/components/inset/overview/InsetOverviewPage.tsx new file mode 100644 index 0000000000..35a447b0f6 --- /dev/null +++ b/apps/website/screens/components/inset/overview/InsetOverviewPage.tsx @@ -0,0 +1,66 @@ +import { DxcBulletedList, DxcFlex, DxcLink, DxcParagraph } from "@dxc-technology/halstack-react"; +import QuickNavContainerLayout from "@/common/QuickNavContainerLayout"; +import QuickNavContainer from "@/common/QuickNavContainer"; +import DocFooter from "@/common/DocFooter"; +import Link from "next/link"; + +const sections = [ + { + title: "Introduction", + content: ( + <> + + The inset component is a container that adds spacing around its content, enhancing visual separation between + elements in a layout. It offers customizable spacing options, allowing for greater design flexibility. + Typically, it is used alongside other components to create a cohesive and well-structured layout. + + + ), + }, + { + title: "Best practices", + content: ( + + + Enhance visual hierarchy: use the inset component to create clear separation between elements + in a layout. + + + Maintain balance and aesthetics: choose appropriate spacing values to ensure a + well-proportioned and visually appealing design. + + + Avoid unnecessary clutter: excessive use of the Inset component may lead to a fragmented or + overcrowded layout. + + + Ensure consistency with design tokens: whenever possible, use the design tokens provided by + the Halstack Design System, to maintain visual and functional consistency across applications, even though the + component allows custom values. + + + Combine with other layout techniques: use this component alongside{" "} + + flex + {" "} + and{" "} + + grid + {" "} + components to create consistent and semantic layouts. + + + ), + }, +]; + +const InsetOverviewPage = () => ( + + + + + + +); + +export default InsetOverviewPage; diff --git a/apps/website/screens/components/inset/specs/InsetSpecsPage.tsx b/apps/website/screens/components/inset/specs/InsetSpecsPage.tsx deleted file mode 100644 index 2777ef89c8..0000000000 --- a/apps/website/screens/components/inset/specs/InsetSpecsPage.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import { DxcFlex, DxcParagraph } from "@dxc-technology/halstack-react"; -import QuickNavContainerLayout from "@/common/QuickNavContainerLayout"; -import DocFooter from "@/common/DocFooter"; -import QuickNavContainer from "@/common/QuickNavContainer"; -import Figure from "@/common/Figure"; -import Image from "@/common/Image"; -import insetSpecs from "./images/inset_specs.png"; - -const sections = [ - { - title: "Specifications", - content: ( - <> -
- Inset design specifications -
- - Positive space varies depending on the REM values and the approach to implementation. - - - ), - }, -]; - -const InsetSpecsPage = () => { - return ( - - - - - - - ); -}; - -export default InsetSpecsPage; diff --git a/apps/website/screens/components/inset/specs/images/inset_specs.png b/apps/website/screens/components/inset/specs/images/inset_specs.png deleted file mode 100644 index 5583cb33cc..0000000000 Binary files a/apps/website/screens/components/inset/specs/images/inset_specs.png and /dev/null differ diff --git a/apps/website/screens/components/inset/usage/InsetUsagePage.tsx b/apps/website/screens/components/inset/usage/InsetUsagePage.tsx deleted file mode 100644 index 6ee979d9cc..0000000000 --- a/apps/website/screens/components/inset/usage/InsetUsagePage.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { DxcFlex, DxcParagraph } from "@dxc-technology/halstack-react"; -import QuickNavContainerLayout from "@/common/QuickNavContainerLayout"; -import QuickNavContainer from "@/common/QuickNavContainer"; -import DocFooter from "@/common/DocFooter"; -import Code from "@/common/Code"; - -const sections = [ - { - title: "Usage", - content: ( - <> - - Inset properties refer to the scale of the spacing used outside a container. The unit commonly used for the - inset scale is REM, which is a measurement unit that refers to the font-size of the root element of a - document. - - - The following values of REM are commonly used in the design system: 0, 0.125,{" "} - 0.25, 0.5, 1, 1.5, 2, 3,{" "} - 4, and 5. - - - ), - }, -]; - -const InsetUsagePage = () => { - return ( - - - - - - - ); -}; - -export default InsetUsagePage; diff --git a/apps/website/screens/components/paginator/overview/examples/scrollable.ts b/apps/website/screens/components/paginator/overview/examples/scrollable.ts index 856536c6a4..c0246246b7 100644 --- a/apps/website/screens/components/paginator/overview/examples/scrollable.ts +++ b/apps/website/screens/components/paginator/overview/examples/scrollable.ts @@ -46,7 +46,7 @@ const code = `() => { complete: 46, priority: "High", issueType: "Bug", - expandedContent: Custom content 1, + expandedContent: Custom content 1, expandedContentHeight: 470 }, { @@ -55,7 +55,7 @@ const code = `() => { complete: 51, priority: "High", issueType: "Epic", - expandedContent: Custom content 1 + expandedContent: Custom content 1 }, { id: 3, @@ -63,7 +63,7 @@ const code = `() => { complete: 40, priority: "High", issueType: "Improvement", - expandedContent: Custom content 1 + expandedContent: Custom content 1 }, { id: 4, @@ -71,7 +71,7 @@ const code = `() => { complete: 10, priority: "High", issueType: "Improvement", - expandedContent: Custom content 1 + expandedContent: Custom content 1 }, { id: 5, @@ -87,7 +87,7 @@ const code = `() => { complete: 37, priority: "High", issueType: "Improvement", - expandedContent: Custom content 1 + expandedContent: Custom content 1 }, { id: 7, @@ -95,7 +95,7 @@ const code = `() => { complete: 73, priority: "Medium", issueType: "Story", - expandedContent: Custom content 1 + expandedContent: Custom content 1 }, { id: 8, @@ -103,7 +103,7 @@ const code = `() => { complete: 27, priority: "Medium", issueType: "Story", - expandedContent: Custom content 1 + expandedContent: Custom content 1 }, { id: 9, @@ -111,15 +111,15 @@ const code = `() => { complete: 36, priority: "Critical", issueType: "Epic", - expandedContent: Custom content 1 + expandedContent: Custom content 1 }, ]; return ( - - + +
); }`; diff --git a/packages/lib/src/accordion/Accordion.stories.tsx b/packages/lib/src/accordion/Accordion.stories.tsx index cb16d8150d..f05781c8f1 100644 --- a/packages/lib/src/accordion/Accordion.stories.tsx +++ b/packages/lib/src/accordion/Accordion.stories.tsx @@ -47,7 +47,7 @@ const Accordion = () => ( <DxcAccordion> <DxcAccordion.AccordionItem label="Assure Claims"> - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -58,7 +58,7 @@ const Accordion = () => ( <Title title="Label and sublabel" theme="light" level={4} /> <DxcAccordion> <DxcAccordion.AccordionItem label="Assure Claims" subLabel="Jan, 09 2025"> - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -80,7 +80,7 @@ const Accordion = () => ( <Title title="Label, subLabel and assistive text" theme="light" level={4} /> <DxcAccordion> <DxcAccordion.AccordionItem label="Assure Claims" subLabel="Jan, 09 2025" assistiveText="Ref - 1236554546"> - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -91,7 +91,7 @@ const Accordion = () => ( <Title title="Icon and label" theme="light" level={4} /> <DxcAccordion> <DxcAccordion.AccordionItem label="Assure Claims" icon="heart_plus"> - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -102,7 +102,7 @@ const Accordion = () => ( <Title title="Icon, label and sublabel" theme="light" level={4} /> <DxcAccordion> <DxcAccordion.AccordionItem label="Assure Claims" subLabel="Jan, 09 2025" icon="heart_plus"> - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -118,7 +118,7 @@ const Accordion = () => ( assistiveText="Ref - 1236554546" icon="heart_plus" > - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -134,7 +134,7 @@ const Accordion = () => ( assistiveText="Ref - 1236554546" badge={{ position: "before", element: <DxcBadge label="Enterprise" icon="home" /> }} > - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -149,7 +149,7 @@ const Accordion = () => ( subLabel="Jan, 09 2025" badge={{ position: "after", element: <DxcBadge label="Enterprise" /> }} > - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -165,7 +165,7 @@ const Accordion = () => ( icon="heart_plus" statusLight={<DxcStatusLight label="Active" />} > - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -181,7 +181,7 @@ const Accordion = () => ( badge={{ position: "before", element: <DxcBadge label="Enterprise" /> }} statusLight={<DxcStatusLight label="Active" />} > - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -192,7 +192,7 @@ const Accordion = () => ( <Title title="Smaller icon" theme="light" level={4} /> <DxcAccordion> <DxcAccordion.AccordionItem label="Assure Claims" assistiveText="Ref - 1236554546" icon={smallIcon}> - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -203,7 +203,7 @@ const Accordion = () => ( <Title title="Bigger icon (SVG)" theme="light" level={4} /> <DxcAccordion> <DxcAccordion.AccordionItem label="Assure Claims" assistiveText="Ref - 1236554546" icon={facebookIcon}> - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -214,19 +214,19 @@ const Accordion = () => ( <Title title="Group of accordions (independent false)" theme="light" level={4} /> <DxcAccordion defaultIndexActive={[0, 2]}> <DxcAccordion.AccordionItem label="Accordion1" assistiveText="Assistive text"> - <DxcInset space="2rem"> + <DxcInset space="var(--spacing-padding-xl)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> </DxcAccordion.AccordionItem> <DxcAccordion.AccordionItem label="Accordion2" assistiveText="Assistive text"> - <DxcInset space="2rem"> + <DxcInset space="var(--spacing-padding-xl)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> </DxcAccordion.AccordionItem> <DxcAccordion.AccordionItem label="Accordion3" assistiveText="Assistive text"> - <DxcInset space="2rem"> + <DxcInset space="var(--spacing-padding-xl)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -241,7 +241,7 @@ const Accordion = () => ( badge={{ position: "before", element: <DxcBadge label="GET" color="green" /> }} statusLight={<DxcStatusLight label="Active" mode="success" />} > - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -251,7 +251,7 @@ const Accordion = () => ( assistiveText="Provide all required info" badge={{ position: "before", element: <DxcBadge label="POST" color="blue" /> }} > - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -261,7 +261,7 @@ const Accordion = () => ( badge={{ position: "before", element: <DxcBadge label="OPTIONS" color="yellow" /> }} statusLight={<DxcStatusLight label="Active" mode="warning" />} > - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -272,7 +272,7 @@ const Accordion = () => ( icon="delete" badge={{ position: "before", element: <DxcBadge label="DELETE" /> }} > - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -293,7 +293,7 @@ const Accordion = () => ( ), }} > - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -308,7 +308,7 @@ const Accordion = () => ( subLabel="Jan, 09 2025 Jan, 09 2025 Jan, 09 2025 Jan, 09 2025 Jan, 09 2025 Jan, 09 2025 Jan, 09 2025 Jan, 09 2025 Jan, 09 2025 Jan, 09 2025 Jan, 09 2025 Jan, 09 2025 Jan, 09 2025 Jan, 09 2025 Jan, 09 2025 Jan, 09 2025 Jan, 09 2025 Jan, 09 2025 Jan, 09 2025 Jan, 09 2025 Jan, 09 2025" icon="heart_plus" > - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -324,7 +324,7 @@ const Accordion = () => ( assistiveText="Assistive text Assistive text" icon="heart_plus" > - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -340,7 +340,7 @@ const Accordion = () => ( assistiveText="Assistive text Assistive text Assistive text Assistive text Assistive text Assistive text Assistive text Assistive text Assistive text Assistive text Assistive text Assistive text Assistive text Assistive text" icon="heart_plus" > - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -352,7 +352,7 @@ const Accordion = () => ( <Title title="Focused" theme="light" level={4} /> <DxcAccordion> <DxcAccordion.AccordionItem label="Assure Claims" subLabel="Jan, 09 2025" assistiveText="Ref - 1236554546"> - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -363,7 +363,7 @@ const Accordion = () => ( <Title title="Hovered" theme="light" level={4} /> <DxcAccordion> <DxcAccordion.AccordionItem label="Assure Claims" subLabel="Jan, 09 2025" assistiveText="Ref - 1236554546"> - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -374,7 +374,7 @@ const Accordion = () => ( <Title title="Active" theme="light" level={4} /> <DxcAccordion> <DxcAccordion.AccordionItem label="Assure Claims" subLabel="Jan, 09 2025" assistiveText="Ref - 1236554546"> - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -391,7 +391,7 @@ const Accordion = () => ( icon="heart_plus" disabled > - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -405,7 +405,7 @@ const Accordion = () => ( badge={{ position: "before", element: <DxcBadge label="Enterprise" color="green" /> }} statusLight={<DxcStatusLight label="Active" mode="success" />} > - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -419,7 +419,7 @@ const Accordion = () => ( disabled badge={{ position: "after", element: <DxcBadge label="Enterprise" color="green" /> }} > - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -434,7 +434,7 @@ const Accordion = () => ( badge={{ position: "before", element: <DxcBadge label="GET" color="green" /> }} statusLight={<DxcStatusLight label="Active" mode="success" />} > - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -444,7 +444,7 @@ const Accordion = () => ( assistiveText="Provide all required info" badge={{ position: "before", element: <DxcBadge label="POST" color="blue" /> }} > - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -454,7 +454,7 @@ const Accordion = () => ( badge={{ position: "before", element: <DxcBadge label="OPTIONS" color="yellow" /> }} statusLight={<DxcStatusLight label="Active" mode="warning" />} > - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -465,7 +465,7 @@ const Accordion = () => ( icon="delete" badge={{ position: "before", element: <DxcBadge label="DELETE" /> }} > - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -477,7 +477,7 @@ const Accordion = () => ( <Title title="Xxsmall margin" theme="light" level={4} /> <DxcAccordion margin="xxsmall"> <DxcAccordion.AccordionItem label="Assure Claims"> - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -488,7 +488,7 @@ const Accordion = () => ( <Title title="Xsmall margin" theme="light" level={4} /> <DxcAccordion margin="xsmall"> <DxcAccordion.AccordionItem label="Assure Claims"> - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -499,7 +499,7 @@ const Accordion = () => ( <Title title="Small margin" theme="light" level={4} /> <DxcAccordion margin="small"> <DxcAccordion.AccordionItem label="Assure Claims"> - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -510,7 +510,7 @@ const Accordion = () => ( <Title title="Medium margin" theme="light" level={4} /> <DxcAccordion margin="medium"> <DxcAccordion.AccordionItem label="Assure Claims"> - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -521,7 +521,7 @@ const Accordion = () => ( <Title title="Large margin" theme="light" level={4} /> <DxcAccordion margin="large"> <DxcAccordion.AccordionItem label="Assure Claims"> - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -532,7 +532,7 @@ const Accordion = () => ( <Title title="Xlarge margin" theme="light" level={4} /> <DxcAccordion margin="xlarge"> <DxcAccordion.AccordionItem label="Assure Claims"> - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> @@ -543,7 +543,7 @@ const Accordion = () => ( <Title title="Xxlarge margin" theme="light" level={4} /> <DxcAccordion margin="xxlarge"> <DxcAccordion.AccordionItem label="Assure Claims"> - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget. </DxcInset> diff --git a/packages/lib/src/action-icon/ActionIcon.stories.tsx b/packages/lib/src/action-icon/ActionIcon.stories.tsx index bd1a035d2a..be36839843 100644 --- a/packages/lib/src/action-icon/ActionIcon.stories.tsx +++ b/packages/lib/src/action-icon/ActionIcon.stories.tsx @@ -56,7 +56,7 @@ const NestedTooltip = () => ( <> <Title title="Nested tooltip" theme="light" level={2} /> <ExampleContainer> - <DxcInset top="3rem"> + <DxcInset top="var(--spacing-padding-xxl)"> <DxcTooltip label="Favourite" position="top"> <DxcActionIcon icon="favorite" title="Favourite" /> </DxcTooltip> diff --git a/packages/lib/src/badge/Badge.stories.tsx b/packages/lib/src/badge/Badge.stories.tsx index 001e77dfaa..5dc227fcab 100644 --- a/packages/lib/src/badge/Badge.stories.tsx +++ b/packages/lib/src/badge/Badge.stories.tsx @@ -225,7 +225,7 @@ const NestedTooltip = () => ( <> <Title title="Nested tooltip" theme="light" level={2} /> <ExampleContainer> - <DxcInset top="3rem"> + <DxcInset top="var(--spacing-padding-xxl)"> <DxcTooltip label="Tooltip label" position="top"> <DxcBadge label="Tooltip label" title="Label" /> </DxcTooltip> diff --git a/packages/lib/src/button/Button.stories.tsx b/packages/lib/src/button/Button.stories.tsx index 5f6f25692c..a91e42c359 100644 --- a/packages/lib/src/button/Button.stories.tsx +++ b/packages/lib/src/button/Button.stories.tsx @@ -4934,7 +4934,7 @@ const NestedTooltip = () => ( <> <Title title="Nested tooltip" theme="light" level={2} /> <ExampleContainer> - <DxcInset top="3rem"> + <DxcInset top="var(--spacing-padding-xxl)"> <DxcTooltip label="Button" position="top"> <DxcButton label="Button" title="Button" /> </DxcTooltip> diff --git a/packages/lib/src/container/Container.stories.tsx b/packages/lib/src/container/Container.stories.tsx index 189305e5c9..f732722a45 100644 --- a/packages/lib/src/container/Container.stories.tsx +++ b/packages/lib/src/container/Container.stories.tsx @@ -11,43 +11,38 @@ export default { const Listbox = ({ suggestions = [] }: { suggestions: string[] }): JSX.Element => ( <DxcContainer - boxSizing="border-box" - boxShadow="0 4px 6px -1px rgba(0, 0, 0, 0.1)" + background={{ color: "var(--border-color-neutral-brighter)" }} border={{ + color: "var(--border-color-neutral-medium)", width: "var(--border-width-s)", style: "var(--border-style-default)", - color: "var(--border-color-neutral-medium)", }} borderRadius="var(--border-radius-s)" - background={{ color: "var(--color-bg-neutral-lightest)" }} - padding={{ top: "xxsmall", bottom: "xxsmall" }} + boxShadow="var(--shadow-mid-x-position) var(--shadow-mid-y-position) var(--shadow-mid-blur) var(--shadow-mid-spread) var(--shadow-light)" + boxSizing="border-box" maxHeight="304px" - width="250px" overflow={{ x: "hidden", y: "auto" }} + padding={{ bottom: "var(--spacing-padding-xxs)", top: "var(--spacing-padding-xxs)" }} + width="250px" > {suggestions.map((suggestion, index) => ( - <DxcContainer padding={{ left: "xsmall", right: "xsmall" }}> + <DxcContainer padding={{ left: "var(--spacing-padding-xs)", right: "var(--spacing-padding-xs)" }}> <DxcContainer border={ index !== suggestions.length - 1 ? { bottom: { - width: "var(--border-width-s)", - style: "var(--border-style-default)", color: "var(--border-color-neutral-lighter)", + style: "var(--border-style-default)", + width: "var(--border-width-s)", }, } : undefined } - padding={{ - top: "xxsmall", - bottom: "xxsmall", - left: "xxsmall", - right: "xxsmall", - }} overflow="hidden" + padding="var(--spacing-padding-xxs)" > - <DxcTypography whiteSpace="nowrap" textOverflow="ellipsis" lineHeight="1.715em"> + <DxcTypography lineHeight="1.715em" textOverflow="ellipsis" whiteSpace="nowrap"> {suggestion} </DxcTypography> </DxcContainer> @@ -78,8 +73,8 @@ const Container = () => ( }, }} borderRadius="var(--border-radius-none) var(--border-radius-none) var(--border-radius-s) var(--border-radius-s)" - padding="medium" - margin="large" + padding="var(--spacing-padding-m)" + margin="var(--spacing-padding-l)" > <b>Example text</b> </DxcContainer> @@ -109,21 +104,21 @@ const Container = () => ( style: "var(--border-style-dashed)", }} borderRadius="var(--border-radius-s)" - margin={{ bottom: "xxlarge" }} + margin={{ bottom: "var(--spacing-padding-xxl)" }} > <DxcContainer display="inline-block" background={{ color: "var(--color-bg-primary-medium)" }} - width="50px" - height="50px" + width="56px" + height="var(--height-xxxl)" > <b>1</b> </DxcContainer> <DxcContainer display="inline-block" background={{ color: "var(--color-bg-primary-medium)" }} - width="50px" - height="50px" + width="56px" + height="var(--height-xxxl)" > <b>2</b> </DxcContainer> @@ -132,8 +127,8 @@ const Container = () => ( position="absolute" inset={{ top: "25px", left: "0" }} background={{ color: "var(--color-bg-secondary-strong)" }} - width="50px" - height="50px" + width="56px" + height="var(--height-xxxl)" zIndex={1} > <b>3</b> @@ -155,15 +150,15 @@ const Container = () => ( background={{ color: "var(--color-bg-primary-medium)" }} width="50px" height="50px" - margin={{ bottom: "medium" }} + margin={{ bottom: "var(--spacing-padding-m)" }} > <b>1</b> </DxcContainer> <DxcContainer background={{ color: "var(--color-bg-primary-medium)" }} - width="50px" - height="50px" - margin={{ top: "large" }} + width="56px" + height="var(--height-xxxl)" + margin={{ top: "var(--spacing-padding-l)" }} > <b>2</b> </DxcContainer> @@ -173,10 +168,14 @@ const Container = () => ( <ExampleContainer> <DxcContainer overflow={{ x: "auto" }} maxHeight="100px" width="fit-content"> <DxcContainer - border={{ width: "var(--border-width-s)", style: "var(--border-style-default)", color: "var(--border-color-neutral-strongest)" }} + border={{ + width: "var(--border-width-s)", + style: "var(--border-style-default)", + color: "var(--border-color-neutral-strongest)", + }} background={{ color: "var(--color-bg-primary-medium)" }} - width="50px" - height="50px" + width="56px" + height="var(--height-xxxl)" > <b tabIndex={0}>1</b> </DxcContainer> @@ -187,16 +186,20 @@ const Container = () => ( color: "var(--border-color-neutral-strongest)", }} background={{ color: "var(--color-bg-primary-medium)" }} - width="50px" - height="50px" + width="56px" + height="var(--height-xxxl)" > <b tabIndex={0}>2</b> </DxcContainer> <DxcContainer - border={{ width: "var(--border-width-s)", style: "var(--border-style-default)", color: "var(--border-color-neutral-strongest)" }} + border={{ + width: "var(--border-width-s)", + style: "var(--border-style-default)", + color: "var(--border-color-neutral-strongest)", + }} background={{ color: "var(--color-bg-primary-medium)" }} - width="50px" - height="50px" + width="56px" + height="var(--height-xxxl)" > <b tabIndex={0}>3</b> </DxcContainer> @@ -204,8 +207,20 @@ const Container = () => ( </ExampleContainer> <Title title="Float" level={4} /> <ExampleContainer> - <DxcContainer padding="medium" border={{ width: "var(--border-width-s)", style: "var(--border-style-default)", color: "var(--border-color-neutral-strongest)" }}> - <DxcContainer float="right" background={{ color: "var(--color-bg-primary-medium)" }} width="100px" height="100px"> + <DxcContainer + padding="var(--spacing-padding-m)" + border={{ + width: "var(--border-width-s)", + style: "var(--border-style-default)", + color: "var(--border-color-neutral-strongest)", + }} + > + <DxcContainer + float="right" + background={{ color: "var(--color-bg-primary-medium)" }} + width="100px" + height="100px" + > <b>Floating text</b> </DxcContainer> <p style={{ margin: 0 }}> @@ -223,8 +238,12 @@ const Container = () => ( <Title title="Box shadow and opacity" level={4} /> <ExampleContainer> <DxcContainer - padding="medium" - outline={{ width: "var(--border-width-s)", style: "var(--border-style-default)", color: "var(--border-color-neutral-strongest)" }} + padding="var(--spacing-padding-m)" + outline={{ + width: "var(--border-width-s)", + style: "var(--border-style-default)", + color: "var(--border-color-neutral-strongest)", + }} boxShadow="10px 5px 5px #fe0123" > <p style={{ margin: 0 }}> @@ -246,7 +265,11 @@ const Container = () => ( <Title title="Border and outline" level={4} /> <ExampleContainer> <DxcContainer - outline={{ color: "var(--border-color-secondary-medium)", style: "var(--border-style-default)", offset: "var(--spacing-padding-xxxs)" }} + outline={{ + color: "var(--border-color-secondary-medium)", + style: "var(--border-style-default)", + offset: "var(--spacing-padding-xxxs)", + }} border={{ top: { style: "var(--border-style-default)" } }} > Example text diff --git a/packages/lib/src/container/Container.test.tsx b/packages/lib/src/container/Container.test.tsx index 0e54c959d1..0c8a4c5c7b 100644 --- a/packages/lib/src/container/Container.test.tsx +++ b/packages/lib/src/container/Container.test.tsx @@ -8,22 +8,22 @@ describe("Container component tests", () => { boxSizing="border-box" width="200px" height="200px" - background={{ color: "color_purple_400" }} + background={{ color: "var(--color-bg-primary-medium)" }} border={{ top: { - width: "2px", - color: "color_blue_600", - style: "solid", + width: "var(--border-width-m)", + color: "var(--border-color-secondary-strong)", + style: "var(--border-style-default)", }, bottom: { - width: "thick", - color: "color_purple_600", - style: "solid", + width: "var(--border-width-l)", + color: "var(--border-color-primary-strong)", + style: "var(--border-style-default)", }, }} - borderRadius="0 0 0.25rem 0.25rem" - padding="medium" - margin="large" + borderRadius="var(--border-radius-none) var(--border-radius-none) var(--border-radius-s) var(--border-radius-s)" + padding="var(--spacing-padding-m)" + margin="var(--spacing-padding-l)" > <b>Example text</b> </DxcContainer> diff --git a/packages/lib/src/container/Container.tsx b/packages/lib/src/container/Container.tsx index 36ad1da0cc..4abf8d90be 100644 --- a/packages/lib/src/container/Container.tsx +++ b/packages/lib/src/container/Container.tsx @@ -1,6 +1,5 @@ import styled from "styled-components"; import ContainerPropsType, { BorderProperties, StyledProps } from "./types"; -import { spaces } from "../common/variables"; const getBorderStyles = (direction: "top" | "bottom" | "left" | "right", borderProperties: BorderProperties) => `border-${direction}: ${borderProperties.width ?? ""} ${borderProperties.style ?? ""} ${ @@ -63,21 +62,21 @@ const Container = styled.div<StyledProps>` } return styles; }}; - margin: ${({ margin }) => (typeof margin === "string" ? spaces[margin] : "")}; - margin-top: ${({ margin }) => (typeof margin === "object" && margin.top ? spaces[margin.top] : "")}; - margin-right: ${({ margin }) => (typeof margin === "object" && margin.right ? spaces[margin.right] : "")}; - margin-bottom: ${({ margin }) => (typeof margin === "object" && margin.bottom ? spaces[margin.bottom] : "")}; - margin-left: ${({ margin }) => (typeof margin === "object" && margin.left ? spaces[margin.left] : "")}; + margin: ${({ margin }) => (typeof margin === "string" ? margin : "")}; + margin-top: ${({ margin }) => (typeof margin === "object" && margin.top ? margin.top : "")}; + margin-right: ${({ margin }) => (typeof margin === "object" && margin.right ? margin.right : "")}; + margin-bottom: ${({ margin }) => (typeof margin === "object" && margin.bottom ? margin.bottom : "")}; + margin-left: ${({ margin }) => (typeof margin === "object" && margin.left ? margin.left : "")}; outline: ${({ outline }) => `${outline?.width ?? ""} ${outline?.style ?? ""} ${outline?.color ?? ""}`}; outline-offset: ${({ outline }) => outline?.offset}; overflow: ${({ $overflow }) => (typeof $overflow === "string" ? $overflow : "")}; overflow-x: ${({ $overflow }) => (typeof $overflow === "object" ? `${$overflow?.x}` : "")}; overflow-y: ${({ $overflow }) => (typeof $overflow === "object" ? `${$overflow?.y}` : "")}; - padding: ${({ padding }) => (typeof padding === "string" ? spaces[padding] : "")}; - padding-top: ${({ padding }) => (typeof padding === "object" && padding.top ? spaces[padding.top] : "")}; - padding-right: ${({ padding }) => (typeof padding === "object" && padding.right ? spaces[padding.right] : "")}; - padding-bottom: ${({ padding }) => (typeof padding === "object" && padding.bottom ? spaces[padding.bottom] : "")}; - padding-left: ${({ padding }) => (typeof padding === "object" && padding.left ? spaces[padding.left] : "")}; + padding: ${({ padding }) => (typeof padding === "string" ? padding : "")}; + padding-top: ${({ padding }) => (typeof padding === "object" && padding.top ? padding.top : "")}; + padding-right: ${({ padding }) => (typeof padding === "object" && padding.right ? padding.right : "")}; + padding-bottom: ${({ padding }) => (typeof padding === "object" && padding.bottom ? padding.bottom : "")}; + padding-left: ${({ padding }) => (typeof padding === "object" && padding.left ? padding.left : "")}; `; export default function DxcContainer({ display, width, height, overflow, ...props }: ContainerPropsType) { diff --git a/packages/lib/src/container/types.ts b/packages/lib/src/container/types.ts index 683cac799f..2346f54204 100644 --- a/packages/lib/src/container/types.ts +++ b/packages/lib/src/container/types.ts @@ -1,13 +1,11 @@ import { ReactNode } from "react"; -import { Space as SpacingValues } from "../common/utils"; -type Space = - | SpacingValues - | { - top?: SpacingValues; - right?: SpacingValues; - bottom?: SpacingValues; - left?: SpacingValues; - }; + +type Space = { + top?: string; + right?: string; + bottom?: string; + left?: string; +}; type Inset = { top?: string; @@ -35,11 +33,11 @@ export type BorderProperties = { type Border = | BorderProperties | { - top?: BorderProperties; - right?: BorderProperties; - bottom?: BorderProperties; - left?: BorderProperties; - }; + top?: BorderProperties; + right?: BorderProperties; + bottom?: BorderProperties; + left?: BorderProperties; + }; type Outline = BorderProperties & { offset?: string; @@ -80,7 +78,7 @@ type Props = { /** * Custom content inside the container. */ - children: ReactNode; + children?: ReactNode; /** * Sets the display CSS property. * The set of values is limited to the ones related to the outer display type. @@ -108,17 +106,9 @@ type Props = { */ inset?: Inset; /** - * Size of the margin to be applied to the component. - * You can pass an object with 'top', 'bottom', 'left' and 'right' properties - * in order to specify different margin sizes. + * Size of the margin to be applied to the container. */ - margin?: Space; - /** - * Sets the max-height CSS property. - * - * See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/max-height - */ - maxWidth?: string; + margin?: string | Space; /** * Sets the max-width CSS property. * @@ -126,17 +116,23 @@ type Props = { */ maxHeight?: string; /** - * Sets the min-height CSS property. + * Sets the max-height CSS property. * - * See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/min-height + * See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/max-height */ - minWidth?: string; + maxWidth?: string; /** * Sets the min-width CSS property. * * See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/min-width */ minHeight?: string; + /** + * Sets the min-height CSS property. + * + * See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/min-height + */ + minWidth?: string; /** * Based on the CSS property outline allows configuring all properties related * to the outline of a container. @@ -149,11 +145,9 @@ type Props = { */ overflow?: Overflow; /** - * Size of the margin to be applied to the component. - * You can pass an object with 'top', 'bottom', 'left' and 'right' properties - * in order to specify different margin sizes. + * Size of the padding to be applied to the container. */ - padding?: Space; + padding?: string | Space; /** * Sets the position CSS property. * @@ -176,9 +170,9 @@ type Props = { export type StyledProps = Omit<Props, "display" | "width" | "height" | "opacity" | "overflow"> & { $display?: "block" | "inline-block" | "inline" | "none"; - $width?: string; $height?: string; $overflow?: Overflow; + $width?: string; }; export default Props; diff --git a/packages/lib/src/contextual-menu/Section.tsx b/packages/lib/src/contextual-menu/Section.tsx index a8a09e47d3..e33d1b3d37 100644 --- a/packages/lib/src/contextual-menu/Section.tsx +++ b/packages/lib/src/contextual-menu/Section.tsx @@ -32,7 +32,7 @@ export default function Section({ index, length, section }: SectionProps) { ))} </SubMenu> {index !== length - 1 && ( - <DxcInset top="0.25rem" bottom="0.25rem"> + <DxcInset top="var(--spacing-padding-xxs)" bottom="var(--spacing-padding-xxs)"> <DxcDivider color="lightGrey" /> </DxcInset> )} diff --git a/packages/lib/src/data-grid/DataGrid.stories.tsx b/packages/lib/src/data-grid/DataGrid.stories.tsx index 5c3f1c41c6..af1b220c47 100644 --- a/packages/lib/src/data-grid/DataGrid.stories.tsx +++ b/packages/lib/src/data-grid/DataGrid.stories.tsx @@ -151,7 +151,7 @@ const expandableRows = [ complete: 46, priority: "High", issueType: "Bug", - expandedContent: <DxcContainer> Custom content 1</DxcContainer>, + expandedContent: <DxcContainer>Custom content 1</DxcContainer>, expandedContentHeight: 470, actions: <DxcDataGrid.ActionsCell actions={actions} />, }, @@ -161,7 +161,7 @@ const expandableRows = [ complete: 51, priority: "High", issueType: "Epic", - expandedContent: <DxcContainer> Custom content 1</DxcContainer>, + expandedContent: <DxcContainer>Custom content 1</DxcContainer>, actions: <DxcDataGrid.ActionsCell actions={actions} />, }, { @@ -170,7 +170,7 @@ const expandableRows = [ complete: 40, priority: "High", issueType: "Improvement", - expandedContent: <DxcContainer> Custom content 1</DxcContainer>, + expandedContent: <DxcContainer>Custom content 1</DxcContainer>, actions: <DxcDataGrid.ActionsCell actions={actions} />, }, { @@ -179,7 +179,7 @@ const expandableRows = [ complete: 10, priority: "High", issueType: "Improvement", - expandedContent: <DxcContainer> Custom content 1</DxcContainer>, + expandedContent: <DxcContainer>Custom content 1</DxcContainer>, actions: <DxcDataGrid.ActionsCell actions={actions} />, }, { @@ -188,7 +188,7 @@ const expandableRows = [ complete: 68, priority: "High", issueType: "Improvement", - expandedContent: <DxcContainer> Custom content 1</DxcContainer>, + expandedContent: <DxcContainer>Custom content 1</DxcContainer>, actions: <DxcDataGrid.ActionsCell actions={actions} />, }, { @@ -197,7 +197,7 @@ const expandableRows = [ complete: 37, priority: "High", issueType: "Improvement", - expandedContent: <DxcContainer> Custom content 1</DxcContainer>, + expandedContent: <DxcContainer>Custom content 1</DxcContainer>, actions: <DxcDataGrid.ActionsCell actions={actions} />, }, { @@ -206,7 +206,7 @@ const expandableRows = [ complete: 73, priority: "Medium", issueType: "Story", - expandedContent: <DxcContainer> Custom content 1</DxcContainer>, + expandedContent: <DxcContainer>Custom content 1</DxcContainer>, actions: <DxcDataGrid.ActionsCell actions={actions} />, }, { @@ -215,7 +215,7 @@ const expandableRows = [ complete: 27, priority: "Medium", issueType: "Story", - expandedContent: <DxcContainer> Custom content 1</DxcContainer>, + expandedContent: <DxcContainer>Custom content 1</DxcContainer>, actions: <DxcDataGrid.ActionsCell actions={actions} />, }, { @@ -224,7 +224,7 @@ const expandableRows = [ complete: 36, priority: "Critical", issueType: "Epic", - expandedContent: <DxcContainer> Custom content 1</DxcContainer>, + expandedContent: <DxcContainer>Custom content 1</DxcContainer>, actions: <DxcDataGrid.ActionsCell actions={actions} />, }, ]; @@ -236,7 +236,7 @@ const expandableRowsPaginated = [ complete: 46, priority: "High", issueType: "Bug", - expandedContent: <DxcContainer> Custom content 1</DxcContainer>, + expandedContent: <DxcContainer>Custom content 1</DxcContainer>, expandedContentHeight: 470, }, { @@ -245,7 +245,7 @@ const expandableRowsPaginated = [ complete: 51, priority: "High", issueType: "Epic", - expandedContent: <DxcContainer> Custom content 1</DxcContainer>, + expandedContent: <DxcContainer>Custom content 1</DxcContainer>, }, { id: 33, @@ -253,7 +253,7 @@ const expandableRowsPaginated = [ complete: 40, priority: "High", issueType: "Improvement", - expandedContent: <DxcContainer> Custom content 1</DxcContainer>, + expandedContent: <DxcContainer>Custom content 1</DxcContainer>, }, { id: 44, @@ -261,7 +261,7 @@ const expandableRowsPaginated = [ complete: 10, priority: "High", issueType: "Improvement", - expandedContent: <DxcContainer> Custom content 1</DxcContainer>, + expandedContent: <DxcContainer>Custom content 1</DxcContainer>, }, { id: 55, @@ -269,7 +269,7 @@ const expandableRowsPaginated = [ complete: 68, priority: "High", issueType: "Improvement", - expandedContent: <DxcContainer> Custom content 1</DxcContainer>, + expandedContent: <DxcContainer>Custom content 1</DxcContainer>, }, { id: 66, @@ -277,7 +277,7 @@ const expandableRowsPaginated = [ complete: 37, priority: "High", issueType: "Improvement", - expandedContent: <DxcContainer> Custom content 1</DxcContainer>, + expandedContent: <DxcContainer>Custom content 1</DxcContainer>, }, { id: 77, @@ -285,7 +285,7 @@ const expandableRowsPaginated = [ complete: 73, priority: "Medium", issueType: "Story", - expandedContent: <DxcContainer> Custom content 1</DxcContainer>, + expandedContent: <DxcContainer>Custom content 1</DxcContainer>, }, { id: 88, @@ -293,7 +293,7 @@ const expandableRowsPaginated = [ complete: 27, priority: "Medium", issueType: "Story", - expandedContent: <DxcContainer> Custom content 1</DxcContainer>, + expandedContent: <DxcContainer>Custom content 1</DxcContainer>, }, { id: 99, @@ -301,7 +301,7 @@ const expandableRowsPaginated = [ complete: 36, priority: "Critical", issueType: "Epic", - expandedContent: <DxcContainer> Custom content 1</DxcContainer>, + expandedContent: <DxcContainer>Custom content 1</DxcContainer>, }, ]; diff --git a/packages/lib/src/dialog/Dialog.stories.tsx b/packages/lib/src/dialog/Dialog.stories.tsx index 7c86b7b279..20061cceda 100644 --- a/packages/lib/src/dialog/Dialog.stories.tsx +++ b/packages/lib/src/dialog/Dialog.stories.tsx @@ -36,8 +36,8 @@ const Dialog = () => ( <ExampleContainer expanded={true}> <Title title="Default dialog" theme="light" level={4} /> <DxcDialog> - <DxcInset space="1.5rem"> - <DxcFlex direction="column" gap="1rem"> + <DxcInset space="var(--spacing-padding-l)"> + <DxcFlex direction="column" gap="var(--spacing-padding-m)"> <DxcHeading level={4} text="Example title" /> <DxcParagraph> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi egestas luctus porttitor. Donec massa magna, @@ -60,10 +60,10 @@ const DialogInput = () => ( <ExampleContainer expanded={true}> <Title title="Dialog with inputs" theme="light" level={4} /> <DxcDialog> - <DxcInset space="1.5rem"> - <DxcFlex gap="2rem" direction="column"> + <DxcInset space="var(--spacing-padding-l)"> + <DxcFlex gap="var(--spacing-padding-xl)" direction="column"> <DxcHeading level={4} text="Example form" /> - <DxcFlex gap="1rem" direction="column"> + <DxcFlex gap="var(--spacing-padding-m)" direction="column"> <DxcTextInput size="fillParent" label="Name" /> <DxcTextInput size="fillParent" label="Surname" /> </DxcFlex> @@ -74,7 +74,7 @@ const DialogInput = () => ( text: "User: arn:aws:xxx::xxxxxxxxxxxx:assumed-role/assure-sandbox-xxxx-xxxxxxxxxxxxxxxxxxxxxxxxxx/sandbox-xxxx-xxxxxxxxxxxxxxxxxx is not authorized to perform: lambda:xxxxxxxxxxxxxx on resource: arn:aws:lambda:us-east-1:xxxxxxxxxxxx:function:sandbox-xxxx-xx-xxxxxxx-xxxxxxx-lambda because no identity-based policy allows the lambda:xxxxxxxxxxxxxx action", }} /> - <DxcFlex justifyContent="flex-end" gap="0.5rem"> + <DxcFlex justifyContent="flex-end" gap="var(--spacing-padding-xs)"> <DxcButton label="Cancel" mode="tertiary" /> <DxcButton label="Save" /> </DxcFlex> @@ -88,8 +88,8 @@ const DialogNoOverlay = () => ( <ExampleContainer expanded={true}> <Title title="Dialog Without Overlay" theme="light" level={4} /> <DxcDialog overlay={false}> - <DxcInset space="1.5rem"> - <DxcFlex direction="column" gap="1rem"> + <DxcInset space="var(--spacing-padding-l)"> + <DxcFlex direction="column" gap="var(--spacing-padding-m)"> <DxcHeading level={4} text="Example title" /> <DxcParagraph> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi egestas luctus porttitor. Donec massa magna, @@ -112,7 +112,7 @@ const DialogCloseNoVisible = () => ( <ExampleContainer expanded={true}> <Title title="Dialog Close Visible" theme="dark" level={4} /> <DxcDialog closable={false}> - <DxcInset space="1.5rem"> + <DxcInset space="var(--spacing-padding-l)"> <DxcParagraph> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi egestas luctus porttitor. Donec massa magna, placerat sit amet felis eget, venenatis fringilla ipsum. Lorem ipsum dolor sit amet, consectetur adipiscing @@ -133,14 +133,14 @@ const RespDialog = () => ( <ExampleContainer expanded={true}> <Title title="Responsive dialog" theme="light" level={4} /> <DxcDialog> - <DxcInset space="1.5rem"> - <DxcFlex gap="2rem" direction="column"> + <DxcInset space="var(--spacing-padding-l)"> + <DxcFlex gap="var(--spacing-padding-xl)" direction="column"> <DxcHeading level={4} text="Example form" /> - <DxcFlex gap="1rem" direction="column"> + <DxcFlex gap="var(--spacing-padding-m)" direction="column"> <DxcTextInput size="fillParent" label="Name" /> <DxcTextInput size="fillParent" label="Surname" /> </DxcFlex> - <DxcFlex justifyContent="flex-end" gap="0.5rem"> + <DxcFlex justifyContent="flex-end" gap="var(--spacing-padding-xs)"> <DxcButton label="Cancel" mode="tertiary" /> <DxcButton label="Save" /> </DxcFlex> @@ -289,8 +289,8 @@ const ScrollingDialog = () => ( </DxcParagraph> </> <DxcDialog> - <DxcInset space="1.5rem"> - <DxcFlex direction="column" gap="1rem"> + <DxcInset space="var(--spacing-padding-l)"> + <DxcFlex direction="column" gap="var(--spacing-padding-m)"> <DxcHeading level={4} text="Example title" /> <DxcParagraph> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi egestas luctus porttitor. Donec massa magna, diff --git a/packages/lib/src/grid/Grid.stories.tsx b/packages/lib/src/grid/Grid.stories.tsx index 738dccb151..f160fd7e60 100644 --- a/packages/lib/src/grid/Grid.stories.tsx +++ b/packages/lib/src/grid/Grid.stories.tsx @@ -152,7 +152,7 @@ const Grid = () => ( </DxcGrid> </ExampleContainer> <Title title="Overlapping" level={4} /> - <DxcInset bottom="2rem"> + <DxcInset bottom="var(--spacing-padding-xl)"> <ExampleContainer> <DxcGrid templateRows={["50px", "50px"]}> <ColoredContainer color="yellow" height="100px"> diff --git a/packages/lib/src/image/Image.stories.tsx b/packages/lib/src/image/Image.stories.tsx index 8fcc668c4e..407bb2b710 100644 --- a/packages/lib/src/image/Image.stories.tsx +++ b/packages/lib/src/image/Image.stories.tsx @@ -34,7 +34,7 @@ const Image = () => ( metus proin arcu faucibus proin nibh sit. Vel integer sed enim in sed vel nec ut vitae. Commodo sagittis volutpat id lorem. </DxcParagraph> - <DxcInset top="2rem" bottom="2rem"> + <DxcInset top="var(--spacing-padding-xl)" bottom="var(--spacing-padding-xl)"> <DxcImage alt="Ratatouille is a great movie" caption="Ratatouille with a smile on his face." diff --git a/packages/lib/src/inset/Inset.stories.tsx b/packages/lib/src/inset/Inset.stories.tsx index 881073928f..6fbb0e6ab3 100644 --- a/packages/lib/src/inset/Inset.stories.tsx +++ b/packages/lib/src/inset/Inset.stories.tsx @@ -1,229 +1,85 @@ -import styled from "styled-components"; import Title from "../../.storybook/components/Title"; import DxcFlex from "./../flex/Flex"; import DxcInset from "./Inset"; import { Meta, StoryObj } from "@storybook/react"; +import DxcContainer from "../container/Container"; +import { ReactNode } from "react"; export default { title: "Inset", component: DxcInset, } as Meta<typeof DxcInset>; -const Container = styled.div` - background: #f2eafa; - margin: 2.5rem; -`; +const Container = ({ children }: { children: ReactNode }) => ( + <DxcContainer background={{ color: "var(--color-bg-primary-lighter)" }} margin="var(--spacing-padding-xxl)"> + {children} + </DxcContainer> +); -const Placeholder = styled.div` - min-height: 40px; - min-width: 120px; - border: 1px solid #a46ede; - border-radius: 0.5rem; - background-color: #e5d5f6; -`; +const Placeholder = () => ( + <DxcContainer + background={{ color: "var(--color-bg-primary-lighter)" }} + border={{ + color: "var(--border-color-primary-medium)", + style: "var(--border-style-default)", + width: "var(--border-width-s)", + }} + borderRadius="var(--border-radius-m)" + minHeight="var(--height-xl)" + minWidth="120px" + /> +); const Inset = () => ( <> - <Title title="Default" level={4} /> + <Title title="No space (default)" level={4} /> <Container> <DxcInset> - <Placeholder></Placeholder> - </DxcInset> - </Container> - <Title title="space = none" level={4} /> - <Container> - <DxcInset space="0rem"> - <Placeholder></Placeholder> - </DxcInset> - </Container> - <Title title="space = xxxsmall" level={4} /> - <Container> - <DxcInset space="0.125rem"> - <Placeholder></Placeholder> - </DxcInset> - </Container> - <Title title="space = xxsmall" level={4} /> - <Container> - <DxcInset space="0.25rem"> - <Placeholder></Placeholder> - </DxcInset> - </Container> - <Title title="space = xsmall" level={4} /> - <Container> - <DxcInset space="0.5rem"> - <Placeholder></Placeholder> - </DxcInset> - </Container> - <Title title="space = small" level={4} /> - <Container> - <DxcInset space="1rem"> - <Placeholder></Placeholder> - </DxcInset> - </Container> - <Title title="space = medium" level={4} /> - <Container> - <DxcInset space="1.5rem"> - <Placeholder></Placeholder> - </DxcInset> - </Container> - <Title title="space = large" level={4} /> - <Container> - <DxcInset space="2rem"> - <Placeholder></Placeholder> - </DxcInset> - </Container> - <Title title="space = xlarge" level={4} /> - <Container> - <DxcInset space="3rem"> - <Placeholder></Placeholder> - </DxcInset> - </Container> - <Title title="space = xxlarge" level={4} /> - <Container> - <DxcInset space="4rem"> - <Placeholder></Placeholder> - </DxcInset> - </Container> - <Title title="space = xxxlarge" level={4} /> - <Container> - <DxcInset space="5rem"> - <Placeholder></Placeholder> + <Placeholder /> </DxcInset> </Container> - <Title title="horizontal = none" level={4} /> + <Title title="space = xxLarge" level={4} /> <Container> - <DxcInset horizontal="0rem"> - <Placeholder></Placeholder> - </DxcInset> - </Container> - <Title title="horizontal = xxxsmall" level={4} /> - <Container> - <DxcInset horizontal="0.125rem"> - <Placeholder></Placeholder> - </DxcInset> - </Container> - <Title title="horizontal = xxsmall" level={4} /> - <Container> - <DxcInset horizontal="0.25rem"> - <Placeholder></Placeholder> - </DxcInset> - </Container> - <Title title="horizontal = xsmall" level={4} /> - <Container> - <DxcInset horizontal="0.5rem"> - <Placeholder></Placeholder> + <DxcInset space="var(--spacing-padding-xxl)"> + <Placeholder /> </DxcInset> </Container> <Title title="horizontal = small" level={4} /> <Container> - <DxcInset horizontal="1rem"> - <Placeholder></Placeholder> - </DxcInset> - </Container> - <Title title="horizontal = medium" level={4} /> - <Container> - <DxcInset horizontal="1.5rem"> - <Placeholder></Placeholder> - </DxcInset> - </Container> - <Title title="horizontal = large" level={4} /> - <Container> - <DxcInset horizontal="2rem"> - <Placeholder></Placeholder> - </DxcInset> - </Container> - <Title title="horizontal = xlarge" level={4} /> - <Container> - <DxcInset horizontal="3rem"> - <Placeholder></Placeholder> - </DxcInset> - </Container> - <Title title="horizontal = xxlarge" level={4} /> - <Container> - <DxcInset horizontal="4rem"> - <Placeholder></Placeholder> - </DxcInset> - </Container> - <Title title="horizontal = xxxlarge" level={4} /> - <Container> - <DxcInset horizontal="5rem"> - <Placeholder></Placeholder> - </DxcInset> - </Container> - <Title title="vertical = none" level={4} /> - <Container> - <DxcInset vertical="0rem"> - <Placeholder></Placeholder> - </DxcInset> - </Container> - <Title title="vertical = xxxsmall" level={4} /> - <Container> - <DxcInset vertical="0.125rem"> - <Placeholder></Placeholder> - </DxcInset> - </Container> - <Title title="vertical = xxsmall" level={4} /> - <Container> - <DxcInset vertical="0.25rem"> - <Placeholder></Placeholder> - </DxcInset> - </Container> - <Title title="vertical = xsmall" level={4} /> - <Container> - <DxcInset vertical="0.5rem"> - <Placeholder></Placeholder> - </DxcInset> - </Container> - <Title title="vertical = small" level={4} /> - <Container> - <DxcInset vertical="1rem"> - <Placeholder></Placeholder> - </DxcInset> - </Container> - <Title title="vertical = medium" level={4} /> - <Container> - <DxcInset vertical="1.5rem"> - <Placeholder></Placeholder> + <DxcInset horizontal="var(--spacing-padding-s)"> + <Placeholder /> </DxcInset> </Container> <Title title="vertical = large" level={4} /> <Container> - <DxcInset vertical="2rem"> - <Placeholder></Placeholder> - </DxcInset> - </Container> - <Title title="vertical = xlarge" level={4} /> - <Container> - <DxcInset vertical="3rem"> - <Placeholder></Placeholder> - </DxcInset> - </Container> - <Title title="vertical = xxlarge" level={4} /> - <Container> - <DxcInset vertical="4rem"> - <Placeholder></Placeholder> - </DxcInset> - </Container> - <Title title="vertical = xxxlarge" level={4} /> - <Container> - <DxcInset vertical="5rem"> - <Placeholder></Placeholder> + <DxcInset vertical="var(--spacing-padding-l)"> + <Placeholder /> </DxcInset> </Container> <Title title="top = xxsmall, right= medium, bottom = large and left = xxlarge" level={4} /> <Container> - <DxcInset top="0.25rem" right="1.5rem" bottom="2rem" left="4rem"> - <Placeholder></Placeholder> + <DxcInset + top="var(--spacing-padding-xxs)" + right="var(--spacing-padding-m)" + bottom="var(--spacing-padding-l)" + left="var(--spacing-padding-xl)" + > + <Placeholder /> </DxcInset> </Container> <Title title="Inside a flex column" level={4} /> <Container> <DxcFlex direction="column" gap="1rem"> - <Placeholder></Placeholder> - <DxcInset top="0.25rem" right="1.5rem" bottom="2rem" left="4rem"> - <Placeholder></Placeholder> + <Placeholder /> + <DxcInset + top="var(--spacing-padding-xxs)" + right="var(--spacing-padding-l)" + bottom="var(--spacing-padding-xl)" + left="var(--spacing-padding-xxl)" + > + <Placeholder /> </DxcInset> - <Placeholder></Placeholder> + <Placeholder /> </DxcFlex> </Container> </> diff --git a/packages/lib/src/inset/Inset.tsx b/packages/lib/src/inset/Inset.tsx index f1ffbded1c..c952c7d9d0 100644 --- a/packages/lib/src/inset/Inset.tsx +++ b/packages/lib/src/inset/Inset.tsx @@ -1,28 +1,19 @@ -import styled from "styled-components"; import InsetPropsType from "./types"; -import { CoreSpacingTokensType } from "../common/coreTokens"; +import DxcContainer from "../container/Container"; -const getSpacingValue = (spacingName?: CoreSpacingTokensType) => spacingName ?? "0rem"; - -const StyledInset = styled.div<InsetPropsType>` - ${({ space, horizontal, vertical, top, right, bottom, left }) => ` - padding: ${getSpacingValue(top || vertical || space)} ${getSpacingValue(right || horizontal || space)} - ${getSpacingValue(bottom || vertical || space)} ${getSpacingValue(left || horizontal || space)}; -`} -`; - -const Inset = ({ space, horizontal, vertical, top, right, bottom, left, children }: InsetPropsType) => ( - <StyledInset - space={space} - horizontal={horizontal} - vertical={vertical} - top={top} - right={right} - bottom={bottom} - left={left} - > - {children} - </StyledInset> -); - -export default Inset; +export default function DxcInset({ bottom, children, horizontal, left, right, space, top, vertical }: InsetPropsType) { + return ( + <DxcContainer + padding={ + space || { + bottom: (bottom || vertical) ?? "0rem", + left: (left || horizontal) ?? "0rem", + right: (right || horizontal) ?? "0rem", + top: (top || vertical) ?? "0rem", + } + } + > + {children} + </DxcContainer> + ); +} diff --git a/packages/lib/src/inset/types.ts b/packages/lib/src/inset/types.ts index cb6567e7c2..af9833ef26 100644 --- a/packages/lib/src/inset/types.ts +++ b/packages/lib/src/inset/types.ts @@ -1,39 +1,38 @@ import { ReactNode } from "react"; -import { CoreSpacingTokensType } from "../common/coreTokens"; type Props = { /** - * Applies the spacing scale to all sides. + * Applies the spacing scale to the bottom side. */ - space?: CoreSpacingTokensType; + bottom?: string; /** - * Applies the spacing scale to the left and right sides. + * Custom content inside the inset. */ - horizontal?: CoreSpacingTokensType; + children: ReactNode; /** - * Applies the spacing scale to the top and bottom sides. + * Applies the spacing scale to the left and right sides. */ - vertical?: CoreSpacingTokensType; + horizontal?: string; /** - * Applies the spacing scale to the top side. + * Applies the spacing scale to the left side. */ - top?: CoreSpacingTokensType; + left?: string; /** * Applies the spacing scale to the right side. */ - right?: CoreSpacingTokensType; + right?: string; /** - * Applies the spacing scale to the bottom side. + * Applies the spacing scale to all sides. */ - bottom?: CoreSpacingTokensType; + space?: string; /** - * Applies the spacing scale to the left side. + * Applies the spacing scale to the top side. */ - left?: CoreSpacingTokensType; + top?: string; /** - * Custom content inside the inset. + * Applies the spacing scale to the top and bottom sides. */ - children: ReactNode; + vertical?: string; }; export default Props; diff --git a/packages/lib/src/quick-nav/QuickNav.tsx b/packages/lib/src/quick-nav/QuickNav.tsx index 333d0e4c28..dcb1666c53 100644 --- a/packages/lib/src/quick-nav/QuickNav.tsx +++ b/packages/lib/src/quick-nav/QuickNav.tsx @@ -15,18 +15,18 @@ const DxcQuickNav = ({ title, links }: QuickNavTypes): JSX.Element => { return ( <ThemeProvider theme={colorsTheme.quickNav}> <QuickNavContainer> - <DxcFlex direction="column" gap="0.5rem"> + <DxcFlex direction="column" gap="var(--spacing-gap-s)"> <DxcHeading level={4} text={title || translatedLabels.quickNav.contentTitle} /> <ListColumn> {links.map((link) => ( <li key={link.label}> - <DxcInset space="0.25rem"> + <DxcInset space="var(--spacing-padding-xxs)"> <DxcTypography> <Link href={`#${slugify(link.label, { lower: true })}`}>{link.label}</Link> <ListSecondColumn> {link.links?.map((sublink) => ( <li key={sublink.label}> - <DxcInset horizontal="0.5rem"> + <DxcInset horizontal="var(--spacing-padding-xs)"> <DxcTypography> <Link href={`#${slugify(link?.label, { lower: true })}-${slugify(sublink?.label, { diff --git a/packages/lib/src/sidenav/Sidenav.stories.tsx b/packages/lib/src/sidenav/Sidenav.stories.tsx index a0398bbac5..d4eb078d78 100644 --- a/packages/lib/src/sidenav/Sidenav.stories.tsx +++ b/packages/lib/src/sidenav/Sidenav.stories.tsx @@ -217,7 +217,7 @@ const ActiveGroupSidenav = () => ( <Title title="Active state for groups (selected and not)" theme="light" level={4} /> <DxcSidenav title={<DxcSidenav.Title>Dxc technology</DxcSidenav.Title>}> <DxcSidenav.Section> - <DxcInset space="1rem"> + <DxcInset space="var(--spacing-padding-m)"> <DxcSelect defaultValue="1" options={[ diff --git a/packages/lib/src/tooltip/Tooltip.stories.tsx b/packages/lib/src/tooltip/Tooltip.stories.tsx index 98fc64922e..d11dbde965 100644 --- a/packages/lib/src/tooltip/Tooltip.stories.tsx +++ b/packages/lib/src/tooltip/Tooltip.stories.tsx @@ -16,7 +16,7 @@ const Tooltip = () => ( <> <Title title="Default tooltip" theme="light" level={4} /> <ExampleContainer> - <DxcInset bottom="3rem"> + <DxcInset bottom="var(--spacing-padding-xxl)"> <DxcTooltip label="Tooltip Test"> <DxcButton label="Hoverable button" /> </DxcTooltip> @@ -29,7 +29,7 @@ const LargeTextWithinTooltip = () => ( <> <Title title="Multiple line tooltip" theme="light" level={4} /> <ExampleContainer> - <DxcInset bottom="5rem" left="1rem"> + <DxcInset bottom="var(--spacing-padding-xxl)" left="var(--spacing-padding-m)"> <DxcTooltip label="Tooltip Test with a large text to display in the container while hovering the component"> <DxcButton label="Hoverable button" /> </DxcTooltip> @@ -42,7 +42,7 @@ const TopTooltip = () => ( <> <Title title="Top tooltip" theme="light" level={4} /> <ExampleContainer> - <DxcInset top="3rem"> + <DxcInset top="var(--spacing-padding-xxl)"> <DxcTooltip label="Tooltip Test" position="top"> <DxcButton label="Hoverable button" /> </DxcTooltip>