@react-aria/textfield 3.14.4 → 3.14.5

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.
@@ -22,8 +22,8 @@ $parcel$export(module.exports, "useFormattedTextField", () => $56b68c3dab9bf16c$
22
22
 
23
23
 
24
24
  function $56b68c3dab9bf16c$var$supportsNativeBeforeInputEvent() {
25
- return typeof window !== "undefined" && window.InputEvent && // @ts-ignore
26
- typeof InputEvent.prototype.getTargetRanges === "function";
25
+ return typeof window !== 'undefined' && window.InputEvent && // @ts-ignore
26
+ typeof InputEvent.prototype.getTargetRanges === 'function';
27
27
  }
28
28
  function $56b68c3dab9bf16c$export$4f384c9210e583c3(props, state, inputRef) {
29
29
  // All browsers implement the 'beforeinput' event natively except Firefox
@@ -38,31 +38,31 @@ function $56b68c3dab9bf16c$export$4f384c9210e583c3(props, state, inputRef) {
38
38
  // See https://www.w3.org/TR/input-events-2/#interface-InputEvent-Attributes for a full list of input types.
39
39
  let nextValue;
40
40
  switch(e.inputType){
41
- case "historyUndo":
42
- case "historyRedo":
41
+ case 'historyUndo':
42
+ case 'historyRedo':
43
43
  // Explicitly allow undo/redo. e.data is null in this case, but there's no need to validate,
44
44
  // because presumably the input would have already been validated previously.
45
45
  return;
46
- case "insertLineBreak":
46
+ case 'insertLineBreak':
47
47
  // Explicitly allow "insertLineBreak" event, to allow onSubmit for "enter" key. e.data is null in this case.
48
48
  return;
49
- case "deleteContent":
50
- case "deleteByCut":
51
- case "deleteByDrag":
49
+ case 'deleteContent':
50
+ case 'deleteByCut':
51
+ case 'deleteByDrag':
52
52
  nextValue = input.value.slice(0, input.selectionStart) + input.value.slice(input.selectionEnd);
53
53
  break;
54
- case "deleteContentForward":
54
+ case 'deleteContentForward':
55
55
  // This is potentially incorrect, since the browser may actually delete more than a single UTF-16
56
56
  // character. In reality, a full Unicode grapheme cluster consisting of multiple UTF-16 characters
57
57
  // or code points may be deleted. However, in our currently supported locales, there are no such cases.
58
58
  // If we support additional locales in the future, this may need to change.
59
59
  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);
60
60
  break;
61
- case "deleteContentBackward":
61
+ case 'deleteContentBackward':
62
62
  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);
63
63
  break;
64
- case "deleteSoftLineBackward":
65
- case "deleteHardLineBackward":
64
+ case 'deleteSoftLineBackward':
65
+ case 'deleteHardLineBackward':
66
66
  nextValue = input.value.slice(input.selectionStart);
67
67
  break;
68
68
  default:
@@ -77,9 +77,9 @@ function $56b68c3dab9bf16c$export$4f384c9210e583c3(props, state, inputRef) {
77
77
  (0, $6PuoT$react.useEffect)(()=>{
78
78
  if (!$56b68c3dab9bf16c$var$supportsNativeBeforeInputEvent()) return;
79
79
  let input = inputRef.current;
80
- input.addEventListener("beforeinput", onBeforeInputFallback, false);
80
+ input.addEventListener('beforeinput', onBeforeInputFallback, false);
81
81
  return ()=>{
82
- input.removeEventListener("beforeinput", onBeforeInputFallback, false);
82
+ input.removeEventListener('beforeinput', onBeforeInputFallback, false);
83
83
  };
84
84
  }, [
85
85
  inputRef,
@@ -16,8 +16,8 @@ import {useEffect as $jyGKS$useEffect, useRef as $jyGKS$useRef} from "react";
16
16
 
17
17
 
18
18
  function $d841c8010a73d545$var$supportsNativeBeforeInputEvent() {
19
- return typeof window !== "undefined" && window.InputEvent && // @ts-ignore
20
- typeof InputEvent.prototype.getTargetRanges === "function";
19
+ return typeof window !== 'undefined' && window.InputEvent && // @ts-ignore
20
+ typeof InputEvent.prototype.getTargetRanges === 'function';
21
21
  }
22
22
  function $d841c8010a73d545$export$4f384c9210e583c3(props, state, inputRef) {
23
23
  // All browsers implement the 'beforeinput' event natively except Firefox
@@ -32,31 +32,31 @@ function $d841c8010a73d545$export$4f384c9210e583c3(props, state, inputRef) {
32
32
  // See https://www.w3.org/TR/input-events-2/#interface-InputEvent-Attributes for a full list of input types.
33
33
  let nextValue;
34
34
  switch(e.inputType){
35
- case "historyUndo":
36
- case "historyRedo":
35
+ case 'historyUndo':
36
+ case 'historyRedo':
37
37
  // Explicitly allow undo/redo. e.data is null in this case, but there's no need to validate,
38
38
  // because presumably the input would have already been validated previously.
39
39
  return;
40
- case "insertLineBreak":
40
+ case 'insertLineBreak':
41
41
  // Explicitly allow "insertLineBreak" event, to allow onSubmit for "enter" key. e.data is null in this case.
42
42
  return;
43
- case "deleteContent":
44
- case "deleteByCut":
45
- case "deleteByDrag":
43
+ case 'deleteContent':
44
+ case 'deleteByCut':
45
+ case 'deleteByDrag':
46
46
  nextValue = input.value.slice(0, input.selectionStart) + input.value.slice(input.selectionEnd);
47
47
  break;
48
- case "deleteContentForward":
48
+ case 'deleteContentForward':
49
49
  // This is potentially incorrect, since the browser may actually delete more than a single UTF-16
50
50
  // character. In reality, a full Unicode grapheme cluster consisting of multiple UTF-16 characters
51
51
  // or code points may be deleted. However, in our currently supported locales, there are no such cases.
52
52
  // If we support additional locales in the future, this may need to change.
53
53
  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);
54
54
  break;
55
- case "deleteContentBackward":
55
+ case 'deleteContentBackward':
56
56
  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);
57
57
  break;
58
- case "deleteSoftLineBackward":
59
- case "deleteHardLineBackward":
58
+ case 'deleteSoftLineBackward':
59
+ case 'deleteHardLineBackward':
60
60
  nextValue = input.value.slice(input.selectionStart);
61
61
  break;
62
62
  default:
@@ -71,9 +71,9 @@ function $d841c8010a73d545$export$4f384c9210e583c3(props, state, inputRef) {
71
71
  (0, $jyGKS$useEffect)(()=>{
72
72
  if (!$d841c8010a73d545$var$supportsNativeBeforeInputEvent()) return;
73
73
  let input = inputRef.current;
74
- input.addEventListener("beforeinput", onBeforeInputFallback, false);
74
+ input.addEventListener('beforeinput', onBeforeInputFallback, false);
75
75
  return ()=>{
76
- input.removeEventListener("beforeinput", onBeforeInputFallback, false);
76
+ input.removeEventListener('beforeinput', onBeforeInputFallback, false);
77
77
  };
78
78
  }, [
79
79
  inputRef,
@@ -128,4 +128,4 @@ function $d841c8010a73d545$export$4f384c9210e583c3(props, state, inputRef) {
128
128
 
129
129
 
130
130
  export {$d841c8010a73d545$export$4f384c9210e583c3 as useFormattedTextField};
131
- //# sourceMappingURL=useFormattedTextField.mjs.map
131
+ //# sourceMappingURL=useFormattedTextField.module.js.map
@@ -16,8 +16,8 @@ import {useEffect as $jyGKS$useEffect, useRef as $jyGKS$useRef} from "react";
16
16
 
17
17
 
18
18
  function $d841c8010a73d545$var$supportsNativeBeforeInputEvent() {
19
- return typeof window !== "undefined" && window.InputEvent && // @ts-ignore
20
- typeof InputEvent.prototype.getTargetRanges === "function";
19
+ return typeof window !== 'undefined' && window.InputEvent && // @ts-ignore
20
+ typeof InputEvent.prototype.getTargetRanges === 'function';
21
21
  }
22
22
  function $d841c8010a73d545$export$4f384c9210e583c3(props, state, inputRef) {
23
23
  // All browsers implement the 'beforeinput' event natively except Firefox
@@ -32,31 +32,31 @@ function $d841c8010a73d545$export$4f384c9210e583c3(props, state, inputRef) {
32
32
  // See https://www.w3.org/TR/input-events-2/#interface-InputEvent-Attributes for a full list of input types.
33
33
  let nextValue;
34
34
  switch(e.inputType){
35
- case "historyUndo":
36
- case "historyRedo":
35
+ case 'historyUndo':
36
+ case 'historyRedo':
37
37
  // Explicitly allow undo/redo. e.data is null in this case, but there's no need to validate,
38
38
  // because presumably the input would have already been validated previously.
39
39
  return;
40
- case "insertLineBreak":
40
+ case 'insertLineBreak':
41
41
  // Explicitly allow "insertLineBreak" event, to allow onSubmit for "enter" key. e.data is null in this case.
42
42
  return;
43
- case "deleteContent":
44
- case "deleteByCut":
45
- case "deleteByDrag":
43
+ case 'deleteContent':
44
+ case 'deleteByCut':
45
+ case 'deleteByDrag':
46
46
  nextValue = input.value.slice(0, input.selectionStart) + input.value.slice(input.selectionEnd);
47
47
  break;
48
- case "deleteContentForward":
48
+ case 'deleteContentForward':
49
49
  // This is potentially incorrect, since the browser may actually delete more than a single UTF-16
50
50
  // character. In reality, a full Unicode grapheme cluster consisting of multiple UTF-16 characters
51
51
  // or code points may be deleted. However, in our currently supported locales, there are no such cases.
52
52
  // If we support additional locales in the future, this may need to change.
53
53
  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);
54
54
  break;
55
- case "deleteContentBackward":
55
+ case 'deleteContentBackward':
56
56
  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);
57
57
  break;
58
- case "deleteSoftLineBackward":
59
- case "deleteHardLineBackward":
58
+ case 'deleteSoftLineBackward':
59
+ case 'deleteHardLineBackward':
60
60
  nextValue = input.value.slice(input.selectionStart);
61
61
  break;
62
62
  default:
@@ -71,9 +71,9 @@ function $d841c8010a73d545$export$4f384c9210e583c3(props, state, inputRef) {
71
71
  (0, $jyGKS$useEffect)(()=>{
72
72
  if (!$d841c8010a73d545$var$supportsNativeBeforeInputEvent()) return;
73
73
  let input = inputRef.current;
74
- input.addEventListener("beforeinput", onBeforeInputFallback, false);
74
+ input.addEventListener('beforeinput', onBeforeInputFallback, false);
75
75
  return ()=>{
76
- input.removeEventListener("beforeinput", onBeforeInputFallback, false);
76
+ input.removeEventListener('beforeinput', onBeforeInputFallback, false);
77
77
  };
78
78
  }, [
79
79
  inputRef,
@@ -30,8 +30,8 @@ $parcel$export(module.exports, "useTextField", () => $9076f978e02df845$export$71
30
30
 
31
31
 
32
32
  function $9076f978e02df845$export$712718f7aec83d5(props, ref) {
33
- let { inputElementType: inputElementType = "input", isDisabled: isDisabled = false, isRequired: isRequired = false, isReadOnly: isReadOnly = false, type: type = "text", validationBehavior: validationBehavior = "aria" } = props;
34
- let [value, setValue] = (0, $4Z7CR$reactstatelyutils.useControlledState)(props.value, props.defaultValue || "", props.onChange);
33
+ let { inputElementType: inputElementType = 'input', isDisabled: isDisabled = false, isRequired: isRequired = false, isReadOnly: isReadOnly = false, type: type = 'text', validationBehavior: validationBehavior = 'aria' } = props;
34
+ let [value, setValue] = (0, $4Z7CR$reactstatelyutils.useControlledState)(props.value, props.defaultValue || '', props.onChange);
35
35
  let { focusableProps: focusableProps } = (0, $4Z7CR$reactariafocus.useFocusable)(props, ref);
36
36
  let validationState = (0, $4Z7CR$reactstatelyform.useFormValidationState)({
37
37
  ...props,
@@ -62,7 +62,7 @@ function $9076f978e02df845$export$712718f7aec83d5(props, ref) {
62
62
  // https://github.com/facebook/react/issues/11896
63
63
  if (ref.current instanceof (0, $4Z7CR$reactariautils.getOwnerWindow)(ref.current).HTMLTextAreaElement) {
64
64
  let input = ref.current;
65
- Object.defineProperty(input, "defaultValue", {
65
+ Object.defineProperty(input, 'defaultValue', {
66
66
  get: ()=>input.value,
67
67
  set: ()=>{},
68
68
  configurable: true
@@ -73,16 +73,16 @@ function $9076f978e02df845$export$712718f7aec83d5(props, ref) {
73
73
  ]);
74
74
  return {
75
75
  labelProps: labelProps,
76
- inputProps: (0, $4Z7CR$reactariautils.mergeProps)(domProps, inputElementType === "input" && inputOnlyProps, {
76
+ inputProps: (0, $4Z7CR$reactariautils.mergeProps)(domProps, inputElementType === 'input' && inputOnlyProps, {
77
77
  disabled: isDisabled,
78
78
  readOnly: isReadOnly,
79
- required: isRequired && validationBehavior === "native",
80
- "aria-required": isRequired && validationBehavior === "aria" || undefined,
81
- "aria-invalid": isInvalid || undefined,
82
- "aria-errormessage": props["aria-errormessage"],
83
- "aria-activedescendant": props["aria-activedescendant"],
84
- "aria-autocomplete": props["aria-autocomplete"],
85
- "aria-haspopup": props["aria-haspopup"],
79
+ required: isRequired && validationBehavior === 'native',
80
+ 'aria-required': isRequired && validationBehavior === 'aria' || undefined,
81
+ 'aria-invalid': isInvalid || undefined,
82
+ 'aria-errormessage': props['aria-errormessage'],
83
+ 'aria-activedescendant': props['aria-activedescendant'],
84
+ 'aria-autocomplete': props['aria-autocomplete'],
85
+ 'aria-haspopup': props['aria-haspopup'],
86
86
  value: value,
87
87
  onChange: (e)=>setValue(e.target.value),
88
88
  autoComplete: props.autoComplete,
@@ -24,8 +24,8 @@ import {useFormValidationState as $ig234$useFormValidationState} from "@react-st
24
24
 
25
25
 
26
26
  function $2d73ec29415bd339$export$712718f7aec83d5(props, ref) {
27
- let { inputElementType: inputElementType = "input", isDisabled: isDisabled = false, isRequired: isRequired = false, isReadOnly: isReadOnly = false, type: type = "text", validationBehavior: validationBehavior = "aria" } = props;
28
- let [value, setValue] = (0, $ig234$useControlledState)(props.value, props.defaultValue || "", props.onChange);
27
+ let { inputElementType: inputElementType = 'input', isDisabled: isDisabled = false, isRequired: isRequired = false, isReadOnly: isReadOnly = false, type: type = 'text', validationBehavior: validationBehavior = 'aria' } = props;
28
+ let [value, setValue] = (0, $ig234$useControlledState)(props.value, props.defaultValue || '', props.onChange);
29
29
  let { focusableProps: focusableProps } = (0, $ig234$useFocusable)(props, ref);
30
30
  let validationState = (0, $ig234$useFormValidationState)({
31
31
  ...props,
@@ -56,7 +56,7 @@ function $2d73ec29415bd339$export$712718f7aec83d5(props, ref) {
56
56
  // https://github.com/facebook/react/issues/11896
57
57
  if (ref.current instanceof (0, $ig234$getOwnerWindow)(ref.current).HTMLTextAreaElement) {
58
58
  let input = ref.current;
59
- Object.defineProperty(input, "defaultValue", {
59
+ Object.defineProperty(input, 'defaultValue', {
60
60
  get: ()=>input.value,
61
61
  set: ()=>{},
62
62
  configurable: true
@@ -67,16 +67,16 @@ function $2d73ec29415bd339$export$712718f7aec83d5(props, ref) {
67
67
  ]);
68
68
  return {
69
69
  labelProps: labelProps,
70
- inputProps: (0, $ig234$mergeProps)(domProps, inputElementType === "input" && inputOnlyProps, {
70
+ inputProps: (0, $ig234$mergeProps)(domProps, inputElementType === 'input' && inputOnlyProps, {
71
71
  disabled: isDisabled,
72
72
  readOnly: isReadOnly,
73
- required: isRequired && validationBehavior === "native",
74
- "aria-required": isRequired && validationBehavior === "aria" || undefined,
75
- "aria-invalid": isInvalid || undefined,
76
- "aria-errormessage": props["aria-errormessage"],
77
- "aria-activedescendant": props["aria-activedescendant"],
78
- "aria-autocomplete": props["aria-autocomplete"],
79
- "aria-haspopup": props["aria-haspopup"],
73
+ required: isRequired && validationBehavior === 'native',
74
+ 'aria-required': isRequired && validationBehavior === 'aria' || undefined,
75
+ 'aria-invalid': isInvalid || undefined,
76
+ 'aria-errormessage': props['aria-errormessage'],
77
+ 'aria-activedescendant': props['aria-activedescendant'],
78
+ 'aria-autocomplete': props['aria-autocomplete'],
79
+ 'aria-haspopup': props['aria-haspopup'],
80
80
  value: value,
81
81
  onChange: (e)=>setValue(e.target.value),
82
82
  autoComplete: props.autoComplete,
@@ -112,4 +112,4 @@ function $2d73ec29415bd339$export$712718f7aec83d5(props, ref) {
112
112
 
113
113
 
114
114
  export {$2d73ec29415bd339$export$712718f7aec83d5 as useTextField};
115
- //# sourceMappingURL=useTextField.mjs.map
115
+ //# sourceMappingURL=useTextField.module.js.map
@@ -24,8 +24,8 @@ import {useFormValidationState as $ig234$useFormValidationState} from "@react-st
24
24
 
25
25
 
26
26
  function $2d73ec29415bd339$export$712718f7aec83d5(props, ref) {
27
- let { inputElementType: inputElementType = "input", isDisabled: isDisabled = false, isRequired: isRequired = false, isReadOnly: isReadOnly = false, type: type = "text", validationBehavior: validationBehavior = "aria" } = props;
28
- let [value, setValue] = (0, $ig234$useControlledState)(props.value, props.defaultValue || "", props.onChange);
27
+ let { inputElementType: inputElementType = 'input', isDisabled: isDisabled = false, isRequired: isRequired = false, isReadOnly: isReadOnly = false, type: type = 'text', validationBehavior: validationBehavior = 'aria' } = props;
28
+ let [value, setValue] = (0, $ig234$useControlledState)(props.value, props.defaultValue || '', props.onChange);
29
29
  let { focusableProps: focusableProps } = (0, $ig234$useFocusable)(props, ref);
30
30
  let validationState = (0, $ig234$useFormValidationState)({
31
31
  ...props,
@@ -56,7 +56,7 @@ function $2d73ec29415bd339$export$712718f7aec83d5(props, ref) {
56
56
  // https://github.com/facebook/react/issues/11896
57
57
  if (ref.current instanceof (0, $ig234$getOwnerWindow)(ref.current).HTMLTextAreaElement) {
58
58
  let input = ref.current;
59
- Object.defineProperty(input, "defaultValue", {
59
+ Object.defineProperty(input, 'defaultValue', {
60
60
  get: ()=>input.value,
61
61
  set: ()=>{},
62
62
  configurable: true
@@ -67,16 +67,16 @@ function $2d73ec29415bd339$export$712718f7aec83d5(props, ref) {
67
67
  ]);
68
68
  return {
69
69
  labelProps: labelProps,
70
- inputProps: (0, $ig234$mergeProps)(domProps, inputElementType === "input" && inputOnlyProps, {
70
+ inputProps: (0, $ig234$mergeProps)(domProps, inputElementType === 'input' && inputOnlyProps, {
71
71
  disabled: isDisabled,
72
72
  readOnly: isReadOnly,
73
- required: isRequired && validationBehavior === "native",
74
- "aria-required": isRequired && validationBehavior === "aria" || undefined,
75
- "aria-invalid": isInvalid || undefined,
76
- "aria-errormessage": props["aria-errormessage"],
77
- "aria-activedescendant": props["aria-activedescendant"],
78
- "aria-autocomplete": props["aria-autocomplete"],
79
- "aria-haspopup": props["aria-haspopup"],
73
+ required: isRequired && validationBehavior === 'native',
74
+ 'aria-required': isRequired && validationBehavior === 'aria' || undefined,
75
+ 'aria-invalid': isInvalid || undefined,
76
+ 'aria-errormessage': props['aria-errormessage'],
77
+ 'aria-activedescendant': props['aria-activedescendant'],
78
+ 'aria-autocomplete': props['aria-autocomplete'],
79
+ 'aria-haspopup': props['aria-haspopup'],
80
80
  value: value,
81
81
  onChange: (e)=>setValue(e.target.value),
82
82
  autoComplete: props.autoComplete,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/textfield",
3
- "version": "3.14.4",
3
+ "version": "3.14.5",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -22,14 +22,14 @@
22
22
  "url": "https://github.com/adobe/react-spectrum"
23
23
  },
24
24
  "dependencies": {
25
- "@react-aria/focus": "^3.17.0",
26
- "@react-aria/form": "^3.0.4",
27
- "@react-aria/label": "^3.7.7",
28
- "@react-aria/utils": "^3.24.0",
29
- "@react-stately/form": "^3.0.2",
30
- "@react-stately/utils": "^3.10.0",
31
- "@react-types/shared": "^3.23.0",
32
- "@react-types/textfield": "^3.9.2",
25
+ "@react-aria/focus": "^3.17.1",
26
+ "@react-aria/form": "^3.0.5",
27
+ "@react-aria/label": "^3.7.8",
28
+ "@react-aria/utils": "^3.24.1",
29
+ "@react-stately/form": "^3.0.3",
30
+ "@react-stately/utils": "^3.10.1",
31
+ "@react-types/shared": "^3.23.1",
32
+ "@react-types/textfield": "^3.9.3",
33
33
  "@swc/helpers": "^0.5.0"
34
34
  },
35
35
  "peerDependencies": {
@@ -38,5 +38,5 @@
38
38
  "publishConfig": {
39
39
  "access": "public"
40
40
  },
41
- "gitHead": "f645f29edc1322153fd60af4640cbcab1d992dbd"
41
+ "gitHead": "b77d7d594dff4dcfb5359bffbcfd18142b146433"
42
42
  }