Reorganize twenty-ui into best-practice component domains and per-component folders (#21745)

Reorganizes `twenty-ui`'s component organization to follow how the best
UI libraries (MUI, Mantine, Base UI, Polaris) structure their source,
now that the package has stabilized.

**Taxonomy** — dissolves the meaningless `components/` junk-drawer and
the 107-file `display/` mega-category. New domains/subpaths:
`data-display`, `typography`, `icon`, `surfaces`; `feedback` and
`layout` absorb the rest (banners/callout/info + placeholders →
feedback; modal/card → surfaces; motion + separators → layout).

**Per-component layout** — every component is now
`<domain>/<ComponentName>/<ComponentName>.tsx` with colocated
styles/stories/types, `internal/` for private helpers and `parts/` for
re-exported compound sub-parts. The redundant inner `/components/` is
gone. `icon` and `json-visualizer` are kept as cohesive subsystems.

**Also:** adds a tree-shakeable root barrel (`import { Button } from
'twenty-ui'`), the generator now owns `individual-entry.ts`, and a real
barrel-leak bug is fixed (private `internals/` parts were leaking into
the public API).

Consumer imports (~1.2k files) and the `twenty-sdk` UI aggregator were
updated by codemod. The change is **export-neutral** except 16
intentionally-removed private internals symbols (all verified
unconsumed). Gates green: typecheck, lint, build, size-limit, storybook.


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/twentyhq/twenty/pull/21745?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
This commit is contained in:
Raphaël Bosi
2026-06-18 10:31:29 +02:00
committed by GitHub
parent 640a8e6ca6
commit 8034c7725f
1580 changed files with 2382 additions and 2404 deletions
@@ -14,7 +14,7 @@ import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomStat
import { useLingui } from '@lingui/react/macro';
import { useState } from 'react';
import { isFieldMetadataDateKind } from 'twenty-shared/utils';
import { IconChevronLeft, IconSettings, useIcons } from 'twenty-ui/display';
import { IconChevronLeft, IconSettings, useIcons } from 'twenty-ui/icon';
import { MenuItem, MenuItemSelect } from 'twenty-ui/navigation';
export const ObjectOptionsDropdownCalendarFieldsContent = () => {
@@ -13,13 +13,13 @@ import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomState
import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
import { useUpdateCurrentView } from '@/views/hooks/useUpdateCurrentView';
import { t } from '@lingui/core/macro';
import { Pill } from 'twenty-ui/components';
import { Pill } from 'twenty-ui/data-display';
import {
IconCalendarMonth,
IconCalendarWeek,
IconChevronLeft,
IconTimelineEvent,
} from 'twenty-ui/display';
} from 'twenty-ui/icon';
import { MenuItemSelect } from 'twenty-ui/navigation';
import { ViewCalendarLayout } from '~/generated-metadata/graphql';
@@ -24,14 +24,14 @@ import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/use
import { useLingui } from '@lingui/react/macro';
import { capitalize, isDefined } from 'twenty-shared/utils';
import {
AppTooltip,
IconCalendar,
IconCalendarWeek,
IconLayoutList,
IconListDetails,
IconShare,
IconTrash,
} from 'twenty-ui/display';
} from 'twenty-ui/icon';
import { AppTooltip } from 'twenty-ui/surfaces';
import { MenuItem } from 'twenty-ui/navigation';
import { ViewCalendarLayout } from '~/generated-metadata/graphql';
@@ -19,7 +19,7 @@ import {
IconListDetails,
IconLock,
useIcons,
} from 'twenty-ui/display';
} from 'twenty-ui/icon';
import { MenuItem } from 'twenty-ui/navigation';
import { useCopyToClipboard } from '~/hooks/useCopyToClipboard';
@@ -10,7 +10,7 @@ import { ViewFieldsVisibleDropdownSection } from '@/views/components/ViewFieldsV
import { useLingui } from '@lingui/react/macro';
import { isNonEmptyString } from '@sniptt/guards';
import { useState } from 'react';
import { IconChevronLeft, IconEyeOff } from 'twenty-ui/display';
import { IconChevronLeft, IconEyeOff } from 'twenty-ui/icon';
import { MenuItemNavigate } from 'twenty-ui/navigation';
export const ObjectOptionsDropdownFieldsContent = () => {
@@ -14,7 +14,7 @@ import { ViewFieldsHiddenDropdownSection } from '@/views/components/ViewFieldsHi
import { useLingui } from '@lingui/react/macro';
import { SettingsPath } from 'twenty-shared/types';
import { getSettingsPath } from 'twenty-shared/utils';
import { IconChevronLeft, IconSettings } from 'twenty-ui/display';
import { IconChevronLeft, IconSettings } from 'twenty-ui/icon';
import { MenuItem, UndecoratedLink } from 'twenty-ui/navigation';
export const ObjectOptionsDropdownHiddenFieldsContent = () => {
@@ -23,7 +23,7 @@ import { useLocation } from 'react-router-dom';
import { VIEW_GROUP_VISIBLE_OPTIONS_MAX } from 'twenty-shared/constants';
import { SettingsPath } from 'twenty-shared/types';
import { getSettingsPath } from 'twenty-shared/utils';
import { IconChevronLeft, IconSettings } from 'twenty-ui/display';
import { IconChevronLeft, IconSettings } from 'twenty-ui/icon';
import { MenuItem, UndecoratedLink } from 'twenty-ui/navigation';
export const ObjectOptionsDropdownHiddenRecordGroupsContent = () => {
@@ -33,8 +33,8 @@ import {
IconLayoutNavbar,
IconLayoutSidebarRight,
IconTable,
OverflowingTextWithTooltip,
} from 'twenty-ui/display';
} from 'twenty-ui/icon';
import { OverflowingTextWithTooltip } from 'twenty-ui/surfaces';
import { MenuItem, MenuItemSelect, MenuItemToggle } from 'twenty-ui/navigation';
import {
ViewCalendarLayout,
@@ -20,7 +20,7 @@ import {
IconChevronLeft,
IconLayoutNavbar,
IconLayoutSidebarRight,
} from 'twenty-ui/display';
} from 'twenty-ui/icon';
import { MenuItemSelect } from 'twenty-ui/navigation';
export const ObjectOptionsDropdownLayoutOpenInContent = () => {
@@ -15,7 +15,8 @@ import { viewPickerSelectedIconComponentState } from '@/views/view-picker/states
import { styled } from '@linaria/react';
import { useContext, useEffect, useRef, useState } from 'react';
import { Key } from 'ts-key-enum';
import { OverflowingTextWithTooltip, useIcons } from 'twenty-ui/display';
import { useIcons } from 'twenty-ui/icon';
import { OverflowingTextWithTooltip } from 'twenty-ui/surfaces';
import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { useDebouncedCallback } from 'use-debounce';
@@ -23,7 +23,7 @@ import { useLingui } from '@lingui/react/macro';
import { useLocation } from 'react-router-dom';
import { SettingsPath } from 'twenty-shared/types';
import { getSettingsPath, isDefined } from 'twenty-shared/utils';
import { IconChevronLeft, IconSettings, useIcons } from 'twenty-ui/display';
import { IconChevronLeft, IconSettings, useIcons } from 'twenty-ui/icon';
import {
MenuItem,
MenuItemSelect,
@@ -21,7 +21,7 @@ import {
IconHandMove,
IconSortAZ,
IconSortZA,
} from 'twenty-ui/display';
} from 'twenty-ui/icon';
import { MenuItemSelect } from 'twenty-ui/navigation';
export const ObjectOptionsDropdownRecordGroupSortContent = () => {
@@ -29,7 +29,7 @@ import {
IconEyeOff,
IconLayoutList,
IconSortDescending,
} from 'twenty-ui/display';
} from 'twenty-ui/icon';
import {
MenuItem,
MenuItemNavigate,
@@ -17,12 +17,12 @@ import { useUpdateCurrentView } from '@/views/hooks/useUpdateCurrentView';
import { useLingui } from '@lingui/react/macro';
import { createPortal } from 'react-dom';
import {
AppTooltip,
IconChevronLeft,
IconCircle,
IconCircleDashed,
IconCopy,
} from 'twenty-ui/display';
} from 'twenty-ui/icon';
import { AppTooltip } from 'twenty-ui/surfaces';
import { MenuItem, MenuItemSelect } from 'twenty-ui/navigation';
import {
ViewVisibility,