The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Complete AlertDialog parts (#27605)
Raphaël Bosi2c8d67c5a8d7
diff --git a/packages/twenty-docs/developers/extend/apps/layout/front-components.mdx b/packages/twenty-docs/developers/extend/apps/layout/front-components.mdxindex f3db6fc2b8d..b14fd17696c 100644--- a/packages/twenty-docs/developers/extend/apps/layout/front-components.mdx+++ b/packages/twenty-docs/developers/extend/apps/layout/front-components.mdx@@ -592,7 +592,7 @@ const routeUrl = `${process.env.TWENTY_FUNCTIONS_URL || `${process.env.TWENTY_AP## Host communication API-Front components can trigger navigation, modals, and notifications using functions from `twenty-sdk`:+Front components can trigger navigation, modals, and notifications using functions from `twenty-sdk`. Use `openCommandConfirmationModal` for confirmation dialogs. It accepts a structured title, subtitle, and confirm-button options and returns a confirm or cancel result. The host owns modal focus, dismissal, and scrolling. Front components cannot render direct `Dialog`, `AlertDialog`, or native browser dialogs, or activate native popovers.| Function | Description || -------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |@@ -888,7 +888,7 @@ These entry points do not require `monaco-editor`.| `twenty-ui/primitives/input` | Buttons and form controls || `twenty-ui/primitives/layout` | Expansion, separators, direction, and resizing || `twenty-ui/primitives/navigation` | Action links, list items, and tabs |-| `twenty-ui/primitives/surfaces` | Cards, dialogs, menus, popovers, and tooltips |+| `twenty-ui/primitives/surfaces` | Cards, menus, popovers, and tooltips || `twenty-ui/primitives/typography` | Text and headings || `twenty-ui/icon` | `Icon*` components (e.g. `IconCheck`) || `twenty-ui/theme` | `ThemeProvider`, `themeCssVariables` |diff --git a/packages/twenty-docs/snippets/ui/generated/surfaces/alert-dialog.mdx b/packages/twenty-docs/snippets/ui/generated/surfaces/alert-dialog.mdxindex 48ebdb68ef8..53265e325c0 100644--- a/packages/twenty-docs/snippets/ui/generated/surfaces/alert-dialog.mdx+++ b/packages/twenty-docs/snippets/ui/generated/surfaces/alert-dialog.mdx@@ -99,16 +99,80 @@returns a style object based on the component's state.</ParamField>-### AlertDialog.Popup+### AlertDialog.Portal-<ParamField body="Popup.className" type="string | ((state: DialogPopupState) => string | undefined)">+<ParamField body="Portal.className" type="string | ((state: DialogPortalState) => string | undefined)">+ CSS class applied to the element, or a function that+ returns a class based on the component's state.+</ParamField>++<ParamField body="Portal.container" type="HTMLElement | ShadowRoot | RefObject<HTMLElement | ShadowRoot | null> | null">+ Portal destination. Omission uses the theme container or Base UI default; explicit `null` defers mounting. A ref with a null current value uses the Base UI default destination.+</ParamField>++<ParamField body="Portal.keepMounted" type="boolean" default="false">+ Keeps content mounted while the alert is closed.+</ParamField>++<ParamField body="Portal.render" type="ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, DialogPortalState>">+ 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="Portal.style" type="CSSProperties | ((state: DialogPortalState) => CSSProperties | undefined)">+ Style applied to the element, or a function that+ returns a style object based on the component's state.+</ParamField>++### AlertDialog.Backdrop++<ParamField body="Backdrop.className" type="string | ((state: DialogBackdropState) => string | undefined)">CSS class applied to the element, or a function thatreturns a class based on the component's state.</ParamField>-<ParamField body="Popup.container" type="HTMLElement | ShadowRoot | RefObject<HTMLElement | ShadowRoot | null> | null">- Element the dialog is portaled into. Defaults to the theme's portal- container.+<ParamField body="Backdrop.forceRender" type="boolean" default="false">+ Whether the backdrop is forced to render even when nested.+</ParamField>++<ParamField body="Backdrop.render" type="ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, DialogBackdropState>">+ 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="Backdrop.style" type="CSSProperties | ((state: DialogBackdropState) => CSSProperties | undefined)">+ Style applied to the element, or a function that+ returns a style object based on the component's state.+</ParamField>++### AlertDialog.Viewport++<ParamField body="Viewport.className" type="string | ((state: DialogViewportState) => string | undefined)">+ CSS class applied to the element, or a function that+ returns a class based on the component's state.+</ParamField>++<ParamField body="Viewport.render" type="ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, DialogViewportState>">+ 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="Viewport.style" type="CSSProperties | ((state: DialogViewportState) => CSSProperties | undefined)">+ Style applied to the element, or a function that+ returns a style object based on the component's state.+</ParamField>++### AlertDialog.Popup++<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.finalFocus" type="boolean | RefObject<HTMLElement | null> | ((closeType: InteractionType) => boolean | void | HTMLElement | null)">@@ -133,10 +197,6 @@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">- Keeps the dialog mounted in the DOM while it is closed.-</ParamField>-<ParamField body="Popup.render" type="ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, DialogPopupState>">Allows you to replace the component's HTML elementwith a different tag, or compose it with another component.@@ -145,7 +205,7 @@</ParamField><ParamField body="Popup.size" type=""fullscreen" | "lg" | "md" | "sm" | "xl"" default="md">- Width of the dialog, or `fullscreen` to fill the viewport.+ Width of the alert, or `fullscreen` to fill the viewport.</ParamField><ParamField body="Popup.style" type="CSSProperties | ((state: DialogPopupState) => CSSProperties | undefined)">diff --git a/packages/twenty-docs/ui/primitives/overview.mdx b/packages/twenty-docs/ui/primitives/overview.mdxindex d5bd00d370c..50a8b5f49e6 100644--- a/packages/twenty-docs/ui/primitives/overview.mdx+++ b/packages/twenty-docs/ui/primitives/overview.mdx@@ -36,17 +36,18 @@ Slots such as `InputGroup.startElement` and `ListItem.actions` accept React node### Popup composition-Twenty UI packages the supporting overlay elements inside each public `Popup` part:+Some primitives package supporting overlay elements inside their `Popup` part:-| Component | Included in `Popup` | Configure on `Popup` |-| ------------- | -------------------------------------- | -------------------------------------------------------- |-| `Select` | Portal and positioner | Placement, anchor, and portal container |-| `Menu` | Portal and positioner | Placement, anchor, portal container, and mounting |-| `Popover` | Portal, positioner, and optional arrow | Placement, anchor, portal container, mounting, and arrow |-| `AlertDialog` | Portal, backdrop, and viewport | Size, portal container, mounting, and focus |+| Component | Included in `Popup` | Configure on `Popup` |+| --------- | -------------------------------------- | -------------------------------------------------------- |+| `Select` | Portal and positioner | Placement, anchor, and portal container |+| `Menu` | Portal and positioner | Placement, anchor, portal container, and mounting |+| `Popover` | Portal, positioner, and optional arrow | Placement, anchor, portal container, mounting, and arrow |Place content directly inside these popup parts. Their portal may move the rendered DOM to another container while preserving the component hierarchy and context. See [theming](/ui/theming#scope-an-override) for scoped portal containers.+[AlertDialog](/ui/primitives/surfaces/alert-dialog) exposes `Portal`, `Backdrop`, `Viewport`, and `Popup` separately. Configure mounting and the destination on `Portal`, overlay appearance on `Backdrop` and `Viewport`, and content size and focus on `Popup`. Each part preserves its own native attributes, ref target, and render composition.+### Custom componentsFor parts that support `render`, pass a compatible element or component to replace the default element. For example, `Popover.Trigger` can use a Twenty UI `Button` while retaining its trigger behavior.diff --git a/packages/twenty-docs/ui/primitives/surfaces/alert-dialog.mdx b/packages/twenty-docs/ui/primitives/surfaces/alert-dialog.mdxindex b401f48bf84..1aa51ef5c6d 100644--- a/packages/twenty-docs/ui/primitives/surfaces/alert-dialog.mdx+++ b/packages/twenty-docs/ui/primitives/surfaces/alert-dialog.mdx@@ -7,7 +7,9 @@ import { StoryEmbed } from '/snippets/ui/StoryEmbed.mdx';import AlertDialogReference from '/snippets/ui/generated/surfaces/alert-dialog.mdx';-Use `AlertDialog` for a decision that interrupts the current workflow, such as confirming deletion. It provides an accessible modal with a backdrop and focus management.+Use `AlertDialog` for a decision that interrupts the current workflow, such as confirming deletion. It provides `alertdialog` semantics, focus management, and explicit confirmation or cancellation.++This primitive is for standalone Twenty UI and host-owned interfaces. Front components must request a confirmation through the [SDK host dialog API](/developers/extend/apps/layout/front-components#host-communication-api). Direct `Dialog`, `AlertDialog`, and native browser dialogs are prohibited inside the front component renderer.<StoryEmbedstoryId="ui-surfaces-alertdialog--documentation"@@ -17,32 +19,38 @@ Use `AlertDialog` for a decision that interrupts the current workflow, such as c## Anatomy-Keep the trigger and popup inside `AlertDialog.Root`. This tree shows the recommended layout for a confirmation dialog.+Keep related parts inside `AlertDialog.Root`, or connect detached triggers through a handle. Compose the portal, backdrop, viewport, and popup separately.```textAlertDialog.Root├── AlertDialog.Trigger-└── AlertDialog.Popup- ├── AlertDialog.Header- │ ├── AlertDialog.Title- │ └── AlertDialog.Description- ├── AlertDialog.Body- └── AlertDialog.Footer- ├── AlertDialog.Close- └── Confirmation action+└── AlertDialog.Portal+ ├── AlertDialog.Backdrop+ └── AlertDialog.Viewport+ └── AlertDialog.Popup+ ├── AlertDialog.Header+ │ ├── AlertDialog.Title+ │ └── AlertDialog.Description+ ├── AlertDialog.Body+ └── AlertDialog.Footer+ ├── AlertDialog.Close+ └── Confirmation action```-| Part | Requirement | Purpose |-| -------------------------- | --------------------------------------------- | ------------------------------------------------------------------------ |-| `Root` | Required | Coordinates open state and modal behavior. |-| `Trigger` | Optional for a programmatically opened dialog | Opens the dialog and provides a return focus target. |-| `Popup` | Required | Renders the modal content with focus management. |-| `Title` | Recommended | Supplies the visible dialog name. An accessible name is always required. |-| `Description` | Recommended for a confirmation | Explains the decision and its consequences. |-| `Header`, `Body`, `Footer` | Optional layout parts | Arrange headings, additional content, and actions. |-| `Close` | Recommended for cancellation | Supplies an explicit close action. |--`Popup` includes the portal, backdrop, and viewport. Put content directly inside it and set `size`, `container`, and focus props on `Popup`. `Header`, `Body`, and `Footer` arrange content; `Title` and `Description` provide the accessible relationships.+| Part | Requirement | Purpose |+| -------------------------- | --------------------------------------------- | ----------------------------------------------------------------------- |+| `Root` | Required | Coordinates open state and modal behavior. |+| `Trigger` | Optional for a programmatically opened dialog | Opens the dialog and provides a return focus target. |+| `Portal` | Recommended | Moves the overlay to its container and controls mounting. |+| `Backdrop` | Optional | Visually separates the alert from the surrounding page. |+| `Viewport` | Recommended | Positions the popup and provides its scrollable surrounding area. |+| `Popup` | Required | Renders the alert content with focus management. |+| `Title` | Recommended | Supplies the visible alert name. An accessible name is always required. |+| `Description` | Recommended for a confirmation | Explains the decision and its consequences. |+| `Header`, `Body`, `Footer` | Optional layout parts | Arrange headings, additional content, and actions. |+| `Close` | Recommended for cancellation | Supplies an explicit close action. |++Set `container` and `keepMounted` on `Portal`, backdrop attributes on `Backdrop`, layout attributes on `Viewport`, and `size` and focus props on `Popup`. Each element part accepts its own native attributes, handlers, ref, and `render` composition. `Popup.ref` points to the alert content element. `Title` and `Description` establish the accessible relationships; provide `aria-label` on `Popup` when omitting a title.The confirmation action is application content, not an exported part. Use `Close` with a synchronous handler or a `Button` with controlled open state for asynchronous confirmation.@@ -51,25 +59,38 @@ The confirmation action is application content, not an exported part. Use `CloseUse `defaultOpen` to set the initial visibility. The dialog owns subsequent changes from its trigger, close controls, and dismissal interactions.```tsx+import { Button } from 'twenty-ui/primitives/input';import { AlertDialog } from 'twenty-ui/primitives/surfaces';type DeleteConfirmationProps = { onDelete: () => void };export const DeleteConfirmation = ({ onDelete }: DeleteConfirmationProps) => (<AlertDialog.Root defaultOpen={false}>- <AlertDialog.Trigger>Delete record</AlertDialog.Trigger>- <AlertDialog.Popup>- <AlertDialog.Header>- <AlertDialog.Title>Delete this record?</AlertDialog.Title>- <AlertDialog.Description>- This action cannot be undone.- </AlertDialog.Description>- </AlertDialog.Header>- <AlertDialog.Footer>- <AlertDialog.Close>Cancel</AlertDialog.Close>- <AlertDialog.Close onClick={onDelete}>Delete</AlertDialog.Close>- </AlertDialog.Footer>- </AlertDialog.Popup>+ <AlertDialog.Trigger+ render={<Button color="danger">Delete record</Button>}+ />+ <AlertDialog.Portal>+ <AlertDialog.Backdrop />+ <AlertDialog.Viewport>+ <AlertDialog.Popup>+ <AlertDialog.Header>+ <AlertDialog.Title>Delete this record?</AlertDialog.Title>+ <AlertDialog.Description>+ This action cannot be undone.+ </AlertDialog.Description>+ </AlertDialog.Header>+ <AlertDialog.Footer>+ <AlertDialog.Close+ render={<Button variant="outline">Cancel</Button>}+ />+ <AlertDialog.Close+ onClick={onDelete}+ render={<Button color="danger">Delete</Button>}+ />+ </AlertDialog.Footer>+ </AlertDialog.Popup>+ </AlertDialog.Viewport>+ </AlertDialog.Portal></AlertDialog.Root>);```@@ -78,10 +99,11 @@ export const DeleteConfirmation = ({ onDelete }: DeleteConfirmationProps) => (## Controlled state-Pass `open` and update it with `onOpenChange` to own the same dialog's visibility in React state. The callback receives the next boolean and event details, including changes requested by the trigger and close controls.+Pass `open` and update it with `onOpenChange` to own the same dialog's visibility in React state. The callback receives the requested boolean and upstream event details, including `reason`, `event`, and `cancel()`. Call `eventDetails.cancel()` to reject a requested change. `onOpenChangeComplete` runs after opening or closing transitions finish.```tsximport { useState } from 'react';+import { Button } from 'twenty-ui/primitives/input';import { AlertDialog } from 'twenty-ui/primitives/surfaces';type DeleteConfirmationProps = { onDelete: () => void };@@ -91,19 +113,31 @@ export const DeleteConfirmation = ({ onDelete }: DeleteConfirmationProps) => {return (<AlertDialog.Root open={open} onOpenChange={setOpen}>- <AlertDialog.Trigger>Delete record</AlertDialog.Trigger>- <AlertDialog.Popup>- <AlertDialog.Header>- <AlertDialog.Title>Delete this record?</AlertDialog.Title>- <AlertDialog.Description>- This action cannot be undone.- </AlertDialog.Description>- </AlertDialog.Header>- <AlertDialog.Footer>- <AlertDialog.Close>Cancel</AlertDialog.Close>- <AlertDialog.Close onClick={onDelete}>Delete</AlertDialog.Close>- </AlertDialog.Footer>- </AlertDialog.Popup>+ <AlertDialog.Trigger+ render={<Button color="danger">Delete record</Button>}+ />+ <AlertDialog.Portal>+ <AlertDialog.Backdrop />+ <AlertDialog.Viewport>+ <AlertDialog.Popup>+ <AlertDialog.Header>+ <AlertDialog.Title>Delete this record?</AlertDialog.Title>+ <AlertDialog.Description>+ This action cannot be undone.+ </AlertDialog.Description>+ </AlertDialog.Header>+ <AlertDialog.Footer>+ <AlertDialog.Close+ render={<Button variant="outline">Cancel</Button>}+ />+ <AlertDialog.Close+ onClick={onDelete}+ render={<Button color="danger">Delete</Button>}+ />+ </AlertDialog.Footer>+ </AlertDialog.Popup>+ </AlertDialog.Viewport>+ </AlertDialog.Portal></AlertDialog.Root>);};@@ -126,34 +160,53 @@ export const DeleteConfirmation = ({ onDelete }: DeleteConfirmationProps) => (<AlertDialog.Triggerrender={<Button color="danger">Delete record</Button>}/>- <AlertDialog.Popup>- <AlertDialog.Header>- <AlertDialog.Title>Delete this record?</AlertDialog.Title>- <AlertDialog.Description>- This action cannot be undone.- </AlertDialog.Description>- </AlertDialog.Header>- <AlertDialog.Footer>- <AlertDialog.Close render={<Button variant="outline">Cancel</Button>} />- <AlertDialog.Close- onClick={onDelete}- render={<Button color="danger">Delete</Button>}- />- </AlertDialog.Footer>- </AlertDialog.Popup>+ <AlertDialog.Portal>+ <AlertDialog.Backdrop />+ <AlertDialog.Viewport>+ <AlertDialog.Popup>+ <AlertDialog.Header>+ <AlertDialog.Title>Delete this record?</AlertDialog.Title>+ <AlertDialog.Description>+ This action cannot be undone.+ </AlertDialog.Description>+ </AlertDialog.Header>+ <AlertDialog.Footer>+ <AlertDialog.Close+ render={<Button variant="outline">Cancel</Button>}+ />+ <AlertDialog.Close+ onClick={onDelete}+ render={<Button color="danger">Delete</Button>}+ />+ </AlertDialog.Footer>+ </AlertDialog.Popup>+ </AlertDialog.Viewport>+ </AlertDialog.Portal></AlertDialog.Root>);```Keep each action as a single interactive control. If you wrap `Button` in your own component, [forward the supplied props and ref](/ui/primitives/overview#custom-components).+## Detached triggers and imperative actions++Create a handle once with `AlertDialog.createHandle<Payload>()` and pass it to `handle` on `Root` and each detached `Trigger`. A trigger's typed `payload` is available to the root's child render function. A handle also supports `open(triggerId)`, `openWithPayload(payload)`, `close()`, and the `isOpen` getter while its root is mounted. Pass a matching trigger ID to `open`, or `null` to open without a trigger. Call imperative methods from event handlers or effects.++`Root.actionsRef` exposes `close()` and `unmount()`. For an externally controlled closing animation, call `eventDetails.preventUnmountOnClose()` in `onOpenChange`, then call `actionsRef.current?.unmount()` after the animation finishes. The regular styled parts manage their own transitions without these imperative actions.+## Sizing and portals-`Popup.size` defaults to `md`; see the reference for supported sizes. Use `container` to override the theme's portal container and `keepMounted` to retain mounted content when closed.+`Popup.size` accepts `sm`, `md`, `lg`, `xl`, and `fullscreen`, and defaults to `md`. Size and appearance belong to the AlertDialog surface and do not have to match Dialog presets.++`Portal.container` defaults to the nearest theme's portal container. Without one, Base UI uses its default portal destination, normally `document.body`. An explicit element, shadow root, or ref overrides that destination. An explicit `null` defers mounting until a container is available. Base UI resolves a ref whose `current` is `null` using its default destination; use `container={null}` when mounting must wait.++Portaled content retains the theme context. `Portal` and `Viewport` inherit the provided text direction unless you set `dir` explicitly. Set `Portal.keepMounted` to retain mounted content and form state while closed.## Focus and dismissal-The dialog traps focus while open. Escape can dismiss it; clicking the backdrop does not. Always provide a visible Cancel or Close action. Keep the initial focus on the least destructive action, and preserve a meaningful return focus target when the action removes its trigger. Use `Popup.initialFocus` and `Popup.finalFocus` to customize focus behavior.+The alert traps focus, blocks outside interaction, and locks page scrolling while open. Escape requests closure; clicking outside does not. To prevent Escape dismissal, cancel the `escape-key` change in `onOpenChange`. Always provide a visible Cancel or Close action.++By default, focus moves to the first tabbable control, or to the popup for a touch opening. Put the least destructive action first, or use `Popup.initialFocus` to select it. Focus returns to the trigger or previously focused element when the alert closes. Use `Popup.finalFocus` when a successful action removes that target. Both focus props accept a boolean, element ref, or interaction-type callback according to the upstream contract.## Propsdiff --git a/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsx b/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsxindex fbed16caa9f..8a55f63d4b4 100644--- a/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsx+++ b/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsx@@ -47,7 +47,6 @@ import {displayHelpersTest,galleryRenderTest,} from '@/__stories__/twenty-ui-gallery/utils/galleryRenderTests';-import { alertDialogTest } from '@/__stories__/twenty-ui-gallery/utils/alertDialogTest';import { menuTest } from '@/__stories__/twenty-ui-gallery/utils/menuTest';import { popoverTest } from '@/__stories__/twenty-ui-gallery/utils/popoverTest';import { selectTest } from '@/__stories__/twenty-ui-gallery/utils/selectTest';@@ -442,17 +441,6 @@ export const ToastCountdownPreact: Story = createGalleryStory({play: toastCountdownTest,});-export const AlertDialogReact: Story = createGalleryStory({- frontComponentBundleName: 'twenty-ui-alert-dialog',- runtime: 'react',- play: alertDialogTest,-});-export const AlertDialogPreact: Story = createGalleryStory({- frontComponentBundleName: 'twenty-ui-alert-dialog',- runtime: 'preact',- play: alertDialogTest,-});-export const SwitchReact: Story = createGalleryStory({frontComponentBundleName: 'twenty-ui-switch',runtime: 'react',diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/README.md b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/README.mdindex 987540eae2a..f312b41685e 100644--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/README.md+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/README.md@@ -46,7 +46,6 @@ effect within the interaction timeout.| `twenty-ui-select` | Select || `twenty-ui-dropdown` | Dropdown || `twenty-ui-toast` | Toast |-| `twenty-ui-alert-dialog` | AlertDialog || `twenty-ui-switch` | Switch (interaction coverage in addition to the original input gallery) || `twenty-ui-checkbox` | Checkbox || `twenty-ui-radio-group` | RadioGroup, Radio (standard and card) |@@ -79,6 +78,10 @@ through a narrow worker TreeWalker that supports SHOW_TEXT, nextNode andcurrentNode without callback filters; document Selection and DOM Range areoutside this scope.+## Dialog policy++Direct `AlertDialog` modality is prohibited inside the front component renderer. Its standalone Twenty UI API has dedicated unit and browser stories in `twenty-ui`. Front components request a host-owned confirmation through the SDK `openCommandConfirmationModal` API, which accepts structured title, subtitle, and confirm-button options and returns confirm or cancel. Renderer policy and SDK result, focus restoration, and teardown acceptance remain part of the renderer integration work. No direct AlertDialog gallery fixture is retained as a compatibility target.+## Known sandbox limitationsThese are compatibility regression stories, not assertions that the components@@ -89,12 +92,12 @@ must change the corresponding story to assert successful behavior; do not keepor broaden an obsolete expectation. No stories are skipped or marked asexpected-to-fail by the runner.-| Component | Current limitation |-| --- | --- |-| ImageInput | Native file picker activation and usable file contents are unavailable in the sandbox. The fixture checks forwarded file metadata, preview recovery, action callbacks, and supplied error changes. See the [ImageInput documentation](../../../../twenty-docs/ui/components/input/image-input.mdx). |-| Popover, Dialog, AlertDialog, Menu, Select, Dropdown, CurrencyPicker, PhoneCountryPicker, CountrySelect, Autocomplete (React and Preact) | The trigger opens the overlay, but the popup portals into the sandbox `document.body`, which never reaches the host, so its content stays invisible. Search, selection, dismissal and focus restoration are not covered yet. |-| Slider | Thumbs stay hidden because the sandbox has no `ResizeObserver` to re-measure after the first geometry batch. |-| Responsive hooks | The sandbox `window.matchMedia` answers for the widget's own box, so `useIsMobile` follows the widget width rather than the browser viewport: a widget 768px wide or narrower gets the mobile layout, and Button drops its hotkey hint, on any screen. `useIsTouchDevice` follows the primary input of the host device, so it is `false` under the desktop Chromium that runs these stories. The fixture asserts both at a 1024px and a 400px widget width. |+| Component | Current limitation |+| --------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| ImageInput | Native file picker activation and usable file contents are unavailable in the sandbox. The fixture checks forwarded file metadata, preview recovery, action callbacks, and supplied error changes. See the [ImageInput documentation](../../../../twenty-docs/ui/components/input/image-input.mdx). |+| Popover, Dialog, Menu, Select, Dropdown, CurrencyPicker, PhoneCountryPicker, CountrySelect, Autocomplete (React and Preact) | The trigger opens the overlay, but the popup portals into the sandbox `document.body`, which never reaches the host, so its content stays invisible. Search, selection, dismissal and focus restoration are not covered yet. |+| Slider | Thumbs stay hidden because the sandbox has no `ResizeObserver` to re-measure after the first geometry batch. |+| Responsive hooks | The sandbox `window.matchMedia` answers for the widget's own box, so `useIsMobile` follows the widget width rather than the browser viewport: a widget 768px wide or narrower gets the mobile layout, and Button drops its hotkey hint, on any screen. `useIsTouchDevice` follows the primary input of the host device, so it is `false` under the desktop Chromium that runs these stories. The fixture asserts both at a 1024px and a 400px widget width. |The worker DOM now provides `Node.contains`, `compareDocumentPosition`,`getRootNode`, `Element.matches`, `closest`, `querySelector` backed bydiff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-alert-dialog.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-alert-dialog.front-component.tsxdeleted file mode 100644index 359dafcfa2a..00000000000--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-alert-dialog.front-component.tsx+++ /dev/null@@ -1,37 +0,0 @@-import { useState } from 'react';-import { defineFrontComponent } from 'twenty-sdk/define';-import { AlertDialog } from 'twenty-ui/primitives/surfaces';--import { TwentyUiGalleryCard } from '@/__stories__/shared/front-components/twenty-ui-gallery-card';--const AlertDialogExample = () => {- const [open, setOpen] = useState(false);-- return (- <TwentyUiGalleryCard title="AlertDialog">- <AlertDialog.Root open={open} onOpenChange={setOpen}>- <AlertDialog.Trigger>Delete account</AlertDialog.Trigger>- <AlertDialog.Popup>- <AlertDialog.Header>- <AlertDialog.Title>Delete this account?</AlertDialog.Title>- <AlertDialog.Description>- This action cannot be undone- </AlertDialog.Description>- </AlertDialog.Header>- <AlertDialog.Body>All account notes will be removed</AlertDialog.Body>- <AlertDialog.Footer>- <AlertDialog.Close>Keep account</AlertDialog.Close>- </AlertDialog.Footer>- </AlertDialog.Popup>- </AlertDialog.Root>- <p role="status">Confirmation: {open ? 'open' : 'closed'}</p>- </TwentyUiGalleryCard>- );-};--export default defineFrontComponent({- universalIdentifier: '4d23e9af-7cb3-4e4a-bbca-8e960f840009',- name: 'twenty-ui-alert-dialog',- description: 'AlertDialog opening and closing through a sandbox portal',- component: AlertDialogExample,-});diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/alertDialogTest.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/alertDialogTest.tsdeleted file mode 100644index 8885aa338e3..00000000000--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/alertDialogTest.ts+++ /dev/null@@ -1,7 +0,0 @@-import { createOverlayOpenTest } from '@/__stories__/twenty-ui-gallery/utils/createOverlayOpenTest';--export const alertDialogTest = createOverlayOpenTest({- trigger: { role: 'button', name: 'Delete account' },- expectedOpenStatus: 'Confirmation: open',- popupText: 'This action cannot be undone',-});diff --git a/packages/twenty-ui/docs/alertDialogPartPropDescriptions.ts b/packages/twenty-ui/docs/alertDialogPartPropDescriptions.tsnew file mode 100644index 00000000000..13bfbc7134c--- /dev/null+++ b/packages/twenty-ui/docs/alertDialogPartPropDescriptions.ts@@ -0,0 +1,13 @@+import { type AlertDialogPopupProps } from '../src/primitives/surfaces/AlertDialog/types/AlertDialogPopupProps';+import { type AlertDialogPortalProps } from '../src/primitives/surfaces/AlertDialog/types/AlertDialogPortalProps';++export const ALERT_DIALOG_PART_PROP_DESCRIPTIONS = {+ Popup: {+ size: 'Width of the alert, or `fullscreen` to fill the viewport.',+ } satisfies Partial<Record<keyof AlertDialogPopupProps, string>>,+ Portal: {+ container:+ 'Portal destination. Omission uses the theme container or Base UI default; explicit `null` defers mounting. A ref with a null current value uses the Base UI default destination.',+ keepMounted: 'Keeps content mounted while the alert is closed.',+ } satisfies Partial<Record<keyof AlertDialogPortalProps, string>>,+};diff --git a/packages/twenty-ui/docs/components.ts b/packages/twenty-ui/docs/components.tsindex 8de6000d5d5..318dbedd69a 100644--- a/packages/twenty-ui/docs/components.ts+++ b/packages/twenty-ui/docs/components.ts@@ -46,6 +46,7 @@ import { CHIP_PROP_DESCRIPTIONS } from './chipPropDescriptions';import { CODE_EDITOR_HEADER_PROP_DESCRIPTIONS } from './codeEditorHeaderPropDescriptions';import { CODE_EDITOR_PROP_DESCRIPTIONS } from './codeEditorPropDescriptions';import { COLOR_SAMPLE_PROP_DESCRIPTIONS } from './colorSamplePropDescriptions';+import { ALERT_DIALOG_PART_PROP_DESCRIPTIONS } from './alertDialogPartPropDescriptions';import { DIALOG_POPUP_PROP_DESCRIPTIONS } from './dialogPopupPropDescriptions';import { DIALOG_TITLE_PROP_DESCRIPTIONS } from './dialogTitlePropDescriptions';import { DROPDOWN_PART_PROP_DESCRIPTIONS } from './dropdownPartPropDescriptions';@@ -429,6 +430,22 @@ export const DOCUMENTED_COMPONENTS = [source: 'primitives/surfaces/AlertDialog/AlertDialog.tsx',entryPoint: 'twenty-ui/primitives/surfaces',slug: 'surfaces/alert-dialog',+ parts: [+ 'Root',+ 'Trigger',+ 'Portal',+ 'Backdrop',+ 'Viewport',+ 'Popup',+ 'Title',+ 'Description',+ 'Close',+ 'Header',+ 'Body',+ 'Footer',+ ],+ partPropDescriptions: ALERT_DIALOG_PART_PROP_DESCRIPTIONS,+ partPropDefaults: { Popup: { size: 'md' } },},{name: 'Menu',diff --git a/packages/twenty-ui/docs/public-exports.json b/packages/twenty-ui/docs/public-exports.jsonindex dc005a3b7bb..60e4447ea9c 100644--- a/packages/twenty-ui/docs/public-exports.json+++ b/packages/twenty-ui/docs/public-exports.json@@ -892,16 +892,32 @@"Tooltip": "primitives/surfaces/Tooltip/Tooltip"},"types": {+ "AlertDialogBackdropProps": "primitives/surfaces/AlertDialog/types/AlertDialogBackdropProps",+ "AlertDialogBackdropState": "primitives/surfaces/AlertDialog/types/AlertDialogBackdropState","AlertDialogBodyProps": "primitives/surfaces/AlertDialog/types/AlertDialogBodyProps","AlertDialogCloseProps": "primitives/surfaces/AlertDialog/types/AlertDialogCloseProps",+ "AlertDialogCloseState": "primitives/surfaces/AlertDialog/types/AlertDialogCloseState","AlertDialogDescriptionProps": "primitives/surfaces/AlertDialog/types/AlertDialogDescriptionProps",+ "AlertDialogDescriptionState": "primitives/surfaces/AlertDialog/types/AlertDialogDescriptionState","AlertDialogFooterProps": "primitives/surfaces/AlertDialog/types/AlertDialogFooterProps",+ "AlertDialogHandle": "primitives/surfaces/AlertDialog/types/AlertDialogHandle","AlertDialogHeaderProps": "primitives/surfaces/AlertDialog/types/AlertDialogHeaderProps","AlertDialogPopupProps": "primitives/surfaces/AlertDialog/types/AlertDialogPopupProps",+ "AlertDialogPopupState": "primitives/surfaces/AlertDialog/types/AlertDialogPopupState",+ "AlertDialogPortalProps": "primitives/surfaces/AlertDialog/types/AlertDialogPortalProps",+ "AlertDialogPortalState": "primitives/surfaces/AlertDialog/types/AlertDialogPortalState",+ "AlertDialogRootActions": "primitives/surfaces/AlertDialog/types/AlertDialogRootActions",+ "AlertDialogRootChangeEventDetails": "primitives/surfaces/AlertDialog/types/AlertDialogRootChangeEventDetails",+ "AlertDialogRootChangeEventReason": "primitives/surfaces/AlertDialog/types/AlertDialogRootChangeEventReason","AlertDialogRootProps": "primitives/surfaces/AlertDialog/types/AlertDialogRootProps",+ "AlertDialogRootState": "primitives/surfaces/AlertDialog/types/AlertDialogRootState","AlertDialogSize": "primitives/surfaces/AlertDialog/types/AlertDialogSize","AlertDialogTitleProps": "primitives/surfaces/AlertDialog/types/AlertDialogTitleProps",+ "AlertDialogTitleState": "primitives/surfaces/AlertDialog/types/AlertDialogTitleState","AlertDialogTriggerProps": "primitives/surfaces/AlertDialog/types/AlertDialogTriggerProps",+ "AlertDialogTriggerState": "primitives/surfaces/AlertDialog/types/AlertDialogTriggerState",+ "AlertDialogViewportProps": "primitives/surfaces/AlertDialog/types/AlertDialogViewportProps",+ "AlertDialogViewportState": "primitives/surfaces/AlertDialog/types/AlertDialogViewportState","DialogBodyProps": "primitives/surfaces/Dialog/types/DialogBodyProps","DialogCloseProps": "primitives/surfaces/Dialog/types/DialogCloseProps","DialogDescriptionProps": "primitives/surfaces/Dialog/types/DialogDescriptionProps",diff --git a/packages/twenty-ui/generated/components.docs.json b/packages/twenty-ui/generated/components.docs.jsonindex 8c208a0f758..d916c3b840b 100644--- a/packages/twenty-ui/generated/components.docs.json+++ b/packages/twenty-ui/generated/components.docs.json@@ -5684,11 +5684,11 @@]},{- "name": "Popup",+ "name": "Portal","props": [{"name": "className",- "type": "string | ((state: DialogPopupState) => string | undefined)",+ "type": "string | ((state: DialogPortalState) => 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."@@ -5698,7 +5698,99 @@"type": "HTMLElement | ShadowRoot | RefObject<HTMLElement | ShadowRoot | null> | null","required": false,"defaultValue": null,- "description": "Element the dialog is portaled into. Defaults to the theme's portal\ncontainer."+ "description": "Portal destination. Omission uses the theme container or Base UI default; explicit `null` defers mounting. A ref with a null current value uses the Base UI default destination."+ },+ {+ "name": "keepMounted",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Keeps content mounted while the alert is closed."+ },+ {+ "name": "render",+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, DialogPortalState>",+ "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: DialogPortalState) => 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": "Backdrop",+ "props": [+ {+ "name": "className",+ "type": "string | ((state: DialogBackdropState) => 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": "forceRender",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Whether the backdrop is forced to render even when nested."+ },+ {+ "name": "render",+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, DialogBackdropState>",+ "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: DialogBackdropState) => 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": "Viewport",+ "props": [+ {+ "name": "className",+ "type": "string | ((state: DialogViewportState) => 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, DialogViewportState>",+ "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: DialogViewportState) => 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": "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": "finalFocus",@@ -5714,13 +5806,6 @@"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": "Keeps the dialog mounted in the DOM while it is closed."- },{"name": "render","type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, DialogPopupState>",@@ -5733,7 +5818,7 @@"type": "\"fullscreen\" | \"lg\" | \"md\" | \"sm\" | \"xl\"","required": false,"defaultValue": "md",- "description": "Width of the dialog, or `fullscreen` to fill the viewport."+ "description": "Width of the alert, or `fullscreen` to fill the viewport."},{"name": "style",diff --git a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/AlertDialog.tsx b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/AlertDialog.tsxindex ff88a3144e2..c1e8af61400 100644--- a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/AlertDialog.tsx+++ b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/AlertDialog.tsx@@ -1,15 +1,21 @@import { AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog';+import { AlertDialogBackdrop } from './internal/AlertDialogBackdrop';import { AlertDialogBody } from './internal/AlertDialogBody';import { AlertDialogDescription } from './internal/AlertDialogDescription';import { AlertDialogFooter } from './internal/AlertDialogFooter';import { AlertDialogHeader } from './internal/AlertDialogHeader';+import { AlertDialogPortal } from './internal/AlertDialogPortal';import { AlertDialogPopup } from './internal/AlertDialogPopup';import { AlertDialogTitle } from './internal/AlertDialogTitle';+import { AlertDialogViewport } from './internal/AlertDialogViewport';const createAlertDialog = () => ({Root: AlertDialogPrimitive.Root,Trigger: AlertDialogPrimitive.Trigger,+ Portal: AlertDialogPortal,+ Backdrop: AlertDialogBackdrop,+ Viewport: AlertDialogViewport,Popup: AlertDialogPopup,Title: AlertDialogTitle,Description: AlertDialogDescription,@@ -17,6 +23,8 @@ const createAlertDialog = () => ({Header: AlertDialogHeader,Body: AlertDialogBody,Footer: AlertDialogFooter,+ Handle: AlertDialogPrimitive.Handle,+ createHandle: AlertDialogPrimitive.createHandle,});// Base UI namespace reads would otherwise retain AlertDialog in unrelated imports.diff --git a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__stories__/AlertDialog.handles.stories.tsx b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__stories__/AlertDialog.handles.stories.tsxnew file mode 100644index 00000000000..d95b42ffb1c--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__stories__/AlertDialog.handles.stories.tsx@@ -0,0 +1,196 @@+import { type Meta, type StoryObj } from '@storybook/react-vite';+import { useRef, useState } from 'react';+import { expect, fn, userEvent, waitFor, within } from 'storybook/test';++import { Button } from '@ui/primitives/input/Button/Button';+import { ComponentDecorator } from '@ui/testing';++import { AlertDialog } from '../AlertDialog';+import { type AlertDialogRootActions } from '../types/AlertDialogRootActions';+import { type AlertDialogRootProps } from '../types/AlertDialogRootProps';+import { waitForAlertDialog } from './waitForAlertDialog';++const ExternalTriggerAlertDialog = (props: AlertDialogRootProps<string>) => {+ const [handle] = useState(() => AlertDialog.createHandle<string>());++ return (+ <>+ <AlertDialog.Trigger+ id="delete-acme"+ handle={handle}+ payload="Acme"+ render={<Button>Delete Acme</Button>}+ />+ <AlertDialog.Trigger+ id="delete-globex"+ handle={handle}+ payload="Globex"+ nativeButton={false}+ render={<span>Delete Globex</span>}+ />+ <AlertDialog.Root {...props} handle={handle}>+ {({ payload }) => (+ <AlertDialog.Portal>+ <AlertDialog.Backdrop />+ <AlertDialog.Viewport>+ <AlertDialog.Popup>+ <AlertDialog.Header>+ <AlertDialog.Title>Delete {payload}?</AlertDialog.Title>+ <AlertDialog.Description>+ This action cannot be undone.+ </AlertDialog.Description>+ </AlertDialog.Header>+ <AlertDialog.Footer>+ <AlertDialog.Close render={<Button>Cancel</Button>} />+ </AlertDialog.Footer>+ </AlertDialog.Popup>+ </AlertDialog.Viewport>+ </AlertDialog.Portal>+ )}+ </AlertDialog.Root>+ </>+ );+};++const meta: Meta<typeof ExternalTriggerAlertDialog> = {+ title: 'UI/Surfaces/AlertDialog',+ component: ExternalTriggerAlertDialog,+ decorators: [ComponentDecorator],+};++export default meta;+type Story = StoryObj<typeof ExternalTriggerAlertDialog>;++export const DetachedPayloadTriggers: Story = {+ args: { onOpenChange: fn() },+ play: async ({ args, canvasElement }) => {+ const canvas = within(canvasElement);++ for (const company of ['Acme', 'Globex']) {+ const trigger = canvas.getByRole('button', { name: `Delete ${company}` });++ if (company === 'Acme') {+ await userEvent.click(trigger);+ }++ if (company === 'Globex') {+ trigger.focus();+ await userEvent.keyboard('{Enter}');+ expect(trigger.tagName).toBe('SPAN');+ }++ const dialog = await waitForAlertDialog(canvasElement);+ expect(dialog).toHaveAccessibleName(`Delete ${company}?`);+ expect(trigger).toHaveAttribute('aria-expanded', 'true');+ expect(trigger).toHaveAttribute('aria-controls', dialog.id);+ expect(args.onOpenChange).toHaveBeenLastCalledWith(+ true,+ expect.objectContaining({ reason: 'trigger-press', trigger }),+ );+ await userEvent.click(+ within(dialog).getByRole('button', { name: 'Cancel' }),+ );+ await waitFor(() => expect(dialog).not.toBeInTheDocument());+ await waitFor(() => expect(trigger).toHaveFocus());+ }+ },+};++const ImperativeAlertDialog = ({+ onOpenChange,+}: AlertDialogRootProps<string>) => {+ const [handle] = useState(() => AlertDialog.createHandle<string>());+ const actionsRef = useRef<AlertDialogRootActions>(null);++ return (+ <>+ <Button onClick={() => handle.openWithPayload('Archived record')}>+ Open with payload+ </Button>+ <Button onClick={() => handle.open(null)}>Open without a trigger</Button>+ <Button onClick={() => actionsRef.current?.unmount()}>Finish exit</Button>+ <AlertDialog.Root+ handle={handle}+ actionsRef={actionsRef}+ onOpenChange={(open, eventDetails) => {+ if (!open) {+ eventDetails.preventUnmountOnClose();+ }++ onOpenChange?.(open, eventDetails);+ }}+ >+ {({ payload }) => (+ <AlertDialog.Portal>+ <AlertDialog.Backdrop />+ <AlertDialog.Viewport>+ <AlertDialog.Popup>+ <AlertDialog.Header>+ <AlertDialog.Title>+ Delete {payload ?? 'this record'}?+ </AlertDialog.Title>+ <AlertDialog.Description>+ This action cannot be undone.+ </AlertDialog.Description>+ </AlertDialog.Header>+ <AlertDialog.Footer>+ <Button onClick={() => handle.close()}>+ Close with handle+ </Button>+ <Button onClick={() => actionsRef.current?.close()}>+ Close with actions+ </Button>+ </AlertDialog.Footer>+ </AlertDialog.Popup>+ </AlertDialog.Viewport>+ </AlertDialog.Portal>+ )}+ </AlertDialog.Root>+ </>+ );+};++export const ImperativeActions: Story = {+ args: { onOpenChange: fn() },+ render: (args) => <ImperativeAlertDialog {...args} />,+ play: async ({ args, canvasElement }) => {+ const canvas = within(canvasElement);++ for (const closeAction of ['Close with handle', 'Close with actions']) {+ await userEvent.click(+ canvas.getByRole('button', { name: 'Open with payload' }),+ );+ const dialog = await waitForAlertDialog(canvasElement);+ expect(dialog).toHaveAccessibleName('Delete Archived record?');+ expect(args.onOpenChange).toHaveBeenLastCalledWith(+ true,+ expect.objectContaining({ reason: 'imperative-action' }),+ );+ await userEvent.click(+ within(dialog).getByRole('button', { name: closeAction }),+ );+ await waitFor(() => expect(dialog).not.toBeVisible());+ expect(dialog).toBeInTheDocument();+ expect(args.onOpenChange).toHaveBeenLastCalledWith(+ false,+ expect.objectContaining({ reason: 'imperative-action' }),+ );+ await userEvent.click(+ canvas.getByRole('button', { name: 'Finish exit' }),+ );+ await waitFor(() => expect(dialog).not.toBeInTheDocument());+ }++ await userEvent.click(+ canvas.getByRole('button', { name: 'Open without a trigger' }),+ );+ const dialog = await waitForAlertDialog(canvasElement);+ expect(dialog).toHaveAccessibleName('Delete Archived record?');+ await userEvent.click(+ within(dialog).getByRole('button', { name: 'Close with handle' }),+ );+ await waitFor(() => expect(dialog).not.toBeVisible());+ await userEvent.click(canvas.getByRole('button', { name: 'Finish exit' }));+ await waitFor(() => expect(dialog).not.toBeInTheDocument());+ },+};diff --git a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__stories__/AlertDialog.interactions.stories.tsx b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__stories__/AlertDialog.interactions.stories.tsxindex b1e90ec884e..0ba654d9694 100644--- a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__stories__/AlertDialog.interactions.stories.tsx+++ b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__stories__/AlertDialog.interactions.stories.tsx@@ -2,12 +2,12 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';import { useRef, useState } from 'react';import { expect, fn, userEvent, waitFor, within } from 'storybook/test';+import { Button } from '@ui/primitives/input/Button/Button';import { Input } from '@ui/primitives/input/Input/Input';import { ComponentDecorator } from '@ui/testing';import { AlertDialog } from '../AlertDialog';import { AlertDialogExample } from './AlertDialogExample';-import styles from './AlertDialog.stories.module.scss';import { waitForAlertDialog } from './waitForAlertDialog';const meta: Meta<typeof AlertDialogExample> = {@@ -123,32 +123,32 @@ const ControlledAlertDialog = () => {<><p>{deleted ? 'Record deleted' : 'Record available'}</p><AlertDialog.Root open={open} onOpenChange={setOpen}>- <AlertDialog.Trigger className={styles.button}>- Delete record- </AlertDialog.Trigger>- <AlertDialog.Popup>- <AlertDialog.Header>- <AlertDialog.Title>Delete this record?</AlertDialog.Title>- <AlertDialog.Description>- This action cannot be undone.- </AlertDialog.Description>- </AlertDialog.Header>- <AlertDialog.Footer>- <AlertDialog.Close className={styles.button}>- Cancel- </AlertDialog.Close>- <button- type="button"- className={styles.button}- onClick={() => {- setDeleted(true);- setOpen(false);- }}- >- Confirm deletion- </button>- </AlertDialog.Footer>- </AlertDialog.Popup>+ <AlertDialog.Trigger render={<Button>Delete record</Button>} />+ <AlertDialog.Portal>+ <AlertDialog.Backdrop />+ <AlertDialog.Viewport>+ <AlertDialog.Popup>+ <AlertDialog.Header>+ <AlertDialog.Title>Delete this record?</AlertDialog.Title>+ <AlertDialog.Description>+ This action cannot be undone.+ </AlertDialog.Description>+ </AlertDialog.Header>+ <AlertDialog.Footer>+ <AlertDialog.Close render={<Button>Cancel</Button>} />+ <Button+ color="danger"+ onClick={() => {+ setDeleted(true);+ setOpen(false);+ }}+ >+ Confirm deletion+ </Button>+ </AlertDialog.Footer>+ </AlertDialog.Popup>+ </AlertDialog.Viewport>+ </AlertDialog.Portal></AlertDialog.Root></>);@@ -189,7 +189,7 @@ export const DisabledTrigger: Story = {export const KeepMounted: Story = {decorators: [ComponentDecorator],args: {- popupProps: { keepMounted: true },+ portalProps: { keepMounted: true },content: <Input aria-label="Reason" />,},play: async ({ canvasElement }) => {@@ -227,9 +227,7 @@ const CustomFocusAlertDialog = () => {popupProps={{ initialFocus, finalFocus }}content={<Input ref={initialFocus} aria-label="Confirmation" />}/>- <button type="button" ref={finalFocus}>- Next record- </button>+ <Button ref={finalFocus}>Next record</Button></>);};@@ -319,3 +317,26 @@ export const Scrollable: Story = {await waitFor(() => expect(dialog).not.toBeInTheDocument());},};++export const TransitionCompletion: Story = {+ decorators: [ComponentDecorator],+ args: { onOpenChangeComplete: fn() },+ play: async ({ args, canvasElement }) => {+ const trigger = within(canvasElement).getByRole('button', {+ name: 'Delete record',+ });+ await userEvent.click(trigger);+ const dialog = await waitForAlertDialog(canvasElement);+ await waitFor(() =>+ expect(args.onOpenChangeComplete).toHaveBeenLastCalledWith(true),+ );+ await userEvent.click(+ within(dialog).getByRole('button', { name: 'Cancel' }),+ );+ await waitFor(() => expect(dialog).not.toBeInTheDocument());+ await waitFor(() =>+ expect(args.onOpenChangeComplete).toHaveBeenLastCalledWith(false),+ );+ expect(args.onOpenChangeComplete).toHaveBeenCalledTimes(2);+ },+};diff --git a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__stories__/AlertDialog.portals.stories.tsx b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__stories__/AlertDialog.portals.stories.tsxindex c5cd352fc69..91bc8e52011 100644--- a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__stories__/AlertDialog.portals.stories.tsx+++ b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__stories__/AlertDialog.portals.stories.tsx@@ -2,10 +2,12 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';import { useRef, useState } from 'react';import { expect, userEvent, waitFor, within } from 'storybook/test';+import { Button } from '@ui/primitives/input/Button/Button';import { DirectionProvider } from '@ui/primitives/layout/DirectionProvider/DirectionProvider';import { ComponentDecorator } from '@ui/testing';import { ThemeProvider } from '@ui/theme/ThemeProvider';+import { AlertDialog } from '../AlertDialog';import { AlertDialogExample } from './AlertDialogExample';import { waitForAlertDialog } from './waitForAlertDialog';@@ -58,7 +60,7 @@ const ExplicitContainerAlertDialog = () => {<><div ref={setContainer} data-testid="portal-container" /><ThemeProvider colorScheme="dark" applyToRoot={false}>- <AlertDialogExample defaultOpen popupProps={{ container }} />+ <AlertDialogExample defaultOpen portalProps={{ container }} /></ThemeProvider></>);@@ -83,10 +85,10 @@ const DeferredContainerAlertDialog = () => {return (<ThemeProvider colorScheme="light" applyToRoot={false}><div ref={containerRef} data-testid="deferred-container" />- <button type="button" onClick={() => setContainer(containerRef.current)}>+ <Button onClick={() => setContainer(containerRef.current)}>Attach container- </button>- <AlertDialogExample defaultOpen popupProps={{ container }} />+ </Button>+ <AlertDialogExample defaultOpen portalProps={{ container }} /></ThemeProvider>);};@@ -112,7 +114,7 @@ const RefContainerAlertDialog = () => {return (<><div ref={container} data-testid="ref-container" />- <AlertDialogExample defaultOpen popupProps={{ container }} />+ <AlertDialogExample defaultOpen portalProps={{ container }} /></>);};@@ -158,3 +160,68 @@ export const RenderComposition: Story = {await waitFor(() => expect(dialog).not.toBeInTheDocument());},};++export const ExplicitDirection: Story = {+ decorators: [ComponentDecorator],+ render: () => (+ <DirectionProvider direction="rtl">+ <AlertDialog.Root defaultOpen>+ <AlertDialog.Portal dir="ltr" data-testid="explicit-direction-portal">+ <AlertDialog.Backdrop />+ <AlertDialog.Viewport+ dir="ltr"+ data-testid="explicit-direction-viewport"+ >+ <AlertDialog.Popup>+ <AlertDialog.Header>+ <AlertDialog.Title>Delete this record?</AlertDialog.Title>+ <AlertDialog.Description>+ This action cannot be undone.+ </AlertDialog.Description>+ </AlertDialog.Header>+ <AlertDialog.Footer>+ <AlertDialog.Close render={<Button>Cancel</Button>} />+ </AlertDialog.Footer>+ </AlertDialog.Popup>+ </AlertDialog.Viewport>+ </AlertDialog.Portal>+ </AlertDialog.Root>+ </DirectionProvider>+ ),+ play: async ({ canvasElement }) => {+ const dialog = await waitForAlertDialog(canvasElement);+ const body = within(canvasElement.ownerDocument.body);+ expect(body.getByTestId('explicit-direction-portal')).toHaveAttribute(+ 'dir',+ 'ltr',+ );+ expect(body.getByTestId('explicit-direction-viewport')).toHaveAttribute(+ 'dir',+ 'ltr',+ );+ expect(getComputedStyle(dialog).direction).toBe('ltr');+ },+};++const NullRefContainerAlertDialog = () => {+ const container = useRef<HTMLDivElement>(null);++ return (+ <DirectionProvider direction="rtl">+ <ThemeProvider colorScheme="dark" applyToRoot={false}>+ <AlertDialogExample defaultOpen portalProps={{ container }} />+ </ThemeProvider>+ </DirectionProvider>+ );+};++export const NullRefContainer: Story = {+ decorators: [ComponentDecorator],+ render: () => <NullRefContainerAlertDialog />,+ play: async ({ canvasElement }) => {+ const dialog = await waitForAlertDialog(canvasElement);+ expect(canvasElement).not.toContainElement(dialog);+ expect(dialog.closest('.dark')).toBeNull();+ expect(getComputedStyle(dialog).direction).toBe('rtl');+ },+};diff --git a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__stories__/AlertDialog.stories.module.scss b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__stories__/AlertDialog.stories.module.scssindex 1d30c88e003..44859b6bfab 100644--- a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__stories__/AlertDialog.stories.module.scss+++ b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__stories__/AlertDialog.stories.module.scss@@ -1,34 +1,3 @@-.button {- align-items: center;- background: var(--t-background-primary);- border: 1px solid var(--t-border-color-strong);- border-radius: var(--t-border-radius-sm);- color: var(--t-font-color-primary);- cursor: pointer;- display: inline-flex;- font-family: var(--t-font-family);- font-size: var(--t-font-size-md);- font-weight: var(--t-font-weight-medium);- justify-content: center;- min-block-size: var(--t-spacing-8);- padding: var(--t-spacing-1) var(--t-spacing-3);-- @include focus-ring;-- &:hover {- background: var(--t-background-tertiary);- }-- &[data-danger] {- color: var(--t-color-red11);- }-- &:disabled {- color: var(--t-font-color-tertiary);- cursor: not-allowed;- }-}-.record {background: var(--t-background-secondary);border: 1px solid var(--t-border-color-medium);diff --git a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__stories__/AlertDialog.stories.module.scss.d.ts b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__stories__/AlertDialog.stories.module.scss.d.tsindex cf7b19e25bf..616c5c1e2dd 100644--- a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__stories__/AlertDialog.stories.module.scss.d.ts+++ b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__stories__/AlertDialog.stories.module.scss.d.ts@@ -1,5 +1,4 @@declare const classNames: {- readonly button: 'button';readonly record: 'record';};export default classNames;diff --git a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__stories__/AlertDialogExample.tsx b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__stories__/AlertDialogExample.tsxindex 8548dc0a3bb..cbd9842a6b4 100644--- a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__stories__/AlertDialogExample.tsx+++ b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__stories__/AlertDialogExample.tsx@@ -1,43 +1,42 @@-import { type ReactNode } from 'react';+import { Button } from '@ui/primitives/input/Button/Button';+import { isDefined } from '@ui/utilities/utils/isDefined';import { AlertDialog } from '../AlertDialog';-import { type AlertDialogPopupProps } from '../types/AlertDialogPopupProps';-import { type AlertDialogRootProps } from '../types/AlertDialogRootProps';--import styles from './AlertDialog.stories.module.scss';--export type AlertDialogExampleProps = AlertDialogRootProps & {- size?: AlertDialogPopupProps['size'];- popupProps?: AlertDialogPopupProps;- disabled?: boolean;- content?: ReactNode;-};+import { type AlertDialogExampleProps } from './AlertDialogExampleProps';export const AlertDialogExample = ({size,popupProps,+ portalProps,disabled,content,...props}: AlertDialogExampleProps) => (<AlertDialog.Root {...props}>- <AlertDialog.Trigger className={styles.button} disabled={disabled}>- Delete record- </AlertDialog.Trigger>- <AlertDialog.Popup size={size} {...popupProps}>- <AlertDialog.Header>- <AlertDialog.Title>Delete this record?</AlertDialog.Title>- <AlertDialog.Description>- This record will be permanently deleted. This action cannot be undone.- </AlertDialog.Description>- </AlertDialog.Header>- {content && <AlertDialog.Body>{content}</AlertDialog.Body>}- <AlertDialog.Footer>- <AlertDialog.Close className={styles.button}>Cancel</AlertDialog.Close>- <AlertDialog.Close className={styles.button} data-danger>- Delete- </AlertDialog.Close>- </AlertDialog.Footer>- </AlertDialog.Popup>+ <AlertDialog.Trigger+ disabled={disabled}+ render={<Button variant="solid">Delete record</Button>}+ />+ <AlertDialog.Portal {...portalProps}>+ <AlertDialog.Backdrop />+ <AlertDialog.Viewport>+ <AlertDialog.Popup size={size} {...popupProps}>+ <AlertDialog.Header>+ <AlertDialog.Title>Delete this record?</AlertDialog.Title>+ <AlertDialog.Description>+ This record will be permanently deleted. This action cannot be+ undone.+ </AlertDialog.Description>+ </AlertDialog.Header>+ {isDefined(content) && <AlertDialog.Body>{content}</AlertDialog.Body>}+ <AlertDialog.Footer>+ <AlertDialog.Close render={<Button>Cancel</Button>} />+ <AlertDialog.Close+ render={<Button color="danger">Delete</Button>}+ />+ </AlertDialog.Footer>+ </AlertDialog.Popup>+ </AlertDialog.Viewport>+ </AlertDialog.Portal></AlertDialog.Root>);diff --git a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__stories__/AlertDialogExampleProps.ts b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__stories__/AlertDialogExampleProps.tsnew file mode 100644index 00000000000..5393b827469--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__stories__/AlertDialogExampleProps.ts@@ -0,0 +1,13 @@+import { type ReactNode } from 'react';++import { type AlertDialogPopupProps } from '../types/AlertDialogPopupProps';+import { type AlertDialogPortalProps } from '../types/AlertDialogPortalProps';+import { type AlertDialogRootProps } from '../types/AlertDialogRootProps';++export type AlertDialogExampleProps = AlertDialogRootProps & {+ size?: AlertDialogPopupProps['size'];+ popupProps?: AlertDialogPopupProps;+ portalProps?: AlertDialogPortalProps;+ disabled?: boolean;+ content?: ReactNode;+};diff --git a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__tests__/AlertDialog.test.tsx b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__tests__/AlertDialog.test.tsxindex 10dd8b74f6c..2e685bfef27 100644--- a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__tests__/AlertDialog.test.tsx+++ b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/__tests__/AlertDialog.test.tsx@@ -11,11 +11,21 @@ const AlertDialogRootWrapper = ({ children }: { children: ReactNode }) => (const OpenAlertDialogWrapper = ({ children }: { children: ReactNode }) => (<AlertDialog.Root open>{children}</AlertDialog.Root>);-const AlertDialogPopupWrapper = ({ children }: { children: ReactNode }) => (+const AlertDialogPortalWrapper = ({ children }: { children: ReactNode }) => (<AlertDialog.Root open>- <AlertDialog.Popup initialFocus={false}>{children}</AlertDialog.Popup>+ <AlertDialog.Portal>{children}</AlertDialog.Portal></AlertDialog.Root>);+const AlertDialogViewportWrapper = ({ children }: { children: ReactNode }) => (+ <AlertDialogPortalWrapper>+ <AlertDialog.Viewport>{children}</AlertDialog.Viewport>+ </AlertDialogPortalWrapper>+);+const AlertDialogPopupWrapper = ({ children }: { children: ReactNode }) => (+ <AlertDialogViewportWrapper>+ <AlertDialog.Popup initialFocus={false}>{children}</AlertDialog.Popup>+ </AlertDialogViewportWrapper>+);runComponentConformance({name: 'AlertDialog.Trigger',@@ -24,11 +34,31 @@ runComponentConformance({wrapper: AlertDialogRootWrapper,renderPropTagName: 'button',});+runComponentConformance({+ name: 'AlertDialog.Portal',+ element: <AlertDialog.Portal />,+ refInstanceOf: HTMLDivElement,+ wrapper: OpenAlertDialogWrapper,+});+runComponentConformance({+ name: 'AlertDialog.Backdrop',+ element: <AlertDialog.Backdrop />,+ refInstanceOf: HTMLDivElement,+ wrapper: AlertDialogPortalWrapper,+ ownClassName: styles.backdrop,+});+runComponentConformance({+ name: 'AlertDialog.Viewport',+ element: <AlertDialog.Viewport />,+ refInstanceOf: HTMLDivElement,+ wrapper: AlertDialogPortalWrapper,+ ownClassName: styles.viewport,+});runComponentConformance({name: 'AlertDialog.Popup',element: <AlertDialog.Popup initialFocus={false} />,refInstanceOf: HTMLDivElement,- wrapper: OpenAlertDialogWrapper,+ wrapper: AlertDialogViewportWrapper,ownClassName: styles.popup,});runComponentConformance({diff --git a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/internal/AlertDialogBackdrop.tsx b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/internal/AlertDialogBackdrop.tsxnew file mode 100644index 00000000000..1e3cc0998a9--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/internal/AlertDialogBackdrop.tsx@@ -0,0 +1,16 @@+import { AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog';++import { mergeClassNames } from '@ui/utilities/internal/mergeClassNames';++import styles from '@ui/primitives/surfaces/internal/Dialog.module.scss';+import { type AlertDialogBackdropProps } from '../types/AlertDialogBackdropProps';++export const AlertDialogBackdrop = ({+ className,+ ...props+}: AlertDialogBackdropProps) => (+ <AlertDialogPrimitive.Backdrop+ {...props}+ className={mergeClassNames(styles.backdrop, className)}+ />+);diff --git a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/internal/AlertDialogPopup.tsx b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/internal/AlertDialogPopup.tsxindex 15c44b7c633..b75744cab5e 100644--- a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/internal/AlertDialogPopup.tsx+++ b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/internal/AlertDialogPopup.tsx@@ -1,7 +1,5 @@import { AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog';-import { useProvidedTextDirection } from '@ui/primitives/layout/DirectionProvider/internal/useProvidedTextDirection';-import { useThemeContainer } from '@ui/theme';import { mergeClassNames } from '@ui/utilities/internal/mergeClassNames';import styles from '@ui/primitives/surfaces/internal/Dialog.module.scss';@@ -9,32 +7,12 @@ import { type AlertDialogPopupProps } from '../types/AlertDialogPopupProps';export const AlertDialogPopup = ({size = 'md',- container,- keepMounted,className,...props-}: AlertDialogPopupProps) => {- const themeContainer = useThemeContainer();- const direction = useProvidedTextDirection();-- return (- <AlertDialogPrimitive.Portal- container={- container === undefined ? (themeContainer ?? undefined) : container- }- keepMounted={keepMounted}- >- <AlertDialogPrimitive.Backdrop className={styles.backdrop} />- <AlertDialogPrimitive.Viewport- dir={direction}- className={styles.viewport}- >- <AlertDialogPrimitive.Popup- {...props}- data-size={size}- className={mergeClassNames(styles.popup, className)}- />- </AlertDialogPrimitive.Viewport>- </AlertDialogPrimitive.Portal>- );-};+}: AlertDialogPopupProps) => (+ <AlertDialogPrimitive.Popup+ {...props}+ data-size={size}+ className={mergeClassNames(styles.popup, className)}+ />+);diff --git a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/internal/AlertDialogPortal.tsx b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/internal/AlertDialogPortal.tsxnew file mode 100644index 00000000000..2b57d78a6e1--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/internal/AlertDialogPortal.tsx@@ -0,0 +1,24 @@+import { AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog';++import { useProvidedTextDirection } from '@ui/primitives/layout/DirectionProvider/internal/useProvidedTextDirection';+import { useThemeContainer } from '@ui/theme/useThemeContainer';++import { type AlertDialogPortalProps } from '../types/AlertDialogPortalProps';++export const AlertDialogPortal = ({+ container,+ ...props+}: AlertDialogPortalProps) => {+ const themeContainer = useThemeContainer();+ const direction = useProvidedTextDirection();++ return (+ <AlertDialogPrimitive.Portal+ dir={direction}+ {...props}+ container={+ container === undefined ? (themeContainer ?? undefined) : container+ }+ />+ );+};diff --git a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/internal/AlertDialogViewport.tsx b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/internal/AlertDialogViewport.tsxnew file mode 100644index 00000000000..b1ba40d08e8--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/internal/AlertDialogViewport.tsx@@ -0,0 +1,22 @@+import { AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog';++import { useProvidedTextDirection } from '@ui/primitives/layout/DirectionProvider/internal/useProvidedTextDirection';+import { mergeClassNames } from '@ui/utilities/internal/mergeClassNames';++import styles from '@ui/primitives/surfaces/internal/Dialog.module.scss';+import { type AlertDialogViewportProps } from '../types/AlertDialogViewportProps';++export const AlertDialogViewport = ({+ className,+ ...props+}: AlertDialogViewportProps) => {+ const direction = useProvidedTextDirection();++ return (+ <AlertDialogPrimitive.Viewport+ dir={direction}+ {...props}+ className={mergeClassNames(styles.viewport, className)}+ />+ );+};diff --git a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogBackdropProps.ts b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogBackdropProps.tsnew file mode 100644index 00000000000..0bea4ba9373--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogBackdropProps.ts@@ -0,0 +1,3 @@+import { type AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog';++export type AlertDialogBackdropProps = AlertDialogPrimitive.Backdrop.Props;diff --git a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogBackdropState.ts b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogBackdropState.tsnew file mode 100644index 00000000000..b9faeeb69eb--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogBackdropState.ts@@ -0,0 +1,3 @@+import { type AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog';++export type AlertDialogBackdropState = AlertDialogPrimitive.Backdrop.State;diff --git a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogCloseState.ts b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogCloseState.tsnew file mode 100644index 00000000000..88a0727f2a2--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogCloseState.ts@@ -0,0 +1,3 @@+import { type AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog';++export type AlertDialogCloseState = AlertDialogPrimitive.Close.State;diff --git a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogDescriptionState.ts b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogDescriptionState.tsnew file mode 100644index 00000000000..67260c02745--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogDescriptionState.ts@@ -0,0 +1,4 @@+import { type AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog';++export type AlertDialogDescriptionState =+ AlertDialogPrimitive.Description.State;diff --git a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogHandle.ts b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogHandle.tsnew file mode 100644index 00000000000..d3d1f6714d8--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogHandle.ts@@ -0,0 +1,4 @@+import { type AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog';++export type AlertDialogHandle<TPayload = unknown> =+ AlertDialogPrimitive.Handle<TPayload>;diff --git a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogPopupProps.ts b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogPopupProps.tsindex 625ce23fa0b..c21b0c6f2f8 100644--- a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogPopupProps.ts+++ b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogPopupProps.ts@@ -3,13 +3,5 @@ import { type AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dimport { type AlertDialogSize } from './AlertDialogSize';export type AlertDialogPopupProps = AlertDialogPrimitive.Popup.Props & {- /** Width of the dialog, or `fullscreen` to fill the viewport. */size?: AlertDialogSize;- /**- * Element the dialog is portaled into. Defaults to the theme's portal- * container.- */- container?: AlertDialogPrimitive.Portal.Props['container'];- /** Keeps the dialog mounted in the DOM while it is closed. */- keepMounted?: boolean;};diff --git a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogPopupState.ts b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogPopupState.tsnew file mode 100644index 00000000000..51517bb5636--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogPopupState.ts@@ -0,0 +1,3 @@+import { type AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog';++export type AlertDialogPopupState = AlertDialogPrimitive.Popup.State;diff --git a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogPortalProps.ts b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogPortalProps.tsnew file mode 100644index 00000000000..c3bac69e57d--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogPortalProps.ts@@ -0,0 +1,3 @@+import { type AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog';++export type AlertDialogPortalProps = AlertDialogPrimitive.Portal.Props;diff --git a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogPortalState.ts b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogPortalState.tsnew file mode 100644index 00000000000..6ed99ea0712--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogPortalState.ts@@ -0,0 +1,3 @@+import { type AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog';++export type AlertDialogPortalState = AlertDialogPrimitive.Portal.State;diff --git a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogRootActions.ts b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogRootActions.tsnew file mode 100644index 00000000000..d4dbf7974d1--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogRootActions.ts@@ -0,0 +1,3 @@+import { type AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog';++export type AlertDialogRootActions = AlertDialogPrimitive.Root.Actions;diff --git a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogRootChangeEventDetails.ts b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogRootChangeEventDetails.tsnew file mode 100644index 00000000000..18463385cd0--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogRootChangeEventDetails.ts@@ -0,0 +1,4 @@+import { type AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog';++export type AlertDialogRootChangeEventDetails =+ AlertDialogPrimitive.Root.ChangeEventDetails;diff --git a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogRootChangeEventReason.ts b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogRootChangeEventReason.tsnew file mode 100644index 00000000000..b95772ada6f--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogRootChangeEventReason.ts@@ -0,0 +1,4 @@+import { type AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog';++export type AlertDialogRootChangeEventReason =+ AlertDialogPrimitive.Root.ChangeEventReason;diff --git a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogRootState.ts b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogRootState.tsnew file mode 100644index 00000000000..082cb71c90b--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogRootState.ts@@ -0,0 +1,3 @@+import { type AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog';++export type AlertDialogRootState = AlertDialogPrimitive.Root.State;diff --git a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogTitleState.ts b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogTitleState.tsnew file mode 100644index 00000000000..cab47b05ea7--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogTitleState.ts@@ -0,0 +1,3 @@+import { type AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog';++export type AlertDialogTitleState = AlertDialogPrimitive.Title.State;diff --git a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogTriggerState.ts b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogTriggerState.tsnew file mode 100644index 00000000000..e23c51ff95f--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogTriggerState.ts@@ -0,0 +1,3 @@+import { type AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog';++export type AlertDialogTriggerState = AlertDialogPrimitive.Trigger.State;diff --git a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogViewportProps.ts b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogViewportProps.tsnew file mode 100644index 00000000000..054dd8f5bba--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogViewportProps.ts@@ -0,0 +1,3 @@+import { type AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog';++export type AlertDialogViewportProps = AlertDialogPrimitive.Viewport.Props;diff --git a/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogViewportState.ts b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogViewportState.tsnew file mode 100644index 00000000000..d2c1aa0bb12--- /dev/null+++ b/packages/twenty-ui/src/primitives/surfaces/AlertDialog/types/AlertDialogViewportState.ts@@ -0,0 +1,3 @@+import { type AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog';++export type AlertDialogViewportState = AlertDialogPrimitive.Viewport.State;diff --git a/packages/twenty-ui/src/primitives/surfaces/index.ts b/packages/twenty-ui/src/primitives/surfaces/index.tsindex 5981f458f25..f5c40b50b8c 100644--- a/packages/twenty-ui/src/primitives/surfaces/index.ts+++ b/packages/twenty-ui/src/primitives/surfaces/index.ts@@ -8,16 +8,32 @@*/export { AlertDialog } from './AlertDialog/AlertDialog';+export type { AlertDialogBackdropProps } from './AlertDialog/types/AlertDialogBackdropProps';+export type { AlertDialogBackdropState } from './AlertDialog/types/AlertDialogBackdropState';export type { AlertDialogBodyProps } from './AlertDialog/types/AlertDialogBodyProps';export type { AlertDialogCloseProps } from './AlertDialog/types/AlertDialogCloseProps';+export type { AlertDialogCloseState } from './AlertDialog/types/AlertDialogCloseState';export type { AlertDialogDescriptionProps } from './AlertDialog/types/AlertDialogDescriptionProps';+export type { AlertDialogDescriptionState } from './AlertDialog/types/AlertDialogDescriptionState';export type { AlertDialogFooterProps } from './AlertDialog/types/AlertDialogFooterProps';+export type { AlertDialogHandle } from './AlertDialog/types/AlertDialogHandle';export type { AlertDialogHeaderProps } from './AlertDialog/types/AlertDialogHeaderProps';export type { AlertDialogPopupProps } from './AlertDialog/types/AlertDialogPopupProps';+export type { AlertDialogPopupState } from './AlertDialog/types/AlertDialogPopupState';+export type { AlertDialogPortalProps } from './AlertDialog/types/AlertDialogPortalProps';+export type { AlertDialogPortalState } from './AlertDialog/types/AlertDialogPortalState';+export type { AlertDialogRootActions } from './AlertDialog/types/AlertDialogRootActions';+export type { AlertDialogRootChangeEventDetails } from './AlertDialog/types/AlertDialogRootChangeEventDetails';+export type { AlertDialogRootChangeEventReason } from './AlertDialog/types/AlertDialogRootChangeEventReason';export type { AlertDialogRootProps } from './AlertDialog/types/AlertDialogRootProps';+export type { AlertDialogRootState } from './AlertDialog/types/AlertDialogRootState';export type { AlertDialogSize } from './AlertDialog/types/AlertDialogSize';export type { AlertDialogTitleProps } from './AlertDialog/types/AlertDialogTitleProps';+export type { AlertDialogTitleState } from './AlertDialog/types/AlertDialogTitleState';export type { AlertDialogTriggerProps } from './AlertDialog/types/AlertDialogTriggerProps';+export type { AlertDialogTriggerState } from './AlertDialog/types/AlertDialogTriggerState';+export type { AlertDialogViewportProps } from './AlertDialog/types/AlertDialogViewportProps';+export type { AlertDialogViewportState } from './AlertDialog/types/AlertDialogViewportState';export { Card } from './Card/Card';export { Dialog } from './Dialog/Dialog';export type { DialogBodyProps } from './Dialog/types/DialogBodyProps';