@react-spectrum/textfield 3.12.0 → 3.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/TextArea.main.js +7 -7
- package/dist/TextArea.mjs +8 -8
- package/dist/TextArea.module.js +7 -7
- package/dist/TextField.main.js +1 -1
- package/dist/TextField.mjs +2 -2
- package/dist/TextField.module.js +1 -1
- package/dist/TextFieldBase.main.js +19 -19
- package/dist/TextFieldBase.main.js.map +1 -1
- package/dist/TextFieldBase.mjs +20 -20
- package/dist/TextFieldBase.module.js +19 -19
- package/dist/TextFieldBase.module.js.map +1 -1
- package/dist/textfield_vars_css.mjs +1 -1
- package/dist/types.d.ts +3 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/{vars.07716e14.css → vars.9c96c732.css} +2 -1
- package/dist/vars.9c96c732.css.map +1 -0
- package/package.json +14 -14
- package/src/TextFieldBase.tsx +5 -5
- package/dist/vars.07716e14.css.map +0 -1
package/dist/TextArea.main.js
CHANGED
@@ -39,7 +39,7 @@ function $eec649e464f3832d$var$TextArea(props, ref) {
|
|
39
39
|
let { isDisabled: isDisabled = false, isQuiet: isQuiet = false, isReadOnly: isReadOnly = false, isRequired: isRequired = false, onChange: onChange, ...otherProps } = props;
|
40
40
|
var _props_defaultValue;
|
41
41
|
// not in stately because this is so we know when to re-measure, which is a spectrum design
|
42
|
-
let [inputValue, setInputValue] = (0, $5VIId$reactstatelyutils.useControlledState)(props.value, (_props_defaultValue = props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue :
|
42
|
+
let [inputValue, setInputValue] = (0, $5VIId$reactstatelyutils.useControlledState)(props.value, (_props_defaultValue = props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue : '', ()=>{});
|
43
43
|
let inputRef = (0, $5VIId$react.useRef)(null);
|
44
44
|
let onHeightChange = (0, $5VIId$react.useCallback)(()=>{
|
45
45
|
// Quiet textareas always grow based on their text content.
|
@@ -51,10 +51,10 @@ function $eec649e464f3832d$var$TextArea(props, ref) {
|
|
51
51
|
// Firefox scroll position is lost when overflow: 'hidden' is applied so we skip applying it.
|
52
52
|
// The measure/applied height is also incorrect/reset if we turn on and off
|
53
53
|
// overflow: hidden in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1787062
|
54
|
-
let isFirefox =
|
55
|
-
if (!isFirefox) input.style.overflow =
|
56
|
-
input.style.alignSelf =
|
57
|
-
input.style.height =
|
54
|
+
let isFirefox = 'MozAppearance' in input.style;
|
55
|
+
if (!isFirefox) input.style.overflow = 'hidden';
|
56
|
+
input.style.alignSelf = 'start';
|
57
|
+
input.style.height = 'auto';
|
58
58
|
// offsetHeight - clientHeight accounts for the border/padding.
|
59
59
|
input.style.height = `${input.scrollHeight + (input.offsetHeight - input.clientHeight)}px`;
|
60
60
|
input.style.overflow = prevOverflow;
|
@@ -72,11 +72,11 @@ function $eec649e464f3832d$var$TextArea(props, ref) {
|
|
72
72
|
inputValue,
|
73
73
|
inputRef
|
74
74
|
]);
|
75
|
-
if (props.placeholder) console.warn(
|
75
|
+
if (props.placeholder) console.warn('Placeholders are deprecated due to accessibility issues. Please use help text instead. See the docs for details: https://react-spectrum.adobe.com/react-spectrum/TextArea.html#help-text');
|
76
76
|
let result = (0, $5VIId$reactariatextfield.useTextField)({
|
77
77
|
...props,
|
78
78
|
onChange: (0, $5VIId$reactariautils.chain)(onChange, setInputValue),
|
79
|
-
inputElementType:
|
79
|
+
inputElementType: 'textarea'
|
80
80
|
}, inputRef);
|
81
81
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($5VIId$react))).createElement((0, $86793250183ac29e$exports.TextFieldBase), {
|
82
82
|
...otherProps,
|
package/dist/TextArea.mjs
CHANGED
@@ -29,7 +29,7 @@ function $cc187bf91f8eea73$var$TextArea(props, ref) {
|
|
29
29
|
let { isDisabled: isDisabled = false, isQuiet: isQuiet = false, isReadOnly: isReadOnly = false, isRequired: isRequired = false, onChange: onChange, ...otherProps } = props;
|
30
30
|
var _props_defaultValue;
|
31
31
|
// not in stately because this is so we know when to re-measure, which is a spectrum design
|
32
|
-
let [inputValue, setInputValue] = (0, $hi3T0$useControlledState)(props.value, (_props_defaultValue = props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue :
|
32
|
+
let [inputValue, setInputValue] = (0, $hi3T0$useControlledState)(props.value, (_props_defaultValue = props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue : '', ()=>{});
|
33
33
|
let inputRef = (0, $hi3T0$useRef)(null);
|
34
34
|
let onHeightChange = (0, $hi3T0$useCallback)(()=>{
|
35
35
|
// Quiet textareas always grow based on their text content.
|
@@ -41,10 +41,10 @@ function $cc187bf91f8eea73$var$TextArea(props, ref) {
|
|
41
41
|
// Firefox scroll position is lost when overflow: 'hidden' is applied so we skip applying it.
|
42
42
|
// The measure/applied height is also incorrect/reset if we turn on and off
|
43
43
|
// overflow: hidden in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1787062
|
44
|
-
let isFirefox =
|
45
|
-
if (!isFirefox) input.style.overflow =
|
46
|
-
input.style.alignSelf =
|
47
|
-
input.style.height =
|
44
|
+
let isFirefox = 'MozAppearance' in input.style;
|
45
|
+
if (!isFirefox) input.style.overflow = 'hidden';
|
46
|
+
input.style.alignSelf = 'start';
|
47
|
+
input.style.height = 'auto';
|
48
48
|
// offsetHeight - clientHeight accounts for the border/padding.
|
49
49
|
input.style.height = `${input.scrollHeight + (input.offsetHeight - input.clientHeight)}px`;
|
50
50
|
input.style.overflow = prevOverflow;
|
@@ -62,11 +62,11 @@ function $cc187bf91f8eea73$var$TextArea(props, ref) {
|
|
62
62
|
inputValue,
|
63
63
|
inputRef
|
64
64
|
]);
|
65
|
-
if (props.placeholder) console.warn(
|
65
|
+
if (props.placeholder) console.warn('Placeholders are deprecated due to accessibility issues. Please use help text instead. See the docs for details: https://react-spectrum.adobe.com/react-spectrum/TextArea.html#help-text');
|
66
66
|
let result = (0, $hi3T0$useTextField)({
|
67
67
|
...props,
|
68
68
|
onChange: (0, $hi3T0$chain)(onChange, setInputValue),
|
69
|
-
inputElementType:
|
69
|
+
inputElementType: 'textarea'
|
70
70
|
}, inputRef);
|
71
71
|
return /*#__PURE__*/ (0, $hi3T0$react).createElement((0, $599adb75312e6492$export$d22444a338b6e3c2), {
|
72
72
|
...otherProps,
|
@@ -88,4 +88,4 @@ function $cc187bf91f8eea73$var$TextArea(props, ref) {
|
|
88
88
|
|
89
89
|
|
90
90
|
export {$cc187bf91f8eea73$export$f5c9f3c2c4054eec as TextArea};
|
91
|
-
//# sourceMappingURL=TextArea.
|
91
|
+
//# sourceMappingURL=TextArea.module.js.map
|
package/dist/TextArea.module.js
CHANGED
@@ -29,7 +29,7 @@ function $cc187bf91f8eea73$var$TextArea(props, ref) {
|
|
29
29
|
let { isDisabled: isDisabled = false, isQuiet: isQuiet = false, isReadOnly: isReadOnly = false, isRequired: isRequired = false, onChange: onChange, ...otherProps } = props;
|
30
30
|
var _props_defaultValue;
|
31
31
|
// not in stately because this is so we know when to re-measure, which is a spectrum design
|
32
|
-
let [inputValue, setInputValue] = (0, $hi3T0$useControlledState)(props.value, (_props_defaultValue = props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue :
|
32
|
+
let [inputValue, setInputValue] = (0, $hi3T0$useControlledState)(props.value, (_props_defaultValue = props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue : '', ()=>{});
|
33
33
|
let inputRef = (0, $hi3T0$useRef)(null);
|
34
34
|
let onHeightChange = (0, $hi3T0$useCallback)(()=>{
|
35
35
|
// Quiet textareas always grow based on their text content.
|
@@ -41,10 +41,10 @@ function $cc187bf91f8eea73$var$TextArea(props, ref) {
|
|
41
41
|
// Firefox scroll position is lost when overflow: 'hidden' is applied so we skip applying it.
|
42
42
|
// The measure/applied height is also incorrect/reset if we turn on and off
|
43
43
|
// overflow: hidden in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1787062
|
44
|
-
let isFirefox =
|
45
|
-
if (!isFirefox) input.style.overflow =
|
46
|
-
input.style.alignSelf =
|
47
|
-
input.style.height =
|
44
|
+
let isFirefox = 'MozAppearance' in input.style;
|
45
|
+
if (!isFirefox) input.style.overflow = 'hidden';
|
46
|
+
input.style.alignSelf = 'start';
|
47
|
+
input.style.height = 'auto';
|
48
48
|
// offsetHeight - clientHeight accounts for the border/padding.
|
49
49
|
input.style.height = `${input.scrollHeight + (input.offsetHeight - input.clientHeight)}px`;
|
50
50
|
input.style.overflow = prevOverflow;
|
@@ -62,11 +62,11 @@ function $cc187bf91f8eea73$var$TextArea(props, ref) {
|
|
62
62
|
inputValue,
|
63
63
|
inputRef
|
64
64
|
]);
|
65
|
-
if (props.placeholder) console.warn(
|
65
|
+
if (props.placeholder) console.warn('Placeholders are deprecated due to accessibility issues. Please use help text instead. See the docs for details: https://react-spectrum.adobe.com/react-spectrum/TextArea.html#help-text');
|
66
66
|
let result = (0, $hi3T0$useTextField)({
|
67
67
|
...props,
|
68
68
|
onChange: (0, $hi3T0$chain)(onChange, setInputValue),
|
69
|
-
inputElementType:
|
69
|
+
inputElementType: 'textarea'
|
70
70
|
}, inputRef);
|
71
71
|
return /*#__PURE__*/ (0, $hi3T0$react).createElement((0, $599adb75312e6492$export$d22444a338b6e3c2), {
|
72
72
|
...otherProps,
|
package/dist/TextField.main.js
CHANGED
@@ -34,7 +34,7 @@ function $34fd51d50eb4b056$var$TextField(props, ref) {
|
|
34
34
|
props = (0, $em8OD$reactspectrumform.useFormProps)(props);
|
35
35
|
let inputRef = (0, $em8OD$react.useRef)(null);
|
36
36
|
let result = (0, $em8OD$reactariatextfield.useTextField)(props, inputRef);
|
37
|
-
if (props.placeholder) console.warn(
|
37
|
+
if (props.placeholder) console.warn('Placeholders are deprecated due to accessibility issues. Please use help text instead. See the docs for details: https://react-spectrum.adobe.com/react-spectrum/TextField.html#help-text');
|
38
38
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($em8OD$react))).createElement((0, $86793250183ac29e$exports.TextFieldBase), {
|
39
39
|
...props,
|
40
40
|
...result,
|
package/dist/TextField.mjs
CHANGED
@@ -24,7 +24,7 @@ function $265457f9427aa380$var$TextField(props, ref) {
|
|
24
24
|
props = (0, $9R76J$useFormProps)(props);
|
25
25
|
let inputRef = (0, $9R76J$useRef)(null);
|
26
26
|
let result = (0, $9R76J$useTextField)(props, inputRef);
|
27
|
-
if (props.placeholder) console.warn(
|
27
|
+
if (props.placeholder) console.warn('Placeholders are deprecated due to accessibility issues. Please use help text instead. See the docs for details: https://react-spectrum.adobe.com/react-spectrum/TextField.html#help-text');
|
28
28
|
return /*#__PURE__*/ (0, $9R76J$react).createElement((0, $599adb75312e6492$export$d22444a338b6e3c2), {
|
29
29
|
...props,
|
30
30
|
...result,
|
@@ -40,4 +40,4 @@ function $265457f9427aa380$var$TextField(props, ref) {
|
|
40
40
|
|
41
41
|
|
42
42
|
export {$265457f9427aa380$export$2c73285ae9390cec as TextField};
|
43
|
-
//# sourceMappingURL=TextField.
|
43
|
+
//# sourceMappingURL=TextField.module.js.map
|
package/dist/TextField.module.js
CHANGED
@@ -24,7 +24,7 @@ function $265457f9427aa380$var$TextField(props, ref) {
|
|
24
24
|
props = (0, $9R76J$useFormProps)(props);
|
25
25
|
let inputRef = (0, $9R76J$useRef)(null);
|
26
26
|
let result = (0, $9R76J$useTextField)(props, inputRef);
|
27
|
-
if (props.placeholder) console.warn(
|
27
|
+
if (props.placeholder) console.warn('Placeholders are deprecated due to accessibility issues. Please use help text instead. See the docs for details: https://react-spectrum.adobe.com/react-spectrum/TextField.html#help-text');
|
28
28
|
return /*#__PURE__*/ (0, $9R76J$react).createElement((0, $599adb75312e6492$export$d22444a338b6e3c2), {
|
29
29
|
...props,
|
30
30
|
...result,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require("./vars.
|
1
|
+
require("./vars.9c96c732.css");
|
2
2
|
var $40cb3a00c193680f$exports = require("./textfield_vars_css.main.js");
|
3
3
|
var $fWjzu$spectrumiconsuiAlertMedium = require("@spectrum-icons/ui/AlertMedium");
|
4
4
|
var $fWjzu$spectrumiconsuiCheckmarkMedium = require("@spectrum-icons/ui/CheckmarkMedium");
|
@@ -39,7 +39,7 @@ $parcel$export(module.exports, "TextFieldBase", () => $86793250183ac29e$export$d
|
|
39
39
|
|
40
40
|
|
41
41
|
function $86793250183ac29e$var$TextFieldBase(props, ref) {
|
42
|
-
let { validationState: validationState = props.isInvalid ?
|
42
|
+
let { validationState: validationState = props.isInvalid ? 'invalid' : null, icon: icon, isQuiet: isQuiet = false, isDisabled: isDisabled, multiLine: multiLine, autoFocus: autoFocus, inputClassName: inputClassName, wrapperChildren: wrapperChildren, labelProps: labelProps, inputProps: inputProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps, inputRef: userInputRef, isLoading: isLoading, loadingIndicator: loadingIndicator, validationIconClassName: validationIconClassName, disableFocusRing: disableFocusRing } = props;
|
43
43
|
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $fWjzu$reactariainteractions.useHover)({
|
44
44
|
isDisabled: isDisabled
|
45
45
|
});
|
@@ -56,39 +56,39 @@ function $86793250183ac29e$var$TextFieldBase(props, ref) {
|
|
56
56
|
return inputRef.current;
|
57
57
|
}
|
58
58
|
}));
|
59
|
-
let ElementType = multiLine ?
|
60
|
-
let isInvalid = validationState ===
|
59
|
+
let ElementType = multiLine ? 'textarea' : 'input';
|
60
|
+
let isInvalid = validationState === 'invalid' && !isDisabled;
|
61
61
|
if (icon) {
|
62
|
-
let UNSAFE_className = (0, $fWjzu$reactspectrumutils.classNames)((0, ($parcel$interopDefault($40cb3a00c193680f$exports))), icon.props && icon.props.UNSAFE_className,
|
62
|
+
let UNSAFE_className = (0, $fWjzu$reactspectrumutils.classNames)((0, ($parcel$interopDefault($40cb3a00c193680f$exports))), icon.props && icon.props.UNSAFE_className, 'spectrum-Textfield-icon');
|
63
63
|
icon = /*#__PURE__*/ (0, $fWjzu$react.cloneElement)(icon, {
|
64
64
|
UNSAFE_className: UNSAFE_className,
|
65
|
-
size:
|
65
|
+
size: 'S'
|
66
66
|
});
|
67
67
|
}
|
68
68
|
let validationIcon = isInvalid ? /*#__PURE__*/ (0, ($parcel$interopDefault($fWjzu$react))).createElement((0, ($parcel$interopDefault($fWjzu$spectrumiconsuiAlertMedium))), null) : /*#__PURE__*/ (0, ($parcel$interopDefault($fWjzu$react))).createElement((0, ($parcel$interopDefault($fWjzu$spectrumiconsuiCheckmarkMedium))), null);
|
69
69
|
let validation = /*#__PURE__*/ (0, $fWjzu$react.cloneElement)(validationIcon, {
|
70
|
-
UNSAFE_className: (0, $fWjzu$reactspectrumutils.classNames)((0, ($parcel$interopDefault($40cb3a00c193680f$exports))),
|
70
|
+
UNSAFE_className: (0, $fWjzu$reactspectrumutils.classNames)((0, ($parcel$interopDefault($40cb3a00c193680f$exports))), 'spectrum-Textfield-validationIcon', validationIconClassName)
|
71
71
|
});
|
72
72
|
let { focusProps: focusProps, isFocusVisible: isFocusVisible } = (0, $fWjzu$reactariafocus.useFocusRing)({
|
73
73
|
isTextInput: true,
|
74
74
|
autoFocus: autoFocus
|
75
75
|
});
|
76
76
|
let textField = /*#__PURE__*/ (0, ($parcel$interopDefault($fWjzu$react))).createElement("div", {
|
77
|
-
className: (0, $fWjzu$reactspectrumutils.classNames)((0, ($parcel$interopDefault($40cb3a00c193680f$exports))),
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
77
|
+
className: (0, $fWjzu$reactspectrumutils.classNames)((0, ($parcel$interopDefault($40cb3a00c193680f$exports))), 'spectrum-Textfield', {
|
78
|
+
'spectrum-Textfield--invalid': isInvalid,
|
79
|
+
'spectrum-Textfield--valid': validationState === 'valid' && !isDisabled,
|
80
|
+
'spectrum-Textfield--loadable': loadingIndicator,
|
81
|
+
'spectrum-Textfield--quiet': isQuiet,
|
82
|
+
'spectrum-Textfield--multiline': multiLine,
|
83
|
+
'focus-ring': !disableFocusRing && isFocusVisible
|
84
84
|
})
|
85
85
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($fWjzu$react))).createElement(ElementType, {
|
86
86
|
...(0, $fWjzu$reactariautils.mergeProps)(inputProps, hoverProps, focusProps),
|
87
87
|
ref: inputRef,
|
88
88
|
rows: multiLine ? 1 : undefined,
|
89
|
-
className: (0, $fWjzu$reactspectrumutils.classNames)((0, ($parcel$interopDefault($40cb3a00c193680f$exports))),
|
90
|
-
|
91
|
-
|
89
|
+
className: (0, $fWjzu$reactspectrumutils.classNames)((0, ($parcel$interopDefault($40cb3a00c193680f$exports))), 'spectrum-Textfield-input', {
|
90
|
+
'spectrum-Textfield-inputIcon': icon,
|
91
|
+
'is-hovered': isHovered
|
92
92
|
}, inputClassName)
|
93
93
|
}), icon, validationState && !isLoading && !isDisabled ? validation : null, isLoading && loadingIndicator, wrapperChildren);
|
94
94
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($fWjzu$react))).createElement((0, $fWjzu$reactspectrumlabel.Field), {
|
@@ -96,8 +96,8 @@ function $86793250183ac29e$var$TextFieldBase(props, ref) {
|
|
96
96
|
labelProps: labelProps,
|
97
97
|
descriptionProps: descriptionProps,
|
98
98
|
errorMessageProps: errorMessageProps,
|
99
|
-
wrapperClassName: (0, $fWjzu$reactspectrumutils.classNames)((0, ($parcel$interopDefault($40cb3a00c193680f$exports))),
|
100
|
-
|
99
|
+
wrapperClassName: (0, $fWjzu$reactspectrumutils.classNames)((0, ($parcel$interopDefault($40cb3a00c193680f$exports))), 'spectrum-Textfield-wrapper', {
|
100
|
+
'spectrum-Textfield-wrapper--quiet': isQuiet
|
101
101
|
}),
|
102
102
|
showErrorIcon: false,
|
103
103
|
ref: domRef
|
@@ -1 +1 @@
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AA6BD,SAAS,oCAAc,KAAyB,EAAE,GAAsB;IACtE,IAAI,mBACF,kBAAkB,MAAM,SAAS,GAAG,YAAY,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jC,cAAc,CAAC,oBAAoB;QACrC;qBAGJ,0DAAC;QACE,GAAG,CAAA,GAAA,gCAAS,EAAE,YAAY,YAAY,WAAW;QAClD,KAAK;QACL,MAAM,YAAY,IAAI;QACtB,WACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAK,GACL,4BACA;YACE,gCAAgC;YAChC,cAAc;QAChB,GACA;QAGL,MACA,mBAAmB,CAAC,aAAa,CAAC,aAAa,aAAa,MAC5D,aAAa,kBACb;IAIL,qBACE,0DAAC,CAAA,GAAA,+BAAI;QACF,GAAG,KAAK;QACT,YAAY;QACZ,kBAAkB;QAClB,mBAAmB;QACnB,kBACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAK,GACL,8BACA;YACE,qCAAqC;QACvC;QAGJ,eAAe;QACf,KAAK;OACJ;AAGP;AAEA,MAAM,0DAAiB,CAAA,GAAA,uBAAS,EAAE","sources":["packages/@react-spectrum/textfield/src/TextFieldBase.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport AlertMedium from '@spectrum-icons/ui/AlertMedium';\nimport CheckmarkMedium from '@spectrum-icons/ui/CheckmarkMedium';\nimport {classNames, createFocusableRef} from '@react-spectrum/utils';\nimport {Field} from '@react-spectrum/label';\nimport {mergeProps} from '@react-aria/utils';\nimport {PressEvents, RefObject, ValidationResult} from '@react-types/shared';\nimport React, {cloneElement, forwardRef, HTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, ReactElement, Ref, TextareaHTMLAttributes, useImperativeHandle, useRef} from 'react';\nimport {SpectrumTextFieldProps, TextFieldRef} from '@react-types/textfield';\nimport styles from '@adobe/spectrum-css-temp/components/textfield/vars.css';\nimport {useFocusRing} from '@react-aria/focus';\nimport {useHover} from '@react-aria/interactions';\n\ninterface TextFieldBaseProps extends Omit<SpectrumTextFieldProps, 'onChange' | 'validate'>, PressEvents, Partial<ValidationResult> {\n wrapperChildren?: ReactElement | ReactElement[],\n inputClassName?: string,\n validationIconClassName?: string,\n multiLine?: boolean,\n labelProps?: LabelHTMLAttributes<HTMLLabelElement>,\n inputProps: InputHTMLAttributes<HTMLInputElement> | TextareaHTMLAttributes<HTMLTextAreaElement>,\n descriptionProps?: HTMLAttributes<HTMLElement>,\n errorMessageProps?: HTMLAttributes<HTMLElement>,\n inputRef?: RefObject<HTMLInputElement | HTMLTextAreaElement | null>,\n loadingIndicator?: ReactElement,\n isLoading?: boolean,\n disableFocusRing?: boolean\n}\n\nfunction TextFieldBase(props: TextFieldBaseProps, ref: Ref<TextFieldRef>) {\n let {\n validationState = props.isInvalid ? 'invalid' : null,\n icon,\n isQuiet = false,\n isDisabled,\n multiLine,\n autoFocus,\n inputClassName,\n wrapperChildren,\n labelProps,\n inputProps,\n descriptionProps,\n errorMessageProps,\n inputRef: userInputRef,\n isLoading,\n loadingIndicator,\n validationIconClassName,\n disableFocusRing\n } = props;\n let {hoverProps, isHovered} = useHover({isDisabled});\n let domRef = useRef<HTMLDivElement>(null);\n let defaultInputRef = useRef<HTMLInputElement | HTMLTextAreaElement>(null);\n let inputRef = userInputRef || defaultInputRef;\n\n // Expose imperative interface for ref\n useImperativeHandle(ref, () => ({\n ...createFocusableRef(domRef, inputRef),\n select() {\n if (inputRef.current) {\n inputRef.current.select();\n }\n },\n getInputElement() {\n return inputRef.current;\n }\n }));\n\n let ElementType: React.ElementType = multiLine ? 'textarea' : 'input';\n let isInvalid = validationState === 'invalid' && !isDisabled;\n\n if (icon) {\n let UNSAFE_className = classNames(\n styles,\n icon.props && (icon.props as any).UNSAFE_className,\n 'spectrum-Textfield-icon'\n );\n\n icon = cloneElement(icon, {\n UNSAFE_className,\n size: 'S'\n } as any);\n }\n\n let validationIcon = isInvalid ? <AlertMedium /> : <CheckmarkMedium />;\n let validation = cloneElement(validationIcon, {\n UNSAFE_className: classNames(\n styles,\n 'spectrum-Textfield-validationIcon',\n validationIconClassName\n )\n });\n\n let {focusProps, isFocusVisible} = useFocusRing({\n isTextInput: true,\n autoFocus\n });\n\n let textField = (\n <div\n className={\n classNames(\n styles,\n 'spectrum-Textfield',\n {\n 'spectrum-Textfield--invalid': isInvalid,\n 'spectrum-Textfield--valid': validationState === 'valid' && !isDisabled,\n 'spectrum-Textfield--loadable': loadingIndicator,\n 'spectrum-Textfield--quiet': isQuiet,\n 'spectrum-Textfield--multiline': multiLine,\n 'focus-ring': !disableFocusRing && isFocusVisible\n }\n )\n }>\n <ElementType\n {...mergeProps(inputProps, hoverProps, focusProps)}\n ref={inputRef as any}\n rows={multiLine ? 1 : undefined}\n className={\n classNames(\n styles,\n 'spectrum-Textfield-input',\n {\n 'spectrum-Textfield-inputIcon': icon,\n 'is-hovered': isHovered\n },\n inputClassName\n )\n } />\n {icon}\n {validationState && !isLoading && !isDisabled ? validation : null}\n {isLoading && loadingIndicator}\n {wrapperChildren}\n </div>\n );\n\n return (\n <Field\n {...props}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n wrapperClassName={\n classNames(\n styles,\n 'spectrum-Textfield-wrapper',\n {\n 'spectrum-Textfield-wrapper--quiet': isQuiet\n }\n )\n }\n showErrorIcon={false}\n ref={domRef}>\n {textField}\n </Field>\n );\n}\n\nconst _TextFieldBase = forwardRef(TextFieldBase);\nexport {_TextFieldBase as TextFieldBase};\n"],"names":[],"version":3,"file":"TextFieldBase.main.js.map"}
|
package/dist/TextFieldBase.mjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import "./vars.
|
1
|
+
import "./vars.9c96c732.css";
|
2
2
|
import $264pK$textfield_vars_cssmodulejs from "./textfield_vars_css.mjs";
|
3
3
|
import $264pK$spectrumiconsuiAlertMedium from "@spectrum-icons/ui/AlertMedium";
|
4
4
|
import $264pK$spectrumiconsuiCheckmarkMedium from "@spectrum-icons/ui/CheckmarkMedium";
|
@@ -33,7 +33,7 @@ function $parcel$interopDefault(a) {
|
|
33
33
|
|
34
34
|
|
35
35
|
function $599adb75312e6492$var$TextFieldBase(props, ref) {
|
36
|
-
let { validationState: validationState = props.isInvalid ?
|
36
|
+
let { validationState: validationState = props.isInvalid ? 'invalid' : null, icon: icon, isQuiet: isQuiet = false, isDisabled: isDisabled, multiLine: multiLine, autoFocus: autoFocus, inputClassName: inputClassName, wrapperChildren: wrapperChildren, labelProps: labelProps, inputProps: inputProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps, inputRef: userInputRef, isLoading: isLoading, loadingIndicator: loadingIndicator, validationIconClassName: validationIconClassName, disableFocusRing: disableFocusRing } = props;
|
37
37
|
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $264pK$useHover)({
|
38
38
|
isDisabled: isDisabled
|
39
39
|
});
|
@@ -50,39 +50,39 @@ function $599adb75312e6492$var$TextFieldBase(props, ref) {
|
|
50
50
|
return inputRef.current;
|
51
51
|
}
|
52
52
|
}));
|
53
|
-
let ElementType = multiLine ?
|
54
|
-
let isInvalid = validationState ===
|
53
|
+
let ElementType = multiLine ? 'textarea' : 'input';
|
54
|
+
let isInvalid = validationState === 'invalid' && !isDisabled;
|
55
55
|
if (icon) {
|
56
|
-
let UNSAFE_className = (0, $264pK$classNames)((0, ($parcel$interopDefault($264pK$textfield_vars_cssmodulejs))), icon.props && icon.props.UNSAFE_className,
|
56
|
+
let UNSAFE_className = (0, $264pK$classNames)((0, ($parcel$interopDefault($264pK$textfield_vars_cssmodulejs))), icon.props && icon.props.UNSAFE_className, 'spectrum-Textfield-icon');
|
57
57
|
icon = /*#__PURE__*/ (0, $264pK$cloneElement)(icon, {
|
58
58
|
UNSAFE_className: UNSAFE_className,
|
59
|
-
size:
|
59
|
+
size: 'S'
|
60
60
|
});
|
61
61
|
}
|
62
62
|
let validationIcon = isInvalid ? /*#__PURE__*/ (0, $264pK$react).createElement((0, $264pK$spectrumiconsuiAlertMedium), null) : /*#__PURE__*/ (0, $264pK$react).createElement((0, $264pK$spectrumiconsuiCheckmarkMedium), null);
|
63
63
|
let validation = /*#__PURE__*/ (0, $264pK$cloneElement)(validationIcon, {
|
64
|
-
UNSAFE_className: (0, $264pK$classNames)((0, ($parcel$interopDefault($264pK$textfield_vars_cssmodulejs))),
|
64
|
+
UNSAFE_className: (0, $264pK$classNames)((0, ($parcel$interopDefault($264pK$textfield_vars_cssmodulejs))), 'spectrum-Textfield-validationIcon', validationIconClassName)
|
65
65
|
});
|
66
66
|
let { focusProps: focusProps, isFocusVisible: isFocusVisible } = (0, $264pK$useFocusRing)({
|
67
67
|
isTextInput: true,
|
68
68
|
autoFocus: autoFocus
|
69
69
|
});
|
70
70
|
let textField = /*#__PURE__*/ (0, $264pK$react).createElement("div", {
|
71
|
-
className: (0, $264pK$classNames)((0, ($parcel$interopDefault($264pK$textfield_vars_cssmodulejs))),
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
71
|
+
className: (0, $264pK$classNames)((0, ($parcel$interopDefault($264pK$textfield_vars_cssmodulejs))), 'spectrum-Textfield', {
|
72
|
+
'spectrum-Textfield--invalid': isInvalid,
|
73
|
+
'spectrum-Textfield--valid': validationState === 'valid' && !isDisabled,
|
74
|
+
'spectrum-Textfield--loadable': loadingIndicator,
|
75
|
+
'spectrum-Textfield--quiet': isQuiet,
|
76
|
+
'spectrum-Textfield--multiline': multiLine,
|
77
|
+
'focus-ring': !disableFocusRing && isFocusVisible
|
78
78
|
})
|
79
79
|
}, /*#__PURE__*/ (0, $264pK$react).createElement(ElementType, {
|
80
80
|
...(0, $264pK$mergeProps)(inputProps, hoverProps, focusProps),
|
81
81
|
ref: inputRef,
|
82
82
|
rows: multiLine ? 1 : undefined,
|
83
|
-
className: (0, $264pK$classNames)((0, ($parcel$interopDefault($264pK$textfield_vars_cssmodulejs))),
|
84
|
-
|
85
|
-
|
83
|
+
className: (0, $264pK$classNames)((0, ($parcel$interopDefault($264pK$textfield_vars_cssmodulejs))), 'spectrum-Textfield-input', {
|
84
|
+
'spectrum-Textfield-inputIcon': icon,
|
85
|
+
'is-hovered': isHovered
|
86
86
|
}, inputClassName)
|
87
87
|
}), icon, validationState && !isLoading && !isDisabled ? validation : null, isLoading && loadingIndicator, wrapperChildren);
|
88
88
|
return /*#__PURE__*/ (0, $264pK$react).createElement((0, $264pK$Field), {
|
@@ -90,8 +90,8 @@ function $599adb75312e6492$var$TextFieldBase(props, ref) {
|
|
90
90
|
labelProps: labelProps,
|
91
91
|
descriptionProps: descriptionProps,
|
92
92
|
errorMessageProps: errorMessageProps,
|
93
|
-
wrapperClassName: (0, $264pK$classNames)((0, ($parcel$interopDefault($264pK$textfield_vars_cssmodulejs))),
|
94
|
-
|
93
|
+
wrapperClassName: (0, $264pK$classNames)((0, ($parcel$interopDefault($264pK$textfield_vars_cssmodulejs))), 'spectrum-Textfield-wrapper', {
|
94
|
+
'spectrum-Textfield-wrapper--quiet': isQuiet
|
95
95
|
}),
|
96
96
|
showErrorIcon: false,
|
97
97
|
ref: domRef
|
@@ -101,4 +101,4 @@ const $599adb75312e6492$export$d22444a338b6e3c2 = /*#__PURE__*/ (0, $264pK$forwa
|
|
101
101
|
|
102
102
|
|
103
103
|
export {$599adb75312e6492$export$d22444a338b6e3c2 as TextFieldBase};
|
104
|
-
//# sourceMappingURL=TextFieldBase.
|
104
|
+
//# sourceMappingURL=TextFieldBase.module.js.map
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import "./vars.
|
1
|
+
import "./vars.9c96c732.css";
|
2
2
|
import $264pK$textfield_vars_cssmodulejs from "./textfield_vars_css.module.js";
|
3
3
|
import $264pK$spectrumiconsuiAlertMedium from "@spectrum-icons/ui/AlertMedium";
|
4
4
|
import $264pK$spectrumiconsuiCheckmarkMedium from "@spectrum-icons/ui/CheckmarkMedium";
|
@@ -33,7 +33,7 @@ function $parcel$interopDefault(a) {
|
|
33
33
|
|
34
34
|
|
35
35
|
function $599adb75312e6492$var$TextFieldBase(props, ref) {
|
36
|
-
let { validationState: validationState = props.isInvalid ?
|
36
|
+
let { validationState: validationState = props.isInvalid ? 'invalid' : null, icon: icon, isQuiet: isQuiet = false, isDisabled: isDisabled, multiLine: multiLine, autoFocus: autoFocus, inputClassName: inputClassName, wrapperChildren: wrapperChildren, labelProps: labelProps, inputProps: inputProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps, inputRef: userInputRef, isLoading: isLoading, loadingIndicator: loadingIndicator, validationIconClassName: validationIconClassName, disableFocusRing: disableFocusRing } = props;
|
37
37
|
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $264pK$useHover)({
|
38
38
|
isDisabled: isDisabled
|
39
39
|
});
|
@@ -50,39 +50,39 @@ function $599adb75312e6492$var$TextFieldBase(props, ref) {
|
|
50
50
|
return inputRef.current;
|
51
51
|
}
|
52
52
|
}));
|
53
|
-
let ElementType = multiLine ?
|
54
|
-
let isInvalid = validationState ===
|
53
|
+
let ElementType = multiLine ? 'textarea' : 'input';
|
54
|
+
let isInvalid = validationState === 'invalid' && !isDisabled;
|
55
55
|
if (icon) {
|
56
|
-
let UNSAFE_className = (0, $264pK$classNames)((0, ($parcel$interopDefault($264pK$textfield_vars_cssmodulejs))), icon.props && icon.props.UNSAFE_className,
|
56
|
+
let UNSAFE_className = (0, $264pK$classNames)((0, ($parcel$interopDefault($264pK$textfield_vars_cssmodulejs))), icon.props && icon.props.UNSAFE_className, 'spectrum-Textfield-icon');
|
57
57
|
icon = /*#__PURE__*/ (0, $264pK$cloneElement)(icon, {
|
58
58
|
UNSAFE_className: UNSAFE_className,
|
59
|
-
size:
|
59
|
+
size: 'S'
|
60
60
|
});
|
61
61
|
}
|
62
62
|
let validationIcon = isInvalid ? /*#__PURE__*/ (0, $264pK$react).createElement((0, $264pK$spectrumiconsuiAlertMedium), null) : /*#__PURE__*/ (0, $264pK$react).createElement((0, $264pK$spectrumiconsuiCheckmarkMedium), null);
|
63
63
|
let validation = /*#__PURE__*/ (0, $264pK$cloneElement)(validationIcon, {
|
64
|
-
UNSAFE_className: (0, $264pK$classNames)((0, ($parcel$interopDefault($264pK$textfield_vars_cssmodulejs))),
|
64
|
+
UNSAFE_className: (0, $264pK$classNames)((0, ($parcel$interopDefault($264pK$textfield_vars_cssmodulejs))), 'spectrum-Textfield-validationIcon', validationIconClassName)
|
65
65
|
});
|
66
66
|
let { focusProps: focusProps, isFocusVisible: isFocusVisible } = (0, $264pK$useFocusRing)({
|
67
67
|
isTextInput: true,
|
68
68
|
autoFocus: autoFocus
|
69
69
|
});
|
70
70
|
let textField = /*#__PURE__*/ (0, $264pK$react).createElement("div", {
|
71
|
-
className: (0, $264pK$classNames)((0, ($parcel$interopDefault($264pK$textfield_vars_cssmodulejs))),
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
71
|
+
className: (0, $264pK$classNames)((0, ($parcel$interopDefault($264pK$textfield_vars_cssmodulejs))), 'spectrum-Textfield', {
|
72
|
+
'spectrum-Textfield--invalid': isInvalid,
|
73
|
+
'spectrum-Textfield--valid': validationState === 'valid' && !isDisabled,
|
74
|
+
'spectrum-Textfield--loadable': loadingIndicator,
|
75
|
+
'spectrum-Textfield--quiet': isQuiet,
|
76
|
+
'spectrum-Textfield--multiline': multiLine,
|
77
|
+
'focus-ring': !disableFocusRing && isFocusVisible
|
78
78
|
})
|
79
79
|
}, /*#__PURE__*/ (0, $264pK$react).createElement(ElementType, {
|
80
80
|
...(0, $264pK$mergeProps)(inputProps, hoverProps, focusProps),
|
81
81
|
ref: inputRef,
|
82
82
|
rows: multiLine ? 1 : undefined,
|
83
|
-
className: (0, $264pK$classNames)((0, ($parcel$interopDefault($264pK$textfield_vars_cssmodulejs))),
|
84
|
-
|
85
|
-
|
83
|
+
className: (0, $264pK$classNames)((0, ($parcel$interopDefault($264pK$textfield_vars_cssmodulejs))), 'spectrum-Textfield-input', {
|
84
|
+
'spectrum-Textfield-inputIcon': icon,
|
85
|
+
'is-hovered': isHovered
|
86
86
|
}, inputClassName)
|
87
87
|
}), icon, validationState && !isLoading && !isDisabled ? validation : null, isLoading && loadingIndicator, wrapperChildren);
|
88
88
|
return /*#__PURE__*/ (0, $264pK$react).createElement((0, $264pK$Field), {
|
@@ -90,8 +90,8 @@ function $599adb75312e6492$var$TextFieldBase(props, ref) {
|
|
90
90
|
labelProps: labelProps,
|
91
91
|
descriptionProps: descriptionProps,
|
92
92
|
errorMessageProps: errorMessageProps,
|
93
|
-
wrapperClassName: (0, $264pK$classNames)((0, ($parcel$interopDefault($264pK$textfield_vars_cssmodulejs))),
|
94
|
-
|
93
|
+
wrapperClassName: (0, $264pK$classNames)((0, ($parcel$interopDefault($264pK$textfield_vars_cssmodulejs))), 'spectrum-Textfield-wrapper', {
|
94
|
+
'spectrum-Textfield-wrapper--quiet': isQuiet
|
95
95
|
}),
|
96
96
|
showErrorIcon: false,
|
97
97
|
ref: domRef
|
@@ -1 +1 @@
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AA6BD,SAAS,oCAAc,KAAyB,EAAE,GAAsB;IACtE,IAAI,mBACF,kBAAkB,MAAM,SAAS,GAAG,YAAY,YAChD,IAAI,WACJ,UAAU,mBACV,UAAU,aACV,SAAS,aACT,SAAS,kBACT,cAAc,mBACd,eAAe,cACf,UAAU,cACV,UAAU,oBACV,gBAAgB,qBAChB,iBAAiB,EACjB,UAAU,YAAY,aACtB,SAAS,oBACT,gBAAgB,2BAChB,uBAAuB,oBACvB,gBAAgB,EACjB,GAAG;IACJ,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;oBAAC;IAAU;IAClD,IAAI,SAAS,CAAA,GA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AAG,KAAK;QACT,YAAY;QACZ,kBAAkB;QAClB,mBAAmB;QACnB,kBACE,CAAA,GAAA,iBAAS,EACP,CAAA,GAAA,2DAAK,GACL,8BACA;YACE,qCAAqC;QACvC;QAGJ,eAAe;QACf,KAAK;OACJ;AAGP;AAEA,MAAM,0DAAiB,CAAA,GAAA,iBAAS,EAAE","sources":["packages/@react-spectrum/textfield/src/TextFieldBase.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport AlertMedium from '@spectrum-icons/ui/AlertMedium';\nimport CheckmarkMedium from '@spectrum-icons/ui/CheckmarkMedium';\nimport {classNames, createFocusableRef} from '@react-spectrum/utils';\nimport {Field} from '@react-spectrum/label';\nimport {mergeProps} from '@react-aria/utils';\nimport {PressEvents, RefObject, ValidationResult} from '@react-types/shared';\nimport React, {cloneElement, forwardRef, HTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, ReactElement, Ref, TextareaHTMLAttributes, useImperativeHandle, useRef} from 'react';\nimport {SpectrumTextFieldProps, TextFieldRef} from '@react-types/textfield';\nimport styles from '@adobe/spectrum-css-temp/components/textfield/vars.css';\nimport {useFocusRing} from '@react-aria/focus';\nimport {useHover} from '@react-aria/interactions';\n\ninterface TextFieldBaseProps extends Omit<SpectrumTextFieldProps, 'onChange' | 'validate'>, PressEvents, Partial<ValidationResult> {\n wrapperChildren?: ReactElement | ReactElement[],\n inputClassName?: string,\n validationIconClassName?: string,\n multiLine?: boolean,\n labelProps?: LabelHTMLAttributes<HTMLLabelElement>,\n inputProps: InputHTMLAttributes<HTMLInputElement> | TextareaHTMLAttributes<HTMLTextAreaElement>,\n descriptionProps?: HTMLAttributes<HTMLElement>,\n errorMessageProps?: HTMLAttributes<HTMLElement>,\n inputRef?: RefObject<HTMLInputElement | HTMLTextAreaElement | null>,\n loadingIndicator?: ReactElement,\n isLoading?: boolean,\n disableFocusRing?: boolean\n}\n\nfunction TextFieldBase(props: TextFieldBaseProps, ref: Ref<TextFieldRef>) {\n let {\n validationState = props.isInvalid ? 'invalid' : null,\n icon,\n isQuiet = false,\n isDisabled,\n multiLine,\n autoFocus,\n inputClassName,\n wrapperChildren,\n labelProps,\n inputProps,\n descriptionProps,\n errorMessageProps,\n inputRef: userInputRef,\n isLoading,\n loadingIndicator,\n validationIconClassName,\n disableFocusRing\n } = props;\n let {hoverProps, isHovered} = useHover({isDisabled});\n let domRef = useRef<HTMLDivElement>(null);\n let defaultInputRef = useRef<HTMLInputElement | HTMLTextAreaElement>(null);\n let inputRef = userInputRef || defaultInputRef;\n\n // Expose imperative interface for ref\n useImperativeHandle(ref, () => ({\n ...createFocusableRef(domRef, inputRef),\n select() {\n if (inputRef.current) {\n inputRef.current.select();\n }\n },\n getInputElement() {\n return inputRef.current;\n }\n }));\n\n let ElementType: React.ElementType = multiLine ? 'textarea' : 'input';\n let isInvalid = validationState === 'invalid' && !isDisabled;\n\n if (icon) {\n let UNSAFE_className = classNames(\n styles,\n icon.props && (icon.props as any).UNSAFE_className,\n 'spectrum-Textfield-icon'\n );\n\n icon = cloneElement(icon, {\n UNSAFE_className,\n size: 'S'\n } as any);\n }\n\n let validationIcon = isInvalid ? <AlertMedium /> : <CheckmarkMedium />;\n let validation = cloneElement(validationIcon, {\n UNSAFE_className: classNames(\n styles,\n 'spectrum-Textfield-validationIcon',\n validationIconClassName\n )\n });\n\n let {focusProps, isFocusVisible} = useFocusRing({\n isTextInput: true,\n autoFocus\n });\n\n let textField = (\n <div\n className={\n classNames(\n styles,\n 'spectrum-Textfield',\n {\n 'spectrum-Textfield--invalid': isInvalid,\n 'spectrum-Textfield--valid': validationState === 'valid' && !isDisabled,\n 'spectrum-Textfield--loadable': loadingIndicator,\n 'spectrum-Textfield--quiet': isQuiet,\n 'spectrum-Textfield--multiline': multiLine,\n 'focus-ring': !disableFocusRing && isFocusVisible\n }\n )\n }>\n <ElementType\n {...mergeProps(inputProps, hoverProps, focusProps)}\n ref={inputRef as any}\n rows={multiLine ? 1 : undefined}\n className={\n classNames(\n styles,\n 'spectrum-Textfield-input',\n {\n 'spectrum-Textfield-inputIcon': icon,\n 'is-hovered': isHovered\n },\n inputClassName\n )\n } />\n {icon}\n {validationState && !isLoading && !isDisabled ? validation : null}\n {isLoading && loadingIndicator}\n {wrapperChildren}\n </div>\n );\n\n return (\n <Field\n {...props}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n wrapperClassName={\n classNames(\n styles,\n 'spectrum-Textfield-wrapper',\n {\n 'spectrum-Textfield-wrapper--quiet': isQuiet\n }\n )\n }\n showErrorIcon={false}\n ref={domRef}>\n {textField}\n </Field>\n );\n}\n\nconst _TextFieldBase = forwardRef(TextFieldBase);\nexport {_TextFieldBase as TextFieldBase};\n"],"names":[],"version":3,"file":"TextFieldBase.module.js.map"}
|
package/dist/types.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { PressEvents, ValidationResult } from "@react-types/shared";
|
2
|
-
import React, { HTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, ReactElement,
|
1
|
+
import { PressEvents, RefObject, ValidationResult } from "@react-types/shared";
|
2
|
+
import React, { HTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, ReactElement, TextareaHTMLAttributes } from "react";
|
3
3
|
import { SpectrumTextFieldProps, TextFieldRef, SpectrumTextAreaProps } from "@react-types/textfield";
|
4
4
|
interface TextFieldBaseProps extends Omit<SpectrumTextFieldProps, 'onChange' | 'validate'>, PressEvents, Partial<ValidationResult> {
|
5
5
|
wrapperChildren?: ReactElement | ReactElement[];
|
@@ -10,7 +10,7 @@ interface TextFieldBaseProps extends Omit<SpectrumTextFieldProps, 'onChange' | '
|
|
10
10
|
inputProps: InputHTMLAttributes<HTMLInputElement> | TextareaHTMLAttributes<HTMLTextAreaElement>;
|
11
11
|
descriptionProps?: HTMLAttributes<HTMLElement>;
|
12
12
|
errorMessageProps?: HTMLAttributes<HTMLElement>;
|
13
|
-
inputRef?: RefObject<HTMLInputElement | HTMLTextAreaElement>;
|
13
|
+
inputRef?: RefObject<HTMLInputElement | HTMLTextAreaElement | null>;
|
14
14
|
loadingIndicator?: ReactElement;
|
15
15
|
isLoading?: boolean;
|
16
16
|
disableFocusRing?: boolean;
|
package/dist/types.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"mappings":";;;AAwBA,4BAA6B,SAAQ,IAAI,CAAC,sBAAsB,EAAE,UAAU,GAAG,UAAU,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,gBAAgB,CAAC;IAChI,eAAe,CAAC,EAAE,YAAY,GAAG,YAAY,EAAE,CAAC;IAChD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,oBAAoB,gBAAgB,CAAC,CAAC;IACnD,UAAU,EAAE,oBAAoB,gBAAgB,CAAC,GAAG,uBAAuB,mBAAmB,CAAC,CAAC;IAChG,gBAAgB,CAAC,EAAE,eAAe,WAAW,CAAC,CAAC;IAC/C,iBAAiB,CAAC,EAAE,eAAe,WAAW,CAAC,CAAC;IAChD,QAAQ,CAAC,EAAE,UAAU,gBAAgB,GAAG,mBAAmB,CAAC,CAAC;
|
1
|
+
{"mappings":";;;AAwBA,4BAA6B,SAAQ,IAAI,CAAC,sBAAsB,EAAE,UAAU,GAAG,UAAU,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,gBAAgB,CAAC;IAChI,eAAe,CAAC,EAAE,YAAY,GAAG,YAAY,EAAE,CAAC;IAChD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,oBAAoB,gBAAgB,CAAC,CAAC;IACnD,UAAU,EAAE,oBAAoB,gBAAgB,CAAC,GAAG,uBAAuB,mBAAmB,CAAC,CAAC;IAChG,gBAAgB,CAAC,EAAE,eAAe,WAAW,CAAC,CAAC;IAC/C,iBAAiB,CAAC,EAAE,eAAe,WAAW,CAAC,CAAC;IAChD,QAAQ,CAAC,EAAE,UAAU,gBAAgB,GAAG,mBAAmB,GAAG,IAAI,CAAC,CAAC;IACpE,gBAAgB,CAAC,EAAE,YAAY,CAAC;IAChC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B;AAkID,OAAA,MAAM,sGAA0C,CAAC;AC7EjD;;;;GAIG;AACH,OAAA,IAAI,oGAAsC,CAAC;ACxD3C;;;;GAIG;AACH,OAAA,MAAM,sGAAkC,CAAC;AC3BzC,YAAY,EAAC,sBAAsB,EAAE,qBAAqB,EAAC,MAAM,wBAAwB,CAAC","sources":["packages/@react-spectrum/textfield/src/packages/@react-spectrum/textfield/src/TextFieldBase.tsx","packages/@react-spectrum/textfield/src/packages/@react-spectrum/textfield/src/TextArea.tsx","packages/@react-spectrum/textfield/src/packages/@react-spectrum/textfield/src/TextField.tsx","packages/@react-spectrum/textfield/src/packages/@react-spectrum/textfield/src/index.ts","packages/@react-spectrum/textfield/src/index.ts"],"sourcesContent":[null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/// <reference types=\"css-module-types\" />\n\nexport {TextArea} from './TextArea';\nexport {TextField} from './TextField';\nexport {TextFieldBase} from './TextFieldBase';\nexport type {SpectrumTextFieldProps, SpectrumTextAreaProps} from '@react-types/textfield';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
@@ -244,6 +244,7 @@
|
|
244
244
|
}
|
245
245
|
|
246
246
|
.YO3Nla_spectrum-Textfield-validationIcon {
|
247
|
+
box-sizing: content-box;
|
247
248
|
pointer-events: all;
|
248
249
|
transition: color var(--spectrum-global-animation-duration-100, .13s) ease-in-out;
|
249
250
|
padding-inline-end: calc(var(--spectrum-textfield-padding-x, var(--spectrum-global-dimension-size-150)) / 2);
|
@@ -546,4 +547,4 @@
|
|
546
547
|
border-color: var(--spectrum-textfield-quiet-border-color-key-focus, var(--spectrum-alias-border-color-focus));
|
547
548
|
}
|
548
549
|
}
|
549
|
-
/*# sourceMappingURL=vars.
|
550
|
+
/*# sourceMappingURL=vars.9c96c732.css.map */
|
@@ -0,0 +1 @@
|
|
1
|
+
{"mappings":"AA4DA;;;;;AAIE;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAQA;;;;AAIA;;;;AAKF;;;;;;;;AAOE;;;;;;;;;;;AAqBE;;;;;AAQF;;;;AAKE;;;;;AAOJ;EACE;;;;EAIE;;;;;AAMJ;;;;;;;AAQE;;;;;;AAWF;;;;;;;;;;;;;;;;;;;;AA4CE;;;;;;;;AAYA;;;;;;;AAWE;;;;AAIA;;;;AAJA;;;;AAIA;;;;AAJA;;;;AAIA;;;;AAJA;;;;AAIA;;;;AAJA;;;;AAIA;;;;AAMA;;;;AAKF;;;;;AAME;;;;AAQF;;;;;AAOA;;;;;AAAA;;;;;AAOA;;;;AAIA;;;;;;;;AAUA;;;;;;;AASA;;;;AAIA;;;;AASF;;;;AAIA;;;;;AAKE;;;;AAIA;;;;;AAME;;;;AAOJ;;;;;;;;AAUE;;;;AAKF;;;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAOA;;;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AASA;;;;;;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAaA;;;;AASE;;;;AAIE;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAKF;;;;;AAQF;;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAME;;;;AAiBF;;;;;;AAKE;;;;AAKA;;;;;AAIE;;;;AAMF;;;;;;AAKE;;;;AAMF;;;;AAME;;;;;AAMF;;;;;;;AASE;;;;AAKA;;;;AAdF;;;;;;;AASE;;;;AAKA;;;;AAKF;;;;AAGE;;;;AAcE;;;;;AAOJ;;;;;AAIE;;;;AAIA;;;;AAIA;;;;AAME;;;;;AAMF;;;;;AAOF;;;;AAGE;;;;AAIA;;;;AAIA;;;;AAME;;;;;AASA;;;;AASJ;;;;AAIA;;;;AAKF;EACE;;;;;;;;;;;;EAUE;;;;;EAKE;;;;;;EAKE","sources":["packages/@adobe/spectrum-css-temp/components/textfield/vars.css"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"vars.9c96c732.css.map"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@react-spectrum/textfield",
|
3
|
-
"version": "3.12.
|
3
|
+
"version": "3.12.2",
|
4
4
|
"description": "Spectrum UI components in React",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"main": "dist/main.js",
|
@@ -36,17 +36,17 @@
|
|
36
36
|
"url": "https://github.com/adobe/react-spectrum"
|
37
37
|
},
|
38
38
|
"dependencies": {
|
39
|
-
"@react-aria/focus": "^3.
|
40
|
-
"@react-aria/interactions": "^3.
|
41
|
-
"@react-aria/textfield": "^3.14.
|
42
|
-
"@react-aria/utils": "^3.
|
43
|
-
"@react-spectrum/form": "^3.7.
|
44
|
-
"@react-spectrum/label": "^3.16.
|
45
|
-
"@react-spectrum/utils": "^3.11.
|
46
|
-
"@react-stately/utils": "^3.10.
|
47
|
-
"@react-types/shared": "^3.
|
48
|
-
"@react-types/textfield": "^3.9.
|
49
|
-
"@spectrum-icons/ui": "^3.6.
|
39
|
+
"@react-aria/focus": "^3.18.0",
|
40
|
+
"@react-aria/interactions": "^3.22.0",
|
41
|
+
"@react-aria/textfield": "^3.14.6",
|
42
|
+
"@react-aria/utils": "^3.25.0",
|
43
|
+
"@react-spectrum/form": "^3.7.7",
|
44
|
+
"@react-spectrum/label": "^3.16.7",
|
45
|
+
"@react-spectrum/utils": "^3.11.8",
|
46
|
+
"@react-stately/utils": "^3.10.2",
|
47
|
+
"@react-types/shared": "^3.24.0",
|
48
|
+
"@react-types/textfield": "^3.9.4",
|
49
|
+
"@spectrum-icons/ui": "^3.6.8",
|
50
50
|
"@swc/helpers": "^0.5.0"
|
51
51
|
},
|
52
52
|
"devDependencies": {
|
@@ -55,10 +55,10 @@
|
|
55
55
|
},
|
56
56
|
"peerDependencies": {
|
57
57
|
"@react-spectrum/provider": "^3.0.0",
|
58
|
-
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
|
58
|
+
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
|
59
59
|
},
|
60
60
|
"publishConfig": {
|
61
61
|
"access": "public"
|
62
62
|
},
|
63
|
-
"gitHead": "
|
63
|
+
"gitHead": "86d80e3216bc32e75108831cf3a5a720bc849206"
|
64
64
|
}
|
package/src/TextFieldBase.tsx
CHANGED
@@ -15,8 +15,8 @@ import CheckmarkMedium from '@spectrum-icons/ui/CheckmarkMedium';
|
|
15
15
|
import {classNames, createFocusableRef} from '@react-spectrum/utils';
|
16
16
|
import {Field} from '@react-spectrum/label';
|
17
17
|
import {mergeProps} from '@react-aria/utils';
|
18
|
-
import {PressEvents, ValidationResult} from '@react-types/shared';
|
19
|
-
import React, {cloneElement, forwardRef, HTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, ReactElement, Ref,
|
18
|
+
import {PressEvents, RefObject, ValidationResult} from '@react-types/shared';
|
19
|
+
import React, {cloneElement, forwardRef, HTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, ReactElement, Ref, TextareaHTMLAttributes, useImperativeHandle, useRef} from 'react';
|
20
20
|
import {SpectrumTextFieldProps, TextFieldRef} from '@react-types/textfield';
|
21
21
|
import styles from '@adobe/spectrum-css-temp/components/textfield/vars.css';
|
22
22
|
import {useFocusRing} from '@react-aria/focus';
|
@@ -31,7 +31,7 @@ interface TextFieldBaseProps extends Omit<SpectrumTextFieldProps, 'onChange' | '
|
|
31
31
|
inputProps: InputHTMLAttributes<HTMLInputElement> | TextareaHTMLAttributes<HTMLTextAreaElement>,
|
32
32
|
descriptionProps?: HTMLAttributes<HTMLElement>,
|
33
33
|
errorMessageProps?: HTMLAttributes<HTMLElement>,
|
34
|
-
inputRef?: RefObject<HTMLInputElement | HTMLTextAreaElement>,
|
34
|
+
inputRef?: RefObject<HTMLInputElement | HTMLTextAreaElement | null>,
|
35
35
|
loadingIndicator?: ReactElement,
|
36
36
|
isLoading?: boolean,
|
37
37
|
disableFocusRing?: boolean
|
@@ -81,14 +81,14 @@ function TextFieldBase(props: TextFieldBaseProps, ref: Ref<TextFieldRef>) {
|
|
81
81
|
if (icon) {
|
82
82
|
let UNSAFE_className = classNames(
|
83
83
|
styles,
|
84
|
-
icon.props && icon.props.UNSAFE_className,
|
84
|
+
icon.props && (icon.props as any).UNSAFE_className,
|
85
85
|
'spectrum-Textfield-icon'
|
86
86
|
);
|
87
87
|
|
88
88
|
icon = cloneElement(icon, {
|
89
89
|
UNSAFE_className,
|
90
90
|
size: 'S'
|
91
|
-
});
|
91
|
+
} as any);
|
92
92
|
}
|
93
93
|
|
94
94
|
let validationIcon = isInvalid ? <AlertMedium /> : <CheckmarkMedium />;
|
@@ -1 +0,0 @@
|
|
1
|
-
{"mappings":"AA4DA;;;;;AAIE;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAQA;;;;AAIA;;;;AAKF;;;;;;;;AAOE;;;;;;;;;;;AAqBE;;;;;AAQF;;;;AAKE;;;;;AAOJ;EACE;;;;EAIE;;;;;AAMJ;;;;;;;AAQE;;;;;;AAWF;;;;;;;;;;;;;;;;;;;;AA4CE;;;;;;;;AAYA;;;;;;;AAWE;;;;AAIA;;;;AAJA;;;;AAIA;;;;AAJA;;;;AAIA;;;;AAJA;;;;AAIA;;;;AAJA;;;;AAIA;;;;AAMA;;;;AAKF;;;;;AAME;;;;AAQF;;;;;AAOA;;;;;AAAA;;;;;AAOA;;;;AAIA;;;;;;;;AAUA;;;;;;;AASA;;;;AAIA;;;;AASF;;;;AAIA;;;;;AAKE;;;;AAIA;;;;;AAME;;;;AAOJ;;;;;;;AASE;;;;AAKF;;;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAOA;;;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AASA;;;;;;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAaA;;;;AASE;;;;AAIE;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAKF;;;;;AAQF;;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAAA;;;;AAME;;;;AAiBF;;;;;;AAKE;;;;AAKA;;;;;AAIE;;;;AAMF;;;;;;AAKE;;;;AAMF;;;;AAME;;;;;AAMF;;;;;;;AASE;;;;AAKA;;;;AAdF;;;;;;;AASE;;;;AAKA;;;;AAKF;;;;AAGE;;;;AAcE;;;;;AAOJ;;;;;AAIE;;;;AAIA;;;;AAIA;;;;AAME;;;;;AAMF;;;;;AAOF;;;;AAGE;;;;AAIA;;;;AAIA;;;;AAME;;;;;AASA;;;;AASJ;;;;AAIA;;;;AAKF;EACE;;;;;;;;;;;;EAUE;;;;;EAKE;;;;;;EAKE","sources":["packages/@adobe/spectrum-css-temp/components/textfield/vars.css"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"vars.07716e14.css.map"}
|