anvilui 0.1.0 → 0.2.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 (142) hide show
  1. package/AGENTS.md +483 -0
  2. package/README.md +70 -3
  3. package/bin/anvilui.mjs +83 -0
  4. package/dist/colors/colors.d.ts +10 -2
  5. package/dist/components/Accordion/Accordion.d.ts +36 -0
  6. package/dist/components/AnimatedNumber/AnimatedNumber.d.ts +17 -0
  7. package/dist/components/AnvilRoot/AnvilContext.d.ts +22 -2
  8. package/dist/components/AnvilRoot/AnvilRoot.d.ts +44 -6
  9. package/dist/components/AppBar/AppBar.d.ts +13 -2
  10. package/dist/components/Avatar/Avatar.d.ts +6 -2
  11. package/dist/components/Avatar/AvatarGroupContext.d.ts +1 -0
  12. package/dist/components/AvatarGroup/AvatarGroup.d.ts +25 -0
  13. package/dist/components/Badge/Badge.d.ts +4 -0
  14. package/dist/components/BottomSheet/BottomSheet.d.ts +22 -0
  15. package/dist/components/Button/Button.d.ts +17 -0
  16. package/dist/components/Calendar/Calendar.d.ts +19 -0
  17. package/dist/components/Card/Card.d.ts +36 -0
  18. package/dist/components/Carousel/Carousel.d.ts +21 -0
  19. package/dist/components/Checkbox/Checkbox.d.ts +10 -0
  20. package/dist/components/Chip/Chip.d.ts +25 -2
  21. package/dist/components/Combobox/Combobox.d.ts +42 -0
  22. package/dist/components/Confetti/Confetti.d.ts +31 -0
  23. package/dist/components/ContextMenu/ContextMenu.d.ts +24 -0
  24. package/dist/components/DateInput/DateInput.d.ts +37 -0
  25. package/dist/components/Dialog/Dialog.d.ts +32 -0
  26. package/dist/components/Divider/Divider.d.ts +8 -0
  27. package/dist/components/FAB/FAB.d.ts +4 -0
  28. package/dist/components/FAB/magnet.d.ts +2 -0
  29. package/dist/components/FABMenu/FABMenu.d.ts +55 -0
  30. package/dist/components/Field/Field.d.ts +20 -0
  31. package/dist/components/FloatingToolbar/FloatingToolbar.d.ts +15 -0
  32. package/dist/components/HoldButton/HoldButton.d.ts +4 -1
  33. package/dist/components/Icon/Icon.d.ts +14 -0
  34. package/dist/components/IconButton/IconButton.d.ts +11 -0
  35. package/dist/components/Input/Input.d.ts +9 -0
  36. package/dist/components/Kbd/Kbd.d.ts +21 -0
  37. package/dist/components/List/List.d.ts +10 -1
  38. package/dist/components/Menu/Menu.d.ts +32 -0
  39. package/dist/components/Menubar/Menubar.d.ts +17 -0
  40. package/dist/components/NavigationBar/NavigationBar.d.ts +10 -0
  41. package/dist/components/NavigationDrawer/NavigationDrawer.d.ts +22 -0
  42. package/dist/components/NavigationList/NavigationList.d.ts +27 -0
  43. package/dist/components/NavigationRail/NavigationRail.d.ts +25 -9
  44. package/dist/components/PinInput/PinInput.d.ts +31 -0
  45. package/dist/components/Popover/Popover.d.ts +30 -2
  46. package/dist/components/PreviewCard/PreviewCard.d.ts +31 -0
  47. package/dist/components/Progress/Progress.d.ts +8 -1
  48. package/dist/components/RadioGroup/RadioGroup.d.ts +12 -0
  49. package/dist/components/Search/Search.d.ts +39 -0
  50. package/dist/components/Select/Select.d.ts +15 -2
  51. package/dist/components/Skeleton/Skeleton.d.ts +20 -0
  52. package/dist/components/Slider/Slider.d.ts +5 -0
  53. package/dist/components/Snackbar/Snackbar.d.ts +7 -2
  54. package/dist/components/SplitButton/SplitButton.d.ts +13 -0
  55. package/dist/components/Sticker/Sticker.d.ts +21 -0
  56. package/dist/components/Switch/Switch.d.ts +11 -0
  57. package/dist/components/Table/Table.d.ts +36 -0
  58. package/dist/components/Tabs/Tabs.d.ts +17 -0
  59. package/dist/components/Textarea/Textarea.d.ts +8 -0
  60. package/dist/components/TimePicker/TimePicker.d.ts +45 -0
  61. package/dist/components/Toggle/Toggle.d.ts +41 -0
  62. package/dist/components/ToggleGroup/ToggleGroup.d.ts +14 -2
  63. package/dist/components/Tooltip/Tooltip.d.ts +10 -1
  64. package/dist/components/Typography/Typography.d.ts +13 -1
  65. package/dist/datetime.d.ts +12 -0
  66. package/dist/dev.d.ts +15 -0
  67. package/dist/index.cjs +3105 -634
  68. package/dist/index.cjs.map +1 -1
  69. package/dist/index.css +1417 -364
  70. package/dist/index.css.map +1 -1
  71. package/dist/index.d.ts +50 -4
  72. package/dist/index.js +3038 -591
  73. package/dist/index.js.map +1 -1
  74. package/dist/themes/baseTheme.d.ts +2 -0
  75. package/dist/themes/createTheme.d.ts +22 -0
  76. package/dist/themes/monochromeTheme.d.ts +2 -0
  77. package/dist/themes/types.d.ts +15 -6
  78. package/dist/tokens/baseTokens.d.ts +4 -0
  79. package/dist/tokens/types.d.ts +34 -0
  80. package/docs/accordion.md +47 -0
  81. package/docs/animated-number.md +31 -0
  82. package/docs/app-bar.md +53 -0
  83. package/docs/avatar-group.md +35 -0
  84. package/docs/avatar.md +34 -0
  85. package/docs/badge.md +41 -0
  86. package/docs/bottom-sheet.md +65 -0
  87. package/docs/button.md +63 -0
  88. package/docs/calendar.md +26 -0
  89. package/docs/card.md +71 -0
  90. package/docs/carousel.md +43 -0
  91. package/docs/checkbox.md +37 -0
  92. package/docs/chip.md +48 -0
  93. package/docs/combobox.md +72 -0
  94. package/docs/composition.md +80 -0
  95. package/docs/confetti.md +30 -0
  96. package/docs/context-menu.md +42 -0
  97. package/docs/date-input.md +41 -0
  98. package/docs/dialog.md +106 -0
  99. package/docs/divider.md +31 -0
  100. package/docs/fab-menu.md +55 -0
  101. package/docs/fab.md +43 -0
  102. package/docs/field.md +59 -0
  103. package/docs/floating-toolbar.md +48 -0
  104. package/docs/forms.md +81 -0
  105. package/docs/hold-button.md +32 -0
  106. package/docs/icon-button.md +54 -0
  107. package/docs/icons.md +38 -0
  108. package/docs/input.md +50 -0
  109. package/docs/kbd.md +25 -0
  110. package/docs/list.md +65 -0
  111. package/docs/llms-index.md +82 -0
  112. package/docs/menu.md +88 -0
  113. package/docs/menubar.md +34 -0
  114. package/docs/morph.md +51 -0
  115. package/docs/navigation-bar.md +48 -0
  116. package/docs/navigation-drawer.md +72 -0
  117. package/docs/navigation-list.md +40 -0
  118. package/docs/navigation-rail.md +53 -0
  119. package/docs/pin-input.md +38 -0
  120. package/docs/popover.md +78 -0
  121. package/docs/preview-card.md +40 -0
  122. package/docs/progress.md +37 -0
  123. package/docs/radio-group.md +47 -0
  124. package/docs/search.md +77 -0
  125. package/docs/select.md +64 -0
  126. package/docs/setup.md +106 -0
  127. package/docs/skeleton.md +33 -0
  128. package/docs/slider.md +49 -0
  129. package/docs/snackbar.md +50 -0
  130. package/docs/split-button.md +44 -0
  131. package/docs/sticker.md +27 -0
  132. package/docs/switch.md +44 -0
  133. package/docs/table.md +66 -0
  134. package/docs/tabs.md +51 -0
  135. package/docs/textarea.md +23 -0
  136. package/docs/theming.md +182 -0
  137. package/docs/time-picker.md +38 -0
  138. package/docs/toggle-group.md +70 -0
  139. package/docs/toggle.md +49 -0
  140. package/docs/tooltip.md +42 -0
  141. package/docs/typography.md +41 -0
  142. package/package.json +25 -5
@@ -0,0 +1,38 @@
1
+ # TimePicker
2
+
3
+ A field that opens a Material 3 time picker (clock dial or typed boxes). **The value is a 24-hour `"HH:mm"` string.**
4
+
5
+ ```ts
6
+ import { TimePicker } from 'anvilui'
7
+ import type { TimePickerProps } from 'anvilui'
8
+ ```
9
+
10
+ | Prop | Type | Default | Description |
11
+ | --- | --- | --- | --- |
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). |
14
+ | `type` | `'dial' \| 'input'` | `'dial'` | |
15
+ | `hourCycle` | `12 \| 24` | user's locale | 12 shows AM/PM. |
16
+ | `label` | `ReactNode` | | Either this or `aria-label`. |
17
+ | `name` | `string` | | Submits `"HH:mm"` with a form. |
18
+ | `size` | `'small' \| 'normal'` | `'normal'` | |
19
+ | `disabled` | `boolean` | `false` | |
20
+ | `open` / `defaultOpen` / `onOpenChange` | | | The popup. |
21
+ | `className`, other `<div>` props | | | On the wrapper. |
22
+
23
+ ```tsx
24
+ import { useState } from 'react'
25
+ import { TimePicker } from 'anvilui'
26
+
27
+ export function Example() {
28
+ const [time, setTime] = useState<string | null>('07:30')
29
+ return (
30
+ <TimePicker
31
+ label="Alarm"
32
+ value={time}
33
+ onValueChange={setTime}
34
+ hourCycle={12}
35
+ />
36
+ )
37
+ }
38
+ ```
@@ -0,0 +1,70 @@
1
+ # ToggleGroup
2
+
3
+ A segmented control: a row of options with a sliding selection pill. One selected by default; `multiple` for several.
4
+
5
+ ```ts
6
+ import { ToggleGroup, ToggleGroupItem } from 'anvilui'
7
+ import type { ToggleGroupProps, ToggleGroupItemProps } from 'anvilui'
8
+ ```
9
+
10
+ ## ToggleGroup props
11
+
12
+ | Prop | Type | Default | Description |
13
+ | --- | --- | --- | --- |
14
+ | `value` / `defaultValue` | single: `Value`; multiple: `string[]` | | **Single mode takes one value, not an array.** |
15
+ | `onValueChange` | single: `(value: Value, details) => void`; multiple: `(value: string[], details) => void` | | |
16
+ | `multiple` | `boolean` | `false` | Allow several on at once. |
17
+ | `color` | `ComponentColor` | `'primary'` | |
18
+ | `fillType` | `'filled' \| 'outlined' \| 'text'` | `'filled'` | |
19
+ | `size` | `'small' \| 'normal' \| 'big'` | `'normal'` | |
20
+ | `disabled` | `boolean` | | |
21
+ | `aria-label` / `aria-labelledby` | `string` | | Name the group (both are passed through). |
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`.
24
+
25
+ ## ToggleGroupItem props
26
+
27
+ | Prop | Type | Description |
28
+ | --- | --- | --- |
29
+ | `value` | `Value` (string in `multiple`) | Required. |
30
+ | `children` | `ReactNode` | Label. |
31
+ | `startIcon`, `endIcon` | `MaterialSymbol` | |
32
+ | `disabled` | `boolean` | |
33
+
34
+ ## Example
35
+
36
+ ```tsx
37
+ import { useState } from 'react'
38
+ import { ToggleGroup, ToggleGroupItem } from 'anvilui'
39
+
40
+ export function Example() {
41
+ const [view, setView] = useState('list')
42
+ const [days, setDays] = useState<string[]>(['mon'])
43
+ return (
44
+ <>
45
+ <ToggleGroup aria-label="View" value={view} onValueChange={setView}>
46
+ <ToggleGroupItem value="list" startIcon="list">
47
+ List
48
+ </ToggleGroupItem>
49
+ <ToggleGroupItem value="grid" startIcon="grid_view">
50
+ Grid
51
+ </ToggleGroupItem>
52
+ </ToggleGroup>
53
+
54
+ <ToggleGroup
55
+ multiple
56
+ aria-label="Days"
57
+ value={days}
58
+ onValueChange={setDays}
59
+ fillType="outlined"
60
+ >
61
+ <ToggleGroupItem value="mon">Mon</ToggleGroupItem>
62
+ <ToggleGroupItem value="tue">Tue</ToggleGroupItem>
63
+ <ToggleGroupItem value="wed">Wed</ToggleGroupItem>
64
+ </ToggleGroup>
65
+ </>
66
+ )
67
+ }
68
+ ```
69
+
70
+ Use it for 2–5 short options. For longer lists use [RadioGroup](radio-group.md) or [Select](select.md).
package/docs/toggle.md ADDED
@@ -0,0 +1,49 @@
1
+ # Toggle
2
+
3
+ A button that stays on or off (Bold, Favorite). Sets `aria-pressed`. Off it's neutral; on it fills with `color`.
4
+
5
+ ```ts
6
+ import { Toggle } from 'anvilui'
7
+ import type { ToggleProps } from 'anvilui'
8
+ ```
9
+
10
+ ## Props
11
+
12
+ | Prop | Type | Default | Description |
13
+ | --- | --- | --- | --- |
14
+ | `pressed` / `defaultPressed` | `boolean` | `false` | On state. |
15
+ | `onPressedChange` | `(pressed: boolean, details) => void` | | |
16
+ | `color` | `ComponentColor` | `'primary'` | Color while on. |
17
+ | `fillType` | `'filled' \| 'outlined' \| 'text'` | `'filled'` | Look while off. |
18
+ | `children` | `ReactNode` | | Label (text toggle). |
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. |
22
+ | `value` | `string` | | Identifies it in a Base UI ToggleGroup. |
23
+
24
+ Either `children` or `icon` + `aria-label`, not both.
25
+
26
+ ```tsx
27
+ import { useState } from 'react'
28
+ import { Toggle } from 'anvilui'
29
+
30
+ export function Example() {
31
+ const [favorite, setFavorite] = useState(false)
32
+ return (
33
+ <>
34
+ <Toggle startIcon="format_bold" defaultPressed>
35
+ Bold
36
+ </Toggle>
37
+ <Toggle
38
+ icon="favorite"
39
+ aria-label="Favorite"
40
+ color="error"
41
+ pressed={favorite}
42
+ onPressedChange={setFavorite}
43
+ />
44
+ </>
45
+ )
46
+ }
47
+ ```
48
+
49
+ For a row of exclusive options use [ToggleGroup](toggle-group.md). For filter chips use `FilterChip` ([chip.md](chip.md)).
@@ -0,0 +1,42 @@
1
+ # Tooltip
2
+
3
+ A short hint on hover or keyboard focus. **One component, no parts.** The text is `label`; the single child element is the trigger.
4
+
5
+ ```ts
6
+ import { Tooltip } from 'anvilui'
7
+ import type { TooltipProps } from 'anvilui'
8
+ ```
9
+
10
+ | Prop | Type | Default | Description |
11
+ | --- | --- | --- | --- |
12
+ | `label` | `ReactNode` | required | The hint text (not `content` or `title`). |
13
+ | `children` | `ReactElement` | required | Exactly one element that takes a ref and passes props through (all AnvilUI components do). |
14
+ | `side` | `'top' \| 'bottom' \| 'left' \| 'right' \| 'inline-start' \| 'inline-end'` | `'top'` | |
15
+ | `align` | `'start' \| 'center' \| 'end'` | `'center'` | |
16
+ | `sideOffset`, `alignOffset` | `number` | `4`, `0` | |
17
+ | `delay`, `closeDelay` | `number` (ms) | | Hover timing. |
18
+ | `open` / `defaultOpen` / `onOpenChange` | | | |
19
+ | `className` | `string` | | On the bubble. |
20
+
21
+ There is no `TooltipTrigger`, `TooltipContent` or `TooltipProvider` (AnvilRoot provides it).
22
+
23
+ ```tsx
24
+ import { IconButton, Tooltip } from 'anvilui'
25
+
26
+ export function Example() {
27
+ return (
28
+ <Tooltip label="Delete" side="bottom">
29
+ <IconButton
30
+ icon="delete"
31
+ aria-label="Delete"
32
+ fillType="text"
33
+ color="container"
34
+ />
35
+ </Tooltip>
36
+ )
37
+ }
38
+ ```
39
+
40
+ - A tooltip is not an accessible name: still give icon buttons `aria-label`.
41
+ - On plain text, wrap it in a focusable element: `<Tooltip label="…"><span tabIndex={0}>text</span></Tooltip>`.
42
+ - Disabled buttons don't get hover events; wrap them in a `<span>`.
@@ -0,0 +1,41 @@
1
+ # Typography
2
+
3
+ Text in the theme's type scale.
4
+
5
+ ```ts
6
+ import { Typography } from 'anvilui'
7
+ import type { TypographyProps, TypographyType, TypographyTag } from 'anvilui'
8
+ ```
9
+
10
+ | Prop | Type | Default | Description |
11
+ | --- | --- | --- | --- |
12
+ | `type` | `'body' \| 'caption' \| 'h1' \| 'h2' \| 'h3' \| 'h4' \| 'h5' \| 'h6'` | `'body'` | The look (not `variant`). |
13
+ | `as` | `'p' \| 'span' \| 'div' \| 'h1' … 'h6'` | from `type` | The tag. `body` → `<p>`, `caption` → `<span>`, `hN` → `<hN>`. |
14
+
15
+ Plus `<p>` props (`id`, `className`, `aria-*`, … all pass through to the rendered tag). No `color`, `weight`, `align` or `gutterBottom`: use `style` or CSS (`color: 'var(--avl-color-on-background-muted)'` for secondary text).
16
+
17
+ ```tsx
18
+ import { Typography } from 'anvilui'
19
+
20
+ export function Example() {
21
+ return (
22
+ <>
23
+ <Typography type="h3" as="h1">
24
+ Settings
25
+ </Typography>
26
+ <Typography type="h6" as="h2">
27
+ Notifications
28
+ </Typography>
29
+ <Typography>Choose what you hear about.</Typography>
30
+ <Typography
31
+ type="caption"
32
+ style={{ color: 'var(--avl-color-on-background-muted)' }}
33
+ >
34
+ Updated 2 minutes ago
35
+ </Typography>
36
+ </>
37
+ )
38
+ }
39
+ ```
40
+
41
+ Sizes (default tokens): h1 57px, h2 45px, h3 36px, h4 32px, h5 28px, h6 24px, body 16px, caption 12px. h1–h3 are display sizes; page titles usually use `h4`–`h6`.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "anvilui",
3
- "version": "0.1.0",
4
- "description": "Anvil UI",
3
+ "version": "0.2.0",
4
+ "description": "Material 3 style React 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",
@@ -20,7 +20,10 @@
20
20
  "*.css"
21
21
  ],
22
22
  "files": [
23
- "dist"
23
+ "dist",
24
+ "bin",
25
+ "docs",
26
+ "AGENTS.md"
24
27
  ],
25
28
  "scripts": {
26
29
  "build": "tsup && tsc -p tsconfig.build.json",
@@ -32,8 +35,8 @@
32
35
  "material-symbols": "^0.47.4"
33
36
  },
34
37
  "peerDependencies": {
35
- "react": ">=18",
36
- "react-dom": ">=18"
38
+ "react": ">=19",
39
+ "react-dom": ">=19"
37
40
  },
38
41
  "devDependencies": {
39
42
  "@types/react": "^19.3.0",
@@ -42,5 +45,22 @@
42
45
  "react-dom": "^19.3.0",
43
46
  "tsup": "^8.5.1",
44
47
  "typescript": "^7.0.2"
48
+ },
49
+ "repository": {
50
+ "type": "git",
51
+ "url": "git+https://github.com/itayvak/anvilui.git",
52
+ "directory": "core"
53
+ },
54
+ "homepage": "https://github.com/itayvak/anvilui#readme",
55
+ "keywords": [
56
+ "react",
57
+ "components",
58
+ "ui",
59
+ "material",
60
+ "base-ui",
61
+ "design-system"
62
+ ],
63
+ "bin": {
64
+ "anvilui": "bin/anvilui.mjs"
45
65
  }
46
66
  }