@antadesign/anta 0.3.21 → 0.3.23
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/dist/avatar-core.d.ts +160 -0
- package/dist/avatar-core.js +271 -0
- package/dist/bundle.css +1 -0
- package/dist/bundle.d.ts +11 -0
- package/dist/bundle.js +1239 -0
- package/dist/components/Avatar.d.ts +63 -0
- package/dist/components/Avatar.js +29 -0
- package/dist/components/Button.d.ts +1 -1
- package/dist/components/Button.js +12 -5
- package/dist/components/Checkbox.js +6 -2
- package/dist/components/Input.d.ts +2 -1
- package/dist/components/Input.js +1 -1
- package/dist/components/InputDate.js +1 -0
- package/dist/components/Loader.d.ts +5 -1
- package/dist/components/Loader.js +2 -1
- package/dist/components/Menu.d.ts +6 -1
- package/dist/components/Menu.js +2 -0
- package/dist/components/RadioGroup.js +21 -5
- package/dist/components/Select.d.ts +3 -1
- package/dist/components/Select.js +1 -0
- package/dist/components/SelectFaceted.d.ts +4 -2
- package/dist/components/Slider.d.ts +1 -1
- package/dist/components/Steps.css +1 -0
- package/dist/components/Steps.d.ts +93 -0
- package/dist/components/Steps.js +128 -0
- package/dist/components/Tabs.d.ts +10 -5
- package/dist/components/Tabs.js +5 -2
- package/dist/components/Tooltip.d.ts +5 -5
- package/dist/elements/a-avatar.css +1 -0
- package/dist/elements/a-avatar.d.ts +31 -0
- package/dist/elements/a-avatar.js +98 -0
- package/dist/elements/a-checkbox.css +1 -1
- package/dist/elements/a-icon.shapes.css +1 -1
- package/dist/elements/a-icon.shapes.d.ts +1 -8
- package/dist/elements/a-icon.shapes.js +0 -14
- package/dist/elements/a-input-time.css +1 -1
- package/dist/elements/a-input-time.js +1 -1
- package/dist/elements/a-input.css +1 -1
- package/dist/elements/a-input.js +1 -1
- package/dist/elements/a-loader.css +1 -1
- package/dist/elements/a-menu.d.ts +4 -2
- package/dist/elements/a-menu.js +122 -4
- package/dist/elements/a-radio.css +1 -1
- package/dist/elements/a-slider.css +1 -1
- package/dist/elements/a-switch.css +1 -1
- package/dist/elements/a-tabs.css +1 -1
- package/dist/elements/a-tooltip.d.ts +4 -4
- package/dist/elements/a-tooltip.js +18 -15
- package/dist/elements/index.d.ts +1 -0
- package/dist/elements/index.js +3 -0
- package/dist/general_types.d.ts +42 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +28 -0
- package/dist/jsx-runtime.d.ts +6 -1
- package/dist/theme-anta.css +1 -1
- package/docs/changelog.md +68 -0
- package/docs/comparison.md +2 -2
- package/docs/components/banner.md +1 -1
- package/docs/components/button.md +3 -3
- package/docs/components/card.md +1 -1
- package/docs/components/expander.md +1 -1
- package/docs/components/input.md +3 -3
- package/docs/components/loader.md +1 -0
- package/docs/components/menu.md +34 -1
- package/docs/components/radio.md +1 -1
- package/docs/components/select-faceted.md +4 -2
- package/docs/components/select.md +3 -1
- package/docs/components/slider.md +1 -1
- package/docs/components/steps.md +324 -0
- package/docs/components/tabs.md +24 -8
- package/docs/components/tag.md +3 -3
- package/docs/components/tooltip.md +5 -5
- package/docs/index.md +1 -0
- package/docs/install-config.md +17 -0
- package/package.json +9 -3
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
# Steps
|
|
2
|
+
|
|
3
|
+
Ordered process navigation built on [`Tabs`](./tabs.md). Use `Tabs` when the views
|
|
4
|
+
are peers rather than phases in a flow.
|
|
5
|
+
|
|
6
|
+
## State
|
|
7
|
+
|
|
8
|
+
Each option needs a unique `value`, a `label`, and a `state`. `state`
|
|
9
|
+
supplies the default marker, `value` controls selection, and `disabled`
|
|
10
|
+
controls access.
|
|
11
|
+
|
|
12
|
+
- `incomplete` — empty circle
|
|
13
|
+
- `loading` — loader
|
|
14
|
+
- `completed` — check
|
|
15
|
+
- `error` — critical ×
|
|
16
|
+
- `disabled` — incomplete marker by default
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
const options = [
|
|
20
|
+
{ value: 'completed', label: 'Completed', state: 'completed' },
|
|
21
|
+
{ value: 'loading', label: 'Loading', state: 'loading' },
|
|
22
|
+
{ value: 'error', label: 'Error', state: 'error' },
|
|
23
|
+
{ value: 'incomplete', label: 'Incomplete', state: 'incomplete' },
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
<Steps fill defaultValue="loading" label="Task state" options={options}>
|
|
27
|
+
<TabPanel value="completed"><Text size="small">This work is complete and ready to use.</Text></TabPanel>
|
|
28
|
+
<TabPanel value="loading"><Text size="small">This work is currently running.</Text></TabPanel>
|
|
29
|
+
<TabPanel value="error"><Text size="small">Resolve this error before continuing.</Text></TabPanel>
|
|
30
|
+
<TabPanel value="incomplete"><Text size="small">This work has not started yet.</Text></TabPanel>
|
|
31
|
+
</Steps>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
An incomplete step can still be selected. Add `disabled` only when it is locked;
|
|
35
|
+
disabled steps keep their layout space and use the incomplete marker by default.
|
|
36
|
+
Pass `marker` or return a value from `renderMarker` to keep a custom marker. Use
|
|
37
|
+
`loading` for work running in the background.
|
|
38
|
+
|
|
39
|
+
## Priority
|
|
40
|
+
|
|
41
|
+
`secondary` is the default: selected markers have a subtle fill inside their
|
|
42
|
+
outline. `primary` fills the selected marker with its tone and uses a white icon,
|
|
43
|
+
like a primary Button. Its 2px resting marker uses `border-3` and its 2px rail
|
|
44
|
+
uses `border-3`; a completed, unselected marker keeps the primary fill at 80%
|
|
45
|
+
without an outline. Its completed connector moves one step stronger to `border-2`.
|
|
46
|
+
`tertiary` removes the marker stroke and makes its marker the icon size plus 2px on
|
|
47
|
+
each side.
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
<Steps
|
|
51
|
+
fill
|
|
52
|
+
priority="primary"
|
|
53
|
+
tone="brand"
|
|
54
|
+
defaultValue="review"
|
|
55
|
+
label="Deployment progress"
|
|
56
|
+
options={[
|
|
57
|
+
{ value: 'build', label: 'Build', state: 'completed' },
|
|
58
|
+
{ value: 'review', label: 'Review', state: 'loading' },
|
|
59
|
+
{ value: 'deploy', label: 'Deploy', state: 'incomplete' },
|
|
60
|
+
]}
|
|
61
|
+
/>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Tone
|
|
65
|
+
|
|
66
|
+
Set `tone` on `Steps` to color every step's label, hint, and icon, plus active
|
|
67
|
+
and completed markers. Inactive incomplete/loading marker rings stay neutral.
|
|
68
|
+
Set `option.tone` when one step needs an override. Labels strengthen on hover and
|
|
69
|
+
selection; hints stay at the muted `text-3` tone. In `secondary` and
|
|
70
|
+
`tertiary`, the marker icon always matches the label's current color; a secondary
|
|
71
|
+
marker's resting stroke uses the matching muted border tone. With every priority,
|
|
72
|
+
the connector after a completed step is one border step stronger: `border-2` from
|
|
73
|
+
the standard `border-3` rail. Error markers stay critical and gain a critical fill
|
|
74
|
+
when selected.
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
const options = [
|
|
78
|
+
{ value: 'done', label: 'Done', hint: 'Complete', state: 'completed' },
|
|
79
|
+
{ value: 'current', label: 'Validate', hint: 'Checking dependencies', state: 'loading' },
|
|
80
|
+
{ value: 'review', label: 'Review', hint: 'Needs attention', state: 'incomplete', tone: 'warning' },
|
|
81
|
+
{ value: 'deploy', label: 'Deploy', hint: 'Waiting', state: 'incomplete', tone: 'info' },
|
|
82
|
+
{ value: 'error', label: 'Error', hint: 'Resolve before continuing', state: 'error' },
|
|
83
|
+
]
|
|
84
|
+
|
|
85
|
+
<Steps tone="brand" defaultValue="current" options={options} />
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Labels and hints ellipsize within each step. Hovering or focusing a clipped step
|
|
89
|
+
shows its full label and hint in a tooltip.
|
|
90
|
+
|
|
91
|
+
Steps and option tones are `neutral` (default), `brand`, `info`, `success`,
|
|
92
|
+
`warning`, and `critical`. Options inherit the Steps tone until `option.tone` is
|
|
93
|
+
set. Omit the Steps tone, or pass an empty string, for neutral; set an option to
|
|
94
|
+
`neutral` or an empty string to opt it out of an inherited tone.
|
|
95
|
+
|
|
96
|
+
## Markers and hints
|
|
97
|
+
|
|
98
|
+
Marker precedence is:
|
|
99
|
+
|
|
100
|
+
1. `renderMarker(...)` result, unless it returns `undefined`
|
|
101
|
+
2. `option.marker`
|
|
102
|
+
3. Built-in marker from `state`
|
|
103
|
+
|
|
104
|
+
Return `null` from `renderMarker` for an intentionally empty ring.
|
|
105
|
+
|
|
106
|
+
A number marker is shown directly; an icon-shape string renders an `Icon`.
|
|
107
|
+
`hint` adds secondary text.
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
const options = [
|
|
111
|
+
{ value: 'draft', label: 'Draft', hint: 'Saved', state: 'completed', marker: 1 },
|
|
112
|
+
{ value: 'approval', label: 'Approval', hint: 'In review', state: 'loading', marker: 'hourglass' },
|
|
113
|
+
{ value: 'publish', label: 'Publish', hint: 'Not started', state: 'incomplete', marker: 'send' },
|
|
114
|
+
]
|
|
115
|
+
|
|
116
|
+
<Steps defaultValue="approval" label="Publishing progress" options={options} />
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Use `renderMarker` when a marker depends on the current step state. Its returned
|
|
120
|
+
node wins; return `undefined` to fall back to `marker`, then the state marker.
|
|
121
|
+
|
|
122
|
+
```tsx
|
|
123
|
+
const options = [
|
|
124
|
+
{ value: 'draft', label: 'Draft', state: 'completed', marker: 1 },
|
|
125
|
+
{ value: 'approval', label: 'Approval', state: 'loading' },
|
|
126
|
+
{ value: 'publish', label: 'Publish', state: 'incomplete', marker: 'send' },
|
|
127
|
+
]
|
|
128
|
+
|
|
129
|
+
<Steps
|
|
130
|
+
defaultValue="approval"
|
|
131
|
+
label="Publishing progress"
|
|
132
|
+
options={options}
|
|
133
|
+
renderMarker={(option, { selected }) =>
|
|
134
|
+
option.state === 'loading'
|
|
135
|
+
? <Icon shape={selected ? 'refresh-ccw-dot' : 'hourglass'} />
|
|
136
|
+
: undefined
|
|
137
|
+
}
|
|
138
|
+
/>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Panels
|
|
142
|
+
|
|
143
|
+
Add a [`TabPanel`](./tabs.md#panels) with the same `value` as its option. Panels stay
|
|
144
|
+
mounted while inactive. Omit them when a router renders the content.
|
|
145
|
+
|
|
146
|
+
## Selection
|
|
147
|
+
|
|
148
|
+
Use `defaultValue` for uncontrolled selection. Use `value` and `onStateChange`
|
|
149
|
+
when the application owns it.
|
|
150
|
+
|
|
151
|
+
```tsx
|
|
152
|
+
const options = [
|
|
153
|
+
{ value: 'build', label: 'Build', state: 'completed' },
|
|
154
|
+
{ value: 'setup', label: 'Setup', state: 'loading' },
|
|
155
|
+
{ value: 'next', label: 'Next steps', state: 'incomplete' },
|
|
156
|
+
]
|
|
157
|
+
const [phase, setPhase] = useState('setup')
|
|
158
|
+
|
|
159
|
+
<Steps
|
|
160
|
+
value={phase}
|
|
161
|
+
tone="brand"
|
|
162
|
+
options={options}
|
|
163
|
+
onStateChange={(_event, { next }) => next && setPhase(next)}
|
|
164
|
+
/>
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
The application also owns state changes and decides when to enable future
|
|
168
|
+
steps. `Steps` does not advance or complete them automatically.
|
|
169
|
+
|
|
170
|
+
### Flow actions
|
|
171
|
+
|
|
172
|
+
Place Back and Continue beside `Steps` so validation and side effects stay in the
|
|
173
|
+
application.
|
|
174
|
+
|
|
175
|
+
```tsx
|
|
176
|
+
const options = [
|
|
177
|
+
{ value: 'build', label: 'Build', state: 'completed' },
|
|
178
|
+
{ value: 'setup', label: 'Setup', state: 'loading' },
|
|
179
|
+
{ value: 'next', label: 'Next steps', state: 'incomplete' },
|
|
180
|
+
]
|
|
181
|
+
const [phase, setPhase] = useState('setup')
|
|
182
|
+
const index = options.findIndex((option) => option.value === phase)
|
|
183
|
+
|
|
184
|
+
<Steps
|
|
185
|
+
value={phase}
|
|
186
|
+
options={options}
|
|
187
|
+
onStateChange={(_event, { next }) => next && setPhase(next)}
|
|
188
|
+
/>
|
|
189
|
+
<Button label="Back" disabled={index === 0} onClick={() => setPhase(options[index - 1].value)} />
|
|
190
|
+
<Button label="Continue" disabled={index === options.length - 1} onClick={() => setPhase(options[index + 1].value)} />
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Size
|
|
194
|
+
|
|
195
|
+
`small`, `medium` (default), and `large` use 24px, 28px, and 32px markers.
|
|
196
|
+
|
|
197
|
+
```tsx
|
|
198
|
+
<Steps
|
|
199
|
+
size="small"
|
|
200
|
+
options={[
|
|
201
|
+
{ value: 'build', label: 'Build', state: 'completed' },
|
|
202
|
+
{ value: 'setup', label: 'Setup', state: 'loading' },
|
|
203
|
+
{ value: 'next', label: 'Next steps', state: 'incomplete' },
|
|
204
|
+
]}
|
|
205
|
+
/>
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Orientation
|
|
209
|
+
|
|
210
|
+
Horizontal steps scroll when needed. Vertical steps place the active panel before
|
|
211
|
+
the next step.
|
|
212
|
+
|
|
213
|
+
```tsx
|
|
214
|
+
<Steps
|
|
215
|
+
orientation="vertical"
|
|
216
|
+
options={[
|
|
217
|
+
{ value: 'build', label: 'Build', state: 'completed' },
|
|
218
|
+
{ value: 'setup', label: 'Setup', state: 'loading' },
|
|
219
|
+
{ value: 'next', label: 'Next steps', state: 'incomplete' },
|
|
220
|
+
]}
|
|
221
|
+
>
|
|
222
|
+
<TabPanel value="build"><Text size="small">Build output is ready.</Text></TabPanel>
|
|
223
|
+
<TabPanel value="setup"><Text size="small">Preparing the environment.</Text></TabPanel>
|
|
224
|
+
<TabPanel value="next"><Text size="small">Review the result.</Text></TabPanel>
|
|
225
|
+
</Steps>
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Pass `label` to name the tablist. Arrow keys follow the orientation; `Home` and
|
|
229
|
+
`End` move to the edges; `Enter` and `Space` activate a focused step. Disabled
|
|
230
|
+
steps are skipped.
|
|
231
|
+
|
|
232
|
+
Markers and connectors are decorative. Put important state text in the active
|
|
233
|
+
panel or an application-owned live region.
|
|
234
|
+
|
|
235
|
+
## Events
|
|
236
|
+
|
|
237
|
+
Events match [`Tabs`](./tabs.md#events).
|
|
238
|
+
|
|
239
|
+
| Callback | When | Cancelable | Payload |
|
|
240
|
+
|---|---|---|---|
|
|
241
|
+
| `onStateChange(event, { next, prev })` | Before selection | Yes | Next and previous values |
|
|
242
|
+
| `onChange(event)` | After selection | No | Native `change` event |
|
|
243
|
+
| `onValueChange(event, { value })` | After selection | No | Selected value |
|
|
244
|
+
|
|
245
|
+
| Prop | Type | Default | Description |
|
|
246
|
+
|------|------|---------|-------------|
|
|
247
|
+
| `options` | StepOption[] | — | Ordered process phases. |
|
|
248
|
+
| `priority?` | StepPriority | 'secondary' | Visual emphasis. Primary uses a solid selected marker and a stronger
|
|
249
|
+
completed connector; secondary is the outlined default; tertiary is compact
|
|
250
|
+
and borderless. |
|
|
251
|
+
| `renderMarker?` | (option, state) => ReactNode | — | Builds a custom marker from a step and its current state. A returned node
|
|
252
|
+
replaces `marker` and the built-in state marker; return `undefined` to use
|
|
253
|
+
those fallbacks, or `null` for an empty ring. |
|
|
254
|
+
| `tone?` | StepTone \| '' | 'neutral' | Tone applied to every step without its own `tone`. Error steps stay
|
|
255
|
+
critical and disabled steps stay neutral. |
|
|
256
|
+
|
|
257
|
+
For framework-free use, compose the same light DOM that `Steps` emits.
|
|
258
|
+
`a-steps` and its `a-step-*` children are structural elements styled by the
|
|
259
|
+
shipped Steps stylesheet. The [Tabs Web Component](./tabs.md#web-component) inside
|
|
260
|
+
owns selection and panel behavior; markers, states, and tones stay in your markup.
|
|
261
|
+
|
|
262
|
+
```js
|
|
263
|
+
import '@antadesign/anta/elements'
|
|
264
|
+
import '@antadesign/anta/components/Steps.css'
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
```html
|
|
268
|
+
<div>
|
|
269
|
+
<a-steps>
|
|
270
|
+
<a-tabs role="tablist" aria-label="Setup progress" priority="secondary" default-state="setup" data-steps fill noslide>
|
|
271
|
+
<a-tab role="tab" value="build" tabindex="0" tone="success">
|
|
272
|
+
<a-step-marker aria-hidden="true"><a-icon shape="check"></a-icon></a-step-marker>
|
|
273
|
+
<a-step-desc><a-tab-label>Build</a-tab-label><a-step-hint>Complete</a-step-hint></a-step-desc>
|
|
274
|
+
</a-tab>
|
|
275
|
+
<a-tab role="tab" value="setup" tabindex="-1" tone="brand">
|
|
276
|
+
<a-step-marker aria-hidden="true"><a-loader></a-loader></a-step-marker>
|
|
277
|
+
<a-step-desc><a-tab-label>Setup</a-tab-label><a-step-hint>In progress</a-step-hint></a-step-desc>
|
|
278
|
+
</a-tab>
|
|
279
|
+
<a-tab role="tab" value="review" tabindex="-1">
|
|
280
|
+
<a-step-marker aria-hidden="true"><a-icon shape="circle-large"></a-icon></a-step-marker>
|
|
281
|
+
<a-step-desc><a-tab-label>Review</a-tab-label><a-step-hint>Waiting</a-step-hint></a-step-desc>
|
|
282
|
+
</a-tab>
|
|
283
|
+
</a-tabs>
|
|
284
|
+
<a-tabpanel role="tabpanel" value="build">Build output is ready.</a-tabpanel>
|
|
285
|
+
<a-tabpanel role="tabpanel" value="setup">Prepare the environment.</a-tabpanel>
|
|
286
|
+
<a-tabpanel role="tabpanel" value="review">Review the result.</a-tabpanel>
|
|
287
|
+
</a-steps>
|
|
288
|
+
</div>
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
Use `priority`, `size`, and `orientation` first. Set `tone` on each option. Each
|
|
292
|
+
option also accepts `className`, `style`, and `data-*` attributes. Markers are
|
|
293
|
+
light DOM; connectors are pseudo-elements.
|
|
294
|
+
|
|
295
|
+
**Dotted connector.** For horizontal steps, replace the connector's solid
|
|
296
|
+
background with a dotted border:
|
|
297
|
+
|
|
298
|
+
```css
|
|
299
|
+
.dotted-steps a-tab:not(:last-child)::before {
|
|
300
|
+
height: 0;
|
|
301
|
+
background: none;
|
|
302
|
+
border-block-start: 2px dotted var(--border-2-brand);
|
|
303
|
+
}
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
`className` on `Steps` applies to `a-steps`. `.dotted-steps` is only the demo
|
|
307
|
+
scope; use your own selector when applying the rule.
|
|
308
|
+
|
|
309
|
+
**Fill the container.** Pass `fill` to spread horizontal steps across their
|
|
310
|
+
container. The connectors take the remaining space, placing the middle step in
|
|
311
|
+
the middle and the last step at the far edge.
|
|
312
|
+
|
|
313
|
+
```tsx
|
|
314
|
+
<Steps
|
|
315
|
+
fill
|
|
316
|
+
defaultValue="review"
|
|
317
|
+
label="Deployment progress"
|
|
318
|
+
options={[
|
|
319
|
+
{ value: 'build', label: 'Build', state: 'completed' },
|
|
320
|
+
{ value: 'review', label: 'Review', state: 'loading' },
|
|
321
|
+
{ value: 'deploy', label: 'Deploy', state: 'incomplete' },
|
|
322
|
+
]}
|
|
323
|
+
/>
|
|
324
|
+
```
|
package/docs/components/tabs.md
CHANGED
|
@@ -6,6 +6,9 @@ A tablist for switching between views. The strip is data-driven: pass an
|
|
|
6
6
|
selectable strip that emits the chosen value; add matching `<TabPanel>` children
|
|
7
7
|
(see [Panels](#panels)) to show and hide the content too.
|
|
8
8
|
|
|
9
|
+
Each option can also set `className`, `style`, and `data-*` attributes on its
|
|
10
|
+
individual `<a-tab>`.
|
|
11
|
+
|
|
9
12
|
## Priority
|
|
10
13
|
|
|
11
14
|
```tsx
|
|
@@ -20,7 +23,7 @@ selectable strip that emits the chosen value; add matching `<TabPanel>` children
|
|
|
20
23
|
- **`secondary`**: a filled tab, no track.
|
|
21
24
|
- **`tertiary`**: an underline.
|
|
22
25
|
|
|
23
|
-
##
|
|
26
|
+
## Tone
|
|
24
27
|
|
|
25
28
|
Six named tones: `neutral` (default), `brand`, `info`, `success`, `warning`,
|
|
26
29
|
`critical`. Any CSS color works for a one-off custom tone. The tone runs through the
|
|
@@ -326,6 +329,7 @@ so those suit an uncontrolled strip reacting to its own pick. **`onFocus`** /
|
|
|
326
329
|
| `defaultValue?` | string | — | Initial active value for the uncontrolled case. After first render `Tabs`
|
|
327
330
|
owns selection itself. |
|
|
328
331
|
| `disabled?` | boolean | — | Disable the whole strip. |
|
|
332
|
+
| `fill?` | boolean | false | Makes horizontal tabs share the available inline space equally. |
|
|
329
333
|
| `label?` | string | — | Accessible name for the tablist (`aria-label`). |
|
|
330
334
|
| `noslide?` | boolean | — | Disable the sliding indicator. By default the selected-tab indicator animates
|
|
331
335
|
between tabs (a single rectangle, via CSS anchor positioning); `noslide` paints it
|
|
@@ -341,7 +345,8 @@ so those suit an uncontrolled strip reacting to its own pick. **`onFocus`** /
|
|
|
341
345
|
| `onValueChange?` | (event, attrs) => void | — | Like `onChange`, but with a `{ value }` snapshot as the 2nd argument. |
|
|
342
346
|
| `options?` | TabOption[] | — | The tabs, as a data array (the strip's single source). Each entry is a
|
|
343
347
|
`TabOption` (`value`, `label` or `children`, `icon`, `iconTrailing`, `tone`,
|
|
344
|
-
`disabled`, `round`).
|
|
348
|
+
`disabled`, `round`, `className`, `style`). `className` and `style` land on
|
|
349
|
+
that option's individual `<a-tab>`, not on the strip. |
|
|
345
350
|
| `orientation?` | 'horizontal' \| 'vertical' | 'horizontal' | Layout + arrow-key axis. Horizontal ellipsizes labels when tabs overflow (scroll
|
|
346
351
|
is opt-in via CSS); vertical stacks them. |
|
|
347
352
|
| `priority?` | 'primary' \| 'secondary' \| 'tertiary' | 'primary' | Visual priority. `primary` is the raised pill on a recessed track (the
|
|
@@ -368,9 +373,11 @@ Use the web component directly when you are not using React or Preact and a nati
|
|
|
368
373
|
Keep the tab strip and panels as siblings under one parent. Panels read the active
|
|
369
374
|
value from `<a-tabs>`.
|
|
370
375
|
|
|
376
|
+
Add `fill` to make horizontal tabs share the available width equally.
|
|
377
|
+
|
|
371
378
|
```html
|
|
372
379
|
<div>
|
|
373
|
-
<a-tabs role="tablist" default-state="account">
|
|
380
|
+
<a-tabs role="tablist" default-state="account" fill>
|
|
374
381
|
<a-tab role="tab" value="account" tabindex="0"><a-tab-label>Account</a-tab-label></a-tab>
|
|
375
382
|
<a-tab role="tab" value="security" tabindex="-1"><a-tab-label>Security</a-tab-label></a-tab>
|
|
376
383
|
</a-tabs>
|
|
@@ -438,12 +445,21 @@ scrollable.
|
|
|
438
445
|
```
|
|
439
446
|
|
|
440
447
|
**Equal-width tabs.** By default tabs are sized to their labels (and compress only
|
|
441
|
-
when the strip overflows).
|
|
442
|
-
|
|
448
|
+
when the strip overflows). Pass `fill` for a segmented-control look where every tab
|
|
449
|
+
shares the strip width:
|
|
443
450
|
|
|
444
|
-
```
|
|
445
|
-
|
|
446
|
-
|
|
451
|
+
```tsx
|
|
452
|
+
<Tabs
|
|
453
|
+
fill
|
|
454
|
+
defaultValue="all"
|
|
455
|
+
label="Filter"
|
|
456
|
+
options={[
|
|
457
|
+
{ value: 'all', label: 'All' },
|
|
458
|
+
{ value: 'assigned', label: 'Assigned to me' },
|
|
459
|
+
{ value: 'recent', label: 'Recent' },
|
|
460
|
+
{ value: 'archived', label: 'Archived' },
|
|
461
|
+
]}
|
|
462
|
+
/>
|
|
447
463
|
```
|
|
448
464
|
|
|
449
465
|
**Wrap labels.** Let long labels wrap so the tabs grow taller instead of truncating:
|
package/docs/components/tag.md
CHANGED
|
@@ -20,7 +20,7 @@ and tracks dark mode.
|
|
|
20
20
|
<Tag allcaps priority="tertiary" tone="brand" label="Tertiary" />
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
##
|
|
23
|
+
## Tone
|
|
24
24
|
|
|
25
25
|
Omit `tone` for the neutral gray tag, or pick a semantic tone. Color
|
|
26
26
|
comes from the theme tokens, so every tone tracks light and dark mode
|
|
@@ -74,7 +74,7 @@ versions, and timers don't reflow.
|
|
|
74
74
|
```tsx
|
|
75
75
|
<Tag allcaps tone="success" icon="circle-check" label="Build" value="passed" />
|
|
76
76
|
<Tag allcaps tone="info" icon="hourglass" label="Running" value="20m 16s" />
|
|
77
|
-
<Tag allcaps icon="
|
|
77
|
+
<Tag allcaps icon="history" label="Commit" value="4f90d13" />
|
|
78
78
|
<Tag allcaps tone="warning" label="Retries" value="3" iconTrailing="refresh" />
|
|
79
79
|
```
|
|
80
80
|
|
|
@@ -113,7 +113,7 @@ Uppercase also tracks wider (0.08ch vs the default 0.02ch) and steps each size
|
|
|
113
113
|
down 1px, since caps read larger than mixed case at the same size.
|
|
114
114
|
|
|
115
115
|
```tsx
|
|
116
|
-
<Tag icon="
|
|
116
|
+
<Tag icon="external-link" label="GitHub" value="v1.6.9" />
|
|
117
117
|
<Tag allcaps label="Running" />
|
|
118
118
|
```
|
|
119
119
|
|
|
@@ -138,11 +138,11 @@ shows.
|
|
|
138
138
|
(px) or a CSS length string for a custom radius. |
|
|
139
139
|
| `truncatedOnly?` | boolean | — | Only show when the target is actually truncated (its text overflows and is
|
|
140
140
|
ellipsized); a label that fits gets no tooltip. The check is a UI-thread
|
|
141
|
-
layout read, re-measured on each show. By default it measures
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
| `truncatedSelector?` | string | — | CSS selector (resolved within the anchor) for the element
|
|
145
|
-
decides whether a `truncatedOnly` tooltip shows. |
|
|
141
|
+
layout read, re-measured on each show. By default it measures every Anta
|
|
142
|
+
ellipsizing label part inside the anchor, then the anchor itself —
|
|
143
|
+
override with `truncatedSelector`. |
|
|
144
|
+
| `truncatedSelector?` | string | — | CSS selector (resolved within the anchor) for the element or elements
|
|
145
|
+
whose overflow decides whether a `truncatedOnly` tooltip shows. |
|
|
146
146
|
|
|
147
147
|
Use the web component directly when you are not using React or Preact and a native control does not fit.
|
|
148
148
|
|
package/docs/index.md
CHANGED
|
@@ -30,6 +30,7 @@ Anta is designed for a clean DOM. Prefer the props and attributes exposed by eac
|
|
|
30
30
|
- [Switch](./components/switch.md)
|
|
31
31
|
- [Slider](./components/slider.md)
|
|
32
32
|
- [Tabs](./components/tabs.md)
|
|
33
|
+
- [Steps](./components/steps.md)
|
|
33
34
|
|
|
34
35
|
- [Expander](./components/expander.md)
|
|
35
36
|
- [Menu](./components/menu.md)
|
package/docs/install-config.md
CHANGED
|
@@ -21,6 +21,21 @@ import { Progress } from '@antadesign/anta'
|
|
|
21
21
|
<Progress value={42} label="Uploaded" hint="3 of 7" />
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
+
### Full bundle
|
|
25
|
+
|
|
26
|
+
For a single minified Anta runtime and stylesheet, use the bundle pair instead
|
|
27
|
+
of the separate tokens, reset, elements, and JSX imports:
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import '@antadesign/anta/bundle.css'
|
|
31
|
+
import { Progress } from '@antadesign/anta/bundle'
|
|
32
|
+
|
|
33
|
+
<Progress value={42} label="Uploaded" hint="3 of 7" />
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
`bundle` registers every custom element and re-exports the JSX API. Its React
|
|
37
|
+
peer dependency and Preact configuration are the same as the regular JSX entry.
|
|
38
|
+
|
|
24
39
|
### What you import (and why)
|
|
25
40
|
|
|
26
41
|
Tokens, elements, and the JSX layer render a styled component. The reset is
|
|
@@ -32,6 +47,8 @@ recommended; the reference theme is optional.
|
|
|
32
47
|
| `@antadesign/anta/reset.css` | A small reset plus Anta's focus, heading, list, and link typography in `@layer anta`. | You use another reset and typography. |
|
|
33
48
|
| `@antadesign/anta/elements` | Registers every `<a-*>` element and its CSS. Per-element entries register one; see [Registering elements](#registering-elements). | You render only on the server or register elements individually. |
|
|
34
49
|
| `@antadesign/anta` | Typed React/Preact wrappers such as `Progress`, `Text`, and `Icon`. | You write `<a-*>` elements directly. |
|
|
50
|
+
| `@antadesign/anta/bundle.css` | One minified stylesheet containing tokens, reset, element, and JSX-wrapper styles. | You want granular CSS imports. |
|
|
51
|
+
| `@antadesign/anta/bundle` | One minified ESM runtime that registers every `<a-*>` element and re-exports the JSX API. | You want granular JS imports. |
|
|
35
52
|
| `@antadesign/anta/theme-anta.css` *(optional)* | The hand-tuned reference palette. Import last to replace the seed-derived default. | You want the seed-derived or your own palette. |
|
|
36
53
|
|
|
37
54
|
Load `tokens.css` before element CSS. Elements read its variables; without it,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antadesign/anta",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.23",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -27,6 +27,10 @@
|
|
|
27
27
|
"types": "./dist/elements/*.d.ts",
|
|
28
28
|
"default": "./dist/elements/*.js"
|
|
29
29
|
},
|
|
30
|
+
"./bundle": {
|
|
31
|
+
"types": "./dist/bundle.d.ts",
|
|
32
|
+
"default": "./dist/bundle.js"
|
|
33
|
+
},
|
|
30
34
|
"./anta_helpers": {
|
|
31
35
|
"types": "./dist/anta_helpers.d.ts",
|
|
32
36
|
"default": "./dist/anta_helpers.js"
|
|
@@ -37,6 +41,7 @@
|
|
|
37
41
|
},
|
|
38
42
|
"./tokens.css": "./dist/tokens.css",
|
|
39
43
|
"./reset.css": "./dist/reset.css",
|
|
44
|
+
"./bundle.css": "./dist/bundle.css",
|
|
40
45
|
"./theme-anta.css": "./dist/theme-anta.css",
|
|
41
46
|
"./generate-icons.mjs": "./dist/generate-icons.mjs",
|
|
42
47
|
"./*": {
|
|
@@ -45,11 +50,12 @@
|
|
|
45
50
|
}
|
|
46
51
|
},
|
|
47
52
|
"scripts": {
|
|
48
|
-
"build": "pnpm run build:js && pnpm run build:css && pnpm run build:types && pnpm run build:docs",
|
|
49
|
-
"build:dev": "pnpm run build:js && pnpm run build:css:dev && pnpm run build:types",
|
|
53
|
+
"build": "pnpm run build:js && pnpm run build:css && pnpm run build:bundle && pnpm run build:types && pnpm run build:docs",
|
|
54
|
+
"build:dev": "pnpm run build:js && pnpm run build:css:dev && pnpm run build:bundle && pnpm run build:types",
|
|
50
55
|
"build:css": "esbuild $(find src -name '*.css') --minify --outdir=dist --outbase=src && cp scripts/generate-icons.mjs dist/",
|
|
51
56
|
"build:css:dev": "find src -name '*.css' | while IFS= read -r f; do d=\"dist/${f#src/}\"; mkdir -p \"$(dirname \"$d\")\"; cp \"$f\" \"$d\"; done && cp scripts/generate-icons.mjs dist/",
|
|
52
57
|
"build:js": "esbuild $(find src \\( -name '*.ts' -o -name '*.tsx' \\) ! -name '*.d.ts') --outdir=dist --outbase=src --jsx=automatic --jsx-import-source=@antadesign/anta --format=esm --target=ES2022 --loader:.css=global-css",
|
|
58
|
+
"build:bundle": "node scripts/build-bundle.mjs",
|
|
53
59
|
"build:types": "tsc -p src/tsconfig.json",
|
|
54
60
|
"build:docs": "pnpm --filter anta-site run docs:api && pnpm --filter anta-site run docs:pages && node scripts/generate-package-docs.mjs",
|
|
55
61
|
"dev": "node scripts/dev.mjs",
|