anvilui 0.3.0 → 0.4.0
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 +8 -7
- package/dist/components/AnvilRoot/AnvilRoot.d.ts +2 -2
- package/dist/components/DateInput/DateInput.d.ts +1 -1
- package/dist/components/FABMenu/FABMenu.d.ts +4 -1
- package/dist/components/NavigationBar/NavigationBar.d.ts +1 -1
- package/dist/components/NavigationList/NavigationList.d.ts +1 -1
- package/dist/components/NavigationRail/NavigationRail.d.ts +1 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
- package/dist/components/Skeleton/Skeleton.d.ts +3 -3
- package/dist/components/Slider/Slider.d.ts +7 -1
- package/dist/dev.d.ts +7 -2
- package/dist/index.cjs +232 -99
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +7 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +210 -66
- package/dist/index.js.map +1 -1
- package/dist/utils.d.ts +1 -1
- package/docs/avatar.md +1 -1
- package/docs/calendar.md +1 -1
- package/docs/fab-menu.md +1 -0
- package/docs/forms.md +1 -1
- package/docs/navigation-bar.md +1 -1
- package/docs/navigation-rail.md +1 -1
- package/docs/radio-group.md +1 -1
- package/docs/skeleton.md +33 -33
- package/docs/slider.md +2 -0
- package/docs/theming.md +1 -1
- package/docs/time-picker.md +1 -1
- package/package.json +1 -1
package/dist/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Ref, RefCallback } from 'react';
|
|
2
2
|
export declare function cx(...parts: (string | false | null | undefined)[]): string;
|
|
3
|
-
export declare function withClass<State>(base: string, className: string | ((state: State) => string | undefined) | undefined): (state: State) => string;
|
|
3
|
+
export declare function withClass<State>(base: string | ((state: State) => string), className: string | ((state: State) => string | undefined) | undefined): (state: State) => string;
|
|
4
4
|
export declare function splitControlProps<P extends object>(props: P): {
|
|
5
5
|
control: Record<string, unknown>;
|
|
6
6
|
rest: P;
|
package/docs/avatar.md
CHANGED
|
@@ -17,7 +17,7 @@ import type { AvatarProps } from 'anvilui'
|
|
|
17
17
|
| `fillType` | `'filled' \| 'outlined' \| 'text'` | `'filled'` | |
|
|
18
18
|
| `children` | `ReactNode` | | Replaces the fallback. |
|
|
19
19
|
|
|
20
|
-
No `alt` prop: use `name
|
|
20
|
+
No `alt` prop: use `name` (an `aria-label` also names it, without showing initials). Leave `name` out when the name is shown next to it.
|
|
21
21
|
|
|
22
22
|
```tsx
|
|
23
23
|
import { Avatar } from 'anvilui'
|
package/docs/calendar.md
CHANGED
|
@@ -9,7 +9,7 @@ import type { CalendarProps } from 'anvilui'
|
|
|
9
9
|
|
|
10
10
|
| Prop | Type | Default | Description |
|
|
11
11
|
| --- | --- | --- | --- |
|
|
12
|
-
| `value` / `defaultValue` | `string \| null` | `null` | |
|
|
12
|
+
| `value` / `defaultValue` | `string \| null` | `null` | The grid shows this date's month, and moves when `value` changes. |
|
|
13
13
|
| `onValueChange` | `(value: string) => void` | | |
|
|
14
14
|
| other | `<div>` props | | |
|
|
15
15
|
|
package/docs/fab-menu.md
CHANGED
|
@@ -21,6 +21,7 @@ import type { FABMenuProps, FABMenuItemProps } from 'anvilui'
|
|
|
21
21
|
| `align` | `'start' \| 'center' \| 'end'` | `'end'` | |
|
|
22
22
|
| `sticky` | `boolean` | `true` | |
|
|
23
23
|
| `className` | `string` | | Goes on the FAB. |
|
|
24
|
+
| `ref` | `Ref<HTMLButtonElement>` | | The FAB's `<button>`. |
|
|
24
25
|
| `open` / `defaultOpen` / `onOpenChange` | | | Base UI Menu.Root state. |
|
|
25
26
|
|
|
26
27
|
## FABMenuItem props
|
package/docs/forms.md
CHANGED
|
@@ -71,7 +71,7 @@ Rules:
|
|
|
71
71
|
- Put the `name` on `Field` (or on the control when there's no Field).
|
|
72
72
|
- Native rules (`required`, `type="email"`, `minLength`, `pattern`, …) block a plain `<form>`'s submit and show in `FieldError`. This includes `<Checkbox required />` and `<DateInput required />`.
|
|
73
73
|
- Custom rules: `validate={(value) => value ? null : 'Required'}` returns an error string or `null`. A failing `validate` blocks submit once it has run, so on a plain `<form>` use `validationMode="onBlur"` or `"onChange"` with it (the default is `"onSubmit"`). Keep a final check in `onSubmit` for anything that must hold.
|
|
74
|
-
- Controls that work inside `Field`: `Input`, `Textarea`, `DateInput`, `Select`, `Combobox`, `Checkbox`, `Switch`, `RadioGroup`, `Slider`.
|
|
74
|
+
- Controls that work inside `Field`: `Input`, `Textarea`, `DateInput`, `Select`, `Combobox`, `Checkbox`, `Switch`, `RadioGroup`, `Slider`. Not `TimePicker`: the Field's `name`, `disabled` and validation don't reach it, so give it its own `name` and `disabled`.
|
|
75
75
|
- `Button loading` disables the button, so it also blocks repeat submits.
|
|
76
76
|
- `Select` with `name` submits the item's `value`, not its label. `DateInput` submits `"YYYY-MM-DD"` and `TimePicker` `"HH:mm"`, not the text they show.
|
|
77
77
|
- Server errors: `<Field invalid>` plus `<FieldError match>` with your message (`match` true shows it whenever the field is invalid).
|
package/docs/navigation-bar.md
CHANGED
|
@@ -9,7 +9,7 @@ import { NavigationBar, NavigationBarItem } from 'anvilui'
|
|
|
9
9
|
| Part | Renders | Props |
|
|
10
10
|
| --- | --- | --- |
|
|
11
11
|
| `NavigationBar` | `<nav>` | Give it `aria-label`. |
|
|
12
|
-
| `NavigationBarItem` | `<a>` | `icon: MaterialSymbol` (required), `label: string` (required), `active?: boolean` (sets `aria-current="page"`), `href`, `render` (router link) |
|
|
12
|
+
| `NavigationBarItem` | `<a>` | `icon: MaterialSymbol` (required), `label: string` (required; not children), `active?: boolean` (sets `aria-current="page"`), `href`, `render` (router link) |
|
|
13
13
|
|
|
14
14
|
Items are links, not tabs: there's no `value` / `onValueChange`. Mark the current one with `active`.
|
|
15
15
|
|
package/docs/navigation-rail.md
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
| --- | --- | --- |
|
|
15
15
|
| `NavigationRail` | `<nav>` (96px wide, `height: 100%`) | `aria-label`; `expanded` / `defaultExpanded` (false) / `onExpandedChange(expanded)` |
|
|
16
16
|
| `NavigationRailToggle` | `IconButton` (menu icon) | `aria-label` required. Must be inside the rail. |
|
|
17
|
-
| `NavigationRailItem` | `<a>` | `icon` (required), `label: string` (required), `active`, `end` (short badge text, e.g. a count), `href`, `render` |
|
|
17
|
+
| `NavigationRailItem` | `<a>` | `icon` (required), `label: string` (required; not children), `active`, `end` (short badge text, e.g. a count), `href`, `render` |
|
|
18
18
|
|
|
19
19
|
```tsx
|
|
20
20
|
import {
|
package/docs/radio-group.md
CHANGED
|
@@ -14,7 +14,7 @@ import type { RadioGroupProps, RadioProps } from 'anvilui'
|
|
|
14
14
|
| `value` / `defaultValue` | `Value` | The picked radio's value. |
|
|
15
15
|
| `onValueChange` | `(value: Value, details) => void` | |
|
|
16
16
|
| `name`, `required`, `disabled`, `readOnly` | | |
|
|
17
|
-
| `aria-label` / `aria-labelledby` | `string` | Name the group
|
|
17
|
+
| `aria-label` / `aria-labelledby` | `string` | Name the group, or put it in a `<fieldset>` with a `<legend>`. |
|
|
18
18
|
|
|
19
19
|
## Radio props (Base UI Radio.Root)
|
|
20
20
|
|
package/docs/skeleton.md
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
# Skeleton
|
|
2
|
-
|
|
3
|
-
A pulsing placeholder while content loads. Hidden from screen readers; put `aria-busy` on the loading region.
|
|
4
|
-
|
|
5
|
-
```ts
|
|
6
|
-
import { Skeleton } from 'anvilui'
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
| Prop | Type | Default | Description |
|
|
10
|
-
| --- | --- | --- | --- |
|
|
11
|
-
| `
|
|
12
|
-
| `animation` | `'pulse' \| 'none'` | `'pulse'` | |
|
|
13
|
-
|
|
14
|
-
Size it with `style` (`width`, `height`). No `width` / `height` props. Renders a `<span>`.
|
|
15
|
-
|
|
16
|
-
```tsx
|
|
17
|
-
import { Skeleton } from 'anvilui'
|
|
18
|
-
|
|
19
|
-
export function Example() {
|
|
20
|
-
return (
|
|
21
|
-
<div
|
|
22
|
-
aria-busy="true"
|
|
23
|
-
style={{ display: 'flex', gap: 12, alignItems: 'center' }}
|
|
24
|
-
>
|
|
25
|
-
<Skeleton
|
|
26
|
-
<div style={{ display: 'grid', gap: 4, flex: 1 }}>
|
|
27
|
-
<Skeleton style={{ width: '40%' }} />
|
|
28
|
-
<Skeleton style={{ width: '70%' }} />
|
|
29
|
-
</div>
|
|
30
|
-
</div>
|
|
31
|
-
)
|
|
32
|
-
}
|
|
33
|
-
```
|
|
1
|
+
# Skeleton
|
|
2
|
+
|
|
3
|
+
A pulsing placeholder while content loads. Hidden from screen readers; put `aria-busy` on the loading region.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { Skeleton } from 'anvilui'
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Default | Description |
|
|
10
|
+
| --- | --- | --- | --- |
|
|
11
|
+
| `type` | `'text' \| 'circular' \| 'rectangular'` | `'text'` | The shape. Not `variant`. |
|
|
12
|
+
| `animation` | `'pulse' \| 'none'` | `'pulse'` | |
|
|
13
|
+
|
|
14
|
+
Size it with `style` (`width`, `height`). No `width` / `height` props. Renders a `<span>`.
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import { Skeleton } from 'anvilui'
|
|
18
|
+
|
|
19
|
+
export function Example() {
|
|
20
|
+
return (
|
|
21
|
+
<div
|
|
22
|
+
aria-busy="true"
|
|
23
|
+
style={{ display: 'flex', gap: 12, alignItems: 'center' }}
|
|
24
|
+
>
|
|
25
|
+
<Skeleton type="circular" style={{ width: 40, height: 40 }} />
|
|
26
|
+
<div style={{ display: 'grid', gap: 4, flex: 1 }}>
|
|
27
|
+
<Skeleton style={{ width: '40%' }} />
|
|
28
|
+
<Skeleton style={{ width: '70%' }} />
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
```
|
package/docs/slider.md
CHANGED
|
@@ -13,6 +13,7 @@ import type { SliderProps } from 'anvilui'
|
|
|
13
13
|
| --- | --- | --- | --- |
|
|
14
14
|
| `label` | `ReactNode` | | Visible label above. Either this or `aria-label`. |
|
|
15
15
|
| `aria-label` | `string` | | |
|
|
16
|
+
| `getAriaLabel` | `(index: number) => string` | | Names each handle of a range ("Minimum price", "Maximum price"). Without it, every handle gets the same name. |
|
|
16
17
|
| `value` / `defaultValue` | `number` or `number[]` | | An array makes a range with that many handles. |
|
|
17
18
|
| `onValueChange` | `(value, details) => void` | | While dragging. Gets the value, not an event: `number` when `value` is a number, `number[]` when it's an array, so a `useState` setter can be passed directly. |
|
|
18
19
|
| `onValueCommitted` | `(value, details) => void` | | On release. |
|
|
@@ -37,6 +38,7 @@ export function Example() {
|
|
|
37
38
|
<Slider label="Volume" value={volume} onValueChange={setVolume} />
|
|
38
39
|
<Slider
|
|
39
40
|
aria-label="Price"
|
|
41
|
+
getAriaLabel={(i) => (i === 0 ? 'Minimum price' : 'Maximum price')}
|
|
40
42
|
value={price}
|
|
41
43
|
onValueChange={setPrice}
|
|
42
44
|
min={0}
|
package/docs/theming.md
CHANGED
|
@@ -37,7 +37,7 @@ import type {
|
|
|
37
37
|
| `darkTheme` | `Theme` | `baseDarkTheme` | Colors in dark mode. |
|
|
38
38
|
| `tokens` | `Partial<DesignTokens>` | `baseDesignTokens` | Spacing, radius, fonts, motion, shadows. Each category you pass **replaces** the whole default category. |
|
|
39
39
|
|
|
40
|
-
AnvilRoot renders a `<div
|
|
40
|
+
AnvilRoot renders a `<div>`, and other `<div>` props (`style`, `id`, `ref`, `data-*`, ...) go on it. There is no `theme` prop: use `lightTheme` / `darkTheme`.
|
|
41
41
|
|
|
42
42
|
## Color mode
|
|
43
43
|
|
package/docs/time-picker.md
CHANGED
|
@@ -14,7 +14,7 @@ import type { TimePickerProps } from 'anvilui'
|
|
|
14
14
|
| `type` | `'dial' \| 'input'` | `'dial'` | |
|
|
15
15
|
| `hourCycle` | `12 \| 24` | user's locale | 12 shows AM/PM. |
|
|
16
16
|
| `label` | `ReactNode` | | Either this or `aria-label`. |
|
|
17
|
-
| `name` | `string` | | Submits `"HH:mm"` with a form. |
|
|
17
|
+
| `name` | `string` | | Submits `"HH:mm"` with a form. Put it on TimePicker itself: it doesn't work inside a `Field`. |
|
|
18
18
|
| `size` | `'small' \| 'normal'` | `'normal'` | |
|
|
19
19
|
| `disabled` | `boolean` | `false` | |
|
|
20
20
|
| `open` / `defaultOpen` / `onOpenChange` | | | The popup. |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "anvilui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Material 3 Expressive for React, pushed further: playful, accessible components built on Base UI. Ships agent docs in AGENTS.md and docs/.",
|
|
5
5
|
"author": "itayvak",
|
|
6
6
|
"license": "MIT",
|