The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Backfill twenty-ui front component renderer stories (#25719)
Raphaël Bosib2bfbbe46ba3
diff --git a/packages/twenty-front-component-renderer/scripts/front-component-stories/build-source-examples.ts b/packages/twenty-front-component-renderer/scripts/front-component-stories/build-source-examples.tsindex acca14327fd..c130a6fad74 100644--- a/packages/twenty-front-component-renderer/scripts/front-component-stories/build-source-examples.ts+++ b/packages/twenty-front-component-renderer/scripts/front-component-stories/build-source-examples.ts@@ -83,6 +83,10 @@ const TWENTY_UI_SUBMODULES = [];const twentyUiAliases = {+ 'twenty-ui/style.css': path.join(+ path.dirname(twentyUiIndividualIndex),+ 'twenty-ui.css',+ ),'twenty-ui': twentyUiIndividualIndex,...Object.fromEntries(TWENTY_UI_SUBMODULES.map((submodule) => [diff --git a/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsx b/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsxindex 6cb29a941d4..4fd66e29a67 100644--- a/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsx+++ b/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsx@@ -1,12 +1,41 @@-import { type Meta, type StoryObj } from '@storybook/react-vite';-import { expect, waitFor, within } from 'storybook/test';+import { type Meta } from '@storybook/react-vite';import {- errorHandler,FRONT_COMPONENT_STORY_DEFAULT_ARGS,resetFrontComponentStoryMocks,} from '@/__stories__/shared/test-utils/createFrontComponentStoryMeta';-import { getBuiltStoryComponentPathForRender } from '@/__stories__/utils/getBuiltStoryComponentPathForRender';+import { type TwentyUiGalleryStory as Story } from '@/__stories__/twenty-ui-gallery/types/TwentyUiGalleryStory';+import {+ createCheckboxTest,+ createFieldControlsTest,+ createRadioGroupPreactTest,+ listItemTest,+ sliderTest,+ toastTest,+} from '@/__stories__/twenty-ui-gallery/utils/componentInteractionTests';+import { createGalleryStory } from '@/__stories__/twenty-ui-gallery/utils/createGalleryStory';+import {+ codeEditorTest,+ dataDisplayTest,+ displayHelpersTest,+ galleryRenderTest,+ inputPreactTest,+ inputReactTest,+ modalOpenHangTest,+ navigationTest,+ themeTokenTest,+} from '@/__stories__/twenty-ui-gallery/utils/galleryRenderTests';+import {+ alertDialogTest,+ menuTest,+ popoverTest,+ radioGroupReactTest,+ selectTest,+ sliderRangeTest,+ switchTest,+ tabsPreactTest,+ tabsReactTest,+} from '@/__stories__/twenty-ui-gallery/utils/sandboxFailureTests';import { FrontComponentRenderer } from '@/host/components/FrontComponentRenderer';const meta: Meta<typeof FrontComponentRenderer> = {@@ -20,251 +49,308 @@ const meta: Meta<typeof FrontComponentRenderer> = {};export default meta;-type Story = StoryObj<typeof FrontComponentRenderer>;--// Every gallery fixture wraps each component in an error boundary and reports-// the aggregated result on the gallery-status element, so a single play-// function covers all submodules.-const galleryTest: Story['play'] = async ({ canvasElement }) => {- const canvas = within(canvasElement);-- const status = await canvas.findByTestId(- 'gallery-status',- {},- { timeout: 30000 },- );-- await waitFor(() => {- expect(status).toHaveAttribute('data-failed-messages', '');- expect(status).toHaveAttribute('data-failed-count', '0');- });- expect(Number(status.getAttribute('data-total-count'))).toBeGreaterThan(0);- expect(errorHandler).not.toHaveBeenCalled();-};--const createGalleryStory = (name: string, runtime?: 'preact'): Story => ({- args: {- componentUrl: getBuiltStoryComponentPathForRender(- `${name}.front-component`,- runtime,- ),- },- play: galleryTest,+export const DataDisplayReact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-data-display-gallery',+ runtime: 'react',+ play: dataDisplayTest,});--// Golden known-failure test (TDD): PASSES while the documented sandbox gap-// exists — the failing component set matches the expected set EXACTLY. It-// FAILS on regression (an unexpected component starts failing), on fix-// (nothing fails anymore) and on partial fix (only some expected components-// still fail): when your fix lands, flip the story back to the strict-// zero-failure `createGalleryStory` play.-const createKnownFailureGalleryTest =- (expectedFailedComponents: string[]): Story['play'] =>- async ({ canvasElement }) => {- const canvas = within(canvasElement);-- const status = await canvas.findByTestId(- 'gallery-status',- {},- { timeout: 30000 },- );-- const expectedFailedComponentsSorted = [...expectedFailedComponents].sort();-- // Failure reports arrive asynchronously: retry until the failed set- // matches the expected set exactly.- await waitFor(() => {- const failedComponents = (status.getAttribute('data-failed-names') ?? '')- .split(', ')- .filter((failedComponent) => failedComponent.length > 0)- .sort();-- expect(failedComponents).toEqual(expectedFailedComponentsSorted);- });-- expect(errorHandler).not.toHaveBeenCalled();- };--const createKnownFailureGalleryStory = (- name: string,- expectedFailedComponents: string[],- runtime?: 'preact',-): Story => ({- ...createGalleryStory(name, runtime),- play: createKnownFailureGalleryTest(expectedFailedComponents),+export const DataDisplayPreact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-data-display-gallery',+ runtime: 'preact',+ play: dataDisplayTest,});-// KNOWN ISSUE (TDD): LinkChip crashes without a router context in the sandbox.-export const DataDisplayReact: Story = createKnownFailureGalleryStory(- 'twenty-ui-data-display-gallery',- ['LinkChip'],-);-export const DataDisplayPreact: Story = createKnownFailureGalleryStory(- 'twenty-ui-data-display-gallery',- ['LinkChip'],- 'preact',-);--export const FeedbackReact: Story = createGalleryStory(- 'twenty-ui-feedback-gallery',-);-export const FeedbackPreact: Story = createGalleryStory(- 'twenty-ui-feedback-gallery',- 'preact',-);+export const FeedbackReact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-feedback-gallery',+ runtime: 'react',+ play: galleryRenderTest,+});+export const FeedbackPreact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-feedback-gallery',+ runtime: 'preact',+ play: galleryRenderTest,+});-export const IconReact: Story = createGalleryStory('twenty-ui-icon-gallery');-export const IconPreact: Story = createGalleryStory(- 'twenty-ui-icon-gallery',- 'preact',-);+export const IconReact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-icon-gallery',+ runtime: 'react',+ play: galleryRenderTest,+});+export const IconPreact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-icon-gallery',+ runtime: 'preact',+ play: galleryRenderTest,+});-// KNOWN ISSUE (TDD): The sandbox DOM lacks Element.matches(':disabled') for-// unselected radios and Node.compareDocumentPosition() for React radio groups.-export const InputReact: Story = createKnownFailureGalleryStory(- 'twenty-ui-input-gallery',- ['Radio', 'RadioGroup'],-);-export const InputPreact: Story = createKnownFailureGalleryStory(- 'twenty-ui-input-gallery',- ['Radio'],- 'preact',-);+export const InputReact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-input-gallery',+ runtime: 'react',+ play: inputReactTest,+});+export const InputPreact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-input-gallery',+ runtime: 'preact',+ play: inputPreactTest,+});-export const JsonVisualizerReact: Story = createGalleryStory(- 'twenty-ui-json-visualizer-gallery',-);-export const JsonVisualizerPreact: Story = createGalleryStory(- 'twenty-ui-json-visualizer-gallery',- 'preact',-);+export const JsonVisualizerReact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-json-visualizer-gallery',+ runtime: 'react',+ play: galleryRenderTest,+});+export const JsonVisualizerPreact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-json-visualizer-gallery',+ runtime: 'preact',+ play: galleryRenderTest,+});-export const LayoutReact: Story = createGalleryStory(- 'twenty-ui-layout-gallery',-);-export const LayoutPreact: Story = createGalleryStory(- 'twenty-ui-layout-gallery',- 'preact',-);+export const LayoutReact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-layout-gallery',+ runtime: 'react',+ play: galleryRenderTest,+});+export const LayoutPreact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-layout-gallery',+ runtime: 'preact',+ play: galleryRenderTest,+});-// KNOWN ISSUE (TDD): react-router Links crash without a router context.-const NAVIGATION_EXPECTED_FAILURES = ['RawLink', 'UndecoratedLink'];-export const NavigationReact: Story = createKnownFailureGalleryStory(- 'twenty-ui-navigation-gallery',- NAVIGATION_EXPECTED_FAILURES,-);-export const NavigationPreact: Story = createKnownFailureGalleryStory(- 'twenty-ui-navigation-gallery',- NAVIGATION_EXPECTED_FAILURES,- 'preact',-);+export const NavigationReact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-navigation-gallery',+ runtime: 'react',+ play: navigationTest,+});+export const NavigationPreact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-navigation-gallery',+ runtime: 'preact',+ play: navigationTest,+});-export const SurfacesReact: Story = createGalleryStory(- 'twenty-ui-surfaces-gallery',-);-export const SurfacesPreact: Story = createGalleryStory(- 'twenty-ui-surfaces-gallery',- 'preact',-);+export const SurfacesReact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-surfaces-gallery',+ runtime: 'react',+ play: galleryRenderTest,+});+export const SurfacesPreact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-surfaces-gallery',+ runtime: 'preact',+ play: galleryRenderTest,+});-// KNOWN ISSUE (TDD) golden test: an open Modal (base-ui Dialog portal) hangs-// the React-runtime render — the gallery status must never mount. Works under-// Preact (see ModalOpenPreact). When fixed, flip this story to the strict-// zero-failure play used by ModalOpenPreact.-const modalOpenHangTest: Story['play'] = async ({ canvasElement }) => {- const canvas = within(canvasElement);+export const ModalOpenReact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-modal-open-gallery',+ runtime: 'react',+ play: modalOpenHangTest,+});+export const ModalOpenPreact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-modal-open-gallery',+ runtime: 'preact',+ play: galleryRenderTest,+});- await expect(- canvas.findByTestId('gallery-status', {}, { timeout: 10000 }),- ).rejects.toThrow();-};+export const CodeEditorReact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-code-editor-gallery',+ runtime: 'react',+ play: codeEditorTest,+});+export const CodeEditorPreact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-code-editor-gallery',+ runtime: 'preact',+ play: codeEditorTest,+});-const modalOpenTest: Story['play'] = async ({ canvasElement }) => {- const canvas = within(canvasElement);+export const TypographyReact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-typography-gallery',+ runtime: 'react',+ play: galleryRenderTest,+});+export const TypographyPreact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-typography-gallery',+ runtime: 'preact',+ play: galleryRenderTest,+});- const status = await canvas.findByTestId(- 'gallery-status',- {},- { timeout: 15000 },- );+export const ThemeTokensReact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-theme-tokens',+ runtime: 'react',+ play: themeTokenTest,+});+export const ThemeTokensPreact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-theme-tokens',+ runtime: 'preact',+ play: themeTokenTest,+});- await waitFor(() => {- expect(status).toHaveAttribute('data-failed-messages', '');- expect(status).toHaveAttribute('data-failed-count', '0');- });+export const FieldControlsReact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-field-controls',+ runtime: 'react',+ // React serializes boolean ARIA as empty strings and loses Textarea's+ // change handler.+ play: createFieldControlsTest({+ expectedAriaInvalid: '',+ expectedReportedValues: /^Email: alice; Notes:$/,+ }),+});+export const FieldControlsPreact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-field-controls',+ runtime: 'preact',+ play: createFieldControlsTest({+ expectedAriaInvalid: 'true',+ expectedReportedValues: 'Email: alice; Notes: Follow up',+ }),+});- expect(errorHandler).not.toHaveBeenCalled();-};+export const DisplayHelpersReact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-display-helpers',+ runtime: 'react',+ play: displayHelpersTest,+});+export const DisplayHelpersPreact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-display-helpers',+ runtime: 'preact',+ play: displayHelpersTest,+});-export const ModalOpenReact: Story = {- ...createGalleryStory('twenty-ui-modal-open-gallery'),- play: modalOpenHangTest,-};-export const ModalOpenPreact: Story = {- ...createGalleryStory('twenty-ui-modal-open-gallery', 'preact'),- play: modalOpenTest,-};+export const ListItemReact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-list-item',+ runtime: 'react',+ play: listItemTest,+});+export const ListItemPreact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-list-item',+ runtime: 'preact',+ play: listItemTest,+});-// KNOWN ISSUE (TDD) golden test: monaco cannot load inside the sandbox worker-// (no script loading in the polyfilled DOM, opaque-origin CSP): the CodeEditor-// wrapper mounts but monaco's onMount never fires. If front components ever-// get a supported code editor path, flip the assertion to 'mounted'.-const codeEditorTest: Story['play'] = async ({ canvasElement }) => {- const canvas = within(canvasElement);+export const TabsReact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-tabs',+ runtime: 'react',+ play: tabsReactTest,+});+export const TabsPreact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-tabs',+ runtime: 'preact',+ play: tabsPreactTest,+});- const codeEditor = await canvas.findByTestId(- 'code-editor-component',- {},- { timeout: 30000 },- );+export const PopoverReact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-popover',+ runtime: 'react',+ play: popoverTest,+});+export const PopoverPreact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-popover',+ runtime: 'preact',+ play: popoverTest,+});- await new Promise((resolve) => setTimeout(resolve, 5000));+export const MenuReact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-menu',+ runtime: 'react',+ play: menuTest,+});+export const MenuPreact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-menu',+ runtime: 'preact',+ play: menuTest,+});- expect(codeEditor).toHaveAttribute('data-monaco-mount-state', 'pending');-};+export const SelectReact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-select',+ runtime: 'react',+ play: selectTest,+});+export const SelectPreact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-select',+ runtime: 'preact',+ play: selectTest,+});-export const CodeEditorReact: Story = {- ...createGalleryStory('twenty-ui-code-editor-gallery'),- play: codeEditorTest,-};-export const CodeEditorPreact: Story = {- ...createGalleryStory('twenty-ui-code-editor-gallery', 'preact'),- play: codeEditorTest,-};+export const ToastReact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-toast',+ runtime: 'react',+ play: toastTest,+});+export const ToastPreact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-toast',+ runtime: 'preact',+ play: toastTest,+});-export const TypographyReact: Story = createGalleryStory(- 'twenty-ui-typography-gallery',-);-export const TypographyPreact: Story = createGalleryStory(- 'twenty-ui-typography-gallery',- 'preact',-);+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,+});-const themeTokenTest: Story['play'] = async ({ canvasElement }) => {- const canvas = within(canvasElement);+export const SwitchReact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-switch',+ runtime: 'react',+ play: switchTest,+});+export const SwitchPreact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-switch',+ runtime: 'preact',+ play: switchTest,+});- const iconWrapper = await canvas.findByTestId(- 'theme-token-icon-wrapper',- {},- { timeout: 30000 },- );+export const CheckboxReact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-checkbox',+ runtime: 'react',+ play: createCheckboxTest({ expectedAriaTrue: '' }),+});+export const CheckboxPreact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-checkbox',+ runtime: 'preact',+ play: createCheckboxTest({ expectedAriaTrue: 'true' }),+});- await waitFor(() => {- const iconBox = iconWrapper.getBoundingClientRect();+export const SliderReact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-slider',+ runtime: 'react',+ play: sliderTest,+});+export const SliderPreact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-slider',+ runtime: 'preact',+ play: sliderTest,+});- expect(Math.round(iconBox.width)).toBe(16);- expect(Math.round(iconBox.height)).toBe(16);- });+export const SliderRangeReact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-slider-range',+ runtime: 'react',+ play: sliderRangeTest,+});+export const SliderRangePreact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-slider-range',+ runtime: 'preact',+ play: sliderRangeTest,+});- expect(errorHandler).not.toHaveBeenCalled();-};+export const RadioGroupReact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-radio-group',+ runtime: 'react',+ play: radioGroupReactTest,+});+export const RadioGroupPreact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-radio-group',+ runtime: 'preact',+ play: createRadioGroupPreactTest({ optionName: 'Daily' }),+});-export const ThemeTokensReact: Story = {- ...createGalleryStory('twenty-ui-theme-tokens'),- play: themeTokenTest,-};-export const ThemeTokensPreact: Story = {- ...createGalleryStory('twenty-ui-theme-tokens', 'preact'),- play: themeTokenTest,-};+export const CardPickerReact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-radio-group',+ runtime: 'react',+ play: radioGroupReactTest,+});+export const CardPickerPreact: Story = createGalleryStory({+ frontComponentBundleName: 'twenty-ui-radio-group',+ runtime: 'preact',+ play: createRadioGroupPreactTest({ optionName: 'Pro plan' }),+});diff --git a/packages/twenty-front-component-renderer/src/__stories__/shared/front-components/twenty-ui-gallery-card.tsx b/packages/twenty-front-component-renderer/src/__stories__/shared/front-components/twenty-ui-gallery-card.tsxnew file mode 100644index 00000000000..45930395f27--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/shared/front-components/twenty-ui-gallery-card.tsx@@ -0,0 +1,16 @@+import { type ComponentProps } from 'react';+import 'twenty-ui/style.css';+import { ThemeProvider } from 'twenty-ui/theme-constants';++import { FrontComponentCard } from '@/__stories__/shared/front-components/front-component-card';++type TwentyUiGalleryCardProps = ComponentProps<typeof FrontComponentCard>;++export const TwentyUiGalleryCard = ({+ title,+ children,+}: TwentyUiGalleryCardProps) => (+ <ThemeProvider colorScheme="light">+ <FrontComponentCard title={title}>{children}</FrontComponentCard>+ </ThemeProvider>+);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.mdnew file mode 100644index 00000000000..a52977b7f8b--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/README.md@@ -0,0 +1,66 @@+# Twenty UI renderer coverage++`TwentyUiGallery.stories.tsx` contains the component catalogs and focused+component stories. Each fixture has React and Preact stories built with+`createGalleryStory`, with an explicit bundle name, runtime, and play function.+Scenarios share their checks between runtimes where behavior matches. The story+file contains the metadata and named entries; `utils/` holds the story factory,+shared assertions, render checks, interaction checks, and known-failure scenarios.+Shared types and error patterns live in `types/` and `constants/`.+`createGalleryRenderTest` checks the+exact set of expected failed components. `createSandboxFailureTest` distinguishes+mount failures from click failures; its error expectation requires at least one+error and can allow additional known errors without requiring them to occur.++| Fixture | Components |+| --- | --- |+| `twenty-ui-field-controls` | Field, Input, InputGroup, Textarea, InputLabel, InputHint |+| `twenty-ui-display-helpers` | Text, EllipsisDisplay, NumberDisplay, JsonDisplay, TextDisplay, SelectDisplay |+| `twenty-ui-list-item` | ListItem |+| `twenty-ui-tabs` | Tabs |+| `twenty-ui-popover` | Popover |+| `twenty-ui-menu` | Menu |+| `twenty-ui-select` | Select |+| `twenty-ui-toast` | Toast |+| `twenty-ui-alert-dialog` | AlertDialog |+| `twenty-ui-switch` | Switch (interaction coverage in addition to the original input gallery) |++The focused fixtures import public twenty-ui entry points and use+`TwentyUiGalleryCard` for the light theme, mount marker, and `twenty-ui/style.css`.+The story builder resolves that stylesheet to the individual build's CSS so+class names match the JavaScript used by the sandbox. Importing CSS through the+shared card also exercises the SDK's CSS injection and the renderer's style bridge.++## Known sandbox limitations++These are compatibility regression stories, not assertions that the components+work fully in the sandbox. The failing scenarios require specific errors and+reject unrelated errors, following the existing gallery convention. Known+precursor errors are optional because the host can coalesce worker errors into+a single state update. A fix must change the corresponding story to assert+successful behavior; do not keep or broaden an obsolete error expectation.+No stories are skipped or marked as expected-to-fail by the runner.++| Component | Current limitation |+| --- | --- |+| Field controls | Forwarded events lack the native event used for `composedPath`. React serializes boolean `aria-invalid` as an empty string; Textarea's cloned render element loses its change handler in React. The value report checks the state received by the component after typing. |+| Tabs | React cannot mount without `compareDocumentPosition`; Preact activation fails on the missing native event for `composedPath`. |+| Popover, AlertDialog | Opening fails while reading unavailable viewport width data. |+| Menu, Select | Opening fails on viewport data and/or missing `nativeEvent.pointerType`. |+| Switch | Activation attempts to construct an unavailable `PointerEvent`. |++Once those gaps are fixed, extend the stories to verify selection, disabled+items, keyboard navigation, and overlay content, dismissal, and focus restoration.+The fixtures already include the controlled state, compound parts, and callback+output for those checks. Passing display, ListItem, and Toast stories verify+rendering/CSS or interaction behavior directly.++## Run++From the repository root, build the fixture dependencies and sandbox with+`npx nx run twenty-front-component-renderer:storybook:prebuild`.+Then, from `packages/twenty-front-component-renderer`, run:++```sh+npx vitest run --config vitest.storybook.config.ts TwentyUiGallery.stories.tsx+```diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/constants/SANDBOX_ERROR_PATTERNS.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/constants/SANDBOX_ERROR_PATTERNS.tsnew file mode 100644index 00000000000..e65a8569331--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/constants/SANDBOX_ERROR_PATTERNS.ts@@ -0,0 +1,13 @@+export const SANDBOX_ERROR_PATTERNS = {+ DOCUMENT_POSITION:+ /^(?:Uncaught TypeError: )?\w+\.compareDocumentPosition is not a function$/,+ COMPOSED_PATH:+ "Uncaught TypeError: Cannot use 'in' operator to search for 'composedPath' in undefined",+ VIEWPORT_WIDTH:+ "Uncaught TypeError: Cannot read properties of undefined (reading 'width')",+ POINTER_TYPE:+ "Uncaught TypeError: Cannot read properties of undefined (reading 'pointerType')",+ ELEMENT_MATCHES: /^(?:Uncaught TypeError: )?\w+\.matches is not a function$/,+ POINTER_EVENT_CONSTRUCTOR:+ /^Uncaught TypeError: .+\.PointerEvent is not a constructor$/,+};diff --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.tsxnew file mode 100644index 00000000000..ac15142ba2d--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-alert-dialog.front-component.tsx@@ -0,0 +1,37 @@+import { useState } from 'react';+import { defineFrontComponent } from 'twenty-sdk/define';+import { AlertDialog } from 'twenty-ui/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/twenty-ui-checkbox.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-checkbox.front-component.tsxnew file mode 100644index 00000000000..dec0e81e10a--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-checkbox.front-component.tsx@@ -0,0 +1,37 @@+import { useState } from 'react';+import { defineFrontComponent } from 'twenty-sdk/define';+import { Checkbox } from 'twenty-ui/input';++import { TwentyUiGalleryCard } from '@/__stories__/shared/front-components/twenty-ui-gallery-card';++const CheckboxExample = () => {+ const [checked, setChecked] = useState(false);+ const [changeCount, setChangeCount] = useState(0);++ return (+ <TwentyUiGalleryCard title="Checkbox">+ <Checkbox+ aria-label="Select account"+ checked={checked}+ onCheckedChange={(nextChecked) => {+ setChecked(nextChecked);+ setChangeCount((count) => count + 1);+ }}+ />+ <Checkbox aria-label="Uncontrolled selection" defaultChecked />+ <Checkbox aria-label="Partial selection" indeterminate />+ <Checkbox aria-label="Disabled selection" disabled />+ <Checkbox aria-label="Read-only selection" defaultChecked readOnly />+ <p role="status">+ Selection: {checked ? 'selected' : 'unselected'}; Changes: {changeCount}+ </p>+ </TwentyUiGalleryCard>+ );+};++export default defineFrontComponent({+ universalIdentifier: '4d23e9af-7cb3-4e4a-bbca-8e960f840011',+ name: 'twenty-ui-checkbox',+ description: 'Checkbox state and interaction behavior in the sandbox',+ component: CheckboxExample,+});diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-display-helpers.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-display-helpers.front-component.tsxnew file mode 100644index 00000000000..67cc2532d50--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-display-helpers.front-component.tsx@@ -0,0 +1,37 @@+import { defineFrontComponent } from 'twenty-sdk/define';+import {+ EllipsisDisplay,+ JsonDisplay,+ NumberDisplay,+ SelectDisplay,+ TextDisplay,+} from 'twenty-ui/data-display';+import { Text } from 'twenty-ui/typography';++import { TwentyUiGalleryCard } from '@/__stories__/shared/front-components/twenty-ui-gallery-card';++const DisplayHelpers = () => (+ <TwentyUiGalleryCard title="Text and display helpers">+ <Text render={<p />} truncate style={{ width: 160 }}>+ A long account name that should truncate+ </Text>+ <Text lineClamp={2} style={{ width: 160 }}>+ A longer account description that spans several lines and should be+ clamped to two lines.+ </Text>+ <EllipsisDisplay maxWidth={120}>+ An overflowing reference number+ </EllipsisDisplay>+ <NumberDisplay value={1234.5} />+ <JsonDisplay text={'{"active":true}'} />+ <TextDisplay text="Account description" />+ <SelectDisplay color="green" label="Qualified" />+ </TwentyUiGalleryCard>+);++export default defineFrontComponent({+ universalIdentifier: '4d23e9af-7cb3-4e4a-bbca-8e960f840002',+ name: 'twenty-ui-display-helpers',+ description: 'Text and migrated display helpers in the sandbox',+ component: DisplayHelpers,+});diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-field-controls.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-field-controls.front-component.tsxnew file mode 100644index 00000000000..6c583954f21--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-field-controls.front-component.tsx@@ -0,0 +1,61 @@+import { useState } from 'react';+import { defineFrontComponent } from 'twenty-sdk/define';+import {+ Field,+ Input,+ InputGroup,+ InputHint,+ InputLabel,+ Textarea,+} from 'twenty-ui/input';++import { TwentyUiGalleryCard } from '@/__stories__/shared/front-components/twenty-ui-gallery-card';++const FieldControls = () => {+ const [email, setEmail] = useState('');+ const [notes, setNotes] = useState('');+ const [reportedValues, setReportedValues] = useState('');++ return (+ <TwentyUiGalleryCard title="Field and text controls">+ <Field.Root>+ <Field.Label>Email</Field.Label>+ <InputGroup startElement="@" endElement=".com">+ <Input value={email} onValueChange={setEmail} />+ </InputGroup>+ <Field.Description>Use your work email</Field.Description>+ </Field.Root>+ <Field.Root invalid>+ <Field.Label>Required name</Field.Label>+ <Field.Control defaultValue="" />+ <Field.Error match>Name is required</Field.Error>+ </Field.Root>+ <Field.Root>+ <Field.Label>Notes</Field.Label>+ <Textarea value={notes} onValueChange={setNotes} rows={2} />+ </Field.Root>+ <InputLabel htmlFor="legacy-reference">Reference</InputLabel>+ <Input id="legacy-reference" value="REF-42" readOnly />+ <InputHint>Keep this reference</InputHint>+ <InputHint danger>Reference cannot be changed</InputHint>+ <Input aria-label="Disabled input" disabled value="Locked" />+ <p role="status">+ Email: {email}; Notes: {notes}+ </p>+ <button+ onClick={() => setReportedValues(`Email: ${email}; Notes: ${notes}`)}+ >+ Read values+ </button>+ <p data-testid="reported-values">{reportedValues}</p>+ </TwentyUiGalleryCard>+ );+};++export default defineFrontComponent({+ universalIdentifier: '4d23e9af-7cb3-4e4a-bbca-8e960f840001',+ name: 'twenty-ui-field-controls',+ description:+ 'Field, Input, InputGroup, Textarea and legacy input helpers in the sandbox',+ component: FieldControls,+});diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-list-item.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-list-item.front-component.tsxnew file mode 100644index 00000000000..e312b87da01--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-list-item.front-component.tsx@@ -0,0 +1,33 @@+import { useState } from 'react';+import { defineFrontComponent } from 'twenty-sdk/define';+import { ListItem } from 'twenty-ui/navigation';++import { TwentyUiGalleryCard } from '@/__stories__/shared/front-components/twenty-ui-gallery-card';++const ListItemExample = () => {+ const [selected, setSelected] = useState(false);++ return (+ <TwentyUiGalleryCard title="ListItem">+ <ListItem+ selected={selected}+ indicator="check"+ onClick={() => setSelected(!selected)}+ description="Workspace preference"+ >+ Weekly digest+ </ListItem>+ <ListItem disabled role="button" onClick={() => setSelected(true)}>+ Disabled preference+ </ListItem>+ <p role="status">Digest: {selected ? 'enabled' : 'disabled'}</p>+ </TwentyUiGalleryCard>+ );+};++export default defineFrontComponent({+ universalIdentifier: '4d23e9af-7cb3-4e4a-bbca-8e960f840003',+ name: 'twenty-ui-list-item',+ description: 'ListItem selection and disabled behavior in the sandbox',+ component: ListItemExample,+});diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-menu.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-menu.front-component.tsxnew file mode 100644index 00000000000..91e9995a0a1--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-menu.front-component.tsx@@ -0,0 +1,38 @@+import { useState } from 'react';+import { defineFrontComponent } from 'twenty-sdk/define';+import { Menu } from 'twenty-ui/surfaces';++import { TwentyUiGalleryCard } from '@/__stories__/shared/front-components/twenty-ui-gallery-card';++const MenuExample = () => {+ const [action, setAction] = useState('none');++ return (+ <TwentyUiGalleryCard title="Menu">+ <Menu.Root>+ <Menu.Trigger>Account actions</Menu.Trigger>+ <Menu.Popup>+ <Menu.Group>+ <Menu.GroupLabel>Record</Menu.GroupLabel>+ <Menu.Item onClick={() => setAction('duplicated')}>+ Duplicate+ </Menu.Item>+ <Menu.Item disabled onClick={() => setAction('archived')}>+ Archive+ </Menu.Item>+ </Menu.Group>+ <Menu.Separator />+ <Menu.Item onClick={() => setAction('exported')}>Export</Menu.Item>+ </Menu.Popup>+ </Menu.Root>+ <p role="status">Action: {action}</p>+ </TwentyUiGalleryCard>+ );+};++export default defineFrontComponent({+ universalIdentifier: '4d23e9af-7cb3-4e4a-bbca-8e960f840006',+ name: 'twenty-ui-menu',+ description: 'Menu portal, activation and disabled items in the sandbox',+ component: MenuExample,+});diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-popover.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-popover.front-component.tsxnew file mode 100644index 00000000000..3a29842001b--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-popover.front-component.tsx@@ -0,0 +1,30 @@+import { useState } from 'react';+import { defineFrontComponent } from 'twenty-sdk/define';+import { Popover } from 'twenty-ui/surfaces';++import { TwentyUiGalleryCard } from '@/__stories__/shared/front-components/twenty-ui-gallery-card';++const PopoverExample = () => {+ const [open, setOpen] = useState(false);++ return (+ <TwentyUiGalleryCard title="Popover">+ <Popover.Root open={open} onOpenChange={setOpen}>+ <Popover.Trigger>Account details</Popover.Trigger>+ <Popover.Popup>+ <Popover.Title>Account owner</Popover.Title>+ <Popover.Description>Alice manages this account</Popover.Description>+ <Popover.Close>Close details</Popover.Close>+ </Popover.Popup>+ </Popover.Root>+ <p role="status">Details: {open ? 'open' : 'closed'}</p>+ </TwentyUiGalleryCard>+ );+};++export default defineFrontComponent({+ universalIdentifier: '4d23e9af-7cb3-4e4a-bbca-8e960f840005',+ name: 'twenty-ui-popover',+ description: 'Popover opening, portal content and dismissal in the sandbox',+ component: PopoverExample,+});diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-radio-group.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-radio-group.front-component.tsxnew file mode 100644index 00000000000..af622b102a1--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-radio-group.front-component.tsx@@ -0,0 +1,43 @@+import { useState } from 'react';+import { defineFrontComponent } from 'twenty-sdk/define';+import { CardPicker, Radio, RadioGroup } from 'twenty-ui/input';++import { TwentyUiGalleryCard } from '@/__stories__/shared/front-components/twenty-ui-gallery-card';++const RadioGroupExample = () => {+ const [frequency, setFrequency] = useState('weekly');+ const [plan, setPlan] = useState('basic');++ return (+ <TwentyUiGalleryCard title="Radio group">+ <RadioGroup+ aria-label="Digest frequency"+ value={frequency}+ onValueChange={setFrequency}+ >+ <Radio value="daily">Daily</Radio>+ <Radio value="weekly">Weekly</Radio>+ <Radio value="monthly" disabled>+ Monthly+ </Radio>+ </RadioGroup>+ <p>Frequency: {frequency}</p>+ <RadioGroup+ aria-label="Plan"+ defaultValue="basic"+ onValueChange={setPlan}+ >+ <CardPicker value="basic">Basic plan</CardPicker>+ <CardPicker value="pro">Pro plan</CardPicker>+ </RadioGroup>+ <p>Plan: {plan}</p>+ </TwentyUiGalleryCard>+ );+};++export default defineFrontComponent({+ universalIdentifier: '4d23e9af-7cb3-4e4a-bbca-8e960f840014',+ name: 'twenty-ui-radio-group',+ description: 'RadioGroup selection with Radio and CardPicker in the sandbox',+ component: RadioGroupExample,+});diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-select.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-select.front-component.tsxnew file mode 100644index 00000000000..97944ed28df--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-select.front-component.tsx@@ -0,0 +1,42 @@+import { useState } from 'react';+import { defineFrontComponent } from 'twenty-sdk/define';+import { Select } from 'twenty-ui/input';++import { TwentyUiGalleryCard } from '@/__stories__/shared/front-components/twenty-ui-gallery-card';++const SelectExample = () => {+ const [value, setValue] = useState<string | null>('new');++ return (+ <TwentyUiGalleryCard title="Select">+ <Select.Root+ value={value}+ onValueChange={setValue}+ items={{ new: 'New', qualified: 'Qualified', archived: 'Archived' }}+ >+ <Select.Trigger aria-label="Account stage">+ <Select.Value />+ </Select.Trigger>+ <Select.Popup>+ <Select.Group>+ <Select.GroupLabel>Active stages</Select.GroupLabel>+ <Select.Item value="new">New</Select.Item>+ <Select.Item value="qualified">Qualified</Select.Item>+ </Select.Group>+ <Select.Separator />+ <Select.Item value="archived" disabled>+ Archived+ </Select.Item>+ </Select.Popup>+ </Select.Root>+ <p role="status">Stage: {value}</p>+ </TwentyUiGalleryCard>+ );+};++export default defineFrontComponent({+ universalIdentifier: '4d23e9af-7cb3-4e4a-bbca-8e960f840007',+ name: 'twenty-ui-select',+ description: 'Select controlled value and portal options in the sandbox',+ component: SelectExample,+});diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-slider-range.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-slider-range.front-component.tsxnew file mode 100644index 00000000000..34c307be9b3--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-slider-range.front-component.tsx@@ -0,0 +1,27 @@+import { defineFrontComponent } from 'twenty-sdk/define';+import { Slider } from 'twenty-ui/input';++import { TwentyUiGalleryCard } from '@/__stories__/shared/front-components/twenty-ui-gallery-card';++const SliderRangeExample = () => (+ <TwentyUiGalleryCard title="Slider range">+ <Slider.Root defaultValue={[20, 80]}>+ <Slider.Label>Price range</Slider.Label>+ <Slider.Value />+ <Slider.Control>+ <Slider.Track>+ <Slider.Indicator />+ <Slider.Thumb index={0} aria-label="Minimum price" />+ <Slider.Thumb index={1} aria-label="Maximum price" />+ </Slider.Track>+ </Slider.Control>+ </Slider.Root>+ </TwentyUiGalleryCard>+);++export default defineFrontComponent({+ universalIdentifier: '4d23e9af-7cb3-4e4a-bbca-8e960f840013',+ name: 'twenty-ui-slider-range',+ description: 'Slider range thumb registration in the sandbox',+ component: SliderRangeExample,+});diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-slider.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-slider.front-component.tsxnew file mode 100644index 00000000000..d23cdc2c6e7--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-slider.front-component.tsx@@ -0,0 +1,50 @@+import { useState } from 'react';+import { defineFrontComponent } from 'twenty-sdk/define';+import { Slider } from 'twenty-ui/input';++import { TwentyUiGalleryCard } from '@/__stories__/shared/front-components/twenty-ui-gallery-card';++const SliderExample = () => {+ const [value, setValue] = useState(40);+ const [committedValue, setCommittedValue] = useState(40);++ return (+ <TwentyUiGalleryCard title="Slider">+ <Slider.Root+ value={value}+ min={10}+ max={90}+ step={5}+ onValueChange={setValue}+ onValueCommitted={setCommittedValue}+ >+ <Slider.Label>Volume</Slider.Label>+ <Slider.Value />+ <Slider.Control>+ <Slider.Track>+ <Slider.Indicator />+ <Slider.Thumb />+ </Slider.Track>+ </Slider.Control>+ </Slider.Root>+ <Slider.Root aria-label="Disabled volume" defaultValue={30} disabled>+ <Slider.Control>+ <Slider.Track>+ <Slider.Indicator />+ <Slider.Thumb aria-label="Disabled volume" />+ </Slider.Track>+ </Slider.Control>+ </Slider.Root>+ <p role="status">+ Volume: {value}; Committed: {committedValue}+ </p>+ </TwentyUiGalleryCard>+ );+};++export default defineFrontComponent({+ universalIdentifier: '4d23e9af-7cb3-4e4a-bbca-8e960f840012',+ name: 'twenty-ui-slider',+ description: 'Slider compound parts and value callbacks in the sandbox',+ component: SliderExample,+});diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-switch.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-switch.front-component.tsxnew file mode 100644index 00000000000..fccca501872--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-switch.front-component.tsx@@ -0,0 +1,30 @@+import { useState } from 'react';+import { defineFrontComponent } from 'twenty-sdk/define';+import { Switch } from 'twenty-ui/input';++import { TwentyUiGalleryCard } from '@/__stories__/shared/front-components/twenty-ui-gallery-card';++const SwitchExample = () => {+ const [checked, setChecked] = useState(false);++ return (+ <TwentyUiGalleryCard title="Switch">+ <Switch+ aria-label="Email notifications"+ checked={checked}+ onCheckedChange={setChecked}+ />+ <Switch aria-label="Uncontrolled notifications" defaultChecked />+ <Switch aria-label="Disabled notifications" disabled />+ <p role="status">Notifications: {checked ? 'enabled' : 'disabled'}</p>+ </TwentyUiGalleryCard>+ );+};++export default defineFrontComponent({+ universalIdentifier: '4d23e9af-7cb3-4e4a-bbca-8e960f840010',+ name: 'twenty-ui-switch',+ description:+ 'Switch controlled, uncontrolled and disabled behavior in the sandbox',+ component: SwitchExample,+});diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-tabs.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-tabs.front-component.tsxnew file mode 100644index 00000000000..ec8f5955510--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-tabs.front-component.tsx@@ -0,0 +1,33 @@+import { useState } from 'react';+import { defineFrontComponent } from 'twenty-sdk/define';+import { Tabs } from 'twenty-ui/navigation';++import { TwentyUiGalleryCard } from '@/__stories__/shared/front-components/twenty-ui-gallery-card';++const TabsExample = () => {+ const [value, setValue] = useState('overview');++ return (+ <TwentyUiGalleryCard title="Tabs">+ <Tabs.Root value={value} onValueChange={setValue}>+ <Tabs.List aria-label="Account sections">+ <Tabs.Tab value="overview">Overview</Tabs.Tab>+ <Tabs.Tab value="disabled" disabled>+ Unavailable+ </Tabs.Tab>+ <Tabs.Tab value="activity">Activity</Tabs.Tab>+ </Tabs.List>+ <Tabs.Panel value="overview">Account overview</Tabs.Panel>+ <Tabs.Panel value="activity">Recent activity</Tabs.Panel>+ </Tabs.Root>+ <p role="status">Section: {value}</p>+ </TwentyUiGalleryCard>+ );+};++export default defineFrontComponent({+ universalIdentifier: '4d23e9af-7cb3-4e4a-bbca-8e960f840004',+ name: 'twenty-ui-tabs',+ description: 'Tabs selection and keyboard navigation in the sandbox',+ component: TabsExample,+});diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-toast.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-toast.front-component.tsxnew file mode 100644index 00000000000..027a626cf90--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-toast.front-component.tsx@@ -0,0 +1,38 @@+import { useState } from 'react';+import { defineFrontComponent } from 'twenty-sdk/define';+import { Toast } from 'twenty-ui/feedback';++import { TwentyUiGalleryCard } from '@/__stories__/shared/front-components/twenty-ui-gallery-card';++const ToastExample = () => {+ const [closed, setClosed] = useState(false);+ const [action, setAction] = useState('none');++ return (+ <TwentyUiGalleryCard title="Toast">+ {!closed && (+ <Toast+ variant="success"+ progress={100}+ description="Your changes are available to the team"+ onClose={() => setClosed(true)}+ closeLabel="Dismiss notification"+ onCancel={() => setAction('cancelled')}+ action={<button onClick={() => setAction('undone')}>Undo</button>}+ >+ Account saved+ </Toast>+ )}+ <p>+ Notification: {closed ? 'closed' : 'visible'}; Action: {action}+ </p>+ </TwentyUiGalleryCard>+ );+};++export default defineFrontComponent({+ universalIdentifier: '4d23e9af-7cb3-4e4a-bbca-8e960f840008',+ name: 'twenty-ui-toast',+ description: 'Toast rendering, actions and dismissal in the sandbox',+ component: ToastExample,+});diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/types/SandboxErrorExpectation.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/types/SandboxErrorExpectation.tsnew file mode 100644index 00000000000..d6398b04a37--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/types/SandboxErrorExpectation.ts@@ -0,0 +1,4 @@+export type SandboxErrorExpectation = {+ requiredErrors: readonly [string | RegExp, ...(string | RegExp)[]];+ allowedAdditionalErrors?: readonly (string | RegExp)[];+};diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/types/TwentyUiGalleryPlayFunction.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/types/TwentyUiGalleryPlayFunction.tsnew file mode 100644index 00000000000..4a9c558bf18--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/types/TwentyUiGalleryPlayFunction.ts@@ -0,0 +1,5 @@+import { type TwentyUiGalleryStory } from '@/__stories__/twenty-ui-gallery/types/TwentyUiGalleryStory';++export type TwentyUiGalleryPlayFunction = NonNullable<+ TwentyUiGalleryStory['play']+>;diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/types/TwentyUiGalleryStory.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/types/TwentyUiGalleryStory.tsnew file mode 100644index 00000000000..3ce800bfe42--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/types/TwentyUiGalleryStory.ts@@ -0,0 +1,5 @@+import { type StoryObj } from '@storybook/react-vite';++import { type FrontComponentRenderer } from '@/host/components/FrontComponentRenderer';++export type TwentyUiGalleryStory = StoryObj<typeof FrontComponentRenderer>;diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/componentInteractionTests.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/componentInteractionTests.tsnew file mode 100644index 00000000000..1aeb8a5873a--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/componentInteractionTests.ts@@ -0,0 +1,212 @@+import { expect, userEvent, waitFor, within } from 'storybook/test';++import { errorHandler } from '@/__stories__/shared/test-utils/createFrontComponentStoryMeta';+import { expectFrontComponentMounted } from '@/__stories__/shared/test-utils/matchers/expectFrontComponentMounted';+import {+ INTERACTION_TIMEOUT,+ TYPING_DELAY,+} from '@/__stories__/shared/test-utils/timeouts';+import { SANDBOX_ERROR_PATTERNS } from '@/__stories__/twenty-ui-gallery/constants/SANDBOX_ERROR_PATTERNS';+import { type TwentyUiGalleryPlayFunction } from '@/__stories__/twenty-ui-gallery/types/TwentyUiGalleryPlayFunction';+import { expectSandboxErrors } from '@/__stories__/twenty-ui-gallery/utils/expectSandboxErrors';++type CreateFieldControlsTestOptions = {+ expectedAriaInvalid: '' | 'true';+ expectedReportedValues: string | RegExp;+};++// React serializes true boolean ARIA attributes as empty strings in the sandbox.+type CreateCheckboxTestOptions = {+ expectedAriaTrue: '' | 'true';+};++export const createCheckboxTest =+ ({+ expectedAriaTrue,+ }: CreateCheckboxTestOptions): TwentyUiGalleryPlayFunction =>+ async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ await expectFrontComponentMounted(canvas);++ const checkbox = canvas.getByRole('checkbox', { name: 'Select account' });+ const uncontrolled = canvas.getByRole('checkbox', {+ name: 'Uncontrolled selection',+ });+ expect(checkbox).not.toBeChecked();+ expect(uncontrolled).toHaveAttribute('aria-checked', expectedAriaTrue);+ expect(+ canvas.getByRole('checkbox', { name: 'Partial selection' }),+ ).toBePartiallyChecked();+ const disabled = canvas.getByRole('checkbox', {+ name: 'Disabled selection',+ });+ expect(disabled).toHaveAttribute('aria-disabled', expectedAriaTrue);+ await userEvent.click(disabled);+ expect(disabled).not.toBeChecked();++ const readOnly = canvas.getByRole('checkbox', {+ name: 'Read-only selection',+ });+ await userEvent.click(readOnly);+ expect(readOnly).toHaveAttribute('aria-checked', expectedAriaTrue);+ expect(errorHandler).not.toHaveBeenCalled();++ // Checkbox activation forwards a click through an unavailable PointerEvent.+ await userEvent.click(checkbox);+ await expectSandboxErrors({+ requiredErrors: [SANDBOX_ERROR_PATTERNS.POINTER_EVENT_CONSTRUCTOR],+ });+ expect(canvas.getByRole('status')).toHaveTextContent(+ 'Selection: unselected; Changes: 0',+ );+ };++export const createFieldControlsTest =+ ({+ expectedAriaInvalid,+ expectedReportedValues,+ }: CreateFieldControlsTestOptions): TwentyUiGalleryPlayFunction =>+ async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ await expectFrontComponentMounted(canvas);++ const email = canvas.getByRole('textbox', { name: 'Email' });+ const notes = canvas.getByRole('textbox', { name: 'Notes' });++ expect(email).toHaveAccessibleDescription('Use your work email');+ expect(+ canvas.getByRole('textbox', { name: 'Required name' }),+ ).toHaveAttribute('aria-invalid', expectedAriaInvalid);+ expect(canvas.getByText('Name is required')).toBeVisible();+ expect(canvas.getByRole('textbox', { name: 'Reference' })).toHaveValue(+ 'REF-42',+ );+ expect(canvas.getByText('Keep this reference')).toBeVisible();+ expect(canvas.getByText('Reference cannot be changed')).toBeVisible();+ expect(+ canvas.getByRole('textbox', { name: 'Disabled input' }),+ ).toBeDisabled();++ await userEvent.click(canvas.getByText('Email', { exact: true }));+ await waitFor(() => expect(email).toHaveFocus());+ await userEvent.type(email, 'alice', { delay: TYPING_DELAY });+ await userEvent.type(notes, 'Follow up', { delay: TYPING_DELAY });+ await userEvent.click(canvas.getByRole('button', { name: 'Read values' }));+ await waitFor(() =>+ expect(canvas.getByTestId('reported-values')).toHaveTextContent(+ expectedReportedValues,+ ),+ );+ await expectSandboxErrors({+ requiredErrors: [SANDBOX_ERROR_PATTERNS.COMPOSED_PATH],+ });+ };++export const listItemTest: TwentyUiGalleryPlayFunction = async ({+ canvasElement,+}) => {+ const canvas = within(canvasElement);+ await expectFrontComponentMounted(canvas);++ const digest = canvas.getByText('Weekly digest');++ await userEvent.click(digest);+ await waitFor(() =>+ expect(canvas.getByRole('status')).toHaveTextContent('Digest: enabled'),+ );+ await userEvent.click(digest);+ await waitFor(() =>+ expect(canvas.getByRole('status')).toHaveTextContent('Digest: disabled'),+ );+ await userEvent.click(canvas.getByText('Disabled preference'));+ expect(canvas.getByRole('status')).toHaveTextContent('Digest: disabled');+ expect(errorHandler).not.toHaveBeenCalled();+};++export const toastTest: TwentyUiGalleryPlayFunction = async ({+ canvasElement,+}) => {+ const canvas = within(canvasElement);+ await expectFrontComponentMounted(canvas);++ expect(canvas.getByRole('status')).toHaveTextContent('Account saved');+ expect(+ canvas.getByText('Your changes are available to the team'),+ ).toBeVisible();+ await userEvent.click(canvas.getByRole('button', { name: 'Undo' }));+ await waitFor(() =>+ expect(+ canvas.getByText('Notification: visible; Action: undone'),+ ).toBeVisible(),+ );+ await userEvent.click(canvas.getByRole('button', { name: 'Cancel' }));+ await waitFor(() =>+ expect(+ canvas.getByText('Notification: visible; Action: cancelled'),+ ).toBeVisible(),+ );+ await userEvent.click(+ canvas.getByRole('button', { name: 'Dismiss notification' }),+ );+ await waitFor(() =>+ expect(canvas.queryByRole('status')).not.toBeInTheDocument(),+ );+ expect(+ canvas.getByText('Notification: closed; Action: cancelled'),+ ).toBeVisible();+ expect(errorHandler).not.toHaveBeenCalled();+};++// Slider's synchronous layout measurements leave its thumbs hidden in the sandbox.+export const sliderTest: TwentyUiGalleryPlayFunction = async ({+ canvasElement,+}) => {+ const canvas = within(canvasElement);+ await expectFrontComponentMounted(canvas);+ const volume = within(canvas.getByRole('group', { name: 'Volume' }));+ const slider = volume.getByRole('slider', { hidden: true });+ expect(volume.getByRole('status')).toHaveTextContent('40');+ expect(slider).toHaveValue('40');+ const disabledVolume = within(+ canvas.getByRole('group', { name: 'Disabled volume' }),+ );+ expect(disabledVolume.getByRole('slider', { hidden: true })).toBeDisabled();+ await expect(+ waitFor(() => expect(slider).toBeVisible(), {+ timeout: INTERACTION_TIMEOUT,+ }),+ ).rejects.toThrow();+ expect(canvas.getByText('Volume: 40; Committed: 40')).toBeVisible();+ expect(errorHandler).not.toHaveBeenCalled();+};++type CreateRadioGroupPreactTestOptions = {+ optionName: 'Daily' | 'Pro plan';+};++export const createRadioGroupPreactTest =+ ({+ optionName,+ }: CreateRadioGroupPreactTestOptions): TwentyUiGalleryPlayFunction =>+ async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ await expectFrontComponentMounted(canvas);+ expect(canvas.getByRole('radio', { name: 'Weekly' })).toBeChecked();+ const disabled = canvas.getByRole('radio', { name: 'Monthly' });+ expect(disabled).toHaveAttribute('aria-disabled', 'true');+ await userEvent.click(disabled);+ expect(disabled).not.toBeChecked();+ expect(canvas.getByRole('radio', { name: 'Basic plan' })).toBeChecked();++ // Preact can report ordering and forwarded-event errors before PointerEvent fails.+ await userEvent.click(canvas.getByRole('radio', { name: optionName }));+ await expectSandboxErrors({+ requiredErrors: [SANDBOX_ERROR_PATTERNS.POINTER_EVENT_CONSTRUCTOR],+ allowedAdditionalErrors: [+ SANDBOX_ERROR_PATTERNS.DOCUMENT_POSITION,+ SANDBOX_ERROR_PATTERNS.COMPOSED_PATH,+ ],+ });+ expect(canvas.getByText('Frequency: weekly')).toBeVisible();+ expect(canvas.getByText('Plan: basic')).toBeVisible();+ };diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createGalleryRenderTest.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createGalleryRenderTest.tsnew file mode 100644index 00000000000..5d3bdd676ea--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createGalleryRenderTest.ts@@ -0,0 +1,43 @@+import { isNonEmptyString } from '@sniptt/guards';+import { expect, waitFor, within } from 'storybook/test';++import { errorHandler } from '@/__stories__/shared/test-utils/createFrontComponentStoryMeta';+import { MOUNT_TIMEOUT } from '@/__stories__/shared/test-utils/timeouts';+import { type TwentyUiGalleryPlayFunction } from '@/__stories__/twenty-ui-gallery/types/TwentyUiGalleryPlayFunction';++type CreateGalleryRenderTestOptions = {+ expectedFailedComponents: readonly string[];+};++// Exact failure sets catch regressions and make fixes require updated assertions.+export const createGalleryRenderTest =+ ({+ expectedFailedComponents,+ }: CreateGalleryRenderTestOptions): TwentyUiGalleryPlayFunction =>+ async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ const status = await canvas.findByTestId(+ 'gallery-status',+ {},+ { timeout: MOUNT_TIMEOUT },+ );++ await waitFor(() => {+ const failedComponents = (status.getAttribute('data-failed-names') ?? '')+ .split(', ')+ .filter(isNonEmptyString)+ .sort();++ expect(failedComponents).toEqual([...expectedFailedComponents].sort());+ expect(status).toHaveAttribute(+ 'data-failed-count',+ String(expectedFailedComponents.length),+ );+ if (expectedFailedComponents.length === 0) {+ expect(status).toHaveAttribute('data-failed-messages', '');+ }+ });++ expect(Number(status.getAttribute('data-total-count'))).toBeGreaterThan(0);+ expect(errorHandler).not.toHaveBeenCalled();+ };diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createGalleryStory.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createGalleryStory.tsnew file mode 100644index 00000000000..b80a418d753--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createGalleryStory.ts@@ -0,0 +1,23 @@+import { type TwentyUiGalleryPlayFunction } from '@/__stories__/twenty-ui-gallery/types/TwentyUiGalleryPlayFunction';+import { type TwentyUiGalleryStory } from '@/__stories__/twenty-ui-gallery/types/TwentyUiGalleryStory';+import { getBuiltStoryComponentPathForRender } from '@/__stories__/utils/getBuiltStoryComponentPathForRender';++type CreateGalleryStoryOptions = {+ frontComponentBundleName: string;+ runtime: 'react' | 'preact';+ play: TwentyUiGalleryPlayFunction;+};++export const createGalleryStory = ({+ frontComponentBundleName,+ runtime,+ play,+}: CreateGalleryStoryOptions): TwentyUiGalleryStory => ({+ args: {+ componentUrl: getBuiltStoryComponentPathForRender(+ `${frontComponentBundleName}.front-component`,+ runtime,+ ),+ },+ play,+});diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createSandboxFailureTest.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createSandboxFailureTest.tsnew file mode 100644index 00000000000..4994770e39e--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/createSandboxFailureTest.ts@@ -0,0 +1,34 @@+import { userEvent, within } from 'storybook/test';++import { expectFrontComponentMounted } from '@/__stories__/shared/test-utils/matchers/expectFrontComponentMounted';+import { type SandboxErrorExpectation } from '@/__stories__/twenty-ui-gallery/types/SandboxErrorExpectation';+import { type TwentyUiGalleryPlayFunction } from '@/__stories__/twenty-ui-gallery/types/TwentyUiGalleryPlayFunction';+import { expectSandboxErrors } from '@/__stories__/twenty-ui-gallery/utils/expectSandboxErrors';++type CreateSandboxFailureTestOptions = SandboxErrorExpectation & {+ trigger:+ | { type: 'mount' }+ | {+ type: 'click';+ role: 'button' | 'combobox' | 'switch' | 'tab';+ name: string;+ };+};++export const createSandboxFailureTest =+ ({+ trigger,+ requiredErrors,+ allowedAdditionalErrors,+ }: CreateSandboxFailureTestOptions): TwentyUiGalleryPlayFunction =>+ async ({ canvasElement }) => {+ // Some failures prevent mounting; only interaction tests can await the card.+ if (trigger.type === 'click') {+ const canvas = within(canvasElement);+ await expectFrontComponentMounted(canvas);+ await userEvent.click(+ canvas.getByRole(trigger.role, { name: trigger.name }),+ );+ }+ await expectSandboxErrors({ requiredErrors, allowedAdditionalErrors });+ };diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/expectSandboxErrors.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/expectSandboxErrors.tsnew file mode 100644index 00000000000..42959ca59e9--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/expectSandboxErrors.ts@@ -0,0 +1,39 @@+import { isString } from '@sniptt/guards';+import { expect, waitFor } from 'storybook/test';++import { errorHandler } from '@/__stories__/shared/test-utils/createFrontComponentStoryMeta';+import { MOUNT_TIMEOUT } from '@/__stories__/shared/test-utils/timeouts';+import { type SandboxErrorExpectation } from '@/__stories__/twenty-ui-gallery/types/SandboxErrorExpectation';++const matchesErrorMessage = (message: unknown, pattern: string | RegExp) =>+ isString(message) &&+ (isString(pattern) ? message === pattern : message.search(pattern) !== -1);++// Worker errors may be coalesced by the host's error state; require the+// triggering failure and reject errors outside the documented sandbox gaps.+export const expectSandboxErrors = async ({+ requiredErrors,+ allowedAdditionalErrors = [],+}: SandboxErrorExpectation): Promise<void> => {+ const allowedErrors = [...requiredErrors, ...allowedAdditionalErrors];++ await waitFor(+ () => {+ const messages = errorHandler.mock.calls.map(([error]) => error?.message);+ const missingRequiredErrors = requiredErrors.filter(+ (pattern) =>+ !messages.some((message) => matchesErrorMessage(message, pattern)),+ );+ const unexpectedMessages = messages.filter(+ (message) =>+ !allowedErrors.some((pattern) =>+ matchesErrorMessage(message, pattern),+ ),+ );++ expect(missingRequiredErrors).toEqual([]);+ expect(unexpectedMessages).toEqual([]);+ },+ { timeout: MOUNT_TIMEOUT },+ );+};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.tsnew file mode 100644index 00000000000..e9d1a97b834--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/galleryRenderTests.ts@@ -0,0 +1,108 @@+import { expect, waitFor, within } from 'storybook/test';++import { errorHandler } from '@/__stories__/shared/test-utils/createFrontComponentStoryMeta';+import { expectFrontComponentMounted } from '@/__stories__/shared/test-utils/matchers/expectFrontComponentMounted';+import { MOUNT_TIMEOUT } from '@/__stories__/shared/test-utils/timeouts';+import { type TwentyUiGalleryPlayFunction } from '@/__stories__/twenty-ui-gallery/types/TwentyUiGalleryPlayFunction';+import { createGalleryRenderTest } from '@/__stories__/twenty-ui-gallery/utils/createGalleryRenderTest';++export const galleryRenderTest = createGalleryRenderTest({+ expectedFailedComponents: [],+});++// LinkChip crashes without a router context in the sandbox.+export const dataDisplayTest = createGalleryRenderTest({+ expectedFailedComponents: ['LinkChip'],+});++// Unselected radios need Element.matches(':disabled'); React radio groups+// also need compareDocumentPosition, which the sandbox DOM does not implement.+export const inputReactTest = createGalleryRenderTest({+ expectedFailedComponents: ['Radio', 'RadioGroup'],+});+export const inputPreactTest = createGalleryRenderTest({+ expectedFailedComponents: ['Radio'],+});++// react-router Links crash without a router context.+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 ({+ canvasElement,+}) => {+ const canvas = within(canvasElement);++ const codeEditor = await canvas.findByTestId(+ 'code-editor-component',+ {},+ { timeout: MOUNT_TIMEOUT },+ );++ await new Promise((resolve) => setTimeout(resolve, 5000));++ expect(codeEditor).toHaveAttribute('data-monaco-mount-state', 'pending');+};++export const themeTokenTest: TwentyUiGalleryPlayFunction = async ({+ canvasElement,+}) => {+ const canvas = within(canvasElement);++ const iconWrapper = await canvas.findByTestId(+ 'theme-token-icon-wrapper',+ {},+ { timeout: MOUNT_TIMEOUT },+ );++ await waitFor(() => {+ const iconBox = iconWrapper.getBoundingClientRect();++ expect(Math.round(iconBox.width)).toBe(16);+ expect(Math.round(iconBox.height)).toBe(16);+ });++ expect(errorHandler).not.toHaveBeenCalled();+};++export const displayHelpersTest: TwentyUiGalleryPlayFunction = async ({+ canvasElement,+}) => {+ const canvas = within(canvasElement);+ await expectFrontComponentMounted(canvas);++ const truncatedText = canvas.getByText(+ 'A long account name that should truncate',+ );+ const clampedText = canvas.getByText(/A longer account description/);++ expect(truncatedText.tagName).toBe('P');+ await waitFor(() => {+ expect(getComputedStyle(truncatedText).textOverflow).toBe('ellipsis');+ expect(truncatedText.scrollWidth).toBeGreaterThan(+ truncatedText.clientWidth,+ );+ expect(getComputedStyle(clampedText).webkitLineClamp).toBe('2');+ });+ expect(canvas.getByText('An overflowing reference number')).toBeVisible();+ expect(canvas.getByText('1234.5')).toBeVisible();+ expect(canvas.getByText('{"active":true}')).toBeVisible();+ expect(canvas.getByText('Account description')).toBeVisible();+ expect(canvas.getByText('Qualified')).toBeVisible();+ expect(errorHandler).not.toHaveBeenCalled();+};diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/sandboxFailureTests.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/sandboxFailureTests.tsnew file mode 100644index 00000000000..cd92bbfc453--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/sandboxFailureTests.ts@@ -0,0 +1,63 @@+import { SANDBOX_ERROR_PATTERNS } from '@/__stories__/twenty-ui-gallery/constants/SANDBOX_ERROR_PATTERNS';+import { createSandboxFailureTest } from '@/__stories__/twenty-ui-gallery/utils/createSandboxFailureTest';++// React cannot mount Tabs without compareDocumentPosition; Preact activation+// expects nativeEvent.composedPath, which the forwarded event lacks.+export const tabsReactTest = createSandboxFailureTest({+ trigger: { type: 'mount' },+ requiredErrors: [SANDBOX_ERROR_PATTERNS.DOCUMENT_POSITION],+});+export const tabsPreactTest = createSandboxFailureTest({+ trigger: { type: 'click', role: 'tab', name: 'Activity' },+ requiredErrors: [SANDBOX_ERROR_PATTERNS.COMPOSED_PATH],+ allowedAdditionalErrors: [SANDBOX_ERROR_PATTERNS.DOCUMENT_POSITION],+});++// Opening the popover requires viewport data absent from the sandbox.+export const popoverTest = createSandboxFailureTest({+ trigger: { type: 'click', role: 'button', name: 'Account details' },+ requiredErrors: [SANDBOX_ERROR_PATTERNS.VIEWPORT_WIDTH],+});++// Menu opening lacks viewport data and nativeEvent.pointerType.+export const menuTest = createSandboxFailureTest({+ trigger: { type: 'click', role: 'button', name: 'Account actions' },+ requiredErrors: [SANDBOX_ERROR_PATTERNS.POINTER_TYPE],+ allowedAdditionalErrors: [SANDBOX_ERROR_PATTERNS.VIEWPORT_WIDTH],+});++// Select opening lacks viewport data and nativeEvent.pointerType.+export const selectTest = createSandboxFailureTest({+ trigger: { type: 'click', role: 'combobox', name: 'Account stage' },+ requiredErrors: [SANDBOX_ERROR_PATTERNS.POINTER_TYPE],+ allowedAdditionalErrors: [+ SANDBOX_ERROR_PATTERNS.VIEWPORT_WIDTH,+ SANDBOX_ERROR_PATTERNS.COMPOSED_PATH,+ SANDBOX_ERROR_PATTERNS.DOCUMENT_POSITION,+ SANDBOX_ERROR_PATTERNS.ELEMENT_MATCHES,+ ],+});++// Opening the alert dialog requires viewport data absent from the sandbox.+export const alertDialogTest = createSandboxFailureTest({+ trigger: { type: 'click', role: 'button', name: 'Delete account' },+ requiredErrors: [SANDBOX_ERROR_PATTERNS.VIEWPORT_WIDTH],+});++// Switch activation constructs a PointerEvent, which the sandbox lacks.+export const switchTest = createSandboxFailureTest({+ trigger: { type: 'click', role: 'switch', name: 'Email notifications' },+ requiredErrors: [SANDBOX_ERROR_PATTERNS.POINTER_EVENT_CONSTRUCTOR],+});++// Ordering range slider thumbs requires compareDocumentPosition in both runtimes.+export const sliderRangeTest = createSandboxFailureTest({+ trigger: { type: 'mount' },+ requiredErrors: [SANDBOX_ERROR_PATTERNS.DOCUMENT_POSITION],+});++// React orders radio group descendants with compareDocumentPosition.+export const radioGroupReactTest = createSandboxFailureTest({+ trigger: { type: 'mount' },+ requiredErrors: [SANDBOX_ERROR_PATTERNS.DOCUMENT_POSITION],+});