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
@@ -0,0 +1,55 @@
.wrapper {
align-items: center;
display: flex;
gap: var(--t-spacing-2);
width: 100%;
}
.inputContainer {
align-items: center;
background-color: var(--t-background-transparent-lighter);
border: 1px solid var(--t-border-color-medium);
border-radius: var(--t-border-radius-sm);
box-sizing: border-box;
display: flex;
flex: 1;
gap: var(--t-spacing-1);
height: 32px;
padding: 0 var(--t-spacing-2);
}
.inputContainer:focus-within {
border-color: var(--t-color-blue);
}
.iconContainer {
align-items: center;
color: var(--t-font-color-light);
display: flex;
justify-content: center;
}
.iconContainer[data-focused] {
color: var(--t-font-color-secondary);
}
.input {
background: transparent;
border: none;
color: var(--t-font-color-primary);
flex: 1;
font-family: var(--t-font-family);
font-size: var(--t-font-size-md);
font-weight: var(--t-font-weight-regular);
outline: none;
width: 100%;
}
.input::placeholder {
color: var(--t-font-color-light);
font-weight: var(--t-font-weight-medium);
}
.input:disabled {
color: var(--t-font-color-tertiary);
}
@@ -0,0 +1,7 @@
declare const classNames: {
readonly wrapper: 'wrapper';
readonly inputContainer: 'inputContainer';
readonly iconContainer: 'iconContainer';
readonly input: 'input';
};
export default classNames;
@@ -0,0 +1,58 @@
import { Input } from '@base-ui/react/input';
import { clsx } from 'clsx';
import { type ReactNode, useContext, useState } from 'react';
import { IconFilter, IconSearch } from '@ui/icon';
import { IconButton } from '@ui/input/IconButton/IconButton';
import { ThemeContext } from '@ui/theme-constants';
import styles from './SearchInput.module.scss';
export type SearchInputProps = {
value: string;
onChange: (value: string) => void;
placeholder?: string;
filterDropdown?: (filterButton: ReactNode) => ReactNode;
autoFocus?: boolean;
disabled?: boolean;
className?: string;
};
export const SearchInput = ({
value,
onChange,
placeholder,
filterDropdown,
autoFocus,
disabled,
className,
}: SearchInputProps) => {
const { theme } = useContext(ThemeContext);
const [isFocused, setIsFocused] = useState(false);
const filterButton = <IconButton Icon={IconFilter} variant="secondary" />;
return (
<div className={clsx(styles.wrapper, className)}>
<div className={styles.inputContainer}>
<div
className={styles.iconContainer}
data-focused={isFocused || undefined}
>
<IconSearch size={theme.icon.size.md} />
</div>
<Input
className={styles.input}
value={value}
onValueChange={(newValue) => onChange(newValue)}
onFocus={() => setIsFocused(true)}
onBlur={() => setIsFocused(false)}
placeholder={placeholder}
autoFocus={autoFocus}
disabled={disabled}
/>
</div>
{filterDropdown && filterDropdown(filterButton)}
</div>
);
};
@@ -0,0 +1,54 @@
import { type Meta, type StoryObj } from '@storybook/react-vite';
import { ComponentDecorator } from '@ui/testing';
import { useState } from 'react';
import { SearchInput } from '@ui/input/SearchInput/SearchInput';
type InteractiveSearchInputProps = {
placeholder?: string;
disabled?: boolean;
autoFocus?: boolean;
className?: string;
};
const InteractiveSearchInput = ({
placeholder,
disabled,
autoFocus,
className,
}: InteractiveSearchInputProps) => {
const [value, setValue] = useState('');
return (
<SearchInput
value={value}
onChange={setValue}
placeholder={placeholder}
disabled={disabled}
autoFocus={autoFocus}
className={className}
/>
);
};
const meta: Meta<typeof InteractiveSearchInput> = {
title: 'UI/Input/SearchInput',
component: InteractiveSearchInput,
decorators: [ComponentDecorator],
};
export default meta;
type Story = StoryObj<typeof InteractiveSearchInput>;
export const Default: Story = {
args: {
placeholder: 'Search...',
},
};
export const Disabled: Story = {
args: {
placeholder: 'Search...',
disabled: true,
},
};