@react-aria/numberfield 3.0.0-rc.0 → 3.1.1

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/main.js CHANGED
@@ -1,7 +1,3 @@
1
- var {
2
- useTextField
3
- } = require("@react-aria/textfield");
4
-
5
1
  var {
6
2
  useSpinButton
7
3
  } = require("@react-aria/spinbutton");
@@ -12,10 +8,23 @@ var {
12
8
  } = require("@react-aria/i18n");
13
9
 
14
10
  var {
15
- useFocus
11
+ useFormattedTextField
12
+ } = require("@react-aria/textfield");
13
+
14
+ var {
15
+ useFocus,
16
+ useFocusWithin,
17
+ useScrollWheel
16
18
  } = require("@react-aria/interactions");
17
19
 
18
20
  var {
21
+ useCallback,
22
+ useMemo,
23
+ useState
24
+ } = require("react");
25
+
26
+ var {
27
+ filterDOMProps,
19
28
  isAndroid,
20
29
  isIOS,
21
30
  isIPhone,
@@ -23,15 +32,10 @@ var {
23
32
  useId
24
33
  } = require("@react-aria/utils");
25
34
 
26
- var {
27
- useCallback,
28
- useEffect,
29
- useMemo,
30
- useRef
31
- } = require("react");
32
-
33
35
  var _babelRuntimeHelpersInteropRequireDefault = $parcel$interopDefault(require("@babel/runtime/helpers/interopRequireDefault"));
34
36
 
37
+ var _babelRuntimeHelpersExtends = $parcel$interopDefault(require("@babel/runtime/helpers/extends"));
38
+
35
39
  function $parcel$interopDefault(a) {
36
40
  return a && a.__esModule ? a.default : a;
37
41
  }
@@ -176,16 +180,10 @@ const $ebb253b0ca493f114f41772a028a$var$intlMessages = {
176
180
  "zh-TW": _babelRuntimeHelpersInteropRequireDefault($e5db46fc5bab2e1cddabb46042e67b$exports).default
177
181
  };
178
182
 
179
- function $ebb253b0ca493f114f41772a028a$var$supportsNativeBeforeInputEvent() {
180
- return typeof window !== 'undefined' && window.InputEvent && // @ts-ignore
181
- typeof InputEvent.prototype.getTargetRanges === 'function';
182
- }
183
183
  /**
184
184
  * Provides the behavior and accessibility implementation for a number field component.
185
185
  * Number fields allow users to enter a number, and increment or decrement the value using stepper buttons.
186
186
  */
187
-
188
-
189
187
  function useNumberField(props, state, inputRef) {
190
188
  let {
191
189
  id,
@@ -199,7 +197,14 @@ function useNumberField(props, state, inputRef) {
199
197
  autoFocus,
200
198
  validationState,
201
199
  label,
202
- formatOptions
200
+ formatOptions,
201
+ onBlur,
202
+ onFocus,
203
+ onFocusChange,
204
+ onKeyDown,
205
+ onKeyUp,
206
+ description,
207
+ errorMessage
203
208
  } = props;
204
209
  let {
205
210
  increment,
@@ -236,25 +241,33 @@ function useNumberField(props, state, inputRef) {
236
241
  value: numberValue,
237
242
  textValue: state.inputValue
238
243
  });
244
+ let [focusWithin, setFocusWithin] = useState(false);
245
+ let {
246
+ focusWithinProps
247
+ } = useFocusWithin({
248
+ isDisabled,
249
+ onFocusWithinChange: setFocusWithin
250
+ });
239
251
  let onWheel = useCallback(e => {
240
- // If the input isn't supposed to receive input, do nothing.
241
- // If the ctrlKey is pressed, this is a zoom event, do nothing.
242
- if (isDisabled || isReadOnly || e.ctrlKey) {
252
+ // if on a trackpad, users can scroll in both X and Y at once, check the magnitude of the change
253
+ // if it's mostly in the X direction, then just return, the user probably doesn't mean to inc/dec
254
+ // this isn't perfect, events come in fast with small deltas and a part of the scroll may give a false indication
255
+ // especially if the user is scrolling near 45deg
256
+ if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) {
243
257
  return;
244
- } // stop scrolling the page
245
-
246
-
247
- e.preventDefault();
258
+ }
248
259
 
249
260
  if (e.deltaY > 0) {
250
261
  increment();
251
262
  } else if (e.deltaY < 0) {
252
263
  decrement();
253
264
  }
254
- }, [isReadOnly, isDisabled, decrement, increment]);
255
- $ebb253b0ca493f114f41772a028a$var$useScrollWheel({
265
+ }, [decrement, increment]); // If the input isn't supposed to receive input, disable scrolling.
266
+
267
+ let scrollingDisabled = isDisabled || isReadOnly || !focusWithin;
268
+ useScrollWheel({
256
269
  onScroll: onWheel,
257
- capture: false
270
+ isDisabled: scrollingDisabled
258
271
  }, inputRef); // The inputMode attribute influences the software keyboard that is shown on touch devices.
259
272
  // Browsers and operating systems are quite inconsistent about what keys are available, however.
260
273
  // We choose between numeric and decimal based on whether we allow negative and fractional numbers,
@@ -285,90 +298,17 @@ function useNumberField(props, state, inputRef) {
285
298
  }
286
299
  }
287
300
 
288
- let stateRef = useRef(state);
289
- stateRef.current = state; // All browsers implement the 'beforeinput' event natively except Firefox
290
- // (currently behind a flag as of Firefox 84). React's polyfill does not
291
- // run in all cases that the native event fires, e.g. when deleting text.
292
- // Use the native event if available so that we can prevent invalid deletions.
293
- // We do not attempt to polyfill this in Firefox since it would be very complicated,
294
- // the benefit of doing so is fairly minor, and it's going to be natively supported soon.
295
-
296
- useEffect(() => {
297
- if (!$ebb253b0ca493f114f41772a028a$var$supportsNativeBeforeInputEvent()) {
298
- return;
299
- }
300
-
301
- let input = inputRef.current;
302
-
303
- let onBeforeInput = e => {
304
- let state = stateRef.current; // Compute the next value of the input if the event is allowed to proceed.
305
- // See https://www.w3.org/TR/input-events-2/#interface-InputEvent-Attributes for a full list of input types.
306
-
307
- let nextValue;
308
-
309
- switch (e.inputType) {
310
- case 'historyUndo':
311
- case 'historyRedo':
312
- // Explicitly allow undo/redo. e.data is null in this case, but there's no need to validate,
313
- // because presumably the input would have already been validated previously.
314
- return;
315
-
316
- case 'deleteContent':
317
- case 'deleteByCut':
318
- case 'deleteByDrag':
319
- nextValue = input.value.slice(0, input.selectionStart) + input.value.slice(input.selectionEnd);
320
- break;
321
-
322
- case 'deleteContentForward':
323
- // This is potentially incorrect, since the browser may actually delete more than a single UTF-16
324
- // character. In reality, a full Unicode grapheme cluster consisting of multiple UTF-16 characters
325
- // or code points may be deleted. However, in our currently supported locales, there are no such cases.
326
- // If we support additional locales in the future, this may need to change.
327
- nextValue = input.selectionEnd === input.selectionStart ? input.value.slice(0, input.selectionStart) + input.value.slice(input.selectionEnd + 1) : input.value.slice(0, input.selectionStart) + input.value.slice(input.selectionEnd);
328
- break;
329
-
330
- case 'deleteContentBackward':
331
- nextValue = input.selectionEnd === input.selectionStart ? input.value.slice(0, input.selectionStart - 1) + input.value.slice(input.selectionStart) : input.value.slice(0, input.selectionStart) + input.value.slice(input.selectionEnd);
332
- break;
333
-
334
- default:
335
- if (e.data != null) {
336
- nextValue = input.value.slice(0, input.selectionStart) + e.data + input.value.slice(input.selectionEnd);
337
- }
338
-
339
- break;
340
- } // If we did not compute a value, or the new value is invalid, prevent the event
341
- // so that the browser does not update the input text, move the selection, or add to
342
- // the undo/redo stack.
343
-
344
-
345
- if (nextValue == null || !state.validate(nextValue)) {
346
- e.preventDefault();
347
- }
348
- };
349
-
350
- input.addEventListener('beforeinput', onBeforeInput, false);
351
- return () => {
352
- input.removeEventListener('beforeinput', onBeforeInput, false);
353
- };
354
- }, [inputRef, stateRef]);
355
- let onBeforeInput = !$ebb253b0ca493f114f41772a028a$var$supportsNativeBeforeInputEvent() ? e => {
356
- let nextValue = e.target.value.slice(0, e.target.selectionStart) + e.data + e.target.value.slice(e.target.selectionEnd);
357
-
358
- if (!state.validate(nextValue)) {
359
- e.preventDefault();
360
- }
361
- } : null;
362
-
363
301
  let onChange = value => {
364
302
  state.setInputValue(value);
365
303
  };
366
304
 
367
- let compositionStartState = useRef(null);
305
+ let domProps = filterDOMProps(props);
368
306
  let {
369
307
  labelProps,
370
- inputProps: textFieldProps
371
- } = useTextField({
308
+ inputProps: textFieldProps,
309
+ descriptionProps,
310
+ errorMessageProps
311
+ } = useFormattedTextField(_babelRuntimeHelpersExtends({}, domProps, {
372
312
  label,
373
313
  autoFocus,
374
314
  isDisabled,
@@ -384,49 +324,14 @@ function useNumberField(props, state, inputRef) {
384
324
  // Can't use type="number" because then we can't have things like $ in the field.
385
325
  inputMode,
386
326
  onChange,
387
- onBeforeInput,
388
-
389
- onCompositionStart() {
390
- // Chrome does not implement Input Events Level 2, which specifies the insertFromComposition
391
- // and deleteByComposition inputType values for the beforeinput event. These are meant to occur
392
- // at the end of a composition (e.g. Pinyin IME, Android auto correct, etc.), and crucially, are
393
- // cancelable. The insertCompositionText and deleteCompositionText input types are not cancelable,
394
- // nor would we want to cancel them because the input from the user is incomplete at that point.
395
- // In Safari, insertFromComposition/deleteFromComposition will fire, however, allowing us to cancel
396
- // the final composition result if it is invalid. As a fallback for Chrome and Firefox, which either
397
- // don't support Input Events Level 2, or beforeinput at all, we store the state of the input when
398
- // the compositionstart event fires, and undo the changes in compositionend (below) if it is invalid.
399
- // Unfortunately, this messes up the undo/redo stack, but until insertFromComposition/deleteByComposition
400
- // are implemented, there is no other way to prevent composed input.
401
- // See https://bugs.chromium.org/p/chromium/issues/detail?id=1022204
402
- let {
403
- value,
404
- selectionStart,
405
- selectionEnd
406
- } = inputRef.current;
407
- compositionStartState.current = {
408
- value,
409
- selectionStart,
410
- selectionEnd
411
- };
412
- },
413
-
414
- onCompositionEnd() {
415
- if (!state.validate(inputRef.current.value)) {
416
- // Restore the input value in the DOM immediately so we can synchronously update the selection position.
417
- // But also update the value in React state as well so it is correct for future updates.
418
- let {
419
- value,
420
- selectionStart,
421
- selectionEnd
422
- } = compositionStartState.current;
423
- inputRef.current.value = value;
424
- inputRef.current.setSelectionRange(selectionStart, selectionEnd);
425
- state.setInputValue(value);
426
- }
427
- }
428
-
429
- }, inputRef);
327
+ onBlur,
328
+ onFocus,
329
+ onFocusChange,
330
+ onKeyDown,
331
+ onKeyUp,
332
+ description,
333
+ errorMessage
334
+ }), state, inputRef);
430
335
  let inputProps = mergeProps(spinButtonProps, textFieldProps, focusProps, {
431
336
  // override the spinbutton role, we can't focus a spin button with VO
432
337
  role: null,
@@ -501,32 +406,19 @@ function useNumberField(props, state, inputRef) {
501
406
  onPressStart: onButtonPressStart
502
407
  });
503
408
  return {
504
- groupProps: {
409
+ groupProps: _babelRuntimeHelpersExtends({
505
410
  role: 'group',
506
411
  'aria-disabled': isDisabled,
507
412
  'aria-invalid': validationState === 'invalid' ? 'true' : undefined
508
- },
413
+ }, focusWithinProps),
509
414
  labelProps,
510
415
  inputProps,
511
416
  incrementButtonProps,
512
- decrementButtonProps
417
+ decrementButtonProps,
418
+ errorMessageProps,
419
+ descriptionProps
513
420
  };
514
- } // scroll wheel needs to be added not passively so it's cancelable, small helper hook to remember that
515
-
421
+ }
516
422
 
517
423
  exports.useNumberField = useNumberField;
518
-
519
- function $ebb253b0ca493f114f41772a028a$var$useScrollWheel(_ref, ref) {
520
- let {
521
- onScroll,
522
- capture
523
- } = _ref;
524
- useEffect(() => {
525
- let elem = ref.current;
526
- elem.addEventListener('wheel', onScroll, capture);
527
- return () => {
528
- elem.removeEventListener('wheel', onScroll, capture);
529
- };
530
- }, [onScroll, ref, capture]);
531
- }
532
424
  //# sourceMappingURL=main.js.map
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,sBAAT,CAAgCC,CAAhC,EAAmC;AACjC,SAAOA,CAAC,IAAIA,CAAC,CAACC,UAAP,GAAoBD,CAAC,CAACE,OAAtB,GAAgCF,CAAvC;AACD;;;;ACFD,0CAAiBG,IAAI,CAACC,KAAL,CAAW,sGAAX,CAAjB;;;ACAA,0CAAiBD,IAAI,CAACC,KAAL,CAAW,uHAAX,CAAjB;;;ACAA,4CAAiBD,IAAI,CAACC,KAAL,CAAW,8GAAX,CAAjB;;;ACAA,4CAAiBD,IAAI,CAACC,KAAL,CAAW,sGAAX,CAAjB;;;ACAA,4CAAiBD,IAAI,CAACC,KAAL,CAAW,kHAAX,CAAjB;;;ACAA,0CAAiBD,IAAI,CAACC,KAAL,CAAW,+GAAX,CAAjB;;;ACAA,qCAAiBD,IAAI,CAACC,KAAL,CAAW,kHAAX,CAAjB;;;ACAA,2CAAiBD,IAAI,CAACC,KAAL,CAAW,oHAAX,CAAjB;;;ACAA,yCAAiBD,IAAI,CAACC,KAAL,CAAW,gHAAX,CAAjB;;;ACAA,2CAAiBD,IAAI,CAACC,KAAL,CAAW,8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ASgB,gDAAT,OAAwFiE,GAAxF,EAAqH;AAAA,MAA7F;AAAChE,IAAAA,QAAD;AAAWC,IAAAA;AAAX,GAA6F;AACnHgB,EAAAA,SAAS,CAAC,MAAM;AACd,QAAIgD,IAAI,GAAGD,GAAG,CAAChD,OAAf;AACAiD,IAAAA,IAAI,CAACtC,gBAAL,CAAsB,OAAtB,EAA+B3B,QAA/B,EAAyCC,OAAzC;AAEA,WAAO,MAAM;AACXgE,MAAAA,IAAI,CAACrC,mBAAL,CAAyB,OAAzB,EAAkC5B,QAAlC,EAA4CC,OAA5C;AACD,KAFD;AAGD,GAPQ,EAON,CAACD,QAAD,EAAWgE,GAAX,EAAgB/D,OAAhB,CAPM,CAAT;AAQD","sources":["./node_modules/@parcel/scope-hoisting/lib/helpers.js","./packages/@react-aria/numberfield/intl/ar-AE.json","./packages/@react-aria/numberfield/intl/bg-BG.json","./packages/@react-aria/numberfield/intl/cs-CZ.json","./packages/@react-aria/numberfield/intl/da-DK.json","./packages/@react-aria/numberfield/intl/de-DE.json","./packages/@react-aria/numberfield/intl/el-GR.json","./packages/@react-aria/numberfield/intl/en-US.json","./packages/@react-aria/numberfield/intl/es-ES.json","./packages/@react-aria/numberfield/intl/et-EE.json","./packages/@react-aria/numberfield/intl/fi-FI.json","./packages/@react-aria/numberfield/intl/fr-FR.json","./packages/@react-aria/numberfield/intl/he-IL.json","./packages/@react-aria/numberfield/intl/hr-HR.json","./packages/@react-aria/numberfield/intl/hu-HU.json","./packages/@react-aria/numberfield/intl/it-IT.json","./packages/@react-aria/numberfield/intl/ja-JP.json","./packages/@react-aria/numberfield/intl/ko-KR.json","./packages/@react-aria/numberfield/intl/lt-LT.json","./packages/@react-aria/numberfield/intl/lv-LV.json","./packages/@react-aria/numberfield/intl/nb-NO.json","./packages/@react-aria/numberfield/intl/nl-NL.json","./packages/@react-aria/numberfield/intl/pl-PL.json","./packages/@react-aria/numberfield/intl/pt-BR.json","./packages/@react-aria/numberfield/intl/pt-PT.json","./packages/@react-aria/numberfield/intl/ro-RO.json","./packages/@react-aria/numberfield/intl/ru-RU.json","./packages/@react-aria/numberfield/intl/sk-SK.json","./packages/@react-aria/numberfield/intl/sl-SI.json","./packages/@react-aria/numberfield/intl/sr-SP.json","./packages/@react-aria/numberfield/intl/sv-SE.json","./packages/@react-aria/numberfield/intl/tr-TR.json","./packages/@react-aria/numberfield/intl/uk-UA.json","./packages/@react-aria/numberfield/intl/zh-CN.json","./packages/@react-aria/numberfield/intl/zh-TW.json","./packages/@react-aria/numberfield/src/useNumberField.ts"],"sourcesContent":["function $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$defineInteropFlag(a) {\n Object.defineProperty(a, '__esModule', {value: true});\n}\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule') {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n },\n });\n });\n\n return dest;\n}\n\nfunction $parcel$missingModule(name) {\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n}\n\nvar $parcel$global =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\n","{\n \"decrease\": \"خفض {fieldLabel}\",\n \"increase\": \"زيادة {fieldLabel}\",\n \"numberField\": \"حقل رقمي\"\n}\n","{\n \"decrease\": \"Намаляване {fieldLabel}\",\n \"increase\": \"Усилване {fieldLabel}\",\n \"numberField\": \"Номер на полето\"\n}\n","{\n \"decrease\": \"Snížit {fieldLabel}\",\n \"increase\": \"Zvýšit {fieldLabel}\",\n \"numberField\": \"Číselné pole\"\n}\n","{\n \"decrease\": \"Reducer {fieldLabel}\",\n \"increase\": \"Øg {fieldLabel}\",\n \"numberField\": \"Talfelt\"\n}\n","{\n \"decrease\": \"{fieldLabel} verringern\",\n \"increase\": \"{fieldLabel} erhöhen\",\n \"numberField\": \"Nummernfeld\"\n}\n","{\n \"decrease\": \"Μείωση {fieldLabel}\",\n \"increase\": \"Αύξηση {fieldLabel}\",\n \"numberField\": \"Πεδίο αριθμού\"\n}\n","{\n \"decrease\": \"Decrease {fieldLabel}\",\n \"increase\": \"Increase {fieldLabel}\",\n \"numberField\": \"Number field\"\n}\n","{\n \"decrease\": \"Reducir {fieldLabel}\",\n \"increase\": \"Aumentar {fieldLabel}\",\n \"numberField\": \"Campo de número\"\n}\n","{\n \"decrease\": \"Vähenda {fieldLabel}\",\n \"increase\": \"Suurenda {fieldLabel}\",\n \"numberField\": \"Numbri väli\"\n}\n","{\n \"decrease\": \"Vähennä {fieldLabel}\",\n \"increase\": \"Lisää {fieldLabel}\",\n \"numberField\": \"Numerokenttä\"\n}\n","{\n \"decrease\": \"Diminuer {fieldLabel}\",\n \"increase\": \"Augmenter {fieldLabel}\",\n \"numberField\": \"Champ de nombre\"\n}\n","{\n \"decrease\": \"הקטן {fieldLabel}\",\n \"increase\": \"הגדל {fieldLabel}\",\n \"numberField\": \"שדה מספר\"\n}\n","{\n \"decrease\": \"Smanji {fieldLabel}\",\n \"increase\": \"Povećaj {fieldLabel}\",\n \"numberField\": \"Polje broja\"\n}\n","{\n \"decrease\": \"{fieldLabel} csökkentése\",\n \"increase\": \"{fieldLabel} növelése\",\n \"numberField\": \"Számmező\"\n}\n","{\n \"decrease\": \"Riduci {fieldLabel}\",\n \"increase\": \"Aumenta {fieldLabel}\",\n \"numberField\": \"Campo numero\"\n}\n","{\n \"decrease\": \"{fieldLabel}を縮小\",\n \"increase\": \"{fieldLabel}を拡大\",\n \"numberField\": \"数値フィールド\"\n}\n","{\n \"decrease\": \"{fieldLabel} 감소\",\n \"increase\": \"{fieldLabel} 증가\",\n \"numberField\": \"번호 필드\"\n}\n","{\n \"decrease\": \"Sumažinti {fieldLabel}\",\n \"increase\": \"Padidinti {fieldLabel}\",\n \"numberField\": \"Numerio laukas\"\n}\n","{\n \"decrease\": \"Samazināšana {fieldLabel}\",\n \"increase\": \"Palielināšana {fieldLabel}\",\n \"numberField\": \"Skaitļu lauks\"\n}\n","{\n \"decrease\": \"Reduser {fieldLabel}\",\n \"increase\": \"Øk {fieldLabel}\",\n \"numberField\": \"Tallfelt\"\n}\n","{\n \"decrease\": \"{fieldLabel} verlagen\",\n \"increase\": \"{fieldLabel} verhogen\",\n \"numberField\": \"Getalveld\"\n}\n","{\n \"decrease\": \"Zmniejsz {fieldLabel}\",\n \"increase\": \"Zwiększ {fieldLabel}\",\n \"numberField\": \"Pole numeru\"\n}\n","{\n \"decrease\": \"Diminuir {fieldLabel}\",\n \"increase\": \"Aumentar {fieldLabel}\",\n \"numberField\": \"Campo de número\"\n}\n","{\n \"decrease\": \"Diminuir {fieldLabel}\",\n \"increase\": \"Aumentar {fieldLabel}\",\n \"numberField\": \"Campo numérico\"\n}\n","{\n \"decrease\": \"Scădere {fieldLabel}\",\n \"increase\": \"Creștere {fieldLabel}\",\n \"numberField\": \"Câmp numeric\"\n}\n","{\n \"decrease\": \"Уменьшение {fieldLabel}\",\n \"increase\": \"Увеличение {fieldLabel}\",\n \"numberField\": \"Числовое поле\"\n}\n","{\n \"decrease\": \"Znížiť {fieldLabel}\",\n \"increase\": \"Zvýšiť {fieldLabel}\",\n \"numberField\": \"Číselné pole\"\n}\n","{\n \"decrease\": \"Upadati {fieldLabel}\",\n \"increase\": \"Povečajte {fieldLabel}\",\n \"numberField\": \"Številčno polje\"\n}\n","{\n \"decrease\": \"Decrease {fieldLabel}\",\n \"increase\": \"Increase {fieldLabel}\",\n \"numberField\": \"Number field\"\n}\n","{\n \"decrease\": \"Minska {fieldLabel}\",\n \"increase\": \"Öka {fieldLabel}\",\n \"numberField\": \"Nummerfält\"\n}\n","{\n \"decrease\": \"{fieldLabel} azalt\",\n \"increase\": \"{fieldLabel} arttır\",\n \"numberField\": \"Sayı alanı\"\n}\n","{\n \"decrease\": \"Зменшити {fieldLabel}\",\n \"increase\": \"Збільшити {fieldLabel}\",\n \"numberField\": \"Поле номера\"\n}\n","{\n \"decrease\": \"降低 {fieldLabel}\",\n \"increase\": \"提高 {fieldLabel}\",\n \"numberField\": \"数字字段\"\n}\n","{\n \"decrease\": \"縮小 {fieldLabel}\",\n \"increase\": \"放大 {fieldLabel}\",\n \"numberField\": \"數字欄位\"\n}\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 {AriaButtonProps} from '@react-types/button';\nimport {AriaNumberFieldProps} from '@react-types/numberfield';\nimport {\n HTMLAttributes,\n InputHTMLAttributes,\n LabelHTMLAttributes,\n RefObject,\n useCallback,\n useEffect,\n useMemo,\n useRef\n} from 'react';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {isAndroid, isIOS, isIPhone, mergeProps, useId} from '@react-aria/utils';\nimport {NumberFieldState} from '@react-stately/numberfield';\nimport {TextInputDOMProps} from '@react-types/shared';\nimport {useFocus} from '@react-aria/interactions';\nimport {\n useMessageFormatter,\n useNumberFormatter\n} from '@react-aria/i18n';\nimport {useSpinButton} from '@react-aria/spinbutton';\nimport {useTextField} from '@react-aria/textfield';\n\ninterface NumberFieldAria {\n /** Props for the label element. */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>,\n /** Props for the group wrapper around the input and stepper buttons. */\n groupProps: HTMLAttributes<HTMLElement>,\n /** Props for the input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n /** Props for the increment button, to be passed to [useButton](useButton.html). */\n incrementButtonProps: AriaButtonProps,\n /** Props for the decrement button, to be passed to [useButton](useButton.html). */\n decrementButtonProps: AriaButtonProps\n}\n\nfunction supportsNativeBeforeInputEvent() {\n return typeof window !== 'undefined' &&\n window.InputEvent &&\n // @ts-ignore\n typeof InputEvent.prototype.getTargetRanges === 'function';\n}\n\n/**\n * Provides the behavior and accessibility implementation for a number field component.\n * Number fields allow users to enter a number, and increment or decrement the value using stepper buttons.\n */\nexport function useNumberField(props: AriaNumberFieldProps, state: NumberFieldState, inputRef: RefObject<HTMLInputElement>): NumberFieldAria {\n let {\n id,\n decrementAriaLabel,\n incrementAriaLabel,\n isDisabled,\n isReadOnly,\n isRequired,\n minValue,\n maxValue,\n autoFocus,\n validationState,\n label,\n formatOptions\n } = props;\n\n let {\n increment,\n incrementToMax,\n decrement,\n decrementToMin,\n numberValue,\n commit\n } = state;\n\n const formatMessage = useMessageFormatter(intlMessages);\n\n let inputId = useId(id);\n\n let {focusProps} = useFocus({\n onBlur: () => {\n // Set input value to normalized valid value\n commit();\n }\n });\n\n let {\n spinButtonProps,\n incrementButtonProps: incButtonProps,\n decrementButtonProps: decButtonProps\n } = useSpinButton(\n {\n isDisabled,\n isReadOnly,\n isRequired,\n maxValue,\n minValue,\n onIncrement: increment,\n onIncrementToMax: incrementToMax,\n onDecrement: decrement,\n onDecrementToMin: decrementToMin,\n value: numberValue,\n textValue: state.inputValue\n }\n );\n\n let onWheel = useCallback((e) => {\n // If the input isn't supposed to receive input, do nothing.\n // If the ctrlKey is pressed, this is a zoom event, do nothing.\n if (isDisabled || isReadOnly || e.ctrlKey) {\n return;\n }\n\n // stop scrolling the page\n e.preventDefault();\n\n if (e.deltaY > 0) {\n increment();\n } else if (e.deltaY < 0) {\n decrement();\n }\n }, [isReadOnly, isDisabled, decrement, increment]);\n useScrollWheel({onScroll: onWheel, capture: false}, inputRef);\n\n // The inputMode attribute influences the software keyboard that is shown on touch devices.\n // Browsers and operating systems are quite inconsistent about what keys are available, however.\n // We choose between numeric and decimal based on whether we allow negative and fractional numbers,\n // and based on testing on various devices to determine what keys are available in each inputMode.\n let numberFormatter = useNumberFormatter(formatOptions);\n let intlOptions = useMemo(() => numberFormatter.resolvedOptions(), [numberFormatter]);\n let hasDecimals = intlOptions.maximumFractionDigits > 0;\n let hasNegative = isNaN(state.minValue) || state.minValue < 0;\n let inputMode: TextInputDOMProps['inputMode'] = 'numeric';\n if (isIPhone()) {\n // iPhone doesn't have a minus sign in either numeric or decimal.\n // Note this is only for iPhone, not iPad, which always has both\n // minus and decimal in numeric.\n if (hasNegative) {\n inputMode = 'text';\n } else if (hasDecimals) {\n inputMode = 'decimal';\n }\n } else if (isAndroid()) {\n // Android numeric has both a decimal point and minus key.\n // decimal does not have a minus key.\n if (hasNegative) {\n inputMode = 'numeric';\n } else if (hasDecimals) {\n inputMode = 'decimal';\n }\n }\n\n let stateRef = useRef(state);\n stateRef.current = state;\n\n // All browsers implement the 'beforeinput' event natively except Firefox\n // (currently behind a flag as of Firefox 84). React's polyfill does not\n // run in all cases that the native event fires, e.g. when deleting text.\n // Use the native event if available so that we can prevent invalid deletions.\n // We do not attempt to polyfill this in Firefox since it would be very complicated,\n // the benefit of doing so is fairly minor, and it's going to be natively supported soon.\n useEffect(() => {\n if (!supportsNativeBeforeInputEvent()) {\n return;\n }\n\n let input = inputRef.current;\n\n let onBeforeInput = (e: InputEvent) => {\n let state = stateRef.current;\n\n // Compute the next value of the input if the event is allowed to proceed.\n // See https://www.w3.org/TR/input-events-2/#interface-InputEvent-Attributes for a full list of input types.\n let nextValue: string;\n switch (e.inputType) {\n case 'historyUndo':\n case 'historyRedo':\n // Explicitly allow undo/redo. e.data is null in this case, but there's no need to validate,\n // because presumably the input would have already been validated previously.\n return;\n case 'deleteContent':\n case 'deleteByCut':\n case 'deleteByDrag':\n nextValue = input.value.slice(0, input.selectionStart) + input.value.slice(input.selectionEnd);\n break;\n case 'deleteContentForward':\n // This is potentially incorrect, since the browser may actually delete more than a single UTF-16\n // character. In reality, a full Unicode grapheme cluster consisting of multiple UTF-16 characters\n // or code points may be deleted. However, in our currently supported locales, there are no such cases.\n // If we support additional locales in the future, this may need to change.\n nextValue = input.selectionEnd === input.selectionStart\n ? input.value.slice(0, input.selectionStart) + input.value.slice(input.selectionEnd + 1)\n : input.value.slice(0, input.selectionStart) + input.value.slice(input.selectionEnd);\n break;\n case 'deleteContentBackward':\n nextValue = input.selectionEnd === input.selectionStart\n ? input.value.slice(0, input.selectionStart - 1) + input.value.slice(input.selectionStart)\n : input.value.slice(0, input.selectionStart) + input.value.slice(input.selectionEnd);\n break;\n default:\n if (e.data != null) {\n nextValue =\n input.value.slice(0, input.selectionStart) +\n e.data +\n input.value.slice(input.selectionEnd);\n }\n break;\n }\n\n // If we did not compute a value, or the new value is invalid, prevent the event\n // so that the browser does not update the input text, move the selection, or add to\n // the undo/redo stack.\n if (nextValue == null || !state.validate(nextValue)) {\n e.preventDefault();\n }\n };\n\n input.addEventListener('beforeinput', onBeforeInput, false);\n return () => {\n input.removeEventListener('beforeinput', onBeforeInput, false);\n };\n }, [inputRef, stateRef]);\n\n let onBeforeInput = !supportsNativeBeforeInputEvent()\n ? e => {\n let nextValue =\n e.target.value.slice(0, e.target.selectionStart) +\n e.data +\n e.target.value.slice(e.target.selectionEnd);\n\n if (!state.validate(nextValue)) {\n e.preventDefault();\n }\n }\n : null;\n\n let onChange = value => {\n state.setInputValue(value);\n };\n\n let compositionStartState = useRef(null);\n let {labelProps, inputProps: textFieldProps} = useTextField({\n label,\n autoFocus,\n isDisabled,\n isReadOnly,\n isRequired,\n validationState,\n value: state.inputValue,\n autoComplete: 'off',\n 'aria-label': props['aria-label'] || null,\n 'aria-labelledby': props['aria-labelledby'] || null,\n id: inputId,\n type: 'text', // Can't use type=\"number\" because then we can't have things like $ in the field.\n inputMode,\n onChange,\n onBeforeInput,\n onCompositionStart() {\n // Chrome does not implement Input Events Level 2, which specifies the insertFromComposition\n // and deleteByComposition inputType values for the beforeinput event. These are meant to occur\n // at the end of a composition (e.g. Pinyin IME, Android auto correct, etc.), and crucially, are\n // cancelable. The insertCompositionText and deleteCompositionText input types are not cancelable,\n // nor would we want to cancel them because the input from the user is incomplete at that point.\n // In Safari, insertFromComposition/deleteFromComposition will fire, however, allowing us to cancel\n // the final composition result if it is invalid. As a fallback for Chrome and Firefox, which either\n // don't support Input Events Level 2, or beforeinput at all, we store the state of the input when\n // the compositionstart event fires, and undo the changes in compositionend (below) if it is invalid.\n // Unfortunately, this messes up the undo/redo stack, but until insertFromComposition/deleteByComposition\n // are implemented, there is no other way to prevent composed input.\n // See https://bugs.chromium.org/p/chromium/issues/detail?id=1022204\n let {value, selectionStart, selectionEnd} = inputRef.current;\n compositionStartState.current = {value, selectionStart, selectionEnd};\n },\n onCompositionEnd() {\n if (!state.validate(inputRef.current.value)) {\n // Restore the input value in the DOM immediately so we can synchronously update the selection position.\n // But also update the value in React state as well so it is correct for future updates.\n let {value, selectionStart, selectionEnd} = compositionStartState.current;\n inputRef.current.value = value;\n inputRef.current.setSelectionRange(selectionStart, selectionEnd);\n state.setInputValue(value);\n }\n }\n }, inputRef);\n\n let inputProps = mergeProps(\n spinButtonProps,\n textFieldProps,\n focusProps,\n {\n // override the spinbutton role, we can't focus a spin button with VO\n role: null,\n // ignore aria-roledescription on iOS so that required state will announce when it is present\n 'aria-roledescription': (!isIOS() ? formatMessage('numberField') : null),\n 'aria-valuemax': null,\n 'aria-valuemin': null,\n 'aria-valuenow': null,\n 'aria-valuetext': null,\n autoCorrect: 'off',\n spellCheck: 'false'\n }\n );\n\n let onButtonPressStart = (e) => {\n // If focus is already on the input, keep it there so we don't hide the\n // software keyboard when tapping the increment/decrement buttons.\n if (document.activeElement === inputRef.current) {\n return;\n }\n\n // Otherwise, when using a mouse, move focus to the input.\n // On touch, or with a screen reader, focus the button so that the software\n // keyboard does not appear and the screen reader cursor is not moved off the button.\n if (e.pointerType === 'mouse') {\n inputRef.current.focus();\n } else {\n e.target.focus();\n }\n };\n\n // Determine the label for the increment and decrement buttons. There are 4 cases:\n //\n // 1. With a visible label that is a string: aria-label: `Increase ${props.label}`\n // 2. With a visible label that is JSX: aria-label: 'Increase', aria-labelledby: '${incrementId} ${labelId}'\n // 3. With an aria-label: aria-label: `Increase ${props['aria-label']}`\n // 4. With an aria-labelledby: aria-label: 'Increase', aria-labelledby: `${incrementId} ${props['aria-labelledby']}`\n //\n // (1) and (2) could possibly be combined and both use aria-labelledby. However, placing the label in\n // the aria-label string rather than using aria-labelledby gives more flexibility to translators to change\n // the order or add additional words around the label if needed.\n let fieldLabel = props['aria-label'] || (typeof props.label === 'string' ? props.label : '');\n let ariaLabelledby: string;\n if (!fieldLabel) {\n ariaLabelledby = props.label != null ? labelProps.id : props['aria-labelledby'];\n }\n\n let incrementId = useId();\n let decrementId = useId();\n\n let incrementButtonProps: AriaButtonProps = mergeProps(incButtonProps, {\n 'aria-label': incrementAriaLabel || formatMessage('increase', {fieldLabel}).trim(),\n id: ariaLabelledby && !incrementAriaLabel ? incrementId : null,\n 'aria-labelledby': ariaLabelledby && !incrementAriaLabel ? `${incrementId} ${ariaLabelledby}` : null,\n 'aria-controls': inputId,\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n isDisabled: !state.canIncrement,\n onPressStart: onButtonPressStart\n });\n\n let decrementButtonProps: AriaButtonProps = mergeProps(decButtonProps, {\n 'aria-label': decrementAriaLabel || formatMessage('decrease', {fieldLabel}).trim(),\n id: ariaLabelledby && !decrementAriaLabel ? decrementId : null,\n 'aria-labelledby': ariaLabelledby && !decrementAriaLabel ? `${decrementId} ${ariaLabelledby}` : null,\n 'aria-controls': inputId,\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n isDisabled: !state.canDecrement,\n onPressStart: onButtonPressStart\n });\n\n return {\n groupProps: {\n role: 'group',\n 'aria-disabled': isDisabled,\n 'aria-invalid': validationState === 'invalid' ? 'true' : undefined\n },\n labelProps,\n inputProps,\n incrementButtonProps,\n decrementButtonProps\n };\n}\n\n// scroll wheel needs to be added not passively so it's cancelable, small helper hook to remember that\nfunction useScrollWheel({onScroll, capture}: {onScroll: (e) => void, capture: boolean}, ref: RefObject<HTMLElement>) {\n useEffect(() => {\n let elem = ref.current;\n elem.addEventListener('wheel', onScroll, capture);\n\n return () => {\n elem.removeEventListener('wheel', onScroll, capture);\n };\n }, [onScroll, ref, capture]);\n}\n"],"names":["$parcel$interopDefault","a","__esModule","default","JSON","parse","supportsNativeBeforeInputEvent","window","InputEvent","prototype","getTargetRanges","useNumberField","props","state","inputRef","id","decrementAriaLabel","incrementAriaLabel","isDisabled","isReadOnly","isRequired","minValue","maxValue","autoFocus","validationState","label","formatOptions","increment","incrementToMax","decrement","decrementToMin","numberValue","commit","formatMessage","useMessageFormatter","intlMessages","inputId","useId","focusProps","useFocus","onBlur","spinButtonProps","incrementButtonProps","incButtonProps","decrementButtonProps","decButtonProps","useSpinButton","onIncrement","onIncrementToMax","onDecrement","onDecrementToMin","value","textValue","inputValue","onWheel","useCallback","e","ctrlKey","preventDefault","deltaY","useScrollWheel","onScroll","capture","numberFormatter","useNumberFormatter","intlOptions","useMemo","resolvedOptions","hasDecimals","maximumFractionDigits","hasNegative","isNaN","inputMode","isIPhone","isAndroid","stateRef","useRef","current","useEffect","input","onBeforeInput","nextValue","inputType","slice","selectionStart","selectionEnd","data","validate","addEventListener","removeEventListener","target","onChange","setInputValue","compositionStartState","labelProps","inputProps","textFieldProps","useTextField","autoComplete","type","onCompositionStart","onCompositionEnd","setSelectionRange","mergeProps","role","isIOS","autoCorrect","spellCheck","onButtonPressStart","document","activeElement","pointerType","focus","fieldLabel","ariaLabelledby","incrementId","decrementId","trim","excludeFromTabOrder","preventFocusOnPress","canIncrement","onPressStart","canDecrement","groupProps","undefined","ref","elem"],"version":3,"file":"main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,sBAAT,CAAgCC,CAAhC,EAAmC;AACjC,SAAOA,CAAC,IAAIA,CAAC,CAACC,UAAP,GAAoBD,CAAC,CAACE,OAAtB,GAAgCF,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/@react-aria/numberfield/intl/bg-BG.json","./packages/@react-aria/numberfield/intl/cs-CZ.json","./packages/@react-aria/numberfield/intl/da-DK.json","./packages/@react-aria/numberfield/intl/de-DE.json","./packages/@react-aria/numberfield/intl/el-GR.json","./packages/@react-aria/numberfield/intl/en-US.json","./packages/@react-aria/numberfield/intl/es-ES.json","./packages/@react-aria/numberfield/intl/et-EE.json","./packages/@react-aria/numberfield/intl/fi-FI.json","./packages/@react-aria/numberfield/intl/fr-FR.json","./packages/@react-aria/numberfield/intl/he-IL.json","./packages/@react-aria/numberfield/intl/hr-HR.json","./packages/@react-aria/numberfield/intl/hu-HU.json","./packages/@react-aria/numberfield/intl/it-IT.json","./packages/@react-aria/numberfield/intl/ja-JP.json","./packages/@react-aria/numberfield/intl/ko-KR.json","./packages/@react-aria/numberfield/intl/lt-LT.json","./packages/@react-aria/numberfield/intl/lv-LV.json","./packages/@react-aria/numberfield/intl/nb-NO.json","./packages/@react-aria/numberfield/intl/nl-NL.json","./packages/@react-aria/numberfield/intl/pl-PL.json","./packages/@react-aria/numberfield/intl/pt-BR.json","./packages/@react-aria/numberfield/intl/pt-PT.json","./packages/@react-aria/numberfield/intl/ro-RO.json","./packages/@react-aria/numberfield/intl/ru-RU.json","./packages/@react-aria/numberfield/intl/sk-SK.json","./packages/@react-aria/numberfield/intl/sl-SI.json","./packages/@react-aria/numberfield/intl/sr-SP.json","./packages/@react-aria/numberfield/intl/sv-SE.json","./packages/@react-aria/numberfield/intl/tr-TR.json","./packages/@react-aria/numberfield/intl/uk-UA.json","./packages/@react-aria/numberfield/intl/zh-CN.json","./packages/@react-aria/numberfield/intl/zh-TW.json","./packages/@react-aria/numberfield/src/useNumberField.ts"],"sourcesContent":["function $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$defineInteropFlag(a) {\n Object.defineProperty(a, '__esModule', {value: true});\n}\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule') {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n },\n });\n });\n\n return dest;\n}\n\nfunction $parcel$missingModule(name) {\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n}\n\nvar $parcel$global =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\n","{\n \"decrease\": \"خفض {fieldLabel}\",\n \"increase\": \"زيادة {fieldLabel}\",\n \"numberField\": \"حقل رقمي\"\n}\n","{\n \"decrease\": \"Намаляване {fieldLabel}\",\n \"increase\": \"Усилване {fieldLabel}\",\n \"numberField\": \"Номер на полето\"\n}\n","{\n \"decrease\": \"Snížit {fieldLabel}\",\n \"increase\": \"Zvýšit {fieldLabel}\",\n \"numberField\": \"Číselné pole\"\n}\n","{\n \"decrease\": \"Reducer {fieldLabel}\",\n \"increase\": \"Øg {fieldLabel}\",\n \"numberField\": \"Talfelt\"\n}\n","{\n \"decrease\": \"{fieldLabel} verringern\",\n \"increase\": \"{fieldLabel} erhöhen\",\n \"numberField\": \"Nummernfeld\"\n}\n","{\n \"decrease\": \"Μείωση {fieldLabel}\",\n \"increase\": \"Αύξηση {fieldLabel}\",\n \"numberField\": \"Πεδίο αριθμού\"\n}\n","{\n \"decrease\": \"Decrease {fieldLabel}\",\n \"increase\": \"Increase {fieldLabel}\",\n \"numberField\": \"Number field\"\n}\n","{\n \"decrease\": \"Reducir {fieldLabel}\",\n \"increase\": \"Aumentar {fieldLabel}\",\n \"numberField\": \"Campo de número\"\n}\n","{\n \"decrease\": \"Vähenda {fieldLabel}\",\n \"increase\": \"Suurenda {fieldLabel}\",\n \"numberField\": \"Numbri väli\"\n}\n","{\n \"decrease\": \"Vähennä {fieldLabel}\",\n \"increase\": \"Lisää {fieldLabel}\",\n \"numberField\": \"Numerokenttä\"\n}\n","{\n \"decrease\": \"Diminuer {fieldLabel}\",\n \"increase\": \"Augmenter {fieldLabel}\",\n \"numberField\": \"Champ de nombre\"\n}\n","{\n \"decrease\": \"הקטן {fieldLabel}\",\n \"increase\": \"הגדל {fieldLabel}\",\n \"numberField\": \"שדה מספר\"\n}\n","{\n \"decrease\": \"Smanji {fieldLabel}\",\n \"increase\": \"Povećaj {fieldLabel}\",\n \"numberField\": \"Polje broja\"\n}\n","{\n \"decrease\": \"{fieldLabel} csökkentése\",\n \"increase\": \"{fieldLabel} növelése\",\n \"numberField\": \"Számmező\"\n}\n","{\n \"decrease\": \"Riduci {fieldLabel}\",\n \"increase\": \"Aumenta {fieldLabel}\",\n \"numberField\": \"Campo numero\"\n}\n","{\n \"decrease\": \"{fieldLabel}を縮小\",\n \"increase\": \"{fieldLabel}を拡大\",\n \"numberField\": \"数値フィールド\"\n}\n","{\n \"decrease\": \"{fieldLabel} 감소\",\n \"increase\": \"{fieldLabel} 증가\",\n \"numberField\": \"번호 필드\"\n}\n","{\n \"decrease\": \"Sumažinti {fieldLabel}\",\n \"increase\": \"Padidinti {fieldLabel}\",\n \"numberField\": \"Numerio laukas\"\n}\n","{\n \"decrease\": \"Samazināšana {fieldLabel}\",\n \"increase\": \"Palielināšana {fieldLabel}\",\n \"numberField\": \"Skaitļu lauks\"\n}\n","{\n \"decrease\": \"Reduser {fieldLabel}\",\n \"increase\": \"Øk {fieldLabel}\",\n \"numberField\": \"Tallfelt\"\n}\n","{\n \"decrease\": \"{fieldLabel} verlagen\",\n \"increase\": \"{fieldLabel} verhogen\",\n \"numberField\": \"Getalveld\"\n}\n","{\n \"decrease\": \"Zmniejsz {fieldLabel}\",\n \"increase\": \"Zwiększ {fieldLabel}\",\n \"numberField\": \"Pole numeru\"\n}\n","{\n \"decrease\": \"Diminuir {fieldLabel}\",\n \"increase\": \"Aumentar {fieldLabel}\",\n \"numberField\": \"Campo de número\"\n}\n","{\n \"decrease\": \"Diminuir {fieldLabel}\",\n \"increase\": \"Aumentar {fieldLabel}\",\n \"numberField\": \"Campo numérico\"\n}\n","{\n \"decrease\": \"Scădere {fieldLabel}\",\n \"increase\": \"Creștere {fieldLabel}\",\n \"numberField\": \"Câmp numeric\"\n}\n","{\n \"decrease\": \"Уменьшение {fieldLabel}\",\n \"increase\": \"Увеличение {fieldLabel}\",\n \"numberField\": \"Числовое поле\"\n}\n","{\n \"decrease\": \"Znížiť {fieldLabel}\",\n \"increase\": \"Zvýšiť {fieldLabel}\",\n \"numberField\": \"Číselné pole\"\n}\n","{\n \"decrease\": \"Upadati {fieldLabel}\",\n \"increase\": \"Povečajte {fieldLabel}\",\n \"numberField\": \"Številčno polje\"\n}\n","{\n \"decrease\": \"Decrease {fieldLabel}\",\n \"increase\": \"Increase {fieldLabel}\",\n \"numberField\": \"Number field\"\n}\n","{\n \"decrease\": \"Minska {fieldLabel}\",\n \"increase\": \"Öka {fieldLabel}\",\n \"numberField\": \"Nummerfält\"\n}\n","{\n \"decrease\": \"{fieldLabel} azalt\",\n \"increase\": \"{fieldLabel} arttır\",\n \"numberField\": \"Sayı alanı\"\n}\n","{\n \"decrease\": \"Зменшити {fieldLabel}\",\n \"increase\": \"Збільшити {fieldLabel}\",\n \"numberField\": \"Поле номера\"\n}\n","{\n \"decrease\": \"降低 {fieldLabel}\",\n \"increase\": \"提高 {fieldLabel}\",\n \"numberField\": \"数字字段\"\n}\n","{\n \"decrease\": \"縮小 {fieldLabel}\",\n \"increase\": \"放大 {fieldLabel}\",\n \"numberField\": \"數字欄位\"\n}\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 {AriaButtonProps} from '@react-types/button';\nimport {AriaNumberFieldProps} from '@react-types/numberfield';\nimport {filterDOMProps, isAndroid, isIOS, isIPhone, mergeProps, useId} from '@react-aria/utils';\nimport {\n HTMLAttributes,\n InputHTMLAttributes,\n LabelHTMLAttributes,\n RefObject,\n useCallback,\n useMemo,\n useState\n} from 'react';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {NumberFieldState} from '@react-stately/numberfield';\nimport {TextInputDOMProps} from '@react-types/shared';\nimport {useFocus, useFocusWithin} from '@react-aria/interactions';\nimport {useFormattedTextField} from '@react-aria/textfield';\nimport {\n useMessageFormatter,\n useNumberFormatter\n} from '@react-aria/i18n';\nimport {useScrollWheel} from '@react-aria/interactions';\nimport {useSpinButton} from '@react-aria/spinbutton';\n\ninterface NumberFieldAria {\n /** Props for the label element. */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>,\n /** Props for the group wrapper around the input and stepper buttons. */\n groupProps: HTMLAttributes<HTMLElement>,\n /** Props for the input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n /** Props for the increment button, to be passed to [useButton](useButton.html). */\n incrementButtonProps: AriaButtonProps,\n /** Props for the decrement button, to be passed to [useButton](useButton.html). */\n decrementButtonProps: AriaButtonProps,\n /** Props for the number field's description element, if any. */\n descriptionProps: HTMLAttributes<HTMLElement>,\n /** Props for the number field's error message element, if any. */\n errorMessageProps: HTMLAttributes<HTMLElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a number field component.\n * Number fields allow users to enter a number, and increment or decrement the value using stepper buttons.\n */\nexport function useNumberField(props: AriaNumberFieldProps, state: NumberFieldState, inputRef: RefObject<HTMLInputElement>): NumberFieldAria {\n let {\n id,\n decrementAriaLabel,\n incrementAriaLabel,\n isDisabled,\n isReadOnly,\n isRequired,\n minValue,\n maxValue,\n autoFocus,\n validationState,\n label,\n formatOptions,\n onBlur,\n onFocus,\n onFocusChange,\n onKeyDown,\n onKeyUp,\n description,\n errorMessage\n } = props;\n\n let {\n increment,\n incrementToMax,\n decrement,\n decrementToMin,\n numberValue,\n commit\n } = state;\n\n const formatMessage = useMessageFormatter(intlMessages);\n\n let inputId = useId(id);\n\n let {focusProps} = useFocus({\n onBlur: () => {\n // Set input value to normalized valid value\n commit();\n }\n });\n\n let {\n spinButtonProps,\n incrementButtonProps: incButtonProps,\n decrementButtonProps: decButtonProps\n } = useSpinButton(\n {\n isDisabled,\n isReadOnly,\n isRequired,\n maxValue,\n minValue,\n onIncrement: increment,\n onIncrementToMax: incrementToMax,\n onDecrement: decrement,\n onDecrementToMin: decrementToMin,\n value: numberValue,\n textValue: state.inputValue\n }\n );\n\n let [focusWithin, setFocusWithin] = useState(false);\n let {focusWithinProps} = useFocusWithin({isDisabled, onFocusWithinChange: setFocusWithin});\n\n let onWheel = useCallback((e) => {\n // if on a trackpad, users can scroll in both X and Y at once, check the magnitude of the change\n // if it's mostly in the X direction, then just return, the user probably doesn't mean to inc/dec\n // this isn't perfect, events come in fast with small deltas and a part of the scroll may give a false indication\n // especially if the user is scrolling near 45deg\n if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) {\n return;\n }\n if (e.deltaY > 0) {\n increment();\n } else if (e.deltaY < 0) {\n decrement();\n }\n }, [decrement, increment]);\n // If the input isn't supposed to receive input, disable scrolling.\n let scrollingDisabled = isDisabled || isReadOnly || !focusWithin;\n useScrollWheel({onScroll: onWheel, isDisabled: scrollingDisabled}, inputRef);\n\n // The inputMode attribute influences the software keyboard that is shown on touch devices.\n // Browsers and operating systems are quite inconsistent about what keys are available, however.\n // We choose between numeric and decimal based on whether we allow negative and fractional numbers,\n // and based on testing on various devices to determine what keys are available in each inputMode.\n let numberFormatter = useNumberFormatter(formatOptions);\n let intlOptions = useMemo(() => numberFormatter.resolvedOptions(), [numberFormatter]);\n let hasDecimals = intlOptions.maximumFractionDigits > 0;\n let hasNegative = isNaN(state.minValue) || state.minValue < 0;\n let inputMode: TextInputDOMProps['inputMode'] = 'numeric';\n if (isIPhone()) {\n // iPhone doesn't have a minus sign in either numeric or decimal.\n // Note this is only for iPhone, not iPad, which always has both\n // minus and decimal in numeric.\n if (hasNegative) {\n inputMode = 'text';\n } else if (hasDecimals) {\n inputMode = 'decimal';\n }\n } else if (isAndroid()) {\n // Android numeric has both a decimal point and minus key.\n // decimal does not have a minus key.\n if (hasNegative) {\n inputMode = 'numeric';\n } else if (hasDecimals) {\n inputMode = 'decimal';\n }\n }\n\n let onChange = value => {\n state.setInputValue(value);\n };\n\n let domProps = filterDOMProps(props);\n\n let {labelProps, inputProps: textFieldProps, descriptionProps, errorMessageProps} = useFormattedTextField({\n ...domProps,\n label,\n autoFocus,\n isDisabled,\n isReadOnly,\n isRequired,\n validationState,\n value: state.inputValue,\n autoComplete: 'off',\n 'aria-label': props['aria-label'] || null,\n 'aria-labelledby': props['aria-labelledby'] || null,\n id: inputId,\n type: 'text', // Can't use type=\"number\" because then we can't have things like $ in the field.\n inputMode,\n onChange,\n onBlur,\n onFocus,\n onFocusChange,\n onKeyDown,\n onKeyUp,\n description,\n errorMessage\n }, state, inputRef);\n\n let inputProps = mergeProps(\n spinButtonProps,\n textFieldProps,\n focusProps,\n {\n // override the spinbutton role, we can't focus a spin button with VO\n role: null,\n // ignore aria-roledescription on iOS so that required state will announce when it is present\n 'aria-roledescription': (!isIOS() ? formatMessage('numberField') : null),\n 'aria-valuemax': null,\n 'aria-valuemin': null,\n 'aria-valuenow': null,\n 'aria-valuetext': null,\n autoCorrect: 'off',\n spellCheck: 'false'\n }\n );\n\n let onButtonPressStart = (e) => {\n // If focus is already on the input, keep it there so we don't hide the\n // software keyboard when tapping the increment/decrement buttons.\n if (document.activeElement === inputRef.current) {\n return;\n }\n\n // Otherwise, when using a mouse, move focus to the input.\n // On touch, or with a screen reader, focus the button so that the software\n // keyboard does not appear and the screen reader cursor is not moved off the button.\n if (e.pointerType === 'mouse') {\n inputRef.current.focus();\n } else {\n e.target.focus();\n }\n };\n\n // Determine the label for the increment and decrement buttons. There are 4 cases:\n //\n // 1. With a visible label that is a string: aria-label: `Increase ${props.label}`\n // 2. With a visible label that is JSX: aria-label: 'Increase', aria-labelledby: '${incrementId} ${labelId}'\n // 3. With an aria-label: aria-label: `Increase ${props['aria-label']}`\n // 4. With an aria-labelledby: aria-label: 'Increase', aria-labelledby: `${incrementId} ${props['aria-labelledby']}`\n //\n // (1) and (2) could possibly be combined and both use aria-labelledby. However, placing the label in\n // the aria-label string rather than using aria-labelledby gives more flexibility to translators to change\n // the order or add additional words around the label if needed.\n let fieldLabel = props['aria-label'] || (typeof props.label === 'string' ? props.label : '');\n let ariaLabelledby: string;\n if (!fieldLabel) {\n ariaLabelledby = props.label != null ? labelProps.id : props['aria-labelledby'];\n }\n\n let incrementId = useId();\n let decrementId = useId();\n\n let incrementButtonProps: AriaButtonProps = mergeProps(incButtonProps, {\n 'aria-label': incrementAriaLabel || formatMessage('increase', {fieldLabel}).trim(),\n id: ariaLabelledby && !incrementAriaLabel ? incrementId : null,\n 'aria-labelledby': ariaLabelledby && !incrementAriaLabel ? `${incrementId} ${ariaLabelledby}` : null,\n 'aria-controls': inputId,\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n isDisabled: !state.canIncrement,\n onPressStart: onButtonPressStart\n });\n\n let decrementButtonProps: AriaButtonProps = mergeProps(decButtonProps, {\n 'aria-label': decrementAriaLabel || formatMessage('decrease', {fieldLabel}).trim(),\n id: ariaLabelledby && !decrementAriaLabel ? decrementId : null,\n 'aria-labelledby': ariaLabelledby && !decrementAriaLabel ? `${decrementId} ${ariaLabelledby}` : null,\n 'aria-controls': inputId,\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n isDisabled: !state.canDecrement,\n onPressStart: onButtonPressStart\n });\n\n return {\n groupProps: {\n role: 'group',\n 'aria-disabled': isDisabled,\n 'aria-invalid': validationState === 'invalid' ? 'true' : undefined,\n ...focusWithinProps\n },\n labelProps,\n inputProps,\n incrementButtonProps,\n decrementButtonProps,\n errorMessageProps,\n descriptionProps\n };\n}\n"],"names":["$parcel$interopDefault","a","__esModule","default","JSON","parse","useNumberField","props","state","inputRef","id","decrementAriaLabel","incrementAriaLabel","isDisabled","isReadOnly","isRequired","minValue","maxValue","autoFocus","validationState","label","formatOptions","onBlur","onFocus","onFocusChange","onKeyDown","onKeyUp","description","errorMessage","increment","incrementToMax","decrement","decrementToMin","numberValue","commit","formatMessage","useMessageFormatter","intlMessages","inputId","useId","focusProps","useFocus","spinButtonProps","incrementButtonProps","incButtonProps","decrementButtonProps","decButtonProps","useSpinButton","onIncrement","onIncrementToMax","onDecrement","onDecrementToMin","value","textValue","inputValue","focusWithin","setFocusWithin","useState","focusWithinProps","useFocusWithin","onFocusWithinChange","onWheel","useCallback","e","Math","abs","deltaY","deltaX","scrollingDisabled","useScrollWheel","onScroll","numberFormatter","useNumberFormatter","intlOptions","useMemo","resolvedOptions","hasDecimals","maximumFractionDigits","hasNegative","isNaN","inputMode","isIPhone","isAndroid","onChange","setInputValue","domProps","filterDOMProps","labelProps","inputProps","textFieldProps","descriptionProps","errorMessageProps","useFormattedTextField","autoComplete","type","mergeProps","role","isIOS","autoCorrect","spellCheck","onButtonPressStart","document","activeElement","current","pointerType","focus","target","fieldLabel","ariaLabelledby","incrementId","decrementId","trim","excludeFromTabOrder","preventFocusOnPress","canIncrement","onPressStart","canDecrement","groupProps","undefined"],"version":3,"file":"main.js.map"}
package/dist/module.js CHANGED
@@ -1,10 +1,11 @@
1
- import { useTextField } from "@react-aria/textfield";
2
1
  import { useSpinButton } from "@react-aria/spinbutton";
3
2
  import { useMessageFormatter, useNumberFormatter } from "@react-aria/i18n";
4
- import { useFocus } from "@react-aria/interactions";
5
- import { isAndroid, isIOS, isIPhone, mergeProps, useId } from "@react-aria/utils";
6
- import { useCallback, useEffect, useMemo, useRef } from "react";
3
+ import { useFormattedTextField } from "@react-aria/textfield";
4
+ import { useFocus, useFocusWithin, useScrollWheel } from "@react-aria/interactions";
5
+ import { useCallback, useMemo, useState } from "react";
6
+ import { filterDOMProps, isAndroid, isIOS, isIPhone, mergeProps, useId } from "@react-aria/utils";
7
7
  import _babelRuntimeHelpersEsmInteropRequireDefault from "@babel/runtime/helpers/esm/interopRequireDefault";
8
+ import _babelRuntimeHelpersEsmExtends from "@babel/runtime/helpers/esm/extends";
8
9
  // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-aria/numberfield/intl/ar-AE.json
9
10
  var $f89057a954f93785840632a2bd0de992$exports = {};
10
11
  $f89057a954f93785840632a2bd0de992$exports = JSON.parse("{\"decrease\":\"خفض {fieldLabel}\",\"increase\":\"زيادة {fieldLabel}\",\"numberField\":\"حقل رقمي\"}");
@@ -145,16 +146,10 @@ const $b40e566e8b7705a138eb78aae622eee$var$intlMessages = {
145
146
  "zh-TW": _babelRuntimeHelpersEsmInteropRequireDefault($c2596f5e9c6c63e22526e4ccf47b$exports).default
146
147
  };
147
148
 
148
- function $b40e566e8b7705a138eb78aae622eee$var$supportsNativeBeforeInputEvent() {
149
- return typeof window !== 'undefined' && window.InputEvent && // @ts-ignore
150
- typeof InputEvent.prototype.getTargetRanges === 'function';
151
- }
152
149
  /**
153
150
  * Provides the behavior and accessibility implementation for a number field component.
154
151
  * Number fields allow users to enter a number, and increment or decrement the value using stepper buttons.
155
152
  */
156
-
157
-
158
153
  export function useNumberField(props, state, inputRef) {
159
154
  let {
160
155
  id,
@@ -168,7 +163,14 @@ export function useNumberField(props, state, inputRef) {
168
163
  autoFocus,
169
164
  validationState,
170
165
  label,
171
- formatOptions
166
+ formatOptions,
167
+ onBlur,
168
+ onFocus,
169
+ onFocusChange,
170
+ onKeyDown,
171
+ onKeyUp,
172
+ description,
173
+ errorMessage
172
174
  } = props;
173
175
  let {
174
176
  increment,
@@ -205,25 +207,33 @@ export function useNumberField(props, state, inputRef) {
205
207
  value: numberValue,
206
208
  textValue: state.inputValue
207
209
  });
210
+ let [focusWithin, setFocusWithin] = useState(false);
211
+ let {
212
+ focusWithinProps
213
+ } = useFocusWithin({
214
+ isDisabled,
215
+ onFocusWithinChange: setFocusWithin
216
+ });
208
217
  let onWheel = useCallback(e => {
209
- // If the input isn't supposed to receive input, do nothing.
210
- // If the ctrlKey is pressed, this is a zoom event, do nothing.
211
- if (isDisabled || isReadOnly || e.ctrlKey) {
218
+ // if on a trackpad, users can scroll in both X and Y at once, check the magnitude of the change
219
+ // if it's mostly in the X direction, then just return, the user probably doesn't mean to inc/dec
220
+ // this isn't perfect, events come in fast with small deltas and a part of the scroll may give a false indication
221
+ // especially if the user is scrolling near 45deg
222
+ if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) {
212
223
  return;
213
- } // stop scrolling the page
214
-
215
-
216
- e.preventDefault();
224
+ }
217
225
 
218
226
  if (e.deltaY > 0) {
219
227
  increment();
220
228
  } else if (e.deltaY < 0) {
221
229
  decrement();
222
230
  }
223
- }, [isReadOnly, isDisabled, decrement, increment]);
224
- $b40e566e8b7705a138eb78aae622eee$var$useScrollWheel({
231
+ }, [decrement, increment]); // If the input isn't supposed to receive input, disable scrolling.
232
+
233
+ let scrollingDisabled = isDisabled || isReadOnly || !focusWithin;
234
+ useScrollWheel({
225
235
  onScroll: onWheel,
226
- capture: false
236
+ isDisabled: scrollingDisabled
227
237
  }, inputRef); // The inputMode attribute influences the software keyboard that is shown on touch devices.
228
238
  // Browsers and operating systems are quite inconsistent about what keys are available, however.
229
239
  // We choose between numeric and decimal based on whether we allow negative and fractional numbers,
@@ -254,90 +264,17 @@ export function useNumberField(props, state, inputRef) {
254
264
  }
255
265
  }
256
266
 
257
- let stateRef = useRef(state);
258
- stateRef.current = state; // All browsers implement the 'beforeinput' event natively except Firefox
259
- // (currently behind a flag as of Firefox 84). React's polyfill does not
260
- // run in all cases that the native event fires, e.g. when deleting text.
261
- // Use the native event if available so that we can prevent invalid deletions.
262
- // We do not attempt to polyfill this in Firefox since it would be very complicated,
263
- // the benefit of doing so is fairly minor, and it's going to be natively supported soon.
264
-
265
- useEffect(() => {
266
- if (!$b40e566e8b7705a138eb78aae622eee$var$supportsNativeBeforeInputEvent()) {
267
- return;
268
- }
269
-
270
- let input = inputRef.current;
271
-
272
- let onBeforeInput = e => {
273
- let state = stateRef.current; // Compute the next value of the input if the event is allowed to proceed.
274
- // See https://www.w3.org/TR/input-events-2/#interface-InputEvent-Attributes for a full list of input types.
275
-
276
- let nextValue;
277
-
278
- switch (e.inputType) {
279
- case 'historyUndo':
280
- case 'historyRedo':
281
- // Explicitly allow undo/redo. e.data is null in this case, but there's no need to validate,
282
- // because presumably the input would have already been validated previously.
283
- return;
284
-
285
- case 'deleteContent':
286
- case 'deleteByCut':
287
- case 'deleteByDrag':
288
- nextValue = input.value.slice(0, input.selectionStart) + input.value.slice(input.selectionEnd);
289
- break;
290
-
291
- case 'deleteContentForward':
292
- // This is potentially incorrect, since the browser may actually delete more than a single UTF-16
293
- // character. In reality, a full Unicode grapheme cluster consisting of multiple UTF-16 characters
294
- // or code points may be deleted. However, in our currently supported locales, there are no such cases.
295
- // If we support additional locales in the future, this may need to change.
296
- nextValue = input.selectionEnd === input.selectionStart ? input.value.slice(0, input.selectionStart) + input.value.slice(input.selectionEnd + 1) : input.value.slice(0, input.selectionStart) + input.value.slice(input.selectionEnd);
297
- break;
298
-
299
- case 'deleteContentBackward':
300
- nextValue = input.selectionEnd === input.selectionStart ? input.value.slice(0, input.selectionStart - 1) + input.value.slice(input.selectionStart) : input.value.slice(0, input.selectionStart) + input.value.slice(input.selectionEnd);
301
- break;
302
-
303
- default:
304
- if (e.data != null) {
305
- nextValue = input.value.slice(0, input.selectionStart) + e.data + input.value.slice(input.selectionEnd);
306
- }
307
-
308
- break;
309
- } // If we did not compute a value, or the new value is invalid, prevent the event
310
- // so that the browser does not update the input text, move the selection, or add to
311
- // the undo/redo stack.
312
-
313
-
314
- if (nextValue == null || !state.validate(nextValue)) {
315
- e.preventDefault();
316
- }
317
- };
318
-
319
- input.addEventListener('beforeinput', onBeforeInput, false);
320
- return () => {
321
- input.removeEventListener('beforeinput', onBeforeInput, false);
322
- };
323
- }, [inputRef, stateRef]);
324
- let onBeforeInput = !$b40e566e8b7705a138eb78aae622eee$var$supportsNativeBeforeInputEvent() ? e => {
325
- let nextValue = e.target.value.slice(0, e.target.selectionStart) + e.data + e.target.value.slice(e.target.selectionEnd);
326
-
327
- if (!state.validate(nextValue)) {
328
- e.preventDefault();
329
- }
330
- } : null;
331
-
332
267
  let onChange = value => {
333
268
  state.setInputValue(value);
334
269
  };
335
270
 
336
- let compositionStartState = useRef(null);
271
+ let domProps = filterDOMProps(props);
337
272
  let {
338
273
  labelProps,
339
- inputProps: textFieldProps
340
- } = useTextField({
274
+ inputProps: textFieldProps,
275
+ descriptionProps,
276
+ errorMessageProps
277
+ } = useFormattedTextField(_babelRuntimeHelpersEsmExtends({}, domProps, {
341
278
  label,
342
279
  autoFocus,
343
280
  isDisabled,
@@ -353,49 +290,14 @@ export function useNumberField(props, state, inputRef) {
353
290
  // Can't use type="number" because then we can't have things like $ in the field.
354
291
  inputMode,
355
292
  onChange,
356
- onBeforeInput,
357
-
358
- onCompositionStart() {
359
- // Chrome does not implement Input Events Level 2, which specifies the insertFromComposition
360
- // and deleteByComposition inputType values for the beforeinput event. These are meant to occur
361
- // at the end of a composition (e.g. Pinyin IME, Android auto correct, etc.), and crucially, are
362
- // cancelable. The insertCompositionText and deleteCompositionText input types are not cancelable,
363
- // nor would we want to cancel them because the input from the user is incomplete at that point.
364
- // In Safari, insertFromComposition/deleteFromComposition will fire, however, allowing us to cancel
365
- // the final composition result if it is invalid. As a fallback for Chrome and Firefox, which either
366
- // don't support Input Events Level 2, or beforeinput at all, we store the state of the input when
367
- // the compositionstart event fires, and undo the changes in compositionend (below) if it is invalid.
368
- // Unfortunately, this messes up the undo/redo stack, but until insertFromComposition/deleteByComposition
369
- // are implemented, there is no other way to prevent composed input.
370
- // See https://bugs.chromium.org/p/chromium/issues/detail?id=1022204
371
- let {
372
- value,
373
- selectionStart,
374
- selectionEnd
375
- } = inputRef.current;
376
- compositionStartState.current = {
377
- value,
378
- selectionStart,
379
- selectionEnd
380
- };
381
- },
382
-
383
- onCompositionEnd() {
384
- if (!state.validate(inputRef.current.value)) {
385
- // Restore the input value in the DOM immediately so we can synchronously update the selection position.
386
- // But also update the value in React state as well so it is correct for future updates.
387
- let {
388
- value,
389
- selectionStart,
390
- selectionEnd
391
- } = compositionStartState.current;
392
- inputRef.current.value = value;
393
- inputRef.current.setSelectionRange(selectionStart, selectionEnd);
394
- state.setInputValue(value);
395
- }
396
- }
397
-
398
- }, inputRef);
293
+ onBlur,
294
+ onFocus,
295
+ onFocusChange,
296
+ onKeyDown,
297
+ onKeyUp,
298
+ description,
299
+ errorMessage
300
+ }), state, inputRef);
399
301
  let inputProps = mergeProps(spinButtonProps, textFieldProps, focusProps, {
400
302
  // override the spinbutton role, we can't focus a spin button with VO
401
303
  role: null,
@@ -470,29 +372,17 @@ export function useNumberField(props, state, inputRef) {
470
372
  onPressStart: onButtonPressStart
471
373
  });
472
374
  return {
473
- groupProps: {
375
+ groupProps: _babelRuntimeHelpersEsmExtends({
474
376
  role: 'group',
475
377
  'aria-disabled': isDisabled,
476
378
  'aria-invalid': validationState === 'invalid' ? 'true' : undefined
477
- },
379
+ }, focusWithinProps),
478
380
  labelProps,
479
381
  inputProps,
480
382
  incrementButtonProps,
481
- decrementButtonProps
383
+ decrementButtonProps,
384
+ errorMessageProps,
385
+ descriptionProps
482
386
  };
483
- } // scroll wheel needs to be added not passively so it's cancelable, small helper hook to remember that
484
-
485
- function $b40e566e8b7705a138eb78aae622eee$var$useScrollWheel(_ref, ref) {
486
- let {
487
- onScroll,
488
- capture
489
- } = _ref;
490
- useEffect(() => {
491
- let elem = ref.current;
492
- elem.addEventListener('wheel', onScroll, capture);
493
- return () => {
494
- elem.removeEventListener('wheel', onScroll, capture);
495
- };
496
- }, [onScroll, ref, capture]);
497
387
  }
498
388
  //# sourceMappingURL=module.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;AAAA,4CAAiBA,IAAI,CAAC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nB,GAA2CoG,WAA3C,SAA0DF,cAA1D,GAA6E,IAH3B;AAIrE,qBAAiB9E,OAJoD;AAKrEkF,IAAAA,mBAAmB,EAAE,IALgD;AAMrEC,IAAAA,mBAAmB,EAAE,IANgD;AAOrErG,IAAAA,UAAU,EAAE,CAACL,KAAK,CAAC6G,YAPkD;AAQrED,IAAAA,YAAY,EAAEb;AARuD,GAAjB,CAAtD;AAWA,SAAO;AACLe,IAAAA,UAAU,EAAE;AACVnB,MAAAA,IAAI,EAAE,OADI;AAEV,uBAAiBtF,UAFP;AAGV,sBAAgBM,eAAe,KAAK,SAApB,GAAgC,MAAhC,GAAyCoG;AAH/C,KADP;AAML9B,IAAAA,UANK;AAOLC,IAAAA,UAPK;AAQLrD,IAAAA,oBARK;AASLE,IAAAA;AATK,GAAP;AAWD,C,CAED;;AACA,SAASgB,mDAAT,OAAwFiE,GAAxF,EAAqH;AAAA,MAA7F;AAAChE,IAAAA,QAAD;AAAWC,IAAAA;AAAX,GAA6F;AACnHgB,EAAAA,SAAS,CAAC,MAAM;AACd,QAAIgD,IAAI,GAAGD,GAAG,CAAChD,OAAf;AACAiD,IAAAA,IAAI,CAACtC,gBAAL,CAAsB,OAAtB,EAA+B3B,QAA/B,EAAyCC,OAAzC;AAEA,WAAO,MAAM;AACXgE,MAAAA,IAAI,CAACrC,mBAAL,CAAyB,OAAzB,EAAkC5B,QAAlC,EAA4CC,OAA5C;AACD,KAFD;AAGD,GAPQ,EAON,CAACD,QAAD,EAAWgE,GAAX,EAAgB/D,OAAhB,CAPM,CAAT;AAQD","sources":["./packages/@react-aria/numberfield/intl/ar-AE.json","./packages/@react-aria/numberfield/intl/bg-BG.json","./packages/@react-aria/numberfield/intl/cs-CZ.json","./packages/@react-aria/numberfield/intl/da-DK.json","./packages/@react-aria/numberfield/intl/de-DE.json","./packages/@react-aria/numberfield/intl/el-GR.json","./packages/@react-aria/numberfield/intl/en-US.json","./packages/@react-aria/numberfield/intl/es-ES.json","./packages/@react-aria/numberfield/intl/et-EE.json","./packages/@react-aria/numberfield/intl/fi-FI.json","./packages/@react-aria/numberfield/intl/fr-FR.json","./packages/@react-aria/numberfield/intl/he-IL.json","./packages/@react-aria/numberfield/intl/hr-HR.json","./packages/@react-aria/numberfield/intl/hu-HU.json","./packages/@react-aria/numberfield/intl/it-IT.json","./packages/@react-aria/numberfield/intl/ja-JP.json","./packages/@react-aria/numberfield/intl/ko-KR.json","./packages/@react-aria/numberfield/intl/lt-LT.json","./packages/@react-aria/numberfield/intl/lv-LV.json","./packages/@react-aria/numberfield/intl/nb-NO.json","./packages/@react-aria/numberfield/intl/nl-NL.json","./packages/@react-aria/numberfield/intl/pl-PL.json","./packages/@react-aria/numberfield/intl/pt-BR.json","./packages/@react-aria/numberfield/intl/pt-PT.json","./packages/@react-aria/numberfield/intl/ro-RO.json","./packages/@react-aria/numberfield/intl/ru-RU.json","./packages/@react-aria/numberfield/intl/sk-SK.json","./packages/@react-aria/numberfield/intl/sl-SI.json","./packages/@react-aria/numberfield/intl/sr-SP.json","./packages/@react-aria/numberfield/intl/sv-SE.json","./packages/@react-aria/numberfield/intl/tr-TR.json","./packages/@react-aria/numberfield/intl/uk-UA.json","./packages/@react-aria/numberfield/intl/zh-CN.json","./packages/@react-aria/numberfield/intl/zh-TW.json","./packages/@react-aria/numberfield/src/useNumberField.ts"],"sourcesContent":["{\n \"decrease\": \"خفض {fieldLabel}\",\n \"increase\": \"زيادة {fieldLabel}\",\n \"numberField\": \"حقل رقمي\"\n}\n","{\n \"decrease\": \"Намаляване {fieldLabel}\",\n \"increase\": \"Усилване {fieldLabel}\",\n \"numberField\": \"Номер на полето\"\n}\n","{\n \"decrease\": \"Snížit {fieldLabel}\",\n \"increase\": \"Zvýšit {fieldLabel}\",\n \"numberField\": \"Číselné pole\"\n}\n","{\n \"decrease\": \"Reducer {fieldLabel}\",\n \"increase\": \"Øg {fieldLabel}\",\n \"numberField\": \"Talfelt\"\n}\n","{\n \"decrease\": \"{fieldLabel} verringern\",\n \"increase\": \"{fieldLabel} erhöhen\",\n \"numberField\": \"Nummernfeld\"\n}\n","{\n \"decrease\": \"Μείωση {fieldLabel}\",\n \"increase\": \"Αύξηση {fieldLabel}\",\n \"numberField\": \"Πεδίο αριθμού\"\n}\n","{\n \"decrease\": \"Decrease {fieldLabel}\",\n \"increase\": \"Increase {fieldLabel}\",\n \"numberField\": \"Number field\"\n}\n","{\n \"decrease\": \"Reducir {fieldLabel}\",\n \"increase\": \"Aumentar {fieldLabel}\",\n \"numberField\": \"Campo de número\"\n}\n","{\n \"decrease\": \"Vähenda {fieldLabel}\",\n \"increase\": \"Suurenda {fieldLabel}\",\n \"numberField\": \"Numbri väli\"\n}\n","{\n \"decrease\": \"Vähennä {fieldLabel}\",\n \"increase\": \"Lisää {fieldLabel}\",\n \"numberField\": \"Numerokenttä\"\n}\n","{\n \"decrease\": \"Diminuer {fieldLabel}\",\n \"increase\": \"Augmenter {fieldLabel}\",\n \"numberField\": \"Champ de nombre\"\n}\n","{\n \"decrease\": \"הקטן {fieldLabel}\",\n \"increase\": \"הגדל {fieldLabel}\",\n \"numberField\": \"שדה מספר\"\n}\n","{\n \"decrease\": \"Smanji {fieldLabel}\",\n \"increase\": \"Povećaj {fieldLabel}\",\n \"numberField\": \"Polje broja\"\n}\n","{\n \"decrease\": \"{fieldLabel} csökkentése\",\n \"increase\": \"{fieldLabel} növelése\",\n \"numberField\": \"Számmező\"\n}\n","{\n \"decrease\": \"Riduci {fieldLabel}\",\n \"increase\": \"Aumenta {fieldLabel}\",\n \"numberField\": \"Campo numero\"\n}\n","{\n \"decrease\": \"{fieldLabel}を縮小\",\n \"increase\": \"{fieldLabel}を拡大\",\n \"numberField\": \"数値フィールド\"\n}\n","{\n \"decrease\": \"{fieldLabel} 감소\",\n \"increase\": \"{fieldLabel} 증가\",\n \"numberField\": \"번호 필드\"\n}\n","{\n \"decrease\": \"Sumažinti {fieldLabel}\",\n \"increase\": \"Padidinti {fieldLabel}\",\n \"numberField\": \"Numerio laukas\"\n}\n","{\n \"decrease\": \"Samazināšana {fieldLabel}\",\n \"increase\": \"Palielināšana {fieldLabel}\",\n \"numberField\": \"Skaitļu lauks\"\n}\n","{\n \"decrease\": \"Reduser {fieldLabel}\",\n \"increase\": \"Øk {fieldLabel}\",\n \"numberField\": \"Tallfelt\"\n}\n","{\n \"decrease\": \"{fieldLabel} verlagen\",\n \"increase\": \"{fieldLabel} verhogen\",\n \"numberField\": \"Getalveld\"\n}\n","{\n \"decrease\": \"Zmniejsz {fieldLabel}\",\n \"increase\": \"Zwiększ {fieldLabel}\",\n \"numberField\": \"Pole numeru\"\n}\n","{\n \"decrease\": \"Diminuir {fieldLabel}\",\n \"increase\": \"Aumentar {fieldLabel}\",\n \"numberField\": \"Campo de número\"\n}\n","{\n \"decrease\": \"Diminuir {fieldLabel}\",\n \"increase\": \"Aumentar {fieldLabel}\",\n \"numberField\": \"Campo numérico\"\n}\n","{\n \"decrease\": \"Scădere {fieldLabel}\",\n \"increase\": \"Creștere {fieldLabel}\",\n \"numberField\": \"Câmp numeric\"\n}\n","{\n \"decrease\": \"Уменьшение {fieldLabel}\",\n \"increase\": \"Увеличение {fieldLabel}\",\n \"numberField\": \"Числовое поле\"\n}\n","{\n \"decrease\": \"Znížiť {fieldLabel}\",\n \"increase\": \"Zvýšiť {fieldLabel}\",\n \"numberField\": \"Číselné pole\"\n}\n","{\n \"decrease\": \"Upadati {fieldLabel}\",\n \"increase\": \"Povečajte {fieldLabel}\",\n \"numberField\": \"Številčno polje\"\n}\n","{\n \"decrease\": \"Decrease {fieldLabel}\",\n \"increase\": \"Increase {fieldLabel}\",\n \"numberField\": \"Number field\"\n}\n","{\n \"decrease\": \"Minska {fieldLabel}\",\n \"increase\": \"Öka {fieldLabel}\",\n \"numberField\": \"Nummerfält\"\n}\n","{\n \"decrease\": \"{fieldLabel} azalt\",\n \"increase\": \"{fieldLabel} arttır\",\n \"numberField\": \"Sayı alanı\"\n}\n","{\n \"decrease\": \"Зменшити {fieldLabel}\",\n \"increase\": \"Збільшити {fieldLabel}\",\n \"numberField\": \"Поле номера\"\n}\n","{\n \"decrease\": \"降低 {fieldLabel}\",\n \"increase\": \"提高 {fieldLabel}\",\n \"numberField\": \"数字字段\"\n}\n","{\n \"decrease\": \"縮小 {fieldLabel}\",\n \"increase\": \"放大 {fieldLabel}\",\n \"numberField\": \"數字欄位\"\n}\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 {AriaButtonProps} from '@react-types/button';\nimport {AriaNumberFieldProps} from '@react-types/numberfield';\nimport {\n HTMLAttributes,\n InputHTMLAttributes,\n LabelHTMLAttributes,\n RefObject,\n useCallback,\n useEffect,\n useMemo,\n useRef\n} from 'react';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {isAndroid, isIOS, isIPhone, mergeProps, useId} from '@react-aria/utils';\nimport {NumberFieldState} from '@react-stately/numberfield';\nimport {TextInputDOMProps} from '@react-types/shared';\nimport {useFocus} from '@react-aria/interactions';\nimport {\n useMessageFormatter,\n useNumberFormatter\n} from '@react-aria/i18n';\nimport {useSpinButton} from '@react-aria/spinbutton';\nimport {useTextField} from '@react-aria/textfield';\n\ninterface NumberFieldAria {\n /** Props for the label element. */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>,\n /** Props for the group wrapper around the input and stepper buttons. */\n groupProps: HTMLAttributes<HTMLElement>,\n /** Props for the input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n /** Props for the increment button, to be passed to [useButton](useButton.html). */\n incrementButtonProps: AriaButtonProps,\n /** Props for the decrement button, to be passed to [useButton](useButton.html). */\n decrementButtonProps: AriaButtonProps\n}\n\nfunction supportsNativeBeforeInputEvent() {\n return typeof window !== 'undefined' &&\n window.InputEvent &&\n // @ts-ignore\n typeof InputEvent.prototype.getTargetRanges === 'function';\n}\n\n/**\n * Provides the behavior and accessibility implementation for a number field component.\n * Number fields allow users to enter a number, and increment or decrement the value using stepper buttons.\n */\nexport function useNumberField(props: AriaNumberFieldProps, state: NumberFieldState, inputRef: RefObject<HTMLInputElement>): NumberFieldAria {\n let {\n id,\n decrementAriaLabel,\n incrementAriaLabel,\n isDisabled,\n isReadOnly,\n isRequired,\n minValue,\n maxValue,\n autoFocus,\n validationState,\n label,\n formatOptions\n } = props;\n\n let {\n increment,\n incrementToMax,\n decrement,\n decrementToMin,\n numberValue,\n commit\n } = state;\n\n const formatMessage = useMessageFormatter(intlMessages);\n\n let inputId = useId(id);\n\n let {focusProps} = useFocus({\n onBlur: () => {\n // Set input value to normalized valid value\n commit();\n }\n });\n\n let {\n spinButtonProps,\n incrementButtonProps: incButtonProps,\n decrementButtonProps: decButtonProps\n } = useSpinButton(\n {\n isDisabled,\n isReadOnly,\n isRequired,\n maxValue,\n minValue,\n onIncrement: increment,\n onIncrementToMax: incrementToMax,\n onDecrement: decrement,\n onDecrementToMin: decrementToMin,\n value: numberValue,\n textValue: state.inputValue\n }\n );\n\n let onWheel = useCallback((e) => {\n // If the input isn't supposed to receive input, do nothing.\n // If the ctrlKey is pressed, this is a zoom event, do nothing.\n if (isDisabled || isReadOnly || e.ctrlKey) {\n return;\n }\n\n // stop scrolling the page\n e.preventDefault();\n\n if (e.deltaY > 0) {\n increment();\n } else if (e.deltaY < 0) {\n decrement();\n }\n }, [isReadOnly, isDisabled, decrement, increment]);\n useScrollWheel({onScroll: onWheel, capture: false}, inputRef);\n\n // The inputMode attribute influences the software keyboard that is shown on touch devices.\n // Browsers and operating systems are quite inconsistent about what keys are available, however.\n // We choose between numeric and decimal based on whether we allow negative and fractional numbers,\n // and based on testing on various devices to determine what keys are available in each inputMode.\n let numberFormatter = useNumberFormatter(formatOptions);\n let intlOptions = useMemo(() => numberFormatter.resolvedOptions(), [numberFormatter]);\n let hasDecimals = intlOptions.maximumFractionDigits > 0;\n let hasNegative = isNaN(state.minValue) || state.minValue < 0;\n let inputMode: TextInputDOMProps['inputMode'] = 'numeric';\n if (isIPhone()) {\n // iPhone doesn't have a minus sign in either numeric or decimal.\n // Note this is only for iPhone, not iPad, which always has both\n // minus and decimal in numeric.\n if (hasNegative) {\n inputMode = 'text';\n } else if (hasDecimals) {\n inputMode = 'decimal';\n }\n } else if (isAndroid()) {\n // Android numeric has both a decimal point and minus key.\n // decimal does not have a minus key.\n if (hasNegative) {\n inputMode = 'numeric';\n } else if (hasDecimals) {\n inputMode = 'decimal';\n }\n }\n\n let stateRef = useRef(state);\n stateRef.current = state;\n\n // All browsers implement the 'beforeinput' event natively except Firefox\n // (currently behind a flag as of Firefox 84). React's polyfill does not\n // run in all cases that the native event fires, e.g. when deleting text.\n // Use the native event if available so that we can prevent invalid deletions.\n // We do not attempt to polyfill this in Firefox since it would be very complicated,\n // the benefit of doing so is fairly minor, and it's going to be natively supported soon.\n useEffect(() => {\n if (!supportsNativeBeforeInputEvent()) {\n return;\n }\n\n let input = inputRef.current;\n\n let onBeforeInput = (e: InputEvent) => {\n let state = stateRef.current;\n\n // Compute the next value of the input if the event is allowed to proceed.\n // See https://www.w3.org/TR/input-events-2/#interface-InputEvent-Attributes for a full list of input types.\n let nextValue: string;\n switch (e.inputType) {\n case 'historyUndo':\n case 'historyRedo':\n // Explicitly allow undo/redo. e.data is null in this case, but there's no need to validate,\n // because presumably the input would have already been validated previously.\n return;\n case 'deleteContent':\n case 'deleteByCut':\n case 'deleteByDrag':\n nextValue = input.value.slice(0, input.selectionStart) + input.value.slice(input.selectionEnd);\n break;\n case 'deleteContentForward':\n // This is potentially incorrect, since the browser may actually delete more than a single UTF-16\n // character. In reality, a full Unicode grapheme cluster consisting of multiple UTF-16 characters\n // or code points may be deleted. However, in our currently supported locales, there are no such cases.\n // If we support additional locales in the future, this may need to change.\n nextValue = input.selectionEnd === input.selectionStart\n ? input.value.slice(0, input.selectionStart) + input.value.slice(input.selectionEnd + 1)\n : input.value.slice(0, input.selectionStart) + input.value.slice(input.selectionEnd);\n break;\n case 'deleteContentBackward':\n nextValue = input.selectionEnd === input.selectionStart\n ? input.value.slice(0, input.selectionStart - 1) + input.value.slice(input.selectionStart)\n : input.value.slice(0, input.selectionStart) + input.value.slice(input.selectionEnd);\n break;\n default:\n if (e.data != null) {\n nextValue =\n input.value.slice(0, input.selectionStart) +\n e.data +\n input.value.slice(input.selectionEnd);\n }\n break;\n }\n\n // If we did not compute a value, or the new value is invalid, prevent the event\n // so that the browser does not update the input text, move the selection, or add to\n // the undo/redo stack.\n if (nextValue == null || !state.validate(nextValue)) {\n e.preventDefault();\n }\n };\n\n input.addEventListener('beforeinput', onBeforeInput, false);\n return () => {\n input.removeEventListener('beforeinput', onBeforeInput, false);\n };\n }, [inputRef, stateRef]);\n\n let onBeforeInput = !supportsNativeBeforeInputEvent()\n ? e => {\n let nextValue =\n e.target.value.slice(0, e.target.selectionStart) +\n e.data +\n e.target.value.slice(e.target.selectionEnd);\n\n if (!state.validate(nextValue)) {\n e.preventDefault();\n }\n }\n : null;\n\n let onChange = value => {\n state.setInputValue(value);\n };\n\n let compositionStartState = useRef(null);\n let {labelProps, inputProps: textFieldProps} = useTextField({\n label,\n autoFocus,\n isDisabled,\n isReadOnly,\n isRequired,\n validationState,\n value: state.inputValue,\n autoComplete: 'off',\n 'aria-label': props['aria-label'] || null,\n 'aria-labelledby': props['aria-labelledby'] || null,\n id: inputId,\n type: 'text', // Can't use type=\"number\" because then we can't have things like $ in the field.\n inputMode,\n onChange,\n onBeforeInput,\n onCompositionStart() {\n // Chrome does not implement Input Events Level 2, which specifies the insertFromComposition\n // and deleteByComposition inputType values for the beforeinput event. These are meant to occur\n // at the end of a composition (e.g. Pinyin IME, Android auto correct, etc.), and crucially, are\n // cancelable. The insertCompositionText and deleteCompositionText input types are not cancelable,\n // nor would we want to cancel them because the input from the user is incomplete at that point.\n // In Safari, insertFromComposition/deleteFromComposition will fire, however, allowing us to cancel\n // the final composition result if it is invalid. As a fallback for Chrome and Firefox, which either\n // don't support Input Events Level 2, or beforeinput at all, we store the state of the input when\n // the compositionstart event fires, and undo the changes in compositionend (below) if it is invalid.\n // Unfortunately, this messes up the undo/redo stack, but until insertFromComposition/deleteByComposition\n // are implemented, there is no other way to prevent composed input.\n // See https://bugs.chromium.org/p/chromium/issues/detail?id=1022204\n let {value, selectionStart, selectionEnd} = inputRef.current;\n compositionStartState.current = {value, selectionStart, selectionEnd};\n },\n onCompositionEnd() {\n if (!state.validate(inputRef.current.value)) {\n // Restore the input value in the DOM immediately so we can synchronously update the selection position.\n // But also update the value in React state as well so it is correct for future updates.\n let {value, selectionStart, selectionEnd} = compositionStartState.current;\n inputRef.current.value = value;\n inputRef.current.setSelectionRange(selectionStart, selectionEnd);\n state.setInputValue(value);\n }\n }\n }, inputRef);\n\n let inputProps = mergeProps(\n spinButtonProps,\n textFieldProps,\n focusProps,\n {\n // override the spinbutton role, we can't focus a spin button with VO\n role: null,\n // ignore aria-roledescription on iOS so that required state will announce when it is present\n 'aria-roledescription': (!isIOS() ? formatMessage('numberField') : null),\n 'aria-valuemax': null,\n 'aria-valuemin': null,\n 'aria-valuenow': null,\n 'aria-valuetext': null,\n autoCorrect: 'off',\n spellCheck: 'false'\n }\n );\n\n let onButtonPressStart = (e) => {\n // If focus is already on the input, keep it there so we don't hide the\n // software keyboard when tapping the increment/decrement buttons.\n if (document.activeElement === inputRef.current) {\n return;\n }\n\n // Otherwise, when using a mouse, move focus to the input.\n // On touch, or with a screen reader, focus the button so that the software\n // keyboard does not appear and the screen reader cursor is not moved off the button.\n if (e.pointerType === 'mouse') {\n inputRef.current.focus();\n } else {\n e.target.focus();\n }\n };\n\n // Determine the label for the increment and decrement buttons. There are 4 cases:\n //\n // 1. With a visible label that is a string: aria-label: `Increase ${props.label}`\n // 2. With a visible label that is JSX: aria-label: 'Increase', aria-labelledby: '${incrementId} ${labelId}'\n // 3. With an aria-label: aria-label: `Increase ${props['aria-label']}`\n // 4. With an aria-labelledby: aria-label: 'Increase', aria-labelledby: `${incrementId} ${props['aria-labelledby']}`\n //\n // (1) and (2) could possibly be combined and both use aria-labelledby. However, placing the label in\n // the aria-label string rather than using aria-labelledby gives more flexibility to translators to change\n // the order or add additional words around the label if needed.\n let fieldLabel = props['aria-label'] || (typeof props.label === 'string' ? props.label : '');\n let ariaLabelledby: string;\n if (!fieldLabel) {\n ariaLabelledby = props.label != null ? labelProps.id : props['aria-labelledby'];\n }\n\n let incrementId = useId();\n let decrementId = useId();\n\n let incrementButtonProps: AriaButtonProps = mergeProps(incButtonProps, {\n 'aria-label': incrementAriaLabel || formatMessage('increase', {fieldLabel}).trim(),\n id: ariaLabelledby && !incrementAriaLabel ? incrementId : null,\n 'aria-labelledby': ariaLabelledby && !incrementAriaLabel ? `${incrementId} ${ariaLabelledby}` : null,\n 'aria-controls': inputId,\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n isDisabled: !state.canIncrement,\n onPressStart: onButtonPressStart\n });\n\n let decrementButtonProps: AriaButtonProps = mergeProps(decButtonProps, {\n 'aria-label': decrementAriaLabel || formatMessage('decrease', {fieldLabel}).trim(),\n id: ariaLabelledby && !decrementAriaLabel ? decrementId : null,\n 'aria-labelledby': ariaLabelledby && !decrementAriaLabel ? `${decrementId} ${ariaLabelledby}` : null,\n 'aria-controls': inputId,\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n isDisabled: !state.canDecrement,\n onPressStart: onButtonPressStart\n });\n\n return {\n groupProps: {\n role: 'group',\n 'aria-disabled': isDisabled,\n 'aria-invalid': validationState === 'invalid' ? 'true' : undefined\n },\n labelProps,\n inputProps,\n incrementButtonProps,\n decrementButtonProps\n };\n}\n\n// scroll wheel needs to be added not passively so it's cancelable, small helper hook to remember that\nfunction useScrollWheel({onScroll, capture}: {onScroll: (e) => void, capture: boolean}, ref: RefObject<HTMLElement>) {\n useEffect(() => {\n let elem = ref.current;\n elem.addEventListener('wheel', onScroll, capture);\n\n return () => {\n elem.removeEventListener('wheel', onScroll, capture);\n };\n }, [onScroll, ref, capture]);\n}\n"],"names":["JSON","parse","supportsNativeBeforeInputEvent","window","InputEvent","prototype","getTargetRanges","useNumberField","props","state","inputRef","id","decrementAriaLabel","incrementAriaLabel","isDisabled","isReadOnly","isRequired","minValue","maxValue","autoFocus","validationState","label","formatOptions","increment","incrementToMax","decrement","decrementToMin","numberValue","commit","formatMessage","useMessageFormatter","intlMessages","inputId","useId","focusProps","useFocus","onBlur","spinButtonProps","incrementButtonProps","incButtonProps","decrementButtonProps","decButtonProps","useSpinButton","onIncrement","onIncrementToMax","onDecrement","onDecrementToMin","value","textValue","inputValue","onWheel","useCallback","e","ctrlKey","preventDefault","deltaY","useScrollWheel","onScroll","capture","numberFormatter","useNumberFormatter","intlOptions","useMemo","resolvedOptions","hasDecimals","maximumFractionDigits","hasNegative","isNaN","inputMode","isIPhone","isAndroid","stateRef","useRef","current","useEffect","input","onBeforeInput","nextValue","inputType","slice","selectionStart","selectionEnd","data","validate","addEventListener","removeEventListener","target","onChange","setInputValue","compositionStartState","labelProps","inputProps","textFieldProps","useTextField","autoComplete","type","onCompositionStart","onCompositionEnd","setSelectionRange","mergeProps","role","isIOS","autoCorrect","spellCheck","onButtonPressStart","document","activeElement","pointerType","focus","fieldLabel","ariaLabelledby","incrementId","decrementId","trim","excludeFromTabOrder","preventFocusOnPress","canIncrement","onPressStart","canDecrement","groupProps","undefined","ref","elem"],"version":3,"file":"module.js.map"}
1
+ {"mappings":";;;;;;;;;;AAAA,4CAAiBA,IAAI,CAACC,KAAL,CAAW,sGAAX,CAAjB;;;ACAA,4CAAiBD,IAAI,CAACC,KAAL,CAAW,uHAAX,CAAjB;;;ACAA,4CAAiBD,IAAI,CAACC,KAAL,CAAW,8GAAX,CAAjB;;;ACAA,4CAAiB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rEpG,IAAAA,UAAU,EAAE,CAACL,KAAK,CAAC0G,YAPkD;AAQrEC,IAAAA,YAAY,EAAEf;AARuD,GAAjB,CAAtD;AAWA,MAAIvD,oBAAqC,GAAGkD,UAAU,CAACjD,cAAD,EAAiB;AACrE,kBAAcnC,kBAAkB,IAAIwB,aAAa,CAAC,UAAD,EAAa;AAACwE,MAAAA;AAAD,KAAb,CAAb,CAAwCI,IAAxC,EADiC;AAErErG,IAAAA,EAAE,EAAEkG,cAAc,IAAI,CAACjG,kBAAnB,GAAwCmG,WAAxC,GAAsD,IAFW;AAGrE,uBAAmBF,cAAc,IAAI,CAACjG,kBAAnB,GAA2CmG,WAA3C,SAA0DF,cAA1D,GAA6E,IAH3B;AAIrE,qBAAiBtE,OAJoD;AAKrE0E,IAAAA,mBAAmB,EAAE,IALgD;AAMrEC,IAAAA,mBAAmB,EAAE,IANgD;AAOrEpG,IAAAA,UAAU,EAAE,CAACL,KAAK,CAAC4G,YAPkD;AAQrED,IAAAA,YAAY,EAAEf;AARuD,GAAjB,CAAtD;AAWA,SAAO;AACLiB,IAAAA,UAAU;AACRrB,MAAAA,IAAI,EAAE,OADE;AAER,uBAAiBnF,UAFT;AAGR,sBAAgBM,eAAe,KAAK,SAApB,GAAgC,MAAhC,GAAyCmG;AAHjD,OAIL5D,gBAJK,CADL;AAOL6B,IAAAA,UAPK;AAQLC,IAAAA,UARK;AASL7C,IAAAA,oBATK;AAULE,IAAAA,oBAVK;AAWL8C,IAAAA,iBAXK;AAYLD,IAAAA;AAZK,GAAP;AAcD","sources":["./packages/@react-aria/numberfield/intl/ar-AE.json","./packages/@react-aria/numberfield/intl/bg-BG.json","./packages/@react-aria/numberfield/intl/cs-CZ.json","./packages/@react-aria/numberfield/intl/da-DK.json","./packages/@react-aria/numberfield/intl/de-DE.json","./packages/@react-aria/numberfield/intl/el-GR.json","./packages/@react-aria/numberfield/intl/en-US.json","./packages/@react-aria/numberfield/intl/es-ES.json","./packages/@react-aria/numberfield/intl/et-EE.json","./packages/@react-aria/numberfield/intl/fi-FI.json","./packages/@react-aria/numberfield/intl/fr-FR.json","./packages/@react-aria/numberfield/intl/he-IL.json","./packages/@react-aria/numberfield/intl/hr-HR.json","./packages/@react-aria/numberfield/intl/hu-HU.json","./packages/@react-aria/numberfield/intl/it-IT.json","./packages/@react-aria/numberfield/intl/ja-JP.json","./packages/@react-aria/numberfield/intl/ko-KR.json","./packages/@react-aria/numberfield/intl/lt-LT.json","./packages/@react-aria/numberfield/intl/lv-LV.json","./packages/@react-aria/numberfield/intl/nb-NO.json","./packages/@react-aria/numberfield/intl/nl-NL.json","./packages/@react-aria/numberfield/intl/pl-PL.json","./packages/@react-aria/numberfield/intl/pt-BR.json","./packages/@react-aria/numberfield/intl/pt-PT.json","./packages/@react-aria/numberfield/intl/ro-RO.json","./packages/@react-aria/numberfield/intl/ru-RU.json","./packages/@react-aria/numberfield/intl/sk-SK.json","./packages/@react-aria/numberfield/intl/sl-SI.json","./packages/@react-aria/numberfield/intl/sr-SP.json","./packages/@react-aria/numberfield/intl/sv-SE.json","./packages/@react-aria/numberfield/intl/tr-TR.json","./packages/@react-aria/numberfield/intl/uk-UA.json","./packages/@react-aria/numberfield/intl/zh-CN.json","./packages/@react-aria/numberfield/intl/zh-TW.json","./packages/@react-aria/numberfield/src/useNumberField.ts"],"sourcesContent":["{\n \"decrease\": \"خفض {fieldLabel}\",\n \"increase\": \"زيادة {fieldLabel}\",\n \"numberField\": \"حقل رقمي\"\n}\n","{\n \"decrease\": \"Намаляване {fieldLabel}\",\n \"increase\": \"Усилване {fieldLabel}\",\n \"numberField\": \"Номер на полето\"\n}\n","{\n \"decrease\": \"Snížit {fieldLabel}\",\n \"increase\": \"Zvýšit {fieldLabel}\",\n \"numberField\": \"Číselné pole\"\n}\n","{\n \"decrease\": \"Reducer {fieldLabel}\",\n \"increase\": \"Øg {fieldLabel}\",\n \"numberField\": \"Talfelt\"\n}\n","{\n \"decrease\": \"{fieldLabel} verringern\",\n \"increase\": \"{fieldLabel} erhöhen\",\n \"numberField\": \"Nummernfeld\"\n}\n","{\n \"decrease\": \"Μείωση {fieldLabel}\",\n \"increase\": \"Αύξηση {fieldLabel}\",\n \"numberField\": \"Πεδίο αριθμού\"\n}\n","{\n \"decrease\": \"Decrease {fieldLabel}\",\n \"increase\": \"Increase {fieldLabel}\",\n \"numberField\": \"Number field\"\n}\n","{\n \"decrease\": \"Reducir {fieldLabel}\",\n \"increase\": \"Aumentar {fieldLabel}\",\n \"numberField\": \"Campo de número\"\n}\n","{\n \"decrease\": \"Vähenda {fieldLabel}\",\n \"increase\": \"Suurenda {fieldLabel}\",\n \"numberField\": \"Numbri väli\"\n}\n","{\n \"decrease\": \"Vähennä {fieldLabel}\",\n \"increase\": \"Lisää {fieldLabel}\",\n \"numberField\": \"Numerokenttä\"\n}\n","{\n \"decrease\": \"Diminuer {fieldLabel}\",\n \"increase\": \"Augmenter {fieldLabel}\",\n \"numberField\": \"Champ de nombre\"\n}\n","{\n \"decrease\": \"הקטן {fieldLabel}\",\n \"increase\": \"הגדל {fieldLabel}\",\n \"numberField\": \"שדה מספר\"\n}\n","{\n \"decrease\": \"Smanji {fieldLabel}\",\n \"increase\": \"Povećaj {fieldLabel}\",\n \"numberField\": \"Polje broja\"\n}\n","{\n \"decrease\": \"{fieldLabel} csökkentése\",\n \"increase\": \"{fieldLabel} növelése\",\n \"numberField\": \"Számmező\"\n}\n","{\n \"decrease\": \"Riduci {fieldLabel}\",\n \"increase\": \"Aumenta {fieldLabel}\",\n \"numberField\": \"Campo numero\"\n}\n","{\n \"decrease\": \"{fieldLabel}を縮小\",\n \"increase\": \"{fieldLabel}を拡大\",\n \"numberField\": \"数値フィールド\"\n}\n","{\n \"decrease\": \"{fieldLabel} 감소\",\n \"increase\": \"{fieldLabel} 증가\",\n \"numberField\": \"번호 필드\"\n}\n","{\n \"decrease\": \"Sumažinti {fieldLabel}\",\n \"increase\": \"Padidinti {fieldLabel}\",\n \"numberField\": \"Numerio laukas\"\n}\n","{\n \"decrease\": \"Samazināšana {fieldLabel}\",\n \"increase\": \"Palielināšana {fieldLabel}\",\n \"numberField\": \"Skaitļu lauks\"\n}\n","{\n \"decrease\": \"Reduser {fieldLabel}\",\n \"increase\": \"Øk {fieldLabel}\",\n \"numberField\": \"Tallfelt\"\n}\n","{\n \"decrease\": \"{fieldLabel} verlagen\",\n \"increase\": \"{fieldLabel} verhogen\",\n \"numberField\": \"Getalveld\"\n}\n","{\n \"decrease\": \"Zmniejsz {fieldLabel}\",\n \"increase\": \"Zwiększ {fieldLabel}\",\n \"numberField\": \"Pole numeru\"\n}\n","{\n \"decrease\": \"Diminuir {fieldLabel}\",\n \"increase\": \"Aumentar {fieldLabel}\",\n \"numberField\": \"Campo de número\"\n}\n","{\n \"decrease\": \"Diminuir {fieldLabel}\",\n \"increase\": \"Aumentar {fieldLabel}\",\n \"numberField\": \"Campo numérico\"\n}\n","{\n \"decrease\": \"Scădere {fieldLabel}\",\n \"increase\": \"Creștere {fieldLabel}\",\n \"numberField\": \"Câmp numeric\"\n}\n","{\n \"decrease\": \"Уменьшение {fieldLabel}\",\n \"increase\": \"Увеличение {fieldLabel}\",\n \"numberField\": \"Числовое поле\"\n}\n","{\n \"decrease\": \"Znížiť {fieldLabel}\",\n \"increase\": \"Zvýšiť {fieldLabel}\",\n \"numberField\": \"Číselné pole\"\n}\n","{\n \"decrease\": \"Upadati {fieldLabel}\",\n \"increase\": \"Povečajte {fieldLabel}\",\n \"numberField\": \"Številčno polje\"\n}\n","{\n \"decrease\": \"Decrease {fieldLabel}\",\n \"increase\": \"Increase {fieldLabel}\",\n \"numberField\": \"Number field\"\n}\n","{\n \"decrease\": \"Minska {fieldLabel}\",\n \"increase\": \"Öka {fieldLabel}\",\n \"numberField\": \"Nummerfält\"\n}\n","{\n \"decrease\": \"{fieldLabel} azalt\",\n \"increase\": \"{fieldLabel} arttır\",\n \"numberField\": \"Sayı alanı\"\n}\n","{\n \"decrease\": \"Зменшити {fieldLabel}\",\n \"increase\": \"Збільшити {fieldLabel}\",\n \"numberField\": \"Поле номера\"\n}\n","{\n \"decrease\": \"降低 {fieldLabel}\",\n \"increase\": \"提高 {fieldLabel}\",\n \"numberField\": \"数字字段\"\n}\n","{\n \"decrease\": \"縮小 {fieldLabel}\",\n \"increase\": \"放大 {fieldLabel}\",\n \"numberField\": \"數字欄位\"\n}\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 {AriaButtonProps} from '@react-types/button';\nimport {AriaNumberFieldProps} from '@react-types/numberfield';\nimport {filterDOMProps, isAndroid, isIOS, isIPhone, mergeProps, useId} from '@react-aria/utils';\nimport {\n HTMLAttributes,\n InputHTMLAttributes,\n LabelHTMLAttributes,\n RefObject,\n useCallback,\n useMemo,\n useState\n} from 'react';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {NumberFieldState} from '@react-stately/numberfield';\nimport {TextInputDOMProps} from '@react-types/shared';\nimport {useFocus, useFocusWithin} from '@react-aria/interactions';\nimport {useFormattedTextField} from '@react-aria/textfield';\nimport {\n useMessageFormatter,\n useNumberFormatter\n} from '@react-aria/i18n';\nimport {useScrollWheel} from '@react-aria/interactions';\nimport {useSpinButton} from '@react-aria/spinbutton';\n\ninterface NumberFieldAria {\n /** Props for the label element. */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>,\n /** Props for the group wrapper around the input and stepper buttons. */\n groupProps: HTMLAttributes<HTMLElement>,\n /** Props for the input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n /** Props for the increment button, to be passed to [useButton](useButton.html). */\n incrementButtonProps: AriaButtonProps,\n /** Props for the decrement button, to be passed to [useButton](useButton.html). */\n decrementButtonProps: AriaButtonProps,\n /** Props for the number field's description element, if any. */\n descriptionProps: HTMLAttributes<HTMLElement>,\n /** Props for the number field's error message element, if any. */\n errorMessageProps: HTMLAttributes<HTMLElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a number field component.\n * Number fields allow users to enter a number, and increment or decrement the value using stepper buttons.\n */\nexport function useNumberField(props: AriaNumberFieldProps, state: NumberFieldState, inputRef: RefObject<HTMLInputElement>): NumberFieldAria {\n let {\n id,\n decrementAriaLabel,\n incrementAriaLabel,\n isDisabled,\n isReadOnly,\n isRequired,\n minValue,\n maxValue,\n autoFocus,\n validationState,\n label,\n formatOptions,\n onBlur,\n onFocus,\n onFocusChange,\n onKeyDown,\n onKeyUp,\n description,\n errorMessage\n } = props;\n\n let {\n increment,\n incrementToMax,\n decrement,\n decrementToMin,\n numberValue,\n commit\n } = state;\n\n const formatMessage = useMessageFormatter(intlMessages);\n\n let inputId = useId(id);\n\n let {focusProps} = useFocus({\n onBlur: () => {\n // Set input value to normalized valid value\n commit();\n }\n });\n\n let {\n spinButtonProps,\n incrementButtonProps: incButtonProps,\n decrementButtonProps: decButtonProps\n } = useSpinButton(\n {\n isDisabled,\n isReadOnly,\n isRequired,\n maxValue,\n minValue,\n onIncrement: increment,\n onIncrementToMax: incrementToMax,\n onDecrement: decrement,\n onDecrementToMin: decrementToMin,\n value: numberValue,\n textValue: state.inputValue\n }\n );\n\n let [focusWithin, setFocusWithin] = useState(false);\n let {focusWithinProps} = useFocusWithin({isDisabled, onFocusWithinChange: setFocusWithin});\n\n let onWheel = useCallback((e) => {\n // if on a trackpad, users can scroll in both X and Y at once, check the magnitude of the change\n // if it's mostly in the X direction, then just return, the user probably doesn't mean to inc/dec\n // this isn't perfect, events come in fast with small deltas and a part of the scroll may give a false indication\n // especially if the user is scrolling near 45deg\n if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) {\n return;\n }\n if (e.deltaY > 0) {\n increment();\n } else if (e.deltaY < 0) {\n decrement();\n }\n }, [decrement, increment]);\n // If the input isn't supposed to receive input, disable scrolling.\n let scrollingDisabled = isDisabled || isReadOnly || !focusWithin;\n useScrollWheel({onScroll: onWheel, isDisabled: scrollingDisabled}, inputRef);\n\n // The inputMode attribute influences the software keyboard that is shown on touch devices.\n // Browsers and operating systems are quite inconsistent about what keys are available, however.\n // We choose between numeric and decimal based on whether we allow negative and fractional numbers,\n // and based on testing on various devices to determine what keys are available in each inputMode.\n let numberFormatter = useNumberFormatter(formatOptions);\n let intlOptions = useMemo(() => numberFormatter.resolvedOptions(), [numberFormatter]);\n let hasDecimals = intlOptions.maximumFractionDigits > 0;\n let hasNegative = isNaN(state.minValue) || state.minValue < 0;\n let inputMode: TextInputDOMProps['inputMode'] = 'numeric';\n if (isIPhone()) {\n // iPhone doesn't have a minus sign in either numeric or decimal.\n // Note this is only for iPhone, not iPad, which always has both\n // minus and decimal in numeric.\n if (hasNegative) {\n inputMode = 'text';\n } else if (hasDecimals) {\n inputMode = 'decimal';\n }\n } else if (isAndroid()) {\n // Android numeric has both a decimal point and minus key.\n // decimal does not have a minus key.\n if (hasNegative) {\n inputMode = 'numeric';\n } else if (hasDecimals) {\n inputMode = 'decimal';\n }\n }\n\n let onChange = value => {\n state.setInputValue(value);\n };\n\n let domProps = filterDOMProps(props);\n\n let {labelProps, inputProps: textFieldProps, descriptionProps, errorMessageProps} = useFormattedTextField({\n ...domProps,\n label,\n autoFocus,\n isDisabled,\n isReadOnly,\n isRequired,\n validationState,\n value: state.inputValue,\n autoComplete: 'off',\n 'aria-label': props['aria-label'] || null,\n 'aria-labelledby': props['aria-labelledby'] || null,\n id: inputId,\n type: 'text', // Can't use type=\"number\" because then we can't have things like $ in the field.\n inputMode,\n onChange,\n onBlur,\n onFocus,\n onFocusChange,\n onKeyDown,\n onKeyUp,\n description,\n errorMessage\n }, state, inputRef);\n\n let inputProps = mergeProps(\n spinButtonProps,\n textFieldProps,\n focusProps,\n {\n // override the spinbutton role, we can't focus a spin button with VO\n role: null,\n // ignore aria-roledescription on iOS so that required state will announce when it is present\n 'aria-roledescription': (!isIOS() ? formatMessage('numberField') : null),\n 'aria-valuemax': null,\n 'aria-valuemin': null,\n 'aria-valuenow': null,\n 'aria-valuetext': null,\n autoCorrect: 'off',\n spellCheck: 'false'\n }\n );\n\n let onButtonPressStart = (e) => {\n // If focus is already on the input, keep it there so we don't hide the\n // software keyboard when tapping the increment/decrement buttons.\n if (document.activeElement === inputRef.current) {\n return;\n }\n\n // Otherwise, when using a mouse, move focus to the input.\n // On touch, or with a screen reader, focus the button so that the software\n // keyboard does not appear and the screen reader cursor is not moved off the button.\n if (e.pointerType === 'mouse') {\n inputRef.current.focus();\n } else {\n e.target.focus();\n }\n };\n\n // Determine the label for the increment and decrement buttons. There are 4 cases:\n //\n // 1. With a visible label that is a string: aria-label: `Increase ${props.label}`\n // 2. With a visible label that is JSX: aria-label: 'Increase', aria-labelledby: '${incrementId} ${labelId}'\n // 3. With an aria-label: aria-label: `Increase ${props['aria-label']}`\n // 4. With an aria-labelledby: aria-label: 'Increase', aria-labelledby: `${incrementId} ${props['aria-labelledby']}`\n //\n // (1) and (2) could possibly be combined and both use aria-labelledby. However, placing the label in\n // the aria-label string rather than using aria-labelledby gives more flexibility to translators to change\n // the order or add additional words around the label if needed.\n let fieldLabel = props['aria-label'] || (typeof props.label === 'string' ? props.label : '');\n let ariaLabelledby: string;\n if (!fieldLabel) {\n ariaLabelledby = props.label != null ? labelProps.id : props['aria-labelledby'];\n }\n\n let incrementId = useId();\n let decrementId = useId();\n\n let incrementButtonProps: AriaButtonProps = mergeProps(incButtonProps, {\n 'aria-label': incrementAriaLabel || formatMessage('increase', {fieldLabel}).trim(),\n id: ariaLabelledby && !incrementAriaLabel ? incrementId : null,\n 'aria-labelledby': ariaLabelledby && !incrementAriaLabel ? `${incrementId} ${ariaLabelledby}` : null,\n 'aria-controls': inputId,\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n isDisabled: !state.canIncrement,\n onPressStart: onButtonPressStart\n });\n\n let decrementButtonProps: AriaButtonProps = mergeProps(decButtonProps, {\n 'aria-label': decrementAriaLabel || formatMessage('decrease', {fieldLabel}).trim(),\n id: ariaLabelledby && !decrementAriaLabel ? decrementId : null,\n 'aria-labelledby': ariaLabelledby && !decrementAriaLabel ? `${decrementId} ${ariaLabelledby}` : null,\n 'aria-controls': inputId,\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n isDisabled: !state.canDecrement,\n onPressStart: onButtonPressStart\n });\n\n return {\n groupProps: {\n role: 'group',\n 'aria-disabled': isDisabled,\n 'aria-invalid': validationState === 'invalid' ? 'true' : undefined,\n ...focusWithinProps\n },\n labelProps,\n inputProps,\n incrementButtonProps,\n decrementButtonProps,\n errorMessageProps,\n descriptionProps\n };\n}\n"],"names":["JSON","parse","useNumberField","props","state","inputRef","id","decrementAriaLabel","incrementAriaLabel","isDisabled","isReadOnly","isRequired","minValue","maxValue","autoFocus","validationState","label","formatOptions","onBlur","onFocus","onFocusChange","onKeyDown","onKeyUp","description","errorMessage","increment","incrementToMax","decrement","decrementToMin","numberValue","commit","formatMessage","useMessageFormatter","intlMessages","inputId","useId","focusProps","useFocus","spinButtonProps","incrementButtonProps","incButtonProps","decrementButtonProps","decButtonProps","useSpinButton","onIncrement","onIncrementToMax","onDecrement","onDecrementToMin","value","textValue","inputValue","focusWithin","setFocusWithin","useState","focusWithinProps","useFocusWithin","onFocusWithinChange","onWheel","useCallback","e","Math","abs","deltaY","deltaX","scrollingDisabled","useScrollWheel","onScroll","numberFormatter","useNumberFormatter","intlOptions","useMemo","resolvedOptions","hasDecimals","maximumFractionDigits","hasNegative","isNaN","inputMode","isIPhone","isAndroid","onChange","setInputValue","domProps","filterDOMProps","labelProps","inputProps","textFieldProps","descriptionProps","errorMessageProps","useFormattedTextField","autoComplete","type","mergeProps","role","isIOS","autoCorrect","spellCheck","onButtonPressStart","document","activeElement","current","pointerType","focus","target","fieldLabel","ariaLabelledby","incrementId","decrementId","trim","excludeFromTabOrder","preventFocusOnPress","canIncrement","onPressStart","canDecrement","groupProps","undefined"],"version":3,"file":"module.js.map"}
package/dist/types.d.ts CHANGED
@@ -13,6 +13,10 @@ interface NumberFieldAria {
13
13
  incrementButtonProps: AriaButtonProps;
14
14
  /** Props for the decrement button, to be passed to [useButton](useButton.html). */
15
15
  decrementButtonProps: AriaButtonProps;
16
+ /** Props for the number field's description element, if any. */
17
+ descriptionProps: HTMLAttributes<HTMLElement>;
18
+ /** Props for the number field's error message element, if any. */
19
+ errorMessageProps: HTMLAttributes<HTMLElement>;
16
20
  }
17
21
  /**
18
22
  * Provides the behavior and accessibility implementation for a number field component.
@@ -1 +1 @@
1
- {"mappings":"A;A;A;A;AAqCA;IACE,mCAAmC;IACnC,UAAU,EAAE,oBAAoB,gBAAgB,CAAC,CAAC;IAClD,wEAAwE;IACxE,UAAU,EAAE,eAAe,WAAW,CAAC,CAAC;IACxC,mCAAmC;IACnC,UAAU,EAAE,oBAAoB,gBAAgB,CAAC,CAAC;IAClD,mFAAmF;IACnF,oBAAoB,EAAE,eAAe,CAAC;IACtC,mFAAmF;IACnF,oBAAoB,EAAE,eAAe,CAAA;CACtC;AASD;A;A;GAGG;AACH,+BAA+B,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,UAAU,gBAAgB,CAAC,GAAG,eAAe,CAkU3I","sources":["./packages/@react-aria/numberfield/src/packages/@react-aria/numberfield/src/useNumberField.ts","./packages/@react-aria/numberfield/src/packages/@react-aria/numberfield/src/index.ts"],"sourcesContent":[null,null],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":"A;A;A;A;AAqCA;IACE,mCAAmC;IACnC,UAAU,EAAE,oBAAoB,gBAAgB,CAAC,CAAC;IAClD,wEAAwE;IACxE,UAAU,EAAE,eAAe,WAAW,CAAC,CAAC;IACxC,mCAAmC;IACnC,UAAU,EAAE,oBAAoB,gBAAgB,CAAC,CAAC;IAClD,mFAAmF;IACnF,oBAAoB,EAAE,eAAe,CAAC;IACtC,mFAAmF;IACnF,oBAAoB,EAAE,eAAe,CAAC;IACtC,gEAAgE;IAChE,gBAAgB,EAAE,eAAe,WAAW,CAAC,CAAC;IAC9C,kEAAkE;IAClE,iBAAiB,EAAE,eAAe,WAAW,CAAC,CAAA;CAC/C;AAED;A;A;GAGG;AACH,+BAA+B,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,UAAU,gBAAgB,CAAC,GAAG,eAAe,CAyO3I","sources":["./packages/@react-aria/numberfield/src/packages/@react-aria/numberfield/src/useNumberField.ts","./packages/@react-aria/numberfield/src/packages/@react-aria/numberfield/src/index.ts"],"sourcesContent":[null,null],"names":[],"version":3,"file":"types.d.ts.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/numberfield",
3
- "version": "3.0.0-rc.0",
3
+ "version": "3.1.1",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -18,23 +18,24 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@babel/runtime": "^7.6.2",
21
- "@react-aria/i18n": "^3.3.0",
22
- "@react-aria/interactions": "^3.3.4",
23
- "@react-aria/live-announcer": "3.0.0-rc.0",
24
- "@react-aria/spinbutton": "3.0.0-rc.0",
25
- "@react-aria/textfield": "^3.1.0",
26
- "@react-aria/utils": "^3.7.0",
27
- "@react-stately/numberfield": "3.0.0-rc.0",
28
- "@react-types/button": "^3.3.1",
29
- "@react-types/numberfield": "3.0.0-rc.0",
30
- "@react-types/shared": "^3.5.0",
31
- "@react-types/textfield": "^3.1.0"
21
+ "@react-aria/i18n": "^3.3.3",
22
+ "@react-aria/interactions": "^3.7.0",
23
+ "@react-aria/live-announcer": "^3.0.1",
24
+ "@react-aria/spinbutton": "^3.0.1",
25
+ "@react-aria/textfield": "^3.5.0",
26
+ "@react-aria/utils": "^3.10.0",
27
+ "@react-stately/numberfield": "^3.0.2",
28
+ "@react-types/button": "^3.4.1",
29
+ "@react-types/numberfield": "^3.1.0",
30
+ "@react-types/shared": "^3.10.0",
31
+ "@react-types/textfield": "^3.3.0"
32
32
  },
33
33
  "peerDependencies": {
34
- "react": "^16.8.0 || ^17.0.0-rc.1"
34
+ "react": "^16.8.0 || ^17.0.0-rc.1",
35
+ "react-dom": "^16.8.0 || ^17.0.0-rc.1"
35
36
  },
36
37
  "publishConfig": {
37
38
  "access": "public"
38
39
  },
39
- "gitHead": "9920ffaa2596a03c4498a15cb940bd2f4ba5cd6a"
40
+ "gitHead": "896eabe5521a0349a675c4773ed7629addd4b8c4"
40
41
  }
@@ -12,28 +12,28 @@
12
12
 
13
13
  import {AriaButtonProps} from '@react-types/button';
14
14
  import {AriaNumberFieldProps} from '@react-types/numberfield';
15
+ import {filterDOMProps, isAndroid, isIOS, isIPhone, mergeProps, useId} from '@react-aria/utils';
15
16
  import {
16
17
  HTMLAttributes,
17
18
  InputHTMLAttributes,
18
19
  LabelHTMLAttributes,
19
20
  RefObject,
20
21
  useCallback,
21
- useEffect,
22
22
  useMemo,
23
- useRef
23
+ useState
24
24
  } from 'react';
25
25
  // @ts-ignore
26
26
  import intlMessages from '../intl/*.json';
27
- import {isAndroid, isIOS, isIPhone, mergeProps, useId} from '@react-aria/utils';
28
27
  import {NumberFieldState} from '@react-stately/numberfield';
29
28
  import {TextInputDOMProps} from '@react-types/shared';
30
- import {useFocus} from '@react-aria/interactions';
29
+ import {useFocus, useFocusWithin} from '@react-aria/interactions';
30
+ import {useFormattedTextField} from '@react-aria/textfield';
31
31
  import {
32
32
  useMessageFormatter,
33
33
  useNumberFormatter
34
34
  } from '@react-aria/i18n';
35
+ import {useScrollWheel} from '@react-aria/interactions';
35
36
  import {useSpinButton} from '@react-aria/spinbutton';
36
- import {useTextField} from '@react-aria/textfield';
37
37
 
38
38
  interface NumberFieldAria {
39
39
  /** Props for the label element. */
@@ -45,14 +45,11 @@ interface NumberFieldAria {
45
45
  /** Props for the increment button, to be passed to [useButton](useButton.html). */
46
46
  incrementButtonProps: AriaButtonProps,
47
47
  /** Props for the decrement button, to be passed to [useButton](useButton.html). */
48
- decrementButtonProps: AriaButtonProps
49
- }
50
-
51
- function supportsNativeBeforeInputEvent() {
52
- return typeof window !== 'undefined' &&
53
- window.InputEvent &&
54
- // @ts-ignore
55
- typeof InputEvent.prototype.getTargetRanges === 'function';
48
+ decrementButtonProps: AriaButtonProps,
49
+ /** Props for the number field's description element, if any. */
50
+ descriptionProps: HTMLAttributes<HTMLElement>,
51
+ /** Props for the number field's error message element, if any. */
52
+ errorMessageProps: HTMLAttributes<HTMLElement>
56
53
  }
57
54
 
58
55
  /**
@@ -72,7 +69,14 @@ export function useNumberField(props: AriaNumberFieldProps, state: NumberFieldSt
72
69
  autoFocus,
73
70
  validationState,
74
71
  label,
75
- formatOptions
72
+ formatOptions,
73
+ onBlur,
74
+ onFocus,
75
+ onFocusChange,
76
+ onKeyDown,
77
+ onKeyUp,
78
+ description,
79
+ errorMessage
76
80
  } = props;
77
81
 
78
82
  let {
@@ -115,23 +119,26 @@ export function useNumberField(props: AriaNumberFieldProps, state: NumberFieldSt
115
119
  }
116
120
  );
117
121
 
122
+ let [focusWithin, setFocusWithin] = useState(false);
123
+ let {focusWithinProps} = useFocusWithin({isDisabled, onFocusWithinChange: setFocusWithin});
124
+
118
125
  let onWheel = useCallback((e) => {
119
- // If the input isn't supposed to receive input, do nothing.
120
- // If the ctrlKey is pressed, this is a zoom event, do nothing.
121
- if (isDisabled || isReadOnly || e.ctrlKey) {
126
+ // if on a trackpad, users can scroll in both X and Y at once, check the magnitude of the change
127
+ // if it's mostly in the X direction, then just return, the user probably doesn't mean to inc/dec
128
+ // this isn't perfect, events come in fast with small deltas and a part of the scroll may give a false indication
129
+ // especially if the user is scrolling near 45deg
130
+ if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) {
122
131
  return;
123
132
  }
124
-
125
- // stop scrolling the page
126
- e.preventDefault();
127
-
128
133
  if (e.deltaY > 0) {
129
134
  increment();
130
135
  } else if (e.deltaY < 0) {
131
136
  decrement();
132
137
  }
133
- }, [isReadOnly, isDisabled, decrement, increment]);
134
- useScrollWheel({onScroll: onWheel, capture: false}, inputRef);
138
+ }, [decrement, increment]);
139
+ // If the input isn't supposed to receive input, disable scrolling.
140
+ let scrollingDisabled = isDisabled || isReadOnly || !focusWithin;
141
+ useScrollWheel({onScroll: onWheel, isDisabled: scrollingDisabled}, inputRef);
135
142
 
136
143
  // The inputMode attribute influences the software keyboard that is shown on touch devices.
137
144
  // Browsers and operating systems are quite inconsistent about what keys are available, however.
@@ -161,96 +168,14 @@ export function useNumberField(props: AriaNumberFieldProps, state: NumberFieldSt
161
168
  }
162
169
  }
163
170
 
164
- let stateRef = useRef(state);
165
- stateRef.current = state;
166
-
167
- // All browsers implement the 'beforeinput' event natively except Firefox
168
- // (currently behind a flag as of Firefox 84). React's polyfill does not
169
- // run in all cases that the native event fires, e.g. when deleting text.
170
- // Use the native event if available so that we can prevent invalid deletions.
171
- // We do not attempt to polyfill this in Firefox since it would be very complicated,
172
- // the benefit of doing so is fairly minor, and it's going to be natively supported soon.
173
- useEffect(() => {
174
- if (!supportsNativeBeforeInputEvent()) {
175
- return;
176
- }
177
-
178
- let input = inputRef.current;
179
-
180
- let onBeforeInput = (e: InputEvent) => {
181
- let state = stateRef.current;
182
-
183
- // Compute the next value of the input if the event is allowed to proceed.
184
- // See https://www.w3.org/TR/input-events-2/#interface-InputEvent-Attributes for a full list of input types.
185
- let nextValue: string;
186
- switch (e.inputType) {
187
- case 'historyUndo':
188
- case 'historyRedo':
189
- // Explicitly allow undo/redo. e.data is null in this case, but there's no need to validate,
190
- // because presumably the input would have already been validated previously.
191
- return;
192
- case 'deleteContent':
193
- case 'deleteByCut':
194
- case 'deleteByDrag':
195
- nextValue = input.value.slice(0, input.selectionStart) + input.value.slice(input.selectionEnd);
196
- break;
197
- case 'deleteContentForward':
198
- // This is potentially incorrect, since the browser may actually delete more than a single UTF-16
199
- // character. In reality, a full Unicode grapheme cluster consisting of multiple UTF-16 characters
200
- // or code points may be deleted. However, in our currently supported locales, there are no such cases.
201
- // If we support additional locales in the future, this may need to change.
202
- nextValue = input.selectionEnd === input.selectionStart
203
- ? input.value.slice(0, input.selectionStart) + input.value.slice(input.selectionEnd + 1)
204
- : input.value.slice(0, input.selectionStart) + input.value.slice(input.selectionEnd);
205
- break;
206
- case 'deleteContentBackward':
207
- nextValue = input.selectionEnd === input.selectionStart
208
- ? input.value.slice(0, input.selectionStart - 1) + input.value.slice(input.selectionStart)
209
- : input.value.slice(0, input.selectionStart) + input.value.slice(input.selectionEnd);
210
- break;
211
- default:
212
- if (e.data != null) {
213
- nextValue =
214
- input.value.slice(0, input.selectionStart) +
215
- e.data +
216
- input.value.slice(input.selectionEnd);
217
- }
218
- break;
219
- }
220
-
221
- // If we did not compute a value, or the new value is invalid, prevent the event
222
- // so that the browser does not update the input text, move the selection, or add to
223
- // the undo/redo stack.
224
- if (nextValue == null || !state.validate(nextValue)) {
225
- e.preventDefault();
226
- }
227
- };
228
-
229
- input.addEventListener('beforeinput', onBeforeInput, false);
230
- return () => {
231
- input.removeEventListener('beforeinput', onBeforeInput, false);
232
- };
233
- }, [inputRef, stateRef]);
234
-
235
- let onBeforeInput = !supportsNativeBeforeInputEvent()
236
- ? e => {
237
- let nextValue =
238
- e.target.value.slice(0, e.target.selectionStart) +
239
- e.data +
240
- e.target.value.slice(e.target.selectionEnd);
241
-
242
- if (!state.validate(nextValue)) {
243
- e.preventDefault();
244
- }
245
- }
246
- : null;
247
-
248
171
  let onChange = value => {
249
172
  state.setInputValue(value);
250
173
  };
251
174
 
252
- let compositionStartState = useRef(null);
253
- let {labelProps, inputProps: textFieldProps} = useTextField({
175
+ let domProps = filterDOMProps(props);
176
+
177
+ let {labelProps, inputProps: textFieldProps, descriptionProps, errorMessageProps} = useFormattedTextField({
178
+ ...domProps,
254
179
  label,
255
180
  autoFocus,
256
181
  isDisabled,
@@ -265,34 +190,14 @@ export function useNumberField(props: AriaNumberFieldProps, state: NumberFieldSt
265
190
  type: 'text', // Can't use type="number" because then we can't have things like $ in the field.
266
191
  inputMode,
267
192
  onChange,
268
- onBeforeInput,
269
- onCompositionStart() {
270
- // Chrome does not implement Input Events Level 2, which specifies the insertFromComposition
271
- // and deleteByComposition inputType values for the beforeinput event. These are meant to occur
272
- // at the end of a composition (e.g. Pinyin IME, Android auto correct, etc.), and crucially, are
273
- // cancelable. The insertCompositionText and deleteCompositionText input types are not cancelable,
274
- // nor would we want to cancel them because the input from the user is incomplete at that point.
275
- // In Safari, insertFromComposition/deleteFromComposition will fire, however, allowing us to cancel
276
- // the final composition result if it is invalid. As a fallback for Chrome and Firefox, which either
277
- // don't support Input Events Level 2, or beforeinput at all, we store the state of the input when
278
- // the compositionstart event fires, and undo the changes in compositionend (below) if it is invalid.
279
- // Unfortunately, this messes up the undo/redo stack, but until insertFromComposition/deleteByComposition
280
- // are implemented, there is no other way to prevent composed input.
281
- // See https://bugs.chromium.org/p/chromium/issues/detail?id=1022204
282
- let {value, selectionStart, selectionEnd} = inputRef.current;
283
- compositionStartState.current = {value, selectionStart, selectionEnd};
284
- },
285
- onCompositionEnd() {
286
- if (!state.validate(inputRef.current.value)) {
287
- // Restore the input value in the DOM immediately so we can synchronously update the selection position.
288
- // But also update the value in React state as well so it is correct for future updates.
289
- let {value, selectionStart, selectionEnd} = compositionStartState.current;
290
- inputRef.current.value = value;
291
- inputRef.current.setSelectionRange(selectionStart, selectionEnd);
292
- state.setInputValue(value);
293
- }
294
- }
295
- }, inputRef);
193
+ onBlur,
194
+ onFocus,
195
+ onFocusChange,
196
+ onKeyDown,
197
+ onKeyUp,
198
+ description,
199
+ errorMessage
200
+ }, state, inputRef);
296
201
 
297
202
  let inputProps = mergeProps(
298
203
  spinButtonProps,
@@ -374,23 +279,14 @@ export function useNumberField(props: AriaNumberFieldProps, state: NumberFieldSt
374
279
  groupProps: {
375
280
  role: 'group',
376
281
  'aria-disabled': isDisabled,
377
- 'aria-invalid': validationState === 'invalid' ? 'true' : undefined
282
+ 'aria-invalid': validationState === 'invalid' ? 'true' : undefined,
283
+ ...focusWithinProps
378
284
  },
379
285
  labelProps,
380
286
  inputProps,
381
287
  incrementButtonProps,
382
- decrementButtonProps
288
+ decrementButtonProps,
289
+ errorMessageProps,
290
+ descriptionProps
383
291
  };
384
292
  }
385
-
386
- // scroll wheel needs to be added not passively so it's cancelable, small helper hook to remember that
387
- function useScrollWheel({onScroll, capture}: {onScroll: (e) => void, capture: boolean}, ref: RefObject<HTMLElement>) {
388
- useEffect(() => {
389
- let elem = ref.current;
390
- elem.addEventListener('wheel', onScroll, capture);
391
-
392
- return () => {
393
- elem.removeEventListener('wheel', onScroll, capture);
394
- };
395
- }, [onScroll, ref, capture]);
396
- }