@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.
- package/LICENSE.md +14 -1
- package/README.md +9 -0
- package/dist/anta_helpers.d.ts +46 -30
- package/dist/anta_helpers.js +66 -25
- package/dist/bundle.css +1 -1
- package/dist/bundle.js +2 -1353
- package/dist/components/Banner.d.ts +25 -40
- package/dist/components/Banner.js +15 -17
- package/dist/components/Breadcrumbs.d.ts +0 -1
- package/dist/components/Breadcrumbs.js +0 -1
- package/dist/components/Button.d.ts +2 -3
- package/dist/components/Button.js +1 -0
- package/dist/components/ButtonCopy.js +3 -2
- package/dist/components/Calendar.js +13 -13
- package/dist/components/Card.d.ts +9 -17
- package/dist/components/Card.js +50 -46
- package/dist/components/Dialog.d.ts +1 -0
- package/dist/components/Dialog.js +16 -10
- package/dist/components/Expander.d.ts +6 -21
- package/dist/components/Expander.js +24 -23
- package/dist/components/Icon.d.ts +8 -14
- package/dist/components/Input.d.ts +77 -96
- package/dist/components/Input.js +23 -27
- package/dist/components/InputAutocomplete.d.ts +29 -10
- package/dist/components/InputAutocomplete.js +25 -8
- package/dist/components/InputDate.d.ts +0 -1
- package/dist/components/InputDate.js +2 -3
- package/dist/components/InputTime.d.ts +10 -4
- package/dist/components/InputTime.js +20 -16
- package/dist/components/Loader.d.ts +2 -2
- package/dist/components/Menu.d.ts +5 -4
- package/dist/components/Menu.js +13 -8
- package/dist/components/MenuItem.js +1 -14
- package/dist/components/MenuItemCopy.js +2 -2
- package/dist/components/Panel.d.ts +3 -1
- package/dist/components/Panel.js +17 -11
- package/dist/components/Progress.d.ts +21 -23
- package/dist/components/Progress.js +13 -9
- package/dist/components/RadioGroup.js +6 -8
- package/dist/components/{select-parts.css → Select.css} +1 -1
- package/dist/components/Select.d.ts +53 -36
- package/dist/components/Select.js +53 -98
- package/dist/components/SelectFaceted.d.ts +7 -4
- package/dist/components/SelectFaceted.js +21 -10
- package/dist/components/Slider.d.ts +28 -11
- package/dist/components/Slider.js +20 -20
- package/dist/components/Steps.css +1 -1
- package/dist/components/Steps.d.ts +0 -1
- package/dist/components/Steps.js +1 -12
- package/dist/components/Tabs.d.ts +17 -20
- package/dist/components/Tabs.js +7 -9
- package/dist/components/Text.d.ts +55 -36
- package/dist/components/Text.js +35 -22
- package/dist/components/Title.d.ts +19 -27
- package/dist/components/Title.js +2 -1
- package/dist/components/Toaster.js +9 -2
- package/dist/components/Tooltip.d.ts +10 -15
- package/dist/components/copy-props.d.ts +14 -3
- package/dist/components/copy-props.js +14 -3
- package/dist/components/select-tree.d.ts +24 -0
- package/dist/components/select-tree.js +35 -0
- package/dist/element-base.d.ts +10 -0
- package/dist/element-base.js +15 -0
- package/dist/elements/a-avatar.css +1 -1
- package/dist/elements/a-avatar.js +2 -28
- package/dist/elements/a-banner.css +1 -1
- package/dist/elements/a-banner.d.ts +4 -1
- package/dist/elements/a-banner.js +22 -112
- package/dist/elements/a-breadcrumbs.d.ts +1 -0
- package/dist/elements/a-breadcrumbs.js +1 -0
- package/dist/elements/a-button.css +1 -1
- package/dist/elements/a-button.d.ts +10 -7
- package/dist/elements/a-button.js +18 -1
- package/dist/elements/a-calendar.d.ts +14 -13
- package/dist/elements/a-calendar.js +29 -24
- package/dist/elements/a-card.css +1 -1
- package/dist/elements/a-card.d.ts +0 -9
- package/dist/elements/a-card.js +0 -184
- package/dist/elements/a-checkbox.css +1 -1
- package/dist/elements/a-copy.css +1 -1
- package/dist/elements/a-copy.d.ts +1 -5
- package/dist/elements/a-copy.js +129 -108
- package/dist/elements/a-dialog.css +1 -1
- package/dist/elements/a-dialog.d.ts +1 -1
- package/dist/elements/a-dialog.js +68 -194
- package/dist/elements/a-expander.css +1 -1
- package/dist/elements/a-expander.d.ts +4 -30
- package/dist/elements/a-expander.js +85 -344
- package/dist/elements/a-icon.d.ts +5 -23
- package/dist/elements/a-icon.js +1 -2
- package/dist/elements/a-input-date.d.ts +1 -0
- package/dist/elements/a-input-date.js +1 -0
- package/dist/elements/a-input-time.css +1 -1
- package/dist/elements/a-input-time.d.ts +2 -1
- package/dist/elements/a-input-time.js +101 -168
- package/dist/elements/a-input.css +1 -1
- package/dist/elements/a-input.d.ts +10 -8
- package/dist/elements/a-input.js +155 -230
- package/dist/elements/a-loader.d.ts +5 -8
- package/dist/elements/a-loader.js +1 -2
- package/dist/elements/a-menu-item.css +1 -1
- package/dist/elements/a-menu-item.d.ts +5 -3
- package/dist/elements/a-menu-item.js +5 -1
- package/dist/elements/a-menu.css +1 -1
- package/dist/elements/a-menu.d.ts +5 -7
- package/dist/elements/a-menu.js +383 -299
- package/dist/elements/a-panel.css +1 -1
- package/dist/elements/a-panel.js +19 -37
- package/dist/elements/a-progress.css +1 -1
- package/dist/elements/a-progress.d.ts +0 -22
- package/dist/elements/a-progress.js +0 -100
- package/dist/elements/a-radio-group.d.ts +1 -1
- package/dist/elements/a-radio-group.js +6 -4
- package/dist/elements/a-select-faceted.d.ts +1 -0
- package/dist/elements/a-select-faceted.js +1 -0
- package/dist/elements/a-select.d.ts +1 -0
- package/dist/elements/a-select.js +1 -0
- package/dist/elements/a-slider.css +1 -1
- package/dist/elements/a-slider.d.ts +11 -3
- package/dist/elements/a-slider.js +244 -242
- package/dist/elements/a-steps.d.ts +1 -0
- package/dist/elements/a-steps.js +1 -0
- package/dist/elements/a-switch.css +1 -1
- package/dist/elements/a-tab.css +1 -1
- package/dist/elements/a-tabpanel.d.ts +2 -2
- package/dist/elements/a-tabpanel.js +13 -3
- package/dist/elements/a-tabs.css +1 -1
- package/dist/elements/a-tabs.d.ts +1 -1
- package/dist/elements/a-tabs.js +6 -4
- package/dist/elements/a-tag.css +1 -1
- package/dist/elements/a-tag.d.ts +1 -0
- package/dist/elements/a-tag.js +1 -0
- package/dist/elements/a-text.css +1 -1
- package/dist/elements/a-text.d.ts +6 -43
- package/dist/elements/a-text.js +110 -193
- package/dist/elements/a-title.css +1 -1
- package/dist/elements/a-title.d.ts +1 -0
- package/dist/elements/a-title.js +1 -0
- package/dist/elements/a-toast.css +1 -1
- package/dist/elements/a-toast.d.ts +10 -45
- package/dist/elements/a-toast.js +80 -66
- package/dist/elements/a-toaster.css +1 -1
- package/dist/elements/a-toaster.js +9 -44
- package/dist/elements/a-tooltip.css +1 -1
- package/dist/elements/a-tooltip.d.ts +1 -1
- package/dist/elements/a-tooltip.js +142 -136
- package/dist/elements/copy-behavior.d.ts +1 -1
- package/dist/elements/copy-behavior.js +21 -21
- package/dist/elements/index.d.ts +9 -3
- package/dist/elements/index.js +6 -6
- package/dist/elements/input-focus-modality.d.ts +15 -0
- package/dist/elements/input-focus-modality.js +44 -0
- package/dist/elements/input-trailing-actions.d.ts +5 -0
- package/dist/elements/input-trailing-actions.js +38 -0
- package/dist/elements/shadow-aria.d.ts +2 -0
- package/dist/elements/shadow-aria.js +2 -1
- package/dist/elements/value-input.d.ts +3 -0
- package/dist/elements/value-input.js +12 -0
- package/dist/general_types.d.ts +103 -96
- package/dist/index.d.ts +1 -1
- package/dist/input-events.d.ts +4 -0
- package/dist/input-events.js +15 -0
- package/dist/jsx-runtime.d.ts +70 -23
- package/dist/jsx-runtime.js +26 -19
- package/dist/native-event-props.d.ts +2 -0
- package/dist/native-event-props.js +10 -0
- package/dist/reset.css +1 -1
- package/dist/theme-antithesis.css +10 -1
- package/dist/theme-antune.css +1 -1
- package/docs/accessibility.md +17 -3
- package/docs/changelog.md +384 -2
- package/docs/comparison.md +2 -2
- package/docs/components/avatar.md +5 -0
- package/docs/components/banner.md +117 -187
- package/docs/components/breadcrumbs.md +9 -6
- package/docs/components/button.md +22 -0
- package/docs/components/card.md +74 -28
- package/docs/components/checkbox.md +9 -10
- package/docs/components/dialog.md +83 -32
- package/docs/components/expander.md +198 -435
- package/docs/components/icon.md +11 -17
- package/docs/components/input-autocomplete.md +152 -52
- package/docs/components/input-date.md +175 -148
- package/docs/components/input-time.md +81 -38
- package/docs/components/input.md +343 -349
- package/docs/components/loader.md +2 -1
- package/docs/components/menu.md +35 -6
- package/docs/components/panel.md +18 -0
- package/docs/components/progress.md +83 -49
- package/docs/components/radio.md +39 -43
- package/docs/components/select-faceted.md +54 -7
- package/docs/components/select.md +390 -386
- package/docs/components/slider.md +136 -19
- package/docs/components/steps.md +6 -3
- package/docs/components/switch.md +8 -9
- package/docs/components/tabs.md +110 -104
- package/docs/components/text.md +110 -86
- package/docs/components/title.md +47 -33
- package/docs/components/toaster.md +242 -84
- package/docs/components/tooltip.md +204 -113
- package/docs/install-config.md +461 -96
- package/docs/packages/plot.md +228 -143
- package/docs/theming.md +29 -13
- package/package.json +43 -4
- package/theme-antithesis-license.md +66 -0
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Checkboxes let users select one or more items from a set, or toggle an option on or off. Use them for multiple independent choices; for a single immediate setting, use a switch instead.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Use `defaultChecked` for an initial choice, or pair `checked` with
|
|
6
|
+
`onStateChange` to control it. Pass `'indeterminate'` for a mixed selection,
|
|
7
|
+
such as a parent checkbox whose children have different states.
|
|
6
8
|
|
|
7
9
|
## Tone
|
|
8
10
|
|
|
@@ -163,11 +165,9 @@ function ParentChild() {
|
|
|
163
165
|
|
|
164
166
|
## Accessibility
|
|
165
167
|
|
|
166
|
-
The
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
`ElementInternals`; no generated IDs are needed. For a label-less checkbox, pass
|
|
170
|
-
`aria-label`.
|
|
168
|
+
The label names the checkbox for screen readers, and the hint supplies its
|
|
169
|
+
description. Without a visible label, pass `aria-label`. Screen readers
|
|
170
|
+
announce the current state.
|
|
171
171
|
|
|
172
172
|
Space toggles the checkbox. Follows the [WAI-ARIA checkbox pattern](https://www.w3.org/WAI/ARIA/apg/patterns/checkbox/).
|
|
173
173
|
|
|
@@ -192,10 +192,9 @@ Space toggles the checkbox. Follows the [WAI-ARIA checkbox pattern](https://www.
|
|
|
192
192
|
|
|
193
193
|
## Web Component
|
|
194
194
|
|
|
195
|
-
Use
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
the element exposes as its accessible name and description.
|
|
195
|
+
Use `<a-checkbox>` directly outside JSX. Set `role="checkbox"` and `tabindex="0"`
|
|
196
|
+
for keyboard access. Its label and hint supply the accessible name and
|
|
197
|
+
description.
|
|
199
198
|
|
|
200
199
|
```html
|
|
201
200
|
<a-checkbox role="checkbox" tabindex="0" name="updates" default-state="checked">
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
# Dialog
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
stacking context on the page), the focus trap, focus return on close, the
|
|
7
|
-
backdrop, and Esc all come from the platform.
|
|
8
|
-
|
|
9
|
-
It has three optional zones: a `header`, the body (`children`), and a `footer`,
|
|
10
|
-
plus a close button in the top-right corner. Set `position` to make it an edge
|
|
11
|
-
drawer instead.
|
|
3
|
+
Dialog opens content above a dimmed backdrop and keeps focus inside until it
|
|
4
|
+
closes. It has optional header and footer regions, a scrollable body, and a close
|
|
5
|
+
button. Set `position` to use an edge drawer.
|
|
12
6
|
|
|
13
7
|
## Zones
|
|
14
8
|
|
|
@@ -19,21 +13,21 @@ when there are no actions. The footer lays its content out in a right-aligned
|
|
|
19
13
|
row.
|
|
20
14
|
|
|
21
15
|
```tsx
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
<Button onClick={() => setOpen(true)}>Open dialog</Button>
|
|
16
|
+
<Button data-dialog-open="zones">Open dialog</Button>
|
|
25
17
|
<Dialog
|
|
26
|
-
|
|
27
|
-
onStateChange={(_e, { next }) => setOpen(next)}
|
|
18
|
+
name="zones"
|
|
28
19
|
header={<Title level={4}>Enable telemetry?</Title>}
|
|
29
20
|
footer={
|
|
30
21
|
<>
|
|
31
|
-
<Button
|
|
32
|
-
<Button priority="primary"
|
|
22
|
+
<Button data-dialog-close="zones">Not now</Button>
|
|
23
|
+
<Button priority="primary" data-dialog-close="zones">Enable</Button>
|
|
33
24
|
</>
|
|
34
25
|
}
|
|
35
26
|
>
|
|
36
|
-
<Text>
|
|
27
|
+
<Text>
|
|
28
|
+
Anonymous usage data helps us find the bugs that matter. You can change
|
|
29
|
+
this any time in settings.
|
|
30
|
+
</Text>
|
|
37
31
|
</Dialog>
|
|
38
32
|
```
|
|
39
33
|
|
|
@@ -64,10 +58,9 @@ that thickness. Resize it with a position-scoped `::part(dialog)` rule (see
|
|
|
64
58
|
|
|
65
59
|
## Rounding corners
|
|
66
60
|
|
|
67
|
-
The
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
drawer `round="left"`.
|
|
61
|
+
The theme sets the centered modal's default corners. Drawers are square unless
|
|
62
|
+
you pass `round`. A **side keyword** rounds only that edge's two corners: a bottom
|
|
63
|
+
sheet takes `round="top"`, a right drawer `round="left"`.
|
|
71
64
|
|
|
72
65
|
```tsx
|
|
73
66
|
<Dialog round={0}>…</Dialog> {/* unrounded centered modal */}
|
|
@@ -79,10 +72,9 @@ drawer `round="left"`.
|
|
|
79
72
|
|
|
80
73
|
A `number` or CSS string sets the amount on all corners; the string may be a full
|
|
81
74
|
`border-radius` shorthand, so `round="12px 12px 0 0"` rounds just the top by 12px
|
|
82
|
-
(a side keyword with a custom amount). Bare `round` rounds all corners
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
shorthands go through the wrapper's `round` prop.
|
|
75
|
+
(a side keyword with a custom amount). Bare `round` rounds all corners, including
|
|
76
|
+
on a drawer. For raw `<a-dialog>`, use a single length (`round="20px"`). Use the
|
|
77
|
+
wrapper's `round` prop for shorthands.
|
|
86
78
|
|
|
87
79
|
## Close button
|
|
88
80
|
|
|
@@ -174,10 +166,22 @@ state: the dialog reopens if `open` is still true. Drive closing through your
|
|
|
174
166
|
state, setting `open` to `false` in `onStateChange`.
|
|
175
167
|
|
|
176
168
|
```tsx
|
|
177
|
-
// controlled
|
|
178
169
|
const [open, setOpen] = useState(false)
|
|
179
|
-
|
|
180
|
-
<
|
|
170
|
+
|
|
171
|
+
<Button onClick={() => setOpen(true)}>Open dialog</Button>
|
|
172
|
+
<Dialog
|
|
173
|
+
open={open}
|
|
174
|
+
onStateChange={(_e, { next }) => setOpen(next)}
|
|
175
|
+
header={<Title level={4}>Enable telemetry?</Title>}
|
|
176
|
+
footer={
|
|
177
|
+
<>
|
|
178
|
+
<Button onClick={() => setOpen(false)}>Not now</Button>
|
|
179
|
+
<Button priority="primary" onClick={() => setOpen(false)}>Enable</Button>
|
|
180
|
+
</>
|
|
181
|
+
}
|
|
182
|
+
>
|
|
183
|
+
<Text>Anonymous usage data helps us find the bugs that matter.</Text>
|
|
184
|
+
</Dialog>
|
|
181
185
|
|
|
182
186
|
// uncontrolled, veto the close while there are unsaved changes
|
|
183
187
|
<Dialog defaultOpen onStateChange={(e, { next }) => {
|
|
@@ -223,8 +227,23 @@ On close, focus returns to whatever opened the dialog, from the native `<dialog>
|
|
|
223
227
|
|
|
224
228
|
Use the web component directly when you are not using React or Preact and a native control does not fit.
|
|
225
229
|
|
|
226
|
-
Slots hold the header, footer, and close control.
|
|
227
|
-
|
|
230
|
+
Slots hold the header, footer, and close control. JSX uses boxless
|
|
231
|
+
`a-dialog-footer` and `a-dialog-close` groups. Raw authors can use those groups
|
|
232
|
+
or assign controls directly to the slots. Existing slot markup remains supported.
|
|
233
|
+
|
|
234
|
+
The element owns the shadow-native dialog and its runtime state. The native
|
|
235
|
+
`<dialog>` supplies top-layer placement, backdrop, focus containment, focus
|
|
236
|
+
restoration, and Escape handling. It escapes ancestor clipping and stacking
|
|
237
|
+
contexts. The element leaves host attributes and authored children unchanged. Load the element stylesheet
|
|
238
|
+
with the granular entry or load `bundle.css` with the full bundle. Default
|
|
239
|
+
layout and transitions require no injected styles or fixed inline styles.
|
|
240
|
+
Load CSS before opening a dialog, including one with `defaultOpen`. Without it,
|
|
241
|
+
the native modal remains visible and closable, but Anta's layout, boxless region
|
|
242
|
+
groups, close-control placement, and animations are unavailable.
|
|
243
|
+
Application-supplied `style` props and custom `round` amounts can still produce
|
|
244
|
+
style attributes blocked by `style-src-attr 'none'`.
|
|
245
|
+
|
|
246
|
+
Add `tabindex="0"` to every raw `<a-button>`.
|
|
228
247
|
|
|
229
248
|
```html
|
|
230
249
|
<a-button role="button" tabindex="0" data-dialog-open="invite"><a-button-label>Invite teammates</a-button-label></a-button>
|
|
@@ -246,9 +265,38 @@ radius). For everything else, style the shadow **parts** in plain CSS.
|
|
|
246
265
|
|
|
247
266
|
`<a-dialog>` exposes `::part(dialog)` (the surface), `::part(header)`,
|
|
248
267
|
`::part(body)`, `::part(footer)`, `::part(close)`, and `::part(dialog)::backdrop`
|
|
249
|
-
(the overlay).
|
|
268
|
+
(the overlay). Defaults live in external CSS. An unlayered consumer rule
|
|
269
|
+
overrides them with no
|
|
250
270
|
`!important`, so the surface, size, radius, shadow, overlay, and zone padding are
|
|
251
|
-
all reachable.
|
|
271
|
+
all reachable. Keep visibility and motion overrides scoped to
|
|
272
|
+
`::part(dialog):modal`; setting `display` on the base part can reveal a closed
|
|
273
|
+
dialog. The native dialog controls closing independently of CSS transitions.
|
|
274
|
+
Entry and exit effects follow the browser's existing `@starting-style`, display,
|
|
275
|
+
and overlay-transition support; reduced motion disables Anta's transitions.
|
|
276
|
+
Surface fades require `::part(dialog):open` support; otherwise the surface stays
|
|
277
|
+
visible without fading. Backdrop fades separately require
|
|
278
|
+
`::part(dialog):modal::backdrop`, keeping static styling when unavailable.
|
|
279
|
+
|
|
280
|
+
Defaults belong to `anta.components`, within the layer order
|
|
281
|
+
`base, anta, components, utilities`. Put consumer overrides in `components`,
|
|
282
|
+
`utilities`, or unlayered CSS. Overrides in the earlier `base` layer lose to
|
|
283
|
+
Anta's defaults. Previously, outer part rules took precedence over the internal
|
|
284
|
+
shadow stylesheet regardless of their layer.
|
|
285
|
+
|
|
286
|
+
Optional regions expose CSS states on the host without adding attributes or
|
|
287
|
+
changing part names. Each state is present when its slot has assigned nodes:
|
|
288
|
+
|
|
289
|
+
| State selector | Assigned slot |
|
|
290
|
+
| --- | --- |
|
|
291
|
+
| `a-dialog:state(has-header)` | `header` |
|
|
292
|
+
| `a-dialog:state(has-footer)` | `footer` |
|
|
293
|
+
|
|
294
|
+
The header, or the body when no header is present, reserves `52px` of inline-end
|
|
295
|
+
padding for a close control. The example increases the header clearance to
|
|
296
|
+
`64px` when `:has(> [slot="close"])` matches. This selector reads the authored
|
|
297
|
+
close-slot markup directly. Firefox can leave clearance stale when an existing
|
|
298
|
+
child's `slot` attribute changes into or out of `close`; adding or removing a
|
|
299
|
+
close child updates normally.
|
|
252
300
|
|
|
253
301
|
**Scope the rule to a position (or a class).** A bare `a-dialog::part(dialog)`
|
|
254
302
|
hits every dialog, drawers included, where a `width` override would collapse a
|
|
@@ -266,6 +314,9 @@ a-dialog.styled-dialog::part(dialog) {
|
|
|
266
314
|
a-dialog.styled-dialog::part(dialog)::backdrop {
|
|
267
315
|
background: color-mix(in oklch, black 60%, transparent);
|
|
268
316
|
}
|
|
317
|
+
a-dialog.styled-dialog:has(> [slot="close"])::part(header) {
|
|
318
|
+
padding-inline-end: 64px;
|
|
319
|
+
}
|
|
269
320
|
```
|
|
270
321
|
|
|
271
322
|
More recipes. The centered modal's max size is the viewport minus a 32px edge
|