@react-spectrum/s2 3.0.0-nightly-93c26d8bd-241028 → 3.0.0-nightly-07431f4b1-241030
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/Accordion.cjs +1 -1
- package/dist/Accordion.cjs.map +1 -1
- package/dist/Accordion.css.map +1 -1
- package/dist/Accordion.mjs +2 -2
- package/dist/Accordion.mjs.map +1 -1
- package/dist/ActionButton.cjs +10 -32
- package/dist/ActionButton.cjs.map +1 -1
- package/dist/ActionButton.css +20 -60
- package/dist/ActionButton.css.map +1 -1
- package/dist/ActionButton.mjs +10 -32
- package/dist/ActionButton.mjs.map +1 -1
- package/dist/Avatar.cjs +2 -4
- package/dist/Avatar.cjs.map +1 -1
- package/dist/Avatar.css +4 -16
- package/dist/Avatar.css.map +1 -1
- package/dist/Avatar.mjs +2 -4
- package/dist/Avatar.mjs.map +1 -1
- package/dist/Badge.cjs +5 -16
- package/dist/Badge.cjs.map +1 -1
- package/dist/Badge.css +10 -30
- package/dist/Badge.css.map +1 -1
- package/dist/Badge.mjs +5 -16
- package/dist/Badge.mjs.map +1 -1
- package/dist/Breadcrumbs.cjs +12 -41
- package/dist/Breadcrumbs.cjs.map +1 -1
- package/dist/Breadcrumbs.css +38 -86
- package/dist/Breadcrumbs.css.map +1 -1
- package/dist/Breadcrumbs.mjs +12 -41
- package/dist/Breadcrumbs.mjs.map +1 -1
- package/dist/Button.cjs +19 -59
- package/dist/Button.cjs.map +1 -1
- package/dist/Button.css +37 -113
- package/dist/Button.css.map +1 -1
- package/dist/Button.mjs +19 -59
- package/dist/Button.mjs.map +1 -1
- package/dist/Card.cjs +27 -67
- package/dist/Card.cjs.map +1 -1
- package/dist/Card.css +42 -117
- package/dist/Card.css.map +1 -1
- package/dist/Card.mjs +27 -67
- package/dist/Card.mjs.map +1 -1
- package/dist/Checkbox.cjs +9 -27
- package/dist/Checkbox.cjs.map +1 -1
- package/dist/Checkbox.css +17 -49
- package/dist/Checkbox.css.map +1 -1
- package/dist/Checkbox.mjs +9 -27
- package/dist/Checkbox.mjs.map +1 -1
- package/dist/CheckboxGroup.cjs +5 -16
- package/dist/CheckboxGroup.cjs.map +1 -1
- package/dist/CheckboxGroup.css +10 -30
- package/dist/CheckboxGroup.css.map +1 -1
- package/dist/CheckboxGroup.mjs +5 -16
- package/dist/CheckboxGroup.mjs.map +1 -1
- package/dist/ClearButton.cjs +6 -17
- package/dist/ClearButton.cjs.map +1 -1
- package/dist/ClearButton.css +11 -35
- package/dist/ClearButton.css.map +1 -1
- package/dist/ClearButton.mjs +6 -17
- package/dist/ClearButton.mjs.map +1 -1
- package/dist/CloseButton.cjs +10 -32
- package/dist/CloseButton.cjs.map +1 -1
- package/dist/CloseButton.css +20 -64
- package/dist/CloseButton.css.map +1 -1
- package/dist/CloseButton.mjs +10 -32
- package/dist/CloseButton.mjs.map +1 -1
- package/dist/ColorArea.cjs +4 -16
- package/dist/ColorArea.cjs.map +1 -1
- package/dist/ColorArea.css +8 -28
- package/dist/ColorArea.css.map +1 -1
- package/dist/ColorArea.mjs +4 -16
- package/dist/ColorArea.mjs.map +1 -1
- package/dist/ColorField.cjs +5 -16
- package/dist/ColorField.cjs.map +1 -1
- package/dist/ColorField.css +10 -30
- package/dist/ColorField.css.map +1 -1
- package/dist/ColorField.mjs +5 -16
- package/dist/ColorField.mjs.map +1 -1
- package/dist/ColorHandle.cjs +5 -15
- package/dist/ColorHandle.cjs.map +1 -1
- package/dist/ColorHandle.css +10 -30
- package/dist/ColorHandle.css.map +1 -1
- package/dist/ColorHandle.mjs +5 -15
- package/dist/ColorHandle.mjs.map +1 -1
- package/dist/ColorSlider.cjs +6 -17
- package/dist/ColorSlider.cjs.map +1 -1
- package/dist/ColorSlider.css +34 -50
- package/dist/ColorSlider.css.map +1 -1
- package/dist/ColorSlider.mjs +6 -17
- package/dist/ColorSlider.mjs.map +1 -1
- package/dist/ColorSwatch.cjs +8 -26
- package/dist/ColorSwatch.cjs.map +1 -1
- package/dist/ColorSwatch.css +16 -52
- package/dist/ColorSwatch.css.map +1 -1
- package/dist/ColorSwatch.mjs +8 -26
- package/dist/ColorSwatch.mjs.map +1 -1
- package/dist/ColorSwatchPicker.cjs +6 -16
- package/dist/ColorSwatchPicker.cjs.map +1 -1
- package/dist/ColorSwatchPicker.css +8 -28
- package/dist/ColorSwatchPicker.css.map +1 -1
- package/dist/ColorSwatchPicker.mjs +6 -16
- package/dist/ColorSwatchPicker.mjs.map +1 -1
- package/dist/ComboBox.cjs +22 -71
- package/dist/ComboBox.cjs.map +1 -1
- package/dist/ComboBox.css +64 -152
- package/dist/ComboBox.css.map +1 -1
- package/dist/ComboBox.mjs +22 -71
- package/dist/ComboBox.mjs.map +1 -1
- package/dist/ContextualHelp.cjs +1 -1
- package/dist/ContextualHelp.css +2 -6
- package/dist/ContextualHelp.css.map +1 -1
- package/dist/ContextualHelp.mjs +1 -1
- package/dist/Dialog.cjs +2 -2
- package/dist/Dialog.css +2 -2
- package/dist/Dialog.mjs +2 -2
- package/dist/Disclosure.cjs +34 -68
- package/dist/Disclosure.cjs.map +1 -1
- package/dist/Disclosure.css +55 -91
- package/dist/Disclosure.css.map +1 -1
- package/dist/Disclosure.mjs +36 -70
- package/dist/Disclosure.mjs.map +1 -1
- package/dist/DropZone.cjs +2 -4
- package/dist/DropZone.cjs.map +1 -1
- package/dist/DropZone.css +4 -16
- package/dist/DropZone.css.map +1 -1
- package/dist/DropZone.mjs +2 -4
- package/dist/DropZone.mjs.map +1 -1
- package/dist/Field.cjs +16 -47
- package/dist/Field.cjs.map +1 -1
- package/dist/Field.css +31 -95
- package/dist/Field.css.map +1 -1
- package/dist/Field.mjs +16 -47
- package/dist/Field.mjs.map +1 -1
- package/dist/IllustratedMessage.cjs +6 -20
- package/dist/IllustratedMessage.cjs.map +1 -1
- package/dist/IllustratedMessage.css +10 -24
- package/dist/IllustratedMessage.css.map +1 -1
- package/dist/IllustratedMessage.mjs +6 -20
- package/dist/IllustratedMessage.mjs.map +1 -1
- package/dist/Image.cjs +2 -2
- package/dist/Image.css +2 -2
- package/dist/Image.mjs +2 -2
- package/dist/InlineAlert.cjs +2 -5
- package/dist/InlineAlert.cjs.map +1 -1
- package/dist/InlineAlert.css +11 -15
- package/dist/InlineAlert.css.map +1 -1
- package/dist/InlineAlert.mjs +2 -5
- package/dist/InlineAlert.mjs.map +1 -1
- package/dist/Menu.cjs +22 -67
- package/dist/Menu.cjs.map +1 -1
- package/dist/Menu.css +32 -96
- package/dist/Menu.css.map +1 -1
- package/dist/Menu.mjs +22 -67
- package/dist/Menu.mjs.map +1 -1
- package/dist/Meter.cjs +22 -68
- package/dist/Meter.cjs.map +1 -1
- package/dist/Meter.css +63 -139
- package/dist/Meter.css.map +1 -1
- package/dist/Meter.mjs +22 -68
- package/dist/Meter.mjs.map +1 -1
- package/dist/Modal.cjs +2 -2
- package/dist/Modal.css +2 -2
- package/dist/Modal.mjs +2 -2
- package/dist/NumberField.cjs +23 -71
- package/dist/NumberField.cjs.map +1 -1
- package/dist/NumberField.css +63 -146
- package/dist/NumberField.css.map +1 -1
- package/dist/NumberField.mjs +23 -71
- package/dist/NumberField.mjs.map +1 -1
- package/dist/Picker.cjs +23 -67
- package/dist/Picker.cjs.map +1 -1
- package/dist/Picker.css +50 -130
- package/dist/Picker.css.map +1 -1
- package/dist/Picker.mjs +23 -67
- package/dist/Picker.mjs.map +1 -1
- package/dist/ProgressBar.cjs +23 -69
- package/dist/ProgressBar.cjs.map +1 -1
- package/dist/ProgressBar.css +64 -140
- package/dist/ProgressBar.css.map +1 -1
- package/dist/ProgressBar.mjs +23 -69
- package/dist/ProgressBar.mjs.map +1 -1
- package/dist/ProgressCircle.cjs +6 -20
- package/dist/ProgressCircle.cjs.map +1 -1
- package/dist/ProgressCircle.css +12 -40
- package/dist/ProgressCircle.css.map +1 -1
- package/dist/ProgressCircle.mjs +6 -20
- package/dist/ProgressCircle.mjs.map +1 -1
- package/dist/Provider.css +7 -0
- package/dist/Provider.css.map +1 -1
- package/dist/Radio.cjs +8 -26
- package/dist/Radio.cjs.map +1 -1
- package/dist/Radio.css +16 -48
- package/dist/Radio.css.map +1 -1
- package/dist/Radio.mjs +8 -26
- package/dist/Radio.mjs.map +1 -1
- package/dist/RadioGroup.cjs +5 -16
- package/dist/RadioGroup.cjs.map +1 -1
- package/dist/RadioGroup.css +10 -30
- package/dist/RadioGroup.css.map +1 -1
- package/dist/RadioGroup.mjs +5 -16
- package/dist/RadioGroup.mjs.map +1 -1
- package/dist/SearchField.cjs +5 -16
- package/dist/SearchField.cjs.map +1 -1
- package/dist/SearchField.css +10 -30
- package/dist/SearchField.css.map +1 -1
- package/dist/SearchField.mjs +5 -16
- package/dist/SearchField.mjs.map +1 -1
- package/dist/SegmentedControl.cjs +8 -14
- package/dist/SegmentedControl.cjs.map +1 -1
- package/dist/SegmentedControl.css +9 -29
- package/dist/SegmentedControl.css.map +1 -1
- package/dist/SegmentedControl.mjs +8 -14
- package/dist/SegmentedControl.mjs.map +1 -1
- package/dist/Slider.cjs +63 -196
- package/dist/Slider.cjs.map +1 -1
- package/dist/Slider.css +61 -181
- package/dist/Slider.css.map +1 -1
- package/dist/Slider.mjs +63 -196
- package/dist/Slider.mjs.map +1 -1
- package/dist/StatusLight.cjs +9 -27
- package/dist/StatusLight.cjs.map +1 -1
- package/dist/StatusLight.css +17 -49
- package/dist/StatusLight.css.map +1 -1
- package/dist/StatusLight.mjs +9 -27
- package/dist/StatusLight.mjs.map +1 -1
- package/dist/Switch.cjs +6 -15
- package/dist/Switch.cjs.map +1 -1
- package/dist/Switch.css +10 -26
- package/dist/Switch.css.map +1 -1
- package/dist/Switch.mjs +6 -15
- package/dist/Switch.mjs.map +1 -1
- package/dist/TableView.cjs +42 -86
- package/dist/TableView.cjs.map +1 -1
- package/dist/TableView.css +65 -129
- package/dist/TableView.css.map +1 -1
- package/dist/TableView.mjs +42 -86
- package/dist/TableView.mjs.map +1 -1
- package/dist/Tabs.cjs +4 -15
- package/dist/Tabs.cjs.map +1 -1
- package/dist/Tabs.css +18 -34
- package/dist/Tabs.css.map +1 -1
- package/dist/Tabs.mjs +4 -15
- package/dist/Tabs.mjs.map +1 -1
- package/dist/TagGroup.cjs +14 -37
- package/dist/TagGroup.cjs.map +1 -1
- package/dist/TagGroup.css +23 -67
- package/dist/TagGroup.css.map +1 -1
- package/dist/TagGroup.mjs +14 -37
- package/dist/TagGroup.mjs.map +1 -1
- package/dist/TextField.cjs +11 -34
- package/dist/TextField.cjs.map +1 -1
- package/dist/TextField.css +22 -66
- package/dist/TextField.css.map +1 -1
- package/dist/TextField.mjs +11 -34
- package/dist/TextField.mjs.map +1 -1
- package/dist/Tooltip.cjs +2 -4
- package/dist/Tooltip.cjs.map +1 -1
- package/dist/Tooltip.css +4 -12
- package/dist/Tooltip.css.map +1 -1
- package/dist/Tooltip.mjs +2 -4
- package/dist/Tooltip.mjs.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +17 -17
- package/page.css +7 -0
- package/src/Accordion.tsx +1 -1
- package/src/Disclosure.tsx +13 -7
- package/src/page.macro.ts +11 -0
- package/style/dist/spectrum-theme.cjs +2 -8
- package/style/dist/spectrum-theme.cjs.map +1 -1
- package/style/dist/spectrum-theme.mjs +2 -8
- package/style/dist/spectrum-theme.mjs.map +1 -1
- package/style/dist/types.d.ts +1 -4
- package/style/dist/types.d.ts.map +1 -1
- package/style/spectrum-theme.ts +4 -4
package/dist/NumberField.css
CHANGED
|
@@ -99,23 +99,23 @@
|
|
|
99
99
|
justify-content: center;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
.
|
|
103
|
-
width: 1rem;
|
|
102
|
+
.lf {
|
|
103
|
+
width: calc(1rem * var(--s2-scale));
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
.
|
|
107
|
-
width: 1.25rem;
|
|
106
|
+
.lg {
|
|
107
|
+
width: calc(1.25rem * var(--s2-scale));
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
.
|
|
111
|
-
width: 1.5rem;
|
|
110
|
+
.lh {
|
|
111
|
+
width: calc(1.5rem * var(--s2-scale));
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
.
|
|
115
|
-
width: 2rem;
|
|
114
|
+
.lj {
|
|
115
|
+
width: calc(2rem * var(--s2-scale));
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
.
|
|
118
|
+
.kF {
|
|
119
119
|
height: auto;
|
|
120
120
|
}
|
|
121
121
|
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
.oa {
|
|
135
|
-
min-height:
|
|
135
|
+
min-height: calc(0rem * var(--s2-scale));
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
._Oa {
|
|
@@ -215,16 +215,17 @@
|
|
|
215
215
|
column-gap: .5rem;
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
.D-
|
|
219
|
-
padding-inline-end: .125rem;
|
|
218
|
+
.D-3zuu7v {
|
|
219
|
+
padding-inline-end: calc(.125rem * var(--s2-scale));
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
.Dc {
|
|
223
223
|
padding-inline-end: .25rem;
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
-
.D-
|
|
227
|
-
padding-inline-end: .375rem;
|
|
226
|
+
.D-ve8p9e {
|
|
227
|
+
padding-inline-end: calc(.375rem * var(--s2-scale));
|
|
228
|
+
padding-inline-end: calc(.375rem * var(--s2-scale));
|
|
228
229
|
}
|
|
229
230
|
|
|
230
231
|
._Zf {
|
|
@@ -298,24 +299,24 @@
|
|
|
298
299
|
line-height: 1.3;
|
|
299
300
|
}
|
|
300
301
|
|
|
301
|
-
.-aqrvqh_k-
|
|
302
|
-
--field-height: 2rem;
|
|
302
|
+
.-aqrvqh_k-j {
|
|
303
|
+
--field-height: calc(2rem * var(--s2-scale));
|
|
303
304
|
}
|
|
304
305
|
|
|
305
|
-
.-aqrvqh_k-
|
|
306
|
-
--field-height: 1.25rem;
|
|
306
|
+
.-aqrvqh_k-g {
|
|
307
|
+
--field-height: calc(1.25rem * var(--s2-scale));
|
|
307
308
|
}
|
|
308
309
|
|
|
309
|
-
.-aqrvqh_k-
|
|
310
|
-
--field-height: 1.5rem;
|
|
310
|
+
.-aqrvqh_k-h {
|
|
311
|
+
--field-height: calc(1.5rem * var(--s2-scale));
|
|
311
312
|
}
|
|
312
313
|
|
|
313
|
-
.-aqrvqh_k-
|
|
314
|
-
--field-height: 2.5rem;
|
|
314
|
+
.-aqrvqh_k-l {
|
|
315
|
+
--field-height: calc(2.5rem * var(--s2-scale));
|
|
315
316
|
}
|
|
316
317
|
|
|
317
|
-
.-aqrvqh_k-
|
|
318
|
-
--field-height: 3rem;
|
|
318
|
+
.-aqrvqh_k-n {
|
|
319
|
+
--field-height: calc(3rem * var(--s2-scale));
|
|
319
320
|
}
|
|
320
321
|
|
|
321
322
|
.-_1inj1bc_i--prjw07 {
|
|
@@ -346,44 +347,44 @@
|
|
|
346
347
|
grid-row-end: input;
|
|
347
348
|
}
|
|
348
349
|
|
|
349
|
-
.
|
|
350
|
-
min-width: 2rem;
|
|
350
|
+
.qj {
|
|
351
|
+
min-width: calc(2rem * var(--s2-scale));
|
|
351
352
|
}
|
|
352
353
|
|
|
353
|
-
.
|
|
354
|
-
min-width: 1.25rem;
|
|
354
|
+
.qg {
|
|
355
|
+
min-width: calc(1.25rem * var(--s2-scale));
|
|
355
356
|
}
|
|
356
357
|
|
|
357
|
-
.
|
|
358
|
-
min-width: 1.5rem;
|
|
358
|
+
.qh {
|
|
359
|
+
min-width: calc(1.5rem * var(--s2-scale));
|
|
359
360
|
}
|
|
360
361
|
|
|
361
|
-
.
|
|
362
|
-
min-width: 2.5rem;
|
|
362
|
+
.ql {
|
|
363
|
+
min-width: calc(2.5rem * var(--s2-scale));
|
|
363
364
|
}
|
|
364
365
|
|
|
365
|
-
.
|
|
366
|
-
min-width: 3rem;
|
|
366
|
+
.qn {
|
|
367
|
+
min-width: calc(3rem * var(--s2-scale));
|
|
367
368
|
}
|
|
368
369
|
|
|
369
370
|
.__ma {
|
|
370
371
|
contain: none;
|
|
371
372
|
}
|
|
372
373
|
|
|
373
|
-
.-usygro_l-
|
|
374
|
-
--defaultWidth: 13rem;
|
|
374
|
+
.-usygro_l-y {
|
|
375
|
+
--defaultWidth: calc(13rem * var(--s2-scale));
|
|
375
376
|
}
|
|
376
377
|
|
|
377
|
-
.-usygro_l-
|
|
378
|
-
--defaultWidth: 12rem;
|
|
378
|
+
.-usygro_l-x {
|
|
379
|
+
--defaultWidth: calc(12rem * var(--s2-scale));
|
|
379
380
|
}
|
|
380
381
|
|
|
381
|
-
.-usygro_l-
|
|
382
|
-
--defaultWidth: 14rem;
|
|
382
|
+
.-usygro_l-z {
|
|
383
|
+
--defaultWidth: calc(14rem * var(--s2-scale));
|
|
383
384
|
}
|
|
384
385
|
|
|
385
|
-
.-usygro_l-
|
|
386
|
-
--defaultWidth: 15rem;
|
|
386
|
+
.-usygro_l-A {
|
|
387
|
+
--defaultWidth: calc(15rem * var(--s2-scale));
|
|
387
388
|
}
|
|
388
389
|
|
|
389
390
|
.m-rwozxi {
|
|
@@ -419,36 +420,40 @@
|
|
|
419
420
|
|
|
420
421
|
@layer UNSAFE_overrides;
|
|
421
422
|
|
|
422
|
-
@layer _.b.
|
|
423
|
-
@media
|
|
424
|
-
.
|
|
425
|
-
|
|
423
|
+
@layer _.b.a {
|
|
424
|
+
@media (forced-colors: active) {
|
|
425
|
+
._Oag {
|
|
426
|
+
transition-property: none;
|
|
426
427
|
}
|
|
427
428
|
|
|
428
|
-
.
|
|
429
|
-
|
|
429
|
+
._Qa-375x7f {
|
|
430
|
+
transition-duration: .15s;
|
|
430
431
|
}
|
|
431
432
|
|
|
432
|
-
.
|
|
433
|
-
|
|
433
|
+
._Raa {
|
|
434
|
+
transition-timing-function: cubic-bezier(.45, 0, .4, 1);
|
|
434
435
|
}
|
|
435
436
|
|
|
436
|
-
.
|
|
437
|
-
|
|
437
|
+
.ba_____x {
|
|
438
|
+
background-color: buttontext;
|
|
438
439
|
}
|
|
439
440
|
|
|
440
|
-
.
|
|
441
|
-
|
|
441
|
+
.ba_____z {
|
|
442
|
+
background-color: highlight;
|
|
442
443
|
}
|
|
443
444
|
|
|
444
|
-
.
|
|
445
|
-
|
|
445
|
+
.ba_____B {
|
|
446
|
+
background-color: graytext;
|
|
446
447
|
}
|
|
447
448
|
|
|
448
|
-
.
|
|
449
|
-
|
|
449
|
+
.aa_____w {
|
|
450
|
+
color: buttonface;
|
|
450
451
|
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
451
454
|
|
|
455
|
+
@layer _.b.b {
|
|
456
|
+
@media not ((hover: hover) and (pointer: fine)) {
|
|
452
457
|
._dbf {
|
|
453
458
|
font-size: 1.0625rem;
|
|
454
459
|
}
|
|
@@ -468,94 +473,6 @@
|
|
|
468
473
|
._dbj {
|
|
469
474
|
font-size: 1.375rem;
|
|
470
475
|
}
|
|
471
|
-
|
|
472
|
-
.-aqrvqh_k-br {
|
|
473
|
-
--field-height: 2.5rem;
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
.-aqrvqh_k-bl {
|
|
477
|
-
--field-height: 1.5625rem;
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
.-aqrvqh_k-bn {
|
|
481
|
-
--field-height: 1.875rem;
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
.-aqrvqh_k-bu {
|
|
485
|
-
--field-height: 3.125rem;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
.-aqrvqh_k-by {
|
|
489
|
-
--field-height: 3.75rem;
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
.qbr {
|
|
493
|
-
min-width: 2.5rem;
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
.qbl {
|
|
497
|
-
min-width: 1.5625rem;
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
.qbn {
|
|
501
|
-
min-width: 1.875rem;
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
.qbu {
|
|
505
|
-
min-width: 3.125rem;
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
.qby {
|
|
509
|
-
min-width: 3.75rem;
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
.-usygro_l-bS {
|
|
513
|
-
--defaultWidth: 16.25rem;
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
.-usygro_l-bQ {
|
|
517
|
-
--defaultWidth: 15rem;
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
.-usygro_l-bU {
|
|
521
|
-
--defaultWidth: 17.5rem;
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
.-usygro_l-bV {
|
|
525
|
-
--defaultWidth: 18.75rem;
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
@layer _.b.a {
|
|
531
|
-
@media (forced-colors: active) {
|
|
532
|
-
._Oag {
|
|
533
|
-
transition-property: none;
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
._Qa-375x7f {
|
|
537
|
-
transition-duration: .15s;
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
._Raa {
|
|
541
|
-
transition-timing-function: cubic-bezier(.45, 0, .4, 1);
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
.ba_____x {
|
|
545
|
-
background-color: buttontext;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
.ba_____z {
|
|
549
|
-
background-color: highlight;
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
.ba_____B {
|
|
553
|
-
background-color: graytext;
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
.aa_____w {
|
|
557
|
-
color: buttonface;
|
|
558
|
-
}
|
|
559
476
|
}
|
|
560
477
|
}
|
|
561
478
|
|
package/dist/NumberField.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AC0DoB;EAAA;;;;EAAA;;;;EAA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;;IAAA;;;;IAAA;;;;IAAA;;;;;;AAhLN;EAAA;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;;;AA0ED;;;;AAsGO;EAAA;IAAA","sources":["b68c88297d49b771","packages/@react-spectrum/s2/src/NumberField.tsx"],"sourcesContent":["@import \"86e54c0ad46f69c2\";\n@import \"81d36b1860c8fc73\";\n@import \"22edbea9646800a7\";\n@import \"c17a88ce1f4f53da\";\n@import \"e6f6c2ace019f265\";\n","/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport Add from '../ui-icons/Add';\nimport {\n ButtonProps as AriaButtonProps,\n NumberField as AriaNumberField,\n NumberFieldProps as AriaNumberFieldProps,\n ButtonContext,\n ContextValue,\n InputContext,\n Text,\n useContextProps\n} from 'react-aria-components';\nimport {baseColor, size, style} from '../style' with {type: 'macro'};\nimport {createContext, CSSProperties, ForwardedRef, forwardRef, ReactNode, Ref, useContext, useImperativeHandle, useMemo, useRef} from 'react';\nimport {createFocusableRef} from '@react-spectrum/utils';\nimport Dash from '../ui-icons/Dash';\nimport {field, fieldInput, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {FieldErrorIcon, FieldGroup, FieldLabel, HelpText, Input} from './Field';\nimport {filterDOMProps, mergeProps, mergeRefs} from '@react-aria/utils';\nimport {FormContext} from './Form';\nimport {HelpTextProps, SpectrumLabelableProps} from '@react-types/shared';\nimport {pressScale} from './pressScale';\nimport {TextFieldRef} from '@react-types/textfield';\nimport {useButton, useFocusRing, useHover} from 'react-aria';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\n\nexport interface NumberFieldProps extends\n Omit<AriaNumberFieldProps, 'children' | 'className' | 'style'>,\n StyleProps,\n SpectrumLabelableProps,\n HelpTextProps {\n /**\n * Whether to hide the increment and decrement buttons.\n * @default false\n */\n hideStepper?: boolean,\n /**\n * The size of the NumberField.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL'\n}\n\nexport const NumberFieldContext = createContext<ContextValue<NumberFieldProps, TextFieldRef>>(null);\n\nconst inputButton = style({\n display: 'flex',\n outlineStyle: 'none',\n textAlign: 'center',\n borderStyle: 'none',\n borderTopRadius: {\n default: {\n size: {\n S: '[3px]',\n M: '[4px]',\n L: '[5px]',\n XL: '[6px]'\n }\n },\n type: {\n decrementStep: 'none'\n }\n },\n borderBottomRadius: {\n default: {\n size: {\n S: '[3px]',\n M: '[4px]',\n L: '[5px]',\n XL: '[6px]'\n }\n },\n type: {\n incrementStep: 'none'\n }\n },\n alignItems: 'center',\n justifyContent: 'center',\n width: {\n size: {\n S: 16,\n M: 20,\n L: 24,\n XL: 32\n }\n },\n height: 'auto',\n marginStart: {\n default: 'text-to-control',\n type: {\n increment: 0\n }\n },\n aspectRatio: 'square',\n flexShrink: 0,\n minHeight: 0,\n transition: {\n default: 'default',\n forcedColors: 'none'\n },\n backgroundColor: {\n default: baseColor('gray-100'),\n isDisabled: 'disabled',\n forcedColors: {\n default: 'ButtonText',\n isHovered: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n color: {\n default: 'neutral',\n isDisabled: 'disabled',\n forcedColors: {\n default: 'ButtonFace'\n }\n },\n cursor: 'default'\n});\n\nconst iconStyles = style({\n flexShrink: 0,\n rotate: {\n default: 0,\n type: {\n incrementStep: 270,\n decrementStep: 90\n }\n },\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nconst stepperContainerStyles = style({\n display: 'flex',\n flexDirection: 'row',\n gap: {\n size: {\n S: 8,\n M: 4,\n L: 8,\n XL: 8\n }\n },\n paddingEnd: {\n size: {\n S: size(2),\n M: 4,\n L: size(6),\n XL: size(6)\n }\n }\n});\n\nfunction NumberField(props: NumberFieldProps, ref: Ref<TextFieldRef>) {\n [props, ref] = useSpectrumContextProps(props, ref, NumberFieldContext);\n let {\n label,\n contextualHelp,\n description: descriptionMessage,\n errorMessage,\n hideStepper,\n isRequired,\n size = 'M',\n labelPosition = 'top',\n necessityIndicator,\n labelAlign = 'start',\n UNSAFE_className = '',\n UNSAFE_style,\n ...numberFieldProps\n } = props;\n let formContext = useContext(FormContext);\n let domRef = useRef<HTMLDivElement | null>(null);\n let inputRef = useRef<HTMLInputElement | null>(null);\n let decrementButtonRef = useRef<HTMLDivElement | null>(null);\n let incrementButtonRef = useRef<HTMLDivElement | null>(null);\n\n // Expose imperative interface for ref\n useImperativeHandle(ref, () => ({\n ...createFocusableRef(domRef, inputRef),\n select() {\n if (inputRef.current) {\n inputRef.current.select();\n }\n },\n getInputElement() {\n return inputRef.current;\n }\n }));\n\n\n return (\n <AriaNumberField\n isRequired={isRequired}\n {...numberFieldProps}\n style={UNSAFE_style}\n className={UNSAFE_className + style(field(), getAllowedOverrides())({\n isInForm: !!formContext,\n labelPosition,\n size\n }, props.styles)}>\n {\n ({isDisabled, isInvalid}) => {\n return (\n <>\n <FieldLabel\n isDisabled={isDisabled}\n isRequired={isRequired}\n size={size}\n labelPosition={labelPosition}\n labelAlign={labelAlign}\n necessityIndicator={necessityIndicator}\n contextualHelp={contextualHelp}>\n {label}\n </FieldLabel>\n <FieldGroup\n role=\"presentation\"\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n size={size}\n styles={style({\n ...fieldInput(),\n paddingStart: 'edge-to-text',\n paddingEnd: {\n default: 0,\n isStepperHidden: 'edge-to-text'\n }\n })({size, isStepperHidden: hideStepper})}>\n <InputContext.Consumer>\n {ctx => (\n <InputContext.Provider value={{...ctx, ref: mergeRefs((ctx as any)?.ref, inputRef)}}>\n <Input />\n </InputContext.Provider>\n )}\n </InputContext.Consumer>\n {isInvalid && <FieldErrorIcon isDisabled={isDisabled} />}\n {!hideStepper && <div className={stepperContainerStyles({size})}>\n <StepButton\n ref={decrementButtonRef}\n slot=\"decrement\"\n style={renderProps => pressScale(decrementButtonRef)(renderProps)}\n className={renderProps => inputButton({\n ...renderProps,\n type: 'decrement',\n size\n })}>\n <Dash size={size} className={iconStyles({})} />\n </StepButton>\n <StepButton\n ref={incrementButtonRef}\n slot=\"increment\"\n style={renderProps => pressScale(incrementButtonRef)(renderProps)}\n className={renderProps => inputButton({\n ...renderProps,\n type: 'increment',\n size\n })}>\n <Add size={size} className={iconStyles({})} />\n </StepButton>\n </div>}\n </FieldGroup>\n {descriptionMessage && <Text slot=\"description\">{descriptionMessage}</Text>}\n <HelpText\n size={size}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n description={descriptionMessage}>\n {errorMessage}\n </HelpText>\n </>\n );\n }\n }\n </AriaNumberField>\n );\n}\n\ninterface StepButtonProps extends AriaButtonProps {\n}\n\nconst additionalButtonHTMLAttributes = new Set(['form', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'name', 'value']);\n\nlet StepButton = forwardRef((props: StepButtonProps, ref: ForwardedRef<HTMLDivElement>) => {\n [props, ref] = useContextProps(props, ref, ButtonContext as any);\n let ctx = props as any;\n /**\n * Must use div for now because Safari pointer event bugs on disabled form elements.\n * Link https://bugs.webkit.org/show_bug.cgi?id=219188.\n */\n let {buttonProps, isPressed} = useButton({...props, elementType: 'div'}, ref);\n let {focusProps, isFocused, isFocusVisible} = useFocusRing(props);\n let {hoverProps, isHovered} = useHover(props);\n let renderProps = useRenderProps({\n ...props,\n values: {isHovered, isPressed, isFocused, isFocusVisible, isDisabled: props.isDisabled || false},\n defaultClassName: 'react-aria-Button'\n });\n return (\n <div\n {...filterDOMProps(props, {propNames: additionalButtonHTMLAttributes})}\n {...mergeProps(buttonProps, focusProps, hoverProps)}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n data-disabled={props.isDisabled || undefined}\n data-pressed={ctx.isPressed || isPressed || undefined}\n data-hovered={isHovered || undefined}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined} />\n );\n});\n\n/**\n * NumberFields allow users to input number values with a keyboard or increment/decrement with step buttons.\n */\nlet _NumberField = forwardRef(NumberField);\nexport {_NumberField as NumberField};\n\n// replace from RAC\nfunction useRenderProps(props: any) {\n let {\n className,\n style,\n children,\n defaultClassName = undefined,\n defaultChildren = undefined,\n defaultStyle,\n values\n } = props;\n\n return useMemo(() => {\n let computedClassName: string | undefined;\n let computedStyle: CSSProperties | undefined;\n let computedChildren: ReactNode | undefined;\n\n if (typeof className === 'function') {\n computedClassName = className({...values, defaultClassName});\n } else {\n computedClassName = className;\n }\n\n if (typeof style === 'function') {\n computedStyle = style({...values, defaultStyle: defaultStyle || {}});\n } else {\n computedStyle = style;\n }\n\n if (typeof children === 'function') {\n computedChildren = children({...values, defaultChildren});\n } else if (children == null) {\n computedChildren = defaultChildren;\n } else {\n computedChildren = children;\n }\n\n return {\n className: computedClassName ?? defaultClassName,\n style: (computedStyle || defaultStyle) ? {...defaultStyle, ...computedStyle} : undefined,\n children: computedChildren ?? defaultChildren,\n 'data-rac': ''\n };\n }, [className, style, children, defaultClassName, defaultChildren, defaultStyle, values]);\n}\n"],"names":[],"version":3,"file":"NumberField.css.map"}
|
|
1
|
+
{"mappings":"AC0DoB;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA0ED;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAeY;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;EA+DK;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAwBV;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AAhLN;EAwJgB;;;;;AAxJhB;;AAAA;EAAA;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;;;AAwJgB;EAAA;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;;;AAwBV;;;;AAAA;EAAA;IAAA","sources":["b68c88297d49b771","packages/@react-spectrum/s2/src/NumberField.tsx"],"sourcesContent":["@import \"86e54c0ad46f69c2\";\n@import \"81d36b1860c8fc73\";\n@import \"22edbea9646800a7\";\n@import \"c17a88ce1f4f53da\";\n@import \"e6f6c2ace019f265\";\n","/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport Add from '../ui-icons/Add';\nimport {\n ButtonProps as AriaButtonProps,\n NumberField as AriaNumberField,\n NumberFieldProps as AriaNumberFieldProps,\n ButtonContext,\n ContextValue,\n InputContext,\n Text,\n useContextProps\n} from 'react-aria-components';\nimport {baseColor, size, style} from '../style' with {type: 'macro'};\nimport {createContext, CSSProperties, ForwardedRef, forwardRef, ReactNode, Ref, useContext, useImperativeHandle, useMemo, useRef} from 'react';\nimport {createFocusableRef} from '@react-spectrum/utils';\nimport Dash from '../ui-icons/Dash';\nimport {field, fieldInput, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {FieldErrorIcon, FieldGroup, FieldLabel, HelpText, Input} from './Field';\nimport {filterDOMProps, mergeProps, mergeRefs} from '@react-aria/utils';\nimport {FormContext} from './Form';\nimport {HelpTextProps, SpectrumLabelableProps} from '@react-types/shared';\nimport {pressScale} from './pressScale';\nimport {TextFieldRef} from '@react-types/textfield';\nimport {useButton, useFocusRing, useHover} from 'react-aria';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\n\nexport interface NumberFieldProps extends\n Omit<AriaNumberFieldProps, 'children' | 'className' | 'style'>,\n StyleProps,\n SpectrumLabelableProps,\n HelpTextProps {\n /**\n * Whether to hide the increment and decrement buttons.\n * @default false\n */\n hideStepper?: boolean,\n /**\n * The size of the NumberField.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL'\n}\n\nexport const NumberFieldContext = createContext<ContextValue<NumberFieldProps, TextFieldRef>>(null);\n\nconst inputButton = style({\n display: 'flex',\n outlineStyle: 'none',\n textAlign: 'center',\n borderStyle: 'none',\n borderTopRadius: {\n default: {\n size: {\n S: '[3px]',\n M: '[4px]',\n L: '[5px]',\n XL: '[6px]'\n }\n },\n type: {\n decrementStep: 'none'\n }\n },\n borderBottomRadius: {\n default: {\n size: {\n S: '[3px]',\n M: '[4px]',\n L: '[5px]',\n XL: '[6px]'\n }\n },\n type: {\n incrementStep: 'none'\n }\n },\n alignItems: 'center',\n justifyContent: 'center',\n width: {\n size: {\n S: 16,\n M: 20,\n L: 24,\n XL: 32\n }\n },\n height: 'auto',\n marginStart: {\n default: 'text-to-control',\n type: {\n increment: 0\n }\n },\n aspectRatio: 'square',\n flexShrink: 0,\n minHeight: 0,\n transition: {\n default: 'default',\n forcedColors: 'none'\n },\n backgroundColor: {\n default: baseColor('gray-100'),\n isDisabled: 'disabled',\n forcedColors: {\n default: 'ButtonText',\n isHovered: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n color: {\n default: 'neutral',\n isDisabled: 'disabled',\n forcedColors: {\n default: 'ButtonFace'\n }\n },\n cursor: 'default'\n});\n\nconst iconStyles = style({\n flexShrink: 0,\n rotate: {\n default: 0,\n type: {\n incrementStep: 270,\n decrementStep: 90\n }\n },\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nconst stepperContainerStyles = style({\n display: 'flex',\n flexDirection: 'row',\n gap: {\n size: {\n S: 8,\n M: 4,\n L: 8,\n XL: 8\n }\n },\n paddingEnd: {\n size: {\n S: size(2),\n M: 4,\n L: size(6),\n XL: size(6)\n }\n }\n});\n\nfunction NumberField(props: NumberFieldProps, ref: Ref<TextFieldRef>) {\n [props, ref] = useSpectrumContextProps(props, ref, NumberFieldContext);\n let {\n label,\n contextualHelp,\n description: descriptionMessage,\n errorMessage,\n hideStepper,\n isRequired,\n size = 'M',\n labelPosition = 'top',\n necessityIndicator,\n labelAlign = 'start',\n UNSAFE_className = '',\n UNSAFE_style,\n ...numberFieldProps\n } = props;\n let formContext = useContext(FormContext);\n let domRef = useRef<HTMLDivElement | null>(null);\n let inputRef = useRef<HTMLInputElement | null>(null);\n let decrementButtonRef = useRef<HTMLDivElement | null>(null);\n let incrementButtonRef = useRef<HTMLDivElement | null>(null);\n\n // Expose imperative interface for ref\n useImperativeHandle(ref, () => ({\n ...createFocusableRef(domRef, inputRef),\n select() {\n if (inputRef.current) {\n inputRef.current.select();\n }\n },\n getInputElement() {\n return inputRef.current;\n }\n }));\n\n\n return (\n <AriaNumberField\n isRequired={isRequired}\n {...numberFieldProps}\n style={UNSAFE_style}\n className={UNSAFE_className + style(field(), getAllowedOverrides())({\n isInForm: !!formContext,\n labelPosition,\n size\n }, props.styles)}>\n {\n ({isDisabled, isInvalid}) => {\n return (\n <>\n <FieldLabel\n isDisabled={isDisabled}\n isRequired={isRequired}\n size={size}\n labelPosition={labelPosition}\n labelAlign={labelAlign}\n necessityIndicator={necessityIndicator}\n contextualHelp={contextualHelp}>\n {label}\n </FieldLabel>\n <FieldGroup\n role=\"presentation\"\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n size={size}\n styles={style({\n ...fieldInput(),\n paddingStart: 'edge-to-text',\n paddingEnd: {\n default: 0,\n isStepperHidden: 'edge-to-text'\n }\n })({size, isStepperHidden: hideStepper})}>\n <InputContext.Consumer>\n {ctx => (\n <InputContext.Provider value={{...ctx, ref: mergeRefs((ctx as any)?.ref, inputRef)}}>\n <Input />\n </InputContext.Provider>\n )}\n </InputContext.Consumer>\n {isInvalid && <FieldErrorIcon isDisabled={isDisabled} />}\n {!hideStepper && <div className={stepperContainerStyles({size})}>\n <StepButton\n ref={decrementButtonRef}\n slot=\"decrement\"\n style={renderProps => pressScale(decrementButtonRef)(renderProps)}\n className={renderProps => inputButton({\n ...renderProps,\n type: 'decrement',\n size\n })}>\n <Dash size={size} className={iconStyles({})} />\n </StepButton>\n <StepButton\n ref={incrementButtonRef}\n slot=\"increment\"\n style={renderProps => pressScale(incrementButtonRef)(renderProps)}\n className={renderProps => inputButton({\n ...renderProps,\n type: 'increment',\n size\n })}>\n <Add size={size} className={iconStyles({})} />\n </StepButton>\n </div>}\n </FieldGroup>\n {descriptionMessage && <Text slot=\"description\">{descriptionMessage}</Text>}\n <HelpText\n size={size}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n description={descriptionMessage}>\n {errorMessage}\n </HelpText>\n </>\n );\n }\n }\n </AriaNumberField>\n );\n}\n\ninterface StepButtonProps extends AriaButtonProps {\n}\n\nconst additionalButtonHTMLAttributes = new Set(['form', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'name', 'value']);\n\nlet StepButton = forwardRef((props: StepButtonProps, ref: ForwardedRef<HTMLDivElement>) => {\n [props, ref] = useContextProps(props, ref, ButtonContext as any);\n let ctx = props as any;\n /**\n * Must use div for now because Safari pointer event bugs on disabled form elements.\n * Link https://bugs.webkit.org/show_bug.cgi?id=219188.\n */\n let {buttonProps, isPressed} = useButton({...props, elementType: 'div'}, ref);\n let {focusProps, isFocused, isFocusVisible} = useFocusRing(props);\n let {hoverProps, isHovered} = useHover(props);\n let renderProps = useRenderProps({\n ...props,\n values: {isHovered, isPressed, isFocused, isFocusVisible, isDisabled: props.isDisabled || false},\n defaultClassName: 'react-aria-Button'\n });\n return (\n <div\n {...filterDOMProps(props, {propNames: additionalButtonHTMLAttributes})}\n {...mergeProps(buttonProps, focusProps, hoverProps)}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n data-disabled={props.isDisabled || undefined}\n data-pressed={ctx.isPressed || isPressed || undefined}\n data-hovered={isHovered || undefined}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined} />\n );\n});\n\n/**\n * NumberFields allow users to input number values with a keyboard or increment/decrement with step buttons.\n */\nlet _NumberField = forwardRef(NumberField);\nexport {_NumberField as NumberField};\n\n// replace from RAC\nfunction useRenderProps(props: any) {\n let {\n className,\n style,\n children,\n defaultClassName = undefined,\n defaultChildren = undefined,\n defaultStyle,\n values\n } = props;\n\n return useMemo(() => {\n let computedClassName: string | undefined;\n let computedStyle: CSSProperties | undefined;\n let computedChildren: ReactNode | undefined;\n\n if (typeof className === 'function') {\n computedClassName = className({...values, defaultClassName});\n } else {\n computedClassName = className;\n }\n\n if (typeof style === 'function') {\n computedStyle = style({...values, defaultStyle: defaultStyle || {}});\n } else {\n computedStyle = style;\n }\n\n if (typeof children === 'function') {\n computedChildren = children({...values, defaultChildren});\n } else if (children == null) {\n computedChildren = defaultChildren;\n } else {\n computedChildren = children;\n }\n\n return {\n className: computedClassName ?? defaultClassName,\n style: (computedStyle || defaultStyle) ? {...defaultStyle, ...computedStyle} : undefined,\n children: computedChildren ?? defaultChildren,\n 'data-rac': ''\n };\n }, [className, style, children, defaultClassName, defaultChildren, defaultStyle, values]);\n}\n"],"names":[],"version":3,"file":"NumberField.css.map"}
|
package/dist/NumberField.mjs
CHANGED
|
@@ -71,25 +71,15 @@ const $675eca1a78ccd399$var$inputButton = function anonymous(props) {
|
|
|
71
71
|
}
|
|
72
72
|
rules += ' _1c';
|
|
73
73
|
rules += ' _2d';
|
|
74
|
-
if (props.size === "XL")
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
rules += ' lm';
|
|
80
|
-
} else if (props.size === "M") {
|
|
81
|
-
rules += ' lbl';
|
|
82
|
-
rules += ' lk';
|
|
83
|
-
} else if (props.size === "S") {
|
|
84
|
-
rules += ' lbk';
|
|
85
|
-
rules += ' lj';
|
|
86
|
-
}
|
|
87
|
-
rules += ' k3';
|
|
74
|
+
if (props.size === "XL") rules += ' lj';
|
|
75
|
+
else if (props.size === "L") rules += ' lh';
|
|
76
|
+
else if (props.size === "M") rules += ' lg';
|
|
77
|
+
else if (props.size === "S") rules += ' lf';
|
|
78
|
+
rules += ' kF';
|
|
88
79
|
if (props.type === "increment") rules += ' ya';
|
|
89
80
|
else rules += ' yF';
|
|
90
81
|
rules += ' _bb';
|
|
91
82
|
rules += ' _8-3t1x';
|
|
92
|
-
rules += ' oba';
|
|
93
83
|
rules += ' oa';
|
|
94
84
|
rules += ' _Oag';
|
|
95
85
|
rules += ' _Oa';
|
|
@@ -139,17 +129,10 @@ const $675eca1a78ccd399$var$stepperContainerStyles = function anonymous(props) {
|
|
|
139
129
|
else if (props.size === "L") rules += ' jd';
|
|
140
130
|
else if (props.size === "M") rules += ' jc';
|
|
141
131
|
else if (props.size === "S") rules += ' jd';
|
|
142
|
-
if (props.size === "XL")
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
rules += ' Db-1aa9md1';
|
|
147
|
-
rules += ' D-6njx2e';
|
|
148
|
-
} else if (props.size === "M") rules += ' Dc';
|
|
149
|
-
else if (props.size === "S") {
|
|
150
|
-
rules += ' Db-13yuhxm';
|
|
151
|
-
rules += ' D-59f7mn';
|
|
152
|
-
}
|
|
132
|
+
if (props.size === "XL") rules += ' D-ve8p9e';
|
|
133
|
+
else if (props.size === "L") rules += ' D-ve8p9e';
|
|
134
|
+
else if (props.size === "M") rules += ' Dc';
|
|
135
|
+
else if (props.size === "S") rules += ' D-3zuu7v';
|
|
153
136
|
return rules;
|
|
154
137
|
};
|
|
155
138
|
function $675eca1a78ccd399$var$NumberField(props1, ref) {
|
|
@@ -221,22 +204,11 @@ function $675eca1a78ccd399$var$NumberField(props1, ref) {
|
|
|
221
204
|
rules += ' _1d';
|
|
222
205
|
rules += ' _f-1x99dlob';
|
|
223
206
|
rules += ' _fa';
|
|
224
|
-
if (props.size === "XL")
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
rules += ' -aqrvqh_k-r';
|
|
230
|
-
} else if (props.size === "S") {
|
|
231
|
-
rules += ' -aqrvqh_k-bn';
|
|
232
|
-
rules += ' -aqrvqh_k-m';
|
|
233
|
-
} else if (props.size === "XS") {
|
|
234
|
-
rules += ' -aqrvqh_k-bl';
|
|
235
|
-
rules += ' -aqrvqh_k-k';
|
|
236
|
-
} else {
|
|
237
|
-
rules += ' -aqrvqh_k-br';
|
|
238
|
-
rules += ' -aqrvqh_k-q';
|
|
239
|
-
}
|
|
207
|
+
if (props.size === "XL") rules += ' -aqrvqh_k-n';
|
|
208
|
+
else if (props.size === "L") rules += ' -aqrvqh_k-l';
|
|
209
|
+
else if (props.size === "S") rules += ' -aqrvqh_k-h';
|
|
210
|
+
else if (props.size === "XS") rules += ' -aqrvqh_k-g';
|
|
211
|
+
else rules += ' -aqrvqh_k-j';
|
|
240
212
|
rules += ' -_1inj1bc_i--prjw07';
|
|
241
213
|
rules += ' je';
|
|
242
214
|
rules += ' __R-yksgrp';
|
|
@@ -270,37 +242,17 @@ function $675eca1a78ccd399$var$NumberField(props1, ref) {
|
|
|
270
242
|
rules += ' __b-4cfph1';
|
|
271
243
|
rules += ' __c-4cfph1';
|
|
272
244
|
rules += ' __d-4cfph1';
|
|
273
|
-
if (props.size === "XL")
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
rules += ' qr';
|
|
279
|
-
} else if (props.size === "S") {
|
|
280
|
-
rules += ' qbn';
|
|
281
|
-
rules += ' qm';
|
|
282
|
-
} else if (props.size === "XS") {
|
|
283
|
-
rules += ' qbl';
|
|
284
|
-
rules += ' qk';
|
|
285
|
-
} else {
|
|
286
|
-
rules += ' qbr';
|
|
287
|
-
rules += ' qq';
|
|
288
|
-
}
|
|
245
|
+
if (props.size === "XL") rules += ' qn';
|
|
246
|
+
else if (props.size === "L") rules += ' ql';
|
|
247
|
+
else if (props.size === "S") rules += ' qh';
|
|
248
|
+
else if (props.size === "XS") rules += ' qg';
|
|
249
|
+
else rules += ' qj';
|
|
289
250
|
if (props.isQuiet) rules += ' __ma';
|
|
290
251
|
else rules += ' __m-1s8glxue';
|
|
291
|
-
if (props.size === "XL")
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
rules += ' -usygro_l-bU';
|
|
296
|
-
rules += ' -usygro_l-T';
|
|
297
|
-
} else if (props.size === "S") {
|
|
298
|
-
rules += ' -usygro_l-bQ';
|
|
299
|
-
rules += ' -usygro_l-P';
|
|
300
|
-
} else {
|
|
301
|
-
rules += ' -usygro_l-bS';
|
|
302
|
-
rules += ' -usygro_l-R';
|
|
303
|
-
}
|
|
252
|
+
if (props.size === "XL") rules += ' -usygro_l-A';
|
|
253
|
+
else if (props.size === "L") rules += ' -usygro_l-z';
|
|
254
|
+
else if (props.size === "S") rules += ' -usygro_l-x';
|
|
255
|
+
else rules += ' -usygro_l-y';
|
|
304
256
|
rules += ' m-rwozxi';
|
|
305
257
|
rules += ' C-375tnm';
|
|
306
258
|
rules += ' D-375tnn';
|
package/dist/NumberField.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;AA8CM,MAAM,0DAAqB,CAAA,GAAA,oBAAY,EAAgD;AAE9F,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0EN,MAAM;;;;;;;;;AAeN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;AAqBN,SAAS,kCAAY,MAAuB,EAAE,GAAsB;IAClE,CAAC,QAAO,IAAI,GAAG,CAAA,GAAA,yCAAsB,EAAE,QAAO,KAAK;IACnD,IAAI,SACF,KAAK,kBACL,cAAc,EACd,aAAa,kBAAkB,gBAC/B,YAAY,eACZ,WAAW,cACX,UAAU,QACV,OAAO,oBACP,gBAAgB,2BAChB,kBAAkB,cAClB,aAAa,2BACb,mBAAmB,kBACnB,YAAY,EACZ,GAAG,kBACJ,GAAG;IACJ,IAAI,cAAc,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yCAAU;IACvC,IAAI,SAAS,CAAA,GAAA,aAAK,EAAyB;IAC3C,IAAI,WAAW,CAAA,GAAA,aAAK,EAA2B;IAC/C,IAAI,qBAAqB,CAAA,GAAA,aAAK,EAAyB;IACvD,IAAI,qBAAqB,CAAA,GAAA,aAAK,EAAyB;IAEvD,sCAAsC;IACtC,CAAA,GAAA,0BAAkB,EAAE,KAAK,IAAO,CAAA;YAC9B,GAAG,CAAA,GAAA,yBAAiB,EAAE,QAAQ,SAAS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Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport Add from '../ui-icons/Add';\nimport {\n ButtonProps as AriaButtonProps,\n NumberField as AriaNumberField,\n NumberFieldProps as AriaNumberFieldProps,\n ButtonContext,\n ContextValue,\n InputContext,\n Text,\n useContextProps\n} from 'react-aria-components';\nimport {baseColor, size, style} from '../style' with {type: 'macro'};\nimport {createContext, CSSProperties, ForwardedRef, forwardRef, ReactNode, Ref, useContext, useImperativeHandle, useMemo, useRef} from 'react';\nimport {createFocusableRef} from '@react-spectrum/utils';\nimport Dash from '../ui-icons/Dash';\nimport {field, fieldInput, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {FieldErrorIcon, FieldGroup, FieldLabel, HelpText, Input} from './Field';\nimport {filterDOMProps, mergeProps, mergeRefs} from '@react-aria/utils';\nimport {FormContext} from './Form';\nimport {HelpTextProps, SpectrumLabelableProps} from '@react-types/shared';\nimport {pressScale} from './pressScale';\nimport {TextFieldRef} from '@react-types/textfield';\nimport {useButton, useFocusRing, useHover} from 'react-aria';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\n\nexport interface NumberFieldProps extends\n Omit<AriaNumberFieldProps, 'children' | 'className' | 'style'>,\n StyleProps,\n SpectrumLabelableProps,\n HelpTextProps {\n /**\n * Whether to hide the increment and decrement buttons.\n * @default false\n */\n hideStepper?: boolean,\n /**\n * The size of the NumberField.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL'\n}\n\nexport const NumberFieldContext = createContext<ContextValue<NumberFieldProps, TextFieldRef>>(null);\n\nconst inputButton = style({\n display: 'flex',\n outlineStyle: 'none',\n textAlign: 'center',\n borderStyle: 'none',\n borderTopRadius: {\n default: {\n size: {\n S: '[3px]',\n M: '[4px]',\n L: '[5px]',\n XL: '[6px]'\n }\n },\n type: {\n decrementStep: 'none'\n }\n },\n borderBottomRadius: {\n default: {\n size: {\n S: '[3px]',\n M: '[4px]',\n L: '[5px]',\n XL: '[6px]'\n }\n },\n type: {\n incrementStep: 'none'\n }\n },\n alignItems: 'center',\n justifyContent: 'center',\n width: {\n size: {\n S: 16,\n M: 20,\n L: 24,\n XL: 32\n }\n },\n height: 'auto',\n marginStart: {\n default: 'text-to-control',\n type: {\n increment: 0\n }\n },\n aspectRatio: 'square',\n flexShrink: 0,\n minHeight: 0,\n transition: {\n default: 'default',\n forcedColors: 'none'\n },\n backgroundColor: {\n default: baseColor('gray-100'),\n isDisabled: 'disabled',\n forcedColors: {\n default: 'ButtonText',\n isHovered: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n color: {\n default: 'neutral',\n isDisabled: 'disabled',\n forcedColors: {\n default: 'ButtonFace'\n }\n },\n cursor: 'default'\n});\n\nconst iconStyles = style({\n flexShrink: 0,\n rotate: {\n default: 0,\n type: {\n incrementStep: 270,\n decrementStep: 90\n }\n },\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nconst stepperContainerStyles = style({\n display: 'flex',\n flexDirection: 'row',\n gap: {\n size: {\n S: 8,\n M: 4,\n L: 8,\n XL: 8\n }\n },\n paddingEnd: {\n size: {\n S: size(2),\n M: 4,\n L: size(6),\n XL: size(6)\n }\n }\n});\n\nfunction NumberField(props: NumberFieldProps, ref: Ref<TextFieldRef>) {\n [props, ref] = useSpectrumContextProps(props, ref, NumberFieldContext);\n let {\n label,\n contextualHelp,\n description: descriptionMessage,\n errorMessage,\n hideStepper,\n isRequired,\n size = 'M',\n labelPosition = 'top',\n necessityIndicator,\n labelAlign = 'start',\n UNSAFE_className = '',\n UNSAFE_style,\n ...numberFieldProps\n } = props;\n let formContext = useContext(FormContext);\n let domRef = useRef<HTMLDivElement | null>(null);\n let inputRef = useRef<HTMLInputElement | null>(null);\n let decrementButtonRef = useRef<HTMLDivElement | null>(null);\n let incrementButtonRef = useRef<HTMLDivElement | null>(null);\n\n // Expose imperative interface for ref\n useImperativeHandle(ref, () => ({\n ...createFocusableRef(domRef, inputRef),\n select() {\n if (inputRef.current) {\n inputRef.current.select();\n }\n },\n getInputElement() {\n return inputRef.current;\n }\n }));\n\n\n return (\n <AriaNumberField\n isRequired={isRequired}\n {...numberFieldProps}\n style={UNSAFE_style}\n className={UNSAFE_className + style(field(), getAllowedOverrides())({\n isInForm: !!formContext,\n labelPosition,\n size\n }, props.styles)}>\n {\n ({isDisabled, isInvalid}) => {\n return (\n <>\n <FieldLabel\n isDisabled={isDisabled}\n isRequired={isRequired}\n size={size}\n labelPosition={labelPosition}\n labelAlign={labelAlign}\n necessityIndicator={necessityIndicator}\n contextualHelp={contextualHelp}>\n {label}\n </FieldLabel>\n <FieldGroup\n role=\"presentation\"\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n size={size}\n styles={style({\n ...fieldInput(),\n paddingStart: 'edge-to-text',\n paddingEnd: {\n default: 0,\n isStepperHidden: 'edge-to-text'\n }\n })({size, isStepperHidden: hideStepper})}>\n <InputContext.Consumer>\n {ctx => (\n <InputContext.Provider value={{...ctx, ref: mergeRefs((ctx as any)?.ref, inputRef)}}>\n <Input />\n </InputContext.Provider>\n )}\n </InputContext.Consumer>\n {isInvalid && <FieldErrorIcon isDisabled={isDisabled} />}\n {!hideStepper && <div className={stepperContainerStyles({size})}>\n <StepButton\n ref={decrementButtonRef}\n slot=\"decrement\"\n style={renderProps => pressScale(decrementButtonRef)(renderProps)}\n className={renderProps => inputButton({\n ...renderProps,\n type: 'decrement',\n size\n })}>\n <Dash size={size} className={iconStyles({})} />\n </StepButton>\n <StepButton\n ref={incrementButtonRef}\n slot=\"increment\"\n style={renderProps => pressScale(incrementButtonRef)(renderProps)}\n className={renderProps => inputButton({\n ...renderProps,\n type: 'increment',\n size\n })}>\n <Add size={size} className={iconStyles({})} />\n </StepButton>\n </div>}\n </FieldGroup>\n {descriptionMessage && <Text slot=\"description\">{descriptionMessage}</Text>}\n <HelpText\n size={size}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n description={descriptionMessage}>\n {errorMessage}\n </HelpText>\n </>\n );\n }\n }\n </AriaNumberField>\n );\n}\n\ninterface StepButtonProps extends AriaButtonProps {\n}\n\nconst additionalButtonHTMLAttributes = new Set(['form', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'name', 'value']);\n\nlet StepButton = forwardRef((props: StepButtonProps, ref: ForwardedRef<HTMLDivElement>) => {\n [props, ref] = useContextProps(props, ref, ButtonContext as any);\n let ctx = props as any;\n /**\n * Must use div for now because Safari pointer event bugs on disabled form elements.\n * Link https://bugs.webkit.org/show_bug.cgi?id=219188.\n */\n let {buttonProps, isPressed} = useButton({...props, elementType: 'div'}, ref);\n let {focusProps, isFocused, isFocusVisible} = useFocusRing(props);\n let {hoverProps, isHovered} = useHover(props);\n let renderProps = useRenderProps({\n ...props,\n values: {isHovered, isPressed, isFocused, isFocusVisible, isDisabled: props.isDisabled || false},\n defaultClassName: 'react-aria-Button'\n });\n return (\n <div\n {...filterDOMProps(props, {propNames: additionalButtonHTMLAttributes})}\n {...mergeProps(buttonProps, focusProps, hoverProps)}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n data-disabled={props.isDisabled || undefined}\n data-pressed={ctx.isPressed || isPressed || undefined}\n data-hovered={isHovered || undefined}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined} />\n );\n});\n\n/**\n * NumberFields allow users to input number values with a keyboard or increment/decrement with step buttons.\n */\nlet _NumberField = forwardRef(NumberField);\nexport {_NumberField as NumberField};\n\n// replace from RAC\nfunction useRenderProps(props: any) {\n let {\n className,\n style,\n children,\n defaultClassName = undefined,\n defaultChildren = undefined,\n defaultStyle,\n values\n } = props;\n\n return useMemo(() => {\n let computedClassName: string | undefined;\n let computedStyle: CSSProperties | undefined;\n let computedChildren: ReactNode | undefined;\n\n if (typeof className === 'function') {\n computedClassName = className({...values, defaultClassName});\n } else {\n computedClassName = className;\n }\n\n if (typeof style === 'function') {\n computedStyle = style({...values, defaultStyle: defaultStyle || {}});\n } else {\n computedStyle = style;\n }\n\n if (typeof children === 'function') {\n computedChildren = children({...values, defaultChildren});\n } else if (children == null) {\n computedChildren = defaultChildren;\n } else {\n computedChildren = children;\n }\n\n return {\n className: computedClassName ?? defaultClassName,\n style: (computedStyle || defaultStyle) ? {...defaultStyle, ...computedStyle} : undefined,\n children: computedChildren ?? defaultChildren,\n 'data-rac': ''\n };\n }, [className, style, children, defaultClassName, defaultChildren, defaultStyle, values]);\n}\n"],"names":[],"version":3,"file":"NumberField.mjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;AA8CM,MAAM,0DAAqB,CAAA,GAAA,oBAAY,EAAgD;AAE9F,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0EN,MAAM;;;;;;;;;AAeN,MAAM;;;;;;;;;;;;;;;;;;AAqBN,SAAS,kCAAY,MAAuB,EAAE,GAAsB;IAClE,CAAC,QAAO,IAAI,GAAG,CAAA,GAAA,yCAAsB,EAAE,QAAO,KAAK;IACnD,IAAI,SACF,KAAK,kBACL,cAAc,EACd,aAAa,kBAAkB,gBAC/B,YAAY,eACZ,WAAW,cACX,UAAU,QACV,OAAO,oBACP,gBAAgB,2BAChB,kBAAkB,cAClB,aAAa,2BACb,mBAAmB,kBACnB,YAAY,EACZ,GAAG,kBACJ,GAAG;IACJ,IAAI,cAAc,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yCAAU;IACvC,IAAI,SAAS,CAAA,GAAA,aAAK,EAAyB;IAC3C,I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AAC,GAAG,YAAY;gBAAE,GAAG,aAAa;YAAA,IAAI;YAC/E,UAAU,oBAAoB;YAC9B,YAAY;QACd;IACF,GAAG;QAAC;QAAW;QAAO;QAAU;QAAkB;QAAiB;QAAc;KAAO;AAC1F","sources":["packages/@react-spectrum/s2/src/NumberField.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport Add from '../ui-icons/Add';\nimport {\n ButtonProps as AriaButtonProps,\n NumberField as AriaNumberField,\n NumberFieldProps as AriaNumberFieldProps,\n ButtonContext,\n ContextValue,\n InputContext,\n Text,\n useContextProps\n} from 'react-aria-components';\nimport {baseColor, size, style} from '../style' with {type: 'macro'};\nimport {createContext, CSSProperties, ForwardedRef, forwardRef, ReactNode, Ref, useContext, useImperativeHandle, useMemo, useRef} from 'react';\nimport {createFocusableRef} from '@react-spectrum/utils';\nimport Dash from '../ui-icons/Dash';\nimport {field, fieldInput, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {FieldErrorIcon, FieldGroup, FieldLabel, HelpText, Input} from './Field';\nimport {filterDOMProps, mergeProps, mergeRefs} from '@react-aria/utils';\nimport {FormContext} from './Form';\nimport {HelpTextProps, SpectrumLabelableProps} from '@react-types/shared';\nimport {pressScale} from './pressScale';\nimport {TextFieldRef} from '@react-types/textfield';\nimport {useButton, useFocusRing, useHover} from 'react-aria';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\n\nexport interface NumberFieldProps extends\n Omit<AriaNumberFieldProps, 'children' | 'className' | 'style'>,\n StyleProps,\n SpectrumLabelableProps,\n HelpTextProps {\n /**\n * Whether to hide the increment and decrement buttons.\n * @default false\n */\n hideStepper?: boolean,\n /**\n * The size of the NumberField.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL'\n}\n\nexport const NumberFieldContext = createContext<ContextValue<NumberFieldProps, TextFieldRef>>(null);\n\nconst inputButton = style({\n display: 'flex',\n outlineStyle: 'none',\n textAlign: 'center',\n borderStyle: 'none',\n borderTopRadius: {\n default: {\n size: {\n S: '[3px]',\n M: '[4px]',\n L: '[5px]',\n XL: '[6px]'\n }\n },\n type: {\n decrementStep: 'none'\n }\n },\n borderBottomRadius: {\n default: {\n size: {\n S: '[3px]',\n M: '[4px]',\n L: '[5px]',\n XL: '[6px]'\n }\n },\n type: {\n incrementStep: 'none'\n }\n },\n alignItems: 'center',\n justifyContent: 'center',\n width: {\n size: {\n S: 16,\n M: 20,\n L: 24,\n XL: 32\n }\n },\n height: 'auto',\n marginStart: {\n default: 'text-to-control',\n type: {\n increment: 0\n }\n },\n aspectRatio: 'square',\n flexShrink: 0,\n minHeight: 0,\n transition: {\n default: 'default',\n forcedColors: 'none'\n },\n backgroundColor: {\n default: baseColor('gray-100'),\n isDisabled: 'disabled',\n forcedColors: {\n default: 'ButtonText',\n isHovered: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n color: {\n default: 'neutral',\n isDisabled: 'disabled',\n forcedColors: {\n default: 'ButtonFace'\n }\n },\n cursor: 'default'\n});\n\nconst iconStyles = style({\n flexShrink: 0,\n rotate: {\n default: 0,\n type: {\n incrementStep: 270,\n decrementStep: 90\n }\n },\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nconst stepperContainerStyles = style({\n display: 'flex',\n flexDirection: 'row',\n gap: {\n size: {\n S: 8,\n M: 4,\n L: 8,\n XL: 8\n }\n },\n paddingEnd: {\n size: {\n S: size(2),\n M: 4,\n L: size(6),\n XL: size(6)\n }\n }\n});\n\nfunction NumberField(props: NumberFieldProps, ref: Ref<TextFieldRef>) {\n [props, ref] = useSpectrumContextProps(props, ref, NumberFieldContext);\n let {\n label,\n contextualHelp,\n description: descriptionMessage,\n errorMessage,\n hideStepper,\n isRequired,\n size = 'M',\n labelPosition = 'top',\n necessityIndicator,\n labelAlign = 'start',\n UNSAFE_className = '',\n UNSAFE_style,\n ...numberFieldProps\n } = props;\n let formContext = useContext(FormContext);\n let domRef = useRef<HTMLDivElement | null>(null);\n let inputRef = useRef<HTMLInputElement | null>(null);\n let decrementButtonRef = useRef<HTMLDivElement | null>(null);\n let incrementButtonRef = useRef<HTMLDivElement | null>(null);\n\n // Expose imperative interface for ref\n useImperativeHandle(ref, () => ({\n ...createFocusableRef(domRef, inputRef),\n select() {\n if (inputRef.current) {\n inputRef.current.select();\n }\n },\n getInputElement() {\n return inputRef.current;\n }\n }));\n\n\n return (\n <AriaNumberField\n isRequired={isRequired}\n {...numberFieldProps}\n style={UNSAFE_style}\n className={UNSAFE_className + style(field(), getAllowedOverrides())({\n isInForm: !!formContext,\n labelPosition,\n size\n }, props.styles)}>\n {\n ({isDisabled, isInvalid}) => {\n return (\n <>\n <FieldLabel\n isDisabled={isDisabled}\n isRequired={isRequired}\n size={size}\n labelPosition={labelPosition}\n labelAlign={labelAlign}\n necessityIndicator={necessityIndicator}\n contextualHelp={contextualHelp}>\n {label}\n </FieldLabel>\n <FieldGroup\n role=\"presentation\"\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n size={size}\n styles={style({\n ...fieldInput(),\n paddingStart: 'edge-to-text',\n paddingEnd: {\n default: 0,\n isStepperHidden: 'edge-to-text'\n }\n })({size, isStepperHidden: hideStepper})}>\n <InputContext.Consumer>\n {ctx => (\n <InputContext.Provider value={{...ctx, ref: mergeRefs((ctx as any)?.ref, inputRef)}}>\n <Input />\n </InputContext.Provider>\n )}\n </InputContext.Consumer>\n {isInvalid && <FieldErrorIcon isDisabled={isDisabled} />}\n {!hideStepper && <div className={stepperContainerStyles({size})}>\n <StepButton\n ref={decrementButtonRef}\n slot=\"decrement\"\n style={renderProps => pressScale(decrementButtonRef)(renderProps)}\n className={renderProps => inputButton({\n ...renderProps,\n type: 'decrement',\n size\n })}>\n <Dash size={size} className={iconStyles({})} />\n </StepButton>\n <StepButton\n ref={incrementButtonRef}\n slot=\"increment\"\n style={renderProps => pressScale(incrementButtonRef)(renderProps)}\n className={renderProps => inputButton({\n ...renderProps,\n type: 'increment',\n size\n })}>\n <Add size={size} className={iconStyles({})} />\n </StepButton>\n </div>}\n </FieldGroup>\n {descriptionMessage && <Text slot=\"description\">{descriptionMessage}</Text>}\n <HelpText\n size={size}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n description={descriptionMessage}>\n {errorMessage}\n </HelpText>\n </>\n );\n }\n }\n </AriaNumberField>\n );\n}\n\ninterface StepButtonProps extends AriaButtonProps {\n}\n\nconst additionalButtonHTMLAttributes = new Set(['form', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'name', 'value']);\n\nlet StepButton = forwardRef((props: StepButtonProps, ref: ForwardedRef<HTMLDivElement>) => {\n [props, ref] = useContextProps(props, ref, ButtonContext as any);\n let ctx = props as any;\n /**\n * Must use div for now because Safari pointer event bugs on disabled form elements.\n * Link https://bugs.webkit.org/show_bug.cgi?id=219188.\n */\n let {buttonProps, isPressed} = useButton({...props, elementType: 'div'}, ref);\n let {focusProps, isFocused, isFocusVisible} = useFocusRing(props);\n let {hoverProps, isHovered} = useHover(props);\n let renderProps = useRenderProps({\n ...props,\n values: {isHovered, isPressed, isFocused, isFocusVisible, isDisabled: props.isDisabled || false},\n defaultClassName: 'react-aria-Button'\n });\n return (\n <div\n {...filterDOMProps(props, {propNames: additionalButtonHTMLAttributes})}\n {...mergeProps(buttonProps, focusProps, hoverProps)}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n data-disabled={props.isDisabled || undefined}\n data-pressed={ctx.isPressed || isPressed || undefined}\n data-hovered={isHovered || undefined}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined} />\n );\n});\n\n/**\n * NumberFields allow users to input number values with a keyboard or increment/decrement with step buttons.\n */\nlet _NumberField = forwardRef(NumberField);\nexport {_NumberField as NumberField};\n\n// replace from RAC\nfunction useRenderProps(props: any) {\n let {\n className,\n style,\n children,\n defaultClassName = undefined,\n defaultChildren = undefined,\n defaultStyle,\n values\n } = props;\n\n return useMemo(() => {\n let computedClassName: string | undefined;\n let computedStyle: CSSProperties | undefined;\n let computedChildren: ReactNode | undefined;\n\n if (typeof className === 'function') {\n computedClassName = className({...values, defaultClassName});\n } else {\n computedClassName = className;\n }\n\n if (typeof style === 'function') {\n computedStyle = style({...values, defaultStyle: defaultStyle || {}});\n } else {\n computedStyle = style;\n }\n\n if (typeof children === 'function') {\n computedChildren = children({...values, defaultChildren});\n } else if (children == null) {\n computedChildren = defaultChildren;\n } else {\n computedChildren = children;\n }\n\n return {\n className: computedClassName ?? defaultClassName,\n style: (computedStyle || defaultStyle) ? {...defaultStyle, ...computedStyle} : undefined,\n children: computedChildren ?? defaultChildren,\n 'data-rac': ''\n };\n }, [className, style, children, defaultClassName, defaultChildren, defaultStyle, values]);\n}\n"],"names":[],"version":3,"file":"NumberField.mjs.map"}
|