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,45 @@
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { expectNoA11yViolations } from '../test/a11y'
|
||||
import { Meter, Progress } from './Progress'
|
||||
|
||||
describe('Progress', () => {
|
||||
it('exposes the value on a labelled progressbar', () => {
|
||||
render(<Progress value={40} label="Exporting" showValue />)
|
||||
const bar = screen.getByRole('progressbar', { name: 'Exporting' })
|
||||
expect(bar).toHaveAttribute('aria-valuenow', '40')
|
||||
expect(bar).toHaveAttribute('aria-valuemax', '100')
|
||||
expect(screen.getByText('40%')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('is indeterminate with value null', () => {
|
||||
render(<Progress value={null} aria-label="Preparing" />)
|
||||
const bar = screen.getByRole('progressbar', { name: 'Preparing' })
|
||||
expect(bar).not.toHaveAttribute('aria-valuenow')
|
||||
})
|
||||
|
||||
it('formats with a function', () => {
|
||||
render(<Progress value={3} max={8} label="Uploading" showValue format={(v, max) => `${v} of ${max} files`} />)
|
||||
expect(screen.getByText('3 of 8 files')).toBeInTheDocument()
|
||||
expect(screen.getByRole('progressbar')).toHaveAttribute('aria-valuetext', '3 of 8 files')
|
||||
})
|
||||
|
||||
it('has no axe violations', async () => {
|
||||
const { container } = render(
|
||||
<div>
|
||||
<Progress value={40} label="Exporting" showValue />
|
||||
<Progress value={null} aria-label="Loading" />
|
||||
<Meter value={7} max={10} label="Storage used" showValue />
|
||||
</div>,
|
||||
)
|
||||
await expectNoA11yViolations(container)
|
||||
})
|
||||
})
|
||||
|
||||
describe('Meter', () => {
|
||||
it('is a labelled meter with its value', () => {
|
||||
render(<Meter value={92} label="API requests" showValue />)
|
||||
const meter = screen.getByRole('meter', { name: 'API requests' })
|
||||
expect(meter).toHaveAttribute('aria-valuenow', '92')
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user