anvilui 0.2.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.
Files changed (58) hide show
  1. package/AGENTS.md +34 -33
  2. package/README.md +42 -89
  3. package/dist/components/AnvilRoot/AnvilRoot.d.ts +2 -2
  4. package/dist/components/Combobox/Combobox.d.ts +8 -2
  5. package/dist/components/DateInput/DateInput.d.ts +5 -3
  6. package/dist/components/FABMenu/FABMenu.d.ts +4 -1
  7. package/dist/components/IconButton/IconButton.d.ts +5 -3
  8. package/dist/components/Input/Input.d.ts +5 -3
  9. package/dist/components/NavigationBar/NavigationBar.d.ts +1 -1
  10. package/dist/components/NavigationList/NavigationList.d.ts +1 -1
  11. package/dist/components/NavigationRail/NavigationRail.d.ts +1 -1
  12. package/dist/components/PinInput/PinInput.d.ts +5 -3
  13. package/dist/components/Progress/Progress.d.ts +4 -1
  14. package/dist/components/RadioGroup/RadioGroup.d.ts +3 -3
  15. package/dist/components/Search/Search.d.ts +22 -6
  16. package/dist/components/Select/Select.d.ts +6 -2
  17. package/dist/components/Skeleton/Skeleton.d.ts +3 -3
  18. package/dist/components/Slider/Slider.d.ts +9 -2
  19. package/dist/components/SquigglyWave/SquigglyWave.d.ts +26 -4
  20. package/dist/components/Textarea/Textarea.d.ts +6 -3
  21. package/dist/components/TimePicker/TimePicker.d.ts +7 -5
  22. package/dist/components/Toggle/Toggle.d.ts +2 -1
  23. package/dist/components/ToggleGroup/ToggleGroup.d.ts +2 -2
  24. package/dist/dev.d.ts +7 -2
  25. package/dist/index.cjs +528 -155
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.css +55 -26
  28. package/dist/index.css.map +1 -1
  29. package/dist/index.js +533 -141
  30. package/dist/index.js.map +1 -1
  31. package/dist/themes/types.d.ts +0 -4
  32. package/dist/utils.d.ts +5 -1
  33. package/docs/avatar.md +1 -1
  34. package/docs/badge.md +41 -41
  35. package/docs/calendar.md +1 -1
  36. package/docs/combobox.md +2 -1
  37. package/docs/composition.md +1 -1
  38. package/docs/date-input.md +4 -3
  39. package/docs/fab-menu.md +1 -0
  40. package/docs/forms.md +2 -2
  41. package/docs/icon-button.md +3 -2
  42. package/docs/input.md +1 -0
  43. package/docs/morph.md +4 -1
  44. package/docs/navigation-bar.md +1 -1
  45. package/docs/navigation-rail.md +1 -1
  46. package/docs/pin-input.md +1 -1
  47. package/docs/progress.md +37 -37
  48. package/docs/radio-group.md +18 -1
  49. package/docs/search.md +7 -7
  50. package/docs/select.md +3 -2
  51. package/docs/skeleton.md +33 -33
  52. package/docs/slider.md +51 -49
  53. package/docs/textarea.md +1 -1
  54. package/docs/theming.md +3 -2
  55. package/docs/time-picker.md +4 -3
  56. package/docs/toggle-group.md +1 -1
  57. package/docs/toggle.md +2 -2
  58. package/package.json +2 -2
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>` and takes no other props (no `style`, `id`, `theme`).
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
 
@@ -100,8 +100,9 @@ export function App() {
100
100
 
101
101
  - `createTheme(primaryHex, { tonal?: hex })` returns `{ light: Theme, dark: Theme }`. Hex only (`'#0B6E4F'` or `'#0B6'`); other formats throw.
102
102
  - `createThemeFromImage(img | File | Blob | url)` returns `Promise<ThemePair>`, browser only. URLs must allow CORS.
103
- - Error, warning and success colors stay the same.
103
+ - Each role keeps the lightness of the base theme, so text stays readable; only hue and colorfulness change. Error, warning and success colors stay the same.
104
104
  - Tweak one role by spreading: `{ ...brand.light, primary: '#…' }`.
105
+ - To switch themes at runtime, keep them in state and pass them as `lightTheme` / `darkTheme`.
105
106
  - Ready-made: `baseLightTheme` / `baseDarkTheme` (purple, the default), `monochromeLightTheme` / `monochromeDarkTheme`.
106
107
 
107
108
  ## Theme roles
@@ -10,15 +10,16 @@ import type { TimePickerProps } from 'anvilui'
10
10
  | Prop | Type | Default | Description |
11
11
  | --- | --- | --- | --- |
12
12
  | `value` / `defaultValue` | `string \| null` | `null` | `"HH:mm"`, e.g. `"07:30"`, `"19:05"`. |
13
- | `onValueChange` | `(value: string) => void` | | On every change. The user can't clear it from the picker; to clear, set `value={null}` yourself (e.g. a Clear button). |
13
+ | `onValueChange` | `(value: string \| null) => void` | | On every change. `null` when the user clears it with the picker's Clear button. |
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. |
21
- | `className`, other `<div>` props | | | On the wrapper. |
21
+ | `ref`, `id`, `aria-*`, `data-*` | | | On the field's button. |
22
+ | `className`, `style`, other `<div>` props | | | On the wrapper. |
22
23
 
23
24
  ```tsx
24
25
  import { useState } from 'react'
@@ -20,7 +20,7 @@ import type { ToggleGroupProps, ToggleGroupItemProps } from 'anvilui'
20
20
  | `disabled` | `boolean` | | |
21
21
  | `aria-label` / `aria-labelledby` | `string` | | Name the group (both are passed through). |
22
22
 
23
- Single mode is a Base UI RadioGroup; multiple mode is a Base UI ToggleGroup. `Value` is inferred from `value`, so a union-typed `useState<'list' | 'grid'>` setter can be passed straight to `onValueChange`.
23
+ Single mode is a Base UI RadioGroup; multiple mode is a Base UI ToggleGroup. `Value` is inferred from `value`, so a union-typed `useState<'list' | 'grid'>` setter can be passed straight to `onValueChange`. With no `value` / `defaultValue`, or in a wrapper typed with `ToggleGroupProps`, it's `unknown`: write `ToggleGroupProps<'list' | 'grid'>`.
24
24
 
25
25
  ## ToggleGroupItem props
26
26
 
package/docs/toggle.md CHANGED
@@ -17,8 +17,8 @@ import type { ToggleProps } from 'anvilui'
17
17
  | `fillType` | `'filled' \| 'outlined' \| 'text'` | `'filled'` | Look while off. |
18
18
  | `children` | `ReactNode` | | Label (text toggle). |
19
19
  | `startIcon`, `endIcon` | `MaterialSymbol` | | Text toggle only. |
20
- | `size` | `'small' \| 'normal' \| 'big'` | `'normal'` | Text toggle only. |
21
- | `icon` | `MaterialSymbol` | | Makes it a round icon toggle. Requires `aria-label`; no children or size. |
20
+ | `size` | `'small' \| 'normal' \| 'big'` | `'normal'` | 32, 40 or 48px, for text and icon toggles. |
21
+ | `icon` | `MaterialSymbol` | | Makes it a round icon toggle. Requires `aria-label`; no children. |
22
22
  | `value` | `string` | | Identifies it in a Base UI ToggleGroup. |
23
23
 
24
24
  Either `children` or `icon` + `aria-label`, not both.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "anvilui",
3
- "version": "0.2.0",
4
- "description": "Material 3 style React components built on Base UI. Ships agent docs in AGENTS.md and docs/.",
3
+ "version": "0.4.0",
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",
7
7
  "type": "module",