@react-aria/spinbutton 3.4.0 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/import.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {clearAnnouncer as $glIEW$clearAnnouncer, announce as $glIEW$announce} from "@react-aria/live-announcer";
2
- import {useRef as $glIEW$useRef, useEffect as $glIEW$useEffect, useCallback as $glIEW$useCallback} from "react";
3
- import {useGlobalListeners as $glIEW$useGlobalListeners} from "@react-aria/utils";
2
+ import {useRef as $glIEW$useRef, useEffect as $glIEW$useEffect} from "react";
3
+ import {useEffectEvent as $glIEW$useEffectEvent, useGlobalListeners as $glIEW$useGlobalListeners} from "@react-aria/utils";
4
4
  import {useLocalizedStringFormatter as $glIEW$useLocalizedStringFormatter} from "@react-aria/i18n";
5
5
 
6
6
  function $parcel$interopDefault(a) {
@@ -27,7 +27,7 @@ function $parcel$interopDefault(a) {
27
27
  * OF ANY KIND, either express or implied. See the License for the specific language
28
28
  * governing permissions and limitations under the License.
29
29
  */
30
- var $c6208a7792e31a37$exports = {};
30
+ var $a99895ee3dc79e61$exports = {};
31
31
  var $ed6aae4e5f766f1e$exports = {};
32
32
  $ed6aae4e5f766f1e$exports = {
33
33
  "Empty": `فارغ`
@@ -232,7 +232,7 @@ $94b60c866ca5dfe6$exports = {
232
232
  };
233
233
 
234
234
 
235
- $c6208a7792e31a37$exports = {
235
+ $a99895ee3dc79e61$exports = {
236
236
  "ar-AE": $ed6aae4e5f766f1e$exports,
237
237
  "bg-BG": $38854e2b175151fa$exports,
238
238
  "cs-CZ": $15b25ab20f3945b2$exports,
@@ -276,9 +276,7 @@ $c6208a7792e31a37$exports = {
276
276
  function $d2e8511e6f209edf$export$e908e06f4b8e3402(props) {
277
277
  const _async = (0, $glIEW$useRef)();
278
278
  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;
279
- const stringFormatter = (0, $glIEW$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($c6208a7792e31a37$exports))));
280
- const propsRef = (0, $glIEW$useRef)(props);
281
- propsRef.current = props;
279
+ const stringFormatter = (0, $glIEW$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($a99895ee3dc79e61$exports))));
282
280
  const clearAsync = ()=>clearTimeout(_async.current);
283
281
  // eslint-disable-next-line arrow-body-style
284
282
  (0, $glIEW$useEffect)(()=>{
@@ -349,32 +347,22 @@ function $d2e8511e6f209edf$export$e908e06f4b8e3402(props) {
349
347
  }, [
350
348
  textValue
351
349
  ]);
352
- const onIncrementPressStart = (0, $glIEW$useCallback)((initialStepDelay)=>{
350
+ const onIncrementPressStart = (0, $glIEW$useEffectEvent)((initialStepDelay)=>{
353
351
  clearAsync();
354
- propsRef.current.onIncrement();
352
+ onIncrement();
355
353
  // Start spinning after initial delay
356
354
  _async.current = window.setTimeout(()=>{
357
355
  if (isNaN(maxValue) || isNaN(value) || value < maxValue) onIncrementPressStart(60);
358
356
  }, initialStepDelay);
359
- }, // eslint-disable-next-line react-hooks/exhaustive-deps
360
- [
361
- onIncrement,
362
- maxValue,
363
- value
364
- ]);
365
- const onDecrementPressStart = (0, $glIEW$useCallback)((initialStepDelay)=>{
357
+ });
358
+ const onDecrementPressStart = (0, $glIEW$useEffectEvent)((initialStepDelay)=>{
366
359
  clearAsync();
367
- propsRef.current.onDecrement();
360
+ onDecrement();
368
361
  // Start spinning after initial delay
369
362
  _async.current = window.setTimeout(()=>{
370
363
  if (isNaN(minValue) || isNaN(value) || value > minValue) onDecrementPressStart(60);
371
364
  }, initialStepDelay);
372
- }, // eslint-disable-next-line react-hooks/exhaustive-deps
373
- [
374
- onDecrement,
375
- minValue,
376
- value
377
- ]);
365
+ });
378
366
  let cancelContextMenu = (e)=>{
379
367
  e.preventDefault();
380
368
  };
package/dist/main.js CHANGED
@@ -32,7 +32,7 @@ $parcel$export(module.exports, "useSpinButton", () => $37bbd4c129023f61$export$e
32
32
  * OF ANY KIND, either express or implied. See the License for the specific language
33
33
  * governing permissions and limitations under the License.
34
34
  */
35
- var $55fd103defc81437$exports = {};
35
+ var $cb4b786159079747$exports = {};
36
36
  var $db6c23092fbfea22$exports = {};
37
37
  $db6c23092fbfea22$exports = {
38
38
  "Empty": `فارغ`
@@ -237,7 +237,7 @@ $8db5191ec1aacb53$exports = {
237
237
  };
238
238
 
239
239
 
240
- $55fd103defc81437$exports = {
240
+ $cb4b786159079747$exports = {
241
241
  "ar-AE": $db6c23092fbfea22$exports,
242
242
  "bg-BG": $f4b3121a918895c4$exports,
243
243
  "cs-CZ": $d01cc02a83842f4c$exports,
@@ -281,9 +281,7 @@ $55fd103defc81437$exports = {
281
281
  function $37bbd4c129023f61$export$e908e06f4b8e3402(props) {
282
282
  const _async = (0, $2BLaI$react.useRef)();
283
283
  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;
284
- const stringFormatter = (0, $2BLaI$reactariai18n.useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($55fd103defc81437$exports))));
285
- const propsRef = (0, $2BLaI$react.useRef)(props);
286
- propsRef.current = props;
284
+ const stringFormatter = (0, $2BLaI$reactariai18n.useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($cb4b786159079747$exports))));
287
285
  const clearAsync = ()=>clearTimeout(_async.current);
288
286
  // eslint-disable-next-line arrow-body-style
289
287
  (0, $2BLaI$react.useEffect)(()=>{
@@ -354,32 +352,22 @@ function $37bbd4c129023f61$export$e908e06f4b8e3402(props) {
354
352
  }, [
355
353
  textValue
356
354
  ]);
357
- const onIncrementPressStart = (0, $2BLaI$react.useCallback)((initialStepDelay)=>{
355
+ const onIncrementPressStart = (0, $2BLaI$reactariautils.useEffectEvent)((initialStepDelay)=>{
358
356
  clearAsync();
359
- propsRef.current.onIncrement();
357
+ onIncrement();
360
358
  // Start spinning after initial delay
361
359
  _async.current = window.setTimeout(()=>{
362
360
  if (isNaN(maxValue) || isNaN(value) || value < maxValue) onIncrementPressStart(60);
363
361
  }, initialStepDelay);
364
- }, // eslint-disable-next-line react-hooks/exhaustive-deps
365
- [
366
- onIncrement,
367
- maxValue,
368
- value
369
- ]);
370
- const onDecrementPressStart = (0, $2BLaI$react.useCallback)((initialStepDelay)=>{
362
+ });
363
+ const onDecrementPressStart = (0, $2BLaI$reactariautils.useEffectEvent)((initialStepDelay)=>{
371
364
  clearAsync();
372
- propsRef.current.onDecrement();
365
+ onDecrement();
373
366
  // Start spinning after initial delay
374
367
  _async.current = window.setTimeout(()=>{
375
368
  if (isNaN(minValue) || isNaN(value) || value > minValue) onDecrementPressStart(60);
376
369
  }, initialStepDelay);
377
- }, // eslint-disable-next-line react-hooks/exhaustive-deps
378
- [
379
- onDecrement,
380
- minValue,
381
- value
382
- ]);
370
+ });
383
371
  let cancelContextMenu = (e)=>{
384
372
  e.preventDefault();
385
373
  };
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC,GAED;;;AEZA,4BAAiB;IAAG,SAAS,CAAC,IAAI,CAAC;AACnC;;ADDA;;AEAA,4BAAiB;IAAG,SAAS,CAAC,QAAQ,CAAC;AACvC;;;;ACDA,4BAAiB;IAAG,SAAS,CAAC,OAAO,CAAC;AACtC;;;;ACDA,4BAAiB;IAAG,SAAS,CAAC,GAAG,CAAC;AAClC;;;;ACDA,4BAAiB;IAAG,SAAS,CAAC,IAAI,C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B;gBACA;YACF;qBACA;oBACA;QACF;IACF;AACF;;CDlNC,GACD","sources":["packages/@react-aria/spinbutton/src/index.ts","packages/@react-aria/spinbutton/src/useSpinButton.ts","packages/@react-aria/spinbutton/intl/*.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 {useCallback, useEffect, useRef} from 'react';\nimport {useGlobalListeners} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\n\nexport interface SpinButtonProps extends InputBase, Validation, 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 const propsRef = useRef(props);\n propsRef.current = props;\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 = useCallback(\n (initialStepDelay: number) => {\n clearAsync();\n propsRef.current.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 // eslint-disable-next-line react-hooks/exhaustive-deps\n [onIncrement, maxValue, value]\n );\n\n const onDecrementPressStart = useCallback(\n (initialStepDelay: number) => {\n clearAsync();\n propsRef.current.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 // eslint-disable-next-line react-hooks/exhaustive-deps\n [onDecrement, minValue, value]\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(\"./ar-AE.json\");\nconst _temp1 = require(\"./bg-BG.json\");\nconst _temp2 = require(\"./cs-CZ.json\");\nconst _temp3 = require(\"./da-DK.json\");\nconst _temp4 = require(\"./de-DE.json\");\nconst _temp5 = require(\"./el-GR.json\");\nconst _temp6 = require(\"./en-US.json\");\nconst _temp7 = require(\"./es-ES.json\");\nconst _temp8 = require(\"./et-EE.json\");\nconst _temp9 = require(\"./fi-FI.json\");\nconst _temp10 = require(\"./fr-FR.json\");\nconst _temp11 = require(\"./he-IL.json\");\nconst _temp12 = require(\"./hr-HR.json\");\nconst _temp13 = require(\"./hu-HU.json\");\nconst _temp14 = require(\"./it-IT.json\");\nconst _temp15 = require(\"./ja-JP.json\");\nconst _temp16 = require(\"./ko-KR.json\");\nconst _temp17 = require(\"./lt-LT.json\");\nconst _temp18 = require(\"./lv-LV.json\");\nconst _temp19 = require(\"./nb-NO.json\");\nconst _temp20 = require(\"./nl-NL.json\");\nconst _temp21 = require(\"./pl-PL.json\");\nconst _temp22 = require(\"./pt-BR.json\");\nconst _temp23 = require(\"./pt-PT.json\");\nconst _temp24 = require(\"./ro-RO.json\");\nconst _temp25 = require(\"./ru-RU.json\");\nconst _temp26 = require(\"./sk-SK.json\");\nconst _temp27 = require(\"./sl-SI.json\");\nconst _temp28 = require(\"./sr-SP.json\");\nconst _temp29 = require(\"./sv-SE.json\");\nconst _temp30 = require(\"./tr-TR.json\");\nconst _temp31 = require(\"./uk-UA.json\");\nconst _temp32 = require(\"./zh-CN.json\");\nconst _temp33 = require(\"./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":";;;;;;;;;;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;IAEd,MAAM,wBAAwB,CAAA,GAAA,oCAAa,EACzC,CAAC;QACC;QACA;QACA,qCAAqC;QACrC,OAAO,UAAU,OAAO,WACtB;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,UAAU,OAAO,WACtB;YACE,IAAI,MAAM,aAAa,MAAM,UAAU,QAAQ,UAC7C,sBAAsB;QAE1B,GACA;IAEJ;IAGF,IAAI,oBAAoB,CAAC;QACvB,EAAE;IACJ;IAEA,IAAI,qBAAC,kBAAiB,4BAAE,yBAAwB,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, 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"}
package/dist/module.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {clearAnnouncer as $glIEW$clearAnnouncer, announce as $glIEW$announce} from "@react-aria/live-announcer";
2
- import {useRef as $glIEW$useRef, useEffect as $glIEW$useEffect, useCallback as $glIEW$useCallback} from "react";
3
- import {useGlobalListeners as $glIEW$useGlobalListeners} from "@react-aria/utils";
2
+ import {useRef as $glIEW$useRef, useEffect as $glIEW$useEffect} from "react";
3
+ import {useEffectEvent as $glIEW$useEffectEvent, useGlobalListeners as $glIEW$useGlobalListeners} from "@react-aria/utils";
4
4
  import {useLocalizedStringFormatter as $glIEW$useLocalizedStringFormatter} from "@react-aria/i18n";
5
5
 
6
6
  function $parcel$interopDefault(a) {
@@ -27,7 +27,7 @@ function $parcel$interopDefault(a) {
27
27
  * OF ANY KIND, either express or implied. See the License for the specific language
28
28
  * governing permissions and limitations under the License.
29
29
  */
30
- var $c6208a7792e31a37$exports = {};
30
+ var $a99895ee3dc79e61$exports = {};
31
31
  var $ed6aae4e5f766f1e$exports = {};
32
32
  $ed6aae4e5f766f1e$exports = {
33
33
  "Empty": `فارغ`
@@ -232,7 +232,7 @@ $94b60c866ca5dfe6$exports = {
232
232
  };
233
233
 
234
234
 
235
- $c6208a7792e31a37$exports = {
235
+ $a99895ee3dc79e61$exports = {
236
236
  "ar-AE": $ed6aae4e5f766f1e$exports,
237
237
  "bg-BG": $38854e2b175151fa$exports,
238
238
  "cs-CZ": $15b25ab20f3945b2$exports,
@@ -276,9 +276,7 @@ $c6208a7792e31a37$exports = {
276
276
  function $d2e8511e6f209edf$export$e908e06f4b8e3402(props) {
277
277
  const _async = (0, $glIEW$useRef)();
278
278
  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;
279
- const stringFormatter = (0, $glIEW$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($c6208a7792e31a37$exports))));
280
- const propsRef = (0, $glIEW$useRef)(props);
281
- propsRef.current = props;
279
+ const stringFormatter = (0, $glIEW$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($a99895ee3dc79e61$exports))));
282
280
  const clearAsync = ()=>clearTimeout(_async.current);
283
281
  // eslint-disable-next-line arrow-body-style
284
282
  (0, $glIEW$useEffect)(()=>{
@@ -349,32 +347,22 @@ function $d2e8511e6f209edf$export$e908e06f4b8e3402(props) {
349
347
  }, [
350
348
  textValue
351
349
  ]);
352
- const onIncrementPressStart = (0, $glIEW$useCallback)((initialStepDelay)=>{
350
+ const onIncrementPressStart = (0, $glIEW$useEffectEvent)((initialStepDelay)=>{
353
351
  clearAsync();
354
- propsRef.current.onIncrement();
352
+ onIncrement();
355
353
  // Start spinning after initial delay
356
354
  _async.current = window.setTimeout(()=>{
357
355
  if (isNaN(maxValue) || isNaN(value) || value < maxValue) onIncrementPressStart(60);
358
356
  }, initialStepDelay);
359
- }, // eslint-disable-next-line react-hooks/exhaustive-deps
360
- [
361
- onIncrement,
362
- maxValue,
363
- value
364
- ]);
365
- const onDecrementPressStart = (0, $glIEW$useCallback)((initialStepDelay)=>{
357
+ });
358
+ const onDecrementPressStart = (0, $glIEW$useEffectEvent)((initialStepDelay)=>{
366
359
  clearAsync();
367
- propsRef.current.onDecrement();
360
+ onDecrement();
368
361
  // Start spinning after initial delay
369
362
  _async.current = window.setTimeout(()=>{
370
363
  if (isNaN(minValue) || isNaN(value) || value > minValue) onDecrementPressStart(60);
371
364
  }, initialStepDelay);
372
- }, // eslint-disable-next-line react-hooks/exhaustive-deps
373
- [
374
- onDecrement,
375
- minValue,
376
- value
377
- ]);
365
+ });
378
366
  let cancelContextMenu = (e)=>{
379
367
  e.preventDefault();
380
368
  };
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC,GAED;;;AEZA,4BAAiB;IAAG,SAAS,CAAC,IAAI,CAAC;AACnC;;ADDA;;AEAA,4BAAiB;IAAG,SAAS,CAAC,QAAQ,CAAC;AACvC;;;;ACDA,4BAAiB;IAAG,SAAS,CAAC,OAAO,CAAC;AACtC;;;;ACDA,4BAAiB;IAAG,SAAS,CAAC,GAAG,CAAC;AAClC;;;;ACDA,4BAAiB;IAAG,SAAS,CAAC,IAAI,CAAC;AACnC;;;;ACDA,4BAAiB;IAAG,SAAS,CAAC,KAAK,CAAC;AACpC;;;;ACDA,4BAAiB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/@react-aria/spinbutton/src/useSpinButton.ts","packages/@react-aria/spinbutton/intl/*.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 {useCallback, useEffect, useRef} from 'react';\nimport {useGlobalListeners} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\n\nexport interface SpinButtonProps extends InputBase, Validation, 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 const propsRef = useRef(props);\n propsRef.current = props;\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 = useCallback(\n (initialStepDelay: number) => {\n clearAsync();\n propsRef.current.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 // eslint-disable-next-line react-hooks/exhaustive-deps\n [onIncrement, maxValue, value]\n );\n\n const onDecrementPressStart = useCallback(\n (initialStepDelay: number) => {\n clearAsync();\n propsRef.current.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 // eslint-disable-next-line react-hooks/exhaustive-deps\n [onDecrement, minValue, value]\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(\"./ar-AE.json\");\nconst _temp1 = require(\"./bg-BG.json\");\nconst _temp2 = require(\"./cs-CZ.json\");\nconst _temp3 = require(\"./da-DK.json\");\nconst _temp4 = require(\"./de-DE.json\");\nconst _temp5 = require(\"./el-GR.json\");\nconst _temp6 = require(\"./en-US.json\");\nconst _temp7 = require(\"./es-ES.json\");\nconst _temp8 = require(\"./et-EE.json\");\nconst _temp9 = require(\"./fi-FI.json\");\nconst _temp10 = require(\"./fr-FR.json\");\nconst _temp11 = require(\"./he-IL.json\");\nconst _temp12 = require(\"./hr-HR.json\");\nconst _temp13 = require(\"./hu-HU.json\");\nconst _temp14 = require(\"./it-IT.json\");\nconst _temp15 = require(\"./ja-JP.json\");\nconst _temp16 = require(\"./ko-KR.json\");\nconst _temp17 = require(\"./lt-LT.json\");\nconst _temp18 = require(\"./lv-LV.json\");\nconst _temp19 = require(\"./nb-NO.json\");\nconst _temp20 = require(\"./nl-NL.json\");\nconst _temp21 = require(\"./pl-PL.json\");\nconst _temp22 = require(\"./pt-BR.json\");\nconst _temp23 = require(\"./pt-PT.json\");\nconst _temp24 = require(\"./ro-RO.json\");\nconst _temp25 = require(\"./ru-RU.json\");\nconst _temp26 = require(\"./sk-SK.json\");\nconst _temp27 = require(\"./sl-SI.json\");\nconst _temp28 = require(\"./sr-SP.json\");\nconst _temp29 = require(\"./sv-SE.json\");\nconst _temp30 = require(\"./tr-TR.json\");\nconst _temp31 = require(\"./uk-UA.json\");\nconst _temp32 = require(\"./zh-CN.json\");\nconst _temp33 = require(\"./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,IAAI,CAAC;AAC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AO,WACtB;YACE,IAAI,MAAM,aAAa,MAAM,UAAU,QAAQ,UAC7C,sBAAsB;QAE1B,GACA;IAEJ;IAGF,MAAM,wBAAwB,CAAA,GAAA,qBAAa,EACzC,CAAC;QACC;QACA;QACA,qCAAqC;QACrC,OAAO,UAAU,OAAO,WACtB;YACE,IAAI,MAAM,aAAa,MAAM,UAAU,QAAQ,UAC7C,sBAAsB;QAE1B,GACA;IAEJ;IAGF,IAAI,oBAAoB,CAAC;QACvB,EAAE;IACJ;IAEA,IAAI,qBAAC,kBAAiB,4BAAE,yBAAwB,EAAC,GAAG,CAAA,GAAA,yBAAiB;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, 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 +1 @@
1
- {"mappings":";;AAsBA,gCAAiC,SAAQ,SAAS,EAAE,UAAU,EAAE,UAAU,MAAM,CAAC,EAAE,eAAe,MAAM,CAAC;IACvG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAA;CAC9B;AAED;IACE,eAAe,EAAE,aAAa,CAAC;IAC/B,oBAAoB,EAAE,eAAe,CAAC;IACtC,oBAAoB,EAAE,eAAe,CAAA;CACtC;AAED,8BACE,KAAK,EAAE,eAAe,GACrB,cAAc,CAoLhB","sources":["packages/@react-aria/spinbutton/src/packages/@react-aria/spinbutton/src/useSpinButton.ts","packages/@react-aria/spinbutton/src/packages/@react-aria/spinbutton/src/index.ts","packages/@react-aria/spinbutton/src/index.ts"],"sourcesContent":[null,null,"/*\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"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;AAsBA,gCAAiC,SAAQ,SAAS,EAAE,UAAU,EAAE,UAAU,MAAM,CAAC,EAAE,eAAe,MAAM,CAAC;IACvG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAA;CAC9B;AAED;IACE,eAAe,EAAE,aAAa,CAAC;IAC/B,oBAAoB,EAAE,eAAe,CAAC;IACtC,oBAAoB,EAAE,eAAe,CAAA;CACtC;AAED,8BACE,KAAK,EAAE,eAAe,GACrB,cAAc,CA8KhB","sources":["packages/@react-aria/spinbutton/src/packages/@react-aria/spinbutton/src/useSpinButton.ts","packages/@react-aria/spinbutton/src/packages/@react-aria/spinbutton/src/index.ts","packages/@react-aria/spinbutton/src/index.ts"],"sourcesContent":[null,null,"/*\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"],"names":[],"version":3,"file":"types.d.ts.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/spinbutton",
3
- "version": "3.4.0",
3
+ "version": "3.5.0",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -22,12 +22,12 @@
22
22
  "url": "https://github.com/adobe/react-spectrum"
23
23
  },
24
24
  "dependencies": {
25
- "@react-aria/i18n": "^3.7.1",
26
- "@react-aria/live-announcer": "^3.3.0",
27
- "@react-aria/utils": "^3.16.0",
28
- "@react-types/button": "^3.7.2",
29
- "@react-types/shared": "^3.18.0",
30
- "@swc/helpers": "^0.4.14"
25
+ "@react-aria/i18n": "^3.8.0",
26
+ "@react-aria/live-announcer": "^3.3.1",
27
+ "@react-aria/utils": "^3.18.0",
28
+ "@react-types/button": "^3.7.3",
29
+ "@react-types/shared": "^3.18.1",
30
+ "@swc/helpers": "^0.5.0"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0",
@@ -36,5 +36,5 @@
36
36
  "publishConfig": {
37
37
  "access": "public"
38
38
  },
39
- "gitHead": "9d1ba9bd8ebcd63bf3495ade16d349bcb71795ce"
39
+ "gitHead": "504e40e0a50c1b20ed0fb3ba9561a263b6d5565e"
40
40
  }
@@ -15,8 +15,8 @@ import {AriaButtonProps} from '@react-types/button';
15
15
  import {DOMAttributes, InputBase, RangeInputBase, Validation, ValueBase} from '@react-types/shared';
16
16
  // @ts-ignore
17
17
  import intlMessages from '../intl/*.json';
18
- import {useCallback, useEffect, useRef} from 'react';
19
- import {useGlobalListeners} from '@react-aria/utils';
18
+ import {useEffect, useRef} from 'react';
19
+ import {useEffectEvent, useGlobalListeners} from '@react-aria/utils';
20
20
  import {useLocalizedStringFormatter} from '@react-aria/i18n';
21
21
 
22
22
 
@@ -56,8 +56,6 @@ export function useSpinButton(
56
56
  onIncrementToMax
57
57
  } = props;
58
58
  const stringFormatter = useLocalizedStringFormatter(intlMessages);
59
- const propsRef = useRef(props);
60
- propsRef.current = props;
61
59
 
62
60
  const clearAsync = () => clearTimeout(_async.current);
63
61
 
@@ -137,10 +135,10 @@ export function useSpinButton(
137
135
  }
138
136
  }, [textValue]);
139
137
 
140
- const onIncrementPressStart = useCallback(
138
+ const onIncrementPressStart = useEffectEvent(
141
139
  (initialStepDelay: number) => {
142
140
  clearAsync();
143
- propsRef.current.onIncrement();
141
+ onIncrement();
144
142
  // Start spinning after initial delay
145
143
  _async.current = window.setTimeout(
146
144
  () => {
@@ -150,15 +148,13 @@ export function useSpinButton(
150
148
  },
151
149
  initialStepDelay
152
150
  );
153
- },
154
- // eslint-disable-next-line react-hooks/exhaustive-deps
155
- [onIncrement, maxValue, value]
151
+ }
156
152
  );
157
153
 
158
- const onDecrementPressStart = useCallback(
154
+ const onDecrementPressStart = useEffectEvent(
159
155
  (initialStepDelay: number) => {
160
156
  clearAsync();
161
- propsRef.current.onDecrement();
157
+ onDecrement();
162
158
  // Start spinning after initial delay
163
159
  _async.current = window.setTimeout(
164
160
  () => {
@@ -168,9 +164,7 @@ export function useSpinButton(
168
164
  },
169
165
  initialStepDelay
170
166
  );
171
- },
172
- // eslint-disable-next-line react-hooks/exhaustive-deps
173
- [onDecrement, minValue, value]
167
+ }
174
168
  );
175
169
 
176
170
  let cancelContextMenu = (e) => {