@react-aria/textfield 3.5.1 → 3.5.4
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 +24 -24
- package/dist/module.js +23 -23
- package/package.json +7 -7
package/dist/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var $
|
|
2
|
-
var $
|
|
3
|
-
var $
|
|
4
|
-
var $
|
|
1
|
+
var $iITAC$reactariautils = require("@react-aria/utils");
|
|
2
|
+
var $iITAC$reactarialabel = require("@react-aria/label");
|
|
3
|
+
var $iITAC$reactariafocus = require("@react-aria/focus");
|
|
4
|
+
var $iITAC$react = require("react");
|
|
5
5
|
|
|
6
6
|
function $parcel$exportWildcard(dest, source) {
|
|
7
7
|
Object.keys(source).forEach(function(key) {
|
|
@@ -22,18 +22,18 @@ function $parcel$exportWildcard(dest, source) {
|
|
|
22
22
|
function $parcel$export(e, n, v, s) {
|
|
23
23
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
24
24
|
}
|
|
25
|
-
var $
|
|
25
|
+
var $9076f978e02df845$exports = {};
|
|
26
26
|
|
|
27
|
-
$parcel$export($
|
|
27
|
+
$parcel$export($9076f978e02df845$exports, "useTextField", () => $9076f978e02df845$export$712718f7aec83d5);
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
function $
|
|
31
|
+
function $9076f978e02df845$export$712718f7aec83d5(props, ref) {
|
|
32
32
|
let { inputElementType: inputElementType = 'input' , isDisabled: isDisabled = false , isRequired: isRequired = false , isReadOnly: isReadOnly = false , validationState: validationState , type: type = 'text' , onChange: onChange = ()=>{
|
|
33
33
|
} } = props;
|
|
34
|
-
let { focusableProps: focusableProps } = $
|
|
35
|
-
let { labelProps: labelProps , fieldProps: fieldProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = $
|
|
36
|
-
let domProps = $
|
|
34
|
+
let { focusableProps: focusableProps } = $iITAC$reactariafocus.useFocusable(props, ref);
|
|
35
|
+
let { labelProps: labelProps , fieldProps: fieldProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = $iITAC$reactarialabel.useField(props);
|
|
36
|
+
let domProps = $iITAC$reactariautils.filterDOMProps(props, {
|
|
37
37
|
labelable: true
|
|
38
38
|
});
|
|
39
39
|
const inputOnlyProps = {
|
|
@@ -42,7 +42,7 @@ function $761a185426eebf7a$export$712718f7aec83d5(props, ref) {
|
|
|
42
42
|
};
|
|
43
43
|
return {
|
|
44
44
|
labelProps: labelProps,
|
|
45
|
-
inputProps: $
|
|
45
|
+
inputProps: $iITAC$reactariautils.mergeProps(domProps, inputElementType === 'input' && inputOnlyProps, {
|
|
46
46
|
disabled: isDisabled,
|
|
47
47
|
readOnly: isReadOnly,
|
|
48
48
|
'aria-required': isRequired || undefined,
|
|
@@ -83,18 +83,18 @@ function $761a185426eebf7a$export$712718f7aec83d5(props, ref) {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
|
|
86
|
-
var $
|
|
86
|
+
var $56b68c3dab9bf16c$exports = {};
|
|
87
87
|
|
|
88
|
-
$parcel$export($
|
|
88
|
+
$parcel$export($56b68c3dab9bf16c$exports, "useFormattedTextField", () => $56b68c3dab9bf16c$export$4f384c9210e583c3);
|
|
89
89
|
|
|
90
90
|
|
|
91
91
|
|
|
92
|
-
function $
|
|
92
|
+
function $56b68c3dab9bf16c$var$supportsNativeBeforeInputEvent() {
|
|
93
93
|
return typeof window !== 'undefined' && window.InputEvent && // @ts-ignore
|
|
94
94
|
typeof InputEvent.prototype.getTargetRanges === 'function';
|
|
95
95
|
}
|
|
96
|
-
function $
|
|
97
|
-
let stateRef = $
|
|
96
|
+
function $56b68c3dab9bf16c$export$4f384c9210e583c3(props, state1, inputRef) {
|
|
97
|
+
let stateRef = $iITAC$react.useRef(state1);
|
|
98
98
|
stateRef.current = state1;
|
|
99
99
|
// All browsers implement the 'beforeinput' event natively except Firefox
|
|
100
100
|
// (currently behind a flag as of Firefox 84). React's polyfill does not
|
|
@@ -102,8 +102,8 @@ function $43712ad07e8cd416$export$4f384c9210e583c3(props, state1, inputRef) {
|
|
|
102
102
|
// Use the native event if available so that we can prevent invalid deletions.
|
|
103
103
|
// We do not attempt to polyfill this in Firefox since it would be very complicated,
|
|
104
104
|
// the benefit of doing so is fairly minor, and it's going to be natively supported soon.
|
|
105
|
-
$
|
|
106
|
-
if (!$
|
|
105
|
+
$iITAC$react.useEffect(()=>{
|
|
106
|
+
if (!$56b68c3dab9bf16c$var$supportsNativeBeforeInputEvent()) return;
|
|
107
107
|
let input = inputRef.current;
|
|
108
108
|
let onBeforeInput = (e)=>{
|
|
109
109
|
let state = stateRef.current;
|
|
@@ -152,14 +152,14 @@ function $43712ad07e8cd416$export$4f384c9210e583c3(props, state1, inputRef) {
|
|
|
152
152
|
inputRef,
|
|
153
153
|
stateRef
|
|
154
154
|
]);
|
|
155
|
-
let onBeforeInput1 = !$
|
|
155
|
+
let onBeforeInput1 = !$56b68c3dab9bf16c$var$supportsNativeBeforeInputEvent() ? (e)=>{
|
|
156
156
|
let nextValue = e.target.value.slice(0, e.target.selectionStart) + e.data + e.target.value.slice(e.target.selectionEnd);
|
|
157
157
|
if (!state1.validate(nextValue)) e.preventDefault();
|
|
158
158
|
} : null;
|
|
159
|
-
let { labelProps: labelProps , inputProps: textFieldProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = $
|
|
160
|
-
let compositionStartState = $
|
|
159
|
+
let { labelProps: labelProps , inputProps: textFieldProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = $9076f978e02df845$export$712718f7aec83d5(props, inputRef);
|
|
160
|
+
let compositionStartState = $iITAC$react.useRef(null);
|
|
161
161
|
return {
|
|
162
|
-
inputProps: $
|
|
162
|
+
inputProps: $iITAC$reactariautils.mergeProps(textFieldProps, {
|
|
163
163
|
onBeforeInput: onBeforeInput1,
|
|
164
164
|
onCompositionStart () {
|
|
165
165
|
// Chrome does not implement Input Events Level 2, which specifies the insertFromComposition
|
|
@@ -199,8 +199,8 @@ function $43712ad07e8cd416$export$4f384c9210e583c3(props, state1, inputRef) {
|
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
|
|
202
|
-
$parcel$exportWildcard(module.exports, $
|
|
203
|
-
$parcel$exportWildcard(module.exports, $
|
|
202
|
+
$parcel$exportWildcard(module.exports, $9076f978e02df845$exports);
|
|
203
|
+
$parcel$exportWildcard(module.exports, $56b68c3dab9bf16c$exports);
|
|
204
204
|
|
|
205
205
|
|
|
206
206
|
//# sourceMappingURL=main.js.map
|
package/dist/module.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import {filterDOMProps as $
|
|
2
|
-
import {useField as $
|
|
3
|
-
import {useFocusable as $
|
|
4
|
-
import {useRef as $
|
|
1
|
+
import {filterDOMProps as $kOq5K$filterDOMProps, mergeProps as $kOq5K$mergeProps} from "@react-aria/utils";
|
|
2
|
+
import {useField as $kOq5K$useField} from "@react-aria/label";
|
|
3
|
+
import {useFocusable as $kOq5K$useFocusable} from "@react-aria/focus";
|
|
4
|
+
import {useRef as $kOq5K$useRef, useEffect as $kOq5K$useEffect} from "react";
|
|
5
5
|
|
|
6
6
|
function $parcel$export(e, n, v, s) {
|
|
7
7
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
8
8
|
}
|
|
9
|
-
var $
|
|
9
|
+
var $2d73ec29415bd339$exports = {};
|
|
10
10
|
|
|
11
|
-
$parcel$export($
|
|
11
|
+
$parcel$export($2d73ec29415bd339$exports, "useTextField", () => $2d73ec29415bd339$export$712718f7aec83d5);
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
function $
|
|
15
|
+
function $2d73ec29415bd339$export$712718f7aec83d5(props, ref) {
|
|
16
16
|
let { inputElementType: inputElementType = 'input' , isDisabled: isDisabled = false , isRequired: isRequired = false , isReadOnly: isReadOnly = false , validationState: validationState , type: type = 'text' , onChange: onChange = ()=>{
|
|
17
17
|
} } = props;
|
|
18
|
-
let { focusableProps: focusableProps } = $
|
|
19
|
-
let { labelProps: labelProps , fieldProps: fieldProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = $
|
|
20
|
-
let domProps = $
|
|
18
|
+
let { focusableProps: focusableProps } = $kOq5K$useFocusable(props, ref);
|
|
19
|
+
let { labelProps: labelProps , fieldProps: fieldProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = $kOq5K$useField(props);
|
|
20
|
+
let domProps = $kOq5K$filterDOMProps(props, {
|
|
21
21
|
labelable: true
|
|
22
22
|
});
|
|
23
23
|
const inputOnlyProps = {
|
|
@@ -26,7 +26,7 @@ function $7811e7c771d6e497$export$712718f7aec83d5(props, ref) {
|
|
|
26
26
|
};
|
|
27
27
|
return {
|
|
28
28
|
labelProps: labelProps,
|
|
29
|
-
inputProps: $
|
|
29
|
+
inputProps: $kOq5K$mergeProps(domProps, inputElementType === 'input' && inputOnlyProps, {
|
|
30
30
|
disabled: isDisabled,
|
|
31
31
|
readOnly: isReadOnly,
|
|
32
32
|
'aria-required': isRequired || undefined,
|
|
@@ -67,18 +67,18 @@ function $7811e7c771d6e497$export$712718f7aec83d5(props, ref) {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
|
|
70
|
-
var $
|
|
70
|
+
var $d841c8010a73d545$exports = {};
|
|
71
71
|
|
|
72
|
-
$parcel$export($
|
|
72
|
+
$parcel$export($d841c8010a73d545$exports, "useFormattedTextField", () => $d841c8010a73d545$export$4f384c9210e583c3);
|
|
73
73
|
|
|
74
74
|
|
|
75
75
|
|
|
76
|
-
function $
|
|
76
|
+
function $d841c8010a73d545$var$supportsNativeBeforeInputEvent() {
|
|
77
77
|
return typeof window !== 'undefined' && window.InputEvent && // @ts-ignore
|
|
78
78
|
typeof InputEvent.prototype.getTargetRanges === 'function';
|
|
79
79
|
}
|
|
80
|
-
function $
|
|
81
|
-
let stateRef = $
|
|
80
|
+
function $d841c8010a73d545$export$4f384c9210e583c3(props, state1, inputRef) {
|
|
81
|
+
let stateRef = $kOq5K$useRef(state1);
|
|
82
82
|
stateRef.current = state1;
|
|
83
83
|
// All browsers implement the 'beforeinput' event natively except Firefox
|
|
84
84
|
// (currently behind a flag as of Firefox 84). React's polyfill does not
|
|
@@ -86,8 +86,8 @@ function $7f9aed3807b71324$export$4f384c9210e583c3(props, state1, inputRef) {
|
|
|
86
86
|
// Use the native event if available so that we can prevent invalid deletions.
|
|
87
87
|
// We do not attempt to polyfill this in Firefox since it would be very complicated,
|
|
88
88
|
// the benefit of doing so is fairly minor, and it's going to be natively supported soon.
|
|
89
|
-
$
|
|
90
|
-
if (!$
|
|
89
|
+
$kOq5K$useEffect(()=>{
|
|
90
|
+
if (!$d841c8010a73d545$var$supportsNativeBeforeInputEvent()) return;
|
|
91
91
|
let input = inputRef.current;
|
|
92
92
|
let onBeforeInput = (e)=>{
|
|
93
93
|
let state = stateRef.current;
|
|
@@ -136,14 +136,14 @@ function $7f9aed3807b71324$export$4f384c9210e583c3(props, state1, inputRef) {
|
|
|
136
136
|
inputRef,
|
|
137
137
|
stateRef
|
|
138
138
|
]);
|
|
139
|
-
let onBeforeInput1 = !$
|
|
139
|
+
let onBeforeInput1 = !$d841c8010a73d545$var$supportsNativeBeforeInputEvent() ? (e)=>{
|
|
140
140
|
let nextValue = e.target.value.slice(0, e.target.selectionStart) + e.data + e.target.value.slice(e.target.selectionEnd);
|
|
141
141
|
if (!state1.validate(nextValue)) e.preventDefault();
|
|
142
142
|
} : null;
|
|
143
|
-
let { labelProps: labelProps , inputProps: textFieldProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = $
|
|
144
|
-
let compositionStartState = $
|
|
143
|
+
let { labelProps: labelProps , inputProps: textFieldProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = $2d73ec29415bd339$export$712718f7aec83d5(props, inputRef);
|
|
144
|
+
let compositionStartState = $kOq5K$useRef(null);
|
|
145
145
|
return {
|
|
146
|
-
inputProps: $
|
|
146
|
+
inputProps: $kOq5K$mergeProps(textFieldProps, {
|
|
147
147
|
onBeforeInput: onBeforeInput1,
|
|
148
148
|
onCompositionStart () {
|
|
149
149
|
// Chrome does not implement Input Events Level 2, which specifies the insertFromComposition
|
|
@@ -185,5 +185,5 @@ function $7f9aed3807b71324$export$4f384c9210e583c3(props, state1, inputRef) {
|
|
|
185
185
|
|
|
186
186
|
|
|
187
187
|
|
|
188
|
-
export {$
|
|
188
|
+
export {$2d73ec29415bd339$export$712718f7aec83d5 as useTextField, $d841c8010a73d545$export$4f384c9210e583c3 as useFormattedTextField};
|
|
189
189
|
//# sourceMappingURL=module.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/textfield",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.4",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@babel/runtime": "^7.6.2",
|
|
21
|
-
"@react-aria/focus": "^3.5.
|
|
22
|
-
"@react-aria/label": "^3.2.
|
|
23
|
-
"@react-aria/utils": "^3.11.
|
|
24
|
-
"@react-types/shared": "^3.11.
|
|
25
|
-
"@react-types/textfield": "^3.3.
|
|
21
|
+
"@react-aria/focus": "^3.5.4",
|
|
22
|
+
"@react-aria/label": "^3.2.4",
|
|
23
|
+
"@react-aria/utils": "^3.11.3",
|
|
24
|
+
"@react-types/shared": "^3.11.2",
|
|
25
|
+
"@react-types/textfield": "^3.3.3"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"react": "^16.8.0 || ^17.0.0-rc.1"
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "e7708349a637642a30d33a11ca4a75ad5829eaa3"
|
|
34
34
|
}
|