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,35 @@
.button {
align-items: center;
background: var(--t-color-blue);
border: none;
border-radius: 50%;
color: var(--t-font-color-inverted);
cursor: pointer;
display: flex;
justify-content: center;
outline: none;
padding: 0;
transition:
color 0.1s ease-in-out,
background 0.1s ease-in-out;
&:hover:not(:disabled) {
background: var(--t-color-blue10);
}
&:disabled {
background: var(--t-background-quaternary);
color: var(--t-font-color-tertiary);
cursor: default;
}
}
.small {
height: 20px;
width: 20px;
}
.medium {
height: 24px;
width: 24px;
}
@@ -0,0 +1,6 @@
declare const classNames: {
readonly button: 'button';
readonly small: 'small';
readonly medium: 'medium';
};
export default classNames;
@@ -0,0 +1,34 @@
import { clsx } from 'clsx';
import React, { useContext } from 'react';
import { type IconComponent } from '@ui/icon';
import { ThemeContext } from '@ui/theme-constants';
import styles from './RoundedIconButton.module.scss';
export type RoundedIconButtonSize = 'small' | 'medium';
type RoundedIconButtonProps = {
Icon: IconComponent;
size?: RoundedIconButtonSize;
} & React.ButtonHTMLAttributes<HTMLButtonElement>;
export const RoundedIconButton = ({
Icon,
onClick,
disabled,
className,
size = 'small',
}: RoundedIconButtonProps) => {
const { theme } = useContext(ThemeContext);
return (
<button
className={clsx(styles.button, styles[size], className)}
disabled={disabled}
onClick={onClick}
>
<Icon size={theme.icon.size.md} />
</button>
);
};
@@ -0,0 +1,32 @@
import { type Meta, type StoryObj } from '@storybook/react-vite';
import { IconArrowRight } from '@ui/icon';
import { ComponentDecorator } from '@ui/testing';
import { expect, fn, userEvent, within } from 'storybook/test';
import { RoundedIconButton } from '@ui/input/RoundedIconButton/RoundedIconButton';
const clickJestFn = fn();
const meta: Meta<typeof RoundedIconButton> = {
title: 'UI/Input/Button/RoundedIconButton',
component: RoundedIconButton,
};
export default meta;
type Story = StoryObj<typeof RoundedIconButton>;
export const Default: Story = {
// TODO(a11y): violations inherited from deprecated story; fix during a11y pass
parameters: { a11y: { test: 'todo' } },
decorators: [ComponentDecorator],
argTypes: { Icon: { control: false } },
args: { onClick: clickJestFn, Icon: IconArrowRight },
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
expect(clickJestFn).toHaveBeenCalledTimes(0);
const button = canvas.getByRole('button');
await userEvent.click(button);
expect(clickJestFn).toHaveBeenCalledTimes(1);
},
};