@antadesign/anta 0.3.22 → 0.3.24

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 (73) hide show
  1. package/dist/avatar-core.d.ts +160 -0
  2. package/dist/avatar-core.js +271 -0
  3. package/dist/bundle.css +1 -0
  4. package/dist/bundle.d.ts +11 -0
  5. package/dist/bundle.js +1245 -0
  6. package/dist/components/Avatar.d.ts +63 -0
  7. package/dist/components/Avatar.js +29 -0
  8. package/dist/components/Breadcrumbs.css +1 -0
  9. package/dist/components/Breadcrumbs.d.ts +127 -0
  10. package/dist/components/Breadcrumbs.js +145 -0
  11. package/dist/components/Button.d.ts +14 -7
  12. package/dist/components/Button.js +2 -0
  13. package/dist/components/Input.d.ts +3 -1
  14. package/dist/components/Input.js +2 -0
  15. package/dist/components/InputTime.d.ts +3 -1
  16. package/dist/components/InputTime.js +2 -0
  17. package/dist/components/Loader.d.ts +5 -1
  18. package/dist/components/Loader.js +2 -1
  19. package/dist/components/MenuItemCopy.d.ts +14 -3
  20. package/dist/components/MenuItemCopy.js +9 -3
  21. package/dist/components/Slider.d.ts +1 -1
  22. package/dist/components/Steps.css +1 -0
  23. package/dist/components/Steps.d.ts +93 -0
  24. package/dist/components/Steps.js +128 -0
  25. package/dist/components/Tabs.d.ts +10 -5
  26. package/dist/components/Tabs.js +5 -2
  27. package/dist/components/Tooltip.d.ts +5 -5
  28. package/dist/elements/a-avatar.css +1 -0
  29. package/dist/elements/a-avatar.d.ts +31 -0
  30. package/dist/elements/a-avatar.js +98 -0
  31. package/dist/elements/a-button.css +1 -1
  32. package/dist/elements/a-dialog.js +3 -1
  33. package/dist/elements/a-icon.shapes.css +1 -1
  34. package/dist/elements/a-icon.shapes.d.ts +2 -9
  35. package/dist/elements/a-icon.shapes.js +2 -16
  36. package/dist/elements/a-input-time.d.ts +2 -0
  37. package/dist/elements/a-input-time.js +7 -0
  38. package/dist/elements/a-input.css +1 -1
  39. package/dist/elements/a-input.d.ts +4 -0
  40. package/dist/elements/a-input.js +9 -0
  41. package/dist/elements/a-loader.css +1 -1
  42. package/dist/elements/a-slider.css +1 -1
  43. package/dist/elements/a-tabs.css +1 -1
  44. package/dist/elements/a-tooltip.d.ts +4 -4
  45. package/dist/elements/a-tooltip.js +18 -15
  46. package/dist/elements/index.d.ts +1 -0
  47. package/dist/elements/index.js +3 -0
  48. package/dist/general_types.d.ts +42 -0
  49. package/dist/index.d.ts +9 -1
  50. package/dist/index.js +30 -0
  51. package/dist/jsx-runtime.d.ts +8 -1
  52. package/dist/search-index.json +0 -0
  53. package/docs/changelog.md +60 -0
  54. package/docs/comparison.md +10 -5
  55. package/docs/components/banner.md +1 -1
  56. package/docs/components/breadcrumbs.md +177 -0
  57. package/docs/components/button.md +7 -4
  58. package/docs/components/card.md +1 -1
  59. package/docs/components/dialog.md +4 -4
  60. package/docs/components/expander.md +1 -1
  61. package/docs/components/input-time.md +1 -0
  62. package/docs/components/input.md +2 -1
  63. package/docs/components/loader.md +1 -0
  64. package/docs/components/menu.md +7 -2
  65. package/docs/components/radio.md +1 -1
  66. package/docs/components/slider.md +1 -1
  67. package/docs/components/steps.md +324 -0
  68. package/docs/components/tabs.md +24 -8
  69. package/docs/components/tag.md +3 -3
  70. package/docs/components/tooltip.md +5 -5
  71. package/docs/index.md +2 -0
  72. package/docs/install-config.md +17 -0
  73. package/package.json +9 -3
@@ -0,0 +1,177 @@
1
+ # Breadcrumbs
2
+
3
+ Hierarchy navigation assembled from Anta Buttons. Breadcrumb entries can be
4
+ links, actions, or copy controls. Set `maxItems` to fold one middle range into a
5
+ More menu without measuring the available width.
6
+
7
+ ## Items
8
+
9
+ Pass ordered data through `items`. An `href` renders a native link with the
10
+ Button appearance; omit it for an action button. Each item accepts `label`,
11
+ `icon`, `iconTrailing`, `tone`, `disabled`, `onClick`, `className`, `style`,
12
+ `id`, `title`, and `data-*` / `aria-*` attributes. `size`, priority, and
13
+ underline treatment belong to the whole trail so every visible control retains
14
+ the same height.
15
+
16
+ ```tsx
17
+ <Breadcrumbs
18
+ aria-label="Project location"
19
+ items={[
20
+ { label: 'Home', href: '/', icon: 'home' },
21
+ { label: 'Projects', href: '/projects', icon: 'folder-open', tone: 'brand' },
22
+ { label: 'Refresh', icon: 'refresh', onClick: reload },
23
+ ]}
24
+ />
25
+ ```
26
+
27
+ An item with `current` receives `aria-current="page"`. The current item may
28
+ remain a link when revisiting the page is useful, or it can be an action such as
29
+ copying the current path.
30
+
31
+ ## Priority, size, underline, and padding
32
+
33
+ Breadcrumbs use either `tertiary` or `quaternary` Button priority. `size` drives
34
+ every visible crumb and the More control: small is 24px, medium is 28px, and
35
+ large is 32px. `underline` and `underlineOnHover` forward to each visible Button.
36
+ With `priority="quaternary"` (the default), `paddingless` removes their horizontal
37
+ padding without changing their height, and uses a `0.75ch` gap around separators.
38
+
39
+ ```tsx
40
+ <Breadcrumbs priority="tertiary" size="small" items={items} />
41
+ <Breadcrumbs priority="quaternary" underline="solid" underlineOnHover items={items} />
42
+ <Breadcrumbs paddingless items={items} />
43
+ <Breadcrumbs priority="tertiary" size="large" items={items} />
44
+ ```
45
+
46
+ The default is medium quaternary. `tertiary` adds a hover fill. `quaternary`
47
+ keeps the trail text-only, which suits dense page headers. An underline is
48
+ permanent unless `underlineOnHover` is set. `paddingless` is only available with
49
+ quaternary priority.
50
+
51
+ ## Separators
52
+
53
+ Pass any of `→`, `/`, `•`, or `▸` for a text separator. Pass an
54
+ Anta icon shape for an icon separator. Separators are decorative and hidden from
55
+ assistive technology.
56
+
57
+ ```tsx
58
+ <Breadcrumbs separator="→" items={items} />
59
+ <Breadcrumbs separator="/" items={items} />
60
+ <Breadcrumbs separator="•" items={items} />
61
+ <Breadcrumbs separator="▸" items={items} />
62
+ <Breadcrumbs separator="chevron-right" items={items} />
63
+ ```
64
+
65
+ `chevron-right` is the default. The icon form accepts any registered `IconShape`,
66
+ including icons added by an application through Anta's icon generator. Icon
67
+ separators use no flex gap; text separators keep the configured gap.
68
+
69
+ ## Folding into More
70
+
71
+ `maxItems` limits the number of original breadcrumb entries that remain visible;
72
+ the More control does not count. When folding, `itemsBeforeCollapse` controls
73
+ where More appears. Its default is `0`, so More comes first and the most recent
74
+ items remain visible. The final original item is always kept visible.
75
+
76
+ ```tsx
77
+ // More / Projects / Anta / Button.tsx
78
+ <Breadcrumbs maxItems={3} items={items} />
79
+
80
+ // Home / Workspace / More / src / Button.tsx
81
+ <Breadcrumbs maxItems={4} itemsBeforeCollapse={2} items={items} />
82
+ ```
83
+
84
+ The More trigger is an icon-only Button followed by an Anta `Menu`; it supports
85
+ pointer, keyboard, and outside-dismiss interaction through the existing menu
86
+ primitive. Folded links retain their native link behavior, while folded actions
87
+ become menu selections.
88
+
89
+ ## Copying the current item
90
+
91
+ An item with `copy`, `copyNode`, or `copyUrl` uses `ButtonCopy` while visible and
92
+ `MenuItemCopy` if it is folded. Copy entries cannot combine with `href`. Mark a
93
+ copying final item `current` when it represents the current page.
94
+
95
+ ```tsx
96
+ <Breadcrumbs
97
+ items={[
98
+ { label: 'Home', href: '/' },
99
+ {
100
+ label: 'Button.tsx',
101
+ current: true,
102
+ copy: 'src/components/Button.tsx',
103
+ iconPlacement: 'trailing',
104
+ copiedLabel: 'Path copied',
105
+ },
106
+ ]}
107
+ />
108
+ ```
109
+
110
+ Use `copyUrl` to copy `location.href`, `copyNode` to copy a marked rendered
111
+ region, or `copy` for a known string. `onCopyRequest` refreshes a reactive string
112
+ before copying, and `onCopied` receives the result.
113
+
114
+ ### Props
115
+
116
+ | Prop | Type | Default | Description |
117
+ |------|------|---------|-------------|
118
+ | `items` | BreadcrumbItem[] | — | Ordered breadcrumb entries. |
119
+ | `itemsBeforeCollapse?` | number | 0 | Number of original items kept before the More control when `maxItems`
120
+ collapses the trail. The rest of the visible-item budget is kept from the
121
+ end, so `0` puts More first. |
122
+ | `maxItems?` | number | — | Maximum number of original breadcrumb items left visible. The More
123
+ control does not count. Omit to keep every item visible. |
124
+ | `moreLabel?` | string | 'Show more breadcrumbs' | Accessible name for the More control. |
125
+ | `paddingless?` | boolean | — | Remove horizontal padding from every visible breadcrumb control. |
126
+ | `priority?` | 'quaternary' \| 'tertiary' | quaternary | Button priority applied to every visible item and the More control. |
127
+ | `separator?` | BreadcrumbSeparator | 'chevron-right' | Separator between visible entries. |
128
+ | `size?` | 'small' \| 'medium' \| 'large' | 'medium' | Button size applied to every visible item and the More control. |
129
+ | `underline?` | 'solid' \| 'dashed' \| 'dotted' | — | Underline style applied to every visible breadcrumb control. |
130
+ | `underlineOnHover?` | boolean | — | Hide the underline at rest and reveal it on hover. |
131
+
132
+ `Breadcrumbs` deliberately adds no custom-element behavior: it assembles Anta
133
+ Buttons, an optional Menu, and two light-DOM layout tags. When you are not using
134
+ JSX, import the Breadcrumbs stylesheet and the primitives, then compose the same
135
+ structure yourself. Keep an overflow Menu immediately after its More Button.
136
+
137
+ ```ts
138
+ import '@antadesign/anta/components/Breadcrumbs.css'
139
+ import '@antadesign/anta/elements'
140
+ ```
141
+
142
+ ```html
143
+ <a-breadcrumbs role="navigation" aria-label="Project location" data-paddingless>
144
+ <a href="/" data-anta role="button" priority="quaternary" paddingless>
145
+ <a-button-label>Home</a-button-label>
146
+ </a>
147
+ <a-breadcrumb-separator aria-hidden="true">•</a-breadcrumb-separator>
148
+
149
+ <a-button role="button" tabindex="0" priority="quaternary" paddingless
150
+ aria-label="Show more breadcrumbs" aria-haspopup="menu">
151
+ <a-icon shape="more" aria-hidden="true"></a-icon>
152
+ </a-button>
153
+ <a-menu autowidth>
154
+ <a href="/workspace" data-anta-menu-item role="menuitem"><a-menu-item-label>Workspace</a-menu-item-label></a>
155
+ <a href="/workspace/projects" data-anta-menu-item role="menuitem"><a-menu-item-label>Projects</a-menu-item-label></a>
156
+ </a-menu>
157
+
158
+ <a-breadcrumb-separator aria-hidden="true">•</a-breadcrumb-separator>
159
+ <a href="/workspace/projects/anta" data-anta role="button" priority="quaternary"
160
+ paddingless aria-current="page"><a-button-label>Anta</a-button-label></a>
161
+ </a-breadcrumbs>
162
+ ```
163
+
164
+ Use `priority`, `size`, and `separator` before adding CSS. A `className` on
165
+ `Breadcrumbs` lands on the navigation wrapper; item `className` values land on
166
+ their individual Buttons. The composed structure uses light-DOM tags, so plain
167
+ CSS can style a separator directly.
168
+
169
+ ```tsx
170
+ <Breadcrumbs className="project-breadcrumbs" separator="chevron-right" items={items} />
171
+ ```
172
+
173
+ ```css
174
+ .project-breadcrumbs a-breadcrumb-separator {
175
+ color: var(--text-2);
176
+ }
177
+ ```
@@ -5,7 +5,7 @@ component (or `<a role="button">` when `href` is set). Tone, priority,
5
5
  size, and state are all plain attributes, so the styling is identical
6
6
  whether you use the wrapper or author the element by hand.
7
7
 
8
- ## Priorities
8
+ ## Priority
9
9
 
10
10
  A button's priority helps control how much attention it draws:
11
11
 
@@ -21,7 +21,7 @@ A button's priority helps control how much attention it draws:
21
21
  - `tertiary` — Background-less at rest, fills on hover.
22
22
  - `quaternary` — Text only, no background.
23
23
 
24
- ## Tones
24
+ ## Tone
25
25
 
26
26
  Six named tones — `neutral` (default), `brand`, `critical`, `info`,
27
27
  `success`, `warning`. Omitting `tone` — or passing an empty string —
@@ -66,7 +66,7 @@ too, so there's no state change; to keep distinct states, set the per-state
66
66
  variables instead — `--button-bg-{priority}-hover`,
67
67
  `--button-bg-{priority}-active`, and the `--button-fg-*` equivalents.
68
68
 
69
- ## Sizes
69
+ ## Size
70
70
 
71
71
  ```tsx
72
72
  <Button tone="brand" size="small" label="Small" />
@@ -190,11 +190,13 @@ dropped (a valid `0` still renders).
190
190
  <Button tone="brand" priority="tertiary" underline="solid" label="Solid" />
191
191
  <Button tone="brand" priority="tertiary" underline="dashed" label="Dashed" />
192
192
  <Button tone="brand" priority="tertiary" underline="dotted" label="Dotted" />
193
+ <Button tone="brand" priority="quaternary" underline="solid" underlineOnHover label="Hover only" />
193
194
  ```
194
195
 
195
196
  When the button has a [link mode](#link-mode), or you simply want an
196
197
  underline stylistically, it supports three styles — `solid`, `dashed`,
197
- `dotted` (only valid on `priority="tertiary"` / `"quaternary"`).
198
+ `dotted` (only valid on `priority="tertiary"` / `"quaternary"`). Set
199
+ `underlineOnHover` to keep that underline hidden until pointer hover.
198
200
 
199
201
  ## States
200
202
 
@@ -369,6 +371,7 @@ because the write happens on the click.
369
371
  brand curve so any input stays legible. |
370
372
  | `type?` | 'button' \| 'submit' \| 'reset' | — | Form submission type. |
371
373
  | `underline?` | 'solid' \| 'dashed' \| 'dotted' | — | Underline style. |
374
+ | `underlineOnHover?` | boolean | — | Hide the underline at rest and reveal it on hover. |
372
375
 
373
376
  ## Link mode
374
377
 
@@ -62,7 +62,7 @@ when toned (stepping to `border-3` on hover).
62
62
  <Card priority="tertiary" header="Tertiary">…</Card>
63
63
  ```
64
64
 
65
- ## Tones
65
+ ## Tone
66
66
 
67
67
  A semantic `tone` tints the surface, border, and text. The set matches the rest of
68
68
  Anta: `neutral` (the default) plus `brand`, `info`, `success`, `warning`, and
@@ -193,13 +193,13 @@ destructive button, and it works the same with or without a close button or
193
193
  focusable content. A screen reader announces the dialog by its `header` text
194
194
  (mirrored to the dialog's accessible name), and the ✕ is the last tab stop.
195
195
 
196
- To focus a specific control on open instead (a search field, say), put
197
- `autofocus` on it; the dialog honors that and skips the default. On close, focus
198
- returns to whatever opened the dialog, from the native `<dialog>`.
196
+ To focus a specific control on open instead (a search field, say), pass
197
+ `autoFocus`; the dialog focuses it before returning from the opening interaction.
198
+ On close, focus returns to whatever opened the dialog, from the native `<dialog>`.
199
199
 
200
200
  ```tsx
201
201
  <Dialog header="Rename" footer={…}>
202
- <Input label="Name" autofocus /> {/* focus the field on open */}
202
+ <Input label="Name" autoFocus />
203
203
  </Dialog>
204
204
  ```
205
205
 
@@ -36,7 +36,7 @@ to see the corners hold their radius as the body appears.
36
36
  <Expander round title="Details" priority="primary">…</Expander>
37
37
  ```
38
38
 
39
- ## Tones
39
+ ## Tone
40
40
 
41
41
  Pick a semantic `tone` to tint the header text and — on the filled
42
42
  priorities (`secondary` / `primary`) — the surface too. The set matches
@@ -68,6 +68,7 @@ range is clamped to the nearest bound as you step or leave the field, and flags
68
68
 
69
69
  | Prop | Type | Default | Description |
70
70
  |------|------|---------|-------------|
71
+ | `autoFocus?` | boolean | — | Focus this field when its containing `Dialog` opens. |
71
72
  | `children?` | ReactNode | — | Extra content rendered under the field, above the hint (a no-box child like
72
73
  a `<Tooltip>` takes no space and anchors to the field). |
73
74
  | `clearable?` | boolean | — | Show a clear button once the field has a value. |
@@ -6,7 +6,7 @@ self-contained (you never pass a control in) yet fully native underneath:
6
6
  focus, IME, autofill, and form submission all work, and the control is reachable
7
7
  for styling through `::part(input)`.
8
8
 
9
- ## Sizes
9
+ ## Size
10
10
 
11
11
  ```tsx
12
12
  <Input size="small" label="Small" placeholder="24px tall" />
@@ -431,6 +431,7 @@ wraps to fewer columns as it narrows. Resize the preview to see it reflow.
431
431
  | `autoComplete?` | 'off' \| 'on' \| 'name' \| 'username' \| 'email' \| 'current-password' \| 'new-password' \| 'one-time-code' \| 'tel' \| 'url' \| (string & {}) | — | Native autocomplete token. Overrides the value derived from `type`
432
432
  (`email` / `tel` / `url`) — set it for the cases `type` can't express, e.g.
433
433
  `username`, `current-password`, `new-password`, `one-time-code`, or `off`. |
434
+ | `autoFocus?` | boolean | — | Focus this field when its containing `Dialog` opens. |
434
435
  | `children?` | ReactNode | — | Extra content rendered directly under the field, above the hint/error (it
435
436
  pushes the message down). A no-box child like an Anta `<Tooltip>` takes no
436
437
  space and anchors to the field — consistent with how tooltips attach
@@ -61,6 +61,7 @@ decorative so nearby status text remains the single announcement. |
61
61
  | `max?` | number | 100 | Upper bound of the range. |
62
62
  | `size?` | number | 16 | Width and height in pixels. |
63
63
  | `speed?` | number | 0.75 | Seconds per rotation. Pass a positive number. |
64
+ | `tone?` | LoaderTone | — | Color tone for the loader. Omit it to use the standard text-3 color. |
64
65
  | `value?` | number \| false | — | Current progress value. Omit this prop, or pass `false`, for an
65
66
  indeterminate rotating gradient. |
66
67
 
@@ -39,7 +39,7 @@ const onSelect = (e, { value }) => act(value)
39
39
  </Menu>
40
40
  ```
41
41
 
42
- ## Tones
42
+ ## Tone
43
43
 
44
44
  `tone` colors an item's label, icon, and hover/selected tint (and its
45
45
  `selectionIndicator`) with a semantic palette — `brand`, `info`, `success`,
@@ -370,7 +370,8 @@ chevron stay centered on the row, so it composes with a trailing counter.
370
370
  literal string, `copyNode` for a DOM region. It composes a `<MenuItem>` with a
371
371
  slotted `<a-copy>` element that performs the write, and keeps the menu open on
372
372
  select so the check / retone feedback shows. `onCopied(ok)` fires after each
373
- attempt.
373
+ attempt. `iconPlacement="trailing"` moves the feedback glyph to the end of the
374
+ row; `"none"` shows a cursor-near confirmation instead.
374
375
 
375
376
  Copy sits alongside normal items, so a "Share" menu can mix a copy-link row with
376
377
  navigating links.
@@ -391,6 +392,7 @@ navigating links.
391
392
  |------|------|---------|-------------|
392
393
  | `children?` | ReactNode | — | Item content. With `label` set, children are extra content — most
393
394
  notably the nested `<Menu>` for a submenu parent. |
395
+ | `copiedLabel?` | string | Copied | Text in the successful no-icon confirmation. |
394
396
  | `copy?` | string | — | Text copied to the clipboard on activation. |
395
397
  | `copyNode?` | boolean \| string | — | Copy a DOM node as rich text (`text/html`) + plain text. `true` copies
396
398
  the nearest ancestor marked `data-copy-source`; a string is a CSS
@@ -404,6 +406,9 @@ navigating links.
404
406
  option `hint`. Requires `label` (it stacks in a column beneath it). Muted
405
407
  (`--text-3`) and tracks the row's `tone`. A string, or any node. |
406
408
  | `icon?` | IconShape | — | Leading icon shape. |
409
+ | `iconPlacement?` | 'leading' \| 'trailing' \| 'none' | 'leading' | Where the copy glyph sits relative to the label — or `'none'` to omit it.
410
+ Without a glyph, a successful copy shows a confirmation label near the
411
+ pointer and leaves the row unchanged. |
407
412
  | `iconTrailing?` | IconShape | — | A trailing icon. On a `submenu` item this **overrides** the default
408
413
  chevron (omit it to keep the chevron); on a normal item it's the trailing
409
414
  glyph (omit for none). |
@@ -31,7 +31,7 @@ Each option can also set `className`, `style`, and `data-*`.
31
31
  `RadioGroup` forwards them to that option's `<a-radio>` so you can add
32
32
  per-option presentation and application metadata.
33
33
 
34
- ## Tones
34
+ ## Tone
35
35
 
36
36
  ```tsx
37
37
  {/* Usually one tone for the whole group: */}
@@ -80,7 +80,7 @@ for a shared custom radius. |
80
80
  | `step?` | number | 1 | Smallest keyboard and drag increment. |
81
81
  | `thumbFill?` | boolean | false | Fill the thumb with its resolved border color. This follows `thumbTone`
82
82
  and interactive states. |
83
- | `thumbSize?` | number \| string | 18 | Diameter of the thumb. Numbers use pixels; strings are CSS lengths. Keep
83
+ | `thumbSize?` | number \| string | 16 | Diameter of the thumb. Numbers use pixels; strings are CSS lengths. Keep
84
84
  it at least as large as `trackSize`. |
85
85
  | `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
86
86
  one-off custom tone. Omit it to keep the thumb neutral. |