The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Center Dialog.Description like Dialog.Title (#28063)
Raphaël Bosi5f2b2c94c1b1
diff --git a/packages/twenty-docs/ui/primitives/surfaces/dialog.mdx b/packages/twenty-docs/ui/primitives/surfaces/dialog.mdxindex 48426599d44..fbd6e9963dc 100644--- a/packages/twenty-docs/ui/primitives/surfaces/dialog.mdx+++ b/packages/twenty-docs/ui/primitives/surfaces/dialog.mdx@@ -138,7 +138,9 @@ To open one dialog from triggers outside `Root`, create a handle once with `DialImperative actions take effect only while the associated Root is mounted. Root's `actionsRef` also exposes `close()` and `unmount()` for explicit transition control. To control an external closing animation, call `eventDetails.preventUnmountOnClose()` in `onOpenChange`, then call the `unmount()` action when the animation finishes.-`Title` uses `Heading` and defaults to an `h2` with large type, primary text color, centered alignment, and spacing-4 below it. Use `level` to change the heading level independently of `size`, or `color` to change its text color. Native `className`, `style`, refs, and `render` are forwarded to the heading. Keep a heading element when using `render`.+`Title` uses `Heading` and defaults to an `h2` with large type, primary text color, centered alignment, and spacing-4 below it. Use `level` to change the heading level independently of `size`, or `color` to change its text color. Native `className`, `style`, refs, and `render` are forwarded to the heading. Keep a heading element when using `render`. `Description` is centered like `Title`; AlertDialog keeps both left-aligned.++`Popup` has no padding. `Header`, `Body` and `Footer` provide the inset, so content placed directly in `Popup` sits against its edges.## Focus, scrolling, and dismissaldiff --git a/packages/twenty-front/src/modules/onboarding/components/OnboardingSkipDialog.tsx b/packages/twenty-front/src/modules/onboarding/components/OnboardingSkipDialog.tsxindex 995aa078be4..9b81342c789 100644--- a/packages/twenty-front/src/modules/onboarding/components/OnboardingSkipDialog.tsx+++ b/packages/twenty-front/src/modules/onboarding/components/OnboardingSkipDialog.tsx@@ -15,7 +15,6 @@ import { themeCssVariables } from 'twenty-ui/theme';const StyledHeader = styled(Dialog.Header)`align-items: center;position: relative;- text-align: center;`;const StyledCloseButton = styled.div`diff --git a/packages/twenty-oxlint-rules/rules/no-twenty-ui-override.exemptions.ts b/packages/twenty-oxlint-rules/rules/no-twenty-ui-override.exemptions.tsindex 070d8fe1034..69188eb5ab4 100644--- a/packages/twenty-oxlint-rules/rules/no-twenty-ui-override.exemptions.ts+++ b/packages/twenty-oxlint-rules/rules/no-twenty-ui-override.exemptions.ts@@ -49,6 +49,11 @@ export const TWENTY_UI_OVERRIDE_EXEMPTIONS = ['packages/twenty-front/src/modules/object-record/record-update-multiple/components/UpdateMultipleRecordsForm.tsx',reason: 'Section.Root laid out as the padded column of bulk edit fields',},+ {+ filePath:+ 'packages/twenty-front/src/modules/onboarding/components/OnboardingSkipDialog.tsx',+ reason: 'Dialog.Header centers the visual and anchors the close button',+ },{filePath:'packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsPasswordController.tsx',diff --git a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__stories__/AlertDialog.stories.tsx b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__stories__/AlertDialog.stories.tsxindex a42494b9b3e..fa973fc2811 100644--- a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__stories__/AlertDialog.stories.tsx+++ b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__stories__/AlertDialog.stories.tsx@@ -32,6 +32,13 @@ export const Default: Story = {expect(dialog).toHaveAccessibleDescription('This record will be permanently deleted. This action cannot be undone.',);+ expect(+ getComputedStyle(+ within(dialog).getByText(+ 'This record will be permanently deleted. This action cannot be undone.',+ ),+ ).textAlign,+ ).toBe('start');expect(dialog).toHaveAttribute('aria-labelledby',body.getByRole('heading', { name: 'Delete this record?' }).id,diff --git a/packages/twenty-ui/src/primitives/surfaces/Dialog/DialogDescription.module.scss b/packages/twenty-ui/src/primitives/surfaces/Dialog/DialogDescription.module.scssnew file mode 100644index 00000000000..00e54a5d81c--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Dialog/DialogDescription.module.scss@@ -0,0 +1,3 @@+.description {+ text-align: center;+}diff --git a/packages/twenty-ui/src/primitives/surfaces/Dialog/DialogDescription.module.scss.d.ts b/packages/twenty-ui/src/primitives/surfaces/Dialog/DialogDescription.module.scss.d.tsnew file mode 100644index 00000000000..7e55a3e7c61--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Dialog/DialogDescription.module.scss.d.ts@@ -0,0 +1,4 @@+declare const classNames: {+ readonly description: 'description';+};+export default classNames;diff --git a/packages/twenty-ui/src/primitives/surfaces/Dialog/__stories__/Dialog.titles.stories.tsx b/packages/twenty-ui/src/primitives/surfaces/Dialog/__stories__/Dialog.titles.stories.tsxindex c11dd50e507..929b648e9c0 100644--- a/packages/twenty-ui/src/primitives/surfaces/Dialog/__stories__/Dialog.titles.stories.tsx+++ b/packages/twenty-ui/src/primitives/surfaces/Dialog/__stories__/Dialog.titles.stories.tsx@@ -84,3 +84,35 @@ export const TitleTypographyDark: Story = {...TitleTypography,globals: { colorScheme: 'dark' },};++export const CenteredDescription: Story = {+ render: (args) => (+ <Dialog.Root defaultOpen>+ <Dialog.Portal>+ <Dialog.Backdrop />+ <Dialog.Viewport>+ <Dialog.Popup>+ <Dialog.Header>+ <Dialog.Title {...args} />+ <Dialog.Description>+ Credits are shared by every member of this workspace and renew+ at the start of each billing period.+ </Dialog.Description>+ </Dialog.Header>+ <Dialog.Footer>+ <Dialog.Close render={<Button>Close</Button>} />+ </Dialog.Footer>+ </Dialog.Popup>+ </Dialog.Viewport>+ </Dialog.Portal>+ </Dialog.Root>+ ),+ play: async ({ canvasElement }) => {+ const dialog = await waitForDialog(canvasElement);+ const description = within(dialog).getByText(+ 'Credits are shared by every member of this workspace and renew at the start of each billing period.',+ );++ expect(getComputedStyle(description).textAlign).toBe('center');+ },+};diff --git a/packages/twenty-ui/src/primitives/surfaces/Dialog/internal/DialogDescription.tsx b/packages/twenty-ui/src/primitives/surfaces/Dialog/internal/DialogDescription.tsxindex a5e0311d568..47114d94bb3 100644--- a/packages/twenty-ui/src/primitives/surfaces/Dialog/internal/DialogDescription.tsx+++ b/packages/twenty-ui/src/primitives/surfaces/Dialog/internal/DialogDescription.tsx@@ -1,16 +1,22 @@import { Dialog as DialogPrimitive } from '@base-ui/react/dialog';+import { clsx } from 'clsx';import { mergeClassNames } from '@ui/utilities/internal/mergeClassNames';import styles from '@ui/primitives/surfaces/internal/Dialog.module.scss';import { type DialogDescriptionProps } from '../types/DialogDescriptionProps';+import descriptionStyles from '../DialogDescription.module.scss';+export const DialogDescription = ({className,...props}: DialogDescriptionProps) => (<DialogPrimitive.Description{...props}- className={mergeClassNames(styles.description, className)}+ className={mergeClassNames(+ clsx(styles.description, descriptionStyles.description),+ className,+ )}/>);