diff --git a/.changeset/poor-scissors-chew.md b/.changeset/poor-scissors-chew.md new file mode 100644 index 00000000000..eda562ba27b --- /dev/null +++ b/.changeset/poor-scissors-chew.md @@ -0,0 +1,5 @@ +--- +"@salt-ds/lab": patch +--- + +fix alignment for titles spanning into multiple lines, wrap labs dialog header in H2 to avoid breaking change diff --git a/packages/core/src/dialog/DialogHeader.css b/packages/core/src/dialog/DialogHeader.css index 0fa72081a0e..fa35e6ba786 100644 --- a/packages/core/src/dialog/DialogHeader.css +++ b/packages/core/src/dialog/DialogHeader.css @@ -17,6 +17,7 @@ /* Styles applied to the status indicator icon overriding its default size */ .saltDialogHeader .saltStatusIndicator.saltIcon { --icon-size: var(--salt-text-h2-lineHeight); + padding-top: calc((var(--salt-size-base) - var(--salt-text-h2-lineHeight)) / 2); } /* Styles applied to DialogHeader when accent={true} */ diff --git a/packages/lab/src/dialog/DialogHeader.css b/packages/lab/src/dialog/DialogHeader.css index 17aeb97d312..3d32cd686ad 100644 --- a/packages/lab/src/dialog/DialogHeader.css +++ b/packages/lab/src/dialog/DialogHeader.css @@ -3,12 +3,14 @@ padding-bottom: var(--salt-spacing-300); padding-left: var(--salt-spacing-300); padding-right: var(--salt-spacing-300); - align-items: center; display: flex; flex-direction: row; gap: var(--salt-spacing-100); box-sizing: border-box; } +.saltDialogHeader-header { + margin: 0; +} .saltDialogHeader-container { flex-grow: 1; diff --git a/packages/lab/src/dialog/DialogHeader.tsx b/packages/lab/src/dialog/DialogHeader.tsx index 6ea6463beff..22395b47826 100644 --- a/packages/lab/src/dialog/DialogHeader.tsx +++ b/packages/lab/src/dialog/DialogHeader.tsx @@ -1,4 +1,5 @@ import { + H2, StatusIndicator, Text, type ValidationStatus, @@ -86,7 +87,7 @@ export const DialogHeader = forwardRef( {preheader && ( {preheader} )} - {header} +

{header}

{description && ( diff --git a/packages/lab/src/overlay/OverlayHeader.css b/packages/lab/src/overlay/OverlayHeader.css index 2a74f8fd5b0..da5e7af7276 100644 --- a/packages/lab/src/overlay/OverlayHeader.css +++ b/packages/lab/src/overlay/OverlayHeader.css @@ -1,7 +1,6 @@ .saltOverlayHeader { padding: var(--salt-spacing-100); width: 100%; - align-items: center; display: flex; flex-direction: row; justify-content: stretch; diff --git a/packages/lab/stories/dialog/dialog.qa.stories.tsx b/packages/lab/stories/dialog/dialog.qa.stories.tsx index a3a355afe7e..e9b7cc3ecdc 100644 --- a/packages/lab/stories/dialog/dialog.qa.stories.tsx +++ b/packages/lab/stories/dialog/dialog.qa.stories.tsx @@ -1,4 +1,5 @@ -import { Dialog, H2 } from "@salt-ds/core"; +import { Button, Dialog } from "@salt-ds/core"; +import { CloseIcon } from "@salt-ds/icons"; import { DialogHeader } from "@salt-ds/lab"; import type { Meta, StoryFn } from "@storybook/react"; import { QAContainer, type QAContainerProps } from "docs/components"; @@ -11,7 +12,7 @@ export default { export const DialogHeaders: StoryFn = () => ( Terms and conditions} + header="Terms and conditions" style={{ width: 600, }} @@ -20,40 +21,47 @@ export const DialogHeaders: StoryFn = () => ( style={{ width: 600, }} - header={

Terms and conditions

} + header="Terms and conditions" preheader="Ensure you read and agree to these Terms" /> Terms and conditions} + header="Terms and conditions" preheader="Ensure you read and agree to these Terms" description="Effective date: August 29, 2024" /> Terms and conditions} + header="Terms and conditions" style={{ width: 600, }} /> + + + } status="info" style={{ width: 600, }} - header={

Terms and conditions

} - preheader="Ensure you read and agree to these Terms" + header="Terms and conditions" /> + + + } status="info" style={{ width: 600, }} - header={

Terms and conditions

} - preheader="Ensure you read and agree to these Terms" - description="Effective date: August 29, 2024" + header="Complete terms and conditions for using the services provided by our company" />
); diff --git a/packages/lab/stories/dialog/dialog.stories.tsx b/packages/lab/stories/dialog/dialog.stories.tsx index f1aaa1e77be..ea20eeac614 100644 --- a/packages/lab/stories/dialog/dialog.stories.tsx +++ b/packages/lab/stories/dialog/dialog.stories.tsx @@ -145,6 +145,12 @@ export const Default = DialogTemplate.bind({}); Default.args = { id: "Default", }; +export const LongTitle = DialogTemplate.bind({}); +Default.args = { + id: "LongTitle", + header: + "Complete terms and conditions for using the services provided by our company", +}; const AlertDialogTemplate: StoryFn< DialogProps & { header: ReactNode; content: ReactNode } diff --git a/packages/lab/stories/overlay/overlay.qa.stories.tsx b/packages/lab/stories/overlay/overlay.qa.stories.tsx index 1c7b5a5a0c4..3288dd2fcc9 100644 --- a/packages/lab/stories/overlay/overlay.qa.stories.tsx +++ b/packages/lab/stories/overlay/overlay.qa.stories.tsx @@ -29,8 +29,8 @@ export const Default: StoryFn = (props) => { return ( = (props) => { - + Header block} + header={

Guidelines for optimal use of our application

} actions={} /> diff --git a/packages/lab/stories/overlay/overlay.stories.tsx b/packages/lab/stories/overlay/overlay.stories.tsx index cf640781114..4a9d6cb56ea 100644 --- a/packages/lab/stories/overlay/overlay.stories.tsx +++ b/packages/lab/stories/overlay/overlay.stories.tsx @@ -13,14 +13,14 @@ import { } from "@salt-ds/core"; import { CloseIcon } from "@salt-ds/icons"; import { OverlayHeader } from "@salt-ds/lab"; -import type { Meta } from "@storybook/react"; +import type { Meta, StoryFn } from "@storybook/react"; import { useState } from "react"; export default { title: "Lab/Overlay Header", } as Meta; -export const Header = ({ onOpenChange }: OverlayProps) => { +const HeaderTemplate: StoryFn = ({ onOpenChange, ...props }: OverlayProps) => { const [open, setOpen] = useState(false); const id = useId(); @@ -40,7 +40,7 @@ export const Header = ({ onOpenChange }: OverlayProps) => { width: 500, }} > - Header block} /> + Header block} {...props} /> @@ -62,6 +62,29 @@ export const Header = ({ onOpenChange }: OverlayProps) => { ); }; +export const Header = HeaderTemplate.bind({}); +Header.args = {}; + +export const LongHeader = HeaderTemplate.bind({}); +LongHeader.args = { + header: ( +

+ Comprehensive guidelines and detailed instructions for the optimal use and + application of our services to ensure maximum efficiency and user + satisfaction +

+ ), + actions: ( + + ), +}; + export const HeaderWithCloseButton = ({ onOpenChange }: OverlayProps) => { const [open, setOpen] = useState(false); const id = useId();