The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Expose Collapsible parts (#27507)
Raphaël Bosi7a4ab9a12c2b
diff --git a/packages/twenty-docs/snippets/ui/generated/layout/collapsible.mdx b/packages/twenty-docs/snippets/ui/generated/layout/collapsible.mdxindex c3d320cbcd3..e61a3a3198a 100644--- a/packages/twenty-docs/snippets/ui/generated/layout/collapsible.mdx+++ b/packages/twenty-docs/snippets/ui/generated/layout/collapsible.mdx@@ -11,26 +11,94 @@* npx nx generate:ui twenty-docs*/}-<ParamField body="animationDurations" type="AnimationDurations" default="default">- Default theme timing or separate opacity and size durations in seconds.+### Collapsible.Root++<ParamField body="Root.className" type="string | ((state: CollapsibleRootState) => string | undefined)">+ CSS class applied to the element, or a function that+ returns a class based on the component's state.+</ParamField>++<ParamField body="Root.defaultOpen" type="boolean" default="false">+ Initial uncontrolled expansion state.+</ParamField>++<ParamField body="Root.disabled" type="boolean" default="false">+ Default disabled state inherited by the triggers in this root.+</ParamField>++<ParamField body="Root.onOpenChange" type="((open: boolean, eventDetails: CollapsibleRootChangeEventDetails) => void)">+ Called with the requested open state and cancelable Base UI event details.+</ParamField>++<ParamField body="Root.open" type="boolean">+ Controlled expansion state. Use defaultOpen for uncontrolled state.+</ParamField>++<ParamField body="Root.render" type="ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, CollapsibleRootState>">+ Replaces the root div. Forward the supplied props and ref.+</ParamField>++<ParamField body="Root.style" type="CSSProperties | ((state: CollapsibleRootState) => CSSProperties | undefined)">+ Style applied to the element, or a function that+ returns a style object based on the component's state.+</ParamField>++### Collapsible.Trigger++<ParamField body="Trigger.className" type="string | ((state: CollapsibleTriggerState) => string | undefined)">+ CSS class applied to the element, or a function that+ returns a class based on the component's state.</ParamField>-<ParamField body="children" type="ReactNode" required>- Content inside the expanding panel.+<ParamField body="Trigger.disabled" type="boolean">+ Disables this trigger.</ParamField>-<ParamField body="containAnimation" type="boolean" default="true">+<ParamField body="Trigger.nativeButton" type="boolean" default="true">+ Set to false when render replaces the native button with another element.+</ParamField>++<ParamField body="Trigger.render" type="ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, CollapsibleTriggerState>">+ Replaces the linked trigger button. Forward the supplied props and ref.+</ParamField>++<ParamField body="Trigger.style" type="CSSProperties | ((state: CollapsibleTriggerState) => CSSProperties | undefined)">+ Style applied to the element, or a function that+ returns a style object based on the component's state.+</ParamField>++### Collapsible.Panel++<ParamField body="Panel.className" type="string | ((state: CollapsiblePanelState) => string | undefined)">+ CSS class applied to the element, or a function that+ returns a class based on the component's state.+</ParamField>++<ParamField body="Panel.containAnimation" type="boolean" default="true">Clips overflowing content during expansion and uses a column layout.</ParamField>-<ParamField body="dimension" type=""height" | "width"" default="height">+<ParamField body="Panel.dimension" type=""height" | "width"" default="height">Dimension animated when the panel opens and closes.</ParamField>-<ParamField body="duration" type=""fast" | "instant" | "normal" | "slow"">- Theme timing preset for both opacity and size. Explicit `animationDurations` take precedence.+<ParamField body="Panel.duration" type=""fast" | "instant" | "normal" | "slow"" default="normal">+ Theme timing preset for both size and opacity. Native style can customize transition timing.+</ParamField>++<ParamField body="Panel.hiddenUntilFound" type="boolean" default="false">+ Uses hidden until-found so browser page search can reveal the contents. Overrides keepMounted.+</ParamField>++<ParamField body="Panel.keepMounted" type="boolean" default="false">+ Keeps the closed panel mounted and hidden, preserving local content state.+</ParamField>++<ParamField body="Panel.render" type="ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, CollapsiblePanelState>">+ Replaces the animated panel div. Forward the supplied props and ref.</ParamField>-<ParamField body="isExpanded" type="boolean" required>- Controlled visibility of the panel. The application owns the trigger and state.+<ParamField body="Panel.style" type="CSSProperties | ((state: CollapsiblePanelState) => CSSProperties | undefined)">+ Style applied to the element, or a function that+ returns a style object based on the component's state.</ParamField>diff --git a/packages/twenty-docs/ui/primitives/layout/collapsible.mdx b/packages/twenty-docs/ui/primitives/layout/collapsible.mdxindex 5d80ab3bfa2..af4c0711712 100644--- a/packages/twenty-docs/ui/primitives/layout/collapsible.mdx+++ b/packages/twenty-docs/ui/primitives/layout/collapsible.mdx@@ -1,25 +1,22 @@---title: Collapsible-description: Animate a controlled panel as it opens and closes.+description: Compose an accessible trigger and animated panel with controlled or uncontrolled expansion.---import { StoryEmbed } from '/snippets/ui/StoryEmbed.mdx';-import CollapsibleReference from '/snippets/ui/generated/layout/collapsible.mdx';-`Collapsible` animates the height or width of its content. The application owns its expanded state and trigger. There is no uncontrolled mode or built-in toggle.+`Collapsible` exposes Base UI's Root, Trigger, and Panel contracts. Root owns expansion state, Trigger supplies keyboard activation and the panel relationship, and Panel owns animation and content lifetime.## Anatomy```text-Application-├── Button (application-supplied trigger)-└── Collapsible+Collapsible.Root+├── Collapsible.Trigger+└── Collapsible.Panel└── Content```-`children` and `isExpanded` are required. The component supplies the collapsible root and animated panel internally. Supply the trigger separately and keep its `aria-expanded` value synchronized with `isExpanded`.-<StoryEmbedstoryId="ui-layout-collapsible--documentation"title="Collapsible example"@@ -28,37 +25,39 @@ Application## Usage```tsx-import { useState } from 'react';import { Button } from 'twenty-ui/primitives/input';import { Collapsible } from 'twenty-ui/primitives/layout';import { Text } from 'twenty-ui/primitives/typography';-export const ImportDetails = () => {- const [isExpanded, setIsExpanded] = useState(false);-- return (- <>- <Button- aria-expanded={isExpanded}- onClick={() => setIsExpanded((expanded) => !expanded)}- >- {isExpanded ? 'Hide import details' : 'Show import details'}- </Button>- <Collapsible isExpanded={isExpanded}>- <Text>Match each CSV column to a record field before importing.</Text>- </Collapsible>- </>- );-};+export const ImportDetails = () => (+ <Collapsible.Root defaultOpen>+ <Collapsible.Trigger render={<Button />}>+ Import details+ </Collapsible.Trigger>+ <Collapsible.Panel>+ <Text>Match each CSV column to a record field before importing.</Text>+ </Collapsible.Panel>+ </Collapsible.Root>+);```+Use `defaultOpen` for uncontrolled expansion. Use `open` and `onOpenChange` when the application owns the state. The callback receives the requested boolean and Base UI event details, including `reason`, `event`, and `cancel()`. Canceling a change preserves the current state. An externally controlled panel can omit Trigger when its state comes from another control or application condition.++Triggers inherit Root's `disabled` state and can override it with their own `disabled` prop. The native trigger supports Enter and Space and supplies `aria-expanded` and `aria-controls` automatically. Give each trigger a meaningful accessible name.++## Native customization++Root and Panel render a `div`; Trigger renders a `button`. Each part accepts native attributes, handlers, `className`, `style`, refs, and Base UI `render` composition. Class and style callbacks receive the part's state. Forward all supplied props and the ref from custom render components. Set `nativeButton={false}` when Trigger renders a non-button element.++Public types include `CollapsibleRootProps`, `CollapsibleTriggerProps`, `CollapsiblePanelProps`, the three part state types, and `CollapsibleRootChangeEventDetails` and `CollapsibleRootChangeEventReason`.+## Animation and content lifetime-The default dimension is `height`. Use `dimension="width"` for horizontal expansion. `containAnimation` defaults to `true`, clips overflow, and lays content out in a column. Turn it off when content needs to overflow during the transition.+Panel defaults to `dimension="height"`. Use `dimension="width"` for horizontal expansion and constrain the content's width when needed. `containAnimation` defaults to `true`, clips overflow, and lays content out in a column. Set it to `false` when content needs to overflow during the transition.-Use `duration` for a theme timing preset (`instant`, `fast`, `normal`, or `slow`). `animationDurations={{ opacity: 0.15, size: 0.25 }}` supplies independent durations in seconds and takes precedence over the preset.+Panel's `duration` chooses a theme preset (`instant`, `fast`, `normal`, or `slow`). For independent timings, use native `style={{ transitionDuration: '0.4s, 0.2s' }}`. The first duration controls size and the second controls opacity. Reduced-motion preferences disable the transitions, including custom timings.-The panel unmounts its content after closing. Keep state that must survive closing outside the panel. The component does not forward native attributes or refs to its internal panel; keep focus handling and trigger relationships in the application.+Panel unmounts after closing by default. Use `keepMounted` to preserve local content state while hiding the closed panel. `hiddenUntilFound` lets browser page search reveal closed content and takes precedence over `keepMounted`.## Propsdiff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/collapsible-example.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/collapsible-example.tsxnew file mode 100644index 00000000000..3860dd9e9b5--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/collapsible-example.tsx@@ -0,0 +1,80 @@+import { createElement, useState } from 'react';+import { Button } from 'twenty-ui/primitives/input';+import { Collapsible } from 'twenty-ui/primitives/layout';+import { Text } from 'twenty-ui/primitives/typography';++export const CollapsibleExample = () => {+ const [open, setOpen] = useState(false);+ const [changeCount, setChangeCount] = useState(0);+ const [reason, setReason] = useState('none');+ const [clickCount, setClickCount] = useState(0);++ return (+ <>+ <Collapsible.Root+ open={open}+ onOpenChange={(nextOpen, details) => {+ setOpen(nextOpen);+ setReason(details.reason);+ setChangeCount((count) => count + 1);+ }}+ aria-label="Controlled collapsible"+ ref={(element) => {+ element?.setAttribute('data-ref-target', 'collapsible-root');+ }}+ render={<section />}+ >+ <Button onClick={() => setOpen(!open)}>+ Toggle controlled details+ </Button>+ <Collapsible.Trigger+ render={<Button />}+ onClick={() => setClickCount((count) => count + 1)}+ ref={(element) => {+ element?.setAttribute('data-ref-target', 'collapsible-trigger');+ }}+ >+ Controlled details+ </Collapsible.Trigger>+ <Collapsible.Panel+ id="controlled-collapsible-panel"+ keepMounted+ duration="fast"+ aria-label="Controlled panel"+ className={(state) => (state.open ? 'open-panel' : 'closed-panel')}+ style={(state) => ({ padding: state.open ? 7 : 0 })}+ ref={(element) => {+ element?.setAttribute('data-ref-target', 'collapsible-panel');+ }}+ render={(props, state) =>+ createElement('article', {+ ...props,+ 'data-render-open': String(state.open),+ })+ }+ >+ <Text>Controlled expandable content</Text>+ </Collapsible.Panel>+ </Collapsible.Root>+ <Text>+ Changes: {changeCount}, reason: {reason}, clicks: {clickCount}+ </Text>+ <Collapsible.Root defaultOpen>+ <Collapsible.Trigger render={<Button />}>+ Uncontrolled details+ </Collapsible.Trigger>+ <Collapsible.Panel>+ <Text>Uncontrolled expandable content</Text>+ </Collapsible.Panel>+ </Collapsible.Root>+ <Collapsible.Root disabled>+ <Collapsible.Trigger render={<Button />}>+ Disabled details+ </Collapsible.Trigger>+ <Collapsible.Panel>+ <Text>Disabled expandable content</Text>+ </Collapsible.Panel>+ </Collapsible.Root>+ </>+ );+};diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-layout-gallery.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-layout-gallery.front-component.tsxindex 2894c76379a..703e3c0f699 100644--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-layout-gallery.front-component.tsx+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-layout-gallery.front-component.tsx@@ -1,6 +1,6 @@import { defineFrontComponent } from 'twenty-sdk/define';import 'twenty-ui/style.css';-import { Collapsible } from 'twenty-ui/primitives/layout';+import { CollapsibleExample } from './collapsible-example';import { ThemeProvider } from 'twenty-ui/theme';import { SeparatorExample } from './separator-example';import { ResizeHandleExample } from './resize-handle-example';@@ -14,7 +14,7 @@ import {const LAYOUT_ENTRIES: GalleryEntry[] = [{name: 'Collapsible',- node: <Collapsible isExpanded={true}>Expandable</Collapsible>,+ node: <CollapsibleExample />,},{name: 'AnimatedIconCrossfade',diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/collapsibleTest.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/collapsibleTest.tsnew file mode 100644index 00000000000..d2a4acc7333--- /dev/null+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/collapsibleTest.ts@@ -0,0 +1,83 @@+import { expect, userEvent, waitFor, within } from 'storybook/test';++import { MOUNT_TIMEOUT } from '@/__stories__/shared/test-utils/timeouts';+import { type TwentyUiGalleryPlayFunction } from '@/__stories__/twenty-ui-gallery/types/TwentyUiGalleryPlayFunction';++export const collapsibleTest: TwentyUiGalleryPlayFunction = async ({+ canvasElement,+}) => {+ const canvas = within(canvasElement);+ const trigger = await canvas.findByRole(+ 'button',+ { name: 'Controlled details' },+ { timeout: MOUNT_TIMEOUT },+ );+ const root = canvas.getByRole('region', { name: 'Controlled collapsible' });+ const panel = within(root).getByRole('article', { hidden: true });+ expect(root.tagName).toBe('SECTION');+ expect(root).toHaveAttribute('data-ref-target', 'collapsible-root');+ expect(trigger).toHaveAttribute('data-ref-target', 'collapsible-trigger');+ expect(panel).toHaveAttribute('data-ref-target', 'collapsible-panel');+ expect(trigger).toHaveAttribute('aria-expanded', 'false');+ expect(panel).not.toBeVisible();+ expect(panel.getBoundingClientRect().height).toBe(0);++ await userEvent.click(trigger);+ await waitFor(() => {+ expect(trigger).toHaveAttribute('aria-expanded', 'true');+ expect(trigger).toHaveAttribute('aria-controls', panel.id);+ expect(panel).toBeVisible();+ expect(canvas.getByRole('article', { name: 'Controlled panel' })).toBe(+ panel,+ );+ expect(panel).toHaveClass('open-panel');+ expect(panel).toHaveAttribute('data-render-open', 'true');+ expect(panel).toHaveStyle({ padding: '7px' });+ expect(+ canvas.getByText('Changes: 1, reason: trigger-press, clicks: 1'),+ ).toBeVisible();+ });++ await userEvent.keyboard(' ');+ await waitFor(() => {+ expect(trigger).toHaveAttribute('aria-expanded', 'false');+ expect(panel).not.toBeVisible();+ expect(panel.getBoundingClientRect().height).toBe(0);+ expect(+ canvas.getByText('Changes: 2, reason: trigger-press, clicks: 2'),+ ).toBeVisible();+ });++ await userEvent.click(+ canvas.getByRole('button', { name: 'Toggle controlled details' }),+ );+ await waitFor(() => expect(panel).toBeVisible());+ expect(trigger).toHaveAttribute('aria-expanded', 'true');+ expect(+ canvas.getByText('Changes: 2, reason: trigger-press, clicks: 2'),+ ).toBeVisible();++ const uncontrolled = canvas.getByRole('button', {+ name: 'Uncontrolled details',+ });+ expect(uncontrolled).toHaveAttribute('aria-expanded', 'true');+ await userEvent.click(uncontrolled);+ await waitFor(() =>+ expect(+ canvas.queryByText('Uncontrolled expandable content'),+ ).not.toBeInTheDocument(),+ );+ await userEvent.keyboard('{Enter}');+ await waitFor(() =>+ expect(canvas.getByText('Uncontrolled expandable content')).toBeVisible(),+ );+ expect(uncontrolled).toHaveAttribute('aria-expanded', 'true');++ const disabled = canvas.getByRole('button', { name: 'Disabled details' });+ expect(disabled).toHaveAttribute('aria-disabled', 'true');+ await userEvent.click(disabled);+ expect(disabled).toHaveAttribute('aria-expanded', 'false');+ expect(+ canvas.queryByText('Disabled expandable content'),+ ).not.toBeInTheDocument();+};diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/layoutTest.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/layoutTest.tsindex ca013caa72a..945c60f254a 100644--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/layoutTest.ts+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/layoutTest.ts@@ -1,9 +1,11 @@import { expect, userEvent, waitFor, within } from 'storybook/test';import { type TwentyUiGalleryPlayFunction } from '@/__stories__/twenty-ui-gallery/types/TwentyUiGalleryPlayFunction';+import { collapsibleTest } from '@/__stories__/twenty-ui-gallery/utils/collapsibleTest';import { resizeHandleTest } from '@/__stories__/twenty-ui-gallery/utils/resizeHandleTest';export const layoutTest: TwentyUiGalleryPlayFunction = async (context) => {+ await collapsibleTest(context);await resizeHandleTest(context);const canvas = within(context.canvasElement);const horizontal = canvas.getByRole('separator', {diff --git a/packages/twenty-front-component-renderer/src/constants/HtmlCommonProperties.ts b/packages/twenty-front-component-renderer/src/constants/HtmlCommonProperties.tsindex afa6e1a0b64..af97b9f8f97 100644--- a/packages/twenty-front-component-renderer/src/constants/HtmlCommonProperties.ts+++ b/packages/twenty-front-component-renderer/src/constants/HtmlCommonProperties.ts@@ -7,6 +7,7 @@ export const HTML_COMMON_PROPERTIES: Record<string, PropertySchema> = {style: { type: 'string', optional: true },title: { type: 'string', optional: true },tabIndex: { type: 'number', optional: true },+ hidden: { type: 'boolean', optional: true },role: { type: 'string', optional: true },'aria-label': { type: 'string', optional: true },'aria-hidden': { type: 'boolean', optional: true },diff --git a/packages/twenty-front-component-renderer/src/remote/generated/remote-elements.ts b/packages/twenty-front-component-renderer/src/remote/generated/remote-elements.tsindex 590f978004b..4adcef93245 100644--- a/packages/twenty-front-component-renderer/src/remote/generated/remote-elements.ts+++ b/packages/twenty-front-component-renderer/src/remote/generated/remote-elements.ts@@ -15,6 +15,7 @@ export type HtmlCommonProperties = {style?: string;title?: string;tabIndex?: number;+ hidden?: boolean;role?: string;'aria-label'?: string;'aria-hidden'?: boolean;@@ -138,6 +139,7 @@ const HTML_COMMON_PROPERTIES_CONFIG = {style: { type: String },title: { type: String },tabIndex: { type: Number },+ hidden: { type: Boolean },role: { type: String },'aria-label': { type: String },'aria-hidden': { type: Boolean },diff --git a/packages/twenty-front/src/modules/activities/emails/components/EmailThreadMessageBody.tsx b/packages/twenty-front/src/modules/activities/emails/components/EmailThreadMessageBody.tsxindex 5198648f9ee..ae04df8a2e3 100644--- a/packages/twenty-front/src/modules/activities/emails/components/EmailThreadMessageBody.tsx+++ b/packages/twenty-front/src/modules/activities/emails/components/EmailThreadMessageBody.tsx@@ -33,17 +33,19 @@ export const EmailThreadMessageBody = ({isDisplayed,}: EmailThreadMessageBodyProps) => {return (- <Collapsible isExpanded={isDisplayed} duration="fast">- <StyledThreadMessageBody>- <Linkify- options={{- target: '_blank',- rel: 'noopener noreferrer',- }}- >- {body}- </Linkify>- </StyledThreadMessageBody>- </Collapsible>+ <Collapsible.Root open={isDisplayed}>+ <Collapsible.Panel duration="fast">+ <StyledThreadMessageBody>+ <Linkify+ options={{+ target: '_blank',+ rel: 'noopener noreferrer',+ }}+ >+ {body}+ </Linkify>+ </StyledThreadMessageBody>+ </Collapsible.Panel>+ </Collapsible.Root>);};diff --git a/packages/twenty-front/src/modules/ai/components/AgentOutputSchemaBuilder.tsx b/packages/twenty-front/src/modules/ai/components/AgentOutputSchemaBuilder.tsxindex 2f4dec2b882..4d27cf6593d 100644--- a/packages/twenty-front/src/modules/ai/components/AgentOutputSchemaBuilder.tsx+++ b/packages/twenty-front/src/modules/ai/components/AgentOutputSchemaBuilder.tsx@@ -163,45 +163,47 @@ export const AgentOutputSchemaBuilder = ({: undefined}/>- <Collapsible isExpanded={isExpanded}>- <StyledSettingsContent>- <FormFieldInputContainer>- <FormTextFieldInput- label={t`Variable Name`}- placeholder={t`e.g., summary, status, count`}- defaultValue={field.name}- error={getVariableNameError(field.name)}- onChange={(value) =>- updateField(field.id, { name: value.trim() })- }- readonly={readonly}- />- </FormFieldInputContainer>-- <FormFieldInputContainer>- <AgentOutputFieldTypeSelector- onChange={(value) =>- updateField(field.id, { type: value })- }- value={field.type}- disabled={readonly}- dropdownId={`output-field-type-selector-${field.id}`}- />- </FormFieldInputContainer>-- <FormFieldInputContainer>- <FormTextFieldInput- label={t`Instruction for AI`}- placeholder={t`Brief explanation of this output field`}- defaultValue={field.description}- onChange={(value) =>- updateField(field.id, { description: value })- }- readonly={readonly}- />- </FormFieldInputContainer>- </StyledSettingsContent>- </Collapsible>+ <Collapsible.Root open={isExpanded}>+ <Collapsible.Panel>+ <StyledSettingsContent>+ <FormFieldInputContainer>+ <FormTextFieldInput+ label={t`Variable Name`}+ placeholder={t`e.g., summary, status, count`}+ defaultValue={field.name}+ error={getVariableNameError(field.name)}+ onChange={(value) =>+ updateField(field.id, { name: value.trim() })+ }+ readonly={readonly}+ />+ </FormFieldInputContainer>++ <FormFieldInputContainer>+ <AgentOutputFieldTypeSelector+ onChange={(value) =>+ updateField(field.id, { type: value })+ }+ value={field.type}+ disabled={readonly}+ dropdownId={`output-field-type-selector-${field.id}`}+ />+ </FormFieldInputContainer>++ <FormFieldInputContainer>+ <FormTextFieldInput+ label={t`Instruction for AI`}+ placeholder={t`Brief explanation of this output field`}+ defaultValue={field.description}+ onChange={(value) =>+ updateField(field.id, { description: value })+ }+ readonly={readonly}+ />+ </FormFieldInputContainer>+ </StyledSettingsContent>+ </Collapsible.Panel>+ </Collapsible.Root></StyledOutputSchemaFieldContainer>);})}diff --git a/packages/twenty-front/src/modules/ai/components/CodeExecutionDisplay.tsx b/packages/twenty-front/src/modules/ai/components/CodeExecutionDisplay.tsxindex 967fe93276c..ff4710cebda 100644--- a/packages/twenty-front/src/modules/ai/components/CodeExecutionDisplay.tsx+++ b/packages/twenty-front/src/modules/ai/components/CodeExecutionDisplay.tsx@@ -248,20 +248,22 @@ export const CodeExecutionDisplay = ({)}</StyledHeaderRight></StyledSectionHeader>- <Collapsible isExpanded={isCodeExpanded}>- <StyledCodeEditorContainer>- <CodeEditor- value={code}- language="python"- height="300px"- options={{- readOnly: true,- domReadOnly: true,- minimap: { enabled: false },- }}- />- </StyledCodeEditorContainer>- </Collapsible>+ <Collapsible.Root open={isCodeExpanded}>+ <Collapsible.Panel>+ <StyledCodeEditorContainer>+ <CodeEditor+ value={code}+ language="python"+ height="300px"+ options={{+ readOnly: true,+ domReadOnly: true,+ minimap: { enabled: false },+ }}+ />+ </StyledCodeEditorContainer>+ </Collapsible.Panel>+ </Collapsible.Root></StyledSection>{(hasOutput || isRunning) && (@@ -276,13 +278,15 @@ export const CodeExecutionDisplay = ({<IconChevronDown size={theme.icon.size.sm} />)}</StyledSectionHeader>- <Collapsible isExpanded={isOutputExpanded}>- <TerminalOutput- stdout={stdout}- stderr={stderr}- isRunning={isRunning}- />- </Collapsible>+ <Collapsible.Root open={isOutputExpanded}>+ <Collapsible.Panel>+ <TerminalOutput+ stdout={stdout}+ stderr={stderr}+ isRunning={isRunning}+ />+ </Collapsible.Panel>+ </Collapsible.Root></StyledSection>)}@@ -301,43 +305,48 @@ export const CodeExecutionDisplay = ({<IconChevronDown size={theme.icon.size.sm} />)}</StyledSectionHeader>- <Collapsible isExpanded={isFilesExpanded}>- <StyledFilesGrid>- {files.map((file) => {- const filename = file.filename;+ <Collapsible.Root open={isFilesExpanded}>+ <Collapsible.Panel>+ <StyledFilesGrid>+ {files.map((file) => {+ const filename = file.filename;- return (- <StyledFileCard key={file.fileId}>- <StyledFilePreview>- {isPreviewableMimeType(file.mimeType) ? (- <StyledPreviewImage- src={file.url}- alt={filename}- loading="lazy"- />- ) : (- <IconFile size={48} color={theme.font.color.tertiary} />- )}- </StyledFilePreview>- <StyledFileInfo>- <StyledFileName title={filename}>- {filename}- </StyledFileName>- <StyledDownloadLink- href={file.url}- download={filename}- title={t`Download ${filename}`}- target="_blank"- rel="noopener noreferrer"- >- <IconDownload size={theme.icon.size.sm} />- </StyledDownloadLink>- </StyledFileInfo>- </StyledFileCard>- );- })}- </StyledFilesGrid>- </Collapsible>+ return (+ <StyledFileCard key={file.fileId}>+ <StyledFilePreview>+ {isPreviewableMimeType(file.mimeType) ? (+ <StyledPreviewImage+ src={file.url}+ alt={filename}+ loading="lazy"+ />+ ) : (+ <IconFile+ size={48}+ color={theme.font.color.tertiary}+ />+ )}+ </StyledFilePreview>+ <StyledFileInfo>+ <StyledFileName title={filename}>+ {filename}+ </StyledFileName>+ <StyledDownloadLink+ href={file.url}+ download={filename}+ title={t`Download ${filename}`}+ target="_blank"+ rel="noopener noreferrer"+ >+ <IconDownload size={theme.icon.size.sm} />+ </StyledDownloadLink>+ </StyledFileInfo>+ </StyledFileCard>+ );+ })}+ </StyledFilesGrid>+ </Collapsible.Panel>+ </Collapsible.Root></StyledSection>)}</StyledContainer>diff --git a/packages/twenty-front/src/modules/ai/components/ThinkingToolStepRow.tsx b/packages/twenty-front/src/modules/ai/components/ThinkingToolStepRow.tsxindex 43f39e34941..392d8911efe 100644--- a/packages/twenty-front/src/modules/ai/components/ThinkingToolStepRow.tsx+++ b/packages/twenty-front/src/modules/ai/components/ThinkingToolStepRow.tsx@@ -242,55 +242,59 @@ export const ThinkingToolStepRow = ({</StyledToolRowButton>{isExpandable && (- <Collapsible isExpanded={isExpanded}>- <StyledToolDetailsContainer>- {isNonEmptyArray(recordReferences) && (- <StyledToolRecordsContainer>- <ToolRecordsWidget- message={recordsMessage ?? ''}- recordReferences={recordReferences}- />- </StyledToolRecordsContainer>- )}- {hasError ? (- <StyledToolErrorText>{part.errorText}</StyledToolErrorText>- ) : (- <TabListRoot componentInstanceId={toolTabListComponentInstanceId}>- <StyledToolDetailsContent>- <StyledToolTabListContainer>- <TabList- aria-label={t`Tool details: ${displayMessage}`}- tabs={toolTabs}- behaveAsLinks={false}- componentInstanceId={toolTabListComponentInstanceId}- />- </StyledToolTabListContainer>- <Tabs.Panel- value={activeTab}- render={<StyledToolJsonContent />}- >- <StyledJsonTreeContainer>- <JsonTree- value={- (activeTab === 'output'- ? toolOutput- : toolInput) as JsonValue- }- shouldExpandNodeInitially={() => false}- emptyArrayLabel={t`Empty Array`}- emptyObjectLabel={t`Empty Object`}- emptyStringLabel={t`[empty string]`}- arrowButtonCollapsedLabel={t`Expand`}- arrowButtonExpandedLabel={t`Collapse`}- onNodeValueClick={copyToClipboard}+ <Collapsible.Root open={isExpanded}>+ <Collapsible.Panel>+ <StyledToolDetailsContainer>+ {isNonEmptyArray(recordReferences) && (+ <StyledToolRecordsContainer>+ <ToolRecordsWidget+ message={recordsMessage ?? ''}+ recordReferences={recordReferences}+ />+ </StyledToolRecordsContainer>+ )}+ {hasError ? (+ <StyledToolErrorText>{part.errorText}</StyledToolErrorText>+ ) : (+ <TabListRoot+ componentInstanceId={toolTabListComponentInstanceId}+ >+ <StyledToolDetailsContent>+ <StyledToolTabListContainer>+ <TabList+ aria-label={t`Tool details: ${displayMessage}`}+ tabs={toolTabs}+ behaveAsLinks={false}+ componentInstanceId={toolTabListComponentInstanceId}/>- </StyledJsonTreeContainer>- </Tabs.Panel>- </StyledToolDetailsContent>- </TabListRoot>- )}- </StyledToolDetailsContainer>- </Collapsible>+ </StyledToolTabListContainer>+ <Tabs.Panel+ value={activeTab}+ render={<StyledToolJsonContent />}+ >+ <StyledJsonTreeContainer>+ <JsonTree+ value={+ (activeTab === 'output'+ ? toolOutput+ : toolInput) as JsonValue+ }+ shouldExpandNodeInitially={() => false}+ emptyArrayLabel={t`Empty Array`}+ emptyObjectLabel={t`Empty Object`}+ emptyStringLabel={t`[empty string]`}+ arrowButtonCollapsedLabel={t`Expand`}+ arrowButtonExpandedLabel={t`Collapse`}+ onNodeValueClick={copyToClipboard}+ />+ </StyledJsonTreeContainer>+ </Tabs.Panel>+ </StyledToolDetailsContent>+ </TabListRoot>+ )}+ </StyledToolDetailsContainer>+ </Collapsible.Panel>+ </Collapsible.Root>)}</StyledToolRowContainer>);diff --git a/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolderLayout.tsx b/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolderLayout.tsxindex c759c9434ca..9e6ff89261d 100644--- a/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolderLayout.tsx+++ b/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolderLayout.tsx@@ -30,13 +30,11 @@ export const NavigationMenuItemFolderLayout = ({<NavigationDrawerItemsCollapsableContainer isGroup={isGroup}>{header}<StyledFolderExpandableWrapper>- <Collapsible- isExpanded={isExpandedForAnimation}- dimension="height"- containAnimation- >- {children}- </Collapsible>+ <Collapsible.Root open={isExpandedForAnimation}>+ <Collapsible.Panel dimension="height" containAnimation>+ {children}+ </Collapsible.Panel>+ </Collapsible.Root></StyledFolderExpandableWrapper></NavigationDrawerItemsCollapsableContainer>);diff --git a/packages/twenty-front/src/modules/navigation-menu-item/display/sections/components/NavigationDrawerOpenedSection.tsx b/packages/twenty-front/src/modules/navigation-menu-item/display/sections/components/NavigationDrawerOpenedSection.tsxindex 64286ccbd32..c53437c2cd6 100644--- a/packages/twenty-front/src/modules/navigation-menu-item/display/sections/components/NavigationDrawerOpenedSection.tsx+++ b/packages/twenty-front/src/modules/navigation-menu-item/display/sections/components/NavigationDrawerOpenedSection.tsx@@ -22,11 +22,13 @@ export const NavigationDrawerOpenedSection = () => {}return (- <Collapsible isExpanded>- <NavigationDrawerSectionForObjectMetadataItems- sectionTitle={t`Opened`}- objectMetadataItems={[objectMetadataItem]}- />- </Collapsible>+ <Collapsible.Root open>+ <Collapsible.Panel>+ <NavigationDrawerSectionForObjectMetadataItems+ sectionTitle={t`Opened`}+ objectMetadataItems={[objectMetadataItem]}+ />+ </Collapsible.Panel>+ </Collapsible.Root>);};diff --git a/packages/twenty-front/src/modules/navigation-menu-item/display/sections/components/NavigationMenuItemSection.tsx b/packages/twenty-front/src/modules/navigation-menu-item/display/sections/components/NavigationMenuItemSection.tsxindex 7a1552f767f..9fe34977233 100644--- a/packages/twenty-front/src/modules/navigation-menu-item/display/sections/components/NavigationMenuItemSection.tsx+++ b/packages/twenty-front/src/modules/navigation-menu-item/display/sections/components/NavigationMenuItemSection.tsx@@ -27,13 +27,11 @@ export const NavigationMenuItemSection = ({contentWrapper,}: NavigationMenuItemSectionProps) => {const content = (- <Collapsible- isExpanded={isOpen || forceExpanded}- dimension="height"- containAnimation- >- {children}- </Collapsible>+ <Collapsible.Root open={isOpen || forceExpanded}>+ <Collapsible.Panel dimension="height" containAnimation>+ {children}+ </Collapsible.Panel>+ </Collapsible.Root>);return (diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCard.tsx b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCard.tsxindex 0a3f547fa4d..336f9acf4c4 100644--- a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCard.tsx+++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCard.tsx@@ -132,11 +132,13 @@ export const RecordBoardCard = () => {isDragging={!isDragOverlay && isRecordIdSecondaryDragMultiple}><RecordBoardCardHeader />- <Collapsible- isExpanded={recordBoardCardIsExpanded || !isCompactModeActive}+ <Collapsible.Root+ open={recordBoardCardIsExpanded || !isCompactModeActive}>- <RecordBoardCardBody />- </Collapsible>+ <Collapsible.Panel>+ <RecordBoardCardBody />+ </Collapsible.Panel>+ </Collapsible.Root></RecordCard></StyledCardContainer>{!isDragOverlay && (diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/components/RecordCalendarCard.tsx b/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/components/RecordCalendarCard.tsxindex cf122f7b039..82e024f81ff 100644--- a/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/components/RecordCalendarCard.tsx+++ b/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/components/RecordCalendarCard.tsx@@ -100,13 +100,15 @@ export const RecordCalendarCard = ({isDragging={!isDragOverlay && isRecordIdSecondaryDragMultiple}><RecordCalendarCardHeader recordId={recordId} />- <Collapsible isExpanded={!isCompactModeActive}>- <RecordCalendarCardBody- recordId={recordId}- calendarDay={calendarDay}- isRecordReadOnly={false}- />- </Collapsible>+ <Collapsible.Root open={!isCompactModeActive}>+ <Collapsible.Panel>+ <RecordCalendarCardBody+ recordId={recordId}+ calendarDay={calendarDay}+ isRecordReadOnly={false}+ />+ </Collapsible.Panel>+ </Collapsible.Root></RecordCard></StyledCardContainer></StyledRecordCardContainer>diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/components/__tests__/RecordCalendarCard.test.tsx b/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/components/__tests__/RecordCalendarCard.test.tsxindex fa353653954..3e3104559ca 100644--- a/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/components/__tests__/RecordCalendarCard.test.tsx+++ b/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/components/__tests__/RecordCalendarCard.test.tsx@@ -64,13 +64,11 @@ jest.mock('@/object-record/record-card/components/RecordCard', () => ({),}));jest.mock('twenty-ui/primitives/layout', () => ({- Collapsible: ({- children,- isExpanded,- }: {- children: React.ReactNode;- isExpanded: boolean;- }) => (isExpanded ? children : null),+ Collapsible: {+ Root: ({ children, open }: { children: React.ReactNode; open: boolean }) =>+ open ? children : null,+ Panel: ({ children }: { children: React.ReactNode }) => children,+ },}));describe('RecordCalendarCard', () => {diff --git a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationRecordsListItem.tsx b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationRecordsListItem.tsxindex e7266f5aae4..9f174b9e86a 100644--- a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationRecordsListItem.tsx+++ b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationRecordsListItem.tsx@@ -260,17 +260,19 @@ export const RecordDetailRelationRecordsListItem = ({</DropdownRoot>)}</RecordDetailRecordsListItemContainer>- <Collapsible containAnimation={false} isExpanded={isExpanded}>- <RecordFieldList- instanceId={`${scopeInstanceId}-relation-${relationRecord.id}`}- objectNameSingular={relationObjectMetadataNameSingular}- objectRecordId={relationRecord.id}- showDuplicatesSection={false}- showRelationSections={false}- excludeCreatedAtAndUpdatedAt={true}- excludeFieldMetadataIds={[relationFieldMetadataId]}- />- </Collapsible>+ <Collapsible.Root open={isExpanded}>+ <Collapsible.Panel containAnimation={false}>+ <RecordFieldList+ instanceId={`${scopeInstanceId}-relation-${relationRecord.id}`}+ objectNameSingular={relationObjectMetadataNameSingular}+ objectRecordId={relationRecord.id}+ showDuplicatesSection={false}+ showRelationSections={false}+ excludeCreatedAtAndUpdatedAt={true}+ excludeFieldMetadataIds={[relationFieldMetadataId]}+ />+ </Collapsible.Panel>+ </Collapsible.Root>{createPortal(<ConfirmationDialogdialogId={getDeleteRelationModalId(relationRecord.id)}diff --git a/packages/twenty-front/src/modules/page-layout/widgets/fields/components/FieldsWidgetGroupContainer.tsx b/packages/twenty-front/src/modules/page-layout/widgets/fields/components/FieldsWidgetGroupContainer.tsxindex 3ba43308ddc..3471ca6bc7e 100644--- a/packages/twenty-front/src/modules/page-layout/widgets/fields/components/FieldsWidgetGroupContainer.tsx+++ b/packages/twenty-front/src/modules/page-layout/widgets/fields/components/FieldsWidgetGroupContainer.tsx@@ -55,7 +55,9 @@ export const FieldsWidgetGroupContainer = ({/></StyledChevronWrapper></StyledHeader>- <Collapsible isExpanded={isExpanded}>{children}</Collapsible>+ <Collapsible.Root open={isExpanded}>+ <Collapsible.Panel>{children}</Collapsible.Panel>+ </Collapsible.Root></Section.Root>);};diff --git a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminChatCollapsibleSection.tsx b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminChatCollapsibleSection.tsxindex e0fecf6062a..4f4301bd048 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminChatCollapsibleSection.tsx+++ b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminChatCollapsibleSection.tsx@@ -40,21 +40,20 @@ export const SettingsAdminChatCollapsibleSection = ({const [isExpanded, setIsExpanded] = useState(defaultExpanded);return (- <StyledContainer>- <StyledToggleButton- aria-expanded={isExpanded}- onClick={() =>- setIsExpanded((previousIsExpanded) => !previousIsExpanded)- }- >+ <Collapsible.Root+ open={isExpanded}+ onOpenChange={setIsExpanded}+ render={<StyledContainer />}+ >+ <Collapsible.Trigger render={<StyledToggleButton />}>{label}{isExpanded ? (<IconChevronUp size={14} />) : (<IconChevronDown size={14} />)}- </StyledToggleButton>- <Collapsible isExpanded={isExpanded}>{children}</Collapsible>- </StyledContainer>+ </Collapsible.Trigger>+ <Collapsible.Panel>{children}</Collapsible.Panel>+ </Collapsible.Root>);};diff --git a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminChatToolCallPart.tsx b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminChatToolCallPart.tsxindex e91d8bf4fe4..a50b79cf7eb 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminChatToolCallPart.tsx+++ b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminChatToolCallPart.tsx@@ -136,43 +136,45 @@ export const SettingsAdminChatToolCallPart = ({)}</StyledRightContent></StyledToggleRow>- <Collapsible isExpanded={isExpanded}>- <StyledTabContainer>- <StyledTab- isActive={activeTab === 'output'}- onClick={() => setActiveTab('output')}- >- {t`Output`}- </StyledTab>- <StyledTab- isActive={activeTab === 'input'}- onClick={() => setActiveTab('input')}- >- {t`Input`}- </StyledTab>- </StyledTabContainer>- {isDefined(activeJsonValue) ? (- <StyledJsonTreeContainer>- <JsonTree- value={activeJsonValue}- shouldExpandNodeInitially={() => false}- emptyArrayLabel={t`Empty Array`}- emptyObjectLabel={t`Empty Object`}- emptyStringLabel={t`[empty string]`}- arrowButtonCollapsedLabel={t`Expand`}- arrowButtonExpandedLabel={t`Collapse`}- onNodeValueClick={copyToClipboard}- />- </StyledJsonTreeContainer>- ) : (- <StyledEmptyTabLabel>- {activeTab === 'output' ? t`No output` : t`No input`}- </StyledEmptyTabLabel>- )}- {isNonEmptyString(part.errorMessage) && (- <StyledErrorMessage>{part.errorMessage}</StyledErrorMessage>- )}- </Collapsible>+ <Collapsible.Root open={isExpanded}>+ <Collapsible.Panel>+ <StyledTabContainer>+ <StyledTab+ isActive={activeTab === 'output'}+ onClick={() => setActiveTab('output')}+ >+ {t`Output`}+ </StyledTab>+ <StyledTab+ isActive={activeTab === 'input'}+ onClick={() => setActiveTab('input')}+ >+ {t`Input`}+ </StyledTab>+ </StyledTabContainer>+ {isDefined(activeJsonValue) ? (+ <StyledJsonTreeContainer>+ <JsonTree+ value={activeJsonValue}+ shouldExpandNodeInitially={() => false}+ emptyArrayLabel={t`Empty Array`}+ emptyObjectLabel={t`Empty Object`}+ emptyStringLabel={t`[empty string]`}+ arrowButtonCollapsedLabel={t`Expand`}+ arrowButtonExpandedLabel={t`Collapse`}+ onNodeValueClick={copyToClipboard}+ />+ </StyledJsonTreeContainer>+ ) : (+ <StyledEmptyTabLabel>+ {activeTab === 'output' ? t`No output` : t`No input`}+ </StyledEmptyTabLabel>+ )}+ {isNonEmptyString(part.errorMessage) && (+ <StyledErrorMessage>{part.errorMessage}</StyledErrorMessage>+ )}+ </Collapsible.Panel>+ </Collapsible.Root></StyledContainer>);};diff --git a/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminJobDetailsExpandable.tsx b/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminJobDetailsExpandable.tsxindex e653fbf935d..69739dd933b 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminJobDetailsExpandable.tsx+++ b/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminJobDetailsExpandable.tsx@@ -73,65 +73,69 @@ export const SettingsAdminJobDetailsExpandable = ({const isAnyNode = () => true;return (- <Collapsible isExpanded={isExpanded} dimension="height">- <StyledDetailsContainer>- {hasFailedReason && (- <StyledSection>- <StyledSectionTitle>{t`Error Message`}</StyledSectionTitle>- <StyledPreformattedText>{job.failedReason}</StyledPreformattedText>- </StyledSection>- )}+ <Collapsible.Root open={isExpanded}>+ <Collapsible.Panel dimension="height">+ <StyledDetailsContainer>+ {hasFailedReason && (+ <StyledSection>+ <StyledSectionTitle>{t`Error Message`}</StyledSectionTitle>+ <StyledPreformattedText>+ {job.failedReason}+ </StyledPreformattedText>+ </StyledSection>+ )}- {hasStacktrace && job.stackTrace && (- <StyledSection>- <StyledSectionTitle>{t`Stack Trace`}</StyledSectionTitle>- <StyledPreformattedText>- {job.stackTrace.join('\n')}- </StyledPreformattedText>- </StyledSection>- )}+ {hasStacktrace && job.stackTrace && (+ <StyledSection>+ <StyledSectionTitle>{t`Stack Trace`}</StyledSectionTitle>+ <StyledPreformattedText>+ {job.stackTrace.join('\n')}+ </StyledPreformattedText>+ </StyledSection>+ )}- {hasReturnValue && (- <StyledSection>- <StyledSectionTitle>{t`Return Value`}</StyledSectionTitle>- <JsonTree- value={job.returnValue}- shouldExpandNodeInitially={isAnyNode}- emptyArrayLabel={t`Empty Array`}- emptyObjectLabel={t`Empty Object`}- emptyStringLabel={t`[empty string]`}- arrowButtonCollapsedLabel={t`Expand`}- arrowButtonExpandedLabel={t`Collapse`}- onNodeValueClick={copyToClipboard}- />- </StyledSection>- )}+ {hasReturnValue && (+ <StyledSection>+ <StyledSectionTitle>{t`Return Value`}</StyledSectionTitle>+ <JsonTree+ value={job.returnValue}+ shouldExpandNodeInitially={isAnyNode}+ emptyArrayLabel={t`Empty Array`}+ emptyObjectLabel={t`Empty Object`}+ emptyStringLabel={t`[empty string]`}+ arrowButtonCollapsedLabel={t`Expand`}+ arrowButtonExpandedLabel={t`Collapse`}+ onNodeValueClick={copyToClipboard}+ />+ </StyledSection>+ )}- {hasData && (- <StyledSection>- <StyledSectionTitle>{t`Job Data`}</StyledSectionTitle>- <JsonTree- value={job.data}- shouldExpandNodeInitially={isAnyNode}- emptyArrayLabel={t`Empty Array`}- emptyObjectLabel={t`Empty Object`}- emptyStringLabel={t`[empty string]`}- arrowButtonCollapsedLabel={t`Expand`}- arrowButtonExpandedLabel={t`Collapse`}- onNodeValueClick={copyToClipboard}- />- </StyledSection>- )}+ {hasData && (+ <StyledSection>+ <StyledSectionTitle>{t`Job Data`}</StyledSectionTitle>+ <JsonTree+ value={job.data}+ shouldExpandNodeInitially={isAnyNode}+ emptyArrayLabel={t`Empty Array`}+ emptyObjectLabel={t`Empty Object`}+ emptyStringLabel={t`[empty string]`}+ arrowButtonCollapsedLabel={t`Expand`}+ arrowButtonExpandedLabel={t`Collapse`}+ onNodeValueClick={copyToClipboard}+ />+ </StyledSection>+ )}- {hasLogs && (- <StyledSection>- <StyledSectionTitle>{t`Logs`}</StyledSectionTitle>- {job.logs?.map((log, index) => (- <StyledLogEntry key={index}>{log}</StyledLogEntry>- ))}- </StyledSection>- )}- </StyledDetailsContainer>- </Collapsible>+ {hasLogs && (+ <StyledSection>+ <StyledSectionTitle>{t`Logs`}</StyledSectionTitle>+ {job.logs?.map((log, index) => (+ <StyledLogEntry key={index}>{log}</StyledLogEntry>+ ))}+ </StyledSection>+ )}+ </StyledDetailsContainer>+ </Collapsible.Panel>+ </Collapsible.Root>);};diff --git a/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminWorkspacesByHealthAccordion.tsx b/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminWorkspacesByHealthAccordion.tsxindex 731bb80c9b6..33545b3d2bd 100644--- a/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminWorkspacesByHealthAccordion.tsx+++ b/packages/twenty-front/src/modules/settings/admin-panel/health-status/components/SettingsAdminWorkspacesByHealthAccordion.tsx@@ -100,26 +100,28 @@ export const SettingsAdminWorkspacesByHealthAccordion = ({</StyledAccordionHeaderButtonDisabled>)}{hasWorkspaces && (- <Collapsible isExpanded={isExpanded} dimension="height">- <StyledAccordionContent>- <StyledWorkspaceList>- {workspaces.map((workspace) => (- <StyledWorkspaceListItem key={workspace.id}>- <StyledWorkspaceLink- to={getSettingsPath(- SettingsPath.AdminPanelWorkspaceDetail,- { workspaceId: workspace.id },- )}- >- {workspace.name ?? t`Unknown workspace`}- {' - '}- {workspace.id}- </StyledWorkspaceLink>- </StyledWorkspaceListItem>- ))}- </StyledWorkspaceList>- </StyledAccordionContent>- </Collapsible>+ <Collapsible.Root open={isExpanded}>+ <Collapsible.Panel dimension="height">+ <StyledAccordionContent>+ <StyledWorkspaceList>+ {workspaces.map((workspace) => (+ <StyledWorkspaceListItem key={workspace.id}>+ <StyledWorkspaceLink+ to={getSettingsPath(+ SettingsPath.AdminPanelWorkspaceDetail,+ { workspaceId: workspace.id },+ )}+ >+ {workspace.name ?? t`Unknown workspace`}+ {' - '}+ {workspace.id}+ </StyledWorkspaceLink>+ </StyledWorkspaceListItem>+ ))}+ </StyledWorkspaceList>+ </StyledAccordionContent>+ </Collapsible.Panel>+ </Collapsible.Root>)}</Card.Root>);diff --git a/packages/twenty-front/src/modules/settings/components/AdvancedSettingsWrapper.tsx b/packages/twenty-front/src/modules/settings/components/AdvancedSettingsWrapper.tsxindex 5c945a02cc7..ce2fb0097f3 100644--- a/packages/twenty-front/src/modules/settings/components/AdvancedSettingsWrapper.tsx+++ b/packages/twenty-front/src/modules/settings/components/AdvancedSettingsWrapper.tsx@@ -39,19 +39,22 @@ export const AdvancedSettingsWrapper = ({return (<StyledContainer>- <Collapsible- isExpanded={isAdvancedModeEnabled}- dimension={animationDimension}- animationDurations={ADVANCED_SETTINGS_ANIMATION_DURATION}- containAnimation={false}- >- <AdvancedSettingsContentWrapperWithDot- hideDot={hideDot}- dotPosition={dotPosition}+ <Collapsible.Root open={isAdvancedModeEnabled}>+ <Collapsible.Panel+ dimension={animationDimension}+ style={{+ transitionDuration: `${ADVANCED_SETTINGS_ANIMATION_DURATION.size}s, ${ADVANCED_SETTINGS_ANIMATION_DURATION.opacity}s`,+ }}+ containAnimation={false}>- <StyledContent>{children}</StyledContent>- </AdvancedSettingsContentWrapperWithDot>- </Collapsible>+ <AdvancedSettingsContentWrapperWithDot+ hideDot={hideDot}+ dotPosition={dotPosition}+ >+ <StyledContent>{children}</StyledContent>+ </AdvancedSettingsContentWrapperWithDot>+ </Collapsible.Panel>+ </Collapsible.Root></StyledContainer>);};diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/forms/date/components/SettingsDataModelFieldDateForm.tsx b/packages/twenty-front/src/modules/settings/data-model/fields/forms/date/components/SettingsDataModelFieldDateForm.tsxindex 448dbafb99c..2ee81dc3fa0 100644--- a/packages/twenty-front/src/modules/settings/data-model/fields/forms/date/components/SettingsDataModelFieldDateForm.tsx+++ b/packages/twenty-front/src/modules/settings/data-model/fields/forms/date/components/SettingsDataModelFieldDateForm.tsx@@ -105,30 +105,33 @@ export const SettingsDataModelFieldDateForm = ({</SettingsOptionCardContentSelect>)}/>- <Collapsible- isExpanded={showCustomFormatTextInput}- dimension="height"- animationDurations={ADVANCED_SETTINGS_ANIMATION_DURATION}- containAnimation={false}- >- <Controller- name="settings.customUnicodeDateFormat"- control={control}- defaultValue={initialCustomUnicodeDateFormat}- render={({ field: { onChange, value } }) => (- <StyledTextInputContainer>- <SettingsTextInput- instanceId="custom-date-format-input"- placeholder={t`Format e.g. d-MMM-y (qqq''yy)`}- value={value}- onChange={(value) => onChange(value)}- disabled={false}- fullWidth- />- </StyledTextInputContainer>- )}- />- </Collapsible>+ <Collapsible.Root open={showCustomFormatTextInput}>+ <Collapsible.Panel+ dimension="height"+ style={{+ transitionDuration: `${ADVANCED_SETTINGS_ANIMATION_DURATION.size}s, ${ADVANCED_SETTINGS_ANIMATION_DURATION.opacity}s`,+ }}+ containAnimation={false}+ >+ <Controller+ name="settings.customUnicodeDateFormat"+ control={control}+ defaultValue={initialCustomUnicodeDateFormat}+ render={({ field: { onChange, value } }) => (+ <StyledTextInputContainer>+ <SettingsTextInput+ instanceId="custom-date-format-input"+ placeholder={t`Format e.g. d-MMM-y (qqq''yy)`}+ value={value}+ onChange={(value) => onChange(value)}+ disabled={false}+ fullWidth+ />+ </StyledTextInputContainer>+ )}+ />+ </Collapsible.Panel>+ </Collapsible.Root></>);};diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsSection.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsSection.tsxindex 4b096f2c35f..3d4a3baaf08 100644--- a/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsSection.tsx+++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsSection.tsx@@ -86,35 +86,35 @@ export const SettingsRolePermissionsSettingsSection = ({</Card.Root></StyledCardContainer>)}- <Collapsible- isExpanded={+ <Collapsible.Root+ open={!shouldShowAllAccessToggle || !settingsDraftRole.canUpdateAllSettings}- dimension="height"- animationDurations={{- opacity: 0.2,- size: 0.4,- }}- containAnimation={false}>- <StyledTable>- <SettingsRolePermissionsSettingsTableHeader- roleId={roleId}- settingsPermissionsConfig={settingsPermissionsConfig}- isEditable={isEditable}- />- <StyledTableRows>- {settingsPermissionsConfig.map((permission) => (- <SettingsRolePermissionsSettingsTableRow- key={permission.key}- roleId={roleId}- permission={permission}- isEditable={isEditable}- />- ))}- </StyledTableRows>- </StyledTable>- </Collapsible>+ <Collapsible.Panel+ dimension="height"+ style={{ transitionDuration: '0.4s, 0.2s' }}+ containAnimation={false}+ >+ <StyledTable>+ <SettingsRolePermissionsSettingsTableHeader+ roleId={roleId}+ settingsPermissionsConfig={settingsPermissionsConfig}+ isEditable={isEditable}+ />+ <StyledTableRows>+ {settingsPermissionsConfig.map((permission) => (+ <SettingsRolePermissionsSettingsTableRow+ key={permission.key}+ roleId={roleId}+ permission={permission}+ isEditable={isEditable}+ />+ ))}+ </StyledTableRows>+ </StyledTable>+ </Collapsible.Panel>+ </Collapsible.Root></Section.Root>);};diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsToolSection.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsToolSection.tsxindex 3487ba342d4..caf3fb81741 100644--- a/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsToolSection.tsx+++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsToolSection.tsx@@ -85,35 +85,35 @@ export const SettingsRolePermissionsToolSection = ({</Card.Root></StyledCardContainer>)}- <Collapsible- isExpanded={+ <Collapsible.Root+ open={!shouldShowAllAccessToggle || !settingsDraftRole.canAccessAllTools}- dimension="height"- animationDurations={{- opacity: 0.2,- size: 0.4,- }}- containAnimation={false}>- <StyledTable>- <SettingsRolePermissionsSettingsTableHeader- roleId={roleId}- settingsPermissionsConfig={toolPermissionsConfig}- isEditable={isEditable}- />- <StyledTableRows>- {toolPermissionsConfig.map((permission) => (- <SettingsRolePermissionsSettingsTableRow- key={permission.key}- roleId={roleId}- permission={permission}- isEditable={isEditable}- />- ))}- </StyledTableRows>- </StyledTable>- </Collapsible>+ <Collapsible.Panel+ dimension="height"+ style={{ transitionDuration: '0.4s, 0.2s' }}+ containAnimation={false}+ >+ <StyledTable>+ <SettingsRolePermissionsSettingsTableHeader+ roleId={roleId}+ settingsPermissionsConfig={toolPermissionsConfig}+ isEditable={isEditable}+ />+ <StyledTableRows>+ {toolPermissionsConfig.map((permission) => (+ <SettingsRolePermissionsSettingsTableRow+ key={permission.key}+ roleId={roleId}+ permission={permission}+ isEditable={isEditable}+ />+ ))}+ </StyledTableRows>+ </StyledTable>+ </Collapsible.Panel>+ </Collapsible.Root></Section.Root>);};diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components/UnmatchColumn.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components/UnmatchColumn.tsxindex 555ae59e0aa..093c159c2b5 100644--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components/UnmatchColumn.tsx+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components/UnmatchColumn.tsx@@ -72,19 +72,21 @@ export const UnmatchColumn = ({isExpanded={isExpanded}allMatched={allMatched}/>- <Collapsible isExpanded={isExpanded} dimension="height" containAnimation>- <StyledContentWrapper>- {column.matchedOptions?.map((option) => (- <SubMatchingSelectRow- option={option}- column={column}- onSubChange={onSubChange}- key={option.entry}- placeholder={t`Select an option`}- />- ))}- </StyledContentWrapper>- </Collapsible>+ <Collapsible.Root open={isExpanded}>+ <Collapsible.Panel dimension="height" containAnimation>+ <StyledContentWrapper>+ {column.matchedOptions?.map((option) => (+ <SubMatchingSelectRow+ option={option}+ column={column}+ onSubChange={onSubChange}+ key={option.entry}+ placeholder={t`Select an option`}+ />+ ))}+ </StyledContentWrapper>+ </Collapsible.Panel>+ </Collapsible.Root></StyledContainer>);};diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/CollapsibleNavigationDrawerSection.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/CollapsibleNavigationDrawerSection.tsxindex 12459ae7520..e389668b95f 100644--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/CollapsibleNavigationDrawerSection.tsx+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/CollapsibleNavigationDrawerSection.tsx@@ -49,13 +49,13 @@ export const CollapsibleNavigationDrawerSection = ({<NavigationDrawerSection>{isNavigationDrawerExpanded &&(wrapTitle ? wrapTitle(titleNode) : titleNode)}- <Collapsible- isExpanded={!isNavigationDrawerExpanded || isNavigationSectionOpen}- dimension="height"- containAnimation+ <Collapsible.Root+ open={!isNavigationDrawerExpanded || isNavigationSectionOpen}>- <StyledItems>{children}</StyledItems>- </Collapsible>+ <Collapsible.Panel dimension="height" containAnimation>+ <StyledItems>{children}</StyledItems>+ </Collapsible.Panel>+ </Collapsible.Root></NavigationDrawerSection>);};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowRunStepLogsToolCallRow.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowRunStepLogsToolCallRow.tsxindex 343e6183b3a..1bf286f32ee 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowRunStepLogsToolCallRow.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowRunStepLogsToolCallRow.tsx@@ -198,49 +198,51 @@ export const WorkflowRunStepLogsToolCallRow = ({</StyledToggleButton>{isExpandable && (- <Collapsible isExpanded={isExpanded}>- <StyledContentContainer>- {hasError && isDefined(toolCall.errorMessage) ? (- <StyledErrorMessage>{toolCall.errorMessage}</StyledErrorMessage>- ) : (- <>- <StyledTabContainer>- <StyledTab- type="button"- isActive={activeTab === 'output'}- onClick={() => setActiveTab('output')}- >- {t`Output`}- </StyledTab>- <StyledTab- type="button"- isActive={activeTab === 'input'}- onClick={() => setActiveTab('input')}- >- {t`Input`}- </StyledTab>- </StyledTabContainer>-- <StyledJsonTreeContainer>- <JsonTree- value={- (activeTab === 'output'- ? (toolCall.output ?? t`No output`)- : (toolCall.input ?? t`No input`)) as JsonValue- }- shouldExpandNodeInitially={() => false}- emptyArrayLabel={t`Empty Array`}- emptyObjectLabel={t`Empty Object`}- emptyStringLabel={t`[empty string]`}- arrowButtonCollapsedLabel={t`Expand`}- arrowButtonExpandedLabel={t`Collapse`}- onNodeValueClick={copyToClipboard}- />- </StyledJsonTreeContainer>- </>- )}- </StyledContentContainer>- </Collapsible>+ <Collapsible.Root open={isExpanded}>+ <Collapsible.Panel>+ <StyledContentContainer>+ {hasError && isDefined(toolCall.errorMessage) ? (+ <StyledErrorMessage>{toolCall.errorMessage}</StyledErrorMessage>+ ) : (+ <>+ <StyledTabContainer>+ <StyledTab+ type="button"+ isActive={activeTab === 'output'}+ onClick={() => setActiveTab('output')}+ >+ {t`Output`}+ </StyledTab>+ <StyledTab+ type="button"+ isActive={activeTab === 'input'}+ onClick={() => setActiveTab('input')}+ >+ {t`Input`}+ </StyledTab>+ </StyledTabContainer>++ <StyledJsonTreeContainer>+ <JsonTree+ value={+ (activeTab === 'output'+ ? (toolCall.output ?? t`No output`)+ : (toolCall.input ?? t`No input`)) as JsonValue+ }+ shouldExpandNodeInitially={() => false}+ emptyArrayLabel={t`Empty Array`}+ emptyObjectLabel={t`Empty Object`}+ emptyStringLabel={t`[empty string]`}+ arrowButtonCollapsedLabel={t`Expand`}+ arrowButtonExpandedLabel={t`Collapse`}+ onNodeValueClick={copyToClipboard}+ />+ </StyledJsonTreeContainer>+ </>+ )}+ </StyledContentContainer>+ </Collapsible.Panel>+ </Collapsible.Root>)}</StyledContainer>);diff --git a/packages/twenty-ui/docs/collapsiblePropDescriptions.ts b/packages/twenty-ui/docs/collapsiblePropDescriptions.tsindex eb2a664bbb1..d7a3dcffebe 100644--- a/packages/twenty-ui/docs/collapsiblePropDescriptions.ts+++ b/packages/twenty-ui/docs/collapsiblePropDescriptions.ts@@ -1,16 +1,34 @@-import { type ComponentProps } from 'react';+import { type CollapsiblePanelProps } from '../src/primitives/layout/Collapsible/types/CollapsiblePanelProps';+import { type CollapsibleRootProps } from '../src/primitives/layout/Collapsible/types/CollapsibleRootProps';+import { type CollapsibleTriggerProps } from '../src/primitives/layout/Collapsible/types/CollapsibleTriggerProps';-import { type Collapsible } from '../src/primitives/layout/Collapsible/Collapsible';--export const COLLAPSIBLE_PROP_DESCRIPTIONS = {- children: 'Content inside the expanding panel.',- isExpanded:- 'Controlled visibility of the panel. The application owns the trigger and state.',- dimension: 'Dimension animated when the panel opens and closes.',- animationDurations:- 'Default theme timing or separate opacity and size durations in seconds.',- containAnimation:- 'Clips overflowing content during expansion and uses a column layout.',- duration:- 'Theme timing preset for both opacity and size. Explicit `animationDurations` take precedence.',-} satisfies Partial<Record<keyof ComponentProps<typeof Collapsible>, string>>;+export const COLLAPSIBLE_PART_PROP_DESCRIPTIONS = {+ Root: {+ open: 'Controlled expansion state. Use defaultOpen for uncontrolled state.',+ defaultOpen: 'Initial uncontrolled expansion state.',+ onOpenChange:+ 'Called with the requested open state and cancelable Base UI event details.',+ disabled: 'Default disabled state inherited by the triggers in this root.',+ render: 'Replaces the root div. Forward the supplied props and ref.',+ } satisfies Partial<Record<keyof CollapsibleRootProps, string>>,+ Trigger: {+ disabled: 'Disables this trigger.',+ nativeButton:+ 'Set to false when render replaces the native button with another element.',+ render:+ 'Replaces the linked trigger button. Forward the supplied props and ref.',+ } satisfies Partial<Record<keyof CollapsibleTriggerProps, string>>,+ Panel: {+ dimension: 'Dimension animated when the panel opens and closes.',+ containAnimation:+ 'Clips overflowing content during expansion and uses a column layout.',+ duration:+ 'Theme timing preset for both size and opacity. Native style can customize transition timing.',+ keepMounted:+ 'Keeps the closed panel mounted and hidden, preserving local content state.',+ hiddenUntilFound:+ 'Uses hidden until-found so browser page search can reveal the contents. Overrides keepMounted.',+ render:+ 'Replaces the animated panel div. Forward the supplied props and ref.',+ } satisfies Partial<Record<keyof CollapsiblePanelProps, string>>,+};diff --git a/packages/twenty-ui/docs/components.ts b/packages/twenty-ui/docs/components.tsindex 46f3eb054b9..99a5bc0c39a 100644--- a/packages/twenty-ui/docs/components.ts+++ b/packages/twenty-ui/docs/components.ts@@ -29,7 +29,7 @@ import { ICONS_PROVIDER_PROP_DESCRIPTIONS } from './iconsProviderPropDescriptionimport { ILLUSTRATION_ICON_WRAPPER_PROP_DESCRIPTIONS } from './illustrationIconWrapperPropDescriptions';import { THINKING_ORBIT_LOADER_ICON_PROP_DESCRIPTIONS } from './thinkingOrbitLoaderIconPropDescriptions';import { COMPONENT_STORYBOOK_LAYOUT_PROP_DESCRIPTIONS } from './componentStorybookLayoutPropDescriptions';-import { COLLAPSIBLE_PROP_DESCRIPTIONS } from './collapsiblePropDescriptions';+import { COLLAPSIBLE_PART_PROP_DESCRIPTIONS } from './collapsiblePropDescriptions';import { AVATAR_PROP_DESCRIPTIONS } from './avatarPropDescriptions';import { BANNER_PROP_DESCRIPTIONS } from './bannerPropDescriptions';import { BREADCRUMB_PROP_DESCRIPTIONS } from './breadcrumbPropDescriptions';@@ -180,7 +180,14 @@ export const DOCUMENTED_COMPONENTS = [source: 'primitives/layout/Collapsible/Collapsible.tsx',entryPoint: 'twenty-ui/primitives/layout',slug: 'layout/collapsible',- propDescriptions: COLLAPSIBLE_PROP_DESCRIPTIONS,+ partPropDescriptions: COLLAPSIBLE_PART_PROP_DESCRIPTIONS,+ partPropDefaults: {+ Panel: {+ dimension: 'height',+ containAnimation: 'true',+ duration: 'normal',+ },+ },},{name: 'Separator',diff --git a/packages/twenty-ui/docs/public-exports.json b/packages/twenty-ui/docs/public-exports.jsonindex 7503b9df576..454ed5d91c0 100644--- a/packages/twenty-ui/docs/public-exports.json+++ b/packages/twenty-ui/docs/public-exports.json@@ -834,8 +834,14 @@},"types": {"AnimationDimension": "primitives/layout/Collapsible/types/AnimationDimension",- "AnimationDurationObject": "primitives/layout/Collapsible/types/AnimationDurationObject",- "AnimationDurations": "primitives/layout/Collapsible/types/AnimationDurations",+ "CollapsiblePanelProps": "primitives/layout/Collapsible/types/CollapsiblePanelProps",+ "CollapsiblePanelState": "primitives/layout/Collapsible/types/CollapsiblePanelState",+ "CollapsibleRootChangeEventDetails": "primitives/layout/Collapsible/types/CollapsibleRootChangeEventDetails",+ "CollapsibleRootChangeEventReason": "primitives/layout/Collapsible/types/CollapsibleRootChangeEventReason",+ "CollapsibleRootProps": "primitives/layout/Collapsible/types/CollapsibleRootProps",+ "CollapsibleRootState": "primitives/layout/Collapsible/types/CollapsibleRootState",+ "CollapsibleTriggerProps": "primitives/layout/Collapsible/types/CollapsibleTriggerProps",+ "CollapsibleTriggerState": "primitives/layout/Collapsible/types/CollapsibleTriggerState","DirectionProviderProps": "primitives/layout/DirectionProvider/types/DirectionProviderProps","ResizeHandleProps": "primitives/layout/ResizeHandle/types/ResizeHandleProps","SeparatorProps": "primitives/layout/Separator/types/SeparatorProps"diff --git a/packages/twenty-ui/generated/components.docs.json b/packages/twenty-ui/generated/components.docs.jsonindex 1e5e799294f..0da07ee22d1 100644--- a/packages/twenty-ui/generated/components.docs.json+++ b/packages/twenty-ui/generated/components.docs.json@@ -1113,48 +1113,162 @@"name": "Collapsible","entryPoint": "twenty-ui/primitives/layout","slug": "layout/collapsible",- "props": [- {- "name": "animationDurations",- "type": "AnimationDurations",- "required": false,- "defaultValue": "default",- "description": "Default theme timing or separate opacity and size durations in seconds."- },- {- "name": "children",- "type": "ReactNode",- "required": true,- "defaultValue": null,- "description": "Content inside the expanding panel."- },- {- "name": "containAnimation",- "type": "boolean",- "required": false,- "defaultValue": "true",- "description": "Clips overflowing content during expansion and uses a column layout."- },+ "props": [],+ "parts": [{- "name": "dimension",- "type": "\"height\" | \"width\"",- "required": false,- "defaultValue": "height",- "description": "Dimension animated when the panel opens and closes."+ "name": "Root",+ "props": [+ {+ "name": "className",+ "type": "string | ((state: CollapsibleRootState) => 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": "defaultOpen",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Initial uncontrolled expansion state."+ },+ {+ "name": "disabled",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Default disabled state inherited by the triggers in this root."+ },+ {+ "name": "onOpenChange",+ "type": "((open: boolean, eventDetails: CollapsibleRootChangeEventDetails) => void)",+ "required": false,+ "defaultValue": null,+ "description": "Called with the requested open state and cancelable Base UI event details."+ },+ {+ "name": "open",+ "type": "boolean",+ "required": false,+ "defaultValue": null,+ "description": "Controlled expansion state. Use defaultOpen for uncontrolled state."+ },+ {+ "name": "render",+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, CollapsibleRootState>",+ "required": false,+ "defaultValue": null,+ "description": "Replaces the root div. Forward the supplied props and ref."+ },+ {+ "name": "style",+ "type": "CSSProperties | ((state: CollapsibleRootState) => 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": "duration",- "type": "\"fast\" | \"instant\" | \"normal\" | \"slow\"",- "required": false,- "defaultValue": null,- "description": "Theme timing preset for both opacity and size. Explicit `animationDurations` take precedence."+ "name": "Trigger",+ "props": [+ {+ "name": "className",+ "type": "string | ((state: CollapsibleTriggerState) => 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": "disabled",+ "type": "boolean",+ "required": false,+ "defaultValue": null,+ "description": "Disables this trigger."+ },+ {+ "name": "nativeButton",+ "type": "boolean",+ "required": false,+ "defaultValue": "true",+ "description": "Set to false when render replaces the native button with another element."+ },+ {+ "name": "render",+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, CollapsibleTriggerState>",+ "required": false,+ "defaultValue": null,+ "description": "Replaces the linked trigger button. Forward the supplied props and ref."+ },+ {+ "name": "style",+ "type": "CSSProperties | ((state: CollapsibleTriggerState) => 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": "isExpanded",- "type": "boolean",- "required": true,- "defaultValue": null,- "description": "Controlled visibility of the panel. The application owns the trigger and state."+ "name": "Panel",+ "props": [+ {+ "name": "className",+ "type": "string | ((state: CollapsiblePanelState) => 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": "containAnimation",+ "type": "boolean",+ "required": false,+ "defaultValue": "true",+ "description": "Clips overflowing content during expansion and uses a column layout."+ },+ {+ "name": "dimension",+ "type": "\"height\" | \"width\"",+ "required": false,+ "defaultValue": "height",+ "description": "Dimension animated when the panel opens and closes."+ },+ {+ "name": "duration",+ "type": "\"fast\" | \"instant\" | \"normal\" | \"slow\"",+ "required": false,+ "defaultValue": "normal",+ "description": "Theme timing preset for both size and opacity. Native style can customize transition timing."+ },+ {+ "name": "hiddenUntilFound",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Uses hidden until-found so browser page search can reveal the contents. Overrides keepMounted."+ },+ {+ "name": "keepMounted",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Keeps the closed panel mounted and hidden, preserving local content state."+ },+ {+ "name": "render",+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, CollapsiblePanelState>",+ "required": false,+ "defaultValue": null,+ "description": "Replaces the animated panel div. Forward the supplied props and ref."+ },+ {+ "name": "style",+ "type": "CSSProperties | ((state: CollapsiblePanelState) => CSSProperties | undefined)",+ "required": false,+ "defaultValue": null,+ "description": "Style applied to the element, or a function that\nreturns a style object based on the component's state."+ }+ ]}]},diff --git a/packages/twenty-ui/src/primitives/layout/Collapsible/Collapsible.module.scss b/packages/twenty-ui/src/primitives/layout/Collapsible/Collapsible.module.scssindex 3ad9df4e815..249a00a83a8 100644--- a/packages/twenty-ui/src/primitives/layout/Collapsible/Collapsible.module.scss+++ b/packages/twenty-ui/src/primitives/layout/Collapsible/Collapsible.module.scss@@ -5,6 +5,10 @@opacity: 1;transition: opacity var(--collapsible-opacity-duration) ease-in-out;+ &[hidden]:not([hidden='until-found']) {+ display: none;+ }+&[data-dimension='height'] {height: var(--collapsible-panel-height);transition:@@ -51,3 +55,9 @@--collapsible-size-duration: #{duration($duration)};}}++@media (prefers-reduced-motion: reduce) {+ .panel {+ transition-duration: 0s !important;+ }+}diff --git a/packages/twenty-ui/src/primitives/layout/Collapsible/Collapsible.tsx b/packages/twenty-ui/src/primitives/layout/Collapsible/Collapsible.tsxindex c152116993c..927e14604ad 100644--- a/packages/twenty-ui/src/primitives/layout/Collapsible/Collapsible.tsx+++ b/packages/twenty-ui/src/primitives/layout/Collapsible/Collapsible.tsx@@ -1,47 +1,9 @@-import { Collapsible as BaseCollapsible } from '@base-ui/react/collapsible';-import { type AnimationDuration } from '@ui/theme';-import { clsx } from 'clsx';+import { Collapsible as CollapsiblePrimitive } from '@base-ui/react/collapsible';-import { type AnimationDimension } from '@ui/primitives/layout/Collapsible/types/AnimationDimension';-import { type AnimationDurations } from '@ui/primitives/layout/Collapsible/types/AnimationDurations';+import { CollapsiblePanel } from './internal/CollapsiblePanel';-import styles from './Collapsible.module.scss';--type CollapsibleProps = {- children: React.ReactNode;- isExpanded: boolean;- dimension?: AnimationDimension;- animationDurations?: AnimationDurations;- containAnimation?: boolean;- duration?: AnimationDuration;-};--export const Collapsible = ({- children,- isExpanded,- dimension = 'height',- animationDurations = 'default',- containAnimation = true,- duration,-}: CollapsibleProps) => {- const durationStyle =- animationDurations === 'default'- ? undefined- : ({- '--collapsible-opacity-duration': `${animationDurations.opacity}s`,- '--collapsible-size-duration': `${animationDurations.size}s`,- } as React.CSSProperties);-- return (- <BaseCollapsible.Root open={isExpanded}>- <BaseCollapsible.Panel- className={clsx(styles.panel, containAnimation && styles.contained)}- data-dimension={dimension}- data-duration={duration}- style={durationStyle}- >- {children}- </BaseCollapsible.Panel>- </BaseCollapsible.Root>- );+export const Collapsible = {+ Root: CollapsiblePrimitive.Root,+ Trigger: CollapsiblePrimitive.Trigger,+ Panel: CollapsiblePanel,};diff --git a/packages/twenty-ui/src/primitives/layout/Collapsible/__stories__/Collapsible.stories.tsx b/packages/twenty-ui/src/primitives/layout/Collapsible/__stories__/Collapsible.stories.tsxindex 92e622235da..aa736fe11ab 100644--- a/packages/twenty-ui/src/primitives/layout/Collapsible/__stories__/Collapsible.stories.tsx+++ b/packages/twenty-ui/src/primitives/layout/Collapsible/__stories__/Collapsible.stories.tsx@@ -3,176 +3,236 @@ import { A11Y_DEFER_COLOR_CONTRAST, ComponentDecorator } from '@ui/testing';import { clsx } from 'clsx';import { useState } from 'react';import { expect, userEvent, waitFor, within } from 'storybook/test';-import { Collapsible } from '@ui/primitives/layout/Collapsible/Collapsible';+import { Button } from '@ui/primitives/input/Button/Button';+import { Collapsible } from '@ui/primitives/layout/Collapsible/Collapsible';+import { type CollapsiblePanelProps } from '@ui/primitives/layout/Collapsible/types/CollapsiblePanelProps';import { Text } from '@ui/primitives/typography/Text/Text';+import { isDefined } from '@ui/utilities/utils/isDefined';import styles from './Collapsible.stories.module.scss';-type CollapsibleWithButtonProps = {- isExpanded: boolean;- dimension: 'width' | 'height';- hasFixedHeight: boolean;- animationDurations:- | {- opacity: number;- size: number;- }- | 'default';+type CollapsibleExampleProps = Pick<+ CollapsiblePanelProps,+ 'dimension' | 'duration' | 'style'+> & {+ defaultOpen?: boolean;+ hasFixedHeight?: boolean;};-const CollapsibleWithButton = ({- isExpanded: initialIsExpanded,- ...args-}: CollapsibleWithButtonProps) => {- const [isExpanded, setIsExpanded] = useState(initialIsExpanded);+const CollapsibleExample = ({+ defaultOpen = false,+ dimension = 'height',+ hasFixedHeight = true,+ ...panelProps+}: CollapsibleExampleProps) => (+ <Collapsible.Root+ defaultOpen={defaultOpen}+ className={clsx(+ styles.buttonWrapper,+ dimension === 'width'+ ? styles.buttonWrapperWidth+ : styles.buttonWrapperHeight,+ )}+ >+ <Collapsible.Trigger render={<Button className={styles.button} />}>+ Import details+ </Collapsible.Trigger>+ <Collapsible.Panel dimension={dimension} {...panelProps}>+ <Text render={<div />} className={styles.expandableWrapper}>+ <Text+ render={<div />}+ className={clsx(+ styles.content,+ dimension === 'height' &&+ hasFixedHeight &&+ styles.contentFixedHeight,+ dimension === 'width' && styles.contentFixedWidth,+ )}+ >+ <Text render={<p />}>+ Match each CSV column to a record field before importing.+ </Text>+ <Text render={<p />}>+ The panel animates its content size when opening and closing.+ </Text>+ </Text>+ </Text>+ </Collapsible.Panel>+ </Collapsible.Root>+);++const meta = {+ title: 'UI/Layout/Collapsible',+ component: CollapsibleExample,+ decorators: [ComponentDecorator],+ parameters: { a11y: A11Y_DEFER_COLOR_CONTRAST },+ args: { defaultOpen: false, dimension: 'height', hasFixedHeight: true },+} satisfies Meta<typeof CollapsibleExample>;- return (- <div- className={clsx(- styles.buttonWrapper,- args.dimension === 'width'- ? styles.buttonWrapperWidth- : styles.buttonWrapperHeight,- )}- >- <Button- type="button"- className={styles.button}- aria-label={isExpanded ? 'Collapse' : 'Expand'}- aria-expanded={isExpanded}- onClick={() => setIsExpanded(!isExpanded)}- >- {isExpanded ? 'Collapse' : 'Expand'}- </Button>- <Collapsible- isExpanded={isExpanded}- dimension={args.dimension}- animationDurations={args.animationDurations}- >- <div className={styles.expandableWrapper}>- <div- className={clsx(- styles.content,- args.dimension === 'height' &&- args.hasFixedHeight &&- styles.contentFixedHeight,- args.dimension === 'width' && styles.contentFixedWidth,- )}- >- <Text render={<p />}>- This is some content inside the Collapsible. It will animate- smoothly when expanding or collapsing.- </Text>- <Text render={<p />}>- You can control the animation duration, dimension, and content- height through the Storybook controls.- </Text>- <Text render={<p />}>- Try different combinations to see how the container behaves with- different settings!- </Text>- </div>- </div>- </Collapsible>- </div>+export default meta;+type Story = StoryObj<typeof meta>;++const verifyExpansion: NonNullable<Story['play']> = async ({+ canvasElement,+ args,+}) => {+ const canvas = within(canvasElement);+ const trigger = canvas.getByRole('button', { name: 'Import details' });+ const content = 'Match each CSV column to a record field before importing.';+ if (args.defaultOpen) {+ expect(trigger).toHaveAttribute('aria-expanded', 'true');+ expect(canvas.getByText(content)).toBeVisible();+ await userEvent.click(trigger);+ await waitFor(() =>+ expect(canvas.queryByText(content)).not.toBeInTheDocument(),+ );+ }+ expect(trigger).toHaveAttribute('aria-expanded', 'false');+ await userEvent.click(trigger);+ expect(trigger).toHaveAttribute('aria-expanded', 'true');+ await waitFor(() => expect(canvas.getByText(content)).toBeVisible());+ const panel = document.getElementById(+ trigger.getAttribute('aria-controls') ?? '',);+ if (!isDefined(panel)) {+ throw new Error('The trigger must be linked to its panel');+ }+ expect(panel).toContainElement(canvas.getByText(content));+ expect(getComputedStyle(panel).transitionProperty).toBe(+ `${panel.dataset.dimension}, opacity`,+ );+ await waitFor(() => {+ expect(panel?.getBoundingClientRect().height).toBeGreaterThan(0);+ expect(panel?.getBoundingClientRect().width).toBeGreaterThan(0);+ });+ trigger.focus();+ await userEvent.keyboard(' ');+ expect(trigger).toHaveAttribute('aria-expanded', 'false');+ await waitFor(() =>+ expect(canvas.queryByText(content)).not.toBeInTheDocument(),+ );+ await userEvent.keyboard('{Enter}');+ await waitFor(() => expect(canvas.getByText(content)).toBeVisible());};-const meta: Meta<typeof CollapsibleWithButton> = {- title: 'UI/Layout/Collapsible',- component: CollapsibleWithButton,- decorators: [ComponentDecorator],- argTypes: {- isExpanded: {- control: 'boolean',- description: 'Controls whether the container is expanded or collapsed',- defaultValue: false,- },- dimension: {- control: 'radio',- options: ['width', 'height'],- description: 'The dimension along which the container expands',- defaultValue: 'height',- },- hasFixedHeight: {- control: 'boolean',- description: 'Use content with a fixed height in this example',- defaultValue: true,- },- animationDurations: {- control: 'radio',- options: ['default', 'custom'],- mapping: {- default: 'default',- custom: { opacity: 0.3, size: 0.3 },- },- description:- 'Animation durations - either default theme values or custom values',- },+export const Default: Story = { play: verifyExpansion };+export const Documentation: Story = {};+export const FitContent: Story = {+ args: { hasFixedHeight: false, defaultOpen: true },+ play: verifyExpansion,+};+export const WidthAnimation: Story = {+ args: { dimension: 'width' },+ play: verifyExpansion,+};+export const CustomDurations: Story = {+ args: { style: { transitionDuration: '1.2s, 0.8s' } },+ play: async (context) => {+ await verifyExpansion(context);+ const trigger = within(context.canvasElement).getByRole('button', {+ name: 'Import details',+ });+ const panel = document.getElementById(+ trigger.getAttribute('aria-controls') ?? '',+ );+ if (!isDefined(panel)) {+ throw new Error('The trigger must be linked to its panel');+ }+ expect(getComputedStyle(panel).transitionDuration).toBe('1.2s, 0.8s');},};-export default meta;-type Story = StoryObj<typeof CollapsibleWithButton>;+const ControlledExample = () => {+ const [open, setOpen] = useState(false);+ return (+ <Collapsible.Root open={open} onOpenChange={setOpen}>+ <Button onClick={() => setOpen(!open)}>Toggle externally</Button>+ <Collapsible.Trigger render={<Button />}>+ Linked trigger+ </Collapsible.Trigger>+ <Collapsible.Panel>+ <Text>Controlled content</Text>+ </Collapsible.Panel>+ </Collapsible.Root>+ );+};-export const Default: Story = {- parameters: { a11y: A11Y_DEFER_COLOR_CONTRAST },- args: {- isExpanded: false,- dimension: 'height',- hasFixedHeight: true,- animationDurations: 'default',- },+export const Controlled: Story = {+ render: () => <ControlledExample />,play: async ({ canvasElement }) => {const canvas = within(canvasElement);- const contentText =- 'This is some content inside the Collapsible. It will animate smoothly when expanding or collapsing.';- const toggleButton = canvas.getByRole('button', { name: 'Expand' });-- await expect(toggleButton).toHaveAttribute('aria-expanded', 'false');- await expect(canvas.queryByText(contentText)).not.toBeInTheDocument();-- await userEvent.click(toggleButton);-- await expect(toggleButton).toHaveAttribute('aria-expanded', 'true');- await waitFor(() => expect(canvas.getByText(contentText)).toBeVisible());-- await userEvent.click(canvas.getByRole('button', { name: 'Collapse' }));-- await expect(toggleButton).toHaveAttribute('aria-expanded', 'false');+ await userEvent.click(+ canvas.getByRole('button', { name: 'Toggle externally' }),+ );+ expect(+ canvas.getByRole('button', { name: 'Linked trigger' }),+ ).toHaveAttribute('aria-expanded', 'true');+ await userEvent.click(+ canvas.getByRole('button', { name: 'Linked trigger' }),+ );await waitFor(() =>- expect(canvas.queryByText(contentText)).not.toBeInTheDocument(),+ expect(canvas.queryByText('Controlled content')).not.toBeInTheDocument(),);},};-export const Documentation: Story = {- parameters: Default.parameters,- args: Default.args,-};--export const FitContent: Story = {- parameters: { a11y: A11Y_DEFER_COLOR_CONTRAST },- args: {- ...Default.args,- hasFixedHeight: false,+export const Disabled: Story = {+ render: () => (+ <Collapsible.Root disabled>+ <Collapsible.Trigger render={<Button />}>+ Disabled details+ </Collapsible.Trigger>+ <Collapsible.Panel>+ <Text>Unavailable content</Text>+ </Collapsible.Panel>+ </Collapsible.Root>+ ),+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ const trigger = canvas.getByRole('button', { name: 'Disabled details' });+ expect(trigger).toHaveAttribute('aria-disabled', 'true');+ await userEvent.click(trigger);+ expect(canvas.queryByText('Unavailable content')).not.toBeInTheDocument();},};-export const CustomDurations: Story = {- parameters: { a11y: A11Y_DEFER_COLOR_CONTRAST },- args: {- ...Default.args,- animationDurations: { opacity: 0.8, size: 1.2 },- },+const PersistentExample = () => {+ const [count, setCount] = useState(0);+ return (+ <Collapsible.Root defaultOpen>+ <Collapsible.Trigger render={<Button />}>+ Persistent details+ </Collapsible.Trigger>+ <Collapsible.Panel keepMounted id="persistent-panel">+ <Button onClick={() => setCount(count + 1)}>Count {count}</Button>+ </Collapsible.Panel>+ </Collapsible.Root>+ );};-export const WidthAnimation: Story = {- parameters: { a11y: A11Y_DEFER_COLOR_CONTRAST },- args: {- ...Default.args,- dimension: 'width',+export const KeepMounted: Story = {+ render: () => <PersistentExample />,+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ const trigger = canvas.getByRole('button', { name: 'Persistent details' });+ const panel = canvasElement.querySelector<HTMLElement>('#persistent-panel');+ if (!isDefined(panel)) {+ throw new Error('The persistent panel must be mounted');+ }+ await userEvent.click(canvas.getByRole('button', { name: 'Count 0' }));+ await userEvent.click(trigger);+ await waitFor(() => {+ expect(panel).not.toBeVisible();+ expect(panel.getBoundingClientRect().height).toBe(0);+ expect(+ canvas.queryByRole('button', { name: 'Count 1' }),+ ).not.toBeInTheDocument();+ expect(canvas.getByText('Count 1')).toBeInTheDocument();+ });+ await userEvent.click(trigger);+ await waitFor(() =>+ expect(canvas.getByRole('button', { name: 'Count 1' })).toBeVisible(),+ );},- play: Default.play,};diff --git a/packages/twenty-ui/src/primitives/layout/Collapsible/__tests__/Collapsible.reduced-motion.test.tsx b/packages/twenty-ui/src/primitives/layout/Collapsible/__tests__/Collapsible.reduced-motion.test.tsxnew file mode 100644index 00000000000..5acfb03257a--- /dev/null+++ b/packages/twenty-ui/src/primitives/layout/Collapsible/__tests__/Collapsible.reduced-motion.test.tsx@@ -0,0 +1,34 @@+import { cleanup, render, screen } from '@testing-library/react';+import { afterEach, expect, it } from 'vitest';++import { Collapsible } from '../Collapsible';++afterEach(cleanup);++it('disables height and width transitions including custom timing when reduced motion is preferred', () => {+ render(+ <Collapsible.Root defaultOpen>+ <Collapsible.Panel+ data-testid="height-panel"+ style={{ transitionDuration: '1.2s, 0.8s' }}+ >+ Height content+ </Collapsible.Panel>+ <Collapsible.Panel data-testid="width-panel" dimension="width">+ Width content+ </Collapsible.Panel>+ </Collapsible.Root>,+ );++ expect(window.matchMedia('(prefers-reduced-motion: reduce)').matches).toBe(+ true,+ );+ for (const panel of [+ screen.getByTestId('height-panel'),+ screen.getByTestId('width-panel'),+ ]) {+ expect(getComputedStyle(panel).transitionDuration).toBe('0s');+ expect(panel.getBoundingClientRect().height).toBeGreaterThan(0);+ expect(panel.getAnimations()).toHaveLength(0);+ }+});diff --git a/packages/twenty-ui/src/primitives/layout/Collapsible/__tests__/Collapsible.test.tsx b/packages/twenty-ui/src/primitives/layout/Collapsible/__tests__/Collapsible.test.tsxnew file mode 100644index 00000000000..315e65d41e0--- /dev/null+++ b/packages/twenty-ui/src/primitives/layout/Collapsible/__tests__/Collapsible.test.tsx@@ -0,0 +1,225 @@+import { render, screen, waitFor } from '@testing-library/react';+import userEvent from '@testing-library/user-event';+import { runComponentConformance } from '@test-utilities/conformance/runComponentConformance';+import { type PropsWithChildren, useState } from 'react';+import { describe, expect, it, vi } from 'vitest';++import { Collapsible } from '../Collapsible';+import styles from '../Collapsible.module.scss';+import { type CollapsibleTriggerProps } from '../types/CollapsibleTriggerProps';+import { type CollapsibleRootChangeEventDetails } from '../types/CollapsibleRootChangeEventDetails';++const OpenRoot = ({ children }: PropsWithChildren) => (+ <Collapsible.Root defaultOpen>{children}</Collapsible.Root>+);++runComponentConformance({+ name: 'Collapsible.Root',+ element: <Collapsible.Root />,+ refInstanceOf: HTMLDivElement,+});++runComponentConformance({+ name: 'Collapsible.Trigger',+ renderPropTagName: 'button',+ element: <Collapsible.Trigger>Toggle</Collapsible.Trigger>,+ refInstanceOf: HTMLButtonElement,+ wrapper: OpenRoot,+});++runComponentConformance({+ name: 'Collapsible.Panel',+ element: <Collapsible.Panel>Content</Collapsible.Panel>,+ refInstanceOf: HTMLDivElement,+ ownClassName: styles.panel,+ wrapper: OpenRoot,+});++describe('Collapsible', () => {+ it('opens an uncontrolled panel with a linked keyboard trigger', async () => {+ const user = userEvent.setup();+ const onOpenChange = vi.fn();+ render(+ <Collapsible.Root onOpenChange={onOpenChange}>+ <Collapsible.Trigger>Details</Collapsible.Trigger>+ <Collapsible.Panel id="details-panel">Import details</Collapsible.Panel>+ </Collapsible.Root>,+ );+ const trigger = screen.getByRole('button', { name: 'Details' });+ expect(trigger).toHaveAttribute('aria-expanded', 'false');+ expect(screen.queryByText('Import details')).not.toBeInTheDocument();++ await user.tab();+ await user.keyboard('{Enter}');+ expect(trigger).toHaveAttribute('aria-expanded', 'true');+ expect(trigger).toHaveAttribute('aria-controls', 'details-panel');+ expect(screen.getByText('Import details')).toHaveAttribute(+ 'id',+ 'details-panel',+ );+ expect(onOpenChange).toHaveBeenLastCalledWith(+ true,+ expect.objectContaining({+ reason: 'trigger-press',+ event: expect.any(Event),+ cancel: expect.any(Function),+ }),+ );++ await user.keyboard(' ');+ expect(trigger).toHaveAttribute('aria-expanded', 'false');+ await waitFor(() =>+ expect(screen.queryByText('Import details')).not.toBeInTheDocument(),+ );+ expect(onOpenChange).toHaveBeenCalledTimes(2);+ });++ it('leaves controlled visibility with the caller', async () => {+ const user = userEvent.setup();+ const onOpenChange = vi.fn();+ const Controlled = ({ open }: { open: boolean }) => (+ <Collapsible.Root open={open} onOpenChange={onOpenChange}>+ <Collapsible.Trigger>Details</Collapsible.Trigger>+ <Collapsible.Panel>Import details</Collapsible.Panel>+ </Collapsible.Root>+ );+ const { rerender } = render(<Controlled open={false} />);+ await user.click(screen.getByRole('button', { name: 'Details' }));+ expect(onOpenChange).toHaveBeenCalledWith(+ true,+ expect.objectContaining({ reason: 'trigger-press' }),+ );+ expect(screen.queryByText('Import details')).not.toBeInTheDocument();+ rerender(<Controlled open />);+ expect(screen.getByText('Import details')).toBeVisible();+ expect(screen.getByRole('button', { name: 'Details' })).toHaveAttribute(+ 'aria-expanded',+ 'true',+ );+ });++ it('honors cancellation through the upstream change details', async () => {+ const user = userEvent.setup();+ const onOpenChange = vi.fn(+ (open: boolean, details: CollapsibleRootChangeEventDetails) => {+ expect(open).toBe(true);+ details.cancel();+ },+ );+ render(+ <Collapsible.Root onOpenChange={onOpenChange}>+ <Collapsible.Trigger>Details</Collapsible.Trigger>+ <Collapsible.Panel>Import details</Collapsible.Panel>+ </Collapsible.Root>,+ );+ await user.click(screen.getByRole('button', { name: 'Details' }));+ expect(onOpenChange).toHaveBeenCalledTimes(1);+ expect(screen.getByRole('button', { name: 'Details' })).toHaveAttribute(+ 'aria-expanded',+ 'false',+ );+ });++ it('suppresses disabled root and trigger activation', async () => {+ const user = userEvent.setup();+ const onOpenChange = vi.fn();+ render(+ <>+ <Collapsible.Root disabled onOpenChange={onOpenChange}>+ <Collapsible.Trigger>Disabled root</Collapsible.Trigger>+ <Collapsible.Panel>Root content</Collapsible.Panel>+ </Collapsible.Root>+ <Collapsible.Root onOpenChange={onOpenChange}>+ <Collapsible.Trigger disabled>Disabled trigger</Collapsible.Trigger>+ <Collapsible.Panel>Trigger content</Collapsible.Panel>+ </Collapsible.Root>+ </>,+ );+ for (const trigger of screen.getAllByRole('button')) {+ expect(trigger).toHaveAttribute('aria-disabled', 'true');+ await user.click(trigger);+ }+ expect(onOpenChange).not.toHaveBeenCalled();+ });++ it('preserves native handlers and Base UI event cancellation', async () => {+ const user = userEvent.setup();+ const onClick = vi.fn<NonNullable<CollapsibleTriggerProps['onClick']>>(+ (event) => event.preventBaseUIHandler(),+ );+ render(+ <Collapsible.Root>+ <Collapsible.Trigger onClick={onClick}>Details</Collapsible.Trigger>+ <Collapsible.Panel>Import details</Collapsible.Panel>+ </Collapsible.Root>,+ );+ await user.click(screen.getByRole('button', { name: 'Details' }));+ expect(onClick).toHaveBeenCalledTimes(1);+ expect(screen.queryByText('Import details')).not.toBeInTheDocument();+ });++ it('keeps hidden content state when keepMounted is requested', async () => {+ const user = userEvent.setup();+ const Counter = () => {+ const [count, setCount] = useState(0);+ return <button onClick={() => setCount(count + 1)}>Count {count}</button>;+ };+ render(+ <Collapsible.Root defaultOpen>+ <Collapsible.Trigger>Details</Collapsible.Trigger>+ <Collapsible.Panel keepMounted>+ <Counter />+ </Collapsible.Panel>+ </Collapsible.Root>,+ );+ await user.click(screen.getByRole('button', { name: 'Count 0' }));+ await user.click(screen.getByRole('button', { name: 'Details' }));+ await waitFor(() => expect(screen.getByText('Count 1')).not.toBeVisible());+ await user.click(screen.getByRole('button', { name: 'Details' }));+ expect(screen.getByRole('button', { name: 'Count 1' })).toBeVisible();+ });++ it('activates a composed non-native trigger through the keyboard', async () => {+ const user = userEvent.setup();+ render(+ <Collapsible.Root>+ <Collapsible.Trigger nativeButton={false} render={<span />}>+ Details+ </Collapsible.Trigger>+ <Collapsible.Panel>Import details</Collapsible.Panel>+ </Collapsible.Root>,+ );+ const trigger = screen.getByRole('button', { name: 'Details' });+ expect(trigger.tagName).toBe('SPAN');+ await user.tab();+ await user.keyboard(' ');+ expect(trigger).toHaveAttribute('aria-expanded', 'true');+ expect(screen.getByText('Import details')).toBeVisible();+ });++ it('passes state to native style and className callbacks', () => {+ render(+ <Collapsible.Root defaultOpen>+ <Collapsible.Panel+ dimension="width"+ containAnimation={false}+ duration="fast"+ className={(state) => (state.open ? 'open-panel' : 'closed-panel')}+ style={(state) => ({+ padding: state.open ? 7 : 0,+ transitionDuration: '0.4s, 0.2s',+ })}+ >+ Import details+ </Collapsible.Panel>+ </Collapsible.Root>,+ );+ const panel = screen.getByText('Import details');+ expect(panel).toHaveClass(styles.panel, 'open-panel');+ expect(panel).not.toHaveClass(styles.contained);+ expect(panel).toHaveStyle({+ padding: '7px',+ transitionDuration: '0.4s, 0.2s',+ });+ });+});diff --git a/packages/twenty-ui/src/primitives/layout/Collapsible/internal/CollapsiblePanel.tsx b/packages/twenty-ui/src/primitives/layout/Collapsible/internal/CollapsiblePanel.tsxnew file mode 100644index 00000000000..5d4898beed2--- /dev/null+++ b/packages/twenty-ui/src/primitives/layout/Collapsible/internal/CollapsiblePanel.tsx@@ -0,0 +1,25 @@+import { Collapsible as CollapsiblePrimitive } from '@base-ui/react/collapsible';+import { clsx } from 'clsx';++import { mergeClassNames } from '@ui/utilities/internal/mergeClassNames';++import styles from '../Collapsible.module.scss';+import { type CollapsiblePanelProps } from '../types/CollapsiblePanelProps';++export const CollapsiblePanel = ({+ dimension = 'height',+ containAnimation = true,+ duration = 'normal',+ className,+ ...props+}: CollapsiblePanelProps) => (+ <CollapsiblePrimitive.Panel+ data-dimension={dimension}+ data-duration={duration}+ {...props}+ className={mergeClassNames(+ clsx(styles.panel, containAnimation && styles.contained),+ className,+ )}+ />+);diff --git a/packages/twenty-ui/src/primitives/layout/Collapsible/types/AnimationDurationObject.ts b/packages/twenty-ui/src/primitives/layout/Collapsible/types/AnimationDurationObject.tsdeleted file mode 100644index 3867129f138..00000000000--- a/packages/twenty-ui/src/primitives/layout/Collapsible/types/AnimationDurationObject.ts+++ /dev/null@@ -1,4 +0,0 @@-export type AnimationDurationObject = {- opacity: number;- size: number;-};diff --git a/packages/twenty-ui/src/primitives/layout/Collapsible/types/AnimationDurations.ts b/packages/twenty-ui/src/primitives/layout/Collapsible/types/AnimationDurations.tsdeleted file mode 100644index 3f53d7d7c8c..00000000000--- a/packages/twenty-ui/src/primitives/layout/Collapsible/types/AnimationDurations.ts+++ /dev/null@@ -1,3 +0,0 @@-import { type AnimationDurationObject } from '@ui/primitives/layout/Collapsible/types/AnimationDurationObject';--export type AnimationDurations = AnimationDurationObject | 'default';diff --git a/packages/twenty-ui/src/primitives/layout/Collapsible/types/CollapsiblePanelProps.ts b/packages/twenty-ui/src/primitives/layout/Collapsible/types/CollapsiblePanelProps.tsnew file mode 100644index 00000000000..8fbbc785570--- /dev/null+++ b/packages/twenty-ui/src/primitives/layout/Collapsible/types/CollapsiblePanelProps.ts@@ -0,0 +1,11 @@+import { type Collapsible as CollapsiblePrimitive } from '@base-ui/react/collapsible';++import { type AnimationDuration } from '@ui/theme';++import { type AnimationDimension } from './AnimationDimension';++export type CollapsiblePanelProps = CollapsiblePrimitive.Panel.Props & {+ dimension?: AnimationDimension;+ containAnimation?: boolean;+ duration?: AnimationDuration;+};diff --git a/packages/twenty-ui/src/primitives/layout/Collapsible/types/CollapsiblePanelState.ts b/packages/twenty-ui/src/primitives/layout/Collapsible/types/CollapsiblePanelState.tsnew file mode 100644index 00000000000..7ef398635dd--- /dev/null+++ b/packages/twenty-ui/src/primitives/layout/Collapsible/types/CollapsiblePanelState.ts@@ -0,0 +1,3 @@+import { type Collapsible as CollapsiblePrimitive } from '@base-ui/react/collapsible';++export type CollapsiblePanelState = CollapsiblePrimitive.Panel.State;diff --git a/packages/twenty-ui/src/primitives/layout/Collapsible/types/CollapsibleRootChangeEventDetails.ts b/packages/twenty-ui/src/primitives/layout/Collapsible/types/CollapsibleRootChangeEventDetails.tsnew file mode 100644index 00000000000..6ea343c133f--- /dev/null+++ b/packages/twenty-ui/src/primitives/layout/Collapsible/types/CollapsibleRootChangeEventDetails.ts@@ -0,0 +1,4 @@+import { type Collapsible as CollapsiblePrimitive } from '@base-ui/react/collapsible';++export type CollapsibleRootChangeEventDetails =+ CollapsiblePrimitive.Root.ChangeEventDetails;diff --git a/packages/twenty-ui/src/primitives/layout/Collapsible/types/CollapsibleRootChangeEventReason.ts b/packages/twenty-ui/src/primitives/layout/Collapsible/types/CollapsibleRootChangeEventReason.tsnew file mode 100644index 00000000000..361735f22fa--- /dev/null+++ b/packages/twenty-ui/src/primitives/layout/Collapsible/types/CollapsibleRootChangeEventReason.ts@@ -0,0 +1,4 @@+import { type Collapsible as CollapsiblePrimitive } from '@base-ui/react/collapsible';++export type CollapsibleRootChangeEventReason =+ CollapsiblePrimitive.Root.ChangeEventReason;diff --git a/packages/twenty-ui/src/primitives/layout/Collapsible/types/CollapsibleRootProps.ts b/packages/twenty-ui/src/primitives/layout/Collapsible/types/CollapsibleRootProps.tsnew file mode 100644index 00000000000..2b377855bf4--- /dev/null+++ b/packages/twenty-ui/src/primitives/layout/Collapsible/types/CollapsibleRootProps.ts@@ -0,0 +1,3 @@+import { type Collapsible as CollapsiblePrimitive } from '@base-ui/react/collapsible';++export type CollapsibleRootProps = CollapsiblePrimitive.Root.Props;diff --git a/packages/twenty-ui/src/primitives/layout/Collapsible/types/CollapsibleRootState.ts b/packages/twenty-ui/src/primitives/layout/Collapsible/types/CollapsibleRootState.tsnew file mode 100644index 00000000000..89dffa0b940--- /dev/null+++ b/packages/twenty-ui/src/primitives/layout/Collapsible/types/CollapsibleRootState.ts@@ -0,0 +1,3 @@+import { type Collapsible as CollapsiblePrimitive } from '@base-ui/react/collapsible';++export type CollapsibleRootState = CollapsiblePrimitive.Root.State;diff --git a/packages/twenty-ui/src/primitives/layout/Collapsible/types/CollapsibleTriggerProps.ts b/packages/twenty-ui/src/primitives/layout/Collapsible/types/CollapsibleTriggerProps.tsnew file mode 100644index 00000000000..65d8e9c45e7--- /dev/null+++ b/packages/twenty-ui/src/primitives/layout/Collapsible/types/CollapsibleTriggerProps.ts@@ -0,0 +1,3 @@+import { type Collapsible as CollapsiblePrimitive } from '@base-ui/react/collapsible';++export type CollapsibleTriggerProps = CollapsiblePrimitive.Trigger.Props;diff --git a/packages/twenty-ui/src/primitives/layout/Collapsible/types/CollapsibleTriggerState.ts b/packages/twenty-ui/src/primitives/layout/Collapsible/types/CollapsibleTriggerState.tsnew file mode 100644index 00000000000..5cf891c506e--- /dev/null+++ b/packages/twenty-ui/src/primitives/layout/Collapsible/types/CollapsibleTriggerState.ts@@ -0,0 +1,3 @@+import { type Collapsible as CollapsiblePrimitive } from '@base-ui/react/collapsible';++export type CollapsibleTriggerState = CollapsiblePrimitive.Trigger.State;diff --git a/packages/twenty-ui/src/primitives/layout/index.ts b/packages/twenty-ui/src/primitives/layout/index.tsindex 7a5748236cd..38345615056 100644--- a/packages/twenty-ui/src/primitives/layout/index.ts+++ b/packages/twenty-ui/src/primitives/layout/index.ts@@ -9,8 +9,14 @@export { Collapsible } from './Collapsible/Collapsible';export type { AnimationDimension } from './Collapsible/types/AnimationDimension';-export type { AnimationDurationObject } from './Collapsible/types/AnimationDurationObject';-export type { AnimationDurations } from './Collapsible/types/AnimationDurations';+export type { CollapsiblePanelProps } from './Collapsible/types/CollapsiblePanelProps';+export type { CollapsiblePanelState } from './Collapsible/types/CollapsiblePanelState';+export type { CollapsibleRootChangeEventDetails } from './Collapsible/types/CollapsibleRootChangeEventDetails';+export type { CollapsibleRootChangeEventReason } from './Collapsible/types/CollapsibleRootChangeEventReason';+export type { CollapsibleRootProps } from './Collapsible/types/CollapsibleRootProps';+export type { CollapsibleRootState } from './Collapsible/types/CollapsibleRootState';+export type { CollapsibleTriggerProps } from './Collapsible/types/CollapsibleTriggerProps';+export type { CollapsibleTriggerState } from './Collapsible/types/CollapsibleTriggerState';export { DirectionProvider } from './DirectionProvider/DirectionProvider';export type { DirectionProviderProps } from './DirectionProvider/types/DirectionProviderProps';export { ResizeHandle } from './ResizeHandle/ResizeHandle';