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:
1 parent
dc5e6ff800
commit
f01de83733
185 files changed
+22542
-5182
No files matched your search
@@ -0,0 +1,112 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite'
|
||||
import { Button } from './Button'
|
||||
import { Separator } from './Separator'
|
||||
|
||||
const meta = {
|
||||
title: 'Layout/Separator',
|
||||
component: Separator,
|
||||
tags: ['autodocs'],
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
component:
|
||||
'A thin rule between groups of content, built on Base UI Separator (`role="separator"` with `aria-orientation`). Add a `label` such as "or" in the middle, and use `dashed` for a lighter break. Vertical separators stretch to the height of their flex row.',
|
||||
},
|
||||
},
|
||||
},
|
||||
argTypes: {
|
||||
orientation: { control: 'inline-radio', options: ['horizontal', 'vertical'], table: { defaultValue: { summary: 'horizontal' } } },
|
||||
variant: { control: 'inline-radio', options: ['solid', 'dashed'], table: { defaultValue: { summary: 'solid' } } },
|
||||
label: { control: 'text' },
|
||||
className: { control: 'text' },
|
||||
},
|
||||
args: {
|
||||
orientation: 'horizontal',
|
||||
variant: 'solid',
|
||||
},
|
||||
} satisfies Meta<typeof Separator>
|
||||
|
||||
export default meta
|
||||
type Story = StoryObj<typeof meta>
|
||||
|
||||
export const Playground: Story = {
|
||||
render: (args) => (
|
||||
<div className={args.orientation === 'vertical' ? 'flex h-16 items-center gap-4 text-sm text-fg' : 'grid max-w-md gap-4 text-sm text-fg'}>
|
||||
<span>Account</span>
|
||||
<Separator {...args} />
|
||||
<span>Billing</span>
|
||||
</div>
|
||||
),
|
||||
}
|
||||
|
||||
export const Horizontal: Story = {
|
||||
render: () => (
|
||||
<div className="grid max-w-md gap-4 text-sm">
|
||||
<div>
|
||||
<p className="font-medium text-fg">Jane Doe</p>
|
||||
<p className="text-fg-muted">jane.doe@example.com</p>
|
||||
</div>
|
||||
<Separator />
|
||||
<p className="text-fg-muted">Member of Acme Corporation since March 2021.</p>
|
||||
<Separator variant="dashed" />
|
||||
<p className="text-fg-muted">Dashed separators work well inside forms and lists.</p>
|
||||
</div>
|
||||
),
|
||||
}
|
||||
|
||||
export const Vertical: Story = {
|
||||
render: () => (
|
||||
<div className="grid gap-5 text-sm">
|
||||
<nav aria-label="Footer" className="flex h-5 items-center gap-4 text-fg-muted">
|
||||
<a href="#privacy" className="hover:text-fg">
|
||||
Privacy
|
||||
</a>
|
||||
<Separator orientation="vertical" />
|
||||
<a href="#terms" className="hover:text-fg">
|
||||
Terms
|
||||
</a>
|
||||
<Separator orientation="vertical" />
|
||||
<a href="#status" className="hover:text-fg">
|
||||
Status
|
||||
</a>
|
||||
</nav>
|
||||
<div className="flex h-10 items-center gap-3">
|
||||
<Button size="sm" variant="ghost" color="neutral">
|
||||
Bold
|
||||
</Button>
|
||||
<Button size="sm" variant="ghost" color="neutral">
|
||||
Italic
|
||||
</Button>
|
||||
<Separator orientation="vertical" variant="dashed" />
|
||||
<Button size="sm" variant="ghost" color="neutral">
|
||||
Link
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
}
|
||||
|
||||
export const WithLabel: Story = {
|
||||
parameters: { docs: { description: { story: 'A label in the middle, e.g. between two sign-in methods.' } } },
|
||||
render: () => (
|
||||
<div className="grid max-w-sm gap-5 rounded-xl border border-border bg-surface p-6">
|
||||
<Button variant="outline" color="neutral" fullWidth>
|
||||
Continue with SSO
|
||||
</Button>
|
||||
<Separator label="or" />
|
||||
<Button fullWidth>Continue with email</Button>
|
||||
<Separator label="Recent activity" variant="dashed" />
|
||||
<p className="text-sm text-fg-muted">Last signed in 2 hours ago from Lisbon.</p>
|
||||
</div>
|
||||
),
|
||||
}
|
||||
|
||||
export const VerticalWithLabel: Story = {
|
||||
render: () => (
|
||||
<div className="flex h-40 max-w-md items-stretch gap-4 text-sm">
|
||||
<div className="flex flex-1 items-center justify-center rounded-lg bg-surface-sunken text-fg-muted">Upload a file</div>
|
||||
<Separator orientation="vertical" label="or" />
|
||||
<div className="flex flex-1 items-center justify-center rounded-lg bg-surface-sunken text-fg-muted">Paste a link</div>
|
||||
</div>
|
||||
),
|
||||
}
|
||||
Reference in new issue
Block a user