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.
44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
import { readFileSync } from 'node:fs'
|
|
import { fileURLToPath, URL } from 'node:url'
|
|
import react from '@vitejs/plugin-react'
|
|
import { defineConfig } from 'vite'
|
|
|
|
/**
|
|
* Library build: `npm run build:lib` → dist-lib/.
|
|
*
|
|
* One ES module per source file (preserveModules) so apps only bundle the
|
|
* components they import. Dependencies stay external. Types come from
|
|
* `tsc -p tsconfig.lib.json`, and tokens.css is copied alongside.
|
|
*/
|
|
const pkg = JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8')) as {
|
|
version: string
|
|
dependencies: Record<string, string>
|
|
peerDependencies?: Record<string, string>
|
|
}
|
|
const external = [...Object.keys(pkg.dependencies), ...Object.keys(pkg.peerDependencies ?? {})]
|
|
|
|
export default defineConfig({
|
|
define: {
|
|
__TANSY_VERSION__: JSON.stringify(pkg.version),
|
|
},
|
|
plugins: [react()],
|
|
build: {
|
|
outDir: 'dist-lib',
|
|
emptyOutDir: true,
|
|
sourcemap: true,
|
|
copyPublicDir: false,
|
|
lib: {
|
|
entry: fileURLToPath(new URL('./src/index.ts', import.meta.url)),
|
|
formats: ['es'],
|
|
},
|
|
rollupOptions: {
|
|
external: (id) => external.some((dep) => id === dep || id.startsWith(`${dep}/`)) || id.startsWith('react/'),
|
|
output: {
|
|
preserveModules: true,
|
|
preserveModulesRoot: 'src',
|
|
entryFileNames: '[name].js',
|
|
},
|
|
},
|
|
},
|
|
})
|