@boostdev/design-system-components 1.2.1 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +26 -0
- package/README.md +36 -19
- package/dist/client.cjs +141 -120
- package/dist/client.css +506 -503
- package/dist/client.d.cts +71 -96
- package/dist/client.d.ts +71 -96
- package/dist/client.js +141 -120
- package/dist/index.cjs +141 -120
- package/dist/index.css +506 -503
- package/dist/index.d.cts +71 -96
- package/dist/index.d.ts +71 -96
- package/dist/index.js +141 -120
- package/package.json +3 -3
- package/src/components/interaction/Button/Button.module.css +1 -4
- package/src/components/interaction/Command/Command.tsx +4 -3
- package/src/components/interaction/Dialog/Dialog.module.css +1 -1
- package/src/components/interaction/Dialog/Dialog.tsx +4 -5
- package/src/components/interaction/Drawer/Drawer.module.css +1 -1
- package/src/components/interaction/Drawer/Drawer.spec.tsx +3 -3
- package/src/components/interaction/Drawer/Drawer.tsx +4 -7
- package/src/components/interaction/DropdownMenu/DropdownMenu.module.css +4 -0
- package/src/components/interaction/DropdownMenu/DropdownMenu.stories.tsx +4 -4
- package/src/components/interaction/DropdownMenu/DropdownMenu.tsx +4 -2
- package/src/components/interaction/Popover/Popover.tsx +4 -3
- package/src/components/interaction/Rating/Rating.tsx +4 -2
- package/src/components/interaction/form/CheckboxGroup/CheckboxGroup.tsx +4 -6
- package/src/components/interaction/form/Combobox/Combobox.module.css +1 -1
- package/src/components/interaction/form/Combobox/Combobox.tsx +4 -2
- package/src/components/interaction/form/FileInput/FileInput.tsx +4 -3
- package/src/components/interaction/form/FormInput/FormInput.module.css +1 -1
- package/src/components/interaction/form/NumberInput/NumberInput.module.css +1 -1
- package/src/components/interaction/form/NumberInput/NumberInput.tsx +4 -3
- package/src/components/interaction/form/RadioGroup/RadioGroup.tsx +4 -6
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.module.css +5 -5
- package/src/components/interaction/form/SegmentedControl/SegmentedControl.tsx +4 -6
- package/src/components/interaction/form/Select/Select.module.css +1 -1
- package/src/components/interaction/form/Slider/Slider.module.css +4 -4
- package/src/components/interaction/form/Switch/Switch.module.css +3 -3
- package/src/components/interaction/form/atoms/InputContainer.tsx +2 -2
- package/src/components/layout/ButtonGroup/ButtonGroup.tsx +4 -6
- package/src/components/layout/Card/Card.tsx +4 -10
- package/src/components/layout/IconWrapper/IconWrapper.module.css +1 -1
- package/src/components/layout/IconWrapper/IconWrapper.tsx +4 -5
- package/src/components/layout/SectionHeader/SectionHeader.tsx +5 -4
- package/src/components/ui/Accordion/Accordion.tsx +4 -3
- package/src/components/ui/Alert/Alert.module.css +1 -1
- package/src/components/ui/Alert/Alert.tsx +4 -3
- package/src/components/ui/Avatar/Avatar.module.css +1 -1
- package/src/components/ui/Avatar/Avatar.tsx +5 -3
- package/src/components/ui/Badge/Badge.module.css +1 -1
- package/src/components/ui/Badge/Badge.tsx +4 -5
- package/src/components/ui/Breadcrumb/Breadcrumb.tsx +4 -3
- package/src/components/ui/Calendar/Calendar.module.css +2 -2
- package/src/components/ui/Calendar/Calendar.tsx +4 -4
- package/src/components/ui/Carousel/Carousel.module.css +1 -1
- package/src/components/ui/Carousel/Carousel.tsx +4 -4
- package/src/components/ui/DescriptionList/DescriptionList.tsx +4 -4
- package/src/components/ui/Loading/Loading.module.css +1 -1
- package/src/components/ui/Loading/Loading.tsx +4 -3
- package/src/components/ui/NotificationBanner/NotificationBanner.module.css +1 -1
- package/src/components/ui/NotificationBanner/NotificationBanner.tsx +4 -2
- package/src/components/ui/Pagination/Pagination.module.css +5 -1
- package/src/components/ui/Pagination/Pagination.tsx +4 -2
- package/src/components/ui/Progress/Progress.module.css +2 -2
- package/src/components/ui/Progress/Progress.tsx +4 -2
- package/src/components/ui/ProgressCircle/ProgressCircle.tsx +4 -1
- package/src/components/ui/Separator/Separator.tsx +5 -3
- package/src/components/ui/Skeleton/Skeleton.tsx +4 -3
- package/src/components/ui/SkipLink/SkipLink.tsx +4 -5
- package/src/components/ui/Tabs/Tabs.tsx +4 -4
- package/src/components/ui/Tooltip/Tooltip.module.css +1 -1
- package/src/components/ui/Tooltip/Tooltip.tsx +4 -2
- package/src/components/ui/Typography/Typography.tsx +4 -5
- package/src/stories/DesignSystem/Grid.mdx +2 -0
package/AGENTS.md
CHANGED
|
@@ -158,6 +158,11 @@ Apply this pattern to any component with a visually distinct active/selected/fil
|
|
|
158
158
|
- Shadow: use elevation scale (`--bds-shadow_s` … `--bds-shadow_2xl`). Shadows use `--bds-shadow_color-rgb` internally — override this token to theme shadow colour.
|
|
159
159
|
- Z-index: use named role tokens, never raw integers
|
|
160
160
|
- Focus-visible outlines: use `--bds-outline_default` (2px dotted, adapts to dark mode). `--bds-outline_color` is the colour token; `--bds-outline_offset` is the offset (2px outside). These are distinct from the inset `--bdc-outline_*` border system.
|
|
161
|
+
- Border radius: use foundation tokens, never raw `px` or `%` values. Key tokens:
|
|
162
|
+
- `--bds-border_radius--full` (9999px) — pill shape for buttons, inputs, badges, tracks
|
|
163
|
+
- `--bds-border_radius--circle` (50%) — perfect circle for avatars, thumbs, close buttons, spinners
|
|
164
|
+
- `--bds-border_radius--xs` / `--s` / `--m` — standard rounded corners
|
|
165
|
+
- Always wrap in a component-scoped override: `var(--component_radius, var(--bds-border_radius--full))`
|
|
161
166
|
- Dark mode: foundation tokens adapt automatically via `[data-theme="dark"]` attribute or `prefers-color-scheme: dark`. No extra CSS needed in components.
|
|
162
167
|
|
|
163
168
|
### Semantic tokens for state colours
|
|
@@ -224,6 +229,27 @@ References: https://developer.mozilla.org/en-US/docs/Web/Accessibility | https:/
|
|
|
224
229
|
- **State guard in open/close methods**: `_open()` and `_close()` on stateful web components must return early if already in the target state, to prevent dispatching redundant events to listeners.
|
|
225
230
|
- **Drawer/Dialog animation**: `<dialog>` is the sliding panel itself — no wrapper div. Slide animation uses `translate` + `@starting-style` only. Do **not** add `@keyframes` — mixing `@keyframes` (open) with `translate` transition (close) causes a stutter. Backdrop uses `opacity: 0` as default with `@starting-style { opacity: 0 }` on `[open]::backdrop` for a smooth fade. `display` and `overlay` discrete transitions must include the easing function before `allow-discrete`.
|
|
226
231
|
|
|
232
|
+
## HTML attribute forwarding
|
|
233
|
+
|
|
234
|
+
All components accept the full set of native HTML attributes for their root element. Props interfaces extend the appropriate `HTMLAttributes<HTMLXxxElement>` type and spread `...rest` onto the root element:
|
|
235
|
+
|
|
236
|
+
```tsx
|
|
237
|
+
interface BadgeProps extends WithClassName, HTMLAttributes<HTMLSpanElement> {
|
|
238
|
+
variant?: 'primary' | 'secondary' | 'success' | 'error' | 'warning';
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export function Badge({ variant = 'primary', className, children, ...rest }: BadgeProps) {
|
|
242
|
+
return <span {...rest} className={cn(css.badge, className)}>{children}</span>;
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
Key patterns:
|
|
247
|
+
- Spread `{...rest}` **before** component-controlled attributes so explicit props always win
|
|
248
|
+
- Use `Omit<HTMLAttributes<...>, 'prop'>` when a custom prop has an incompatible type with the HTML attribute (e.g. `title` as `ReactNode` instead of `string`, `onChange` with a custom signature, `content` as `ReactNode`)
|
|
249
|
+
- Components wrapping `<fieldset>` use `FieldsetHTMLAttributes<HTMLFieldSetElement>`
|
|
250
|
+
- Components wrapping `<a>` use `AnchorHTMLAttributes<HTMLAnchorElement>`
|
|
251
|
+
- Composite form components (Combobox, NumberInput, FileInput) forward `...rest` through `InputContainer`
|
|
252
|
+
|
|
227
253
|
## Adding new components
|
|
228
254
|
|
|
229
255
|
1. Create `src/components/{category}/{ComponentName}/`
|
package/README.md
CHANGED
|
@@ -149,7 +149,7 @@ Renders an `aria-hidden` shimmer block. Size it with a `className` or inline sty
|
|
|
149
149
|
import { Button } from '@boostdev/components';
|
|
150
150
|
|
|
151
151
|
<Button>Click me</Button>
|
|
152
|
-
<Button variant="
|
|
152
|
+
<Button variant="outline">Cancel</Button>
|
|
153
153
|
<Button size="small">Small</Button>
|
|
154
154
|
<Button href="/dashboard">Link button</Button>
|
|
155
155
|
<Button iconStart={<Icon />} aria-label="Delete" />
|
|
@@ -158,7 +158,7 @@ import { Button } from '@boostdev/components';
|
|
|
158
158
|
|
|
159
159
|
| Prop | Type | Default |
|
|
160
160
|
|---|---|---|
|
|
161
|
-
| `variant` | `'default' \| '
|
|
161
|
+
| `variant` | `'default' \| 'outline'` | `'default'` |
|
|
162
162
|
| `size` | `'small' \| 'medium' \| 'large'` | `'medium'` |
|
|
163
163
|
| `href` | `string` | — renders an `<a>` |
|
|
164
164
|
| `iconStart` | `ReactNode` | — |
|
|
@@ -167,8 +167,8 @@ import { Button } from '@boostdev/components';
|
|
|
167
167
|
| `disabled` | `boolean` | `false` |
|
|
168
168
|
|
|
169
169
|
**Variants:**
|
|
170
|
-
- `default` — filled with `--button_color
|
|
171
|
-
- `
|
|
170
|
+
- `default` — filled with `--button_color`. Hover transitions to an outlined state.
|
|
171
|
+
- `outline` — transparent background, border and text use `--button_color`. Hover fills. (`ghost` is a deprecated alias.)
|
|
172
172
|
|
|
173
173
|
**Re-theming** — set two CSS custom properties to change the colour of both variants:
|
|
174
174
|
|
|
@@ -243,7 +243,7 @@ Toasts auto-dismiss after 5 seconds.
|
|
|
243
243
|
|
|
244
244
|
### Form components
|
|
245
245
|
|
|
246
|
-
All
|
|
246
|
+
All components accept native HTML attributes for their root element via `...rest` spread in addition to their own props. This means you can pass `id`, `data-*`, `aria-*`, `style`, event handlers, and any other valid HTML attribute directly.
|
|
247
247
|
|
|
248
248
|
#### FormInput
|
|
249
249
|
|
|
@@ -309,20 +309,20 @@ Sizes: `small` · `medium` (default) · `large`
|
|
|
309
309
|
```tsx
|
|
310
310
|
import { SegmentedControl } from '@boostdev/components';
|
|
311
311
|
|
|
312
|
-
<SegmentedControl
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
312
|
+
<SegmentedControl aria-label="Calendar view" selectedIndex={1}>
|
|
313
|
+
<button>Day</button>
|
|
314
|
+
<button>Week</button>
|
|
315
|
+
<button>Month</button>
|
|
316
|
+
</SegmentedControl>
|
|
317
|
+
|
|
318
|
+
{/* Navigation variant — active item auto-detected from aria-current */}
|
|
319
|
+
<SegmentedControl aria-label="Section">
|
|
320
|
+
<a href="/overview" aria-current="page">Overview</a>
|
|
321
|
+
<a href="/details">Details</a>
|
|
322
|
+
</SegmentedControl>
|
|
323
323
|
```
|
|
324
324
|
|
|
325
|
-
|
|
325
|
+
Children-based API — pass `<button>`, `<a>`, or router `<Link>` elements directly. Active item is set via `selectedIndex` or auto-detected from `aria-current="page"` / `aria-pressed={true}` / `aria-selected={true}`. Variants: `outline` (default) · `filled`. Sizes: `small` · `medium` (default) · `large`.
|
|
326
326
|
|
|
327
327
|
---
|
|
328
328
|
|
|
@@ -362,7 +362,7 @@ import { Card } from '@boostdev/components';
|
|
|
362
362
|
| `variant` | `'default' \| 'elevated' \| 'outlined'` | `'default'` |
|
|
363
363
|
| `padding` | `'none' \| 'small' \| 'medium' \| 'large'` | `'medium'` |
|
|
364
364
|
| `textAlign` | `'start' \| 'center' \| 'end'` | `'start'` |
|
|
365
|
-
| `onClick` | `
|
|
365
|
+
| `onClick` | `MouseEventHandler<HTMLElement>` | — renders a `<button>` |
|
|
366
366
|
|
|
367
367
|
---
|
|
368
368
|
|
|
@@ -447,6 +447,23 @@ All component styles sit in `@layer component`. You can also write rules in a hi
|
|
|
447
447
|
}
|
|
448
448
|
```
|
|
449
449
|
|
|
450
|
+
### Overriding border-radius
|
|
451
|
+
|
|
452
|
+
Components default to pill (`--bds-border_radius--full`) or circle (`--bds-border_radius--circle`)
|
|
453
|
+
shapes from the foundation. Override the component-scoped variable to change individual components:
|
|
454
|
+
|
|
455
|
+
```css
|
|
456
|
+
/* Make all buttons square-cornered */
|
|
457
|
+
.my-button {
|
|
458
|
+
--button_radius: var(--bds-border_radius--s);
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/* Make avatars rounded-square instead of circular */
|
|
462
|
+
.my-avatar {
|
|
463
|
+
--avatar_radius: var(--bds-border_radius--m);
|
|
464
|
+
}
|
|
465
|
+
```
|
|
466
|
+
|
|
450
467
|
### Overriding active/checked state colour
|
|
451
468
|
|
|
452
469
|
Components with a checked or filled state (Checkbox, Radio, Slider, Progress, ProgressCircle)
|
|
@@ -515,7 +532,7 @@ pnpm build # compile to dist/
|
|
|
515
532
|
pnpm typecheck # TypeScript check (library code only)
|
|
516
533
|
pnpm lint # ESLint
|
|
517
534
|
pnpm lint:css # Stylelint
|
|
518
|
-
pnpm test # Vitest —
|
|
535
|
+
pnpm test # Vitest — 857 tests
|
|
519
536
|
pnpm mcp:start # Start the MCP server locally (http://localhost:3001/api/mcp)
|
|
520
537
|
pnpm storybook # Storybook dev server on port 6006
|
|
521
538
|
```
|