Rebuild Tansy UI on Base UI with one API and dark mode (v0.3.0)

Every component is rebuilt on @base-ui/react with a single prop API,
token-only colours and dark mode, and 28 new components are added.

Components
- New: Field, FeaturedTextArea, NumberInput, Combobox, CheckboxGroup,
  Slider, ToggleGroup/Toggle, IconButton, Dialog/Modal, AlertDialog,
  Drawer/Sheet, Popover, InfoTip, DropdownMenu, Tabs, Breadcrumb,
  Pagination, Toast (Toaster, useToast), Progress, Meter, Skeleton,
  CountBadge, Avatar/AvatarGroup, Kbd, Separator, Table
- Rewritten: Button, Input, FeaturedInput, TextArea, Select,
  FeaturedSelect (real ARIA combobox), NativeSelect, Checkbox, Radio,
  Switch, Tooltip, Accordion, Alert, Spinner, Badge, Card
- Removed TextField (use Input) and sonner (use Toast)

Foundations
- Semantic tokens (surfaces, text, borders, status ramps) in
  src/styles/tokens.css, with class-based dark mode
- Visible focus rings, linked labels/descriptions/errors, alert roles by
  severity, keyboard support from Base UI
- Fixed the Classic Blue ramp; Emerald, Amber and Teal 500 steps now
  carry white text at AA
- Library build (per-component ES modules, types, tokens.css, exports)

Quality
- Vitest, Testing Library and axe tests for every component (289 tests)
- scripts/check-stories.mjs renders every story in Chrome and fails on
  errors or axe violations, including contrast; all 423 stories pass in
  light and dark mode and in all seven palettes
- Storybook: controls for every prop, open states for every popup,
  light/dark toolbar, Introduction guides, docs/CONVENTIONS.md

BREAKING CHANGE: component props changed across the kit; see CHANGELOG.md.
This commit is contained in:
thekhalidsha committed 2026-09-28 21:12:11 +05:30
1 parent dc5e6ff800
commit f01de83733
185 files changed
+22542 -5182

No files matched your search

+309 -121
View File
@@ -1,69 +1,6 @@
@import "tailwindcss";
@theme {
--font-sans: "Instrument Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
--font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
--font-display: "Schibsted Grotesk", "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
--shadow-doc: 0 18px 46px -34px rgba(23, 25, 29, 0.38);
/* ------------------------------------------------------------------
Palette token registration.
Tailwind v4 only *generates* a utility class if its colour token is
declared here. The ported components reference `bg-primary-500`,
`text-primary-600`, `border-zink-700` and so on; without these
declarations the build silently emits no rules and those elements
render with no colour at all.
The values below are the Classic Blue defaults. They exist so the
utility classes are generated at build time. The Storybook palette
switcher overrides them at runtime on a wrapper element (see
src/theme/applyPalette.ts), which re-themes without a rebuild.
------------------------------------------------------------------ */
--color-primary-50: #eff6ff;
--color-primary-100: #dbeafe;
--color-primary-200: #bfdbfe;
--color-primary-300: #93c5fd;
--color-primary-400: #60a5fa;
--color-primary-500: #305ddd;
--color-primary-600: #274bc4;
--color-primary-700: #1e3a8a;
--color-primary-800: #1e40af;
--color-primary-900: #1e3a8a;
--color-primary: #305ddd;
--color-secondary-50: #f5f3ff;
--color-secondary-100: #ede9fe;
--color-secondary-200: #ddd6fe;
--color-secondary-300: #c4b5fd;
--color-secondary-400: #a78bfa;
--color-secondary-500: #8b5cf6;
--color-secondary-600: #7c3aed;
--color-secondary-700: #6d28d9;
--color-secondary-800: #5b21b6;
--color-secondary-900: #4c1d95;
--color-secondary: #8b5cf6;
--color-zink-50: #f8f8f9;
--color-zink-100: #f1f2f3;
--color-zink-200: #e4e6e8;
--color-zink-300: #cfd3d6;
--color-zink-400: #9aa2a9;
--color-zink-500: #6b7680;
--color-zink-600: #4d5761;
--color-zink-700: #313a43;
--color-zink-800: #1f262c;
--color-zink-900: #12171b;
--color-zink: #6b7680;
/* Semantic colours used by Alert, Badge and the status components. */
--color-success: #10b981;
--color-warning: #f59e0b;
--color-error: #ef4444;
--color-info: #3b82f6;
--color-danger: #ef4444;
}
@import "./styles/tokens.css";
/* ------------------------------------------------------------------
Tansy UI landing page.
@@ -160,18 +97,21 @@
color: var(--accent);
}
h1,
h2,
h3 {
margin: 0;
font-family: var(--font-display);
color: var(--ink);
text-wrap: balance;
}
/* Element defaults stay in the base layer so component utilities (text-*, font-*) win. */
@layer base {
h1,
h2,
h3 {
margin: 0;
font-family: var(--font-display);
color: var(--ink);
text-wrap: balance;
}
code {
font-family: var(--font-mono);
font-size: 0.8125rem;
code {
font-family: var(--font-mono);
font-size: 0.8125rem;
}
}
/* ---------- Header ---------- */
@@ -188,7 +128,7 @@ code {
.header-inner {
display: flex;
align-items: center;
gap: 2rem;
gap: 1rem;
min-height: 4rem;
}
@@ -218,10 +158,27 @@ code {
color: var(--ink-muted);
}
.version-pill {
padding: 0.15rem 0.55rem;
border: 1px solid var(--line-strong);
border-radius: 999px;
font-family: var(--font-mono);
font-size: 0.75rem;
color: var(--ink-soft);
font-variant-numeric: tabular-nums;
transition: border-color 150ms, color 150ms;
}
.version-pill:hover {
border-color: var(--accent);
color: var(--accent);
}
.header-nav {
display: flex;
gap: 1.5rem;
margin-left: auto;
margin-right: 0.75rem;
font-size: 0.875rem;
font-weight: 500;
color: var(--ink-soft);
@@ -391,8 +348,7 @@ code {
gap: 1.25rem;
}
.playground-intro h2,
.principles-head h2 {
.playground-intro h2 {
font-size: clamp(1.75rem, 3.2vw, 2.4rem);
font-weight: 800;
line-height: 1.08;
@@ -536,53 +492,247 @@ code {
padding: 1rem 1.5rem;
}
/* ---------- Principles ---------- */
/* ---------- Shared section heading ---------- */
.principles {
.section-head {
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.section-head h2 {
max-width: 32rem;
font-size: clamp(1.75rem, 3.2vw, 2.4rem);
font-weight: 800;
line-height: 1.08;
letter-spacing: -0.035em;
}
.section-head-row {
flex-direction: row;
flex-wrap: wrap;
align-items: flex-end;
justify-content: space-between;
gap: 1.5rem;
}
.section-head-row > div {
display: flex;
flex-direction: column;
gap: 0.75rem;
}
/* ---------- Why Tansy ---------- */
.why,
.roadmap {
display: flex;
flex-direction: column;
gap: 2.5rem;
padding-block: 5rem;
}
.principles-head {
display: flex;
flex-direction: column;
gap: 0.75rem;
/* The hero above already ends with generous padding. */
.why {
padding-top: 1rem;
}
.principle-grid {
.why-grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 2.5rem;
gap: 1.25rem;
}
.principle {
.why-card {
display: flex;
flex-direction: column;
gap: 0.6rem;
padding-top: 1.25rem;
border-top: 2px solid var(--ink);
padding: 1.25rem;
border: 1px solid var(--line);
border-radius: 1rem;
background: var(--surface);
}
.principle h3 {
.why-card h3 {
margin-top: 0.6rem;
font-size: 1.125rem;
font-weight: 700;
letter-spacing: -0.015em;
}
.principle p {
margin: 0;
.why-card > p {
flex: 1;
margin: 0;
font-size: 0.9375rem;
color: var(--ink-soft);
}
.principle code {
.why-card > a {
width: fit-content;
padding: 0.2rem 0.5rem;
border-radius: 0.3rem;
background: var(--accent-soft);
color: var(--accent-strong);
font-size: 0.875rem;
font-weight: 600;
color: var(--accent);
}
.why-card > a:hover {
text-decoration: underline;
text-underline-offset: 3px;
}
.why-visual {
display: flex;
flex-direction: column;
justify-content: center;
gap: 1rem;
min-height: 10.5rem;
padding: 1.1rem;
border-radius: 0.75rem;
background: var(--surface-sunk);
}
.why-visual-code {
padding: 0;
background: none;
}
.why-swatches {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
}
.why-swatches button {
width: 1.75rem;
height: 1.75rem;
border: 2px solid var(--surface);
border-radius: 999px;
box-shadow: 0 0 0 1px var(--line-strong);
cursor: pointer;
transition: transform 150ms;
}
.why-swatches button:hover {
transform: scale(1.1);
}
.why-swatches button[aria-pressed="true"] {
box-shadow: 0 0 0 2px var(--ink);
}
.why-buttons {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
}
.why-states {
display: flex;
flex-wrap: wrap;
gap: 0.4rem;
}
.why-stat {
margin: 0;
font-size: 0.875rem;
color: var(--ink-soft);
font-variant-numeric: tabular-nums;
}
.why-stat strong {
color: var(--ink);
}
/* Code sample: a dark panel so it reads as code in any palette. */
.code-sample {
display: flex;
flex-direction: column;
min-height: 10.5rem;
overflow: hidden;
border-radius: 0.75rem;
background: #151923;
color: #d7dce5;
}
.code-sample-bar {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.35rem 0.4rem 0.35rem 0.9rem;
border-bottom: 1px solid rgb(255 255 255 / 0.08);
font-family: var(--font-mono);
font-size: 0.6875rem;
color: #8a93a6;
}
.code-copy {
min-height: 1.75rem;
color: #c3cad6;
}
.code-copy:hover {
background: rgb(255 255 255 / 0.08);
color: #ffffff;
}
.code-sample pre {
margin: 0;
padding: 0.85rem 0.9rem 1rem;
overflow-x: auto;
font-family: var(--font-mono);
font-size: 0.75rem;
line-height: 1.65;
}
.tok-key {
color: #c792ea;
}
.tok-str {
color: #a5d6a7;
}
.tok-tag {
color: #82aaff;
}
/* ---------- Roadmap ---------- */
.roadmap {
border-top: 1px solid var(--line);
}
.roadmap-grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 1.25rem;
margin: 0;
padding: 0;
list-style: none;
}
.roadmap-step {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 0.75rem;
padding-top: 1.25rem;
border-top: 2px solid var(--ink);
}
.roadmap-step h3 {
font-size: 1.25rem;
font-weight: 800;
letter-spacing: -0.02em;
}
.roadmap-step ul {
display: flex;
flex-direction: column;
gap: 0.4rem;
margin: 0;
padding-left: 1.1rem;
list-style: disc;
color: var(--ink-soft);
}
/* ---------- Footer ---------- */
@@ -592,34 +742,64 @@ code {
background: var(--surface);
}
.footer-inner {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
gap: 1rem;
padding-block: 1.75rem;
.footer-grid {
display: grid;
grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr));
gap: 2rem;
padding-block: 3rem;
font-size: 0.875rem;
color: var(--ink-soft);
}
.footer-brand {
display: flex;
flex-direction: column;
gap: 0.6rem;
}
.footer-brand p {
max-width: 18rem;
margin: 0;
}
.footer-logo {
display: inline-flex;
align-items: center;
gap: 0.5rem;
}
.footer-brand strong {
font-family: var(--font-display);
font-size: 1.125rem;
font-weight: 800;
letter-spacing: -0.03em;
color: var(--ink);
}
.footer-nav {
display: flex;
gap: 1.25rem;
.footer-version {
font-family: var(--font-mono);
font-size: 0.75rem;
color: var(--ink-muted);
}
.footer-nav a:hover {
.footer-version a {
color: var(--accent);
}
.footer-col {
display: flex;
flex-direction: column;
gap: 0.55rem;
}
.footer-col h2 {
margin-bottom: 0.25rem;
font-family: var(--font-mono);
font-size: 0.75rem;
font-weight: 500;
letter-spacing: 0.06em;
text-transform: uppercase;
color: var(--ink-muted);
}
.footer-col a:hover {
color: var(--ink);
}
@@ -636,9 +816,17 @@ code {
padding-block: 3rem 4rem;
}
.principle-grid {
.why-grid,
.roadmap-grid {
grid-template-columns: minmax(0, 1fr);
gap: 2rem;
}
.footer-grid {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
.footer-brand {
grid-column: 1 / -1;
}
}
@@ -652,13 +840,8 @@ code {
}
.header-nav,
.brand-ui {
margin-left: 0.22em;
font-weight: 700;
color: var(--ink-muted);
}
.brand-by {
.brand-by,
.version-pill {
display: none;
}
@@ -671,10 +854,15 @@ code {
}
.playground,
.principles {
.why,
.roadmap {
padding-block: 3.5rem;
}
.footer-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.employee-card-body,
.employee-card-header,
.employee-card-footer {