@antadesign/anta 0.3.23 → 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 (38) hide show
  1. package/dist/bundle.css +1 -1
  2. package/dist/bundle.js +31 -25
  3. package/dist/components/Breadcrumbs.css +1 -0
  4. package/dist/components/Breadcrumbs.d.ts +127 -0
  5. package/dist/components/Breadcrumbs.js +145 -0
  6. package/dist/components/Button.d.ts +14 -7
  7. package/dist/components/Button.js +2 -0
  8. package/dist/components/Input.d.ts +3 -1
  9. package/dist/components/Input.js +2 -0
  10. package/dist/components/InputTime.d.ts +3 -1
  11. package/dist/components/InputTime.js +2 -0
  12. package/dist/components/MenuItemCopy.d.ts +14 -3
  13. package/dist/components/MenuItemCopy.js +9 -3
  14. package/dist/elements/a-button.css +1 -1
  15. package/dist/elements/a-dialog.js +3 -1
  16. package/dist/elements/a-icon.shapes.css +1 -1
  17. package/dist/elements/a-icon.shapes.d.ts +2 -2
  18. package/dist/elements/a-icon.shapes.js +2 -2
  19. package/dist/elements/a-input-time.d.ts +2 -0
  20. package/dist/elements/a-input-time.js +7 -0
  21. package/dist/elements/a-input.css +1 -1
  22. package/dist/elements/a-input.d.ts +4 -0
  23. package/dist/elements/a-input.js +9 -0
  24. package/dist/general_types.d.ts +6 -0
  25. package/dist/index.d.ts +3 -1
  26. package/dist/index.js +2 -0
  27. package/dist/jsx-runtime.d.ts +2 -0
  28. package/dist/search-index.json +0 -0
  29. package/docs/changelog.md +21 -1
  30. package/docs/comparison.md +8 -3
  31. package/docs/components/breadcrumbs.md +177 -0
  32. package/docs/components/button.md +4 -1
  33. package/docs/components/dialog.md +4 -4
  34. package/docs/components/input-time.md +1 -0
  35. package/docs/components/input.md +1 -0
  36. package/docs/components/menu.md +6 -1
  37. package/docs/index.md +1 -0
  38. package/package.json +1 -1
@@ -8,11 +8,16 @@ Most systems are React-only and use CSS-in-JS, Sass, StyleX, or Tailwind.
8
8
  Anta ships web components with plain CSS in one `@layer`, without a style
9
9
  runtime. Consumer CSS overrides its defaults normally.
10
10
 
11
+ Browser years show the oldest published fixed floor. `~` marks the earliest
12
+ year shared by a browser feature the current system ships, rather than a
13
+ published support promise. Hover a value for the policy and the feature behind
14
+ that estimate.
15
+
11
16
  Fixed-package sizes are measured from the version named on each card. Each npm
12
17
  artifact was downloaded, bundled as a full ESM import with esbuild, minified,
13
- and gzipped. React and React DOM are external. When a library ships base CSS,
14
- the total adds its separately gzipped CSS bundle. The line below each figure
15
- states what it counts.
18
+ and gzipped, then rounded up to the nearest 10 KiB. React and React DOM are
19
+ external. When a library ships base CSS, the total adds its separately gzipped
20
+ CSS bundle. The line below each figure states what it counts.
16
21
 
17
22
  Tree-shaking, peer dependencies, icons, styles, and copied source still make
18
23
  the numbers different shapes. Polaris is a dated CDN snapshot, not a
@@ -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
+ ```
@@ -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
 
@@ -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
 
@@ -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. |
@@ -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
@@ -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). |
package/docs/index.md CHANGED
@@ -25,6 +25,7 @@ Anta is designed for a clean DOM. Prefer the props and attributes exposed by eac
25
25
  - [Progress](./components/progress.md)
26
26
 
27
27
  - [Button](./components/button.md)
28
+ - [Breadcrumbs](./components/breadcrumbs.md)
28
29
  - [Checkbox](./components/checkbox.md)
29
30
  - [Radio](./components/radio.md)
30
31
  - [Switch](./components/switch.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antadesign/anta",
3
- "version": "0.3.23",
3
+ "version": "0.3.24",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",