@antadesign/anta 0.3.33 → 0.3.35

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 (205) hide show
  1. package/LICENSE.md +14 -1
  2. package/README.md +9 -0
  3. package/dist/anta_helpers.d.ts +46 -30
  4. package/dist/anta_helpers.js +66 -25
  5. package/dist/bundle.css +1 -1
  6. package/dist/bundle.js +2 -1353
  7. package/dist/components/Banner.d.ts +25 -40
  8. package/dist/components/Banner.js +15 -17
  9. package/dist/components/Breadcrumbs.d.ts +0 -1
  10. package/dist/components/Breadcrumbs.js +0 -1
  11. package/dist/components/Button.d.ts +2 -3
  12. package/dist/components/Button.js +1 -0
  13. package/dist/components/ButtonCopy.js +3 -2
  14. package/dist/components/Calendar.js +13 -13
  15. package/dist/components/Card.d.ts +9 -17
  16. package/dist/components/Card.js +50 -46
  17. package/dist/components/Dialog.d.ts +1 -0
  18. package/dist/components/Dialog.js +16 -10
  19. package/dist/components/Expander.d.ts +6 -21
  20. package/dist/components/Expander.js +24 -23
  21. package/dist/components/Icon.d.ts +8 -14
  22. package/dist/components/Input.d.ts +77 -96
  23. package/dist/components/Input.js +23 -27
  24. package/dist/components/InputAutocomplete.d.ts +29 -10
  25. package/dist/components/InputAutocomplete.js +25 -8
  26. package/dist/components/InputDate.d.ts +0 -1
  27. package/dist/components/InputDate.js +2 -3
  28. package/dist/components/InputTime.d.ts +10 -4
  29. package/dist/components/InputTime.js +20 -16
  30. package/dist/components/Loader.d.ts +2 -2
  31. package/dist/components/Menu.d.ts +5 -4
  32. package/dist/components/Menu.js +13 -8
  33. package/dist/components/MenuItem.js +1 -14
  34. package/dist/components/MenuItemCopy.js +2 -2
  35. package/dist/components/Panel.d.ts +3 -1
  36. package/dist/components/Panel.js +17 -11
  37. package/dist/components/Progress.d.ts +21 -23
  38. package/dist/components/Progress.js +13 -9
  39. package/dist/components/RadioGroup.js +6 -8
  40. package/dist/components/{select-parts.css → Select.css} +1 -1
  41. package/dist/components/Select.d.ts +53 -36
  42. package/dist/components/Select.js +53 -98
  43. package/dist/components/SelectFaceted.d.ts +7 -4
  44. package/dist/components/SelectFaceted.js +21 -10
  45. package/dist/components/Slider.d.ts +28 -11
  46. package/dist/components/Slider.js +20 -20
  47. package/dist/components/Steps.css +1 -1
  48. package/dist/components/Steps.d.ts +0 -1
  49. package/dist/components/Steps.js +1 -12
  50. package/dist/components/Tabs.d.ts +17 -20
  51. package/dist/components/Tabs.js +7 -9
  52. package/dist/components/Text.d.ts +55 -36
  53. package/dist/components/Text.js +35 -22
  54. package/dist/components/Title.d.ts +19 -27
  55. package/dist/components/Title.js +2 -1
  56. package/dist/components/Toaster.js +9 -2
  57. package/dist/components/Tooltip.d.ts +10 -15
  58. package/dist/components/copy-props.d.ts +14 -3
  59. package/dist/components/copy-props.js +14 -3
  60. package/dist/components/select-tree.d.ts +24 -0
  61. package/dist/components/select-tree.js +35 -0
  62. package/dist/element-base.d.ts +10 -0
  63. package/dist/element-base.js +15 -0
  64. package/dist/elements/a-avatar.css +1 -1
  65. package/dist/elements/a-avatar.js +2 -28
  66. package/dist/elements/a-banner.css +1 -1
  67. package/dist/elements/a-banner.d.ts +4 -1
  68. package/dist/elements/a-banner.js +22 -112
  69. package/dist/elements/a-breadcrumbs.d.ts +1 -0
  70. package/dist/elements/a-breadcrumbs.js +1 -0
  71. package/dist/elements/a-button.css +1 -1
  72. package/dist/elements/a-button.d.ts +10 -7
  73. package/dist/elements/a-button.js +18 -1
  74. package/dist/elements/a-calendar.d.ts +14 -13
  75. package/dist/elements/a-calendar.js +29 -24
  76. package/dist/elements/a-card.css +1 -1
  77. package/dist/elements/a-card.d.ts +0 -9
  78. package/dist/elements/a-card.js +0 -184
  79. package/dist/elements/a-checkbox.css +1 -1
  80. package/dist/elements/a-copy.css +1 -1
  81. package/dist/elements/a-copy.d.ts +1 -5
  82. package/dist/elements/a-copy.js +129 -108
  83. package/dist/elements/a-dialog.css +1 -1
  84. package/dist/elements/a-dialog.d.ts +1 -1
  85. package/dist/elements/a-dialog.js +68 -194
  86. package/dist/elements/a-expander.css +1 -1
  87. package/dist/elements/a-expander.d.ts +4 -30
  88. package/dist/elements/a-expander.js +85 -344
  89. package/dist/elements/a-icon.d.ts +5 -23
  90. package/dist/elements/a-icon.js +1 -2
  91. package/dist/elements/a-input-date.d.ts +1 -0
  92. package/dist/elements/a-input-date.js +1 -0
  93. package/dist/elements/a-input-time.css +1 -1
  94. package/dist/elements/a-input-time.d.ts +2 -1
  95. package/dist/elements/a-input-time.js +101 -168
  96. package/dist/elements/a-input.css +1 -1
  97. package/dist/elements/a-input.d.ts +10 -8
  98. package/dist/elements/a-input.js +155 -230
  99. package/dist/elements/a-loader.d.ts +5 -8
  100. package/dist/elements/a-loader.js +1 -2
  101. package/dist/elements/a-menu-item.css +1 -1
  102. package/dist/elements/a-menu-item.d.ts +5 -3
  103. package/dist/elements/a-menu-item.js +5 -1
  104. package/dist/elements/a-menu.css +1 -1
  105. package/dist/elements/a-menu.d.ts +5 -7
  106. package/dist/elements/a-menu.js +383 -299
  107. package/dist/elements/a-panel.css +1 -1
  108. package/dist/elements/a-panel.js +19 -37
  109. package/dist/elements/a-progress.css +1 -1
  110. package/dist/elements/a-progress.d.ts +0 -22
  111. package/dist/elements/a-progress.js +0 -100
  112. package/dist/elements/a-radio-group.d.ts +1 -1
  113. package/dist/elements/a-radio-group.js +6 -4
  114. package/dist/elements/a-select-faceted.d.ts +1 -0
  115. package/dist/elements/a-select-faceted.js +1 -0
  116. package/dist/elements/a-select.d.ts +1 -0
  117. package/dist/elements/a-select.js +1 -0
  118. package/dist/elements/a-slider.css +1 -1
  119. package/dist/elements/a-slider.d.ts +11 -3
  120. package/dist/elements/a-slider.js +244 -242
  121. package/dist/elements/a-steps.d.ts +1 -0
  122. package/dist/elements/a-steps.js +1 -0
  123. package/dist/elements/a-switch.css +1 -1
  124. package/dist/elements/a-tab.css +1 -1
  125. package/dist/elements/a-tabpanel.d.ts +2 -2
  126. package/dist/elements/a-tabpanel.js +13 -3
  127. package/dist/elements/a-tabs.css +1 -1
  128. package/dist/elements/a-tabs.d.ts +1 -1
  129. package/dist/elements/a-tabs.js +6 -4
  130. package/dist/elements/a-tag.css +1 -1
  131. package/dist/elements/a-tag.d.ts +1 -0
  132. package/dist/elements/a-tag.js +1 -0
  133. package/dist/elements/a-text.css +1 -1
  134. package/dist/elements/a-text.d.ts +6 -43
  135. package/dist/elements/a-text.js +110 -193
  136. package/dist/elements/a-title.css +1 -1
  137. package/dist/elements/a-title.d.ts +1 -0
  138. package/dist/elements/a-title.js +1 -0
  139. package/dist/elements/a-toast.css +1 -1
  140. package/dist/elements/a-toast.d.ts +10 -45
  141. package/dist/elements/a-toast.js +80 -66
  142. package/dist/elements/a-toaster.css +1 -1
  143. package/dist/elements/a-toaster.js +9 -44
  144. package/dist/elements/a-tooltip.css +1 -1
  145. package/dist/elements/a-tooltip.d.ts +1 -1
  146. package/dist/elements/a-tooltip.js +142 -136
  147. package/dist/elements/copy-behavior.d.ts +1 -1
  148. package/dist/elements/copy-behavior.js +21 -21
  149. package/dist/elements/index.d.ts +9 -3
  150. package/dist/elements/index.js +6 -6
  151. package/dist/elements/input-focus-modality.d.ts +15 -0
  152. package/dist/elements/input-focus-modality.js +44 -0
  153. package/dist/elements/input-trailing-actions.d.ts +5 -0
  154. package/dist/elements/input-trailing-actions.js +38 -0
  155. package/dist/elements/shadow-aria.d.ts +2 -0
  156. package/dist/elements/shadow-aria.js +2 -1
  157. package/dist/elements/value-input.d.ts +3 -0
  158. package/dist/elements/value-input.js +12 -0
  159. package/dist/general_types.d.ts +103 -96
  160. package/dist/index.d.ts +1 -1
  161. package/dist/input-events.d.ts +4 -0
  162. package/dist/input-events.js +15 -0
  163. package/dist/jsx-runtime.d.ts +70 -23
  164. package/dist/jsx-runtime.js +26 -19
  165. package/dist/native-event-props.d.ts +2 -0
  166. package/dist/native-event-props.js +10 -0
  167. package/dist/reset.css +1 -1
  168. package/dist/theme-antithesis.css +10 -1
  169. package/dist/theme-antune.css +1 -1
  170. package/docs/accessibility.md +17 -3
  171. package/docs/changelog.md +384 -2
  172. package/docs/comparison.md +2 -2
  173. package/docs/components/avatar.md +5 -0
  174. package/docs/components/banner.md +117 -187
  175. package/docs/components/breadcrumbs.md +9 -6
  176. package/docs/components/button.md +22 -0
  177. package/docs/components/card.md +74 -28
  178. package/docs/components/checkbox.md +9 -10
  179. package/docs/components/dialog.md +83 -32
  180. package/docs/components/expander.md +198 -435
  181. package/docs/components/icon.md +11 -17
  182. package/docs/components/input-autocomplete.md +152 -52
  183. package/docs/components/input-date.md +175 -148
  184. package/docs/components/input-time.md +81 -38
  185. package/docs/components/input.md +343 -349
  186. package/docs/components/loader.md +2 -1
  187. package/docs/components/menu.md +35 -6
  188. package/docs/components/panel.md +18 -0
  189. package/docs/components/progress.md +83 -49
  190. package/docs/components/radio.md +39 -43
  191. package/docs/components/select-faceted.md +54 -7
  192. package/docs/components/select.md +390 -386
  193. package/docs/components/slider.md +136 -19
  194. package/docs/components/steps.md +6 -3
  195. package/docs/components/switch.md +8 -9
  196. package/docs/components/tabs.md +110 -104
  197. package/docs/components/text.md +110 -86
  198. package/docs/components/title.md +47 -33
  199. package/docs/components/toaster.md +242 -84
  200. package/docs/components/tooltip.md +204 -113
  201. package/docs/install-config.md +461 -96
  202. package/docs/packages/plot.md +228 -143
  203. package/docs/theming.md +29 -13
  204. package/package.json +43 -4
  205. package/theme-antithesis-license.md +66 -0
@@ -1,9 +1,8 @@
1
1
  # Icon
2
2
 
3
- Inline-block icon rendered via CSS `mask-image`. Color follows
4
- `currentColor`, default size is 16×16, and the only required prop is
5
- `shape`. The set of valid shapes is the union of Anta's built-ins plus
6
- any custom icons you generate yourself.
3
+ Use Icon for standalone symbols, such as a warning beside a message. Pass a
4
+ `shape` from Anta's built-in set or your generated icons. Color follows the
5
+ surrounding text, and the default size is 16×16 pixels.
7
6
 
8
7
  `shape="loader"` is the exception: it is Anta's animated loading alias for
9
8
  string-only icon props. Use `Loader` when you need a progress value, speed, or
@@ -135,8 +134,9 @@ accessible loading status.
135
134
 
136
135
  Use the web component directly when you are not using React or Preact and a native control does not fit.
137
136
 
138
- Set the accessible name on the raw element. Use `--icon-size` for a portable custom
139
- size.
137
+ Icon needs its stylesheet without JavaScript registration. Set an accessible
138
+ name when the icon conveys meaning, or `aria-hidden="true"` when decorative.
139
+ Use `--icon-size` for custom dimensions.
140
140
 
141
141
  ```html
142
142
  <a-icon
@@ -158,22 +158,16 @@ together. Default is `16`. Color always follows `currentColor`.
158
158
  <Text tone="critical"><Icon shape="warning-triangle" /></Text> {/* tinted */}
159
159
  ```
160
160
 
161
- Internally, `size` is applied as the `--icon-size` CSS custom property
162
- on the rendered `<a-icon>`. The base CSS rule reads it as
163
- `width: var(--icon-size, 16px); height: var(--icon-size, 16px)`. That
164
- means consumer CSS (or a parent's variable cascade) can drive icon
165
- size too — useful for sizing whole regions of UI at once:
161
+ Set `--icon-size` on a container to size its icons together:
166
162
 
167
163
  ```css
168
164
  .toolbar { --icon-size: 18px; }
169
165
  ```
170
166
 
171
- > The `<Icon size>` wrapper sets `--icon-size` inline, so it works
172
- > everywhere. Hand-authoring the raw element's `size` *attribute*
173
- > (`<a-icon size="18">`) instead relies on typed `attr()` (Chrome 133+);
174
- > on browsers without it (iOS Safari, Firefox) the attribute is ignored
175
- > and the icon falls back to the 16px default. Prefer `<Icon size>` for
176
- > exact custom sizes.
167
+ For a raw `<a-icon>`, use `--icon-size` for custom dimensions. Its `size`
168
+ attribute requires typed CSS `attr()` support. See
169
+ [Content Security Policy](../install-config.md#content-security-policy) when your policy
170
+ blocks inline styles from custom size props.
177
171
 
178
172
  ## The `blank` spacer
179
173
 
@@ -1,47 +1,135 @@
1
1
  # InputAutocomplete
2
2
 
3
- `InputAutocomplete` is a text field with a suggestion list. Its value remains a
4
- free-form string: text that is not in the list stays in the field, and selecting
5
- a suggestion fills the field. Use [Select](./select.md) with `filter` when the
6
- value must be one of the options.
3
+ `InputAutocomplete` offers suggestions while people enter text. Use it for
4
+ package names, search queries, or other fields where common entries help but
5
+ people can also enter their own value. Choosing a suggestion fills the field
6
+ with its value. Use [Select](./select.md) when an option's identity is the value.
7
7
 
8
- InputAutocomplete uses an [Input](./input.md) for the field and a [Menu](./menu.md)
9
- for suggestions. **`onValueChange`** reports field text. `onSelect` runs only
10
- after someone chooses a suggestion. Use `value` to control it, or `defaultValue`
11
- for uncontrolled use.
8
+ Give the field a visible `label`. If you omit it, provide `aria-label` or
9
+ `aria-labelledby`. A placeholder alone does not name the field.
12
10
 
13
11
  ## Free text is the point
14
12
 
15
- The value is always the text in the field. That's what separates this from a
16
- [Select](./select.md): a Select constrains the value to one of its options, so a Select
17
- with `filter` already covers "search a fixed list". `InputAutocomplete` is for when
18
- the list only *suggests* and the user may commit something you didn't list.
13
+ The field keeps whatever someone types, including text absent from the list.
14
+ `onValueChange` reports that text as it changes. Use `onSelect` when the
15
+ application also needs to know that someone chose a suggestion.
19
16
 
20
- The keyboard follows that intent. No suggestion is highlighted as you type, so
21
- Enter commits the typed text and closes the list. ↓ highlights
22
- the first suggestion (then ↑/↓ move through them), and
23
- Enter on a highlighted row picks it. Esc or an outside click
24
- closes the list; clicking the field to place the caret keeps it open.
17
+ ```tsx
18
+ const frameworks = ['React', 'Preact', 'Solid', 'Svelte', 'Vue', 'Angular', 'Qwik', 'Lit', 'Astro']
19
+ const [value, setValue] = useState('')
20
+
21
+ <InputAutocomplete
22
+ label="Framework"
23
+ placeholder="Type to search…"
24
+ clearable
25
+ suggestions={frameworks}
26
+ value={value}
27
+ onValueChange={setValue}
28
+ />
29
+ <div>Value: <code>{value || '(empty)'}</code></div>
30
+ ```
31
+
32
+ ## Suggestions
33
+
34
+ Use strings for a simple list, or option objects to show a readable `label`, a
35
+ supporting `hint`, or an `icon`. Choosing a row fills the field with its `value`,
36
+ so the **Anta** suggestion here fills in `@antadesign/anta`. Disabled suggestions
37
+ remain visible and are skipped during keyboard navigation.
38
+
39
+ ```tsx
40
+ <InputAutocomplete
41
+ label="Package"
42
+ hint="Choose a package name or enter another."
43
+ suggestions={[
44
+ { value: '@antadesign/anta', label: 'Anta', hint: 'UI components', icon: 'cube' },
45
+ { value: '@antadesign/plot', label: 'Plot', hint: 'Canvas charts', icon: 'workflow' },
46
+ { value: '@antadesign/stickers', label: 'Stickers', hint: 'Illustrations', icon: 'asterisk' },
47
+ { value: '@antadesign/archived', label: 'Archived', hint: 'Unavailable', disabled: true },
48
+ ]}
49
+ />
50
+ ```
51
+
52
+ ## Managing the value
25
53
 
26
- The focused field is associated directly with the suggestion popup and its
27
- active option through ARIA element reflection. These relationships do not
28
- require generated popup or option IDs, so separate application roots cannot
29
- collide. Explicit ARIA relationships authored on a raw Anta Input take
30
- precedence.
54
+ Pass `value` and update it through `onValueChange` when another part of your
55
+ application needs the text. Reset controlled text with `''`. For a field that
56
+ keeps its own text, use `defaultValue`; a form reset restores that default without
57
+ opening an unfocused field's suggestions or moving focus.
58
+
59
+ ```tsx
60
+ const [value, setValue] = useState('React')
61
+
62
+ <InputAutocomplete label="Framework" suggestions={frameworks}
63
+ value={value} onValueChange={setValue} clearable />
64
+ <Button label="Reset text" onClick={() => setValue('')} />
65
+ ```
31
66
 
32
67
  ## Filtering
33
68
 
34
- `filter` decides how suggestions match the text:
69
+ The built-in filter matches the value, label, and hint without case sensitivity,
70
+ and highlights matching label and hint text. Use a function when your
71
+ application needs a different rule, such as matching word prefixes. It receives
72
+ the original field text, including whitespace; decide whether to trim it in
73
+ your matcher.
74
+
75
+ ```tsx
76
+ <InputAutocomplete
77
+ label="Framework prefix"
78
+ suggestions={frameworks}
79
+ filter={(option, query) => option.value.toLowerCase().startsWith(query.trim().toLowerCase())}
80
+ />
81
+ ```
82
+
83
+ ### Application-provided results
84
+
85
+ Pass `filter={false}` when your application already selects or ranks the
86
+ suggestions. This preserves their order and skips local highlighting. The
87
+ example supplies matching projects in reverse order; fetched results use the
88
+ same pattern.
89
+
90
+ ```tsx
91
+ const projects = ['Billing service', 'Billing dashboard', 'Build tools', 'Customer portal']
92
+ const [value, setValue] = useState('')
93
+ const results = projects.filter(name => name.toLowerCase().includes(value.toLowerCase())).reverse()
94
+
95
+ <InputAutocomplete
96
+ label="Project"
97
+ hint="Results use the application's order. You can also enter a new project."
98
+ suggestions={results}
99
+ filter={false}
100
+ value={value}
101
+ onValueChange={setValue}
102
+ />
103
+ ```
104
+
105
+ Replace `suggestions` as results arrive. New results update an open list; they
106
+ do not reopen it after Escape or focus loss. Your application owns loading,
107
+ request cancellation, and discarding responses for older queries.
108
+
109
+ ## Keyboard interaction
110
+
111
+ Typing leaves every suggestion inactive, so Enter keeps the typed text and
112
+ closes the list. Arrow Down highlights the first enabled suggestion; Arrow Up
113
+ and Arrow Down move through the list. Enter on an active suggestion fills the
114
+ field. Editing again clears that active suggestion. Input-method composition
115
+ keeps its own candidate navigation and confirmation keys.
35
116
 
36
- - **`true`** (default): built-in case-insensitive substring match on each option's
37
- `value` / `label` / `hint`.
38
- - **a function** `(option, query) => boolean`: a custom matcher, called for each option.
39
- - **`false`**: show `suggestions` as-is, doing no local filtering. Use this when you
40
- fetch or filter results yourself (async / remote) and feed the current set through
41
- `suggestions`.
117
+ Escape closes the list and keeps focus in the field. Tab closes it and moves
118
+ to the next control. Selecting a suggestion or clicking the list's padding keeps
119
+ focus in the field. Clicking within an open field leaves the list open while
120
+ placing the caret. The field exposes combobox semantics, the popup is a listbox,
121
+ and the active suggestion is associated directly with the focused input.
42
122
 
43
- Suggestions are bare strings or `SelectOption`s, the same option shape
44
- [Select](./select.md) uses: `value`, `label`, `hint`, `icon`, `tone`, `disabled`.
123
+ ## Events
124
+
125
+ Use `onValueChange` for application text state. `onInput`, `onFocus`, `onBlur`,
126
+ and `onKeyDown` also receive their field events. An input event reports an edit
127
+ that already happened; `preventDefault()` does not reject the text.
128
+
129
+ A consumer `onKeyDown` can prevent the wrapper's plain-Enter dismissal.
130
+ Menu handles active suggestions and navigation earlier in document capture.
131
+ Those actions cannot be canceled from the field callback, and Escape is
132
+ consumed before it reaches the field. See the callback reference for ordering.
45
133
 
46
134
  ## Component props
47
135
 
@@ -49,41 +137,43 @@ Suggestions are bare strings or `SelectOption`s, the same option shape
49
137
  |------|------|---------|-------------|
50
138
  | `suggestions` | string \| SelectOption[] | — | The suggestions: bare strings or `SelectOption`s (`value` / `label` / `hint` / `icon` / `tone` / `disabled`). A flat list; picking one fills the field. |
51
139
  | `clearable?` | boolean | — | Show a clear button while the field has text. |
52
- | `defaultValue?` | string | — | Initial value for uncontrolled use. |
140
+ | `defaultValue?` | string | — | Initial uncontrolled text and the value restored by a form reset. Resetting an unfocused field does not open suggestions or move focus. |
53
141
  | `disabled?` | boolean | — | Disable the field. |
54
- | `filter?` | boolean \| (option, query) => boolean | true | How suggestions match the text. `true` uses the built-in case-insensitive substring match on `value` / `label` / `hint`; a function `(option, query) => boolean` uses a custom matcher; `false` shows `suggestions` unchanged for application-provided async or remote filtering. |
142
+ | `filter?` | boolean \| (option, query) => boolean | true | How suggestions match the text. `true` uses the built-in case-insensitive substring match on `value` / `label` / `hint`; a function `(option, query) => boolean` receives the original field text, including whitespace, once per option on each render, including when empty. Custom matching has no automatic highlighting. `false` shows `suggestions` unchanged for application-provided async or remote filtering, without automatic highlighting. Replacing results updates an open list but does not reopen a dismissed list. |
55
143
  | `hint?` | ReactNode | — | Hint under the field. |
56
144
  | `label?` | ReactNode | — | Field label. |
57
145
  | `leading?` | ReactNode | — | Leading adornment inside the field. |
58
146
  | `name?` | string | — | Form field name. |
59
- | `onSelect?` | (option) => void | — | Fires only when a suggestion is chosen, with that option. |
60
- | `onValueChange?` | (value) => void | — | Fires as the text changes (typing, picking a suggestion, or clearing) with the new field text. |
147
+ | `onBlur?` | (event) => void | — | Observe focus loss. The suggestion list closes without changing the text. |
148
+ | `onFocus?` | (event) => void | — | Observe focus before the suggestion list opens. |
149
+ | `onInput?` | (event) => void | — | Observe editing before `onValueChange`. The input event reports text that has already changed; `preventDefault()` does not reject that text. |
150
+ | `onKeyDown?` | (event) => void | — | Observe keys before the wrapper's plain-Enter dismissal. `preventDefault()` keeps that dismissal from running. Menu handles navigation and active-option activation earlier, in document capture; this callback cannot veto those actions. Composing keys remain with the input method. |
151
+ | `onSelect?` | (option) => void | — | Fires after `onValueChange` when a suggestion is chosen, with the normalized option. This reports the choice even if a controlled parent rejects the value. Typing and clearing do not call it. |
152
+ | `onValueChange?` | (value) => void | — | Reports text changes from typing, picking a suggestion, clearing, or form reset. |
61
153
  | `placeholder?` | string | — | Placeholder text. |
62
154
  | `size?` | 'small' \| 'medium' \| 'large' | medium | Field size. |
63
155
  | `status?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' | — | Validation status. |
64
156
  | `statusIcon?` | (string & {}) \| false \| IconShape | — | Status icon override, or `false` to drop it. |
65
157
  | `tone?` | string | — | Custom accent color — a named tone or any CSS color. |
66
158
  | `trailing?` | ReactNode | — | Trailing adornment inside the field. |
67
- | `value?` | string | — | Controlled value: the field's text, a **free** string not constrained to a suggestion. Leave undefined for uncontrolled. |
159
+ | `value?` | string | — | The controlled field text. Any string is valid, including `''` for an empty field. Omit or pass `undefined` for uncontrolled use. Parent updates do not call `onValueChange`. Releasing control retains the latest controlled text. |
68
160
 
69
161
  ## Web Component
70
162
 
71
- `InputAutocomplete` combines an input with a Menu. Reproducing its filtering,
72
- selection, focus, and popup coordination without the React or Preact wrapper is
73
- a substantial amount of code.
163
+ `InputAutocomplete` composes [Input](./input.md) and [Menu](./menu.md). It has no
164
+ `a-input-autocomplete` element or registration entry. Raw authors own the text,
165
+ filtering, popup state, and equivalent ARIA declarations. See
166
+ [Install and configure](../install-config.md) for imports, renderer setup, and CSP guidance.
74
167
 
75
168
  ### Native HTML input with autocomplete
76
169
 
77
- For browser-native suggestions, pair a native input with a `<datalist>`. It
78
- keeps free-form entry and lets the browser filter and fill matching options,
79
- while `data-anta` supplies the field appearance.
80
-
81
- The browser renders the suggestions popup. Use `InputAutocomplete` for custom
82
- option content, popup styling, or consistent behavior across browsers.
170
+ For browser-native suggestions, pair a native input with a `datalist`. The
171
+ browser supplies the popup and keeps free-form entry. Use InputAutocomplete
172
+ when you need Anta's suggestion rows and popup styling.
83
173
 
84
174
  ```html
85
- <input data-anta type="text" list="people" placeholder="Search people">
86
-
175
+ <label for="autocomplete-people">Person</label>
176
+ <input id="autocomplete-people" data-anta type="text" list="people" placeholder="Search people">
87
177
  <datalist id="people">
88
178
  <option value="Maya Chen">
89
179
  <option value="Noah Williams">
@@ -94,11 +184,21 @@ option content, popup styling, or consistent behavior across browsers.
94
184
 
95
185
  ## Styling
96
186
 
97
- **The field** is styled through Input's props (`size`, `status`, `tone`, `round`,
98
- `leading` / `trailing`) and its `::part`s; set its width with `style` / `className`
99
- (forwarded to the field). **The suggestion popover** takes Menu's `::part(menu)`.
187
+ Use Input's `size`, `status`, `tone`, and adornment props to configure the field.
188
+ `className` and `style` apply to its `a-input`. Target Input's parts for field
189
+ styles and the adjacent Menu's `::part(menu)` for the suggestion popup. Option
190
+ objects accept `className`, `style`, and application data attributes on their
191
+ rows.
192
+
193
+ The `package-field` class below belongs to this example. Replace it with your
194
+ own selector.
100
195
 
101
196
  ```tsx
102
- // Give the field a width; tint it with a custom tone.
103
- <InputAutocomplete tone="info" style={{ width: '260px' }} suggestions={frameworks} />
197
+ <InputAutocomplete className="package-field" label="Package" suggestions={packages} tone="info" />
198
+ ```
199
+
200
+ ```css
201
+ .package-field { width: 260px; }
202
+ .package-field::part(field) { border-radius: 12px; }
203
+ .package-field + a-menu::part(menu) { border-radius: 12px; }
104
204
  ```