@react-aria/spinbutton 3.0.0-nightly.1349 → 3.0.0-nightly.1356

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/module.js CHANGED
@@ -1,299 +1,324 @@
1
- import { useMessageFormatter } from "@react-aria/i18n";
2
- import { useCallback, useEffect, useRef } from "react";
3
- import { announce } from "@react-aria/live-announcer";
4
- import _babelRuntimeHelpersEsmInteropRequireDefault from "@babel/runtime/helpers/esm/interopRequireDefault";
5
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/ar-AE.json
6
- var $fbc9e9d7cb7b3e7c701c779ec38417cd$exports = {};
7
- $fbc9e9d7cb7b3e7c701c779ec38417cd$exports = JSON.parse("{\"Empty\":\"فارغ\"}");
8
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/bg-BG.json
9
- var $cb592d229837e637f9593ff7c701689$exports = {};
10
- $cb592d229837e637f9593ff7c701689$exports = JSON.parse("{\"Empty\":\"Изпразни\"}");
11
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/cs-CZ.json
12
- var $f17666a495bf7495c6bff6a1397e6822$exports = {};
13
- $f17666a495bf7495c6bff6a1397e6822$exports = JSON.parse("{\"Empty\":\"Prázdné\"}");
14
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/da-DK.json
15
- var $e194eb80ef0031d8117819166a22680$exports = {};
16
- $e194eb80ef0031d8117819166a22680$exports = JSON.parse("{\"Empty\":\"Tom\"}");
17
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/de-DE.json
18
- var $c40bcdf693a8ed8a2291ef8d7b$exports = {};
19
- $c40bcdf693a8ed8a2291ef8d7b$exports = JSON.parse("{\"Empty\":\"Leer\"}");
20
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/el-GR.json
21
- var $ac454f31f410e77efbde3e1e4851cedb$exports = {};
22
- $ac454f31f410e77efbde3e1e4851cedb$exports = JSON.parse("{\"Empty\":\"Άδειο\"}");
23
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/en-US.json
24
- var $ed19cb0446558aab98a9086a697ac7$exports = {};
25
- $ed19cb0446558aab98a9086a697ac7$exports = JSON.parse("{\"Empty\":\"Empty\"}");
26
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/es-ES.json
27
- var $dc8cdf38b1ab312b8e3dd3e35ac00a29$exports = {};
28
- $dc8cdf38b1ab312b8e3dd3e35ac00a29$exports = JSON.parse("{\"Empty\":\"Vacío\"}");
29
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/et-EE.json
30
- var $a694686b3766c14509e50fe827e0f2b$exports = {};
31
- $a694686b3766c14509e50fe827e0f2b$exports = JSON.parse("{\"Empty\":\"Tühjenda\"}");
32
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/fi-FI.json
33
- var $cb67d619f35171d4f8c8e2fc148491$exports = {};
34
- $cb67d619f35171d4f8c8e2fc148491$exports = JSON.parse("{\"Empty\":\"Tyhjä\"}");
35
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/fr-FR.json
36
- var $af684764dbb48d4f24251e7a5c48530$exports = {};
37
- $af684764dbb48d4f24251e7a5c48530$exports = JSON.parse("{\"Empty\":\"Vide\"}");
38
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/he-IL.json
39
- var $d69024b42a69f97c46c58a953f67e84f$exports = {};
40
- $d69024b42a69f97c46c58a953f67e84f$exports = JSON.parse("{\"Empty\":\"ריק\"}");
41
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/hr-HR.json
42
- var $e6b7076edc78920211046f3c983cfbdb$exports = {};
43
- $e6b7076edc78920211046f3c983cfbdb$exports = JSON.parse("{\"Empty\":\"Prazno\"}");
44
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/hu-HU.json
45
- var $db974e9c56980ee80c35253d2f136aee$exports = {};
46
- $db974e9c56980ee80c35253d2f136aee$exports = JSON.parse("{\"Empty\":\"Üres\"}");
47
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/it-IT.json
48
- var $b9ca32da5122499256c996b9183ca3d$exports = {};
49
- $b9ca32da5122499256c996b9183ca3d$exports = JSON.parse("{\"Empty\":\"Vuoto\"}");
50
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/ja-JP.json
51
- var $d93cbf7ca50d42ab95c8247bd7$exports = {};
52
- $d93cbf7ca50d42ab95c8247bd7$exports = JSON.parse("{\"Empty\":\"空\"}");
53
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/ko-KR.json
54
- var $e4194ee149df1a8d2d78edc886ab7fd$exports = {};
55
- $e4194ee149df1a8d2d78edc886ab7fd$exports = JSON.parse("{\"Empty\":\"비어 있음\"}");
56
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/lt-LT.json
57
- var $e084f50698524d1617f726c5c5229$exports = {};
58
- $e084f50698524d1617f726c5c5229$exports = JSON.parse("{\"Empty\":\"Tuščias\"}");
59
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/lv-LV.json
60
- var $d6d90ca120aa4d5001ed49fd45b8$exports = {};
61
- $d6d90ca120aa4d5001ed49fd45b8$exports = JSON.parse("{\"Empty\":\"Tukšs\"}");
62
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/nb-NO.json
63
- var $a3b3b03e00a7f050d1866c8c67b7f18c$exports = {};
64
- $a3b3b03e00a7f050d1866c8c67b7f18c$exports = JSON.parse("{\"Empty\":\"Tom\"}");
65
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/nl-NL.json
66
- var $b87ad28933ffd5d3c721324feb$exports = {};
67
- $b87ad28933ffd5d3c721324feb$exports = JSON.parse("{\"Empty\":\"Leeg\"}");
68
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/pl-PL.json
69
- var $f5481a4fa637113043217da5a6260$exports = {};
70
- $f5481a4fa637113043217da5a6260$exports = JSON.parse("{\"Empty\":\"Pusty\"}");
71
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/pt-BR.json
72
- var $fd14df6b825e4a9565037f1ca1aa0f0$exports = {};
73
- $fd14df6b825e4a9565037f1ca1aa0f0$exports = JSON.parse("{\"Empty\":\"Vazio\"}");
74
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/pt-PT.json
75
- var $c82d4c61928ba408ae61ffae1197cc$exports = {};
76
- $c82d4c61928ba408ae61ffae1197cc$exports = JSON.parse("{\"Empty\":\"Vazio\"}");
77
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/ro-RO.json
78
- var $f83fdc6074b3422b785a49bb04be8fd$exports = {};
79
- $f83fdc6074b3422b785a49bb04be8fd$exports = JSON.parse("{\"Empty\":\"Gol\"}");
80
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/ru-RU.json
81
- var $c0d7db44cf5646c580ef6639717353$exports = {};
82
- $c0d7db44cf5646c580ef6639717353$exports = JSON.parse("{\"Empty\":\"Не заполнено\"}");
83
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/sk-SK.json
84
- var $a780415d2ea29cc31052caf8538da8$exports = {};
85
- $a780415d2ea29cc31052caf8538da8$exports = JSON.parse("{\"Empty\":\"Prázdne\"}");
86
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/sl-SI.json
87
- var $fb01b3dc59b99eb11848f254d$exports = {};
88
- $fb01b3dc59b99eb11848f254d$exports = JSON.parse("{\"Empty\":\"Prazen\"}");
89
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/sr-SP.json
90
- var $e08a3987f61a6b3d12b3e19ec5fd9$exports = {};
91
- $e08a3987f61a6b3d12b3e19ec5fd9$exports = JSON.parse("{\"Empty\":\"Prazno\"}");
92
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/sv-SE.json
93
- var $b3a7572915c12bdc376a15c698e26a$exports = {};
94
- $b3a7572915c12bdc376a15c698e26a$exports = JSON.parse("{\"Empty\":\"Tomt\"}");
95
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/tr-TR.json
96
- var $fffe30e4880b8ca2a1bf8bd52f099e3$exports = {};
97
- $fffe30e4880b8ca2a1bf8bd52f099e3$exports = JSON.parse("{\"Empty\":\"Boş\"}");
98
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/uk-UA.json
99
- var $daa0babda3d97bfdac06e14540e3d556$exports = {};
100
- $daa0babda3d97bfdac06e14540e3d556$exports = JSON.parse("{\"Empty\":\"Пусто\"}");
101
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/zh-CN.json
102
- var $b9d579215c0cc839bfce28a9cec$exports = {};
103
- $b9d579215c0cc839bfce28a9cec$exports = JSON.parse("{\"Empty\":\"空\"}");
104
- // ASSET: /home/circleci/react-spectrum/packages/@react-aria/spinbutton/intl/zh-TW.json
105
- var $fcd9e4d86a0277eaf944ca3546ee7$exports = {};
106
- $fcd9e4d86a0277eaf944ca3546ee7$exports = JSON.parse("{\"Empty\":\"空白\"}");
107
- // @ts-ignore
108
- const $c1af8e5962e38e4cf122539ddeaf$var$intlMessages = {
109
- "ar-AE": _babelRuntimeHelpersEsmInteropRequireDefault($fbc9e9d7cb7b3e7c701c779ec38417cd$exports).default,
110
- "bg-BG": _babelRuntimeHelpersEsmInteropRequireDefault($cb592d229837e637f9593ff7c701689$exports).default,
111
- "cs-CZ": _babelRuntimeHelpersEsmInteropRequireDefault($f17666a495bf7495c6bff6a1397e6822$exports).default,
112
- "da-DK": _babelRuntimeHelpersEsmInteropRequireDefault($e194eb80ef0031d8117819166a22680$exports).default,
113
- "de-DE": _babelRuntimeHelpersEsmInteropRequireDefault($c40bcdf693a8ed8a2291ef8d7b$exports).default,
114
- "el-GR": _babelRuntimeHelpersEsmInteropRequireDefault($ac454f31f410e77efbde3e1e4851cedb$exports).default,
115
- "en-US": _babelRuntimeHelpersEsmInteropRequireDefault($ed19cb0446558aab98a9086a697ac7$exports).default,
116
- "es-ES": _babelRuntimeHelpersEsmInteropRequireDefault($dc8cdf38b1ab312b8e3dd3e35ac00a29$exports).default,
117
- "et-EE": _babelRuntimeHelpersEsmInteropRequireDefault($a694686b3766c14509e50fe827e0f2b$exports).default,
118
- "fi-FI": _babelRuntimeHelpersEsmInteropRequireDefault($cb67d619f35171d4f8c8e2fc148491$exports).default,
119
- "fr-FR": _babelRuntimeHelpersEsmInteropRequireDefault($af684764dbb48d4f24251e7a5c48530$exports).default,
120
- "he-IL": _babelRuntimeHelpersEsmInteropRequireDefault($d69024b42a69f97c46c58a953f67e84f$exports).default,
121
- "hr-HR": _babelRuntimeHelpersEsmInteropRequireDefault($e6b7076edc78920211046f3c983cfbdb$exports).default,
122
- "hu-HU": _babelRuntimeHelpersEsmInteropRequireDefault($db974e9c56980ee80c35253d2f136aee$exports).default,
123
- "it-IT": _babelRuntimeHelpersEsmInteropRequireDefault($b9ca32da5122499256c996b9183ca3d$exports).default,
124
- "ja-JP": _babelRuntimeHelpersEsmInteropRequireDefault($d93cbf7ca50d42ab95c8247bd7$exports).default,
125
- "ko-KR": _babelRuntimeHelpersEsmInteropRequireDefault($e4194ee149df1a8d2d78edc886ab7fd$exports).default,
126
- "lt-LT": _babelRuntimeHelpersEsmInteropRequireDefault($e084f50698524d1617f726c5c5229$exports).default,
127
- "lv-LV": _babelRuntimeHelpersEsmInteropRequireDefault($d6d90ca120aa4d5001ed49fd45b8$exports).default,
128
- "nb-NO": _babelRuntimeHelpersEsmInteropRequireDefault($a3b3b03e00a7f050d1866c8c67b7f18c$exports).default,
129
- "nl-NL": _babelRuntimeHelpersEsmInteropRequireDefault($b87ad28933ffd5d3c721324feb$exports).default,
130
- "pl-PL": _babelRuntimeHelpersEsmInteropRequireDefault($f5481a4fa637113043217da5a6260$exports).default,
131
- "pt-BR": _babelRuntimeHelpersEsmInteropRequireDefault($fd14df6b825e4a9565037f1ca1aa0f0$exports).default,
132
- "pt-PT": _babelRuntimeHelpersEsmInteropRequireDefault($c82d4c61928ba408ae61ffae1197cc$exports).default,
133
- "ro-RO": _babelRuntimeHelpersEsmInteropRequireDefault($f83fdc6074b3422b785a49bb04be8fd$exports).default,
134
- "ru-RU": _babelRuntimeHelpersEsmInteropRequireDefault($c0d7db44cf5646c580ef6639717353$exports).default,
135
- "sk-SK": _babelRuntimeHelpersEsmInteropRequireDefault($a780415d2ea29cc31052caf8538da8$exports).default,
136
- "sl-SI": _babelRuntimeHelpersEsmInteropRequireDefault($fb01b3dc59b99eb11848f254d$exports).default,
137
- "sr-SP": _babelRuntimeHelpersEsmInteropRequireDefault($e08a3987f61a6b3d12b3e19ec5fd9$exports).default,
138
- "sv-SE": _babelRuntimeHelpersEsmInteropRequireDefault($b3a7572915c12bdc376a15c698e26a$exports).default,
139
- "tr-TR": _babelRuntimeHelpersEsmInteropRequireDefault($fffe30e4880b8ca2a1bf8bd52f099e3$exports).default,
140
- "uk-UA": _babelRuntimeHelpersEsmInteropRequireDefault($daa0babda3d97bfdac06e14540e3d556$exports).default,
141
- "zh-CN": _babelRuntimeHelpersEsmInteropRequireDefault($b9d579215c0cc839bfce28a9cec$exports).default,
142
- "zh-TW": _babelRuntimeHelpersEsmInteropRequireDefault($fcd9e4d86a0277eaf944ca3546ee7$exports).default
143
- };
144
- export function useSpinButton(props) {
145
- const _async = useRef();
146
-
147
- let {
148
- value,
149
- textValue,
150
- minValue,
151
- maxValue,
152
- isDisabled,
153
- isReadOnly,
154
- isRequired,
155
- onIncrement,
156
- onIncrementPage,
157
- onDecrement,
158
- onDecrementPage,
159
- onDecrementToMin,
160
- onIncrementToMax
161
- } = props;
162
- const formatMessage = useMessageFormatter($c1af8e5962e38e4cf122539ddeaf$var$intlMessages);
163
-
164
- const clearAsync = () => clearTimeout(_async.current); // eslint-disable-next-line arrow-body-style
165
-
166
-
167
- useEffect(() => {
168
- return () => clearAsync();
169
- }, []);
170
-
171
- let onKeyDown = e => {
172
- if (e.ctrlKey || e.metaKey || e.shiftKey || e.altKey || isReadOnly) {
173
- return;
174
- }
175
-
176
- switch (e.key) {
177
- case 'PageUp':
178
- if (onIncrementPage) {
179
- e.preventDefault();
180
- onIncrementPage();
181
- break;
182
- }
1
+ import {announce as $2ZufI$announce} from "@react-aria/live-announcer";
2
+ import {useRef as $2ZufI$useRef, useEffect as $2ZufI$useEffect, useCallback as $2ZufI$useCallback} from "react";
3
+ import {useMessageFormatter as $2ZufI$useMessageFormatter} from "@react-aria/i18n";
183
4
 
184
- // fallthrough!
5
+ function $parcel$interopDefault(a) {
6
+ return a && a.__esModule ? a.default : a;
7
+ }
8
+ function $parcel$export(e, n, v, s) {
9
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
10
+ }
11
+ var $fade679e6d148269$exports = {};
185
12
 
186
- case 'ArrowUp':
187
- case 'Up':
188
- if (onIncrement) {
189
- e.preventDefault();
190
- onIncrement();
191
- }
13
+ $parcel$export($fade679e6d148269$exports, "useSpinButton", () => $fade679e6d148269$export$e908e06f4b8e3402);
192
14
 
193
- break;
194
15
 
195
- case 'PageDown':
196
- if (onDecrementPage) {
197
- e.preventDefault();
198
- onDecrementPage();
199
- break;
200
- }
16
+ var $00b653b26a900380$exports = {};
17
+ var $06e8f07dbc38416a$exports = {};
18
+ $06e8f07dbc38416a$exports = JSON.parse("{\"Empty\":\"فارغ\"}");
201
19
 
202
- // fallthrough
203
20
 
204
- case 'ArrowDown':
205
- case 'Down':
206
- if (onDecrement) {
207
- e.preventDefault();
208
- onDecrement();
209
- }
21
+ var $ba0b57bbf8318d93$exports = {};
22
+ $ba0b57bbf8318d93$exports = JSON.parse("{\"Empty\":\"Изпразни\"}");
210
23
 
211
- break;
212
24
 
213
- case 'Home':
214
- if (onDecrementToMin) {
215
- e.preventDefault();
216
- onDecrementToMin();
217
- }
25
+ var $2dd637ef80444064$exports = {};
26
+ $2dd637ef80444064$exports = JSON.parse("{\"Empty\":\"Prázdné\"}");
218
27
 
219
- break;
220
28
 
221
- case 'End':
222
- if (onIncrementToMax) {
223
- e.preventDefault();
224
- onIncrementToMax();
225
- }
29
+ var $6634bee357bc64d1$exports = {};
30
+ $6634bee357bc64d1$exports = JSON.parse("{\"Empty\":\"Tom\"}");
31
+
32
+
33
+ var $64ae55904a3a497e$exports = {};
34
+ $64ae55904a3a497e$exports = JSON.parse("{\"Empty\":\"Leer\"}");
35
+
36
+
37
+ var $5228c8dbe5376ecd$exports = {};
38
+ $5228c8dbe5376ecd$exports = JSON.parse("{\"Empty\":\"Άδειο\"}");
39
+
40
+
41
+ var $90a1fdd34a0a5fb7$exports = {};
42
+ $90a1fdd34a0a5fb7$exports = JSON.parse("{\"Empty\":\"Empty\"}");
43
+
44
+
45
+ var $e159d3bb265ca0d3$exports = {};
46
+ $e159d3bb265ca0d3$exports = JSON.parse("{\"Empty\":\"Vacío\"}");
47
+
48
+
49
+ var $7a555ac8d698ff45$exports = {};
50
+ $7a555ac8d698ff45$exports = JSON.parse("{\"Empty\":\"Tühjenda\"}");
51
+
52
+
53
+ var $8327d3b31f390576$exports = {};
54
+ $8327d3b31f390576$exports = JSON.parse("{\"Empty\":\"Tyhjä\"}");
55
+
56
+
57
+ var $d19b8fe5d8996888$exports = {};
58
+ $d19b8fe5d8996888$exports = JSON.parse("{\"Empty\":\"Vide\"}");
59
+
60
+
61
+ var $11f672035ce17e3b$exports = {};
62
+ $11f672035ce17e3b$exports = JSON.parse("{\"Empty\":\"ריק\"}");
63
+
64
+
65
+ var $b8b8cd4ea00918d4$exports = {};
66
+ $b8b8cd4ea00918d4$exports = JSON.parse("{\"Empty\":\"Prazno\"}");
67
+
68
+
69
+ var $ad49c313d99bbd7a$exports = {};
70
+ $ad49c313d99bbd7a$exports = JSON.parse("{\"Empty\":\"Üres\"}");
71
+
72
+
73
+ var $5534a75e4907f02d$exports = {};
74
+ $5534a75e4907f02d$exports = JSON.parse("{\"Empty\":\"Vuoto\"}");
75
+
76
+
77
+ var $54226de30084f7c4$exports = {};
78
+ $54226de30084f7c4$exports = JSON.parse("{\"Empty\":\"空\"}");
79
+
80
+
81
+ var $44a3f691c27e292d$exports = {};
82
+ $44a3f691c27e292d$exports = JSON.parse("{\"Empty\":\"비어 있음\"}");
83
+
84
+
85
+ var $3457688ed766f573$exports = {};
86
+ $3457688ed766f573$exports = JSON.parse("{\"Empty\":\"Tuščias\"}");
87
+
88
+
89
+ var $4773e70c86633b6b$exports = {};
90
+ $4773e70c86633b6b$exports = JSON.parse("{\"Empty\":\"Tukšs\"}");
91
+
226
92
 
227
- break;
228
- }
229
- };
230
-
231
- let isFocused = useRef(false);
232
-
233
- let onFocus = () => {
234
- isFocused.current = true;
235
- };
236
-
237
- let onBlur = () => {
238
- isFocused.current = false;
239
- }; // Replace Unicode hyphen-minus (U+002D) with minus sign (U+2212).
240
- // This ensures that macOS VoiceOver announces it as "minus" even with other characters between the minus sign
241
- // and the number (e.g. currency symbol). Otherwise it announces nothing because it assumes the character is a hyphen.
242
- // In addition, replace the empty string with the word "Empty" so that iOS VoiceOver does not read "50%" for an empty field.
243
-
244
-
245
- textValue = textValue === '' ? formatMessage('Empty') : (textValue || "" + value).replace('-', '\u2212');
246
- useEffect(() => {
247
- if (isFocused.current) {
248
- announce(textValue, 'assertive');
249
- }
250
- }, [textValue]);
251
- const onIncrementPressStart = useCallback(initialStepDelay => {
252
- clearAsync();
253
- onIncrement(); // Start spinning after initial delay
254
-
255
- _async.current = window.setTimeout(() => {
256
- if (isNaN(maxValue) || isNaN(value) || value < maxValue) {
257
- onIncrementPressStart(60);
258
- }
259
- }, initialStepDelay);
260
- }, [onIncrement, maxValue, value]);
261
- const onDecrementPressStart = useCallback(initialStepDelay => {
262
- clearAsync();
263
- onDecrement(); // Start spinning after initial delay
264
-
265
- _async.current = window.setTimeout(() => {
266
- if (isNaN(minValue) || isNaN(value) || value > minValue) {
267
- onDecrementPressStart(60);
268
- }
269
- }, initialStepDelay);
270
- }, [onDecrement, minValue, value]);
271
- return {
272
- spinButtonProps: {
273
- role: 'spinbutton',
274
- 'aria-valuenow': !isNaN(value) ? value : null,
275
- 'aria-valuetext': textValue,
276
- 'aria-valuemin': minValue,
277
- 'aria-valuemax': maxValue,
278
- 'aria-disabled': isDisabled || null,
279
- 'aria-readonly': isReadOnly || null,
280
- 'aria-required': isRequired || null,
281
- onKeyDown,
282
- onFocus,
283
- onBlur
284
- },
285
- incrementButtonProps: {
286
- onPressStart: () => onIncrementPressStart(400),
287
- onPressEnd: clearAsync,
288
- onFocus,
289
- onBlur
290
- },
291
- decrementButtonProps: {
292
- onPressStart: () => onDecrementPressStart(400),
293
- onPressEnd: clearAsync,
294
- onFocus,
295
- onBlur
296
- }
297
- };
93
+ var $68a6f74dbd686f52$exports = {};
94
+ $68a6f74dbd686f52$exports = JSON.parse("{\"Empty\":\"Tom\"}");
95
+
96
+
97
+ var $d719e96a98f9068e$exports = {};
98
+ $d719e96a98f9068e$exports = JSON.parse("{\"Empty\":\"Leeg\"}");
99
+
100
+
101
+ var $62b6e2bdd923543d$exports = {};
102
+ $62b6e2bdd923543d$exports = JSON.parse("{\"Empty\":\"Pusty\"}");
103
+
104
+
105
+ var $a8122fd20adf3e55$exports = {};
106
+ $a8122fd20adf3e55$exports = JSON.parse("{\"Empty\":\"Vazio\"}");
107
+
108
+
109
+ var $d6ad1891a939df67$exports = {};
110
+ $d6ad1891a939df67$exports = JSON.parse("{\"Empty\":\"Vazio\"}");
111
+
112
+
113
+ var $42c5bfdd97a0189b$exports = {};
114
+ $42c5bfdd97a0189b$exports = JSON.parse("{\"Empty\":\"Gol\"}");
115
+
116
+
117
+ var $11817d895f8336ae$exports = {};
118
+ $11817d895f8336ae$exports = JSON.parse("{\"Empty\":\"Не заполнено\"}");
119
+
120
+
121
+ var $ebd3288c5c0528c0$exports = {};
122
+ $ebd3288c5c0528c0$exports = JSON.parse("{\"Empty\":\"Prázdne\"}");
123
+
124
+
125
+ var $9b19bf9b8048baa1$exports = {};
126
+ $9b19bf9b8048baa1$exports = JSON.parse("{\"Empty\":\"Prazen\"}");
127
+
128
+
129
+ var $fcabb39760f00d21$exports = {};
130
+ $fcabb39760f00d21$exports = JSON.parse("{\"Empty\":\"Prazno\"}");
131
+
132
+
133
+ var $dd0633b64ec80f5b$exports = {};
134
+ $dd0633b64ec80f5b$exports = JSON.parse("{\"Empty\":\"Tomt\"}");
135
+
136
+
137
+ var $240ce93a49474cbd$exports = {};
138
+ $240ce93a49474cbd$exports = JSON.parse("{\"Empty\":\"Boş\"}");
139
+
140
+
141
+ var $9200ba6ac6860aed$exports = {};
142
+ $9200ba6ac6860aed$exports = JSON.parse("{\"Empty\":\"Пусто\"}");
143
+
144
+
145
+ var $b05c3ca874f366be$exports = {};
146
+ $b05c3ca874f366be$exports = JSON.parse("{\"Empty\":\"空\"}");
147
+
148
+
149
+ var $2ec35289219839ee$exports = {};
150
+ $2ec35289219839ee$exports = JSON.parse("{\"Empty\":\"空白\"}");
151
+
152
+
153
+ $00b653b26a900380$exports = {
154
+ "ar-AE": $06e8f07dbc38416a$exports,
155
+ "bg-BG": $ba0b57bbf8318d93$exports,
156
+ "cs-CZ": $2dd637ef80444064$exports,
157
+ "da-DK": $6634bee357bc64d1$exports,
158
+ "de-DE": $64ae55904a3a497e$exports,
159
+ "el-GR": $5228c8dbe5376ecd$exports,
160
+ "en-US": $90a1fdd34a0a5fb7$exports,
161
+ "es-ES": $e159d3bb265ca0d3$exports,
162
+ "et-EE": $7a555ac8d698ff45$exports,
163
+ "fi-FI": $8327d3b31f390576$exports,
164
+ "fr-FR": $d19b8fe5d8996888$exports,
165
+ "he-IL": $11f672035ce17e3b$exports,
166
+ "hr-HR": $b8b8cd4ea00918d4$exports,
167
+ "hu-HU": $ad49c313d99bbd7a$exports,
168
+ "it-IT": $5534a75e4907f02d$exports,
169
+ "ja-JP": $54226de30084f7c4$exports,
170
+ "ko-KR": $44a3f691c27e292d$exports,
171
+ "lt-LT": $3457688ed766f573$exports,
172
+ "lv-LV": $4773e70c86633b6b$exports,
173
+ "nb-NO": $68a6f74dbd686f52$exports,
174
+ "nl-NL": $d719e96a98f9068e$exports,
175
+ "pl-PL": $62b6e2bdd923543d$exports,
176
+ "pt-BR": $a8122fd20adf3e55$exports,
177
+ "pt-PT": $d6ad1891a939df67$exports,
178
+ "ro-RO": $42c5bfdd97a0189b$exports,
179
+ "ru-RU": $11817d895f8336ae$exports,
180
+ "sk-SK": $ebd3288c5c0528c0$exports,
181
+ "sl-SI": $9b19bf9b8048baa1$exports,
182
+ "sr-SP": $fcabb39760f00d21$exports,
183
+ "sv-SE": $dd0633b64ec80f5b$exports,
184
+ "tr-TR": $240ce93a49474cbd$exports,
185
+ "uk-UA": $9200ba6ac6860aed$exports,
186
+ "zh-CN": $b05c3ca874f366be$exports,
187
+ "zh-TW": $2ec35289219839ee$exports
188
+ };
189
+
190
+
191
+
192
+ function $fade679e6d148269$export$e908e06f4b8e3402(props) {
193
+ const _async = $2ZufI$useRef();
194
+ let { value: value , textValue: textValue , minValue: minValue , maxValue: maxValue , isDisabled: isDisabled , isReadOnly: isReadOnly , isRequired: isRequired , onIncrement: onIncrement , onIncrementPage: onIncrementPage , onDecrement: onDecrement , onDecrementPage: onDecrementPage , onDecrementToMin: onDecrementToMin , onIncrementToMax: onIncrementToMax } = props;
195
+ const formatMessage = $2ZufI$useMessageFormatter((/*@__PURE__*/$parcel$interopDefault($00b653b26a900380$exports)));
196
+ const clearAsync = ()=>clearTimeout(_async.current)
197
+ ;
198
+ // eslint-disable-next-line arrow-body-style
199
+ $2ZufI$useEffect(()=>{
200
+ return ()=>clearAsync()
201
+ ;
202
+ }, []);
203
+ let onKeyDown = (e)=>{
204
+ if (e.ctrlKey || e.metaKey || e.shiftKey || e.altKey || isReadOnly) return;
205
+ switch(e.key){
206
+ case 'PageUp':
207
+ if (onIncrementPage) {
208
+ e.preventDefault();
209
+ onIncrementPage();
210
+ break;
211
+ }
212
+ // fallthrough!
213
+ case 'ArrowUp':
214
+ case 'Up':
215
+ if (onIncrement) {
216
+ e.preventDefault();
217
+ onIncrement();
218
+ }
219
+ break;
220
+ case 'PageDown':
221
+ if (onDecrementPage) {
222
+ e.preventDefault();
223
+ onDecrementPage();
224
+ break;
225
+ }
226
+ // fallthrough
227
+ case 'ArrowDown':
228
+ case 'Down':
229
+ if (onDecrement) {
230
+ e.preventDefault();
231
+ onDecrement();
232
+ }
233
+ break;
234
+ case 'Home':
235
+ if (onDecrementToMin) {
236
+ e.preventDefault();
237
+ onDecrementToMin();
238
+ }
239
+ break;
240
+ case 'End':
241
+ if (onIncrementToMax) {
242
+ e.preventDefault();
243
+ onIncrementToMax();
244
+ }
245
+ break;
246
+ }
247
+ };
248
+ let isFocused = $2ZufI$useRef(false);
249
+ let onFocus = ()=>{
250
+ isFocused.current = true;
251
+ };
252
+ let onBlur = ()=>{
253
+ isFocused.current = false;
254
+ };
255
+ // Replace Unicode hyphen-minus (U+002D) with minus sign (U+2212).
256
+ // This ensures that macOS VoiceOver announces it as "minus" even with other characters between the minus sign
257
+ // and the number (e.g. currency symbol). Otherwise it announces nothing because it assumes the character is a hyphen.
258
+ // In addition, replace the empty string with the word "Empty" so that iOS VoiceOver does not read "50%" for an empty field.
259
+ textValue = textValue === '' ? formatMessage('Empty') : (textValue || `${value}`).replace('-', '\u2212');
260
+ $2ZufI$useEffect(()=>{
261
+ if (isFocused.current) $2ZufI$announce(textValue, 'assertive');
262
+ }, [
263
+ textValue
264
+ ]);
265
+ const onIncrementPressStart = $2ZufI$useCallback((initialStepDelay)=>{
266
+ clearAsync();
267
+ onIncrement();
268
+ // Start spinning after initial delay
269
+ _async.current = window.setTimeout(()=>{
270
+ if (isNaN(maxValue) || isNaN(value) || value < maxValue) onIncrementPressStart(60);
271
+ }, initialStepDelay);
272
+ }, [
273
+ onIncrement,
274
+ maxValue,
275
+ value
276
+ ]);
277
+ const onDecrementPressStart = $2ZufI$useCallback((initialStepDelay)=>{
278
+ clearAsync();
279
+ onDecrement();
280
+ // Start spinning after initial delay
281
+ _async.current = window.setTimeout(()=>{
282
+ if (isNaN(minValue) || isNaN(value) || value > minValue) onDecrementPressStart(60);
283
+ }, initialStepDelay);
284
+ }, [
285
+ onDecrement,
286
+ minValue,
287
+ value
288
+ ]);
289
+ return {
290
+ spinButtonProps: {
291
+ role: 'spinbutton',
292
+ 'aria-valuenow': !isNaN(value) ? value : null,
293
+ 'aria-valuetext': textValue,
294
+ 'aria-valuemin': minValue,
295
+ 'aria-valuemax': maxValue,
296
+ 'aria-disabled': isDisabled || null,
297
+ 'aria-readonly': isReadOnly || null,
298
+ 'aria-required': isRequired || null,
299
+ onKeyDown: onKeyDown,
300
+ onFocus: onFocus,
301
+ onBlur: onBlur
302
+ },
303
+ incrementButtonProps: {
304
+ onPressStart: ()=>onIncrementPressStart(400)
305
+ ,
306
+ onPressEnd: clearAsync,
307
+ onFocus: onFocus,
308
+ onBlur: onBlur
309
+ },
310
+ decrementButtonProps: {
311
+ onPressStart: ()=>onDecrementPressStart(400)
312
+ ,
313
+ onPressEnd: clearAsync,
314
+ onFocus: onFocus,
315
+ onBlur: onBlur
316
+ }
317
+ };
298
318
  }
319
+
320
+
321
+
322
+
323
+ export {$fade679e6d148269$export$e908e06f4b8e3402 as useSpinButton};
299
324
  //# sourceMappingURL=module.js.map