@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,79 @@
1
1
  # Slider
2
2
 
3
- **`Slider`** selects one number or an interval between two numbers. Pass a number
4
- for one thumb or a two-number tuple for two thumbs. Its label sits above the
5
- rail, and the value appears at the right side of the label row by default. Use
6
- `value` with `onValueChange` to control it, or `defaultValue` for uncontrolled use.
3
+ `Slider` selects a number or an interval within a numeric range. Use it for
4
+ settings such as volume, playback speed, or price limits when dragging helps
5
+ people choose a value. Use a separate numeric input when precise text entry is
6
+ also useful.
7
+
8
+ Give every slider a visible `label` or an accessible name. A string label supplies
9
+ the name; pair a rich label with `aria-label` or `aria-labelledby`.
10
+
11
+ ## Managing the value
12
+
13
+ Pass `defaultValue` for an uncontrolled slider, or use `value` with
14
+ `onValueChange` when the application owns the number. A controlled slider changes
15
+ only when you update `value`. Turn off **Accept changes** in this example to see
16
+ requests without applying them. **Reset to 35%** changes the application value
17
+ without requesting another change.
18
+
19
+ ```tsx title="Accept or reject a requested value"
20
+ import { useState } from 'preact/hooks'
21
+ import { Button, Checkbox, Slider } from '@antadesign/anta'
22
+
23
+ function SliderOwnershipDemo() {
24
+ const [value, setValue] = useState(35)
25
+ const [accept, setAccept] = useState(true)
26
+ const [requested, setRequested] = useState(35)
27
+
28
+ return (
29
+ <>
30
+ <Checkbox label="Accept changes" checked={accept} onStateChange={(_, { next }) => setAccept(next === true)} />
31
+ <Slider
32
+ label="Volume"
33
+ value={value}
34
+ valueSuffix="%"
35
+ onValueChange={(_, { value: next }) => {
36
+ setRequested(next)
37
+ if (accept) setValue(next)
38
+ }}
39
+ />
40
+ <Button onClick={() => setValue(35)}>Reset to 35%</Button>
41
+ <p>Applied: {value}%. Requested: {requested}%.</p>
42
+ </>
43
+ )
44
+ }
45
+ ```
46
+
47
+ `0` is a controlled numeric value. Omitting `value` or passing `undefined` selects
48
+ uncontrolled use. Releasing control retains the last applied number until
49
+ interaction or reset changes it. A numeric slider has no empty value.
50
+
51
+ `onValueChange` reports requested values while dragging. `onValueCommit` reports
52
+ the final request when the gesture ends, including cancellation or capture loss,
53
+ and after each keyboard step. Its value can differ from the applied value when
54
+ the application rejects a controlled request. `onInput` runs before
55
+ `onValueChange`; `onChange` runs before `onValueCommit`. Cancel a keyboard or
56
+ pointer default in `onKeyDown` or `onPointerDown`; the value notifications are
57
+ noncancelable. See the prop reference for callback snapshots and reset behavior.
58
+
59
+ ## Forms
60
+
61
+ Pass `name` to include the applied number in form submission. A range submits two
62
+ entries under the same name; read them with `FormData.getAll(name)`. Disabled
63
+ sliders submit nothing.
64
+
65
+ Form reset restores an uncontrolled slider's `defaultValue`. Without one, it
66
+ restores `min`, or `[min, max]` for a range. A changed uncontrolled reset emits
67
+ both value callbacks. Controlled reset retains the application's value, and
68
+ restoration does not overwrite a controlled value. Restoration of an uncontrolled
69
+ value is silent.
70
+
71
+ ```tsx
72
+ <form>
73
+ <Slider label="Brightness" name="brightness" defaultValue={60} valueSuffix="%" />
74
+ <Button type="reset">Reset brightness</Button>
75
+ </form>
76
+ ```
7
77
 
8
78
  ## Relative dragging
9
79
 
@@ -17,7 +87,13 @@ dragging, as a native range input does.
17
87
  Releasing the pointer or losing pointer capture ends the drag. Moving back over
18
88
  the slider without pressing leaves its value unchanged.
19
89
 
20
- Arrow keys change by `step`. Home and End set the minimum and maximum. PageUp and PageDown move by one tenth of the range.
90
+ Slider is horizontal. In inherited RTL, its minimum is at the right edge and
91
+ horizontal pointer and arrow movement follow that direction. Up and Down still
92
+ increase and decrease the value. Vertical orientation and readonly mode are not
93
+ part of its API. The control reserves touch gestures for dragging.
94
+
95
+ Arrow keys change by `step`. Home selects the minimum; End selects the nearest allowed
96
+ step to the maximum. PageUp and PageDown move by one tenth of the range.
21
97
 
22
98
  ```tsx
23
99
  <Slider label="Relative drag" defaultValue={35} />
@@ -35,7 +111,7 @@ cross.
35
111
 
36
112
  `onValueChange` receives a number for a single-value slider and an ordered
37
113
  `[number, number]` tuple for a range slider. `onValueCommit` uses the same shape.
38
- Without `defaultValue`, a form reset selects the full `[min, max]` range.
114
+ For an uncontrolled range without `defaultValue`, form reset selects `[min, max]`.
39
115
 
40
116
  ```tsx title="Controlled range"
41
117
  import { useState } from 'preact/hooks'
@@ -78,15 +154,19 @@ thumb movement and keyboard controls stay the same.
78
154
  `valueDisplay="end"` is the default. Use `inline` for `Label: value`, `thumb` to keep a value above the thumb, or `none` to omit it. `valuePrefix` and `valueSuffix` add text to every live value display.
79
155
 
80
156
  ```tsx
81
- <Slider label="Volume" defaultValue={48} valueSuffix="%" />
82
- <Slider label="Volume" defaultValue={48} valueDisplay="inline" valueSuffix="%" />
83
- <Slider label="Volume" defaultValue={48} valueDisplay="thumb" valueSuffix="%" />
157
+ <Slider label="End" defaultValue={48} valueSuffix="%" />
158
+ <Slider label="Inline" defaultValue={48} valueDisplay="inline" valueSuffix="%" />
159
+ <Slider label="Thumb" defaultValue={48} valueDisplay="thumb" valueSuffix="%" />
84
160
  ```
85
161
 
86
162
  ## Size, tones, and radius
87
163
 
88
164
  `size` follows the input height scale: 24px, 28px, and 32px. `trackSize` sets the thickness of both rail segments without changing the control height; numbers use pixels and strings accept CSS lengths. `thumbSize` controls the thumb diameter, and `thumbFill` fills it with its resolved border color. `tone` colors the filled rail. `thumbTone` separately colors the thumb stroke. The unfilled rail stays neutral. `round` shapes both the rail and thumb. Pass `true` for fully round corners or a number or CSS length for a shared custom radius.
89
165
 
166
+ In the Antithesis theme, an omitted `thumbTone` follows the filled rail's color.
167
+ Other themes keep the thumb neutral. Pass `thumbTone="neutral"` to keep a neutral
168
+ thumb in every theme. The native range uses the same rule for `thumb-tone`.
169
+
90
170
  ```tsx
91
171
  <Slider size="small" tone="info" label="Small" defaultValue={32} />
92
172
  <Slider tone="brand" thumbTone="success" trackSize={4} thumbSize={20} thumbFill label="Medium, filled thumb" defaultValue={52} />
@@ -104,6 +184,7 @@ thumb movement and keyboard controls stay the same.
104
184
  max={2}
105
185
  step={0.25}
106
186
  defaultValue={1}
187
+ valueSuffix="×"
107
188
  markers={[
108
189
  { value: 0.5, label: '0.5×' },
109
190
  { value: 1, label: 'Normal' },
@@ -116,33 +197,47 @@ thumb movement and keyboard controls stay the same.
116
197
 
117
198
  | Prop | Type | Default | Description |
118
199
  |------|------|---------|-------------|
119
- | `defaultValue?` | number \| SliderRangeValue | 0 | Initial uncontrolled value. |
200
+ | `defaultValue?` | number \| SliderRangeValue | min | Initial uncontrolled value and form-reset baseline. Changes while pristine update the value; after interaction they affect the next reset. Without a default, scalar reset uses `min` and range reset uses `[min, max]`. |
120
201
  | `disabled?` | boolean | — | Disables pointer and keyboard interaction. |
121
202
  | `inverted?` | boolean | — | Fill the rail outside the selected value or range. |
122
203
  | `label?` | ReactNode | — | Visible field label, shown above the rail. A string supplies the slider's accessible name; give a rich label an explicit `aria-label`. |
123
204
  | `markers?` | SliderMarker[] | — | Compact text labels positioned below the rail. They do not add dots or ticks to the rail. |
124
- | `max?` | number | 100 | Highest permitted value. |
125
- | `min?` | number | 0 | Lowest permitted value. |
205
+ | `max?` | number | 100 | Highest permitted value. A lower bound than `min` collapses the range to `min`. Nonfinite values use 100. |
206
+ | `min?` | number | 0 | Lowest permitted value and step origin. Nonfinite values use 0. |
126
207
  | `name?` | string | — | Form field name. A range submits two values under this name. |
127
- | `onValueChange?` | (event, attrs) => void | — | Fires on every keyboard or pointer value change. |
128
- | `onValueCommit?` | (event, attrs) => void | — | Fires after a drag ends and after each keyboard value change. |
208
+ | `onValueChange?` | (event, attrs) => void | — | Reports each distinct requested value during a drag and each keyboard step. `onInput` runs first. The snapshot contains the requested value and effective constraints; the element's `value` remains the applied value. Controlled sliders accept by updating `value` and reject by leaving it unchanged. Events are notifications; `preventDefault()` does not veto a value request. |
209
+ | `onValueCommit?` | (event, attrs) => void | — | Reports the final requested value after a drag, cancellation, or capture loss, and after each keyboard step. `onChange` runs first. A drag ending at its starting value is silent. Controlled requests can commit without being accepted. Uncontrolled form reset emits both callbacks when it changes the value; state restoration and application updates are silent. |
129
210
  | `round?` | boolean \| number \| string | — | Fully round the rail and thumb. Pass a number (px) or CSS length string for a shared custom radius. |
130
211
  | `size?` | 'small' \| 'medium' \| 'large' | 'medium' | Size variant. small=24px, medium=28px, large=32px tall. |
131
- | `step?` | number | 1 | Smallest keyboard and drag increment. |
212
+ | `step?` | number | 1 | Smallest keyboard and drag increment. Nonpositive and nonfinite values use 1. Page keys move by at least one step, or one tenth of the range. |
132
213
  | `thumbFill?` | boolean | false | Fill the thumb with its resolved border color. This follows `thumbTone` and interactive states. |
133
214
  | `thumbSize?` | number \| string | 16 | Diameter of the thumb. Numbers use pixels; strings are CSS lengths. Keep it at least as large as `trackSize`. |
134
- | `thumbTone?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | 'neutral' | Color of the thumb stroke. Pass a named tone or a literal CSS color for a one-off custom tone. Omit it to keep the thumb neutral. |
215
+ | `thumbTone?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | 'neutral' (the Antithesis theme follows `tone`) | Color of the thumb stroke. Pass a named tone or a literal CSS color for a one-off custom tone. An explicit `neutral` keeps the thumb neutral in every theme. |
135
216
  | `tone?` | 'neutral' \| 'brand' \| 'info' \| 'success' \| 'warning' \| 'critical' \| (string & {}) | 'neutral' | Color of the filled rail. Pass a named tone or a literal CSS color for a one-off custom tone. The unfilled rail stays neutral. |
136
217
  | `trackClick?` | 'drag-only' \| 'jump' | 'drag-only' | Controls what happens when the rail is pressed. `drag-only` starts dragging from the current value. `jump` first moves to the pressed position. |
137
218
  | `trackSize?` | number \| string | 2 | Thickness of both rail segments. Numbers use pixels; strings are CSS lengths. Keep it no larger than the thumb diameter. |
138
- | `value?` | number \| SliderRangeValue | — | Controlled value. A pair of numbers selects a range. Update it from `onValueChange`. |
219
+ | `value?` | number \| SliderRangeValue | — | Controlled numeric value. A pair selects a range, ordered low to high. Omit or pass `undefined` for uncontrolled use; `0` stays controlled. Runtime `null` is treated as omission; it is not a controlled empty value. Takes precedence over `defaultValue`, including on form reset. Values are clamped to the bounds and rounded to a step measured from `min`. Releasing control retains the last applied value. There is no empty numeric state. |
139
220
  | `valueDisplay?` | 'end' \| 'inline' \| 'thumb' \| 'none' | 'end' | Where the live value appears. `end` puts it at the right edge of the label row. `inline` renders `Label: value`. `thumb` keeps it above the thumb. |
140
221
  | `valuePrefix?` | string | — | Text inserted before the live numeric value, such as `$`. |
141
222
  | `valueSuffix?` | string | — | Text inserted after the live numeric value, such as `%` or `°C`. |
142
223
 
143
224
  ## Web Component
144
225
 
145
- Use `<a-slider>` when you are not using React or Preact. Add its `role` and accessible name yourself, then register it from `@antadesign/anta/elements`.
226
+ Use `<a-slider>` with `value` for a controlled value or `defaultvalue` for an
227
+ uncontrolled initial value. Reading the `value` property returns the applied
228
+ number or sorted pair. `input` and `change` events carry request snapshots in
229
+ `event.detail`; accept a controlled request by assigning `event.detail.value` to
230
+ the `value` property. Application updates are silent. See
231
+ [Install and configure](../install-config.md) for imports and hydration setup.
232
+
233
+ Setting the `value` property reflects the controlled `value` attribute. Removing
234
+ that attribute, or assigning `null` or `undefined` to the property, releases
235
+ control and retains the last applied number. Assigning `defaultValue` reflects
236
+ `defaultvalue`. Uncontrolled interaction, reset, and restoration never rewrite
237
+ these attributes. The applied value stays in internal state and form submission.
238
+
239
+ Add `tabindex="0"` to a scalar slider, and supply its accessible name. The element
240
+ provides the default slider or group role through `ElementInternals`.
146
241
 
147
242
  For a range, separate the two numbers with a space in `value` or `defaultvalue`.
148
243
  Use `role="group"` and give the range an accessible name. Each thumb receives
@@ -192,7 +287,29 @@ as `Slider`. In raw HTML, `round` needs a CSS length such as `"4px"`; JSX
192
287
 
193
288
  ## Styling
194
289
 
195
- `Slider` renders an `<a-slider>` with a circular thumb. `tone` and `thumbTone` accept named or custom CSS colors; custom values use the public `--slider-tone-source` and `--slider-thumb-tone-source` knobs. Use `round` to shape the rail and thumb together. Target its shadow parts to change their presentation without taking on the interaction code: `::part(thumb)` customizes the thumb’s surface and stroke. The element exposes `header`, `label`, `value`, `control`, `track`, `fill`, `thumb`, `thumb-value`, `markers`, and `extras`.
290
+ `Slider` renders an `<a-slider>` with a circular thumb. `tone` and `thumbTone` accept named or custom CSS colors; custom values use the public `--slider-tone-source` and `--slider-thumb-tone-source` knobs. Use `round` to shape the rail and thumb together. Target its shadow parts to change their presentation without taking on the interaction code: `::part(thumb)` customizes the thumb’s surface and stroke. Existing parts remain available: `header`, `label`, `value`, `control`, `track`,
291
+ `fill`, `thumb`, `thumb-value`, `markers`, and `extras`. `thumb-1` and `thumb-2`
292
+ identify physical thumbs and retain their identity when crossing. Additional parts
293
+ include `rail-area`, `inline-value`, `end-value`, `value-separator`, `value-affix`,
294
+ `fill-start`, `fill-end`, `thumb-value-1`, and `thumb-value-2`.
295
+
296
+ Defaults load from external CSS, including styles for these shadow parts. Place
297
+ consumer overrides in `components`, `utilities`, or unlayered CSS; earlier `base`
298
+ rules lose to Anta defaults. Load Slider CSS in the same root as the host when
299
+ rendering inside a consumer shadow root. Existing part names may have additional
300
+ tokens, so use `[part~="thumb"]` for shadow queries.
301
+
302
+ Public host states describe applied presentation: `range`, `dragging`,
303
+ `pointer-focus`, `thumb-1-active`, and `thumb-2-active`. The active-thumb states
304
+ identify the most recently focused or pressed physical thumb. Region states
305
+ `has-header`, `has-markers`, `has-extras`, `has-fill`, `has-fill-end`,
306
+ `has-thumb-value`, and `has-thumb-value-end` indicate visible regions, including
307
+ coincident range bubbles.
308
+
309
+ Custom colors, radius, sizing, marker positions, and application `style` props can
310
+ serialize inline style attributes during SSR. Under `style-src-attr 'none'`, use
311
+ external consumer CSS for those values; see [CSP guidance](../install-config.md#content-security-policy).
312
+ Default external styling does not remove that separate inline-style constraint.
196
313
 
197
314
  ```css
198
315
  /* The class is only for the demo. Use your own selector. */
@@ -208,7 +208,8 @@ const index = options.findIndex((option) => option.value === phase)
208
208
  ## Orientation
209
209
 
210
210
  Horizontal steps scroll when needed. Vertical steps place the active panel before
211
- the next step.
211
+ the next step. This layout uses external CSS and needs no inline style attributes
212
+ under a strict [Content Security Policy](../install-config.md#content-security-policy).
212
213
 
213
214
  ```tsx
214
215
  <Steps
@@ -288,8 +289,10 @@ shipped Steps stylesheet. The [Tabs Web Component](./tabs.md#web-component) insi
288
289
  owns selection and panel behavior; markers, states, and tones stay in your markup.
289
290
 
290
291
  ```js
291
- import '@antadesign/anta/elements'
292
- import '@antadesign/anta/components/Steps.css'
292
+ import '@antadesign/anta/elements/a-steps'
293
+ import '@antadesign/anta/elements/a-tabs'
294
+ import '@antadesign/anta/elements/a-tab'
295
+ import '@antadesign/anta/elements/a-tabpanel'
293
296
  ```
294
297
 
295
298
  ```html
@@ -2,7 +2,8 @@
2
2
 
3
3
  Switches change a single setting immediately. Use a checkbox when people select one or more values to submit together.
4
4
 
5
- The `Switch` wrapper renders a form-associated `<a-switch>` element. It works uncontrolled with `defaultChecked`, or controlled with `checked` and `onStateChange`.
5
+ Use `defaultChecked` for an initial setting, or pair `checked` with
6
+ `onStateChange` when the application controls the setting.
6
7
 
7
8
  ## Tone
8
9
 
@@ -121,10 +122,9 @@ Use **`onStateChange`** to intercept a toggle or drive a controlled switch. Use
121
122
 
122
123
  ## Accessibility
123
124
 
124
- The wrapper sets `role="switch"`, and the element keeps `aria-checked` in sync
125
- with the current value. Its light-DOM label supplies the accessible name and its
126
- hint supplies the accessible description through `ElementInternals`; no generated
127
- IDs are needed. For a label-less switch, pass `aria-label`.
125
+ The label names the switch for screen readers, and the hint supplies its
126
+ description. Without a visible label, pass `aria-label`. Screen readers
127
+ announce the current state.
128
128
 
129
129
  Space toggles the switch. It follows the [WAI-ARIA switch pattern](https://www.w3.org/WAI/ARIA/apg/patterns/switch/).
130
130
 
@@ -150,10 +150,9 @@ Space toggles the switch. It follows the [WAI-ARIA switch pattern](https://www.w
150
150
 
151
151
  ## Web Component
152
152
 
153
- Use the web component directly when you are not using React or Preact and a native control does not fit.
154
-
155
- The focusable host carries the state. Label and hint are light-DOM children that
156
- the element exposes as its accessible name and description.
153
+ Use `<a-switch>` directly outside JSX. Set `role="switch"` and `tabindex="0"`
154
+ for keyboard access. Its label and hint supply the accessible name and
155
+ description.
157
156
 
158
157
  ```html
159
158
  <a-switch role="switch" tabindex="0" name="updates" default-state="checked">