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