@jobber/components 8.24.1 → 8.24.2-visual-reg-5479aeb.18
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/ProgressIndicator.d.ts +1 -0
- package/{DescriptionList.js → ProgressIndicator.js} +3 -3
- package/dist/AtlantisThemeContext/AtlantisThemeContext.d.ts +1 -1
- package/dist/AtlantisThemeContext/index.cjs +1 -2
- package/dist/AtlantisThemeContext/index.mjs +1 -2
- package/dist/AtlantisThemeContext/themeStore.d.ts +11 -0
- package/dist/AtlantisThemeContext/types.d.ts +14 -0
- package/dist/AtlantisThemeContext/updateTheme.d.ts +1 -1
- package/dist/AtlantisThemeContext-cjs.js +58 -17
- package/dist/AtlantisThemeContext-es.js +60 -20
- package/dist/BottomSheet-cjs.js +8 -7
- package/dist/BottomSheet-es.js +9 -8
- package/dist/ComboboxChipRemove-es.js +2 -2
- package/dist/DatePicker-es.js +1 -1
- package/dist/Dialog/Dialog.d.ts +47 -3
- package/dist/Dialog/Dialog.types.d.ts +1 -15
- package/dist/Dialog/DialogBottomSheet.d.ts +12 -13
- package/dist/Dialog/DialogModal.d.ts +11 -11
- package/dist/Dialog/dialogComposableShared.d.ts +13 -3
- package/dist/DrawerDescription-cjs.js +4 -97
- package/dist/DrawerDescription-es.js +6 -98
- package/dist/InputNumberExperimental-cjs.js +21 -25
- package/dist/InputNumberExperimental-es.js +22 -26
- package/dist/MenuSubmenuTrigger-es.js +3 -3
- package/dist/Modal/index.cjs +12 -2
- package/dist/Modal/index.mjs +13 -3
- package/dist/ProgressBar/ProgressBar.d.ts +7 -0
- package/dist/ProgressBar-cjs.js +4 -0
- package/dist/ProgressBar-es.js +4 -0
- package/dist/ProgressIndicator/ProgressIndicator.d.ts +60 -0
- package/dist/ProgressIndicator/index.cjs +9 -0
- package/dist/ProgressIndicator/index.d.ts +1 -0
- package/dist/ProgressIndicator/index.mjs +3 -0
- package/dist/ProgressIndicator-cjs.js +43 -0
- package/dist/ProgressIndicator-es.js +41 -0
- package/dist/ScrollAreaViewport-cjs.js +2122 -12
- package/dist/ScrollAreaViewport-es.js +2118 -13
- package/dist/dialogReturnFocus-cjs.js +61 -34
- package/dist/dialogReturnFocus-es.js +63 -36
- package/dist/docs/AtlantisThemeContext/AtlantisThemeContext.md +41 -0
- package/dist/docs/DataTable/DataTable.md +0 -4
- package/dist/docs/Dialog/Dialog.md +1006 -0
- package/dist/docs/Icon/Icon.md +60 -53
- package/dist/docs/InputNumberExperimental/InputNumberExperimental.md +578 -0
- package/dist/docs/ProgressBar/ProgressBar.md +9 -0
- package/dist/docs/ProgressIndicator/ProgressIndicator.md +105 -0
- package/dist/docs/Table/Table.md +1 -3
- package/dist/docs/index.md +3 -1
- package/dist/index.cjs +3 -4
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +2 -3
- package/dist/isTypedArray-es.js +1 -1
- package/dist/primitives/InputNumberExperimental/InputNumberExperimental.d.ts +31 -15
- package/dist/primitives/InputNumberExperimental/types.d.ts +0 -1
- package/dist/styles.css +172 -51
- package/dist/unstyledPrimitives/index.cjs +218 -2230
- package/dist/unstyledPrimitives/index.mjs +224 -2236
- package/dist/useButton-es.js +1 -1
- package/dist/useScrollLock-es.js +2 -2
- package/dist/useScrollToActive-es.js +1 -1
- package/dist/utils/meta/meta.json +1 -1
- package/package.json +7 -7
- package/DescriptionList.d.ts +0 -1
- package/dist/DescriptionList/DescriptionList.d.ts +0 -11
- package/dist/DescriptionList/index.cjs +0 -10
- package/dist/DescriptionList/index.d.ts +0 -1
- package/dist/DescriptionList/index.mjs +0 -4
- package/dist/DescriptionList-cjs.js +0 -14
- package/dist/DescriptionList-es.js +0 -12
- package/dist/docs/DescriptionList/DescriptionList.md +0 -25
- package/dist/updateTheme-cjs.js +0 -20
- package/dist/updateTheme-es.js +0 -18
|
@@ -0,0 +1,578 @@
|
|
|
1
|
+
# InputNumberExperimental
|
|
2
|
+
|
|
3
|
+
## Summary
|
|
4
|
+
|
|
5
|
+
`InputNumberExperimental` collects a single numeric value in a form. Reach for
|
|
6
|
+
it when the value benefits from being nudged up or down, such as quantities,
|
|
7
|
+
prices, durations, or counts.
|
|
8
|
+
|
|
9
|
+
Most fields only need the props shown below. For rare layouts the props can't
|
|
10
|
+
handle, you can build the same field from smaller pieces. See the **Implement**
|
|
11
|
+
tab.
|
|
12
|
+
|
|
13
|
+
### When to use
|
|
14
|
+
|
|
15
|
+
* The value is a number the user increments or decrements, like a quantity,
|
|
16
|
+
price, day count, or number of repetitions
|
|
17
|
+
* A stepper, min/max bounds, or number formatting would help the user
|
|
18
|
+
|
|
19
|
+
### When not to use
|
|
20
|
+
|
|
21
|
+
* The value is a sequence of digits that is never calculated with, such as phone
|
|
22
|
+
numbers, credit-card numbers, or postal codes. A stepper adds no value there;
|
|
23
|
+
use [InputText](../InputText/InputText.md) instead.
|
|
24
|
+
|
|
25
|
+
## Anatomy
|
|
26
|
+
|
|
27
|
+
`InputNumberExperimental` typically includes:
|
|
28
|
+
|
|
29
|
+
* Label (required): names the value the field collects
|
|
30
|
+
* Value field (required): the number the user types or steps through
|
|
31
|
+
* Stepper (optional): increment and decrement controls that change the value by
|
|
32
|
+
`step`
|
|
33
|
+
* Prefix or suffix (optional): a unit or symbol shown alongside the value, like
|
|
34
|
+
$ or kg
|
|
35
|
+
* Loading indicator (optional): replaces the stepper while background work runs
|
|
36
|
+
|
|
37
|
+
## Behavior
|
|
38
|
+
|
|
39
|
+
* The field is controlled through `value`, where a number sets the value and
|
|
40
|
+
`null` leaves it empty.
|
|
41
|
+
* `onValueCommitted` fires when the user commits a value: on blur, on Enter, or
|
|
42
|
+
when they use the stepper or arrow keys. Use `onValueChange` for per-keystroke
|
|
43
|
+
updates.
|
|
44
|
+
* The stepper buttons and the Up and Down arrow keys change the value by `step`
|
|
45
|
+
(default 1).
|
|
46
|
+
* `min` and `max` bound the value, and the stepper stops at each limit.
|
|
47
|
+
* `loading` hides the stepper and shows an indicator in its place. The field
|
|
48
|
+
stays editable, so use `readOnly` or `disabled` to lock it.
|
|
49
|
+
|
|
50
|
+
## Options
|
|
51
|
+
|
|
52
|
+
### Basic
|
|
53
|
+
|
|
54
|
+
Pass `label`, a controlled `value`, and `onValueCommitted`. Bounds (`min` /
|
|
55
|
+
`max`) and `step` are optional.
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
import React, { useState } from "react";
|
|
59
|
+
import type { InputNumberExperimentalProps } from "@jobber/components/primitives";
|
|
60
|
+
import { InputNumberExperimental } from "@jobber/components/primitives";
|
|
61
|
+
|
|
62
|
+
export function InputNumberExperimentalBasicExample(
|
|
63
|
+
props: Partial<InputNumberExperimentalProps>,
|
|
64
|
+
) {
|
|
65
|
+
const [value, setValue] = useState<number | null>(3);
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<InputNumberExperimental
|
|
69
|
+
label="Quantity"
|
|
70
|
+
min={0}
|
|
71
|
+
max={100}
|
|
72
|
+
{...props}
|
|
73
|
+
value={value}
|
|
74
|
+
onValueCommitted={setValue}
|
|
75
|
+
/>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Prefixes and suffixes
|
|
81
|
+
|
|
82
|
+
Use `prefix` or `suffix` to add a unit or symbol. A suffix can be a label, an
|
|
83
|
+
icon, or a clickable icon that runs an action (give it an `ariaLabel`).
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
import React, { useState } from "react";
|
|
87
|
+
import { InputNumberExperimental } from "@jobber/components/primitives";
|
|
88
|
+
import { Content } from "@jobber/components/Content";
|
|
89
|
+
|
|
90
|
+
export function InputNumberExperimentalAffixesExample() {
|
|
91
|
+
const [price, setPrice] = useState<number | null>(42);
|
|
92
|
+
const [days, setDays] = useState<number | null>(7);
|
|
93
|
+
const [reps, setReps] = useState<number | null>(3);
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<Content>
|
|
97
|
+
<InputNumberExperimental
|
|
98
|
+
label="Price"
|
|
99
|
+
prefix={{ label: "$" }}
|
|
100
|
+
suffix={{ label: "USD" }}
|
|
101
|
+
value={price}
|
|
102
|
+
onValueCommitted={setPrice}
|
|
103
|
+
/>
|
|
104
|
+
|
|
105
|
+
<InputNumberExperimental
|
|
106
|
+
label="Follow-up in"
|
|
107
|
+
suffix={{ icon: "calendar", label: "days" }}
|
|
108
|
+
value={days}
|
|
109
|
+
onValueCommitted={setDays}
|
|
110
|
+
/>
|
|
111
|
+
|
|
112
|
+
<InputNumberExperimental
|
|
113
|
+
label="Repetitions"
|
|
114
|
+
suffix={{
|
|
115
|
+
icon: "remove",
|
|
116
|
+
ariaLabel: "Clear value",
|
|
117
|
+
onClick: () => setReps(null),
|
|
118
|
+
}}
|
|
119
|
+
value={reps}
|
|
120
|
+
onValueCommitted={setReps}
|
|
121
|
+
/>
|
|
122
|
+
</Content>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Sizes
|
|
128
|
+
|
|
129
|
+
3 sizes are available. `default` fits almost every form; use `small` only in
|
|
130
|
+
tight spaces and `large` only in especially spacious layouts.
|
|
131
|
+
|
|
132
|
+
```tsx
|
|
133
|
+
import React, { useState } from "react";
|
|
134
|
+
import { InputNumberExperimental } from "@jobber/components/primitives";
|
|
135
|
+
import { Content } from "@jobber/components/Content";
|
|
136
|
+
|
|
137
|
+
export function InputNumberExperimentalSizesExample() {
|
|
138
|
+
const [small, setSmall] = useState<number | null>(42);
|
|
139
|
+
const [base, setBase] = useState<number | null>(42);
|
|
140
|
+
const [large, setLarge] = useState<number | null>(42);
|
|
141
|
+
|
|
142
|
+
return (
|
|
143
|
+
<Content>
|
|
144
|
+
<InputNumberExperimental
|
|
145
|
+
label="Small"
|
|
146
|
+
size="small"
|
|
147
|
+
suffix={{ label: "items" }}
|
|
148
|
+
value={small}
|
|
149
|
+
onValueCommitted={setSmall}
|
|
150
|
+
/>
|
|
151
|
+
<InputNumberExperimental
|
|
152
|
+
label="Default"
|
|
153
|
+
size="default"
|
|
154
|
+
suffix={{ label: "items" }}
|
|
155
|
+
value={base}
|
|
156
|
+
onValueCommitted={setBase}
|
|
157
|
+
/>
|
|
158
|
+
<InputNumberExperimental
|
|
159
|
+
label="Large"
|
|
160
|
+
size="large"
|
|
161
|
+
suffix={{ label: "items" }}
|
|
162
|
+
value={large}
|
|
163
|
+
onValueCommitted={setLarge}
|
|
164
|
+
/>
|
|
165
|
+
</Content>
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Formatting
|
|
171
|
+
|
|
172
|
+
`format` takes any `Intl.NumberFormatOptions` and controls only how the value is
|
|
173
|
+
displayed; the committed value stays a plain number. See the **Implement** tab
|
|
174
|
+
for how percent and currency values map to the underlying number.
|
|
175
|
+
|
|
176
|
+
```tsx
|
|
177
|
+
import React, { useState } from "react";
|
|
178
|
+
import { InputNumberExperimental } from "@jobber/components/primitives";
|
|
179
|
+
import { Content } from "@jobber/components/Content";
|
|
180
|
+
|
|
181
|
+
export function InputNumberExperimentalFormattingExample() {
|
|
182
|
+
const [currency, setCurrency] = useState<number | null>(1234.5);
|
|
183
|
+
const [percent, setPercent] = useState<number | null>(0.5);
|
|
184
|
+
const [decimal, setDecimal] = useState<number | null>(11.13);
|
|
185
|
+
|
|
186
|
+
return (
|
|
187
|
+
<Content>
|
|
188
|
+
<InputNumberExperimental
|
|
189
|
+
label="Currency"
|
|
190
|
+
description='{ style: "currency", currency: "USD" }'
|
|
191
|
+
format={{ style: "currency", currency: "USD" }}
|
|
192
|
+
value={currency}
|
|
193
|
+
onValueCommitted={setCurrency}
|
|
194
|
+
/>
|
|
195
|
+
<InputNumberExperimental
|
|
196
|
+
label="Percent"
|
|
197
|
+
description='{ style: "percent" } — value is a ratio: 0.5 → 50%'
|
|
198
|
+
format={{ style: "percent", maximumFractionDigits: 2 }}
|
|
199
|
+
value={percent}
|
|
200
|
+
onValueCommitted={setPercent}
|
|
201
|
+
/>
|
|
202
|
+
<InputNumberExperimental
|
|
203
|
+
label="Decimal"
|
|
204
|
+
description="{ maximumFractionDigits: 2 }"
|
|
205
|
+
format={{ maximumFractionDigits: 2 }}
|
|
206
|
+
value={decimal}
|
|
207
|
+
onValueCommitted={setDecimal}
|
|
208
|
+
/>
|
|
209
|
+
</Content>
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Loading
|
|
215
|
+
|
|
216
|
+
`loading` shows a non-blocking indicator in the stepper's slot for background
|
|
217
|
+
work, like saving. The field stays editable and the stepper is hidden while
|
|
218
|
+
loading.
|
|
219
|
+
|
|
220
|
+
```tsx
|
|
221
|
+
import React, { useState } from "react";
|
|
222
|
+
import { InputNumberExperimental } from "@jobber/components/primitives";
|
|
223
|
+
|
|
224
|
+
export function InputNumberExperimentalLoadingExample() {
|
|
225
|
+
const [value, setValue] = useState<number | null>(42);
|
|
226
|
+
|
|
227
|
+
return (
|
|
228
|
+
<InputNumberExperimental
|
|
229
|
+
loading
|
|
230
|
+
label="Quantity"
|
|
231
|
+
suffix={{ label: "items" }}
|
|
232
|
+
value={value}
|
|
233
|
+
onValueCommitted={setValue}
|
|
234
|
+
/>
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## Content guidelines
|
|
240
|
+
|
|
241
|
+
### Label the unit, don't repeat it
|
|
242
|
+
|
|
243
|
+
Put the unit in the label or an affix, not both.
|
|
244
|
+
|
|
245
|
+
| ✅ Do | ❌ Don't |
|
|
246
|
+
| ------------------------------- | --------------------------------------- |
|
|
247
|
+
| Label "Weight", suffix "kg" | Label "Weight (kg)", suffix "kg" |
|
|
248
|
+
| Label "Duration", suffix "days" | Label "Duration in days", suffix "days" |
|
|
249
|
+
|
|
250
|
+
### Keep labels short and sentence case
|
|
251
|
+
|
|
252
|
+
| ✅ Do | ❌ Don't |
|
|
253
|
+
| -------- | ----------------------- |
|
|
254
|
+
| Quantity | Enter the quantity here |
|
|
255
|
+
| Discount | DISCOUNT % |
|
|
256
|
+
|
|
257
|
+
### Put the symbol where it's read
|
|
258
|
+
|
|
259
|
+
Use a prefix for a leading symbol and a suffix for a trailing unit, matching how
|
|
260
|
+
the value is spoken.
|
|
261
|
+
|
|
262
|
+
| ✅ Do | ❌ Don't |
|
|
263
|
+
| -------------------- | -------------------- |
|
|
264
|
+
| Prefix "$", value 40 | Suffix "$", value 40 |
|
|
265
|
+
| Suffix "%", value 15 | Prefix "%", value 15 |
|
|
266
|
+
|
|
267
|
+
### Keep validation errors helpful
|
|
268
|
+
|
|
269
|
+
When a value breaks `min` or `max`, provide helpful guidance on what values will
|
|
270
|
+
be accepted as opposed to just providing a generic error.
|
|
271
|
+
|
|
272
|
+
| ✅ Do | ❌ Don't |
|
|
273
|
+
| ------------------------------ | ------------- |
|
|
274
|
+
| Enter a value between 1 and 99 | Invalid input |
|
|
275
|
+
| Quantity can't be more than 50 | Error |
|
|
276
|
+
|
|
277
|
+
### Use numbers as opposed to spelling them
|
|
278
|
+
|
|
279
|
+
Use numerals in labels, helper text, affixes, and bounds.
|
|
280
|
+
|
|
281
|
+
| ✅ Do | ❌ Don't |
|
|
282
|
+
| ----------- | --------------- |
|
|
283
|
+
| Max 3 items | Max three items |
|
|
284
|
+
|
|
285
|
+
## Do's and Don'ts
|
|
286
|
+
|
|
287
|
+
#### Do:
|
|
288
|
+
|
|
289
|
+
* ✅ Use for values the user increments or decrements
|
|
290
|
+
* ✅ Set `min` and `max` when the value has real bounds
|
|
291
|
+
* ✅ Use `format` for currency, percent, and decimals rather than formatting the
|
|
292
|
+
value yourself
|
|
293
|
+
* ✅ Use `loading` for background work so the field stays usable
|
|
294
|
+
|
|
295
|
+
#### Don't:
|
|
296
|
+
|
|
297
|
+
* ❌ Use it for digit sequences that are never calculated with, like phone or
|
|
298
|
+
credit card numbers
|
|
299
|
+
* ❌ Disable the field to communicate an error; show an `error` message instead
|
|
300
|
+
* ❌ Repeat the unit in both the label and an affix
|
|
301
|
+
|
|
302
|
+
## Accessibility notes
|
|
303
|
+
|
|
304
|
+
The field is a native number input, so it is reachable and operable by keyboard
|
|
305
|
+
and assistive technology.
|
|
306
|
+
|
|
307
|
+
| Key | Behavior |
|
|
308
|
+
| ---------------- | ------------------------------- |
|
|
309
|
+
| Tab | Moves focus to the field |
|
|
310
|
+
| Up / Down arrows | Increment / decrement by `step` |
|
|
311
|
+
| Enter | Commits the current value |
|
|
312
|
+
| Type | Replaces the value |
|
|
313
|
+
|
|
314
|
+
Give a clickable affix a clear `ariaLabel` describing its action, like "Clear
|
|
315
|
+
value".
|
|
316
|
+
|
|
317
|
+
## Related components
|
|
318
|
+
|
|
319
|
+
* For digit sequences that are not calculated with, like phone or credit card
|
|
320
|
+
numbers, use [InputText](../InputText/InputText.md).
|
|
321
|
+
* For dates, use [InputDate](../InputDate/InputDate.md).
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
## Anatomy
|
|
325
|
+
|
|
326
|
+
The prop-driven `<InputNumberExperimental>` composes a set of parts. You only
|
|
327
|
+
need these when the props can't express a layout; otherwise reach for the props
|
|
328
|
+
shown on the **Design** tab.
|
|
329
|
+
|
|
330
|
+
| Part | Description |
|
|
331
|
+
| ----------------------- | -------------------------------------------------------------------- |
|
|
332
|
+
| `Wrapper` | Owns the field configuration and state; provides it to the parts |
|
|
333
|
+
| `Group` | The bordered field row |
|
|
334
|
+
| `Input` | The input area; holds the `Label` and the `Stepper` / `Loading` slot |
|
|
335
|
+
| `Label` | Floating field label |
|
|
336
|
+
| `Stepper` | The increment / decrement button pair |
|
|
337
|
+
| `Increment` `Decrement` | The individual stepper buttons |
|
|
338
|
+
| `Affix` | Prefix / suffix content (label, icon, or clickable icon) |
|
|
339
|
+
| `Loading` | Non-blocking loading indicator slot |
|
|
340
|
+
| `Footer` | Below-field row that holds `Description` and `Error` |
|
|
341
|
+
| `Description` | Helper text below the field |
|
|
342
|
+
| `Error` | Styled error message below the field |
|
|
343
|
+
|
|
344
|
+
## Composition
|
|
345
|
+
|
|
346
|
+
The prop-driven component is sugar: it renders exactly the tree you would write
|
|
347
|
+
by hand with `<InputNumberExperimental.Wrapper>` and the parts. To customize a
|
|
348
|
+
single piece, compose the tree yourself and swap that one part — the other parts
|
|
349
|
+
keep their defaults. The sugar does not merge consumer-provided parts into its
|
|
350
|
+
render, so there is no per-slot precedence to reason about.
|
|
351
|
+
|
|
352
|
+
`Wrapper` owns the field state and shares it with the parts through context, so
|
|
353
|
+
every part must be rendered inside a `Wrapper` (a part used outside one throws).
|
|
354
|
+
|
|
355
|
+
The example below replaces the default stepper icons with `+` / `−` and leaves
|
|
356
|
+
everything else as the default:
|
|
357
|
+
|
|
358
|
+
```tsx
|
|
359
|
+
import React, { useState } from "react";
|
|
360
|
+
import { InputNumberExperimental } from "@jobber/components/primitives";
|
|
361
|
+
|
|
362
|
+
export function InputNumberExperimentalCompositionExample() {
|
|
363
|
+
const [value, setValue] = useState<number | null>(3);
|
|
364
|
+
|
|
365
|
+
return (
|
|
366
|
+
<InputNumberExperimental.Wrapper value={value} onValueCommitted={setValue}>
|
|
367
|
+
<InputNumberExperimental.Group>
|
|
368
|
+
<InputNumberExperimental.Input>
|
|
369
|
+
<InputNumberExperimental.Label>
|
|
370
|
+
Quantity
|
|
371
|
+
</InputNumberExperimental.Label>
|
|
372
|
+
<InputNumberExperimental.Stepper>
|
|
373
|
+
<InputNumberExperimental.Increment ariaLabel="Increase Quantity">
|
|
374
|
+
+
|
|
375
|
+
</InputNumberExperimental.Increment>
|
|
376
|
+
<InputNumberExperimental.Decrement ariaLabel="Decrease Quantity">
|
|
377
|
+
−
|
|
378
|
+
</InputNumberExperimental.Decrement>
|
|
379
|
+
</InputNumberExperimental.Stepper>
|
|
380
|
+
</InputNumberExperimental.Input>
|
|
381
|
+
</InputNumberExperimental.Group>
|
|
382
|
+
</InputNumberExperimental.Wrapper>
|
|
383
|
+
);
|
|
384
|
+
}
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
## Controlled usage
|
|
388
|
+
|
|
389
|
+
The field is controlled: pass `value` (a `number`, or `null` for empty) and read
|
|
390
|
+
changes back through one of two callbacks.
|
|
391
|
+
|
|
392
|
+
| Callback | Fires | Use for |
|
|
393
|
+
| ------------------ | ----------------------------------------------------------- | ---------------------------------- |
|
|
394
|
+
| `onValueChange` | On every parsed change (typing, paste, stepper, arrow step) | Live-updating UI as the user types |
|
|
395
|
+
| `onValueCommitted` | When the user commits (blur, Enter, stepper, arrow step) | Saving / validating a final value |
|
|
396
|
+
|
|
397
|
+
Both emit `null` when the field is empty. Prefer `onValueCommitted` for
|
|
398
|
+
persistence so you are not writing on every keystroke.
|
|
399
|
+
|
|
400
|
+
## Formatting semantics
|
|
401
|
+
|
|
402
|
+
`format` is forwarded to Base UI's `NumberField` `format` and accepts any
|
|
403
|
+
`Intl.NumberFormatOptions`. It changes the display only; the committed value is
|
|
404
|
+
always a plain number. Two things to know:
|
|
405
|
+
|
|
406
|
+
* **Percent** (`{ style: "percent" }`) treats the value as a ratio: `0.5`
|
|
407
|
+
renders `50%`, and the stepper moves in ratio units. If you want the value to
|
|
408
|
+
be the number itself (`50` → `50%`), use `{ style: "unit", unit: "percent" }`.
|
|
409
|
+
* With no `format`, typed decimals are preserved and grouping is off
|
|
410
|
+
(`useGrouping: false`), so large numbers render without thousands separators
|
|
411
|
+
unless you opt in.
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
## Props
|
|
415
|
+
|
|
416
|
+
### Web
|
|
417
|
+
|
|
418
|
+
#### InputNumberExperimental
|
|
419
|
+
|
|
420
|
+
| Prop | Type | Required | Default | Description |
|
|
421
|
+
|------|------|----------|---------|-------------|
|
|
422
|
+
| `align` | `"center" | "right"` | No | — | |
|
|
423
|
+
| `autoComplete` | `InputNumberExperimentalAutoComplete` | No | — | |
|
|
424
|
+
| `className` | `string` | No | — | |
|
|
425
|
+
| `description` | `ReactNode` | No | — | |
|
|
426
|
+
| `disabled` | `boolean` | No | — | |
|
|
427
|
+
| `error` | `string` | No | — | Renders a styled error message below the field. |
|
|
428
|
+
| `format` | `NumberFormatOptions` | No | — | Number formatting for the displayed value, forwarded to Base UI `NumberField`'s native `format`. When omitted, typed ... |
|
|
429
|
+
| `id` | `string` | No | — | |
|
|
430
|
+
| `inline` | `boolean` | No | — | Shrink-wrap the field to its content (auto width). |
|
|
431
|
+
| `inputMode` | `"decimal" | "numeric"` | No | — | |
|
|
432
|
+
| `invalid` | `boolean` | No | — | Style the error border without showing an error message. |
|
|
433
|
+
| `label` | `string` | No | — | Floating field label. |
|
|
434
|
+
| `loading` | `boolean` | No | — | Shows a non-blocking loading indicator in the stepper's slot. The field stays editable (use `readOnly`/`disabled` to ... |
|
|
435
|
+
| `max` | `number` | No | — | |
|
|
436
|
+
| `min` | `number` | No | — | |
|
|
437
|
+
| `name` | `string` | No | — | |
|
|
438
|
+
| `onBlur` | `(event?: FocusEvent<HTMLInputElement, Element>) => void` | No | — | |
|
|
439
|
+
| `onEnter` | `(event: KeyboardEvent<HTMLInputElement>) => void` | No | — | Fires when Enter is pressed without modifier keys (Shift/Ctrl/Meta). |
|
|
440
|
+
| `onFocus` | `(event?: FocusEvent<HTMLInputElement, Element>) => void` | No | — | |
|
|
441
|
+
| `onKeyDown` | `(event: KeyboardEvent<HTMLInputElement>) => void` | No | — | |
|
|
442
|
+
| `onKeyUp` | `(event: KeyboardEvent<HTMLInputElement>) => void` | No | — | |
|
|
443
|
+
| `onValueChange` | `(newValue: number) => void` | No | — | Fires on every parsed value change (typing, paste, stepper, arrow step). Emits `null` when the field is empty. |
|
|
444
|
+
| `onValueCommitted` | `(newValue: number) => void` | No | — | Fires when the user commits a value (blur, Enter, stepper, arrow step). Emits `null` when committed empty. For per-ke... |
|
|
445
|
+
| `prefix` | `InputNumberExperimentalAffix` | No | — | |
|
|
446
|
+
| `readOnly` | `boolean` | No | — | |
|
|
447
|
+
| `ref` | `Ref<InputNumberExperimentalRef>` | No | — | |
|
|
448
|
+
| `showMiniLabel` | `boolean` | No | — | Default `true`. When `false`, the floating label is hidden. |
|
|
449
|
+
| `size` | `InputNumberExperimentalSize` | No | — | |
|
|
450
|
+
| `step` | `number` | No | — | Amount the stepper buttons and ArrowUp/ArrowDown keys change the value by. Default `1`. |
|
|
451
|
+
| `style` | `CSSProperties` | No | — | |
|
|
452
|
+
| `suffix` | `InputNumberExperimentalSuffixProp` | No | — | |
|
|
453
|
+
| `value` | `number` | No | — | Controlled value. `number` sets the value; `null` (or `undefined`) is an empty field. |
|
|
454
|
+
|
|
455
|
+
#### InputNumberExperimental.Affix
|
|
456
|
+
|
|
457
|
+
| Prop | Type | Required | Default | Description |
|
|
458
|
+
|------|------|----------|---------|-------------|
|
|
459
|
+
| `variation` | `"prefix" | "suffix"` | Yes | — | |
|
|
460
|
+
| `ariaLabel` | `string` | No | — | |
|
|
461
|
+
| `children` | `ReactNode` | No | — | Arbitrary affix content, beyond the built-in `label`/`icon`. |
|
|
462
|
+
| `className` | `string` | No | — | |
|
|
463
|
+
| `icon` | `IconNames` | No | — | |
|
|
464
|
+
| `label` | `string` | No | — | |
|
|
465
|
+
| `onClick` | `() => void` | No | — | |
|
|
466
|
+
| `style` | `CSSProperties` | No | — | |
|
|
467
|
+
|
|
468
|
+
#### InputNumberExperimental.Decrement
|
|
469
|
+
|
|
470
|
+
| Prop | Type | Required | Default | Description |
|
|
471
|
+
|------|------|----------|---------|-------------|
|
|
472
|
+
| `ariaLabel` | `string` | No | — | Accessible label for the button. |
|
|
473
|
+
| `children` | `ReactNode` | No | — | Icon content. Falls back to the default Atlantis stepper icon. |
|
|
474
|
+
| `className` | `string` | No | — | |
|
|
475
|
+
| `style` | `CSSProperties` | No | — | |
|
|
476
|
+
|
|
477
|
+
#### InputNumberExperimental.Description
|
|
478
|
+
|
|
479
|
+
| Prop | Type | Required | Default | Description |
|
|
480
|
+
|------|------|----------|---------|-------------|
|
|
481
|
+
| `className` | `string` | No | — | |
|
|
482
|
+
| `style` | `CSSProperties` | No | — | |
|
|
483
|
+
|
|
484
|
+
#### InputNumberExperimental.Error
|
|
485
|
+
|
|
486
|
+
| Prop | Type | Required | Default | Description |
|
|
487
|
+
|------|------|----------|---------|-------------|
|
|
488
|
+
| `className` | `string` | No | — | |
|
|
489
|
+
| `style` | `CSSProperties` | No | — | |
|
|
490
|
+
|
|
491
|
+
#### InputNumberExperimental.Footer
|
|
492
|
+
|
|
493
|
+
| Prop | Type | Required | Default | Description |
|
|
494
|
+
|------|------|----------|---------|-------------|
|
|
495
|
+
| `className` | `string` | No | — | |
|
|
496
|
+
| `style` | `CSSProperties` | No | — | |
|
|
497
|
+
|
|
498
|
+
#### InputNumberExperimental.Group
|
|
499
|
+
|
|
500
|
+
| Prop | Type | Required | Default | Description |
|
|
501
|
+
|------|------|----------|---------|-------------|
|
|
502
|
+
| `className` | `string` | No | — | |
|
|
503
|
+
| `style` | `CSSProperties` | No | — | |
|
|
504
|
+
|
|
505
|
+
#### InputNumberExperimental.Increment
|
|
506
|
+
|
|
507
|
+
| Prop | Type | Required | Default | Description |
|
|
508
|
+
|------|------|----------|---------|-------------|
|
|
509
|
+
| `ariaLabel` | `string` | No | — | Accessible label for the button. |
|
|
510
|
+
| `children` | `ReactNode` | No | — | Icon content. Falls back to the default Atlantis stepper icon. |
|
|
511
|
+
| `className` | `string` | No | — | |
|
|
512
|
+
| `style` | `CSSProperties` | No | — | |
|
|
513
|
+
|
|
514
|
+
#### InputNumberExperimental.Input
|
|
515
|
+
|
|
516
|
+
| Prop | Type | Required | Default | Description |
|
|
517
|
+
|------|------|----------|---------|-------------|
|
|
518
|
+
| `children` | `ReactNode` | No | — | Content rendered inside the input area (e.g. `.Label`, `.Stepper`). |
|
|
519
|
+
| `className` | `string` | No | — | |
|
|
520
|
+
| `style` | `CSSProperties` | No | — | |
|
|
521
|
+
|
|
522
|
+
#### InputNumberExperimental.Label
|
|
523
|
+
|
|
524
|
+
| Prop | Type | Required | Default | Description |
|
|
525
|
+
|------|------|----------|---------|-------------|
|
|
526
|
+
| `className` | `string` | No | — | |
|
|
527
|
+
| `style` | `CSSProperties` | No | — | |
|
|
528
|
+
|
|
529
|
+
#### InputNumberExperimental.Loading
|
|
530
|
+
|
|
531
|
+
| Prop | Type | Required | Default | Description |
|
|
532
|
+
|------|------|----------|---------|-------------|
|
|
533
|
+
| `children` | `ReactNode` | No | — | Indicator content. Falls back to the default `ActivityIndicator`. |
|
|
534
|
+
| `className` | `string` | No | — | |
|
|
535
|
+
| `style` | `CSSProperties` | No | — | |
|
|
536
|
+
|
|
537
|
+
#### InputNumberExperimental.Stepper
|
|
538
|
+
|
|
539
|
+
| Prop | Type | Required | Default | Description |
|
|
540
|
+
|------|------|----------|---------|-------------|
|
|
541
|
+
| `children` | `ReactNode` | No | — | Stepper buttons. Falls back to the default increment/decrement pair. |
|
|
542
|
+
| `className` | `string` | No | — | |
|
|
543
|
+
| `decrementLabel` | `string` | No | — | Accessible label for the decrement button. Defaults to `Decrease value`. |
|
|
544
|
+
| `incrementLabel` | `string` | No | — | Accessible label for the increment button. Defaults to `Increase value`. |
|
|
545
|
+
| `style` | `CSSProperties` | No | — | |
|
|
546
|
+
|
|
547
|
+
#### InputNumberExperimental.Wrapper
|
|
548
|
+
|
|
549
|
+
| Prop | Type | Required | Default | Description |
|
|
550
|
+
|------|------|----------|---------|-------------|
|
|
551
|
+
| `align` | `"center" | "right"` | No | — | |
|
|
552
|
+
| `autoComplete` | `InputNumberExperimentalAutoComplete` | No | — | |
|
|
553
|
+
| `children` | `ReactNode` | No | — | Composed parts (`.Group`, `.Footer`, and the parts within them). |
|
|
554
|
+
| `className` | `string` | No | — | |
|
|
555
|
+
| `disabled` | `boolean` | No | — | |
|
|
556
|
+
| `format` | `NumberFormatOptions` | No | — | Number formatting for the displayed value, forwarded to Base UI `NumberField`'s native `format`. When omitted, typed ... |
|
|
557
|
+
| `id` | `string` | No | — | |
|
|
558
|
+
| `inline` | `boolean` | No | — | Shrink-wrap the field to its content (auto width). |
|
|
559
|
+
| `inputMode` | `"decimal" | "numeric"` | No | — | |
|
|
560
|
+
| `invalid` | `boolean` | No | — | Style the error border without showing an error message. |
|
|
561
|
+
| `loading` | `boolean` | No | — | Shows a non-blocking loading indicator in the stepper's slot. The field stays editable (use `readOnly`/`disabled` to ... |
|
|
562
|
+
| `max` | `number` | No | — | |
|
|
563
|
+
| `min` | `number` | No | — | |
|
|
564
|
+
| `name` | `string` | No | — | |
|
|
565
|
+
| `onBlur` | `(event?: FocusEvent<HTMLInputElement, Element>) => void` | No | — | |
|
|
566
|
+
| `onEnter` | `(event: KeyboardEvent<HTMLInputElement>) => void` | No | — | Fires when Enter is pressed without modifier keys (Shift/Ctrl/Meta). |
|
|
567
|
+
| `onFocus` | `(event?: FocusEvent<HTMLInputElement, Element>) => void` | No | — | |
|
|
568
|
+
| `onKeyDown` | `(event: KeyboardEvent<HTMLInputElement>) => void` | No | — | |
|
|
569
|
+
| `onKeyUp` | `(event: KeyboardEvent<HTMLInputElement>) => void` | No | — | |
|
|
570
|
+
| `onValueChange` | `(newValue: number) => void` | No | — | Fires on every parsed value change (typing, paste, stepper, arrow step). Emits `null` when the field is empty. |
|
|
571
|
+
| `onValueCommitted` | `(newValue: number) => void` | No | — | Fires when the user commits a value (blur, Enter, stepper, arrow step). Emits `null` when committed empty. For per-ke... |
|
|
572
|
+
| `readOnly` | `boolean` | No | — | |
|
|
573
|
+
| `ref` | `Ref<InputNumberExperimentalRef>` | No | — | |
|
|
574
|
+
| `showMiniLabel` | `boolean` | No | — | Default `true`. When `false`, the floating label is hidden. |
|
|
575
|
+
| `size` | `InputNumberExperimentalSize` | No | — | |
|
|
576
|
+
| `step` | `number` | No | — | Amount the stepper buttons and ArrowUp/ArrowDown keys change the value by. Default `1`. |
|
|
577
|
+
| `style` | `CSSProperties` | No | — | |
|
|
578
|
+
| `value` | `number` | No | — | Controlled value. `number` sets the value; `null` (or `undefined`) is an empty field. |
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Progress Bar
|
|
2
2
|
|
|
3
|
+
> **Deprecated.** Use [ProgressIndicator](../ProgressIndicator/ProgressIndicator.md) for new
|
|
4
|
+
> work. `ProgressIndicator` is the supported determinate progress indicator
|
|
5
|
+
> going forward — it offers the same semantic with a cleaner prop surface
|
|
6
|
+
> (`value` / `max` instead of `currentStep` / `totalSteps`,
|
|
7
|
+
> `variation="continuous"` instead of `"progress"`, plain `className` / `style`
|
|
8
|
+
> instead of `UNSAFE_*`), theme-adaptive tokens, and a unified
|
|
9
|
+
> `<div role="progressbar">` structure across continuous and stepped variations.
|
|
10
|
+
> `ProgressBar` continues to work unchanged for existing call sites.
|
|
11
|
+
|
|
3
12
|
A ProgressBar is a visual indicator of how close something is to completion.
|
|
4
13
|
|
|
5
14
|
## Design & usage guidelines
|