The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Migrate Twenty UI tab navigation (#26142)
Raphaël Bosi66fdbf8d042f
diff --git a/packages/twenty-docs/docs.json b/packages/twenty-docs/docs.jsonindex a052fd56097..d5988edaab2 100644--- a/packages/twenty-docs/docs.json+++ b/packages/twenty-docs/docs.json@@ -579,6 +579,7 @@"ui/components/input/light-button","ui/components/input/icon-button","ui/components/section",+ "ui/components/tab-button","ui/components/code-editor"]}diff --git a/packages/twenty-docs/navigation/base-structure.json b/packages/twenty-docs/navigation/base-structure.jsonindex cf576cda238..52b710f0894 100644--- a/packages/twenty-docs/navigation/base-structure.json+++ b/packages/twenty-docs/navigation/base-structure.json@@ -593,6 +593,7 @@"ui/components/input/light-button","ui/components/input/icon-button","ui/components/section",+ "ui/components/tab-button","ui/components/code-editor"]}diff --git a/packages/twenty-docs/snippets/ui/generated/components/tab-button.mdx b/packages/twenty-docs/snippets/ui/generated/components/tab-button.mdxnew file mode 100644index 00000000000..9ab1e0104b7--- /dev/null+++ b/packages/twenty-docs/snippets/ui/generated/components/tab-button.mdx@@ -0,0 +1,50 @@+{/*+ * _____ _+ *|_ _|_ _____ _ __ | |_ _ _+ * | | \ \ /\ / / _ \ '_ \| __| | | | Auto-generated file+ * | | \ V V / __/ | | | |_| |_| | DO NOT EDIT - changes will be overwritten+ * |_| \_/\_/ \___|_| |_|\__|\__, | Generated by: npx nx generate:ui twenty-docs+ * |___/+ *+ * This file is generated from the documentation data in packages/twenty-ui/generated.+ * To update it, edit the component prop types or design tokens in twenty-ui and run:+ * npx nx generate:ui twenty-docs+ */}++<ParamField body="active" type="boolean" default="false">+ Highlights the current destination or an action associated with the active tab. Does not change the control role.+</ParamField>++<ParamField body="badge" type="ReactNode">+ Content following the label and trailing icon, such as a count.+</ParamField>++<ParamField body="className" type="string | ((state: ButtonState) => string | undefined)">+ CSS class applied to the element, or a function that+ returns a class based on the component's state.+</ParamField>++<ParamField body="endIcon" type="ReactNode">+ Decorative content displayed after the label.+</ParamField>++<ParamField body="focusableWhenDisabled" type="boolean" default="false">+ Whether the button should be focusable when disabled.+</ParamField>++<ParamField body="render" type="ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, ButtonState>">+ Caller-supplied root element or renderer. Preserve a native button, or an anchor when `href` is set. Router integration belongs to the caller.+</ParamField>++<ParamField body="size" type=""sm" | "md"" default="sm">+ Padding of the tab content: sm or md.+</ParamField>++<ParamField body="startIcon" type="ReactNode">+ Decorative content displayed before the label.+</ParamField>++<ParamField body="style" type="CSSProperties | ((state: ButtonState) => 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/snippets/ui/generated/navigation/tabs.mdx b/packages/twenty-docs/snippets/ui/generated/navigation/tabs.mdxindex 052b4c7288b..f5e273bf234 100644--- a/packages/twenty-docs/snippets/ui/generated/navigation/tabs.mdx+++ b/packages/twenty-docs/snippets/ui/generated/navigation/tabs.mdx@@ -113,6 +113,14 @@To work around it, ensure that `defaultValue` or `value` on `<Tabs.Root>` is set to an enabled Tab's value.</ParamField>+<ParamField body="Tab.endIcon" type="ReactNode">+ Decorative content after the label and before the badge.+</ParamField>++<ParamField body="Tab.highlighted" type="boolean" default="false">+ Emphasizes the tab content without changing selection.+</ParamField>+<ParamField body="Tab.nativeButton" type="boolean" default="true">Whether the component renders a native `<button>` element when replacing itvia the `render` prop.diff --git a/packages/twenty-docs/ui/components/overview.mdx b/packages/twenty-docs/ui/components/overview.mdxindex 163e6f2faa2..70af4c42486 100644--- a/packages/twenty-docs/ui/components/overview.mdx+++ b/packages/twenty-docs/ui/components/overview.mdx@@ -16,4 +16,5 @@ Import shared components from `twenty-ui/components`. The code editor has its ow| [LightButton](/ui/components/input/light-button) | Lightweight actions with standard or subtle emphasis. || [IconButton](/ui/components/input/icon-button) | Square icon actions built on Button. || [Section](/ui/components/section) | Related content with a heading, description, and optional action. |+| [TabButton](/ui/components/tab-button) | Route links and adjacent actions with the same appearance as tabs. || [CodeEditor](/ui/components/code-editor) | Code editing with Monaco, an optional header, and the Twenty theme. |diff --git a/packages/twenty-docs/ui/components/tab-button.mdx b/packages/twenty-docs/ui/components/tab-button.mdxnew file mode 100644index 00000000000..79360c996ad--- /dev/null+++ b/packages/twenty-docs/ui/components/tab-button.mdx@@ -0,0 +1,71 @@+---+title: TabButton+description: Present route links and actions alongside tabs with consistent styling.+---++import { StoryEmbed } from '/snippets/ui/StoryEmbed.mdx';+import TabButtonReference from '/snippets/ui/generated/components/tab-button.mdx';++Use `TabButton` for navigation links and actions such as adding a tab or opening an overflow menu. It shares the appearance of [Tabs](/ui/primitives/navigation/tabs) and uses [Button](/ui/primitives/input/button) for interaction.++<StoryEmbed+ storyId="ui-components-tabbutton--default"+ title="TabButton example"+ height={180}+/>++## State ownership++Your application supplies `active` from its current route or menu state. This prop highlights the control without changing its role or introducing selection state. Use `Tabs.Root`, `Tabs.List`, `Tabs.Tab`, and `Tabs.Panel` to switch between related content panels, with controlled or uncontrolled selection.++## Navigation++Set `href` to render a link. Supply `aria-current="page"` on the current destination.++```tsx+import { TabButton } from 'twenty-ui/components';+import { IconCreditCard } from 'twenty-ui/icon';++export const BillingLink = () => (+ <TabButton+ href="/billing"+ active+ aria-current="page"+ startIcon={<IconCreditCard />}+ >+ Billing+ </TabButton>+);+```++For client-side routing, pass the resolved destination as `href` and your router link through `render`. Keep route state and history options on the router link. Custom wrappers must forward props and the ref to the anchor. Disabled links retain their link role and block activation.++## Actions++Without `href`, the control renders a native button with `type="button"`. Native attributes, refs, styles, class names, and event handlers pass through.++```tsx+import { useState } from 'react';+import { TabButton } from 'twenty-ui/components';+import { IconPlus } from 'twenty-ui/icon';+import { Text } from 'twenty-ui/primitives/typography';++export const AddTabAction = () => {+ const [count, setCount] = useState(1);++ return (+ <>+ <TabButton startIcon={<IconPlus />} onClick={() => setCount(count + 1)}>+ New Tab+ </TabButton>+ <Text role="status">Tabs: {count}</Text>+ </>+ );+};+```++Use `startIcon`, `endIcon`, and `badge` for supporting content. An avatar passed to an icon slot is decorative when the text names the destination. The `size` prop controls content padding with `sm` and `md` values.++## Props++<TabButtonReference />diff --git a/packages/twenty-docs/ui/primitives/navigation/tabs.mdx b/packages/twenty-docs/ui/primitives/navigation/tabs.mdxindex 574b46e0611..23268f16c07 100644--- a/packages/twenty-docs/ui/primitives/navigation/tabs.mdx+++ b/packages/twenty-docs/ui/primitives/navigation/tabs.mdx@@ -119,8 +119,16 @@ With `activateOnFocus={false}`, arrow keys move focus and Enter or Space activatUse `keepMounted` on a panel when its contents must remain mounted while inactive.+## Visual emphasis++Use `highlighted` on `Tabs.Tab` to outline its content independently of selection, such as when its settings are open. Selection remains owned by `Tabs.Root`.+## PropsThe reference is generated from the public component types. Native attributes, including accessible names and event handlers, are also accepted on parts that render elements.<TabsReference />++## Route links and adjacent actions++Use [TabButton](/ui/components/tab-button) for route navigation and actions such as adding a tab or opening a menu. Keep those controls outside `Tabs.List`, whose children represent content selection. `Tabs.Tab` supports `startIcon`, `endIcon`, and `badge` slots for icons, decorative avatars, and counts.diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-input-gallery.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-input-gallery.front-component.tsxindex e98dee3ea66..e11e074643e 100644--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-input-gallery.front-component.tsx+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-input-gallery.front-component.tsx@@ -1,5 +1,10 @@import { defineFrontComponent } from 'twenty-sdk/define';-import { IconButton, LightButton, MainButton } from 'twenty-ui/components';+import {+ IconButton,+ LightButton,+ MainButton,+ TabButton,+} from 'twenty-ui/components';import { IconPlus, IconSearch, IconStar, IconTrash } from 'twenty-ui/icon';import { CodeEditorHeader } from 'twenty-ui/components/code-editor';import {@@ -22,9 +27,6 @@ import {RoundedIconButton,SearchInput,SegmentedControl,- StyledTabContainer,- TabButton,- TabContent,CardPicker,Checkbox,Radio,@@ -230,21 +232,9 @@ const INPUT_ENTRIES: GalleryEntry[] = [</Slider.Root>),},- {- name: 'StyledTabContainer',- node: (- <StyledTabContainer>- <TabButton id="t1" title="Tab" />- </StyledTabContainer>- ),- },{name: 'TabButton',- node: <TabButton id="tab1" title="Tab" />,- },- {- name: 'TabContent',- node: <TabContent id="tc1" title="Content" />,+ node: <TabButton>Tab</TabButton>,},{name: 'Switch',diff --git a/packages/twenty-front/src/modules/ai/components/ThinkingStepsDisplay.tsx b/packages/twenty-front/src/modules/ai/components/ThinkingStepsDisplay.tsxindex c22ec2da801..0e7e7ae5067 100644--- a/packages/twenty-front/src/modules/ai/components/ThinkingStepsDisplay.tsx+++ b/packages/twenty-front/src/modules/ai/components/ThinkingStepsDisplay.tsx@@ -1,3 +1,5 @@+import { TabListRoot } from '@/ui/layout/tab-list/components/TabListRoot';+import { Tabs } from 'twenty-ui/primitives/navigation';import { styled } from '@linaria/react';import { plural, t } from '@lingui/core/macro';import { useState } from 'react';@@ -340,33 +342,39 @@ const ThinkingToolStepRow = ({{hasError ? (<StyledToolErrorText>{part.errorText}</StyledToolErrorText>) : (- <StyledToolDetailsContent>- <StyledToolTabListContainer>- <TabList- tabs={toolTabs}- behaveAsLinks={false}- componentInstanceId={toolTabListComponentInstanceId}- />- </StyledToolTabListContainer>- <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}+ <TabListRoot componentInstanceId={toolTabListComponentInstanceId}>+ <StyledToolDetailsContent>+ <StyledToolTabListContainer>+ <TabList+ aria-label={t`Tool details: ${displayMessage}`}+ tabs={toolTabs}+ behaveAsLinks={false}+ componentInstanceId={toolTabListComponentInstanceId}/>- </StyledJsonTreeContainer>- </StyledToolJsonContent>- </StyledToolDetailsContent>+ </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></AnimatedExpandableContainer>diff --git a/packages/twenty-front/src/modules/object-record/record-merge/components/MergeRecordsContainer.tsx b/packages/twenty-front/src/modules/object-record/record-merge/components/MergeRecordsContainer.tsxindex 196b6d45340..686df7ded0c 100644--- a/packages/twenty-front/src/modules/object-record/record-merge/components/MergeRecordsContainer.tsx+++ b/packages/twenty-front/src/modules/object-record/record-merge/components/MergeRecordsContainer.tsx@@ -1,3 +1,6 @@+import { t } from '@lingui/core/macro';+import { TabListRoot } from '@/ui/layout/tab-list/components/TabListRoot';+import { Tabs } from 'twenty-ui/primitives/navigation';import { styled } from '@linaria/react';import { useRef } from 'react';import { themeCssVariables } from 'twenty-ui/theme-constants';@@ -6,7 +9,6 @@ import { ShowPageContainer } from '@/ui/layout/page/components/ShowPageContainerimport { SidePanelProvider } from '@/ui/layout/side-panel/contexts/SidePanelContext';import { TabList } from '@/ui/layout/tab-list/components/TabList';import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState';-import { TabListComponentInstanceContext } from '@/ui/layout/tab-list/states/contexts/TabListComponentInstanceContext';import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';import { useMergeRecordsContainerTabs } from '@/object-record/record-merge/hooks/useMergeRecordsContainerTabs';@@ -65,33 +67,37 @@ export const MergeRecordsContainer = ({<SidePanelProvider value={{ isInSidePanel: true }}><ShowPageContainer><StyledShowPageRightContainer>- <TabListComponentInstanceContext.Provider- value={{ instanceId: instanceId }}- >+ <TabListRoot componentInstanceId={instanceId}><StyledTabListContainer><TabList+ aria-label={t`Merge records`}tabs={tabs}behaveAsLinks={false}componentInstanceId={instanceId}/></StyledTabListContainer>- </TabListComponentInstanceContext.Provider>- <MergeRecordsContentScrollResetEffect- activeTabId={activeTabId}- contentContainerRef={contentContainerRef}- />- <StyledContentContainer ref={contentContainerRef}>- {activeTabId === MergeRecordsTabId.MERGE_PREVIEW && (- <MergePreviewTab objectNameSingular={objectNameSingular} />- )}- {activeTabId === MergeRecordsTabId.SETTINGS && <MergeSettingsTab />}- {selectedRecords.some((record) => record.id === activeTabId) && (- <MergeRecordTab- objectNameSingular={objectNameSingular}- recordId={activeTabId || ''}- />- )}- </StyledContentContainer>+ <MergeRecordsContentScrollResetEffect+ activeTabId={activeTabId}+ contentContainerRef={contentContainerRef}+ />+ <Tabs.Panel+ value={activeTabId ?? ''}+ render={<StyledContentContainer ref={contentContainerRef} />}+ >+ {activeTabId === MergeRecordsTabId.MERGE_PREVIEW && (+ <MergePreviewTab objectNameSingular={objectNameSingular} />+ )}+ {activeTabId === MergeRecordsTabId.SETTINGS && (+ <MergeSettingsTab />+ )}+ {selectedRecords.some((record) => record.id === activeTabId) && (+ <MergeRecordTab+ objectNameSingular={objectNameSingular}+ recordId={activeTabId || ''}+ />+ )}+ </Tabs.Panel>+ </TabListRoot><MergeRecordsFooter objectNameSingular={objectNameSingular} /></StyledShowPageRightContainer></ShowPageContainer>diff --git a/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabList.tsx b/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabList.tsxindex 674c5902f4d..b7b09057288 100644--- a/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabList.tsx+++ b/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabList.tsx@@ -5,7 +5,7 @@ import { useLingui } from '@lingui/react/macro';import { useCallback, useMemo } from 'react';import { useLocation, useNavigate } from 'react-router-dom';import { IconPlus, useIcons } from 'twenty-ui/icon';-import { TabButton } from 'twenty-ui/primitives/input';+import { TabButton } from 'twenty-ui/components';import { isPageLayoutTabDraggingComponentState } from '@/page-layout/states/isPageLayoutTabDraggingComponentState';import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';@@ -44,7 +44,6 @@ import { shouldEnableTabEditingFeatures } from '@/page-layout/utils/shouldEnableimport { useSidePanelMenu } from '@/side-panel/hooks/useSidePanelMenu';import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';import { TabListDropdown } from '@/ui/layout/tab-list/components/TabListDropdown';-import { TabListFromUrlOptionalEffect } from '@/ui/layout/tab-list/components/TabListFromUrlOptionalEffect';import { type SingleTabProps } from '@/ui/layout/tab-list/types/SingleTabProps';import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow';import { isDefined } from 'twenty-shared/utils';@@ -121,6 +120,7 @@ type PageLayoutTabListProps = Omit<TabListProps, 'tabs'> & {};export const PageLayoutTabList = ({+ 'aria-label': ariaLabel,tabs,loading,behaveAsLinks,@@ -188,9 +188,11 @@ export const PageLayoutTabList = ({return hiddenTabs.some((tab) => tab.id === activeTabId);}, [hasHiddenTabs, hiddenTabs, activeTabId]);+ const isPageLayoutInEditMode = useIsPageLayoutInEditMode();+const selectTab = useCallback((tabId: string) => {- if (workspaceSurface.ownsRouteLocation) {+ if (!isPageLayoutInEditMode && workspaceSurface.ownsRouteLocation) {navigate({ search: location.search, hash: `#${tabId}` },{@@ -203,6 +205,7 @@ export const PageLayoutTabList = ({onChangeTab?.(tabId);},[+ isPageLayoutInEditMode,navigate,location.search,location.state,@@ -296,7 +299,6 @@ export const PageLayoutTabList = ({},});- const isPageLayoutInEditMode = useIsPageLayoutInEditMode();const [pageLayoutTabSettingsOpenTabId, setPageLayoutTabSettingsOpenTabId] =useAtomComponentState(pageLayoutTabSettingsOpenTabIdComponentState,@@ -410,10 +412,6 @@ export const PageLayoutTabList = ({<TabListComponentInstanceContext.Providervalue={{ instanceId: componentInstanceId }}>- <TabListFromUrlOptionalEffect- tabListIds={tabsWithIcons.map((tab) => tab.id)}- />-{tabsWithIcons.length > 1 && !shouldScrollTabs && (<TabListHiddenMeasurementsvisibleTabs={tabsWithIcons}@@ -427,12 +425,7 @@ export const PageLayoutTabList = ({addButtonMeasurement={addTabStrategy ? (<StyledAddButton>- <TabButton- id="add-tab"- LeftIcon={IconPlus}- title={t`New Tab`}- disableTestId- />+ <TabButton startIcon={<IconPlus />}>{t`New Tab`}</TabButton></StyledAddButton>) : undefined}@@ -449,6 +442,7 @@ export const PageLayoutTabList = ({centerTabs={centerTabs}><PageLayoutTabListVisibleTabs+ aria-label={ariaLabel}visibleTabs={tabsWithIcons}visibleTabCount={shouldScrollTabs ? tabsWithIcons.length : visibleTabCount@@ -503,12 +497,11 @@ export const PageLayoutTabList = ({{addTabStrategy?.mode === 'direct' && (<StyledAddButton><TabButton- id="add-tab"- LeftIcon={IconPlus}- title={t`New Tab`}+ startIcon={<IconPlus />}onClick={() => addTabStrategy.onCreate()}- disableTestId- />+ >+ {t`New Tab`}+ </TabButton></StyledAddButton>)}{addTabStrategy?.mode === 'dropdown' && (@@ -516,12 +509,7 @@ export const PageLayoutTabList = ({<DropdowndropdownId={addTabDropdownId}clickableComponent={- <TabButton- id="add-tab"- LeftIcon={IconPlus}- title={t`New Tab`}- disableTestId- />+ <TabButton startIcon={<IconPlus />}>{t`New Tab`}</TabButton>}dropdownComponents={<PageLayoutTabListNewTabDropdownContentdiff --git a/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListDragHandle.tsx b/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListDragHandle.tsxnew file mode 100644index 00000000000..8d3d84c4d73--- /dev/null+++ b/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListDragHandle.tsx@@ -0,0 +1,35 @@+import { useContext } from 'react';++import { TabListItem } from '@/ui/layout/tab-list/components/TabListItem';+import { type TabListItemProps } from '@/ui/layout/tab-list/types/TabListItemProps';+import { DragDropItemSortableHandleRefContext } from '@/ui/utilities/drag-and-drop/context/DragDropItemSortableHandleRefContext';++type PageLayoutTabListDragHandleProps = Pick<+ TabListItemProps,+ 'tab' | 'active' | 'disabled' | 'onSelect'+> & {+ isHighlighted: boolean;+};++export const PageLayoutTabListDragHandle = ({+ tab,+ active,+ disabled,+ isHighlighted,+ onSelect,+}: PageLayoutTabListDragHandleProps) => {+ const handleRef = useContext(DragDropItemSortableHandleRefContext);++ return (+ <TabListItem+ mode="tab"+ tab={tab}+ active={active}+ disabled={disabled}+ highlighted={isHighlighted}+ onSelect={onSelect}+ ref={handleRef}+ data-dnd-sortable-handle+ />+ );+};diff --git a/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListEffect.tsx b/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListEffect.tsxindex 1d3150d4302..8c4eeea4a46 100644--- a/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListEffect.tsx+++ b/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListEffect.tsx@@ -4,7 +4,8 @@ import { useWorkspaceSurface } from '@/ui/layout/hooks/useWorkspaceSurface';import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState';import { type TabListProps } from '@/ui/layout/tab-list/types/TabListProps';import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';-import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState';+import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';+import { useStore } from 'jotai';import { useEffect } from 'react';import { useLocation, useNavigate } from 'react-router-dom';import { isDefined } from 'twenty-shared/utils';@@ -14,20 +15,23 @@ type PageLayoutTabListEffectProps = Pick<'componentInstanceId' | 'onChangeTab'> & {tabs: PageLayoutTab[];+ isInEditMode: boolean;defaultTabToFocusOnMobileAndSidePanelId?: string;};export const PageLayoutTabListEffect = ({tabs,+ isInEditMode,onChangeTab,componentInstanceId,defaultTabToFocusOnMobileAndSidePanelId,}: PageLayoutTabListEffectProps) => {- const [activeTabId, setActiveTabId] = useAtomComponentState(+ const activeTabId = useAtomComponentStateValue(activeTabIdComponentState,componentInstanceId,);+ const store = useStore();const isMobile = useIsMobile();const workspaceSurface = useWorkspaceSurface();const isInSidePanel = workspaceSurface.type === 'side-panel';@@ -42,16 +46,31 @@ export const PageLayoutTabListEffect = ({isInSidePanel,});+ const shouldSyncWithUrl = !isInEditMode && workspaceSurface.ownsRouteLocation;+ const routeTabId = hash.replace('#', '');+ const nextActiveTabId =+ shouldSyncWithUrl && tabs.some((tab) => tab.id === routeTabId)+ ? routeTabId+ : initialActiveTabId;+useEffect(() => {- setActiveTabId(initialActiveTabId);- onChangeTab?.(initialActiveTabId || '');- }, [initialActiveTabId, onChangeTab, setActiveTabId]);+ const activeTabIdAtom = activeTabIdComponentState.atomFamily({+ instanceId: componentInstanceId,+ });++ if (store.get(activeTabIdAtom) === nextActiveTabId) {+ return;+ }++ store.set(activeTabIdAtom, nextActiveTabId);+ onChangeTab?.(nextActiveTabId ?? '');+ }, [componentInstanceId, nextActiveTabId, onChangeTab, store]);useEffect(() => {// Cancelling customization can pin the active tab again. Replace its stale// hash without overwriting a different deep link or the main URL from a panel.if (- workspaceSurface.ownsRouteLocation &&+ shouldSyncWithUrl &&isDefined(activeTabId) &&isDefined(initialActiveTabId) &&activeTabId !== initialActiveTabId &&@@ -69,7 +88,7 @@ export const PageLayoutTabListEffect = ({navigate,search,state,- workspaceSurface.ownsRouteLocation,+ shouldSyncWithUrl,]);return null;diff --git a/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListReorderableTab.tsx b/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListReorderableTab.tsxindex 311301eb5ad..f9f4ee4f1d3 100644--- a/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListReorderableTab.tsx+++ b/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListReorderableTab.tsx@@ -7,10 +7,8 @@ import { useLayoutRenderingContext } from '@/ui/layout/contexts/LayoutRenderingCimport { type SingleTabProps } from '@/ui/layout/tab-list/types/SingleTabProps';import { DragDropItemSortableCell } from '@/ui/utilities/drag-and-drop/components/DragDropItemSortableCell';import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';-import { styled } from '@linaria/react';import { isDefined } from 'twenty-shared/utils';-import { StyledTabContainer, TabContent } from 'twenty-ui/primitives/input';-import { themeCssVariables } from 'twenty-ui/theme-constants';+import { PageLayoutTabListDragHandle } from '@/page-layout/components/PageLayoutTabListDragHandle';import { PageLayoutType } from '~/generated-metadata/graphql';type PageLayoutTabListReorderableTabProps = {@@ -24,13 +22,6 @@ type PageLayoutTabListReorderableTabProps = {onSelect: () => void;};-const StyledTabContentWrapper = styled.div<{ isHighlighted: boolean }>`- border-radius: ${themeCssVariables.border.radius.sm};- outline: ${({ isHighlighted }) =>- isHighlighted ? `1px solid ${themeCssVariables.color.blue}` : 'none'};- outline-offset: -1px;-`;-export const PageLayoutTabListReorderableTab = ({tab,index,@@ -70,23 +61,13 @@ export const PageLayoutTabListReorderableTab = ({hasTransition={false}orientation="vertical">- <StyledTabContainer- onClick={onSelect}+ <PageLayoutTabListDragHandle+ tab={tab}active={isActive}disabled={disabled}- >- <StyledTabContentWrapper isHighlighted={isHighlighted}>- <TabContent- id={tab.id}- active={isActive}- disabled={disabled}- LeftIcon={tab.Icon}- title={tab.title}- logo={tab.logo}- pill={tab.pill}- />- </StyledTabContentWrapper>- </StyledTabContainer>+ isHighlighted={isHighlighted}+ onSelect={onSelect}+ /></DragDropItemSortableCell>);diff --git a/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListVisibleTabs.tsx b/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListVisibleTabs.tsxindex 5a761163419..ca0fa47f919 100644--- a/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListVisibleTabs.tsx+++ b/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListVisibleTabs.tsx@@ -1,20 +1,18 @@import { styled } from '@linaria/react';-import { useLocation } from 'react-router-dom';-import { TabButton } from 'twenty-ui/primitives/input';+import { TabListRow } from '@/ui/layout/tab-list/components/TabListRow';+import { TabListItem } from '@/ui/layout/tab-list/components/TabListItem';-import { TAB_LIST_GAP } from '@/ui/layout/tab-list/constants/TabListGap';import { useScrollActiveTabIntoView } from '@/ui/layout/tab-list/hooks/useScrollActiveTabIntoView';-import { SCROLLABLE_TAB_ROW_CSS } from '@/ui/layout/tab-list/styles/ScrollableTabRowCSS';import { type SingleTabProps } from '@/ui/layout/tab-list/types/SingleTabProps';import { PAGE_LAYOUT_TAB_LIST_DROPPABLE_IDS } from '@/page-layout/components/PageLayoutTabListDroppableIds';import { PageLayoutTabListReorderableTab } from '@/page-layout/components/PageLayoutTabListReorderableTab';import { usePrerenderPageLayoutTabOnHover } from '@/page-layout/hooks/usePrerenderPageLayoutTabOnHover';import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget';-import { useWorkspaceSurface } from '@/ui/layout/hooks/useWorkspaceSurface';import { DragDropItemDropTarget } from '@/ui/utilities/drag-and-drop/components/DragDropItemDropTarget';type PageLayoutTabListVisibleTabsProps = {+ 'aria-label': string;visibleTabs: SingleTabProps[];visibleTabCount: number;activeTabId: string | null;@@ -28,18 +26,6 @@ type PageLayoutTabListVisibleTabsProps = {isScrollable: boolean;};-const StyledTabContainer = styled.div<{ isScrollable: boolean }>`- display: flex;- max-width: 100%;- overflow-x: ${({ isScrollable }) => (isScrollable ? 'auto' : 'hidden')};- position: relative;- ${SCROLLABLE_TAB_ROW_CSS}-- > *:not(:last-child) {- margin-right: ${TAB_LIST_GAP}px;- }-`;-const StyledTabSlot = styled.div`display: flex;`;@@ -51,6 +37,7 @@ const StyledLeadingDropTarget = styled.div``;export const PageLayoutTabListVisibleTabs = ({+ 'aria-label': ariaLabel,visibleTabs,visibleTabCount,activeTabId,@@ -63,8 +50,6 @@ export const PageLayoutTabListVisibleTabs = ({firstHiddenTabId,isScrollable,}: PageLayoutTabListVisibleTabsProps) => {- const location = useLocation();- const workspaceSurface = useWorkspaceSurface();const { tabRowRef } = useScrollActiveTabIntoView({activeTabId,isScrollable,@@ -77,7 +62,12 @@ export const PageLayoutTabListVisibleTabs = ({const shownTabs = visibleTabs.slice(0, visibleTabCount);return (- <StyledTabContainer ref={tabRowRef} isScrollable={isScrollable}>+ <TabListRow+ aria-label={ariaLabel}+ ref={tabRowRef}+ behaveAsLinks={false}+ isScrollable={isScrollable}+ >{shownTabs.map((tab, index) => (<StyledTabSlot key={tab.id}><StyledLeadingDropTarget>@@ -110,34 +100,25 @@ export const PageLayoutTabListVisibleTabs = ({compact/></StyledLeadingDropTarget>- </StyledTabContainer>+ </TabListRow>);}return (- <StyledTabContainer ref={tabRowRef} isScrollable={isScrollable}>+ <TabListRow+ aria-label={ariaLabel}+ ref={tabRowRef}+ behaveAsLinks={behaveAsLinks}+ isScrollable={isScrollable}+ >{visibleTabs.slice(0, visibleTabCount).map((tab) => (- <TabButton+ <TabListItemkey={tab.id}- id={tab.id}- title={tab.title}- LeftIcon={tab.Icon}- logo={tab.logo}+ tab={tab}+ mode={behaveAsLinks ? 'link' : 'tab'}active={tab.id === activeTabId}disabled={tab.disabled ?? loading}- pill={tab.pill}- to={- behaveAsLinks- ? { search: location.search, hash: `#${tab.id}` }- : undefined- }- state={behaveAsLinks ? location.state : undefined}- replace={behaveAsLinks && workspaceSurface.type === 'side-panel'}- onClick={- behaveAsLinks- ? () => onChangeTab?.(tab.id)- : () => onSelectTab(tab.id)- }+ onSelect={behaveAsLinks ? onChangeTab : onSelectTab}onMouseEnter={tab.id === activeTabId || (tab.disabled ?? loading)? undefined@@ -146,6 +127,6 @@ export const PageLayoutTabListVisibleTabs = ({onMouseLeave={handleTabMouseLeave}/>))}- </StyledTabContainer>+ </TabListRow>);};diff --git a/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabsRenderer.tsx b/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabsRenderer.tsxindex 01f740c5654..0e6b051d6ad 100644--- a/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabsRenderer.tsx+++ b/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabsRenderer.tsx@@ -1,3 +1,5 @@+import { TabListRoot } from '@/ui/layout/tab-list/components/TabListRoot';+import { Tabs } from 'twenty-ui/primitives/navigation';import { PageLayoutWidgetDndProvider } from '@/page-layout/components/dnd/PageLayoutWidgetDndProvider';import { PageLayoutLeftPanel } from '@/page-layout/components/PageLayoutLeftPanel';import { PageLayoutPrerenderedTabIdsResetEffect } from '@/page-layout/components/PageLayoutPrerenderedTabIdsResetEffect';@@ -98,6 +100,15 @@ const StyledTabContentDisplay = styled.div<{ isActiveTab: boolean }>`display: ${({ isActiveTab }) => (isActiveTab ? 'contents' : 'none')};`;+const StyledTabPanel = styled.div`+ align-items: start;+ min-height: 100%;++ &:not([hidden]) {+ display: grid;+ }+`;+const StyledScrollWrapperContainer = styled.div`flex: 1;min-height: 0;@@ -194,17 +205,21 @@ export const PageLayoutTabsRenderer = () => {workspaceSurface.type !== 'side-panel' &&!isMobile;- const tabList = (sortedTabs.length > 1 || isPageLayoutInEditMode) && (+ const shouldRenderTabList = sortedTabs.length > 1 || isPageLayoutInEditMode;+ const behaveAsLinks =+ workspaceSurface.type === 'main' && !isPageLayoutInEditMode;+ const hasTabPanels = shouldRenderTabList && !behaveAsLinks;++ const tabList = shouldRenderTabList && (<PageLayoutTabList+ aria-label={currentPageLayout.name}className="page-layout-tab-list-print-hidden"presentation={shouldRenderRecordIdentifierBar ? 'identifier-bar' : 'standalone'}centerTabs={shouldRenderRecordIdentifierBar && !isDefined(pinnedLeftTab)}tabs={sortedTabs}- behaveAsLinks={- workspaceSurface.type === 'main' && !isPageLayoutInEditMode- }+ behaveAsLinks={behaveAsLinks}componentInstanceId={tabListInstanceId}addTabStrategy={addTabStrategy}isReorderEnabled={canEnableTabEditing}@@ -220,56 +235,73 @@ export const PageLayoutTabsRenderer = () => {targetRecordId={targetRecordIdentifier?.id}/><PageLayoutPrerenderedTabIdsResetEffect />- <StyledRoot>- {shouldRenderRecordIdentifierBar && (- <PageLayoutRecordIdentifierBar- targetRecordIdentifier={targetRecordIdentifier}- pinnedTab={pinnedLeftTab}- isPinnedTabEditable={isPageLayoutInEditMode}- tabList={tabList}- />- )}-- <StyledContainer hasPinnedTab={isDefined(pinnedLeftTab)}>- {isDefined(pinnedLeftTab) && (- <PageLayoutLeftPanel- pageLayoutId={currentPageLayout.id}- pinnedLeftTabId={pinnedLeftTab.id}+ <TabListRoot+ componentInstanceId={tabListInstanceId}+ enabled={hasTabPanels}+ >+ <StyledRoot>+ {shouldRenderRecordIdentifierBar && (+ <PageLayoutRecordIdentifierBar+ targetRecordIdentifier={targetRecordIdentifier}+ pinnedTab={pinnedLeftTab}+ isPinnedTabEditable={isPageLayoutInEditMode}+ tabList={tabList}/>)}- <StyledTabsAndDashboardContainer>- <PageLayoutTabListEffect- tabs={sortedTabs}- componentInstanceId={tabListInstanceId}- defaultTabToFocusOnMobileAndSidePanelId={- currentPageLayout.defaultTabToFocusOnMobileAndSidePanelId ??- undefined- }- />- {!shouldRenderRecordIdentifierBar && tabList}-- <StyledScrollWrapperContainer>- <ScrollWrapper- className="page-layout-scroll-wrapper"- componentInstanceId={scrollWrapperInstanceId}- defaultEnableXScroll={false}- >- {isDefined(activeTabId) &&- activeTabExistsInRenderableTabs &&- tabsToMount.map((tab) => (- <StyledTabContentDisplay- key={tab.id}- isActiveTab={tab.id === activeTabId}- >- <PageLayoutMainContent tabId={tab.id} />- </StyledTabContentDisplay>- ))}- </ScrollWrapper>- </StyledScrollWrapperContainer>- </StyledTabsAndDashboardContainer>- </StyledContainer>- </StyledRoot>+ <StyledContainer hasPinnedTab={isDefined(pinnedLeftTab)}>+ {isDefined(pinnedLeftTab) && (+ <PageLayoutLeftPanel+ pageLayoutId={currentPageLayout.id}+ pinnedLeftTabId={pinnedLeftTab.id}+ />+ )}++ <StyledTabsAndDashboardContainer>+ <PageLayoutTabListEffect+ isInEditMode={isPageLayoutInEditMode}+ tabs={sortedTabs}+ componentInstanceId={tabListInstanceId}+ defaultTabToFocusOnMobileAndSidePanelId={+ currentPageLayout.defaultTabToFocusOnMobileAndSidePanelId ??+ undefined+ }+ />+ {!shouldRenderRecordIdentifierBar && tabList}++ <StyledScrollWrapperContainer>+ <ScrollWrapper+ className="page-layout-scroll-wrapper"+ componentInstanceId={scrollWrapperInstanceId}+ defaultEnableXScroll={false}+ >+ {isDefined(activeTabId) &&+ activeTabExistsInRenderableTabs &&+ tabsToMount.map((tab) =>+ hasTabPanels ? (+ <Tabs.Panel+ key={tab.id}+ value={tab.id}+ keepMounted+ render={<StyledTabPanel />}+ >+ <PageLayoutMainContent tabId={tab.id} />+ </Tabs.Panel>+ ) : (+ <StyledTabContentDisplay+ key={tab.id}+ isActiveTab={tab.id === activeTabId}+ >+ <PageLayoutMainContent tabId={tab.id} />+ </StyledTabContentDisplay>+ ),+ )}+ </ScrollWrapper>+ </StyledScrollWrapperContainer>+ </StyledTabsAndDashboardContainer>+ </StyledContainer>+ </StyledRoot>+ </TabListRoot></PageLayoutWidgetDndProvider>);};diff --git a/packages/twenty-front/src/modules/page-layout/components/__stories__/PageLayoutTabList.stories.tsx b/packages/twenty-front/src/modules/page-layout/components/__stories__/PageLayoutTabList.stories.tsxindex 0f5a9440a27..d71edaf97ee 100644--- a/packages/twenty-front/src/modules/page-layout/components/__stories__/PageLayoutTabList.stories.tsx+++ b/packages/twenty-front/src/modules/page-layout/components/__stories__/PageLayoutTabList.stories.tsx@@ -1,3 +1,6 @@+import { TabListRoot } from '@/ui/layout/tab-list/components/TabListRoot';+import { Tabs } from 'twenty-ui/primitives/navigation';+import { Text } from 'twenty-ui/primitives/typography';import { styled } from '@linaria/react';import type { Meta, StoryObj } from '@storybook/react-vite';import { type ComponentProps, useEffect, useMemo } from 'react';@@ -147,33 +150,42 @@ const PageLayoutTabListPlayground = ({return (<StyledContainer containerWidth={containerWidth}><PageLayoutTabListEffect+ isInEditMode={false}tabs={sortedTabs}componentInstanceId="page-layout-tab-list-story"/>- <PageLayoutWidgetDndProvider>- <StyledTabListContainer isInIdentifierBar={isInIdentifierBar}>- <PageLayoutTabList- tabs={sortedTabs}- componentInstanceId="page-layout-tab-list-story"- behaveAsLinks={false}- loading={false}- addTabStrategy={- isReorderEnabled- ? { mode: 'direct', onCreate: handleAddTab }- : undefined- }- isReorderEnabled={isReorderEnabled}- pageLayoutType={- isInIdentifierBar- ? PageLayoutType.RECORD_PAGE- : PageLayoutType.DASHBOARD- }- presentation={presentation}- centerTabs={centerTabs}- />- </StyledTabListContainer>- </PageLayoutWidgetDndProvider>+ <TabListRoot componentInstanceId="page-layout-tab-list-story">+ <PageLayoutWidgetDndProvider>+ <StyledTabListContainer isInIdentifierBar={isInIdentifierBar}>+ <PageLayoutTabList+ aria-label="Dashboard sections"+ tabs={sortedTabs}+ componentInstanceId="page-layout-tab-list-story"+ behaveAsLinks={false}+ loading={false}+ addTabStrategy={+ isReorderEnabled+ ? { mode: 'direct', onCreate: handleAddTab }+ : undefined+ }+ isReorderEnabled={isReorderEnabled}+ pageLayoutType={+ isInIdentifierBar+ ? PageLayoutType.RECORD_PAGE+ : PageLayoutType.DASHBOARD+ }+ presentation={presentation}+ centerTabs={centerTabs}+ />+ </StyledTabListContainer>+ </PageLayoutWidgetDndProvider>+ {sortedTabs.map((tab) => (+ <Tabs.Panel key={tab.id} value={tab.id}>+ <Text>{tab.title} content</Text>+ </Tabs.Panel>+ ))}+ </TabListRoot></StyledContainer>);};@@ -216,18 +228,22 @@ export const Default: Story = {args: {isReorderEnabled: true,},- play: async ({ canvasElement }) => {+ play: async ({ canvasElement, args }) => {const canvas = within(canvasElement);+ const tabList = await canvas.findByRole('tablist');+ expect(getComputedStyle(tabList, '::after').display).toBe('none');+ expect(getComputedStyle(tabList.parentElement!, '::after').display).toBe(+ args.presentation === 'identifier-bar' ? 'none' : 'block',+ );+ expect(await canvas.findByRole('tab', { name: 'Overview' })).toBeVisible();+ expect(canvas.getByRole('tab', { name: 'Forecasts' })).toBeVisible();expect(- await canvas.findByRole('button', { name: 'Overview' }),- ).toBeVisible();- expect(canvas.getByRole('button', { name: 'Forecasts' })).toBeVisible();+ canvas.queryByRole('button', { name: 'Overview' }),+ ).not.toBeInTheDocument();await userEvent.click(- within(canvas.getByRole('button', { name: 'Revenue' })).getByText(- 'Revenue',- ),+ within(canvas.getByRole('tab', { name: 'Revenue' })).getByText('Revenue'),);await waitFor(() =>@@ -294,3 +310,27 @@ export const IdentifierBarCenteredNarrow: Story = {},play: IdentifierBarNarrow.play,};++export const KeyboardReorder: Story = {+ args: { isReorderEnabled: true },+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ const overview = await canvas.findByRole('tab', { name: 'Overview' });++ overview.focus();+ await userEvent.keyboard('[Space]');+ await userEvent.keyboard('{ArrowRight}');+ await userEvent.keyboard('[Space]');++ await waitFor(() => {+ const draft = jotaiStore.get(+ pageLayoutDraftComponentState.atomFamily({ instanceId: 'instance-id' }),+ );+ const orderedTitles = [...draft.tabs]+ .sort((first, second) => first.position - second.position)+ .map((tab) => tab.title);++ expect(orderedTitles).toEqual(['Revenue', 'Overview', 'Forecasts']);+ });+ },+};diff --git a/packages/twenty-front/src/modules/page-layout/components/__tests__/PageLayoutTabList.test.tsx b/packages/twenty-front/src/modules/page-layout/components/__tests__/PageLayoutTabList.test.tsxindex cad4543a530..90b2d99f253 100644--- a/packages/twenty-front/src/modules/page-layout/components/__tests__/PageLayoutTabList.test.tsx+++ b/packages/twenty-front/src/modules/page-layout/components/__tests__/PageLayoutTabList.test.tsx@@ -87,13 +87,6 @@ jest.mock('@/ui/layout/tab-list/components/TabListHiddenMeasurements', () => ({TabListHiddenMeasurements: () => null,}));-jest.mock(- '@/ui/layout/tab-list/components/TabListFromUrlOptionalEffect',- () => ({- TabListFromUrlOptionalEffect: () => null,- }),-);-jest.mock('@/page-layout/components/PageLayoutTabListVisibleTabs', () => ({PageLayoutTabListVisibleTabs: ({visibleTabs,@@ -186,6 +179,7 @@ const renderTabList = ({value={{ instanceId: PAGE_LAYOUT_ID }}><PageLayoutTabList+ aria-label="Record sections"tabs={TABS}componentInstanceId={TAB_LIST_ID}pageLayoutType={pageLayoutType}@@ -219,17 +213,14 @@ describe('PageLayoutTabList selection', () => {'aria-pressed','true',);- expect(mockNavigate).toHaveBeenCalledWith(- { search: '', hash: `#${title}` },- { replace: false, state: null },- );+ expect(mockNavigate).not.toHaveBeenCalled();expect(mockOpenTabSettings).not.toHaveBeenCalled();await user.click(screen.getByRole('button', { name: title }));expect(mockOpenTabSettings).toHaveBeenCalledTimes(1);expect(mockOpenTabSettings).toHaveBeenCalledWith(title);- expect(mockNavigate).toHaveBeenCalledTimes(1);+ expect(mockNavigate).not.toHaveBeenCalled();},);@@ -277,11 +268,7 @@ describe('PageLayoutTabList selection', () => {.setup().dblClick(screen.getByRole('button', { name: 'Notes' }));- expect(mockNavigate).toHaveBeenCalledTimes(1);- expect(mockNavigate).toHaveBeenCalledWith(- { search: '', hash: '#Notes' },- { replace: false, state: null },- );+ expect(mockNavigate).not.toHaveBeenCalled();expect(mockOpenTabSettings).toHaveBeenCalledTimes(1);expect(store.get(settingsTabAtom)).toBe('Notes');});@@ -330,6 +317,10 @@ describe('PageLayoutTabList selection', () => {expect(mockOpenTabSettings).not.toHaveBeenCalled();expect(mockCloseSidePanelMenu).not.toHaveBeenCalled();+ expect(mockNavigate).toHaveBeenCalledWith(+ { search: '', hash: `#${title}` },+ { replace: false, state: null },+ );},);diff --git a/packages/twenty-front/src/modules/page-layout/components/__tests__/PageLayoutTabListEffect.test.tsx b/packages/twenty-front/src/modules/page-layout/components/__tests__/PageLayoutTabListEffect.test.tsxindex 363bbdbc431..a1d9aeef115 100644--- a/packages/twenty-front/src/modules/page-layout/components/__tests__/PageLayoutTabListEffect.test.tsx+++ b/packages/twenty-front/src/modules/page-layout/components/__tests__/PageLayoutTabListEffect.test.tsx@@ -2,11 +2,11 @@ import { PageLayoutTabListEffect } from '@/page-layout/components/PageLayoutTabLimport { makeTab } from '@/page-layout/testing/pageLayoutDraftFixtures';import { LayoutRenderingProvider } from '@/ui/layout/contexts/LayoutRenderingContext';import { WorkspaceSurfaceContext } from '@/ui/layout/contexts/WorkspaceSurfaceContext';-import { TabListFromUrlOptionalEffect } from '@/ui/layout/tab-list/components/TabListFromUrlOptionalEffect';import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState';import { TabListComponentInstanceContext } from '@/ui/layout/tab-list/states/contexts/TabListComponentInstanceContext';import { render, screen } from '@testing-library/react';import { createStore, Provider } from 'jotai';+import { StrictMode } from 'react';import { MemoryRouter, useLocation, useNavigationType } from 'react-router-dom';import { PageLayoutType } from '~/generated-metadata/graphql';@@ -106,18 +106,52 @@ describe('PageLayoutTabListEffect', () => {expectedActiveTabId: 'timeline',expectedNavigationType: 'REPLACE',},+ {+ name: 'ignores a deep link while editing',+ activeTabId: 'timeline',+ hash: '#notes',+ isInEditMode: true,+ isInSidePanel: false,+ ownsRouteLocation: true,+ expectedHash: '#notes',+ expectedActiveTabId: 'timeline',+ expectedNavigationType: 'POP',+ },+ {+ name: 'does not rewrite a stale hash while editing',+ activeTabId: 'home',+ hash: '#home',+ isInEditMode: true,+ isInSidePanel: false,+ ownsRouteLocation: true,+ expectedHash: '#home',+ expectedActiveTabId: 'timeline',+ expectedNavigationType: 'POP',+ },+ {+ name: 'ignores the main URL when initializing an embedded side panel',+ activeTabId: null,+ hash: '#notes',+ isInSidePanel: true,+ ownsRouteLocation: false,+ expectedHash: '#notes',+ expectedActiveTabId: 'timeline',+ expectedNavigationType: 'POP',+ },])('$name',({activeTabId,hash,isInSidePanel,+ isInEditMode = false,ownsRouteLocation,expectedHash,expectedActiveTabId,expectedNavigationType,}) => {const store = createStore();+ const onChangeTab = jest.fn();const surfaceInstanceId = isInSidePanel ? 'side-panel-page-1' : 'main';const activeTabAtom = activeTabIdComponentState.atomFamily({instanceId: TAB_LIST_INSTANCE_ID,@@ -125,46 +159,47 @@ describe('PageLayoutTabListEffect', () => {store.set(activeTabAtom, activeTabId);render(- <Provider store={store}>- <MemoryRouter- initialEntries={[- `/object/company/record-id?viewId=company-view${hash}`,- ]}- >- <WorkspaceSurfaceContext.Provider- value={{- type: isInSidePanel ? 'side-panel' : 'main',- instanceId: surfaceInstanceId,- ownsRouteLocation,- }}+ <StrictMode>+ <Provider store={store}>+ <MemoryRouter+ initialEntries={[+ `/object/company/record-id?viewId=company-view${hash}`,+ ]}>- <LayoutRenderingProvider+ <WorkspaceSurfaceContext.Providervalue={{- layoutType: PageLayoutType.RECORD_PAGE,- targetRecordIdentifier: {- id: 'record-id',- targetObjectNameSingular: 'company',- },+ type: isInSidePanel ? 'side-panel' : 'main',+ instanceId: surfaceInstanceId,+ ownsRouteLocation,}}>- <TabListComponentInstanceContext.Provider+ <LayoutRenderingProvidervalue={{- instanceId: TAB_LIST_INSTANCE_ID,+ layoutType: PageLayoutType.RECORD_PAGE,+ targetRecordIdentifier: {+ id: 'record-id',+ targetObjectNameSingular: 'company',+ },}}>- <PageLayoutTabListEffect- tabs={[makeTab('timeline', []), makeTab('notes', [], 1)]}- componentInstanceId={TAB_LIST_INSTANCE_ID}- />- <TabListFromUrlOptionalEffect- tabListIds={['timeline', 'notes']}- />- <CurrentLocation />- </TabListComponentInstanceContext.Provider>- </LayoutRenderingProvider>- </WorkspaceSurfaceContext.Provider>- </MemoryRouter>- </Provider>,+ <TabListComponentInstanceContext.Provider+ value={{+ instanceId: TAB_LIST_INSTANCE_ID,+ }}+ >+ <PageLayoutTabListEffect+ isInEditMode={isInEditMode}+ onChangeTab={onChangeTab}+ tabs={[makeTab('timeline', []), makeTab('notes', [], 1)]}+ componentInstanceId={TAB_LIST_INSTANCE_ID}+ />+ <CurrentLocation />+ </TabListComponentInstanceContext.Provider>+ </LayoutRenderingProvider>+ </WorkspaceSurfaceContext.Provider>+ </MemoryRouter>+ </Provider>+ </StrictMode>,);expect(@@ -173,6 +208,12 @@ describe('PageLayoutTabListEffect', () => {`/object/company/record-id?viewId=company-view${expectedHash}`,);expect(store.get(activeTabAtom)).toBe(expectedActiveTabId);+ expect(onChangeTab).toHaveBeenCalledTimes(+ activeTabId === expectedActiveTabId ? 0 : 1,+ );+ if (activeTabId !== expectedActiveTabId) {+ expect(onChangeTab).toHaveBeenCalledWith(expectedActiveTabId);+ }expect(screen.getByRole('status', { name: 'Navigation type' }),).toHaveTextContent(expectedNavigationType);diff --git a/packages/twenty-front/src/modules/page-layout/components/__tests__/PageLayoutTabsRenderer.test.tsx b/packages/twenty-front/src/modules/page-layout/components/__tests__/PageLayoutTabsRenderer.test.tsxindex ac2e55796cf..4cc7ac2d98e 100644--- a/packages/twenty-front/src/modules/page-layout/components/__tests__/PageLayoutTabsRenderer.test.tsx+++ b/packages/twenty-front/src/modules/page-layout/components/__tests__/PageLayoutTabsRenderer.test.tsx@@ -13,7 +13,6 @@ let mockActiveTabId = 'hidden-transcript-tab-id';let mockPrerenderedTabIds: string[] = [];let mockTargetRecordId = 'calendar-event-id';let mockIsInSidePanel = false;-const mockSetActiveTabId = jest.fn();const mockSetPrerenderedTabIds = jest.fn();const homeTab = {@@ -123,10 +122,6 @@ jest.mock('@/ui/utilities/state/jotai/hooks/useSetAtomComponentState', () => ({useSetAtomComponentState: () => mockSetPrerenderedTabIds,}));-jest.mock('@/ui/utilities/state/jotai/hooks/useAtomComponentState', () => ({- useAtomComponentState: () => [mockActiveTabId, mockSetActiveTabId],-}));-jest.mock('@/ui/utilities/responsive/hooks/useIsMobile', () => ({useIsMobile: () => false,}));@@ -167,7 +162,6 @@ describe('PageLayoutTabsRenderer', () => {mockPrerenderedTabIds = [];mockTargetRecordId = 'calendar-event-id';mockIsInSidePanel = false;- mockSetActiveTabId.mockClear();mockSetPrerenderedTabIds.mockClear();});@@ -177,7 +171,6 @@ describe('PageLayoutTabsRenderer', () => {render(<PageLayoutTabsRenderer />, { wrapper: TestWrapper });expect(screen.queryByText(/Rendered tab:/)).not.toBeInTheDocument();- expect(mockSetActiveTabId).toHaveBeenCalledWith('home-tab-id');});it('renders content when the active tab remains renderable', () => {@@ -214,6 +207,35 @@ describe('PageLayoutTabsRenderer', () => {).toBeInTheDocument();});+ it('reveals a prerendered side-panel tab without remounting its content', () => {+ mockIsInSidePanel = true;+ mockActiveTabId = 'home-tab-id';+ mockPrerenderedTabIds = ['timeline-tab-id'];++ const { rerender } = render(<PageLayoutTabsRenderer />, {+ wrapper: TestWrapper,+ });+ const prerenderedContent = screen.getByText(+ 'Rendered tab: timeline-tab-id',+ );++ expect(prerenderedContent).not.toBeVisible();+ expect(screen.getByRole('tabpanel')).toHaveTextContent(+ 'Rendered tab: home-tab-id',+ );++ mockActiveTabId = 'timeline-tab-id';+ rerender(<PageLayoutTabsRenderer />);++ expect(screen.getByText('Rendered tab: timeline-tab-id')).toBe(+ prerenderedContent,+ );+ expect(prerenderedContent).toBeVisible();+ expect(screen.getByRole('tabpanel')).toHaveTextContent(+ 'Rendered tab: timeline-tab-id',+ );+ });+it('does not mount prerendered tabs that are not prerenderable', () => {mockActiveTabId = 'timeline-tab-id';mockPrerenderedTabIds = ['home-tab-id'];diff --git a/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingTabBar.tsx b/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingTabBar.tsxindex 4853d22d735..2d4a5b2ff33 100644--- a/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingTabBar.tsx+++ b/packages/twenty-front/src/modules/settings/billing/components/SettingsBillingTabBar.tsx@@ -5,8 +5,9 @@ import { useLingui } from '@lingui/react/macro';import { styled } from '@linaria/react';import { matchPath, useLocation } from 'react-router-dom';import { SettingsPath } from 'twenty-shared/types';-import { getSettingsPath } from 'twenty-shared/utils';-import { TabButton } from 'twenty-ui/primitives/input';+import { getSettingsPath, isDefined } from 'twenty-shared/utils';+import { NavigationLink } from '@/ui/input/components/NavigationLink';+import { TabButton } from 'twenty-ui/components';import { IconColorSwatch, IconCreditCard, IconGauge } from 'twenty-ui/icon';const StyledTabBar = styled.div`@@ -33,31 +34,37 @@ export const SettingsBillingTabBar = () => {const limitsPath = getSettingsPath(SettingsPath.BillingLimits);const isTabActive = (path: string) =>- matchPath({ path, end: true }, location.pathname) !== null;+ isDefined(matchPath({ path, end: true }, location.pathname));++ const tabs = [+ {+ id: 'billing',+ title: t`Billing`,+ Icon: IconCreditCard,+ path: billingPath,+ },+ { id: 'plans', title: t`Plans`, Icon: IconColorSwatch, path: plansPath },+ { id: 'limits', title: t`Limits`, Icon: IconGauge, path: limitsPath },+ ];return (<StyledTabBar>- <TabButton- id="billing"- title={t`Billing`}- LeftIcon={IconCreditCard}- active={isTabActive(billingPath)}- to={billingPath}- />- <TabButton- id="plans"- title={t`Plans`}- LeftIcon={IconColorSwatch}- active={isTabActive(plansPath)}- to={plansPath}- />- <TabButton- id="limits"- title={t`Limits`}- LeftIcon={IconGauge}- active={isTabActive(limitsPath)}- to={limitsPath}- />+ {tabs.map(({ id, title, Icon, path }) => (+ <NavigationLink key={id} to={path}>+ {({ href, render }) => (+ <TabButton+ data-testid={`tab-${id}`}+ startIcon={<Icon />}+ active={isTabActive(path)}+ aria-current={isTabActive(path) ? 'page' : undefined}+ href={href}+ render={render}+ >+ {title}+ </TabButton>+ )}+ </NavigationLink>+ ))}</StyledTabBar>);};diff --git a/packages/twenty-front/src/modules/settings/components/SettingsCustomizeVideoModal.tsx b/packages/twenty-front/src/modules/settings/components/SettingsCustomizeVideoModal.tsxindex 73239112cca..4a44aa48fdd 100644--- a/packages/twenty-front/src/modules/settings/components/SettingsCustomizeVideoModal.tsx+++ b/packages/twenty-front/src/modules/settings/components/SettingsCustomizeVideoModal.tsx@@ -1,11 +1,14 @@+import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState';+import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';import { type SettingsCustomizeVideoModalTab } from '@/settings/types/SettingsCustomizeVideoModalTab';-import { Dialog } from 'twenty-ui/primitives/surfaces';-import { DialogInstance } from '@/ui/layout/dialog/components/DialogInstance';+import { TabListRoot } from '@/ui/layout/tab-list/components/TabListRoot';+import { Tabs } from 'twenty-ui/primitives/navigation';import { t } from '@lingui/core/macro';+import { DialogInstance } from '@/ui/layout/dialog/components/DialogInstance';+import { Dialog } from 'twenty-ui/primitives/surfaces';import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';import { TabList } from '@/ui/layout/tab-list/components/TabList';import { styled } from '@linaria/react';-import { useState } from 'react';import { IconX } from 'twenty-ui/icon';import { IconButton } from 'twenty-ui/components';import { themeCssVariables, useTheme } from 'twenty-ui/theme-constants';@@ -82,7 +85,10 @@ export const SettingsCustomizeVideoModal = ({}: SettingsCustomizeVideoModalProps) => {const theme = useTheme();const { closeDialog } = useDialog();- const [activeTabId, setActiveTabId] = useState<string>(tabs[0]?.id ?? '');+ const activeTabId = useAtomComponentStateValue(+ activeTabIdComponentState,+ tabsInstanceId,+ );if (tabs.length === 0) {return null;@@ -96,6 +102,21 @@ export const SettingsCustomizeVideoModal = ({closeDialog(modalInstanceId);};+ const videoContent = (+ <StyledVideoContainer>+ <StyledVideoIframe+ key={activeTab.id}+ src={+ activeTab.hasSound+ ? `https://player.vimeo.com/video/${activeTab.vimeoId}?byline=0&portrait=0&title=0&vimeo_logo=0&app_id=58479&dnt=1`+ : `https://player.vimeo.com/video/${activeTab.vimeoId}?autoplay=1&loop=1&autopause=0&background=1&muted=1&dnt=1`+ }+ allow="autoplay; fullscreen; picture-in-picture"+ title={activeTab.title}+ />+ </StyledVideoContainer>+ );+return (<DialogInstancedialogId={modalInstanceId}@@ -110,46 +131,44 @@ export const SettingsCustomizeVideoModal = ({size="lg"style={{ padding: 0 }}>- <StyledHeader $hasBottomBorder={!hasMultipleTabs}>+ <TabListRoot+ componentInstanceId={tabsInstanceId}+ enabled={hasMultipleTabs}+ >+ <StyledHeader $hasBottomBorder={!hasMultipleTabs}>+ {hasMultipleTabs ? (+ <StyledTabsContainer>+ <TabList+ aria-label={t`Video tutorials`}+ tabs={tabs}+ behaveAsLinks={false}+ componentInstanceId={tabsInstanceId}+ />+ </StyledTabsContainer>+ ) : (+ <StyledTitle>+ <ActiveTabIcon+ size={theme.icon.size.md}+ color={theme.font.color.primary}+ aria-hidden+ />+ <StyledTitleText>{activeTab.title}</StyledTitleText>+ </StyledTitle>+ )}+ <IconButton+ aria-label={t`Close video`}+ onClick={handleClose}+ size="sm"+ >+ <IconX />+ </IconButton>+ </StyledHeader>{hasMultipleTabs ? (- <StyledTabsContainer>- <TabList- tabs={tabs}- behaveAsLinks={false}- componentInstanceId={tabsInstanceId}- onChangeTab={(tabId) => setActiveTabId(tabId)}- />- </StyledTabsContainer>+ <Tabs.Panel value={activeTab.id}>{videoContent}</Tabs.Panel>) : (- <StyledTitle>- <ActiveTabIcon- size={theme.icon.size.md}- color={theme.font.color.primary}- aria-hidden- />- <StyledTitleText>{activeTab.title}</StyledTitleText>- </StyledTitle>+ videoContent)}- <IconButton- aria-label={t`Close video`}- onClick={handleClose}- size="sm"- >- <IconX />- </IconButton>- </StyledHeader>- <StyledVideoContainer>- <StyledVideoIframe- key={activeTab.id}- src={- activeTab.hasSound- ? `https://player.vimeo.com/video/${activeTab.vimeoId}?byline=0&portrait=0&title=0&vimeo_logo=0&app_id=58479&dnt=1`- : `https://player.vimeo.com/video/${activeTab.vimeoId}?autoplay=1&loop=1&autopause=0&background=1&muted=1&dnt=1`- }- allow="autoplay; fullscreen; picture-in-picture"- title={activeTab.title}- />- </StyledVideoContainer>+ </TabListRoot></Dialog.Popup>)}</DialogInstance>diff --git a/packages/twenty-front/src/modules/settings/components/layout/SettingsTabBar.tsx b/packages/twenty-front/src/modules/settings/components/layout/SettingsTabBar.tsxindex 953759ed891..740a0f1be28 100644--- a/packages/twenty-front/src/modules/settings/components/layout/SettingsTabBar.tsx+++ b/packages/twenty-front/src/modules/settings/components/layout/SettingsTabBar.tsx@@ -3,16 +3,18 @@ import { type TabListProps } from '@/ui/layout/tab-list/types/TabListProps';type SettingsTabBarProps = Pick<TabListProps,- 'behaveAsLinks' | 'componentInstanceId' | 'tabs'+ 'aria-label' | 'behaveAsLinks' | 'componentInstanceId' | 'tabs'>;export const SettingsTabBar = ({+ 'aria-label': ariaLabel,behaveAsLinks,tabs,componentInstanceId,}: SettingsTabBarProps) => {return (<TabList+ aria-label={ariaLabel}behaveAsLinks={behaveAsLinks}tabs={tabs}componentInstanceId={componentInstanceId}diff --git a/packages/twenty-front/src/modules/settings/logic-functions/components/tabs/SettingsLogicFunctionCodeEditorTab.tsx b/packages/twenty-front/src/modules/settings/logic-functions/components/tabs/SettingsLogicFunctionCodeEditorTab.tsxindex 0221d886e2a..2b2868931f1 100644--- a/packages/twenty-front/src/modules/settings/logic-functions/components/tabs/SettingsLogicFunctionCodeEditorTab.tsx+++ b/packages/twenty-front/src/modules/settings/logic-functions/components/tabs/SettingsLogicFunctionCodeEditorTab.tsx@@ -50,6 +50,7 @@ export const SettingsLogicFunctionCodeEditorTab = ({const HeaderTabList = (<StyledTabListContainer><TabList+ aria-label={t`Function files`}tabs={files.map((file) => {return { id: file.path, title: file.path.split('/').at(-1) || '' };})}diff --git a/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRole.tsx b/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRole.tsxindex f4ab84ce930..975b282f1a9 100644--- a/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRole.tsx+++ b/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRole.tsx@@ -145,6 +145,7 @@ export const SettingsRole = ({ roleId, isCreateMode }: SettingsRoleProps) => {pageTitle={settingsDraftRole.label}secondaryBar={<SettingsTabBar+ aria-label={t`Role settings`}tabs={tabs}componentInstanceId={tabsComponentInstanceId}/>diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/__stories__/SidePanelPageLayoutTabSettingsContent.stories.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/__stories__/SidePanelPageLayoutTabSettingsContent.stories.tsxindex e69be1b832f..683d992605e 100644--- a/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/__stories__/SidePanelPageLayoutTabSettingsContent.stories.tsx+++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/__stories__/SidePanelPageLayoutTabSettingsContent.stories.tsx@@ -16,12 +16,12 @@ import { getTabsByDisplayMode } from '@/page-layout/utils/getTabsByDisplayMode';import { SIDE_PANEL_FOCUS_ID } from '@/side-panel/constants/SidePanelFocusId';import { SidePanelPageLayoutTabSettingsContent } from '@/side-panel/pages/page-layout/components/SidePanelPageLayoutTabSettingsContent';import { LayoutRenderingProvider } from '@/ui/layout/contexts/LayoutRenderingContext';-import { TabListFromUrlOptionalEffect } from '@/ui/layout/tab-list/components/TabListFromUrlOptionalEffect';import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState';import { TabListComponentInstanceContext } from '@/ui/layout/tab-list/states/contexts/TabListComponentInstanceContext';import { focusStackState } from '@/ui/utilities/focus/states/focusStackState';import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType';import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';+import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';import { type Meta, type StoryObj } from '@storybook/react-vite';@@ -43,6 +43,7 @@ const TAB_LIST_INSTANCE_ID = getTabListInstanceIdFromPageLayoutAndRecord({const TabSelectionPreview = () => {const { hash } = useLocation();+ const isInEditMode = useAtomStateValue(isLayoutCustomizationModeEnabledState);const { cancel } = useCancelLayoutCustomization();const isMobile = useIsMobile();const pageLayoutDraft = useAtomComponentStateValue(@@ -61,12 +62,10 @@ const TabSelectionPreview = () => {return (<><PageLayoutTabListEffect+ isInEditMode={isInEditMode}tabs={tabsToRenderInTabList}componentInstanceId={TAB_LIST_INSTANCE_ID}/>- <TabListFromUrlOptionalEffect- tabListIds={tabsToRenderInTabList.map((tab) => tab.id)}- /><output aria-label="Current tab URL">{hash}</output><output aria-label="Active tab">{activeTabId}</output><output aria-label="Pinned tab">{pinnedLeftTab?.title ?? 'none'}</output>diff --git a/packages/twenty-front/src/modules/side-panel/pages/workflow/step/view-run/components/SidePanelWorkflowRunViewStepContent.tsx b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/view-run/components/SidePanelWorkflowRunViewStepContent.tsxindex 3879f2645e5..30ef3fad7a9 100644--- a/packages/twenty-front/src/modules/side-panel/pages/workflow/step/view-run/components/SidePanelWorkflowRunViewStepContent.tsx+++ b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/view-run/components/SidePanelWorkflowRunViewStepContent.tsx@@ -1,3 +1,5 @@+import { TabListRoot } from '@/ui/layout/tab-list/components/TabListRoot';+import { WorkflowStepTabPanel } from '@/workflow/workflow-steps/components/WorkflowStepTabPanel';import { SidePanelWorkflowRunStepContentComponentInstanceContext } from '@/side-panel/pages/workflow/step/view-run/states/contexts/SidePanelWorkflowRunStepContentComponentInstanceContext';import { getIsInputTabDisabled } from '@/side-panel/pages/workflow/step/view-run/utils/getIsInputTabDisabled';import { getIsOutputTabDisabled } from '@/side-panel/pages/workflow/step/view-run/utils/getIsOutputTabDisabled';@@ -141,47 +143,51 @@ export const SidePanelWorkflowRunViewStepContent = () => {stepExecutionStatus={stepExecutionStatus}/>) : (- <>+ <TabListRoot+ componentInstanceId={sidePanelPageComponentInstance.instanceId}+ ><StyledTabListContainer><TabList+ aria-label={t`Workflow step results`}tabs={tabs}behaveAsLinks={false}componentInstanceId={sidePanelPageComponentInstance.instanceId}/></StyledTabListContainer>- {activeTabId === WorkflowRunTabId.OUTPUT ? (- <WorkflowRunStepOutputDetail- key={workflowSelectedNode}- stepId={workflowSelectedNode}- />- ) : null}-- {activeTabId === WorkflowRunTabId.NODE ? (- <WorkflowRunStepNodeDetail- stepId={workflowSelectedNode}- trigger={flow.trigger}- steps={flow.steps}- stepExecutionStatus={stepExecutionStatus}- />- ) : null}-- {activeTabId === WorkflowRunTabId.INPUT ? (- <WorkflowRunStepInputDetail- key={workflowSelectedNode}- stepId={workflowSelectedNode}- />- ) : null}-- {activeTabId === WorkflowRunTabId.LOGS ? (- <WorkflowRunStepLogsDetail- key={workflowSelectedNode}- stepId={workflowSelectedNode}- />- ) : null}-+ <WorkflowStepTabPanel value={activeTabId ?? ''}>+ {activeTabId === WorkflowRunTabId.OUTPUT ? (+ <WorkflowRunStepOutputDetail+ key={workflowSelectedNode}+ stepId={workflowSelectedNode}+ />+ ) : null}++ {activeTabId === WorkflowRunTabId.NODE ? (+ <WorkflowRunStepNodeDetail+ stepId={workflowSelectedNode}+ trigger={flow.trigger}+ steps={flow.steps}+ stepExecutionStatus={stepExecutionStatus}+ />+ ) : null}++ {activeTabId === WorkflowRunTabId.INPUT ? (+ <WorkflowRunStepInputDetail+ key={workflowSelectedNode}+ stepId={workflowSelectedNode}+ />+ ) : null}++ {activeTabId === WorkflowRunTabId.LOGS ? (+ <WorkflowRunStepLogsDetail+ key={workflowSelectedNode}+ stepId={workflowSelectedNode}+ />+ ) : null}+ </WorkflowStepTabPanel><WorkflowIteratorSubStepSwitcher stepId={workflowSelectedNode} />- </>+ </TabListRoot>)}</StyledContainer></SidePanelWorkflowRunStepContentComponentInstanceContext.Provider>diff --git a/packages/twenty-front/src/modules/ui/input/components/NavigationButton.tsx b/packages/twenty-front/src/modules/ui/input/components/NavigationButton.tsxindex 449507f1428..05310a8e98e 100644--- a/packages/twenty-front/src/modules/ui/input/components/NavigationButton.tsx+++ b/packages/twenty-front/src/modules/ui/input/components/NavigationButton.tsx@@ -1,23 +1,15 @@import { type ComponentType } from 'react';-import { Link, type LinkProps, useHref } from 'react-router-dom';+import { type LinkProps } from 'react-router-dom';import { isDefined } from 'twenty-shared/utils';import { Button, type ButtonProps } from 'twenty-ui/primitives/input';+import { NavigationLink } from '@/ui/input/components/NavigationLink';+type NavigationButtonProps = Omit<ButtonProps, 'href' | 'render'> & {buttonComponent?: ComponentType<ButtonProps>;to?: LinkProps['to'];};-const NavigationLinkButton = ({- buttonComponent: ButtonComponent = Button,- to,- ...props-}: NavigationButtonProps & { to: LinkProps['to'] }) => {- const href = useHref(to);-- return <ButtonComponent {...props} href={href} render={<Link to={to} />} />;-};-export const NavigationButton = ({buttonComponent: ButtonComponent = Button,to,@@ -25,11 +17,11 @@ export const NavigationButton = ({}: NavigationButtonProps) => {if (isDefined(to)) {return (- <NavigationLinkButton- {...props}- buttonComponent={ButtonComponent}- to={to}- />+ <NavigationLink to={to}>+ {({ href, render }) => (+ <ButtonComponent {...props} href={href} render={render} />+ )}+ </NavigationLink>);}diff --git a/packages/twenty-front/src/modules/ui/input/components/NavigationLink.tsx b/packages/twenty-front/src/modules/ui/input/components/NavigationLink.tsxnew file mode 100644index 00000000000..73a78fdaa43--- /dev/null+++ b/packages/twenty-front/src/modules/ui/input/components/NavigationLink.tsx@@ -0,0 +1,20 @@+import { type ReactElement, type ReactNode } from 'react';+import { Link, type LinkProps, useHref } from 'react-router-dom';++type NavigationLinkProps = Pick<LinkProps, 'to' | 'state' | 'replace'> & {+ children: (props: { href: string; render: ReactElement }) => ReactNode;+};++export const NavigationLink = ({+ to,+ state,+ replace,+ children,+}: NavigationLinkProps) => {+ const href = useHref(to);++ return children({+ href,+ render: <Link to={to} state={state} replace={replace} />,+ });+};diff --git a/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabList.tsx b/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabList.tsxindex b9ab16e4685..b85757e28ce 100644--- a/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabList.tsx+++ b/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabList.tsx@@ -1,10 +1,8 @@import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';import { TabListHiddenMeasurements } from '@/ui/layout/tab-list/components/TabListHiddenMeasurements';-import { TAB_LIST_GAP } from '@/ui/layout/tab-list/constants/TabListGap';import { TAB_LIST_HEIGHT } from '@/ui/layout/tab-list/constants/TabListHeight';import { useScrollActiveTabIntoView } from '@/ui/layout/tab-list/hooks/useScrollActiveTabIntoView';import { useTabListMeasurements } from '@/ui/layout/tab-list/hooks/useTabListMeasurements';-import { SCROLLABLE_TAB_ROW_CSS } from '@/ui/layout/tab-list/styles/ScrollableTabRowCSS';import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState';import { TabListComponentInstanceContext } from '@/ui/layout/tab-list/states/contexts/TabListComponentInstanceContext';import { type TabListProps } from '@/ui/layout/tab-list/types/TabListProps';@@ -13,13 +11,14 @@ import { useWorkspaceSurface } from '@/ui/layout/hooks/useWorkspaceSurface';import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState';import { styled } from '@linaria/react';-import { useCallback, useEffect, useMemo } from 'react';+import { useCallback, useMemo } from 'react';import { useLocation, useNavigate } from 'react-router-dom';import { isDefined } from 'twenty-shared/utils';-import { TabButton } from 'twenty-ui/primitives/input';+import { TabListRow } from '@/ui/layout/tab-list/components/TabListRow';+import { TabListItem } from '@/ui/layout/tab-list/components/TabListItem';import { themeCssVariables } from 'twenty-ui/theme-constants';import { TabListDropdown } from './TabListDropdown';-import { TabListFromUrlOptionalEffect } from './TabListFromUrlOptionalEffect';+import { TabListSelectionSyncEffect } from '@/ui/layout/tab-list/components/TabListSelectionSyncEffect';const StyledContainer = styled.div`box-sizing: border-box;@@ -53,15 +52,6 @@ const StyledDropdownContainer = styled.div`display: flex;`;-const StyledTabContainer = styled.div<{ isScrollable: boolean }>`- display: flex;- gap: ${TAB_LIST_GAP}px;- max-width: 100%;- overflow-x: ${({ isScrollable }) => (isScrollable ? 'auto' : 'hidden')};- position: relative;- ${SCROLLABLE_TAB_ROW_CSS}-`;-const StyledNodeDimension = styled(NodeDimension)`display: flex;flex: 1;@@ -75,6 +65,7 @@ const StyledRightContainer = styled.div``;export const TabList = ({+ 'aria-label': ariaLabel,tabs,loading,behaveAsLinks = true,@@ -96,7 +87,16 @@ export const TabList = ({);const activeTabExists = visibleTabs.some((tab) => tab.id === activeTabId);- const initialActiveTabId = activeTabExists ? activeTabId : visibleTabs[0]?.id;+ const routeTabId = location.hash.replace('#', '');+ const shouldSelectRouteTab =+ behaveAsLinks &&+ workspaceSurface.ownsRouteLocation &&+ visibleTabs.some((tab) => tab.id === routeTabId);+ const nextActiveTabId = shouldSelectRouteTab+ ? routeTabId+ : activeTabExists+ ? activeTabId+ : (visibleTabs[0]?.id ?? null);const {visibleTabCount,@@ -130,17 +130,16 @@ export const TabList = ({return hiddenTabs.some((tab) => tab.id === activeTabId);}, [hasHiddenTabs, hiddenTabs, activeTabId]);- useEffect(() => {- setActiveTabId(initialActiveTabId);- onChangeTab?.(initialActiveTabId || '');- }, [initialActiveTabId, setActiveTabId, onChangeTab]);-const handleTabSelect = useCallback((tabId: string) => {+ if (tabId === activeTabId) {+ return;+ }+setActiveTabId(tabId);onChangeTab?.(tabId);},- [setActiveTabId, onChangeTab],+ [activeTabId, setActiveTabId, onChangeTab],);const handleTabSelectFromDropdown = useCallback(@@ -153,10 +152,9 @@ export const TabList = ({state: location.state,},);- onChangeTab?.(tabId);- } else {- handleTabSelect(tabId);}++ handleTabSelect(tabId);},[behaveAsLinks,@@ -164,13 +162,18 @@ export const TabList = ({location.search,location.state,navigate,- onChangeTab,workspaceSurface.type,],);if (visibleTabs.length === 0) {- return null;+ return (+ <TabListSelectionSyncEffect+ componentInstanceId={componentInstanceId}+ nextActiveTabId={null}+ onChangeTab={onChangeTab}+ />+ );}return (@@ -178,7 +181,11 @@ export const TabList = ({value={{ instanceId: componentInstanceId }}><>- <TabListFromUrlOptionalEffect tabListIds={tabs.map((tab) => tab.id)} />+ <TabListSelectionSyncEffect+ componentInstanceId={componentInstanceId}+ nextActiveTabId={nextActiveTabId}+ onChangeTab={onChangeTab}+ />{visibleTabs.length > 1 && !shouldScrollTabs && (<TabListHiddenMeasurements@@ -193,38 +200,23 @@ export const TabList = ({<StyledContainer className={className}><StyledNodeDimension onDimensionChange={onContainerWidthChange}><StyledInnerContainer $centerTabs={centerTabs && !shouldScrollTabs}>- <StyledTabContainer+ <TabListRow+ aria-label={ariaLabel}ref={tabRowRef}+ behaveAsLinks={behaveAsLinks}isScrollable={shouldScrollTabs}>{renderedTabs.map((tab) => (- <TabButton+ <TabListItemkey={tab.id}- id={tab.id}- title={tab.title}- LeftIcon={tab.Icon}- logo={tab.logo}+ tab={tab}+ mode={behaveAsLinks ? 'link' : 'tab'}active={tab.id === activeTabId}disabled={tab.disabled ?? loading}- pill={tab.pill}- to={- behaveAsLinks- ? { search: location.search, hash: `#${tab.id}` }- : undefined- }- state={behaveAsLinks ? location.state : undefined}- replace={- behaveAsLinks && workspaceSurface.type === 'side-panel'- }- tooltipContent={tab.tooltipContent}- onClick={- behaveAsLinks- ? () => onChangeTab?.(tab.id)- : () => handleTabSelect(tab.id)- }+ onSelect={handleTabSelect}/>))}- </StyledTabContainer>+ </TabListRow>{shouldShowOverflowDropdown && (<StyledDropdownContainer>diff --git a/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabListFromUrlOptionalEffect.tsx b/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabListFromUrlOptionalEffect.tsxdeleted file mode 100644index 124f25d442d..00000000000--- a/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabListFromUrlOptionalEffect.tsx+++ /dev/null@@ -1,43 +0,0 @@-import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState';-import { useWorkspaceSurface } from '@/ui/layout/hooks/useWorkspaceSurface';-import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';-import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState';-import { useEffect } from 'react';-import { useLocation } from 'react-router-dom';--type TabListFromUrlOptionalEffectProps = {- tabListIds: string[];-};--export const TabListFromUrlOptionalEffect = ({- tabListIds,-}: TabListFromUrlOptionalEffectProps) => {- const workspaceSurface = useWorkspaceSurface();- const location = useLocation();- const activeTabId = useAtomComponentStateValue(activeTabIdComponentState);- const setActiveTabId = useSetAtomComponentState(activeTabIdComponentState);-- const hash = location.hash.replace('#', '');-- useEffect(() => {- if (!workspaceSurface.ownsRouteLocation) {- return;- }-- if (hash === activeTabId) {- return;- }-- if (tabListIds.includes(hash)) {- setActiveTabId(hash);- }- }, [- hash,- activeTabId,- setActiveTabId,- tabListIds,- workspaceSurface.ownsRouteLocation,- ]);-- return <></>;-};diff --git a/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabListHiddenMeasurements.tsx b/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabListHiddenMeasurements.tsxindex 542cd70db35..469951de78b 100644--- a/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabListHiddenMeasurements.tsx+++ b/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabListHiddenMeasurements.tsx@@ -5,7 +5,8 @@ import { type SingleTabProps } from '@/ui/layout/tab-list/types/SingleTabProps';import { NodeDimension } from '@/ui/utilities/dimensions/components/NodeDimension';import { styled } from '@linaria/react';import { IconPlus } from 'twenty-ui/icon';-import { TabButton } from 'twenty-ui/primitives/input';+import { TabButton } from 'twenty-ui/components';+import { getTabListItemContent } from '@/ui/layout/tab-list/utils/getTabListItemContent';import { type TabListDimensions } from '@/ui/layout/tab-list/types/TabListDimension';import { TabMoreButton } from './TabMoreButton';@@ -39,40 +40,40 @@ export const TabListHiddenMeasurements = ({addButtonMeasurement,}: TabListHiddenMeasurementsProps) => {return (- <StyledHiddenMeasurement>- {visibleTabs.map((tab) => (- <NodeDimension- key={tab.id}- onDimensionChange={onTabWidthChange(tab.id)}- >- <TabButton- id={tab.id}- title={tab.title}- LeftIcon={tab.Icon}- logo={tab.logo}- active={tab.id === activeTabId}- disabled={tab.disabled ?? loading}- pill={tab.pill}- disableTestId={true}- />- </NodeDimension>- ))}+ <StyledHiddenMeasurement aria-hidden inert>+ {visibleTabs.map((tab) => {+ const { startIcon, badge } = getTabListItemContent(tab);++ return (+ <NodeDimension+ key={tab.id}+ onDimensionChange={onTabWidthChange(tab.id)}+ >+ <TabButton+ children={tab.title}+ startIcon={startIcon}+ active={tab.id === activeTabId}+ disabled={tab.disabled ?? loading}+ badge={badge}+ />+ </NodeDimension>+ );+ })}<NodeDimension onDimensionChange={onMoreButtonWidthChange}>{/* Measured with the highest count it can ever display, so the widestlabel is reserved and the last visible tab is never clipped by it. */}- <TabMoreButton hiddenTabsCount={visibleTabs.length} active={false} />+ <TabMoreButton+ hiddenTabsCount={visibleTabs.length}+ active={false}+ disableTestId+ /></NodeDimension>{onAddButtonWidthChange && (<NodeDimension onDimensionChange={onAddButtonWidthChange}>{addButtonMeasurement ?? (- <TabButton- id="tab-add-button"- title="+"- LeftIcon={IconPlus}- disableTestId={true}- />+ <TabButton children="+" startIcon={<IconPlus />} />)}</NodeDimension>)}diff --git a/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabListItem.tsx b/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabListItem.tsxnew file mode 100644index 00000000000..0084a34ece1--- /dev/null+++ b/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabListItem.tsx@@ -0,0 +1,91 @@+import { styled } from '@linaria/react';+import { isNonEmptyString } from '@sniptt/guards';+import { useLocation } from 'react-router-dom';+import { TabButton } from 'twenty-ui/components';+import { Tabs } from 'twenty-ui/primitives/navigation';+import { Tooltip } from 'twenty-ui/primitives/surfaces';++import { NavigationLink } from '@/ui/input/components/NavigationLink';+import { useWorkspaceSurface } from '@/ui/layout/hooks/useWorkspaceSurface';+import { type TabListItemProps } from '@/ui/layout/tab-list/types/TabListItemProps';+import { getTabListItemContent } from '@/ui/layout/tab-list/utils/getTabListItemContent';++const TAB_TEST_ID_PREFIX = 'tab-';++const StyledTooltipAnchor = styled.div`+ display: flex;+`;++export const TabListItem = ({+ tab,+ active,+ mode,+ disabled = tab.disabled,+ highlighted,+ onSelect,+ ref,+ 'data-dnd-sortable-handle': isDragHandle,+ onMouseEnter,+ onMouseLeave,+}: TabListItemProps) => {+ const location = useLocation();+ const workspaceSurface = useWorkspaceSurface();+ const { startIcon, badge } = getTabListItemContent(tab);+ const testId = `${TAB_TEST_ID_PREFIX}${tab.id}`;+ const selectTab = () => onSelect?.(tab.id);++ return (+ <Tooltip+ content={tab.tooltipContent}+ disabled={!isNonEmptyString(tab.tooltipContent)}+ side="bottom"+ positionMethod="fixed"+ delay={300}+ >+ <StyledTooltipAnchor>+ {mode === 'tab' ? (+ <Tabs.Tab+ data-testid={testId}+ value={tab.id}+ ref={ref}+ data-dnd-sortable-handle={isDragHandle}+ disabled={disabled}+ highlighted={highlighted}+ startIcon={startIcon}+ badge={badge}+ onClick={selectTab}+ onMouseEnter={onMouseEnter}+ onMouseLeave={onMouseLeave}+ >+ {tab.title}+ </Tabs.Tab>+ ) : (+ <NavigationLink+ to={{ search: location.search, hash: `#${tab.id}` }}+ state={location.state}+ replace={workspaceSurface.type === 'side-panel'}+ >+ {({ href, render }) => (+ <TabButton+ data-testid={testId}+ ref={ref}+ href={href}+ render={render}+ active={active}+ aria-current={active ? 'page' : undefined}+ disabled={disabled}+ startIcon={startIcon}+ badge={badge}+ onClick={selectTab}+ onMouseEnter={onMouseEnter}+ onMouseLeave={onMouseLeave}+ >+ {tab.title}+ </TabButton>+ )}+ </NavigationLink>+ )}+ </StyledTooltipAnchor>+ </Tooltip>+ );+};diff --git a/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabListRoot.tsx b/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabListRoot.tsxnew file mode 100644index 00000000000..745b42d3071--- /dev/null+++ b/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabListRoot.tsx@@ -0,0 +1,40 @@+import { styled } from '@linaria/react';+import { type ReactNode } from 'react';+import { Tabs } from 'twenty-ui/primitives/navigation';++import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState';+import { TabListComponentInstanceContext } from '@/ui/layout/tab-list/states/contexts/TabListComponentInstanceContext';+import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';++const StyledRoot = styled(Tabs.Root)`+ display: contents;+`;++type TabListRootProps = {+ componentInstanceId: string;+ children: ReactNode;+ enabled?: boolean;+};++export const TabListRoot = ({+ componentInstanceId,+ children,+ enabled = true,+}: TabListRootProps) => {+ const activeTabId = useAtomComponentStateValue(+ activeTabIdComponentState,+ componentInstanceId,+ );++ return (+ <TabListComponentInstanceContext.Provider+ value={{ instanceId: componentInstanceId }}+ >+ {enabled ? (+ <StyledRoot value={activeTabId}>{children}</StyledRoot>+ ) : (+ children+ )}+ </TabListComponentInstanceContext.Provider>+ );+};diff --git a/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabListRow.tsx b/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabListRow.tsxnew file mode 100644index 00000000000..ab063d6fa22--- /dev/null+++ b/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabListRow.tsx@@ -0,0 +1,54 @@+import { styled } from '@linaria/react';+import { type ReactNode, type Ref } from 'react';+import { Tabs } from 'twenty-ui/primitives/navigation';++import { TAB_LIST_GAP } from '../constants/TabListGap';+import { SCROLLABLE_TAB_ROW_CSS } from '../styles/ScrollableTabRowCSS';++const StyledContainer = styled.div<{ isScrollable: boolean }>`+ display: flex;+ gap: ${TAB_LIST_GAP}px;+ max-width: 100%;+ overflow-x: ${({ isScrollable }) => (isScrollable ? 'auto' : 'hidden')};+ position: relative;+ ${SCROLLABLE_TAB_ROW_CSS}++ &&::after {+ display: none;+ }+`;++type TabListRowProps = {+ 'aria-label': string;+ behaveAsLinks: boolean;+ children: ReactNode;+ isScrollable: boolean;+ ref?: Ref<HTMLDivElement>;+};++export const TabListRow = ({+ 'aria-label': ariaLabel,+ behaveAsLinks,+ children,+ isScrollable,+ ref,+}: TabListRowProps) => {+ if (behaveAsLinks) {+ return (+ <StyledContainer ref={ref} isScrollable={isScrollable}>+ {children}+ </StyledContainer>+ );+ }++ return (+ <Tabs.List+ ref={ref}+ aria-label={ariaLabel}+ activateOnFocus={false}+ render={<StyledContainer isScrollable={isScrollable} />}+ >+ {children}+ </Tabs.List>+ );+};diff --git a/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabListSelectionSyncEffect.tsx b/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabListSelectionSyncEffect.tsxnew file mode 100644index 00000000000..9dfbdcc530a--- /dev/null+++ b/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabListSelectionSyncEffect.tsx@@ -0,0 +1,33 @@+import { useStore } from 'jotai';+import { useEffect } from 'react';++import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState';++type TabListSelectionSyncEffectProps = {+ componentInstanceId: string;+ nextActiveTabId: string | null;+ onChangeTab?: (tabId: string) => void;+};++export const TabListSelectionSyncEffect = ({+ componentInstanceId,+ nextActiveTabId,+ onChangeTab,+}: TabListSelectionSyncEffectProps) => {+ const store = useStore();++ useEffect(() => {+ const activeTabIdAtom = activeTabIdComponentState.atomFamily({+ instanceId: componentInstanceId,+ });++ if (store.get(activeTabIdAtom) === nextActiveTabId) {+ return;+ }++ store.set(activeTabIdAtom, nextActiveTabId);+ onChangeTab?.(nextActiveTabId ?? '');+ }, [componentInstanceId, nextActiveTabId, onChangeTab, store]);++ return null;+};diff --git a/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabMoreButton.tsx b/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabMoreButton.tsxindex a9c4c89455e..f73cd1537d4 100644--- a/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabMoreButton.tsx+++ b/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabMoreButton.tsx@@ -1,11 +1,13 @@import { styled } from '@linaria/react';import { t } from '@lingui/core/macro';import { IconChevronDown } from 'twenty-ui/icon';-import { TabButton } from 'twenty-ui/primitives/input';+import { TabButton } from 'twenty-ui/components';import { TAB_LIST_HEIGHT } from '@/ui/layout/tab-list/constants/TabListHeight';import { TAB_LIST_ROW_HEIGHT_CSS_VARIABLE } from '@/ui/layout/tab-list/constants/TabListRowHeightCssVariable';+const TAB_MORE_BUTTON_TEST_ID = 'tab-tab-more-button';+// The dropdown wraps its clickable component in a fit-content box, so the row// height cannot be inherited and reaches the button through the variable the// tab list sets.@@ -18,18 +20,22 @@ export const TabMoreButton = ({hiddenTabsCount,active,className,+ disableTestId,}: {hiddenTabsCount: number;active: boolean;className?: string;+ disableTestId?: boolean;}) => {+ const testId = disableTestId ? undefined : TAB_MORE_BUTTON_TEST_ID;+return (<StyledTabMoreButtonContainer><TabButton- id="tab-more-button"+ data-testid={testId}active={active}- title={`+${hiddenTabsCount} ${t`More`}`}- RightIcon={IconChevronDown}+ children={`+${hiddenTabsCount} ${t`More`}`}+ endIcon={<IconChevronDown />}className={className}/></StyledTabMoreButtonContainer>diff --git a/packages/twenty-front/src/modules/ui/layout/tab-list/components/__stories__/TabListNavigation.stories.tsx b/packages/twenty-front/src/modules/ui/layout/tab-list/components/__stories__/TabListNavigation.stories.tsxnew file mode 100644index 00000000000..217bb674e6c--- /dev/null+++ b/packages/twenty-front/src/modules/ui/layout/tab-list/components/__stories__/TabListNavigation.stories.tsx@@ -0,0 +1,261 @@+import { type Meta, type StoryObj } from '@storybook/react-vite';+import { StrictMode, useState } from 'react';+import { MemoryRouter, useLocation, useNavigationType } from 'react-router-dom';+import { expect, userEvent, waitFor, within } from 'storybook/test';+import { ComponentDecorator } from 'twenty-ui/testing';+import { Button } from 'twenty-ui/primitives/input';+import { Tabs } from 'twenty-ui/primitives/navigation';+import { Text } from 'twenty-ui/primitives/typography';++import { TabList } from '@/ui/layout/tab-list/components/TabList';+import { TabListRoot } from '@/ui/layout/tab-list/components/TabListRoot';+import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState';+import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';+import { WorkspaceSurfaceContext } from '@/ui/layout/contexts/WorkspaceSurfaceContext';++const TabGroup = ({+ links,+ instanceId,+}: {+ links: boolean;+ instanceId: string;+}) => {+ const activeTabId = useAtomComponentStateValue(+ activeTabIdComponentState,+ instanceId,+ );+ const [selections, setSelections] = useState(0);+ const [tabIds, setTabIds] = useState(['overview', 'disabled', 'activity']);+ const [renderCount, setRenderCount] = useState(0);++ return (+ <section aria-label={instanceId}>+ <TabListRoot componentInstanceId={instanceId} enabled={!links}>+ <TabList+ aria-label={`${instanceId} sections`}+ componentInstanceId={instanceId}+ behaveAsLinks={links}+ tabs={tabIds.map((id) => ({+ id,+ title: id,+ disabled: id === 'disabled',+ }))}+ onChangeTab={() => setSelections((count) => count + 1)}+ />+ {!links && activeTabId && (+ <Tabs.Panel value={activeTabId}>+ <Text>{activeTabId} content</Text>+ </Tabs.Panel>+ )}+ </TabListRoot>+ <Text role="status">+ {activeTabId ?? 'none'}: {selections}+ </Text>+ <Button onClick={() => setRenderCount((count) => count + 1)}>+ Rerender {renderCount}+ </Button>+ <Button+ onClick={() =>+ setTabIds((ids) => ids.filter((id) => id !== 'activity'))+ }+ >+ Remove activity+ </Button>+ <Button onClick={() => setTabIds([])}>Remove all tabs</Button>+ </section>+ );+};++const TabListNavigationExample = ({+ links = false,+ multiple = false,+}: {+ links?: boolean;+ sidePanel?: boolean;+ multiple?: boolean;+ hash?: string;+}) => {+ const location = useLocation();+ const navigationType = useNavigationType();++ return (+ <>+ <TabGroup links={links} instanceId="first" />+ {multiple && <TabGroup links={links} instanceId="second" />}+ <Text>+ {location.search}+ {location.hash}+ </Text>+ <Text>{navigationType}</Text>+ <Text>{location.state?.source}</Text>+ </>+ );+};++const meta: Meta<typeof TabListNavigationExample> = {+ title: 'UI/Layout/TabList/Navigation',+ component: TabListNavigationExample,+ decorators: [+ ComponentDecorator,+ (Story, { args }) => (+ <StrictMode>+ <MemoryRouter+ initialEntries={[+ {+ pathname: '/',+ search: '?filter=open',+ hash: args.hash,+ state: { source: 'tab-list' },+ },+ ]}+ >+ <WorkspaceSurfaceContext.Provider+ value={{+ type: args.sidePanel ? 'side-panel' : 'main',+ instanceId: 'tab-navigation',+ ownsRouteLocation: true,+ }}+ >+ <Story />+ </WorkspaceSurfaceContext.Provider>+ </MemoryRouter>+ </StrictMode>+ ),+ ],+};++export default meta;+type Story = StoryObj<typeof TabListNavigationExample>;++export const KeyboardSelection: Story = {+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ const overview = await canvas.findByRole('tab', { name: 'overview' });+ const activity = canvas.getByRole('tab', { name: 'activity' });++ await waitFor(() =>+ expect(canvas.getByRole('status')).toHaveTextContent('overview: 1'),+ );+ overview.focus();+ await userEvent.keyboard('{ArrowRight}');+ expect(activity).toHaveFocus();+ expect(overview).toHaveAttribute('aria-selected', 'true');+ await userEvent.keyboard('{Enter}');+ expect(activity).toHaveAttribute('aria-selected', 'true');+ expect(canvas.getByRole('status')).toHaveTextContent('activity: 2');++ const panel = canvas.getByRole('tabpanel', { name: 'activity' });+ expect(panel).toHaveTextContent('activity content');+ expect(activity).toHaveAttribute('aria-controls', panel.id);+ expect(panel).toHaveAttribute('aria-labelledby', activity.id);+ await userEvent.tab();+ expect(panel).toHaveFocus();++ await userEvent.click(activity);+ expect(canvas.getByRole('status')).toHaveTextContent('activity: 2');+ await userEvent.click(canvas.getByRole('button', { name: 'Rerender 0' }));+ expect(canvas.getByRole('status')).toHaveTextContent('activity: 2');+ activity.focus();+ await userEvent.keyboard('{Home}');+ expect(overview).toHaveFocus();+ await userEvent.keyboard(' ');+ expect(canvas.getByRole('status')).toHaveTextContent('overview: 3');+ expect(canvas.getByRole('tabpanel', { name: 'overview' })).toBeVisible();+ },+};++export const InPageSelectionIgnoresHash: Story = {+ ...KeyboardSelection,+ args: { hash: '#activity' },+};++export const SelectionFallback: Story = {+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ await userEvent.click(await canvas.findByRole('tab', { name: 'activity' }));+ expect(canvas.getByRole('status')).toHaveTextContent('activity: 2');+ await userEvent.click(+ canvas.getByRole('button', { name: 'Remove activity' }),+ );+ expect(canvas.getByRole('status')).toHaveTextContent('overview: 3');+ expect(canvas.getByRole('tabpanel', { name: 'overview' })).toBeVisible();+ await userEvent.click(+ canvas.getByRole('button', { name: 'Remove all tabs' }),+ );+ expect(canvas.getByRole('status')).toHaveTextContent('none: 4');+ expect(canvas.queryByRole('tablist')).not.toBeInTheDocument();+ },+};++export const IndependentTabGroups: Story = {+ args: { multiple: true },+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ const first = within(canvas.getByRole('region', { name: 'first' }));+ const second = within(canvas.getByRole('region', { name: 'second' }));+ const firstActivity = await first.findByRole('tab', { name: 'activity' });+ const secondActivity = second.getByRole('tab', { name: 'activity' });++ expect(+ canvas.getByRole('tablist', { name: 'first sections' }),+ ).toBeVisible();+ expect(+ canvas.getByRole('tablist', { name: 'second sections' }),+ ).toBeVisible();+ expect(firstActivity.id).not.toBe(secondActivity.id);+ await userEvent.click(firstActivity);+ expect(first.getByRole('tabpanel', { name: 'activity' })).toBeVisible();+ expect(second.getByRole('tabpanel', { name: 'overview' })).toBeVisible();+ await userEvent.click(secondActivity);+ const firstPanel = first.getByRole('tabpanel', { name: 'activity' });+ const secondPanel = second.getByRole('tabpanel', { name: 'activity' });+ expect(firstPanel.id).not.toBe(secondPanel.id);+ expect(firstActivity).toHaveAttribute('aria-controls', firstPanel.id);+ expect(secondActivity).toHaveAttribute('aria-controls', secondPanel.id);+ const elementsWithIds = [...canvasElement.querySelectorAll('[id]')];+ expect(new Set(elementsWithIds.map((element) => element.id)).size).toBe(+ elementsWithIds.length,+ );+ },+};++export const RouteLinks: Story = {+ args: { links: true },+ play: async ({ canvasElement, args }) => {+ const canvas = within(canvasElement);+ const activity = await canvas.findByRole('link', { name: 'activity' });+ const disabled = canvas.getByRole('link', { name: 'disabled' });++ expect(canvas.queryByRole('tablist')).not.toBeInTheDocument();+ expect(canvas.queryByRole('tabpanel')).not.toBeInTheDocument();+ expect(activity).toHaveAttribute('href', '/?filter=open#activity');+ await userEvent.click(activity);+ expect(canvas.getByRole('status')).toHaveTextContent('activity: 2');+ expect(canvas.getByText('?filter=open#activity')).toBeVisible();+ expect(canvas.getByText(args.sidePanel ? 'REPLACE' : 'PUSH')).toBeVisible();+ expect(canvas.getByText('tab-list')).toBeVisible();+ expect(activity).toHaveAttribute('aria-current', 'page');+ await userEvent.click(disabled);+ expect(canvas.getByRole('status')).toHaveTextContent('activity: 2');+ expect(canvas.getByText('?filter=open#activity')).toBeVisible();+ },+};++export const SidePanelRouteLinks: Story = {+ ...RouteLinks,+ args: { links: true, sidePanel: true },+};++export const RouteSelectionFromHash: Story = {+ args: { links: true, hash: '#activity' },+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ await waitFor(() =>+ expect(canvas.getByRole('status')).toHaveTextContent('activity: 1'),+ );+ expect(canvas.getByRole('link', { name: 'activity' })).toHaveAttribute(+ 'aria-current',+ 'page',+ );+ },+};diff --git a/packages/twenty-front/src/modules/ui/layout/tab-list/components/__stories__/Tablist.stories.tsx b/packages/twenty-front/src/modules/ui/layout/tab-list/components/__stories__/Tablist.stories.tsxindex f5f709bd34a..b7993515a48 100644--- a/packages/twenty-front/src/modules/ui/layout/tab-list/components/__stories__/Tablist.stories.tsx+++ b/packages/twenty-front/src/modules/ui/layout/tab-list/components/__stories__/Tablist.stories.tsx@@ -1,3 +1,6 @@+import { TabListRoot } from '@/ui/layout/tab-list/components/TabListRoot';+import { Tabs } from 'twenty-ui/primitives/navigation';+import { Text } from 'twenty-ui/primitives/typography';import { TabList } from '@/ui/layout/tab-list/components/TabList';import { styled } from '@linaria/react';import { type Meta, type StoryObj } from '@storybook/react-vite';@@ -54,6 +57,7 @@ const meta: Meta<typeof TabList> = {title: 'UI/Layout/TabList/TabList',component: TabList,args: {+ 'aria-label': 'Record sections',tabs: tabs,componentInstanceId: 'tab-list',},@@ -74,13 +78,27 @@ export const Default: Story = {<p><strong>↔ Drag the bottom-right corner to resize!</strong></p>- <TabList- tabs={args.tabs}+ <TabListRootcomponentInstanceId={args.componentInstanceId}- loading={args.loading}- behaveAsLinks={args.behaveAsLinks}- className={args.className}- />+ enabled={args.behaveAsLinks === false}+ >+ <TabList+ aria-label={args['aria-label']}+ tabs={args.tabs}+ componentInstanceId={args.componentInstanceId}+ loading={args.loading}+ behaveAsLinks={args.behaveAsLinks}+ className={args.className}+ />+ {args.behaveAsLinks === false &&+ args.tabs+ .filter((tab) => !tab.hide)+ .map((tab) => (+ <Tabs.Panel key={tab.id} value={tab.id}>+ <Text>{tab.title} content</Text>+ </Tabs.Panel>+ ))}+ </TabListRoot></StyledInteractiveContainer>),};diff --git a/packages/twenty-front/src/modules/ui/layout/tab-list/types/TabListItemProps.ts b/packages/twenty-front/src/modules/ui/layout/tab-list/types/TabListItemProps.tsnew file mode 100644index 00000000000..9a3968c0407--- /dev/null+++ b/packages/twenty-front/src/modules/ui/layout/tab-list/types/TabListItemProps.ts@@ -0,0 +1,19 @@+import { type RefCallback } from 'react';+import { type TabsTabProps } from 'twenty-ui/primitives/navigation';++import { type SingleTabProps } from '@/ui/layout/tab-list/types/SingleTabProps';++export type TabListItemProps = Pick<+ TabsTabProps,+ 'onMouseEnter' | 'onMouseLeave'+> & {+ tab: SingleTabProps;+ active: boolean;+ disabled?: boolean;+ onSelect?: (tabId: string) => void;+ ref?: RefCallback<HTMLElement>;+ 'data-dnd-sortable-handle'?: boolean;+} & (+ | { mode: 'tab'; highlighted?: boolean }+ | { mode: 'link'; highlighted?: never }+ );diff --git a/packages/twenty-front/src/modules/ui/layout/tab-list/types/TabListProps.ts b/packages/twenty-front/src/modules/ui/layout/tab-list/types/TabListProps.tsindex 2e650723b75..b5f85ef9f24 100644--- a/packages/twenty-front/src/modules/ui/layout/tab-list/types/TabListProps.ts+++ b/packages/twenty-front/src/modules/ui/layout/tab-list/types/TabListProps.ts@@ -3,6 +3,7 @@ import { type ReactNode } from 'react';import { type SingleTabProps } from '@/ui/layout/tab-list/types/SingleTabProps';export type TabListProps = {+ 'aria-label': string;tabs: SingleTabProps[];loading?: boolean;behaveAsLinks?: boolean;diff --git a/packages/twenty-front/src/modules/ui/layout/tab-list/utils/getTabListItemContent.tsx b/packages/twenty-front/src/modules/ui/layout/tab-list/utils/getTabListItemContent.tsxnew file mode 100644index 00000000000..1e51a79ef4a--- /dev/null+++ b/packages/twenty-front/src/modules/ui/layout/tab-list/utils/getTabListItemContent.tsx@@ -0,0 +1,23 @@+import { isNonEmptyString, isString } from '@sniptt/guards';+import { isDefined } from 'twenty-shared/utils';+import { Avatar, Pill } from 'twenty-ui/primitives/data-display';++import { type SingleTabProps } from '@/ui/layout/tab-list/types/SingleTabProps';++export const getTabListItemContent = ({+ Icon,+ logo,+ title,+ pill,+}: SingleTabProps) => ({+ startIcon:+ isDefined(Icon) || isNonEmptyString(logo) ? (+ <>+ {isDefined(Icon) && <Icon />}+ {isNonEmptyString(logo) && (+ <Avatar src={logo} size="md" name={title} aria-hidden />+ )}+ </>+ ) : undefined,+ badge: isString(pill) ? <Pill label={pill} /> : pill,+});diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/components/WorkflowStepTabPanel.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/components/WorkflowStepTabPanel.tsxnew file mode 100644index 00000000000..759aff08ee8--- /dev/null+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/components/WorkflowStepTabPanel.tsx@@ -0,0 +1,23 @@+import { styled } from '@linaria/react';+import { type ReactNode } from 'react';+import { Tabs } from 'twenty-ui/primitives/navigation';++const StyledPanel = styled.div`+ display: flex;+ flex-direction: column;+ min-height: 0;+`;++type WorkflowStepTabPanelProps = {+ value: string;+ children: ReactNode;+};++export const WorkflowStepTabPanel = ({+ value,+ children,+}: WorkflowStepTabPanelProps) => (+ <Tabs.Panel value={value} render={<StyledPanel />}>+ {children}+ </Tabs.Panel>+);diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowEditActionAiAgent.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowEditActionAiAgent.tsxindex aa9bf6b358b..f33a28afa37 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowEditActionAiAgent.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowEditActionAiAgent.tsx@@ -1,3 +1,5 @@+import { TabListRoot } from '@/ui/layout/tab-list/components/TabListRoot';+import { WorkflowStepTabPanel } from '@/workflow/workflow-steps/components/WorkflowStepTabPanel';import { TabList } from '@/ui/layout/tab-list/components/TabList';import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState';import { type SingleTabProps } from '@/ui/layout/tab-list/types/SingleTabProps';@@ -172,44 +174,47 @@ export const WorkflowEditActionAiAgent = ({return agentLoading || !isCurrentAgentLoaded ? (<SidePanelSkeletonLoader />) : (- <>+ <TabListRoot componentInstanceId={componentInstanceId}><StyledTabListContainer><TabList+ aria-label={t`AI agent configuration`}tabs={tabs}componentInstanceId={componentInstanceId}behaveAsLinks={false}/></StyledTabListContainer>- {currentTabId === WORKFLOW_AI_AGENT_TABS.PERMISSIONS ? (- <WorkflowStepBody paddingBlock="0" paddingInline="0">- <WorkflowAiAgentPermissionsTab- action={action}- readonly={actionOptions.readonly === true}- isAgentLoading={agentLoading}- refetchAgent={refetchAgent}- />- </WorkflowStepBody>- ) : (- <WorkflowStepBody>- <WorkflowAiAgentPromptTab- action={action}- prompt={prompt}- readonly={actionOptions.readonly === true}- onPromptChange={handleAgentPromptChange}- onActionUpdate={- actionOptions.readonly === true- ? undefined- : actionOptions.onActionUpdate- }- />- </WorkflowStepBody>- )}+ <WorkflowStepTabPanel value={currentTabId}>+ {currentTabId === WORKFLOW_AI_AGENT_TABS.PERMISSIONS ? (+ <WorkflowStepBody paddingBlock="0" paddingInline="0">+ <WorkflowAiAgentPermissionsTab+ action={action}+ readonly={actionOptions.readonly === true}+ isAgentLoading={agentLoading}+ refetchAgent={refetchAgent}+ />+ </WorkflowStepBody>+ ) : (+ <WorkflowStepBody>+ <WorkflowAiAgentPromptTab+ action={action}+ prompt={prompt}+ readonly={actionOptions.readonly === true}+ onPromptChange={handleAgentPromptChange}+ onActionUpdate={+ actionOptions.readonly === true+ ? undefined+ : actionOptions.onActionUpdate+ }+ />+ </WorkflowStepBody>+ )}+ </WorkflowStepTabPanel>{!actionOptions.readonly && (<WorkflowStepFooteradditionalActions={getFooterActions()}stepId={action.id}/>)}- </>+ </TabListRoot>);};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowEditActionCode.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowEditActionCode.tsxindex 1a78209839e..6939a93e64d 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowEditActionCode.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowEditActionCode.tsx@@ -1,3 +1,5 @@+import { TabListRoot } from '@/ui/layout/tab-list/components/TabListRoot';+import { WorkflowStepTabPanel } from '@/workflow/workflow-steps/components/WorkflowStepTabPanel';import { useGetAvailablePackages } from '@/logic-functions/hooks/useGetAvailablePackages';import { useLogicFunctionForm } from '@/logic-functions/hooks/useLogicFunctionForm';import { useFullScreenModal } from '@/ui/layout/fullscreen/hooks/useFullScreenModal';@@ -384,76 +386,83 @@ export const WorkflowEditActionCode = ({return (!loading && (- <>+ <TabListRoot+ componentInstanceId={WORKFLOW_LOGIC_FUNCTION_TAB_LIST_COMPONENT_ID}+ ><LogicFunctionTestInputInitEffect logicFunctionId={logicFunctionId} /><StyledTabListContainer><TabList+ aria-label={t`Code step`}tabs={tabs}behaveAsLinks={false}componentInstanceId={WORKFLOW_LOGIC_FUNCTION_TAB_LIST_COMPONENT_ID}/></StyledTabListContainer>- <WorkflowStepBody>- {activeTabId === WorkflowLogicFunctionTabId.CODE && (- <>- <WorkflowEditActionCodeFields- functionInput={functionInput}- inputSchema={- formValues.workflowActionTriggerSettings?.inputSchema- }- VariablePicker={WorkflowVariablePicker}- onInputChange={handleInputChange}- readonly={actionOptions.readonly}- />- <WorkflowCodeEditor- value={formValues.sourceHandlerCode}- onChange={handleCodeChange}- onMount={handleEditorDidMount}- options={{- readOnly: actionOptions.readonly,- domReadOnly: actionOptions.readonly,- scrollBeyondLastLine: false,- lineNumbersMinChars: 2,- fixedOverflowWidgets: true,- }}- readonly={actionOptions.readonly}- onEnterFullScreen={handleEnterFullScreen}- />- <WorkflowExpectedOutputBodyInput- defaultValue={action.settings.expectedOutputSchema}- onChange={handleExpectedOutputBodyChange}- readonly={actionOptions.readonly}- />- </>- )}- {activeTabId === WorkflowLogicFunctionTabId.TEST && (- <>- <WorkflowEditActionCodeFields- functionInput={logicFunctionTestData.input}- inputSchema={- formValues.workflowActionTriggerSettings?.inputSchema- }- onInputChange={handleTestInputChange}- readonly={actionOptions.readonly}- />- <StyledCodeEditorContainer>- <InputLabel>{t`Result`}</InputLabel>- <LogicFunctionExecutionResult- logicFunctionTestData={logicFunctionTestData}- isTesting={isExecuting}+ <WorkflowStepTabPanel value={activeTabId ?? ''}>+ <WorkflowStepBody>+ {activeTabId === WorkflowLogicFunctionTabId.CODE && (+ <>+ <WorkflowEditActionCodeFields+ functionInput={functionInput}+ inputSchema={+ formValues.workflowActionTriggerSettings?.inputSchema+ }+ VariablePicker={WorkflowVariablePicker}+ onInputChange={handleInputChange}+ readonly={actionOptions.readonly}+ />+ <WorkflowCodeEditor+ value={formValues.sourceHandlerCode}+ onChange={handleCodeChange}+ onMount={handleEditorDidMount}+ options={{+ readOnly: actionOptions.readonly,+ domReadOnly: actionOptions.readonly,+ scrollBeyondLastLine: false,+ lineNumbersMinChars: 2,+ fixedOverflowWidgets: true,+ }}+ readonly={actionOptions.readonly}+ onEnterFullScreen={handleEnterFullScreen}+ />+ <WorkflowExpectedOutputBodyInput+ defaultValue={action.settings.expectedOutputSchema}+ onChange={handleExpectedOutputBodyChange}+ readonly={actionOptions.readonly}+ />+ </>+ )}+ {activeTabId === WorkflowLogicFunctionTabId.TEST && (+ <>+ <WorkflowEditActionCodeFields+ functionInput={logicFunctionTestData.input}+ inputSchema={+ formValues.workflowActionTriggerSettings?.inputSchema+ }+ onInputChange={handleTestInputChange}+ readonly={actionOptions.readonly}/>- </StyledCodeEditorContainer>- {logicFunctionTestData.output.logs.length > 0 && (<StyledCodeEditorContainer>- <LogicFunctionLogs- componentInstanceId={`workflow-edit-action-logs-${action.id}`}- value={isExecuting ? '' : logicFunctionTestData.output.logs}+ <InputLabel>{t`Result`}</InputLabel>+ <LogicFunctionExecutionResult+ logicFunctionTestData={logicFunctionTestData}+ isTesting={isExecuting}/></StyledCodeEditorContainer>- )}- </>- )}- </WorkflowStepBody>+ {logicFunctionTestData.output.logs.length > 0 && (+ <StyledCodeEditorContainer>+ <LogicFunctionLogs+ componentInstanceId={`workflow-edit-action-logs-${action.id}`}+ value={+ isExecuting ? '' : logicFunctionTestData.output.logs+ }+ />+ </StyledCodeEditorContainer>+ )}+ </>+ )}+ </WorkflowStepBody>+ </WorkflowStepTabPanel>{!actionOptions.readonly && (<WorkflowStepFooterstepId={action.id}@@ -471,7 +480,7 @@ export const WorkflowEditActionCode = ({/>)}{fullScreenOverlay}- </>+ </TabListRoot>));};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/WorkflowEditActionHttpRequest.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/WorkflowEditActionHttpRequest.tsxindex 06706ec7414..d9a258950ab 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/WorkflowEditActionHttpRequest.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/WorkflowEditActionHttpRequest.tsx@@ -1,3 +1,5 @@+import { TabListRoot } from '@/ui/layout/tab-list/components/TabListRoot';+import { WorkflowStepTabPanel } from '@/workflow/workflow-steps/components/WorkflowStepTabPanel';import { FormRawJsonFieldInput } from '@/object-record/record-field/ui/form-types/components/FormRawJsonFieldInput';import { FormTextFieldInput } from '@/object-record/record-field/ui/form-types/components/FormTextFieldInput';import { Select } from '@/ui/input/components/Select';@@ -127,85 +129,90 @@ export const WorkflowEditActionHttpRequest = ({useEffect(() => () => saveAction.flush(), [saveAction]);return (- <>+ <TabListRoot+ componentInstanceId={WORKFLOW_HTTP_REQUEST_TAB_LIST_COMPONENT_ID}+ ><StyledTabListContainer><TabList+ aria-label={t`HTTP request`}tabs={tabs}behaveAsLinks={false}componentInstanceId={WORKFLOW_HTTP_REQUEST_TAB_LIST_COMPONENT_ID}/></StyledTabListContainer>- <WorkflowStepBody>- {activeTabId === WorkflowHttpRequestTabId.CONFIGURATION && (- <StyledConfigurationTabContent>- <FormTextFieldInput- label={t`URL`}- placeholder={t`https://api.example.com/endpoint`}- readonly={actionOptions.readonly}- defaultValue={formData.url}- onChange={(value) => handleFieldChange('url', value)}- VariablePicker={WorkflowVariablePicker}- />- <Select- label={t`HTTP Method`}- dropdownId="http-method"- options={[...HTTP_METHODS]}- value={formData.method}- onChange={(value) => handleFieldChange('method', value)}- disabled={actionOptions.readonly}- dropdownOffset={{- y: parseInt(theme.spacing[1], 10),- }}- dropdownWidth={GenericDropdownContentWidth.ExtraLarge}- />-- <KeyValuePairInput- key={getBodyTypeFromHeaders(formData.headers) || 'none'}- label={t`Headers Input`}- defaultValue={formData.headers}- onChange={(value) => handleFieldChange('headers', value)}- readonly={actionOptions.readonly}- keyPlaceholder={t`Header name`}- valuePlaceholder={t`Header value`}- />-- {isMethodWithBody(formData.method) && (- <BodyInput- defaultValue={formData.body}- onChange={(value, type = 'body') =>- handleFieldChange(type, value)- }+ <WorkflowStepTabPanel value={activeTabId ?? ''}>+ <WorkflowStepBody>+ {activeTabId === WorkflowHttpRequestTabId.CONFIGURATION && (+ <StyledConfigurationTabContent>+ <FormTextFieldInput+ label={t`URL`}+ placeholder={t`https://api.example.com/endpoint`}readonly={actionOptions.readonly}- headers={formData.headers}+ defaultValue={formData.url}+ onChange={(value) => handleFieldChange('url', value)}+ VariablePicker={WorkflowVariablePicker}/>- )}-- <StyledFullHeightFormRawJsonFieldInputContainer>- <FormRawJsonFieldInput- label={t`Expected Response Body`}- placeholder={JSON_RESPONSE_PLACEHOLDER}- defaultValue={outputSchema}- onChange={handleOutputSchemaChange}+ <Select+ label={t`HTTP Method`}+ dropdownId="http-method"+ options={[...HTTP_METHODS]}+ value={formData.method}+ onChange={(value) => handleFieldChange('method', value)}+ disabled={actionOptions.readonly}+ dropdownOffset={{+ y: parseInt(theme.spacing[1], 10),+ }}+ dropdownWidth={GenericDropdownContentWidth.ExtraLarge}+ />++ <KeyValuePairInput+ key={getBodyTypeFromHeaders(formData.headers) || 'none'}+ label={t`Headers Input`}+ defaultValue={formData.headers}+ onChange={(value) => handleFieldChange('headers', value)}+ readonly={actionOptions.readonly}+ keyPlaceholder={t`Header name`}+ valuePlaceholder={t`Header value`}+ />++ {isMethodWithBody(formData.method) && (+ <BodyInput+ defaultValue={formData.body}+ onChange={(value, type = 'body') =>+ handleFieldChange(type, value)+ }+ readonly={actionOptions.readonly}+ headers={formData.headers}+ />+ )}++ <StyledFullHeightFormRawJsonFieldInputContainer>+ <FormRawJsonFieldInput+ label={t`Expected Response Body`}+ placeholder={JSON_RESPONSE_PLACEHOLDER}+ defaultValue={outputSchema}+ onChange={handleOutputSchemaChange}+ readonly={actionOptions.readonly}+ error={error}+ />+ </StyledFullHeightFormRawJsonFieldInputContainer>+ </StyledConfigurationTabContent>+ )}+ {activeTabId === WorkflowHttpRequestTabId.TEST && (+ <StyledTestTabContent>+ <HttpRequestTestVariableInput+ httpRequestFormData={formData}+ actionId={action.id}readonly={actionOptions.readonly}- error={error}/>- </StyledFullHeightFormRawJsonFieldInputContainer>- </StyledConfigurationTabContent>- )}- {activeTabId === WorkflowHttpRequestTabId.TEST && (- <StyledTestTabContent>- <HttpRequestTestVariableInput- httpRequestFormData={formData}- actionId={action.id}- readonly={actionOptions.readonly}- />- <HttpRequestExecutionResult- httpRequestTestData={httpRequestTestData}- isTesting={isTesting}- />- </StyledTestTabContent>- )}- </WorkflowStepBody>+ <HttpRequestExecutionResult+ httpRequestTestData={httpRequestTestData}+ isTesting={isTesting}+ />+ </StyledTestTabContent>+ )}+ </WorkflowStepBody>+ </WorkflowStepTabPanel>{!actionOptions.readonly && (<WorkflowStepFooterstepId={action.id}@@ -222,6 +229,6 @@ export const WorkflowEditActionHttpRequest = ({}/>)}- </>+ </TabListRoot>);};diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/logic-function-action/components/WorkflowEditActionLogicFunction.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/logic-function-action/components/WorkflowEditActionLogicFunction.tsxindex 05516b9b400..4334f19cf3a 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/logic-function-action/components/WorkflowEditActionLogicFunction.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/logic-function-action/components/WorkflowEditActionLogicFunction.tsx@@ -1,3 +1,5 @@+import { TabListRoot } from '@/ui/layout/tab-list/components/TabListRoot';+import { WorkflowStepTabPanel } from '@/workflow/workflow-steps/components/WorkflowStepTabPanel';import { useIsThirdPartyApplication } from '@/applications/hooks/useIsThirdPartyApplication';import { LogicFunctionExecutionResult } from '@/logic-functions/components/LogicFunctionExecutionResult';import { LogicFunctionLogs } from '@/logic-functions/components/LogicFunctionLogs';@@ -216,12 +218,74 @@ export const WorkflowEditActionLogicFunction = ({},];+ const stepBody = (+ <WorkflowStepBody>+ {isTestTabActive ? (+ <>+ <WorkflowEditActionCodeFields+ functionInput={testInput}+ inputSchema={+ logicFunction?.workflowActionTriggerSettings?.inputSchema+ }+ onInputChange={handleTestInputChange}+ readonly={actionOptions.readonly}+ />+ <StyledResultContainer>+ <InputLabel>{t`Result`}</InputLabel>+ <LogicFunctionExecutionResult+ logicFunctionTestData={logicFunctionTestData}+ isTesting={isExecuting}+ />+ </StyledResultContainer>+ {logicFunctionTestData.output.logs.length > 0 && (+ <StyledResultContainer>+ <LogicFunctionLogs+ componentInstanceId={`workflow-edit-action-logs-${action.id}`}+ value={isExecuting ? '' : logicFunctionTestData.output.logs}+ />+ </StyledResultContainer>+ )}+ </>+ ) : (+ <StyledContainer>+ {hasInputFields ? (+ <WorkflowEditActionCodeFields+ functionInput={functionInput}+ inputSchema={+ logicFunction?.workflowActionTriggerSettings?.inputSchema+ }+ readonly={actionOptions.readonly}+ onInputChange={handleInputChange}+ VariablePicker={WorkflowVariablePicker}+ fullWidth+ />+ ) : (+ <Callout+ variant={'neutral'}+ title={t`No input fields for this action`}+ description={t`You can see the function logic in your application settings.`}+ />+ )}+ <WorkflowExpectedOutputBodyInput+ defaultValue={action.settings.expectedOutputSchema}+ onChange={handleExpectedOutputBodyChange}+ readonly={actionOptions.readonly}+ />+ </StyledContainer>+ )}+ </WorkflowStepBody>+ );+return (- <>+ <TabListRoot+ componentInstanceId={WORKFLOW_LOGIC_FUNCTION_ACTION_TAB_LIST_COMPONENT_ID}+ enabled={!isThirdPartyApp}+ ><LogicFunctionTestInputInitEffect logicFunctionId={logicFunctionId} />{!isThirdPartyApp && (<StyledTabListContainer><TabList+ aria-label={t`Function step`}tabs={tabs}behaveAsLinks={false}componentInstanceId={@@ -230,61 +294,13 @@ export const WorkflowEditActionLogicFunction = ({/></StyledTabListContainer>)}- <WorkflowStepBody>- {isTestTabActive ? (- <>- <WorkflowEditActionCodeFields- functionInput={testInput}- inputSchema={- logicFunction?.workflowActionTriggerSettings?.inputSchema- }- onInputChange={handleTestInputChange}- readonly={actionOptions.readonly}- />- <StyledResultContainer>- <InputLabel>{t`Result`}</InputLabel>- <LogicFunctionExecutionResult- logicFunctionTestData={logicFunctionTestData}- isTesting={isExecuting}- />- </StyledResultContainer>- {logicFunctionTestData.output.logs.length > 0 && (- <StyledResultContainer>- <LogicFunctionLogs- componentInstanceId={`workflow-edit-action-logs-${action.id}`}- value={isExecuting ? '' : logicFunctionTestData.output.logs}- />- </StyledResultContainer>- )}- </>- ) : (- <StyledContainer>- {hasInputFields ? (- <WorkflowEditActionCodeFields- functionInput={functionInput}- inputSchema={- logicFunction?.workflowActionTriggerSettings?.inputSchema- }- readonly={actionOptions.readonly}- onInputChange={handleInputChange}- VariablePicker={WorkflowVariablePicker}- fullWidth- />- ) : (- <Callout- variant={'neutral'}- title={t`No input fields for this action`}- description={t`You can see the function logic in your application settings.`}- />- )}- <WorkflowExpectedOutputBodyInput- defaultValue={action.settings.expectedOutputSchema}- onChange={handleExpectedOutputBodyChange}- readonly={actionOptions.readonly}- />- </StyledContainer>- )}- </WorkflowStepBody>+ {isThirdPartyApp ? (+ stepBody+ ) : (+ <WorkflowStepTabPanel value={activeTabId ?? ''}>+ {stepBody}+ </WorkflowStepTabPanel>+ )}{!actionOptions.readonly && (<WorkflowStepFooterstepId={action.id}@@ -301,6 +317,6 @@ export const WorkflowEditActionLogicFunction = ({}/>)}- </>+ </TabListRoot>);};diff --git a/packages/twenty-front/src/pages/settings/accounts/SettingsAccountsCalendars.tsx b/packages/twenty-front/src/pages/settings/accounts/SettingsAccountsCalendars.tsxindex 76d4d75974a..5630f8db26c 100644--- a/packages/twenty-front/src/pages/settings/accounts/SettingsAccountsCalendars.tsx+++ b/packages/twenty-front/src/pages/settings/accounts/SettingsAccountsCalendars.tsx@@ -66,6 +66,7 @@ export const SettingsAccountsCalendars = () => {secondaryBar={tabs.length > 1 ? (<SettingsTabBar+ aria-label={t`Calendar accounts`}tabs={tabs}componentInstanceId={SETTINGS_ACCOUNT_CALENDAR_CHANNELS_TAB_LIST_COMPONENT_IDdiff --git a/packages/twenty-front/src/pages/settings/accounts/SettingsAccountsEmails.tsx b/packages/twenty-front/src/pages/settings/accounts/SettingsAccountsEmails.tsxindex ae501ccaf0a..f25a6f4a353 100644--- a/packages/twenty-front/src/pages/settings/accounts/SettingsAccountsEmails.tsx+++ b/packages/twenty-front/src/pages/settings/accounts/SettingsAccountsEmails.tsx@@ -75,6 +75,7 @@ export const SettingsAccountsEmails = () => {secondaryBar={tabs.length > 1 ? (<SettingsTabBar+ aria-label={t`Email accounts`}tabs={tabs}componentInstanceId={SETTINGS_ACCOUNT_MESSAGE_CHANNELS_TAB_LIST_COMPONENT_IDdiff --git a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdmin.tsx b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdmin.tsxindex 50f302ece22..8ad362c68a5 100644--- a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdmin.tsx+++ b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdmin.tsx@@ -28,6 +28,7 @@ export const SettingsAdmin = () => {title={t`Admin Panel`}secondaryBar={<SettingsTabBar+ aria-label={t`Administration`}tabs={tabs}componentInstanceId={SETTINGS_ADMIN_TABS_ID}/>diff --git a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminApplicationRegistrationDetail.tsx b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminApplicationRegistrationDetail.tsxindex 7e60f1ebd80..487f6c3a245 100644--- a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminApplicationRegistrationDetail.tsx+++ b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminApplicationRegistrationDetail.tsx@@ -121,6 +121,7 @@ export const SettingsAdminApplicationRegistrationDetail = () => {]}secondaryBar={<SettingsTabBar+ aria-label={t`Application registration`}tabs={tabs}componentInstanceId={REGISTRATION_DETAIL_TAB_LIST_ID}/>diff --git a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminUserDetail.tsx b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminUserDetail.tsxindex a33f6624acb..3c1deea35b4 100644--- a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminUserDetail.tsx+++ b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminUserDetail.tsx@@ -1,3 +1,5 @@+import { TabListRoot } from '@/ui/layout/tab-list/components/TabListRoot';+import { Tabs } from 'twenty-ui/primitives/navigation';import { useParams } from 'react-router-dom';import { useQuery } from '@apollo/client/react';@@ -9,6 +11,7 @@ import {getImageAbsoluteURI,getSettingsPath,isDefined,+ isNonEmptyArray,} from 'twenty-shared/utils';import { currentUserState } from '@/auth/states/currentUserState';@@ -134,92 +137,103 @@ export const SettingsAdminUserDetail = () => {: []),];+ const workspaceContent = (+ <Section.Root>+ <Section.Header+ title={t`Workspaces`}+ description={t`All workspaces this user is a member of`}+ />+ <SettingsAdminWorkspaceContent activeWorkspace={activeWorkspace} />+ {currentUser?.canImpersonate &&+ activeWorkspace &&+ isDefined(user) &&+ user.id !== currentUser.id && (+ <StyledButtonContainer>+ <Button+ startIcon={<IconEyeShare />}+ onClick={() => handleImpersonate(user.id, activeWorkspace.id)}+ disabled={+ impersonatingUserId !== null ||+ activeWorkspace.allowImpersonation === false+ }+ variant="outline"+ >+ {activeWorkspace.allowImpersonation === false+ ? t`Impersonation is disabled for this workspace`+ : t`Impersonate`}+ </Button>+ </StyledButtonContainer>+ )}+ </Section.Root>+ );+if (isLoading) {return <SettingsSkeletonLoader />;}return (- <SettingsPageLayout- title={displayName}- icon={- <Avatar- name={displayName}- colorSeed={user?.id}- size="md"- shape="circle"- />- }- links={[- {- children: t`Other`,- href: getSettingsPath(SettingsPath.AdminPanel),- },- {- children: t`Admin Panel - General`,- href: getSettingsPath(SettingsPath.AdminPanel),- },- {- children: displayName,- },- ]}- secondaryBar={- tabs.length > 0 ? (- <SettingsTabBar- tabs={tabs}- behaveAsLinks={false}- componentInstanceId={SETTINGS_ADMIN_USER_LOOKUP_WORKSPACE_TABS_ID}- />- ) : undefined- }+ <TabListRoot+ componentInstanceId={SETTINGS_ADMIN_USER_LOOKUP_WORKSPACE_TABS_ID}>- <SettingsPageContainer>- {userLookupResult && (- <>- <Section.Root>- <Section.Header- title={t`User Info`}- description={t`About this user`}- />- <SettingsTableCard- items={userInfoItems}- rounded- gridAutoColumns="1fr 4fr"- />- </Section.Root>- <Section.Root>- <Section.Header- title={t`Workspaces`}- description={t`All workspaces this user is a member of`}- />- <SettingsAdminWorkspaceContent- activeWorkspace={activeWorkspace}- />- {currentUser?.canImpersonate &&- activeWorkspace &&- isDefined(user) &&- user.id !== currentUser.id && (- <StyledButtonContainer>- <Button- startIcon={<IconEyeShare />}- onClick={() =>- handleImpersonate(user.id, activeWorkspace.id)- }- disabled={- impersonatingUserId !== null ||- activeWorkspace.allowImpersonation === false- }- variant="outline"- >- {activeWorkspace.allowImpersonation === false- ? t`Impersonation is disabled for this workspace`- : t`Impersonate`}- </Button>- </StyledButtonContainer>- )}- </Section.Root>- </>- )}- </SettingsPageContainer>- </SettingsPageLayout>+ <SettingsPageLayout+ title={displayName}+ icon={+ <Avatar+ name={displayName}+ colorSeed={user?.id}+ size="md"+ shape="circle"+ />+ }+ links={[+ {+ children: t`Other`,+ href: getSettingsPath(SettingsPath.AdminPanel),+ },+ {+ children: t`Admin Panel - General`,+ href: getSettingsPath(SettingsPath.AdminPanel),+ },+ {+ children: displayName,+ },+ ]}+ secondaryBar={+ tabs.length > 0 ? (+ <SettingsTabBar+ aria-label={t`User workspaces`}+ tabs={tabs}+ behaveAsLinks={false}+ componentInstanceId={SETTINGS_ADMIN_USER_LOOKUP_WORKSPACE_TABS_ID}+ />+ ) : undefined+ }+ >+ <SettingsPageContainer>+ {userLookupResult && (+ <>+ <Section.Root>+ <Section.Header+ title={t`User Info`}+ description={t`About this user`}+ />+ <SettingsTableCard+ items={userInfoItems}+ rounded+ gridAutoColumns="1fr 4fr"+ />+ </Section.Root>+ {isNonEmptyArray(tabs) ? (+ <Tabs.Panel value={effectiveTabId ?? ''}>+ {workspaceContent}+ </Tabs.Panel>+ ) : (+ workspaceContent+ )}+ </>+ )}+ </SettingsPageContainer>+ </SettingsPageLayout>+ </TabListRoot>);};diff --git a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsx b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsxindex bf7960452c8..6fbf528f0ae 100644--- a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsx+++ b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsx@@ -1,3 +1,5 @@+import { TabListRoot } from '@/ui/layout/tab-list/components/TabListRoot';+import { Tabs } from 'twenty-ui/primitives/navigation';import { currentUserState } from '@/auth/states/currentUserState';import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';import { billingState } from '@/client-config/states/billingState';@@ -82,6 +84,11 @@ const WORKSPACE_DETAIL_TAB_IDS = {CHATS: 'chats',};+const StyledTabPanel = styled.div`+ height: 100%;+ min-height: 0;+`;+export const SettingsAdminWorkspaceDetail = () => {const { workspaceId } = useParams<{ workspaceId: string }>();const apolloAdminClient = useApolloAdminClient();@@ -300,190 +307,203 @@ export const SettingsAdminWorkspaceDetail = () => {}return (- <SettingsPageLayout- title={workspaceName}- icon={- <Avatar- src={getAbsoluteImageUrl(workspaceLogo)}- name={workspaceName}- colorSeed={workspace?.id}- size="md"- />- }- links={[- {- children: t`Other`,- href: getSettingsPath(SettingsPath.AdminPanel),- },- {- children: t`Admin Panel - AI`,- href: AI_ADMIN_PATH,- },- {- children: workspaceName,- },- ]}- secondaryBar={- <SettingsTabBar- tabs={tabs}- behaveAsLinks={false}- componentInstanceId={WORKSPACE_DETAIL_TABS_ID}- />- }- >- <SettingsPageContainer>- {effectiveTabId === WORKSPACE_DETAIL_TAB_IDS.INFO && workspace && (- <SettingsAdminWorkspaceContent- activeWorkspace={workspace}- workspaceUpgradeStatus={workspaceUpgradeStatusData?.getUpgradeStatus?.find(- (status) => status?.workspaceId === workspaceId,- )}+ <TabListRoot componentInstanceId={WORKSPACE_DETAIL_TABS_ID}>+ <SettingsPageLayout+ title={workspaceName}+ icon={+ <Avatar+ src={getAbsoluteImageUrl(workspaceLogo)}+ name={workspaceName}+ colorSeed={workspace?.id}+ size="md"+ />+ }+ links={[+ {+ children: t`Other`,+ href: getSettingsPath(SettingsPath.AdminPanel),+ },+ {+ children: t`Admin Panel - AI`,+ href: AI_ADMIN_PATH,+ },+ {+ children: workspaceName,+ },+ ]}+ secondaryBar={+ <SettingsTabBar+ aria-label={t`Workspace details`}+ tabs={tabs}+ behaveAsLinks={false}+ componentInstanceId={WORKSPACE_DETAIL_TABS_ID}/>- )}+ }+ >+ <Tabs.Panel value={effectiveTabId} render={<StyledTabPanel />}>+ <SettingsPageContainer>+ {effectiveTabId === WORKSPACE_DETAIL_TAB_IDS.INFO && workspace && (+ <SettingsAdminWorkspaceContent+ activeWorkspace={workspace}+ workspaceUpgradeStatus={workspaceUpgradeStatusData?.getUpgradeStatus?.find(+ (status) => status?.workspaceId === workspaceId,+ )}+ />+ )}- {effectiveTabId === WORKSPACE_DETAIL_TAB_IDS.BILLING &&- isBillingEnabled &&- workspaceId && (- <SettingsAdminWorkspaceBillingContent workspaceId={workspaceId} />- )}+ {effectiveTabId === WORKSPACE_DETAIL_TAB_IDS.BILLING &&+ isBillingEnabled &&+ workspaceId && (+ <SettingsAdminWorkspaceBillingContent+ workspaceId={workspaceId}+ />+ )}- {effectiveTabId === WORKSPACE_DETAIL_TAB_IDS.MEMBERS && workspace && (- <Section.Root>- <Section.Header- title={t`Members`}- description={t`Workspace members`}- />- <Table>- <TableBody>- <TableRow gridTemplateColumns="1fr 2fr 100px">- <TableHeader>{t`Name`}</TableHeader>- <TableHeader>{t`Email`}</TableHeader>- <TableHeader align="right">{t`Actions`}</TableHeader>- </TableRow>- {workspace.users?.map((user) => {- const userId = user.id;+ {effectiveTabId === WORKSPACE_DETAIL_TAB_IDS.MEMBERS &&+ workspace && (+ <Section.Root>+ <Section.Header+ title={t`Members`}+ description={t`Workspace members`}+ />+ <Table>+ <TableBody>+ <TableRow gridTemplateColumns="1fr 2fr 100px">+ <TableHeader>{t`Name`}</TableHeader>+ <TableHeader>{t`Email`}</TableHeader>+ <TableHeader align="right">{t`Actions`}</TableHeader>+ </TableRow>+ {workspace.users?.map((user) => {+ const userId = user.id;- if (!isDefined(userId)) return null;+ if (!isDefined(userId)) return null;- return (- <TableRow- key={userId}- gridTemplateColumns="1fr 2fr 100px"- to={getSettingsPath(SettingsPath.AdminPanelUserDetail, {- userId,+ return (+ <TableRow+ key={userId}+ gridTemplateColumns="1fr 2fr 100px"+ to={getSettingsPath(+ SettingsPath.AdminPanelUserDetail,+ {+ userId,+ },+ )}+ >+ <TableCell+ color={themeCssVariables.font.color.primary}+ gap={themeCssVariables.spacing[2]}+ overflow="hidden"+ >+ <Avatar+ src={getAbsoluteImageUrl(user.avatarUrl)}+ name={+ `${user.firstName || ''} ${user.lastName || ''}`.trim() ||+ user.email+ }+ colorSeed={user.id}+ size="md"+ shape="circle"+ />+ <OverflowingTextWithTooltip+ text={+ `${user.firstName || ''} ${user.lastName || ''}`.trim() ||+ '\u2014'+ }+ />+ </TableCell>+ <TableCell>{user.email}</TableCell>+ <TableCell align="right">+ {workspace.allowImpersonation &&+ isDefined(currentUser?.id) &&+ userId !== currentUser.id && (+ <Button+ startIcon={<IconEyeShare />}+ size="sm"+ onClick={(e) => {+ e.preventDefault();+ e.stopPropagation();+ handleImpersonate(userId, workspaceId!);+ }}+ disabled={impersonatingUserId === userId}+ variant="outline"+ >{t`Impersonate`}</Button>+ )}+ </TableCell>+ </TableRow>+ );})}- >+ </TableBody>+ </Table>+ </Section.Root>+ )}++ {effectiveTabId === WORKSPACE_DETAIL_TAB_IDS.FEATURE_FLAGS &&+ workspace && (+ <SettingsTableListSection+ title={t`Feature Flags`}+ description={t`Manage feature flags for this workspace`}+ gridAutoColumns="minmax(0, 240px) minmax(0, 1fr) 56px"+ items={featureFlagItems}+ columns={featureFlagColumns}+ />+ )}++ {effectiveTabId === WORKSPACE_DETAIL_TAB_IDS.CHATS && (+ <Section.Root>+ <Section.Header+ title={t`Chat Sessions`}+ description={t`AI chat threads for this workspace`}+ />+ {isLoadingThreads ? (+ <SettingsSectionSkeletonLoader />+ ) : threads.length === 0 ? (+ <Card rounded>+ <TableRow gridTemplateColumns="1fr"><TableCell- color={themeCssVariables.font.color.primary}- gap={themeCssVariables.spacing[2]}- overflow="hidden"+ color={themeCssVariables.font.color.tertiary}+ align="center">- <Avatar- src={getAbsoluteImageUrl(user.avatarUrl)}- name={- `${user.firstName || ''} ${user.lastName || ''}`.trim() ||- user.email- }- colorSeed={user.id}- size="md"- shape="circle"- />- <OverflowingTextWithTooltip- text={- `${user.firstName || ''} ${user.lastName || ''}`.trim() ||- '\u2014'- }- />- </TableCell>- <TableCell>{user.email}</TableCell>- <TableCell align="right">- {workspace.allowImpersonation &&- isDefined(currentUser?.id) &&- userId !== currentUser.id && (- <Button- startIcon={<IconEyeShare />}- size="sm"- onClick={(e) => {- e.preventDefault();- e.stopPropagation();- handleImpersonate(userId, workspaceId!);- }}- disabled={impersonatingUserId === userId}- variant="outline"- >{t`Impersonate`}</Button>- )}+ {t`No chat threads found.`}</TableCell></TableRow>- );- })}- </TableBody>- </Table>- </Section.Root>- )}-- {effectiveTabId === WORKSPACE_DETAIL_TAB_IDS.FEATURE_FLAGS &&- workspace && (- <SettingsTableListSection- title={t`Feature Flags`}- description={t`Manage feature flags for this workspace`}- gridAutoColumns="minmax(0, 240px) minmax(0, 1fr) 56px"- items={featureFlagItems}- columns={featureFlagColumns}- />- )}-- {effectiveTabId === WORKSPACE_DETAIL_TAB_IDS.CHATS && (- <Section.Root>- <Section.Header- title={t`Chat Sessions`}- description={t`AI chat threads for this workspace`}- />- {isLoadingThreads ? (- <SettingsSectionSkeletonLoader />- ) : threads.length === 0 ? (- <Card rounded>- <TableRow gridTemplateColumns="1fr">- <TableCell- color={themeCssVariables.font.color.tertiary}- align="center"- >- {t`No chat threads found.`}- </TableCell>- </TableRow>- </Card>- ) : (- <Table>- <TableRow gridTemplateColumns="1fr 120px 120px">- <TableHeader>{t`Title`}</TableHeader>- <TableHeader align="right">{t`Messages`}</TableHeader>- <TableHeader align="right">{t`Updated`}</TableHeader>- </TableRow>- {threads.map((thread) => (- <TableRow- key={thread.id}- gridTemplateColumns="1fr 120px 120px"- to={getSettingsPath(- SettingsPath.AdminPanelWorkspaceChatThread,- {- workspaceId: workspaceId ?? '',- threadId: thread.id,- },- )}- >- <TableCell color={themeCssVariables.font.color.primary}>- {thread.title || t`Untitled`}- </TableCell>- <TableCell align="right">{thread.messageCount}</TableCell>- <TableCell align="right">- {new Date(thread.updatedAt).toLocaleDateString()}- </TableCell>- </TableRow>- ))}- </Table>+ </Card>+ ) : (+ <Table>+ <TableRow gridTemplateColumns="1fr 120px 120px">+ <TableHeader>{t`Title`}</TableHeader>+ <TableHeader align="right">{t`Messages`}</TableHeader>+ <TableHeader align="right">{t`Updated`}</TableHeader>+ </TableRow>+ {threads.map((thread) => (+ <TableRow+ key={thread.id}+ gridTemplateColumns="1fr 120px 120px"+ to={getSettingsPath(+ SettingsPath.AdminPanelWorkspaceChatThread,+ {+ workspaceId: workspaceId ?? '',+ threadId: thread.id,+ },+ )}+ >+ <TableCell color={themeCssVariables.font.color.primary}>+ {thread.title || t`Untitled`}+ </TableCell>+ <TableCell align="right">+ {thread.messageCount}+ </TableCell>+ <TableCell align="right">+ {new Date(thread.updatedAt).toLocaleDateString()}+ </TableCell>+ </TableRow>+ ))}+ </Table>+ )}+ </Section.Root>)}- </Section.Root>- )}- </SettingsPageContainer>- </SettingsPageLayout>+ </SettingsPageContainer>+ </Tabs.Panel>+ </SettingsPageLayout>+ </TabListRoot>);};diff --git a/packages/twenty-front/src/pages/settings/ai/SettingsAI.tsx b/packages/twenty-front/src/pages/settings/ai/SettingsAI.tsxindex f44a83b56ae..04998aebcc4 100644--- a/packages/twenty-front/src/pages/settings/ai/SettingsAI.tsx+++ b/packages/twenty-front/src/pages/settings/ai/SettingsAI.tsx@@ -81,6 +81,7 @@ export const SettingsAI = () => {title={t`AI`}secondaryBar={<SettingsTabBar+ aria-label={t`AI settings`}tabs={tabs}componentInstanceId={SETTINGS_AI_TABS.COMPONENT_INSTANCE_ID}/>diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentFormContent.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentFormContent.tsxindex b21e3b8311a..8d571183c7b 100644--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentFormContent.tsx+++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentFormContent.tsx@@ -188,6 +188,7 @@ export const SettingsAgentFormContent = ({links={getSettingsAiBreadcrumbLinks(title)}secondaryBar={<SettingsTabBar+ aria-label={t`Agent settings`}tabs={tabs}componentInstanceId={tabListComponentId}/>diff --git a/packages/twenty-front/src/pages/settings/api-webhooks/SettingsApiWebhooks.tsx b/packages/twenty-front/src/pages/settings/api-webhooks/SettingsApiWebhooks.tsxindex 32e011e3de6..fa57399a00f 100644--- a/packages/twenty-front/src/pages/settings/api-webhooks/SettingsApiWebhooks.tsx+++ b/packages/twenty-front/src/pages/settings/api-webhooks/SettingsApiWebhooks.tsx@@ -92,6 +92,7 @@ export const SettingsApiWebhooks = () => {title={t`MCP & APIs`}secondaryBar={<SettingsTabBar+ aria-label={t`APIs and webhooks`}tabs={tabs}componentInstanceId={SETTINGS_API_WEBHOOKS_TABS.COMPONENT_INSTANCE_ID}/>diff --git a/packages/twenty-front/src/pages/settings/applications/SettingsApplicationDetails.tsx b/packages/twenty-front/src/pages/settings/applications/SettingsApplicationDetails.tsxindex 59653c43bee..773041b949b 100644--- a/packages/twenty-front/src/pages/settings/applications/SettingsApplicationDetails.tsx+++ b/packages/twenty-front/src/pages/settings/applications/SettingsApplicationDetails.tsx@@ -267,6 +267,7 @@ export const SettingsApplicationDetails = () => {}secondaryBar={<SettingsTabBar+ aria-label={t`Application details`}tabs={tabs}componentInstanceId={APPLICATION_DETAIL_ID}/>diff --git a/packages/twenty-front/src/pages/settings/applications/SettingsApplicationFrontComponentDetail.tsx b/packages/twenty-front/src/pages/settings/applications/SettingsApplicationFrontComponentDetail.tsxindex 436264ec719..41554846523 100644--- a/packages/twenty-front/src/pages/settings/applications/SettingsApplicationFrontComponentDetail.tsx+++ b/packages/twenty-front/src/pages/settings/applications/SettingsApplicationFrontComponentDetail.tsx@@ -101,7 +101,11 @@ export const SettingsApplicationFrontComponentDetail = () => {title={frontComponent?.name ?? t`Front component`}links={breadcrumbLinks}secondaryBar={- <SettingsTabBar tabs={tabs} componentInstanceId={instanceId} />+ <SettingsTabBar+ aria-label={t`Front component details`}+ tabs={tabs}+ componentInstanceId={instanceId}+ />}><SettingsPageContainer>diff --git a/packages/twenty-front/src/pages/settings/applications/SettingsApplicationRegistrationDetails.tsx b/packages/twenty-front/src/pages/settings/applications/SettingsApplicationRegistrationDetails.tsxindex 0588dff625e..b63bd776f35 100644--- a/packages/twenty-front/src/pages/settings/applications/SettingsApplicationRegistrationDetails.tsx+++ b/packages/twenty-front/src/pages/settings/applications/SettingsApplicationRegistrationDetails.tsx@@ -126,6 +126,7 @@ export const SettingsApplicationRegistrationDetails = () => {]}secondaryBar={<SettingsTabBar+ aria-label={t`Application registration`}tabs={tabs}componentInstanceId={REGISTRATION_DETAIL_TAB_LIST_ID}/>diff --git a/packages/twenty-front/src/pages/settings/applications/SettingsApplications.tsx b/packages/twenty-front/src/pages/settings/applications/SettingsApplications.tsxindex 2b9553f2dfb..957ee053e5f 100644--- a/packages/twenty-front/src/pages/settings/applications/SettingsApplications.tsx+++ b/packages/twenty-front/src/pages/settings/applications/SettingsApplications.tsx@@ -64,6 +64,7 @@ export const SettingsApplications = () => {title={t`Applications`}secondaryBar={<SettingsTabBar+ aria-label={t`Applications`}tabs={tabs}componentInstanceId={APPLICATIONS_TAB_LIST_ID}/>diff --git a/packages/twenty-front/src/pages/settings/applications/SettingsAvailableApplicationDetails.tsx b/packages/twenty-front/src/pages/settings/applications/SettingsAvailableApplicationDetails.tsxindex a367ee89b45..be7d80e900a 100644--- a/packages/twenty-front/src/pages/settings/applications/SettingsAvailableApplicationDetails.tsx+++ b/packages/twenty-front/src/pages/settings/applications/SettingsAvailableApplicationDetails.tsx@@ -226,6 +226,7 @@ export const SettingsAvailableApplicationDetails = () => {}secondaryBar={<SettingsTabBar+ aria-label={t`Available application details`}tabs={tabs}componentInstanceId={AVAILABLE_APPLICATION_DETAIL_ID}/>diff --git a/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceCommunications.tsx b/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceCommunications.tsxindex 4fd59225669..a50e1766d72 100644--- a/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceCommunications.tsx+++ b/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceCommunications.tsx@@ -67,6 +67,7 @@ export const SettingsWorkspaceCommunications = () => {title={t`Communication`}secondaryBar={<SettingsTabBar+ aria-label={t`Workspace communications`}tabs={tabs}componentInstanceId={COMMUNICATIONS_TABS_INSTANCE_ID}/>diff --git a/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceUnsubscribe.tsx b/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceUnsubscribe.tsxindex 64d793d8e98..68c4c82cc8c 100644--- a/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceUnsubscribe.tsx+++ b/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceUnsubscribe.tsx@@ -65,6 +65,7 @@ export const SettingsWorkspaceUnsubscribe = () => {]}secondaryBar={<SettingsTabBar+ aria-label={t`Unsubscribe settings`}tabs={tabs}componentInstanceId={UNSUBSCRIBE_TABS_INSTANCE_ID}/>diff --git a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectDetailPage.tsx b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectDetailPage.tsxindex 8de0bad2988..66a29b99c22 100644--- a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectDetailPage.tsx+++ b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectDetailPage.tsx@@ -188,6 +188,7 @@ export const SettingsObjectDetailPage = () => {}secondaryBar={<SettingsTabBar+ aria-label={t`Object settings`}tabs={tabs}componentInstanceId={tabsComponentInstanceId}/>diff --git a/packages/twenty-front/src/pages/settings/general/SettingsGeneral.tsx b/packages/twenty-front/src/pages/settings/general/SettingsGeneral.tsxindex 1b1e6f824bb..b524752fa58 100644--- a/packages/twenty-front/src/pages/settings/general/SettingsGeneral.tsx+++ b/packages/twenty-front/src/pages/settings/general/SettingsGeneral.tsx@@ -93,6 +93,7 @@ export const SettingsGeneral = () => {secondaryBar={hasSecurityPermission ? (<SettingsTabBar+ aria-label={t`General settings`}tabs={tabs}componentInstanceId={SETTINGS_GENERAL_TABS_INSTANCE_ID}/>diff --git a/packages/twenty-front/src/pages/settings/logic-functions/SettingsLogicFunctionDetail.tsx b/packages/twenty-front/src/pages/settings/logic-functions/SettingsLogicFunctionDetail.tsxindex 2571573af37..c04f8663497 100644--- a/packages/twenty-front/src/pages/settings/logic-functions/SettingsLogicFunctionDetail.tsx+++ b/packages/twenty-front/src/pages/settings/logic-functions/SettingsLogicFunctionDetail.tsx@@ -154,7 +154,11 @@ export const SettingsLogicFunctionDetail = () => {}links={breadcrumbLinks}secondaryBar={- <SettingsTabBar tabs={tabs} componentInstanceId={instanceId} />+ <SettingsTabBar+ aria-label={t`Function details`}+ tabs={tabs}+ componentInstanceId={instanceId}+ />}><SettingsPageContainer>diff --git a/packages/twenty-front/src/pages/settings/members/SettingsWorkspaceMember.tsx b/packages/twenty-front/src/pages/settings/members/SettingsWorkspaceMember.tsxindex 1394dc6d801..597b5fec4c0 100644--- a/packages/twenty-front/src/pages/settings/members/SettingsWorkspaceMember.tsx+++ b/packages/twenty-front/src/pages/settings/members/SettingsWorkspaceMember.tsx@@ -204,6 +204,7 @@ export const SettingsWorkspaceMember = () => {]}secondaryBar={<SettingsTabBar+ aria-label={t`Member details`}tabs={[{id: SETTINGS_WORKSPACE_MEMBER_TABS.TABS_IDS.INFOS,diff --git a/packages/twenty-front/src/pages/settings/members/SettingsWorkspaceMembers.tsx b/packages/twenty-front/src/pages/settings/members/SettingsWorkspaceMembers.tsxindex a3ef5f327d2..8ef68bb9b55 100644--- a/packages/twenty-front/src/pages/settings/members/SettingsWorkspaceMembers.tsx+++ b/packages/twenty-front/src/pages/settings/members/SettingsWorkspaceMembers.tsx@@ -67,7 +67,11 @@ export const SettingsWorkspaceMembers = () => {<SettingsPageLayouttitle={t`Members`}secondaryBar={- <SettingsTabBar tabs={tabs} componentInstanceId={MEMBERS_TAB_LIST_ID} />+ <SettingsTabBar+ aria-label={t`Workspace members`}+ tabs={tabs}+ componentInstanceId={MEMBERS_TAB_LIST_ID}+ />}links={[{diff --git a/packages/twenty-shared/src/constants/DocumentationPaths.ts b/packages/twenty-shared/src/constants/DocumentationPaths.tsindex 527c20108e3..c0eb2632aec 100644--- a/packages/twenty-shared/src/constants/DocumentationPaths.ts+++ b/packages/twenty-shared/src/constants/DocumentationPaths.ts@@ -134,6 +134,7 @@ export const DOCUMENTATION_PATHS = {UI_COMPONENTS_INPUT_MAIN_BUTTON: '/ui/components/input/main-button',UI_COMPONENTS_OVERVIEW: '/ui/components/overview',UI_COMPONENTS_SECTION: '/ui/components/section',+ UI_COMPONENTS_TAB_BUTTON: '/ui/components/tab-button',UI_DARK_MODE: '/ui/dark-mode',UI_GETTING_STARTED: '/ui/getting-started',UI_PRIMITIVES_DATA_DISPLAY_AVATAR: '/ui/primitives/data-display/avatar',diff --git a/packages/twenty-ui/docs/components.ts b/packages/twenty-ui/docs/components.tsindex 822b57a4824..148271ed65f 100644--- a/packages/twenty-ui/docs/components.ts+++ b/packages/twenty-ui/docs/components.ts@@ -123,6 +123,12 @@ export const DOCUMENTED_COMPONENTS = [source: 'primitives/navigation/Tabs/Tabs.tsx',entryPoint: 'twenty-ui/primitives/navigation',slug: 'navigation/tabs',+ partPropDescriptions: {+ Tab: {+ endIcon: 'Decorative content after the label and before the badge.',+ highlighted: 'Emphasizes the tab content without changing selection.',+ },+ },},{name: 'Dialog',@@ -231,4 +237,17 @@ export const DOCUMENTED_COMPONENTS = [slug: 'components/code-editor-header',propDescriptions: CODE_EDITOR_HEADER_PROP_DESCRIPTIONS,},+ {+ name: 'TabButton',+ source: 'components/TabButton/TabButton.tsx',+ entryPoint: 'twenty-ui/components',+ slug: 'components/tab-button',+ propDescriptions: {+ ...BUTTON_PROP_DESCRIPTIONS,+ active:+ 'Highlights the current destination or an action associated with the active tab. Does not change the control role.',+ badge: 'Content following the label and trailing icon, such as a count.',+ size: 'Padding of the tab content: sm or md.',+ },+ },] as const;diff --git a/packages/twenty-ui/generated/components.docs.json b/packages/twenty-ui/generated/components.docs.jsonindex 31c51f10c67..7af96514a2f 100644--- a/packages/twenty-ui/generated/components.docs.json+++ b/packages/twenty-ui/generated/components.docs.json@@ -2450,6 +2450,20 @@"defaultValue": null,"description": "Whether the Tab is disabled.\n\nIf a first Tab on a `<Tabs.List>` is disabled, it won't initially be selected.\nInstead, the next enabled Tab will be selected.\nHowever, it does not work like this during server-side rendering, as it is not known\nduring pre-rendering which Tabs are disabled.\nTo work around it, ensure that `defaultValue` or `value` on `<Tabs.Root>` is set to an enabled Tab's value."},+ {+ "name": "endIcon",+ "type": "ReactNode",+ "required": false,+ "defaultValue": null,+ "description": "Decorative content after the label and before the badge."+ },+ {+ "name": "highlighted",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Emphasizes the tab content without changing selection."+ },{"name": "nativeButton","type": "boolean",@@ -5872,5 +5886,75 @@"description": "Text shown at the start of the header, after `leftNodes`."}]+ },+ {+ "name": "TabButton",+ "entryPoint": "twenty-ui/components",+ "slug": "components/tab-button",+ "props": [+ {+ "name": "active",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Highlights the current destination or an action associated with the active tab. Does not change the control role."+ },+ {+ "name": "badge",+ "type": "ReactNode",+ "required": false,+ "defaultValue": null,+ "description": "Content following the label and trailing icon, such as a count."+ },+ {+ "name": "className",+ "type": "string | ((state: ButtonState) => 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": "endIcon",+ "type": "ReactNode",+ "required": false,+ "defaultValue": null,+ "description": "Decorative content displayed after the label."+ },+ {+ "name": "focusableWhenDisabled",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Whether the button should be focusable when disabled."+ },+ {+ "name": "render",+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, ButtonState>",+ "required": false,+ "defaultValue": null,+ "description": "Caller-supplied root element or renderer. Preserve a native button, or an anchor when `href` is set. Router integration belongs to the caller."+ },+ {+ "name": "size",+ "type": "\"sm\" | \"md\"",+ "required": false,+ "defaultValue": "sm",+ "description": "Padding of the tab content: sm or md."+ },+ {+ "name": "startIcon",+ "type": "ReactNode",+ "required": false,+ "defaultValue": null,+ "description": "Decorative content displayed before the label."+ },+ {+ "name": "style",+ "type": "CSSProperties | ((state: ButtonState) => 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/components/TabButton/TabButton.module.scss b/packages/twenty-ui/src/components/TabButton/TabButton.module.scssnew file mode 100644index 00000000000..12cbad5af00--- /dev/null+++ b/packages/twenty-ui/src/components/TabButton/TabButton.module.scss@@ -0,0 +1,29 @@+.button.button {+ background: transparent;+ block-size: auto;+ border: 0;+ border-radius: 0;+ color: var(--tw-tabs-color);+ opacity: 1;+ padding: 0;++ &:hover,+ &:active {+ background: transparent;+ }++ &::after {+ background: transparent;+ block-size: 1px;+ content: '';+ inset-block-end: 0;+ inset-inline: 0;+ pointer-events: none;+ position: absolute;+ z-index: 1;+ }++ &[data-active]::after {+ background: var(--t-border-color-inverted);+ }+}diff --git a/packages/twenty-ui/src/components/TabButton/TabButton.module.scss.d.ts b/packages/twenty-ui/src/components/TabButton/TabButton.module.scss.d.tsnew file mode 100644index 00000000000..37b2ec6b50f--- /dev/null+++ b/packages/twenty-ui/src/components/TabButton/TabButton.module.scss.d.ts@@ -0,0 +1,4 @@+declare const styles: {+ readonly button: string;+};+export default styles;diff --git a/packages/twenty-ui/src/components/TabButton/TabButton.tsx b/packages/twenty-ui/src/components/TabButton/TabButton.tsxnew file mode 100644index 00000000000..1248325b6db--- /dev/null+++ b/packages/twenty-ui/src/components/TabButton/TabButton.tsx@@ -0,0 +1,32 @@+import { clsx } from 'clsx';++import { Button } from '@ui/primitives/input/Button/Button';+import { TabsTabContent } from '@ui/primitives/navigation/Tabs/internal/TabsTabContent';+import { mergeClassNames } from '@ui/utilities/internal/mergeClassNames';++import tabStyles from '@ui/primitives/navigation/Tabs/Tabs.module.scss';+import styles from './TabButton.module.scss';+import { type TabButtonProps } from './types/TabButtonProps';++export const TabButton = ({+ active = false,+ className,+ children,+ startIcon,+ endIcon,+ badge,+ size = 'sm',+ ...props+}: TabButtonProps) => (+ <Button+ {...props}+ variant="ghost"+ size={size}+ data-active={active || undefined}+ className={mergeClassNames(clsx(tabStyles.tab, styles.button), className)}+ >+ <TabsTabContent startIcon={startIcon} endIcon={endIcon} badge={badge}>+ {children}+ </TabsTabContent>+ </Button>+);diff --git a/packages/twenty-ui/src/primitives/input/TabButton/__stories__/TabButton.stories.module.scss b/packages/twenty-ui/src/components/TabButton/__stories__/TabButton.stories.module.scsssimilarity index 100%rename from packages/twenty-ui/src/primitives/input/TabButton/__stories__/TabButton.stories.module.scssrename to packages/twenty-ui/src/components/TabButton/__stories__/TabButton.stories.module.scssdiff --git a/packages/twenty-ui/src/primitives/input/TabButton/__stories__/TabButton.stories.module.scss.d.ts b/packages/twenty-ui/src/components/TabButton/__stories__/TabButton.stories.module.scss.d.tssimilarity index 100%rename from packages/twenty-ui/src/primitives/input/TabButton/__stories__/TabButton.stories.module.scss.d.tsrename to packages/twenty-ui/src/components/TabButton/__stories__/TabButton.stories.module.scss.d.tsdiff --git a/packages/twenty-ui/src/components/TabButton/__stories__/TabButton.stories.tsx b/packages/twenty-ui/src/components/TabButton/__stories__/TabButton.stories.tsxnew file mode 100644index 00000000000..f886f7da0a7--- /dev/null+++ b/packages/twenty-ui/src/components/TabButton/__stories__/TabButton.stories.tsx@@ -0,0 +1,319 @@+import { type Meta, type StoryObj } from '@storybook/react-vite';+import {+ IconCheckbox,+ IconChevronDown,+ IconMail,+ IconSearch,+ IconSettings,+ IconUser,+} from '@ui/icon';+import { TabButton } from '@ui/components/TabButton/TabButton';+import {+ A11Y_DEFER_COLOR_CONTRAST,+ AVATAR_URL_MOCK,+ CatalogDecorator,+ type CatalogStory,+ ComponentDecorator,+} from '@ui/testing';+import { type ReactNode } from 'react';+import { Avatar } from '@ui/primitives/data-display/Avatar/Avatar';+import { Tabs } from '@ui/primitives/navigation/Tabs/Tabs';+import { Pill } from '@ui/primitives/data-display/Pill/Pill';+import { expect, fn, userEvent, within } from 'storybook/test';++import styles from './TabButton.stories.module.scss';++const TabContainer = ({ children }: { children?: ReactNode }) => {+ return <div className={styles.tabContainer}>{children}</div>;+};++const meta: Meta<typeof TabButton> = {+ title: 'UI/Components/TabButton',+ component: TabButton,+ decorators: [ComponentDecorator],+ args: {+ children: 'Tab Title',+ active: false,+ disabled: false,+ size: 'sm',+ },+ argTypes: {+ startIcon: { control: false },+ endIcon: { control: false },+ badge: { control: 'text' },+ size: {+ control: 'select',+ options: ['sm', 'md'],+ },+ },+};++export default meta;+type Story = StoryObj<typeof TabButton>;++export const Default: Story = {+ args: {+ children: 'General',+ startIcon: <IconSettings />,+ },+ render: (args) => (+ <TabContainer>+ <TabButton {...args} />+ </TabContainer>+ ),+};++export const Active: Story = {+ args: {+ children: 'Active Tab',+ startIcon: <IconUser />,+ active: true,+ },+ render: (args) => (+ <TabContainer>+ <TabButton {...args} />+ </TabContainer>+ ),+};++export const Disabled: Story = {+ args: {+ children: 'Disabled Tab',+ startIcon: <IconCheckbox />,+ disabled: true,+ },+ render: (args) => (+ <TabContainer>+ <TabButton {...args} />+ </TabContainer>+ ),+};++export const WithLogo: Story = {+ args: {+ children: 'Company',+ startIcon: (+ <Avatar src={AVATAR_URL_MOCK} size="md" name="Company" aria-hidden />+ ),+ },+ render: (args) => (+ <TabContainer>+ <TabButton {...args} />+ </TabContainer>+ ),+};++export const WithStringPill: Story = {+ args: {+ children: 'Messages',+ startIcon: <IconMail />,+ badge: <Pill label="12" />,+ },+ render: (args) => (+ <TabContainer>+ <TabButton {...args} />+ </TabContainer>+ ),+};++export const WithBothIcons: Story = {+ args: {+ children: 'Search',+ startIcon: <IconSearch />,+ endIcon: <IconChevronDown />,+ },+ render: (args) => (+ <TabContainer>+ <TabButton {...args} />+ </TabContainer>+ ),+};++export const AsLink: Story = {+ args: {+ children: 'Link Tab',+ startIcon: <IconUser />,+ href: '/profile',+ },+ render: (args) => (+ <TabContainer>+ <TabButton {...args} />+ </TabContainer>+ ),+};++export const SmallContent: Story = {+ args: {+ children: 'Small',+ startIcon: <IconSettings />,+ size: 'sm',+ },+ render: (args) => (+ <TabContainer>+ <TabButton {...args} />+ </TabContainer>+ ),+};++export const MediumContent: Story = {+ args: {+ children: 'Medium',+ startIcon: <IconSettings />,+ size: 'md',+ },+ render: (args) => (+ <TabContainer>+ <TabButton {...args} />+ </TabContainer>+ ),+};++export const Catalog: CatalogStory<Story, typeof TabButton> = {+ args: {+ children: 'Tab title',+ startIcon: <IconCheckbox />,+ },+ argTypes: {+ active: { control: false },+ disabled: { control: false },+ onClick: { control: false },+ href: { control: false },+ },+ render: (args) => (+ <TabContainer>+ <TabButton {...args} />+ </TabContainer>+ ),+ parameters: {+ a11y: A11Y_DEFER_COLOR_CONTRAST,+ pseudo: { hover: ['.hover'], active: ['.active'] },+ catalog: {+ dimensions: [+ {+ name: 'states',+ values: ['default', 'hover', 'active'],+ props: (state: string) =>+ state === 'default' ? {} : { className: state },+ },+ {+ name: 'State',+ values: ['active', 'inactive', 'disabled'],+ labels: (state: string) => state,+ props: (state: string) => ({+ active: state === 'active',+ disabled: state === 'disabled',+ }),+ },+ {+ name: 'Content Size',+ values: ['sm', 'md'],+ labels: (size: string) => size,+ props: (size: string) => ({ size: size as 'sm' | 'md' }),+ },+ {+ name: 'Content',+ values: ['icon', 'logo', 'pill'],+ props: (content: string) => {+ switch (content) {+ case 'icon':+ return { startIcon: <IconSettings /> };+ case 'logo':+ return {+ startIcon: (+ <Avatar+ src={AVATAR_URL_MOCK}+ size="md"+ name="Company"+ aria-hidden+ />+ ),+ };+ case 'pill':+ return { startIcon: <IconMail />, badge: <Pill label="5" /> };+ default:+ return {};+ }+ },+ },+ ],+ },+ layout: 'centered',+ viewport: {+ defaultViewport: 'responsive',+ },+ },+ decorators: [CatalogDecorator],+};++export const KeyboardAction: Story = {+ args: { children: 'New Tab', startIcon: <IconUser />, onClick: fn() },+ render: Default.render,+ play: async ({ canvasElement, args }) => {+ const canvas = within(canvasElement);+ const button = canvas.getByRole('button', { name: 'New Tab' });++ button.focus();+ await userEvent.keyboard('{Enter}');+ expect(args.onClick).toHaveBeenCalledTimes(1);+ expect(button).toHaveAttribute('type', 'button');+ },+};++export const DisabledLink: Story = {+ args: {+ children: 'Unavailable',+ href: '#unavailable',+ disabled: true,+ onClick: fn(),+ },+ render: Default.render,+ play: async ({ canvasElement, args }) => {+ const canvas = within(canvasElement);+ const link = canvas.getByRole('link', { name: 'Unavailable' });++ expect(link).toHaveAttribute('aria-disabled', 'true');+ await userEvent.click(link);+ expect(args.onClick).not.toHaveBeenCalled();+ expect(link).not.toHaveAttribute('type');+ },+};++export const MatchingTabContent: Story = {+ args: {+ children: 'Messages',+ startIcon: <IconMail />,+ badge: <Pill label="12" />,+ },+ render: (args) => (+ <>+ <TabContainer>+ <TabButton {...args} active />+ </TabContainer>+ <Tabs.Root defaultValue="messages">+ <Tabs.List aria-label="Content appearance">+ <Tabs.Tab+ value="messages"+ startIcon={args.startIcon}+ badge={args.badge}+ >+ {args.children}+ </Tabs.Tab>+ </Tabs.List>+ <Tabs.Panel value="messages">Messages content</Tabs.Panel>+ </Tabs.Root>+ </>+ ),+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ const button = canvas.getByRole('button', { name: 'Messages 12' });+ const tab = canvas.getByRole('tab', { name: 'Messages 12' });++ expect(button.getBoundingClientRect().width).toBe(+ tab.getBoundingClientRect().width,+ );+ expect(button.getBoundingClientRect().height).toBe(+ tab.getBoundingClientRect().height,+ );+ expect(getComputedStyle(button).color).toBe(getComputedStyle(tab).color);+ },+};diff --git a/packages/twenty-ui/src/components/TabButton/__tests__/TabButton.test.tsx b/packages/twenty-ui/src/components/TabButton/__tests__/TabButton.test.tsxnew file mode 100644index 00000000000..d26e5483e3c--- /dev/null+++ b/packages/twenty-ui/src/components/TabButton/__tests__/TabButton.test.tsx@@ -0,0 +1,19 @@+import { runComponentConformance } from '@test-utilities/conformance/runComponentConformance';++import { TabButton } from '../TabButton';+import styles from '../TabButton.module.scss';++runComponentConformance({+ name: 'TabButton',+ element: <TabButton>Overview</TabButton>,+ refInstanceOf: HTMLButtonElement,+ ownClassName: styles.button,+});++runComponentConformance({+ name: 'TabButton link',+ element: <TabButton href="#overview">Overview</TabButton>,+ refInstanceOf: HTMLAnchorElement,+ ownClassName: styles.button,+ renderPropTagName: 'a',+});diff --git a/packages/twenty-ui/src/components/TabButton/types/TabButtonProps.ts b/packages/twenty-ui/src/components/TabButton/types/TabButtonProps.tsnew file mode 100644index 00000000000..8c9f4547d33--- /dev/null+++ b/packages/twenty-ui/src/components/TabButton/types/TabButtonProps.ts@@ -0,0 +1,17 @@+import { type ButtonProps } from '@ui/primitives/input/Button/types/ButtonProps';+import { type TabsTabProps } from '@ui/primitives/navigation/Tabs/types/TabsTabProps';++export type TabButtonProps = Omit<+ ButtonProps,+ | 'variant'+ | 'color'+ | 'fullWidth'+ | 'loading'+ | 'elevated'+ | 'hotkeys'+ | 'soon'+ | 'soonLabel'+> &+ Pick<TabsTabProps, 'badge'> & {+ active?: boolean;+ };diff --git a/packages/twenty-ui/src/components/index.ts b/packages/twenty-ui/src/components/index.tsindex 76addaac8b0..d45252f6c5a 100644--- a/packages/twenty-ui/src/components/index.ts+++ b/packages/twenty-ui/src/components/index.ts@@ -15,3 +15,5 @@ export { MainButton } from './MainButton/MainButton';export { Section } from './Section/Section';export type { SectionHeaderProps } from './Section/types/SectionHeaderProps';export type { SectionRootProps } from './Section/types/SectionRootProps';+export { TabButton } from './TabButton/TabButton';+export type { TabButtonProps } from './TabButton/types/TabButtonProps';diff --git a/packages/twenty-ui/src/primitives/input/TabButton/TabButton.module.scss b/packages/twenty-ui/src/primitives/input/TabButton/TabButton.module.scssdeleted file mode 100644index 3b898f5cf18..00000000000--- a/packages/twenty-ui/src/primitives/input/TabButton/TabButton.module.scss+++ /dev/null@@ -1,3 +0,0 @@-.tabTooltipWrapper {- display: flex;-}diff --git a/packages/twenty-ui/src/primitives/input/TabButton/TabButton.module.scss.d.ts b/packages/twenty-ui/src/primitives/input/TabButton/TabButton.module.scss.d.tsdeleted file mode 100644index 9bc27db801d..00000000000--- a/packages/twenty-ui/src/primitives/input/TabButton/TabButton.module.scss.d.ts+++ /dev/null@@ -1,4 +0,0 @@-declare const classNames: {- readonly tabTooltipWrapper: 'tabTooltipWrapper';-};-export default classNames;diff --git a/packages/twenty-ui/src/primitives/input/TabButton/TabButton.tsx b/packages/twenty-ui/src/primitives/input/TabButton/TabButton.tsxdeleted file mode 100644index ee74aa3e440..00000000000--- a/packages/twenty-ui/src/primitives/input/TabButton/TabButton.tsx+++ /dev/null@@ -1,99 +0,0 @@-import { type IconComponent } from '@ui/icon';-import { isNonEmptyString } from '@sniptt/guards';-import { Tooltip } from '@ui/primitives/surfaces/Tooltip/Tooltip';-import {- StyledTabButton,- StyledTabContainer,-} from '@ui/primitives/input/TabButton/parts/StyledTabBase';-import {- TabContent,- type TabContentProps,-} from '@ui/primitives/input/TabButton/parts/TabContent';-import { type ReactElement } from 'react';-import { type To } from 'react-router-dom';--import styles from './TabButton.module.scss';--export { StyledTabContainer, TabContent };-export type { TabContentProps };--type TabButtonProps = {- id: string;- active?: boolean;- disabled?: boolean;- to?: To;- state?: unknown;- replace?: boolean;- LeftIcon?: IconComponent;- className?: string;- title?: string;- onClick?: () => void;- logo?: string;- RightIcon?: IconComponent;- pill?: string | ReactElement;- contentSize?: 'sm' | 'md';- disableTestId?: boolean;- tooltipContent?: string;- onMouseEnter?: () => void;- onMouseLeave?: () => void;-};--export const TabButton = ({- id,- active,- disabled,- to,- state,- replace,- LeftIcon,- className,- title,- onClick,- logo,- RightIcon,- pill,- contentSize = 'sm',- disableTestId = false,- tooltipContent,- onMouseEnter,- onMouseLeave,-}: TabButtonProps) => {- const tabElementId = `tab-${id}`;-- return (- <Tooltip- content={tooltipContent}- disabled={!isNonEmptyString(tooltipContent)}- side="bottom"- positionMethod="fixed"- delay={300}- >- <div key={id} id={tabElementId} className={styles.tabTooltipWrapper}>- <StyledTabButton- data-testid={disableTestId ? undefined : `tab-${id}`}- active={active}- disabled={disabled}- to={to}- state={state}- replace={replace}- className={className}- onClick={onClick}- onMouseEnter={onMouseEnter}- onMouseLeave={onMouseLeave}- >- <TabContent- id={id}- active={active}- disabled={disabled}- LeftIcon={LeftIcon}- title={title}- logo={logo}- RightIcon={RightIcon}- pill={pill}- contentSize={contentSize}- />- </StyledTabButton>- </div>- </Tooltip>- );-};diff --git a/packages/twenty-ui/src/primitives/input/TabButton/__stories__/TabButton.stories.tsx b/packages/twenty-ui/src/primitives/input/TabButton/__stories__/TabButton.stories.tsxdeleted file mode 100644index 1db62ed4b49..00000000000--- a/packages/twenty-ui/src/primitives/input/TabButton/__stories__/TabButton.stories.tsx+++ /dev/null@@ -1,235 +0,0 @@-import { type Meta, type StoryObj } from '@storybook/react-vite';-import {- IconCheckbox,- IconChevronDown,- IconMail,- IconSearch,- IconSettings,- IconUser,-} from '@ui/icon';-import { TabButton } from '@ui/primitives/input/TabButton/TabButton';-import {- A11Y_DEFER_COLOR_CONTRAST,- AVATAR_URL_MOCK,- CatalogDecorator,- type CatalogStory,- ComponentWithRouterDecorator,-} from '@ui/testing';-import { type ReactNode } from 'react';--import styles from './TabButton.stories.module.scss';--const TabContainer = ({ children }: { children?: ReactNode }) => {- return <div className={styles.tabContainer}>{children}</div>;-};--const meta: Meta<typeof TabButton> = {- title: 'UI/Input/Button/TabButton',- component: TabButton,- decorators: [ComponentWithRouterDecorator],- args: {- id: 'tab-button',- title: 'Tab Title',- active: false,- disabled: false,- contentSize: 'sm',- },- argTypes: {- LeftIcon: { control: false },- RightIcon: { control: false },- pill: { control: 'text' },- contentSize: {- control: 'select',- options: ['sm', 'md'],- },- },-};--export default meta;-type Story = StoryObj<typeof TabButton>;--export const Default: Story = {- args: {- title: 'General',- LeftIcon: IconSettings,- },- render: (args) => (- <TabContainer>- <TabButton {...args} />- </TabContainer>- ),-};--export const Active: Story = {- args: {- title: 'Active Tab',- LeftIcon: IconUser,- active: true,- },- render: (args) => (- <TabContainer>- <TabButton {...args} />- </TabContainer>- ),-};--export const Disabled: Story = {- args: {- title: 'Disabled Tab',- LeftIcon: IconCheckbox,- disabled: true,- },- render: (args) => (- <TabContainer>- <TabButton {...args} />- </TabContainer>- ),-};--export const WithLogo: Story = {- args: {- title: 'Company',- logo: AVATAR_URL_MOCK,- },- render: (args) => (- <TabContainer>- <TabButton {...args} />- </TabContainer>- ),-};--export const WithStringPill: Story = {- args: {- title: 'Messages',- LeftIcon: IconMail,- pill: '12',- },- render: (args) => (- <TabContainer>- <TabButton {...args} />- </TabContainer>- ),-};--export const WithBothIcons: Story = {- args: {- title: 'Search',- LeftIcon: IconSearch,- RightIcon: IconChevronDown,- },- render: (args) => (- <TabContainer>- <TabButton {...args} />- </TabContainer>- ),-};--export const AsLink: Story = {- args: {- title: 'Link Tab',- LeftIcon: IconUser,- to: '/profile',- },- render: (args) => (- <TabContainer>- <TabButton {...args} />- </TabContainer>- ),-};--export const SmallContent: Story = {- args: {- title: 'Small',- LeftIcon: IconSettings,- contentSize: 'sm',- },- render: (args) => (- <TabContainer>- <TabButton {...args} />- </TabContainer>- ),-};--export const MediumContent: Story = {- args: {- title: 'Medium',- LeftIcon: IconSettings,- contentSize: 'md',- },- render: (args) => (- <TabContainer>- <TabButton {...args} />- </TabContainer>- ),-};--export const Catalog: CatalogStory<Story, typeof TabButton> = {- args: {- title: 'Tab title',- LeftIcon: IconCheckbox,- },- argTypes: {- active: { control: false },- disabled: { control: false },- onClick: { control: false },- to: { control: false },- },- render: (args) => (- <TabContainer>- <TabButton {...args} />- </TabContainer>- ),- parameters: {- a11y: A11Y_DEFER_COLOR_CONTRAST,- pseudo: { hover: ['.hover'], active: ['.active'] },- catalog: {- dimensions: [- {- name: 'states',- values: ['default', 'hover', 'active'],- props: (state: string) =>- state === 'default' ? {} : { className: state },- },- {- name: 'State',- values: ['active', 'inactive', 'disabled'],- labels: (state: string) => state,- props: (state: string) => ({- active: state === 'active',- disabled: state === 'disabled',- }),- },- {- name: 'Content Size',- values: ['sm', 'md'],- labels: (size: string) => size,- props: (size: string) => ({ contentSize: size as 'sm' | 'md' }),- },- {- name: 'Content',- values: ['icon', 'logo', 'pill'],- props: (content: string) => {- switch (content) {- case 'icon':- return { LeftIcon: IconSettings };- case 'logo':- return {- logo: AVATAR_URL_MOCK,- LeftIcon: undefined,- };- case 'pill':- return { LeftIcon: IconMail, pill: '5' };- default:- return {};- }- },- },- ],- },- layout: 'centered',- viewport: {- defaultViewport: 'responsive',- },- },- decorators: [CatalogDecorator],-};diff --git a/packages/twenty-ui/src/primitives/input/TabButton/parts/StyledTabBase.module.scss b/packages/twenty-ui/src/primitives/input/TabButton/parts/StyledTabBase.module.scssdeleted file mode 100644index 7d483c09aaf..00000000000--- a/packages/twenty-ui/src/primitives/input/TabButton/parts/StyledTabBase.module.scss+++ /dev/null@@ -1,100 +0,0 @@-.tabButton {- all: unset;- align-items: center;- color: var(--t-font-color-secondary);- cursor: pointer;- background-color: transparent;- border: none;- font-family: inherit;- display: flex;- gap: var(--t-spacing-1);- justify-content: center;- text-decoration: none;- position: relative;-- &::after {- content: '';- position: absolute;- bottom: 0;- left: 0;- right: 0;- height: 1px;- background-color: transparent;- z-index: 1;- }-- &[data-disabled] {- color: var(--t-font-color-light);- pointer-events: none;- }-- // active wins over disabled, matching the legacy Linaria ternary- // (active ? primary : disabled ? light : secondary)- &[data-active] {- color: var(--t-font-color-primary);-- &::after {- background-color: var(--t-border-color-inverted);- }- }-}--.tabContainer {- align-items: center;- color: var(--t-font-color-secondary);- cursor: pointer;- background-color: transparent;- display: flex;- gap: var(--t-spacing-1);- justify-content: center;- text-decoration: none;- position: relative;-- &::after {- content: '';- position: absolute;- bottom: 0;- left: 0;- right: 0;- height: 1px;- background-color: transparent;- z-index: 1;- }-- &[data-disabled] {- color: var(--t-font-color-light);- }-- &[data-active] {- color: var(--t-font-color-primary);-- &::after {- background-color: var(--t-border-color-inverted);- }- }-}--.tabHover {- box-sizing: border-box;- display: flex;- gap: var(--t-spacing-1);- // the legacy ternary fell through to the md padding when contentSize was- // undefined, so md padding is the base and sm is the override- padding: var(--t-spacing-2) var(--t-spacing-2);- font-weight: var(--t-font-weight-medium);- width: 100%;- white-space: nowrap;- border-radius: var(--t-border-radius-md);-- &[data-content-size='sm'] {- padding: var(--t-spacing-1) var(--t-spacing-2);- }-- &:hover {- background: var(--t-background-tertiary);- }-- &:active {- background: var(--t-background-quaternary);- }-}diff --git a/packages/twenty-ui/src/primitives/input/TabButton/parts/StyledTabBase.module.scss.d.ts b/packages/twenty-ui/src/primitives/input/TabButton/parts/StyledTabBase.module.scss.d.tsdeleted file mode 100644index 9832b4d27dd..00000000000--- a/packages/twenty-ui/src/primitives/input/TabButton/parts/StyledTabBase.module.scss.d.ts+++ /dev/null@@ -1,6 +0,0 @@-declare const classNames: {- readonly tabButton: 'tabButton';- readonly tabContainer: 'tabContainer';- readonly tabHover: 'tabHover';-};-export default classNames;diff --git a/packages/twenty-ui/src/primitives/input/TabButton/parts/StyledTabBase.tsx b/packages/twenty-ui/src/primitives/input/TabButton/parts/StyledTabBase.tsxdeleted file mode 100644index 67a492acdad..00000000000--- a/packages/twenty-ui/src/primitives/input/TabButton/parts/StyledTabBase.tsx+++ /dev/null@@ -1,88 +0,0 @@-import { clsx } from 'clsx';-import { type ComponentPropsWithoutRef, forwardRef } from 'react';-import { Link, type To } from 'react-router-dom';--import styles from './StyledTabBase.module.scss';--// The deprecated Linaria styled components forwarded refs and arbitrary-// native props (twenty-front spreads drag-and-drop props onto-// StyledTabContainer), so the ports preserve that contract.-type StyledTabButtonProps = {- active?: boolean;- disabled?: boolean;- to?: To;- state?: unknown;- replace?: boolean;-} & ComponentPropsWithoutRef<'button'>;--export const StyledTabButton = forwardRef<HTMLElement, StyledTabButtonProps>(- (- { active, disabled, to, state, replace, className, children, ...rest },- ref,- ) => {- // Replaces the legacy Linaria `as` polymorphism: react-router Link when a- // `to` is provided, a native button otherwise. Typed as any to forward all- // props untyped, exactly like the legacy `as` prop did.- // eslint-disable-next-line @typescript-eslint/no-explicit-any- const TabButtonComponent: any = to ? Link : 'button';-- return (- <TabButtonComponent- ref={ref}- to={to}- state={to ? state : undefined}- replace={to ? replace : undefined}- disabled={to ? undefined : disabled}- className={clsx(styles.tabButton, className)}- data-active={active || undefined}- data-disabled={disabled || undefined}- {...rest}- >- {children}- </TabButtonComponent>- );- },-);--StyledTabButton.displayName = 'StyledTabButton';--type StyledTabContainerProps = {- active?: boolean;- disabled?: boolean;-} & ComponentPropsWithoutRef<'div'>;--export const StyledTabContainer = forwardRef<- HTMLDivElement,- StyledTabContainerProps->(({ active, disabled, className, children, ...rest }, ref) => (- <div- ref={ref}- className={clsx(styles.tabContainer, className)}- data-active={active || undefined}- data-disabled={disabled || undefined}- {...rest}- >- {children}- </div>-));--StyledTabContainer.displayName = 'StyledTabContainer';--type StyledTabHoverProps = {- contentSize?: 'sm' | 'md';-} & ComponentPropsWithoutRef<'span'>;--export const StyledTabHover = forwardRef<HTMLSpanElement, StyledTabHoverProps>(- ({ contentSize, className, children, ...rest }, ref) => (- <span- ref={ref}- className={clsx(styles.tabHover, className)}- data-content-size={contentSize}- {...rest}- >- {children}- </span>- ),-);--StyledTabHover.displayName = 'StyledTabHover';diff --git a/packages/twenty-ui/src/primitives/input/TabButton/parts/TabContent.tsx b/packages/twenty-ui/src/primitives/input/TabButton/parts/TabContent.tsxdeleted file mode 100644index 10774c8e701..00000000000--- a/packages/twenty-ui/src/primitives/input/TabButton/parts/TabContent.tsx+++ /dev/null@@ -1,53 +0,0 @@-import { Pill } from '@ui/primitives/data-display/Pill/Pill';-import { Avatar } from '@ui/primitives/data-display/Avatar/Avatar';-import { type IconComponent } from '@ui/icon';-import { useTheme } from '@ui/theme-constants';-import { type ReactElement } from 'react';-import { StyledTabHover } from '@ui/primitives/input/TabButton/parts/StyledTabBase';--export type TabContentProps = {- id: string;- active?: boolean;- disabled?: boolean;- LeftIcon?: IconComponent;- title?: string;- logo?: string;- RightIcon?: IconComponent;- pill?: string | ReactElement;- contentSize?: 'sm' | 'md';- className?: string;-};--export const TabContent = ({- active,- disabled,- LeftIcon,- title,- logo,- RightIcon,- pill,- contentSize = 'sm',- className,-}: TabContentProps) => {- const theme = useTheme();-- const iconColor = active- ? theme.font.color.primary- : disabled- ? theme.font.color.extraLight- : theme.font.color.secondary;-- return (- <StyledTabHover contentSize={contentSize} className={className}>- {LeftIcon && (- <LeftIcon color={iconColor} size={theme.icon.size.md} aria-hidden />- )}- {logo && <Avatar src={logo} size="md" name={title} aria-hidden />}- {title}- {RightIcon && (- <RightIcon color={iconColor} size={theme.icon.size.md} aria-hidden />- )}- {pill && (typeof pill === 'string' ? <Pill label={pill} /> : pill)}- </StyledTabHover>- );-};diff --git a/packages/twenty-ui/src/primitives/input/index.ts b/packages/twenty-ui/src/primitives/input/index.tsindex 01de9311ccf..0aa72c4298f 100644--- a/packages/twenty-ui/src/primitives/input/index.ts+++ b/packages/twenty-ui/src/primitives/input/index.ts@@ -103,12 +103,6 @@ export type { SliderValueProps } from './Slider/types/SliderValueProps';export { Switch } from './Switch/Switch';export type { SwitchProps } from './Switch/types/SwitchProps';export type { SwitchSize } from './Switch/types/SwitchSize';-export type { TabContentProps } from './TabButton/TabButton';-export {- StyledTabContainer,- TabContent,- TabButton,-} from './TabButton/TabButton';export { Textarea } from './Textarea/Textarea';export type { TextareaProps } from './Textarea/types/TextareaProps';export type { ColorScheme } from './types/ColorScheme';diff --git a/packages/twenty-ui/src/primitives/navigation/Tabs/Tabs.module.scss b/packages/twenty-ui/src/primitives/navigation/Tabs/Tabs.module.scssindex 86ff8abc737..e4c9936fcd5 100644--- a/packages/twenty-ui/src/primitives/navigation/Tabs/Tabs.module.scss+++ b/packages/twenty-ui/src/primitives/navigation/Tabs/Tabs.module.scss@@ -111,6 +111,12 @@white-space: nowrap;}+.tab[data-highlighted] .content {+ border-radius: var(--t-border-radius-sm);+ outline: 1px solid var(--t-color-blue);+ outline-offset: -1px;+}+.label {min-inline-size: 0;overflow: hidden;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 15860904042..55586763677 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@@ -164,6 +164,24 @@ export const Disabled: Story = {},};+export const Highlighted: Story = {+ decorators: [ComponentDecorator],+ parameters: { container: { width: 360 } },+ args: { highlighted: true },+ render: (args) => (+ <TabsExample tabProps={args} rootProps={{ defaultValue: 'activity' }} />+ ),+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement);+ const overview = canvas.getByRole('tab', { name: 'Overview' });++ expect(overview).toHaveAttribute('aria-selected', 'false');+ expect(canvas.getByRole('tabpanel', { name: 'Activity' })).toBeVisible();+ await userEvent.click(overview);+ expect(canvas.getByRole('tabpanel', { name: 'Overview' })).toBeVisible();+ },+};+export const Vertical: Story = {decorators: [ComponentDecorator],parameters: { container: { width: 360 } },diff --git a/packages/twenty-ui/src/primitives/navigation/Tabs/internal/TabsTab.tsx b/packages/twenty-ui/src/primitives/navigation/Tabs/internal/TabsTab.tsxindex a4be341ca88..d135a6d1165 100644--- a/packages/twenty-ui/src/primitives/navigation/Tabs/internal/TabsTab.tsx+++ b/packages/twenty-ui/src/primitives/navigation/Tabs/internal/TabsTab.tsx@@ -4,13 +4,15 @@ import { mergeClassNames } from '@ui/utilities/internal/mergeClassNames';import styles from '../Tabs.module.scss';import { type TabsTabProps } from '../types/TabsTabProps';-import { isRenderableSlot } from './isRenderableSlot';+import { TabsTabContent } from './TabsTabContent';export const TabsTab = ({className,children,startIcon,+ endIcon,badge,+ highlighted = false,size = 'sm',...props}: TabsTabProps) => (@@ -18,15 +20,10 @@ export const TabsTab = ({{...props}className={mergeClassNames(styles.tab, className)}data-size={size}+ data-highlighted={highlighted || undefined}>- <span className={styles.content}>- {isRenderableSlot(startIcon) && (- <span className={styles.startIcon} aria-hidden>- {startIcon}- </span>- )}- <span className={styles.label}>{children}</span>- {isRenderableSlot(badge) && <span className={styles.badge}>{badge}</span>}- </span>+ <TabsTabContent startIcon={startIcon} endIcon={endIcon} badge={badge}>+ {children}+ </TabsTabContent></TabsPrimitive.Tab>);diff --git a/packages/twenty-ui/src/primitives/navigation/Tabs/internal/TabsTabContent.tsx b/packages/twenty-ui/src/primitives/navigation/Tabs/internal/TabsTabContent.tsxnew file mode 100644index 00000000000..cdeb9363594--- /dev/null+++ b/packages/twenty-ui/src/primitives/navigation/Tabs/internal/TabsTabContent.tsx@@ -0,0 +1,31 @@+import { type TabsTabProps } from '../types/TabsTabProps';+import { isRenderableSlot } from './isRenderableSlot';++import styles from '../Tabs.module.scss';++type TabsTabContentProps = Pick<+ TabsTabProps,+ 'children' | 'startIcon' | 'endIcon' | 'badge'+>;++export const TabsTabContent = ({+ children,+ startIcon,+ endIcon,+ badge,+}: TabsTabContentProps) => (+ <span className={styles.content}>+ {isRenderableSlot(startIcon) && (+ <span className={styles.startIcon} aria-hidden>+ {startIcon}+ </span>+ )}+ <span className={styles.label}>{children}</span>+ {isRenderableSlot(endIcon) && (+ <span className={styles.startIcon} aria-hidden>+ {endIcon}+ </span>+ )}+ {isRenderableSlot(badge) && <span className={styles.badge}>{badge}</span>}+ </span>+);diff --git a/packages/twenty-ui/src/primitives/navigation/Tabs/types/TabsTabProps.ts b/packages/twenty-ui/src/primitives/navigation/Tabs/types/TabsTabProps.tsindex 591996de629..b540bc3a077 100644--- a/packages/twenty-ui/src/primitives/navigation/Tabs/types/TabsTabProps.ts+++ b/packages/twenty-ui/src/primitives/navigation/Tabs/types/TabsTabProps.ts@@ -8,6 +8,8 @@ export type TabsTabProps = TabsPrimitive.Tab.Props & {startIcon?: ReactNode;/** Content rendered after the label, such as a count. */badge?: ReactNode;+ endIcon?: ReactNode;+ highlighted?: boolean;/** Visual size of the tab. */size?: TabsSize;};