@eightshift/ui-components 1.0.6 → 1.1.0
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/README.md +9 -0
- package/dist/{Button-eebLs4cp.js → Button-CbFrFO04.js} +5 -5
- package/dist/{Checkbox-BN0TEda-.js → Checkbox-Cv3pZDHg.js} +12 -16
- package/dist/{ColorSwatch-BrowHhTG.js → ColorSwatch-CNQmCQV8.js} +6 -7
- package/dist/{FieldError-ILxgMZy5.js → FieldError-J1-YPbi6.js} +2 -2
- package/dist/{FocusScope-B9b0VMib.js → FocusScope-Bw-IatMO.js} +79 -153
- package/dist/{GridList-CzpWxJsS.js → GridList-CEzzyr-l.js} +62 -90
- package/dist/{Group-Dkdm2-E7.js → Group-D3Qa6PrV.js} +3 -3
- package/dist/{Input-BJA4rmIo.js → Input-CX_rocyZ.js} +8 -8
- package/dist/{Label-9x5iLJ-Y.js → Label-Bg5O81Wb.js} +1 -1
- package/dist/{ListBox-D3Vr4vvC.js → ListBox-CCWXTj0t.js} +391 -598
- package/dist/{LiveAnnouncer-IsokfWQ5.js → LiveAnnouncer-D8h-3GrG.js} +12 -22
- package/dist/{NumberFormatter-LzoKy975.js → NumberFormatter-U_Gx0UDq.js} +26 -44
- package/dist/{Select-49a62830.esm-CKPmlkza.js → Select-49a62830.esm-BnlXlUnT.js} +92 -166
- package/dist/{SelectionManager-sedvcM-1.js → SelectionManager-XOAt-Ekx.js} +219 -401
- package/dist/{Separator-B6rnDabE.js → Separator-DZeg0KOr.js} +41 -72
- package/dist/{Slider-C5U5N7uM.js → Slider-fULMI0gI.js} +51 -82
- package/dist/{Text-Cyxp9ewv.js → Text-WqetJduR.js} +1 -1
- package/dist/{VisuallyHidden-BPJVSUyp.js → VisuallyHidden-Di1zXprL.js} +8 -11
- package/dist/{ariaHideOutside-ByKBPHmX.js → ariaHideOutside-Zn64-frS.js} +20 -36
- package/dist/assets/style.css +1 -1
- package/dist/assets/wp-font-enhancements.css +1 -1
- package/dist/assets/wp-ui-enhancements.css +1 -1
- package/dist/{button-idVI4jmd.js → button-CD8Q1eok.js} +17 -29
- package/dist/components/animated-visibility/animated-visibility.js +125 -113
- package/dist/components/base-control/base-control.js +3 -9
- package/dist/components/breakpoint-preview/breakpoint-preview.js +51 -108
- package/dist/components/button/button.js +6 -6
- package/dist/components/checkbox/checkbox.js +2 -2
- package/dist/components/color-pickers/color-picker.js +2 -2
- package/dist/components/color-pickers/color-swatch.js +5 -9
- package/dist/components/color-pickers/gradient-editor.js +15 -29
- package/dist/components/color-pickers/solid-color-picker.js +81 -128
- package/dist/components/component-toggle/component-toggle.js +4 -4
- package/dist/components/container-panel/container-panel.js +4 -11
- package/dist/components/draggable-list/draggable-list-item.js +4 -4
- package/dist/components/draggable-list/draggable-list.js +5 -5
- package/dist/components/expandable/expandable.js +45 -57
- package/dist/components/index.js +3 -3
- package/dist/components/input-field/input-field.js +11 -26
- package/dist/components/layout/hstack.js +2 -12
- package/dist/components/layout/vstack.js +2 -12
- package/dist/components/link-input/link-input.js +36 -53
- package/dist/components/list-box/list-box.js +4 -4
- package/dist/components/matrix-align/matrix-align.js +6 -10
- package/dist/components/menu/menu.js +101 -170
- package/dist/components/notice/notice.js +1 -1
- package/dist/components/number-picker/number-picker.js +15 -15
- package/dist/components/option-select/option-select.js +48 -64
- package/dist/components/options-panel/options-panel.js +3 -3
- package/dist/components/placeholders/file-placeholder.js +2 -2
- package/dist/components/placeholders/image-placeholder.js +1 -1
- package/dist/components/placeholders/media-placeholder.js +1 -1
- package/dist/components/popover/popover.js +4 -4
- package/dist/components/radio/radio.js +25 -38
- package/dist/components/repeater/repeater-item.js +6 -17
- package/dist/components/repeater/repeater.js +6 -7
- package/dist/components/responsive/responsive-legacy.js +6 -12
- package/dist/components/responsive/responsive.js +21 -48
- package/dist/components/responsive-preview/responsive-preview.js +1 -1
- package/dist/components/rich-label/rich-label.js +2 -8
- package/dist/components/select/async-multi-select.js +3 -3
- package/dist/components/select/async-single-select.js +2 -2
- package/dist/components/select/custom-select-default-components.js +2 -2
- package/dist/components/select/multi-select-components.js +2 -2
- package/dist/components/select/multi-select.js +3 -3
- package/dist/components/select/react-select-component-wrappers.js +9 -9
- package/dist/components/select/single-select.js +2 -2
- package/dist/components/select/styles.js +3 -10
- package/dist/components/slider/column-config-slider.js +4 -4
- package/dist/components/slider/slider.js +5 -8
- package/dist/components/slider/utils.js +2 -6
- package/dist/components/spacer/spacer.js +2 -7
- package/dist/components/tabs/tabs.js +29 -50
- package/dist/components/toggle/switch.js +8 -8
- package/dist/components/toggle/toggle.js +1 -1
- package/dist/components/toggle-button/toggle-button.js +8 -22
- package/dist/components/tooltip/tooltip.js +4 -4
- package/dist/{context-BAcFg5GO.js → context-4oSz1ItD.js} +10 -16
- package/dist/{default-i18n-Bk1GxDHz.js → default-i18n-BqwLkgZv.js} +21 -22
- package/dist/{filterDOMProps-DG2RfOUr.js → filterDOMProps-EDDcM64A.js} +1 -3
- package/dist/{focusSafely-B0hyd-S4.js → focusSafely-BS4dllCW.js} +85 -143
- package/dist/icons/generic-color-swatch.js +105 -13
- package/dist/icons/icons.js +31010 -3447
- package/dist/icons/jsx-svg.js +591 -953
- package/dist/{index-BDk0TPWz.js → index-CAPcSs9K.js} +1504 -2087
- package/dist/{index-a301f526.esm-BzTuHLdr.js → index-a301f526.esm-ByOfDxiG.js} +111 -183
- package/dist/index.js +3 -3
- package/dist/{intlStrings-Ctkp0HDc.js → intlStrings-Dxaeitoh.js} +35 -60
- package/dist/{isScrollable-PcyglExV.js → isScrollable-Dh9D9IOd.js} +1 -2
- package/dist/lite-DVmmD_-j.js +7 -0
- package/dist/{multi-select-components-nORKdJ-2.js → multi-select-components-7vKCF8dG.js} +3 -3
- package/dist/{number-rWqELA8W.js → number-CHmNj-oR.js} +3 -6
- package/dist/{popover-o2Q28Ljn.js → popover-Dk2o4S7K.js} +70 -112
- package/dist/{react-select-async.esm-CLj9uZTq.js → react-select-async.esm-5zW9Dv9E.js} +7 -11
- package/dist/{react-select.esm-3tyTZmrx.js → react-select.esm-Bi6uzjbT.js} +3 -3
- package/dist/{textSelection-BRZdHY-4.js → textSelection-exP_9srp.js} +5 -9
- package/dist/{tooltip-T6H9uF-Z.js → tooltip-BRQ4tvZL.js} +64 -111
- package/dist/{useButton-D-xACzEY.js → useButton-DbjDV_33.js} +19 -22
- package/dist/{useEvent-XlYPKgwX.js → useEvent-zvxfEnmK.js} +2 -3
- package/dist/{useFocusRing-CRx_hYC4.js → useFocusRing-SPRI0-SN.js} +1 -1
- package/dist/{useFocusable-CHfpEdlE.js → useFocusable-CLmhO94g.js} +5 -8
- package/dist/{useFormReset-aHn6-wRk.js → useFormReset-BVWgcyGO.js} +2 -3
- package/dist/{useFormValidationState-CdYmOaXI.js → useFormValidationState-CthG9Fbc.js} +20 -38
- package/dist/{useHasTabbableChild-domoFB7A.js → useHasTabbableChild--gkWUICh.js} +2 -2
- package/dist/{useLabel-DVhXVhtH.js → useLabel-g836T8kL.js} +3 -4
- package/dist/{useLabels-C7E5SkOi.js → useLabels-CfOtyOe2.js} +3 -5
- package/dist/{useListData-BelKu4kx.js → useListData-BpYQj7kK.js} +18 -32
- package/dist/{useListState-BRsq7O1C.js → useListState-DnWZa__1.js} +6 -12
- package/dist/{useLocalizedStringFormatter-WsEL47qR.js → useLocalizedStringFormatter-BQCMno9k.js} +12 -21
- package/dist/{useNumberFieldState-ZH2Qyyxh.js → useNumberFieldState-BegO5X6F.js} +75 -132
- package/dist/{useNumberFormatter-mhdYLxWQ.js → useNumberFormatter-DhOGEsEK.js} +2 -2
- package/dist/{usePress-B42RawCH.js → usePress-CScNeV3V.js} +92 -175
- package/dist/{useToggle-CExfZM8x.js → useToggle-6LnpaJ7-.js} +6 -7
- package/dist/{useToggleState-DghG5ImG.js → useToggleState-Cymkpac8.js} +3 -5
- package/dist/utilities/array-helpers.js +1 -1
- package/dist/utilities/index.js +1 -1
- package/dist/utilities/text-helpers.js +20 -20
- package/dist/{utils-DIBzm1e4.js → utils-Dc35LwuT.js} +49 -90
- package/package.json +96 -90
- package/dist/lite-pbIeT7tm.js +0 -8
|
@@ -1,29 +1,27 @@
|
|
|
1
|
-
import { f as $8ae05eaa5c114e9c$export$7f54fc3180508a52, d as $3ef42575df84b30b$export$9d1611c77c2fe928, e as $bdb11010cef70236$export$f680877a34711e37, n as $ff5963eb1fccf552$export$e08e3b67e392101e } from "./utils-
|
|
2
|
-
import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "./filterDOMProps-
|
|
3
|
-
import { c as $a1ea59d68270f0dd$export$f8168d8dd8fd66e6, d as $9ab94262bd0047c7$export$420e68273165f4ec, x as $c87311424ea30a05$export$186c6964ca17d99, u as $c87311424ea30a05$export$a11b0059900ceec8, j as $c87311424ea30a05$export$fedb369cb70207f1, e as $458b0a5536c1a7cf$export$40bfa8c7b0832715 } from "./focusSafely-
|
|
4
|
-
import { $ as $99facab73266f662$export$5add1d006293d136 } from "./useFormReset-
|
|
1
|
+
import { f as $8ae05eaa5c114e9c$export$7f54fc3180508a52, d as $3ef42575df84b30b$export$9d1611c77c2fe928, e as $bdb11010cef70236$export$f680877a34711e37, n as $ff5963eb1fccf552$export$e08e3b67e392101e } from "./utils-Dc35LwuT.js";
|
|
2
|
+
import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "./filterDOMProps-EDDcM64A.js";
|
|
3
|
+
import { c as $a1ea59d68270f0dd$export$f8168d8dd8fd66e6, d as $9ab94262bd0047c7$export$420e68273165f4ec, x as $c87311424ea30a05$export$186c6964ca17d99, u as $c87311424ea30a05$export$a11b0059900ceec8, j as $c87311424ea30a05$export$fedb369cb70207f1, e as $458b0a5536c1a7cf$export$40bfa8c7b0832715 } from "./focusSafely-BS4dllCW.js";
|
|
4
|
+
import { $ as $99facab73266f662$export$5add1d006293d136 } from "./useFormReset-BVWgcyGO.js";
|
|
5
5
|
import { useCallback, useEffect, useRef, useMemo, useState } from "react";
|
|
6
|
-
import { c as $e5be200c675c3b3a$export$a763b9476acd3eb, $ as $e5be200c675c3b3a$export$fc1a364ae1f3ff10 } from "./useFormValidationState-
|
|
7
|
-
import { $ as $e9faafb641e167db$export$90fc3a17d93f704c } from "./useEvent-
|
|
8
|
-
import { b as $2d73ec29415bd339$export$712718f7aec83d5 } from "./Input-
|
|
9
|
-
import { $ as $fca6afa0e843324b$export$f12b703ca79dfbb1 } from "./useLocalizedStringFormatter-
|
|
10
|
-
import { $ as $a916eb452884faea$export$b7a616150fdb9f44 } from "./useNumberFormatter-
|
|
11
|
-
import { a as $319e236875307eab$export$d10ae4f68404609a, $ as $319e236875307eab$export$a9b970dcc4ae71a9 } from "./LiveAnnouncer-
|
|
12
|
-
import { $ as $03deb23ff14920c4$export$4eaf04e54aa8eed6 } from "./textSelection-
|
|
13
|
-
import { a as $9446cca9a3875146$export$cb6e0bb50bc19463, $ as $9446cca9a3875146$export$7d15b64cf5a3a4c4 } from "./number-
|
|
14
|
-
import { $ as $488c6ddbf4ef74c2$export$cc77c4ff7e8673c5 } from "./NumberFormatter-
|
|
6
|
+
import { c as $e5be200c675c3b3a$export$a763b9476acd3eb, $ as $e5be200c675c3b3a$export$fc1a364ae1f3ff10 } from "./useFormValidationState-CthG9Fbc.js";
|
|
7
|
+
import { $ as $e9faafb641e167db$export$90fc3a17d93f704c } from "./useEvent-zvxfEnmK.js";
|
|
8
|
+
import { b as $2d73ec29415bd339$export$712718f7aec83d5 } from "./Input-CX_rocyZ.js";
|
|
9
|
+
import { $ as $fca6afa0e843324b$export$f12b703ca79dfbb1 } from "./useLocalizedStringFormatter-BQCMno9k.js";
|
|
10
|
+
import { $ as $a916eb452884faea$export$b7a616150fdb9f44 } from "./useNumberFormatter-DhOGEsEK.js";
|
|
11
|
+
import { a as $319e236875307eab$export$d10ae4f68404609a, $ as $319e236875307eab$export$a9b970dcc4ae71a9 } from "./LiveAnnouncer-D8h-3GrG.js";
|
|
12
|
+
import { $ as $03deb23ff14920c4$export$4eaf04e54aa8eed6 } from "./textSelection-exP_9srp.js";
|
|
13
|
+
import { a as $9446cca9a3875146$export$cb6e0bb50bc19463, $ as $9446cca9a3875146$export$7d15b64cf5a3a4c4 } from "./number-CHmNj-oR.js";
|
|
14
|
+
import { $ as $488c6ddbf4ef74c2$export$cc77c4ff7e8673c5 } from "./NumberFormatter-U_Gx0UDq.js";
|
|
15
15
|
function $7d0a636d7a4dcefd$export$2123ff2b87c81ca(props, ref) {
|
|
16
16
|
let { onScroll, isDisabled } = props;
|
|
17
17
|
let onScrollHandler = useCallback((e) => {
|
|
18
|
-
if (e.ctrlKey)
|
|
19
|
-
return;
|
|
18
|
+
if (e.ctrlKey) return;
|
|
20
19
|
e.preventDefault();
|
|
21
20
|
e.stopPropagation();
|
|
22
|
-
if (onScroll)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
});
|
|
21
|
+
if (onScroll) onScroll({
|
|
22
|
+
deltaX: e.deltaX,
|
|
23
|
+
deltaY: e.deltaY
|
|
24
|
+
});
|
|
27
25
|
}, [
|
|
28
26
|
onScroll
|
|
29
27
|
]);
|
|
@@ -67,12 +65,10 @@ const $6c7bd7858deea686$var$numberParserCache = /* @__PURE__ */ new Map();
|
|
|
67
65
|
function $6c7bd7858deea686$var$getNumberParserImpl(locale, options, value) {
|
|
68
66
|
let defaultParser = $6c7bd7858deea686$var$getCachedNumberParser(locale, options);
|
|
69
67
|
if (!locale.includes("-nu-") && !defaultParser.isValidPartialNumber(value)) {
|
|
70
|
-
for (let numberingSystem of $6c7bd7858deea686$var$NUMBERING_SYSTEMS)
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return parser;
|
|
75
|
-
}
|
|
68
|
+
for (let numberingSystem of $6c7bd7858deea686$var$NUMBERING_SYSTEMS) if (numberingSystem !== defaultParser.options.numberingSystem) {
|
|
69
|
+
let parser = $6c7bd7858deea686$var$getCachedNumberParser(locale + (locale.includes("-u-") ? "-nu-" : "-u-nu-") + numberingSystem, options);
|
|
70
|
+
if (parser.isValidPartialNumber(value)) return parser;
|
|
71
|
+
}
|
|
76
72
|
}
|
|
77
73
|
return defaultParser;
|
|
78
74
|
}
|
|
@@ -90,32 +86,23 @@ class $6c7bd7858deea686$var$NumberParserImpl {
|
|
|
90
86
|
let fullySanitizedValue = this.sanitize(value);
|
|
91
87
|
if (this.symbols.group)
|
|
92
88
|
fullySanitizedValue = $6c7bd7858deea686$var$replaceAll(fullySanitizedValue, this.symbols.group, "");
|
|
93
|
-
if (this.symbols.decimal)
|
|
94
|
-
|
|
95
|
-
if (this.symbols.minusSign)
|
|
96
|
-
fullySanitizedValue = fullySanitizedValue.replace(this.symbols.minusSign, "-");
|
|
89
|
+
if (this.symbols.decimal) fullySanitizedValue = fullySanitizedValue.replace(this.symbols.decimal, ".");
|
|
90
|
+
if (this.symbols.minusSign) fullySanitizedValue = fullySanitizedValue.replace(this.symbols.minusSign, "-");
|
|
97
91
|
fullySanitizedValue = fullySanitizedValue.replace(this.symbols.numeral, this.symbols.index);
|
|
98
92
|
if (this.options.style === "percent") {
|
|
99
93
|
let isNegative = fullySanitizedValue.indexOf("-");
|
|
100
94
|
fullySanitizedValue = fullySanitizedValue.replace("-", "");
|
|
101
95
|
let index = fullySanitizedValue.indexOf(".");
|
|
102
|
-
if (index === -1)
|
|
103
|
-
index = fullySanitizedValue.length;
|
|
96
|
+
if (index === -1) index = fullySanitizedValue.length;
|
|
104
97
|
fullySanitizedValue = fullySanitizedValue.replace(".", "");
|
|
105
|
-
if (index - 2 === 0)
|
|
106
|
-
|
|
107
|
-
else if (index - 2 === -
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
fullySanitizedValue = "0.00";
|
|
111
|
-
else
|
|
112
|
-
fullySanitizedValue = `${fullySanitizedValue.slice(0, index - 2)}.${fullySanitizedValue.slice(index - 2)}`;
|
|
113
|
-
if (isNegative > -1)
|
|
114
|
-
fullySanitizedValue = `-${fullySanitizedValue}`;
|
|
98
|
+
if (index - 2 === 0) fullySanitizedValue = `0.${fullySanitizedValue}`;
|
|
99
|
+
else if (index - 2 === -1) fullySanitizedValue = `0.0${fullySanitizedValue}`;
|
|
100
|
+
else if (index - 2 === -2) fullySanitizedValue = "0.00";
|
|
101
|
+
else fullySanitizedValue = `${fullySanitizedValue.slice(0, index - 2)}.${fullySanitizedValue.slice(index - 2)}`;
|
|
102
|
+
if (isNegative > -1) fullySanitizedValue = `-${fullySanitizedValue}`;
|
|
115
103
|
}
|
|
116
104
|
let newValue = fullySanitizedValue ? +fullySanitizedValue : NaN;
|
|
117
|
-
if (isNaN(newValue))
|
|
118
|
-
return NaN;
|
|
105
|
+
if (isNaN(newValue)) return NaN;
|
|
119
106
|
if (this.options.style === "percent") {
|
|
120
107
|
var _this_options_minimumFractionDigits, _this_options_maximumFractionDigits;
|
|
121
108
|
let options = {
|
|
@@ -126,41 +113,31 @@ class $6c7bd7858deea686$var$NumberParserImpl {
|
|
|
126
113
|
};
|
|
127
114
|
return new $6c7bd7858deea686$export$cd11ab140839f11d(this.locale, options).parse(new $488c6ddbf4ef74c2$export$cc77c4ff7e8673c5(this.locale, options).format(newValue));
|
|
128
115
|
}
|
|
129
|
-
if (this.options.currencySign === "accounting" && $6c7bd7858deea686$var$CURRENCY_SIGN_REGEX.test(value))
|
|
130
|
-
newValue = -1 * newValue;
|
|
116
|
+
if (this.options.currencySign === "accounting" && $6c7bd7858deea686$var$CURRENCY_SIGN_REGEX.test(value)) newValue = -1 * newValue;
|
|
131
117
|
return newValue;
|
|
132
118
|
}
|
|
133
119
|
sanitize(value) {
|
|
134
120
|
value = value.replace(this.symbols.literals, "");
|
|
135
|
-
if (this.symbols.minusSign)
|
|
136
|
-
value = value.replace("-", this.symbols.minusSign);
|
|
121
|
+
if (this.symbols.minusSign) value = value.replace("-", this.symbols.minusSign);
|
|
137
122
|
if (this.options.numberingSystem === "arab") {
|
|
138
123
|
if (this.symbols.decimal) {
|
|
139
124
|
value = value.replace(",", this.symbols.decimal);
|
|
140
125
|
value = value.replace(String.fromCharCode(1548), this.symbols.decimal);
|
|
141
126
|
}
|
|
142
|
-
if (this.symbols.group)
|
|
143
|
-
value = $6c7bd7858deea686$var$replaceAll(value, ".", this.symbols.group);
|
|
127
|
+
if (this.symbols.group) value = $6c7bd7858deea686$var$replaceAll(value, ".", this.symbols.group);
|
|
144
128
|
}
|
|
145
|
-
if (this.options.locale === "fr-FR")
|
|
146
|
-
value = $6c7bd7858deea686$var$replaceAll(value, ".", String.fromCharCode(8239));
|
|
129
|
+
if (this.options.locale === "fr-FR") value = $6c7bd7858deea686$var$replaceAll(value, ".", String.fromCharCode(8239));
|
|
147
130
|
return value;
|
|
148
131
|
}
|
|
149
132
|
isValidPartialNumber(value, minValue = -Infinity, maxValue = Infinity) {
|
|
150
133
|
value = this.sanitize(value);
|
|
151
|
-
if (this.symbols.minusSign && value.startsWith(this.symbols.minusSign) && minValue < 0)
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
if (this.symbols.group
|
|
156
|
-
return false;
|
|
157
|
-
if (this.symbols.decimal && value.indexOf(this.symbols.decimal) > -1 && this.options.maximumFractionDigits === 0)
|
|
158
|
-
return false;
|
|
159
|
-
if (this.symbols.group)
|
|
160
|
-
value = $6c7bd7858deea686$var$replaceAll(value, this.symbols.group, "");
|
|
134
|
+
if (this.symbols.minusSign && value.startsWith(this.symbols.minusSign) && minValue < 0) value = value.slice(this.symbols.minusSign.length);
|
|
135
|
+
else if (this.symbols.plusSign && value.startsWith(this.symbols.plusSign) && maxValue > 0) value = value.slice(this.symbols.plusSign.length);
|
|
136
|
+
if (this.symbols.group && value.startsWith(this.symbols.group)) return false;
|
|
137
|
+
if (this.symbols.decimal && value.indexOf(this.symbols.decimal) > -1 && this.options.maximumFractionDigits === 0) return false;
|
|
138
|
+
if (this.symbols.group) value = $6c7bd7858deea686$var$replaceAll(value, this.symbols.group, "");
|
|
161
139
|
value = value.replace(this.symbols.numeral, "");
|
|
162
|
-
if (this.symbols.decimal)
|
|
163
|
-
value = value.replace(this.symbols.decimal, "");
|
|
140
|
+
if (this.symbols.decimal) value = value.replace(this.symbols.decimal, "");
|
|
164
141
|
return value.length === 0;
|
|
165
142
|
}
|
|
166
143
|
constructor(locale, options = {}) {
|
|
@@ -169,8 +146,7 @@ class $6c7bd7858deea686$var$NumberParserImpl {
|
|
|
169
146
|
this.options = this.formatter.resolvedOptions();
|
|
170
147
|
this.symbols = $6c7bd7858deea686$var$getSymbols(locale, this.formatter, this.options, options);
|
|
171
148
|
var _this_options_minimumFractionDigits, _this_options_maximumFractionDigits;
|
|
172
|
-
if (this.options.style === "percent" && (((_this_options_minimumFractionDigits = this.options.minimumFractionDigits) !== null && _this_options_minimumFractionDigits !== void 0 ? _this_options_minimumFractionDigits : 0) > 18 || ((_this_options_maximumFractionDigits = this.options.maximumFractionDigits) !== null && _this_options_maximumFractionDigits !== void 0 ? _this_options_maximumFractionDigits : 0) > 18))
|
|
173
|
-
console.warn("NumberParser cannot handle percentages with greater than 18 decimal places, please reduce the number in your options.");
|
|
149
|
+
if (this.options.style === "percent" && (((_this_options_minimumFractionDigits = this.options.minimumFractionDigits) !== null && _this_options_minimumFractionDigits !== void 0 ? _this_options_minimumFractionDigits : 0) > 18 || ((_this_options_maximumFractionDigits = this.options.maximumFractionDigits) !== null && _this_options_maximumFractionDigits !== void 0 ? _this_options_maximumFractionDigits : 0) > 18)) console.warn("NumberParser cannot handle percentages with greater than 18 decimal places, please reduce the number in your options.");
|
|
174
150
|
}
|
|
175
151
|
}
|
|
176
152
|
const $6c7bd7858deea686$var$nonLiteralParts = /* @__PURE__ */ new Set([
|
|
@@ -208,8 +184,7 @@ function $6c7bd7858deea686$var$getSymbols(locale, formatter, intlOptions, origin
|
|
|
208
184
|
var _allParts_find_value;
|
|
209
185
|
let minusSign = (_allParts_find_value = (_allParts_find = allParts.find((p) => p.type === "minusSign")) === null || _allParts_find === void 0 ? void 0 : _allParts_find.value) !== null && _allParts_find_value !== void 0 ? _allParts_find_value : "-";
|
|
210
186
|
let plusSign = (_posAllParts_find = posAllParts.find((p) => p.type === "plusSign")) === null || _posAllParts_find === void 0 ? void 0 : _posAllParts_find.value;
|
|
211
|
-
if (!plusSign && ((originalOptions === null || originalOptions === void 0 ? void 0 : originalOptions.signDisplay) === "exceptZero" || (originalOptions === null || originalOptions === void 0 ? void 0 : originalOptions.signDisplay) === "always"))
|
|
212
|
-
plusSign = "+";
|
|
187
|
+
if (!plusSign && ((originalOptions === null || originalOptions === void 0 ? void 0 : originalOptions.signDisplay) === "exceptZero" || (originalOptions === null || originalOptions === void 0 ? void 0 : originalOptions.signDisplay) === "always")) plusSign = "+";
|
|
213
188
|
let decimalParts = new Intl.NumberFormat(locale, {
|
|
214
189
|
...intlOptions,
|
|
215
190
|
minimumFractionDigits: 2,
|
|
@@ -285,16 +260,13 @@ function $d841c8010a73d545$export$4f384c9210e583c3(props, state, inputRef) {
|
|
|
285
260
|
nextValue = input.value.slice(input.selectionStart);
|
|
286
261
|
break;
|
|
287
262
|
default:
|
|
288
|
-
if (e.data != null)
|
|
289
|
-
nextValue = input.value.slice(0, input.selectionStart) + e.data + input.value.slice(input.selectionEnd);
|
|
263
|
+
if (e.data != null) nextValue = input.value.slice(0, input.selectionStart) + e.data + input.value.slice(input.selectionEnd);
|
|
290
264
|
break;
|
|
291
265
|
}
|
|
292
|
-
if (nextValue == null || !state.validate(nextValue))
|
|
293
|
-
e.preventDefault();
|
|
266
|
+
if (nextValue == null || !state.validate(nextValue)) e.preventDefault();
|
|
294
267
|
});
|
|
295
268
|
useEffect(() => {
|
|
296
|
-
if (!$d841c8010a73d545$var$supportsNativeBeforeInputEvent())
|
|
297
|
-
return;
|
|
269
|
+
if (!$d841c8010a73d545$var$supportsNativeBeforeInputEvent()) return;
|
|
298
270
|
let input = inputRef.current;
|
|
299
271
|
input.addEventListener("beforeinput", onBeforeInputFallback, false);
|
|
300
272
|
return () => {
|
|
@@ -306,8 +278,7 @@ function $d841c8010a73d545$export$4f384c9210e583c3(props, state, inputRef) {
|
|
|
306
278
|
]);
|
|
307
279
|
let onBeforeInput = !$d841c8010a73d545$var$supportsNativeBeforeInputEvent() ? (e) => {
|
|
308
280
|
let nextValue = e.target.value.slice(0, e.target.selectionStart) + e.data + e.target.value.slice(e.target.selectionEnd);
|
|
309
|
-
if (!state.validate(nextValue))
|
|
310
|
-
e.preventDefault();
|
|
281
|
+
if (!state.validate(nextValue)) e.preventDefault();
|
|
311
282
|
} : null;
|
|
312
283
|
let { labelProps, inputProps: textFieldProps, descriptionProps, errorMessageProps, ...validation } = $2d73ec29415bd339$export$712718f7aec83d5(props, inputRef);
|
|
313
284
|
let compositionStartState = useRef(null);
|
|
@@ -522,8 +493,7 @@ function $d2e8511e6f209edf$export$e908e06f4b8e3402(props) {
|
|
|
522
493
|
return () => clearAsync();
|
|
523
494
|
}, []);
|
|
524
495
|
let onKeyDown = (e) => {
|
|
525
|
-
if (e.ctrlKey || e.metaKey || e.shiftKey || e.altKey || isReadOnly)
|
|
526
|
-
return;
|
|
496
|
+
if (e.ctrlKey || e.metaKey || e.shiftKey || e.altKey || isReadOnly) return;
|
|
527
497
|
switch (e.key) {
|
|
528
498
|
case "PageUp":
|
|
529
499
|
if (onIncrementPage) {
|
|
@@ -585,16 +555,14 @@ function $d2e8511e6f209edf$export$e908e06f4b8e3402(props) {
|
|
|
585
555
|
clearAsync();
|
|
586
556
|
onIncrement === null || onIncrement === void 0 ? void 0 : onIncrement();
|
|
587
557
|
_async.current = window.setTimeout(() => {
|
|
588
|
-
if (maxValue === void 0 || isNaN(maxValue) || value === void 0 || isNaN(value) || value < maxValue)
|
|
589
|
-
onIncrementPressStart(60);
|
|
558
|
+
if (maxValue === void 0 || isNaN(maxValue) || value === void 0 || isNaN(value) || value < maxValue) onIncrementPressStart(60);
|
|
590
559
|
}, initialStepDelay);
|
|
591
560
|
});
|
|
592
561
|
const onDecrementPressStart = $8ae05eaa5c114e9c$export$7f54fc3180508a52((initialStepDelay) => {
|
|
593
562
|
clearAsync();
|
|
594
563
|
onDecrement === null || onDecrement === void 0 ? void 0 : onDecrement();
|
|
595
564
|
_async.current = window.setTimeout(() => {
|
|
596
|
-
if (minValue === void 0 || isNaN(minValue) || value === void 0 || isNaN(value) || value > minValue)
|
|
597
|
-
onDecrementPressStart(60);
|
|
565
|
+
if (minValue === void 0 || isNaN(minValue) || value === void 0 || isNaN(value) || value > minValue) onDecrementPressStart(60);
|
|
598
566
|
}, initialStepDelay);
|
|
599
567
|
});
|
|
600
568
|
let cancelContextMenu = (e) => {
|
|
@@ -927,12 +895,9 @@ function $81397a9303501bda$export$23f548e970bdf099(props, state, inputRef) {
|
|
|
927
895
|
onFocusWithinChange: setFocusWithin
|
|
928
896
|
});
|
|
929
897
|
let onWheel = useCallback((e) => {
|
|
930
|
-
if (Math.abs(e.deltaY) <= Math.abs(e.deltaX))
|
|
931
|
-
|
|
932
|
-
if (e.deltaY
|
|
933
|
-
increment();
|
|
934
|
-
else if (e.deltaY < 0)
|
|
935
|
-
decrement();
|
|
898
|
+
if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) return;
|
|
899
|
+
if (e.deltaY > 0) increment();
|
|
900
|
+
else if (e.deltaY < 0) decrement();
|
|
936
901
|
}, [
|
|
937
902
|
decrement,
|
|
938
903
|
increment
|
|
@@ -946,27 +911,21 @@ function $81397a9303501bda$export$23f548e970bdf099(props, state, inputRef) {
|
|
|
946
911
|
let hasNegative = state.minValue === void 0 || isNaN(state.minValue) || state.minValue < 0;
|
|
947
912
|
let inputMode = "numeric";
|
|
948
913
|
if ($c87311424ea30a05$export$186c6964ca17d99()) {
|
|
949
|
-
if (hasNegative)
|
|
950
|
-
|
|
951
|
-
else if (hasDecimals)
|
|
952
|
-
inputMode = "decimal";
|
|
914
|
+
if (hasNegative) inputMode = "text";
|
|
915
|
+
else if (hasDecimals) inputMode = "decimal";
|
|
953
916
|
} else if ($c87311424ea30a05$export$a11b0059900ceec8()) {
|
|
954
|
-
if (hasNegative)
|
|
955
|
-
|
|
956
|
-
else if (hasDecimals)
|
|
957
|
-
inputMode = "decimal";
|
|
917
|
+
if (hasNegative) inputMode = "numeric";
|
|
918
|
+
else if (hasDecimals) inputMode = "decimal";
|
|
958
919
|
}
|
|
959
920
|
let onChange = (value) => {
|
|
960
|
-
if (state.validate(value))
|
|
961
|
-
state.setInputValue(value);
|
|
921
|
+
if (state.validate(value)) state.setInputValue(value);
|
|
962
922
|
};
|
|
963
923
|
let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props);
|
|
964
924
|
let onKeyDownEnter = useCallback((e) => {
|
|
965
925
|
if (e.key === "Enter") {
|
|
966
926
|
commit();
|
|
967
927
|
commitValidation();
|
|
968
|
-
} else
|
|
969
|
-
e.continuePropagation();
|
|
928
|
+
} else e.continuePropagation();
|
|
970
929
|
}, [
|
|
971
930
|
commit,
|
|
972
931
|
commitValidation
|
|
@@ -1016,21 +975,16 @@ function $81397a9303501bda$export$23f548e970bdf099(props, state, inputRef) {
|
|
|
1016
975
|
autoCorrect: "off",
|
|
1017
976
|
spellCheck: "false"
|
|
1018
977
|
});
|
|
1019
|
-
if (props.validationBehavior === "native")
|
|
1020
|
-
inputProps["aria-required"] = void 0;
|
|
978
|
+
if (props.validationBehavior === "native") inputProps["aria-required"] = void 0;
|
|
1021
979
|
let onButtonPressStart = (e) => {
|
|
1022
980
|
var _inputRef_current;
|
|
1023
|
-
if (document.activeElement === inputRef.current)
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
(_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
|
|
1027
|
-
else
|
|
1028
|
-
e.target.focus();
|
|
981
|
+
if (document.activeElement === inputRef.current) return;
|
|
982
|
+
if (e.pointerType === "mouse") (_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
|
|
983
|
+
else e.target.focus();
|
|
1029
984
|
};
|
|
1030
985
|
let fieldLabel = props["aria-label"] || (typeof props.label === "string" ? props.label : "");
|
|
1031
986
|
let ariaLabelledby;
|
|
1032
|
-
if (!fieldLabel)
|
|
1033
|
-
ariaLabelledby = props.label != null ? labelProps.id : props["aria-labelledby"];
|
|
987
|
+
if (!fieldLabel) ariaLabelledby = props.label != null ? labelProps.id : props["aria-labelledby"];
|
|
1034
988
|
let incrementId = $bdb11010cef70236$export$f680877a34711e37();
|
|
1035
989
|
let decrementId = $bdb11010cef70236$export$f680877a34711e37();
|
|
1036
990
|
let incrementButtonProps = $3ef42575df84b30b$export$9d1611c77c2fe928(incButtonProps, {
|
|
@@ -1079,19 +1033,14 @@ function $81397a9303501bda$export$23f548e970bdf099(props, state, inputRef) {
|
|
|
1079
1033
|
}
|
|
1080
1034
|
function $de67e98908f0c6ee$export$7f629e9dc1ecf37c(props) {
|
|
1081
1035
|
let { minValue, maxValue, step, formatOptions, value, defaultValue = NaN, onChange, locale, isDisabled, isReadOnly } = props;
|
|
1082
|
-
if (value === null)
|
|
1083
|
-
value = NaN;
|
|
1036
|
+
if (value === null) value = NaN;
|
|
1084
1037
|
if (value !== void 0 && !isNaN(value)) {
|
|
1085
|
-
if (step !== void 0 && !isNaN(step))
|
|
1086
|
-
|
|
1087
|
-
else
|
|
1088
|
-
value = $9446cca9a3875146$export$7d15b64cf5a3a4c4(value, minValue, maxValue);
|
|
1038
|
+
if (step !== void 0 && !isNaN(step)) value = $9446cca9a3875146$export$cb6e0bb50bc19463(value, minValue, maxValue, step);
|
|
1039
|
+
else value = $9446cca9a3875146$export$7d15b64cf5a3a4c4(value, minValue, maxValue);
|
|
1089
1040
|
}
|
|
1090
1041
|
if (!isNaN(defaultValue)) {
|
|
1091
|
-
if (step !== void 0 && !isNaN(step))
|
|
1092
|
-
|
|
1093
|
-
else
|
|
1094
|
-
defaultValue = $9446cca9a3875146$export$7d15b64cf5a3a4c4(defaultValue, minValue, maxValue);
|
|
1042
|
+
if (step !== void 0 && !isNaN(step)) defaultValue = $9446cca9a3875146$export$cb6e0bb50bc19463(defaultValue, minValue, maxValue, step);
|
|
1043
|
+
else defaultValue = $9446cca9a3875146$export$7d15b64cf5a3a4c4(defaultValue, minValue, maxValue);
|
|
1095
1044
|
}
|
|
1096
1045
|
let [numberValue, setNumberValue] = $458b0a5536c1a7cf$export$40bfa8c7b0832715(value, isNaN(defaultValue) ? NaN : defaultValue, onChange);
|
|
1097
1046
|
let [inputValue, setInputValue] = useState(() => isNaN(numberValue) ? "" : new $488c6ddbf4ef74c2$export$cc77c4ff7e8673c5(locale, formatOptions).format(numberValue));
|
|
@@ -1122,8 +1071,7 @@ function $de67e98908f0c6ee$export$7f629e9dc1ecf37c(props) {
|
|
|
1122
1071
|
value: numberValue
|
|
1123
1072
|
});
|
|
1124
1073
|
let clampStep = step !== void 0 && !isNaN(step) ? step : 1;
|
|
1125
|
-
if (intlOptions.style === "percent" && (step === void 0 || isNaN(step)))
|
|
1126
|
-
clampStep = 0.01;
|
|
1074
|
+
if (intlOptions.style === "percent" && (step === void 0 || isNaN(step))) clampStep = 0.01;
|
|
1127
1075
|
let [prevValue, setPrevValue] = useState(numberValue);
|
|
1128
1076
|
let [prevLocale, setPrevLocale] = useState(locale);
|
|
1129
1077
|
let [prevFormatOptions, setPrevFormatOptions] = useState(formatOptions);
|
|
@@ -1148,10 +1096,8 @@ function $de67e98908f0c6ee$export$7f629e9dc1ecf37c(props) {
|
|
|
1148
1096
|
return;
|
|
1149
1097
|
}
|
|
1150
1098
|
let clampedValue;
|
|
1151
|
-
if (step === void 0 || isNaN(step))
|
|
1152
|
-
|
|
1153
|
-
else
|
|
1154
|
-
clampedValue = $9446cca9a3875146$export$cb6e0bb50bc19463(parsedValue, minValue, maxValue, step);
|
|
1099
|
+
if (step === void 0 || isNaN(step)) clampedValue = $9446cca9a3875146$export$7d15b64cf5a3a4c4(parsedValue, minValue, maxValue);
|
|
1100
|
+
else clampedValue = $9446cca9a3875146$export$cb6e0bb50bc19463(parsedValue, minValue, maxValue, step);
|
|
1155
1101
|
clampedValue = numberParser.parse(format(clampedValue));
|
|
1156
1102
|
setNumberValue(clampedValue);
|
|
1157
1103
|
setInputValue(format(value === void 0 ? clampedValue : numberValue));
|
|
@@ -1163,22 +1109,19 @@ function $de67e98908f0c6ee$export$7f629e9dc1ecf37c(props) {
|
|
|
1163
1109
|
return $9446cca9a3875146$export$cb6e0bb50bc19463(newValue, minValue, maxValue, clampStep);
|
|
1164
1110
|
} else {
|
|
1165
1111
|
let newValue = $9446cca9a3875146$export$cb6e0bb50bc19463(prev, minValue, maxValue, clampStep);
|
|
1166
|
-
if (operation === "+" && newValue > prev || operation === "-" && newValue < prev)
|
|
1167
|
-
return newValue;
|
|
1112
|
+
if (operation === "+" && newValue > prev || operation === "-" && newValue < prev) return newValue;
|
|
1168
1113
|
return $9446cca9a3875146$export$cb6e0bb50bc19463($de67e98908f0c6ee$var$handleDecimalOperation(operation, prev, clampStep), minValue, maxValue, clampStep);
|
|
1169
1114
|
}
|
|
1170
1115
|
};
|
|
1171
1116
|
let increment = () => {
|
|
1172
1117
|
let newValue = safeNextStep("+", minValue);
|
|
1173
|
-
if (newValue === numberValue)
|
|
1174
|
-
setInputValue(format(newValue));
|
|
1118
|
+
if (newValue === numberValue) setInputValue(format(newValue));
|
|
1175
1119
|
setNumberValue(newValue);
|
|
1176
1120
|
validation.commitValidation();
|
|
1177
1121
|
};
|
|
1178
1122
|
let decrement = () => {
|
|
1179
1123
|
let newValue = safeNextStep("-", maxValue);
|
|
1180
|
-
if (newValue === numberValue)
|
|
1181
|
-
setInputValue(format(newValue));
|
|
1124
|
+
if (newValue === numberValue) setInputValue(format(newValue));
|
|
1182
1125
|
setNumberValue(newValue);
|
|
1183
1126
|
validation.commitValidation();
|
|
1184
1127
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 } from "./context-
|
|
2
|
-
import { $ as $488c6ddbf4ef74c2$export$cc77c4ff7e8673c5 } from "./NumberFormatter-
|
|
1
|
+
import { $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 } from "./context-4oSz1ItD.js";
|
|
2
|
+
import { $ as $488c6ddbf4ef74c2$export$cc77c4ff7e8673c5 } from "./NumberFormatter-U_Gx0UDq.js";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
4
|
function $a916eb452884faea$export$b7a616150fdb9f44(options = {}) {
|
|
5
5
|
let { locale } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
|