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,102 @@
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite'
|
||||
import { SIZES } from '../lib/styles'
|
||||
import { Kbd } from './Kbd'
|
||||
|
||||
const meta = {
|
||||
title: 'Display/Kbd',
|
||||
component: Kbd,
|
||||
tags: ['autodocs'],
|
||||
parameters: {
|
||||
docs: {
|
||||
description: {
|
||||
component:
|
||||
'Shows a key or a shortcut. Pass one key as `children`, or a combination as `keys` (`[\'⌘\', \'K\']`), which renders nested `<kbd>` elements with a `separator`. Symbols such as ⌘ and ⇧ are announced by name.',
|
||||
},
|
||||
},
|
||||
},
|
||||
argTypes: {
|
||||
keys: { control: 'object' },
|
||||
separator: { control: 'text', table: { defaultValue: { summary: '+' } } },
|
||||
size: { control: 'inline-radio', options: SIZES, table: { defaultValue: { summary: 'md' } } },
|
||||
children: { control: 'text' },
|
||||
},
|
||||
args: {
|
||||
keys: ['⌘', 'K'],
|
||||
separator: '+',
|
||||
size: 'md',
|
||||
},
|
||||
} satisfies Meta<typeof Kbd>
|
||||
|
||||
export default meta
|
||||
type Story = StoryObj<typeof meta>
|
||||
|
||||
export const Playground: Story = {}
|
||||
|
||||
export const SingleKeys: Story = {
|
||||
args: { keys: undefined },
|
||||
render: (args) => (
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
{['Esc', 'Tab', '⇧', '⌘', '⌥', '↵', '⌫', '↑', '↓', 'A', '/'].map((k) => (
|
||||
<Kbd key={k} size={args.size}>
|
||||
{k}
|
||||
</Kbd>
|
||||
))}
|
||||
</div>
|
||||
),
|
||||
}
|
||||
|
||||
export const Combinations: Story = {
|
||||
render: (args) => (
|
||||
<div className="grid gap-3">
|
||||
<div className="flex flex-wrap items-center gap-4">
|
||||
<Kbd {...args} keys={['⌘', 'K']} />
|
||||
<Kbd {...args} keys={['⌘', '⇧', 'P']} />
|
||||
<Kbd {...args} keys={['Ctrl', 'Alt', 'Delete']} />
|
||||
</div>
|
||||
<div className="flex flex-wrap items-center gap-4">
|
||||
<Kbd {...args} keys={['⌘', 'K']} separator={null} />
|
||||
<Kbd {...args} keys={['G', 'I']} separator="then" />
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
}
|
||||
|
||||
export const Sizes: Story = {
|
||||
render: (args) => (
|
||||
<div className="flex flex-wrap items-center gap-4">
|
||||
{SIZES.map((size) => (
|
||||
<Kbd key={size} {...args} size={size} />
|
||||
))}
|
||||
</div>
|
||||
),
|
||||
}
|
||||
|
||||
export const InContext: Story = {
|
||||
parameters: { docs: { description: { story: 'Shortcut hints in a search field and a shortcut list.' } } },
|
||||
render: () => (
|
||||
<div className="grid max-w-md gap-5">
|
||||
<div className="flex h-10 items-center justify-between rounded-lg border border-border-strong bg-surface px-3 text-sm text-fg-muted">
|
||||
Search components…
|
||||
<Kbd keys={['⌘', 'K']} separator={null} size="sm" />
|
||||
</div>
|
||||
<dl className="divide-y divide-border rounded-xl border border-border bg-surface text-sm">
|
||||
{[
|
||||
['Open command palette', ['⌘', 'K']],
|
||||
['Toggle dark mode', ['⌘', '⇧', 'L']],
|
||||
['Go to inbox', ['G', 'I']],
|
||||
['Close dialog', ['Esc']],
|
||||
].map(([action, keys]) => (
|
||||
<div key={action as string} className="flex items-center justify-between px-4 py-2.5">
|
||||
<dt className="text-fg">{action as string}</dt>
|
||||
<dd>
|
||||
<Kbd keys={keys as string[]} size="sm" />
|
||||
</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
<p className="text-sm text-fg-muted">
|
||||
Press <Kbd size="sm">/</Kbd> to focus search, or <Kbd size="sm">?</Kbd> to see every shortcut.
|
||||
</p>
|
||||
</div>
|
||||
),
|
||||
}
|
||||
Reference in new issue
Block a user