anvilui 0.0.0-stage → 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 (148) hide show
  1. package/AGENTS.md +483 -0
  2. package/LICENSE +21 -0
  3. package/README.md +128 -2
  4. package/bin/anvilui.mjs +83 -0
  5. package/dist/colors/colors.d.ts +24 -0
  6. package/dist/components/Accordion/Accordion.d.ts +36 -0
  7. package/dist/components/AnimatedNumber/AnimatedNumber.d.ts +17 -0
  8. package/dist/components/AnvilRoot/AnvilContext.d.ts +34 -0
  9. package/dist/components/AnvilRoot/AnvilRoot.d.ts +56 -0
  10. package/dist/components/AppBar/AppBar.d.ts +45 -0
  11. package/dist/components/Avatar/Avatar.d.ts +27 -0
  12. package/dist/components/Avatar/AvatarGroupContext.d.ts +1 -0
  13. package/dist/components/AvatarGroup/AvatarGroup.d.ts +25 -0
  14. package/dist/components/Badge/Badge.d.ts +23 -0
  15. package/dist/components/BottomSheet/BottomSheet.d.ts +41 -0
  16. package/dist/components/Button/Button.d.ts +35 -0
  17. package/dist/components/Calendar/Calendar.d.ts +19 -0
  18. package/dist/components/Card/Card.d.ts +57 -0
  19. package/dist/components/Carousel/Carousel.d.ts +21 -0
  20. package/dist/components/Checkbox/Checkbox.d.ts +14 -0
  21. package/dist/components/Chip/Chip.d.ts +46 -0
  22. package/dist/components/Combobox/Combobox.d.ts +42 -0
  23. package/dist/components/Confetti/Confetti.d.ts +31 -0
  24. package/dist/components/ContextMenu/ContextMenu.d.ts +24 -0
  25. package/dist/components/DateInput/DateInput.d.ts +37 -0
  26. package/dist/components/Dialog/Dialog.d.ts +56 -0
  27. package/dist/components/Divider/Divider.d.ts +24 -0
  28. package/dist/components/FAB/FAB.d.ts +28 -0
  29. package/dist/components/FAB/magnet.d.ts +2 -0
  30. package/dist/components/FABMenu/FABMenu.d.ts +55 -0
  31. package/dist/components/Field/Field.d.ts +36 -0
  32. package/dist/components/FloatingToolbar/FloatingToolbar.d.ts +37 -0
  33. package/dist/components/HoldButton/HoldButton.d.ts +18 -0
  34. package/dist/components/Icon/Icon.d.ts +21 -0
  35. package/dist/components/IconButton/IconButton.d.ts +22 -0
  36. package/dist/components/Input/Input.d.ts +24 -0
  37. package/dist/components/Kbd/Kbd.d.ts +21 -0
  38. package/dist/components/List/List.d.ts +35 -0
  39. package/dist/components/Menu/Menu.d.ts +54 -0
  40. package/dist/components/Menubar/Menubar.d.ts +17 -0
  41. package/dist/components/NavigationBar/NavigationBar.d.ts +30 -0
  42. package/dist/components/NavigationDrawer/NavigationDrawer.d.ts +52 -0
  43. package/dist/components/NavigationList/NavigationList.d.ts +27 -0
  44. package/dist/components/NavigationRail/NavigationRail.d.ts +48 -0
  45. package/dist/components/PinInput/PinInput.d.ts +31 -0
  46. package/dist/components/Popover/Popover.d.ts +49 -0
  47. package/dist/components/PreviewCard/PreviewCard.d.ts +31 -0
  48. package/dist/components/Progress/Progress.d.ts +29 -0
  49. package/dist/components/RadioGroup/RadioGroup.d.ts +19 -0
  50. package/dist/components/Search/Search.d.ts +39 -0
  51. package/dist/components/Select/Select.d.ts +38 -0
  52. package/dist/components/Skeleton/Skeleton.d.ts +20 -0
  53. package/dist/components/Slider/Slider.d.ts +31 -0
  54. package/dist/components/Snackbar/Snackbar.d.ts +35 -0
  55. package/dist/components/SplitButton/SplitButton.d.ts +16 -0
  56. package/dist/components/SquigglyWave/SquigglyWave.d.ts +36 -0
  57. package/dist/components/Sticker/Sticker.d.ts +21 -0
  58. package/dist/components/Switch/Switch.d.ts +15 -0
  59. package/dist/components/Table/Table.d.ts +36 -0
  60. package/dist/components/Tabs/Tabs.d.ts +32 -0
  61. package/dist/components/Textarea/Textarea.d.ts +24 -0
  62. package/dist/components/TimePicker/TimePicker.d.ts +45 -0
  63. package/dist/components/Toggle/Toggle.d.ts +41 -0
  64. package/dist/components/ToggleGroup/ToggleGroup.d.ts +50 -0
  65. package/dist/components/Tooltip/Tooltip.d.ts +23 -0
  66. package/dist/components/Typography/Typography.d.ts +22 -0
  67. package/dist/datetime.d.ts +12 -0
  68. package/dist/dev.d.ts +15 -0
  69. package/dist/index.cjs +5419 -0
  70. package/dist/index.cjs.map +1 -0
  71. package/dist/index.css +3724 -0
  72. package/dist/index.css.map +1 -0
  73. package/dist/index.d.ts +129 -0
  74. package/dist/index.js +5299 -0
  75. package/dist/index.js.map +1 -0
  76. package/dist/morph.d.ts +64 -0
  77. package/dist/themes/baseTheme.d.ts +5 -0
  78. package/dist/themes/createTheme.d.ts +22 -0
  79. package/dist/themes/monochromeTheme.d.ts +5 -0
  80. package/dist/themes/toCssVariables.d.ts +2 -0
  81. package/dist/themes/types.d.ts +60 -0
  82. package/dist/tokens/baseTokens.d.ts +6 -0
  83. package/dist/tokens/toCssVariables.d.ts +2 -0
  84. package/dist/tokens/types.d.ts +80 -0
  85. package/dist/utils.d.ts +4 -0
  86. package/docs/accordion.md +47 -0
  87. package/docs/animated-number.md +31 -0
  88. package/docs/app-bar.md +53 -0
  89. package/docs/avatar-group.md +35 -0
  90. package/docs/avatar.md +34 -0
  91. package/docs/badge.md +41 -0
  92. package/docs/bottom-sheet.md +65 -0
  93. package/docs/button.md +63 -0
  94. package/docs/calendar.md +26 -0
  95. package/docs/card.md +71 -0
  96. package/docs/carousel.md +43 -0
  97. package/docs/checkbox.md +37 -0
  98. package/docs/chip.md +48 -0
  99. package/docs/combobox.md +72 -0
  100. package/docs/composition.md +80 -0
  101. package/docs/confetti.md +30 -0
  102. package/docs/context-menu.md +42 -0
  103. package/docs/date-input.md +41 -0
  104. package/docs/dialog.md +106 -0
  105. package/docs/divider.md +31 -0
  106. package/docs/fab-menu.md +55 -0
  107. package/docs/fab.md +43 -0
  108. package/docs/field.md +59 -0
  109. package/docs/floating-toolbar.md +48 -0
  110. package/docs/forms.md +81 -0
  111. package/docs/hold-button.md +32 -0
  112. package/docs/icon-button.md +54 -0
  113. package/docs/icons.md +38 -0
  114. package/docs/input.md +50 -0
  115. package/docs/kbd.md +25 -0
  116. package/docs/list.md +65 -0
  117. package/docs/llms-index.md +82 -0
  118. package/docs/menu.md +88 -0
  119. package/docs/menubar.md +34 -0
  120. package/docs/morph.md +51 -0
  121. package/docs/navigation-bar.md +48 -0
  122. package/docs/navigation-drawer.md +72 -0
  123. package/docs/navigation-list.md +40 -0
  124. package/docs/navigation-rail.md +53 -0
  125. package/docs/pin-input.md +38 -0
  126. package/docs/popover.md +78 -0
  127. package/docs/preview-card.md +40 -0
  128. package/docs/progress.md +37 -0
  129. package/docs/radio-group.md +47 -0
  130. package/docs/search.md +77 -0
  131. package/docs/select.md +64 -0
  132. package/docs/setup.md +106 -0
  133. package/docs/skeleton.md +33 -0
  134. package/docs/slider.md +49 -0
  135. package/docs/snackbar.md +50 -0
  136. package/docs/split-button.md +44 -0
  137. package/docs/sticker.md +27 -0
  138. package/docs/switch.md +44 -0
  139. package/docs/table.md +66 -0
  140. package/docs/tabs.md +51 -0
  141. package/docs/textarea.md +23 -0
  142. package/docs/theming.md +182 -0
  143. package/docs/time-picker.md +38 -0
  144. package/docs/toggle-group.md +70 -0
  145. package/docs/toggle.md +49 -0
  146. package/docs/tooltip.md +42 -0
  147. package/docs/typography.md +41 -0
  148. package/package.json +65 -5
@@ -0,0 +1,182 @@
1
+ # Theming and color mode
2
+
3
+ Colors come from a `Theme` (light and dark), everything else from `DesignTokens`. Both are props on `AnvilRoot`.
4
+
5
+ ```ts
6
+ import {
7
+ AnvilRoot,
8
+ useAnvil,
9
+ createTheme,
10
+ createThemeFromImage,
11
+ baseLightTheme,
12
+ baseDarkTheme,
13
+ monochromeLightTheme,
14
+ monochromeDarkTheme,
15
+ baseDesignTokens,
16
+ } from 'anvilui'
17
+ import type {
18
+ Theme,
19
+ ThemePair,
20
+ DesignTokens,
21
+ ColorModeSetting,
22
+ ColorType,
23
+ } from 'anvilui'
24
+ ```
25
+
26
+ ## AnvilRoot props
27
+
28
+ | Prop | Type | Default | Description |
29
+ | --- | --- | --- | --- |
30
+ | `children` | `ReactNode` | required | The app. |
31
+ | `className` | `string` | | Classes for the root `<div>`, e.g. to fill the viewport. |
32
+ | `colorMode` | `'light' \| 'dark' \| 'system'` | | Controlled color mode. Pair with `onColorModeChange`. |
33
+ | `defaultColorMode` | `'light' \| 'dark' \| 'system'` | `'system'` | Starting mode when uncontrolled. `'system'` follows the OS live. |
34
+ | `onColorModeChange` | `(mode: ColorModeSetting) => void` | | Called when the mode changes. |
35
+ | `storageKey` | `string` | | Saves the mode in `localStorage` under this key and restores it (no flash with SSR). |
36
+ | `lightTheme` | `Theme` | `baseLightTheme` | Colors in light mode. |
37
+ | `darkTheme` | `Theme` | `baseDarkTheme` | Colors in dark mode. |
38
+ | `tokens` | `Partial<DesignTokens>` | `baseDesignTokens` | Spacing, radius, fonts, motion, shadows. Each category you pass **replaces** the whole default category. |
39
+
40
+ AnvilRoot renders a `<div>` and takes no other props (no `style`, `id`, `theme`).
41
+
42
+ ## Color mode
43
+
44
+ ```tsx
45
+ import { AnvilRoot, IconButton, useAnvil } from 'anvilui'
46
+
47
+ function ModeToggle() {
48
+ const { colorMode, setColorMode } = useAnvil()
49
+ return (
50
+ <IconButton
51
+ icon={colorMode === 'dark' ? 'light_mode' : 'dark_mode'}
52
+ aria-label="Toggle dark mode"
53
+ fillType="text"
54
+ color="container"
55
+ onClick={() =>
56
+ setColorMode(colorMode === 'dark' ? 'light' : 'dark')
57
+ }
58
+ />
59
+ )
60
+ }
61
+
62
+ export function App() {
63
+ return (
64
+ <AnvilRoot storageKey="color-mode">
65
+ <ModeToggle />
66
+ </AnvilRoot>
67
+ )
68
+ }
69
+ ```
70
+
71
+ `useAnvil()` returns:
72
+
73
+ | Field | Type | Description |
74
+ | --- | --- | --- |
75
+ | `colorMode` | `'light' \| 'dark'` | What's shown now (`'system'` resolved). |
76
+ | `colorModeSetting` | `'light' \| 'dark' \| 'system'` | What was picked. |
77
+ | `setColorMode` | `Dispatch<SetStateAction<ColorModeSetting>>` | Like a `useState` setter. |
78
+ | `lightTheme`, `darkTheme` | `Theme` | The themes in use. |
79
+ | `tokens` | `DesignTokens` | The tokens in use, defaults filled in. |
80
+ | `rootRef` | `RefObject<HTMLDivElement \| null>` | The root element (the portal container). |
81
+
82
+ `useAnvil()` throws outside `AnvilRoot`.
83
+
84
+ ## Custom colors
85
+
86
+ ```tsx
87
+ import { AnvilRoot, Button, createTheme } from 'anvilui'
88
+
89
+ // Module scope (or useMemo): it does color math
90
+ const brand = createTheme('#0B6E4F', { tonal: '#6E4F0B' })
91
+
92
+ export function App() {
93
+ return (
94
+ <AnvilRoot lightTheme={brand.light} darkTheme={brand.dark}>
95
+ <Button>Brand colored</Button>
96
+ </AnvilRoot>
97
+ )
98
+ }
99
+ ```
100
+
101
+ - `createTheme(primaryHex, { tonal?: hex })` returns `{ light: Theme, dark: Theme }`. Hex only (`'#0B6E4F'` or `'#0B6'`); other formats throw.
102
+ - `createThemeFromImage(img | File | Blob | url)` returns `Promise<ThemePair>`, browser only. URLs must allow CORS.
103
+ - Error, warning and success colors stay the same.
104
+ - Tweak one role by spreading: `{ ...brand.light, primary: '#…' }`.
105
+ - Ready-made: `baseLightTheme` / `baseDarkTheme` (purple, the default), `monochromeLightTheme` / `monochromeDarkTheme`.
106
+
107
+ ## Theme roles
108
+
109
+ `Theme` is an object of color strings. Each `x` has an `onX` for text on it.
110
+
111
+ | Role | Used for |
112
+ | --- | --- |
113
+ | `background` / `onBackground` / `onBackgroundMuted` | Page and body text; muted is secondary text |
114
+ | `container` / `onContainer` | Neutral fills: cards, chips, inputs, "secondary" buttons |
115
+ | `surface` / `onSurface` | Navigation, menus, dialogs, sheets |
116
+ | `primary` / `onPrimary`, `primaryContainer` / `onPrimaryContainer` | Brand color |
117
+ | `tonal` / `onTonal`, `tonalContainer` / `onTonalContainer` | Softer accent: selected states, tonal buttons |
118
+ | `error`, `warning`, `success` (+ `on…`, `…Container`, `on…Container`) | Status colors |
119
+ | `outline` | Borders of inputs and outlined controls |
120
+ | `divider` | Lines between content |
121
+ | `inverseSurface`, `inverseOnSurface`, `inversePrimary` (optional) | Tooltips, snackbars |
122
+ | `shadow`, `scrim` (optional) | Shadow color, dialog backdrop |
123
+
124
+ Each role is a CSS variable in kebab case: `primaryContainer` → `var(--avl-color-primary-container)`.
125
+
126
+ ## Component colors (`color` prop)
127
+
128
+ Components take `color` from these roles only:
129
+
130
+ ```ts
131
+ type ComponentColor =
132
+ | 'primary'
133
+ | 'tonal'
134
+ | 'success'
135
+ | 'warning'
136
+ | 'error'
137
+ | 'container'
138
+ | 'surface'
139
+ type ComponentFillType = 'filled' | 'outlined' | 'text'
140
+ ```
141
+
142
+ There is no `secondary`, `danger`, `destructive`, `info` or `default`. Use `tonal` or `container` for secondary actions and `error` for destructive ones.
143
+
144
+ ## Tokens
145
+
146
+ ```tsx
147
+ import { AnvilRoot, baseDesignTokens } from 'anvilui'
148
+
149
+ export function App() {
150
+ return (
151
+ <AnvilRoot
152
+ tokens={{
153
+ // A category replaces the whole default one, so spread it
154
+ radius: {
155
+ ...baseDesignTokens.radius,
156
+ medium: '8px',
157
+ large: '12px',
158
+ },
159
+ font: {
160
+ main: 'Inter, sans-serif',
161
+ title: 'Inter, sans-serif',
162
+ mono: 'monospace',
163
+ },
164
+ }}
165
+ >
166
+ <main />
167
+ </AnvilRoot>
168
+ )
169
+ }
170
+ ```
171
+
172
+ | Category | Keys | CSS variables |
173
+ | --- | --- | --- |
174
+ | `spacing` | a number (px), default `4` | `--avl-spacing-x1` … `--avl-spacing-x20` |
175
+ | `font` | `main`, `title`, `mono` | `--avl-font-main` … |
176
+ | `fontSize` | `body`, `caption`, `labelSmall`, `label`, `labelLarge`, `h1`–`h6` | `--avl-font-size-label-small` … |
177
+ | `fontWeight` | `regular`, `medium`, `semibold`, `bold` | `--avl-font-weight-bold` … |
178
+ | `radius` | `small`, `medium`, `large`, `button`, `full` | `--avl-radius-medium` … |
179
+ | `shadow` | `small`, `medium`, `large` | `--avl-shadow-small` … |
180
+ | `ease` | `out`, `in`, `smooth`, `bounce` | `--avl-ease-out` … |
181
+ | `easeLength` | `short`, `normal`, `slow` | `--avl-ease-length-short` … |
182
+ | `outlineSize`, `disabledOpacity` | strings | `--avl-outline-size`, `--avl-disabled-opacity` |
@@ -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,6 +1,66 @@
1
1
  {
2
- "name": "anvilui",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
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/.",
5
+ "author": "itayvak",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "main": "./dist/index.cjs",
9
+ "module": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.js",
15
+ "require": "./dist/index.cjs"
16
+ },
17
+ "./styles.css": "./dist/index.css"
18
+ },
19
+ "sideEffects": [
20
+ "*.css"
21
+ ],
22
+ "files": [
23
+ "dist",
24
+ "bin",
25
+ "docs",
26
+ "AGENTS.md"
27
+ ],
28
+ "scripts": {
29
+ "build": "tsup && tsc -p tsconfig.build.json",
30
+ "dev": "tsup --watch",
31
+ "prepublishOnly": "npm run build"
32
+ },
33
+ "dependencies": {
34
+ "@base-ui/react": "^1.8.0",
35
+ "material-symbols": "^0.47.4"
36
+ },
37
+ "peerDependencies": {
38
+ "react": ">=19",
39
+ "react-dom": ">=19"
40
+ },
41
+ "devDependencies": {
42
+ "@types/react": "^19.3.0",
43
+ "@types/react-dom": "^19.3.0",
44
+ "react": "^19.3.0",
45
+ "react-dom": "^19.3.0",
46
+ "tsup": "^8.5.1",
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"
65
+ }
66
+ }