The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Replace Twenty UI Modal with Dialog (#26087)
Raphaël Bosif9574f306bbe
diff --git a/packages/twenty-docs/snippets/ui/generated/surfaces/dialog.mdx b/packages/twenty-docs/snippets/ui/generated/surfaces/dialog.mdxindex e1e3c465c1d..6f69a6aaf7c 100644--- a/packages/twenty-docs/snippets/ui/generated/surfaces/dialog.mdx+++ b/packages/twenty-docs/snippets/ui/generated/surfaces/dialog.mdx@@ -11,6 +11,170 @@* npx nx generate:ui twenty-docs*/}+### Dialog.Root++<ParamField body="Root.actionsRef" type="RefObject<DialogRootActions | null>">+ A ref to imperative actions.+ - `unmount`: Manually unmounts the dialog.+ Call this after any externally controlled closing animation finishes.+ - `close`: Closes the dialog imperatively when called.+</ParamField>++<ParamField body="Root.children" type="ReactNode | PayloadChildRenderFunction<Payload>">+ The content of the dialog.+ This can be a regular React node or a render function that receives the `payload` of the active trigger.+</ParamField>++<ParamField body="Root.defaultOpen" type="boolean" default="false">+ Whether the dialog is initially open.++ To render a controlled dialog, use the `open` prop instead.+</ParamField>++<ParamField body="Root.defaultTriggerId" type="string | null">+ ID of the trigger that the dialog is associated with.+ This is useful in conjunction with the `defaultOpen` prop to create an initially open dialog.+</ParamField>++<ParamField body="Root.disablePointerDismissal" type="boolean" default="false">+ Whether to prevent the dialog from closing on outside presses.+ For non-modal dialogs, this also prevents the dialog from closing when focus moves outside of it.+</ParamField>++<ParamField body="Root.handle" type="DialogHandle<Payload>">+ A handle to associate the dialog with a trigger.+ If specified, allows external triggers to control the dialog's open state.+ Can be created with the Dialog.createHandle() method.+</ParamField>++<ParamField body="Root.modal" type="boolean | "trap-focus"" default="true">+ Determines if the dialog enters a modal state when open.+ - `true`: user interaction is limited to just the dialog: focus is trapped, document page scroll is locked, and pointer interactions on outside elements are disabled.+ - `false`: user interaction with the rest of the document is allowed.+ - `'trap-focus'`: focus is trapped inside the dialog, but document page scroll is not locked and pointer interactions outside of it remain enabled.++ When `modal` is `true` or `'trap-focus'`, render `<Dialog.Close>` inside `<Dialog.Popup>` so+ touch screen readers can escape the popup.+</ParamField>++<ParamField body="Root.onOpenChange" type="((open: boolean, eventDetails: DialogRootChangeEventDetails) => void)">+ Event handler called when the dialog is opened or closed.+</ParamField>++<ParamField body="Root.onOpenChangeComplete" type="((open: boolean) => void)">+ Event handler called after any animations complete when the dialog is opened or closed.+</ParamField>++<ParamField body="Root.open" type="boolean">+ Whether the dialog is currently open.+</ParamField>++<ParamField body="Root.triggerId" type="string | null">+ ID of the trigger that the dialog is associated with.+ This is useful in conjunction with the `open` prop to create a controlled dialog.+ There's no need to specify this prop when the dialog is uncontrolled (that is, when the `open` prop is not set).+</ParamField>++### Dialog.Trigger++<ParamField body="Trigger.className" type="string | ((state: DialogTriggerState) => string | undefined)">+ CSS class applied to the element, or a function that+ returns a class based on the component's state.+</ParamField>++<ParamField body="Trigger.handle" type="DialogHandle<Payload>">+ A handle to associate the trigger with a dialog.+ Can be created with the Dialog.createHandle() method.+</ParamField>++<ParamField body="Trigger.id" type="string">+ ID of the trigger. In addition to being forwarded to the rendered element,+ it is also used to specify the active trigger for the dialog in controlled mode (with the DialogRoot `triggerId` prop).+</ParamField>++<ParamField body="Trigger.nativeButton" type="boolean" default="true">+ Whether the component renders a native `<button>` element when replacing it+ via the `render` prop.+ Set to `false` if the rendered element is not a button (for example, `<div>`).+</ParamField>++<ParamField body="Trigger.payload" type="Payload">+ A payload to pass to the dialog when it is opened.+</ParamField>++<ParamField body="Trigger.render" type="ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, DialogTriggerState>">+ Allows you to replace the component's HTML element+ with a different tag, or compose it with another component.++ Accepts a `ReactElement` or a function that returns the element to render.+</ParamField>++<ParamField body="Trigger.style" type="CSSProperties | ((state: DialogTriggerState) => CSSProperties | undefined)">+ Style applied to the element, or a function that+ returns a style object based on the component's state.+</ParamField>++### Dialog.Popup++<ParamField body="Popup.backdrop" type="boolean | DialogBackdropProps" default="true">++</ParamField>++<ParamField body="Popup.className" type="string | ((state: DialogPopupState) => string | undefined)">+ CSS class applied to the element, or a function that+ returns a class based on the component's state.+</ParamField>++<ParamField body="Popup.container" type="HTMLElement | ShadowRoot | RefObject<HTMLElement | ShadowRoot | null> | null">++</ParamField>++<ParamField body="Popup.finalFocus" type="boolean | RefObject<HTMLElement | null> | ((closeType: InteractionType) => boolean | void | HTMLElement | null)">+ Determines the element to focus when the dialog is closed.++ - `false`: Do not move focus.+ - `true`: Move focus based on the default behavior (trigger or previously focused element).+ - `RefObject`: Move focus to the ref element.+ - `function`: Called with the interaction type (`mouse`, `touch`, `pen`, or `keyboard`).+ Return an element to focus, `true` to use the default behavior, `null` to fall back to the default behavior, or `false`/`undefined` to do nothing.+</ParamField>++<ParamField body="Popup.initialFocus" type="boolean | RefObject<HTMLElement | null> | ((openType: InteractionType) => boolean | void | HTMLElement | null)">+ Determines the element to focus when the dialog is opened.+ By default, focus moves to the first tabbable element inside the popup, except when the dialog+ is opened by touch — then the popup itself is focused to avoid opening the virtual keyboard.++ - `false`: Do not move focus.+ - `true`: Move focus based on the default behavior (first tabbable element or popup).+ - `RefObject`: Move focus to the ref element.+ - `function`: Called with the interaction type (`mouse`, `touch`, `pen`, or `keyboard`).+ Return an element to focus, `true` to use the default behavior, `null` to fall back to the default behavior, or `false`/`undefined` to do nothing.+</ParamField>++<ParamField body="Popup.keepMounted" type="boolean">++</ParamField>++<ParamField body="Popup.render" type="ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, DialogPopupState>">+ Allows you to replace the component's HTML element+ with a different tag, or compose it with another component.++ Accepts a `ReactElement` or a function that returns the element to render.+</ParamField>++<ParamField body="Popup.size" type=""sm" | "md" | "lg" | "xl" | "fullscreen"" default="md">++</ParamField>++<ParamField body="Popup.style" type="CSSProperties | ((state: DialogPopupState) => CSSProperties | undefined)">+ Style applied to the element, or a function that+ returns a style object based on the component's state.+</ParamField>++<ParamField body="Popup.viewportProps" type="DialogViewportProps">++</ParamField>+### Dialog.Title<ParamField body="Title.className" type="string | ((state: DialogTitleState) => string | undefined)">@@ -41,3 +205,74 @@Style applied to the element, or a function thatreturns a style object based on the component's state.</ParamField>++### Dialog.Description++<ParamField body="Description.className" type="string | ((state: DialogDescriptionState) => string | undefined)">+ CSS class applied to the element, or a function that+ returns a class based on the component's state.+</ParamField>++<ParamField body="Description.render" type="ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, DialogDescriptionState>">+ Allows you to replace the component's HTML element+ with a different tag, or compose it with another component.++ Accepts a `ReactElement` or a function that returns the element to render.+</ParamField>++<ParamField body="Description.style" type="CSSProperties | ((state: DialogDescriptionState) => CSSProperties | undefined)">+ Style applied to the element, or a function that+ returns a style object based on the component's state.+</ParamField>++### Dialog.Close++<ParamField body="Close.className" type="string | ((state: DialogCloseState) => string | undefined)">+ CSS class applied to the element, or a function that+ returns a class based on the component's state.+</ParamField>++<ParamField body="Close.nativeButton" type="boolean" default="true">+ Whether the component renders a native `<button>` element when replacing it+ via the `render` prop.+ Set to `false` if the rendered element is not a button (for example, `<div>`).+</ParamField>++<ParamField body="Close.render" type="ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, DialogCloseState>">+ Allows you to replace the component's HTML element+ with a different tag, or compose it with another component.++ Accepts a `ReactElement` or a function that returns the element to render.+</ParamField>++<ParamField body="Close.style" type="CSSProperties | ((state: DialogCloseState) => CSSProperties | undefined)">+ Style applied to the element, or a function that+ returns a style object based on the component's state.+</ParamField>++### Dialog.Header++<ParamField body="Header.render" type="ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, {}>">+ Allows you to replace the component's HTML element+ with a different tag, or compose it with another component.++ Accepts a `ReactElement` or a function that returns the element to render.+</ParamField>++### Dialog.Body++<ParamField body="Body.render" type="ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, {}>">+ Allows you to replace the component's HTML element+ with a different tag, or compose it with another component.++ Accepts a `ReactElement` or a function that returns the element to render.+</ParamField>++### Dialog.Footer++<ParamField body="Footer.render" type="ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, {}>">+ Allows you to replace the component's HTML element+ with a different tag, or compose it with another component.++ Accepts a `ReactElement` or a function that returns the element to render.+</ParamField>diff --git a/packages/twenty-docs/ui/primitives/surfaces/dialog.mdx b/packages/twenty-docs/ui/primitives/surfaces/dialog.mdxindex 2f463aaa6cf..5286e3ea0f2 100644--- a/packages/twenty-docs/ui/primitives/surfaces/dialog.mdx+++ b/packages/twenty-docs/ui/primitives/surfaces/dialog.mdx@@ -1,38 +1,140 @@---title: Dialog-description: Give a modal a visible heading and accessible name with Dialog.Title.+description: Present a focused task above the current page.---import { StoryEmbed } from '/snippets/ui/StoryEmbed.mdx';+import DialogReference from '/snippets/ui/generated/surfaces/dialog.mdx';-Use `Dialog.Title` inside Twenty UI's existing `Modal`. It provides the shared modal heading style and automatically connects the heading to the modal's accessible name. The public `Dialog` namespace currently exports `Title`.+Use `Dialog` for forms, details, and other tasks that open above the page. It manages focus, keyboard dismissal, outside clicks, and scrolling. Use [AlertDialog](/ui/primitives/surfaces/alert-dialog) when the user must explicitly respond to a decision.<StoryEmbedstoryId="ui-surfaces-dialog--documentation"- title="Dialog title example"- height={300}+ title="Dialog example"+ height={440}/>-## Add a modal title+## Anatomy-```tsx-import { Dialog, Modal } from 'twenty-ui/primitives/surfaces';-import { Text } from 'twenty-ui/primitives/typography';+```text+Dialog.Root+├── Dialog.Trigger+└── Dialog.Popup+ ├── Dialog.Header+ │ ├── Dialog.Title+ │ └── Dialog.Description+ ├── Dialog.Body+ └── Dialog.Footer+ └── Dialog.Close+```++| Part | Requirement | Purpose |+| -------------------------- | ----------- | ------------------------------------------------------------------------------ |+| `Root` | Required | Coordinates visibility and modal behavior. |+| `Trigger` | Optional | Opens the dialog and receives focus when it closes. |+| `Popup` | Required | Contains the dialog and includes its portal, backdrop, and viewport. |+| `Title` | Recommended | Provides the accessible name. Supply `aria-label` on `Popup` when omitting it. |+| `Description` | Optional | Associates supporting text with the dialog. |+| `Header`, `Body`, `Footer` | Optional | Arrange headings, content, and actions. |+| `Close` | Recommended | Provides a visible close action, including for touch screen readers. |-type CreditModalProps = { isOpen: boolean };+## Uncontrolled state++`Root` owns visibility by default. Set `defaultOpen` for its initial state. Triggers, close controls, Escape, and outside clicks update that state.++```tsx+import { Button } from 'twenty-ui/primitives/input';+import { Dialog } from 'twenty-ui/primitives/surfaces';-export const CreditModal = ({ isOpen }: CreditModalProps) => (- <Modal isOpen={isOpen} padding="large" autoHeight>- <Dialog.Title>Grant credits</Dialog.Title>- <Text>Add credits to this workspace.</Text>- </Modal>+export const AccountDialog = () => (+ <Dialog.Root defaultOpen={false}>+ <Dialog.Trigger+ render={<Button>Account details</Button>}+ />+ <Dialog.Popup>+ <Dialog.Header>+ <Dialog.Title>Account details</Dialog.Title>+ <Dialog.Description>+ Review your account information.+ </Dialog.Description>+ </Dialog.Header>+ <Dialog.Body>Acme</Dialog.Body>+ <Dialog.Footer>+ <Dialog.Close render={<Button>Close</Button>} />+ </Dialog.Footer>+ </Dialog.Popup>+ </Dialog.Root>);```-The title defaults to an `h2` with large type, primary text color, centered alignment, and spacing-4 below it. Use `level` to change the document outline independently of `size`. Native `className` and `style` can adjust alignment and spacing.+## Controlled state++Pass `open` and `onOpenChange` when the application owns visibility. The callback receives the requested state and event details. Update state to accept a change, or call `eventDetails.cancel()` to reject it.++```tsx+import { useState } from 'react';+import { Button } from 'twenty-ui/primitives/input';+import { Dialog } from 'twenty-ui/primitives/surfaces';++export const AccountDialog = () => {+ const [open, setOpen] = useState(false);++ return (+ <Dialog.Root open={open} onOpenChange={setOpen}>+ <Dialog.Trigger+ render={<Button>Account details</Button>}+ />+ <Dialog.Popup>+ <Dialog.Header>+ <Dialog.Title>Account details</Dialog.Title>+ <Dialog.Description>+ Review your account information.+ </Dialog.Description>+ </Dialog.Header>+ <Dialog.Body>Acme</Dialog.Body>+ <Dialog.Footer>+ <Dialog.Close render={<Button>Close</Button>} />+ </Dialog.Footer>+ </Dialog.Popup>+ </Dialog.Root>+ );+};+```++For an asynchronous form, keep the dialog open while submitting. Close it after success and display failures inside the dialog.++## Composition++`Trigger` and `Close` accept `render` to compose with `Button`, as shown above. Custom wrappers must [forward supplied props and refs](/ui/primitives/overview#custom-components). Layout parts also support `render`, native attributes, refs, styles, and class names. `Popup`, `Title`, and `Description` accept state-aware class names and styles.++Nest another `Dialog.Root` inside a popup to open a second dialog. Closing the nested dialog returns focus to its trigger in the parent.++To open one dialog from triggers outside `Root`, create a handle once with `Dialog.createHandle()` and pass it to `handle` on both `Root` and each `Trigger`. Trigger `payload` values are available in `Root`'s render function.++`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`.++## Focus, scrolling, and dismissal++`Root.modal` controls the interaction boundary:++| Value | Focus | Page scrolling and outside interaction |+| ---------------- | ------------------------- | -------------------------------------------------------- |+| `true` (default) | Trapped inside the dialog | Page scrolling and outside interaction are blocked. |+| `"trap-focus"` | Trapped inside the dialog | Page scrolling and outside interaction remain available. |+| `false` | Can leave the dialog | Page scrolling and outside interaction remain available. |++Set `Popup.backdrop={false}` when outside content should remain visible and interactive. Set `Popup.initialFocus` or `Popup.finalFocus` to a ref or callback to choose focus targets; `false` disables that automatic focus move.++`Root.disablePointerDismissal` prevents outside clicks from requesting closure. To prevent Escape dismissal, cancel the `escape-key` change in `onOpenChange`. Always provide a visible way to close a modal dialog.++## Sizes and portals++`Popup.size` accepts `sm`, `md`, `lg`, `xl`, and `fullscreen`, and defaults to `md`. Long content scrolls within the popup. Width is constrained to the viewport.++Portals use the nearest theme container by default and preserve text direction. Set `container` to an element or ref to choose another destination; `null` defers mounting until a destination is available. `keepMounted` retains content and form state while closed.-Native attributes, refs, and `render` are forwarded to the heading. Keep a heading element when using `render`, and keep the title inside `Modal` so its accessible naming relationship is available.+Use `backdrop` props to customize the backdrop, and `viewportProps` for native attributes, styles, or `render` composition on the surrounding viewport. These props let application layout containers host a dialog while keeping the popup's semantics.## Propsdiff --git a/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsx b/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsxindex e30babb1ca7..d7d2e18ef14 100644--- a/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsx+++ b/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsx@@ -1,4 +1,5 @@import { buttonControlsTest } from '@/__stories__/twenty-ui-gallery/utils/buttonControlsTest';+import { dialogTest } from '@/__stories__/twenty-ui-gallery/utils/dialogTest';import { type Meta } from '@storybook/react-vite';import {@@ -29,7 +30,6 @@ import {galleryRenderTest,inputPreactTest,inputReactTest,- modalOpenHangTest,navigationTest,themeTokenTest,} from '@/__stories__/twenty-ui-gallery/utils/galleryRenderTests';@@ -147,15 +147,15 @@ export const SurfacesPreact: Story = createGalleryStory({play: galleryRenderTest,});-export const ModalOpenReact: Story = createGalleryStory({- frontComponentBundleName: 'twenty-ui-modal-open-gallery',+export const DialogReact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-dialog',runtime: 'react',- play: modalOpenHangTest,+ play: dialogTest,});-export const ModalOpenPreact: Story = createGalleryStory({- frontComponentBundleName: 'twenty-ui-modal-open-gallery',+export const DialogPreact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-dialog',runtime: 'preact',- play: galleryRenderTest,+ play: dialogTest,});export const CodeEditorReact: Story = createGalleryStory({diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-dialog.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-dialog.front-component.tsxnew file mode 100644index 00000000000..a7276ff7bcb--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-dialog.front-component.tsx@@ -0,0 +1,37 @@+import { useState } from 'react';+import { defineFrontComponent } from 'twenty-sdk/define';+import { Button } from 'twenty-ui/primitives/input';+import { Dialog } from 'twenty-ui/primitives/surfaces';+import { Text } from 'twenty-ui/primitives/typography';++import { TwentyUiGalleryCard } from '@/__stories__/shared/front-components/twenty-ui-gallery-card';++const DialogExample = () => {+ const [open, setOpen] = useState(false);++ return (+ <TwentyUiGalleryCard title="Dialog">+ <Dialog.Root open={open} onOpenChange={setOpen}>+ <Dialog.Trigger render={<Button>Edit account</Button>} />+ <Dialog.Popup>+ <Dialog.Header>+ <Dialog.Title>Edit account</Dialog.Title>+ <Dialog.Description>Update the account details.</Dialog.Description>+ </Dialog.Header>+ <Dialog.Body>Account details</Dialog.Body>+ <Dialog.Footer>+ <Dialog.Close render={<Button>Close</Button>} />+ </Dialog.Footer>+ </Dialog.Popup>+ </Dialog.Root>+ <Text role="status">Dialog: {open ? 'open' : 'closed'}</Text>+ </TwentyUiGalleryCard>+ );+};++export default defineFrontComponent({+ universalIdentifier: 'test-20ui0-0000-0000-0000-000000000111',+ name: 'twenty-ui-dialog',+ description: 'Dialog opening and closing through a sandbox portal',+ component: DialogExample,+});diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-modal-open-gallery.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-modal-open-gallery.front-component.tsxdeleted file mode 100644index 0e9805605ca..00000000000--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-modal-open-gallery.front-component.tsx+++ /dev/null@@ -1,40 +0,0 @@-import { defineFrontComponent } from 'twenty-sdk/define';-import { Dialog, Modal } from 'twenty-ui/primitives/surfaces';-import { ThemeProvider } from 'twenty-ui/theme-constants';--import {- ComponentGallery,- type GalleryEntry,-} from '../shared/front-components/component-gallery';--// KNOWN ISSUE: an open Modal (base-ui Dialog portal) hangs the React-runtime-// sandbox render entirely (no error, the tree never commits); it works under-// Preact. Isolated in its own fixture so the hang cannot mask the rest of the-// surfaces gallery.-const MODAL_OPEN_ENTRIES: GalleryEntry[] = [- {- name: 'Modal',- node: (- <Modal isOpen={true}>- <Dialog.Title>Open gallery modal</Dialog.Title>- Modal body- </Modal>- ),- },-];--const ModalOpenGallery = () => (- <ThemeProvider colorScheme="light">- <ComponentGallery- title="twenty-ui/primitives/surfaces Modal (open)"- entries={MODAL_OPEN_ENTRIES}- />- </ThemeProvider>-);--export default defineFrontComponent({- universalIdentifier: 'test-20ui0-0000-0000-0000-000000000111',- name: 'twenty-ui-modal-open-gallery',- description: 'Renders an open twenty-ui Modal in the sandbox',- component: ModalOpenGallery,-});diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-surfaces-gallery.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-surfaces-gallery.front-component.tsxindex 35be3a495fe..5ad7aacb923 100644--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-surfaces-gallery.front-component.tsx+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-surfaces-gallery.front-component.tsx@@ -5,11 +5,6 @@ import {CardContent,CardFooter,CardHeader,- Modal,- ModalBackdrop,- ModalContent,- ModalFooter,- ModalHeader,OverflowingTextWithTooltip,Tooltip,} from 'twenty-ui/primitives/surfaces';@@ -47,36 +42,6 @@ const SURFACES_ENTRIES: GalleryEntry[] = [name: 'CardHeader',node: <CardHeader>Card header</CardHeader>,},- // Rendered closed here so a hang cannot mask the rest of this gallery; the- // open-Modal known issue is exposed by twenty-ui-modal-open-gallery.- {- name: 'Modal',- node: (- <Modal isOpen={false} ariaLabel="Gallery modal">- Modal body- </Modal>- ),- },- {- name: 'ModalBackdrop',- node: (- <ModalBackdrop overlay="dark" backdropZIndex={39}>- Backdrop child- </ModalBackdrop>- ),- },- {- name: 'ModalContent',- node: <ModalContent>Modal content</ModalContent>,- },- {- name: 'ModalFooter',- node: <ModalFooter>Modal footer</ModalFooter>,- },- {- name: 'ModalHeader',- node: <ModalHeader>Modal header</ModalHeader>,- },{name: 'OverflowingTextWithTooltip',node: <OverflowingTextWithTooltip text="Some overflowing text" />,diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/dialogTest.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/dialogTest.tsnew file mode 100644index 00000000000..415e449f007--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/dialogTest.ts@@ -0,0 +1,7 @@+import { SANDBOX_ERROR_PATTERNS } from '@/__stories__/twenty-ui-gallery/constants/SANDBOX_ERROR_PATTERNS';+import { createSandboxFailureTest } from '@/__stories__/twenty-ui-gallery/utils/createSandboxFailureTest';++export const dialogTest = createSandboxFailureTest({+ trigger: { type: 'click', role: 'button', name: 'Edit account' },+ requiredErrors: [SANDBOX_ERROR_PATTERNS.VIEWPORT_WIDTH],+});diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/galleryRenderTests.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/galleryRenderTests.tsindex e9d1a97b834..37a066176b8 100644--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/galleryRenderTests.ts+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/galleryRenderTests.ts@@ -29,18 +29,6 @@ export const navigationTest = createGalleryRenderTest({expectedFailedComponents: ['RawLink', 'UndecoratedLink'],});-// An open Modal portal hangs the React render without an error, so the-// missing gallery status is the only observable failure. Preact can mount it.-export const modalOpenHangTest: TwentyUiGalleryPlayFunction = async ({- canvasElement,-}) => {- const canvas = within(canvasElement);-- await expect(- canvas.findByTestId('gallery-status', {}, { timeout: 10000 }),- ).rejects.toThrow();-};-// Monaco cannot load scripts inside the sandbox worker, so the wrapper mounts// but the editor's onMount never fires.export const codeEditorTest: TwentyUiGalleryPlayFunction = async ({diff --git a/packages/twenty-front/src/modules/activities/files/components/AttachmentList.tsx b/packages/twenty-front/src/modules/activities/files/components/AttachmentList.tsxindex a29bdbfae67..950502f75f2 100644--- a/packages/twenty-front/src/modules/activities/files/components/AttachmentList.tsx+++ b/packages/twenty-front/src/modules/activities/files/components/AttachmentList.tsx@@ -1,7 +1,8 @@+import { Dialog } from 'twenty-ui/primitives/surfaces';+import { DialogInstance } from '@/ui/layout/dialog/components/DialogInstance';import { styled } from '@linaria/react';import { t } from '@lingui/core/macro';import { lazy, Suspense, useState } from 'react';-import { createPortal } from 'react-dom';import { DropZone } from '@/activities/files/components/DropZone';import { useUploadAttachmentFile } from '@/activities/files/hooks/useUploadAttachmentFile';@@ -9,9 +10,7 @@ import { type Attachment } from '@/activities/files/types/Attachment';import { downloadFile } from '@/activities/files/utils/downloadFile';import { type ActivityTargetableObject } from '@/activities/types/ActivityTargetableEntity';import { isAttachmentPreviewEnabledState } from '@/client-config/states/isAttachmentPreviewEnabledState';-import { ModalStatefulWrapper } from '@/ui/layout/modal/components/ModalStatefulWrapper';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';-import { ModalContent, ModalHeader } from 'twenty-ui/primitives/surfaces';import { ActivityList } from '@/activities/components/ActivityList';import {@@ -20,7 +19,7 @@ import {} from '@/activities/files/utils/filterAttachmentsWithFile';import { getAttachmentUrl } from '@/activities/utils/getAttachmentUrl';import { useHasPermissionFlag } from '@/settings/roles/hooks/useHasPermissionFlag';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { ScrollWrapper } from '@/ui/utilities/scroll/components/ScrollWrapper';import { isDefined } from 'twenty-shared/utils';import { IconDownload, IconX } from 'twenty-ui/icon';@@ -91,7 +90,7 @@ const StyledButtonContainer = styled.div`gap: ${themeCssVariables.spacing[1]};`;-export const PREVIEW_MODAL_ID = 'preview-modal';+const PREVIEW_MODAL_ID = 'preview-modal';export const AttachmentList = ({targetableObject,@@ -114,7 +113,7 @@ export const AttachmentList = ({PermissionFlagType.UPLOAD_FILE,);- const { openModal, closeModal } = useModal();+ const { openDialog, closeDialog } = useDialog();const attachmentsWithFile = filterAttachmentsWithFile(attachments);@@ -131,11 +130,11 @@ export const AttachmentList = ({const handlePreview = (attachment: AttachmentWithFile) => {if (!isAttachmentPreviewEnabled) return;setPreviewedAttachment(attachment);- openModal(PREVIEW_MODAL_ID);+ openDialog(PREVIEW_MODAL_ID);};const handleClosePreview = () => {- closeModal(PREVIEW_MODAL_ID);+ closeDialog(PREVIEW_MODAL_ID);setPreviewedAttachment(null);};@@ -173,66 +172,88 @@ export const AttachmentList = ({</StyledDropZoneContainer></StyledContainer>)}- {previewedAttachment &&- isAttachmentPreviewEnabled &&- createPortal(- <ModalStatefulWrapper- modalInstanceId={PREVIEW_MODAL_ID}- size="large"- isClosable- onClose={handleClosePreview}- renderInDocumentBody- gap={2}- padding="small"- >- <ModalHeader noPadding autoHeight>- <StyledHeader>- <StyledModalTitle>{previewedAttachment.name}</StyledModalTitle>- <StyledButtonContainer>- {hasDownloadPermission && (+ {previewedAttachment && isAttachmentPreviewEnabled && (+ <DialogInstance+ dialogId={PREVIEW_MODAL_ID}+ dismissible+ onClose={handleClosePreview}+ renderInDocumentBody+ >+ {({ container, backdrop, viewportProps, onKeyDown }) => (+ <Dialog.Popup+ aria-label={previewedAttachment.name}+ {...{ container, backdrop, viewportProps, onKeyDown }}+ size="lg"+ style={{+ padding: 'var(--t-spacing-2)',+ gap: 'var(--t-spacing-2)',+ }}+ >+ <Dialog.Header+ style={{+ flexDirection: 'row',+ alignItems: 'center',+ height: 'auto',+ padding: 0,+ }}+ >+ <StyledHeader>+ <StyledModalTitle>+ {previewedAttachment.name}+ </StyledModalTitle>+ <StyledButtonContainer>+ {hasDownloadPermission && (+ <IconButton+ aria-label={t`Download attachment`}+ onClick={handleDownload}+ size="sm"+ >+ <IconDownload />+ </IconButton>+ )}<IconButton- aria-label={t`Download attachment`}- onClick={handleDownload}+ aria-label={t`Close preview`}+ onClick={handleClosePreview}size="sm">- <IconDownload />+ <IconX /></IconButton>- )}- <IconButton- aria-label={t`Close preview`}- onClick={handleClosePreview}- size="sm"- >- <IconX />- </IconButton>- </StyledButtonContainer>- </StyledHeader>- </ModalHeader>- <ScrollWrapper- componentInstanceId={`preview-modal-${previewedAttachment.id}`}- >- <ModalContent noPadding>- <Suspense- fallback={- <StyledLoadingContainer>- <StyledLoadingText>- {t`Loading document viewer...`}- </StyledLoadingText>- </StyledLoadingContainer>- }+ </StyledButtonContainer>+ </StyledHeader>+ </Dialog.Header>+ <ScrollWrapper+ componentInstanceId={`preview-modal-${previewedAttachment.id}`}+ >+ <Dialog.Body+ style={{+ display: 'flex',+ flex: '1 1 0%',+ flexDirection: 'column',+ padding: 0,+ }}>- <DocumentViewer- documentName={previewedAttachment.name}- documentUrl={getAttachmentUrl({- attachment: previewedAttachment,- })}- />- </Suspense>- </ModalContent>- </ScrollWrapper>- </ModalStatefulWrapper>,- document.body,- )}+ <Suspense+ fallback={+ <StyledLoadingContainer>+ <StyledLoadingText>+ {t`Loading document viewer...`}+ </StyledLoadingText>+ </StyledLoadingContainer>+ }+ >+ <DocumentViewer+ documentName={previewedAttachment.name}+ documentUrl={getAttachmentUrl({+ attachment: previewedAttachment,+ })}+ />+ </Suspense>+ </Dialog.Body>+ </ScrollWrapper>+ </Dialog.Popup>+ )}+ </DialogInstance>+ )}</>);};diff --git a/packages/twenty-front/src/modules/ai/components/AIChatNoMoreBillingCreditsBanner.tsx b/packages/twenty-front/src/modules/ai/components/AIChatNoMoreBillingCreditsBanner.tsxindex 3ba431ab6f4..5cd9d55b7c5 100644--- a/packages/twenty-front/src/modules/ai/components/AIChatNoMoreBillingCreditsBanner.tsx+++ b/packages/twenty-front/src/modules/ai/components/AIChatNoMoreBillingCreditsBanner.tsx@@ -4,8 +4,8 @@ import { AddCreditCardModal } from '@/settings/billing/components/AddCreditCardMimport { StartSubscriptionConfirmationModal } from '@/settings/billing/components/StartSubscriptionConfirmationModal';import { useCreditUpgradeAction } from '@/settings/billing/hooks/useCreditUpgradeAction';import { usePermissionFlagMap } from '@/settings/roles/hooks/usePermissionFlagMap';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useSubscriptionStatus } from '@/workspace/hooks/useSubscriptionStatus';import { useLingui } from '@lingui/react/macro';import { isDefined } from 'twenty-shared/utils';@@ -22,7 +22,7 @@ export const AIChatNoMoreBillingCreditsBanner = () => {const { t } = useLingui();const subscriptionStatus = useSubscriptionStatus();- const { openModal } = useModal();+ const { openDialog } = useDialog();const { [PermissionFlagType.BILLING]: hasPermissionToManageBilling } =usePermissionFlagMap();@@ -63,9 +63,9 @@ export const AIChatNoMoreBillingCreditsBanner = () => {: undefined;const handleButtonClick = isTrialing- ? () => openModal(AI_CHAT_END_TRIAL_PERIOD_MODAL_ID)+ ? () => openDialog(AI_CHAT_END_TRIAL_PERIOD_MODAL_ID): isDefined(nextPrice)- ? () => openModal(AI_CHAT_UPGRADE_CREDIT_PLAN_MODAL_ID)+ ? () => openDialog(AI_CHAT_UPGRADE_CREDIT_PLAN_MODAL_ID): undefined;return (@@ -104,8 +104,8 @@ export const AIChatNoMoreBillingCreditsBanner = () => {/>))}{!isTrialing && (- <ConfirmationModal- modalInstanceId={AI_CHAT_UPGRADE_CREDIT_PLAN_MODAL_ID}+ <ConfirmationDialog+ dialogId={AI_CHAT_UPGRADE_CREDIT_PLAN_MODAL_ID}title={t`Get more credits`}subtitle={t`Upgrade to ${nextResourceCreditsAmount ?? ''} credits for $${nextResourceCreditPrice ?? ''}/${nextTierInterval ?? ''}.`}onConfirmClick={upgradeCreditPlan}diff --git a/packages/twenty-front/src/modules/ai/components/AiChatThreadDeleteConfirmationModal.tsx b/packages/twenty-front/src/modules/ai/components/AiChatThreadDeleteConfirmationModal.tsxindex 111ca6eb72d..31fea059d1a 100644--- a/packages/twenty-front/src/modules/ai/components/AiChatThreadDeleteConfirmationModal.tsx+++ b/packages/twenty-front/src/modules/ai/components/AiChatThreadDeleteConfirmationModal.tsx@@ -4,7 +4,7 @@ import { type AiChatThreadActionsSurface } from '@/ai/types/AiChatThreadActionsSimport { useDeleteChatThread } from '@/ai/hooks/useDeleteChatThread';import { aiChatThreadPendingDeleteFamilyState } from '@/ai/states/aiChatThreadPendingDeleteFamilyState';import { getAiChatThreadDeleteModalId } from '@/ai/utils/getAiChatThreadDeleteModalId';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState';@@ -36,8 +36,8 @@ export const AiChatThreadDeleteConfirmationModal = ({};return (- <ConfirmationModal- modalInstanceId={modalInstanceId}+ <ConfirmationDialog+ dialogId={modalInstanceId}title={t`Delete chat`}subtitle={<Trans>diff --git a/packages/twenty-front/src/modules/ai/components/AiChatThreadItemMenu.tsx b/packages/twenty-front/src/modules/ai/components/AiChatThreadItemMenu.tsxindex afb6502d7f4..53eed033f03 100644--- a/packages/twenty-front/src/modules/ai/components/AiChatThreadItemMenu.tsx+++ b/packages/twenty-front/src/modules/ai/components/AiChatThreadItemMenu.tsx@@ -19,7 +19,7 @@ import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState';type AiChatThreadItemMenuProps = {@@ -42,7 +42,7 @@ export const AiChatThreadItemMenu = ({const { t } = useLingui();const dropdownId = getAiChatThreadItemMenuDropdownId(threadId, surface);const { closeDropdown } = useCloseDropdown();- const { openModal } = useModal();+ const { openDialog } = useDialog();const { archiveChatThread, unarchiveChatThread } =useChatThreadArchiveActions();const setAiChatThreadPendingDelete = useSetAtomFamilyState(@@ -70,7 +70,7 @@ export const AiChatThreadItemMenu = ({event.stopPropagation();closeDropdown(dropdownId);setAiChatThreadPendingDelete({ threadId, threadTitle });- openModal(getAiChatThreadDeleteModalId(surface));+ openDialog(getAiChatThreadDeleteModalId(surface));};return (diff --git a/packages/twenty-front/src/modules/auth/components/StyledAuthContent.tsx b/packages/twenty-front/src/modules/auth/components/StyledAuthContent.tsxnew file mode 100644index 00000000000..1d2db5cf597--- /dev/null+++ b/packages/twenty-front/src/modules/auth/components/StyledAuthContent.tsx@@ -0,0 +1,11 @@+import { styled } from '@linaria/react';+import { themeCssVariables } from 'twenty-ui/theme-constants';++export const StyledAuthContent = styled.div`+ align-items: center;+ display: flex;+ flex: 1 1 0%;+ flex-direction: column;+ justify-content: center;+ padding: ${themeCssVariables.spacing[10]};+`;diff --git a/packages/twenty-front/src/modules/auth/components/VerifyEmail.tsx b/packages/twenty-front/src/modules/auth/components/VerifyEmail.tsxindex 7c5c82f604a..9cf4c9a6b89 100644--- a/packages/twenty-front/src/modules/auth/components/VerifyEmail.tsx+++ b/packages/twenty-front/src/modules/auth/components/VerifyEmail.tsx@@ -1,3 +1,4 @@+import { StyledAuthContent } from '@/auth/components/StyledAuthContent';import { SubTitle } from '@/auth/components/SubTitle';import { VerifyEmailEffect } from '@/auth/components/VerifyEmailEffect';import { EmailVerificationSent } from '@/auth/sign-in-up/components/EmailVerificationSent';@@ -5,7 +6,6 @@ import { OnboardingVerifyLayout } from '@/onboarding/components/OnboardingVerifyimport { useLingui } from '@lingui/react/macro';import { useState } from 'react';import { useSearchParams } from 'react-router-dom';-import { ModalContent } from 'twenty-ui/primitives/surfaces';export const VerifyEmail = () => {const { t } = useLingui();@@ -16,9 +16,9 @@ export const VerifyEmail = () => {if (isError) {return (- <ModalContent isVerticallyCentered isHorizontallyCentered>+ <StyledAuthContent><EmailVerificationSent email={email} isError={true} />- </ModalContent>+ </StyledAuthContent>);}diff --git a/packages/twenty-front/src/modules/auth/components/__stories__/VerifyEmail.stories.tsx b/packages/twenty-front/src/modules/auth/components/__stories__/VerifyEmail.stories.tsxindex 915f86a5120..8e550b42fb1 100644--- a/packages/twenty-front/src/modules/auth/components/__stories__/VerifyEmail.stories.tsx+++ b/packages/twenty-front/src/modules/auth/components/__stories__/VerifyEmail.stories.tsx@@ -1,8 +1,8 @@+import { StyledAuthContent } from '@/auth/components/StyledAuthContent';import { type VerifyEmail } from '@/auth/components/VerifyEmail';import { EmailVerificationSent } from '@/auth/sign-in-up/components/EmailVerificationSent';import { type Meta, type StoryObj } from '@storybook/react-vite';import { MemoryRouter, Route, Routes } from 'react-router-dom';-import { ModalContent } from 'twenty-ui/primitives/surfaces';// Mock component that just renders the error state of VerifyEmail directly// (since normal VerifyEmail has async logic that's hard to test in Storybook)@@ -10,9 +10,9 @@ import { ToastDecorator } from '~/testing/decorators/ToastDecorator';const VerifyEmailErrorState = ({ email = '[email protected]' }) => {return (- <ModalContent isVerticallyCentered isHorizontallyCentered>+ <StyledAuthContent><EmailVerificationSent email={email} isError={true} />- </ModalContent>+ </StyledAuthContent>);};@@ -29,7 +29,7 @@ const meta: Meta<typeof VerifyEmailErrorState> = {],parameters: {codeSection: {- docs: 'IMPORTANT: When rendering EmailVerificationSent from VerifyEmail, always wrap it with ModalContent to maintain consistent styling.',+ docs: 'IMPORTANT: When rendering EmailVerificationSent from VerifyEmail, always wrap it with StyledAuthContent to maintain consistent styling.',},},};diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/components/SignInUpStandardContent.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/components/SignInUpStandardContent.tsxindex ff7b48cd15d..4fd51ecdda4 100644--- a/packages/twenty-front/src/modules/auth/sign-in-up/components/SignInUpStandardContent.tsx+++ b/packages/twenty-front/src/modules/auth/sign-in-up/components/SignInUpStandardContent.tsx@@ -1,3 +1,4 @@+import { StyledAuthContent } from '@/auth/components/StyledAuthContent';import { Logo } from '@/auth/components/Logo';import { Title } from '@/auth/components/Title';import { FooterNote } from '@/auth/sign-in-up/components/FooterNote';@@ -7,7 +8,6 @@ import { styled } from '@linaria/react';import { type JSX } from 'react';import { AppPath } from 'twenty-shared/types';import { AnimatedEaseIn } from 'twenty-ui/primitives/layout';-import { ModalContent } from 'twenty-ui/primitives/surfaces';import { themeCssVariables } from 'twenty-ui/theme-constants';import { type PublicWorkspaceData } from '~/generated-metadata/graphql';@@ -42,7 +42,7 @@ export const SignInUpStandardContent = ({onClickOnLogo,}: SignInUpStandardContentProps) => {return (- <ModalContent isVerticallyCentered isHorizontallyCentered>+ <StyledAuthContent><AnimatedEaseIn><LogosecondaryLogo={workspacePublicData?.logo}@@ -67,6 +67,6 @@ export const SignInUpStandardContent = ({].includes(signInUpStep) && (<FooterNote secondaryAgreement="dataProcessingAgreement" />)}- </ModalContent>+ </StyledAuthContent>);};diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/components/__stories__/EmailVerificationSent.stories.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/components/__stories__/EmailVerificationSent.stories.tsxindex e2484c5cb4f..30662185fc6 100644--- a/packages/twenty-front/src/modules/auth/sign-in-up/components/__stories__/EmailVerificationSent.stories.tsx+++ b/packages/twenty-front/src/modules/auth/sign-in-up/components/__stories__/EmailVerificationSent.stories.tsx@@ -1,17 +1,17 @@+import { StyledAuthContent } from '@/auth/components/StyledAuthContent';import { type Meta, type StoryObj } from '@storybook/react-vite';import { EmailVerificationSent } from '@/auth/sign-in-up/components/EmailVerificationSent';-import { ModalContent } from 'twenty-ui/primitives/surfaces';import { ComponentDecorator } from 'twenty-ui/testing';import { ToastDecorator } from '~/testing/decorators/ToastDecorator';-const RenderWithModalContent = (+const RenderWithStyledAuthContent = (args: React.ComponentProps<typeof EmailVerificationSent>,) => {return (- <ModalContent isVerticallyCentered isHorizontallyCentered>+ <StyledAuthContent><EmailVerificationSent email={args.email} isError={args.isError} />- </ModalContent>+ </StyledAuthContent>);};@@ -21,10 +21,10 @@ const meta: Meta<typeof EmailVerificationSent> = {decorators: [ComponentDecorator, ToastDecorator],parameters: {codeSection: {- docs: 'This component should always be wrapped with ModalContent in the app.\n\nCorrect usage:\n```tsx\n<ModalContent isVerticallyCentered isHorizontallyCentered>\n <EmailVerificationSent email={email} />\n</ModalContent>\n```\n',+ docs: 'This component should always be wrapped with StyledAuthContent in the app.\n\nCorrect usage:\n```tsx\n<StyledAuthContent>\n <EmailVerificationSent email={email} />\n</StyledAuthContent>\n```\n',},},- render: RenderWithModalContent,+ render: RenderWithStyledAuthContent,};export default meta;diff --git a/packages/twenty-front/src/modules/command-menu-item/confirmation-modal/components/CommandMenuConfirmationModalManager.tsx b/packages/twenty-front/src/modules/command-menu-item/confirmation-modal/components/CommandMenuConfirmationModalManager.tsxindex c57b7dda59a..0bdda496f5d 100644--- a/packages/twenty-front/src/modules/command-menu-item/confirmation-modal/components/CommandMenuConfirmationModalManager.tsx+++ b/packages/twenty-front/src/modules/command-menu-item/confirmation-modal/components/CommandMenuConfirmationModalManager.tsx@@ -9,8 +9,8 @@ import {type CommandMenuConfirmationModalResult,type CommandMenuConfirmationModalResultBrowserEventDetail,} from 'twenty-shared/types';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { isModalOpenedComponentState } from '@/ui/layout/modal/states/isModalOpenedComponentState';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { isDialogOpenedComponentState } from '@/ui/layout/dialog/states/isDialogOpenedComponentState';import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';@@ -25,8 +25,8 @@ export const CommandMenuConfirmationModalManager = () => {const commandMenuItemConfirmationModalConfig = useAtomStateValue(commandMenuItemConfirmationModalConfigState,);- const isModalOpened = useAtomComponentStateValue(- isModalOpenedComponentState,+ const isDialogOpened = useAtomComponentStateValue(+ isDialogOpenedComponentState,COMMAND_MENU_CONFIRMATION_MODAL_INSTANCE_ID,);const setCommandMenuItemConfirmationModalConfig = useSetAtomState(@@ -57,15 +57,15 @@ export const CommandMenuConfirmationModalManager = () => {setCommandMenuItemConfirmationModalConfig(null);};- if (!commandMenuItemConfirmationModalConfig || !isModalOpened) {+ if (!commandMenuItemConfirmationModalConfig || !isDialogOpened) {return null;}const linkButton = commandMenuItemConfirmationModalConfig.linkButton;return (- <ConfirmationModal- modalInstanceId={COMMAND_MENU_CONFIRMATION_MODAL_INSTANCE_ID}+ <ConfirmationDialog+ dialogId={COMMAND_MENU_CONFIRMATION_MODAL_INSTANCE_ID}title={commandMenuItemConfirmationModalConfig.title}subtitle={commandMenuItemConfirmationModalConfig.subtitle}onConfirmClick={() => emitConfirmationResult('confirm')}diff --git a/packages/twenty-front/src/modules/command-menu-item/confirmation-modal/hooks/useCommandMenuConfirmationModal.ts b/packages/twenty-front/src/modules/command-menu-item/confirmation-modal/hooks/useCommandMenuConfirmationModal.tsindex bc4ecbcd143..ec65abafda3 100644--- a/packages/twenty-front/src/modules/command-menu-item/confirmation-modal/hooks/useCommandMenuConfirmationModal.ts+++ b/packages/twenty-front/src/modules/command-menu-item/confirmation-modal/hooks/useCommandMenuConfirmationModal.ts@@ -6,8 +6,8 @@ import {type CommandMenuItemConfirmationModalConfig,commandMenuItemConfirmationModalConfigState,} from '@/command-menu-item/confirmation-modal/states/commandMenuItemConfirmationModalState';-import { useModal } from '@/ui/layout/modal/hooks/useModal';-import { isModalOpenedComponentState } from '@/ui/layout/modal/states/isModalOpenedComponentState';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';+import { isDialogOpenedComponentState } from '@/ui/layout/dialog/states/isDialogOpenedComponentState';import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';export const useCommandMenuConfirmationModal = () => {@@ -15,7 +15,7 @@ export const useCommandMenuConfirmationModal = () => {const setCommandMenuItemConfirmationModalConfig = useSetAtomState(commandMenuItemConfirmationModalConfigState,);- const { openModal } = useModal();+ const { openDialog } = useDialog();const openConfirmationModal = useCallback((config: CommandMenuItemConfirmationModalConfig) => {@@ -23,7 +23,7 @@ export const useCommandMenuConfirmationModal = () => {commandMenuItemConfirmationModalConfigState.atom,);const isCommandMenuItemConfirmationModalOpened = store.get(- isModalOpenedComponentState.atomFamily({+ isDialogOpenedComponentState.atomFamily({instanceId: COMMAND_MENU_CONFIRMATION_MODAL_INSTANCE_ID,}),);@@ -39,9 +39,9 @@ export const useCommandMenuConfirmationModal = () => {setCommandMenuItemConfirmationModalConfig(config);- openModal(COMMAND_MENU_CONFIRMATION_MODAL_INSTANCE_ID);+ openDialog(COMMAND_MENU_CONFIRMATION_MODAL_INSTANCE_ID);},- [store, setCommandMenuItemConfirmationModalConfig, openModal],+ [store, setCommandMenuItemConfirmationModalConfig, openDialog],);return { openConfirmationModal };diff --git a/packages/twenty-front/src/modules/information-banner/components/billing/InformationBannerEndTrialPeriod.tsx b/packages/twenty-front/src/modules/information-banner/components/billing/InformationBannerEndTrialPeriod.tsxindex 33d934c8234..8eb2f926ab2 100644--- a/packages/twenty-front/src/modules/information-banner/components/billing/InformationBannerEndTrialPeriod.tsx+++ b/packages/twenty-front/src/modules/information-banner/components/billing/InformationBannerEndTrialPeriod.tsx@@ -4,7 +4,7 @@ import { StartSubscriptionConfirmationModal } from '@/settings/billing/componentimport { billingHasPaymentMethodSelector } from '@/settings/billing/states/billingHasPaymentMethodSelector';import { useEndSubscriptionTrialPeriod } from '@/settings/billing/hooks/useEndSubscriptionTrialPeriod';import { usePermissionFlagMap } from '@/settings/roles/hooks/usePermissionFlagMap';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useLingui } from '@lingui/react/macro';import { PermissionFlagType } from '~/generated-metadata/graphql';@@ -15,7 +15,7 @@ const INFORMATION_BANNER_END_TRIAL_PERIOD_MODAL_ID =export const InformationBannerEndTrialPeriod = () => {const { endTrialPeriod, isLoading } = useEndSubscriptionTrialPeriod();const { t } = useLingui();- const { openModal } = useModal();+ const { openDialog } = useDialog();const { [PermissionFlagType.BILLING]: hasPermissionToEndTrialPeriod } =usePermissionFlagMap();@@ -43,7 +43,7 @@ export const InformationBannerEndTrialPeriod = () => {: undefined}buttonOnClick={() =>- openModal(INFORMATION_BANNER_END_TRIAL_PERIOD_MODAL_ID)+ openDialog(INFORMATION_BANNER_END_TRIAL_PERIOD_MODAL_ID)}isButtonDisabled={isLoading}/>diff --git a/packages/twenty-front/src/modules/information-banner/components/billing/InformationBannerNoMoreCredits.tsx b/packages/twenty-front/src/modules/information-banner/components/billing/InformationBannerNoMoreCredits.tsxindex d1667ebcd48..f899fbc728f 100644--- a/packages/twenty-front/src/modules/information-banner/components/billing/InformationBannerNoMoreCredits.tsx+++ b/packages/twenty-front/src/modules/information-banner/components/billing/InformationBannerNoMoreCredits.tsx@@ -2,8 +2,8 @@ import { InformationBanner } from '@/information-banner/components/InformationBaimport { informationBannerIsOpenComponentState } from '@/information-banner/states/informationBannerIsOpenComponentState';import { useCreditUpgradeAction } from '@/settings/billing/hooks/useCreditUpgradeAction';import { usePermissionFlagMap } from '@/settings/roles/hooks/usePermissionFlagMap';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState';import { useLingui } from '@lingui/react/macro';import { SettingsPath } from 'twenty-shared/types';@@ -23,7 +23,7 @@ export const InformationBannerNoMoreCredits = () => {usePermissionFlagMap();const navigateSettings = useNavigateSettings();- const { openModal } = useModal();+ const { openDialog } = useDialog();const setInformationBannerIsOpen = useSetAtomComponentState(informationBannerIsOpenComponentState,@@ -45,7 +45,7 @@ export const InformationBannerNoMoreCredits = () => {const buttonOnClick = !hasPermissionToUpdateCreditPlan? undefined: canUpgradeInline- ? () => openModal(INFORMATION_BANNER_UPGRADE_CREDIT_PLAN_MODAL_ID)+ ? () => openDialog(INFORMATION_BANNER_UPGRADE_CREDIT_PLAN_MODAL_ID): () => navigateSettings(SettingsPath.Billing);return (@@ -67,8 +67,8 @@ export const InformationBannerNoMoreCredits = () => {onClose={() => setInformationBannerIsOpen(false)}/>{canUpgradeInline && (- <ConfirmationModal- modalInstanceId={INFORMATION_BANNER_UPGRADE_CREDIT_PLAN_MODAL_ID}+ <ConfirmationDialog+ dialogId={INFORMATION_BANNER_UPGRADE_CREDIT_PLAN_MODAL_ID}title={t`Get more credits`}subtitle={t`Upgrade to ${nextResourceCreditsAmount ?? ''} credits for $${nextResourceCreditPrice ?? ''}/${nextTierInterval ?? ''}.`}onConfirmClick={upgradeCreditPlan}diff --git a/packages/twenty-front/src/modules/layout-customization/components/LayoutCustomizationBarMenuDropdown.tsx b/packages/twenty-front/src/modules/layout-customization/components/LayoutCustomizationBarMenuDropdown.tsxindex 436de132081..81ff6d70cc5 100644--- a/packages/twenty-front/src/modules/layout-customization/components/LayoutCustomizationBarMenuDropdown.tsx+++ b/packages/twenty-front/src/modules/layout-customization/components/LayoutCustomizationBarMenuDropdown.tsx@@ -13,7 +13,7 @@ import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContentimport { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth';import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';const StyledInvertedIconButtonWrapper = styled.span`align-items: center;@@ -31,11 +31,11 @@ const StyledInvertedIconButtonWrapper = styled.span`export const LayoutCustomizationBarMenuDropdown = () => {const { t } = useLingui();const { closeDropdown } = useCloseDropdown();- const { openModal } = useModal();+ const { openDialog } = useDialog();const handleResetClick = () => {closeDropdown(LAYOUT_CUSTOMIZATION_BAR_DROPDOWN_ID);- openModal(RESET_RECORD_PAGE_LAYOUT_MODAL_ID);+ openDialog(RESET_RECORD_PAGE_LAYOUT_MODAL_ID);};return (diff --git a/packages/twenty-front/src/modules/layout-customization/components/LayoutCustomizationBarResetConfirmationModal.tsx b/packages/twenty-front/src/modules/layout-customization/components/LayoutCustomizationBarResetConfirmationModal.tsxindex 0eef825595b..5ad24a82237 100644--- a/packages/twenty-front/src/modules/layout-customization/components/LayoutCustomizationBarResetConfirmationModal.tsx+++ b/packages/twenty-front/src/modules/layout-customization/components/LayoutCustomizationBarResetConfirmationModal.tsx@@ -3,7 +3,7 @@ import { useLingui } from '@lingui/react/macro';import { RESET_RECORD_PAGE_LAYOUT_MODAL_ID } from '@/layout-customization/constants/ResetRecordPageLayoutModalId';import { useRefreshPageLayoutAfterReset } from '@/page-layout/hooks/useRefreshPageLayoutAfterReset';import { useResetPageLayoutToDefault } from '@/page-layout/hooks/useResetPageLayoutToDefault';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';type LayoutCustomizationBarResetConfirmationModalProps = {pageLayoutId: string;@@ -24,8 +24,8 @@ export const LayoutCustomizationBarResetConfirmationModal = ({};return (- <ConfirmationModal- modalInstanceId={RESET_RECORD_PAGE_LAYOUT_MODAL_ID}+ <ConfirmationDialog+ dialogId={RESET_RECORD_PAGE_LAYOUT_MODAL_ID}title={t`Reset to default`}subtitle={t`This action cannot be undone.`}onConfirmClick={handleConfirmReset}diff --git a/packages/twenty-front/src/modules/marketplace/components/SettingsApplicationInstallPermissionValidationModal.tsx b/packages/twenty-front/src/modules/marketplace/components/SettingsApplicationInstallPermissionValidationModal.tsxindex eabf6645395..167555804fc 100644--- a/packages/twenty-front/src/modules/marketplace/components/SettingsApplicationInstallPermissionValidationModal.tsx+++ b/packages/twenty-front/src/modules/marketplace/components/SettingsApplicationInstallPermissionValidationModal.tsx@@ -1,10 +1,12 @@+import { Dialog } from 'twenty-ui/primitives/surfaces';+import { DialogInstance } from '@/ui/layout/dialog/components/DialogInstance';import { AppConnectionHeader } from '@/applications/components/AppConnectionHeader';import { AuthorizeActionButtons } from '@/applications/components/AuthorizeActionButtons';import {buildPermissionSummaryFromRoleManifest,type PermissionSummaryItem,} from '@/marketplace/utils/buildPermissionSummaryFromRoleManifest';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { styled } from '@linaria/react';import { t } from '@lingui/core/macro';import { useMemo } from 'react';@@ -12,7 +14,6 @@ import { type RoleManifest } from 'twenty-shared/application';import { LightButton } from 'twenty-ui/components';import { IconChevronLeft } from 'twenty-ui/icon';import { themeCssVariables } from 'twenty-ui/theme-constants';-import { StyledAppModal } from '~/pages/settings/applications/components/SettingsAppModalLayout';type SettingsApplicationInstallPermissionValidationModalProps = {modalInstanceId: string;@@ -96,7 +97,7 @@ export const SettingsApplicationInstallPermissionValidationModal = ({onAuthorize,isInstalling,}: SettingsApplicationInstallPermissionValidationModalProps) => {- const { closeModal } = useModal();+ const { closeDialog } = useDialog();const permissionItems: PermissionSummaryItem[] = useMemo(() => {if (!defaultRole) {@@ -107,64 +108,70 @@ export const SettingsApplicationInstallPermissionValidationModal = ({}, [defaultRole]);const handleAuthorize = () => {- closeModal(modalInstanceId);+ closeDialog(modalInstanceId);onAuthorize();};const handleClose = () => {- closeModal(modalInstanceId);+ closeDialog(modalInstanceId);};return (- <StyledAppModal- modalId={modalInstanceId}- isClosable+ <DialogInstance+ dialogId={modalInstanceId}+ dismissibleonClose={handleClose}- size="fullscreen"- padding="none"- overlay="transparent">- <StyledFullscreenContainer>- <StyledLightButton- startIcon={<IconChevronLeft />}- onClick={handleClose}- >{t`Back to settings`}</StyledLightButton>-- <StyledContent>- <StyledAppConnectionHeaderContainer>- <AppConnectionHeader- appLogoUrl={appLogoUrl}- appName={appDisplayName}- />- </StyledAppConnectionHeaderContainer>-- <StyledTitle>- {t`Install ${appDisplayName} on your workspace`}- </StyledTitle>-- {permissionItems.length > 0 && (- <StyledPermissionsCard>- <StyledPermissionsTitle>- {t`${appDisplayName} would like to:`}- </StyledPermissionsTitle>- {permissionItems.map((item) => (- <StyledPermissionRow key={item.label}>- <StyledPermissionIcon>- <item.Icon size={16} />- </StyledPermissionIcon>- {item.label}- </StyledPermissionRow>- ))}- </StyledPermissionsCard>- )}-- <AuthorizeActionButtons- onCancel={handleClose}- onAuthorize={handleAuthorize}- isLoading={isInstalling}- />- </StyledContent>- </StyledFullscreenContainer>- </StyledAppModal>+ {({ container, backdrop, viewportProps, onKeyDown }) => (+ <Dialog.Popup+ aria-label={t`Install ${appDisplayName} on your workspace`}+ {...{ container, backdrop, viewportProps, onKeyDown }}+ size="fullscreen"+ style={{ padding: 0, background: 'transparent', boxShadow: 'none' }}+ >+ <StyledFullscreenContainer>+ <StyledLightButton+ startIcon={<IconChevronLeft />}+ onClick={handleClose}+ >{t`Back to settings`}</StyledLightButton>++ <StyledContent>+ <StyledAppConnectionHeaderContainer>+ <AppConnectionHeader+ appLogoUrl={appLogoUrl}+ appName={appDisplayName}+ />+ </StyledAppConnectionHeaderContainer>++ <StyledTitle>+ {t`Install ${appDisplayName} on your workspace`}+ </StyledTitle>++ {permissionItems.length > 0 && (+ <StyledPermissionsCard>+ <StyledPermissionsTitle>+ {t`${appDisplayName} would like to:`}+ </StyledPermissionsTitle>+ {permissionItems.map((item) => (+ <StyledPermissionRow key={item.label}>+ <StyledPermissionIcon>+ <item.Icon size={16} />+ </StyledPermissionIcon>+ {item.label}+ </StyledPermissionRow>+ ))}+ </StyledPermissionsCard>+ )}++ <AuthorizeActionButtons+ onCancel={handleClose}+ onAuthorize={handleAuthorize}+ isLoading={isInstalling}+ />+ </StyledContent>+ </StyledFullscreenContainer>+ </Dialog.Popup>+ )}+ </DialogInstance>);};diff --git a/packages/twenty-front/src/modules/marketplace/hooks/useInstallMarketplaceAppWithPermissionValidation.ts b/packages/twenty-front/src/modules/marketplace/hooks/useInstallMarketplaceAppWithPermissionValidation.tsindex 096c65b40db..b9465c719a4 100644--- a/packages/twenty-front/src/modules/marketplace/hooks/useInstallMarketplaceAppWithPermissionValidation.ts+++ b/packages/twenty-front/src/modules/marketplace/hooks/useInstallMarketplaceAppWithPermissionValidation.ts@@ -1,4 +1,4 @@-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useInstallMarketplaceApp } from '@/marketplace/hooks/useInstallMarketplaceApp';import { useCallback } from 'react';@@ -12,12 +12,12 @@ type UseInstallMarketplaceAppWithPermissionValidationArgs = Parameters<export const useInstallMarketplaceAppWithPermissionValidation = (args?: UseInstallMarketplaceAppWithPermissionValidationArgs,) => {- const { openModal } = useModal();+ const { openDialog } = useDialog();const { install, isInstalling } = useInstallMarketplaceApp(args);const requestInstall = useCallback(() => {- openModal(INSTALL_PERMISSION_VALIDATION_MODAL_ID);- }, [openModal]);+ openDialog(INSTALL_PERMISSION_VALIDATION_MODAL_ID);+ }, [openDialog]);return {requestInstall,diff --git a/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolderDnd.tsx b/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolderDnd.tsxindex 33639f78b69..6f8ab9fe116 100644--- a/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolderDnd.tsx+++ b/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolderDnd.tsx@@ -45,7 +45,7 @@ import { useFavoritesFolderEdit } from '@/navigation-menu-item/edit/folder/hooksimport { NavigationMenuItemAddDropdown } from '@/navigation-menu-item/edit/components/NavigationMenuItemAddDropdown';import type { EditModeProps } from '@/object-metadata/components/EditModeProps';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';import { NavigationDrawerItem } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerItem';import { NavigationDrawerSubItem } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerSubItem';import { getNavigationSubItemLeftAdornment } from '@/ui/navigation/navigation-drawer/utils/getNavigationSubItemLeftAdornment';@@ -285,10 +285,10 @@ export const NavigationMenuItemFolderDnd = ({});const deleteModal =- isEditInPlace && favoritesEdit.isModalOpened+ isEditInPlace && favoritesEdit.isDialogOpened? createPortal(- <ConfirmationModal- modalInstanceId={favoritesEdit.modalId}+ <ConfirmationDialog+ dialogId={favoritesEdit.modalId}title={favoritesEdit.navigationMenuItemCount > 1? t`Remove ${favoritesEdit.navigationMenuItemCount} navigation menu items?`diff --git a/packages/twenty-front/src/modules/navigation-menu-item/edit/folder/hooks/useFavoritesFolderEdit.ts b/packages/twenty-front/src/modules/navigation-menu-item/edit/folder/hooks/useFavoritesFolderEdit.tsindex 63a7e65fb49..26e23824cd2 100644--- a/packages/twenty-front/src/modules/navigation-menu-item/edit/folder/hooks/useFavoritesFolderEdit.ts+++ b/packages/twenty-front/src/modules/navigation-menu-item/edit/folder/hooks/useFavoritesFolderEdit.ts@@ -6,8 +6,8 @@ import { type NavigationMenuItem } from '~/generated-metadata/graphql';import { NAVIGATION_MENU_ITEM_FOLDER_DELETE_MODAL_ID } from '@/navigation-menu-item/common/constants/NavigationMenuItemFolderDeleteModalId';import { useDeleteNavigationMenuItemFolder } from '@/navigation-menu-item/edit/folder/hooks/useDeleteNavigationMenuItemFolder';import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDropdownOpenComponentState';-import { useModal } from '@/ui/layout/modal/hooks/useModal';-import { isModalOpenedComponentState } from '@/ui/layout/modal/states/isModalOpenedComponentState';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';+import { isDialogOpenedComponentState } from '@/ui/layout/dialog/states/isDialogOpenedComponentState';import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';type UseFavoritesFolderEditParams = {@@ -33,7 +33,7 @@ export const useFavoritesFolderEdit = ({const { deleteNavigationMenuItemFolder } =useDeleteNavigationMenuItemFolder();- const { openModal } = useModal();+ const { openDialog } = useDialog();const dropdownId = `navigation-menu-item-folder-edit-${folderId}`;const isDropdownOpen = useAtomComponentStateValue(@@ -42,14 +42,14 @@ export const useFavoritesFolderEdit = ({);const modalId = `${NAVIGATION_MENU_ITEM_FOLDER_DELETE_MODAL_ID}-${folderId}`;- const isModalOpened = useAtomComponentStateValue(- isModalOpenedComponentState,+ const isDialogOpened = useAtomComponentStateValue(+ isDialogOpenedComponentState,modalId,);const handleFolderDelete = async () => {if (navigationMenuItems.length > 0) {- openModal(modalId);+ openDialog(modalId);} else {await deleteNavigationMenuItemFolder(folderId);}@@ -65,7 +65,7 @@ export const useFavoritesFolderEdit = ({handleConfirmDelete,isDropdownOpen,modalId,- isModalOpened,+ isDialogOpened,navigationMenuItemCount: navigationMenuItems.length,};};diff --git a/packages/twenty-front/src/modules/object-core/workflows/versions/components/CoreWorkflowVersionRestoreButton.tsx b/packages/twenty-front/src/modules/object-core/workflows/versions/components/CoreWorkflowVersionRestoreButton.tsxindex e6bf0aa8588..f8868027f78 100644--- a/packages/twenty-front/src/modules/object-core/workflows/versions/components/CoreWorkflowVersionRestoreButton.tsx+++ b/packages/twenty-front/src/modules/object-core/workflows/versions/components/CoreWorkflowVersionRestoreButton.tsx@@ -3,8 +3,8 @@ import { Button } from 'twenty-ui/primitives/input';import { RESTORE_CORE_WORKFLOW_VERSION_MODAL_ID } from '@/object-core/workflows/versions/constants/RestoreCoreWorkflowVersionModalId';import { useRestoreCoreWorkflowVersionAsDraft } from '@/object-core/workflows/versions/hooks/useRestoreCoreWorkflowVersionAsDraft';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';export const CoreWorkflowVersionRestoreButton = ({workflowId,@@ -14,7 +14,7 @@ export const CoreWorkflowVersionRestoreButton = ({workspaceWorkflowVersionId: string;}) => {const { t } = useLingui();- const { openModal } = useModal();+ const { openDialog } = useDialog();const {restoreCoreWorkflowVersionAsDraft,isRestoring,@@ -27,7 +27,7 @@ export const CoreWorkflowVersionRestoreButton = ({const handleRestoreClick = () => {if (hasExistingDraft) {- openModal(RESTORE_CORE_WORKFLOW_VERSION_MODAL_ID);+ openDialog(RESTORE_CORE_WORKFLOW_VERSION_MODAL_ID);return;}@@ -44,8 +44,8 @@ export const CoreWorkflowVersionRestoreButton = ({variant="solid"color="accent">{t`Restore`}</Button>- <ConfirmationModal- modalInstanceId={RESTORE_CORE_WORKFLOW_VERSION_MODAL_ID}+ <ConfirmationDialog+ dialogId={RESTORE_CORE_WORKFLOW_VERSION_MODAL_ID}title={t`A draft already exists`}subtitle={t`A draft already exists for this workflow. Are you sure you want to erase it?`}confirmButtonText={t`Override Draft`}diff --git a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardClickOutsideEffect.tsx b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardClickOutsideEffect.tsxindex df20d1b9191..eda9d634efb 100644--- a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardClickOutsideEffect.tsx+++ b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardClickOutsideEffect.tsx@@ -9,7 +9,7 @@ import { useResetRecordBoardSelection } from '@/object-record/record-board/hooksimport { RECORD_BOARD_CARD_CLICK_OUTSIDE_ID } from '@/object-record/record-board/record-board-card/constants/RecordBoardCardClickOutsideId';import { isDraggingRecordComponentState } from '@/object-record/record-drag/states/isDraggingRecordComponentState';-import { MODAL_BACKDROP_CLICK_OUTSIDE_ID } from '@/ui/layout/modal/constants/ModalBackdropClickOutsideId';+import { DIALOG_BACKDROP_CLICK_OUTSIDE_ID } from '@/ui/layout/dialog/constants/DialogBackdropClickOutsideId';import { PAGE_ACTION_CONTAINER_CLICK_OUTSIDE_ID } from '@/ui/layout/page/constants/PageActionContainerClickOutsideId';import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside';import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';@@ -34,7 +34,7 @@ export const RecordBoardClickOutsideEffect = () => {excludedClickOutsideIds: [COMMAND_MENU_DROPDOWN_CLICK_OUTSIDE_ID,COMMAND_MENU_CLICK_OUTSIDE_ID,- MODAL_BACKDROP_CLICK_OUTSIDE_ID,+ DIALOG_BACKDROP_CLICK_OUTSIDE_ID,PAGE_ACTION_CONTAINER_CLICK_OUTSIDE_ID,RECORD_BOARD_CARD_CLICK_OUTSIDE_ID,LINK_CHIP_CLICK_OUTSIDE_ID,diff --git a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardContainer.tsx b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardContainer.tsxindex 87c28f2151e..2934c1b3af6 100644--- a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardContainer.tsx+++ b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardContainer.tsx@@ -14,7 +14,7 @@ import { RecordIndexRemoveSortingModal } from '@/object-record/record-index/compimport { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext';import { getRecordIndexRemoveSortingModalId } from '@/object-record/record-index/utils/getRecordIndexRemoveSortingModalId';-import { isModalOpenedComponentState } from '@/ui/layout/modal/states/isModalOpenedComponentState';+import { isDialogOpenedComponentState } from '@/ui/layout/dialog/states/isDialogOpenedComponentState';import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';import { isDefined } from 'twenty-shared/utils';@@ -58,8 +58,8 @@ export const RecordBoardContainer = ({const { recordIndexId } = useRecordIndexContextOrThrow();- const isModalOpened = useAtomComponentStateValue(- isModalOpenedComponentState,+ const isDialogOpened = useAtomComponentStateValue(+ isDialogOpenedComponentState,getRecordIndexRemoveSortingModalId(recordIndexId),);@@ -83,7 +83,7 @@ export const RecordBoardContainer = ({value={{ instanceId: recordBoardId }}><RecordBoard />- {isModalOpened && <RecordIndexRemoveSortingModal />}+ {isDialogOpened && <RecordIndexRemoveSortingModal />}<RecordBoardHotkeyEffect /><RecordBoardBodyEscapeHotkeyEffect /></RecordBoardComponentInstanceContext.Provider>diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/dnd/hooks/useRecordBoardColumnDndKit.ts b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/dnd/hooks/useRecordBoardColumnDndKit.tsindex db9a4f2ab62..32c86e1d41b 100644--- a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/dnd/hooks/useRecordBoardColumnDndKit.ts+++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/dnd/hooks/useRecordBoardColumnDndKit.ts@@ -8,7 +8,7 @@ import { RecordGroupSort } from '@/object-record/record-group/types/RecordGroupSimport { useRecordIndexIdFromCurrentContextStore } from '@/object-record/record-index/hooks/useRecordIndexIdFromCurrentContextStore';import { recordIndexRecordGroupIsDraggableSortComponentSelector } from '@/object-record/record-index/states/selectors/recordIndexRecordGroupIsDraggableSortComponentSelector';import { recordIndexRecordGroupSortComponentState } from '@/object-record/record-index/states/recordIndexRecordGroupSortComponentState';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { type DragDropItemData } from '@/ui/utilities/drag-and-drop/types/DragDropItemData';import { resolveDropFromPointer } from '@/ui/utilities/drag-and-drop/utils/resolveDropFromPointer';import { useDragSelect } from '@/ui/utilities/drag-select/hooks/useDragSelect';@@ -42,7 +42,7 @@ export const useRecordBoardColumnDndKit = (): {onDragEnd: (event: DragEndPayload) => void;};} => {- const { openModal } = useModal();+ const { openDialog } = useDialog();const { recordIndexId } = useRecordIndexIdFromCurrentContextStore();const { reorderRecordGroups } = useReorderRecordGroups({recordIndexId,@@ -127,7 +127,7 @@ export const useRecordBoardColumnDndKit = (): {fromIndex: sourceIndex,toIndex: destinationIndex,});- openModal(getRecordGroupReorderConfirmationModalId(recordIndexId));+ openDialog(getRecordGroupReorderConfirmationModalId(recordIndexId));return;}diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-dnd/hooks/useRecordBoardDndKit.ts b/packages/twenty-front/src/modules/object-record/record-board/record-board-dnd/hooks/useRecordBoardDndKit.tsindex 2b90f3d3ccb..fd62def23f0 100644--- a/packages/twenty-front/src/modules/object-record/record-board/record-board-dnd/hooks/useRecordBoardDndKit.ts+++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-dnd/hooks/useRecordBoardDndKit.ts@@ -18,7 +18,7 @@ import { originalDragSelectionComponentState } from '@/object-record/record-dragimport { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext';import { getRecordIndexRemoveSortingModalId } from '@/object-record/record-index/utils/getRecordIndexRemoveSortingModalId';import { currentRecordSortsComponentState } from '@/object-record/record-sort/states/currentRecordSortsComponentState';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useAtomComponentSelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorCallbackState';import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState';import { type DragDropProviderDragEndEvent } from '@/ui/utilities/drag-and-drop/types/DragDropProviderDragEndEvent';@@ -76,7 +76,7 @@ export const useRecordBoardDndKit = (): {isRecordBoardDropProcessingComponentState,);- const { openModal } = useModal();+ const { openDialog } = useDialog();const { recordIndexId } = useRecordIndexContextOrThrow();const [activeDropTargetIndex, setActiveDropTargetIndex] = useState<@@ -167,7 +167,7 @@ export const useRecordBoardDndKit = (): {if (boardCardDropBehavior.shouldBlockDrop) {resetDragState();- openModal(getRecordIndexRemoveSortingModalId(recordIndexId));+ openDialog(getRecordIndexRemoveSortingModalId(recordIndexId));return;}diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/components/RecordCalendar.tsx b/packages/twenty-front/src/modules/object-record/record-calendar/components/RecordCalendar.tsxindex 9f3f51418ba..eece0b1735c 100644--- a/packages/twenty-front/src/modules/object-record/record-calendar/components/RecordCalendar.tsx+++ b/packages/twenty-front/src/modules/object-record/record-calendar/components/RecordCalendar.tsx@@ -11,7 +11,7 @@ import { RECORD_CALENDAR_CARD_CLICK_OUTSIDE_ID } from '@/object-record/record-caimport { recordIndexCalendarLayoutComponentState } from '@/object-record/record-index/states/recordIndexCalendarLayoutComponentState';import { RecordCalendarComponentInstanceContext } from '@/object-record/record-calendar/states/contexts/RecordCalendarComponentInstanceContext';import { useRecordCalendarSelection } from '@/object-record/record-calendar/states/selectors/useRecordCalendarSelection';-import { MODAL_BACKDROP_CLICK_OUTSIDE_ID } from '@/ui/layout/modal/constants/ModalBackdropClickOutsideId';+import { DIALOG_BACKDROP_CLICK_OUTSIDE_ID } from '@/ui/layout/dialog/constants/DialogBackdropClickOutsideId';import { PAGE_ACTION_CONTAINER_CLICK_OUTSIDE_ID } from '@/ui/layout/page/constants/PageActionContainerClickOutsideId';import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside';import { ScrollWrapper } from '@/ui/utilities/scroll/components/ScrollWrapper';@@ -50,7 +50,7 @@ export const RecordCalendar = () => {excludedClickOutsideIds: [COMMAND_MENU_DROPDOWN_CLICK_OUTSIDE_ID,COMMAND_MENU_CLICK_OUTSIDE_ID,- MODAL_BACKDROP_CLICK_OUTSIDE_ID,+ DIALOG_BACKDROP_CLICK_OUTSIDE_ID,PAGE_ACTION_CONTAINER_CLICK_OUTSIDE_ID,RECORD_CALENDAR_CARD_CLICK_OUTSIDE_ID,LINK_CHIP_CLICK_OUTSIDE_ID,diff --git a/packages/twenty-front/src/modules/object-record/record-drag/hooks/useProcessTableWithGroupRecordDrop.ts b/packages/twenty-front/src/modules/object-record/record-drag/hooks/useProcessTableWithGroupRecordDrop.tsindex a5e5c7fc412..68a8a1ae99b 100644--- a/packages/twenty-front/src/modules/object-record/record-drag/hooks/useProcessTableWithGroupRecordDrop.ts+++ b/packages/twenty-front/src/modules/object-record/record-drag/hooks/useProcessTableWithGroupRecordDrop.ts@@ -16,7 +16,7 @@ import { currentRecordSortsComponentState } from '@/object-record/record-sort/stimport { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext';import { useRecordTableContextOrThrow } from '@/object-record/record-table/contexts/RecordTableContext';import { selectedRowIdsComponentSelector } from '@/object-record/record-table/states/selectors/selectedRowIdsComponentSelector';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState';import { useAtomComponentSelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorCallbackState';import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState';@@ -30,7 +30,7 @@ export const useProcessTableWithGroupRecordDrop = () => {const { updateOneRecord } = useUpdateOneRecord();- const { openModal } = useModal();+ const { openDialog } = useDialog();const recordIdsByGroupFamilyState = useAtomComponentFamilyStateCallbackState(recordIndexRecordIdsByGroupComponentFamilyState,@@ -95,7 +95,7 @@ export const useProcessTableWithGroupRecordDrop = () => {const existingRecordSorts = store.get(currentRecordSorts);if (existingRecordSorts.length > 0) {- openModal(getRecordIndexRemoveSortingModalId(recordIndexId));+ openDialog(getRecordIndexRemoveSortingModalId(recordIndexId));return;}@@ -129,7 +129,7 @@ export const useProcessTableWithGroupRecordDrop = () => {selectedRowIds,recordIdsByGroupFamilyState,recordIndexGroupFieldMetadataItem?.id,- openModal,+ openDialog,updateOneRecord,],);diff --git a/packages/twenty-front/src/modules/object-record/record-drag/hooks/useProcessTableWithoutGroupRecordDrop.ts b/packages/twenty-front/src/modules/object-record/record-drag/hooks/useProcessTableWithoutGroupRecordDrop.tsindex c87f9a13eef..b17024addd9 100644--- a/packages/twenty-front/src/modules/object-record/record-drag/hooks/useProcessTableWithoutGroupRecordDrop.ts+++ b/packages/twenty-front/src/modules/object-record/record-drag/hooks/useProcessTableWithoutGroupRecordDrop.ts@@ -16,7 +16,7 @@ import { useRecordIndexContextOrThrow } from '@/object-record/record-index/conteimport { useRecordTableContextOrThrow } from '@/object-record/record-table/contexts/RecordTableContext';import { selectedRowIdsComponentSelector } from '@/object-record/record-table/states/selectors/selectedRowIdsComponentSelector';import { type RecordWithPosition } from '@/object-record/utils/computeNewPositionOfDraggedRecord';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState';import { useAtomComponentSelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorCallbackState';import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';@@ -47,7 +47,7 @@ export const useProcessTableWithoutGroupRecordDrop = () => {currentRecordSortsComponentState,);- const { openModal } = useModal();+ const { openDialog } = useDialog();const { triggerTableWithoutGroupDragAndDropOptimisticUpdate } =useTriggerTableWithoutGroupDragAndDropOptimisticUpdate();@@ -57,7 +57,7 @@ export const useProcessTableWithoutGroupRecordDrop = () => {if (!tableRecordDropResult.destination) return;if (currentRecordSorts.length > 0) {- openModal(getRecordIndexRemoveSortingModalId(recordIndexId));+ openDialog(getRecordIndexRemoveSortingModalId(recordIndexId));return;}@@ -161,7 +161,7 @@ export const useProcessTableWithoutGroupRecordDrop = () => {selectedRowIds,store,updateOneRecord,- openModal,+ openDialog,currentRecordSorts,originalDragSelection,allRecordIdsWithoutGroup,diff --git a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationRecordsListItem.tsx b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationRecordsListItem.tsxindex f034d8a4a99..bf85c4c1a96 100644--- a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationRecordsListItem.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationRecordsListItem.tsx@@ -24,8 +24,8 @@ import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContentimport { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDropdownOpenComponentState';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState';import { t } from '@lingui/core/macro';@@ -85,7 +85,7 @@ export const RecordDetailRelationRecordsListItem = ({const { onSubmit } = useContext(FieldInputEventContext);- const { openModal } = useModal();+ const { openDialog } = useDialog();const { relationType, objectMetadataNameSingular } =fieldDefinition.metadata as FieldRelationMetadata;@@ -188,7 +188,7 @@ export const RecordDetailRelationRecordsListItem = ({const handleDelete = async () => {closeDropdown(dropdownInstanceId);- openModal(getDeleteRelationModalId(relationRecord.id));+ openDialog(getDeleteRelationModalId(relationRecord.id));};const handleConfirmDelete = async () => {@@ -274,8 +274,8 @@ export const RecordDetailRelationRecordsListItem = ({/></AnimatedEaseInOut>{createPortal(- <ConfirmationModal- modalInstanceId={getDeleteRelationModalId(relationRecord.id)}+ <ConfirmationDialog+ dialogId={getDeleteRelationModalId(relationRecord.id)}title={t`Delete Related ${relationObjectLabelSingular}`}subtitle={<Trans>diff --git a/packages/twenty-front/src/modules/object-record/record-group/components/RecordGroupReorderConfirmationModal.tsx b/packages/twenty-front/src/modules/object-record/record-group/components/RecordGroupReorderConfirmationModal.tsxindex aed67685e00..f0940d6ecca 100644--- a/packages/twenty-front/src/modules/object-record/record-group/components/RecordGroupReorderConfirmationModal.tsx+++ b/packages/twenty-front/src/modules/object-record/record-group/components/RecordGroupReorderConfirmationModal.tsx@@ -1,7 +1,7 @@import { getRecordGroupReorderConfirmationModalId } from '@/object-record/record-group/utils/getRecordGroupReorderConfirmationModalId';import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext';import { recordIndexRecordGroupSortComponentState } from '@/object-record/record-index/states/recordIndexRecordGroupSortComponentState';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';import { t } from '@lingui/core/macro';import { type ReactNode } from 'react';@@ -22,10 +22,8 @@ export const RecordGroupReorderConfirmationModal = ({return (<>{createPortal(- <ConfirmationModal- modalInstanceId={getRecordGroupReorderConfirmationModalId(- recordIndexId,- )}+ <ConfirmationDialog+ dialogId={getRecordGroupReorderConfirmationModalId(recordIndexId)}title={t`Group sorting`}subtitle={t`Would you like to remove ${recordIndexRecordGroupSort} group sorting?`}onConfirmClick={onConfirmClick}diff --git a/packages/twenty-front/src/modules/object-record/record-group/hooks/useRecordGroupReorderConfirmationModal.ts b/packages/twenty-front/src/modules/object-record/record-group/hooks/useRecordGroupReorderConfirmationModal.tsindex 0b5febcb92c..2cc80af8c0b 100644--- a/packages/twenty-front/src/modules/object-record/record-group/hooks/useRecordGroupReorderConfirmationModal.ts+++ b/packages/twenty-front/src/modules/object-record/record-group/hooks/useRecordGroupReorderConfirmationModal.ts@@ -6,7 +6,7 @@ import { recordIndexRecordGroupIsDraggableSortComponentSelector } from '@/objectimport { useCloseAnyOpenDropdown } from '@/ui/layout/dropdown/hooks/useCloseAnyOpenDropdown';import { useGoBackToPreviousDropdownFocusId } from '@/ui/layout/dropdown/hooks/useGoBackToPreviousDropdownFocusId';import { useSetActiveDropdownFocusIdAndMemorizePrevious } from '@/ui/layout/dropdown/hooks/useSetFocusedDropdownIdAndMemorizePrevious';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState';import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue';import { type ViewType } from '@/views/types/ViewType';@@ -27,7 +27,7 @@ export const useRecordGroupReorderConfirmationModal = ({const { goBackToPreviousDropdownFocusId } =useGoBackToPreviousDropdownFocusId();- const { openModal } = useModal();+ const { openDialog } = useDialog();const [pendingDragEndHandlerParams, setPendingDragEndHandlerParams] =useState<DraggableListDropResult | null>(null);@@ -60,7 +60,7 @@ export const useRecordGroupReorderConfirmationModal = ({const handleDragEndWithModal = (result: DraggableListDropResult) => {if (!isDragableSortRecordGroup) {closeAnyOpenDropdown();- openModal(getRecordGroupReorderConfirmationModalId(recordIndexId));+ openDialog(getRecordGroupReorderConfirmationModalId(recordIndexId));setActiveDropdownFocusIdAndMemorizePrevious(null);setPendingDragEndHandlerParams(result);} else {diff --git a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexRemoveSortingModal.tsx b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexRemoveSortingModal.tsxindex a0ce3747bc9..c1d04b179c1 100644--- a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexRemoveSortingModal.tsx+++ b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexRemoveSortingModal.tsx@@ -2,7 +2,7 @@ import { useRecordIndexContextOrThrow } from '@/object-record/record-index/conteimport { getRecordIndexRemoveSortingModalId } from '@/object-record/record-index/utils/getRecordIndexRemoveSortingModalId';import { useRemoveRecordSort } from '@/object-record/record-sort/hooks/useRemoveRecordSort';import { currentRecordSortsComponentState } from '@/object-record/record-sort/states/currentRecordSortsComponentState';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';import { useLingui } from '@lingui/react/macro';@@ -27,8 +27,8 @@ export const RecordIndexRemoveSortingModal = () => {};return (- <ConfirmationModal- modalInstanceId={getRecordIndexRemoveSortingModalId(recordIndexId)}+ <ConfirmationDialog+ dialogId={getRecordIndexRemoveSortingModalId(recordIndexId)}title={t`Remove sorting?`}subtitle={t`This is required to enable manual row reordering.`}onConfirmClick={handleRemoveClick}diff --git a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexTableContainer.tsx b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexTableContainer.tsxindex 22226a879f6..5fdda57ae62 100644--- a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexTableContainer.tsx+++ b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexTableContainer.tsx@@ -3,7 +3,7 @@ import { RecordIndexTableContainerEffect } from '@/object-record/record-index/coimport { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext';import { getRecordIndexRemoveSortingModalId } from '@/object-record/record-index/utils/getRecordIndexRemoveSortingModalId';import { RecordTableWithWrappers } from '@/object-record/record-table/components/RecordTableWithWrappers';-import { isModalOpenedComponentState } from '@/ui/layout/modal/states/isModalOpenedComponentState';+import { isDialogOpenedComponentState } from '@/ui/layout/dialog/states/isDialogOpenedComponentState';import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';type RecordIndexTableContainerProps = {@@ -16,8 +16,8 @@ export const RecordIndexTableContainer = ({const { objectNameSingular, viewBarInstanceId, recordIndexId } =useRecordIndexContextOrThrow();- const isModalOpened = useAtomComponentStateValue(- isModalOpenedComponentState,+ const isDialogOpened = useAtomComponentStateValue(+ isDialogOpenedComponentState,getRecordIndexRemoveSortingModalId(recordIndexId),);@@ -29,7 +29,7 @@ export const RecordIndexTableContainer = ({objectNameSingular={objectNameSingular}viewBarId={viewBarInstanceId}/>- {isModalOpened && <RecordIndexRemoveSortingModal />}+ {isDialogOpened && <RecordIndexRemoveSortingModal />}</>);};diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyFocusClickOutsideEffect.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyFocusClickOutsideEffect.tsxindex 178ab5ae321..e5293c3d2fd 100644--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyFocusClickOutsideEffect.tsx+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyFocusClickOutsideEffect.tsx@@ -4,7 +4,7 @@ import { RECORD_TABLE_CLICK_OUTSIDE_LISTENER_ID } from '@/object-record/record-timport { SIDE_PANEL_CLICK_OUTSIDE_ID } from '@/side-panel/constants/SidePanelClickOutsideId';import { useRecordTableContextOrThrow } from '@/object-record/record-table/contexts/RecordTableContext';import { useLeaveTableFocus } from '@/object-record/record-table/hooks/internal/useLeaveTableFocus';-import { MODAL_BACKDROP_CLICK_OUTSIDE_ID } from '@/ui/layout/modal/constants/ModalBackdropClickOutsideId';+import { DIALOG_BACKDROP_CLICK_OUTSIDE_ID } from '@/ui/layout/dialog/constants/DialogBackdropClickOutsideId';import { PAGE_ACTION_CONTAINER_CLICK_OUTSIDE_ID } from '@/ui/layout/page/constants/PageActionContainerClickOutsideId';import { currentFocusedItemSelector } from '@/ui/utilities/focus/states/currentFocusedItemSelector';import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';@@ -30,7 +30,7 @@ export const RecordTableBodyFocusClickOutsideEffect = ({COMMAND_MENU_DROPDOWN_CLICK_OUTSIDE_ID,COMMAND_MENU_CLICK_OUTSIDE_ID,PAGE_ACTION_CONTAINER_CLICK_OUTSIDE_ID,- MODAL_BACKDROP_CLICK_OUTSIDE_ID,+ DIALOG_BACKDROP_CLICK_OUTSIDE_ID,SIDE_PANEL_CLICK_OUTSIDE_ID,],listenerId: RECORD_TABLE_CLICK_OUTSIDE_LISTENER_ID,diff --git a/packages/twenty-front/src/modules/object-record/record-update-multiple/components/UpdateMultipleRecordsContainer.tsx b/packages/twenty-front/src/modules/object-record/record-update-multiple/components/UpdateMultipleRecordsContainer.tsxindex 2e5f74fc45e..82070e8bca4 100644--- a/packages/twenty-front/src/modules/object-record/record-update-multiple/components/UpdateMultipleRecordsContainer.tsx+++ b/packages/twenty-front/src/modules/object-record/record-update-multiple/components/UpdateMultipleRecordsContainer.tsx@@ -3,8 +3,8 @@ import { UpdateMultipleRecordsFooter } from '@/object-record/record-update-multiimport { UpdateMultipleRecordsForm } from '@/object-record/record-update-multiple/components/UpdateMultipleRecordsForm';import { useUpdateMultipleRecordsActions } from '@/object-record/record-update-multiple/hooks/useUpdateMultipleRecordsActions';import { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { ShowPageContainer } from '@/ui/layout/page/components/ShowPageContainer';import { SidePanelProvider } from '@/ui/layout/side-panel/contexts/SidePanelContext';import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';@@ -57,7 +57,7 @@ export const UpdateMultipleRecordsContainer = ({const { t } = useLingui();const { enqueueToast } = useToast();- const { openModal } = useModal();+ const { openDialog } = useDialog();const { closeSidePanelMenu } = useSidePanelMenu();const [fieldUpdates, setFieldUpdates] = useState<UpdateMultipleRecordsState>(@@ -65,7 +65,7 @@ export const UpdateMultipleRecordsContainer = ({);const handleUpdateClick = () => {- openModal(UPDATE_MULTIPLE_RECORDS_CONFIRMATION_MODAL_ID);+ openDialog(UPDATE_MULTIPLE_RECORDS_CONFIRMATION_MODAL_ID);};const handleConfirmedUpdate = async () => {@@ -120,8 +120,8 @@ export const UpdateMultipleRecordsContainer = ({/></StyledShowPageRightContainer></ShowPageContainer>- <ConfirmationModal- modalInstanceId={UPDATE_MULTIPLE_RECORDS_CONFIRMATION_MODAL_ID}+ <ConfirmationDialog+ dialogId={UPDATE_MULTIPLE_RECORDS_CONFIRMATION_MODAL_ID}title={t`Update ${contextStoreNumberOfSelectedRecords} records`}subtitle={t`This will modify ${contextStoreNumberOfSelectedRecords} records. This action cannot be undone.`}onConfirmClick={handleConfirmedUpdate}diff --git a/packages/twenty-front/src/modules/object-record/record-update-multiple/components/__stories__/UpdateMultipleRecordsContainer.stories.tsx b/packages/twenty-front/src/modules/object-record/record-update-multiple/components/__stories__/UpdateMultipleRecordsContainer.stories.tsxindex 04a55ea0117..c80a5463d59 100644--- a/packages/twenty-front/src/modules/object-record/record-update-multiple/components/__stories__/UpdateMultipleRecordsContainer.stories.tsx+++ b/packages/twenty-front/src/modules/object-record/record-update-multiple/components/__stories__/UpdateMultipleRecordsContainer.stories.tsx@@ -15,7 +15,7 @@ import {} from '@storybook/react-vite';import gql from 'graphql-tag';import { useEffect } from 'react';-import { expect, userEvent, within } from 'storybook/test';+import { expect, userEvent, waitFor, within } from 'storybook/test';import { ContextStoreDecorator } from '~/testing/decorators/ContextStoreDecorator';import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';@@ -125,9 +125,17 @@ export const Default: Story = {await userEvent.click(applyButton);- const cancelButton = await canvas.findByRole('button', { name: /Cancel/i });+ const dialog = await within(canvasElement.ownerDocument.body).findByRole(+ 'dialog',+ { name: 'Update 3 records' },+ );+ const cancelButton = within(dialog).getByRole('button', {+ name: /Cancel/i,+ });expect(cancelButton).toBeEnabled();await userEvent.click(cancelButton);+ await waitFor(() => expect(dialog).not.toBeInTheDocument());+ await waitFor(() => expect(applyButton).toHaveFocus());},};diff --git a/packages/twenty-front/src/modules/onboarding/components/__stories__/OnboardingActivationSteps.stories.tsx b/packages/twenty-front/src/modules/onboarding/components/__stories__/OnboardingActivationSteps.stories.tsxindex b5233a47c35..550e18890eb 100644--- a/packages/twenty-front/src/modules/onboarding/components/__stories__/OnboardingActivationSteps.stories.tsx+++ b/packages/twenty-front/src/modules/onboarding/components/__stories__/OnboardingActivationSteps.stories.tsx@@ -1,17 +1,17 @@+import { StyledAuthContent } from '@/auth/components/StyledAuthContent';import { type Meta, type StoryObj } from '@storybook/react-vite';import { OnboardingActivationSteps } from '@/onboarding/components/OnboardingActivationSteps';import { OnboardingActivationStepsEffect } from '@/onboarding/components/OnboardingActivationStepsEffect';import { ONBOARDING_ACTIVATION_MESSAGES } from '@/onboarding/constants/OnboardingActivationMessages';import { useState } from 'react';-import { ModalContent } from 'twenty-ui/primitives/surfaces';import { ComponentDecorator } from 'twenty-ui/testing';-const RenderWithModalContent = () => {+const RenderWithStyledAuthContent = () => {const [messageIndex, setMessageIndex] = useState(0);return (- <ModalContent isVerticallyCentered isHorizontallyCentered>+ <StyledAuthContent><OnboardingActivationStepsEffectmessageIndex={messageIndex}setMessageIndex={setMessageIndex}@@ -21,7 +21,7 @@ const RenderWithModalContent = () => {messages={ONBOARDING_ACTIVATION_MESSAGES}messageIndex={messageIndex}/>- </ModalContent>+ </StyledAuthContent>);};@@ -29,7 +29,7 @@ const meta: Meta<typeof OnboardingActivationSteps> = {title: 'Modules/Onboarding/OnboardingActivationSteps',component: OnboardingActivationSteps,decorators: [ComponentDecorator],- render: RenderWithModalContent,+ render: RenderWithStyledAuthContent,};export default meta;diff --git a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsRowDropdownMenu.tsx b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsRowDropdownMenu.tsxindex 0ecd56ea697..dfe9e85d21e 100644--- a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsRowDropdownMenu.tsx+++ b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsRowDropdownMenu.tsx@@ -12,8 +12,8 @@ import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { Trans, useLingui } from '@lingui/react/macro';import {IconAt,@@ -41,7 +41,7 @@ export const SettingsAccountsRowDropdownMenu = ({const accountHandle = account.handle;const { t } = useLingui();- const { openModal } = useModal();+ const { openDialog } = useDialog();const navigate = useNavigateSettings();const { closeDropdown } = useCloseDropdown();@@ -141,15 +141,15 @@ export const SettingsAccountsRowDropdownMenu = ({text={t`Remove account`}onClick={() => {closeDropdown(dropdownId);- openModal(deleteAccountModalId);+ openDialog(deleteAccountModalId);}}/></DropdownMenuItemsContainer></DropdownContent>}/>- <ConfirmationModal- modalInstanceId={deleteAccountModalId}+ <ConfirmationDialog+ dialogId={deleteAccountModalId}title={t`Data deletion`}subtitle={<Trans>diff --git a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminServerAdminAccess.tsx b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminServerAdminAccess.tsxindex 9b9b02c562f..a64e97c127d 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminServerAdminAccess.tsx+++ b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminServerAdminAccess.tsx@@ -6,8 +6,8 @@ import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { CombinedGraphQLErrors } from '@apollo/client/errors';import { useMutation, useQuery } from '@apollo/client/react';import { styled } from '@linaria/react';@@ -78,7 +78,7 @@ export const SettingsAdminServerAdminAccess = ({}) => {const dropdownId = `server-admin-access-${userId}`;const apolloAdminClient = useApolloAdminClient();- const { openModal } = useModal();+ const { openDialog } = useDialog();const { closeDropdown } = useCloseDropdown();const { enqueueToast } = useToast();@@ -111,7 +111,7 @@ export const SettingsAdminServerAdminAccess = ({closeDropdown(dropdownId);setOtp('');setPendingChange(change);- openModal(SERVER_ADMIN_ACCESS_CONFIRMATION_MODAL_ID);+ openDialog(SERVER_ADMIN_ACCESS_CONFIRMATION_MODAL_ID);};const handleConfirm = async () => {@@ -222,8 +222,8 @@ export const SettingsAdminServerAdminAccess = ({}/></StyledValue>- <ConfirmationModal- modalInstanceId={SERVER_ADMIN_ACCESS_CONFIRMATION_MODAL_ID}+ <ConfirmationDialog+ dialogId={SERVER_ADMIN_ACCESS_CONFIRMATION_MODAL_ID}title={pendingChange?.isRevoking ? t`Revoke access` : t`Grant access`}confirmButtonColor={pendingChange?.isRevoking ? 'danger' : 'accent'}confirmButtonText={t`Confirm`}diff --git a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceBillingContent.tsx b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceBillingContent.tsxindex a21bf99ea4b..52a6c80cbb0 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceBillingContent.tsx+++ b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceBillingContent.tsx@@ -25,7 +25,7 @@ import { useApolloAdminClient } from '@/settings/admin-panel/apollo/hooks/useApoimport { SettingsAdminWorkspaceCreditGrantModal } from '@/settings/admin-panel/components/SettingsAdminWorkspaceCreditGrantModal';import { SettingsAdminWorkspaceCreditGrantsTable } from '@/settings/admin-panel/components/SettingsAdminWorkspaceCreditGrantsTable';import { formatSubscriptionItemValue } from '@/settings/admin-panel/utils/formatSubscriptionItemValue';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { GET_WORKSPACE_BILLING_ADMIN_PANEL } from '@/settings/admin-panel/graphql/queries/getWorkspaceBillingAdminPanel';import { SettingsTableCard } from '@/settings/components/SettingsTableCard';import { PlansTags } from '@/settings/billing/components/internal/PlansTags';@@ -130,7 +130,7 @@ export const SettingsAdminWorkspaceBillingContent = ({}: SettingsAdminWorkspaceBillingContentProps) => {const { t } = useLingui();const { formatNumber } = useNumberFormat();- const { openModal } = useModal();+ const { openDialog } = useDialog();const apolloAdminClient = useApolloAdminClient();const { data, loading } = useQuery<WorkspaceBillingAdminPanelQuery>(@@ -407,7 +407,7 @@ export const SettingsAdminWorkspaceBillingContent = ({<SettingsAdminWorkspaceCreditGrantsTableworkspaceId={workspaceId}creditGrants={creditGrants}- onGrantCreditsClick={() => openModal(GRANT_CREDITS_MODAL_ID)}+ onGrantCreditsClick={() => openDialog(GRANT_CREDITS_MODAL_ID)}/><SettingsAdminWorkspaceCreditGrantModaldiff --git a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceCreditGrantModal.tsx b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceCreditGrantModal.tsxindex 6ed5f8d23c9..52d4994c33f 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceCreditGrantModal.tsx+++ b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceCreditGrantModal.tsx@@ -1,3 +1,4 @@+import { DialogInstance } from '@/ui/layout/dialog/components/DialogInstance';import { useApolloAdminClient } from '@/settings/admin-panel/apollo/hooks/useApolloAdminClient';import { CREDIT_GRANT_EXPIRY_OPTIONS } from '@/settings/admin-panel/constants/CreditGrantExpiryOptions';import { CREDIT_GRANT_TYPE_LABELS } from '@/settings/admin-panel/constants/CreditGrantTypeLabels';@@ -6,8 +7,7 @@ import { GRANT_WORKSPACE_CREDITS } from '@/settings/admin-panel/graphql/mutationimport { GET_WORKSPACE_BILLING_ADMIN_PANEL } from '@/settings/admin-panel/graphql/queries/getWorkspaceBillingAdminPanel';import { Select } from '@/ui/input/components/Select';import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';-import { ModalStatefulWrapper } from '@/ui/layout/modal/components/ModalStatefulWrapper';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useMutation } from '@apollo/client/react';import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';@@ -52,7 +52,7 @@ export const SettingsAdminWorkspaceCreditGrantModal = ({workspaceId,}: SettingsAdminWorkspaceCreditGrantModalProps) => {const { t } = useLingui();- const { closeModal } = useModal();+ const { closeDialog } = useDialog();const { enqueueToast } = useToast();const apolloAdminClient = useApolloAdminClient();@@ -91,7 +91,7 @@ export const SettingsAdminWorkspaceCreditGrantModal = ({setReason('');setExpiresInDays(null);setSubmittedGrant(null);- closeModal(modalInstanceId);+ closeDialog(modalInstanceId);};const handleSubmit = async () => {@@ -137,95 +137,101 @@ export const SettingsAdminWorkspaceCreditGrantModal = ({};return (- <ModalStatefulWrapper- modalInstanceId={modalInstanceId}+ <DialogInstance+ dialogId={modalInstanceId}+ dismissibleonClose={handleClose}- isClosable- size="medium"- padding="large"- overlay="dark"- width="360px"- dataGloballyPreventClickOutsiderenderInDocumentBody- smallBorderRadius- autoHeight>- <Dialog.Title>{t`Grant credits`}</Dialog.Title>- <StyledSectionContainer>- <Section.Root align="center" color="primary">- {t`Credits are added on top of the plan allowance and are spent only once it runs out. They carry over in full from one billing period to the next, and stay available until they are used up or, where an expiry is set, until the end of the billing period that expiry falls in.`}- </Section.Root>- </StyledSectionContainer>-- <StyledFields>- <SettingsTextInput- instanceId={`${modalInstanceId}-amount`}- label={t`Amount`}- placeholder="200"- type="number"- min={0}- leftAdornment="$"- value={amount}- onChange={setAmount}- autoFocusOnMount- fullWidth- />-- <Select- dropdownId={`${modalInstanceId}-type`}- label={t`Type`}- value={type}- options={GRANTABLE_CREDIT_GRANT_TYPES.map((grantType) => ({- value: grantType,- label: t(CREDIT_GRANT_TYPE_LABELS[grantType]),- }))}- onChange={setType}- isDropdownInModal- fullWidth- />-- <Select- dropdownId={`${modalInstanceId}-expires-in-days`}- label={t`Expires`}- value={expiresInDays}- options={CREDIT_GRANT_EXPIRY_OPTIONS.map((option) => ({- value: option.value,- label: t(option.label),- }))}- onChange={setExpiresInDays}- isDropdownInModal- fullWidth- />-- <SettingsTextInput- instanceId={`${modalInstanceId}-reason`}- label={t`Reason`}- placeholder={t`Goodwill gesture after the March incident`}- value={reason}- onChange={setReason}- maxLength={500}- fullWidth- />- </StyledFields>-- <StyledModalActions>- <StyledActionSlot>- <Button- onClick={handleClose}- fullWidth- variant="outline"- >{t`Cancel`}</Button>- </StyledActionSlot>- <StyledActionSlot>- <Button- onClick={handleSubmit}- fullWidth- disabled={!isAmountValid || loading}- variant="solid"- color="accent"- >{t`Grant`}</Button>- </StyledActionSlot>- </StyledModalActions>- </ModalStatefulWrapper>+ {({ container, backdrop, viewportProps, onKeyDown }) => (+ <Dialog.Popup+ {...{ container, backdrop, viewportProps, onKeyDown }}+ size="md"+ data-globally-prevent-click-outside+ style={{+ padding: 'var(--t-spacing-6)',+ borderRadius: 'var(--t-spacing-1)',+ width: '360px',+ }}+ >+ <Dialog.Title>{t`Grant credits`}</Dialog.Title>+ <StyledSectionContainer>+ <Section.Root align="center" color="primary">+ {t`Credits are added on top of the plan allowance and are spent only once it runs out. They carry over in full from one billing period to the next, and stay available until they are used up or, where an expiry is set, until the end of the billing period that expiry falls in.`}+ </Section.Root>+ </StyledSectionContainer>++ <StyledFields>+ <SettingsTextInput+ instanceId={`${modalInstanceId}-amount`}+ label={t`Amount`}+ placeholder="200"+ type="number"+ min={0}+ leftAdornment="$"+ value={amount}+ onChange={setAmount}+ autoFocusOnMount+ fullWidth+ />++ <Select+ dropdownId={`${modalInstanceId}-type`}+ label={t`Type`}+ value={type}+ options={GRANTABLE_CREDIT_GRANT_TYPES.map((grantType) => ({+ value: grantType,+ label: t(CREDIT_GRANT_TYPE_LABELS[grantType]),+ }))}+ onChange={setType}+ isDropdownInModal+ fullWidth+ />++ <Select+ dropdownId={`${modalInstanceId}-expires-in-days`}+ label={t`Expires`}+ value={expiresInDays}+ options={CREDIT_GRANT_EXPIRY_OPTIONS.map((option) => ({+ value: option.value,+ label: t(option.label),+ }))}+ onChange={setExpiresInDays}+ isDropdownInModal+ fullWidth+ />++ <SettingsTextInput+ instanceId={`${modalInstanceId}-reason`}+ label={t`Reason`}+ placeholder={t`Goodwill gesture after the March incident`}+ value={reason}+ onChange={setReason}+ maxLength={500}+ fullWidth+ />+ </StyledFields>++ <StyledModalActions>+ <StyledActionSlot>+ <Button+ onClick={handleClose}+ fullWidth+ variant="outline"+ >{t`Cancel`}</Button>+ </StyledActionSlot>+ <StyledActionSlot>+ <Button+ onClick={handleSubmit}+ fullWidth+ disabled={!isAmountValid || loading}+ variant="solid"+ color="accent"+ >{t`Grant`}</Button>+ </StyledActionSlot>+ </StyledModalActions>+ </Dialog.Popup>+ )}+ </DialogInstance>);};diff --git a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceCreditGrantsTable.tsx b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceCreditGrantsTable.tsxindex 5dc1a6bec0b..a86484be7a1 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceCreditGrantsTable.tsx+++ b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceCreditGrantsTable.tsx@@ -21,8 +21,8 @@ import {type CollapsedCreditGrant,} from '@/settings/admin-panel/utils/collapseCreditGrantChains';import { SettingsTableListSection } from '@/settings/components/SettingsTableListSection';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useToast } from 'twenty-ui/primitives/feedback';import { type WorkspaceBillingAdminPanelQuery } from '~/generated-admin/graphql';import { beautifyExactDate } from '~/utils/date-utils';@@ -70,7 +70,7 @@ export const SettingsAdminWorkspaceCreditGrantsTable = ({const { formatNumber } = useNumberFormat();const { enqueueToast } = useToast();const apolloAdminClient = useApolloAdminClient();- const { openModal } = useModal();+ const { openDialog } = useDialog();const [grantPendingRevocation, setGrantPendingRevocation] =useState<CreditGrant | null>(null);@@ -91,7 +91,7 @@ export const SettingsAdminWorkspaceCreditGrantsTable = ({const handleRevokeClick = (creditGrant: CreditGrant) => {setGrantPendingRevocation(creditGrant);- openModal(REVOKE_CREDIT_GRANT_MODAL_ID);+ openDialog(REVOKE_CREDIT_GRANT_MODAL_ID);};const handleRevoke = async (creditGrantId: string) => {@@ -181,8 +181,8 @@ export const SettingsAdminWorkspaceCreditGrantsTable = ({onFooterButtonClick={onGrantCreditsClick}/>- <ConfirmationModal- modalInstanceId={REVOKE_CREDIT_GRANT_MODAL_ID}+ <ConfirmationDialog+ dialogId={REVOKE_CREDIT_GRANT_MODAL_ID}title={t`Revoke credit grant`}subtitle={isDefined(grantPendingRevocation)diff --git a/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminDeleteJobsConfirmationModal.tsx b/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminDeleteJobsConfirmationModal.tsxindex f67dbb2a3f8..1aaaf952334 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminDeleteJobsConfirmationModal.tsx+++ b/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminDeleteJobsConfirmationModal.tsx@@ -1,4 +1,4 @@-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';import { plural, t } from '@lingui/core/macro';type SettingsAdminDeleteJobsConfirmationModalProps = {@@ -25,8 +25,8 @@ export const SettingsAdminDeleteJobsConfirmationModal = ({});return (- <ConfirmationModal- modalInstanceId={modalInstanceId}+ <ConfirmationDialog+ dialogId={modalInstanceId}title={title}subtitle={subtitle}onConfirmClick={onConfirm}diff --git a/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminQueueJobsTable.tsx b/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminQueueJobsTable.tsxindex 2cab31e4280..7a39b69c6a7 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminQueueJobsTable.tsx+++ b/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminQueueJobsTable.tsx@@ -8,7 +8,7 @@ import { useApolloAdminClient } from '@/settings/admin-panel/apollo/hooks/useApoimport { useDeleteJobs } from '@/settings/admin-panel/health-status/hooks/useDeleteJobs';import { useRetryJobs } from '@/settings/admin-panel/health-status/hooks/useRetryJobs';import { Select } from '@/ui/input/components/Select';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { Table } from '@/ui/layout/table/components/Table';import { TableBody } from '@/ui/layout/table/components/TableBody';import { TableCell } from '@/ui/layout/table/components/TableCell';@@ -82,7 +82,7 @@ export const SettingsAdminQueueJobsTable = ({const [stateFilter, setStateFilter] = useState<JobState>(JobState.COMPLETED);const [expandedJobId, setExpandedJobId] = useState<string | null>(null);const [selectedJobIds, setSelectedJobIds] = useState<Set<string>>(new Set());- const { openModal } = useModal();+ const { openDialog } = useDialog();const jobStateOptions: { value: JobState; label: string }[] = [{ value: JobState.COMPLETED, label: t`Completed` },@@ -170,7 +170,7 @@ export const SettingsAdminQueueJobsTable = ({};const handleRetrySelected = () => {- openModal(RETRY_MODAL_ID);+ openDialog(RETRY_MODAL_ID);};const confirmRetrySelected = async () => {@@ -180,7 +180,7 @@ export const SettingsAdminQueueJobsTable = ({};const handleDeleteSelected = () => {- openModal(DELETE_MODAL_ID);+ openDialog(DELETE_MODAL_ID);};const confirmDeleteSelected = async () => {diff --git a/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminRetryJobsConfirmationModal.tsx b/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminRetryJobsConfirmationModal.tsxindex 277626ae2d7..0fe26d93a52 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminRetryJobsConfirmationModal.tsx+++ b/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminRetryJobsConfirmationModal.tsx@@ -1,4 +1,4 @@-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';import { plural, t } from '@lingui/core/macro';type SettingsAdminRetryJobsConfirmationModalProps = {@@ -25,8 +25,8 @@ export const SettingsAdminRetryJobsConfirmationModal = ({});return (- <ConfirmationModal- modalInstanceId={modalInstanceId}+ <ConfirmationDialog+ dialogId={modalInstanceId}title={title}subtitle={subtitle}onConfirmClick={onConfirm}diff --git a/packages/twenty-front/src/modules/settings/admin-panel/signing-keys/components/SettingsAdminRevokeSigningKeyConfirmationModal.tsx b/packages/twenty-front/src/modules/settings/admin-panel/signing-keys/components/SettingsAdminRevokeSigningKeyConfirmationModal.tsxindex 791baef9d83..85187093902 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/signing-keys/components/SettingsAdminRevokeSigningKeyConfirmationModal.tsx+++ b/packages/twenty-front/src/modules/settings/admin-panel/signing-keys/components/SettingsAdminRevokeSigningKeyConfirmationModal.tsx@@ -1,4 +1,4 @@-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';import { t } from '@lingui/core/macro';type SettingsAdminRevokeSigningKeyConfirmationModalProps = {@@ -19,8 +19,8 @@ export const SettingsAdminRevokeSigningKeyConfirmationModal = ({: t`Revoking this key will invalidate every JWT signed with it. Users with active tokens signed by this key will be logged out.`;return (- <ConfirmationModal- modalInstanceId={modalInstanceId}+ <ConfirmationDialog+ dialogId={modalInstanceId}title={t`Revoke signing key`}subtitle={subtitle}onConfirmClick={onConfirm}diff --git a/packages/twenty-front/src/modules/settings/admin-panel/signing-keys/components/SettingsAdminSigningKeysTable.tsx b/packages/twenty-front/src/modules/settings/admin-panel/signing-keys/components/SettingsAdminSigningKeysTable.tsxindex e570ae9fb94..d6476a02ad2 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/signing-keys/components/SettingsAdminSigningKeysTable.tsx+++ b/packages/twenty-front/src/modules/settings/admin-panel/signing-keys/components/SettingsAdminSigningKeysTable.tsx@@ -2,7 +2,7 @@ import { useApolloAdminClient } from '@/settings/admin-panel/apollo/hooks/useApoimport { SettingsAdminRevokeSigningKeyConfirmationModal } from '@/settings/admin-panel/signing-keys/components/SettingsAdminRevokeSigningKeyConfirmationModal';import { useRevokeSigningKey } from '@/settings/admin-panel/signing-keys/hooks/useRevokeSigningKey';import { SettingsSectionSkeletonLoader } from '@/settings/components/SettingsSectionSkeletonLoader';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { Table } from '@/ui/layout/table/components/Table';import { TableBody } from '@/ui/layout/table/components/TableBody';import { TableCell } from '@/ui/layout/table/components/TableCell';@@ -54,7 +54,7 @@ const getStatusTag = (export const SettingsAdminSigningKeysTable = () => {const apolloAdminClient = useApolloAdminClient();- const { openModal } = useModal();+ const { openDialog } = useDialog();const { copyToClipboard } = useCopyToClipboard();const [selectedSigningKey, setSelectedSigningKey] =useState<SelectedSigningKey | null>(null);@@ -70,7 +70,7 @@ export const SettingsAdminSigningKeysTable = () => {const handleRevokeClick = (signingKey: SelectedSigningKey) => {setSelectedSigningKey(signingKey);- openModal(REVOKE_MODAL_ID);+ openDialog(REVOKE_MODAL_ID);};const handleConfirmRevoke = async () => {diff --git a/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationScreenshotGallery.tsx b/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationScreenshotGallery.tsxindex 75507e9efea..779fad04693 100644--- a/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationScreenshotGallery.tsx+++ b/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationScreenshotGallery.tsx@@ -1,5 +1,5 @@import { SettingsApplicationScreenshotLightbox } from '@/settings/applications/components/SettingsApplicationScreenshotLightbox';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { styled } from '@linaria/react';import { t } from '@lingui/core/macro';import { useId, useState } from 'react';@@ -76,7 +76,7 @@ export const SettingsApplicationScreenshotGallery = ({displayName,}: SettingsApplicationScreenshotGalleryProps) => {const [selectedScreenshotIndex, setSelectedScreenshotIndex] = useState(0);- const { openModal, closeModal } = useModal();+ const { openDialog, closeDialog } = useDialog();const lightboxModalId = useId();if (screenshots.length === 0) {@@ -90,7 +90,7 @@ export const SettingsApplicationScreenshotGallery = ({<StyledHeroButtontype="button"aria-label={t`View screenshot in full screen`}- onClick={() => openModal(lightboxModalId)}+ onClick={() => openDialog(lightboxModalId)}><StyledHeroImagesrc={screenshots[safeIndex]}@@ -120,7 +120,7 @@ export const SettingsApplicationScreenshotGallery = ({displayName={displayName}selectedIndex={safeIndex}onSelectedIndexChange={setSelectedScreenshotIndex}- onClose={() => closeModal(lightboxModalId)}+ onClose={() => closeDialog(lightboxModalId)}/></StyledGalleryContainer>);diff --git a/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationScreenshotLightbox.tsx b/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationScreenshotLightbox.tsxindex 355a6bfd870..98f6a9ae88a 100644--- a/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationScreenshotLightbox.tsx+++ b/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationScreenshotLightbox.tsx@@ -1,4 +1,5 @@-import { ModalStatefulWrapper } from '@/ui/layout/modal/components/ModalStatefulWrapper';+import { Dialog } from 'twenty-ui/primitives/surfaces';+import { DialogInstance } from '@/ui/layout/dialog/components/DialogInstance';import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';import { styled } from '@linaria/react';import { t } from '@lingui/core/macro';@@ -98,51 +99,57 @@ export const SettingsApplicationScreenshotLightbox = ({});return (- <ModalStatefulWrapper- modalInstanceId={modalInstanceId}- size="fullscreen"- padding="none"- overlay="transparent"- isClosable+ <DialogInstance+ dialogId={modalInstanceId}+ dismissibleonClose={onClose}renderInDocumentBody>- <StyledContainer>- <StyledCloseButton>- <FloatingIconButton- Icon={IconX}- ariaLabel={t`Close`}- onClick={onClose}- />- </StyledCloseButton>- {hasSeveralScreenshots && (- <StyledPreviousButton>- <FloatingIconButton- Icon={IconChevronLeft}- ariaLabel={t`Previous screenshot`}- onClick={showPrevious}- />- </StyledPreviousButton>- )}- <StyledImage- src={screenshots[selectedIndex]}- alt={`${displayName} screenshot ${selectedIndex + 1}`}- />- {hasSeveralScreenshots && (- <>- <StyledNextButton>+ {({ container, backdrop, viewportProps, onKeyDown }) => (+ <Dialog.Popup+ aria-label={displayName}+ {...{ container, backdrop, viewportProps, onKeyDown }}+ size="fullscreen"+ style={{ padding: 0, background: 'transparent', boxShadow: 'none' }}+ >+ <StyledContainer>+ <StyledCloseButton><FloatingIconButton- Icon={IconChevronRight}- ariaLabel={t`Next screenshot`}- onClick={showNext}+ Icon={IconX}+ ariaLabel={t`Close`}+ onClick={onClose}/>- </StyledNextButton>- <StyledCounter>- {selectedIndex + 1} / {screenshotCount}- </StyledCounter>- </>- )}- </StyledContainer>- </ModalStatefulWrapper>+ </StyledCloseButton>+ {hasSeveralScreenshots && (+ <StyledPreviousButton>+ <FloatingIconButton+ Icon={IconChevronLeft}+ ariaLabel={t`Previous screenshot`}+ onClick={showPrevious}+ />+ </StyledPreviousButton>+ )}+ <StyledImage+ src={screenshots[selectedIndex]}+ alt={`${displayName} screenshot ${selectedIndex + 1}`}+ />+ {hasSeveralScreenshots && (+ <>+ <StyledNextButton>+ <FloatingIconButton+ Icon={IconChevronRight}+ ariaLabel={t`Next screenshot`}+ onClick={showNext}+ />+ </StyledNextButton>+ <StyledCounter>+ {selectedIndex + 1} / {screenshotCount}+ </StyledCounter>+ </>+ )}+ </StyledContainer>+ </Dialog.Popup>+ )}+ </DialogInstance>);};diff --git a/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationUninstallButton.tsx b/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationUninstallButton.tsxindex 81229397201..aebee505f39 100644--- a/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationUninstallButton.tsx+++ b/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationUninstallButton.tsx@@ -1,5 +1,5 @@-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { t } from '@lingui/core/macro';import { Trans } from '@lingui/react/macro';import { useId } from 'react';@@ -15,8 +15,8 @@ export const SettingsApplicationUninstallButton = ({onUninstall,isUninstalling,}: SettingsApplicationUninstallButtonProps) => {- const { openModal } = useModal();- const uninstallModalId = useId();+ const { openDialog } = useDialog();+ const uninstallDialogId = useId();const confirmationValue = t`yes`;@@ -27,15 +27,15 @@ export const SettingsApplicationUninstallButton = ({variant="outline"color="danger"size="sm"- onClick={() => openModal(uninstallModalId)}+ onClick={() => openDialog(uninstallDialogId)}disabled={isUninstalling}>{isUninstalling ? t`Uninstalling...` : t`Uninstall`}</Button>- <ConfirmationModal+ <ConfirmationDialogconfirmationPlaceholder={confirmationValue}confirmationValue={confirmationValue}- modalInstanceId={uninstallModalId}+ dialogId={uninstallDialogId}title={t`Uninstall Application?`}subtitle={<Trans>diff --git a/packages/twenty-front/src/modules/settings/billing/components/AddCreditCardModal.tsx b/packages/twenty-front/src/modules/settings/billing/components/AddCreditCardModal.tsxindex 9b0d6f6899f..501094fcf01 100644--- a/packages/twenty-front/src/modules/settings/billing/components/AddCreditCardModal.tsx+++ b/packages/twenty-front/src/modules/settings/billing/components/AddCreditCardModal.tsx@@ -1,6 +1,6 @@+import { DialogInstance } from '@/ui/layout/dialog/components/DialogInstance';import { AddPaymentMethodForm } from '@/settings/billing/components/AddPaymentMethodForm';-import { ModalStatefulWrapper } from '@/ui/layout/modal/components/ModalStatefulWrapper';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';import { Section } from 'twenty-ui/components';@@ -28,43 +28,49 @@ export const AddCreditCardModal = ({onPaymentMethodAdded,}: AddCreditCardModalProps) => {const { t } = useLingui();- const { closeModal } = useModal();+ const { closeDialog } = useDialog();// Close only after activation so the form keeps its loading state visibleconst handlePaymentMethodAdded = async () => {await onPaymentMethodAdded();- closeModal(modalInstanceId);+ closeDialog(modalInstanceId);};return (- <ModalStatefulWrapper- modalInstanceId={modalInstanceId}- isClosable={true}- size="medium"- padding="large"- overlay="dark"- dataGloballyPreventClickOutside+ <DialogInstance+ dialogId={modalInstanceId}+ dismissible={true}renderInDocumentBody- smallBorderRadius- autoHeight>- <Dialog.Title>{t`Add your credit card`}</Dialog.Title>- <StyledSectionContainer>- <Section.Root align="center" color="primary">- {t`Add your credit card below. Once added, your subscription will start automatically.`}- </Section.Root>- </StyledSectionContainer>- <AddPaymentMethodForm- finalRedirectPath={finalRedirectPath}- onPaymentMethodAdded={handlePaymentMethodAdded}- />- <StyledCancelButtonContainer>- <Button- onClick={() => closeModal(modalInstanceId)}- fullWidth- variant="outline"- >{t`Cancel`}</Button>- </StyledCancelButtonContainer>- </ModalStatefulWrapper>+ {({ container, backdrop, viewportProps, onKeyDown }) => (+ <Dialog.Popup+ {...{ container, backdrop, viewportProps, onKeyDown }}+ size="md"+ data-globally-prevent-click-outside+ style={{+ padding: 'var(--t-spacing-6)',+ borderRadius: 'var(--t-spacing-1)',+ }}+ >+ <Dialog.Title>{t`Add your credit card`}</Dialog.Title>+ <StyledSectionContainer>+ <Section.Root align="center" color="primary">+ {t`Add your credit card below. Once added, your subscription will start automatically.`}+ </Section.Root>+ </StyledSectionContainer>+ <AddPaymentMethodForm+ finalRedirectPath={finalRedirectPath}+ onPaymentMethodAdded={handlePaymentMethodAdded}+ />+ <StyledCancelButtonContainer>+ <Button+ onClick={() => closeDialog(modalInstanceId)}+ fullWidth+ variant="outline"+ >{t`Cancel`}</Button>+ </StyledCancelButtonContainer>+ </Dialog.Popup>+ )}+ </DialogInstance>);};diff --git a/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingCreditsSection.tsx b/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingCreditsSection.tsxindex 557ef4396d9..95bafd41706 100644--- a/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingCreditsSection.tsx+++ b/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingCreditsSection.tsx@@ -15,7 +15,7 @@ import { useGetResourceCreditUsage } from '@/settings/billing/hooks/useGetResourimport { useSplitPhaseItemsInPrices } from '@/settings/billing/hooks/useSplitPhaseItemsInPrices';import { usePermissionFlagMap } from '@/settings/roles/hooks/usePermissionFlagMap';import { getDocumentationUrl } from '@/support/utils/getDocumentationUrl';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { isSubscriptionPaymentOverdue } from '@/settings/billing/utils/isSubscriptionPaymentOverdue';import { useSubscriptionStatus } from '@/workspace/hooks/useSubscriptionStatus';import { styled } from '@linaria/react';@@ -134,7 +134,7 @@ export const SettingsBillingCreditsSection = ({}) => {const theme = useTheme();const subscriptionStatus = useSubscriptionStatus();- const { openModal } = useModal();+ const { openDialog } = useDialog();const { formatNumber } = useNumberFormat();const { isMonthlyPlan } = useCurrentBillingFlags();@@ -251,7 +251,7 @@ export const SettingsBillingCreditsSection = ({isUpdatePaymentDisabled={isUpdatePaymentDisabled}canCancelCreditPackSwitch={canCancelCreditPackSwitch}onCancelCreditPackSwitch={() =>- openModal(BILLING_MODAL_IDS.cancelSwitchMeteredPrice)+ openDialog(BILLING_MODAL_IDS.cancelSwitchMeteredPrice)}/></StyledSettingsBillingCardHeader>diff --git a/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingLimitEditForm.tsx b/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingLimitEditForm.tsxindex 2e6d407ace9..297b4232e51 100644--- a/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingLimitEditForm.tsx+++ b/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingLimitEditForm.tsx@@ -20,8 +20,8 @@ import { buildUsageLimitFormValues } from '@/settings/billing/utils/buildUsageLiimport { SaveAndCancelButtons } from '@/settings/components/SaveAndCancelButtons/SaveAndCancelButtons';import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useNavigateSettings } from '~/hooks/useNavigateSettings';const DELETE_MODAL_ID = 'usage-limit-edit-delete';@@ -42,7 +42,7 @@ export const SettingsBillingLimitEditForm = ({useUsageQuotaDefinitions();const { updateUsageLimit, loading: isSaving } = useUpdateUsageLimit();const { deleteUsageLimit, loading: isDeleting } = useDeleteUsageLimit();- const { openModal, closeModal } = useModal();+ const { openDialog, closeDialog } = useDialog();const [values, setValues] = useState<UsageLimitFormValues>(buildUsageLimitFormValues(quota),@@ -62,7 +62,7 @@ export const SettingsBillingLimitEditForm = ({children: t`Failed to delete the limit.`,});} finally {- closeModal(DELETE_MODAL_ID);+ closeDialog(DELETE_MODAL_ID);}};@@ -136,12 +136,12 @@ export const SettingsBillingLimitEditForm = ({startIcon={<IconTrash />}size="sm"disabled={isDeleting}- onClick={() => openModal(DELETE_MODAL_ID)}+ onClick={() => openDialog(DELETE_MODAL_ID)}variant="outline"color="danger">{t`Delete limit`}</Button>- <ConfirmationModal- modalInstanceId={DELETE_MODAL_ID}+ <ConfirmationDialog+ dialogId={DELETE_MODAL_ID}title={t`Delete this limit?`}subtitle={t`Spending will only be capped by your plan allowance and the other limits.`}confirmButtonText={t`Delete`}diff --git a/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingSubscriptionInfo.tsx b/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingSubscriptionInfo.tsxindex 1b5bc93270b..a63d44185ee 100644--- a/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingSubscriptionInfo.tsx+++ b/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingSubscriptionInfo.tsx@@ -22,7 +22,7 @@ import { useSplitPhaseItemsInPrices } from '@/settings/billing/hooks/useSplitPhaimport { billingHasPaymentMethodSelector } from '@/settings/billing/states/billingHasPaymentMethodSelector';import { isSubscriptionPaymentOverdue } from '@/settings/billing/utils/isSubscriptionPaymentOverdue';import { usePermissionFlagMap } from '@/settings/roles/hooks/usePermissionFlagMap';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useSubscriptionStatus } from '@/workspace/hooks/useSubscriptionStatus';import { CombinedGraphQLErrors } from '@apollo/client/errors';@@ -63,7 +63,7 @@ export const SettingsBillingSubscriptionInfo = ({const { t } = useLingui();const { formatNumber } = useNumberFormat();- const { openModal } = useModal();+ const { openDialog } = useDialog();const { enqueueToast } = useToast();@@ -414,12 +414,14 @@ export const SettingsBillingSubscriptionInfo = ({isManageBillingDisabled={isManageBillingDisabled}isUpdatePaymentDisabled={isUpdatePaymentDisabled}onCancelIntervalSwitch={() =>- openModal(BILLING_MODAL_IDS.cancelSwitchBillingInterval)+ openDialog(BILLING_MODAL_IDS.cancelSwitchBillingInterval)}onCancelPlanSwitch={() =>- openModal(BILLING_MODAL_IDS.cancelSwitchBillingPlan)+ openDialog(BILLING_MODAL_IDS.cancelSwitchBillingPlan)+ }+ onEndTrialPeriod={() =>+ openDialog(BILLING_MODAL_IDS.endTrialPeriod)}- onEndTrialPeriod={() => openModal(BILLING_MODAL_IDS.endTrialPeriod)}onManageBilling={onManageBilling}onUpdatePayment={onUpdatePayment}shouldUpdatePayment={shouldUpdatePayment}@@ -427,10 +429,10 @@ export const SettingsBillingSubscriptionInfo = ({}isSubscriptionActionDisabled={isSubscriptionActionDisabled}onSwitchToMonthly={() =>- openModal(BILLING_MODAL_IDS.switchBillingIntervalToMonthly)+ openDialog(BILLING_MODAL_IDS.switchBillingIntervalToMonthly)}onSwitchToYearly={() =>- openModal(BILLING_MODAL_IDS.switchBillingIntervalToYearly)+ openDialog(BILLING_MODAL_IDS.switchBillingIntervalToYearly)}planLabel={planLabel}scheduledChangeItems={scheduledChangeItems}diff --git a/packages/twenty-front/src/modules/settings/billing/components/StartSubscriptionConfirmationModal.tsx b/packages/twenty-front/src/modules/settings/billing/components/StartSubscriptionConfirmationModal.tsxindex 73ed2293496..9a025f5e4f5 100644--- a/packages/twenty-front/src/modules/settings/billing/components/StartSubscriptionConfirmationModal.tsx+++ b/packages/twenty-front/src/modules/settings/billing/components/StartSubscriptionConfirmationModal.tsx@@ -1,4 +1,4 @@-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';import { t } from '@lingui/core/macro';type StartSubscriptionConfirmationModalProps = {@@ -17,8 +17,8 @@ export const StartSubscriptionConfirmationModal = ({const needsCreditCard = hasPaymentMethod === false;return (- <ConfirmationModal- modalInstanceId={modalInstanceId}+ <ConfirmationDialog+ dialogId={modalInstanceId}title={needsCreditCard ? t`Add your credit card` : t`Start Your Subscription`}diff --git a/packages/twenty-front/src/modules/settings/billing/components/UpdatePaymentMethodModal.tsx b/packages/twenty-front/src/modules/settings/billing/components/UpdatePaymentMethodModal.tsxindex 62d32d78fc8..a145312475e 100644--- a/packages/twenty-front/src/modules/settings/billing/components/UpdatePaymentMethodModal.tsx+++ b/packages/twenty-front/src/modules/settings/billing/components/UpdatePaymentMethodModal.tsx@@ -1,9 +1,9 @@+import { DialogInstance } from '@/ui/layout/dialog/components/DialogInstance';import { AddPaymentMethodForm } from '@/settings/billing/components/AddPaymentMethodForm';import { useMarkBillingPaymentMethodAsAdded } from '@/settings/billing/hooks/useMarkBillingPaymentMethodAsAdded';import { useWaitForPaymentRecovery } from '@/settings/billing/hooks/useWaitForPaymentRecovery';import { isSubscriptionPaymentOverdue } from '@/settings/billing/utils/isSubscriptionPaymentOverdue';-import { ModalStatefulWrapper } from '@/ui/layout/modal/components/ModalStatefulWrapper';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useSubscriptionStatus } from '@/workspace/hooks/useSubscriptionStatus';import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';@@ -29,7 +29,7 @@ export const UpdatePaymentMethodModal = ({modalInstanceId,}: UpdatePaymentMethodModalProps) => {const { t } = useLingui();- const { closeModal } = useModal();+ const { closeDialog } = useDialog();const { enqueueToast } = useToast();const subscriptionStatus = useSubscriptionStatus();const { markBillingPaymentMethodAsAdded } =@@ -37,7 +37,7 @@ export const UpdatePaymentMethodModal = ({const { waitForPaymentRecovery } = useWaitForPaymentRecovery();const handlePaymentMethodAdded = async () => {- closeModal(modalInstanceId);+ closeDialog(modalInstanceId);markBillingPaymentMethodAsAdded();if (!isSubscriptionPaymentOverdue(subscriptionStatus)) {@@ -55,34 +55,36 @@ export const UpdatePaymentMethodModal = ({};return (- <ModalStatefulWrapper- modalInstanceId={modalInstanceId}- isClosable- size="medium"- padding="large"- overlay="dark"- dataGloballyPreventClickOutside- renderInDocumentBody- smallBorderRadius- autoHeight- >- <Dialog.Title>{t`Update your payment method`}</Dialog.Title>- <StyledSectionContainer>- <Section.Root align="center" color="primary">- {t`Add a card below to update your billing details and retry your payment.`}- </Section.Root>- </StyledSectionContainer>- <AddPaymentMethodForm- onPaymentMethodAdded={handlePaymentMethodAdded}- shouldStartSubscriptionAfterPaymentMethod={false}- />- <StyledCancelButtonContainer>- <Button- onClick={() => closeModal(modalInstanceId)}- fullWidth- variant="outline"- >{t`Cancel`}</Button>- </StyledCancelButtonContainer>- </ModalStatefulWrapper>+ <DialogInstance dialogId={modalInstanceId} dismissible renderInDocumentBody>+ {({ container, backdrop, viewportProps, onKeyDown }) => (+ <Dialog.Popup+ {...{ container, backdrop, viewportProps, onKeyDown }}+ size="md"+ data-globally-prevent-click-outside+ style={{+ padding: 'var(--t-spacing-6)',+ borderRadius: 'var(--t-spacing-1)',+ }}+ >+ <Dialog.Title>{t`Update your payment method`}</Dialog.Title>+ <StyledSectionContainer>+ <Section.Root align="center" color="primary">+ {t`Add a card below to update your billing details and retry your payment.`}+ </Section.Root>+ </StyledSectionContainer>+ <AddPaymentMethodForm+ onPaymentMethodAdded={handlePaymentMethodAdded}+ shouldStartSubscriptionAfterPaymentMethod={false}+ />+ <StyledCancelButtonContainer>+ <Button+ onClick={() => closeDialog(modalInstanceId)}+ fullWidth+ variant="outline"+ >{t`Cancel`}</Button>+ </StyledCancelButtonContainer>+ </Dialog.Popup>+ )}+ </DialogInstance>);};diff --git a/packages/twenty-front/src/modules/settings/billing/components/internal/ResourceCreditPackagePickerModal.tsx b/packages/twenty-front/src/modules/settings/billing/components/internal/ResourceCreditPackagePickerModal.tsxindex 7675e891397..dfa5df6f358 100644--- a/packages/twenty-front/src/modules/settings/billing/components/internal/ResourceCreditPackagePickerModal.tsx+++ b/packages/twenty-front/src/modules/settings/billing/components/internal/ResourceCreditPackagePickerModal.tsx@@ -1,6 +1,6 @@+import { DialogInstance } from '@/ui/layout/dialog/components/DialogInstance';import { AnimatedFormattedNumber } from '@/settings/billing/components/internal/AnimatedFormattedNumber';import { BILLING_MODAL_IDS } from '@/settings/billing/constants/BillingModalIds';-import { ModalStatefulWrapper } from '@/ui/layout/modal/components/ModalStatefulWrapper';import { styled } from '@linaria/react';import { t } from '@lingui/core/macro';import { AnimatePresence, motion } from 'framer-motion';@@ -252,174 +252,180 @@ export const ResourceCreditPackagePickerModal = ({);return (- <ModalStatefulWrapper- modalInstanceId={BILLING_MODAL_IDS.creditPackagePicker}- isClosable={true}- size="medium"- padding="large"- overlay="dark"- width="360px"- dataGloballyPreventClickOutside+ <DialogInstance+ dialogId={BILLING_MODAL_IDS.creditPackagePicker}+ dismissible={true}renderInDocumentBody- smallBorderRadius- autoHeight>- <StyledCenteredTitle>- <Dialog.Title>{t`Choose ${intervalAdjective} credits`}</Dialog.Title>- </StyledCenteredTitle>- <StyledSectionContainer>- <Section.Root align="center" color="primary">- {t`Select the credit package to add to your ${intervalAdjective} bill.`}- </Section.Root>- </StyledSectionContainer>- <StyledPackageCard>- <StyledPackageHeader>- <StyledPackageHeaderRow>- <StyledPackageHeaderTitle>- <IconCoins- size={theme.icon.size.md}- color={themeCssVariables.color.green9}- />- <StyledPackageCreditAmount>- <AnimatedFormattedNumber- value={selectedCreditAmountValue}- formatValue={formatAnimatedCreditAmount}- />{' '}- {t`credits`}- </StyledPackageCreditAmount>- </StyledPackageHeaderTitle>- <StyledPackagePrice>- $- <AnimatedFormattedNumber- value={selectedPriceAmountValue}- formatValue={formatAnimatedPriceAmount}- />- /{intervalLabel}- </StyledPackagePrice>- </StyledPackageHeaderRow>- <Slider.Root- min={0}- max={Math.max(1, priceCount - 1)}- step={1}- value={selectedPriceIndex}- onValueChange={onSliderValueChange}- disabled={isUpdating || priceCount < 2}- color="success"- >- <Slider.Control>- <Slider.Track>- <Slider.Indicator />- <Slider.Thumb aria-label={t`Credit package`} />- </Slider.Track>- </Slider.Control>- </Slider.Root>- </StyledPackageHeader>- <StyledPackageDetails>- <StyledPackageDivider />- <StyledPackageSummaryRows>- {renderPackageSummaryRow({- Icon: IconHistory,- label: t`Current`,- value: (- <>- <StyledCurrentValueText- data-strikethrough={isChanged || undefined}- >- {t`${currentCreditAmountDisplay} credits `}- </StyledCurrentValueText>- <StyledMutedText>- <StyledCurrentValueText- data-strikethrough={isChanged || undefined}- >- {t`($${currentCreditPriceDisplay}/${intervalLabel})`}- </StyledCurrentValueText>- </StyledMutedText>- </>- ),- })}- <AnimatePresence initial={false}>- {isChanged && (- <StyledAnimatedPackageSummaryRow- key="new-credit-package-summary-row"- initial={{- height: 0,- marginBottom: 0,- opacity: 0,- y: -2,- }}- animate={{- height: PACKAGE_SUMMARY_ROW_HEIGHT,- marginBottom: PACKAGE_SUMMARY_ROW_GAP,- opacity: 1,- y: 0,- }}- exit={{- height: 0,- marginBottom: 0,- opacity: 0,- y: -2,- }}- transition={{- duration: theme.animation.duration.fast,- ease: 'easeInOut',- }}- >- <StyledPackageSummaryLabel>- <IconSparkles- size={theme.icon.size.md}- stroke={theme.icon.stroke.sm}- color={themeCssVariables.font.color.tertiary}- />- <PackageSummaryLabelText label={t`New credit pack`} />- </StyledPackageSummaryLabel>- <StyledPackageSummaryValue>- <span>- $- <AnimatedFormattedNumber- value={selectedPriceAmountValue}- formatValue={formatAnimatedPriceAmount}- />- {t` per ${intervalLabel}`}- </span>- </StyledPackageSummaryValue>- </StyledAnimatedPackageSummaryRow>- )}- </AnimatePresence>- {isDefined(newRolloverLimit) &&- renderPackageSummaryRow({- Icon: IconRefreshDot,- label: t`New rollover limit`,- value: (- <StyledAmountWithUnit>+ {({ container, backdrop, viewportProps, onKeyDown }) => (+ <Dialog.Popup+ {...{ container, backdrop, viewportProps, onKeyDown }}+ size="md"+ data-globally-prevent-click-outside+ style={{+ padding: 'var(--t-spacing-6)',+ borderRadius: 'var(--t-spacing-1)',+ width: '360px',+ }}+ >+ <StyledCenteredTitle>+ <Dialog.Title>{t`Choose ${intervalAdjective} credits`}</Dialog.Title>+ </StyledCenteredTitle>+ <StyledSectionContainer>+ <Section.Root align="center" color="primary">+ {t`Select the credit package to add to your ${intervalAdjective} bill.`}+ </Section.Root>+ </StyledSectionContainer>+ <StyledPackageCard>+ <StyledPackageHeader>+ <StyledPackageHeaderRow>+ <StyledPackageHeaderTitle>+ <IconCoins+ size={theme.icon.size.md}+ color={themeCssVariables.color.green9}+ />+ <StyledPackageCreditAmount><AnimatedFormattedNumber- value={newRolloverLimitValue}- formatValue={formatAnimatedRolloverLimit}- />- <span>{t`credits`}</span>- </StyledAmountWithUnit>- ),- })}- </StyledPackageSummaryRows>- </StyledPackageDetails>- </StyledPackageCard>- <StyledModalActions>- <StyledActionSlot>- <Button- onClick={onCancel}- fullWidth- variant="outline"- >{t`Cancel`}</Button>- </StyledActionSlot>- <StyledActionSlot>- <Button- onClick={onConfirm}- fullWidth- disabled={isConfirmDisabled}- variant="solid"- color="accent"- >{t`Confirm`}</Button>- </StyledActionSlot>- </StyledModalActions>- </ModalStatefulWrapper>+ value={selectedCreditAmountValue}+ formatValue={formatAnimatedCreditAmount}+ />{' '}+ {t`credits`}+ </StyledPackageCreditAmount>+ </StyledPackageHeaderTitle>+ <StyledPackagePrice>+ $+ <AnimatedFormattedNumber+ value={selectedPriceAmountValue}+ formatValue={formatAnimatedPriceAmount}+ />+ /{intervalLabel}+ </StyledPackagePrice>+ </StyledPackageHeaderRow>+ <Slider.Root+ min={0}+ max={Math.max(1, priceCount - 1)}+ step={1}+ value={selectedPriceIndex}+ onValueChange={onSliderValueChange}+ disabled={isUpdating || priceCount < 2}+ color="success"+ >+ <Slider.Control>+ <Slider.Track>+ <Slider.Indicator />+ <Slider.Thumb aria-label={t`Credit package`} />+ </Slider.Track>+ </Slider.Control>+ </Slider.Root>+ </StyledPackageHeader>+ <StyledPackageDetails>+ <StyledPackageDivider />+ <StyledPackageSummaryRows>+ {renderPackageSummaryRow({+ Icon: IconHistory,+ label: t`Current`,+ value: (+ <>+ <StyledCurrentValueText+ data-strikethrough={isChanged || undefined}+ >+ {t`${currentCreditAmountDisplay} credits `}+ </StyledCurrentValueText>+ <StyledMutedText>+ <StyledCurrentValueText+ data-strikethrough={isChanged || undefined}+ >+ {t`($${currentCreditPriceDisplay}/${intervalLabel})`}+ </StyledCurrentValueText>+ </StyledMutedText>+ </>+ ),+ })}+ <AnimatePresence initial={false}>+ {isChanged && (+ <StyledAnimatedPackageSummaryRow+ key="new-credit-package-summary-row"+ initial={{+ height: 0,+ marginBottom: 0,+ opacity: 0,+ y: -2,+ }}+ animate={{+ height: PACKAGE_SUMMARY_ROW_HEIGHT,+ marginBottom: PACKAGE_SUMMARY_ROW_GAP,+ opacity: 1,+ y: 0,+ }}+ exit={{+ height: 0,+ marginBottom: 0,+ opacity: 0,+ y: -2,+ }}+ transition={{+ duration: theme.animation.duration.fast,+ ease: 'easeInOut',+ }}+ >+ <StyledPackageSummaryLabel>+ <IconSparkles+ size={theme.icon.size.md}+ stroke={theme.icon.stroke.sm}+ color={themeCssVariables.font.color.tertiary}+ />+ <PackageSummaryLabelText label={t`New credit pack`} />+ </StyledPackageSummaryLabel>+ <StyledPackageSummaryValue>+ <span>+ $+ <AnimatedFormattedNumber+ value={selectedPriceAmountValue}+ formatValue={formatAnimatedPriceAmount}+ />+ {t` per ${intervalLabel}`}+ </span>+ </StyledPackageSummaryValue>+ </StyledAnimatedPackageSummaryRow>+ )}+ </AnimatePresence>+ {isDefined(newRolloverLimit) &&+ renderPackageSummaryRow({+ Icon: IconRefreshDot,+ label: t`New rollover limit`,+ value: (+ <StyledAmountWithUnit>+ <AnimatedFormattedNumber+ value={newRolloverLimitValue}+ formatValue={formatAnimatedRolloverLimit}+ />+ <span>{t`credits`}</span>+ </StyledAmountWithUnit>+ ),+ })}+ </StyledPackageSummaryRows>+ </StyledPackageDetails>+ </StyledPackageCard>+ <StyledModalActions>+ <StyledActionSlot>+ <Button+ onClick={onCancel}+ fullWidth+ variant="outline"+ >{t`Cancel`}</Button>+ </StyledActionSlot>+ <StyledActionSlot>+ <Button+ onClick={onConfirm}+ fullWidth+ disabled={isConfirmDisabled}+ variant="solid"+ color="accent"+ >{t`Confirm`}</Button>+ </StyledActionSlot>+ </StyledModalActions>+ </Dialog.Popup>+ )}+ </DialogInstance>);};diff --git a/packages/twenty-front/src/modules/settings/billing/components/internal/ResourceCreditPriceSelector.tsx b/packages/twenty-front/src/modules/settings/billing/components/internal/ResourceCreditPriceSelector.tsxindex c674372ce5a..1c3d823b78c 100644--- a/packages/twenty-front/src/modules/settings/billing/components/internal/ResourceCreditPriceSelector.tsx+++ b/packages/twenty-front/src/modules/settings/billing/components/internal/ResourceCreditPriceSelector.tsx@@ -6,8 +6,8 @@ import { useApplyCurrentWorkspaceBillingUpdate } from '@/settings/billing/hooks/import { useBillingWording } from '@/settings/billing/hooks/useBillingWording';import { useCurrentResourceCredit } from '@/settings/billing/hooks/useCurrentResourceCredit';import { useGetResourceCreditUsage } from '@/settings/billing/hooks/useGetResourceCreditUsage';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { CombinedGraphQLErrors } from '@apollo/client/errors';import { useMutation } from '@apollo/client/react';import { styled } from '@linaria/react';@@ -245,7 +245,7 @@ export const ResourceCreditPriceSelector = ({const formatAnimatedRolloverLimit = (value: number) =>formatNumber(Math.max(0, Math.round(value)), { decimals: 2 });- const { openModal, closeModal } = useModal();+ const { openDialog, closeDialog } = useDialog();const redirectToRequiredBillingAction = () => {if (shouldRedirectToUpdatePayment) {@@ -269,7 +269,7 @@ export const ResourceCreditPriceSelector = ({}setSelectedPriceId(price.stripePriceId);- openModal(BILLING_MODAL_IDS.confirmResourceCreditPriceChange);+ openDialog(BILLING_MODAL_IDS.confirmResourceCreditPriceChange);};const handleOpenCreditPackagePicker = () => {@@ -278,7 +278,7 @@ export const ResourceCreditPriceSelector = ({}setSelectedPriceId(defaultResourceCreditPriceForPicker?.stripePriceId);- openModal(BILLING_MODAL_IDS.creditPackagePicker);+ openDialog(BILLING_MODAL_IDS.creditPackagePicker);};const handleSliderValueChange = (value: number) => {@@ -294,8 +294,8 @@ export const ResourceCreditPriceSelector = ({return;}- closeModal(BILLING_MODAL_IDS.creditPackagePicker);- openModal(BILLING_MODAL_IDS.confirmResourceCreditPriceChange);+ closeDialog(BILLING_MODAL_IDS.creditPackagePicker);+ openDialog(BILLING_MODAL_IDS.confirmResourceCreditPriceChange);};const handleConfirmClick = async () => {@@ -345,7 +345,7 @@ export const ResourceCreditPriceSelector = ({}if (isTrialing) {- openModal(BILLING_MODAL_IDS.endTrialPeriod);+ openDialog(BILLING_MODAL_IDS.endTrialPeriod);return;}@@ -425,7 +425,7 @@ export const ResourceCreditPriceSelector = ({isUpdating={isUpdating}newRolloverLimit={newRolloverLimit}newRolloverLimitValue={newRolloverLimitValue}- onCancel={() => closeModal(BILLING_MODAL_IDS.creditPackagePicker)}+ onCancel={() => closeDialog(BILLING_MODAL_IDS.creditPackagePicker)}onConfirm={handleConfirmPackagePicker}onSliderValueChange={handleSliderValueChange}priceCount={sortedResourceCreditPrices.length}@@ -433,8 +433,8 @@ export const ResourceCreditPriceSelector = ({selectedPriceAmountValue={selectedPriceAmountValue}selectedPriceIndex={selectedPriceIndex}/>- <ConfirmationModal- modalInstanceId={BILLING_MODAL_IDS.confirmResourceCreditPriceChange}+ <ConfirmationDialog+ dialogId={BILLING_MODAL_IDS.confirmResourceCreditPriceChange}title={isUpgrade() ? t`Confirm upgrade` : t`Confirm downgrade`}subtitle={isDefined(selectedCreditAmountDisplay) &&diff --git a/packages/twenty-front/src/modules/settings/billing/components/internal/SettingsBillingPlansWithSubscription.tsx b/packages/twenty-front/src/modules/settings/billing/components/internal/SettingsBillingPlansWithSubscription.tsxindex 33609783e0c..dcd1b96b5c3 100644--- a/packages/twenty-front/src/modules/settings/billing/components/internal/SettingsBillingPlansWithSubscription.tsx+++ b/packages/twenty-front/src/modules/settings/billing/components/internal/SettingsBillingPlansWithSubscription.tsx@@ -9,8 +9,8 @@ import {type SettingsBillingPlanPrices,} from '@/settings/billing/types/settingsBillingPlanComparison.type';import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useLingui } from '@lingui/react/macro';import { useState } from 'react';import { isDefined } from 'twenty-shared/utils';@@ -32,7 +32,7 @@ export const SettingsBillingPlansWithSubscription = ({planPrices,}: SettingsBillingPlansWithSubscriptionProps) => {const { t } = useLingui();- const { openModal } = useModal();+ const { openDialog } = useDialog();const [pendingChange, setPendingChange] =useState<BillingSubscriptionChange | null>(null);const {@@ -47,7 +47,7 @@ export const SettingsBillingPlansWithSubscription = ({isApplyingBillingSubscriptionChange,onBillingSubscriptionChangeRequested: (change) => {setPendingChange(change);- openModal(BILLING_MODAL_IDS.confirmSubscriptionChange);+ openDialog(BILLING_MODAL_IDS.confirmSubscriptionChange);},});@@ -67,8 +67,8 @@ export const SettingsBillingPlansWithSubscription = ({planPrices={planPrices}/>{isDefined(pendingChange) && isDefined(pendingChangeWording) && (- <ConfirmationModal- modalInstanceId={BILLING_MODAL_IDS.confirmSubscriptionChange}+ <ConfirmationDialog+ dialogId={BILLING_MODAL_IDS.confirmSubscriptionChange}title={pendingChangeWording.title}subtitle={pendingChangeWording.subtitle}onConfirmClick={() => applyBillingSubscriptionChange(pendingChange)}diff --git a/packages/twenty-front/src/modules/settings/billing/components/internal/SettingsBillingSubscriptionInfoModals.tsx b/packages/twenty-front/src/modules/settings/billing/components/internal/SettingsBillingSubscriptionInfoModals.tsxindex 5097911bfc0..9e363a03c4e 100644--- a/packages/twenty-front/src/modules/settings/billing/components/internal/SettingsBillingSubscriptionInfoModals.tsx+++ b/packages/twenty-front/src/modules/settings/billing/components/internal/SettingsBillingSubscriptionInfoModals.tsx@@ -1,7 +1,7 @@import { AddCreditCardModal } from '@/settings/billing/components/AddCreditCardModal';import { BILLING_MODAL_IDS } from '@/settings/billing/constants/BillingModalIds';import { type BillingSubscriptionChangeWording } from '@/settings/billing/types/billingSubscriptionChangeWording.type';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';import { useLingui } from '@lingui/react/macro';type SettingsBillingSubscriptionInfoModalsProps = {@@ -43,8 +43,8 @@ export const SettingsBillingSubscriptionInfoModals = ({return (<>- <ConfirmationModal- modalInstanceId={BILLING_MODAL_IDS.switchBillingIntervalToYearly}+ <ConfirmationDialog+ dialogId={BILLING_MODAL_IDS.switchBillingIntervalToYearly}title={switchToYearlyWording.title}subtitle={switchToYearlyWording.subtitle}onConfirmClick={onSwitchInterval}@@ -52,8 +52,8 @@ export const SettingsBillingSubscriptionInfoModals = ({confirmButtonColor="accent"loading={isApplyingSubscriptionChange}/>- <ConfirmationModal- modalInstanceId={BILLING_MODAL_IDS.switchBillingIntervalToMonthly}+ <ConfirmationDialog+ dialogId={BILLING_MODAL_IDS.switchBillingIntervalToMonthly}title={switchToMonthlyWording.title}subtitle={switchToMonthlyWording.subtitle}onConfirmClick={onSwitchInterval}@@ -61,8 +61,8 @@ export const SettingsBillingSubscriptionInfoModals = ({confirmButtonColor="accent"loading={isApplyingSubscriptionChange}/>- <ConfirmationModal- modalInstanceId={BILLING_MODAL_IDS.cancelSwitchBillingInterval}+ <ConfirmationDialog+ dialogId={BILLING_MODAL_IDS.cancelSwitchBillingInterval}title={cancelIntervalSwitchingWording.title}subtitle={cancelIntervalSwitchingWording.subtitle}onConfirmClick={onCancelIntervalSwitching}@@ -70,8 +70,8 @@ export const SettingsBillingSubscriptionInfoModals = ({confirmButtonColor="accent"loading={isApplyingSubscriptionChange}/>- <ConfirmationModal- modalInstanceId={BILLING_MODAL_IDS.cancelSwitchBillingPlan}+ <ConfirmationDialog+ dialogId={BILLING_MODAL_IDS.cancelSwitchBillingPlan}title={cancelPlanSwitchingWording.title}subtitle={cancelPlanSwitchingWording.subtitle}onConfirmClick={onCancelPlanSwitching}@@ -85,8 +85,8 @@ export const SettingsBillingSubscriptionInfoModals = ({onPaymentMethodAdded={onPaymentMethodAdded}/>) : (- <ConfirmationModal- modalInstanceId={BILLING_MODAL_IDS.endTrialPeriod}+ <ConfirmationDialog+ dialogId={BILLING_MODAL_IDS.endTrialPeriod}title={t`Start Your Subscription`}subtitle={startSubscriptionSubtitle}onConfirmClick={onEndTrialPeriod}@@ -95,8 +95,8 @@ export const SettingsBillingSubscriptionInfoModals = ({loading={isEndTrialPeriodLoading}/>)}- <ConfirmationModal- modalInstanceId={BILLING_MODAL_IDS.cancelSwitchMeteredPrice}+ <ConfirmationDialog+ dialogId={BILLING_MODAL_IDS.cancelSwitchMeteredPrice}title={t`Cancel credit pack switching?`}subtitle={t`You have scheduled a credit pack change. Do you want to cancel it?`}onConfirmClick={onCancelResourceCreditSwitching}diff --git a/packages/twenty-front/src/modules/settings/billing/hooks/usePaymentMethodFlow.ts b/packages/twenty-front/src/modules/settings/billing/hooks/usePaymentMethodFlow.tsindex 79efeb5dbf2..159639b1887 100644--- a/packages/twenty-front/src/modules/settings/billing/hooks/usePaymentMethodFlow.ts+++ b/packages/twenty-front/src/modules/settings/billing/hooks/usePaymentMethodFlow.ts@@ -1,14 +1,14 @@import { useBillingPortalSession } from '@/settings/billing/hooks/useBillingPortalSession';import { billingHasPaymentMethodSelector } from '@/settings/billing/states/billingHasPaymentMethodSelector';import { usePermissionFlagMap } from '@/settings/roles/hooks/usePermissionFlagMap';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { SettingsPath } from 'twenty-shared/types';import { getSettingsPath } from 'twenty-shared/utils';import { PermissionFlagType } from '~/generated-metadata/graphql';export const usePaymentMethodFlow = (modalInstanceId: string) => {- const { openModal } = useModal();+ const { openDialog } = useDialog();const billingHasPaymentMethod = useAtomStateValue(billingHasPaymentMethodSelector,@@ -27,7 +27,7 @@ export const usePaymentMethodFlow = (modalInstanceId: string) => {const openPaymentMethodFlow = () => {if (shouldAddPaymentMethodInProduct) {- openModal(modalInstanceId);+ openDialog(modalInstanceId);return;}diff --git a/packages/twenty-front/src/modules/settings/components/SettingsCustomizeVideoModal.tsx b/packages/twenty-front/src/modules/settings/components/SettingsCustomizeVideoModal.tsxindex 92af4f95b7f..73239112cca 100644--- a/packages/twenty-front/src/modules/settings/components/SettingsCustomizeVideoModal.tsx+++ b/packages/twenty-front/src/modules/settings/components/SettingsCustomizeVideoModal.tsx@@ -1,21 +1,15 @@+import { type SettingsCustomizeVideoModalTab } from '@/settings/types/SettingsCustomizeVideoModalTab';+import { Dialog } from 'twenty-ui/primitives/surfaces';+import { DialogInstance } from '@/ui/layout/dialog/components/DialogInstance';import { t } from '@lingui/core/macro';-import { ModalStatefulWrapper } from '@/ui/layout/modal/components/ModalStatefulWrapper';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { TabList } from '@/ui/layout/tab-list/components/TabList';import { styled } from '@linaria/react';import { useState } from 'react';-import { type IconComponent, IconX } from 'twenty-ui/icon';+import { IconX } from 'twenty-ui/icon';import { IconButton } from 'twenty-ui/components';import { themeCssVariables, useTheme } from 'twenty-ui/theme-constants';-export type SettingsCustomizeVideoModalTab = {- id: string;- title: string;- Icon: IconComponent;- vimeoId: string;- hasSound?: boolean;-};-type SettingsCustomizeVideoModalProps = {modalInstanceId: string;tabsInstanceId: string;@@ -87,7 +81,7 @@ export const SettingsCustomizeVideoModal = ({tabs,}: SettingsCustomizeVideoModalProps) => {const theme = useTheme();- const { closeModal } = useModal();+ const { closeDialog } = useDialog();const [activeTabId, setActiveTabId] = useState<string>(tabs[0]?.id ?? '');if (tabs.length === 0) {@@ -99,54 +93,65 @@ export const SettingsCustomizeVideoModal = ({const ActiveTabIcon = activeTab.Icon;const handleClose = () => {- closeModal(modalInstanceId);+ closeDialog(modalInstanceId);};return (- <ModalStatefulWrapper- modalInstanceId={modalInstanceId}- size="large"- padding="none"- isClosable+ <DialogInstance+ dialogId={modalInstanceId}+ dismissibleonClose={handleClose}renderInDocumentBody>- <StyledHeader $hasBottomBorder={!hasMultipleTabs}>- {hasMultipleTabs ? (- <StyledTabsContainer>- <TabList- tabs={tabs}- behaveAsLinks={false}- componentInstanceId={tabsInstanceId}- onChangeTab={(tabId) => setActiveTabId(tabId)}- />- </StyledTabsContainer>- ) : (- <StyledTitle>- <ActiveTabIcon- size={theme.icon.size.md}- color={theme.font.color.primary}- aria-hidden+ {({ container, backdrop, viewportProps, onKeyDown }) => (+ <Dialog.Popup+ aria-label={activeTab.title}+ {...{ container, backdrop, viewportProps, onKeyDown }}+ size="lg"+ style={{ padding: 0 }}+ >+ <StyledHeader $hasBottomBorder={!hasMultipleTabs}>+ {hasMultipleTabs ? (+ <StyledTabsContainer>+ <TabList+ tabs={tabs}+ behaveAsLinks={false}+ componentInstanceId={tabsInstanceId}+ onChangeTab={(tabId) => setActiveTabId(tabId)}+ />+ </StyledTabsContainer>+ ) : (+ <StyledTitle>+ <ActiveTabIcon+ size={theme.icon.size.md}+ color={theme.font.color.primary}+ aria-hidden+ />+ <StyledTitleText>{activeTab.title}</StyledTitleText>+ </StyledTitle>+ )}+ <IconButton+ aria-label={t`Close video`}+ onClick={handleClose}+ size="sm"+ >+ <IconX />+ </IconButton>+ </StyledHeader>+ <StyledVideoContainer>+ <StyledVideoIframe+ key={activeTab.id}+ src={+ activeTab.hasSound+ ? `https://player.vimeo.com/video/${activeTab.vimeoId}?byline=0&portrait=0&title=0&vimeo_logo=0&app_id=58479&dnt=1`+ : `https://player.vimeo.com/video/${activeTab.vimeoId}?autoplay=1&loop=1&autopause=0&background=1&muted=1&dnt=1`+ }+ allow="autoplay; fullscreen; picture-in-picture"+ title={activeTab.title}/>- <StyledTitleText>{activeTab.title}</StyledTitleText>- </StyledTitle>- )}- <IconButton aria-label={t`Close video`} onClick={handleClose} size="sm">- <IconX />- </IconButton>- </StyledHeader>- <StyledVideoContainer>- <StyledVideoIframe- key={activeTab.id}- src={- activeTab.hasSound- ? `https://player.vimeo.com/video/${activeTab.vimeoId}?byline=0&portrait=0&title=0&vimeo_logo=0&app_id=58479&dnt=1`- : `https://player.vimeo.com/video/${activeTab.vimeoId}?autoplay=1&loop=1&autopause=0&background=1&muted=1&dnt=1`- }- allow="autoplay; fullscreen; picture-in-picture"- title={activeTab.title}- />- </StyledVideoContainer>- </ModalStatefulWrapper>+ </StyledVideoContainer>+ </Dialog.Popup>+ )}+ </DialogInstance>);};diff --git a/packages/twenty-front/src/modules/settings/components/SettingsDiscoveryHeroCard.tsx b/packages/twenty-front/src/modules/settings/components/SettingsDiscoveryHeroCard.tsxindex 9e27cf2e654..2c92a1ed399 100644--- a/packages/twenty-front/src/modules/settings/components/SettingsDiscoveryHeroCard.tsx+++ b/packages/twenty-front/src/modules/settings/components/SettingsDiscoveryHeroCard.tsx@@ -1,9 +1,7 @@-import {- SettingsCustomizeVideoModal,- type SettingsCustomizeVideoModalTab,-} from '@/settings/components/SettingsCustomizeVideoModal';+import { type SettingsCustomizeVideoModalTab } from '@/settings/types/SettingsCustomizeVideoModalTab';+import { SettingsCustomizeVideoModal } from '@/settings/components/SettingsCustomizeVideoModal';import { HeroPlayButton } from '@/ui/layout/hero/components/HeroPlayButton';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';import { type ReactNode, useContext } from 'react';@@ -64,7 +62,7 @@ export const SettingsDiscoveryHeroCard = ({}: SettingsDiscoveryHeroCardProps) => {const { t } = useLingui();const { colorScheme } = useContext(ThemeContext);- const { openModal } = useModal();+ const { openDialog } = useDialog();const shouldDisplayVideo = tabs.length > 0;const modalInstanceId = `${instanceIdPrefix}-modal`;@@ -80,7 +78,7 @@ export const SettingsDiscoveryHeroCard = ({{shouldDisplayVideo && (<StyledOverlay><HeroPlayButton- onClick={() => openModal(modalInstanceId)}+ onClick={() => openDialog(modalInstanceId)}ariaLabel={playButtonAriaLabel ?? t`Watch demo`}/></StyledOverlay>diff --git a/packages/twenty-front/src/modules/settings/components/__tests__/SettingsRoutedFlowStateScope.test.tsx b/packages/twenty-front/src/modules/settings/components/__tests__/SettingsRoutedFlowStateScope.test.tsxindex 1c0bd0e09f5..28c2b680413 100644--- a/packages/twenty-front/src/modules/settings/components/__tests__/SettingsRoutedFlowStateScope.test.tsx+++ b/packages/twenty-front/src/modules/settings/components/__tests__/SettingsRoutedFlowStateScope.test.tsx@@ -10,8 +10,8 @@ import { type RoleWithPartialMembers } from '@/settings/roles/types/RoleWithPartimport { WorkspaceSurfaceContext } from '@/ui/layout/contexts/WorkspaceSurfaceContext';import { useOpenDropdown } from '@/ui/layout/dropdown/hooks/useOpenDropdown';import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDropdownOpenComponentState';-import { useModal } from '@/ui/layout/modal/hooks/useModal';-import { isModalOpenedComponentState } from '@/ui/layout/modal/states/isModalOpenedComponentState';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';+import { isDialogOpenedComponentState } from '@/ui/layout/dialog/states/isDialogOpenedComponentState';import { useWorkspaceSurfaceScopedComponentInstanceId } from '@/ui/layout/hooks/useWorkspaceSurfaceScopedComponentInstanceId';import { sortedFieldByTableFamilyState } from '@/ui/layout/table/states/sortedFieldByTableFamilyState';import {@@ -60,11 +60,11 @@ const ScopedStateProbe = ({settingsPersistedRoleFamilyState,ROLE_ID,);- const isModalOpened = useAtomComponentStateValue(- isModalOpenedComponentState,+ const isDialogOpened = useAtomComponentStateValue(+ isDialogOpenedComponentState,modalId,);- const { openModal, toggleModal } = useModal();+ const { openDialog, toggleDialog } = useDialog();const isDropdownOpen = useAtomComponentStateValue(isDropdownOpenComponentState,dropdownId,@@ -91,7 +91,7 @@ const ScopedStateProbe = ({<span data-testid={`${name}-persisted`}>{settingsPersistedRole?.label ?? 'unset'}</span>- <span data-testid={`${name}-modal`}>{String(isModalOpened)}</span>+ <span data-testid={`${name}-modal`}>{String(isDialogOpened)}</span><span data-testid={`${name}-dropdown`}>{String(isDropdownOpen)}</span><span data-testid={`${name}-sort`}>{sortedFieldByTable?.fieldName ?? 'unset'}@@ -109,8 +109,8 @@ const ScopedStateProbe = ({>{name} draft</button>- <button onClick={() => openModal(modalId)}>{name} modal</button>- <button onClick={() => toggleModal(modalId)}>{name} toggle modal</button>+ <button onClick={() => openDialog(modalId)}>{name} modal</button>+ <button onClick={() => toggleDialog(modalId)}>{name} toggle modal</button><buttononClick={() =>openDropdown({ dropdownComponentInstanceIdFromProps: dropdownId })diff --git a/packages/twenty-front/src/modules/settings/config-variables/components/ConfigVariableEdit.tsx b/packages/twenty-front/src/modules/settings/config-variables/components/ConfigVariableEdit.tsxindex d2fc19fd2de..0bda71f71ae 100644--- a/packages/twenty-front/src/modules/settings/config-variables/components/ConfigVariableEdit.tsx+++ b/packages/twenty-front/src/modules/settings/config-variables/components/ConfigVariableEdit.tsx@@ -1,6 +1,6 @@import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';import { type Dispatch, type SetStateAction, useState } from 'react';@@ -60,7 +60,7 @@ export const ConfigVariableEdit = ({}: ConfigVariableEditProps) => {const { t } = useLingui();- const { openModal } = useModal();+ const { openDialog } = useDialog();const { enqueueToast } = useToast();@@ -100,7 +100,7 @@ export const ConfigVariableEdit = ({const handleCancel = () => {if (canOpenCancelModal) {- openModal(RESET_VARIABLE_MODAL_ID);+ openDialog(RESET_VARIABLE_MODAL_ID);return;}@@ -158,8 +158,8 @@ export const ConfigVariableEdit = ({/></StyledButtonContainer>)}- <ConfirmationModal- modalInstanceId={RESET_VARIABLE_MODAL_ID}+ <ConfirmationDialog+ dialogId={RESET_VARIABLE_MODAL_ID}title={t`Reset variable`}subtitle={t`Are you sure you want to reset this variable?`}onConfirmClick={handleConfirmReset}diff --git a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsUpdateDataModelObjectAboutForm.tsx b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsUpdateDataModelObjectAboutForm.tsxindex cee5a582f78..54990516092 100644--- a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsUpdateDataModelObjectAboutForm.tsx+++ b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsUpdateDataModelObjectAboutForm.tsx@@ -1,4 +1,6 @@-import { StyledCenteredButton } from '@/ui/layout/modal/components/StyledCenteredButton';+import { Button } from 'twenty-ui/primitives/input';+import { styled } from '@linaria/react';+import { themeCssVariables } from 'twenty-ui/theme-constants';import { isDDLLockedState } from '@/client-config/states/isDDLLockedState';import { useGetIsMetadataItemCustom } from '@/object-metadata/hooks/useGetIsMetadataItemCustom';import { type EnrichedObjectMetadataItem } from '@/object-metadata/types/EnrichedObjectMetadataItem';@@ -12,13 +14,18 @@ import {type SettingsDataModelObjectAboutFormValues,settingsDataModelObjectAboutFormSchema,} from '@/settings/data-model/validation-schemas/settingsDataModelObjectAboutFormSchema';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { zodResolver } from '@hookform/resolvers/zod';import { useLingui } from '@lingui/react/macro';import { FormProvider, useForm } from 'react-hook-form';import { getObjectColorWithFallback } from '@/object-metadata/utils/getObjectColorWithFallback';+const StyledCenteredButton = styled(Button)`+ box-sizing: border-box;+ margin-top: ${themeCssVariables.spacing[2]};+`;+type SettingsUpdateDataModelObjectAboutFormProps = {objectMetadataItem: EnrichedObjectMetadataItem;};@@ -81,8 +88,8 @@ export const SettingsUpdateDataModelObjectAboutForm = ({disableEdition={readonly}objectMetadataItem={objectMetadataItem}/>- <ConfirmationModal- modalInstanceId={TRANSLATION_INTENT_MODAL_ID}+ <ConfirmationDialog+ dialogId={TRANSLATION_INTENT_MODAL_ID}title={t`Translate or rename?`}subtitle={t`You are editing the ${currentLanguageLabel} translation. Renaming instead changes the source label, for every language.`}confirmButtonText={t`Only in ${currentLanguageLabel}`}diff --git a/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/ObjectLayout.tsx b/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/ObjectLayout.tsxindex 4a4ae6e81a6..15a7fcabd63 100644--- a/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/ObjectLayout.tsx+++ b/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/ObjectLayout.tsx@@ -18,8 +18,8 @@ import recordPageLayoutCoverDark from '@/settings/data-model/object-details/asseimport recordPageLayoutCoverLight from '@/settings/data-model/object-details/assets/record-page-layout-cover-light.png';import { ObjectOpenRecordInPicker } from '@/settings/data-model/object-details/components/tabs/ObjectOpenRecordInPicker';import { useHasPermissionFlag } from '@/settings/roles/hooks/useHasPermissionFlag';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue';import { PermissionFlagType } from '~/generated-metadata/graphql';@@ -43,7 +43,7 @@ export const ObjectLayout = ({ objectMetadataItem }: ObjectLayoutProps) => {const navigateApp = useNavigateApp();const { enterLayoutCustomizationMode } = useEnterLayoutCustomizationMode();const hasLayoutsPermission = useHasPermissionFlag(PermissionFlagType.LAYOUTS);- const { openModal } = useModal();+ const { openDialog } = useDialog();const { resetPageLayoutToDefault } = useResetPageLayoutToDefault();const pageLayout = useAtomFamilySelectorValue(@@ -82,7 +82,7 @@ export const ObjectLayout = ({ objectMetadataItem }: ObjectLayoutProps) => {};const handleResetPageLayout = () => {- openModal(RESET_PAGE_LAYOUT_MODAL_ID);+ openDialog(RESET_PAGE_LAYOUT_MODAL_ID);};const handleConfirmReset = async () => {@@ -147,8 +147,8 @@ export const ObjectLayout = ({ objectMetadataItem }: ObjectLayoutProps) => {variant="outline">{t`Reset to default`}</Button></Section.Root>- <ConfirmationModal- modalInstanceId={RESET_PAGE_LAYOUT_MODAL_ID}+ <ConfirmationDialog+ dialogId={RESET_PAGE_LAYOUT_MODAL_ID}title={t`Reset to default`}subtitle={t`This action cannot be undone.`}onConfirmClick={handleConfirmReset}diff --git a/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/ObjectSettings.tsx b/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/ObjectSettings.tsxindex 97acdd9c083..aa1c261cff0 100644--- a/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/ObjectSettings.tsx+++ b/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/ObjectSettings.tsx@@ -10,8 +10,8 @@ import { SettingsObjectIndexesSection } from '@/settings/data-model/object-detaiimport { SettingsObjectSearchSection } from '@/settings/data-model/object-details/components/tabs/SettingsObjectSearchSection';import { SettingsDataModelObjectSettingsFormCard } from '@/settings/data-model/objects/forms/components/SettingsDataModelObjectSettingsFormCard';import { SettingsTranslationsButton } from '@/settings/translations/components/SettingsTranslationsButton';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';@@ -60,7 +60,7 @@ export const ObjectSettings = ({const { updateOneObjectMetadataItem } = useUpdateOneObjectMetadataItem();const { deleteOneObjectMetadataItem } = useDeleteOneObjectMetadataItem();const { enqueueToast } = useToast();- const { openModal, closeModal } = useModal();+ const { openDialog, closeDialog } = useDialog();const isDDLLocked = useAtomStateValue(isDDLLockedState);@@ -79,7 +79,7 @@ export const ObjectSettings = ({};const handleDelete = () => {- openModal(DELETE_OBJECT_MODAL_ID);+ openDialog(DELETE_OBJECT_MODAL_ID);};const confirmDelete = async () => {@@ -88,13 +88,13 @@ export const ObjectSettings = ({if (result.status === 'successful') {enqueueToast({ variant: 'success', children: t`Object deleted` });- closeModal(DELETE_OBJECT_MODAL_ID);+ closeDialog(DELETE_OBJECT_MODAL_ID);navigate(SettingsPath.Objects);return;}setIsDeleting(false);- closeModal(DELETE_OBJECT_MODAL_ID);+ closeDialog(DELETE_OBJECT_MODAL_ID);};const objectLabel = objectMetadataItem.labelPlural;@@ -192,13 +192,13 @@ export const ObjectSettings = ({</Section.Root></StyledFormSectionContainer>)}- <ConfirmationModal- modalInstanceId={DELETE_OBJECT_MODAL_ID}+ <ConfirmationDialog+ dialogId={DELETE_OBJECT_MODAL_ID}title={t`Delete ${objectLabel} object?`}subtitle={t`This will permanently delete the object and all its records. Type "yes" to confirm.`}confirmButtonText={t`Delete`}onConfirmClick={confirmDelete}- onClose={() => closeModal(DELETE_OBJECT_MODAL_ID)}+ onClose={() => closeDialog(DELETE_OBJECT_MODAL_ID)}confirmationValue="yes"confirmationPlaceholder="yes"loading={isDeleting}diff --git a/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/SettingsObjectIndexesSection.tsx b/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/SettingsObjectIndexesSection.tsxindex ab411288a9c..a5fc42c8762 100644--- a/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/SettingsObjectIndexesSection.tsx+++ b/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/SettingsObjectIndexesSection.tsx@@ -9,8 +9,8 @@ import { type CompositeFieldType } from '@/settings/data-model/types/CompositeFiimport { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';import { isNonEmptyString } from '@sniptt/guards';@@ -53,7 +53,7 @@ export const SettingsObjectIndexesSection = ({isReadOnly,}: SettingsObjectIndexesSectionProps) => {const { t } = useLingui();- const { openModal, closeModal } = useModal();+ const { openDialog, closeDialog } = useDialog();const { enqueueToast } = useToast();const { deleteOneIndexMetadataItem } = useDeleteOneIndexMetadataItem();const { objectMetadataItems } = useObjectMetadataItems();@@ -140,7 +140,7 @@ export const SettingsObjectIndexesSection = ({const handleRequestDelete = (item: SettingsObjectIndexesTableItem) => {setPendingDelete(item);- openModal(DELETE_INDEX_MODAL_ID);+ openDialog(DELETE_INDEX_MODAL_ID);};const handleConfirmDelete = async () => {@@ -152,7 +152,7 @@ export const SettingsObjectIndexesSection = ({});setIsDeleting(false);- closeModal(DELETE_INDEX_MODAL_ID);+ closeDialog(DELETE_INDEX_MODAL_ID);if (result.status === 'successful') {enqueueToast({ variant: 'success', children: t`Index deleted` });@@ -216,8 +216,8 @@ export const SettingsObjectIndexesSection = ({)}</StyledButtonContainer>)}- <ConfirmationModal- modalInstanceId={DELETE_INDEX_MODAL_ID}+ <ConfirmationDialog+ dialogId={DELETE_INDEX_MODAL_ID}title={t`Delete this index?`}subtitle={t`Queries that relied on it will fall back to a sequential scan. You can recreate it later.`}confirmButtonText={t`Delete`}diff --git a/packages/twenty-front/src/modules/settings/data-model/object-details/hooks/useSaveUpdateDataModelObjectAboutForm.ts b/packages/twenty-front/src/modules/settings/data-model/object-details/hooks/useSaveUpdateDataModelObjectAboutForm.tsindex ecf4ede3ac3..4c02b439ab9 100644--- a/packages/twenty-front/src/modules/settings/data-model/object-details/hooks/useSaveUpdateDataModelObjectAboutForm.ts+++ b/packages/twenty-front/src/modules/settings/data-model/object-details/hooks/useSaveUpdateDataModelObjectAboutForm.ts@@ -5,7 +5,7 @@ import { useUpdateOneObjectMetadataItem } from '@/object-metadata/hooks/useUpdatimport { type EnrichedObjectMetadataItem } from '@/object-metadata/types/EnrichedObjectMetadataItem';import { computeUpdatedNavigationMemorizedUrlAfterObjectNamePluralChange } from '@/settings/data-model/object-details/utils/computeUpdatedNavigationMemorizedUrlAfterObjectNamePluralChange';import { type SettingsDataModelObjectAboutFormValues } from '@/settings/data-model/validation-schemas/settingsDataModelObjectAboutFormSchema';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { navigationMemorizedUrlState } from '@/ui/navigation/states/navigationMemorizedUrlState';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';@@ -53,7 +53,7 @@ export const useSaveUpdateDataModelObjectAboutForm = ({);const { updateOneObjectMetadataItem } = useUpdateOneObjectMetadataItem();const apolloClient = useApolloClient();- const { openModal, closeModal } = useModal();+ const { openDialog, closeDialog } = useDialog();const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState);const currentLocale = currentWorkspaceMember?.locale ?? SOURCE_LOCALE;const localeOptions = useLocaleOptions();@@ -206,7 +206,7 @@ export const useSaveUpdateDataModelObjectAboutForm = ({if (isEditingThroughTranslation) {setPendingFormValues(formValues);- openModal(TRANSLATION_INTENT_MODAL_ID);+ openDialog(TRANSLATION_INTENT_MODAL_ID);return;}}@@ -248,7 +248,7 @@ export const useSaveUpdateDataModelObjectAboutForm = ({updatePayload: { ...dirtyNonTranslatableValues, translations },});- closeModal(TRANSLATION_INTENT_MODAL_ID);+ closeDialog(TRANSLATION_INTENT_MODAL_ID);setPendingFormValues(null);if (updateResult.status === 'successful') {@@ -269,7 +269,7 @@ export const useSaveUpdateDataModelObjectAboutForm = ({const formValues = pendingFormValues;- closeModal(TRANSLATION_INTENT_MODAL_ID);+ closeDialog(TRANSLATION_INTENT_MODAL_ID);setPendingFormValues(null);await saveAsRename(formValues);};diff --git a/packages/twenty-front/src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx b/packages/twenty-front/src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsxindex b50f5a3999c..7b49207e278 100644--- a/packages/twenty-front/src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx+++ b/packages/twenty-front/src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx@@ -8,8 +8,8 @@ import { type WebhookFormMode } from '@/settings/developers/constants/WebhookForimport { useWebhookForm } from '@/settings/developers/hooks/useWebhookForm';import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';import { TextArea } from '@/ui/input/components/TextArea';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';import { Trans, useLingui } from '@lingui/react/macro';import { SettingsPath } from 'twenty-shared/types';@@ -39,7 +39,7 @@ export const SettingsDevelopersWebhookForm = ({}: SettingsDevelopersWebhookFormProps) => {const { t } = useLingui();const navigate = useNavigateSettings();- const { openModal } = useModal();+ const { openDialog } = useDialog();const {formConfig,loading,@@ -208,7 +208,7 @@ export const SettingsDevelopersWebhookForm = ({/><ButtonstartIcon={<IconTrash />}- onClick={() => openModal(DELETE_WEBHOOK_MODAL_ID)}+ onClick={() => openDialog(DELETE_WEBHOOK_MODAL_ID)}variant="outline"color="danger">{t`Delete`}</Button>@@ -217,10 +217,10 @@ export const SettingsDevelopersWebhookForm = ({</SettingsPageContainer></SettingsPageLayout>{!isCreationMode && (- <ConfirmationModal+ <ConfirmationDialogconfirmationPlaceholder={t`yes`}confirmationValue={t`yes`}- modalInstanceId={DELETE_WEBHOOK_MODAL_ID}+ dialogId={DELETE_WEBHOOK_MODAL_ID}title={t`Delete webhook`}subtitle={<Trans>diff --git a/packages/twenty-front/src/modules/settings/domains/components/SettingsSubdomain.tsx b/packages/twenty-front/src/modules/settings/domains/components/SettingsSubdomain.tsxindex 447d85dc793..a425b67d1d3 100644--- a/packages/twenty-front/src/modules/settings/domains/components/SettingsSubdomain.tsx+++ b/packages/twenty-front/src/modules/settings/domains/components/SettingsSubdomain.tsx@@ -7,7 +7,7 @@ import {useSettingsSubdomain,} from '@/settings/domains/hooks/useSettingsSubdomain';import { TextInput } from '@/ui/input/components/TextInput';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { Trans, useLingui } from '@lingui/react/macro';@@ -86,8 +86,8 @@ export const SettingsSubdomain = () => {</Section.Root></SettingsPageContainer></SettingsPageLayout>- <ConfirmationModal- modalInstanceId={SUBDOMAIN_CHANGE_CONFIRMATION_MODAL_ID}+ <ConfirmationDialog+ dialogId={SUBDOMAIN_CHANGE_CONFIRMATION_MODAL_ID}title={t`Change subdomain?`}subtitle={t`You're about to change your workspace subdomain. This action will log out all users.`}onConfirmClick={handleConfirm}diff --git a/packages/twenty-front/src/modules/settings/domains/hooks/useSettingsSubdomain.ts b/packages/twenty-front/src/modules/settings/domains/hooks/useSettingsSubdomain.tsindex 8cac43edf7f..ceddf5ac4fe 100644--- a/packages/twenty-front/src/modules/settings/domains/hooks/useSettingsSubdomain.ts+++ b/packages/twenty-front/src/modules/settings/domains/hooks/useSettingsSubdomain.ts@@ -2,7 +2,7 @@ import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';import { useRedirectToWorkspaceDomain } from '@/domain-manager/hooks/useRedirectToWorkspaceDomain';import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';import { getSubdomainValidationSchema } from '@/settings/domains/utils/getSubdomainValidationSchema';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';import { CombinedGraphQLErrors } from '@apollo/client/errors';import { useMutation } from '@apollo/client/react';@@ -22,7 +22,7 @@ export const useSettingsSubdomain = () => {const { enqueueToast } = useToast();const [updateWorkspace] = useMutation(UpdateWorkspaceDocument);const { redirectToWorkspaceDomain } = useRedirectToWorkspaceDomain();- const { openModal, closeModal } = useModal();+ const { openDialog, closeDialog } = useDialog();const [currentWorkspace, setCurrentWorkspace] = useAtomState(currentWorkspaceState,@@ -45,7 +45,7 @@ export const useSettingsSubdomain = () => {const handleSave = () => {if (isDefined(currentWorkspace)) {- openModal(SUBDOMAIN_CHANGE_CONFIRMATION_MODAL_ID);+ openDialog(SUBDOMAIN_CHANGE_CONFIRMATION_MODAL_ID);}};@@ -64,7 +64,7 @@ export const useSettingsSubdomain = () => {CombinedGraphQLErrors.is(mutationError) &&mutationError.errors[0]?.extensions?.code === 'CONFLICT') {- closeModal(SUBDOMAIN_CHANGE_CONFIRMATION_MODAL_ID);+ closeDialog(SUBDOMAIN_CHANGE_CONFIRMATION_MODAL_ID);setError(t`Subdomain already taken`);setIsSubmitting(false);diff --git a/packages/twenty-front/src/modules/settings/enterprise/components/EnterprisePlanModal.tsx b/packages/twenty-front/src/modules/settings/enterprise/components/EnterprisePlanModal.tsxindex 4885b7bb020..82daae57c3e 100644--- a/packages/twenty-front/src/modules/settings/enterprise/components/EnterprisePlanModal.tsx+++ b/packages/twenty-front/src/modules/settings/enterprise/components/EnterprisePlanModal.tsx@@ -1,9 +1,10 @@+import { Dialog } from 'twenty-ui/primitives/surfaces';+import { DialogInstance } from '@/ui/layout/dialog/components/DialogInstance';import { SubTitle } from '@/auth/components/SubTitle';import { Title } from '@/auth/components/Title';import { SubscriptionBenefit } from '@/settings/billing/components/SubscriptionBenefit';import { ENTERPRISE_CHECKOUT_SESSION } from '@/settings/enterprise/graphql/queries/enterpriseCheckoutSession';-import { ModalStatefulWrapper } from '@/ui/layout/modal/components/ModalStatefulWrapper';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useApolloClient } from '@apollo/client/react';import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';@@ -11,7 +12,6 @@ import { useState } from 'react';import { Loader, useToast } from 'twenty-ui/primitives/feedback';import { MainButton } from 'twenty-ui/components';import { CardPicker, RadioGroup } from 'twenty-ui/primitives/input';-import { ModalContent } from 'twenty-ui/primitives/surfaces';import { themeCssVariables } from 'twenty-ui/theme-constants';const StyledCheckoutButton = styled(MainButton)`@@ -93,7 +93,7 @@ const StyledIntervalSubtitle = styled.div`export const EnterprisePlanModal = () => {const { t } = useLingui();- const { closeModal } = useModal();+ const { closeDialog } = useDialog();const { enqueueToast } = useToast();const [selectedInterval, setSelectedInterval] =useState<BillingInterval>('monthly');@@ -129,7 +129,7 @@ export const EnterprisePlanModal = () => {if (checkoutUrl !== null && checkoutUrl !== undefined) {window.open(checkoutUrl, '_blank', 'noopener');- closeModal(ENTERPRISE_PLAN_MODAL_ID);+ closeDialog(ENTERPRISE_PLAN_MODAL_ID);} else {enqueueToast({variant: 'error',@@ -144,54 +144,68 @@ export const EnterprisePlanModal = () => {};return (- <ModalStatefulWrapper- modalInstanceId={ENTERPRISE_PLAN_MODAL_ID}- size="medium"- padding="none"- isClosable- >- <ModalContent isVerticallyCentered>- <Title noMarginTop>{t`Get Organization`}</Title>- <SubTitle>{t`Enjoy a 30-day free trial`}</SubTitle>-- <StyledSubscriptionContainer>- <StyledPriceContainer>- <StyledPrice>{`$${price}`}</StyledPrice>- <StyledPriceUnit>{priceUnit}</StyledPriceUnit>- </StyledPriceContainer>- <StyledBenefitsContainer>- {benefits.map((benefit) => (- <SubscriptionBenefit key={benefit}>{benefit}</SubscriptionBenefit>- ))}- </StyledBenefitsContainer>- </StyledSubscriptionContainer>-- <RadioGroup- render={<StyledIntervalContainer />}- aria-label={t`Billing interval`}- value={selectedInterval}- onValueChange={setSelectedInterval}+ <DialogInstance dialogId={ENTERPRISE_PLAN_MODAL_ID} dismissible>+ {({ container, backdrop, viewportProps, onKeyDown }) => (+ <Dialog.Popup+ aria-label={t`Get Organization`}+ {...{ container, backdrop, viewportProps, onKeyDown }}+ size="md"+ style={{ padding: 0 }}>- <CardPicker value="monthly">- <StyledIntervalCardContent>- <StyledIntervalTitle>{t`Monthly`}</StyledIntervalTitle>- <StyledIntervalSubtitle>{`$${MONTHLY_PRICE} / ${t`seat / month`}`}</StyledIntervalSubtitle>- </StyledIntervalCardContent>- </CardPicker>- <CardPicker value="yearly">- <StyledIntervalCardContent>- <StyledIntervalTitle>{t`Yearly`}</StyledIntervalTitle>- <StyledIntervalSubtitle>{`$${YEARLY_PRICE} / ${t`seat / month`}`}</StyledIntervalSubtitle>- </StyledIntervalCardContent>- </CardPicker>- </RadioGroup>-- <StyledCheckoutButton- onClick={handleContinue}- startIcon={isLoading && <Loader />}- disabled={isLoading}- >{t`Continue`}</StyledCheckoutButton>- </ModalContent>- </ModalStatefulWrapper>+ <Dialog.Body+ style={{+ display: 'flex',+ flex: '1 1 0%',+ flexDirection: 'column',+ padding: 'var(--t-spacing-10)',+ alignItems: 'center',+ }}+ >+ <Title noMarginTop>{t`Get Organization`}</Title>+ <SubTitle>{t`Enjoy a 30-day free trial`}</SubTitle>++ <StyledSubscriptionContainer>+ <StyledPriceContainer>+ <StyledPrice>{`$${price}`}</StyledPrice>+ <StyledPriceUnit>{priceUnit}</StyledPriceUnit>+ </StyledPriceContainer>+ <StyledBenefitsContainer>+ {benefits.map((benefit) => (+ <SubscriptionBenefit key={benefit}>+ {benefit}+ </SubscriptionBenefit>+ ))}+ </StyledBenefitsContainer>+ </StyledSubscriptionContainer>++ <RadioGroup+ render={<StyledIntervalContainer />}+ aria-label={t`Billing interval`}+ value={selectedInterval}+ onValueChange={setSelectedInterval}+ >+ <CardPicker value="monthly">+ <StyledIntervalCardContent>+ <StyledIntervalTitle>{t`Monthly`}</StyledIntervalTitle>+ <StyledIntervalSubtitle>{`$${MONTHLY_PRICE} / ${t`seat / month`}`}</StyledIntervalSubtitle>+ </StyledIntervalCardContent>+ </CardPicker>+ <CardPicker value="yearly">+ <StyledIntervalCardContent>+ <StyledIntervalTitle>{t`Yearly`}</StyledIntervalTitle>+ <StyledIntervalSubtitle>{`$${YEARLY_PRICE} / ${t`seat / month`}`}</StyledIntervalSubtitle>+ </StyledIntervalCardContent>+ </CardPicker>+ </RadioGroup>++ <StyledCheckoutButton+ onClick={handleContinue}+ startIcon={isLoading && <Loader />}+ disabled={isLoading}+ >{t`Continue`}</StyledCheckoutButton>+ </Dialog.Body>+ </Dialog.Popup>+ )}+ </DialogInstance>);};diff --git a/packages/twenty-front/src/modules/settings/members/components/MemberPermissionsTab.tsx b/packages/twenty-front/src/modules/settings/members/components/MemberPermissionsTab.tsxindex 981ed5d5f23..d80d00c83f1 100644--- a/packages/twenty-front/src/modules/settings/members/components/MemberPermissionsTab.tsx+++ b/packages/twenty-front/src/modules/settings/members/components/MemberPermissionsTab.tsx@@ -1,8 +1,8 @@import { SettingsRolePermissions } from '@/settings/roles/role-permissions/components/SettingsRolePermissions';import { type RoleWithPartialMembers } from '@/settings/roles/types/RoleWithPartialMembers';import { Select } from '@/ui/input/components/Select';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { type WorkspaceMember } from '@/workspace-member/types/WorkspaceMember';import { useMutation } from '@apollo/client/react';import { styled } from '@linaria/react';@@ -54,7 +54,7 @@ export const MemberPermissionsTab = ({const { getIcon } = useIcons();const navigateSettings = useNavigateSettings();const { enqueueToast } = useToast();- const { openModal } = useModal();+ const { openDialog } = useDialog();const [pendingRole, setPendingRole] = useState<RoleWithPartialMembers | null>(null,);@@ -77,7 +77,7 @@ export const MemberPermissionsTab = ({if (!newRole || newRoleId === primaryRole?.id) return;setPendingRole(newRole);- openModal(CONFIRM_ROLE_CHANGE_MODAL_ID);+ openDialog(CONFIRM_ROLE_CHANGE_MODAL_ID);};const handleConfirmRoleChange = async () => {@@ -149,8 +149,8 @@ export const MemberPermissionsTab = ({</Section.Root>{pendingRole && (- <ConfirmationModal- modalInstanceId={CONFIRM_ROLE_CHANGE_MODAL_ID}+ <ConfirmationDialog+ dialogId={CONFIRM_ROLE_CHANGE_MODAL_ID}title={t`Confirm role update`}subtitle={t`Are you sure you want to update the role of this user from "${oldRoleLabel}" to "${newRoleLabel}"?`}onConfirmClick={handleConfirmRoleChange}diff --git a/packages/twenty-front/src/modules/settings/profile/components/DeleteAccount.tsx b/packages/twenty-front/src/modules/settings/profile/components/DeleteAccount.tsxindex 6a281d1a536..76aada533a8 100644--- a/packages/twenty-front/src/modules/settings/profile/components/DeleteAccount.tsx+++ b/packages/twenty-front/src/modules/settings/profile/components/DeleteAccount.tsx@@ -3,8 +3,8 @@ import { availableWorkspacesState } from '@/auth/states/availableWorkspacesStateimport { currentUserState } from '@/auth/states/currentUserState';import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';import { countAvailableWorkspaces } from '@/auth/utils/availableWorkspacesUtils';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useMutation } from '@apollo/client/react';import { styled } from '@linaria/react';@@ -30,7 +30,7 @@ const StyledDangerActions = styled.div`export const DeleteAccount = () => {const { t } = useLingui();- const { openModal } = useModal();+ const { openDialog } = useDialog();const { enqueueToast } = useToast();const [deleteUserAccount] = useMutation(DeleteUserAccountDocument);@@ -81,22 +81,22 @@ export const DeleteAccount = () => {<StyledDangerActions>{userHasMultipleWorkspaces && (<Button- onClick={() => openModal(LEAVE_WORKSPACE_MODAL_ID)}+ onClick={() => openDialog(LEAVE_WORKSPACE_MODAL_ID)}variant="outline"color="danger">{t`Leave workspace`}</Button>)}<Button- onClick={() => openModal(DELETE_ACCOUNT_MODAL_ID)}+ onClick={() => openDialog(DELETE_ACCOUNT_MODAL_ID)}variant="outline"color="danger">{t`Delete account`}</Button></StyledDangerActions>{userHasMultipleWorkspaces && (- <ConfirmationModal+ <ConfirmationDialogconfirmationValue={userEmail}confirmationPlaceholder={userEmail ?? ''}- modalInstanceId={LEAVE_WORKSPACE_MODAL_ID}+ dialogId={LEAVE_WORKSPACE_MODAL_ID}title={t`Leave workspace`}subtitle={<>@@ -109,10 +109,10 @@ export const DeleteAccount = () => {confirmButtonText={t`Leave workspace`}/>)}- <ConfirmationModal+ <ConfirmationDialogconfirmationValue={userEmail}confirmationPlaceholder={userEmail ?? ''}- modalInstanceId={DELETE_ACCOUNT_MODAL_ID}+ dialogId={DELETE_ACCOUNT_MODAL_ID}title={t`Account Deletion`}subtitle={<>diff --git a/packages/twenty-front/src/modules/settings/profile/components/DeleteWorkspace.tsx b/packages/twenty-front/src/modules/settings/profile/components/DeleteWorkspace.tsxindex 6bca1624327..2fc566d8a02 100644--- a/packages/twenty-front/src/modules/settings/profile/components/DeleteWorkspace.tsx+++ b/packages/twenty-front/src/modules/settings/profile/components/DeleteWorkspace.tsx@@ -4,8 +4,8 @@ import { useAuth } from '@/auth/hooks/useAuth';import { currentUserState } from '@/auth/states/currentUserState';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useRedirectToDefaultDomain } from '@/domain-manager/hooks/useRedirectToDefaultDomain';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { Section } from 'twenty-ui/components';import { IconTrash } from 'twenty-ui/icon';import { Button } from 'twenty-ui/primitives/input';@@ -20,7 +20,7 @@ export const DeleteWorkspace = () => {const currentUser = useAtomStateValue(currentUserState);const userEmail = currentUser?.email;const { t } = useLingui();- const { openModal } = useModal();+ const { openDialog } = useDialog();const { signOut } = useAuth();const { redirectToDefaultDomain } = useRedirectToDefaultDomain();@@ -39,13 +39,13 @@ export const DeleteWorkspace = () => {/><ButtonstartIcon={<IconTrash />}- onClick={() => openModal(DELETE_WORKSPACE_MODAL_ID)}+ onClick={() => openDialog(DELETE_WORKSPACE_MODAL_ID)}variant="outline"color="danger">{t`Delete workspace`}</Button>- <ConfirmationModal- modalInstanceId={DELETE_WORKSPACE_MODAL_ID}+ <ConfirmationDialog+ dialogId={DELETE_WORKSPACE_MODAL_ID}confirmationPlaceholder={userEmail}confirmationValue={userEmail}title={t`Workspace Deletion`}diff --git a/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignment.tsx b/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignment.tsxindex a0b554256a0..f3b8cec7cbe 100644--- a/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignment.tsx+++ b/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignment.tsx@@ -9,8 +9,8 @@ import { SettingsRoleAssignmentConfirmationModal } from '@/settings/roles/role-aimport { type SettingsRoleAssignmentConfirmationModalSelectedRoleTarget } from '@/settings/roles/role-assignment/types/SettingsRoleAssignmentConfirmationModalSelectedRoleTarget';import { useSettingsAllRoles } from '@/settings/roles/hooks/useSettingsAllRoles';import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState';-import { useModal } from '@/ui/layout/modal/hooks/useModal';-import { isModalOpenedComponentState } from '@/ui/layout/modal/states/isModalOpenedComponentState';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';+import { isDialogOpenedComponentState } from '@/ui/layout/dialog/states/isDialogOpenedComponentState';import { useWorkspaceSurfaceScopedComponentInstanceId } from '@/ui/layout/hooks/useWorkspaceSurfaceScopedComponentInstanceId';import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';@@ -59,7 +59,7 @@ export const SettingsRoleAssignment = ({const { data: agentsData } = useQuery(FindManyAgentsDocument);const { data: apiKeysData } = useQuery(GetApiKeysDocument);- const { openModal, closeModal } = useModal();+ const { openDialog, closeDialog } = useDialog();const modalInstanceId = useWorkspaceSurfaceScopedComponentInstanceId(ROLE_ASSIGNMENT_CONFIRMATION_MODAL_ID,);@@ -91,13 +91,13 @@ export const SettingsRoleAssignment = ({setSelectRoleTarget(null);};- const isModalOpened = useAtomComponentStateValue(- isModalOpenedComponentState,+ const isDialogOpened = useAtomComponentStateValue(+ isDialogOpenedComponentState,modalInstanceId,);const handleConfirm = async () => {- if (!selectedRoleTarget || !isModalOpened) return;+ if (!selectedRoleTarget || !isDialogOpened) return;if (!isCreateMode) {switch (selectedRoleTarget.entityType) {@@ -187,13 +187,13 @@ export const SettingsRoleAssignment = ({entityType: entityType as 'member' | 'agent' | 'apiKey',});- openModal(modalInstanceId);+ openDialog(modalInstanceId);};const handleRoleClick = (roleId: string) => {navigateSettings(SettingsPath.RoleDetail, { roleId });handleModalClose();- closeModal(modalInstanceId);+ closeDialog(modalInstanceId);};if (!isDefined(settingsDraftRole)) {diff --git a/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentConfirmationModal.tsx b/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentConfirmationModal.tsxindex 312532e87fb..bd31ee42e37 100644--- a/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentConfirmationModal.tsx+++ b/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentConfirmationModal.tsx@@ -1,6 +1,6 @@import { SettingsRoleAssignmentConfirmationModalSubtitle } from '@/settings/roles/role-assignment/components/SettingsRoleAssignmentConfirmationModalSubtitle';import { type SettingsRoleAssignmentConfirmationModalSelectedRoleTarget } from '@/settings/roles/role-assignment/types/SettingsRoleAssignmentConfirmationModalSelectedRoleTarget';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';import { t } from '@lingui/core/macro';type SettingsRoleAssignmentConfirmationModalProps = {@@ -25,8 +25,8 @@ export const SettingsRoleAssignmentConfirmationModal = ({const title = t`Assign ${roleTargetName}?`;return (- <ConfirmationModal- modalInstanceId={modalInstanceId}+ <ConfirmationDialog+ dialogId={modalInstanceId}title={title}subtitle={selectedRoleTarget.role ? (diff --git a/packages/twenty-front/src/modules/settings/roles/role-settings/components/SettingsRoleSettings.tsx b/packages/twenty-front/src/modules/settings/roles/role-settings/components/SettingsRoleSettings.tsxindex 3838591fc35..d148f6afcb9 100644--- a/packages/twenty-front/src/modules/settings/roles/role-settings/components/SettingsRoleSettings.tsx+++ b/packages/twenty-front/src/modules/settings/roles/role-settings/components/SettingsRoleSettings.tsx@@ -10,7 +10,7 @@ import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtoimport { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState';import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';import { TextArea } from '@/ui/input/components/TextArea';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { Section } from 'twenty-ui/components';import { Button } from 'twenty-ui/primitives/input';import { themeCssVariables } from 'twenty-ui/theme-constants';@@ -47,7 +47,7 @@ export const SettingsRoleSettings = ({roleId,);- const { openModal } = useModal();+ const { openDialog } = useDialog();const descriptionTextAreaId = `${roleId}-description`;const nameTextInputId = `${roleId}-name`;@@ -124,7 +124,7 @@ export const SettingsRoleSettings = ({<Buttonsize="sm"onClick={() => {- openModal(ROLE_SETTINGS_DELETE_ROLE_CONFIRMATION_MODAL_ID);+ openDialog(ROLE_SETTINGS_DELETE_ROLE_CONFIRMATION_MODAL_ID);}}disabled={!isEditable}variant="outline"diff --git a/packages/twenty-front/src/modules/settings/roles/role-settings/components/SettingsRoleSettingsDeleteRoleConfirmationModal.tsx b/packages/twenty-front/src/modules/settings/roles/role-settings/components/SettingsRoleSettingsDeleteRoleConfirmationModal.tsxindex b5d7d133893..b8d51a83318 100644--- a/packages/twenty-front/src/modules/settings/roles/role-settings/components/SettingsRoleSettingsDeleteRoleConfirmationModal.tsx+++ b/packages/twenty-front/src/modules/settings/roles/role-settings/components/SettingsRoleSettingsDeleteRoleConfirmationModal.tsx@@ -1,6 +1,6 @@import { ROLE_SETTINGS_DELETE_ROLE_CONFIRMATION_MODAL_ID } from '@/settings/roles/role-settings/components/constants/RoleSettingsDeleteRoleConfirmationModalId';import { SettingsRoleSettingsDeleteRoleConfirmationModalSubtitle } from '@/settings/roles/role-settings/components/SettingsRoleSettingsDeleteRoleConfirmationModalSubtitle';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';import { t } from '@lingui/core/macro';import { SettingsPath } from 'twenty-shared/types';import { useMutation } from '@apollo/client/react';@@ -26,8 +26,8 @@ export const SettingsRoleSettingsDeleteRoleConfirmationModal = ({};return (- <ConfirmationModal- modalInstanceId={ROLE_SETTINGS_DELETE_ROLE_CONFIRMATION_MODAL_ID}+ <ConfirmationDialog+ dialogId={ROLE_SETTINGS_DELETE_ROLE_CONFIRMATION_MODAL_ID}title={t`Delete Role Permanently`}subtitle={<SettingsRoleSettingsDeleteRoleConfirmationModalSubtitlediff --git a/packages/twenty-front/src/modules/settings/two-factor-authentication/components/DeleteTwoFactorAuthenticationMethod.tsx b/packages/twenty-front/src/modules/settings/two-factor-authentication/components/DeleteTwoFactorAuthenticationMethod.tsxindex 16e3a53d4de..28a84d8871f 100644--- a/packages/twenty-front/src/modules/settings/two-factor-authentication/components/DeleteTwoFactorAuthenticationMethod.tsx+++ b/packages/twenty-front/src/modules/settings/two-factor-authentication/components/DeleteTwoFactorAuthenticationMethod.tsx@@ -2,8 +2,8 @@ import { useAuth } from '@/auth/hooks/useAuth';import { currentUserState } from '@/auth/states/currentUserState';import { useCurrentUserWorkspaceTwoFactorAuthentication } from '@/settings/two-factor-authentication/hooks/useCurrentUserWorkspaceTwoFactorAuthentication';import { useCurrentWorkspaceTwoFactorAuthenticationPolicy } from '@/settings/two-factor-authentication/hooks/useWorkspaceTwoFactorAuthenticationPolicy';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useLoadCurrentUser } from '@/users/hooks/useLoadCurrentUser';import { useMutation } from '@apollo/client/react';@@ -21,7 +21,7 @@ const DELETE_TWO_FACTOR_AUTHENTICATION_MODAL_ID ='delete-two-factor-authentication-modal';export const DeleteTwoFactorAuthentication = () => {const { t } = useLingui();- const { openModal } = useModal();+ const { openDialog } = useDialog();const { enqueueToast } = useToast();const { signOut } = useAuth();@@ -89,15 +89,15 @@ export const DeleteTwoFactorAuthentication = () => {/><Button- onClick={() => openModal(DELETE_TWO_FACTOR_AUTHENTICATION_MODAL_ID)}+ onClick={() => openDialog(DELETE_TWO_FACTOR_AUTHENTICATION_MODAL_ID)}variant="outline"color="danger">{t`Reset 2FA`}</Button>- <ConfirmationModal+ <ConfirmationDialogconfirmationValue={userEmail}confirmationPlaceholder={userEmail ?? ''}- modalInstanceId={DELETE_TWO_FACTOR_AUTHENTICATION_MODAL_ID}+ dialogId={DELETE_TWO_FACTOR_AUTHENTICATION_MODAL_ID}title={t`2FA Method Reset`}subtitle={isTwoFactorAuthenticationEnforced ? (diff --git a/packages/twenty-front/src/modules/settings/types/SettingsCustomizeVideoModalTab.ts b/packages/twenty-front/src/modules/settings/types/SettingsCustomizeVideoModalTab.tsnew file mode 100644index 00000000000..60ab29e90e9--- /dev/null+++ b/packages/twenty-front/src/modules/settings/types/SettingsCustomizeVideoModalTab.ts@@ -0,0 +1,9 @@+import { type IconComponent } from 'twenty-ui/icon';++export type SettingsCustomizeVideoModalTab = {+ id: string;+ title: string;+ Icon: IconComponent;+ vimeoId: string;+ hasSound?: boolean;+};diff --git a/packages/twenty-front/src/modules/side-panel/components/SidePanelForDesktop.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelForDesktop.tsxindex f86470101f2..8a0991ce06f 100644--- a/packages/twenty-front/src/modules/side-panel/components/SidePanelForDesktop.tsx+++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelForDesktop.tsx@@ -12,7 +12,7 @@ import {SIDE_PANEL_WIDTH_VAR,sidePanelWidthState,} from '@/side-panel/states/sidePanelWidthState';-import { ModalContainerContext } from '@/ui/layout/modal/contexts/ModalContainerContext';+import { DialogContainerContext } from '@/ui/layout/dialog/contexts/DialogContainerContext';import { ResizablePanelGap } from '@/ui/layout/resizable-panel/components/ResizablePanelGap';import { ParentClickOutsideIdContext } from '@/ui/utilities/pointer-event/contexts/ParentClickOutsideIdContext';import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';@@ -184,13 +184,15 @@ export const SidePanelForDesktop = () => {><StyledSidePanel isShrinkingFromFullWidth={isShrinkingFromFullWidth}><StyledModalContainer ref={handleModalContainerRef} />- <ModalContainerContext.Provider value={{ container: modalContainer }}>+ <DialogContainerContext.Provider+ value={{ container: modalContainer }}+ ><ParentClickOutsideIdContext.Providervalue={SIDE_PANEL_CLICK_OUTSIDE_ID}>{shouldShowContent && <SidePanelRouter />}</ParentClickOutsideIdContext.Provider>- </ModalContainerContext.Provider>+ </DialogContainerContext.Provider></StyledSidePanel></StyledSidePanelWrapper></>diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/RegularTabSettingsContent.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/RegularTabSettingsContent.tsxindex 71d5f837fb3..286d3b03db3 100644--- a/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/RegularTabSettingsContent.tsx+++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/RegularTabSettingsContent.tsx@@ -4,8 +4,8 @@ import { SidePanelList } from '@/side-panel/components/SidePanelList';import { TabSettingsPlacementSection } from '@/side-panel/pages/page-layout/components/TabSettingsPlacementSection';import { TAB_SETTINGS_SELECTABLE_ITEM_IDS } from '@/side-panel/pages/page-layout/constants/settings/TabSettingsSelectableItemIds';import { getTabSettingsPlacementItems } from '@/side-panel/pages/page-layout/utils/getTabSettingsPlacementItems';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem';import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { useLingui } from '@lingui/react/macro';@@ -48,13 +48,13 @@ export const RegularTabSettingsContent = ({onDelete,}: RegularTabSettingsContentProps) => {const { t } = useLingui();- const { openModal } = useModal();+ const { openDialog } = useDialog();const handleResetToDefault = () => {if (isResetToDefaultDisabled) {return;}- openModal(RESET_TAB_TO_DEFAULT_MODAL_ID);+ openDialog(RESET_TAB_TO_DEFAULT_MODAL_ID);};const placementItems = getTabSettingsPlacementItems({@@ -128,8 +128,8 @@ export const RegularTabSettingsContent = ({)}</SidePanelGroup></SidePanelList>- <ConfirmationModal- modalInstanceId={RESET_TAB_TO_DEFAULT_MODAL_ID}+ <ConfirmationDialog+ dialogId={RESET_TAB_TO_DEFAULT_MODAL_ID}title={t`Reset to default`}subtitle={t`This will cancel all modifications done on the tab and its widgets. Edit mode will be canceled and the page will refresh. This action cannot be undone.`}onConfirmClick={onResetToDefault}diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/SingleWidgetTabSettingsContent.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/SingleWidgetTabSettingsContent.tsxindex 047bd1c6fee..86170cae711 100644--- a/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/SingleWidgetTabSettingsContent.tsx+++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/SingleWidgetTabSettingsContent.tsx@@ -9,8 +9,8 @@ import { TAB_SETTINGS_SELECTABLE_ITEM_IDS } from '@/side-panel/pages/page-layoutimport { useTranslatedVisibilityLabel } from '@/side-panel/pages/page-layout/hooks/useTranslatedVisibilityLabel';import { getTabSettingsPlacementItems } from '@/side-panel/pages/page-layout/utils/getTabSettingsPlacementItems';import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem';import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { useLingui } from '@lingui/react/macro';@@ -56,7 +56,7 @@ export const SingleWidgetTabSettingsContent = ({onDelete,}: SingleWidgetTabSettingsContentProps) => {const { t } = useLingui();- const { openModal } = useModal();+ const { openDialog } = useDialog();const visibilityLabel = useTranslatedVisibilityLabel(singleWidget.conditionalAvailabilityExpression,@@ -66,7 +66,7 @@ export const SingleWidgetTabSettingsContent = ({if (isResetToDefaultDisabled) {return;}- openModal(RESET_TAB_TO_DEFAULT_MODAL_ID);+ openDialog(RESET_TAB_TO_DEFAULT_MODAL_ID);};const placementItems = getTabSettingsPlacementItems({@@ -155,8 +155,8 @@ export const SingleWidgetTabSettingsContent = ({)}</SidePanelGroup></SidePanelList>- <ConfirmationModal- modalInstanceId={RESET_TAB_TO_DEFAULT_MODAL_ID}+ <ConfirmationDialog+ dialogId={RESET_TAB_TO_DEFAULT_MODAL_ID}title={t`Reset to default`}subtitle={t`This will cancel all modifications done on the tab and its widgets. Edit mode will be canceled and the page will refresh. This action cannot be undone.`}onConfirmClick={onResetToDefault}diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/WidgetSettingsManageSection.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/WidgetSettingsManageSection.tsxindex e2acedd2825..7fbe7f2f215 100644--- a/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/WidgetSettingsManageSection.tsx+++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/WidgetSettingsManageSection.tsx@@ -11,8 +11,8 @@ import { useOpenReplaceWidgetPicker } from '@/side-panel/pages/page-layout/hooksimport { useTranslatedVisibilityLabel } from '@/side-panel/pages/page-layout/hooks/useTranslatedVisibilityLabel';import { useWidgetInEditMode } from '@/side-panel/pages/page-layout/hooks/useWidgetInEditMode';import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem';import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';@@ -57,7 +57,7 @@ export const WidgetSettingsManageSection = ({const { openReplaceWidgetPicker } = useOpenReplaceWidgetPicker(pageLayoutId);- const { openModal } = useModal();+ const { openDialog } = useDialog();const visibilityLabel = useTranslatedVisibilityLabel(widgetInEditMode?.conditionalAvailabilityExpression,@@ -76,7 +76,7 @@ export const WidgetSettingsManageSection = ({if (isResetToDefaultDisabled) {return;}- openModal(RESET_WIDGET_TO_DEFAULT_MODAL_ID);+ openDialog(RESET_WIDGET_TO_DEFAULT_MODAL_ID);};const handleConfirmReset = () => {@@ -156,8 +156,8 @@ export const WidgetSettingsManageSection = ({/></SelectableListItem></SidePanelGroup>- <ConfirmationModal- modalInstanceId={RESET_WIDGET_TO_DEFAULT_MODAL_ID}+ <ConfirmationDialog+ dialogId={RESET_WIDGET_TO_DEFAULT_MODAL_ID}title={t`Reset to default`}subtitle={t`This will cancel all modifications done on the widget. This action cannot be undone.`}onConfirmClick={handleConfirmReset}diff --git a/packages/twenty-front/src/modules/spreadsheet-import/components/SpreadSheetImportModalWrapper.tsx b/packages/twenty-front/src/modules/spreadsheet-import/components/SpreadSheetImportModalWrapper.tsxindex 3f6e688aaeb..7f0c1330214 100644--- a/packages/twenty-front/src/modules/spreadsheet-import/components/SpreadSheetImportModalWrapper.tsx+++ b/packages/twenty-front/src/modules/spreadsheet-import/components/SpreadSheetImportModalWrapper.tsx@@ -1,8 +1,10 @@+import { t } from '@lingui/core/macro';+import { Dialog } from 'twenty-ui/primitives/surfaces';+import { DialogInstance } from '@/ui/layout/dialog/components/DialogInstance';import { styled } from '@linaria/react';import { useSpreadsheetImportInternal } from '@/spreadsheet-import/hooks/useSpreadsheetImportInternal';-import { ModalStatefulWrapper } from '@/ui/layout/modal/components/ModalStatefulWrapper';import { MOBILE_VIEWPORT } from 'twenty-ui/theme-constants';import { SpreadSheetImportModalCloseButton } from './SpreadSheetImportModalCloseButton';@@ -41,20 +43,27 @@ export const SpreadSheetImportModalWrapper = ({const { rtl } = useSpreadsheetImportInternal();return (- <ModalStatefulWrapper- size="extraLarge"- padding="none"- modalInstanceId={modalInstanceId}- isClosable={true}+ <DialogInstance+ dialogId={modalInstanceId}+ dismissible={true}onClose={onClose}- shouldCloseModalOnClickOutsideOrEscape={false}+ closeOnDismiss={false}>- <StyledInnerContainer>- <StyledRtlLtr dir={rtl ? 'rtl' : 'ltr'}>- <SpreadSheetImportModalCloseButton onClose={onClose} />- {children}- </StyledRtlLtr>- </StyledInnerContainer>- </ModalStatefulWrapper>+ {({ container, backdrop, viewportProps, onKeyDown }) => (+ <Dialog.Popup+ aria-label={t`Import data`}+ {...{ container, backdrop, viewportProps, onKeyDown }}+ size="xl"+ style={{ padding: 0, height: 'var(--t-modal-size-xl-height)' }}+ >+ <StyledInnerContainer>+ <StyledRtlLtr dir={rtl ? 'rtl' : 'ltr'}>+ <SpreadSheetImportModalCloseButton onClose={onClose} />+ {children}+ </StyledRtlLtr>+ </StyledInnerContainer>+ </Dialog.Popup>+ )}+ </DialogInstance>);};diff --git a/packages/twenty-front/src/modules/spreadsheet-import/components/StepNavigationButton.tsx b/packages/twenty-front/src/modules/spreadsheet-import/components/StepNavigationButton.tsxindex c943649a95d..017ea75cc36 100644--- a/packages/twenty-front/src/modules/spreadsheet-import/components/StepNavigationButton.tsx+++ b/packages/twenty-front/src/modules/spreadsheet-import/components/StepNavigationButton.tsx@@ -1,10 +1,10 @@+import { Dialog } from 'twenty-ui/primitives/surfaces';import { styled } from '@linaria/react';import { MainButton } from 'twenty-ui/components';import { themeCssVariables } from 'twenty-ui/theme-constants';import { t } from '@lingui/core/macro';import { CircularProgressBar } from 'twenty-ui/primitives/feedback';-import { ModalFooter } from 'twenty-ui/primitives/surfaces';import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';const StyledFooterContainer = styled.div`@@ -34,7 +34,7 @@ export const StepNavigationButton = ({}: StepNavigationButtonProps) => {return (<StyledFooterContainer>- <ModalFooter autoHeight>+ <Dialog.Footer style={{ padding: 'var(--t-spacing-5)' }}>{!isUndefinedOrNull(onBack) && (<MainButtonstartIcon={isLoading ? <CircularProgressBar /> : undefined}@@ -53,7 +53,7 @@ export const StepNavigationButton = ({{continueTitle}</MainButton>)}- </ModalFooter>+ </Dialog.Footer></StyledFooterContainer>);};diff --git a/packages/twenty-front/src/modules/spreadsheet-import/hooks/useOpenSpreadsheetImportDialog.ts b/packages/twenty-front/src/modules/spreadsheet-import/hooks/useOpenSpreadsheetImportDialog.tsindex 9acf9e5133c..4b48202e7b9 100644--- a/packages/twenty-front/src/modules/spreadsheet-import/hooks/useOpenSpreadsheetImportDialog.ts+++ b/packages/twenty-front/src/modules/spreadsheet-import/hooks/useOpenSpreadsheetImportDialog.ts@@ -1,7 +1,7 @@import { SPREADSHEET_IMPORT_MODAL_ID } from '@/spreadsheet-import/constants/SpreadsheetImportModalId';import { spreadsheetImportDialogState } from '@/spreadsheet-import/states/spreadsheetImportDialogState';import { type SpreadsheetImportDialogOptions } from '@/spreadsheet-import/types';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';export const useOpenSpreadsheetImportDialog = () => {@@ -9,12 +9,12 @@ export const useOpenSpreadsheetImportDialog = () => {spreadsheetImportDialogState,);- const { openModal } = useModal();+ const { openDialog } = useDialog();const openSpreadsheetImportDialog = (options: Omit<SpreadsheetImportDialogOptions, 'isOpen' | 'onClose'>,) => {- openModal(SPREADSHEET_IMPORT_MODAL_ID);+ openDialog(SPREADSHEET_IMPORT_MODAL_ID);setSpreadsheetImportDialog({isOpen: true,isStepBarVisible: true,diff --git a/packages/twenty-front/src/modules/spreadsheet-import/provider/components/SpreadsheetImportProvider.tsx b/packages/twenty-front/src/modules/spreadsheet-import/provider/components/SpreadsheetImportProvider.tsxindex 834e07257b2..0b243089804 100644--- a/packages/twenty-front/src/modules/spreadsheet-import/provider/components/SpreadsheetImportProvider.tsx+++ b/packages/twenty-front/src/modules/spreadsheet-import/provider/components/SpreadsheetImportProvider.tsx@@ -6,7 +6,7 @@ import { SKELETON_LOADER_HEIGHT_SIZES } from '@/activities/components/SkeletonLoimport { SPREADSHEET_IMPORT_MODAL_ID } from '@/spreadsheet-import/constants/SpreadsheetImportModalId';import { spreadsheetImportDialogState } from '@/spreadsheet-import/states/spreadsheetImportDialogState';import { matchColumnsState } from '@/spreadsheet-import/steps/components/MatchColumnsStep/components/states/initialComputedColumnsState';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';@@ -40,7 +40,7 @@ export const SpreadsheetImportProvider = (const setMatchColumns = useSetAtomState(matchColumnsState);- const { closeModal } = useModal();+ const { closeDialog } = useDialog();const handleClose = () => {spreadsheetImportDialog.options?.onAbortSubmit?.();@@ -50,7 +50,7 @@ export const SpreadsheetImportProvider = (options: null,});- closeModal(SPREADSHEET_IMPORT_MODAL_ID);+ closeDialog(SPREADSHEET_IMPORT_MODAL_ID);setMatchColumns([]);};diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/ImportDataStep.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/ImportDataStep.tsxindex a899fd5091a..e63edea8aa3 100644--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/ImportDataStep.tsx+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/ImportDataStep.tsx@@ -1,9 +1,9 @@+import { Dialog } from 'twenty-ui/primitives/surfaces';import { useNumberFormat } from '@/localization/hooks/useNumberFormat';import { StepNavigationButton } from '@/spreadsheet-import/components/StepNavigationButton';import { useSpreadsheetImportInternal } from '@/spreadsheet-import/hooks/useSpreadsheetImportInternal';import { spreadsheetImportCreatedRecordsProgressState } from '@/spreadsheet-import/states/spreadsheetImportCreatedRecordsProgressState';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';-import { ModalContent } from 'twenty-ui/primitives/surfaces';import { styled } from '@linaria/react';import { themeCssVariables } from 'twenty-ui/theme-constants';import { t } from '@lingui/core/macro';@@ -43,11 +43,20 @@ export const ImportDataStep = ({return (<>- <ModalContent noPadding isVerticallyCentered isHorizontallyCentered>+ <Dialog.Body+ style={{+ display: 'flex',+ flex: '1 1 0%',+ flexDirection: 'column',+ padding: 0,+ alignItems: 'center',+ justifyContent: 'center',+ }}+ ><StyledHeader>{t`Importing Data ...`}</StyledHeader><StyledDescription>{t`${formattedCreatedRecordsProgress} out of ${formattedRecordsToImportCount} records imported.`}</StyledDescription><Loader />- </ModalContent>+ </Dialog.Body><StepNavigationButton onBack={onClose} backTitle={t`Cancel`} /></>);diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/MatchColumnsStep.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/MatchColumnsStep.tsxindex 4679ea41a58..d47acecee39 100644--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/MatchColumnsStep.tsx+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/MatchColumnsStep.tsx@@ -1,3 +1,4 @@+import { Dialog } from 'twenty-ui/primitives/surfaces';import { styled } from '@linaria/react';import { useCallback, useMemo, useState } from 'react';@@ -14,8 +15,6 @@ import { setIgnoreColumn } from '@/spreadsheet-import/utils/setIgnoreColumn';import { setSubColumn } from '@/spreadsheet-import/utils/setSubColumn';import { useDialogManager } from '@/ui/feedback/dialog-manager/hooks/useDialogManager';-import { ModalContent } from 'twenty-ui/primitives/surfaces';-import { DO_NOT_IMPORT_OPTION_KEY } from '@/spreadsheet-import/constants/DoNotImportOptionKey';import { ColumnGrid } from '@/spreadsheet-import/steps/components/MatchColumnsStep/components/ColumnGrid';import { TemplateColumn } from '@/spreadsheet-import/steps/components/MatchColumnsStep/components/TemplateColumn';@@ -272,7 +271,15 @@ export const MatchColumnsStep = ({return (<>- <ModalContent noPadding isVerticallyCentered>+ <Dialog.Body+ style={{+ display: 'flex',+ flex: '1 1 0%',+ flexDirection: 'column',+ padding: 0,+ alignItems: 'center',+ }}+ ><ScrollWrapper componentInstanceId="scroll-wrapper-modal-content"><ColumnGridcolumns={columns}@@ -300,7 +307,7 @@ export const MatchColumnsStep = ({)}/></ScrollWrapper>- </ModalContent>+ </Dialog.Body><StepNavigationButtononContinue={handleOnContinue}isLoading={isLoading}diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SelectHeaderStep/SelectHeaderStep.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SelectHeaderStep/SelectHeaderStep.tsxindex 33453b6bf8d..c5aedd56583 100644--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SelectHeaderStep/SelectHeaderStep.tsx+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SelectHeaderStep/SelectHeaderStep.tsx@@ -1,3 +1,4 @@+import { Dialog } from 'twenty-ui/primitives/surfaces';import { styled } from '@linaria/react';import { themeCssVariables } from 'twenty-ui/theme-constants';import { useCallback, useState } from 'react';@@ -6,8 +7,6 @@ import { Heading } from '@/spreadsheet-import/components/Heading';import { StepNavigationButton } from '@/spreadsheet-import/components/StepNavigationButton';import { type ImportedRow } from '@/spreadsheet-import/types';-import { ModalContent } from 'twenty-ui/primitives/surfaces';-import { useComputeColumnSuggestionsAndAutoMatch } from '@/spreadsheet-import/hooks/useComputeColumnSuggestionsAndAutoMatch';import { useSpreadsheetImportInternal } from '@/spreadsheet-import/hooks/useSpreadsheetImportInternal';import { type SpreadsheetImportStep } from '@/spreadsheet-import/steps/types/SpreadsheetImportStep';@@ -101,7 +100,14 @@ export const SelectHeaderStep = ({return (<>- <ModalContent>+ <Dialog.Body+ style={{+ display: 'flex',+ flex: '1 1 0%',+ flexDirection: 'column',+ padding: 'var(--t-spacing-10)',+ }}+ ><StyledHeadingContainer><Heading title={t`Select header row`} /></StyledHeadingContainer>@@ -112,7 +118,7 @@ export const SelectHeaderStep = ({onSelectedRowChange={setSelectedRowIndex}/></StyledTableContainer>- </ModalContent>+ </Dialog.Body><StepNavigationButtononContinue={handleOnContinue}onBack={onBack}diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SelectSheetStep/SelectSheetStep.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SelectSheetStep/SelectSheetStep.tsxindex 4addb0fbc35..75b8a5cb79b 100644--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SelectSheetStep/SelectSheetStep.tsx+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SelectSheetStep/SelectSheetStep.tsx@@ -1,3 +1,4 @@+import { Dialog } from 'twenty-ui/primitives/surfaces';import { styled } from '@linaria/react';import { useCallback, useState } from 'react';@@ -9,7 +10,6 @@ import { SpreadsheetImportStepType } from '@/spreadsheet-import/steps/types/Spreimport { exceedsMaxRecords } from '@/spreadsheet-import/utils/exceedsMaxRecords';import { mapWorkbook } from '@/spreadsheet-import/utils/mapWorkbook';-import { ModalContent } from 'twenty-ui/primitives/surfaces';import { useLingui } from '@lingui/react/macro';import { Radio, RadioGroup } from 'twenty-ui/primitives/input';import { themeCssVariables } from 'twenty-ui/theme-constants';@@ -99,7 +99,17 @@ export const SelectSheetStep = ({return (<>- <ModalContent isVerticallyCentered isHorizontallyCentered gap={8}>+ <Dialog.Body+ style={{+ display: 'flex',+ flex: '1 1 0%',+ flexDirection: 'column',+ padding: 'var(--t-spacing-10)',+ alignItems: 'center',+ justifyContent: 'center',+ gap: 'var(--t-spacing-8)',+ }}+ ><Heading title={t`Select the sheet to use`} /><RadioGrouprender={<StyledRadioContainer />}@@ -113,7 +123,7 @@ export const SelectSheetStep = ({</StyledRadioItemContainer>))}</RadioGroup>- </ModalContent>+ </Dialog.Body><StepNavigationButtononContinue={() => handleOnContinue(value)}onBack={onBack}diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SpreadsheetImportStepper.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SpreadsheetImportStepper.tsxindex 0c20880fe80..ce1a8daac47 100644--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SpreadsheetImportStepper.tsx+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SpreadsheetImportStepper.tsx@@ -1,10 +1,10 @@+import { Dialog } from 'twenty-ui/primitives/surfaces';import { useSpreadsheetImportInternal } from '@/spreadsheet-import/hooks/useSpreadsheetImportInternal';import { ImportDataStep } from '@/spreadsheet-import/steps/components/ImportDataStep';import { type SpreadsheetImportStep } from '@/spreadsheet-import/steps/types/SpreadsheetImportStep';import { SpreadsheetImportStepType } from '@/spreadsheet-import/steps/types/SpreadsheetImportStepType';import { useCallback, useContext, useState } from 'react';import { CircularProgressBar, useToast } from 'twenty-ui/primitives/feedback';-import { ModalContent } from 'twenty-ui/primitives/surfaces';import { ThemeContext } from 'twenty-ui/theme-constants';import { MatchColumnsStep } from './MatchColumnsStep/MatchColumnsStep';import { SelectHeaderStep } from './SelectHeaderStep/SelectHeaderStep';@@ -124,13 +124,22 @@ export const SpreadsheetImportStepper = ({case SpreadsheetImportStepType.loading:default:return (- <ModalContent isVerticallyCentered isHorizontallyCentered>+ <Dialog.Body+ style={{+ display: 'flex',+ flex: '1 1 0%',+ flexDirection: 'column',+ padding: 'var(--t-spacing-10)',+ alignItems: 'center',+ justifyContent: 'center',+ }}+ ><CircularProgressBarsize={80}barWidth={8}barColor={theme.font.color.primary}/>- </ModalContent>+ </Dialog.Body>);}};diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SpreadsheetImportStepperContainer.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SpreadsheetImportStepperContainer.tsxindex 37adeb8203a..6f2a1314b98 100644--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SpreadsheetImportStepperContainer.tsx+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SpreadsheetImportStepperContainer.tsx@@ -1,3 +1,5 @@+import { styled } from '@linaria/react';+import { Dialog } from 'twenty-ui/primitives/surfaces';import { useSpreadsheetImportInitialStep } from '@/spreadsheet-import/hooks/useSpreadsheetImportInitialStep';import { useSpreadsheetImportInternal } from '@/spreadsheet-import/hooks/useSpreadsheetImportInternal';@@ -7,10 +9,22 @@ import { useStepBar } from '@/ui/navigation/step-bar/hooks/useStepBar';import { spreadsheetImportDialogState } from '@/spreadsheet-import/states/spreadsheetImportDialogState';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useLingui } from '@lingui/react/macro';-import { themeCssVariables } from 'twenty-ui/theme-constants';-import { ModalHeader } from 'twenty-ui/primitives/surfaces';+import { MOBILE_VIEWPORT, themeCssVariables } from 'twenty-ui/theme-constants';import { SpreadsheetImportStepper } from './SpreadsheetImportStepper';+const StyledImportHeader = styled(Dialog.Header)`+ align-items: center;+ background: ${themeCssVariables.background.secondary};+ border-bottom: 1px solid ${themeCssVariables.border.color.medium};+ flex-direction: row;+ height: 60px;+ padding: 0 ${themeCssVariables.spacing[30]};++ @media (max-width: ${MOBILE_VIEWPORT}px) {+ padding-inline: ${themeCssVariables.spacing[4]};+ }+`;+export const SpreadsheetImportStepperContainer = () => {const { t } = useLingui();@@ -36,11 +50,7 @@ export const SpreadsheetImportStepperContainer = () => {return (<>- <ModalHeader- hasBorderBottom- paddingHorizontal={30}- backgroundColor={themeCssVariables.background.secondary}- >+ <StyledImportHeader>{spreadsheetImportDialog.isStepBarVisible && (<StepBar activeStep={activeStep}>{steps.map((key) => (@@ -52,7 +62,7 @@ export const SpreadsheetImportStepperContainer = () => {))}</StepBar>)}- </ModalHeader>+ </StyledImportHeader><SpreadsheetImportStepper nextStep={nextStep} prevStep={prevStep} /></>);diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/UploadStep/UploadStep.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/UploadStep/UploadStep.tsxindex 1ee5ac63de5..4511ffe0da4 100644--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/UploadStep/UploadStep.tsx+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/UploadStep/UploadStep.tsx@@ -1,9 +1,8 @@+import { Dialog } from 'twenty-ui/primitives/surfaces';import { t } from '@lingui/core/macro';import { useCallback, useState } from 'react';import { type WorkBook } from 'xlsx-ugnis';-import { ModalContent } from 'twenty-ui/primitives/surfaces';-import { useComputeColumnSuggestionsAndAutoMatch } from '@/spreadsheet-import/hooks/useComputeColumnSuggestionsAndAutoMatch';import { useSpreadsheetImportInternal } from '@/spreadsheet-import/hooks/useSpreadsheetImportInternal';import { type SpreadsheetImportStep } from '@/spreadsheet-import/steps/types/SpreadsheetImportStep';@@ -111,8 +110,15 @@ export const UploadStep = ({);return (- <ModalContent contentPadding={6}>+ <Dialog.Body+ style={{+ display: 'flex',+ flex: '1 1 0%',+ flexDirection: 'column',+ padding: 'var(--t-spacing-6)',+ }}+ ><DropZone onContinue={handleOnContinue} isLoading={isLoading} />- </ModalContent>+ </Dialog.Body>);};diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/ValidationStep/ValidationStep.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/ValidationStep/ValidationStep.tsxindex 94f8d04db40..7323552fc02 100644--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/ValidationStep/ValidationStep.tsx+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/ValidationStep/ValidationStep.tsx@@ -1,3 +1,4 @@+import { Dialog } from 'twenty-ui/primitives/surfaces';import { SpreadsheetImportTable } from '@/spreadsheet-import/components/SpreadsheetImportTable';import { StepNavigationButton } from '@/spreadsheet-import/components/StepNavigationButton';import { useHideStepBar } from '@/spreadsheet-import/hooks/useHideStepBar';@@ -21,7 +22,6 @@ import {useMemo,useState,} from 'react';-import { ModalContent } from 'twenty-ui/primitives/surfaces';import { themeCssVariables } from 'twenty-ui/theme-constants';import { type RowsChangeData } from 'react-data-grid';import { isDefined } from 'twenty-shared/utils';@@ -288,7 +288,14 @@ export const ValidationStep = ({return (<>- <ModalContent noPadding>+ <Dialog.Body+ style={{+ display: 'flex',+ flex: '1 1 0%',+ flexDirection: 'column',+ padding: 0,+ }}+ ><StyledContentWrapper>{filterByErrors && tableData.length === 0 ? (<StyledNoRowsWithErrorsContainer>@@ -337,7 +344,7 @@ export const ValidationStep = ({</StyledButtonContainer></StyledToolbar></StyledContentWrapper>- </ModalContent>+ </Dialog.Body><StepNavigationButtononContinue={onContinue}onBack={onBack}diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/__stories__/SelectHeader.stories.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/__stories__/SelectHeader.stories.tsxindex a2b310e44a4..7686d765352 100644--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/__stories__/SelectHeader.stories.tsx+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/__stories__/SelectHeader.stories.tsx@@ -9,7 +9,7 @@ import { SpreadSheetImportModalWrapper } from '@/spreadsheet-import/components/Simport { SelectHeaderStep } from '@/spreadsheet-import/steps/components/SelectHeaderStep/SelectHeaderStep';import { SpreadsheetImportStepType } from '@/spreadsheet-import/steps/types/SpreadsheetImportStepType';import { DialogComponentInstanceContext } from '@/ui/feedback/dialog-manager/contexts/DialogComponentInstanceContext';-import { isModalOpenedComponentState } from '@/ui/layout/modal/states/isModalOpenedComponentState';+import { isDialogOpenedComponentState } from '@/ui/layout/dialog/states/isDialogOpenedComponentState';import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';import { Provider as JotaiProvider } from 'jotai';@@ -22,7 +22,7 @@ const meta: Meta<typeof SelectHeaderStep> = {decorators: [(Story) => {jotaiStore.set(- isModalOpenedComponentState.atomFamily({+ isDialogOpenedComponentState.atomFamily({instanceId: 'select-header-step',}),true,diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/__stories__/SelectSheet.stories.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/__stories__/SelectSheet.stories.tsxindex 7f8b11c50f7..8c6b50fafbd 100644--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/__stories__/SelectSheet.stories.tsx+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/__stories__/SelectSheet.stories.tsx@@ -6,7 +6,7 @@ import { SpreadSheetImportModalWrapper } from '@/spreadsheet-import/components/Simport { SelectSheetStep } from '@/spreadsheet-import/steps/components/SelectSheetStep/SelectSheetStep';import { SpreadsheetImportStepType } from '@/spreadsheet-import/steps/types/SpreadsheetImportStepType';import { DialogComponentInstanceContext } from '@/ui/feedback/dialog-manager/contexts/DialogComponentInstanceContext';-import { isModalOpenedComponentState } from '@/ui/layout/modal/states/isModalOpenedComponentState';+import { isDialogOpenedComponentState } from '@/ui/layout/dialog/states/isDialogOpenedComponentState';import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';import { Provider as JotaiProvider } from 'jotai';@@ -19,7 +19,7 @@ const meta: Meta<typeof SelectSheetStep> = {decorators: [(Story) => {jotaiStore.set(- isModalOpenedComponentState.atomFamily({+ isDialogOpenedComponentState.atomFamily({instanceId: 'select-sheet-step',}),true,diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/__stories__/Upload.stories.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/__stories__/Upload.stories.tsxindex 528b44a905f..8130e1228cd 100644--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/__stories__/Upload.stories.tsx+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/__stories__/Upload.stories.tsx@@ -6,7 +6,7 @@ import { SpreadSheetImportModalWrapper } from '@/spreadsheet-import/components/Simport { UploadStep } from '@/spreadsheet-import/steps/components/UploadStep/UploadStep';import { SpreadsheetImportStepType } from '@/spreadsheet-import/steps/types/SpreadsheetImportStepType';import { DialogComponentInstanceContext } from '@/ui/feedback/dialog-manager/contexts/DialogComponentInstanceContext';-import { isModalOpenedComponentState } from '@/ui/layout/modal/states/isModalOpenedComponentState';+import { isDialogOpenedComponentState } from '@/ui/layout/dialog/states/isDialogOpenedComponentState';import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';import { Provider as JotaiProvider } from 'jotai';import { ContextStoreDecorator } from '~/testing/decorators/ContextStoreDecorator';@@ -24,7 +24,7 @@ const meta: Meta<typeof UploadStep> = {ContextStoreDecorator,(Story) => {jotaiStore.set(- isModalOpenedComponentState.atomFamily({+ isDialogOpenedComponentState.atomFamily({instanceId: 'upload-step',}),true,diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/__stories__/Validation.stories.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/__stories__/Validation.stories.tsxindex 815287dac9c..3d9a757666d 100644--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/__stories__/Validation.stories.tsx+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/__stories__/Validation.stories.tsx@@ -9,7 +9,7 @@ import { ReactSpreadsheetImportContextProvider } from '@/spreadsheet-import/compimport { SpreadSheetImportModalWrapper } from '@/spreadsheet-import/components/SpreadSheetImportModalWrapper';import { ValidationStep } from '@/spreadsheet-import/steps/components/ValidationStep/ValidationStep';import { DialogComponentInstanceContext } from '@/ui/feedback/dialog-manager/contexts/DialogComponentInstanceContext';-import { isModalOpenedComponentState } from '@/ui/layout/modal/states/isModalOpenedComponentState';+import { isDialogOpenedComponentState } from '@/ui/layout/dialog/states/isDialogOpenedComponentState';import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';import { Provider as JotaiProvider } from 'jotai';@@ -22,7 +22,7 @@ const meta: Meta<typeof ValidationStep> = {decorators: [(Story) => {jotaiStore.set(- isModalOpenedComponentState.atomFamily({+ isDialogOpenedComponentState.atomFamily({instanceId: 'validation-step',}),true,diff --git a/packages/twenty-front/src/modules/ui/field/display/components/GlobalFilePreviewModal.tsx b/packages/twenty-front/src/modules/ui/field/display/components/GlobalFilePreviewModal.tsxindex 240e441079c..409177f0b1d 100644--- a/packages/twenty-front/src/modules/ui/field/display/components/GlobalFilePreviewModal.tsx+++ b/packages/twenty-front/src/modules/ui/field/display/components/GlobalFilePreviewModal.tsx@@ -1,13 +1,13 @@+import { Dialog } from 'twenty-ui/primitives/surfaces';+import { DialogInstance } from '@/ui/layout/dialog/components/DialogInstance';import { downloadFile } from '@/activities/files/utils/downloadFile';import { filePreviewState } from '@/ui/field/display/states/filePreviewState';-import { ModalStatefulWrapper } from '@/ui/layout/modal/components/ModalStatefulWrapper';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';import { ScrollWrapper } from '@/ui/utilities/scroll/components/ScrollWrapper';import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';import { type JSX, lazy, Suspense, useEffect } from 'react';-import { createPortal } from 'react-dom';import { isDefined } from 'twenty-shared/utils';import { IconDownload, IconX } from 'twenty-ui/icon';import { IconButton } from 'twenty-ui/components';@@ -75,16 +75,16 @@ const StyledLoadingText = styled.div`export const GlobalFilePreviewModal = (): JSX.Element | null => {const { t } = useLingui();const [filePreview, setFilePreview] = useAtomState(filePreviewState);- const { openModal, closeModal } = useModal();+ const { openDialog, closeDialog } = useDialog();useEffect(() => {if (isDefined(filePreview)) {- openModal(GLOBAL_FILE_PREVIEW_MODAL_ID);+ openDialog(GLOBAL_FILE_PREVIEW_MODAL_ID);}- }, [filePreview, openModal]);+ }, [filePreview, openDialog]);const handleClose = () => {- closeModal(GLOBAL_FILE_PREVIEW_MODAL_ID);+ closeDialog(GLOBAL_FILE_PREVIEW_MODAL_ID);setFilePreview(null);};@@ -98,14 +98,18 @@ export const GlobalFilePreviewModal = (): JSX.Element | null => {}return (- <>- {createPortal(- <ModalStatefulWrapper- modalInstanceId={GLOBAL_FILE_PREVIEW_MODAL_ID}- size="large"- isClosable- onClose={handleClose}- renderInDocumentBody+ <DialogInstance+ dialogId={GLOBAL_FILE_PREVIEW_MODAL_ID}+ dismissible+ onClose={handleClose}+ renderInDocumentBody+ >+ {({ container, backdrop, viewportProps, onKeyDown }) => (+ <Dialog.Popup+ aria-label={filePreview.label ?? t`File preview`}+ {...{ container, backdrop, viewportProps, onKeyDown }}+ size="lg"+ style={{ padding: 'var(--t-spacing-4)' }}><StyledModalHeader><StyledHeader>@@ -149,9 +153,8 @@ export const GlobalFilePreviewModal = (): JSX.Element | null => {</Suspense></StyledModalContent></ScrollWrapper>- </ModalStatefulWrapper>,- document.body,+ </Dialog.Popup>)}- </>+ </DialogInstance>);};diff --git a/packages/twenty-front/src/modules/ui/layout/dialog/components/ConfirmationDialog.tsx b/packages/twenty-front/src/modules/ui/layout/dialog/components/ConfirmationDialog.tsxnew file mode 100644index 00000000000..9127b67bb32--- /dev/null+++ b/packages/twenty-front/src/modules/ui/layout/dialog/components/ConfirmationDialog.tsx@@ -0,0 +1,146 @@+import { Button } from 'twenty-ui/primitives/input';+import { DialogInstance } from '@/ui/layout/dialog/components/DialogInstance';+import { type ConfirmationDialogProps } from '@/ui/layout/dialog/types/ConfirmationDialogProps';+import { styled } from '@linaria/react';+import { isNonEmptyString } from '@sniptt/guards';+import { useState } from 'react';++import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';++import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';+import { msg } from '@lingui/core/macro';+import { useLingui } from '@lingui/react/macro';+import { Section } from 'twenty-ui/components';+import { Dialog } from 'twenty-ui/primitives/surfaces';+import { themeCssVariables } from 'twenty-ui/theme-constants';++const StyledCenteredButton = styled(Button)`+ box-sizing: border-box;+ margin-top: ${themeCssVariables.spacing[2]};+`;++const StyledDescription = styled(Dialog.Description)`+ && {+ color: inherit;+ font-size: inherit;+ line-height: inherit;+ margin-bottom: ${themeCssVariables.spacing[6]};+ }+`;++const defaultConfirmButtonText = msg`Confirm`;++export const ConfirmationDialog = ({+ dialogId,+ title,+ loading,+ subtitle,+ onConfirmClick,+ onClose,+ confirmButtonText,+ confirmationValue,+ confirmationPlaceholder,+ confirmButtonColor = 'danger',+ AdditionalButtons,+ hideCancelButton = false,+}: ConfirmationDialogProps) => {+ const { i18n, t } = useLingui();+ const translatedConfirmButtonText =+ confirmButtonText ?? i18n._(defaultConfirmButtonText);+ const [inputConfirmationValue, setInputConfirmationValue] =+ useState<string>('');++ const isValidValue =+ !isNonEmptyString(confirmationValue) ||+ inputConfirmationValue === confirmationValue;++ const { closeDialog } = useDialog();++ const handleClose = () => {+ setInputConfirmationValue('');+ closeDialog(dialogId);+ };++ const handleConfirmClick = () => {+ handleClose();+ onConfirmClick();+ };++ const handleCancelClick = () => {+ handleClose();+ onClose?.();+ };++ const handleEnter = () => {+ if (isValidValue && !loading) {+ handleConfirmClick();+ }+ };++ return (+ <DialogInstance+ dialogId={dialogId}+ dismissible={true}+ onClose={() => {+ setInputConfirmationValue('');+ onClose?.();+ }}+ onEnter={handleEnter}+ renderInDocumentBody+ >+ {({ container, backdrop, viewportProps, onKeyDown }) => (+ <Dialog.Popup+ {...{ container, backdrop, viewportProps, onKeyDown }}+ data-globally-prevent-click-outside+ style={{+ padding: 'var(--t-spacing-6)',+ borderRadius: 'var(--t-spacing-1)',+ width: 'calc(400px - var(--t-spacing-32))',+ }}+ >+ <Dialog.Title>{title}</Dialog.Title>+ <StyledDescription render={<div />}>+ <Section.Root align="center" color="primary">+ {subtitle}+ </Section.Root>+ </StyledDescription>+ {isNonEmptyString(confirmationValue) && (+ <Section.Root>+ <SettingsTextInput+ instanceId="confirmation-modal-input"+ dataTestId="confirmation-modal-input"+ value={inputConfirmationValue}+ onChange={setInputConfirmationValue}+ placeholder={confirmationPlaceholder}+ fullWidth+ disableHotkeys+ key={'input-' + confirmationValue}+ />+ </Section.Root>+ )}+ {!hideCancelButton && (+ <StyledCenteredButton+ onClick={handleCancelClick}+ fullWidth+ data-testid="confirmation-modal-cancel-button"+ variant="outline"+ >{t`Cancel`}</StyledCenteredButton>+ )}++ {AdditionalButtons}++ <StyledCenteredButton+ onClick={handleConfirmClick}+ disabled={!isValidValue || loading}+ fullWidth+ data-testid="confirmation-modal-confirm-button"+ variant={confirmButtonColor === 'neutral' ? 'outline' : 'solid'}+ color={confirmButtonColor}+ >+ {translatedConfirmButtonText}+ </StyledCenteredButton>+ </Dialog.Popup>+ )}+ </DialogInstance>+ );+};diff --git a/packages/twenty-front/src/modules/ui/layout/dialog/components/DialogEnterHotkeyEffect.tsx b/packages/twenty-front/src/modules/ui/layout/dialog/components/DialogEnterHotkeyEffect.tsxnew file mode 100644index 00000000000..82604b14589--- /dev/null+++ b/packages/twenty-front/src/modules/ui/layout/dialog/components/DialogEnterHotkeyEffect.tsx@@ -0,0 +1,21 @@+import { Key } from 'ts-key-enum';++import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';++type DialogEnterHotkeyEffectProps = {+ dialogId: string;+ onEnter: () => void;+};++export const DialogEnterHotkeyEffect = ({+ dialogId,+ onEnter,+}: DialogEnterHotkeyEffectProps) => {+ useHotkeysOnFocusedElement({+ keys: [Key.Enter],+ callback: onEnter,+ focusId: dialogId,+ dependencies: [onEnter],+ });+ return null;+};diff --git a/packages/twenty-front/src/modules/ui/layout/dialog/components/DialogInstance.tsx b/packages/twenty-front/src/modules/ui/layout/dialog/components/DialogInstance.tsxnew file mode 100644index 00000000000..4f38858e7e7--- /dev/null+++ b/packages/twenty-front/src/modules/ui/layout/dialog/components/DialogInstance.tsx@@ -0,0 +1,145 @@+import { useContext, type ReactNode } from 'react';+import { useStore } from 'jotai';+import { isDefined } from 'twenty-shared/utils';+import { Dialog, type DialogPopupProps } from 'twenty-ui/primitives/surfaces';++import { RootStackingContextZIndices } from '@/ui/layout/constants/RootStackingContextZIndices';+import { DialogEnterHotkeyEffect } from '@/ui/layout/dialog/components/DialogEnterHotkeyEffect';+import { DIALOG_BACKDROP_CLICK_OUTSIDE_ID } from '@/ui/layout/dialog/constants/DialogBackdropClickOutsideId';+import { DIALOG_CLICK_OUTSIDE_LISTENER_EXCLUDED_ID } from '@/ui/layout/dialog/constants/DialogClickOutsideListenerExcludedClassName';+import { DialogComponentInstanceContext } from '@/ui/layout/dialog/contexts/DialogComponentInstanceContext';+import { DialogContainerContext } from '@/ui/layout/dialog/contexts/DialogContainerContext';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';+import { isDialogOpenedComponentState } from '@/ui/layout/dialog/states/isDialogOpenedComponentState';+import { isDialogDismissalExcluded } from '@/ui/layout/dialog/utils/isDialogDismissalExcluded';+import { currentFocusIdSelector } from '@/ui/utilities/focus/states/currentFocusIdSelector';+import { ClickOutsideListenerContext } from '@/ui/utilities/pointer-event/contexts/ClickOutsideListenerContext';+import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';++type DialogInstanceProps = {+ dialogId: string;+ children: (popupProps: DialogPopupProps) => ReactNode;+ onEnter?: () => void;+ onClose?: () => void;+ dismissible?: boolean;+ closeOnDismiss?: boolean;+ renderInDocumentBody?: boolean;+};++const PROPAGATED_KEYS = new Set([+ 'ArrowUp',+ 'ArrowDown',+ 'ArrowLeft',+ 'ArrowRight',+ 'Home',+ 'End',+]);++export const DialogInstance = ({+ dialogId,+ children,+ onEnter,+ onClose,+ dismissible = false,+ closeOnDismiss = true,+ renderInDocumentBody = false,+}: DialogInstanceProps) => {+ const store = useStore();+ const { container } = useContext(DialogContainerContext);+ const isInContainer = isDefined(container) && !renderInDocumentBody;+ const isDialogOpened = useAtomComponentStateValue(+ isDialogOpenedComponentState,+ dialogId,+ );+ const { openDialog, closeDialog } = useDialog();+ const position = isInContainer ? 'absolute' : 'fixed';++ const popupProps: DialogPopupProps = {+ container: renderInDocumentBody ? document.body : (container ?? undefined),+ backdrop: {+ style: {+ position,+ zIndex: RootStackingContextZIndices.RootModalBackDrop,+ background: isInContainer+ ? 'var(--t-background-overlay-tertiary)'+ : undefined,+ },+ },+ viewportProps: {+ render: (+ <div+ data-testid="dialog-viewport"+ data-click-outside-id={DIALOG_BACKDROP_CLICK_OUTSIDE_ID}+ />+ ),+ style: { position, zIndex: RootStackingContextZIndices.RootModal },+ onMouseDown: (event) => event.stopPropagation(),+ },+ onKeyDown: (event) => {+ const isNestedFocus = store.get(currentFocusIdSelector.atom) !== dialogId;+ if (+ PROPAGATED_KEYS.has(event.key) ||+ (event.key === 'Escape' && isNestedFocus)+ ) {+ event.preventBaseUIHandler();+ }+ },+ };++ return (+ <DialogComponentInstanceContext.Provider value={{ instanceId: dialogId }}>+ <ClickOutsideListenerContext.Provider+ value={{+ excludedClickOutsideId: DIALOG_CLICK_OUTSIDE_LISTENER_EXCLUDED_ID,+ }}+ >+ <Dialog.Root+ open={isDialogOpened}+ modal={!isInContainer}+ onOpenChange={(open, eventDetails) => {+ if (open) {+ openDialog(dialogId);+ return;+ }++ const isNestedEscape =+ eventDetails.reason === 'escape-key' &&+ store.get(currentFocusIdSelector.atom) !== dialogId;++ if (isNestedEscape) {+ eventDetails.cancel();+ eventDetails.allowPropagation();+ return;+ }++ const isDismissal =+ eventDetails.reason === 'escape-key' ||+ eventDetails.reason === 'outside-press';+ const isExcludedPress =+ eventDetails.reason === 'outside-press' &&+ isDialogDismissalExcluded(eventDetails.event.target);++ if ((isDismissal && !dismissible) || isExcludedPress) {+ eventDetails.cancel();+ return;+ }++ onClose?.();++ if (isDismissal && !closeOnDismiss) {+ eventDetails.cancel();+ return;+ }++ closeDialog(dialogId);+ }}+ >+ {isDialogOpened && isDefined(onEnter) && (+ <DialogEnterHotkeyEffect dialogId={dialogId} onEnter={onEnter} />+ )}+ {children(popupProps)}+ </Dialog.Root>+ </ClickOutsideListenerContext.Provider>+ </DialogComponentInstanceContext.Provider>+ );+};diff --git a/packages/twenty-front/src/modules/ui/layout/modal/components/__stories__/ConfirmationModal.stories.tsx b/packages/twenty-front/src/modules/ui/layout/dialog/components/__stories__/ConfirmationDialog.stories.tsxsimilarity index 63%rename from packages/twenty-front/src/modules/ui/layout/modal/components/__stories__/ConfirmationModal.stories.tsxrename to packages/twenty-front/src/modules/ui/layout/dialog/components/__stories__/ConfirmationDialog.stories.tsxindex dd60b8eaf21..1dc148e9755 100644--- a/packages/twenty-front/src/modules/ui/layout/modal/components/__stories__/ConfirmationModal.stories.tsx+++ b/packages/twenty-front/src/modules/ui/layout/dialog/components/__stories__/ConfirmationDialog.stories.tsx@@ -5,8 +5,8 @@ import {} from '@storybook/react-vite';import { expect, fn, userEvent, waitFor, within } from 'storybook/test';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { isModalOpenedComponentState } from '@/ui/layout/modal/states/isModalOpenedComponentState';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { isDialogOpenedComponentState } from '@/ui/layout/dialog/states/isDialogOpenedComponentState';import { focusStackState } from '@/ui/utilities/focus/states/focusStackState';import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';@@ -16,7 +16,7 @@ import { sleep } from '~/utils/sleep';const JotaiInitDecorator: Decorator = (Story) => {jotaiStore.set(- isModalOpenedComponentState.atomFamily({+ isDialogOpenedComponentState.atomFamily({instanceId: 'confirmation-modal',}),true,@@ -37,9 +37,9 @@ const JotaiInitDecorator: Decorator = (Story) => {return <Story />;};-const meta: Meta<typeof ConfirmationModal> = {- title: 'UI/Layout/Modal/ConfirmationModal',- component: ConfirmationModal,+const meta: Meta<typeof ConfirmationDialog> = {+ title: 'UI/Layout/Dialog/ConfirmationDialog',+ component: ConfirmationDialog,decorators: [JotaiInitDecorator, RootDecorator, ComponentDecorator],parameters: {disableHotkeyInitialization: true,@@ -47,19 +47,80 @@ const meta: Meta<typeof ConfirmationModal> = {};export default meta;-type Story = StoryObj<typeof ConfirmationModal>;+type Story = StoryObj<typeof ConfirmationDialog>;const closeMock = fn();const confirmMock = fn();export const Default: Story = {args: {- modalInstanceId: 'confirmation-modal',+ dialogId: 'confirmation-modal',title: 'Pariatur labore.',subtitle: 'Velit dolore aliquip laborum occaecat fugiat.',confirmButtonText: 'Delete',onConfirmClick: fn(),},+ play: async ({ canvasElement }) => {+ const dialog = await within(canvasElement.ownerDocument.body).findByRole(+ 'dialog',+ { name: 'Pariatur labore.' },+ );+ const title = within(dialog).getByRole('heading', { level: 2 });+ const subtitle = within(dialog).getByText(+ 'Velit dolore aliquip laborum occaecat fugiat.',+ );+ const description = canvasElement.ownerDocument.getElementById(+ dialog.getAttribute('aria-describedby') ?? '',+ );++ expect(dialog).toHaveAccessibleDescription(+ 'Velit dolore aliquip laborum occaecat fugiat.',+ );+ expect(getComputedStyle(dialog).width).toBe('272px');+ expect(getComputedStyle(dialog).padding).toBe('24px');+ expect(getComputedStyle(title).marginBlockEnd).toBe('16px');+ expect(getComputedStyle(title).textAlign).toBe('center');+ expect(title).toHaveAttribute('data-size', 'lg');+ expect(getComputedStyle(subtitle).textAlign).toBe('center');+ expect(getComputedStyle(subtitle).color).toBe(+ getComputedStyle(dialog).color,+ );+ expect(getComputedStyle(subtitle).lineHeight).toBe(+ getComputedStyle(dialog).lineHeight,+ );+ expect(description).not.toBeNull();+ expect(getComputedStyle(description!).marginBottom).toBe('24px');+ },+};++export const RichSubtitle: Story = {+ args: {+ ...Default.args,+ subtitle: (+ <div>+ <p>Remove this record.</p>+ <ul>+ <li>Files will be removed.</li>+ </ul>+ </div>+ ),+ },+ play: async ({ canvasElement }) => {+ const dialog = await within(canvasElement.ownerDocument.body).findByRole(+ 'dialog',+ { name: 'Pariatur labore.' },+ );+ const description = canvasElement.ownerDocument.getElementById(+ dialog.getAttribute('aria-describedby') ?? '',+ );++ expect(dialog).toHaveAccessibleDescription(+ 'Remove this record. Files will be removed.',+ );+ expect(description?.tagName).toBe('DIV');+ expect(within(dialog).getByRole('list')).toBeVisible();+ expect(dialog.querySelector('p p, p div, p ul')).toBeNull();+ },};export const InputConfirmation: Story = {@@ -72,7 +133,7 @@ export const InputConfirmation: Story = {export const CloseOnEscape: Story = {args: {- modalInstanceId: 'confirmation-modal',+ dialogId: 'confirmation-modal',title: 'Escape Key Test',subtitle: 'This modal should close when pressing the Escape key.',confirmButtonText: 'Confirm',@@ -95,7 +156,7 @@ export const CloseOnEscape: Story = {export const CloseOnClickOutside: Story = {args: {- modalInstanceId: 'confirmation-modal',+ dialogId: 'confirmation-modal',title: 'Click Outside Test',subtitle: 'This modal should close when clicking outside of it.',confirmButtonText: 'Confirm',@@ -106,7 +167,7 @@ export const CloseOnClickOutside: Story = {await body.findByText('Click Outside Test');- const backdrop = await body.findByTestId('modal-backdrop');+ const backdrop = await body.findByTestId('dialog-viewport');// We need to wait for the outside click listener to be registeredawait sleep(100);@@ -121,7 +182,7 @@ export const CloseOnClickOutside: Story = {export const ConfirmWithEnterKey: Story = {args: {- modalInstanceId: 'confirmation-modal',+ dialogId: 'confirmation-modal',title: 'Enter Key Test',subtitle: 'This modal should confirm when pressing the Enter key.',confirmButtonText: 'Confirm',@@ -142,7 +203,7 @@ export const ConfirmWithEnterKey: Story = {export const CancelButtonClick: Story = {args: {- modalInstanceId: 'confirmation-modal',+ dialogId: 'confirmation-modal',title: 'Cancel Button Test',subtitle: 'Clicking the cancel button should close the modal',confirmButtonText: 'Confirm',@@ -166,7 +227,7 @@ export const CancelButtonClick: Story = {export const ConfirmButtonClick: Story = {args: {- modalInstanceId: 'confirmation-modal',+ dialogId: 'confirmation-modal',title: 'Confirm Button Test',subtitle: 'Clicking the confirm button should trigger the confirm action',confirmButtonText: 'Confirm',@@ -191,7 +252,7 @@ export const ConfirmButtonClick: Story = {export const ResetsInputWhenReopened: Story = {args: {- modalInstanceId: 'confirmation-modal',+ dialogId: 'confirmation-modal',title: 'Reopen Reset Test',subtitle: 'Reopening the modal should clear the confirmation input.',confirmButtonText: 'Confirm',@@ -225,7 +286,7 @@ export const ResetsInputWhenReopened: Story = {});jotaiStore.set(- isModalOpenedComponentState.atomFamily({+ isDialogOpenedComponentState.atomFamily({instanceId: 'confirmation-modal',}),true,@@ -241,3 +302,22 @@ export const ResetsInputWhenReopened: Story = {});},};++export const PreventConfirmationWhileLoading: Story = {+ args: {+ ...Default.args,+ loading: true,+ onConfirmClick: fn(),+ },+ play: async ({ canvasElement, args }) => {+ const dialog = await within(canvasElement.ownerDocument.body).findByRole(+ 'dialog',+ );+ expect(+ within(dialog).getByRole('button', { name: 'Delete' }),+ ).toBeDisabled();+ await userEvent.keyboard('{Enter}');+ expect(args.onConfirmClick).not.toHaveBeenCalled();+ expect(dialog).toBeInTheDocument();+ },+};diff --git a/packages/twenty-front/src/modules/ui/layout/dialog/components/__stories__/DialogInstance.stories.tsx b/packages/twenty-front/src/modules/ui/layout/dialog/components/__stories__/DialogInstance.stories.tsxnew file mode 100644index 00000000000..7ef52e95d27--- /dev/null+++ b/packages/twenty-front/src/modules/ui/layout/dialog/components/__stories__/DialogInstance.stories.tsx@@ -0,0 +1,219 @@+import { type ComponentProps, useState } from 'react';+import { type Meta, type StoryObj } from '@storybook/react-vite';+import { expect, fn, userEvent, waitFor, within } from 'storybook/test';+import { Button } from 'twenty-ui/primitives/input';+import { Dialog } from 'twenty-ui/primitives/surfaces';+import { ComponentDecorator } from 'twenty-ui/testing';++import { Select } from '@/ui/input/components/Select';+import { DialogInstance } from '@/ui/layout/dialog/components/DialogInstance';+import { DialogContainerContext } from '@/ui/layout/dialog/contexts/DialogContainerContext';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';+import { RootDecorator } from '~/testing/decorators/RootDecorator';++const DIALOG_ID = 'dialog-instance-story';++type DialogInstanceExampleProps = Omit<+ ComponentProps<typeof DialogInstance>,+ 'dialogId' | 'children'+>;++const DialogInstanceExample = (props: DialogInstanceExampleProps) => {+ const { openDialog } = useDialog();+ const [choice, setChoice] = useState('first');++ return (+ <>+ <Button onClick={() => openDialog(DIALOG_ID)}>Open dialog</Button>+ <DialogInstance {...props} dialogId={DIALOG_ID}>+ {({ container, backdrop, viewportProps, onKeyDown }) => (+ <Dialog.Popup {...{ container, backdrop, viewportProps, onKeyDown }}>+ <Dialog.Header>+ <Dialog.Title>Workspace preferences</Dialog.Title>+ <Dialog.Description>Choose a preference.</Dialog.Description>+ </Dialog.Header>+ <Dialog.Body>+ <Select+ dropdownId="dialog-instance-choice"+ label="Preference"+ value={choice}+ onChange={setChoice}+ options={[+ { value: 'first', label: 'First option' },+ { value: 'second', label: 'Second option' },+ ]}+ isDropdownInModal+ />+ </Dialog.Body>+ <Dialog.Footer>+ <Dialog.Close render={<Button>Close dialog</Button>} />+ </Dialog.Footer>+ </Dialog.Popup>+ )}+ </DialogInstance>+ </>+ );+};++const meta: Meta<typeof DialogInstanceExample> = {+ title: 'UI/Layout/Dialog/DialogInstance',+ component: DialogInstanceExample,+ decorators: [RootDecorator, ComponentDecorator],+ args: { dismissible: true, onClose: fn() },+};++export default meta;+type Story = StoryObj<typeof DialogInstanceExample>;++export const OpenAndRestoreFocus: Story = {+ play: async ({ canvasElement, args }) => {+ const trigger = within(canvasElement).getByRole('button', {+ name: 'Open dialog',+ });+ const body = within(canvasElement.ownerDocument.body);+ await userEvent.click(trigger);+ const dialog = await body.findByRole('dialog', {+ name: 'Workspace preferences',+ });+ await userEvent.click(+ within(dialog).getByRole('button', { name: 'Close dialog' }),+ );+ await waitFor(() => expect(dialog).not.toBeInTheDocument());+ await waitFor(() => expect(trigger).toHaveFocus());+ expect(args.onClose).toHaveBeenCalledTimes(1);+ },+};++export const CloseOnEscape: Story = {+ play: async ({ canvasElement, args }) => {+ await userEvent.click(+ within(canvasElement).getByRole('button', { name: 'Open dialog' }),+ );+ const dialog = await within(canvasElement.ownerDocument.body).findByRole(+ 'dialog',+ );+ await userEvent.keyboard('{Escape}');+ await waitFor(() => expect(dialog).not.toBeInTheDocument());+ expect(args.onClose).toHaveBeenCalledTimes(1);+ },+};++export const TrapFocus: Story = {+ play: async ({ canvasElement }) => {+ await userEvent.click(+ within(canvasElement).getByRole('button', { name: 'Open dialog' }),+ );+ const dialog = await within(canvasElement.ownerDocument.body).findByRole(+ 'dialog',+ );+ await waitFor(() =>+ expect(dialog.contains(document.activeElement)).toBe(true),+ );+ await userEvent.tab();+ await waitFor(() =>+ expect(dialog.contains(document.activeElement)).toBe(true),+ );+ await userEvent.tab();+ await waitFor(() =>+ expect(dialog.contains(document.activeElement)).toBe(true),+ );+ },+};++export const CloseOnOutsidePress: Story = {+ play: async ({ canvasElement, args }) => {+ const body = within(canvasElement.ownerDocument.body);+ await userEvent.click(+ within(canvasElement).getByRole('button', { name: 'Open dialog' }),+ );+ const dialog = await body.findByRole('dialog');+ await userEvent.click(body.getByTestId('dialog-viewport'));+ await waitFor(() => expect(dialog).not.toBeInTheDocument());+ expect(args.onClose).toHaveBeenCalledTimes(1);+ },+};++export const PreventDismissal: Story = {+ args: { dismissible: false },+ play: async ({ canvasElement, args }) => {+ const body = within(canvasElement.ownerDocument.body);+ await userEvent.click(+ within(canvasElement).getByRole('button', { name: 'Open dialog' }),+ );+ const dialog = await body.findByRole('dialog');+ await userEvent.keyboard('{Escape}');+ await userEvent.click(body.getByTestId('dialog-viewport'));+ await waitFor(() => expect(dialog).toBeVisible());+ expect(args.onClose).not.toHaveBeenCalled();+ await userEvent.click(+ within(dialog).getByRole('button', { name: 'Close dialog' }),+ );+ await waitFor(() => expect(dialog).not.toBeInTheDocument());+ },+};++export const DeferDismissal: Story = {+ args: { closeOnDismiss: false },+ play: async ({ canvasElement, args }) => {+ await userEvent.click(+ within(canvasElement).getByRole('button', { name: 'Open dialog' }),+ );+ const dialog = await within(canvasElement.ownerDocument.body).findByRole(+ 'dialog',+ );+ await userEvent.keyboard('{Escape}');+ await waitFor(() => expect(args.onClose).toHaveBeenCalledTimes(1));+ await waitFor(() => expect(dialog).toBeVisible());+ },+};++export const PortaledDropdown: Story = {+ play: async ({ canvasElement, args }) => {+ const body = within(canvasElement.ownerDocument.body);+ await userEvent.click(+ within(canvasElement).getByRole('button', { name: 'Open dialog' }),+ );+ const dialog = await body.findByRole('dialog');+ await userEvent.click(within(dialog).getByText('First option'));+ await userEvent.click(await body.findByText('Second option'));+ expect(within(dialog).getByText('Second option')).toBeVisible();+ expect(args.onClose).not.toHaveBeenCalled();+ await userEvent.click(within(dialog).getByText('Second option'));+ await userEvent.keyboard('{Escape}');+ await waitFor(() => expect(dialog).toBeVisible());+ await userEvent.keyboard('{Escape}');+ await waitFor(() => expect(dialog).not.toBeInTheDocument());+ },+};++const ContainedDialogExample = (props: DialogInstanceExampleProps) => {+ const [container, setContainer] = useState<HTMLDivElement | null>(null);++ return (+ <div+ ref={setContainer}+ data-testid="dialog-container"+ style={{ position: 'relative', width: 640, height: 480 }}+ >+ <DialogContainerContext.Provider value={{ container }}>+ <DialogInstanceExample {...props} />+ </DialogContainerContext.Provider>+ </div>+ );+};++export const ScopedContainer: Story = {+ render: (args) => <ContainedDialogExample {...args} />,+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ await userEvent.click(canvas.getByRole('button', { name: 'Open dialog' }));+ const container = canvas.getByTestId('dialog-container');+ const dialog = await within(container).findByRole('dialog');+ const viewport = within(container).getByTestId('dialog-viewport');+ expect(getComputedStyle(viewport).position).toBe('absolute');+ await userEvent.click(+ within(dialog).getByRole('button', { name: 'Close dialog' }),+ );+ await waitFor(() => expect(dialog).not.toBeInTheDocument());+ },+};diff --git a/packages/twenty-front/src/modules/ui/layout/dialog/constants/DialogBackdropClickOutsideId.ts b/packages/twenty-front/src/modules/ui/layout/dialog/constants/DialogBackdropClickOutsideId.tsnew file mode 100644index 00000000000..6c54a433adb--- /dev/null+++ b/packages/twenty-front/src/modules/ui/layout/dialog/constants/DialogBackdropClickOutsideId.ts@@ -0,0 +1 @@+export const DIALOG_BACKDROP_CLICK_OUTSIDE_ID = 'dialog-backdrop';diff --git a/packages/twenty-front/src/modules/ui/layout/dialog/constants/DialogClickOutsideListenerExcludedClassName.ts b/packages/twenty-front/src/modules/ui/layout/dialog/constants/DialogClickOutsideListenerExcludedClassName.tsnew file mode 100644index 00000000000..250c399a4ed--- /dev/null+++ b/packages/twenty-front/src/modules/ui/layout/dialog/constants/DialogClickOutsideListenerExcludedClassName.ts@@ -0,0 +1,2 @@+export const DIALOG_CLICK_OUTSIDE_LISTENER_EXCLUDED_ID =+ 'dialog-click-outside-listener-excluded';diff --git a/packages/twenty-front/src/modules/ui/layout/modal/contexts/ModalComponentInstanceContext.ts b/packages/twenty-front/src/modules/ui/layout/dialog/contexts/DialogComponentInstanceContext.tssimilarity index 60%rename from packages/twenty-front/src/modules/ui/layout/modal/contexts/ModalComponentInstanceContext.tsrename to packages/twenty-front/src/modules/ui/layout/dialog/contexts/DialogComponentInstanceContext.tsindex 2558c36d538..a87732357bf 100644--- a/packages/twenty-front/src/modules/ui/layout/modal/contexts/ModalComponentInstanceContext.ts+++ b/packages/twenty-front/src/modules/ui/layout/dialog/contexts/DialogComponentInstanceContext.ts@@ -1,3 +1,3 @@import { createComponentInstanceContext } from '@/ui/utilities/state/component-state/utils/createComponentInstanceContext';-export const ModalComponentInstanceContext = createComponentInstanceContext();+export const DialogComponentInstanceContext = createComponentInstanceContext();diff --git a/packages/twenty-front/src/modules/ui/layout/dialog/contexts/DialogContainerContext.tsx b/packages/twenty-front/src/modules/ui/layout/dialog/contexts/DialogContainerContext.tsxnew file mode 100644index 00000000000..bc8f14feaa7--- /dev/null+++ b/packages/twenty-front/src/modules/ui/layout/dialog/contexts/DialogContainerContext.tsx@@ -0,0 +1,8 @@+import { createContext } from 'react';++type DialogContainerContextValue = {+ container: HTMLElement | null;+};++export const DialogContainerContext =+ createContext<DialogContainerContextValue>({ container: null });diff --git a/packages/twenty-front/src/modules/ui/layout/dialog/hooks/__tests__/useDialog.spec.tsx b/packages/twenty-front/src/modules/ui/layout/dialog/hooks/__tests__/useDialog.spec.tsxnew file mode 100644index 00000000000..0a3c0f858ed--- /dev/null+++ b/packages/twenty-front/src/modules/ui/layout/dialog/hooks/__tests__/useDialog.spec.tsx@@ -0,0 +1,121 @@+import { renderHook } from '@testing-library/react';+import { createStore, Provider } from 'jotai';+import { type ReactNode, act } from 'react';++import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';+import { isDialogOpenedComponentState } from '@/ui/layout/dialog/states/isDialogOpenedComponentState';+import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';++const dialogId = 'test-dialog-id';++const createTestWrapper = () => {+ const store = createStore();++ const TestWrapper = ({ children }: { children: ReactNode }) => (+ <Provider store={store}>{children}</Provider>+ );++ return TestWrapper;+};++describe('useDialog', () => {+ it('should open a dialog', () => {+ const { result } = renderHook(+ () => {+ const dialog = useDialog();+ const isDialogOpened = useAtomComponentStateValue(+ isDialogOpenedComponentState,+ dialogId,+ );+ return { dialog, isDialogOpened };+ },+ {+ wrapper: createTestWrapper(),+ },+ );++ act(() => {+ result.current.dialog.openDialog(dialogId);+ });++ expect(result.current.isDialogOpened).toBe(true);+ });++ it('should close a dialog', () => {+ const { result } = renderHook(+ () => {+ const dialog = useDialog();+ const isDialogOpened = useAtomComponentStateValue(+ isDialogOpenedComponentState,+ dialogId,+ );+ return { dialog, isDialogOpened };+ },+ {+ wrapper: createTestWrapper(),+ },+ );++ act(() => {+ result.current.dialog.openDialog(dialogId);+ });+ expect(result.current.isDialogOpened).toBe(true);++ act(() => {+ result.current.dialog.closeDialog(dialogId);+ });++ expect(result.current.isDialogOpened).toBe(false);+ });++ it('should toggle a dialog (open when closed)', () => {+ const { result } = renderHook(+ () => {+ const dialog = useDialog();+ const isDialogOpened = useAtomComponentStateValue(+ isDialogOpenedComponentState,+ dialogId,+ );+ return { dialog, isDialogOpened };+ },+ {+ wrapper: createTestWrapper(),+ },+ );++ expect(result.current.isDialogOpened).toBe(false);++ act(() => {+ result.current.dialog.toggleDialog(dialogId);+ });++ expect(result.current.isDialogOpened).toBe(true);+ });++ it('should toggle a dialog (close when open)', () => {+ const { result } = renderHook(+ () => {+ const dialog = useDialog();+ const isDialogOpened = useAtomComponentStateValue(+ isDialogOpenedComponentState,+ dialogId,+ );+ return { dialog, isDialogOpened };+ },+ {+ wrapper: createTestWrapper(),+ },+ );++ act(() => {+ result.current.dialog.openDialog(dialogId);+ });+ expect(result.current.isDialogOpened).toBe(true);++ act(() => {+ result.current.dialog.toggleDialog(dialogId);+ });++ expect(result.current.isDialogOpened).toBe(false);+ });+});diff --git a/packages/twenty-front/src/modules/ui/layout/modal/hooks/useModal.tsx b/packages/twenty-front/src/modules/ui/layout/dialog/hooks/useDialog.tsxsimilarity index 50%rename from packages/twenty-front/src/modules/ui/layout/modal/hooks/useModal.tsxrename to packages/twenty-front/src/modules/ui/layout/dialog/hooks/useDialog.tsxindex e5cb023e6e4..8a070400f21 100644--- a/packages/twenty-front/src/modules/ui/layout/modal/hooks/useModal.tsx+++ b/packages/twenty-front/src/modules/ui/layout/dialog/hooks/useDialog.tsx@@ -1,37 +1,37 @@import { useCallback } from 'react';import { useStore } from 'jotai';-import { isModalOpenedComponentState } from '@/ui/layout/modal/states/isModalOpenedComponentState';+import { isDialogOpenedComponentState } from '@/ui/layout/dialog/states/isDialogOpenedComponentState';import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack';import { useRemoveFocusItemFromFocusStackById } from '@/ui/utilities/focus/hooks/useRemoveFocusItemFromFocusStackById';import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';-export const useModal = () => {+export const useDialog = () => {const { pushFocusItemToFocusStack } = usePushFocusItemToFocusStack();const { removeFocusItemFromFocusStackById } =useRemoveFocusItemFromFocusStackById();const store = useStore();- const closeModal = useCallback(- (modalInstanceId: string) => {- const isModalOpen = store.get(- isModalOpenedComponentState.atomFamily({- instanceId: modalInstanceId,+ const closeDialog = useCallback(+ (dialogId: string) => {+ const isDialogOpened = store.get(+ isDialogOpenedComponentState.atomFamily({+ instanceId: dialogId,}),);- if (!isModalOpen) {+ if (!isDialogOpened) {return;}removeFocusItemFromFocusStackById({- focusId: modalInstanceId,+ focusId: dialogId,});store.set(- isModalOpenedComponentState.atomFamily({- instanceId: modalInstanceId,+ isDialogOpenedComponentState.atomFamily({+ instanceId: dialogId,}),false,);@@ -39,30 +39,30 @@ export const useModal = () => {[store, removeFocusItemFromFocusStackById],);- const openModal = useCallback(- (modalInstanceId: string) => {- const isModalOpened = store.get(- isModalOpenedComponentState.atomFamily({- instanceId: modalInstanceId,+ const openDialog = useCallback(+ (dialogId: string) => {+ const isDialogOpened = store.get(+ isDialogOpenedComponentState.atomFamily({+ instanceId: dialogId,}),);- if (isModalOpened) {+ if (isDialogOpened) {return;}store.set(- isModalOpenedComponentState.atomFamily({- instanceId: modalInstanceId,+ isDialogOpenedComponentState.atomFamily({+ instanceId: dialogId,}),true,);pushFocusItemToFocusStack({- focusId: modalInstanceId,+ focusId: dialogId,component: {type: FocusComponentType.MODAL,- instanceId: modalInstanceId,+ instanceId: dialogId,},globalHotkeysConfig: {enableGlobalHotkeysWithModifiers: false,@@ -73,26 +73,27 @@ export const useModal = () => {[store, pushFocusItemToFocusStack],);- const toggleModal = useCallback(- (modalInstanceId: string) => {- const isModalOpen = store.get(- isModalOpenedComponentState.atomFamily({- instanceId: modalInstanceId,+ const toggleDialog = useCallback(+ (dialogId: string) => {+ const isDialogOpened = store.get(+ isDialogOpenedComponentState.atomFamily({+ instanceId: dialogId,}),);- if (isModalOpen) {- closeModal(modalInstanceId);- } else {- openModal(modalInstanceId);+ if (isDialogOpened) {+ closeDialog(dialogId);+ return;}++ openDialog(dialogId);},- [store, closeModal, openModal],+ [store, closeDialog, openDialog],);return {- closeModal,- openModal,- toggleModal,+ closeDialog,+ openDialog,+ toggleDialog,};};diff --git a/packages/twenty-front/src/modules/ui/layout/dialog/states/isDialogOpenedComponentState.ts b/packages/twenty-front/src/modules/ui/layout/dialog/states/isDialogOpenedComponentState.tsnew file mode 100644index 00000000000..d43d685de38--- /dev/null+++ b/packages/twenty-front/src/modules/ui/layout/dialog/states/isDialogOpenedComponentState.ts@@ -0,0 +1,8 @@+import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState';+import { DialogComponentInstanceContext } from '@/ui/layout/dialog/contexts/DialogComponentInstanceContext';++export const isDialogOpenedComponentState = createAtomComponentState<boolean>({+ key: 'isDialogOpenedComponentState',+ defaultValue: false,+ componentInstanceContext: DialogComponentInstanceContext,+});diff --git a/packages/twenty-front/src/modules/ui/layout/modal/types/ConfirmationModalProps.ts b/packages/twenty-front/src/modules/ui/layout/dialog/types/ConfirmationDialogProps.tssimilarity index 72%rename from packages/twenty-front/src/modules/ui/layout/modal/types/ConfirmationModalProps.tsrename to packages/twenty-front/src/modules/ui/layout/dialog/types/ConfirmationDialogProps.tsindex 0a87ab92ac5..af974a4ca37 100644--- a/packages/twenty-front/src/modules/ui/layout/modal/types/ConfirmationModalProps.ts+++ b/packages/twenty-front/src/modules/ui/layout/dialog/types/ConfirmationDialogProps.ts@@ -1,9 +1,8 @@import { type ReactNode } from 'react';import { type ButtonColor } from 'twenty-ui/primitives/input';-import { type ModalOverlay } from 'twenty-ui/primitives/surfaces';-export type ConfirmationModalProps = {- modalInstanceId: string;+export type ConfirmationDialogProps = {+ dialogId: string;title: string;loading?: boolean;subtitle: ReactNode;@@ -15,5 +14,4 @@ export type ConfirmationModalProps = {confirmButtonColor?: ButtonColor;AdditionalButtons?: ReactNode;hideCancelButton?: boolean;- overlay?: ModalOverlay;};diff --git a/packages/twenty-front/src/modules/ui/layout/dialog/utils/isDialogDismissalExcluded.ts b/packages/twenty-front/src/modules/ui/layout/dialog/utils/isDialogDismissalExcluded.tsnew file mode 100644index 00000000000..5d6dc4a237a--- /dev/null+++ b/packages/twenty-front/src/modules/ui/layout/dialog/utils/isDialogDismissalExcluded.ts@@ -0,0 +1,14 @@+import { isDefined } from 'twenty-shared/utils';++import { DIALOG_CLICK_OUTSIDE_ID } from '@/ui/feedback/dialog-manager/constants/DialogClickOutsideId';+import { DIALOG_CLICK_OUTSIDE_LISTENER_EXCLUDED_ID } from '@/ui/layout/dialog/constants/DialogClickOutsideListenerExcludedClassName';++const EXCLUDED_OVERLAY_SELECTOR = [+ `[data-click-outside-id="${DIALOG_CLICK_OUTSIDE_LISTENER_EXCLUDED_ID}"]`,+ `[data-click-outside-id="${DIALOG_CLICK_OUTSIDE_ID}"]`,+ '[data-globally-prevent-click-outside="true"]',+].join(',');++export const isDialogDismissalExcluded = (target: EventTarget | null) =>+ target instanceof Element &&+ isDefined(target.closest(EXCLUDED_OVERLAY_SELECTOR));diff --git a/packages/twenty-front/src/modules/ui/layout/modal/components/ConfirmationModal.tsx b/packages/twenty-front/src/modules/ui/layout/modal/components/ConfirmationModal.tsxdeleted file mode 100644index c478a330c7d..00000000000--- a/packages/twenty-front/src/modules/ui/layout/modal/components/ConfirmationModal.tsx+++ /dev/null@@ -1,131 +0,0 @@-import { StyledCenteredButton } from '@/ui/layout/modal/components/StyledCenteredButton';-import { type ConfirmationModalProps } from '@/ui/layout/modal/types/ConfirmationModalProps';-import { styled } from '@linaria/react';-import { isNonEmptyString } from '@sniptt/guards';-import { useState } from 'react';--import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';--import { ModalStatefulWrapper } from '@/ui/layout/modal/components/ModalStatefulWrapper';-import { useModal } from '@/ui/layout/modal/hooks/useModal';-import { msg } from '@lingui/core/macro';-import { useLingui } from '@lingui/react/macro';-import { Section } from 'twenty-ui/components';-import { Dialog } from 'twenty-ui/primitives/surfaces';-import { themeCssVariables } from 'twenty-ui/theme-constants';--const StyledSectionContainer = styled.div`- margin-bottom: ${themeCssVariables.spacing[6]};-`;--const defaultConfirmButtonText = msg`Confirm`;--export const ConfirmationModal = ({- modalInstanceId,- title,- loading,- subtitle,- onConfirmClick,- onClose,- confirmButtonText,- confirmationValue,- confirmationPlaceholder,- confirmButtonColor = 'danger',- AdditionalButtons,- hideCancelButton = false,- overlay = 'dark',-}: ConfirmationModalProps) => {- const { i18n, t } = useLingui();- const translatedConfirmButtonText =- confirmButtonText ?? i18n._(defaultConfirmButtonText);- const [inputConfirmationValue, setInputConfirmationValue] =- useState<string>('');-- const isValidValue =- !isNonEmptyString(confirmationValue) ||- inputConfirmationValue === confirmationValue;-- const { closeModal } = useModal();-- const handleClose = () => {- setInputConfirmationValue('');- closeModal(modalInstanceId);- };-- const handleConfirmClick = () => {- handleClose();- onConfirmClick();- };-- const handleCancelClick = () => {- handleClose();- onClose?.();- };-- const handleEnter = () => {- if (isValidValue) {- handleConfirmClick();- }- };-- return (- <ModalStatefulWrapper- modalInstanceId={modalInstanceId}- onClose={() => {- setInputConfirmationValue('');- onClose?.();- }}- onEnter={handleEnter}- isClosable={true}- padding="large"- overlay={overlay}- dataGloballyPreventClickOutside- renderInDocumentBody- smallBorderRadius- narrowWidth- autoHeight- >- <Dialog.Title>{title}</Dialog.Title>- <StyledSectionContainer>- <Section.Root align="center" color="primary">- {subtitle}- </Section.Root>- </StyledSectionContainer>- {confirmationValue && (- <Section.Root>- <SettingsTextInput- instanceId="confirmation-modal-input"- dataTestId="confirmation-modal-input"- value={inputConfirmationValue}- onChange={setInputConfirmationValue}- placeholder={confirmationPlaceholder}- fullWidth- disableHotkeys- key={'input-' + confirmationValue}- />- </Section.Root>- )}- {!hideCancelButton && (- <StyledCenteredButton- onClick={handleCancelClick}- fullWidth- data-testid="confirmation-modal-cancel-button"- variant="outline"- >{t`Cancel`}</StyledCenteredButton>- )}-- {AdditionalButtons}-- <StyledCenteredButton- onClick={handleConfirmClick}- disabled={!isValidValue || loading}- fullWidth- data-testid="confirmation-modal-confirm-button"- variant={confirmButtonColor === 'neutral' ? 'outline' : 'solid'}- color={confirmButtonColor}- >- {translatedConfirmButtonText}- </StyledCenteredButton>- </ModalStatefulWrapper>- );-};diff --git a/packages/twenty-front/src/modules/ui/layout/modal/components/ModalHotkeysAndClickOutsideEffect.tsx b/packages/twenty-front/src/modules/ui/layout/modal/components/ModalHotkeysAndClickOutsideEffect.tsxdeleted file mode 100644index 6c12887f9f6..00000000000--- a/packages/twenty-front/src/modules/ui/layout/modal/components/ModalHotkeysAndClickOutsideEffect.tsx+++ /dev/null@@ -1,57 +0,0 @@-import { DIALOG_CLICK_OUTSIDE_ID } from '@/ui/feedback/dialog-manager/constants/DialogClickOutsideId';-import { MODAL_CLICK_OUTSIDE_LISTENER_EXCLUDED_ID } from '@/ui/layout/modal/constants/ModalClickOutsideListenerExcludedClassName';-import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';-import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside';-import { Key } from 'ts-key-enum';--type ModalHotkeysAndClickOutsideEffectProps = {- modalRef: React.RefObject<HTMLDivElement | null>;- onEnter?: () => void;- isClosable?: boolean;- onClose?: () => void;- modalInstanceId: string;-};--export const ModalHotkeysAndClickOutsideEffect = ({- modalRef,- onEnter,- isClosable = false,- onClose,- modalInstanceId,-}: ModalHotkeysAndClickOutsideEffectProps) => {- useHotkeysOnFocusedElement({- keys: [Key.Enter],- callback: () => {- onEnter?.();- },- focusId: modalInstanceId,- dependencies: [onEnter],- });-- useHotkeysOnFocusedElement({- keys: [Key.Escape],- callback: () => {- if (isClosable && onClose !== undefined) {- onClose();- }- },- focusId: modalInstanceId,- dependencies: [isClosable, onClose],- });-- useListenClickOutside({- refs: [modalRef],- excludedClickOutsideIds: [- MODAL_CLICK_OUTSIDE_LISTENER_EXCLUDED_ID,- DIALOG_CLICK_OUTSIDE_ID,- ],- listenerId: `MODAL_CLICK_OUTSIDE_LISTENER_ID_${modalInstanceId}`,- callback: () => {- if (isClosable && onClose !== undefined) {- onClose();- }- },- });-- return null;-};diff --git a/packages/twenty-front/src/modules/ui/layout/modal/components/ModalStatefulWrapper.tsx b/packages/twenty-front/src/modules/ui/layout/modal/components/ModalStatefulWrapper.tsxdeleted file mode 100644index fc4cd85ccab..00000000000--- a/packages/twenty-front/src/modules/ui/layout/modal/components/ModalStatefulWrapper.tsx+++ /dev/null@@ -1,98 +0,0 @@-import { ModalHotkeysAndClickOutsideEffect } from '@/ui/layout/modal/components/ModalHotkeysAndClickOutsideEffect';-import { MODAL_BACKDROP_CLICK_OUTSIDE_ID } from '@/ui/layout/modal/constants/ModalBackdropClickOutsideId';-import { MODAL_CLICK_OUTSIDE_LISTENER_EXCLUDED_ID } from '@/ui/layout/modal/constants/ModalClickOutsideListenerExcludedClassName';-import { RootStackingContextZIndices } from '@/ui/layout/constants/RootStackingContextZIndices';-import { ModalComponentInstanceContext } from '@/ui/layout/modal/contexts/ModalComponentInstanceContext';-import { useModalContainer } from '@/ui/layout/modal/contexts/ModalContainerContext';-import { useModal } from '@/ui/layout/modal/hooks/useModal';-import { isModalOpenedComponentState } from '@/ui/layout/modal/states/isModalOpenedComponentState';-import { type ModalStatefulWrapperProps } from '@/ui/layout/modal/types/ModalStatefulWrapperProps';-import { ClickOutsideListenerContext } from '@/ui/utilities/pointer-event/contexts/ClickOutsideListenerContext';-import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';-import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';-import { useRef } from 'react';-import { isDefined } from 'twenty-shared/utils';-import { Modal } from 'twenty-ui/primitives/surfaces';--export const ModalStatefulWrapper = ({- modalInstanceId,- children,- size = 'medium',- padding = 'medium',- onEnter,- isClosable = false,- onClose,- overlay = 'dark',- dataGloballyPreventClickOutside = false,- shouldCloseModalOnClickOutsideOrEscape = true,- renderInDocumentBody = false,- gap,- smallBorderRadius,- narrowWidth,- autoHeight,- width,-}: ModalStatefulWrapperProps) => {- const isMobile = useIsMobile();- const modalRef = useRef<HTMLDivElement>(null);- const { container } = useModalContainer();-- const effectiveContainer = renderInDocumentBody ? document.body : container;- const isInContainer = isDefined(container) && !renderInDocumentBody;-- const isModalOpened = useAtomComponentStateValue(- isModalOpenedComponentState,- modalInstanceId,- );-- const { closeModal } = useModal();-- const handleClose = () => {- onClose?.();- if (shouldCloseModalOnClickOutsideOrEscape) {- closeModal(modalInstanceId);- }- };-- return (- <ModalComponentInstanceContext.Provider- value={{ instanceId: modalInstanceId }}- >- <ClickOutsideListenerContext.Provider- value={{- excludedClickOutsideId: MODAL_CLICK_OUTSIDE_LISTENER_EXCLUDED_ID,- }}- >- {isModalOpened && (- <ModalHotkeysAndClickOutsideEffect- modalInstanceId={modalInstanceId}- modalRef={modalRef}- onEnter={onEnter}- isClosable={isClosable}- onClose={handleClose}- />- )}- <Modal- isOpen={isModalOpened}- size={size}- padding={padding}- overlay={isInContainer ? 'light' : overlay}- isMobile={isMobile}- isInContainer={isInContainer}- container={effectiveContainer}- gap={gap}- smallBorderRadius={smallBorderRadius}- narrowWidth={narrowWidth}- autoHeight={autoHeight}- width={width}- modalZIndex={RootStackingContextZIndices.RootModal}- backdropZIndex={RootStackingContextZIndices.RootModalBackDrop}- backdropClickOutsideId={MODAL_BACKDROP_CLICK_OUTSIDE_ID}- preventClickOutside={dataGloballyPreventClickOutside}- modalRef={modalRef}- >- {children}- </Modal>- </ClickOutsideListenerContext.Provider>- </ModalComponentInstanceContext.Provider>- );-};diff --git a/packages/twenty-front/src/modules/ui/layout/modal/components/StyledCenteredButton.tsx b/packages/twenty-front/src/modules/ui/layout/modal/components/StyledCenteredButton.tsxdeleted file mode 100644index 102a616256c..00000000000--- a/packages/twenty-front/src/modules/ui/layout/modal/components/StyledCenteredButton.tsx+++ /dev/null@@ -1,8 +0,0 @@-import { styled } from '@linaria/react';-import { Button } from 'twenty-ui/primitives/input';-import { themeCssVariables } from 'twenty-ui/theme-constants';--export const StyledCenteredButton = styled(Button)`- box-sizing: border-box;- margin-top: ${themeCssVariables.spacing[2]};-`;diff --git a/packages/twenty-front/src/modules/ui/layout/modal/components/__stories__/Modal.stories.tsx b/packages/twenty-front/src/modules/ui/layout/modal/components/__stories__/Modal.stories.tsxdeleted file mode 100644index c4216345be6..00000000000--- a/packages/twenty-front/src/modules/ui/layout/modal/components/__stories__/Modal.stories.tsx+++ /dev/null@@ -1,138 +0,0 @@-import {- type Decorator,- type Meta,- type StoryObj,-} from '@storybook/react-vite';-import { expect, fn, userEvent, waitFor, within } from 'storybook/test';--import { ModalStatefulWrapper } from '@/ui/layout/modal/components/ModalStatefulWrapper';-import { isModalOpenedComponentState } from '@/ui/layout/modal/states/isModalOpenedComponentState';-import { focusStackState } from '@/ui/utilities/focus/states/focusStackState';-import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';-import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';-import {- ModalContent,- ModalFooter,- ModalHeader,-} from 'twenty-ui/primitives/surfaces';-import { ComponentDecorator } from 'twenty-ui/testing';-import { RootDecorator } from '~/testing/decorators/RootDecorator';-import { sleep } from '~/utils/sleep';--const JotaiInitDecorator: Decorator = (Story) => {- jotaiStore.set(- isModalOpenedComponentState.atomFamily({- instanceId: 'modal-id',- }),- true,- );- jotaiStore.set(focusStackState.atom, [- {- focusId: 'modal-id',- componentInstance: {- componentType: FocusComponentType.MODAL,- componentInstanceId: 'modal-id',- },- globalHotkeysConfig: {- enableGlobalHotkeysWithModifiers: true,- enableGlobalHotkeysConflictingWithKeyboard: true,- },- },- ]);- return <Story />;-};--const meta: Meta<typeof ModalStatefulWrapper> = {- title: 'UI/Layout/Modal/ModalStatefulWrapper',- component: ModalStatefulWrapper,- decorators: [JotaiInitDecorator, RootDecorator, ComponentDecorator],- parameters: {- disableHotkeyInitialization: true,- },-};--export default meta;-type Story = StoryObj<typeof ModalStatefulWrapper>;--const closeMock = fn();--export const Default: Story = {- args: {- modalInstanceId: 'modal-id',- size: 'medium',- padding: 'medium',- children: (- <>- <ModalHeader>Stay in touch</ModalHeader>- <ModalContent>- This is a dummy newletter form so don't bother trying to test it. Not- that I expect you to, anyways. :)- </ModalContent>- <ModalFooter>- By using Twenty, you're opting for the finest CRM experience you'll- ever encounter.- </ModalFooter>- </>- ),- },-};--export const CloseClosableModalOnClickOutside: Story = {- args: {- modalInstanceId: 'modal-id',- size: 'medium',- padding: 'medium',- isClosable: true,- onClose: closeMock,- children: (- <>- <ModalHeader>Click Outside Test</ModalHeader>- <ModalContent>- This modal should close when clicking outside of it.- </ModalContent>- </>- ),- },- play: async ({ canvasElement }) => {- const canvas = within(canvasElement.ownerDocument.body);-- await canvas.findByText('Click Outside Test');-- const backdrop = await canvas.findByTestId('modal-backdrop');- await sleep(100);- await userEvent.click(backdrop);-- await waitFor(() => {- expect(closeMock).toHaveBeenCalledTimes(1);- });- },-};--export const CloseClosableModalOnEscape: Story = {- args: {- modalInstanceId: 'modal-id',- size: 'medium',- padding: 'medium',- isClosable: true,- onClose: closeMock,- children: (- <>- <ModalHeader>Escape Key Test</ModalHeader>- <ModalContent>- This modal should close when pressing the Escape key.- </ModalContent>- </>- ),- },- play: async ({ canvasElement }) => {- const canvas = within(canvasElement.ownerDocument.body);-- await canvas.findByText('Escape Key Test');-- await userEvent.keyboard('{Escape}');-- await waitFor(() => {- expect(closeMock).toHaveBeenCalledTimes(1);- });- },-};diff --git a/packages/twenty-front/src/modules/ui/layout/modal/constants/ModalBackdropClickOutsideId.ts b/packages/twenty-front/src/modules/ui/layout/modal/constants/ModalBackdropClickOutsideId.tsdeleted file mode 100644index 7f6a41428cf..00000000000--- a/packages/twenty-front/src/modules/ui/layout/modal/constants/ModalBackdropClickOutsideId.ts+++ /dev/null@@ -1 +0,0 @@-export const MODAL_BACKDROP_CLICK_OUTSIDE_ID = 'modal-backdrop';diff --git a/packages/twenty-front/src/modules/ui/layout/modal/constants/ModalClickOutsideListenerExcludedClassName.ts b/packages/twenty-front/src/modules/ui/layout/modal/constants/ModalClickOutsideListenerExcludedClassName.tsdeleted file mode 100644index bc8f721890e..00000000000--- a/packages/twenty-front/src/modules/ui/layout/modal/constants/ModalClickOutsideListenerExcludedClassName.ts+++ /dev/null@@ -1,2 +0,0 @@-export const MODAL_CLICK_OUTSIDE_LISTENER_EXCLUDED_ID =- 'modal-click-outside-listener-excluded';diff --git a/packages/twenty-front/src/modules/ui/layout/modal/contexts/ModalContainerContext.tsx b/packages/twenty-front/src/modules/ui/layout/modal/contexts/ModalContainerContext.tsxdeleted file mode 100644index ded9ce9fe8d..00000000000--- a/packages/twenty-front/src/modules/ui/layout/modal/contexts/ModalContainerContext.tsx+++ /dev/null@@ -1,13 +0,0 @@-import { createContext, useContext } from 'react';--export type ModalContainerContextValue = {- container: HTMLElement | null;-};--export const ModalContainerContext = createContext<ModalContainerContextValue>({- container: null,-});--export const useModalContainer = () => {- return useContext(ModalContainerContext);-};diff --git a/packages/twenty-front/src/modules/ui/layout/modal/hooks/__tests__/useModal.spec.tsx b/packages/twenty-front/src/modules/ui/layout/modal/hooks/__tests__/useModal.spec.tsxdeleted file mode 100644index e2da09a5344..00000000000--- a/packages/twenty-front/src/modules/ui/layout/modal/hooks/__tests__/useModal.spec.tsx+++ /dev/null@@ -1,121 +0,0 @@-import { renderHook } from '@testing-library/react';-import { createStore, Provider } from 'jotai';-import { type ReactNode, act } from 'react';--import { useModal } from '@/ui/layout/modal/hooks/useModal';-import { isModalOpenedComponentState } from '@/ui/layout/modal/states/isModalOpenedComponentState';-import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';--const modalId = 'test-modal-id';--const createTestWrapper = () => {- const store = createStore();-- const TestWrapper = ({ children }: { children: ReactNode }) => (- <Provider store={store}>{children}</Provider>- );-- return TestWrapper;-};--describe('useModal', () => {- it('should open a modal', () => {- const { result } = renderHook(- () => {- const modal = useModal();- const isModalOpened = useAtomComponentStateValue(- isModalOpenedComponentState,- modalId,- );- return { modal, isModalOpened };- },- {- wrapper: createTestWrapper(),- },- );-- act(() => {- result.current.modal.openModal(modalId);- });-- expect(result.current.isModalOpened).toBe(true);- });-- it('should close a modal', () => {- const { result } = renderHook(- () => {- const modal = useModal();- const isModalOpened = useAtomComponentStateValue(- isModalOpenedComponentState,- modalId,- );- return { modal, isModalOpened };- },- {- wrapper: createTestWrapper(),- },- );-- act(() => {- result.current.modal.openModal(modalId);- });- expect(result.current.isModalOpened).toBe(true);-- act(() => {- result.current.modal.closeModal(modalId);- });-- expect(result.current.isModalOpened).toBe(false);- });-- it('should toggle a modal (open when closed)', () => {- const { result } = renderHook(- () => {- const modal = useModal();- const isModalOpened = useAtomComponentStateValue(- isModalOpenedComponentState,- modalId,- );- return { modal, isModalOpened };- },- {- wrapper: createTestWrapper(),- },- );-- expect(result.current.isModalOpened).toBe(false);-- act(() => {- result.current.modal.toggleModal(modalId);- });-- expect(result.current.isModalOpened).toBe(true);- });-- it('should toggle a modal (close when open)', () => {- const { result } = renderHook(- () => {- const modal = useModal();- const isModalOpened = useAtomComponentStateValue(- isModalOpenedComponentState,- modalId,- );- return { modal, isModalOpened };- },- {- wrapper: createTestWrapper(),- },- );-- act(() => {- result.current.modal.openModal(modalId);- });- expect(result.current.isModalOpened).toBe(true);-- act(() => {- result.current.modal.toggleModal(modalId);- });-- expect(result.current.isModalOpened).toBe(false);- });-});diff --git a/packages/twenty-front/src/modules/ui/layout/modal/states/isModalOpenedComponentState.ts b/packages/twenty-front/src/modules/ui/layout/modal/states/isModalOpenedComponentState.tsdeleted file mode 100644index 52af1986db1..00000000000--- a/packages/twenty-front/src/modules/ui/layout/modal/states/isModalOpenedComponentState.ts+++ /dev/null@@ -1,8 +0,0 @@-import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState';-import { ModalComponentInstanceContext } from '@/ui/layout/modal/contexts/ModalComponentInstanceContext';--export const isModalOpenedComponentState = createAtomComponentState<boolean>({- key: 'isModalOpenedComponentState',- defaultValue: false,- componentInstanceContext: ModalComponentInstanceContext,-});diff --git a/packages/twenty-front/src/modules/ui/layout/modal/types/ModalStatefulWrapperProps.ts b/packages/twenty-front/src/modules/ui/layout/modal/types/ModalStatefulWrapperProps.tsdeleted file mode 100644index 2a6ce5f1e98..00000000000--- a/packages/twenty-front/src/modules/ui/layout/modal/types/ModalStatefulWrapperProps.ts+++ /dev/null@@ -1,24 +0,0 @@-import type React from 'react';-import { type ModalProps } from 'twenty-ui/primitives/surfaces';--export type ModalStatefulWrapperProps = Pick<- ModalProps,- | 'size'- | 'padding'- | 'overlay'- | 'gap'- | 'smallBorderRadius'- | 'narrowWidth'- | 'autoHeight'- | 'width'-> &- React.PropsWithChildren & {- modalInstanceId: string;- onEnter?: () => void;- dataGloballyPreventClickOutside?: boolean;- shouldCloseModalOnClickOutsideOrEscape?: boolean;- renderInDocumentBody?: boolean;- } & (- | { isClosable: true; onClose?: () => void }- | { isClosable?: false; onClose?: never }- );diff --git a/packages/twenty-front/src/pages/auth/Authorize.tsx b/packages/twenty-front/src/pages/auth/Authorize.tsxindex 60f17268aad..da406c81a40 100644--- a/packages/twenty-front/src/pages/auth/Authorize.tsx+++ b/packages/twenty-front/src/pages/auth/Authorize.tsx@@ -1,3 +1,4 @@+import { StyledAuthContent } from '@/auth/components/StyledAuthContent';import { styled } from '@linaria/react';import { useContext, useEffect, useState } from 'react';import { useSearchParams } from 'react-router-dom';@@ -17,7 +18,6 @@ import {IconUserCircle,} from 'twenty-ui/icon';import { Heading } from 'twenty-ui/primitives/typography';-import { ModalContent } from 'twenty-ui/primitives/surfaces';import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';import {AuthorizeAppDocument,@@ -244,18 +244,20 @@ export const Authorize = () => {if (isDefined(queryError)) {return (- <ModalContent isVerticallyCentered isHorizontallyCentered>+ <StyledAuthContent><StyledCardWrapper>- <ModalContent contentPadding={10}>+ <StyledAuthContent+ style={{ alignItems: 'stretch', justifyContent: 'flex-start' }}+ ><StyledOAuthTitle level={2} size="lg"><Trans>Something went wrong</Trans></StyledOAuthTitle><StyledErrorText>{t`Unable to load application details. Please try again later.`}</StyledErrorText>- </ModalContent>+ </StyledAuthContent></StyledCardWrapper>- </ModalContent>+ </StyledAuthContent>);}@@ -268,12 +270,14 @@ export const Authorize = () => {const requestedScopes: string[] = applicationRegistration.oAuthScopes ?? [];return (- <ModalContent isVerticallyCentered isHorizontallyCentered>+ <StyledAuthContent><StyledCardWrapper><StyledHeader><AppConnectionHeader appLogoUrl={appLogoUrl} appName={appName} /></StyledHeader>- <ModalContent contentPadding={10}>+ <StyledAuthContent+ style={{ alignItems: 'stretch', justifyContent: 'flex-start' }}+ ><StyledOAuthTitle level={2} size="lg"><Trans>Connect {appName} to your account</Trans></StyledOAuthTitle>@@ -309,8 +313,8 @@ export const Authorize = () => {onAuthorize={handleAuthorize}isLoading={isAuthorizing}/>- </ModalContent>+ </StyledAuthContent></StyledCardWrapper>- </ModalContent>+ </StyledAuthContent>);};diff --git a/packages/twenty-front/src/pages/auth/PasswordReset.tsx b/packages/twenty-front/src/pages/auth/PasswordReset.tsxindex 6f727a78dd1..944f1c525eb 100644--- a/packages/twenty-front/src/pages/auth/PasswordReset.tsx+++ b/packages/twenty-front/src/pages/auth/PasswordReset.tsx@@ -1,3 +1,4 @@+import { StyledAuthContent } from '@/auth/components/StyledAuthContent';import { SKELETON_LOADER_HEIGHT_SIZES } from '@/activities/components/SkeletonLoader';import { Logo } from '@/auth/components/Logo';import { StyledOnboardingContentContainer } from '@/auth/components/StyledOnboardingContentContainer';@@ -31,7 +32,6 @@ import { AppPath } from 'twenty-shared/types';import { useToast } from 'twenty-ui/primitives/feedback';import { MainButton } from 'twenty-ui/components';import { AnimatedEaseIn } from 'twenty-ui/primitives/layout';-import { ModalContent } from 'twenty-ui/primitives/surfaces';import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';import { z } from 'zod';import {@@ -211,7 +211,7 @@ export const PasswordReset = () => {return (isTokenValid && (- <ModalContent isVerticallyCentered isHorizontallyCentered>+ <StyledAuthContent><StyledMainContainer><AnimatedEaseIn><Logo@@ -305,7 +305,7 @@ export const PasswordReset = () => {)}</StyledOnboardingContentContainer></StyledMainContainer>- </ModalContent>+ </StyledAuthContent>));};diff --git a/packages/twenty-front/src/pages/auth/SignInUp.tsx b/packages/twenty-front/src/pages/auth/SignInUp.tsxindex 11a67daaf2b..2835057df58 100644--- a/packages/twenty-front/src/pages/auth/SignInUp.tsx+++ b/packages/twenty-front/src/pages/auth/SignInUp.tsx@@ -1,3 +1,4 @@+import { StyledAuthContent } from '@/auth/components/StyledAuthContent';import { useSignInUp } from '@/auth/sign-in-up/hooks/useSignInUp';import { useSignInUpForm } from '@/auth/sign-in-up/hooks/useSignInUpForm';import { isCreatingWorkspaceState } from '@/auth/states/isCreatingWorkspaceState';@@ -32,7 +33,6 @@ import { SignInUpTwoFactorAuthenticationProvision } from '@/auth/sign-in-up/compimport { SignInUpTOTPVerification } from '@/auth/sign-in-up/components/internal/SignInUpTwoFactorAuthenticationVerification';import { useWorkspaceFromInviteHash } from '@/auth/sign-in-up/hooks/useWorkspaceFromInviteHash';import { clientConfigApiStatusState } from '@/client-config/states/clientConfigApiStatusState';-import { ModalContent } from 'twenty-ui/primitives/surfaces';import { useLingui } from '@lingui/react/macro';import { useSearchParams } from 'react-router-dom';import { isDefined } from 'twenty-shared/utils';@@ -212,9 +212,9 @@ export const SignInUp = () => {) : (<StyledBackground>{signInUpStep === SignInUpStep.EmailVerification ? (- <ModalContent isVerticallyCentered isHorizontallyCentered>+ <StyledAuthContent><EmailVerificationSent email={searchParams.get('email')} />- </ModalContent>+ </StyledAuthContent>) : (<SignInUpStandardContentworkspacePublicData={workspacePublicData}diff --git a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminAiProviderDetail.tsx b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminAiProviderDetail.tsxindex 011b8358569..ff0d6ea55ba 100644--- a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminAiProviderDetail.tsx+++ b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminAiProviderDetail.tsx@@ -15,8 +15,8 @@ import { SettingsPageContainer } from '@/settings/components/SettingsPageContainimport { SettingsSkeletonLoader } from '@/settings/components/SettingsSkeletonLoader';import { SettingsTableCard } from '@/settings/components/SettingsTableCard';import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useMutation, useQuery } from '@apollo/client/react';import { t } from '@lingui/core/macro';import { useMemo, useState } from 'react';@@ -53,7 +53,7 @@ export const SettingsAdminAiProviderDetail = () => {const navigate = useNavigate();const { enqueueToast } = useToast();const { refetch: refetchClientConfig } = useClientConfig();- const { openModal } = useModal();+ const { openDialog } = useDialog();const [searchQuery, setSearchQuery] = useState('');const [modelToRemove, setModelToRemove] = useState<{modelId: string;@@ -199,7 +199,7 @@ export const SettingsAdminAiProviderDetail = () => {label: model.label,name: model.name ?? model.modelId,});- openModal(REMOVE_MODEL_MODAL_ID);+ openDialog(REMOVE_MODEL_MODAL_ID);};const providerInfoItems = useMemo(() => {@@ -412,7 +412,7 @@ export const SettingsAdminAiProviderDetail = () => {/><ButtonstartIcon={<IconTrash />}- onClick={() => openModal(REMOVE_PROVIDER_MODAL_ID)}+ onClick={() => openDialog(REMOVE_PROVIDER_MODAL_ID)}variant="outline"color="danger">{t`Remove provider`}</Button>@@ -420,8 +420,8 @@ export const SettingsAdminAiProviderDetail = () => {)}</SettingsPageContainer>- <ConfirmationModal- modalInstanceId={REMOVE_PROVIDER_MODAL_ID}+ <ConfirmationDialog+ dialogId={REMOVE_PROVIDER_MODAL_ID}title={t`Remove provider "${provider?.label ?? providerName ?? ''}"`}subtitle={t`This will disconnect all models from this provider. Models will no longer be available until a new provider is configured.`}onConfirmClick={handleRemoveProvider}@@ -429,8 +429,8 @@ export const SettingsAdminAiProviderDetail = () => {confirmButtonColor="danger"/>- <ConfirmationModal- modalInstanceId={REMOVE_MODEL_MODAL_ID}+ <ConfirmationDialog+ dialogId={REMOVE_MODEL_MODAL_ID}title={t`Remove model "${modelToRemove?.label ?? ''}"`}subtitle={t`This model will be removed from the provider. You can re-add it later.`}onConfirmClick={handleRemoveModel}diff --git a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminApplicationRegistrationDangerZone.tsx b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminApplicationRegistrationDangerZone.tsxindex 3a2e66aae34..661c654fd9f 100644--- a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminApplicationRegistrationDangerZone.tsx+++ b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminApplicationRegistrationDangerZone.tsx@@ -1,6 +1,7 @@+import { DialogInstance } from '@/ui/layout/dialog/components/DialogInstance';import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { useMutation, useQuery } from '@apollo/client/react';import { styled } from '@linaria/react';@@ -24,11 +25,6 @@ import {TransferApplicationRegistrationOwnershipDocument,} from '~/generated-metadata/graphql';import { useNavigateSettings } from '~/hooks/useNavigateSettings';-import {- StyledAppModal,- StyledAppModalButton,- StyledAppModalSection,-} from '~/pages/settings/applications/components/SettingsAppModalLayout';const DELETE_REGISTRATION_MODAL_ID = 'delete-application-registration-modal';@@ -40,6 +36,14 @@ const CLAIM_OWNERSHIP_MODAL_ID =const DELETE_REGISTRATION_BUTTON_ID = 'delete-registration-button';+const StyledActionButton = styled(Button)`+ margin-top: ${themeCssVariables.spacing[2]};+`;++const StyledDescriptionSection = styled(Section.Root)`+ margin-bottom: ${themeCssVariables.spacing[6]};+`;+const StyledDangerButtonGroup = styled.div`display: flex;gap: ${themeCssVariables.spacing[2]};@@ -55,7 +59,7 @@ export const SettingsAdminApplicationRegistrationDangerZone = ({const { t } = useLingui();const navigate = useNavigateSettings();const { enqueueToast } = useToast();- const { openModal, closeModal } = useModal();+ const { openDialog, closeDialog } = useDialog();const [isLoading, setIsLoading] = useState(false);const [isTransferring, setIsTransferring] = useState(false);@@ -177,7 +181,7 @@ export const SettingsAdminApplicationRegistrationDangerZone = ({variant: 'success',children: t`Ownership claimed successfully`,});- closeModal(CLAIM_OWNERSHIP_MODAL_ID);+ closeDialog(CLAIM_OWNERSHIP_MODAL_ID);} catch {enqueueToast({variant: 'error',@@ -212,7 +216,7 @@ export const SettingsAdminApplicationRegistrationDangerZone = ({variant="outline"startIcon={<IconTrash />}disabled={hasActiveInstalls}- onClick={() => openModal(DELETE_REGISTRATION_MODAL_ID)}+ onClick={() => openDialog(DELETE_REGISTRATION_MODAL_ID)}>{t`Delete app`}</Button>@@ -223,24 +227,24 @@ export const SettingsAdminApplicationRegistrationDangerZone = ({? fromAdmin && (<ButtonstartIcon={<IconUserPlus />}- onClick={() => openModal(CLAIM_OWNERSHIP_MODAL_ID)}+ onClick={() => openDialog(CLAIM_OWNERSHIP_MODAL_ID)}variant="outline">{t`Claim ownership`}</Button>): !isUnclaimed && (<ButtonstartIcon={<IconShare />}- onClick={() => openModal(TRANSFER_OWNERSHIP_MODAL_ID)}+ onClick={() => openDialog(TRANSFER_OWNERSHIP_MODAL_ID)}variant="outline">{t`Transfer ownership`}</Button>)}</StyledDangerButtonGroup></Section.Root>- <ConfirmationModal+ <ConfirmationDialogconfirmationPlaceholder={confirmationValue}confirmationValue={confirmationValue}- modalInstanceId={DELETE_REGISTRATION_MODAL_ID}+ dialogId={DELETE_REGISTRATION_MODAL_ID}title={t`Delete app`}subtitle={<Trans>@@ -254,8 +258,8 @@ export const SettingsAdminApplicationRegistrationDangerZone = ({loading={isLoading}/>- <ConfirmationModal- modalInstanceId={CLAIM_OWNERSHIP_MODAL_ID}+ <ConfirmationDialog+ dialogId={CLAIM_OWNERSHIP_MODAL_ID}title={t`Claim ownership`}subtitle={<Trans>@@ -269,47 +273,57 @@ export const SettingsAdminApplicationRegistrationDangerZone = ({loading={isClaiming}/>- <StyledAppModal- modalId={TRANSFER_OWNERSHIP_MODAL_ID}- isClosable+ <DialogInstance+ dialogId={TRANSFER_OWNERSHIP_MODAL_ID}+ dismissibleonClose={() => setTransferSubdomain('')}- padding="large"- dataGloballyPreventClickOutside>- <Dialog.Title>{t`Transfer ownership`}</Dialog.Title>- <StyledAppModalSection align="center" color="primary">- {t`Enter the workspace subdomain to transfer this app to. You will lose access to manage it.`}- </StyledAppModalSection>- <Section.Root>- <SettingsTextInput- instanceId="transfer-ownership-subdomain"- value={transferSubdomain}- onChange={setTransferSubdomain}- placeholder={t`e.g. my-workspace`}- fullWidth- disableHotkeys- label={t`Target workspace subdomain`}- autoFocusOnMount- />- </Section.Root>- <StyledAppModalButton- onClick={() => {- closeModal(TRANSFER_OWNERSHIP_MODAL_ID);- setTransferSubdomain('');- }}- fullWidth- variant="outline"- >{t`Cancel`}</StyledAppModalButton>- <StyledAppModalButton- onClick={handleTransferOwnership}- disabled={- !isNonEmptyString(transferSubdomain.trim()) || isTransferring- }- fullWidth- variant="outline"- color="danger"- >{t`Transfer`}</StyledAppModalButton>- </StyledAppModal>+ {({ container, backdrop, viewportProps, onKeyDown }) => (+ <Dialog.Popup+ {...{ container, backdrop, viewportProps, onKeyDown }}+ data-globally-prevent-click-outside+ style={{+ padding: 'var(--t-spacing-6)',+ borderRadius: 'var(--t-spacing-1)',+ width: 'calc(400px - var(--t-spacing-32))',+ }}+ >+ <Dialog.Title>{t`Transfer ownership`}</Dialog.Title>+ <StyledDescriptionSection align="center" color="primary">+ {t`Enter the workspace subdomain to transfer this app to. You will lose access to manage it.`}+ </StyledDescriptionSection>+ <Section.Root>+ <SettingsTextInput+ instanceId="transfer-ownership-subdomain"+ value={transferSubdomain}+ onChange={setTransferSubdomain}+ placeholder={t`e.g. my-workspace`}+ fullWidth+ disableHotkeys+ label={t`Target workspace subdomain`}+ autoFocusOnMount+ />+ </Section.Root>+ <StyledActionButton+ onClick={() => {+ closeDialog(TRANSFER_OWNERSHIP_MODAL_ID);+ setTransferSubdomain('');+ }}+ fullWidth+ variant="outline"+ >{t`Cancel`}</StyledActionButton>+ <StyledActionButton+ onClick={handleTransferOwnership}+ disabled={+ !isNonEmptyString(transferSubdomain.trim()) || isTransferring+ }+ fullWidth+ variant="outline"+ color="danger"+ >{t`Transfer`}</StyledActionButton>+ </Dialog.Popup>+ )}+ </DialogInstance></>);};diff --git a/packages/twenty-front/src/pages/settings/ai/SettingsToolDetail.tsx b/packages/twenty-front/src/pages/settings/ai/SettingsToolDetail.tsxindex 0044c92e919..6b783a08eba 100644--- a/packages/twenty-front/src/pages/settings/ai/SettingsToolDetail.tsx+++ b/packages/twenty-front/src/pages/settings/ai/SettingsToolDetail.tsx@@ -5,8 +5,8 @@ import { SettingsPageContainer } from '@/settings/components/SettingsPageContainimport { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';import { SettingsLogicFunctionLabelContainer } from '@/settings/logic-functions/components/SettingsLogicFunctionLabelContainer';import { TextArea } from '@/ui/input/components/TextArea';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useQuery } from '@apollo/client/react';import { t } from '@lingui/core/macro';@@ -38,7 +38,7 @@ export const SettingsToolDetail = () => {const { enqueueToast } = useToast();const { updateLogicFunction, deleteLogicFunction } =usePersistLogicFunction();- const { openModal } = useModal();+ const { openDialog } = useDialog();const currentWorkspace = useAtomStateValue(currentWorkspaceState);const [isDeleting, setIsDeleting] = useState(false);const [editedName, setEditedName] = useState<string | null>(null);@@ -253,7 +253,7 @@ export const SettingsToolDetail = () => {<ButtonstartIcon={<IconTrash />}size="sm"- onClick={() => openModal(DELETE_TOOL_MODAL_ID)}+ onClick={() => openDialog(DELETE_TOOL_MODAL_ID)}variant="outline"color="danger">{t`Delete`}</Button>@@ -262,8 +262,8 @@ export const SettingsToolDetail = () => {</>)}</SettingsPageContainer>- <ConfirmationModal- modalInstanceId={DELETE_TOOL_MODAL_ID}+ <ConfirmationDialog+ dialogId={DELETE_TOOL_MODAL_ID}title={t`Delete Tool`}subtitle={t`Are you sure you want to delete this tool? This action cannot be undone.`}onConfirmClick={handleDelete}diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentDeleteConfirmationModal.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentDeleteConfirmationModal.tsxindex 228ba9965dc..c29cd4a5588 100644--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentDeleteConfirmationModal.tsx+++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentDeleteConfirmationModal.tsx@@ -1,8 +1,8 @@import { Trans, useLingui } from '@lingui/react/macro';import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useMutation } from '@apollo/client/react';import { SettingsPath } from 'twenty-shared/types';@@ -22,7 +22,7 @@ export const SettingsAgentDeleteConfirmationModal = ({agentName,}: SettingsAgentDeleteConfirmationModalProps) => {const { t } = useLingui();- const { closeModal } = useModal();+ const { closeDialog } = useDialog();const navigate = useNavigateSettings();const { enqueueToast } = useToast();const [deleteAgent] = useMutation(DeleteOneAgentDocument);@@ -34,7 +34,7 @@ export const SettingsAgentDeleteConfirmationModal = ({input: { id: agentId },},});- closeModal(DELETE_AGENT_MODAL_ID);+ closeDialog(DELETE_AGENT_MODAL_ID);navigate(SettingsPath.AI);} catch (error) {enqueueToast(getToastOptionsFromError({ error }));@@ -42,10 +42,10 @@ export const SettingsAgentDeleteConfirmationModal = ({};return (- <ConfirmationModal+ <ConfirmationDialogconfirmationValue={agentName}confirmationPlaceholder={agentName}- modalInstanceId={DELETE_AGENT_MODAL_ID}+ dialogId={DELETE_AGENT_MODAL_ID}title={t`Delete Agent`}subtitle={<Trans>diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentEvalsTab.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentEvalsTab.tsxindex bef35e69a6a..f55a2e58c73 100644--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentEvalsTab.tsx+++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentEvalsTab.tsx@@ -6,8 +6,8 @@ import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent';import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState';import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState';import { useMutation } from '@apollo/client/react';@@ -65,7 +65,7 @@ export const SettingsAgentEvalsTab = ({}: SettingsAgentEvalsTabProps) => {const [newInput, setNewInput] = useState('');const [inputToDelete, setInputToDelete] = useState<string | null>(null);- const { openModal } = useModal();+ const { openDialog } = useDialog();const { closeDropdown } = useCloseDropdown();const { enqueueToast } = useToast();const navigate = useNavigate();@@ -118,7 +118,7 @@ export const SettingsAgentEvalsTab = ({const openDeleteModal = (id: string) => {setInputToDelete(id);- openModal(DELETE_EVAL_INPUT_MODAL_ID);+ openDialog(DELETE_EVAL_INPUT_MODAL_ID);};const handleRunInput = (text: string, itemId: string) => {@@ -197,8 +197,8 @@ export const SettingsAgentEvalsTab = ({)}</Section.Root>- <ConfirmationModal- modalInstanceId={DELETE_EVAL_INPUT_MODAL_ID}+ <ConfirmationDialog+ dialogId={DELETE_EVAL_INPUT_MODAL_ID}title={t`Delete Evaluation Input`}subtitle={t`Are you sure you want to delete this evaluation input?`}onConfirmClick={handleDeleteInput}diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentSettingsTab.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentSettingsTab.tsxindex 96ef923f05b..76eb4040307 100644--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentSettingsTab.tsx+++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentSettingsTab.tsx@@ -7,7 +7,7 @@ import { aiModelsState } from '@/client-config/states/aiModelsState';import { IconPicker } from '@/ui/input/components/IconPicker';import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';import { TextArea } from '@/ui/input/components/TextArea';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { isDefined } from 'twenty-shared/utils';import { Section } from 'twenty-ui/components';import { IconTrash } from 'twenty-ui/icon';@@ -61,7 +61,7 @@ export const SettingsAgentSettingsTab = ({agent,}: SettingsAgentSettingsTabProps) => {const { t } = useLingui();- const { openModal } = useModal();+ const { openDialog } = useDialog();const aiModels = useAtomStateValue(aiModelsState);const noModelsAvailable = aiModels.length === 0;@@ -163,7 +163,7 @@ export const SettingsAgentSettingsTab = ({/><ButtonstartIcon={<IconTrash />}- onClick={() => openModal(DELETE_AGENT_MODAL_ID)}+ onClick={() => openDialog(DELETE_AGENT_MODAL_ID)}variant="outline"color="danger">{t`Delete Agent`}</Button>diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsSkillDangerZone.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsSkillDangerZone.tsxindex 0d8f811a23c..005e319fe0e 100644--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsSkillDangerZone.tsx+++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsSkillDangerZone.tsx@@ -10,8 +10,8 @@ import { Button } from 'twenty-ui/primitives/input';import { themeCssVariables } from 'twenty-ui/theme-constants';import { getToastOptionsFromError } from '@/error-handler/utils/getToastOptionsFromError';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import {ActivateSkillDocument,DeactivateSkillDocument,@@ -39,7 +39,7 @@ export const SettingsSkillDangerZone = ({}: SettingsSkillDangerZoneProps) => {const navigate = useNavigateSettings();const { enqueueToast } = useToast();- const { openModal, closeModal } = useModal();+ const { openDialog, closeDialog } = useDialog();const [isSubmitting, setIsSubmitting] = useState(false);const [deleteSkill] = useMutation(DeleteSkillDocument);@@ -61,7 +61,7 @@ export const SettingsSkillDangerZone = ({const handleDelete = () =>runAndLeave(async () => {await deleteSkill({ variables: { id: skill.id } });- closeModal(DELETE_SKILL_MODAL_ID);+ closeDialog(DELETE_SKILL_MODAL_ID);});const handleToggleActive = () =>@@ -89,14 +89,14 @@ export const SettingsSkillDangerZone = ({<ButtonstartIcon={<IconTrash />}size="sm"- onClick={() => openModal(DELETE_SKILL_MODAL_ID)}+ onClick={() => openDialog(DELETE_SKILL_MODAL_ID)}variant="outline"color="danger">{t`Delete`}</Button>)}</StyledDangerButtonsContainer>- <ConfirmationModal- modalInstanceId={DELETE_SKILL_MODAL_ID}+ <ConfirmationDialog+ dialogId={DELETE_SKILL_MODAL_ID}title={t`Delete Skill`}subtitle={t`Are you sure you want to delete this skill? This action cannot be undone.`}onConfirmClick={handleDelete}diff --git a/packages/twenty-front/src/pages/settings/applications/SettingsApplicationConnectionDetail.tsx b/packages/twenty-front/src/pages/settings/applications/SettingsApplicationConnectionDetail.tsxindex 65c91a4c37a..23e492a464a 100644--- a/packages/twenty-front/src/pages/settings/applications/SettingsApplicationConnectionDetail.tsx+++ b/packages/twenty-front/src/pages/settings/applications/SettingsApplicationConnectionDetail.tsx@@ -15,8 +15,8 @@ import { themeCssVariables } from 'twenty-ui/theme-constants';import { GET_MY_CONNECTED_ACCOUNTS } from '@/settings/accounts/graphql/queries/getMyConnectedAccounts';import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';import { SettingsSectionSkeletonLoader } from '@/settings/components/SettingsSectionSkeletonLoader';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';import { Table } from '@/ui/layout/table/components/Table';import { TableCell } from '@/ui/layout/table/components/TableCell';@@ -83,7 +83,7 @@ export const SettingsApplicationConnectionDetail = () => {}>();const navigate = useNavigateSettings();- const { openModal } = useModal();+ const { openDialog } = useDialog();const { triggerAppOAuth } = useTriggerAppOAuth();const { connectionProviders, loading: providersLoading } =useFindApplicationConnectionProviders(applicationId);@@ -339,13 +339,13 @@ export const SettingsApplicationConnectionDetail = () => {{connection.visibility !== 'workspace' && (<ButtonstartIcon={<IconUsers />}- onClick={() => openModal(shareWithWorkspaceModalId)}+ onClick={() => openDialog(shareWithWorkspaceModalId)}variant="outline">{t`Share with workspace`}</Button>)}<ButtonstartIcon={<IconTrash />}- onClick={() => openModal(deleteModalId)}+ onClick={() => openDialog(deleteModalId)}variant="outline"color="danger">{t`Disconnect`}</Button>@@ -378,8 +378,8 @@ export const SettingsApplicationConnectionDetail = () => {</TableSection></Table></Section.Root>- <ConfirmationModal- modalInstanceId={deleteModalId}+ <ConfirmationDialog+ dialogId={deleteModalId}title={t`Disconnect connection?`}subtitle={<Trans>@@ -390,8 +390,8 @@ export const SettingsApplicationConnectionDetail = () => {confirmButtonText={t`Disconnect`}loading={isDeleting}/>- <ConfirmationModal- modalInstanceId={shareWithWorkspaceModalId}+ <ConfirmationDialog+ dialogId={shareWithWorkspaceModalId}title={t`Share with workspace?`}subtitle={<Trans>diff --git a/packages/twenty-front/src/pages/settings/applications/__tests__/SettingsApplicationConnectionDetail.test.tsx b/packages/twenty-front/src/pages/settings/applications/__tests__/SettingsApplicationConnectionDetail.test.tsxindex be95bddd8f7..73a03e5a216 100644--- a/packages/twenty-front/src/pages/settings/applications/__tests__/SettingsApplicationConnectionDetail.test.tsx+++ b/packages/twenty-front/src/pages/settings/applications/__tests__/SettingsApplicationConnectionDetail.test.tsx@@ -43,14 +43,14 @@ jest.mock('~/hooks/useNavigateSettings', () => ({useNavigateSettings: jest.fn(() => jest.fn()),}));-jest.mock('@/ui/layout/modal/hooks/useModal', () => ({- useModal: jest.fn(() => ({- openModal: mockOpenModal,+jest.mock('@/ui/layout/dialog/hooks/useDialog', () => ({+ useDialog: jest.fn(() => ({+ openDialog: mockOpenModal,})),}));-jest.mock('@/ui/layout/modal/components/ConfirmationModal', () => ({- ConfirmationModal: ({+jest.mock('@/ui/layout/dialog/components/ConfirmationDialog', () => ({+ ConfirmationDialog: ({confirmButtonText,onConfirmClick,}: {diff --git a/packages/twenty-front/src/pages/settings/applications/components/SettingsAppModalLayout.tsx b/packages/twenty-front/src/pages/settings/applications/components/SettingsAppModalLayout.tsxdeleted file mode 100644index 74e1db6f13d..00000000000--- a/packages/twenty-front/src/pages/settings/applications/components/SettingsAppModalLayout.tsx+++ /dev/null@@ -1,115 +0,0 @@-import { styled } from '@linaria/react';-import React from 'react';--import { ModalStatefulWrapper } from '@/ui/layout/modal/components/ModalStatefulWrapper';-import { Section } from 'twenty-ui/components';-import { Button } from 'twenty-ui/primitives/input';-import {- type ModalOverlay,- type ModalPadding,- type ModalSize,-} from 'twenty-ui/primitives/surfaces';-import { themeCssVariables } from 'twenty-ui/theme-constants';--type StyledAppModalBaseProps = React.PropsWithChildren<{- modalId: string;- size?: ModalSize;- padding?: ModalPadding;- overlay?: ModalOverlay;- dataGloballyPreventClickOutside?: boolean;-}>;--type StyledAppModalProps = StyledAppModalBaseProps &- (- | { isClosable: true; onClose?: () => void }- | { isClosable?: false; onClose?: never }- );--const ModalWrapper = ({- modalId,- children,- size,- padding,- overlay,- dataGloballyPreventClickOutside,- isClosable,- onClose,-}: StyledAppModalBaseProps & { isClosable: boolean; onClose?: () => void }) =>- isClosable ? (- <ModalStatefulWrapper- modalInstanceId={modalId}- isClosable={true}- onClose={onClose}- size={size}- padding={padding}- overlay={overlay}- smallBorderRadius- narrowWidth- autoHeight- dataGloballyPreventClickOutside={dataGloballyPreventClickOutside}- >- {children}- </ModalStatefulWrapper>- ) : (- <ModalStatefulWrapper- modalInstanceId={modalId}- isClosable={false}- size={size}- padding={padding}- overlay={overlay}- smallBorderRadius- narrowWidth- autoHeight- dataGloballyPreventClickOutside={dataGloballyPreventClickOutside}- >- {children}- </ModalStatefulWrapper>- );--export const StyledAppModal = (props: StyledAppModalProps) => (- <ModalWrapper- modalId={props.modalId}- size={props.size}- padding={props.padding}- overlay={props.overlay}- dataGloballyPreventClickOutside={props.dataGloballyPreventClickOutside}- isClosable={props.isClosable ?? false}- onClose={props.isClosable ? props.onClose : undefined}- >- {props.children}- </ModalWrapper>-);--const StyledAppModalButtonContainer = styled.div`- box-sizing: border-box;- display: flex;- justify-content: center;- margin-top: ${themeCssVariables.spacing[2]};-`;--export const StyledAppModalButton = (- props: React.ComponentProps<typeof Button>,-) => (- <StyledAppModalButtonContainer>- {/* oxlint-disable-next-line react/jsx-props-no-spreading */}- <Button {...props} />- </StyledAppModalButtonContainer>-);--export const StyledAppModalTitle = styled.div`- text-align: center;-`;--const StyledAppModalSectionContainer = styled.div`- margin-bottom: ${themeCssVariables.spacing[6]};-`;--export const StyledAppModalSection = ({- children,- ...props-}: React.ComponentProps<typeof Section.Root>) => (- <StyledAppModalSectionContainer>- {/* oxlint-disable-next-line react/jsx-props-no-spreading */}- <Section.Root {...props}>{children}</Section.Root>- </StyledAppModalSectionContainer>-);diff --git a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationRegistrationOAuthTab.tsx b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationRegistrationOAuthTab.tsxindex c9040b6dc8b..1e5bbc1ce40 100644--- a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationRegistrationOAuthTab.tsx+++ b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationRegistrationOAuthTab.tsx@@ -1,7 +1,7 @@import { SettingsTableCard } from '@/settings/components/SettingsTableCard';import { ApiKeyInput } from '@/settings/developers/components/ApiKeyInput';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';import { useMutation } from '@apollo/client/react';import { styled } from '@linaria/react';@@ -35,7 +35,7 @@ export const SettingsApplicationRegistrationOAuthTab = ({}) => {const { t } = useLingui();const { enqueueToast } = useToast();- const { openModal } = useModal();+ const { openDialog } = useDialog();const applicationRegistrationId = registration.id;@@ -142,7 +142,7 @@ export const SettingsApplicationRegistrationOAuthTab = ({<StyledRotateContainer><ButtonstartIcon={<IconRefresh />}- onClick={() => openModal(ROTATE_SECRET_MODAL_ID)}+ onClick={() => openDialog(ROTATE_SECRET_MODAL_ID)}variant="outline">{t`Rotate client secret`}</Button></StyledRotateContainer>@@ -173,10 +173,10 @@ export const SettingsApplicationRegistrationOAuthTab = ({/></Section.Root>- <ConfirmationModal+ <ConfirmationDialogconfirmationPlaceholder={confirmationValue}confirmationValue={confirmationValue}- modalInstanceId={ROTATE_SECRET_MODAL_ID}+ dialogId={ROTATE_SECRET_MODAL_ID}title={t`Rotate client secret`}subtitle={<Trans>diff --git a/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceCommunicationGroupChannelDetail.tsx b/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceCommunicationGroupChannelDetail.tsxindex 5719b7692f9..64c14bc4f33 100644--- a/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceCommunicationGroupChannelDetail.tsx+++ b/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceCommunicationGroupChannelDetail.tsx@@ -10,8 +10,8 @@ import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayimport { SettingsEmailingDomainDnsRecords } from '@/settings/emailing-domains/components/SettingsEmailingDomainDnsRecords';import { SettingsEmailingDomainVerifyButton } from '@/settings/emailing-domains/components/SettingsEmailingDomainVerifyButton';import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useQuery } from '@apollo/client/react';import { styled } from '@linaria/react';import { useLingui } from '@lingui/react/macro';@@ -54,7 +54,7 @@ export const SettingsWorkspaceCommunicationGroupChannelDetail = () => {const { messageChannelId } = useParams<{ messageChannelId: string }>();const { channels, loading } = useMyMessageChannels();const { copyToClipboard } = useCopyToClipboard();- const { openModal } = useModal();+ const { openDialog } = useDialog();const { enqueueToast } = useToast();const { deleteEmailGroupChannel, loading: deleting } =useDeleteEmailGroupChannel();@@ -156,7 +156,7 @@ export const SettingsWorkspaceCommunicationGroupChannelDetail = () => {startIcon={<IconTrash />}size="sm"disabled={deleting}- onClick={() => openModal(DELETE_EMAIL_GROUP_MODAL_ID)}+ onClick={() => openDialog(DELETE_EMAIL_GROUP_MODAL_ID)}variant="outline"color="danger">{t`Delete`}</Button>@@ -242,8 +242,8 @@ export const SettingsWorkspaceCommunicationGroupChannelDetail = () => {)}<SettingsAccountsMessageChannelDetails messageChannel={channel} /></SettingsPageContainer>- <ConfirmationModal- modalInstanceId={DELETE_EMAIL_GROUP_MODAL_ID}+ <ConfirmationDialog+ dialogId={DELETE_EMAIL_GROUP_MODAL_ID}title={t`Delete email channel`}subtitle={t`Are you sure you want to delete ${sourceHandle}? Inbound mail forwarded to this address and outbound replies from it will stop working.`}onConfirmClick={handleDelete}diff --git a/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceUnsubscribeTopicDetail.tsx b/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceUnsubscribeTopicDetail.tsxindex 7a5c4cfe5f2..099334e7490 100644--- a/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceUnsubscribeTopicDetail.tsx+++ b/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceUnsubscribeTopicDetail.tsx@@ -7,8 +7,8 @@ import { useDeleteUnsubscribeTopic } from '@/settings/unsubscribe-topics/hooks/uimport { useUpdateUnsubscribeTopic } from '@/settings/unsubscribe-topics/hooks/useUpdateUnsubscribeTopic';import { SETTINGS_UNSUBSCRIBE_TAB_IDS } from '@/settings/unsubscribers/constants/SettingsUnsubscribeTabIds';import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';import { useLingui } from '@lingui/react/macro';import { useEffect, useState } from 'react';@@ -32,7 +32,7 @@ export const SettingsWorkspaceUnsubscribeTopicDetail = () => {const navigateSettings = useNavigateSettings();const { unsubscribeTopicId } = useParams<{ unsubscribeTopicId: string }>();const { unsubscribeTopics, loading } = useUnsubscribeTopics();- const { openModal } = useModal();+ const { openDialog } = useDialog();const { enqueueToast } = useToast();const { updateUnsubscribeTopic } = useUpdateUnsubscribeTopic();const { deleteUnsubscribeTopic, loading: deleting } =@@ -150,7 +150,7 @@ export const SettingsWorkspaceUnsubscribeTopicDetail = () => {startIcon={<IconTrash />}size="sm"disabled={deleting}- onClick={() => openModal(DELETE_UNSUBSCRIBE_TOPIC_MODAL_ID)}+ onClick={() => openDialog(DELETE_UNSUBSCRIBE_TOPIC_MODAL_ID)}variant="outline"color="danger">{t`Delete`}</Button>@@ -201,8 +201,8 @@ export const SettingsWorkspaceUnsubscribeTopicDetail = () => {</Card></Section.Root></SettingsPageContainer>- <ConfirmationModal- modalInstanceId={DELETE_UNSUBSCRIBE_TOPIC_MODAL_ID}+ <ConfirmationDialog+ dialogId={DELETE_UNSUBSCRIBE_TOPIC_MODAL_ID}title={t`Delete unsubscribe topic`}subtitle={t`Are you sure you want to delete ${topicName}? Recipients will no longer be able to opt out of this category.`}onConfirmClick={handleDelete}diff --git a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectFieldEdit.tsx b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectFieldEdit.tsxindex 47c3f121e8f..4e50add876d 100644--- a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectFieldEdit.tsx+++ b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectFieldEdit.tsx@@ -22,8 +22,8 @@ import { type SettingsDataModelFieldEditFormValues } from '@/settings/data-modelimport { type SettingsFieldType } from '@/settings/data-model/types/SettingsFieldType';import { SettingsTranslationsButton } from '@/settings/translations/components/SettingsTranslationsButton';import { useWorkspaceSurface } from '@/ui/layout/hooks/useWorkspaceSurface';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { navigationMemorizedUrlState } from '@/ui/navigation/states/navigationMemorizedUrlState';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { zodResolver } from '@hookform/resolvers/zod';@@ -58,7 +58,7 @@ export const SettingsObjectFieldEdit = () => {const workspaceSurface = useWorkspaceSurface();const { t } = useLingui();- const { openModal, closeModal } = useModal();+ const { openDialog, closeDialog } = useDialog();const { enqueueToast } = useToast();const navigate = useNavigate();@@ -297,7 +297,7 @@ export const SettingsObjectFieldEdit = () => {return;}- openModal(DELETE_FIELD_MODAL_ID);+ openDialog(DELETE_FIELD_MODAL_ID);};const confirmDelete = async () => {@@ -313,7 +313,7 @@ export const SettingsObjectFieldEdit = () => {if (deleteResult.status === 'successful') {enqueueToast({ variant: 'success', children: t`Field deleted` });- closeModal(DELETE_FIELD_MODAL_ID);+ closeDialog(DELETE_FIELD_MODAL_ID);navigateSettings(SettingsPath.ObjectDetail, {objectNamePlural,});@@ -321,7 +321,7 @@ export const SettingsObjectFieldEdit = () => {}setIsDeleting(false);- closeModal(DELETE_FIELD_MODAL_ID);+ closeDialog(DELETE_FIELD_MODAL_ID);};return (@@ -460,15 +460,15 @@ export const SettingsObjectFieldEdit = () => {</SettingsPageLayout></FormProvider>{isCustomField && (- <ConfirmationModal- modalInstanceId={DELETE_FIELD_MODAL_ID}+ <ConfirmationDialog+ dialogId={DELETE_FIELD_MODAL_ID}title={t`Delete ${fieldLabel} field?`}subtitle={t`This will permanently delete the field and all its data from ${objectLabel}. Type "yes" to confirm.`}confirmButtonText={t`Delete`}confirmationValue="yes"confirmationPlaceholder="yes"onConfirmClick={confirmDelete}- onClose={() => closeModal(DELETE_FIELD_MODAL_ID)}+ onClose={() => closeDialog(DELETE_FIELD_MODAL_ID)}loading={isDeleting}/>)}diff --git a/packages/twenty-front/src/pages/settings/developers/api-keys/SettingsDevelopersApiKeyDetail.tsx b/packages/twenty-front/src/pages/settings/developers/api-keys/SettingsDevelopersApiKeyDetail.tsxindex fbabb44adf1..924fd0acd4b 100644--- a/packages/twenty-front/src/pages/settings/developers/api-keys/SettingsDevelopersApiKeyDetail.tsx+++ b/packages/twenty-front/src/pages/settings/developers/api-keys/SettingsDevelopersApiKeyDetail.tsx@@ -8,8 +8,8 @@ import { apiKeyTokenFamilyState } from '@/settings/developers/states/apiKeyTokenimport { computeNewExpirationDate } from '@/settings/developers/utils/computeNewExpirationDate';import { formatExpiration } from '@/settings/developers/utils/formatExpiration';import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue';import { useMutation, useQuery } from '@apollo/client/react';import { styled } from '@linaria/react';@@ -57,7 +57,7 @@ const REGENERATE_API_KEY_MODAL_ID = 'regenerate-api-key-modal';export const SettingsDevelopersApiKeyDetail = () => {const { t } = useLingui();const { enqueueToast } = useToast();- const { openModal } = useModal();+ const { openDialog } = useDialog();const [isLoading, setIsLoading] = useState(false);const navigate = useNavigateSettings();@@ -289,7 +289,7 @@ export const SettingsDevelopersApiKeyDetail = () => {<StyledInputContainer><ButtonstartIcon={<IconRepeat />}- onClick={() => openModal(REGENERATE_API_KEY_MODAL_ID)}+ onClick={() => openDialog(REGENERATE_API_KEY_MODAL_ID)}>{t`Regenerate Key`}</Button><StyledInfo>{formatExpiration(apiKey?.expiresAt || '', true, false)}@@ -341,7 +341,7 @@ export const SettingsDevelopersApiKeyDetail = () => {/><ButtonstartIcon={<IconTrash />}- onClick={() => openModal(DELETE_API_KEY_MODAL_ID)}+ onClick={() => openDialog(DELETE_API_KEY_MODAL_ID)}variant="outline"color="danger">{t`Delete`}</Button>@@ -349,10 +349,10 @@ export const SettingsDevelopersApiKeyDetail = () => {</SettingsPageContainer></SettingsPageLayout>)}- <ConfirmationModal+ <ConfirmationDialogconfirmationPlaceholder={confirmationValue}confirmationValue={confirmationValue}- modalInstanceId={DELETE_API_KEY_MODAL_ID}+ dialogId={DELETE_API_KEY_MODAL_ID}title={t`Delete API key`}subtitle={<Trans>@@ -365,10 +365,10 @@ export const SettingsDevelopersApiKeyDetail = () => {confirmButtonText={t`Delete`}loading={isLoading}/>- <ConfirmationModal+ <ConfirmationDialogconfirmationPlaceholder={confirmationValue}confirmationValue={confirmationValue}- modalInstanceId={REGENERATE_API_KEY_MODAL_ID}+ dialogId={REGENERATE_API_KEY_MODAL_ID}title={t`Regenerate an API key`}subtitle={<Trans>diff --git a/packages/twenty-front/src/pages/settings/enterprise/SettingsEnterprise.tsx b/packages/twenty-front/src/pages/settings/enterprise/SettingsEnterprise.tsxindex 722a8d7b2ab..9351cb7566e 100644--- a/packages/twenty-front/src/pages/settings/enterprise/SettingsEnterprise.tsx+++ b/packages/twenty-front/src/pages/settings/enterprise/SettingsEnterprise.tsx@@ -20,8 +20,8 @@ import { SET_ENTERPRISE_KEY } from '@/settings/enterprise/graphql/mutations/setOimport { ENTERPRISE_PORTAL_SESSION } from '@/settings/enterprise/graphql/queries/enterprisePortalSession';import { ENTERPRISE_SUBSCRIPTION_STATUS } from '@/settings/enterprise/graphql/queries/enterpriseSubscriptionStatus';import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useLoadCurrentUser } from '@/users/hooks/useLoadCurrentUser';import { useLazyQuery, useMutation } from '@apollo/client/react';@@ -141,7 +141,7 @@ export const SettingsEnterprise = ({const [isRefreshingToken, setIsRefreshingToken] = useState(false);const [isReleasing, setIsReleasing] = useState(false);const [isBoundToAnotherServer, setIsBoundToAnotherServer] = useState(false);- const { openModal } = useModal();+ const { openDialog } = useDialog();const { enqueueToast } = useToast();const { loadCurrentUser } = useLoadCurrentUser();@@ -357,8 +357,8 @@ export const SettingsEnterprise = ({}, [fetchPortalSession, enqueueToast, t, returnUrlPath]);const openCheckoutModal = useCallback(() => {- openModal(ENTERPRISE_PLAN_MODAL_ID);- }, [openModal]);+ openDialog(ENTERPRISE_PLAN_MODAL_ID);+ }, [openDialog]);const handleRefreshValidityToken = useCallback(async () => {setIsRefreshingToken(true);@@ -565,7 +565,7 @@ export const SettingsEnterprise = ({<ButtonstartIcon={<IconKey />}onClick={() =>- openModal(RELEASE_ENTERPRISE_BINDING_CONFIRMATION_MODAL_ID)+ openDialog(RELEASE_ENTERPRISE_BINDING_CONFIRMATION_MODAL_ID)}disabled={isReleasing}variant="outline"@@ -995,8 +995,8 @@ export const SettingsEnterprise = ({const innerContent = (<><EnterprisePlanModal />- <ConfirmationModal- modalInstanceId={RELEASE_ENTERPRISE_BINDING_CONFIRMATION_MODAL_ID}+ <ConfirmationDialog+ dialogId={RELEASE_ENTERPRISE_BINDING_CONFIRMATION_MODAL_ID}title={t`Release & transfer Organization key`}subtitle={t`This Organization key is currently bound to a different server instance. Transferring it here will release it from the previous server and stop counting seats on it. Are you sure you want to continue?`}confirmButtonText={t`Release & transfer`}diff --git a/packages/twenty-front/src/pages/settings/members/SettingsWorkspaceMember.tsx b/packages/twenty-front/src/pages/settings/members/SettingsWorkspaceMember.tsxindex d351d9eede0..1394dc6d801 100644--- a/packages/twenty-front/src/pages/settings/members/SettingsWorkspaceMember.tsx+++ b/packages/twenty-front/src/pages/settings/members/SettingsWorkspaceMember.tsx@@ -8,8 +8,8 @@ import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayimport { SettingsTabBar } from '@/settings/components/layout/SettingsTabBar';import { SettingsRolesQueryEffect } from '@/settings/roles/components/SettingsRolesQueryEffect';import { useHasPermissionFlag } from '@/settings/roles/hooks/useHasPermissionFlag';-import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';-import { useModal } from '@/ui/layout/modal/hooks/useModal';+import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';+import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState';import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';@@ -49,7 +49,7 @@ export const SettingsWorkspaceMember = () => {const { workspaceMemberId = '' } = useParams();const navigateSettings = useNavigateSettings();const { enqueueToast } = useToast();- const { openModal, closeModal } = useModal();+ const { openDialog, closeDialog } = useDialog();const currentUser = useAtomStateValue(currentUserState);const currentWorkspace = useAtomStateValue(currentWorkspaceState);const { startImpersonating } = useImpersonationSession();@@ -128,7 +128,7 @@ export const SettingsWorkspaceMember = () => {variant: 'success',children: t`Member removed from workspace`,});- closeModal(DELETE_MEMBER_MODAL_ID);+ closeDialog(DELETE_MEMBER_MODAL_ID);navigateSettings(SettingsPath.WorkspaceMembersPage);} catch (error) {enqueueToast({@@ -233,7 +233,7 @@ export const SettingsWorkspaceMember = () => {: undefined}onNameChange={debouncedUpdateName}- onDelete={() => openModal(DELETE_MEMBER_MODAL_ID)}+ onDelete={() => openDialog(DELETE_MEMBER_MODAL_ID)}/>)}@@ -247,8 +247,8 @@ export const SettingsWorkspaceMember = () => {)}</SettingsPageContainer>- <ConfirmationModal- modalInstanceId={DELETE_MEMBER_MODAL_ID}+ <ConfirmationDialog+ dialogId={DELETE_MEMBER_MODAL_ID}title={t`Remove member from workspace`}subtitle={t`This action cannot be undone. This member will be removed and unassigned from their records. Their synced emails and calendars will stop syncing and be reassigned to you.`}onConfirmClick={handleDeleteMember}diff --git a/packages/twenty-ui/docs/components.ts b/packages/twenty-ui/docs/components.tsindex c518c973b6b..822b57a4824 100644--- a/packages/twenty-ui/docs/components.ts+++ b/packages/twenty-ui/docs/components.ts@@ -1,3 +1,4 @@+import { DIALOG_PROP_DESCRIPTIONS } from './dialogPropDescriptions';import { AVATAR_PROP_DESCRIPTIONS } from './avatarPropDescriptions';import { BUTTON_GROUP_PROP_DESCRIPTIONS } from './buttonGroupPropDescriptions';import { BUTTON_PROP_DESCRIPTIONS } from './buttonPropDescriptions';@@ -123,6 +124,14 @@ export const DOCUMENTED_COMPONENTS = [entryPoint: 'twenty-ui/primitives/navigation',slug: 'navigation/tabs',},+ {+ name: 'Dialog',+ source: 'primitives/surfaces/Dialog/Dialog.tsx',+ entryPoint: 'twenty-ui/primitives/surfaces',+ slug: 'surfaces/dialog',+ propDescriptions: DIALOG_PROP_DESCRIPTIONS,+ partPropDescriptions: { Title: DIALOG_TITLE_PROP_DESCRIPTIONS },+ },{name: 'AlertDialog',source: 'primitives/surfaces/AlertDialog/AlertDialog.tsx',@@ -222,11 +231,4 @@ export const DOCUMENTED_COMPONENTS = [slug: 'components/code-editor-header',propDescriptions: CODE_EDITOR_HEADER_PROP_DESCRIPTIONS,},- {- name: 'Dialog',- source: 'primitives/surfaces/Dialog/Dialog.tsx',- entryPoint: 'twenty-ui/primitives/surfaces',- slug: 'surfaces/dialog',- partPropDescriptions: { Title: DIALOG_TITLE_PROP_DESCRIPTIONS },- },] as const;diff --git a/packages/twenty-ui/docs/dialogPropDescriptions.ts b/packages/twenty-ui/docs/dialogPropDescriptions.tsnew file mode 100644index 00000000000..589de3d0e93--- /dev/null+++ b/packages/twenty-ui/docs/dialogPropDescriptions.ts@@ -0,0 +1,12 @@+import { type DialogPopupProps } from '../src/primitives/surfaces/Dialog/types/DialogPopupProps';++export const DIALOG_PROP_DESCRIPTIONS = {+ size: 'Width of the dialog, or `fullscreen` to fill the viewport.',+ container:+ 'Portal destination. Defaults to the theme container; `null` defers mounting.',+ keepMounted: 'Keeps content mounted while the dialog is closed.',+ backdrop:+ 'Show the backdrop, customize its native props, or pass `false` to hide it.',+ viewportProps:+ 'Native props and render composition for the viewport surrounding the popup.',+} satisfies Partial<Record<keyof DialogPopupProps, string>>;diff --git a/packages/twenty-ui/generated/components.docs.json b/packages/twenty-ui/generated/components.docs.jsonindex 3d54f9f85b3..31c51f10c67 100644--- a/packages/twenty-ui/generated/components.docs.json+++ b/packages/twenty-ui/generated/components.docs.json@@ -2536,6 +2536,367 @@}]},+ {+ "name": "Dialog",+ "entryPoint": "twenty-ui/primitives/surfaces",+ "slug": "surfaces/dialog",+ "props": [],+ "parts": [+ {+ "name": "Root",+ "props": [+ {+ "name": "actionsRef",+ "type": "RefObject<DialogRootActions | null>",+ "required": false,+ "defaultValue": null,+ "description": "A ref to imperative actions.\n- `unmount`: Manually unmounts the dialog.\nCall this after any externally controlled closing animation finishes.\n- `close`: Closes the dialog imperatively when called."+ },+ {+ "name": "children",+ "type": "ReactNode | PayloadChildRenderFunction<Payload>",+ "required": false,+ "defaultValue": null,+ "description": "The content of the dialog.\nThis can be a regular React node or a render function that receives the `payload` of the active trigger."+ },+ {+ "name": "defaultOpen",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Whether the dialog is initially open.\n\nTo render a controlled dialog, use the `open` prop instead."+ },+ {+ "name": "defaultTriggerId",+ "type": "string | null",+ "required": false,+ "defaultValue": null,+ "description": "ID of the trigger that the dialog is associated with.\nThis is useful in conjunction with the `defaultOpen` prop to create an initially open dialog."+ },+ {+ "name": "disablePointerDismissal",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Whether to prevent the dialog from closing on outside presses.\nFor non-modal dialogs, this also prevents the dialog from closing when focus moves outside of it."+ },+ {+ "name": "handle",+ "type": "DialogHandle<Payload>",+ "required": false,+ "defaultValue": null,+ "description": "A handle to associate the dialog with a trigger.\nIf specified, allows external triggers to control the dialog's open state.\nCan be created with the Dialog.createHandle() method."+ },+ {+ "name": "modal",+ "type": "boolean | \"trap-focus\"",+ "required": false,+ "defaultValue": "true",+ "description": "Determines if the dialog enters a modal state when open.\n- `true`: user interaction is limited to just the dialog: focus is trapped, document page scroll is locked, and pointer interactions on outside elements are disabled.\n- `false`: user interaction with the rest of the document is allowed.\n- `'trap-focus'`: focus is trapped inside the dialog, but document page scroll is not locked and pointer interactions outside of it remain enabled.\n\nWhen `modal` is `true` or `'trap-focus'`, render `<Dialog.Close>` inside `<Dialog.Popup>` so\ntouch screen readers can escape the popup."+ },+ {+ "name": "onOpenChange",+ "type": "((open: boolean, eventDetails: DialogRootChangeEventDetails) => void)",+ "required": false,+ "defaultValue": null,+ "description": "Event handler called when the dialog is opened or closed."+ },+ {+ "name": "onOpenChangeComplete",+ "type": "((open: boolean) => void)",+ "required": false,+ "defaultValue": null,+ "description": "Event handler called after any animations complete when the dialog is opened or closed."+ },+ {+ "name": "open",+ "type": "boolean",+ "required": false,+ "defaultValue": null,+ "description": "Whether the dialog is currently open."+ },+ {+ "name": "triggerId",+ "type": "string | null",+ "required": false,+ "defaultValue": null,+ "description": "ID of the trigger that the dialog is associated with.\nThis is useful in conjunction with the `open` prop to create a controlled dialog.\nThere's no need to specify this prop when the dialog is uncontrolled (that is, when the `open` prop is not set)."+ }+ ]+ },+ {+ "name": "Trigger",+ "props": [+ {+ "name": "className",+ "type": "string | ((state: DialogTriggerState) => string | undefined)",+ "required": false,+ "defaultValue": null,+ "description": "CSS class applied to the element, or a function that\nreturns a class based on the component's state."+ },+ {+ "name": "handle",+ "type": "DialogHandle<Payload>",+ "required": false,+ "defaultValue": null,+ "description": "A handle to associate the trigger with a dialog.\nCan be created with the Dialog.createHandle() method."+ },+ {+ "name": "id",+ "type": "string",+ "required": false,+ "defaultValue": null,+ "description": "ID of the trigger. In addition to being forwarded to the rendered element,\nit is also used to specify the active trigger for the dialog in controlled mode (with the DialogRoot `triggerId` prop)."+ },+ {+ "name": "nativeButton",+ "type": "boolean",+ "required": false,+ "defaultValue": "true",+ "description": "Whether the component renders a native `<button>` element when replacing it\nvia the `render` prop.\nSet to `false` if the rendered element is not a button (for example, `<div>`)."+ },+ {+ "name": "payload",+ "type": "Payload",+ "required": false,+ "defaultValue": null,+ "description": "A payload to pass to the dialog when it is opened."+ },+ {+ "name": "render",+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, DialogTriggerState>",+ "required": false,+ "defaultValue": null,+ "description": "Allows you to replace the component's HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."+ },+ {+ "name": "style",+ "type": "CSSProperties | ((state: DialogTriggerState) => CSSProperties | undefined)",+ "required": false,+ "defaultValue": null,+ "description": "Style applied to the element, or a function that\nreturns a style object based on the component's state."+ }+ ]+ },+ {+ "name": "Popup",+ "props": [+ {+ "name": "backdrop",+ "type": "boolean | DialogBackdropProps",+ "required": false,+ "defaultValue": "true",+ "description": ""+ },+ {+ "name": "className",+ "type": "string | ((state: DialogPopupState) => string | undefined)",+ "required": false,+ "defaultValue": null,+ "description": "CSS class applied to the element, or a function that\nreturns a class based on the component's state."+ },+ {+ "name": "container",+ "type": "HTMLElement | ShadowRoot | RefObject<HTMLElement | ShadowRoot | null> | null",+ "required": false,+ "defaultValue": null,+ "description": ""+ },+ {+ "name": "finalFocus",+ "type": "boolean | RefObject<HTMLElement | null> | ((closeType: InteractionType) => boolean | void | HTMLElement | null)",+ "required": false,+ "defaultValue": null,+ "description": "Determines the element to focus when the dialog is closed.\n\n- `false`: Do not move focus.\n- `true`: Move focus based on the default behavior (trigger or previously focused element).\n- `RefObject`: Move focus to the ref element.\n- `function`: Called with the interaction type (`mouse`, `touch`, `pen`, or `keyboard`).\n Return an element to focus, `true` to use the default behavior, `null` to fall back to the default behavior, or `false`/`undefined` to do nothing."+ },+ {+ "name": "initialFocus",+ "type": "boolean | RefObject<HTMLElement | null> | ((openType: InteractionType) => boolean | void | HTMLElement | null)",+ "required": false,+ "defaultValue": null,+ "description": "Determines the element to focus when the dialog is opened.\nBy default, focus moves to the first tabbable element inside the popup, except when the dialog\nis opened by touch — then the popup itself is focused to avoid opening the virtual keyboard.\n\n- `false`: Do not move focus.\n- `true`: Move focus based on the default behavior (first tabbable element or popup).\n- `RefObject`: Move focus to the ref element.\n- `function`: Called with the interaction type (`mouse`, `touch`, `pen`, or `keyboard`).\n Return an element to focus, `true` to use the default behavior, `null` to fall back to the default behavior, or `false`/`undefined` to do nothing."+ },+ {+ "name": "keepMounted",+ "type": "boolean",+ "required": false,+ "defaultValue": null,+ "description": ""+ },+ {+ "name": "render",+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, DialogPopupState>",+ "required": false,+ "defaultValue": null,+ "description": "Allows you to replace the component's HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."+ },+ {+ "name": "size",+ "type": "\"sm\" | \"md\" | \"lg\" | \"xl\" | \"fullscreen\"",+ "required": false,+ "defaultValue": "md",+ "description": ""+ },+ {+ "name": "style",+ "type": "CSSProperties | ((state: DialogPopupState) => CSSProperties | undefined)",+ "required": false,+ "defaultValue": null,+ "description": "Style applied to the element, or a function that\nreturns a style object based on the component's state."+ },+ {+ "name": "viewportProps",+ "type": "DialogViewportProps",+ "required": false,+ "defaultValue": null,+ "description": ""+ }+ ]+ },+ {+ "name": "Title",+ "props": [+ {+ "name": "className",+ "type": "string | ((state: DialogTitleState) => string | undefined)",+ "required": false,+ "defaultValue": null,+ "description": "CSS class applied to the element, or a function that\nreturns a class based on the component's state."+ },+ {+ "name": "color",+ "type": "\"primary\" | \"secondary\" | \"tertiary\"",+ "required": false,+ "defaultValue": "primary",+ "description": "Theme font color. Defaults to `primary`."+ },+ {+ "name": "level",+ "type": "5 | 1 | 2 | 3 | 4 | 6",+ "required": false,+ "defaultValue": "2",+ "description": "Semantic heading level, from `h1` through `h6`. Does not change the visual size. Defaults to `2`."+ },+ {+ "name": "render",+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, DialogTitleState>",+ "required": false,+ "defaultValue": null,+ "description": "Allows you to replace the component's HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."+ },+ {+ "name": "size",+ "type": "\"sm\" | \"md\" | \"lg\" | \"xs\"",+ "required": false,+ "defaultValue": "lg",+ "description": "Visual font size, independent of the heading level. Defaults to `lg`."+ },+ {+ "name": "style",+ "type": "CSSProperties | ((state: DialogTitleState) => CSSProperties | undefined)",+ "required": false,+ "defaultValue": null,+ "description": "Style applied to the element, or a function that\nreturns a style object based on the component's state."+ }+ ]+ },+ {+ "name": "Description",+ "props": [+ {+ "name": "className",+ "type": "string | ((state: DialogDescriptionState) => string | undefined)",+ "required": false,+ "defaultValue": null,+ "description": "CSS class applied to the element, or a function that\nreturns a class based on the component's state."+ },+ {+ "name": "render",+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, DialogDescriptionState>",+ "required": false,+ "defaultValue": null,+ "description": "Allows you to replace the component's HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."+ },+ {+ "name": "style",+ "type": "CSSProperties | ((state: DialogDescriptionState) => CSSProperties | undefined)",+ "required": false,+ "defaultValue": null,+ "description": "Style applied to the element, or a function that\nreturns a style object based on the component's state."+ }+ ]+ },+ {+ "name": "Close",+ "props": [+ {+ "name": "className",+ "type": "string | ((state: DialogCloseState) => string | undefined)",+ "required": false,+ "defaultValue": null,+ "description": "CSS class applied to the element, or a function that\nreturns a class based on the component's state."+ },+ {+ "name": "nativeButton",+ "type": "boolean",+ "required": false,+ "defaultValue": "true",+ "description": "Whether the component renders a native `<button>` element when replacing it\nvia the `render` prop.\nSet to `false` if the rendered element is not a button (for example, `<div>`)."+ },+ {+ "name": "render",+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, DialogCloseState>",+ "required": false,+ "defaultValue": null,+ "description": "Allows you to replace the component's HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."+ },+ {+ "name": "style",+ "type": "CSSProperties | ((state: DialogCloseState) => CSSProperties | undefined)",+ "required": false,+ "defaultValue": null,+ "description": "Style applied to the element, or a function that\nreturns a style object based on the component's state."+ }+ ]+ },+ {+ "name": "Header",+ "props": [+ {+ "name": "render",+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, {}>",+ "required": false,+ "defaultValue": null,+ "description": "Allows you to replace the component's HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."+ }+ ]+ },+ {+ "name": "Body",+ "props": [+ {+ "name": "render",+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, {}>",+ "required": false,+ "defaultValue": null,+ "description": "Allows you to replace the component's HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."+ }+ ]+ },+ {+ "name": "Footer",+ "props": [+ {+ "name": "render",+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, {}>",+ "required": false,+ "defaultValue": null,+ "description": "Allows you to replace the component's HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."+ }+ ]+ }+ ]+ },{"name": "AlertDialog","entryPoint": "twenty-ui/primitives/surfaces",@@ -5511,60 +5872,5 @@"description": "Text shown at the start of the header, after `leftNodes`."}]- },- {- "name": "Dialog",- "entryPoint": "twenty-ui/primitives/surfaces",- "slug": "surfaces/dialog",- "props": [],- "parts": [- {- "name": "Title",- "props": [- {- "name": "className",- "type": "string | ((state: DialogTitleState) => string | undefined)",- "required": false,- "defaultValue": null,- "description": "CSS class applied to the element, or a function that\nreturns a class based on the component's state."- },- {- "name": "color",- "type": "\"primary\" | \"secondary\" | \"tertiary\"",- "required": false,- "defaultValue": "primary",- "description": "Theme font color. Defaults to `primary`."- },- {- "name": "level",- "type": "5 | 1 | 2 | 3 | 4 | 6",- "required": false,- "defaultValue": "2",- "description": "Semantic heading level, from `h1` through `h6`. Does not change the visual size. Defaults to `2`."- },- {- "name": "render",- "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, DialogTitleState>",- "required": false,- "defaultValue": null,- "description": "Allows you to replace the component's HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."- },- {- "name": "size",- "type": "\"sm\" | \"md\" | \"lg\" | \"xs\"",- "required": false,- "defaultValue": "lg",- "description": "Visual font size, independent of the heading level. Defaults to `lg`."- },- {- "name": "style",- "type": "CSSProperties | ((state: DialogTitleState) => CSSProperties | undefined)",- "required": false,- "defaultValue": null,- "description": "Style applied to the element, or a function that\nreturns a style object based on the component's state."- }- ]- }- ]}]diff --git a/packages/twenty-ui/scripts/generateDocsData.ts b/packages/twenty-ui/scripts/generateDocsData.tsindex 4b5504e17ab..fb150f2db1e 100644--- a/packages/twenty-ui/scripts/generateDocsData.ts+++ b/packages/twenty-ui/scripts/generateDocsData.ts@@ -21,6 +21,7 @@ import {} from '../docs/types';const HIDDEN_PROP_TAGS = ['ignore', 'internal'];+const COMPONENT_PART_NAME_PATTERN = /^[A-Z]/;const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');const sourceRoot = resolve(packageRoot, 'src');@@ -185,6 +186,7 @@ const components: ComponentDocumentation[] = DOCUMENTED_COMPONENTS.map('partPropDescriptions' in component ? component.partPropDescriptions : {};const componentParts = type.getProperties()+ .filter((part) => COMPONENT_PART_NAME_PATTERN.test(part.name)).filter((part) => partNames?.includes(part.name) ?? props.length === 0);const parts = componentParts.map((part) => {const declaration = part.valueDeclaration;diff --git a/packages/twenty-ui/src/primitives/surfaces/Dialog/Dialog.tsx b/packages/twenty-ui/src/primitives/surfaces/Dialog/Dialog.tsxindex f671ae39624..aa721103e19 100644--- a/packages/twenty-ui/src/primitives/surfaces/Dialog/Dialog.tsx+++ b/packages/twenty-ui/src/primitives/surfaces/Dialog/Dialog.tsx@@ -1,5 +1,21 @@+import { Dialog as DialogPrimitive } from '@base-ui/react/dialog';++import { DialogBody } from './internal/DialogBody';+import { DialogDescription } from './internal/DialogDescription';+import { DialogFooter } from './internal/DialogFooter';+import { DialogHeader } from './internal/DialogHeader';+import { DialogPopup } from './internal/DialogPopup';import { DialogTitle } from './internal/DialogTitle';export const Dialog = {+ createHandle: DialogPrimitive.createHandle,+ Root: DialogPrimitive.Root,+ Trigger: DialogPrimitive.Trigger,+ Popup: DialogPopup,Title: DialogTitle,+ Description: DialogDescription,+ Close: DialogPrimitive.Close,+ Header: DialogHeader,+ Body: DialogBody,+ Footer: DialogFooter,};diff --git a/packages/twenty-ui/src/primitives/surfaces/Dialog/__stories__/Dialog.handles.stories.tsx b/packages/twenty-ui/src/primitives/surfaces/Dialog/__stories__/Dialog.handles.stories.tsxnew file mode 100644index 00000000000..e9da285d4f6--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Dialog/__stories__/Dialog.handles.stories.tsx@@ -0,0 +1,68 @@+import { type Meta, type StoryObj } from '@storybook/react-vite';+import { useState } from 'react';+import { expect, userEvent, waitFor, within } from 'storybook/test';++import { Button } from '@ui/primitives/input/Button/Button';+import { ComponentDecorator } from '@ui/testing';++import { Dialog } from '../Dialog';+import { waitForDialog } from './waitForDialog';++const ExternalTriggerDialog = () => {+ const [handle] = useState(() => Dialog.createHandle<string>());++ return (+ <>+ {['Acme', 'Globex'].map((company) => (+ <Dialog.Trigger+ key={company}+ handle={handle}+ payload={company}+ render={<Button>Edit {company}</Button>}+ />+ ))}+ <Dialog.Root handle={handle}>+ {({ payload }) => (+ <Dialog.Popup>+ <Dialog.Header>+ <Dialog.Title>{payload}</Dialog.Title>+ <Dialog.Description>Review company details.</Dialog.Description>+ </Dialog.Header>+ <Dialog.Footer>+ <Dialog.Close render={<Button>Close</Button>} />+ </Dialog.Footer>+ </Dialog.Popup>+ )}+ </Dialog.Root>+ </>+ );+};++const meta: Meta<typeof ExternalTriggerDialog> = {+ title: 'UI/Surfaces/Dialog',+ component: ExternalTriggerDialog,+ decorators: [ComponentDecorator],+};++export default meta;+type Story = StoryObj<typeof ExternalTriggerDialog>;++export const ExternalTriggers: Story = {+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);++ for (const company of ['Acme', 'Globex']) {+ const trigger = canvas.getByRole('button', { name: `Edit ${company}` });+ await userEvent.click(trigger);+ const dialog = await waitForDialog(canvasElement);+ expect(dialog).toHaveAccessibleName(company);+ expect(trigger).toHaveAttribute('aria-expanded', 'true');+ expect(trigger).toHaveAttribute('aria-controls', dialog.id);+ await userEvent.click(+ within(dialog).getByRole('button', { name: 'Close' }),+ );+ await waitFor(() => expect(dialog).not.toBeInTheDocument());+ await waitFor(() => expect(trigger).toHaveFocus());+ }+ },+};diff --git a/packages/twenty-ui/src/primitives/surfaces/Dialog/__stories__/Dialog.interactions.stories.tsx b/packages/twenty-ui/src/primitives/surfaces/Dialog/__stories__/Dialog.interactions.stories.tsxnew file mode 100644index 00000000000..7bfbbf27ff7--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Dialog/__stories__/Dialog.interactions.stories.tsx@@ -0,0 +1,389 @@+import { type Meta, type StoryObj } from '@storybook/react-vite';+import { useRef, useState } from 'react';+import { expect, fn, userEvent, waitFor, within } from 'storybook/test';++import { Input } from '@ui/primitives/input/Input/Input';+import { ComponentDecorator } from '@ui/testing';++import { Dialog } from '../Dialog';+import { DialogExample } from './DialogExample';+import { Button } from '@ui/primitives/input/Button/Button';+import { Text } from '@ui/primitives/typography/Text/Text';+import { waitForDialog } from './waitForDialog';++const meta: Meta<typeof DialogExample> = {+ title: 'UI/Surfaces/Dialog',+ component: DialogExample,+};++export default meta;+type Story = StoryObj<typeof DialogExample>;++export const KeyboardAndDismissal: Story = {+ decorators: [ComponentDecorator],+ args: { onOpenChange: fn() },+ play: async ({ args, canvasElement, step }) => {+ const canvas = within(canvasElement);+ const body = within(canvasElement.ownerDocument.body);+ const trigger = canvas.getByRole('button', { name: 'Edit account' });+ const initialOverflow = canvasElement.ownerDocument.body.style.overflow;++ await step(+ 'Open from the keyboard and focus the close action',+ async () => {+ trigger.focus();+ await userEvent.keyboard('{Enter}');+ const dialog = await waitForDialog(canvasElement);+ expect(canvasElement.ownerDocument.body.style.overflow).toBe('hidden');+ expect(trigger).toHaveAttribute('aria-expanded', 'true');+ expect(trigger).toHaveAttribute('aria-controls', dialog.id);+ await waitFor(() =>+ expect(body.getByRole('button', { name: 'Close' })).toHaveFocus(),+ );+ expect(args.onOpenChange).toHaveBeenLastCalledWith(+ true,+ expect.objectContaining({ reason: 'trigger-press' }),+ );+ },+ );++ await step('Keep forward and backward tab navigation inside', async () => {+ await userEvent.tab();+ await waitFor(() =>+ expect(body.getByRole('button', { name: 'Save' })).toHaveFocus(),+ );+ await userEvent.tab();+ await waitFor(() =>+ expect(body.getByRole('button', { name: 'Close' })).toHaveFocus(),+ );+ await userEvent.tab({ shift: true });+ await waitFor(() =>+ expect(body.getByRole('button', { name: 'Save' })).toHaveFocus(),+ );+ });++ await step(+ 'Escape dismisses and returns focus to the trigger',+ async () => {+ await userEvent.keyboard('{Escape}');+ await waitFor(() =>+ expect(body.queryByRole('dialog')).not.toBeInTheDocument(),+ );+ await waitFor(() => expect(trigger).toHaveFocus());+ expect(canvasElement.ownerDocument.body.style.overflow).toBe(+ initialOverflow,+ );+ expect(args.onOpenChange).toHaveBeenLastCalledWith(+ false,+ expect.objectContaining({ reason: 'escape-key' }),+ );+ },+ );++ await step('Close and confirmation both close the dialog', async () => {+ for (const name of ['Close', 'Save']) {+ await userEvent.click(trigger);+ await waitForDialog(canvasElement);+ await userEvent.click(body.getByRole('button', { name }));+ await waitFor(() =>+ expect(body.queryByRole('dialog')).not.toBeInTheDocument(),+ );+ expect(args.onOpenChange).toHaveBeenLastCalledWith(+ false,+ expect.objectContaining({ reason: 'close-press' }),+ );+ }+ });+ },+};++const ControlledDialog = () => {+ const [open, setOpen] = useState(false);+ const [saved, setSaved] = useState(false);++ return (+ <>+ <Text>{saved ? 'Account saved' : 'Record available'}</Text>+ <Dialog.Root open={open} onOpenChange={setOpen}>+ <Dialog.Trigger render={<Button>Edit account</Button>} />+ <Dialog.Popup>+ <Dialog.Header>+ <Dialog.Title>Edit account</Dialog.Title>+ <Dialog.Description>Update the account details.</Dialog.Description>+ </Dialog.Header>+ <Dialog.Footer>+ <Dialog.Close render={<Button variant="outline">Close</Button>} />+ <Button+ onClick={() => {+ setSaved(true);+ setOpen(false);+ }}+ >+ Save changes+ </Button>+ </Dialog.Footer>+ </Dialog.Popup>+ </Dialog.Root>+ </>+ );+};++export const Controlled: Story = {+ decorators: [ComponentDecorator],+ render: () => <ControlledDialog />,+ play: async ({ canvasElement }) => {+ await userEvent.click(+ within(canvasElement).getByRole('button', { name: 'Edit account' }),+ );+ const dialog = await waitForDialog(canvasElement);+ await userEvent.click(+ within(dialog).getByRole('button', { name: 'Save changes' }),+ );+ await waitFor(() => expect(dialog).not.toBeInTheDocument());+ expect(within(canvasElement).getByText('Account saved')).toBeVisible();+ },+};++export const DisabledTrigger: Story = {+ decorators: [ComponentDecorator],+ args: { disabled: true, onOpenChange: fn() },+ play: async ({ args, canvasElement }) => {+ const trigger = within(canvasElement).getByRole('button', {+ name: 'Edit account',+ });+ expect(trigger).toBeDisabled();+ await userEvent.click(trigger);+ expect(args.onOpenChange).not.toHaveBeenCalled();+ expect(+ within(canvasElement.ownerDocument.body).queryByRole('dialog'),+ ).not.toBeInTheDocument();+ },+};++export const KeepMounted: Story = {+ decorators: [ComponentDecorator],+ args: {+ popupProps: { keepMounted: true },+ content: <Input aria-label="Reason" />,+ },+ play: async ({ canvasElement }) => {+ const body = within(canvasElement.ownerDocument.body);+ const trigger = within(canvasElement).getByRole('button', {+ name: 'Edit account',+ });+ expect(body.getByRole('dialog', { hidden: true })).not.toBeVisible();+ await userEvent.click(trigger);+ const dialog = await waitForDialog(canvasElement);+ await userEvent.type(+ within(dialog).getByRole('textbox', { name: 'Reason' }),+ 'Duplicate',+ );+ await userEvent.click(+ within(dialog).getByRole('button', { name: 'Close' }),+ );+ await waitFor(() => expect(dialog).not.toBeVisible());+ expect(dialog).toBeInTheDocument();+ await userEvent.click(trigger);+ await waitForDialog(canvasElement);+ expect(within(dialog).getByRole('textbox', { name: 'Reason' })).toHaveValue(+ 'Duplicate',+ );+ },+};++const CustomFocusDialog = () => {+ const initialFocus = useRef<HTMLInputElement>(null);+ const finalFocus = useRef<HTMLButtonElement>(null);++ return (+ <>+ <DialogExample+ popupProps={{ initialFocus, finalFocus }}+ content={<Input ref={initialFocus} aria-label="Confirmation" />}+ />+ <Button ref={finalFocus}>Next record</Button>+ </>+ );+};++export const CustomFocus: Story = {+ decorators: [ComponentDecorator],+ render: () => <CustomFocusDialog />,+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ await userEvent.click(canvas.getByRole('button', { name: 'Edit account' }));+ const dialog = await waitForDialog(canvasElement);+ await waitFor(() =>+ expect(+ within(dialog).getByRole('textbox', { name: 'Confirmation' }),+ ).toHaveFocus(),+ );+ await userEvent.keyboard('{Escape}');+ await waitFor(() => expect(dialog).not.toBeInTheDocument());+ await waitFor(() =>+ expect(canvas.getByRole('button', { name: 'Next record' })).toHaveFocus(),+ );+ },+};++export const CanceledClose: Story = {+ decorators: [ComponentDecorator],+ args: {+ defaultOpen: true,+ onOpenChange: (open, eventDetails) => {+ if (!open && eventDetails.reason === 'escape-key') {+ eventDetails.cancel();+ }+ },+ },+ play: async ({ canvasElement }) => {+ const dialog = await waitForDialog(canvasElement);+ await userEvent.keyboard('{Escape}');+ expect(dialog).toBeVisible();+ await userEvent.click(+ within(dialog).getByRole('button', { name: 'Close' }),+ );+ await waitFor(() => expect(dialog).not.toBeInTheDocument());+ },+};++export const Nested: Story = {+ decorators: [ComponentDecorator],+ args: { defaultOpen: true, content: <DialogExample /> },+ play: async ({ canvasElement }) => {+ const parentDialog = await waitForDialog(canvasElement);+ const nestedTrigger = within(parentDialog).getByRole('button', {+ name: 'Edit account',+ });+ await userEvent.click(nestedTrigger);+ const nestedDialog = await waitForDialog(canvasElement);+ expect(nestedDialog).not.toBe(parentDialog);+ expect(nestedDialog).toHaveAttribute('data-nested');+ expect(parentDialog).toHaveAttribute('data-nested-dialog-open');+ await userEvent.keyboard('{Escape}');+ await waitFor(() => expect(nestedDialog).not.toBeInTheDocument());+ expect(parentDialog).toBeVisible();+ await waitFor(() => expect(nestedTrigger).toHaveFocus());+ },+};++export const Scrollable: Story = {+ decorators: [ComponentDecorator],+ args: {+ defaultOpen: true,+ content: Array.from({ length: 50 }, (_, index) => (+ <Text key={index}>Record {index + 1} details.</Text>+ )),+ },+ play: async ({ canvasElement }) => {+ const dialog = await waitForDialog(canvasElement);+ expect(dialog.scrollHeight).toBeGreaterThan(dialog.clientHeight);+ const bounds = dialog.getBoundingClientRect();+ expect(bounds.top).toBeGreaterThanOrEqual(0);+ expect(bounds.bottom).toBeLessThanOrEqual(+ canvasElement.ownerDocument.documentElement.clientHeight,+ );+ await userEvent.click(+ within(dialog).getByRole('button', { name: 'Close' }),+ );+ await waitFor(() => expect(dialog).not.toBeInTheDocument());+ },+};++export const OutsideDismissal: Story = {+ decorators: [ComponentDecorator],+ args: { defaultOpen: true, onOpenChange: fn() },+ play: async ({ args, canvasElement }) => {+ const dialog = await waitForDialog(canvasElement);+ const target = canvasElement.ownerDocument.elementFromPoint(1, 1);+ expect(target).not.toBeNull();+ await userEvent.pointer({+ keys: '[MouseLeft]',+ target: target!,+ coords: { clientX: 1, clientY: 1 },+ });+ await waitFor(() => expect(dialog).not.toBeInTheDocument());+ expect(args.onOpenChange).toHaveBeenLastCalledWith(+ false,+ expect.objectContaining({ reason: 'outside-press' }),+ );+ },+};++export const FocusTrapWithoutScrollLock: Story = {+ decorators: [ComponentDecorator],+ args: {+ defaultOpen: true,+ modal: 'trap-focus',+ popupProps: { backdrop: false },+ },+ play: async ({ canvasElement }) => {+ const dialog = await waitForDialog(canvasElement);+ expect(canvasElement.ownerDocument.body.style.overflow).not.toBe('hidden');+ const close = within(dialog).getByRole('button', { name: 'Close' });+ close.focus();+ await userEvent.tab({ shift: true });+ await waitFor(() =>+ expect(+ within(dialog).getByRole('button', { name: 'Save' }),+ ).toHaveFocus(),+ );+ },+};++export const ExternalStateAndFocus: Story = {+ decorators: [ComponentDecorator],+ args: {+ open: true,+ modal: false,+ disablePointerDismissal: true,+ popupProps: { initialFocus: false, finalFocus: false, backdrop: false },+ },+ play: async ({ canvasElement }) => {+ const dialog = await waitForDialog(canvasElement);+ expect(canvasElement.ownerDocument.body.style.overflow).not.toBe('hidden');+ const trigger = within(canvasElement).getByRole('button', {+ name: 'Edit account',+ });+ trigger.focus();+ await waitFor(() => expect(trigger).toHaveFocus());+ await userEvent.keyboard('{Escape}');+ expect(dialog).toBeVisible();+ },+};++const NonModalDialog = () => {+ const [pageActionCount, setPageActionCount] = useState(0);++ return (+ <>+ <Button+ style={{ position: 'fixed', insetBlockStart: 8, insetInlineStart: 8 }}+ onClick={() => setPageActionCount(pageActionCount + 1)}+ >+ Page action+ </Button>+ <Text role="status">Page actions: {pageActionCount}</Text>+ <DialogExample open modal={false} popupProps={{ backdrop: false }} />+ </>+ );+};++export const NonModalPageInteraction: Story = {+ decorators: [ComponentDecorator],+ render: () => <NonModalDialog />,+ play: async ({ canvasElement }) => {+ const dialog = await waitForDialog(canvasElement);+ const canvas = within(canvasElement);+ const pageAction = canvas.getByRole('button', { name: 'Page action' });+ const bounds = pageAction.getBoundingClientRect();+ const hitTarget = canvasElement.ownerDocument.elementFromPoint(+ bounds.left + bounds.width / 2,+ bounds.top + bounds.height / 2,+ );+ expect(pageAction.contains(hitTarget)).toBe(true);+ await userEvent.click(pageAction);+ expect(canvas.getByRole('status')).toHaveTextContent('Page actions: 1');+ expect(dialog).toBeVisible();+ },+};diff --git a/packages/twenty-ui/src/primitives/surfaces/Dialog/__stories__/Dialog.portals.stories.tsx b/packages/twenty-ui/src/primitives/surfaces/Dialog/__stories__/Dialog.portals.stories.tsxnew file mode 100644index 00000000000..3e88c93f593--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Dialog/__stories__/Dialog.portals.stories.tsx@@ -0,0 +1,164 @@+import { Button } from '@ui/primitives/input/Button/Button';+import { DirectionProvider } from '@base-ui/react/direction-provider';+import { type Meta, type StoryObj } from '@storybook/react-vite';+import { useRef, useState } from 'react';+import { expect, userEvent, waitFor, within } from 'storybook/test';++import { ComponentDecorator } from '@ui/testing';+import { ThemeProvider } from '@ui/theme-constants/ThemeProvider';++import { DialogExample } from './DialogExample';+import { waitForDialog } from './waitForDialog';++const meta: Meta<typeof DialogExample> = {+ title: 'UI/Surfaces/Dialog',+ component: DialogExample,+};++export default meta;+type Story = StoryObj<typeof DialogExample>;++export const ScopedThemeAndDirection: Story = {+ decorators: [ComponentDecorator],+ render: () => (+ <DirectionProvider direction="rtl">+ <ThemeProvider colorScheme="dark" applyToRoot={false}>+ <div+ data-testid="theme-scope"+ style={{ backgroundColor: 'var(--t-background-primary)' }}+ >+ <div+ data-testid="theme-color"+ style={{ backgroundColor: 'var(--t-background-primary)' }}+ />+ <DialogExample defaultOpen />+ </div>+ </ThemeProvider>+ </DirectionProvider>+ ),+ play: async ({ canvasElement }) => {+ const dialog = await waitForDialog(canvasElement);+ const colorSample = within(canvasElement).getByTestId('theme-color');+ expect(canvasElement).toContainElement(dialog);+ expect(dialog.closest('.dark')).not.toBeNull();+ expect(getComputedStyle(dialog).direction).toBe('rtl');+ expect(getComputedStyle(dialog).backgroundColor).toBe(+ getComputedStyle(colorSample).backgroundColor,+ );+ const cancel = within(dialog).getByRole('button', { name: 'Close' });+ const confirm = within(dialog).getByRole('button', {+ name: 'Save',+ });+ expect(cancel.getBoundingClientRect().left).toBeGreaterThan(+ confirm.getBoundingClientRect().left,+ );+ },+};++const ExplicitContainerDialog = () => {+ const [container, setContainer] = useState<HTMLDivElement | null>(null);++ return (+ <>+ <div ref={setContainer} data-testid="portal-container" />+ <ThemeProvider colorScheme="dark" applyToRoot={false}>+ <div style={{ backgroundColor: 'var(--t-background-primary)' }}>+ <DialogExample defaultOpen popupProps={{ container }} />+ </div>+ </ThemeProvider>+ </>+ );+};++export const ExplicitContainer: Story = {+ decorators: [ComponentDecorator],+ render: () => <ExplicitContainerDialog />,+ play: async ({ canvasElement }) => {+ const dialog = await waitForDialog(canvasElement);+ expect(+ within(canvasElement).getByTestId('portal-container'),+ ).toContainElement(dialog);+ expect(dialog.closest('.dark')).toBeNull();+ },+};++const DeferredContainerDialog = () => {+ const containerRef = useRef<HTMLDivElement>(null);+ const [container, setContainer] = useState<HTMLDivElement | null>(null);++ return (+ <ThemeProvider colorScheme="light" applyToRoot={false}>+ <div ref={containerRef} data-testid="deferred-container" />+ <Button onClick={() => setContainer(containerRef.current)}>+ Attach container+ </Button>+ <DialogExample open popupProps={{ container }} />+ </ThemeProvider>+ );+};++export const DeferredContainer: Story = {+ decorators: [ComponentDecorator],+ render: () => <DeferredContainerDialog />,+ play: async ({ canvasElement }) => {+ const body = within(canvasElement.ownerDocument.body);+ expect(body.queryByRole('dialog')).not.toBeInTheDocument();+ const canvas = within(canvasElement);+ await userEvent.click(+ canvas.getByRole('button', { name: 'Attach container' }),+ );+ const dialog = await waitForDialog(canvasElement);+ expect(canvas.getByTestId('deferred-container')).toContainElement(dialog);+ },+};++const RefContainerDialog = () => {+ const container = useRef<HTMLDivElement>(null);++ return (+ <>+ <div ref={container} data-testid="ref-container" />+ <DialogExample defaultOpen popupProps={{ container }} />+ </>+ );+};++export const RefContainer: Story = {+ decorators: [ComponentDecorator],+ render: () => <RefContainerDialog />,+ play: async ({ canvasElement }) => {+ const dialog = await waitForDialog(canvasElement);+ expect(within(canvasElement).getByTestId('ref-container')).toContainElement(+ dialog,+ );+ },+};++export const RenderComposition: Story = {+ decorators: [ComponentDecorator],+ args: {+ popupProps: {+ render: (props, state) => (+ <section {...props} data-render-open={state.open} />+ ),+ className: (state) => (state.open ? 'consumer-open' : 'consumer-closed'),+ style: (state) => ({+ borderTopWidth: state.open ? 3 : 1,+ borderTopStyle: 'solid',+ }),+ },+ },+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ await userEvent.click(canvas.getByRole('button', { name: 'Edit account' }));+ const dialog = await waitForDialog(canvasElement);+ expect(dialog.tagName).toBe('SECTION');+ expect(dialog).toHaveAttribute('data-render-open', 'true');+ expect(dialog).toHaveClass('consumer-open');+ expect(dialog).toHaveStyle({ borderTopWidth: '3px' });+ await userEvent.click(+ within(dialog).getByRole('button', { name: 'Close' }),+ );+ await waitFor(() => expect(dialog).not.toBeInTheDocument());+ },+};diff --git a/packages/twenty-ui/src/primitives/surfaces/Dialog/__stories__/Dialog.stories.tsx b/packages/twenty-ui/src/primitives/surfaces/Dialog/__stories__/Dialog.stories.tsxindex 18266961558..51ccc841770 100644--- a/packages/twenty-ui/src/primitives/surfaces/Dialog/__stories__/Dialog.stories.tsx+++ b/packages/twenty-ui/src/primitives/surfaces/Dialog/__stories__/Dialog.stories.tsx@@ -1,66 +1,100 @@+import { Text } from '@ui/primitives/typography/Text/Text';import { type Meta, type StoryObj } from '@storybook/react-vite';-import { expect, within } from 'storybook/test';+import { expect, userEvent, waitFor, within } from 'storybook/test';-import { Modal } from '@ui/primitives/surfaces/Modal/Modal';-import { Text } from '@ui/primitives/typography/Text/Text';import { ComponentDecorator } from '@ui/testing';-import { Dialog } from '../Dialog';+import { DialogExample } from './DialogExample';++import { waitForDialog } from './waitForDialog';-const meta: Meta<typeof Dialog.Title> = {+const meta: Meta<typeof DialogExample> = {title: 'UI/Surfaces/Dialog',- component: Dialog.Title,- decorators: [ComponentDecorator],- args: { children: 'Grant credits' },- render: (args) => (- <Modal isOpen padding="large" autoHeight>- <Dialog.Title {...args} />- <Text>Add credits to this workspace.</Text>- </Modal>- ),+ component: DialogExample,+ argTypes: {+ size: {+ control: 'select',+ options: ['sm', 'md', 'lg', 'xl', 'fullscreen'],+ },+ },};export default meta;+type Story = StoryObj<typeof DialogExample>;-type Story = StoryObj<typeof Dialog.Title>;--export const Documentation: Story = {- play: async () => {- const dialog = within(document.body).getByRole('dialog', {- name: 'Grant credits',- });- const title = within(dialog).getByRole('heading', { level: 2 });+export const Default: Story = {+ decorators: [ComponentDecorator],+ args: { defaultOpen: true },+ play: async ({ canvasElement }) => {+ const dialog = await waitForDialog(canvasElement);+ const body = within(canvasElement.ownerDocument.body);- const titleStyle = getComputedStyle(title);+ expect(dialog).toHaveAccessibleName('Edit account');+ expect(dialog).toHaveAccessibleDescription('Update the account details.');+ expect(dialog).toHaveAttribute(+ 'aria-labelledby',+ body.getByRole('heading', { name: 'Edit account' }).id,+ );+ expect(canvasElement).not.toContainElement(dialog);+ const bounds = dialog.getBoundingClientRect();+ const viewport = canvasElement.ownerDocument.documentElement;- await expect(title).toHaveAttribute('data-size', 'lg');- await expect(titleStyle.marginBlockEnd).toBe('16px');- await expect(titleStyle.textAlign).toBe('center');- await expect(dialog).toHaveAttribute('aria-labelledby', title.id);+ expect(bounds.left).toBeGreaterThanOrEqual(0);+ expect(bounds.top).toBeGreaterThanOrEqual(0);+ expect(bounds.right).toBeLessThanOrEqual(viewport.clientWidth);+ expect(bounds.bottom).toBeLessThanOrEqual(viewport.clientHeight);},};-export const CustomTitle: Story = {- args: {- level: 3,- size: 'sm',- style: { marginBlockEnd: 24, textAlign: 'left' },- },- play: async () => {- const title = within(document.body).getByRole('heading', {- name: 'Grant credits',- level: 3,+export const Documentation: Story = {+ ...Default,+ args: { defaultOpen: false },+ play: async ({ canvasElement }) => {+ const trigger = within(canvasElement).getByRole('button', {+ name: 'Edit account',});+ const body = within(canvasElement.ownerDocument.body);++ expect(body.queryByRole('dialog')).not.toBeInTheDocument();+ await userEvent.click(trigger);+ const dialog = await waitForDialog(canvasElement);+ expect(dialog).toHaveAccessibleName('Edit account');+ expect(dialog).toHaveAccessibleDescription('Update the account details.');+ await userEvent.click(+ within(dialog).getByRole('button', { name: 'Close' }),+ );+ await waitFor(() => expect(dialog).not.toBeInTheDocument());+ await waitFor(() => expect(trigger).toHaveFocus());+ },+};- const titleStyle = getComputedStyle(title);+export const Small: Story = {+ ...Default,+ args: { defaultOpen: true, size: 'sm' },+};+export const Large: Story = {+ ...Default,+ args: { defaultOpen: true, size: 'lg' },+};+export const ExtraLarge: Story = {+ ...Default,+ args: { defaultOpen: true, size: 'xl' },+};+export const Fullscreen: Story = {+ ...Default,+ args: { defaultOpen: true, size: 'fullscreen' },+};- await expect(title).toHaveAttribute('data-size', 'sm');- await expect(titleStyle.marginBlockEnd).toBe('24px');- await expect(titleStyle.textAlign).toBe('left');+export const Catalog: Story = {+ ...Default,+ args: {+ defaultOpen: true,+ content: <Text>Acme · Company record</Text>,},};-export const Dark: Story = {- ...Documentation,+export const CatalogDark: Story = {+ ...Catalog,+ tags: ['!autodocs'],globals: { colorScheme: 'dark' },};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.tsxnew file mode 100644index 00000000000..a44522e9d32--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Dialog/__stories__/Dialog.titles.stories.tsx@@ -0,0 +1,81 @@+import { type Meta, type StoryObj } from '@storybook/react-vite';+import { expect, within } from 'storybook/test';++import { Button } from '@ui/primitives/input/Button/Button';+import { ComponentDecorator } from '@ui/testing';++import { Dialog } from '../Dialog';+import { waitForDialog } from './waitForDialog';++const meta: Meta<typeof Dialog.Title> = {+ title: 'UI/Surfaces/Dialog',+ component: Dialog.Title,+ decorators: [ComponentDecorator],+ args: { children: 'Grant credits' },+ render: (args) => (+ <Dialog.Root defaultOpen>+ <Dialog.Popup>+ <Dialog.Header>+ <Dialog.Title {...args} />+ <Dialog.Description>+ Add credits to this workspace.+ </Dialog.Description>+ </Dialog.Header>+ <Dialog.Footer>+ <Dialog.Close render={<Button>Close</Button>} />+ </Dialog.Footer>+ </Dialog.Popup>+ </Dialog.Root>+ ),+};++export default meta;+type Story = StoryObj<typeof Dialog.Title>;++export const TitleTypography: Story = {+ play: async ({ canvasElement }) => {+ const dialog = await waitForDialog(canvasElement);+ const title = within(dialog).getByRole('heading', {+ name: 'Grant credits',+ level: 2,+ });+ const titleStyle = getComputedStyle(title);++ expect(title).toHaveAttribute('data-size', 'lg');+ expect(title).toHaveAttribute('data-color', 'primary');+ expect(titleStyle.marginBlockEnd).toBe('16px');+ expect(titleStyle.textAlign).toBe('center');+ expect(dialog).toHaveAttribute('aria-labelledby', title.id);+ },+};++export const CustomTitle: Story = {+ args: {+ level: 3,+ size: 'sm',+ color: 'secondary',+ style: { marginBlockEnd: 24, textAlign: 'left' },+ },+ play: async ({ canvasElement }) => {+ const dialog = await waitForDialog(canvasElement);+ const title = within(dialog).getByRole('heading', {+ name: 'Grant credits',+ level: 3,+ });+ const titleStyle = getComputedStyle(title);+ const description = within(dialog).getByText(+ 'Add credits to this workspace.',+ );++ expect(title).toHaveAttribute('data-size', 'sm');+ expect(titleStyle.color).toBe(getComputedStyle(description).color);+ expect(titleStyle.marginBlockEnd).toBe('24px');+ expect(titleStyle.textAlign).toBe('left');+ expect(dialog).toHaveAccessibleName('Grant credits');+ },+};++export const TitleTypographyDark: Story = {+ ...TitleTypography,+ globals: { colorScheme: 'dark' },+};diff --git a/packages/twenty-ui/src/primitives/surfaces/Dialog/__stories__/DialogExample.tsx b/packages/twenty-ui/src/primitives/surfaces/Dialog/__stories__/DialogExample.tsxnew file mode 100644index 00000000000..6f67344b974--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Dialog/__stories__/DialogExample.tsx@@ -0,0 +1,31 @@+import { Button } from '@ui/primitives/input/Button/Button';+import { isDefined } from '@ui/utilities/utils/isDefined';++import { Dialog } from '../Dialog';+import { type DialogExampleProps } from './DialogExampleProps';++export const DialogExample = ({+ size,+ popupProps,+ disabled,+ content,+ ...props+}: DialogExampleProps) => (+ <Dialog.Root {...props}>+ <Dialog.Trigger+ disabled={disabled}+ render={<Button>Edit account</Button>}+ />+ <Dialog.Popup size={size} {...popupProps}>+ <Dialog.Header>+ <Dialog.Title>Edit account</Dialog.Title>+ <Dialog.Description>Update the account details.</Dialog.Description>+ </Dialog.Header>+ {isDefined(content) && <Dialog.Body>{content}</Dialog.Body>}+ <Dialog.Footer>+ <Dialog.Close render={<Button variant="outline">Close</Button>} />+ <Dialog.Close render={<Button>Save</Button>} />+ </Dialog.Footer>+ </Dialog.Popup>+ </Dialog.Root>+);diff --git a/packages/twenty-ui/src/primitives/surfaces/Dialog/__stories__/DialogExampleProps.ts b/packages/twenty-ui/src/primitives/surfaces/Dialog/__stories__/DialogExampleProps.tsnew file mode 100644index 00000000000..2fba95e6c22--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Dialog/__stories__/DialogExampleProps.ts@@ -0,0 +1,11 @@+import { type ReactNode } from 'react';++import { type DialogPopupProps } from '../types/DialogPopupProps';+import { type DialogRootProps } from '../types/DialogRootProps';++export type DialogExampleProps = DialogRootProps & {+ size?: DialogPopupProps['size'];+ popupProps?: DialogPopupProps;+ disabled?: boolean;+ content?: ReactNode;+};diff --git a/packages/twenty-ui/src/primitives/surfaces/Dialog/__stories__/waitForDialog.ts b/packages/twenty-ui/src/primitives/surfaces/Dialog/__stories__/waitForDialog.tsnew file mode 100644index 00000000000..eaf9e8de8e1--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Dialog/__stories__/waitForDialog.ts@@ -0,0 +1,14 @@+import { expect, waitFor, within } from 'storybook/test';++export const waitForDialog = async (canvasElement: HTMLElement) => {+ const dialog = await within(canvasElement.ownerDocument.body).findByRole(+ 'dialog',+ );++ await waitFor(() => {+ expect(dialog).toBeVisible();+ expect(getComputedStyle(dialog).opacity).toBe('1');+ });++ return dialog;+};diff --git a/packages/twenty-ui/src/primitives/surfaces/Dialog/__tests__/Dialog.test.tsx b/packages/twenty-ui/src/primitives/surfaces/Dialog/__tests__/Dialog.test.tsxnew file mode 100644index 00000000000..56949a1d0a9--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Dialog/__tests__/Dialog.test.tsx@@ -0,0 +1,65 @@+import { type ReactNode } from 'react';++import { runComponentConformance } from '@test-utilities/conformance/runComponentConformance';++import styles from '@ui/primitives/surfaces/internal/Dialog.module.scss';+import { Dialog } from '../Dialog';++const DialogRootWrapper = ({ children }: { children: ReactNode }) => (+ <Dialog.Root>{children}</Dialog.Root>+);+const OpenDialogWrapper = ({ children }: { children: ReactNode }) => (+ <Dialog.Root open>{children}</Dialog.Root>+);+const DialogPopupWrapper = ({ children }: { children: ReactNode }) => (+ <Dialog.Root open>+ <Dialog.Popup initialFocus={false}>{children}</Dialog.Popup>+ </Dialog.Root>+);++runComponentConformance({+ name: 'Dialog.Trigger',+ element: <Dialog.Trigger>Open</Dialog.Trigger>,+ refInstanceOf: HTMLButtonElement,+ wrapper: DialogRootWrapper,+ renderPropTagName: 'button',+});+runComponentConformance({+ name: 'Dialog.Popup',+ element: <Dialog.Popup initialFocus={false} />,+ refInstanceOf: HTMLDivElement,+ wrapper: OpenDialogWrapper,+ ownClassName: styles.popup,+});+runComponentConformance({+ name: 'Dialog.Description',+ element: <Dialog.Description>Description</Dialog.Description>,+ refInstanceOf: HTMLParagraphElement,+ wrapper: DialogPopupWrapper,+ ownClassName: styles.description,+});+runComponentConformance({+ name: 'Dialog.Close',+ element: <Dialog.Close>Cancel</Dialog.Close>,+ refInstanceOf: HTMLButtonElement,+ wrapper: DialogPopupWrapper,+ renderPropTagName: 'button',+});+runComponentConformance({+ name: 'Dialog.Header',+ element: <Dialog.Header>Header</Dialog.Header>,+ refInstanceOf: HTMLDivElement,+ ownClassName: styles.header,+});+runComponentConformance({+ name: 'Dialog.Body',+ element: <Dialog.Body>Body</Dialog.Body>,+ refInstanceOf: HTMLDivElement,+ ownClassName: styles.body,+});+runComponentConformance({+ name: 'Dialog.Footer',+ element: <Dialog.Footer>Footer</Dialog.Footer>,+ refInstanceOf: HTMLDivElement,+ ownClassName: styles.footer,+});diff --git a/packages/twenty-ui/src/primitives/surfaces/Dialog/__tests__/DialogTitle.test.tsx b/packages/twenty-ui/src/primitives/surfaces/Dialog/__tests__/DialogTitle.test.tsxindex 6642954e397..debc262d422 100644--- a/packages/twenty-ui/src/primitives/surfaces/Dialog/__tests__/DialogTitle.test.tsx+++ b/packages/twenty-ui/src/primitives/surfaces/Dialog/__tests__/DialogTitle.test.tsx@@ -1,10 +1,8 @@-import { Dialog as DialogPrimitive } from '@base-ui/react/dialog';import { render, screen } from '@testing-library/react';import { type ReactNode } from 'react';import { expect, it } from 'vitest';import { runComponentConformance } from '@test-utilities/conformance/runComponentConformance';-import { Modal } from '@ui/primitives/surfaces/Modal/Modal';import { ThemeProvider } from '@ui/theme-constants/ThemeProvider';import { Dialog } from '../Dialog';@@ -12,7 +10,7 @@ import { Dialog } from '../Dialog';import styles from '../DialogTitle.module.scss';const DialogRootWrapper = ({ children }: { children: ReactNode }) => (- <DialogPrimitive.Root>{children}</DialogPrimitive.Root>+ <Dialog.Root>{children}</Dialog.Root>);runComponentConformance({@@ -23,14 +21,16 @@ runComponentConformance({wrapper: DialogRootWrapper,});-it('labels the modal and keeps the title level independent of its size', () => {+it('labels the dialog and keeps the title level independent of its size', () => {render(<ThemeProvider colorScheme="light">- <Modal isOpen>- <Dialog.Title level={3} size="sm">- Grant credits- </Dialog.Title>- </Modal>+ <Dialog.Root open>+ <Dialog.Popup initialFocus={false}>+ <Dialog.Title level={3} size="sm">+ Grant credits+ </Dialog.Title>+ </Dialog.Popup>+ </Dialog.Root></ThemeProvider>,);diff --git a/packages/twenty-ui/src/primitives/surfaces/Dialog/internal/DialogBody.tsx b/packages/twenty-ui/src/primitives/surfaces/Dialog/internal/DialogBody.tsxnew file mode 100644index 00000000000..11dd521f64d--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Dialog/internal/DialogBody.tsx@@ -0,0 +1,17 @@+import { useRender } from '@base-ui/react/use-render';+import { clsx } from 'clsx';++import styles from '@ui/primitives/surfaces/internal/Dialog.module.scss';+import { type DialogBodyProps } from '../types/DialogBodyProps';++export const DialogBody = ({+ render,+ ref,+ className,+ ...props+}: DialogBodyProps) =>+ useRender({+ render,+ ref,+ props: { ...props, className: clsx(styles.body, className) },+ });diff --git a/packages/twenty-ui/src/primitives/surfaces/Dialog/internal/DialogDescription.tsx b/packages/twenty-ui/src/primitives/surfaces/Dialog/internal/DialogDescription.tsxnew file mode 100644index 00000000000..a5e0311d568--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Dialog/internal/DialogDescription.tsx@@ -0,0 +1,16 @@+import { Dialog as DialogPrimitive } from '@base-ui/react/dialog';++import { mergeClassNames } from '@ui/utilities/internal/mergeClassNames';++import styles from '@ui/primitives/surfaces/internal/Dialog.module.scss';+import { type DialogDescriptionProps } from '../types/DialogDescriptionProps';++export const DialogDescription = ({+ className,+ ...props+}: DialogDescriptionProps) => (+ <DialogPrimitive.Description+ {...props}+ className={mergeClassNames(styles.description, className)}+ />+);diff --git a/packages/twenty-ui/src/primitives/surfaces/Dialog/internal/DialogFooter.tsx b/packages/twenty-ui/src/primitives/surfaces/Dialog/internal/DialogFooter.tsxnew file mode 100644index 00000000000..9b33972ec34--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Dialog/internal/DialogFooter.tsx@@ -0,0 +1,17 @@+import { useRender } from '@base-ui/react/use-render';+import { clsx } from 'clsx';++import styles from '@ui/primitives/surfaces/internal/Dialog.module.scss';+import { type DialogFooterProps } from '../types/DialogFooterProps';++export const DialogFooter = ({+ render,+ ref,+ className,+ ...props+}: DialogFooterProps) =>+ useRender({+ render,+ ref,+ props: { ...props, className: clsx(styles.footer, className) },+ });diff --git a/packages/twenty-ui/src/primitives/surfaces/Dialog/internal/DialogHeader.tsx b/packages/twenty-ui/src/primitives/surfaces/Dialog/internal/DialogHeader.tsxnew file mode 100644index 00000000000..89eb766b77f--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Dialog/internal/DialogHeader.tsx@@ -0,0 +1,17 @@+import { useRender } from '@base-ui/react/use-render';+import { clsx } from 'clsx';++import styles from '@ui/primitives/surfaces/internal/Dialog.module.scss';+import { type DialogHeaderProps } from '../types/DialogHeaderProps';++export const DialogHeader = ({+ render,+ ref,+ className,+ ...props+}: DialogHeaderProps) =>+ useRender({+ render,+ ref,+ props: { ...props, className: clsx(styles.header, className) },+ });diff --git a/packages/twenty-ui/src/primitives/surfaces/Dialog/internal/DialogPopup.tsx b/packages/twenty-ui/src/primitives/surfaces/Dialog/internal/DialogPopup.tsxnew file mode 100644index 00000000000..a495b447cd5--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Dialog/internal/DialogPopup.tsx@@ -0,0 +1,51 @@+import { Dialog as DialogPrimitive } from '@base-ui/react/dialog';+import { isBoolean } from '@sniptt/guards';+import { useDirection } from '@base-ui/react/direction-provider';++import { useThemeContainer } from '@ui/theme-constants';+import { mergeClassNames } from '@ui/utilities/internal/mergeClassNames';++import styles from '@ui/primitives/surfaces/internal/Dialog.module.scss';+import { type DialogPopupProps } from '../types/DialogPopupProps';++export const DialogPopup = ({+ size = 'md',+ container,+ keepMounted,+ backdrop = true,+ viewportProps,+ className,+ ...props+}: DialogPopupProps) => {+ const themeContainer = useThemeContainer();+ const direction = useDirection();+ const backdropProps = isBoolean(backdrop) ? {} : backdrop;++ return (+ <DialogPrimitive.Portal+ container={+ container === undefined ? (themeContainer ?? undefined) : container+ }+ keepMounted={keepMounted}+ >+ {backdrop !== false && (+ <DialogPrimitive.Backdrop+ {...backdropProps}+ className={mergeClassNames(styles.backdrop, backdropProps.className)}+ />+ )}+ <DialogPrimitive.Viewport+ dir={direction}+ data-backdrop-hidden={backdrop === false}+ {...viewportProps}+ className={mergeClassNames(styles.viewport, viewportProps?.className)}+ >+ <DialogPrimitive.Popup+ {...props}+ data-size={size}+ className={mergeClassNames(styles.popup, className)}+ />+ </DialogPrimitive.Viewport>+ </DialogPrimitive.Portal>+ );+};diff --git a/packages/twenty-ui/src/primitives/surfaces/Dialog/types/DialogBodyProps.ts b/packages/twenty-ui/src/primitives/surfaces/Dialog/types/DialogBodyProps.tsnew file mode 100644index 00000000000..bdedb15e498--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Dialog/types/DialogBodyProps.ts@@ -0,0 +1,3 @@+import { type useRender } from '@base-ui/react/use-render';++export type DialogBodyProps = useRender.ComponentProps<'div'>;diff --git a/packages/twenty-ui/src/primitives/surfaces/Dialog/types/DialogCloseProps.ts b/packages/twenty-ui/src/primitives/surfaces/Dialog/types/DialogCloseProps.tsnew file mode 100644index 00000000000..d0311a783c5--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Dialog/types/DialogCloseProps.ts@@ -0,0 +1,3 @@+import { type Dialog as DialogPrimitive } from '@base-ui/react/dialog';++export type DialogCloseProps = DialogPrimitive.Close.Props;diff --git a/packages/twenty-ui/src/primitives/surfaces/Dialog/types/DialogDescriptionProps.ts b/packages/twenty-ui/src/primitives/surfaces/Dialog/types/DialogDescriptionProps.tsnew file mode 100644index 00000000000..3773d4db13d--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Dialog/types/DialogDescriptionProps.ts@@ -0,0 +1,3 @@+import { type Dialog as DialogPrimitive } from '@base-ui/react/dialog';++export type DialogDescriptionProps = DialogPrimitive.Description.Props;diff --git a/packages/twenty-ui/src/primitives/surfaces/Dialog/types/DialogFooterProps.ts b/packages/twenty-ui/src/primitives/surfaces/Dialog/types/DialogFooterProps.tsnew file mode 100644index 00000000000..db2b70e394d--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Dialog/types/DialogFooterProps.ts@@ -0,0 +1,3 @@+import { type useRender } from '@base-ui/react/use-render';++export type DialogFooterProps = useRender.ComponentProps<'div'>;diff --git a/packages/twenty-ui/src/primitives/surfaces/Dialog/types/DialogHeaderProps.ts b/packages/twenty-ui/src/primitives/surfaces/Dialog/types/DialogHeaderProps.tsnew file mode 100644index 00000000000..5aec20a9188--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Dialog/types/DialogHeaderProps.ts@@ -0,0 +1,3 @@+import { type useRender } from '@base-ui/react/use-render';++export type DialogHeaderProps = useRender.ComponentProps<'div'>;diff --git a/packages/twenty-ui/src/primitives/surfaces/Dialog/types/DialogPopupProps.ts b/packages/twenty-ui/src/primitives/surfaces/Dialog/types/DialogPopupProps.tsnew file mode 100644index 00000000000..527702bfd39--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Dialog/types/DialogPopupProps.ts@@ -0,0 +1,11 @@+import { type Dialog as DialogPrimitive } from '@base-ui/react/dialog';++import { type DialogSize } from './DialogSize';++export type DialogPopupProps = DialogPrimitive.Popup.Props & {+ size?: DialogSize;+ container?: DialogPrimitive.Portal.Props['container'];+ keepMounted?: boolean;+ backdrop?: boolean | DialogPrimitive.Backdrop.Props;+ viewportProps?: DialogPrimitive.Viewport.Props;+};diff --git a/packages/twenty-ui/src/primitives/surfaces/Dialog/types/DialogRootProps.ts b/packages/twenty-ui/src/primitives/surfaces/Dialog/types/DialogRootProps.tsnew file mode 100644index 00000000000..e89a819592d--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Dialog/types/DialogRootProps.ts@@ -0,0 +1,4 @@+import { type Dialog as DialogPrimitive } from '@base-ui/react/dialog';++export type DialogRootProps<TPayload = unknown> =+ DialogPrimitive.Root.Props<TPayload>;diff --git a/packages/twenty-ui/src/primitives/surfaces/Dialog/types/DialogSize.ts b/packages/twenty-ui/src/primitives/surfaces/Dialog/types/DialogSize.tsnew file mode 100644index 00000000000..b776b9d4c07--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Dialog/types/DialogSize.ts@@ -0,0 +1 @@+export type DialogSize = 'sm' | 'md' | 'lg' | 'xl' | 'fullscreen';diff --git a/packages/twenty-ui/src/primitives/surfaces/Dialog/types/DialogTriggerProps.ts b/packages/twenty-ui/src/primitives/surfaces/Dialog/types/DialogTriggerProps.tsnew file mode 100644index 00000000000..1dd01d9bd70--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/Dialog/types/DialogTriggerProps.ts@@ -0,0 +1,4 @@+import { type Dialog as DialogPrimitive } from '@base-ui/react/dialog';++export type DialogTriggerProps<TPayload = unknown> =+ DialogPrimitive.Trigger.Props<TPayload>;diff --git a/packages/twenty-ui/src/primitives/surfaces/Modal/Modal.module.scss b/packages/twenty-ui/src/primitives/surfaces/Modal/Modal.module.scssdeleted file mode 100644index b44794007e0..00000000000--- a/packages/twenty-ui/src/primitives/surfaces/Modal/Modal.module.scss+++ /dev/null@@ -1,98 +0,0 @@-.modal {- display: flex;- flex-direction: column;- box-shadow: var(--t-box-shadow-strong);- background: var(--t-background-primary);- color: var(--t-font-color-primary);- border-radius: var(--t-border-radius-md);- overflow-x: hidden;- overflow-y: auto;- z-index: var(--modal-z-index, 40);- width: auto;- height: auto;- max-height: calc(90dvh / var(--t-zoom, 1));- // framer-motion faded the deprecated modal in and out over the theme's- // normal duration; Base UI drives the same fade through its- // data-starting-style and data-ending-style transition states- transition: opacity duration(normal) ease-out;-- &[data-starting-style],- &[data-ending-style] {- opacity: 0;- }-}--// The source order of the classes below replicates the precedence of the-// deprecated Linaria conditionals: fullscreen > narrowWidth and autoHeight >-// isMobile > overlay and smallBorderRadius > size--.small {- width: var(--t-modal-size-sm-width);-}--.medium {- width: var(--t-modal-size-md-width);-}--.large {- width: var(--t-modal-size-lg-width);-}--.extraLarge {- width: var(--t-modal-size-xl-width);- height: var(--t-modal-size-xl-height);-}--.paddingNone {- padding: var(--t-spacing-0);-}--.paddingSmall {- padding: var(--t-spacing-2);-}--.paddingMedium {- padding: var(--t-spacing-4);-}--.paddingLarge {- padding: var(--t-spacing-6);-}--.overlayDark {- box-shadow: var(--t-box-shadow-super-heavy);-}--.smallBorderRadius {- border-radius: var(--t-spacing-1);-}--.overlayTransparent {- box-shadow: none;- background: transparent;- border-radius: 0;-}--.mobile {- border-radius: 0;- width: var(--t-modal-size-fullscreen-width);- height: var(--t-modal-size-fullscreen-height);- max-height: none;-}--.narrowWidth {- width: calc(400px - var(--t-spacing-32));-}--.autoHeight {- height: auto;-}--.fullscreen {- box-shadow: none;- background: var(--t-background-primary);- border-radius: 0;- width: var(--t-modal-size-fullscreen-width);- height: var(--t-modal-size-fullscreen-height);- max-height: none;-}diff --git a/packages/twenty-ui/src/primitives/surfaces/Modal/Modal.module.scss.d.ts b/packages/twenty-ui/src/primitives/surfaces/Modal/Modal.module.scss.d.tsdeleted file mode 100644index 670f48ddf0e..00000000000--- a/packages/twenty-ui/src/primitives/surfaces/Modal/Modal.module.scss.d.ts+++ /dev/null@@ -1,19 +0,0 @@-declare const classNames: {- readonly modal: 'modal';- readonly small: 'small';- readonly medium: 'medium';- readonly large: 'large';- readonly extraLarge: 'extraLarge';- readonly paddingNone: 'paddingNone';- readonly paddingSmall: 'paddingSmall';- readonly paddingMedium: 'paddingMedium';- readonly paddingLarge: 'paddingLarge';- readonly overlayDark: 'overlayDark';- readonly smallBorderRadius: 'smallBorderRadius';- readonly overlayTransparent: 'overlayTransparent';- readonly mobile: 'mobile';- readonly narrowWidth: 'narrowWidth';- readonly autoHeight: 'autoHeight';- readonly fullscreen: 'fullscreen';-};-export default classNames;diff --git a/packages/twenty-ui/src/primitives/surfaces/Modal/Modal.tsx b/packages/twenty-ui/src/primitives/surfaces/Modal/Modal.tsxdeleted file mode 100644index f05788cebb7..00000000000--- a/packages/twenty-ui/src/primitives/surfaces/Modal/Modal.tsx+++ /dev/null@@ -1,132 +0,0 @@-import { Dialog } from '@base-ui/react/dialog';-import { clsx } from 'clsx';-import { useRef } from 'react';-import { useThemeContainer } from '@ui/theme-constants';-import { isDefined } from '@ui/utilities/utils/isDefined';--import { type ModalOverlay } from '@ui/primitives/surfaces/Modal/types/ModalOverlay';-import { type ModalPadding } from '@ui/primitives/surfaces/Modal/types/ModalPadding';-import { type ModalProps } from '@ui/primitives/surfaces/Modal/types/ModalProps';--import styles from './Modal.module.scss';-import { ModalBackdrop } from '@ui/primitives/surfaces/ModalBackdrop/ModalBackdrop';--const DEFAULT_MODAL_Z_INDEX = 40;-const DEFAULT_BACKDROP_Z_INDEX = 39;--// Base UI's Dialog.Popup stops the propagation of these keydown events, but-// the deprecated Modal let them bubble up to global hotkey listeners.-const KEYDOWN_EVENTS_TO_PROPAGATE = new Set([- 'ArrowUp',- 'ArrowDown',- 'ArrowLeft',- 'ArrowRight',- 'Home',- 'End',-]);--const PADDING_CLASS_NAMES: Record<ModalPadding, string> = {- none: styles.paddingNone,- small: styles.paddingSmall,- medium: styles.paddingMedium,- large: styles.paddingLarge,-};--// The 'light' overlay is the base style of the modal, so it needs no class-const OVERLAY_CLASS_NAMES: Record<ModalOverlay, string | undefined> = {- dark: styles.overlayDark,- light: undefined,- transparent: styles.overlayTransparent,-};--export const Modal = ({- isOpen,- ariaLabel,- children,- size = 'medium',- padding = 'medium',- overlay = 'dark',- isMobile = false,- isInContainer = false,- container,- gap,- smallBorderRadius,- narrowWidth,- autoHeight,- width,- modalZIndex = DEFAULT_MODAL_Z_INDEX,- backdropZIndex = DEFAULT_BACKDROP_Z_INDEX,- backdropTestId = 'modal-backdrop',- backdropClickOutsideId,- preventClickOutside,- onBackdropMouseDown,- modalRef: externalRef,-}: ModalProps) => {- const internalRef = useRef<HTMLDivElement>(null);- const resolvedRef = externalRef ?? internalRef;-- const themeContainer = useThemeContainer();- const resolvedContainer = isDefined(container)- ? container- : (themeContainer ?? undefined);-- const handleBackdropMouseDown = (e: React.MouseEvent) => {- e.stopPropagation();- onBackdropMouseDown?.(e);- };-- // modal={false} and disablePointerDismissal keep Base UI from trapping- // focus, locking scroll or closing on outside press: like the deprecated- // Modal, open/close is fully controlled by the isOpen prop- return (- <Dialog.Root open={isOpen} modal={false} disablePointerDismissal>- <Dialog.Portal container={resolvedContainer}>- <ModalBackdrop- data-testid={backdropTestId}- data-click-outside-id={backdropClickOutsideId}- onMouseDown={handleBackdropMouseDown}- overlay={overlay}- backdropZIndex={backdropZIndex}- isInContainer={isInContainer}- >- <Dialog.Popup- initialFocus={false}- finalFocus={false}- onKeyDown={(event) => {- if (KEYDOWN_EVENTS_TO_PROPAGATE.has(event.key)) {- event.preventBaseUIHandler();- }- }}- render={- <div- ref={resolvedRef}- aria-label={ariaLabel}- className={clsx(- styles.modal,- styles[size],- PADDING_CLASS_NAMES[padding],- OVERLAY_CLASS_NAMES[overlay],- isMobile && styles.mobile,- smallBorderRadius && styles.smallBorderRadius,- narrowWidth && styles.narrowWidth,- autoHeight && styles.autoHeight,- )}- style={- {- '--modal-z-index': modalZIndex,- width: isMobile ? undefined : width,- gap:- gap !== undefined ? `var(--t-spacing-${gap})` : undefined,- } as React.CSSProperties- }- data-globally-prevent-click-outside={preventClickOutside}- />- }- >- {children}- </Dialog.Popup>- </ModalBackdrop>- </Dialog.Portal>- </Dialog.Root>- );-};diff --git a/packages/twenty-ui/src/primitives/surfaces/Modal/__stories__/Modal.stories.module.scss b/packages/twenty-ui/src/primitives/surfaces/Modal/__stories__/Modal.stories.module.scssdeleted file mode 100644index 14ae9aa02fc..00000000000--- a/packages/twenty-ui/src/primitives/surfaces/Modal/__stories__/Modal.stories.module.scss+++ /dev/null@@ -1,3 +0,0 @@-.sectionContainer {- margin-bottom: var(--t-spacing-6);-}diff --git a/packages/twenty-ui/src/primitives/surfaces/Modal/__stories__/Modal.stories.module.scss.d.ts b/packages/twenty-ui/src/primitives/surfaces/Modal/__stories__/Modal.stories.module.scss.d.tsdeleted file mode 100644index a66148ad167..00000000000--- a/packages/twenty-ui/src/primitives/surfaces/Modal/__stories__/Modal.stories.module.scss.d.ts+++ /dev/null@@ -1,4 +0,0 @@-declare const classNames: {- readonly sectionContainer: 'sectionContainer';-};-export default classNames;diff --git a/packages/twenty-ui/src/primitives/surfaces/Modal/__stories__/Modal.stories.tsx b/packages/twenty-ui/src/primitives/surfaces/Modal/__stories__/Modal.stories.tsxdeleted file mode 100644index 9fec5e8e4d5..00000000000--- a/packages/twenty-ui/src/primitives/surfaces/Modal/__stories__/Modal.stories.tsx+++ /dev/null@@ -1,263 +0,0 @@-import { Section } from '@ui/components/Section/Section';-import { Dialog } from '@ui/primitives/surfaces/Dialog/Dialog';-import { type Meta, type StoryObj } from '@storybook/react-vite';-import { useState } from 'react';-import { IconX } from '@ui/icon';--import { Button } from '@ui/primitives/input';-import { IconButton } from '@ui/components';-import { A11Y_DEFER_COLOR_CONTRAST, ComponentDecorator } from '@ui/testing';--import { Modal } from '@ui/primitives/surfaces/Modal/Modal';-import { ModalContent } from '@ui/primitives/surfaces/ModalContent/ModalContent';-import { ModalFooter } from '@ui/primitives/surfaces/ModalFooter/ModalFooter';-import { ModalHeader } from '@ui/primitives/surfaces/ModalHeader/ModalHeader';--import styles from './Modal.stories.module.scss';--const meta: Meta<typeof Modal> = {- title: 'UI/Surfaces/Modal',- component: Modal,- decorators: [ComponentDecorator],- argTypes: {- size: {- control: 'select',- options: ['small', 'medium', 'large', 'extraLarge'],- },- padding: {- control: 'select',- options: ['none', 'small', 'medium', 'large'],- },- overlay: {- control: 'select',- options: ['light', 'dark', 'transparent'],- },- },-};--export default meta;-type Story = StoryObj<typeof Modal>;--export const Default: Story = {- parameters: { a11y: A11Y_DEFER_COLOR_CONTRAST },- args: {- isOpen: true,- size: 'medium',- padding: 'none',- overlay: 'dark',- },- render: ({ isOpen, size, padding, overlay }) => (- <Modal- isOpen={isOpen}- size={size}- padding={padding}- overlay={overlay}- ariaLabel="Edit workspace"- >- <ModalHeader>- <Section.Header- title="Edit workspace"- description="Update your workspace settings"- />- </ModalHeader>- <ModalContent>- <Section.Root>- Workspace name and subdomain can be changed from the settings panel.- These changes will be reflected across all members.- </Section.Root>- </ModalContent>- <ModalFooter>- <Button variant="outline">{'Cancel'}</Button>- <Button variant="solid" color="accent">- {'Save'}- </Button>- </ModalFooter>- </Modal>- ),-};--export const Confirmation: Story = {- args: {- isOpen: true,- padding: 'large',- overlay: 'dark',- smallBorderRadius: true,- narrowWidth: true,- autoHeight: true,- gap: 2,- },- render: ({- isOpen,- padding,- overlay,- smallBorderRadius,- narrowWidth,- autoHeight,- gap,- }) => (- <Modal- isOpen={isOpen}- padding={padding}- overlay={overlay}- smallBorderRadius={smallBorderRadius}- narrowWidth={narrowWidth}- autoHeight={autoHeight}- gap={gap}- >- <Dialog.Title>Delete record?</Dialog.Title>- <div className={styles.sectionContainer}>- <Section.Root align="center" color="primary">- This action cannot be undone. The record and all of its data will be- permanently removed.- </Section.Root>- </div>- <Button fullWidth variant="outline" style={{ justifyContent: 'center' }}>- {'Cancel'}- </Button>- <Button- fullWidth- variant="outline"- color="danger"- style={{ justifyContent: 'center' }}- >- {'Delete'}- </Button>- </Modal>- ),-};--export const Small: Story = {- args: {- isOpen: true,- size: 'small',- padding: 'none',- overlay: 'dark',- },- render: ({ isOpen, size, padding, overlay }) => (- <Modal- isOpen={isOpen}- size={size}- padding={padding}- overlay={overlay}- ariaLabel="Archive item"- >- <ModalHeader>- <Section.Header title="Archive item" />- </ModalHeader>- <ModalContent>- <Section.Root>Are you sure you want to archive this item?</Section.Root>- </ModalContent>- <ModalFooter>- <Button variant="outline">{'No'}</Button>- <Button variant="solid" color="accent">- {'Yes, archive'}- </Button>- </ModalFooter>- </Modal>- ),-};--export const ExtraLarge: Story = {- parameters: { a11y: A11Y_DEFER_COLOR_CONTRAST },- args: {- isOpen: true,- size: 'extraLarge',- padding: 'none',- overlay: 'dark',- },- render: ({ isOpen, size, padding, overlay }) => (- <Modal- isOpen={isOpen}- size={size}- padding={padding}- overlay={overlay}- ariaLabel="Import contacts"- >- <ModalHeader>- <Section.Header- title="Import contacts"- description="Upload a CSV file to import your contacts"- />- </ModalHeader>- <ModalContent>- <Section.Root>- The file should include columns for name, email, phone, and company.- Drag and drop your CSV file here, or click to browse.- </Section.Root>- </ModalContent>- <ModalFooter>- <Button variant="outline">{'Cancel'}</Button>- <Button variant="solid" color="accent">- {'Upload & import'}- </Button>- </ModalFooter>- </Modal>- ),-};--export const Closed: Story = {- args: {- isOpen: false,- size: 'medium',- padding: 'medium',- overlay: 'dark',- },- render: ({ isOpen, size, padding, overlay }) => (- <Modal isOpen={isOpen} size={size} padding={padding} overlay={overlay}>- <ModalContent>This should not be visible.</ModalContent>- </Modal>- ),-};--const InteractiveModal = () => {- const [isOpen, setIsOpen] = useState(false);-- return (- <>- <Button onClick={() => setIsOpen(true)} variant="solid" color="accent">- {'Open Modal'}- </Button>- <Modal- isOpen={isOpen}- size="medium"- padding="none"- overlay="dark"- onBackdropMouseDown={() => setIsOpen(false)}- >- <ModalHeader>- <Section.Header title="Create record" />- <IconButton- aria-label="Close"- variant="ghost"- size="sm"- onClick={() => setIsOpen(false)}- >- <IconX />- </IconButton>- </ModalHeader>- <ModalContent>- <Section.Root>- Fill in the details below to create a new record. All fields are- optional.- </Section.Root>- </ModalContent>- <ModalFooter>- <Button onClick={() => setIsOpen(false)} variant="outline">- {'Cancel'}- </Button>- <Button- onClick={() => setIsOpen(false)}- variant="solid"- color="accent"- >- {'Create'}- </Button>- </ModalFooter>- </Modal>- </>- );-};--export const Interactive: Story = {- render: () => <InteractiveModal />,-};diff --git a/packages/twenty-ui/src/primitives/surfaces/Modal/types/ModalOverlay.ts b/packages/twenty-ui/src/primitives/surfaces/Modal/types/ModalOverlay.tsdeleted file mode 100644index f2f20c2ef31..00000000000--- a/packages/twenty-ui/src/primitives/surfaces/Modal/types/ModalOverlay.ts+++ /dev/null@@ -1 +0,0 @@-export type ModalOverlay = 'light' | 'dark' | 'transparent';diff --git a/packages/twenty-ui/src/primitives/surfaces/Modal/types/ModalPadding.ts b/packages/twenty-ui/src/primitives/surfaces/Modal/types/ModalPadding.tsdeleted file mode 100644index 7c7e5fb286d..00000000000--- a/packages/twenty-ui/src/primitives/surfaces/Modal/types/ModalPadding.ts+++ /dev/null@@ -1 +0,0 @@-export type ModalPadding = 'none' | 'small' | 'medium' | 'large';diff --git a/packages/twenty-ui/src/primitives/surfaces/Modal/types/ModalProps.ts b/packages/twenty-ui/src/primitives/surfaces/Modal/types/ModalProps.tsdeleted file mode 100644index 5d90f85c06a..00000000000--- a/packages/twenty-ui/src/primitives/surfaces/Modal/types/ModalProps.ts+++ /dev/null@@ -1,28 +0,0 @@-import type React from 'react';--import { type ModalOverlay } from '@ui/primitives/surfaces/Modal/types/ModalOverlay';-import { type ModalPadding } from '@ui/primitives/surfaces/Modal/types/ModalPadding';-import { type ModalSize } from '@ui/primitives/surfaces/Modal/types/ModalSize';--export type ModalProps = React.PropsWithChildren & {- isOpen: boolean;- ariaLabel?: string;- size?: ModalSize;- padding?: ModalPadding;- overlay?: ModalOverlay;- isMobile?: boolean;- isInContainer?: boolean;- container?: HTMLElement | null;- gap?: number;- smallBorderRadius?: boolean;- narrowWidth?: boolean;- autoHeight?: boolean;- width?: React.CSSProperties['width'];- modalZIndex?: number;- backdropZIndex?: number;- backdropTestId?: string;- backdropClickOutsideId?: string;- preventClickOutside?: boolean;- onBackdropMouseDown?: (e: React.MouseEvent) => void;- modalRef?: React.RefObject<HTMLDivElement | null>;-};diff --git a/packages/twenty-ui/src/primitives/surfaces/Modal/types/ModalSize.ts b/packages/twenty-ui/src/primitives/surfaces/Modal/types/ModalSize.tsdeleted file mode 100644index b079d5f3ba4..00000000000--- a/packages/twenty-ui/src/primitives/surfaces/Modal/types/ModalSize.ts+++ /dev/null@@ -1,6 +0,0 @@-export type ModalSize =- | 'small'- | 'medium'- | 'large'- | 'extraLarge'- | 'fullscreen';diff --git a/packages/twenty-ui/src/primitives/surfaces/ModalBackdrop/ModalBackdrop.module.scss b/packages/twenty-ui/src/primitives/surfaces/ModalBackdrop/ModalBackdrop.module.scssdeleted file mode 100644index 3f990679c22..00000000000--- a/packages/twenty-ui/src/primitives/surfaces/ModalBackdrop/ModalBackdrop.module.scss+++ /dev/null@@ -1,23 +0,0 @@-.backdrop {- align-items: center;- background: var(--t-background-overlay-primary);- display: flex;- height: 100%;- justify-content: center;- left: 0;- pointer-events: auto;- position: fixed;- top: 0;- width: 100%;- z-index: var(--modal-backdrop-z-index, 39);- user-select: none;-}--.overlayLight {- background: var(--t-background-overlay-tertiary);-}--.inContainer {- background: var(--t-background-overlay-tertiary);- position: absolute;-}diff --git a/packages/twenty-ui/src/primitives/surfaces/ModalBackdrop/ModalBackdrop.module.scss.d.ts b/packages/twenty-ui/src/primitives/surfaces/ModalBackdrop/ModalBackdrop.module.scss.d.tsdeleted file mode 100644index f3c500808b4..00000000000--- a/packages/twenty-ui/src/primitives/surfaces/ModalBackdrop/ModalBackdrop.module.scss.d.ts+++ /dev/null@@ -1,6 +0,0 @@-declare const classNames: {- readonly backdrop: 'backdrop';- readonly overlayLight: 'overlayLight';- readonly inContainer: 'inContainer';-};-export default classNames;diff --git a/packages/twenty-ui/src/primitives/surfaces/ModalBackdrop/ModalBackdrop.tsx b/packages/twenty-ui/src/primitives/surfaces/ModalBackdrop/ModalBackdrop.tsxdeleted file mode 100644index 32b99ca4b7e..00000000000--- a/packages/twenty-ui/src/primitives/surfaces/ModalBackdrop/ModalBackdrop.tsx+++ /dev/null@@ -1,43 +0,0 @@-import { clsx } from 'clsx';-import { forwardRef } from 'react';--import { type ModalOverlay } from '@ui/primitives/surfaces/Modal/types/ModalOverlay';--import styles from './ModalBackdrop.module.scss';--// The deprecated Linaria styled.div forwarded refs and accepted all native-// div props (including the data-* attributes Modal relies on), so the port-// preserves that contract.-type ModalBackdropProps = React.ComponentPropsWithoutRef<'div'> & {- overlay: ModalOverlay;- backdropZIndex: number;- isInContainer?: boolean;- 'data-testid'?: string;- 'data-click-outside-id'?: string;-};--export const ModalBackdrop = forwardRef<HTMLDivElement, ModalBackdropProps>(- (- { overlay, backdropZIndex, isInContainer, className, style, ...divProps },- ref,- ) => (- <div- ref={ref}- className={clsx(- styles.backdrop,- overlay === 'light' && styles.overlayLight,- isInContainer && styles.inContainer,- className,- )}- style={- {- '--modal-backdrop-z-index': backdropZIndex,- ...style,- } as React.CSSProperties- }- {...divProps}- />- ),-);--ModalBackdrop.displayName = 'ModalBackdrop';diff --git a/packages/twenty-ui/src/primitives/surfaces/ModalContent/ModalContent.module.scss b/packages/twenty-ui/src/primitives/surfaces/ModalContent/ModalContent.module.scssdeleted file mode 100644index 845c8fb1656..00000000000--- a/packages/twenty-ui/src/primitives/surfaces/ModalContent/ModalContent.module.scss+++ /dev/null@@ -1,30 +0,0 @@-.content {- align-items: stretch;- display: flex;- flex: 1 1 0%;- flex-direction: column;- justify-content: flex-start;- overflow: visible;- padding: var(--t-spacing-10);-}--.verticallyCentered {- align-items: center;-}--.horizontallyCentered {- justify-content: center;-}--.overflowHidden {- overflow: hidden;-}--.withContentPadding {- padding: var(--modal-content-padding);-}--// noPadding wins over contentPadding, like the deprecated Linaria switch-.noPadding {- padding: 0;-}diff --git a/packages/twenty-ui/src/primitives/surfaces/ModalContent/ModalContent.module.scss.d.ts b/packages/twenty-ui/src/primitives/surfaces/ModalContent/ModalContent.module.scss.d.tsdeleted file mode 100644index 31a89d494e6..00000000000--- a/packages/twenty-ui/src/primitives/surfaces/ModalContent/ModalContent.module.scss.d.ts+++ /dev/null@@ -1,9 +0,0 @@-declare const classNames: {- readonly content: 'content';- readonly verticallyCentered: 'verticallyCentered';- readonly horizontallyCentered: 'horizontallyCentered';- readonly overflowHidden: 'overflowHidden';- readonly withContentPadding: 'withContentPadding';- readonly noPadding: 'noPadding';-};-export default classNames;diff --git a/packages/twenty-ui/src/primitives/surfaces/ModalContent/ModalContent.tsx b/packages/twenty-ui/src/primitives/surfaces/ModalContent/ModalContent.tsxdeleted file mode 100644index 142a964753b..00000000000--- a/packages/twenty-ui/src/primitives/surfaces/ModalContent/ModalContent.tsx+++ /dev/null@@ -1,44 +0,0 @@-import { clsx } from 'clsx';--import styles from './ModalContent.module.scss';--export type ModalContentProps = React.PropsWithChildren & {- isVerticallyCentered?: boolean;- isHorizontallyCentered?: boolean;- noPadding?: boolean;- overflowHidden?: boolean;- gap?: number;- contentPadding?: number;-};--export const ModalContent = ({- children,- isVerticallyCentered,- isHorizontallyCentered,- noPadding,- overflowHidden,- gap,- contentPadding,-}: ModalContentProps) => (- <div- className={clsx(- styles.content,- isVerticallyCentered && styles.verticallyCentered,- isHorizontallyCentered && styles.horizontallyCentered,- overflowHidden && styles.overflowHidden,- contentPadding !== undefined && styles.withContentPadding,- noPadding && styles.noPadding,- )}- style={- {- gap: gap !== undefined ? `var(--t-spacing-${gap})` : undefined,- '--modal-content-padding':- contentPadding !== undefined- ? `var(--t-spacing-${contentPadding})`- : undefined,- } as React.CSSProperties- }- >- {children}- </div>-);diff --git a/packages/twenty-ui/src/primitives/surfaces/ModalFooter/ModalFooter.module.scss b/packages/twenty-ui/src/primitives/surfaces/ModalFooter/ModalFooter.module.scssdeleted file mode 100644index 6792fb2f785..00000000000--- a/packages/twenty-ui/src/primitives/surfaces/ModalFooter/ModalFooter.module.scss+++ /dev/null@@ -1,22 +0,0 @@-.footer {- align-items: center;- display: flex;- flex-direction: row;- gap: var(--t-spacing-2);- height: 60px;- justify-content: flex-end;- overflow: hidden;- padding: var(--t-spacing-5);-}--.autoHeight {- height: auto;-}--.centered {- justify-content: center;-}--.smallPadding {- padding: var(--t-spacing-3);-}diff --git a/packages/twenty-ui/src/primitives/surfaces/ModalFooter/ModalFooter.module.scss.d.ts b/packages/twenty-ui/src/primitives/surfaces/ModalFooter/ModalFooter.module.scss.d.tsdeleted file mode 100644index 8bd9b6a5a02..00000000000--- a/packages/twenty-ui/src/primitives/surfaces/ModalFooter/ModalFooter.module.scss.d.ts+++ /dev/null@@ -1,7 +0,0 @@-declare const classNames: {- readonly footer: 'footer';- readonly autoHeight: 'autoHeight';- readonly centered: 'centered';- readonly smallPadding: 'smallPadding';-};-export default classNames;diff --git a/packages/twenty-ui/src/primitives/surfaces/ModalFooter/ModalFooter.tsx b/packages/twenty-ui/src/primitives/surfaces/ModalFooter/ModalFooter.tsxdeleted file mode 100644index 3df4a7fa15d..00000000000--- a/packages/twenty-ui/src/primitives/surfaces/ModalFooter/ModalFooter.tsx+++ /dev/null@@ -1,30 +0,0 @@-import { clsx } from 'clsx';--import styles from './ModalFooter.module.scss';--export type ModalFooterProps = React.PropsWithChildren & {- autoHeight?: boolean;- centered?: boolean;- smallPadding?: boolean;- className?: string;-};--export const ModalFooter = ({- children,- autoHeight,- centered,- smallPadding,- className,-}: ModalFooterProps) => (- <div- className={clsx(- styles.footer,- autoHeight && styles.autoHeight,- centered && styles.centered,- smallPadding && styles.smallPadding,- className,- )}- >- {children}- </div>-);diff --git a/packages/twenty-ui/src/primitives/surfaces/ModalHeader/ModalHeader.module.scss b/packages/twenty-ui/src/primitives/surfaces/ModalHeader/ModalHeader.module.scssdeleted file mode 100644index 0a7775e47f6..00000000000--- a/packages/twenty-ui/src/primitives/surfaces/ModalHeader/ModalHeader.module.scss+++ /dev/null@@ -1,31 +0,0 @@-.header {- align-items: center;- display: flex;- flex-direction: row;- flex-shrink: 0;- height: 60px;- overflow: hidden;- padding: var(--t-spacing-5);-}--.autoHeight {- height: auto;-}--.noPadding {- padding: 0;-}--// paddingHorizontal wins over noPadding, like the deprecated Linaria switch-.withHorizontalPadding {- padding: 0 var(--modal-header-padding-horizontal);-- @include respond-to(mobile) {- padding-left: var(--t-spacing-4);- padding-right: var(--t-spacing-4);- }-}--.withBorderBottom {- border-bottom: 1px solid var(--t-border-color-medium);-}diff --git a/packages/twenty-ui/src/primitives/surfaces/ModalHeader/ModalHeader.module.scss.d.ts b/packages/twenty-ui/src/primitives/surfaces/ModalHeader/ModalHeader.module.scss.d.tsdeleted file mode 100644index abb7431876c..00000000000--- a/packages/twenty-ui/src/primitives/surfaces/ModalHeader/ModalHeader.module.scss.d.ts+++ /dev/null@@ -1,8 +0,0 @@-declare const classNames: {- readonly header: 'header';- readonly autoHeight: 'autoHeight';- readonly noPadding: 'noPadding';- readonly withHorizontalPadding: 'withHorizontalPadding';- readonly withBorderBottom: 'withBorderBottom';-};-export default classNames;diff --git a/packages/twenty-ui/src/primitives/surfaces/ModalHeader/ModalHeader.tsx b/packages/twenty-ui/src/primitives/surfaces/ModalHeader/ModalHeader.tsxdeleted file mode 100644index 5f886965d72..00000000000--- a/packages/twenty-ui/src/primitives/surfaces/ModalHeader/ModalHeader.tsx+++ /dev/null@@ -1,41 +0,0 @@-import { clsx } from 'clsx';--import styles from './ModalHeader.module.scss';--export type ModalHeaderProps = React.PropsWithChildren & {- noPadding?: boolean;- autoHeight?: boolean;- hasBorderBottom?: boolean;- paddingHorizontal?: number;- backgroundColor?: string;-};--export const ModalHeader = ({- children,- noPadding,- autoHeight,- hasBorderBottom,- paddingHorizontal,- backgroundColor,-}: ModalHeaderProps) => (- <div- className={clsx(- styles.header,- autoHeight && styles.autoHeight,- noPadding && styles.noPadding,- paddingHorizontal !== undefined && styles.withHorizontalPadding,- hasBorderBottom && styles.withBorderBottom,- )}- style={- {- '--modal-header-padding-horizontal':- paddingHorizontal !== undefined- ? `var(--t-spacing-${paddingHorizontal})`- : undefined,- backgroundColor,- } as React.CSSProperties- }- >- {children}- </div>-);diff --git a/packages/twenty-ui/src/primitives/surfaces/index.ts b/packages/twenty-ui/src/primitives/surfaces/index.tsindex 75ddf2cac6e..9916a1daea1 100644--- a/packages/twenty-ui/src/primitives/surfaces/index.ts+++ b/packages/twenty-ui/src/primitives/surfaces/index.ts@@ -23,7 +23,16 @@ export { CardContent } from './CardContent/CardContent';export { CardFooter } from './CardFooter/CardFooter';export { CardHeader } from './CardHeader/CardHeader';export { Dialog } from './Dialog/Dialog';+export type { DialogBodyProps } from './Dialog/types/DialogBodyProps';+export type { DialogCloseProps } from './Dialog/types/DialogCloseProps';+export type { DialogDescriptionProps } from './Dialog/types/DialogDescriptionProps';+export type { DialogFooterProps } from './Dialog/types/DialogFooterProps';+export type { DialogHeaderProps } from './Dialog/types/DialogHeaderProps';+export type { DialogPopupProps } from './Dialog/types/DialogPopupProps';+export type { DialogRootProps } from './Dialog/types/DialogRootProps';+export type { DialogSize } from './Dialog/types/DialogSize';export type { DialogTitleProps } from './Dialog/types/DialogTitleProps';+export type { DialogTriggerProps } from './Dialog/types/DialogTriggerProps';export { Menu } from './Menu/Menu';export type { MenuActionItemProps } from './Menu/types/MenuActionItemProps';export type { MenuAlign } from './Menu/types/MenuAlign';@@ -40,18 +49,6 @@ export type { MenuSide } from './Menu/types/MenuSide';export type { MenuSubmenuRootProps } from './Menu/types/MenuSubmenuRootProps';export type { MenuSubmenuTriggerProps } from './Menu/types/MenuSubmenuTriggerProps';export type { MenuTriggerProps } from './Menu/types/MenuTriggerProps';-export { Modal } from './Modal/Modal';-export type { ModalOverlay } from './Modal/types/ModalOverlay';-export type { ModalPadding } from './Modal/types/ModalPadding';-export type { ModalProps } from './Modal/types/ModalProps';-export type { ModalSize } from './Modal/types/ModalSize';-export { ModalBackdrop } from './ModalBackdrop/ModalBackdrop';-export type { ModalContentProps } from './ModalContent/ModalContent';-export { ModalContent } from './ModalContent/ModalContent';-export type { ModalFooterProps } from './ModalFooter/ModalFooter';-export { ModalFooter } from './ModalFooter/ModalFooter';-export type { ModalHeaderProps } from './ModalHeader/ModalHeader';-export { ModalHeader } from './ModalHeader/ModalHeader';export { OverflowingTextWithTooltip } from './OverflowingTextWithTooltip/OverflowingTextWithTooltip';export { Popover } from './Popover/Popover';export type { PopoverAlign } from './Popover/types/PopoverAlign';diff --git a/packages/twenty-ui/src/primitives/surfaces/internal/Dialog.module.scss b/packages/twenty-ui/src/primitives/surfaces/internal/Dialog.module.scssindex 86536a987c1..c80b49e0e5c 100644--- a/packages/twenty-ui/src/primitives/surfaces/internal/Dialog.module.scss+++ b/packages/twenty-ui/src/primitives/surfaces/internal/Dialog.module.scss@@ -27,6 +27,14 @@display: none;}+ &[data-backdrop-hidden='true'] {+ pointer-events: none;++ > .popup {+ pointer-events: auto;+ }+ }+&:has(> [data-size='fullscreen']) {padding: 0;}