The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Add compact Tabs for tool call details (#28395)
Raphaël Bosi0174e5b100f6
diff --git a/packages/twenty-docs/snippets/ui/generated/navigation/tabs.mdx b/packages/twenty-docs/snippets/ui/generated/navigation/tabs.mdxindex ae35c44ed5e..978717926fb 100644--- a/packages/twenty-docs/snippets/ui/generated/navigation/tabs.mdx+++ b/packages/twenty-docs/snippets/ui/generated/navigation/tabs.mdx@@ -134,8 +134,8 @@Accepts a `ReactElement` or a function that returns the element to render.</ParamField>-<ParamField body="Tab.size" type=""md" | "sm"" default="sm">- Visual size of the tab.+<ParamField body="Tab.size" type=""compact" | "md" | "sm"" default="sm">+ Visual tab size. Compact uses a 24px minimum height, small text, and 4px content padding; sm and md keep a 40px minimum height.</ParamField><ParamField body="Tab.startIcon" type="ReactNode">diff --git a/packages/twenty-docs/ui/primitives/navigation/tabs.mdx b/packages/twenty-docs/ui/primitives/navigation/tabs.mdxindex 8335fbf0413..d07325c6ea6 100644--- a/packages/twenty-docs/ui/primitives/navigation/tabs.mdx+++ b/packages/twenty-docs/ui/primitives/navigation/tabs.mdx@@ -36,7 +36,33 @@ export const RecordTabs = () => ();```-`Tabs.Tab` accepts `startIcon`, `endIcon`, `badge`, and a `size` of `sm` or `md` (default `sm`). The remaining props retain the installed Base UI contract. Values are not restricted to strings or numbers. Reference values must use the same identity on their tab, panel, and root. A root value of `null` selects no panel.+`Tabs.Tab` accepts `startIcon`, `endIcon`, `badge`, and a `size` of `compact`, `sm`, or `md` (default `sm`). The remaining props retain the installed Base UI contract. Values are not restricted to strings or numbers. Reference values must use the same identity on their tab, panel, and root. A root value of `null` selects no panel.++### Compact tabs++Use `size="compact"` on each tab for short Input/Output controls inside a card. Compact tabs have a 24px minimum row height, small text, and 4px content padding on each side. The existing `sm` and `md` sizes keep their 40px minimum height. Compact tabs use the same indicator, focus ring, and keyboard activation as the other sizes.++```tsx+import { Tabs } from 'twenty-ui/primitives/navigation';++export const ToolCallTabs = () => (+ <Tabs.Root defaultValue="output">+ <Tabs.List aria-label="Tool call details">+ <Tabs.Tab value="output" size="compact">Output</Tabs.Tab>+ <Tabs.Tab value="input" size="compact">Input</Tabs.Tab>+ <Tabs.Indicator />+ </Tabs.List>+ <Tabs.Panel value="output">Tool output</Tabs.Panel>+ <Tabs.Panel value="input">Tool input</Tabs.Panel>+ </Tabs.Root>+);+```++<StoryEmbed+ storyId="ui-navigation-tabs--compact"+ title="Compact Input and Output tabs"+ height={110}+/>## Anatomydiff --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 a50b79cf7eb..b981a7adc9c 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@@ -8,6 +8,7 @@ import { JsonTree } from 'twenty-ui/components/data-display';import { IconChevronDown, IconChevronUp, IconTool } from 'twenty-ui/icon';import { Tag } from 'twenty-ui/primitives/data-display';import { Collapsible } from 'twenty-ui/primitives/layout';+import { Tabs } from 'twenty-ui/primitives/navigation';import { themeCssVariables } from 'twenty-ui/theme';import { type AdminChatThreadMessagePart } from '@/settings/admin-panel/types/AdminChatThreadMessagePart';@@ -58,26 +59,10 @@ const StyledRightContent = styled.span``;const StyledTabContainer = styled.div`- display: flex;gap: ${themeCssVariables.spacing[2]};margin-top: ${themeCssVariables.spacing[2]};`;-const StyledTab = styled.button<{ isActive: boolean }>`- background: none;- border: none;- border-bottom: 1px solid- ${({ isActive }) =>- isActive ? themeCssVariables.font.color.primary : 'transparent'};- color: ${({ isActive }) =>- isActive- ? themeCssVariables.font.color.primary- : themeCssVariables.font.color.tertiary};- cursor: pointer;- font-size: ${themeCssVariables.font.size.sm};- padding: ${themeCssVariables.spacing[1]} 0;-`;-const StyledJsonTreeContainer = styled.div`margin-top: ${themeCssVariables.spacing[2]};max-height: 300px;@@ -111,9 +96,18 @@ export const SettingsAdminChatToolCallPart = ({const hasToolError =part.state === 'output-error' || isNonEmptyString(part.errorMessage);- const activeJsonValue = parseAdminToolJson(- activeTab === 'output' ? part.toolOutput : part.toolInput,- );+ const tabPanels = [+ {+ value: 'output',+ content: parseAdminToolJson(part.toolOutput),+ emptyLabel: t`No output`,+ },+ {+ value: 'input',+ content: parseAdminToolJson(part.toolInput),+ emptyLabel: t`No input`,+ },+ ];return (<StyledContainer>@@ -138,38 +132,48 @@ export const SettingsAdminChatToolCallPart = ({</StyledToggleRow><Collapsible.Root open={isExpanded}><Collapsible.Panel>- <StyledTabContainer>- <StyledTab- isActive={activeTab === 'output'}- onClick={() => setActiveTab('output')}- >- {t`Output`}- </StyledTab>- <StyledTab- isActive={activeTab === 'input'}- onClick={() => setActiveTab('input')}+ <Tabs.Root+ value={activeTab}+ onValueChange={(value) => {+ if (value !== 'output' && value !== 'input') {+ return;+ }+ setActiveTab(value);+ }}+ >+ <Tabs.List+ aria-label={t`Tool call details`}+ render={<StyledTabContainer />}>- {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>- )}+ <Tabs.Tab value="output" size="compact">+ {t`Output`}+ </Tabs.Tab>+ <Tabs.Tab value="input" size="compact">+ {t`Input`}+ </Tabs.Tab>+ <Tabs.Indicator />+ </Tabs.List>+ {tabPanels.map(({ value, content, emptyLabel }) => (+ <Tabs.Panel key={value} value={value}>+ {isDefined(content) ? (+ <StyledJsonTreeContainer>+ <JsonTree+ value={content}+ shouldExpandNodeInitially={() => false}+ emptyArrayLabel={t`Empty Array`}+ emptyObjectLabel={t`Empty Object`}+ emptyStringLabel={t`[empty string]`}+ arrowButtonCollapsedLabel={t`Expand`}+ arrowButtonExpandedLabel={t`Collapse`}+ onNodeValueClick={copyToClipboard}+ />+ </StyledJsonTreeContainer>+ ) : (+ <StyledEmptyTabLabel>{emptyLabel}</StyledEmptyTabLabel>+ )}+ </Tabs.Panel>+ ))}+ </Tabs.Root>{isNonEmptyString(part.errorMessage) && (<StyledErrorMessage>{part.errorMessage}</StyledErrorMessage>)}diff --git a/packages/twenty-front/src/modules/settings/admin-panel/components/__stories__/SettingsAdminChatToolCallPart.stories.tsx b/packages/twenty-front/src/modules/settings/admin-panel/components/__stories__/SettingsAdminChatToolCallPart.stories.tsxnew file mode 100644index 00000000000..4660958ebcd--- /dev/null+++ b/packages/twenty-front/src/modules/settings/admin-panel/components/__stories__/SettingsAdminChatToolCallPart.stories.tsx@@ -0,0 +1,117 @@+import { type Meta, type StoryObj } from '@storybook/react-vite';+import { expect, userEvent, waitFor, within } from 'storybook/test';+import { ComponentDecorator } from 'twenty-ui/testing';++import { SettingsAdminChatToolCallPart } from '@/settings/admin-panel/components/SettingsAdminChatToolCallPart';+import { type AdminChatThreadMessagePart } from '@/settings/admin-panel/types/AdminChatThreadMessagePart';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';++const TOOL_PART: AdminChatThreadMessagePart = {+ type: 'tool-inspect_tool',+ orderIndex: 0,+ toolName: 'inspect_tool',+ toolInput: '"Saved input"',+ toolOutput: '"Saved output"',+ state: 'output-available',+};++const meta: Meta<typeof SettingsAdminChatToolCallPart> = {+ title: 'Modules/Settings/AdminPanel/SettingsAdminChatToolCallPart',+ component: SettingsAdminChatToolCallPart,+ decorators: [ToastDecorator, ComponentDecorator],+ parameters: { container: { width: 500 } },+ args: { part: TOOL_PART },+};++export default meta;+type Story = StoryObj<typeof SettingsAdminChatToolCallPart>;++export const OutputAndInput: Story = {+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ const user = userEvent.setup({ writeToClipboard: true });+ const toggle = canvas.getByRole('button', { name: 'inspect_tool' });+ await user.click(toggle);+ const output = await canvas.findByRole('tab', { name: 'Output' });+ const input = canvas.getByRole('tab', { name: 'Input' });+ await waitFor(() => {+ expect(output).toBeVisible();+ expect(output).toHaveAttribute('aria-selected', 'true');+ expect(+ canvas.getByRole('button', { name: 'Saved output' }),+ ).toBeVisible();+ });+ await user.click(canvas.getByRole('button', { name: 'Saved output' }));+ await waitFor(async () =>+ expect(await navigator.clipboard.readText()).toBe('Saved output'),+ );+ await user.click(output);+ await user.keyboard('{ArrowRight}');+ await expect(input).toHaveFocus();+ await expect(output).toHaveAttribute('aria-selected', 'true');+ await user.keyboard('{Enter}');+ await waitFor(() => expect(input).toHaveAttribute('aria-selected', 'true'));+ await expect(canvas.getByRole('tabpanel', { name: 'Input' })).toBeVisible();+ await user.click(canvas.getByRole('button', { name: 'Saved input' }));+ await waitFor(async () =>+ expect(await navigator.clipboard.readText()).toBe('Saved input'),+ );+ await user.click(toggle);+ await waitFor(() =>+ expect(canvas.queryByRole('tablist', { hidden: true })).toBeNull(),+ );+ await user.click(toggle);+ await waitFor(() => {+ const reopenedInput = canvas.getByRole('tab', { name: 'Input' });+ expect(reopenedInput).toBeVisible();+ expect(reopenedInput).toHaveAttribute('aria-selected', 'true');+ expect(canvas.getByRole('tabpanel', { name: 'Input' })).toBeVisible();+ });+ },+};++export const InputWithoutOutput: Story = {+ args: { part: { ...TOOL_PART, toolOutput: null, state: 'input-available' } },+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ await userEvent.click(canvas.getByRole('button', { name: 'inspect_tool' }));+ const input = await canvas.findByRole('tab', { name: 'Input' });+ await waitFor(() => {+ expect(input).toBeVisible();+ expect(input).toHaveAttribute('aria-selected', 'true');+ expect(canvas.getByRole('button', { name: 'Saved input' })).toBeVisible();+ });+ await userEvent.click(canvas.getByRole('tab', { name: 'Output' }));+ await waitFor(() => expect(canvas.getByText('No output')).toBeVisible());+ },+};++export const ErrorWithTabs: Story = {+ args: {+ part: {+ ...TOOL_PART,+ state: 'output-error',+ errorMessage: 'Request failed',+ },+ },+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ await userEvent.click(+ canvas.getByRole('button', { name: 'inspect_tool Failed' }),+ );+ const error = await canvas.findByText('Request failed');+ await waitFor(() => {+ expect(error).toBeVisible();+ expect(canvas.getByRole('tab', { name: 'Output' })).toBeVisible();+ expect(canvas.getByRole('tab', { name: 'Output' })).toHaveAttribute(+ 'aria-selected',+ 'true',+ );+ });+ await userEvent.click(canvas.getByRole('tab', { name: 'Input' }));+ await waitFor(() => {+ expect(canvas.getByRole('tabpanel', { name: 'Input' })).toBeVisible();+ expect(error).toBeVisible();+ });+ },+};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 c369257c00b..60255f2c776 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@@ -15,6 +15,7 @@ import {IconCircleX,} from 'twenty-ui/icon';import { Collapsible } from 'twenty-ui/primitives/layout';+import { Tabs } from 'twenty-ui/primitives/navigation';import { useTheme, themeCssVariables } from 'twenty-ui/theme';import { type JsonValue } from 'type-fest';import { useCopyToClipboard } from '~/hooks/useCopyToClipboard';@@ -92,32 +93,10 @@ const StyledContentContainer = styled.div``;const StyledTabContainer = styled.div`- border-bottom: 1px solid ${themeCssVariables.border.color.light};- display: flex;gap: ${themeCssVariables.spacing[3]};margin-bottom: ${themeCssVariables.spacing[3]};`;-const StyledTab = styled.button<{ isActive: boolean }>`- background: none;- border: none;- color: ${({ isActive }) =>- isActive- ? themeCssVariables.font.color.primary- : themeCssVariables.font.color.tertiary};- cursor: pointer;- font-size: ${themeCssVariables.font.size.sm};- font-weight: ${({ isActive }) =>- isActive- ? themeCssVariables.font.weight.medium- : themeCssVariables.font.weight.regular};- padding: 0 0 ${themeCssVariables.spacing[2]};-- &:hover {- color: ${themeCssVariables.font.color.primary};- }-`;-const StyledJsonTreeContainer = styled.div`overflow-x: auto;`;@@ -146,6 +125,10 @@ export const WorkflowRunStepLogsToolCallRow = ({const hasOutput = isDefined(toolCall.output);const hasInput = isDefined(toolCall.input);const isExpandable = hasOutput || hasInput || hasError;+ const tabPanels = [+ { value: 'output', content: toolCall.output ?? t`No output` },+ { value: 'input', content: toolCall.input ?? t`No input` },+ ];const ToolIcon = getToolIcon(toolCall.toolName);const StatusIcon = hasError ? IconCircleX : IconCheck;@@ -196,41 +179,44 @@ export const WorkflowRunStepLogsToolCallRow = ({{hasError && isDefined(toolCall.errorMessage) ? (<StyledErrorMessage>{toolCall.errorMessage}</StyledErrorMessage>) : (- <>- <StyledTabContainer>- <StyledTab- type="button"- isActive={activeTab === 'output'}- onClick={() => setActiveTab('output')}- >+ <Tabs.Root+ value={activeTab}+ onValueChange={(value) => {+ if (value !== 'output' && value !== 'input') {+ return;+ }+ setActiveTab(value);+ }}+ >+ <Tabs.List+ aria-label={t`Tool call details`}+ render={<StyledTabContainer />}+ >+ <Tabs.Tab value="output" size="compact">{t`Output`}- </StyledTab>- <StyledTab- type="button"- isActive={activeTab === 'input'}- onClick={() => setActiveTab('input')}- >+ </Tabs.Tab>+ <Tabs.Tab value="input" size="compact">{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>- </>+ </Tabs.Tab>+ <Tabs.Indicator />+ </Tabs.List>+ {tabPanels.map(({ value, content }) => (+ <Tabs.Panel key={value} value={value}>+ <StyledJsonTreeContainer>+ <JsonTree+ value={content 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>+ ))}+ </Tabs.Root>)}</StyledContentContainer></Collapsible.Panel>diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/__stories__/WorkflowRunStepLogsToolCallRow.stories.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/__stories__/WorkflowRunStepLogsToolCallRow.stories.tsxnew file mode 100644index 00000000000..299d0e2801a--- /dev/null+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/__stories__/WorkflowRunStepLogsToolCallRow.stories.tsx@@ -0,0 +1,112 @@+import { type Meta, type StoryObj } from '@storybook/react-vite';+import { graphql, HttpResponse } from 'msw';+import { expect, userEvent, waitFor, within } from 'storybook/test';+import { type AgentRunToolCallLog } from 'twenty-shared/ai';+import { ComponentDecorator } from 'twenty-ui/testing';++import { WorkflowRunStepLogsToolCallRow } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowRunStepLogsToolCallRow';+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';++const TOOL_CALL: AgentRunToolCallLog = {+ toolName: 'inspect_tool',+ toolCallId: 'inspect-tool-call',+ state: 'success',+ input: 'Saved input',+ output: 'Saved output',+};++const meta: Meta<typeof WorkflowRunStepLogsToolCallRow> = {+ title: 'Modules/Workflow/Actions/WorkflowRunStepLogsToolCallRow',+ component: WorkflowRunStepLogsToolCallRow,+ decorators: [ToastDecorator, ComponentDecorator],+ args: { toolCall: TOOL_CALL },+ parameters: {+ container: { width: 500 },+ msw: {+ handlers: [+ graphql.query('GetToolIndex', () =>+ HttpResponse.json({ data: { getToolIndex: [] } }),+ ),+ ],+ },+ },+};++export default meta;+type Story = StoryObj<typeof WorkflowRunStepLogsToolCallRow>;++export const OutputAndInput: Story = {+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ const user = userEvent.setup({ writeToClipboard: true });+ const toggle = canvas.getByRole('button', { name: /inspect_tool/ });+ await user.click(toggle);+ const output = await canvas.findByRole('tab', { name: 'Output' });+ const input = canvas.getByRole('tab', { name: 'Input' });+ await waitFor(() => {+ expect(output).toBeVisible();+ expect(output).toHaveAttribute('aria-selected', 'true');+ expect(+ canvas.getByRole('button', { name: 'Saved output' }),+ ).toBeVisible();+ });+ await user.click(canvas.getByRole('button', { name: 'Saved output' }));+ await waitFor(async () =>+ expect(await navigator.clipboard.readText()).toBe('Saved output'),+ );+ await user.click(output);+ await user.keyboard('{ArrowRight}');+ await expect(input).toHaveFocus();+ await expect(output).toHaveAttribute('aria-selected', 'true');+ await user.keyboard('{Enter}');+ await waitFor(() => expect(input).toHaveAttribute('aria-selected', 'true'));+ await user.click(canvas.getByRole('button', { name: 'Saved input' }));+ await waitFor(async () =>+ expect(await navigator.clipboard.readText()).toBe('Saved input'),+ );+ await user.click(toggle);+ await waitFor(() =>+ expect(canvas.queryByRole('tablist', { hidden: true })).toBeNull(),+ );+ await user.click(toggle);+ await waitFor(() => {+ const reopenedInput = canvas.getByRole('tab', { name: 'Input' });+ expect(reopenedInput).toBeVisible();+ expect(reopenedInput).toHaveAttribute('aria-selected', 'true');+ expect(canvas.getByRole('tabpanel', { name: 'Input' })).toBeVisible();+ });+ },+};++export const MissingOutput: Story = {+ args: { toolCall: { ...TOOL_CALL, output: undefined } },+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ await userEvent.click(canvas.getByRole('button', { name: /inspect_tool/ }));+ const output = await canvas.findByRole('tab', { name: 'Output' });+ await waitFor(() => {+ expect(output).toBeVisible();+ expect(output).toHaveAttribute('aria-selected', 'true');+ expect(canvas.getByRole('button', { name: 'No output' })).toBeVisible();+ });+ await userEvent.click(canvas.getByRole('tab', { name: 'Input' }));+ await waitFor(() =>+ expect(canvas.getByRole('button', { name: 'Saved input' })).toBeVisible(),+ );+ },+};++export const ErrorWithoutTabs: Story = {+ args: {+ toolCall: { ...TOOL_CALL, state: 'error', errorMessage: 'Request failed' },+ },+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ await userEvent.click(canvas.getByRole('button', { name: /inspect_tool/ }));+ const error = await canvas.findByText('Request failed');+ await waitFor(() => {+ expect(error).toBeVisible();+ expect(canvas.queryByRole('tablist', { hidden: true })).toBeNull();+ });+ },+};diff --git a/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsApplicationPreferences.stories.tsx b/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsApplicationPreferences.stories.tsxindex 9200ee46ce9..cf443a379fe 100644--- a/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsApplicationPreferences.stories.tsx+++ b/packages/twenty-front/src/pages/settings/accounts/__stories__/SettingsApplicationPreferences.stories.tsx@@ -248,9 +248,11 @@ export const SavedSecretCanBeCleared: Story = {]),);await waitFor(() => expect(saveButton).toBeDisabled());- expect(- canvas.queryByPlaceholderText('sk-1********'),- ).not.toBeInTheDocument();+ await waitFor(() =>+ expect(+ canvas.queryByPlaceholderText('sk-1********'),+ ).not.toBeInTheDocument(),+ );},};diff --git a/packages/twenty-ui/docs/components.ts b/packages/twenty-ui/docs/components.tsindex f40bc1f0cf1..625213de0fd 100644--- a/packages/twenty-ui/docs/components.ts+++ b/packages/twenty-ui/docs/components.ts@@ -578,6 +578,7 @@ export const DOCUMENTED_COMPONENTS = [Tab: {endIcon: 'Decorative content after the label and before the badge.',highlighted: 'Emphasizes the tab content without changing selection.',+ size: 'Visual tab size. Compact uses a 24px minimum height, small text, and 4px content padding; sm and md keep a 40px minimum height.',},},},diff --git a/packages/twenty-ui/generated/components.docs.json b/packages/twenty-ui/generated/components.docs.jsonindex b661ed96aa7..b7fa3da3393 100644--- a/packages/twenty-ui/generated/components.docs.json+++ b/packages/twenty-ui/generated/components.docs.json@@ -7932,10 +7932,10 @@},{"name": "size",- "type": "\"md\" | \"sm\"",+ "type": "\"compact\" | \"md\" | \"sm\"","required": false,"defaultValue": "sm",- "description": "Visual size of the tab."+ "description": "Visual tab size. Compact uses a 24px minimum height, small text, and 4px content padding; sm and md keep a 40px minimum height."},{"name": "startIcon",diff --git a/packages/twenty-ui/src/components/input/CountrySelect/__stories__/CountrySelect.parts.stories.tsx b/packages/twenty-ui/src/components/input/CountrySelect/__stories__/CountrySelect.parts.stories.tsxindex 0ca0616f9ed..6e9ed6feed8 100644--- a/packages/twenty-ui/src/components/input/CountrySelect/__stories__/CountrySelect.parts.stories.tsx+++ b/packages/twenty-ui/src/components/input/CountrySelect/__stories__/CountrySelect.parts.stories.tsx@@ -126,6 +126,7 @@ const assertCancellation: NonNullable<Story['play']> = async ({await waitFor(() =>expect(trigger).toHaveAttribute('aria-expanded', 'false'),);+ await waitFor(() => expect(popup).not.toBeInTheDocument());};export const ShorthandCancellation: Story = {diff --git a/packages/twenty-ui/src/primitives/input/Autocomplete/__stories__/Autocomplete.composition.stories.tsx b/packages/twenty-ui/src/primitives/input/Autocomplete/__stories__/Autocomplete.composition.stories.tsxindex aa7c96983ae..a74b77657b7 100644--- a/packages/twenty-ui/src/primitives/input/Autocomplete/__stories__/Autocomplete.composition.stories.tsx+++ b/packages/twenty-ui/src/primitives/input/Autocomplete/__stories__/Autocomplete.composition.stories.tsx@@ -87,7 +87,7 @@ export const CompositionConfirmation: Story = {inputType: 'insertCompositionText',isComposing: true,});- await body.findByRole('listbox');+ await body.findByRole('listbox', { name: 'Fruit suggestions' });const apple = body.getByRole('option', { name: 'Apple' });await waitFor(() =>expect(input).toHaveAttribute('aria-activedescendant', apple.id),@@ -121,6 +121,9 @@ export const CompositionConfirmation: Story = {await userEvent.keyboard('{Enter}');await expect(input).toHaveValue('Cherry');await expect(input).toHaveAttribute('aria-expanded', 'false');+ await waitFor(() =>+ expect(body.queryByRole('listbox', { hidden: true })).toBeNull(),+ );},};diff --git a/packages/twenty-ui/src/primitives/input/Autocomplete/__stories__/Autocomplete.interactions.stories.tsx b/packages/twenty-ui/src/primitives/input/Autocomplete/__stories__/Autocomplete.interactions.stories.tsxindex cac0caefe25..431795d6390 100644--- a/packages/twenty-ui/src/primitives/input/Autocomplete/__stories__/Autocomplete.interactions.stories.tsx+++ b/packages/twenty-ui/src/primitives/input/Autocomplete/__stories__/Autocomplete.interactions.stories.tsx@@ -193,7 +193,7 @@ const PreventedEnterExample = () => {<Autocomplete.Portal><Autocomplete.Positioner><Autocomplete.Popup>- <Autocomplete.List>+ <Autocomplete.List aria-label="Fruit suggestions">{(fruit: string) => (<Autocomplete.Item key={fruit} value={fruit}>{fruit}@@ -228,6 +228,9 @@ export const PreventedKeyDown: Story = {await expect(input).toHaveValue('a');await expect(input).toHaveAttribute('aria-expanded', 'true');await userEvent.keyboard('{Escape}');+ await waitFor(() =>+ expect(body.queryByRole('listbox', { hidden: true })).toBeNull(),+ );await userEvent.click(await canvas.findByRole('button', { name: 'Allow Base UI selection' }),);@@ -240,5 +243,8 @@ export const PreventedKeyDown: Story = {await expect(canvas.getByText('Enter count: 2')).toBeVisible();await expect(input).toHaveValue('Apple');await expect(input).toHaveAttribute('aria-expanded', 'false');+ await waitFor(() =>+ expect(body.queryByRole('listbox', { hidden: true })).toBeNull(),+ );},};diff --git a/packages/twenty-ui/src/primitives/input/Autocomplete/__stories__/AutocompleteExample.tsx b/packages/twenty-ui/src/primitives/input/Autocomplete/__stories__/AutocompleteExample.tsxindex 87ea9aa0dd3..5b8ce2b01c1 100644--- a/packages/twenty-ui/src/primitives/input/Autocomplete/__stories__/AutocompleteExample.tsx+++ b/packages/twenty-ui/src/primitives/input/Autocomplete/__stories__/AutocompleteExample.tsx@@ -16,7 +16,7 @@ export const AutocompleteExample = (<Autocomplete.Positioner><Autocomplete.Popup><Autocomplete.Empty>No fruits found</Autocomplete.Empty>- <Autocomplete.List>+ <Autocomplete.List aria-label="Fruit suggestions">{(fruit: string) => (<Autocomplete.Item key={fruit} value={fruit}>{fruit}diff --git a/packages/twenty-ui/src/primitives/navigation/Tabs/__stories__/Tabs.stories.tsx b/packages/twenty-ui/src/primitives/navigation/Tabs/__stories__/Tabs.stories.tsxindex d7bf87607a1..121b8abdc5c 100644--- a/packages/twenty-ui/src/primitives/navigation/Tabs/__stories__/Tabs.stories.tsx+++ b/packages/twenty-ui/src/primitives/navigation/Tabs/__stories__/Tabs.stories.tsx@@ -118,6 +118,68 @@ export const Default: Story = {},};+export const Compact: Story = {+ ...Display,+ args: { size: 'compact' },+ render: ({ size }) => (+ <Tabs.Root defaultValue="output">+ <Tabs.List aria-label="Tool call details">+ <Tabs.Tab value="output" size={size}>+ Output+ </Tabs.Tab>+ <Tabs.Tab value="input" size={size}>+ Input+ </Tabs.Tab>+ <Tabs.Indicator data-testid="compact-indicator" />+ </Tabs.List>+ <Tabs.Panel value="output">Saved output</Tabs.Panel>+ <Tabs.Panel value="input">Saved input</Tabs.Panel>+ </Tabs.Root>+ ),+};++export const CompactInteractions: Story = {+ ...Compact,+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ const output = canvas.getByRole('tab', { name: 'Output' });+ const input = canvas.getByRole('tab', { name: 'Input' });+ const indicator = canvas.getByTestId('compact-indicator');++ for (const tab of [output, input]) {+ await expect(tab).toHaveAttribute('data-size', 'compact');+ await expect(getComputedStyle(tab).minBlockSize).toBe('24px');+ await expect(tab.getBoundingClientRect().height).toBeGreaterThanOrEqual(+ 24,+ );+ await expect(tab.getBoundingClientRect().height).toBeLessThan(40);+ await expect(tab.firstElementChild).toHaveStyle({ padding: '4px' });+ }+ await userEvent.click(output);+ await userEvent.keyboard('{ArrowRight}');+ await expect(input).toHaveFocus();+ await expect(output).toHaveAttribute('aria-selected', 'true');+ await expect(+ canvas.getByRole('tabpanel', { name: 'Output' }),+ ).toBeVisible();+ await userEvent.keyboard('{Enter}');+ await waitFor(() => {+ expect(input).toHaveAttribute('aria-selected', 'true');+ expect(canvas.getByRole('tabpanel', { name: 'Input' })).toHaveTextContent(+ 'Saved input',+ );+ expect(indicator.getBoundingClientRect().width).toBeCloseTo(+ input.getBoundingClientRect().width,+ 0,+ );+ expect(indicator.getBoundingClientRect().left).toBeCloseTo(+ input.getBoundingClientRect().left,+ 0,+ );+ });+ },+};+export const Controlled: Story = {decorators: [ComponentDecorator],parameters: { container: { width: 360 } },@@ -328,7 +390,7 @@ export const Catalog: CatalogStory<Story, typeof Tabs.Tab> = {dimensions: [{name: 'size',- values: ['sm', 'md'] satisfies TabsSize[],+ values: ['compact', 'sm', 'md'] satisfies TabsSize[],props: (size: TabsSize) => ({ size }),},{diff --git a/packages/twenty-ui/src/primitives/navigation/Tabs/__tests__/Tabs.test.tsx b/packages/twenty-ui/src/primitives/navigation/Tabs/__tests__/Tabs.test.tsxindex 6913c8eeb85..8426aef0807 100644--- a/packages/twenty-ui/src/primitives/navigation/Tabs/__tests__/Tabs.test.tsx+++ b/packages/twenty-ui/src/primitives/navigation/Tabs/__tests__/Tabs.test.tsx@@ -41,7 +41,11 @@ runComponentConformance({runComponentConformance({name: 'Tabs.Tab',- element: <Tabs.Tab value="overview">Overview</Tabs.Tab>,+ element: (+ <Tabs.Tab value="overview" size="compact">+ Overview+ </Tabs.Tab>+ ),refInstanceOf: HTMLButtonElement,ownClassName: styles.tab,renderPropTagName: 'button',diff --git a/packages/twenty-ui/src/primitives/navigation/Tabs/types/TabsSize.ts b/packages/twenty-ui/src/primitives/navigation/Tabs/types/TabsSize.tsindex 7179640e187..ee0bbc3f182 100644--- a/packages/twenty-ui/src/primitives/navigation/Tabs/types/TabsSize.ts+++ b/packages/twenty-ui/src/primitives/navigation/Tabs/types/TabsSize.ts@@ -1 +1 @@-export type TabsSize = 'sm' | 'md';+export type TabsSize = 'compact' | 'sm' | 'md';diff --git a/packages/twenty-ui/src/primitives/navigation/internal/tab/Tab.module.scss b/packages/twenty-ui/src/primitives/navigation/internal/tab/Tab.module.scssindex 7ec79b40d7e..86ed28903fa 100644--- a/packages/twenty-ui/src/primitives/navigation/internal/tab/Tab.module.scss+++ b/packages/twenty-ui/src/primitives/navigation/internal/tab/Tab.module.scss@@ -45,6 +45,7 @@--tw-tabs-icon-color: var(--tw-tabs-color);--tw-tabs-background: transparent;--tw-tabs-padding-block: var(--t-spacing-1);+ --tw-tabs-padding-inline: var(--t-spacing-2);align-items: center;appearance: none;@@ -67,6 +68,13 @@@include focus-ring;+ &[data-size='compact'] {+ --tw-tabs-padding-inline: var(--t-spacing-1);++ font-size: var(--t-font-size-sm);+ min-block-size: var(--t-spacing-6);+ }+&[data-size='md'] {--tw-tabs-padding-block: var(--t-spacing-2);}@@ -107,7 +115,7 @@inline-size: 100%;min-inline-size: 0;padding-block: var(--tw-tabs-padding-block);- padding-inline: var(--t-spacing-2);+ padding-inline: var(--tw-tabs-padding-inline);white-space: nowrap;}