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:
@@ -0,0 +1,74 @@
|
||||
// State rules below only assign CSS custom properties; the actual
|
||||
// declarations live on the flat .button class so twenty-front
|
||||
// styled(LightButton) overrides keep beating them at (0,1,0) specificity,
|
||||
// exactly like the legacy single Linaria class did.
|
||||
// Cascade order replicates the legacy Linaria color switch precedence:
|
||||
// (active || focus) > disabled > accent base — later rules win.
|
||||
|
||||
.button {
|
||||
align-items: center;
|
||||
background: transparent;
|
||||
border: var(--light-button-border, none);
|
||||
border-radius: var(--t-border-radius-sm);
|
||||
box-shadow: var(--light-button-box-shadow, none);
|
||||
color: var(--light-button-color);
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
font-family: var(--t-font-family);
|
||||
font-weight: var(--t-font-weight-regular);
|
||||
gap: var(--t-spacing-1);
|
||||
height: 24px;
|
||||
padding: 0 var(--t-spacing-2);
|
||||
transition: background 0.1s ease;
|
||||
white-space: nowrap;
|
||||
|
||||
&:hover {
|
||||
background: var(
|
||||
--light-button-hover-bg,
|
||||
var(--t-background-transparent-light)
|
||||
);
|
||||
}
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
&:active {
|
||||
background: var(
|
||||
--light-button-active-bg,
|
||||
var(--t-background-transparent-medium)
|
||||
);
|
||||
}
|
||||
|
||||
&[data-disabled] {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
}
|
||||
|
||||
.button[data-accent='secondary'] {
|
||||
--light-button-color: var(--t-font-color-secondary);
|
||||
}
|
||||
|
||||
.button[data-accent='tertiary'] {
|
||||
--light-button-color: var(--t-font-color-tertiary);
|
||||
}
|
||||
|
||||
.button[data-disabled] {
|
||||
--light-button-color: var(--t-font-color-extra-light);
|
||||
--light-button-hover-bg: transparent;
|
||||
--light-button-active-bg: transparent;
|
||||
}
|
||||
|
||||
// active || focus turn the text blue even when disabled, matching the legacy
|
||||
// switch where the (active || focus) branch came first.
|
||||
.button[data-active],
|
||||
.button[data-focus] {
|
||||
--light-button-color: var(--t-color-blue);
|
||||
}
|
||||
|
||||
// focus is gated by !disabled in the component, like the legacy call-site.
|
||||
.button[data-focus] {
|
||||
--light-button-border: 1px solid var(--t-color-blue);
|
||||
--light-button-box-shadow: 0 0 0 3px var(--t-color-blue3);
|
||||
}
|
||||
Reference in New Issue
Block a user