@react-aria/spinbutton 3.6.0 → 3.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/import.mjs +19 -19
- package/dist/main.js +19 -19
- package/dist/main.js.map +1 -1
- package/dist/module.js +19 -19
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
- package/src/useSpinButton.ts +19 -19
package/dist/import.mjs
CHANGED
|
@@ -277,7 +277,7 @@ $a99895ee3dc79e61$exports = {
|
|
|
277
277
|
function $d2e8511e6f209edf$export$e908e06f4b8e3402(props) {
|
|
278
278
|
const _async = (0, $glIEW$useRef)();
|
|
279
279
|
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;
|
|
280
|
-
const stringFormatter = (0, $glIEW$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($a99895ee3dc79e61$exports))));
|
|
280
|
+
const stringFormatter = (0, $glIEW$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($a99895ee3dc79e61$exports))), "@react-aria/spinbutton");
|
|
281
281
|
const clearAsync = ()=>clearTimeout(_async.current);
|
|
282
282
|
// eslint-disable-next-line arrow-body-style
|
|
283
283
|
(0, $glIEW$useEffect)(()=>{
|
|
@@ -289,7 +289,7 @@ function $d2e8511e6f209edf$export$e908e06f4b8e3402(props) {
|
|
|
289
289
|
case "PageUp":
|
|
290
290
|
if (onIncrementPage) {
|
|
291
291
|
e.preventDefault();
|
|
292
|
-
onIncrementPage();
|
|
292
|
+
onIncrementPage === null || onIncrementPage === void 0 ? void 0 : onIncrementPage();
|
|
293
293
|
break;
|
|
294
294
|
}
|
|
295
295
|
// fallthrough!
|
|
@@ -297,13 +297,13 @@ function $d2e8511e6f209edf$export$e908e06f4b8e3402(props) {
|
|
|
297
297
|
case "Up":
|
|
298
298
|
if (onIncrement) {
|
|
299
299
|
e.preventDefault();
|
|
300
|
-
onIncrement();
|
|
300
|
+
onIncrement === null || onIncrement === void 0 ? void 0 : onIncrement();
|
|
301
301
|
}
|
|
302
302
|
break;
|
|
303
303
|
case "PageDown":
|
|
304
304
|
if (onDecrementPage) {
|
|
305
305
|
e.preventDefault();
|
|
306
|
-
onDecrementPage();
|
|
306
|
+
onDecrementPage === null || onDecrementPage === void 0 ? void 0 : onDecrementPage();
|
|
307
307
|
break;
|
|
308
308
|
}
|
|
309
309
|
// fallthrough
|
|
@@ -311,19 +311,19 @@ function $d2e8511e6f209edf$export$e908e06f4b8e3402(props) {
|
|
|
311
311
|
case "Down":
|
|
312
312
|
if (onDecrement) {
|
|
313
313
|
e.preventDefault();
|
|
314
|
-
onDecrement();
|
|
314
|
+
onDecrement === null || onDecrement === void 0 ? void 0 : onDecrement();
|
|
315
315
|
}
|
|
316
316
|
break;
|
|
317
317
|
case "Home":
|
|
318
318
|
if (onDecrementToMin) {
|
|
319
319
|
e.preventDefault();
|
|
320
|
-
onDecrementToMin();
|
|
320
|
+
onDecrementToMin === null || onDecrementToMin === void 0 ? void 0 : onDecrementToMin();
|
|
321
321
|
}
|
|
322
322
|
break;
|
|
323
323
|
case "End":
|
|
324
324
|
if (onIncrementToMax) {
|
|
325
325
|
e.preventDefault();
|
|
326
|
-
onIncrementToMax();
|
|
326
|
+
onIncrementToMax === null || onIncrementToMax === void 0 ? void 0 : onIncrementToMax();
|
|
327
327
|
}
|
|
328
328
|
break;
|
|
329
329
|
}
|
|
@@ -339,29 +339,29 @@ function $d2e8511e6f209edf$export$e908e06f4b8e3402(props) {
|
|
|
339
339
|
// This ensures that macOS VoiceOver announces it as "minus" even with other characters between the minus sign
|
|
340
340
|
// and the number (e.g. currency symbol). Otherwise it announces nothing because it assumes the character is a hyphen.
|
|
341
341
|
// In addition, replace the empty string with the word "Empty" so that iOS VoiceOver does not read "50%" for an empty field.
|
|
342
|
-
|
|
342
|
+
let ariaTextValue = textValue === "" ? stringFormatter.format("Empty") : (textValue || `${value}`).replace("-", "\u2212");
|
|
343
343
|
(0, $glIEW$useEffect)(()=>{
|
|
344
344
|
if (isFocused.current) {
|
|
345
345
|
(0, $glIEW$clearAnnouncer)("assertive");
|
|
346
|
-
(0, $glIEW$announce)(
|
|
346
|
+
(0, $glIEW$announce)(ariaTextValue, "assertive");
|
|
347
347
|
}
|
|
348
348
|
}, [
|
|
349
|
-
|
|
349
|
+
ariaTextValue
|
|
350
350
|
]);
|
|
351
351
|
const onIncrementPressStart = (0, $glIEW$useEffectEvent)((initialStepDelay)=>{
|
|
352
352
|
clearAsync();
|
|
353
|
-
onIncrement();
|
|
353
|
+
onIncrement === null || onIncrement === void 0 ? void 0 : onIncrement();
|
|
354
354
|
// Start spinning after initial delay
|
|
355
355
|
_async.current = window.setTimeout(()=>{
|
|
356
|
-
if (isNaN(maxValue) || isNaN(value) || value < maxValue) onIncrementPressStart(60);
|
|
356
|
+
if (maxValue === undefined || isNaN(maxValue) || value === undefined || isNaN(value) || value < maxValue) onIncrementPressStart(60);
|
|
357
357
|
}, initialStepDelay);
|
|
358
358
|
});
|
|
359
359
|
const onDecrementPressStart = (0, $glIEW$useEffectEvent)((initialStepDelay)=>{
|
|
360
360
|
clearAsync();
|
|
361
|
-
onDecrement();
|
|
361
|
+
onDecrement === null || onDecrement === void 0 ? void 0 : onDecrement();
|
|
362
362
|
// Start spinning after initial delay
|
|
363
363
|
_async.current = window.setTimeout(()=>{
|
|
364
|
-
if (isNaN(minValue) || isNaN(value) || value > minValue) onDecrementPressStart(60);
|
|
364
|
+
if (minValue === undefined || isNaN(minValue) || value === undefined || isNaN(value) || value > minValue) onDecrementPressStart(60);
|
|
365
365
|
}, initialStepDelay);
|
|
366
366
|
});
|
|
367
367
|
let cancelContextMenu = (e)=>{
|
|
@@ -371,13 +371,13 @@ function $d2e8511e6f209edf$export$e908e06f4b8e3402(props) {
|
|
|
371
371
|
return {
|
|
372
372
|
spinButtonProps: {
|
|
373
373
|
role: "spinbutton",
|
|
374
|
-
"aria-valuenow": !isNaN(value) ? value :
|
|
375
|
-
"aria-valuetext":
|
|
374
|
+
"aria-valuenow": value !== undefined && !isNaN(value) ? value : undefined,
|
|
375
|
+
"aria-valuetext": ariaTextValue,
|
|
376
376
|
"aria-valuemin": minValue,
|
|
377
377
|
"aria-valuemax": maxValue,
|
|
378
|
-
"aria-disabled": isDisabled ||
|
|
379
|
-
"aria-readonly": isReadOnly ||
|
|
380
|
-
"aria-required": isRequired ||
|
|
378
|
+
"aria-disabled": isDisabled || undefined,
|
|
379
|
+
"aria-readonly": isReadOnly || undefined,
|
|
380
|
+
"aria-required": isRequired || undefined,
|
|
381
381
|
onKeyDown: onKeyDown,
|
|
382
382
|
onFocus: onFocus,
|
|
383
383
|
onBlur: onBlur
|
package/dist/main.js
CHANGED
|
@@ -283,7 +283,7 @@ $cb4b786159079747$exports = {
|
|
|
283
283
|
function $37bbd4c129023f61$export$e908e06f4b8e3402(props) {
|
|
284
284
|
const _async = (0, $2BLaI$react.useRef)();
|
|
285
285
|
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;
|
|
286
|
-
const stringFormatter = (0, $2BLaI$reactariai18n.useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($cb4b786159079747$exports))));
|
|
286
|
+
const stringFormatter = (0, $2BLaI$reactariai18n.useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($cb4b786159079747$exports))), "@react-aria/spinbutton");
|
|
287
287
|
const clearAsync = ()=>clearTimeout(_async.current);
|
|
288
288
|
// eslint-disable-next-line arrow-body-style
|
|
289
289
|
(0, $2BLaI$react.useEffect)(()=>{
|
|
@@ -295,7 +295,7 @@ function $37bbd4c129023f61$export$e908e06f4b8e3402(props) {
|
|
|
295
295
|
case "PageUp":
|
|
296
296
|
if (onIncrementPage) {
|
|
297
297
|
e.preventDefault();
|
|
298
|
-
onIncrementPage();
|
|
298
|
+
onIncrementPage === null || onIncrementPage === void 0 ? void 0 : onIncrementPage();
|
|
299
299
|
break;
|
|
300
300
|
}
|
|
301
301
|
// fallthrough!
|
|
@@ -303,13 +303,13 @@ function $37bbd4c129023f61$export$e908e06f4b8e3402(props) {
|
|
|
303
303
|
case "Up":
|
|
304
304
|
if (onIncrement) {
|
|
305
305
|
e.preventDefault();
|
|
306
|
-
onIncrement();
|
|
306
|
+
onIncrement === null || onIncrement === void 0 ? void 0 : onIncrement();
|
|
307
307
|
}
|
|
308
308
|
break;
|
|
309
309
|
case "PageDown":
|
|
310
310
|
if (onDecrementPage) {
|
|
311
311
|
e.preventDefault();
|
|
312
|
-
onDecrementPage();
|
|
312
|
+
onDecrementPage === null || onDecrementPage === void 0 ? void 0 : onDecrementPage();
|
|
313
313
|
break;
|
|
314
314
|
}
|
|
315
315
|
// fallthrough
|
|
@@ -317,19 +317,19 @@ function $37bbd4c129023f61$export$e908e06f4b8e3402(props) {
|
|
|
317
317
|
case "Down":
|
|
318
318
|
if (onDecrement) {
|
|
319
319
|
e.preventDefault();
|
|
320
|
-
onDecrement();
|
|
320
|
+
onDecrement === null || onDecrement === void 0 ? void 0 : onDecrement();
|
|
321
321
|
}
|
|
322
322
|
break;
|
|
323
323
|
case "Home":
|
|
324
324
|
if (onDecrementToMin) {
|
|
325
325
|
e.preventDefault();
|
|
326
|
-
onDecrementToMin();
|
|
326
|
+
onDecrementToMin === null || onDecrementToMin === void 0 ? void 0 : onDecrementToMin();
|
|
327
327
|
}
|
|
328
328
|
break;
|
|
329
329
|
case "End":
|
|
330
330
|
if (onIncrementToMax) {
|
|
331
331
|
e.preventDefault();
|
|
332
|
-
onIncrementToMax();
|
|
332
|
+
onIncrementToMax === null || onIncrementToMax === void 0 ? void 0 : onIncrementToMax();
|
|
333
333
|
}
|
|
334
334
|
break;
|
|
335
335
|
}
|
|
@@ -345,29 +345,29 @@ function $37bbd4c129023f61$export$e908e06f4b8e3402(props) {
|
|
|
345
345
|
// This ensures that macOS VoiceOver announces it as "minus" even with other characters between the minus sign
|
|
346
346
|
// and the number (e.g. currency symbol). Otherwise it announces nothing because it assumes the character is a hyphen.
|
|
347
347
|
// In addition, replace the empty string with the word "Empty" so that iOS VoiceOver does not read "50%" for an empty field.
|
|
348
|
-
|
|
348
|
+
let ariaTextValue = textValue === "" ? stringFormatter.format("Empty") : (textValue || `${value}`).replace("-", "\u2212");
|
|
349
349
|
(0, $2BLaI$react.useEffect)(()=>{
|
|
350
350
|
if (isFocused.current) {
|
|
351
351
|
(0, $2BLaI$reactarialiveannouncer.clearAnnouncer)("assertive");
|
|
352
|
-
(0, $2BLaI$reactarialiveannouncer.announce)(
|
|
352
|
+
(0, $2BLaI$reactarialiveannouncer.announce)(ariaTextValue, "assertive");
|
|
353
353
|
}
|
|
354
354
|
}, [
|
|
355
|
-
|
|
355
|
+
ariaTextValue
|
|
356
356
|
]);
|
|
357
357
|
const onIncrementPressStart = (0, $2BLaI$reactariautils.useEffectEvent)((initialStepDelay)=>{
|
|
358
358
|
clearAsync();
|
|
359
|
-
onIncrement();
|
|
359
|
+
onIncrement === null || onIncrement === void 0 ? void 0 : onIncrement();
|
|
360
360
|
// Start spinning after initial delay
|
|
361
361
|
_async.current = window.setTimeout(()=>{
|
|
362
|
-
if (isNaN(maxValue) || isNaN(value) || value < maxValue) onIncrementPressStart(60);
|
|
362
|
+
if (maxValue === undefined || isNaN(maxValue) || value === undefined || isNaN(value) || value < maxValue) onIncrementPressStart(60);
|
|
363
363
|
}, initialStepDelay);
|
|
364
364
|
});
|
|
365
365
|
const onDecrementPressStart = (0, $2BLaI$reactariautils.useEffectEvent)((initialStepDelay)=>{
|
|
366
366
|
clearAsync();
|
|
367
|
-
onDecrement();
|
|
367
|
+
onDecrement === null || onDecrement === void 0 ? void 0 : onDecrement();
|
|
368
368
|
// Start spinning after initial delay
|
|
369
369
|
_async.current = window.setTimeout(()=>{
|
|
370
|
-
if (isNaN(minValue) || isNaN(value) || value > minValue) onDecrementPressStart(60);
|
|
370
|
+
if (minValue === undefined || isNaN(minValue) || value === undefined || isNaN(value) || value > minValue) onDecrementPressStart(60);
|
|
371
371
|
}, initialStepDelay);
|
|
372
372
|
});
|
|
373
373
|
let cancelContextMenu = (e)=>{
|
|
@@ -377,13 +377,13 @@ function $37bbd4c129023f61$export$e908e06f4b8e3402(props) {
|
|
|
377
377
|
return {
|
|
378
378
|
spinButtonProps: {
|
|
379
379
|
role: "spinbutton",
|
|
380
|
-
"aria-valuenow": !isNaN(value) ? value :
|
|
381
|
-
"aria-valuetext":
|
|
380
|
+
"aria-valuenow": value !== undefined && !isNaN(value) ? value : undefined,
|
|
381
|
+
"aria-valuetext": ariaTextValue,
|
|
382
382
|
"aria-valuemin": minValue,
|
|
383
383
|
"aria-valuemax": maxValue,
|
|
384
|
-
"aria-disabled": isDisabled ||
|
|
385
|
-
"aria-readonly": isReadOnly ||
|
|
386
|
-
"aria-required": isRequired ||
|
|
384
|
+
"aria-disabled": isDisabled || undefined,
|
|
385
|
+
"aria-readonly": isReadOnly || undefined,
|
|
386
|
+
"aria-required": isRequired || undefined,
|
|
387
387
|
onKeyDown: onKeyDown,
|
|
388
388
|
onFocus: onFocus,
|
|
389
389
|
onBlur: onBlur
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC;;;AEVD,4BAAiB;IAAG,SAAS,CAAC,4BAAI,CAAC;AACnC;;;;ACDA,4BAAiB;IAAG,SAAS,CAAC,wDAAQ,CAAC;AACvC;;;;ACDA,4BAAiB;IAAG,SAAS,CAAC,a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C;QACrC,OAAO,OAAO,GAAG,OAAO,UAAU,CAChC;YACE,IAAI,MAAM,aAAa,MAAM,UAAU,QAAQ,UAC7C,sBAAsB;QAE1B,GACA;IAEJ;IAGF,MAAM,wBAAwB,CAAA,GAAA,oCAAa,EACzC,CAAC;QACC;QACA;QACA,qCAAqC;QACrC,OAAO,OAAO,GAAG,OAAO,UAAU,CAChC;YACE,IAAI,MAAM,aAAa,MAAM,UAAU,QAAQ,UAC7C,sBAAsB;QAE1B,GACA;IAEJ;IAGF,IAAI,oBAAoB,CAAC;QACvB,EAAE,cAAc;IAClB;IAEA,IAAI,qBAAC,iBAAiB,4BAAE,wBAAwB,EAAC,GAAG,CAAA,GAAA,wCAAiB;IAErE,OAAO;QACL,iBAAiB;YACf,MAAM;YACN,iBAAiB,CAAC,MAAM,SAAS,QAAQ;YACzC,kBAAkB;YAClB,iBAAiB;YACjB,iBAAiB;YACjB,iBAAiB,cAAc;YAC/B,iBAAiB,cAAc;YAC/B,iBAAiB,cAAc;uBAC/B;qBACA;oBACA;QACF;QACA,sBAAsB;YACpB,cAAc;gBACZ,sBAAsB;gBACtB,kBAAkB,QAAQ,eAAe;YAC3C;YACA,YAAY;gBACV;gBACA;YACF;qBACA;oBACA;QACF;QACA,sBAAsB;YACpB,cAAc;gBACZ,sBAAsB;gBACtB,kBAAkB,QAAQ,eAAe;YAC3C;YACA,YAAY;gBACV;gBACA;YACF;qBACA;oBACA;QACF;IACF;AACF;;CD5MC","sources":["packages/@react-aria/spinbutton/src/index.ts","packages/@react-aria/spinbutton/src/useSpinButton.ts","packages/@react-aria/spinbutton/src/*.js","packages/@react-aria/spinbutton/intl/ar-AE.json","packages/@react-aria/spinbutton/intl/bg-BG.json","packages/@react-aria/spinbutton/intl/cs-CZ.json","packages/@react-aria/spinbutton/intl/da-DK.json","packages/@react-aria/spinbutton/intl/de-DE.json","packages/@react-aria/spinbutton/intl/el-GR.json","packages/@react-aria/spinbutton/intl/en-US.json","packages/@react-aria/spinbutton/intl/es-ES.json","packages/@react-aria/spinbutton/intl/et-EE.json","packages/@react-aria/spinbutton/intl/fi-FI.json","packages/@react-aria/spinbutton/intl/fr-FR.json","packages/@react-aria/spinbutton/intl/he-IL.json","packages/@react-aria/spinbutton/intl/hr-HR.json","packages/@react-aria/spinbutton/intl/hu-HU.json","packages/@react-aria/spinbutton/intl/it-IT.json","packages/@react-aria/spinbutton/intl/ja-JP.json","packages/@react-aria/spinbutton/intl/ko-KR.json","packages/@react-aria/spinbutton/intl/lt-LT.json","packages/@react-aria/spinbutton/intl/lv-LV.json","packages/@react-aria/spinbutton/intl/nb-NO.json","packages/@react-aria/spinbutton/intl/nl-NL.json","packages/@react-aria/spinbutton/intl/pl-PL.json","packages/@react-aria/spinbutton/intl/pt-BR.json","packages/@react-aria/spinbutton/intl/pt-PT.json","packages/@react-aria/spinbutton/intl/ro-RO.json","packages/@react-aria/spinbutton/intl/ru-RU.json","packages/@react-aria/spinbutton/intl/sk-SK.json","packages/@react-aria/spinbutton/intl/sl-SI.json","packages/@react-aria/spinbutton/intl/sr-SP.json","packages/@react-aria/spinbutton/intl/sv-SE.json","packages/@react-aria/spinbutton/intl/tr-TR.json","packages/@react-aria/spinbutton/intl/uk-UA.json","packages/@react-aria/spinbutton/intl/zh-CN.json","packages/@react-aria/spinbutton/intl/zh-TW.json"],"sourcesContent":["/*\n * Copyright 2020 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 */\nexport type {SpinButtonProps, SpinbuttonAria} from './useSpinButton';\nexport {useSpinButton} from './useSpinButton';\n","/*\n * Copyright 2020 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 {announce, clearAnnouncer} from '@react-aria/live-announcer';\nimport {AriaButtonProps} from '@react-types/button';\nimport {DOMAttributes, InputBase, RangeInputBase, Validation, ValueBase} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {useEffect, useRef} from 'react';\nimport {useEffectEvent, useGlobalListeners} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\n\nexport interface SpinButtonProps extends InputBase, Validation<number>, ValueBase<number>, RangeInputBase<number> {\n textValue?: string,\n onIncrement?: () => void,\n onIncrementPage?: () => void,\n onDecrement?: () => void,\n onDecrementPage?: () => void,\n onDecrementToMin?: () => void,\n onIncrementToMax?: () => void\n}\n\nexport interface SpinbuttonAria {\n spinButtonProps: DOMAttributes,\n incrementButtonProps: AriaButtonProps,\n decrementButtonProps: AriaButtonProps\n}\n\nexport function useSpinButton(\n props: SpinButtonProps\n): SpinbuttonAria {\n const _async = useRef<number>();\n let {\n value,\n textValue,\n minValue,\n maxValue,\n isDisabled,\n isReadOnly,\n isRequired,\n onIncrement,\n onIncrementPage,\n onDecrement,\n onDecrementPage,\n onDecrementToMin,\n onIncrementToMax\n } = props;\n const stringFormatter = useLocalizedStringFormatter(intlMessages);\n\n const clearAsync = () => clearTimeout(_async.current);\n\n // eslint-disable-next-line arrow-body-style\n useEffect(() => {\n return () => clearAsync();\n }, []);\n\n let onKeyDown = (e) => {\n if (e.ctrlKey || e.metaKey || e.shiftKey || e.altKey || isReadOnly) {\n return;\n }\n\n switch (e.key) {\n case 'PageUp':\n if (onIncrementPage) {\n e.preventDefault();\n onIncrementPage();\n break;\n }\n // fallthrough!\n case 'ArrowUp':\n case 'Up':\n if (onIncrement) {\n e.preventDefault();\n onIncrement();\n }\n break;\n case 'PageDown':\n if (onDecrementPage) {\n e.preventDefault();\n onDecrementPage();\n break;\n }\n // fallthrough\n case 'ArrowDown':\n case 'Down':\n if (onDecrement) {\n e.preventDefault();\n onDecrement();\n }\n break;\n case 'Home':\n if (onDecrementToMin) {\n e.preventDefault();\n onDecrementToMin();\n }\n break;\n case 'End':\n if (onIncrementToMax) {\n e.preventDefault();\n onIncrementToMax();\n }\n break;\n }\n };\n\n let isFocused = useRef(false);\n let onFocus = () => {\n isFocused.current = true;\n };\n\n let onBlur = () => {\n isFocused.current = false;\n };\n\n // Replace Unicode hyphen-minus (U+002D) with minus sign (U+2212).\n // This ensures that macOS VoiceOver announces it as \"minus\" even with other characters between the minus sign\n // and the number (e.g. currency symbol). Otherwise it announces nothing because it assumes the character is a hyphen.\n // In addition, replace the empty string with the word \"Empty\" so that iOS VoiceOver does not read \"50%\" for an empty field.\n textValue = textValue === '' ? stringFormatter.format('Empty') : (textValue || `${value}`).replace('-', '\\u2212');\n\n useEffect(() => {\n if (isFocused.current) {\n clearAnnouncer('assertive');\n announce(textValue, 'assertive');\n }\n }, [textValue]);\n\n const onIncrementPressStart = useEffectEvent(\n (initialStepDelay: number) => {\n clearAsync();\n onIncrement();\n // Start spinning after initial delay\n _async.current = window.setTimeout(\n () => {\n if (isNaN(maxValue) || isNaN(value) || value < maxValue) {\n onIncrementPressStart(60);\n }\n },\n initialStepDelay\n );\n }\n );\n\n const onDecrementPressStart = useEffectEvent(\n (initialStepDelay: number) => {\n clearAsync();\n onDecrement();\n // Start spinning after initial delay\n _async.current = window.setTimeout(\n () => {\n if (isNaN(minValue) || isNaN(value) || value > minValue) {\n onDecrementPressStart(60);\n }\n },\n initialStepDelay\n );\n }\n );\n\n let cancelContextMenu = (e) => {\n e.preventDefault();\n };\n\n let {addGlobalListener, removeAllGlobalListeners} = useGlobalListeners();\n\n return {\n spinButtonProps: {\n role: 'spinbutton',\n 'aria-valuenow': !isNaN(value) ? value : null,\n 'aria-valuetext': textValue,\n 'aria-valuemin': minValue,\n 'aria-valuemax': maxValue,\n 'aria-disabled': isDisabled || null,\n 'aria-readonly': isReadOnly || null,\n 'aria-required': isRequired || null,\n onKeyDown,\n onFocus,\n onBlur\n },\n incrementButtonProps: {\n onPressStart: () => {\n onIncrementPressStart(400);\n addGlobalListener(window, 'contextmenu', cancelContextMenu);\n },\n onPressEnd: () => {\n clearAsync();\n removeAllGlobalListeners();\n },\n onFocus,\n onBlur\n },\n decrementButtonProps: {\n onPressStart: () => {\n onDecrementPressStart(400);\n addGlobalListener(window, 'contextmenu', cancelContextMenu);\n },\n onPressEnd: () => {\n clearAsync();\n removeAllGlobalListeners();\n },\n onFocus,\n onBlur\n }\n };\n}\n","const _temp0 = require(\"../intl/ar-AE.json\");\nconst _temp1 = require(\"../intl/bg-BG.json\");\nconst _temp2 = require(\"../intl/cs-CZ.json\");\nconst _temp3 = require(\"../intl/da-DK.json\");\nconst _temp4 = require(\"../intl/de-DE.json\");\nconst _temp5 = require(\"../intl/el-GR.json\");\nconst _temp6 = require(\"../intl/en-US.json\");\nconst _temp7 = require(\"../intl/es-ES.json\");\nconst _temp8 = require(\"../intl/et-EE.json\");\nconst _temp9 = require(\"../intl/fi-FI.json\");\nconst _temp10 = require(\"../intl/fr-FR.json\");\nconst _temp11 = require(\"../intl/he-IL.json\");\nconst _temp12 = require(\"../intl/hr-HR.json\");\nconst _temp13 = require(\"../intl/hu-HU.json\");\nconst _temp14 = require(\"../intl/it-IT.json\");\nconst _temp15 = require(\"../intl/ja-JP.json\");\nconst _temp16 = require(\"../intl/ko-KR.json\");\nconst _temp17 = require(\"../intl/lt-LT.json\");\nconst _temp18 = require(\"../intl/lv-LV.json\");\nconst _temp19 = require(\"../intl/nb-NO.json\");\nconst _temp20 = require(\"../intl/nl-NL.json\");\nconst _temp21 = require(\"../intl/pl-PL.json\");\nconst _temp22 = require(\"../intl/pt-BR.json\");\nconst _temp23 = require(\"../intl/pt-PT.json\");\nconst _temp24 = require(\"../intl/ro-RO.json\");\nconst _temp25 = require(\"../intl/ru-RU.json\");\nconst _temp26 = require(\"../intl/sk-SK.json\");\nconst _temp27 = require(\"../intl/sl-SI.json\");\nconst _temp28 = require(\"../intl/sr-SP.json\");\nconst _temp29 = require(\"../intl/sv-SE.json\");\nconst _temp30 = require(\"../intl/tr-TR.json\");\nconst _temp31 = require(\"../intl/uk-UA.json\");\nconst _temp32 = require(\"../intl/zh-CN.json\");\nconst _temp33 = require(\"../intl/zh-TW.json\");\nmodule.exports = {\n \"ar-AE\": _temp0,\n \"bg-BG\": _temp1,\n \"cs-CZ\": _temp2,\n \"da-DK\": _temp3,\n \"de-DE\": _temp4,\n \"el-GR\": _temp5,\n \"en-US\": _temp6,\n \"es-ES\": _temp7,\n \"et-EE\": _temp8,\n \"fi-FI\": _temp9,\n \"fr-FR\": _temp10,\n \"he-IL\": _temp11,\n \"hr-HR\": _temp12,\n \"hu-HU\": _temp13,\n \"it-IT\": _temp14,\n \"ja-JP\": _temp15,\n \"ko-KR\": _temp16,\n \"lt-LT\": _temp17,\n \"lv-LV\": _temp18,\n \"nb-NO\": _temp19,\n \"nl-NL\": _temp20,\n \"pl-PL\": _temp21,\n \"pt-BR\": _temp22,\n \"pt-PT\": _temp23,\n \"ro-RO\": _temp24,\n \"ru-RU\": _temp25,\n \"sk-SK\": _temp26,\n \"sl-SI\": _temp27,\n \"sr-SP\": _temp28,\n \"sv-SE\": _temp29,\n \"tr-TR\": _temp30,\n \"uk-UA\": _temp31,\n \"zh-CN\": _temp32,\n \"zh-TW\": _temp33\n}","{\n \"Empty\": \"فارغ\"\n}\n","{\n \"Empty\": \"Изпразни\"\n}\n","{\n \"Empty\": \"Prázdné\"\n}\n","{\n \"Empty\": \"Tom\"\n}\n","{\n \"Empty\": \"Leer\"\n}\n","{\n \"Empty\": \"Άδειο\"\n}\n","{\n \"Empty\": \"Empty\"\n}\n","{\n \"Empty\": \"Vacío\"\n}\n","{\n \"Empty\": \"Tühjenda\"\n}\n","{\n \"Empty\": \"Tyhjä\"\n}\n","{\n \"Empty\": \"Vide\"\n}\n","{\n \"Empty\": \"ריק\"\n}\n","{\n \"Empty\": \"Prazno\"\n}\n","{\n \"Empty\": \"Üres\"\n}\n","{\n \"Empty\": \"Vuoto\"\n}\n","{\n \"Empty\": \"空\"\n}\n","{\n \"Empty\": \"비어 있음\"\n}\n","{\n \"Empty\": \"Tuščias\"\n}\n","{\n \"Empty\": \"Tukšs\"\n}\n","{\n \"Empty\": \"Tom\"\n}\n","{\n \"Empty\": \"Leeg\"\n}\n","{\n \"Empty\": \"Pusty\"\n}\n","{\n \"Empty\": \"Vazio\"\n}\n","{\n \"Empty\": \"Vazio\"\n}\n","{\n \"Empty\": \"Gol\"\n}\n","{\n \"Empty\": \"Не заполнено\"\n}\n","{\n \"Empty\": \"Prázdne\"\n}\n","{\n \"Empty\": \"Prazen\"\n}\n","{\n \"Empty\": \"Prazno\"\n}\n","{\n \"Empty\": \"Tomt\"\n}\n","{\n \"Empty\": \"Boş\"\n}\n","{\n \"Empty\": \"Пусто\"\n}\n","{\n \"Empty\": \"空\"\n}\n","{\n \"Empty\": \"空白\"\n}\n"],"names":[],"version":3,"file":"main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC;;;AEVD,4BAAiB;IAAG,SAAS,CAAC,4BAAI,CAAC;AACnC;;;;ACDA,4BAAiB;IAAG,SAAS,CAAC,wDAAQ,CAAC;AACvC;;;;ACDA,4BAAiB;IAAG,SAAS,CAAC,aAAO,CAAC;AACtC;;;;ACDA,4BAAiB;IAAG,SAAS,CAAC,GAAG,CAAC;AAClC;;;;ACDA,4BAAiB;IAAG,SAAS,CAAC,IAAI,CAAC;AACnC;;;;ACDA,4BAAiB;IAAG,SAAS,CAAC,mCAAK,CAAC;AACpC;;;;ACD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a,MAAM,aAAe,UAAU,aAAa,MAAM,UAAW,QAAQ,UAClG,sBAAsB;QAE1B,GACA;IAEJ;IAGF,MAAM,wBAAwB,CAAA,GAAA,oCAAa,EACzC,CAAC;QACC;QACA,wBAAA,kCAAA;QACA,qCAAqC;QACrC,OAAO,OAAO,GAAG,OAAO,UAAU,CAChC;YACE,IAAI,AAAC,aAAa,aAAa,MAAM,aAAe,UAAU,aAAa,MAAM,UAAW,QAAQ,UAClG,sBAAsB;QAE1B,GACA;IAEJ;IAGF,IAAI,oBAAoB,CAAC;QACvB,EAAE,cAAc;IAClB;IAEA,IAAI,qBAAC,iBAAiB,4BAAE,wBAAwB,EAAC,GAAG,CAAA,GAAA,wCAAiB;IAErE,OAAO;QACL,iBAAiB;YACf,MAAM;YACN,iBAAiB,UAAU,aAAa,CAAC,MAAM,SAAS,QAAQ;YAChE,kBAAkB;YAClB,iBAAiB;YACjB,iBAAiB;YACjB,iBAAiB,cAAc;YAC/B,iBAAiB,cAAc;YAC/B,iBAAiB,cAAc;uBAC/B;qBACA;oBACA;QACF;QACA,sBAAsB;YACpB,cAAc;gBACZ,sBAAsB;gBACtB,kBAAkB,QAAQ,eAAe;YAC3C;YACA,YAAY;gBACV;gBACA;YACF;qBACA;oBACA;QACF;QACA,sBAAsB;YACpB,cAAc;gBACZ,sBAAsB;gBACtB,kBAAkB,QAAQ,eAAe;YAC3C;YACA,YAAY;gBACV;gBACA;YACF;qBACA;oBACA;QACF;IACF;AACF;;CD5MC","sources":["packages/@react-aria/spinbutton/src/index.ts","packages/@react-aria/spinbutton/src/useSpinButton.ts","packages/@react-aria/spinbutton/src/*.js","packages/@react-aria/spinbutton/intl/ar-AE.json","packages/@react-aria/spinbutton/intl/bg-BG.json","packages/@react-aria/spinbutton/intl/cs-CZ.json","packages/@react-aria/spinbutton/intl/da-DK.json","packages/@react-aria/spinbutton/intl/de-DE.json","packages/@react-aria/spinbutton/intl/el-GR.json","packages/@react-aria/spinbutton/intl/en-US.json","packages/@react-aria/spinbutton/intl/es-ES.json","packages/@react-aria/spinbutton/intl/et-EE.json","packages/@react-aria/spinbutton/intl/fi-FI.json","packages/@react-aria/spinbutton/intl/fr-FR.json","packages/@react-aria/spinbutton/intl/he-IL.json","packages/@react-aria/spinbutton/intl/hr-HR.json","packages/@react-aria/spinbutton/intl/hu-HU.json","packages/@react-aria/spinbutton/intl/it-IT.json","packages/@react-aria/spinbutton/intl/ja-JP.json","packages/@react-aria/spinbutton/intl/ko-KR.json","packages/@react-aria/spinbutton/intl/lt-LT.json","packages/@react-aria/spinbutton/intl/lv-LV.json","packages/@react-aria/spinbutton/intl/nb-NO.json","packages/@react-aria/spinbutton/intl/nl-NL.json","packages/@react-aria/spinbutton/intl/pl-PL.json","packages/@react-aria/spinbutton/intl/pt-BR.json","packages/@react-aria/spinbutton/intl/pt-PT.json","packages/@react-aria/spinbutton/intl/ro-RO.json","packages/@react-aria/spinbutton/intl/ru-RU.json","packages/@react-aria/spinbutton/intl/sk-SK.json","packages/@react-aria/spinbutton/intl/sl-SI.json","packages/@react-aria/spinbutton/intl/sr-SP.json","packages/@react-aria/spinbutton/intl/sv-SE.json","packages/@react-aria/spinbutton/intl/tr-TR.json","packages/@react-aria/spinbutton/intl/uk-UA.json","packages/@react-aria/spinbutton/intl/zh-CN.json","packages/@react-aria/spinbutton/intl/zh-TW.json"],"sourcesContent":["/*\n * Copyright 2020 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 */\nexport type {SpinButtonProps, SpinbuttonAria} from './useSpinButton';\nexport {useSpinButton} from './useSpinButton';\n","/*\n * Copyright 2020 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 {announce, clearAnnouncer} from '@react-aria/live-announcer';\nimport {AriaButtonProps} from '@react-types/button';\nimport {DOMAttributes, InputBase, RangeInputBase, Validation, ValueBase} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {useEffect, useRef} from 'react';\nimport {useEffectEvent, useGlobalListeners} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\n\nexport interface SpinButtonProps extends InputBase, Validation<number>, ValueBase<number>, RangeInputBase<number> {\n textValue?: string,\n onIncrement?: () => void,\n onIncrementPage?: () => void,\n onDecrement?: () => void,\n onDecrementPage?: () => void,\n onDecrementToMin?: () => void,\n onIncrementToMax?: () => void\n}\n\nexport interface SpinbuttonAria {\n spinButtonProps: DOMAttributes,\n incrementButtonProps: AriaButtonProps,\n decrementButtonProps: AriaButtonProps\n}\n\nexport function useSpinButton(\n props: SpinButtonProps\n): SpinbuttonAria {\n const _async = useRef<number>();\n let {\n value,\n textValue,\n minValue,\n maxValue,\n isDisabled,\n isReadOnly,\n isRequired,\n onIncrement,\n onIncrementPage,\n onDecrement,\n onDecrementPage,\n onDecrementToMin,\n onIncrementToMax\n } = props;\n const stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/spinbutton');\n\n const clearAsync = () => clearTimeout(_async.current);\n\n // eslint-disable-next-line arrow-body-style\n useEffect(() => {\n return () => clearAsync();\n }, []);\n\n let onKeyDown = (e) => {\n if (e.ctrlKey || e.metaKey || e.shiftKey || e.altKey || isReadOnly) {\n return;\n }\n\n switch (e.key) {\n case 'PageUp':\n if (onIncrementPage) {\n e.preventDefault();\n onIncrementPage?.();\n break;\n }\n // fallthrough!\n case 'ArrowUp':\n case 'Up':\n if (onIncrement) {\n e.preventDefault();\n onIncrement?.();\n }\n break;\n case 'PageDown':\n if (onDecrementPage) {\n e.preventDefault();\n onDecrementPage?.();\n break;\n }\n // fallthrough\n case 'ArrowDown':\n case 'Down':\n if (onDecrement) {\n e.preventDefault();\n onDecrement?.();\n }\n break;\n case 'Home':\n if (onDecrementToMin) {\n e.preventDefault();\n onDecrementToMin?.();\n }\n break;\n case 'End':\n if (onIncrementToMax) {\n e.preventDefault();\n onIncrementToMax?.();\n }\n break;\n }\n };\n\n let isFocused = useRef(false);\n let onFocus = () => {\n isFocused.current = true;\n };\n\n let onBlur = () => {\n isFocused.current = false;\n };\n\n // Replace Unicode hyphen-minus (U+002D) with minus sign (U+2212).\n // This ensures that macOS VoiceOver announces it as \"minus\" even with other characters between the minus sign\n // and the number (e.g. currency symbol). Otherwise it announces nothing because it assumes the character is a hyphen.\n // In addition, replace the empty string with the word \"Empty\" so that iOS VoiceOver does not read \"50%\" for an empty field.\n let ariaTextValue = textValue === '' ? stringFormatter.format('Empty') : (textValue || `${value}`).replace('-', '\\u2212');\n\n useEffect(() => {\n if (isFocused.current) {\n clearAnnouncer('assertive');\n announce(ariaTextValue, 'assertive');\n }\n }, [ariaTextValue]);\n\n const onIncrementPressStart = useEffectEvent(\n (initialStepDelay: number) => {\n clearAsync();\n onIncrement?.();\n // Start spinning after initial delay\n _async.current = window.setTimeout(\n () => {\n if ((maxValue === undefined || isNaN(maxValue)) || (value === undefined || isNaN(value)) || value < maxValue) {\n onIncrementPressStart(60);\n }\n },\n initialStepDelay\n );\n }\n );\n\n const onDecrementPressStart = useEffectEvent(\n (initialStepDelay: number) => {\n clearAsync();\n onDecrement?.();\n // Start spinning after initial delay\n _async.current = window.setTimeout(\n () => {\n if ((minValue === undefined || isNaN(minValue)) || (value === undefined || isNaN(value)) || value > minValue) {\n onDecrementPressStart(60);\n }\n },\n initialStepDelay\n );\n }\n );\n\n let cancelContextMenu = (e) => {\n e.preventDefault();\n };\n\n let {addGlobalListener, removeAllGlobalListeners} = useGlobalListeners();\n\n return {\n spinButtonProps: {\n role: 'spinbutton',\n 'aria-valuenow': value !== undefined && !isNaN(value) ? value : undefined,\n 'aria-valuetext': ariaTextValue,\n 'aria-valuemin': minValue,\n 'aria-valuemax': maxValue,\n 'aria-disabled': isDisabled || undefined,\n 'aria-readonly': isReadOnly || undefined,\n 'aria-required': isRequired || undefined,\n onKeyDown,\n onFocus,\n onBlur\n },\n incrementButtonProps: {\n onPressStart: () => {\n onIncrementPressStart(400);\n addGlobalListener(window, 'contextmenu', cancelContextMenu);\n },\n onPressEnd: () => {\n clearAsync();\n removeAllGlobalListeners();\n },\n onFocus,\n onBlur\n },\n decrementButtonProps: {\n onPressStart: () => {\n onDecrementPressStart(400);\n addGlobalListener(window, 'contextmenu', cancelContextMenu);\n },\n onPressEnd: () => {\n clearAsync();\n removeAllGlobalListeners();\n },\n onFocus,\n onBlur\n }\n };\n}\n","const _temp0 = require(\"../intl/ar-AE.json\");\nconst _temp1 = require(\"../intl/bg-BG.json\");\nconst _temp2 = require(\"../intl/cs-CZ.json\");\nconst _temp3 = require(\"../intl/da-DK.json\");\nconst _temp4 = require(\"../intl/de-DE.json\");\nconst _temp5 = require(\"../intl/el-GR.json\");\nconst _temp6 = require(\"../intl/en-US.json\");\nconst _temp7 = require(\"../intl/es-ES.json\");\nconst _temp8 = require(\"../intl/et-EE.json\");\nconst _temp9 = require(\"../intl/fi-FI.json\");\nconst _temp10 = require(\"../intl/fr-FR.json\");\nconst _temp11 = require(\"../intl/he-IL.json\");\nconst _temp12 = require(\"../intl/hr-HR.json\");\nconst _temp13 = require(\"../intl/hu-HU.json\");\nconst _temp14 = require(\"../intl/it-IT.json\");\nconst _temp15 = require(\"../intl/ja-JP.json\");\nconst _temp16 = require(\"../intl/ko-KR.json\");\nconst _temp17 = require(\"../intl/lt-LT.json\");\nconst _temp18 = require(\"../intl/lv-LV.json\");\nconst _temp19 = require(\"../intl/nb-NO.json\");\nconst _temp20 = require(\"../intl/nl-NL.json\");\nconst _temp21 = require(\"../intl/pl-PL.json\");\nconst _temp22 = require(\"../intl/pt-BR.json\");\nconst _temp23 = require(\"../intl/pt-PT.json\");\nconst _temp24 = require(\"../intl/ro-RO.json\");\nconst _temp25 = require(\"../intl/ru-RU.json\");\nconst _temp26 = require(\"../intl/sk-SK.json\");\nconst _temp27 = require(\"../intl/sl-SI.json\");\nconst _temp28 = require(\"../intl/sr-SP.json\");\nconst _temp29 = require(\"../intl/sv-SE.json\");\nconst _temp30 = require(\"../intl/tr-TR.json\");\nconst _temp31 = require(\"../intl/uk-UA.json\");\nconst _temp32 = require(\"../intl/zh-CN.json\");\nconst _temp33 = require(\"../intl/zh-TW.json\");\nmodule.exports = {\n \"ar-AE\": _temp0,\n \"bg-BG\": _temp1,\n \"cs-CZ\": _temp2,\n \"da-DK\": _temp3,\n \"de-DE\": _temp4,\n \"el-GR\": _temp5,\n \"en-US\": _temp6,\n \"es-ES\": _temp7,\n \"et-EE\": _temp8,\n \"fi-FI\": _temp9,\n \"fr-FR\": _temp10,\n \"he-IL\": _temp11,\n \"hr-HR\": _temp12,\n \"hu-HU\": _temp13,\n \"it-IT\": _temp14,\n \"ja-JP\": _temp15,\n \"ko-KR\": _temp16,\n \"lt-LT\": _temp17,\n \"lv-LV\": _temp18,\n \"nb-NO\": _temp19,\n \"nl-NL\": _temp20,\n \"pl-PL\": _temp21,\n \"pt-BR\": _temp22,\n \"pt-PT\": _temp23,\n \"ro-RO\": _temp24,\n \"ru-RU\": _temp25,\n \"sk-SK\": _temp26,\n \"sl-SI\": _temp27,\n \"sr-SP\": _temp28,\n \"sv-SE\": _temp29,\n \"tr-TR\": _temp30,\n \"uk-UA\": _temp31,\n \"zh-CN\": _temp32,\n \"zh-TW\": _temp33\n}","{\n \"Empty\": \"فارغ\"\n}\n","{\n \"Empty\": \"Изпразни\"\n}\n","{\n \"Empty\": \"Prázdné\"\n}\n","{\n \"Empty\": \"Tom\"\n}\n","{\n \"Empty\": \"Leer\"\n}\n","{\n \"Empty\": \"Άδειο\"\n}\n","{\n \"Empty\": \"Empty\"\n}\n","{\n \"Empty\": \"Vacío\"\n}\n","{\n \"Empty\": \"Tühjenda\"\n}\n","{\n \"Empty\": \"Tyhjä\"\n}\n","{\n \"Empty\": \"Vide\"\n}\n","{\n \"Empty\": \"ריק\"\n}\n","{\n \"Empty\": \"Prazno\"\n}\n","{\n \"Empty\": \"Üres\"\n}\n","{\n \"Empty\": \"Vuoto\"\n}\n","{\n \"Empty\": \"空\"\n}\n","{\n \"Empty\": \"비어 있음\"\n}\n","{\n \"Empty\": \"Tuščias\"\n}\n","{\n \"Empty\": \"Tukšs\"\n}\n","{\n \"Empty\": \"Tom\"\n}\n","{\n \"Empty\": \"Leeg\"\n}\n","{\n \"Empty\": \"Pusty\"\n}\n","{\n \"Empty\": \"Vazio\"\n}\n","{\n \"Empty\": \"Vazio\"\n}\n","{\n \"Empty\": \"Gol\"\n}\n","{\n \"Empty\": \"Не заполнено\"\n}\n","{\n \"Empty\": \"Prázdne\"\n}\n","{\n \"Empty\": \"Prazen\"\n}\n","{\n \"Empty\": \"Prazno\"\n}\n","{\n \"Empty\": \"Tomt\"\n}\n","{\n \"Empty\": \"Boş\"\n}\n","{\n \"Empty\": \"Пусто\"\n}\n","{\n \"Empty\": \"空\"\n}\n","{\n \"Empty\": \"空白\"\n}\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
|
@@ -277,7 +277,7 @@ $a99895ee3dc79e61$exports = {
|
|
|
277
277
|
function $d2e8511e6f209edf$export$e908e06f4b8e3402(props) {
|
|
278
278
|
const _async = (0, $glIEW$useRef)();
|
|
279
279
|
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;
|
|
280
|
-
const stringFormatter = (0, $glIEW$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($a99895ee3dc79e61$exports))));
|
|
280
|
+
const stringFormatter = (0, $glIEW$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($a99895ee3dc79e61$exports))), "@react-aria/spinbutton");
|
|
281
281
|
const clearAsync = ()=>clearTimeout(_async.current);
|
|
282
282
|
// eslint-disable-next-line arrow-body-style
|
|
283
283
|
(0, $glIEW$useEffect)(()=>{
|
|
@@ -289,7 +289,7 @@ function $d2e8511e6f209edf$export$e908e06f4b8e3402(props) {
|
|
|
289
289
|
case "PageUp":
|
|
290
290
|
if (onIncrementPage) {
|
|
291
291
|
e.preventDefault();
|
|
292
|
-
onIncrementPage();
|
|
292
|
+
onIncrementPage === null || onIncrementPage === void 0 ? void 0 : onIncrementPage();
|
|
293
293
|
break;
|
|
294
294
|
}
|
|
295
295
|
// fallthrough!
|
|
@@ -297,13 +297,13 @@ function $d2e8511e6f209edf$export$e908e06f4b8e3402(props) {
|
|
|
297
297
|
case "Up":
|
|
298
298
|
if (onIncrement) {
|
|
299
299
|
e.preventDefault();
|
|
300
|
-
onIncrement();
|
|
300
|
+
onIncrement === null || onIncrement === void 0 ? void 0 : onIncrement();
|
|
301
301
|
}
|
|
302
302
|
break;
|
|
303
303
|
case "PageDown":
|
|
304
304
|
if (onDecrementPage) {
|
|
305
305
|
e.preventDefault();
|
|
306
|
-
onDecrementPage();
|
|
306
|
+
onDecrementPage === null || onDecrementPage === void 0 ? void 0 : onDecrementPage();
|
|
307
307
|
break;
|
|
308
308
|
}
|
|
309
309
|
// fallthrough
|
|
@@ -311,19 +311,19 @@ function $d2e8511e6f209edf$export$e908e06f4b8e3402(props) {
|
|
|
311
311
|
case "Down":
|
|
312
312
|
if (onDecrement) {
|
|
313
313
|
e.preventDefault();
|
|
314
|
-
onDecrement();
|
|
314
|
+
onDecrement === null || onDecrement === void 0 ? void 0 : onDecrement();
|
|
315
315
|
}
|
|
316
316
|
break;
|
|
317
317
|
case "Home":
|
|
318
318
|
if (onDecrementToMin) {
|
|
319
319
|
e.preventDefault();
|
|
320
|
-
onDecrementToMin();
|
|
320
|
+
onDecrementToMin === null || onDecrementToMin === void 0 ? void 0 : onDecrementToMin();
|
|
321
321
|
}
|
|
322
322
|
break;
|
|
323
323
|
case "End":
|
|
324
324
|
if (onIncrementToMax) {
|
|
325
325
|
e.preventDefault();
|
|
326
|
-
onIncrementToMax();
|
|
326
|
+
onIncrementToMax === null || onIncrementToMax === void 0 ? void 0 : onIncrementToMax();
|
|
327
327
|
}
|
|
328
328
|
break;
|
|
329
329
|
}
|
|
@@ -339,29 +339,29 @@ function $d2e8511e6f209edf$export$e908e06f4b8e3402(props) {
|
|
|
339
339
|
// This ensures that macOS VoiceOver announces it as "minus" even with other characters between the minus sign
|
|
340
340
|
// and the number (e.g. currency symbol). Otherwise it announces nothing because it assumes the character is a hyphen.
|
|
341
341
|
// In addition, replace the empty string with the word "Empty" so that iOS VoiceOver does not read "50%" for an empty field.
|
|
342
|
-
|
|
342
|
+
let ariaTextValue = textValue === "" ? stringFormatter.format("Empty") : (textValue || `${value}`).replace("-", "\u2212");
|
|
343
343
|
(0, $glIEW$useEffect)(()=>{
|
|
344
344
|
if (isFocused.current) {
|
|
345
345
|
(0, $glIEW$clearAnnouncer)("assertive");
|
|
346
|
-
(0, $glIEW$announce)(
|
|
346
|
+
(0, $glIEW$announce)(ariaTextValue, "assertive");
|
|
347
347
|
}
|
|
348
348
|
}, [
|
|
349
|
-
|
|
349
|
+
ariaTextValue
|
|
350
350
|
]);
|
|
351
351
|
const onIncrementPressStart = (0, $glIEW$useEffectEvent)((initialStepDelay)=>{
|
|
352
352
|
clearAsync();
|
|
353
|
-
onIncrement();
|
|
353
|
+
onIncrement === null || onIncrement === void 0 ? void 0 : onIncrement();
|
|
354
354
|
// Start spinning after initial delay
|
|
355
355
|
_async.current = window.setTimeout(()=>{
|
|
356
|
-
if (isNaN(maxValue) || isNaN(value) || value < maxValue) onIncrementPressStart(60);
|
|
356
|
+
if (maxValue === undefined || isNaN(maxValue) || value === undefined || isNaN(value) || value < maxValue) onIncrementPressStart(60);
|
|
357
357
|
}, initialStepDelay);
|
|
358
358
|
});
|
|
359
359
|
const onDecrementPressStart = (0, $glIEW$useEffectEvent)((initialStepDelay)=>{
|
|
360
360
|
clearAsync();
|
|
361
|
-
onDecrement();
|
|
361
|
+
onDecrement === null || onDecrement === void 0 ? void 0 : onDecrement();
|
|
362
362
|
// Start spinning after initial delay
|
|
363
363
|
_async.current = window.setTimeout(()=>{
|
|
364
|
-
if (isNaN(minValue) || isNaN(value) || value > minValue) onDecrementPressStart(60);
|
|
364
|
+
if (minValue === undefined || isNaN(minValue) || value === undefined || isNaN(value) || value > minValue) onDecrementPressStart(60);
|
|
365
365
|
}, initialStepDelay);
|
|
366
366
|
});
|
|
367
367
|
let cancelContextMenu = (e)=>{
|
|
@@ -371,13 +371,13 @@ function $d2e8511e6f209edf$export$e908e06f4b8e3402(props) {
|
|
|
371
371
|
return {
|
|
372
372
|
spinButtonProps: {
|
|
373
373
|
role: "spinbutton",
|
|
374
|
-
"aria-valuenow": !isNaN(value) ? value :
|
|
375
|
-
"aria-valuetext":
|
|
374
|
+
"aria-valuenow": value !== undefined && !isNaN(value) ? value : undefined,
|
|
375
|
+
"aria-valuetext": ariaTextValue,
|
|
376
376
|
"aria-valuemin": minValue,
|
|
377
377
|
"aria-valuemax": maxValue,
|
|
378
|
-
"aria-disabled": isDisabled ||
|
|
379
|
-
"aria-readonly": isReadOnly ||
|
|
380
|
-
"aria-required": isRequired ||
|
|
378
|
+
"aria-disabled": isDisabled || undefined,
|
|
379
|
+
"aria-readonly": isReadOnly || undefined,
|
|
380
|
+
"aria-required": isRequired || undefined,
|
|
381
381
|
onKeyDown: onKeyDown,
|
|
382
382
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.ts","packages/@react-aria/spinbutton/src/useSpinButton.ts","packages/@react-aria/spinbutton/src/*.js","packages/@react-aria/spinbutton/intl/ar-AE.json","packages/@react-aria/spinbutton/intl/bg-BG.json","packages/@react-aria/spinbutton/intl/cs-CZ.json","packages/@react-aria/spinbutton/intl/da-DK.json","packages/@react-aria/spinbutton/intl/de-DE.json","packages/@react-aria/spinbutton/intl/el-GR.json","packages/@react-aria/spinbutton/intl/en-US.json","packages/@react-aria/spinbutton/intl/es-ES.json","packages/@react-aria/spinbutton/intl/et-EE.json","packages/@react-aria/spinbutton/intl/fi-FI.json","packages/@react-aria/spinbutton/intl/fr-FR.json","packages/@react-aria/spinbutton/intl/he-IL.json","packages/@react-aria/spinbutton/intl/hr-HR.json","packages/@react-aria/spinbutton/intl/hu-HU.json","packages/@react-aria/spinbutton/intl/it-IT.json","packages/@react-aria/spinbutton/intl/ja-JP.json","packages/@react-aria/spinbutton/intl/ko-KR.json","packages/@react-aria/spinbutton/intl/lt-LT.json","packages/@react-aria/spinbutton/intl/lv-LV.json","packages/@react-aria/spinbutton/intl/nb-NO.json","packages/@react-aria/spinbutton/intl/nl-NL.json","packages/@react-aria/spinbutton/intl/pl-PL.json","packages/@react-aria/spinbutton/intl/pt-BR.json","packages/@react-aria/spinbutton/intl/pt-PT.json","packages/@react-aria/spinbutton/intl/ro-RO.json","packages/@react-aria/spinbutton/intl/ru-RU.json","packages/@react-aria/spinbutton/intl/sk-SK.json","packages/@react-aria/spinbutton/intl/sl-SI.json","packages/@react-aria/spinbutton/intl/sr-SP.json","packages/@react-aria/spinbutton/intl/sv-SE.json","packages/@react-aria/spinbutton/intl/tr-TR.json","packages/@react-aria/spinbutton/intl/uk-UA.json","packages/@react-aria/spinbutton/intl/zh-CN.json","packages/@react-aria/spinbutton/intl/zh-TW.json"],"sourcesContent":["/*\n * Copyright 2020 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 */\nexport type {SpinButtonProps, SpinbuttonAria} from './useSpinButton';\nexport {useSpinButton} from './useSpinButton';\n","/*\n * Copyright 2020 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 {announce, clearAnnouncer} from '@react-aria/live-announcer';\nimport {AriaButtonProps} from '@react-types/button';\nimport {DOMAttributes, InputBase, RangeInputBase, Validation, ValueBase} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {useEffect, useRef} from 'react';\nimport {useEffectEvent, useGlobalListeners} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\n\nexport interface SpinButtonProps extends InputBase, Validation<number>, ValueBase<number>, RangeInputBase<number> {\n textValue?: string,\n onIncrement?: () => void,\n onIncrementPage?: () => void,\n onDecrement?: () => void,\n onDecrementPage?: () => void,\n onDecrementToMin?: () => void,\n onIncrementToMax?: () => void\n}\n\nexport interface SpinbuttonAria {\n spinButtonProps: DOMAttributes,\n incrementButtonProps: AriaButtonProps,\n decrementButtonProps: AriaButtonProps\n}\n\nexport function useSpinButton(\n props: SpinButtonProps\n): SpinbuttonAria {\n const _async = useRef<number>();\n let {\n value,\n textValue,\n minValue,\n maxValue,\n isDisabled,\n isReadOnly,\n isRequired,\n onIncrement,\n onIncrementPage,\n onDecrement,\n onDecrementPage,\n onDecrementToMin,\n onIncrementToMax\n } = props;\n const stringFormatter = useLocalizedStringFormatter(intlMessages);\n\n const clearAsync = () => clearTimeout(_async.current);\n\n // eslint-disable-next-line arrow-body-style\n useEffect(() => {\n return () => clearAsync();\n }, []);\n\n let onKeyDown = (e) => {\n if (e.ctrlKey || e.metaKey || e.shiftKey || e.altKey || isReadOnly) {\n return;\n }\n\n switch (e.key) {\n case 'PageUp':\n if (onIncrementPage) {\n e.preventDefault();\n onIncrementPage();\n break;\n }\n // fallthrough!\n case 'ArrowUp':\n case 'Up':\n if (onIncrement) {\n e.preventDefault();\n onIncrement();\n }\n break;\n case 'PageDown':\n if (onDecrementPage) {\n e.preventDefault();\n onDecrementPage();\n break;\n }\n // fallthrough\n case 'ArrowDown':\n case 'Down':\n if (onDecrement) {\n e.preventDefault();\n onDecrement();\n }\n break;\n case 'Home':\n if (onDecrementToMin) {\n e.preventDefault();\n onDecrementToMin();\n }\n break;\n case 'End':\n if (onIncrementToMax) {\n e.preventDefault();\n onIncrementToMax();\n }\n break;\n }\n };\n\n let isFocused = useRef(false);\n let onFocus = () => {\n isFocused.current = true;\n };\n\n let onBlur = () => {\n isFocused.current = false;\n };\n\n // Replace Unicode hyphen-minus (U+002D) with minus sign (U+2212).\n // This ensures that macOS VoiceOver announces it as \"minus\" even with other characters between the minus sign\n // and the number (e.g. currency symbol). Otherwise it announces nothing because it assumes the character is a hyphen.\n // In addition, replace the empty string with the word \"Empty\" so that iOS VoiceOver does not read \"50%\" for an empty field.\n textValue = textValue === '' ? stringFormatter.format('Empty') : (textValue || `${value}`).replace('-', '\\u2212');\n\n useEffect(() => {\n if (isFocused.current) {\n clearAnnouncer('assertive');\n announce(textValue, 'assertive');\n }\n }, [textValue]);\n\n const onIncrementPressStart = useEffectEvent(\n (initialStepDelay: number) => {\n clearAsync();\n onIncrement();\n // Start spinning after initial delay\n _async.current = window.setTimeout(\n () => {\n if (isNaN(maxValue) || isNaN(value) || value < maxValue) {\n onIncrementPressStart(60);\n }\n },\n initialStepDelay\n );\n }\n );\n\n const onDecrementPressStart = useEffectEvent(\n (initialStepDelay: number) => {\n clearAsync();\n onDecrement();\n // Start spinning after initial delay\n _async.current = window.setTimeout(\n () => {\n if (isNaN(minValue) || isNaN(value) || value > minValue) {\n onDecrementPressStart(60);\n }\n },\n initialStepDelay\n );\n }\n );\n\n let cancelContextMenu = (e) => {\n e.preventDefault();\n };\n\n let {addGlobalListener, removeAllGlobalListeners} = useGlobalListeners();\n\n return {\n spinButtonProps: {\n role: 'spinbutton',\n 'aria-valuenow': !isNaN(value) ? value : null,\n 'aria-valuetext': textValue,\n 'aria-valuemin': minValue,\n 'aria-valuemax': maxValue,\n 'aria-disabled': isDisabled || null,\n 'aria-readonly': isReadOnly || null,\n 'aria-required': isRequired || null,\n onKeyDown,\n onFocus,\n onBlur\n },\n incrementButtonProps: {\n onPressStart: () => {\n onIncrementPressStart(400);\n addGlobalListener(window, 'contextmenu', cancelContextMenu);\n },\n onPressEnd: () => {\n clearAsync();\n removeAllGlobalListeners();\n },\n onFocus,\n onBlur\n },\n decrementButtonProps: {\n onPressStart: () => {\n onDecrementPressStart(400);\n addGlobalListener(window, 'contextmenu', cancelContextMenu);\n },\n onPressEnd: () => {\n clearAsync();\n removeAllGlobalListeners();\n },\n onFocus,\n onBlur\n }\n };\n}\n","const _temp0 = require(\"../intl/ar-AE.json\");\nconst _temp1 = require(\"../intl/bg-BG.json\");\nconst _temp2 = require(\"../intl/cs-CZ.json\");\nconst _temp3 = require(\"../intl/da-DK.json\");\nconst _temp4 = require(\"../intl/de-DE.json\");\nconst _temp5 = require(\"../intl/el-GR.json\");\nconst _temp6 = require(\"../intl/en-US.json\");\nconst _temp7 = require(\"../intl/es-ES.json\");\nconst _temp8 = require(\"../intl/et-EE.json\");\nconst _temp9 = require(\"../intl/fi-FI.json\");\nconst _temp10 = require(\"../intl/fr-FR.json\");\nconst _temp11 = require(\"../intl/he-IL.json\");\nconst _temp12 = require(\"../intl/hr-HR.json\");\nconst _temp13 = require(\"../intl/hu-HU.json\");\nconst _temp14 = require(\"../intl/it-IT.json\");\nconst _temp15 = require(\"../intl/ja-JP.json\");\nconst _temp16 = require(\"../intl/ko-KR.json\");\nconst _temp17 = require(\"../intl/lt-LT.json\");\nconst _temp18 = require(\"../intl/lv-LV.json\");\nconst _temp19 = require(\"../intl/nb-NO.json\");\nconst _temp20 = require(\"../intl/nl-NL.json\");\nconst _temp21 = require(\"../intl/pl-PL.json\");\nconst _temp22 = require(\"../intl/pt-BR.json\");\nconst _temp23 = require(\"../intl/pt-PT.json\");\nconst _temp24 = require(\"../intl/ro-RO.json\");\nconst _temp25 = require(\"../intl/ru-RU.json\");\nconst _temp26 = require(\"../intl/sk-SK.json\");\nconst _temp27 = require(\"../intl/sl-SI.json\");\nconst _temp28 = require(\"../intl/sr-SP.json\");\nconst _temp29 = require(\"../intl/sv-SE.json\");\nconst _temp30 = require(\"../intl/tr-TR.json\");\nconst _temp31 = require(\"../intl/uk-UA.json\");\nconst _temp32 = require(\"../intl/zh-CN.json\");\nconst _temp33 = require(\"../intl/zh-TW.json\");\nmodule.exports = {\n \"ar-AE\": _temp0,\n \"bg-BG\": _temp1,\n \"cs-CZ\": _temp2,\n \"da-DK\": _temp3,\n \"de-DE\": _temp4,\n \"el-GR\": _temp5,\n \"en-US\": _temp6,\n \"es-ES\": _temp7,\n \"et-EE\": _temp8,\n \"fi-FI\": _temp9,\n \"fr-FR\": _temp10,\n \"he-IL\": _temp11,\n \"hr-HR\": _temp12,\n \"hu-HU\": _temp13,\n \"it-IT\": _temp14,\n \"ja-JP\": _temp15,\n \"ko-KR\": _temp16,\n \"lt-LT\": _temp17,\n \"lv-LV\": _temp18,\n \"nb-NO\": _temp19,\n \"nl-NL\": _temp20,\n \"pl-PL\": _temp21,\n \"pt-BR\": _temp22,\n \"pt-PT\": _temp23,\n \"ro-RO\": _temp24,\n \"ru-RU\": _temp25,\n \"sk-SK\": _temp26,\n \"sl-SI\": _temp27,\n \"sr-SP\": _temp28,\n \"sv-SE\": _temp29,\n \"tr-TR\": _temp30,\n \"uk-UA\": _temp31,\n \"zh-CN\": _temp32,\n \"zh-TW\": _temp33\n}","{\n \"Empty\": \"فارغ\"\n}\n","{\n \"Empty\": \"Изпразни\"\n}\n","{\n \"Empty\": \"Prázdné\"\n}\n","{\n \"Empty\": \"Tom\"\n}\n","{\n \"Empty\": \"Leer\"\n}\n","{\n \"Empty\": \"Άδειο\"\n}\n","{\n \"Empty\": \"Empty\"\n}\n","{\n \"Empty\": \"Vacío\"\n}\n","{\n \"Empty\": \"Tühjenda\"\n}\n","{\n \"Empty\": \"Tyhjä\"\n}\n","{\n \"Empty\": \"Vide\"\n}\n","{\n \"Empty\": \"ריק\"\n}\n","{\n \"Empty\": \"Prazno\"\n}\n","{\n \"Empty\": \"Üres\"\n}\n","{\n \"Empty\": \"Vuoto\"\n}\n","{\n \"Empty\": \"空\"\n}\n","{\n \"Empty\": \"비어 있음\"\n}\n","{\n \"Empty\": \"Tuščias\"\n}\n","{\n \"Empty\": \"Tukšs\"\n}\n","{\n \"Empty\": \"Tom\"\n}\n","{\n \"Empty\": \"Leeg\"\n}\n","{\n \"Empty\": \"Pusty\"\n}\n","{\n \"Empty\": \"Vazio\"\n}\n","{\n \"Empty\": \"Vazio\"\n}\n","{\n \"Empty\": \"Gol\"\n}\n","{\n \"Empty\": \"Не заполнено\"\n}\n","{\n \"Empty\": \"Prázdne\"\n}\n","{\n \"Empty\": \"Prazen\"\n}\n","{\n \"Empty\": \"Prazno\"\n}\n","{\n \"Empty\": \"Tomt\"\n}\n","{\n \"Empty\": \"Boş\"\n}\n","{\n \"Empty\": \"Пусто\"\n}\n","{\n \"Empty\": \"空\"\n}\n","{\n \"Empty\": \"空白\"\n}\n"],"names":[],"version":3,"file":"module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC;;;AEVD,4BAAiB;IAAG,SAAS,CAAC,4BAAI,CAAC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/index.ts","packages/@react-aria/spinbutton/src/useSpinButton.ts","packages/@react-aria/spinbutton/src/*.js","packages/@react-aria/spinbutton/intl/ar-AE.json","packages/@react-aria/spinbutton/intl/bg-BG.json","packages/@react-aria/spinbutton/intl/cs-CZ.json","packages/@react-aria/spinbutton/intl/da-DK.json","packages/@react-aria/spinbutton/intl/de-DE.json","packages/@react-aria/spinbutton/intl/el-GR.json","packages/@react-aria/spinbutton/intl/en-US.json","packages/@react-aria/spinbutton/intl/es-ES.json","packages/@react-aria/spinbutton/intl/et-EE.json","packages/@react-aria/spinbutton/intl/fi-FI.json","packages/@react-aria/spinbutton/intl/fr-FR.json","packages/@react-aria/spinbutton/intl/he-IL.json","packages/@react-aria/spinbutton/intl/hr-HR.json","packages/@react-aria/spinbutton/intl/hu-HU.json","packages/@react-aria/spinbutton/intl/it-IT.json","packages/@react-aria/spinbutton/intl/ja-JP.json","packages/@react-aria/spinbutton/intl/ko-KR.json","packages/@react-aria/spinbutton/intl/lt-LT.json","packages/@react-aria/spinbutton/intl/lv-LV.json","packages/@react-aria/spinbutton/intl/nb-NO.json","packages/@react-aria/spinbutton/intl/nl-NL.json","packages/@react-aria/spinbutton/intl/pl-PL.json","packages/@react-aria/spinbutton/intl/pt-BR.json","packages/@react-aria/spinbutton/intl/pt-PT.json","packages/@react-aria/spinbutton/intl/ro-RO.json","packages/@react-aria/spinbutton/intl/ru-RU.json","packages/@react-aria/spinbutton/intl/sk-SK.json","packages/@react-aria/spinbutton/intl/sl-SI.json","packages/@react-aria/spinbutton/intl/sr-SP.json","packages/@react-aria/spinbutton/intl/sv-SE.json","packages/@react-aria/spinbutton/intl/tr-TR.json","packages/@react-aria/spinbutton/intl/uk-UA.json","packages/@react-aria/spinbutton/intl/zh-CN.json","packages/@react-aria/spinbutton/intl/zh-TW.json"],"sourcesContent":["/*\n * Copyright 2020 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 */\nexport type {SpinButtonProps, SpinbuttonAria} from './useSpinButton';\nexport {useSpinButton} from './useSpinButton';\n","/*\n * Copyright 2020 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 {announce, clearAnnouncer} from '@react-aria/live-announcer';\nimport {AriaButtonProps} from '@react-types/button';\nimport {DOMAttributes, InputBase, RangeInputBase, Validation, ValueBase} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {useEffect, useRef} from 'react';\nimport {useEffectEvent, useGlobalListeners} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\n\nexport interface SpinButtonProps extends InputBase, Validation<number>, ValueBase<number>, RangeInputBase<number> {\n textValue?: string,\n onIncrement?: () => void,\n onIncrementPage?: () => void,\n onDecrement?: () => void,\n onDecrementPage?: () => void,\n onDecrementToMin?: () => void,\n onIncrementToMax?: () => void\n}\n\nexport interface SpinbuttonAria {\n spinButtonProps: DOMAttributes,\n incrementButtonProps: AriaButtonProps,\n decrementButtonProps: AriaButtonProps\n}\n\nexport function useSpinButton(\n props: SpinButtonProps\n): SpinbuttonAria {\n const _async = useRef<number>();\n let {\n value,\n textValue,\n minValue,\n maxValue,\n isDisabled,\n isReadOnly,\n isRequired,\n onIncrement,\n onIncrementPage,\n onDecrement,\n onDecrementPage,\n onDecrementToMin,\n onIncrementToMax\n } = props;\n const stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/spinbutton');\n\n const clearAsync = () => clearTimeout(_async.current);\n\n // eslint-disable-next-line arrow-body-style\n useEffect(() => {\n return () => clearAsync();\n }, []);\n\n let onKeyDown = (e) => {\n if (e.ctrlKey || e.metaKey || e.shiftKey || e.altKey || isReadOnly) {\n return;\n }\n\n switch (e.key) {\n case 'PageUp':\n if (onIncrementPage) {\n e.preventDefault();\n onIncrementPage?.();\n break;\n }\n // fallthrough!\n case 'ArrowUp':\n case 'Up':\n if (onIncrement) {\n e.preventDefault();\n onIncrement?.();\n }\n break;\n case 'PageDown':\n if (onDecrementPage) {\n e.preventDefault();\n onDecrementPage?.();\n break;\n }\n // fallthrough\n case 'ArrowDown':\n case 'Down':\n if (onDecrement) {\n e.preventDefault();\n onDecrement?.();\n }\n break;\n case 'Home':\n if (onDecrementToMin) {\n e.preventDefault();\n onDecrementToMin?.();\n }\n break;\n case 'End':\n if (onIncrementToMax) {\n e.preventDefault();\n onIncrementToMax?.();\n }\n break;\n }\n };\n\n let isFocused = useRef(false);\n let onFocus = () => {\n isFocused.current = true;\n };\n\n let onBlur = () => {\n isFocused.current = false;\n };\n\n // Replace Unicode hyphen-minus (U+002D) with minus sign (U+2212).\n // This ensures that macOS VoiceOver announces it as \"minus\" even with other characters between the minus sign\n // and the number (e.g. currency symbol). Otherwise it announces nothing because it assumes the character is a hyphen.\n // In addition, replace the empty string with the word \"Empty\" so that iOS VoiceOver does not read \"50%\" for an empty field.\n let ariaTextValue = textValue === '' ? stringFormatter.format('Empty') : (textValue || `${value}`).replace('-', '\\u2212');\n\n useEffect(() => {\n if (isFocused.current) {\n clearAnnouncer('assertive');\n announce(ariaTextValue, 'assertive');\n }\n }, [ariaTextValue]);\n\n const onIncrementPressStart = useEffectEvent(\n (initialStepDelay: number) => {\n clearAsync();\n onIncrement?.();\n // Start spinning after initial delay\n _async.current = window.setTimeout(\n () => {\n if ((maxValue === undefined || isNaN(maxValue)) || (value === undefined || isNaN(value)) || value < maxValue) {\n onIncrementPressStart(60);\n }\n },\n initialStepDelay\n );\n }\n );\n\n const onDecrementPressStart = useEffectEvent(\n (initialStepDelay: number) => {\n clearAsync();\n onDecrement?.();\n // Start spinning after initial delay\n _async.current = window.setTimeout(\n () => {\n if ((minValue === undefined || isNaN(minValue)) || (value === undefined || isNaN(value)) || value > minValue) {\n onDecrementPressStart(60);\n }\n },\n initialStepDelay\n );\n }\n );\n\n let cancelContextMenu = (e) => {\n e.preventDefault();\n };\n\n let {addGlobalListener, removeAllGlobalListeners} = useGlobalListeners();\n\n return {\n spinButtonProps: {\n role: 'spinbutton',\n 'aria-valuenow': value !== undefined && !isNaN(value) ? value : undefined,\n 'aria-valuetext': ariaTextValue,\n 'aria-valuemin': minValue,\n 'aria-valuemax': maxValue,\n 'aria-disabled': isDisabled || undefined,\n 'aria-readonly': isReadOnly || undefined,\n 'aria-required': isRequired || undefined,\n onKeyDown,\n onFocus,\n onBlur\n },\n incrementButtonProps: {\n onPressStart: () => {\n onIncrementPressStart(400);\n addGlobalListener(window, 'contextmenu', cancelContextMenu);\n },\n onPressEnd: () => {\n clearAsync();\n removeAllGlobalListeners();\n },\n onFocus,\n onBlur\n },\n decrementButtonProps: {\n onPressStart: () => {\n onDecrementPressStart(400);\n addGlobalListener(window, 'contextmenu', cancelContextMenu);\n },\n onPressEnd: () => {\n clearAsync();\n removeAllGlobalListeners();\n },\n onFocus,\n onBlur\n }\n };\n}\n","const _temp0 = require(\"../intl/ar-AE.json\");\nconst _temp1 = require(\"../intl/bg-BG.json\");\nconst _temp2 = require(\"../intl/cs-CZ.json\");\nconst _temp3 = require(\"../intl/da-DK.json\");\nconst _temp4 = require(\"../intl/de-DE.json\");\nconst _temp5 = require(\"../intl/el-GR.json\");\nconst _temp6 = require(\"../intl/en-US.json\");\nconst _temp7 = require(\"../intl/es-ES.json\");\nconst _temp8 = require(\"../intl/et-EE.json\");\nconst _temp9 = require(\"../intl/fi-FI.json\");\nconst _temp10 = require(\"../intl/fr-FR.json\");\nconst _temp11 = require(\"../intl/he-IL.json\");\nconst _temp12 = require(\"../intl/hr-HR.json\");\nconst _temp13 = require(\"../intl/hu-HU.json\");\nconst _temp14 = require(\"../intl/it-IT.json\");\nconst _temp15 = require(\"../intl/ja-JP.json\");\nconst _temp16 = require(\"../intl/ko-KR.json\");\nconst _temp17 = require(\"../intl/lt-LT.json\");\nconst _temp18 = require(\"../intl/lv-LV.json\");\nconst _temp19 = require(\"../intl/nb-NO.json\");\nconst _temp20 = require(\"../intl/nl-NL.json\");\nconst _temp21 = require(\"../intl/pl-PL.json\");\nconst _temp22 = require(\"../intl/pt-BR.json\");\nconst _temp23 = require(\"../intl/pt-PT.json\");\nconst _temp24 = require(\"../intl/ro-RO.json\");\nconst _temp25 = require(\"../intl/ru-RU.json\");\nconst _temp26 = require(\"../intl/sk-SK.json\");\nconst _temp27 = require(\"../intl/sl-SI.json\");\nconst _temp28 = require(\"../intl/sr-SP.json\");\nconst _temp29 = require(\"../intl/sv-SE.json\");\nconst _temp30 = require(\"../intl/tr-TR.json\");\nconst _temp31 = require(\"../intl/uk-UA.json\");\nconst _temp32 = require(\"../intl/zh-CN.json\");\nconst _temp33 = require(\"../intl/zh-TW.json\");\nmodule.exports = {\n \"ar-AE\": _temp0,\n \"bg-BG\": _temp1,\n \"cs-CZ\": _temp2,\n \"da-DK\": _temp3,\n \"de-DE\": _temp4,\n \"el-GR\": _temp5,\n \"en-US\": _temp6,\n \"es-ES\": _temp7,\n \"et-EE\": _temp8,\n \"fi-FI\": _temp9,\n \"fr-FR\": _temp10,\n \"he-IL\": _temp11,\n \"hr-HR\": _temp12,\n \"hu-HU\": _temp13,\n \"it-IT\": _temp14,\n \"ja-JP\": _temp15,\n \"ko-KR\": _temp16,\n \"lt-LT\": _temp17,\n \"lv-LV\": _temp18,\n \"nb-NO\": _temp19,\n \"nl-NL\": _temp20,\n \"pl-PL\": _temp21,\n \"pt-BR\": _temp22,\n \"pt-PT\": _temp23,\n \"ro-RO\": _temp24,\n \"ru-RU\": _temp25,\n \"sk-SK\": _temp26,\n \"sl-SI\": _temp27,\n \"sr-SP\": _temp28,\n \"sv-SE\": _temp29,\n \"tr-TR\": _temp30,\n \"uk-UA\": _temp31,\n \"zh-CN\": _temp32,\n \"zh-TW\": _temp33\n}","{\n \"Empty\": \"فارغ\"\n}\n","{\n \"Empty\": \"Изпразни\"\n}\n","{\n \"Empty\": \"Prázdné\"\n}\n","{\n \"Empty\": \"Tom\"\n}\n","{\n \"Empty\": \"Leer\"\n}\n","{\n \"Empty\": \"Άδειο\"\n}\n","{\n \"Empty\": \"Empty\"\n}\n","{\n \"Empty\": \"Vacío\"\n}\n","{\n \"Empty\": \"Tühjenda\"\n}\n","{\n \"Empty\": \"Tyhjä\"\n}\n","{\n \"Empty\": \"Vide\"\n}\n","{\n \"Empty\": \"ריק\"\n}\n","{\n \"Empty\": \"Prazno\"\n}\n","{\n \"Empty\": \"Üres\"\n}\n","{\n \"Empty\": \"Vuoto\"\n}\n","{\n \"Empty\": \"空\"\n}\n","{\n \"Empty\": \"비어 있음\"\n}\n","{\n \"Empty\": \"Tuščias\"\n}\n","{\n \"Empty\": \"Tukšs\"\n}\n","{\n \"Empty\": \"Tom\"\n}\n","{\n \"Empty\": \"Leeg\"\n}\n","{\n \"Empty\": \"Pusty\"\n}\n","{\n \"Empty\": \"Vazio\"\n}\n","{\n \"Empty\": \"Vazio\"\n}\n","{\n \"Empty\": \"Gol\"\n}\n","{\n \"Empty\": \"Не заполнено\"\n}\n","{\n \"Empty\": \"Prázdne\"\n}\n","{\n \"Empty\": \"Prazen\"\n}\n","{\n \"Empty\": \"Prazno\"\n}\n","{\n \"Empty\": \"Tomt\"\n}\n","{\n \"Empty\": \"Boş\"\n}\n","{\n \"Empty\": \"Пусто\"\n}\n","{\n \"Empty\": \"空\"\n}\n","{\n \"Empty\": \"空白\"\n}\n"],"names":[],"version":3,"file":"module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/spinbutton",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.2",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"url": "https://github.com/adobe/react-spectrum"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@react-aria/i18n": "^3.
|
|
25
|
+
"@react-aria/i18n": "^3.10.1",
|
|
26
26
|
"@react-aria/live-announcer": "^3.3.1",
|
|
27
|
-
"@react-aria/utils": "^3.
|
|
27
|
+
"@react-aria/utils": "^3.23.1",
|
|
28
28
|
"@react-types/button": "^3.9.1",
|
|
29
29
|
"@react-types/shared": "^3.22.0",
|
|
30
30
|
"@swc/helpers": "^0.5.0"
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "f040ff62678e6a31375b96c05396df0bae660350"
|
|
40
40
|
}
|
package/src/useSpinButton.ts
CHANGED
|
@@ -55,7 +55,7 @@ export function useSpinButton(
|
|
|
55
55
|
onDecrementToMin,
|
|
56
56
|
onIncrementToMax
|
|
57
57
|
} = props;
|
|
58
|
-
const stringFormatter = useLocalizedStringFormatter(intlMessages);
|
|
58
|
+
const stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/spinbutton');
|
|
59
59
|
|
|
60
60
|
const clearAsync = () => clearTimeout(_async.current);
|
|
61
61
|
|
|
@@ -73,7 +73,7 @@ export function useSpinButton(
|
|
|
73
73
|
case 'PageUp':
|
|
74
74
|
if (onIncrementPage) {
|
|
75
75
|
e.preventDefault();
|
|
76
|
-
onIncrementPage();
|
|
76
|
+
onIncrementPage?.();
|
|
77
77
|
break;
|
|
78
78
|
}
|
|
79
79
|
// fallthrough!
|
|
@@ -81,13 +81,13 @@ export function useSpinButton(
|
|
|
81
81
|
case 'Up':
|
|
82
82
|
if (onIncrement) {
|
|
83
83
|
e.preventDefault();
|
|
84
|
-
onIncrement();
|
|
84
|
+
onIncrement?.();
|
|
85
85
|
}
|
|
86
86
|
break;
|
|
87
87
|
case 'PageDown':
|
|
88
88
|
if (onDecrementPage) {
|
|
89
89
|
e.preventDefault();
|
|
90
|
-
onDecrementPage();
|
|
90
|
+
onDecrementPage?.();
|
|
91
91
|
break;
|
|
92
92
|
}
|
|
93
93
|
// fallthrough
|
|
@@ -95,19 +95,19 @@ export function useSpinButton(
|
|
|
95
95
|
case 'Down':
|
|
96
96
|
if (onDecrement) {
|
|
97
97
|
e.preventDefault();
|
|
98
|
-
onDecrement();
|
|
98
|
+
onDecrement?.();
|
|
99
99
|
}
|
|
100
100
|
break;
|
|
101
101
|
case 'Home':
|
|
102
102
|
if (onDecrementToMin) {
|
|
103
103
|
e.preventDefault();
|
|
104
|
-
onDecrementToMin();
|
|
104
|
+
onDecrementToMin?.();
|
|
105
105
|
}
|
|
106
106
|
break;
|
|
107
107
|
case 'End':
|
|
108
108
|
if (onIncrementToMax) {
|
|
109
109
|
e.preventDefault();
|
|
110
|
-
onIncrementToMax();
|
|
110
|
+
onIncrementToMax?.();
|
|
111
111
|
}
|
|
112
112
|
break;
|
|
113
113
|
}
|
|
@@ -126,23 +126,23 @@ export function useSpinButton(
|
|
|
126
126
|
// This ensures that macOS VoiceOver announces it as "minus" even with other characters between the minus sign
|
|
127
127
|
// and the number (e.g. currency symbol). Otherwise it announces nothing because it assumes the character is a hyphen.
|
|
128
128
|
// In addition, replace the empty string with the word "Empty" so that iOS VoiceOver does not read "50%" for an empty field.
|
|
129
|
-
|
|
129
|
+
let ariaTextValue = textValue === '' ? stringFormatter.format('Empty') : (textValue || `${value}`).replace('-', '\u2212');
|
|
130
130
|
|
|
131
131
|
useEffect(() => {
|
|
132
132
|
if (isFocused.current) {
|
|
133
133
|
clearAnnouncer('assertive');
|
|
134
|
-
announce(
|
|
134
|
+
announce(ariaTextValue, 'assertive');
|
|
135
135
|
}
|
|
136
|
-
}, [
|
|
136
|
+
}, [ariaTextValue]);
|
|
137
137
|
|
|
138
138
|
const onIncrementPressStart = useEffectEvent(
|
|
139
139
|
(initialStepDelay: number) => {
|
|
140
140
|
clearAsync();
|
|
141
|
-
onIncrement();
|
|
141
|
+
onIncrement?.();
|
|
142
142
|
// Start spinning after initial delay
|
|
143
143
|
_async.current = window.setTimeout(
|
|
144
144
|
() => {
|
|
145
|
-
if (isNaN(maxValue) || isNaN(value) || value < maxValue) {
|
|
145
|
+
if ((maxValue === undefined || isNaN(maxValue)) || (value === undefined || isNaN(value)) || value < maxValue) {
|
|
146
146
|
onIncrementPressStart(60);
|
|
147
147
|
}
|
|
148
148
|
},
|
|
@@ -154,11 +154,11 @@ export function useSpinButton(
|
|
|
154
154
|
const onDecrementPressStart = useEffectEvent(
|
|
155
155
|
(initialStepDelay: number) => {
|
|
156
156
|
clearAsync();
|
|
157
|
-
onDecrement();
|
|
157
|
+
onDecrement?.();
|
|
158
158
|
// Start spinning after initial delay
|
|
159
159
|
_async.current = window.setTimeout(
|
|
160
160
|
() => {
|
|
161
|
-
if (isNaN(minValue) || isNaN(value) || value > minValue) {
|
|
161
|
+
if ((minValue === undefined || isNaN(minValue)) || (value === undefined || isNaN(value)) || value > minValue) {
|
|
162
162
|
onDecrementPressStart(60);
|
|
163
163
|
}
|
|
164
164
|
},
|
|
@@ -176,13 +176,13 @@ export function useSpinButton(
|
|
|
176
176
|
return {
|
|
177
177
|
spinButtonProps: {
|
|
178
178
|
role: 'spinbutton',
|
|
179
|
-
'aria-valuenow': !isNaN(value) ? value :
|
|
180
|
-
'aria-valuetext':
|
|
179
|
+
'aria-valuenow': value !== undefined && !isNaN(value) ? value : undefined,
|
|
180
|
+
'aria-valuetext': ariaTextValue,
|
|
181
181
|
'aria-valuemin': minValue,
|
|
182
182
|
'aria-valuemax': maxValue,
|
|
183
|
-
'aria-disabled': isDisabled ||
|
|
184
|
-
'aria-readonly': isReadOnly ||
|
|
185
|
-
'aria-required': isRequired ||
|
|
183
|
+
'aria-disabled': isDisabled || undefined,
|
|
184
|
+
'aria-readonly': isReadOnly || undefined,
|
|
185
|
+
'aria-required': isRequired || undefined,
|
|
186
186
|
onKeyDown,
|
|
187
187
|
onFocus,
|
|
188
188
|
onBlur
|