@react-spectrum/textfield 3.11.4 → 3.12.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.
@@ -0,0 +1,100 @@
1
+ var $86793250183ac29e$exports = require("./TextFieldBase.main.js");
2
+ var $5VIId$reactariautils = require("@react-aria/utils");
3
+ var $5VIId$react = require("react");
4
+ var $5VIId$reactstatelyutils = require("@react-stately/utils");
5
+ var $5VIId$reactspectrumform = require("@react-spectrum/form");
6
+ var $5VIId$reactspectrumprovider = require("@react-spectrum/provider");
7
+ var $5VIId$reactariatextfield = require("@react-aria/textfield");
8
+
9
+
10
+ function $parcel$interopDefault(a) {
11
+ return a && a.__esModule ? a.default : a;
12
+ }
13
+
14
+ function $parcel$export(e, n, v, s) {
15
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
16
+ }
17
+
18
+ $parcel$export(module.exports, "TextArea", () => $eec649e464f3832d$export$f5c9f3c2c4054eec);
19
+ /*
20
+ * Copyright 2020 Adobe. All rights reserved.
21
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
22
+ * you may not use this file except in compliance with the License. You may obtain a copy
23
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
24
+ *
25
+ * Unless required by applicable law or agreed to in writing, software distributed under
26
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
27
+ * OF ANY KIND, either express or implied. See the License for the specific language
28
+ * governing permissions and limitations under the License.
29
+ */
30
+
31
+
32
+
33
+
34
+
35
+
36
+ function $eec649e464f3832d$var$TextArea(props, ref) {
37
+ props = (0, $5VIId$reactspectrumprovider.useProviderProps)(props);
38
+ props = (0, $5VIId$reactspectrumform.useFormProps)(props);
39
+ let { isDisabled: isDisabled = false, isQuiet: isQuiet = false, isReadOnly: isReadOnly = false, isRequired: isRequired = false, onChange: onChange, ...otherProps } = props;
40
+ var _props_defaultValue;
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 : '', ()=>{});
43
+ let inputRef = (0, $5VIId$react.useRef)(null);
44
+ let onHeightChange = (0, $5VIId$react.useCallback)(()=>{
45
+ // Quiet textareas always grow based on their text content.
46
+ // Standard textareas also grow by default, unless an explicit height is set.
47
+ if ((isQuiet || !props.height) && inputRef.current) {
48
+ let input = inputRef.current;
49
+ let prevAlignment = input.style.alignSelf;
50
+ let prevOverflow = input.style.overflow;
51
+ // Firefox scroll position is lost when overflow: 'hidden' is applied so we skip applying it.
52
+ // The measure/applied height is also incorrect/reset if we turn on and off
53
+ // overflow: hidden in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1787062
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
+ // offsetHeight - clientHeight accounts for the border/padding.
59
+ input.style.height = `${input.scrollHeight + (input.offsetHeight - input.clientHeight)}px`;
60
+ input.style.overflow = prevOverflow;
61
+ input.style.alignSelf = prevAlignment;
62
+ }
63
+ }, [
64
+ isQuiet,
65
+ inputRef,
66
+ props.height
67
+ ]);
68
+ (0, $5VIId$reactariautils.useLayoutEffect)(()=>{
69
+ if (inputRef.current) onHeightChange();
70
+ }, [
71
+ onHeightChange,
72
+ inputValue,
73
+ inputRef
74
+ ]);
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
+ let result = (0, $5VIId$reactariatextfield.useTextField)({
77
+ ...props,
78
+ onChange: (0, $5VIId$reactariautils.chain)(onChange, setInputValue),
79
+ inputElementType: 'textarea'
80
+ }, inputRef);
81
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($5VIId$react))).createElement((0, $86793250183ac29e$exports.TextFieldBase), {
82
+ ...otherProps,
83
+ ref: ref,
84
+ inputRef: inputRef,
85
+ ...result,
86
+ multiLine: true,
87
+ isDisabled: isDisabled,
88
+ isQuiet: isQuiet,
89
+ isReadOnly: isReadOnly,
90
+ isRequired: isRequired
91
+ });
92
+ }
93
+ /**
94
+ * TextAreas are multiline text inputs, useful for cases where users have
95
+ * a sizable amount of text to enter. They allow for all customizations that
96
+ * are available to text fields.
97
+ */ let $eec649e464f3832d$export$f5c9f3c2c4054eec = /*#__PURE__*/ (0, ($parcel$interopDefault($5VIId$react))).forwardRef($eec649e464f3832d$var$TextArea);
98
+
99
+
100
+ //# sourceMappingURL=TextArea.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAWD,SAAS,+BAAS,KAA4B,EAAE,GAAsB;IACpE,QAAQ,CAAA,GAAA,6CAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,qCAAW,EAAE;IACrB,IAAI,cACF,aAAa,gBACb,UAAU,mBACV,aAAa,mBACb,aAAa,iBACb,QAAQ,EACR,GAAG,YACJ,GAAG;QAG8D;IADlE,2FAA2F;IAC3F,IAAI,CAAC,YAAY,cAAc,GAAG,CAAA,GAAA,2CAAiB,EAAE,MAAM,KAAK,EAAE,CAAA,sBAAA,MAAM,YAAY,cAAlB,iCAAA,sBAAsB,IAAI,KAAO;IACnG,IAAI,WAAW,CAAA,GAAA,mBAAK,EAAuB;IAE3C,IAAI,iBAAiB,CAAA,GAAA,wBAAU,EAAE;QAC/B,2DAA2D;QAC3D,6EAA6E;QAC7E,IAAI,AAAC,CAAA,WAAW,CAAC,MAAM,MAAM,AAAD,KAAM,SAAS,OAAO,EAAE;YAClD,IAAI,QAAQ,SAAS,OAAO;YAC5B,IAAI,gBAAgB,MAAM,KAAK,CAAC,SAAS;YACzC,IAAI,eAAe,MAAM,KAAK,CAAC,QAAQ;YACvC,6FAA6F;YAC7F,2EAA2E;YAC3E,mFAAmF;YACnF,IAAI,YAAY,mBAAmB,MAAM,KAAK;YAC9C,IAAI,CAAC,WACH,MAAM,KAAK,CAAC,QAAQ,GAAG;YAEzB,MAAM,KAAK,CAAC,SAAS,GAAG;YACxB,MAAM,KAAK,CAAC,MAAM,GAAG;YACrB,+DAA+D;YAC/D,MAAM,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,MAAM,YAAY,GAAI,CAAA,MAAM,YAAY,GAAG,MAAM,YAAY,AAAD,EAAG,EAAE,CAAC;YAC1F,MAAM,KAAK,CAAC,QAAQ,GAAG;YACvB,MAAM,KAAK,CAAC,SAAS,GAAG;QAC1B;IACF,GAAG;QAAC;QAAS;QAAU,MAAM,MAAM;KAAC;IAEpC,CAAA,GAAA,qCAAc,EAAE;QACd,IAAI,SAAS,OAAO,EAClB;IAEJ,GAAG;QAAC;QAAgB;QAAY;KAAS;IAEzC,IAAI,MAAM,WAAW,EACnB,QAAQ,IAAI,CAAC;IAGf,IAAI,SAAS,CAAA,GAAA,sCAAW,EAAE;QACxB,GAAG,KAAK;QACR,UAAU,CAAA,GAAA,2BAAI,EAAE,UAAU;QAC1B,kBAAkB;IACpB,GAAG;IAEH,qBACE,0DAAC,CAAA,GAAA,uCAAY;QACV,GAAG,UAAU;QACd,KAAK;QACL,UAAU;QACT,GAAG,MAAM;QACV,WAAA;QACA,YAAY;QACZ,SAAS;QACT,YAAY;QACZ,YAAY;;AAElB;AAEA;;;;CAIC,GACD,IAAI,0DAAY,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/textfield/src/TextArea.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 {chain, useLayoutEffect} from '@react-aria/utils';\nimport React, {Ref, useCallback, useRef} from 'react';\nimport {SpectrumTextAreaProps, TextFieldRef} from '@react-types/textfield';\nimport {TextFieldBase} from './TextFieldBase';\nimport {useControlledState} from '@react-stately/utils';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useProviderProps} from '@react-spectrum/provider';\nimport {useTextField} from '@react-aria/textfield';\n\nfunction TextArea(props: SpectrumTextAreaProps, ref: Ref<TextFieldRef>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n isDisabled = false,\n isQuiet = false,\n isReadOnly = false,\n isRequired = false,\n onChange,\n ...otherProps\n } = props;\n\n // not in stately because this is so we know when to re-measure, which is a spectrum design\n let [inputValue, setInputValue] = useControlledState(props.value, props.defaultValue ?? '', () => {});\n let inputRef = useRef<HTMLTextAreaElement>(null);\n\n let onHeightChange = useCallback(() => {\n // Quiet textareas always grow based on their text content.\n // Standard textareas also grow by default, unless an explicit height is set.\n if ((isQuiet || !props.height) && inputRef.current) {\n let input = inputRef.current;\n let prevAlignment = input.style.alignSelf;\n let prevOverflow = input.style.overflow;\n // Firefox scroll position is lost when overflow: 'hidden' is applied so we skip applying it.\n // The measure/applied height is also incorrect/reset if we turn on and off\n // overflow: hidden in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1787062\n let isFirefox = 'MozAppearance' in input.style;\n if (!isFirefox) {\n input.style.overflow = 'hidden';\n }\n input.style.alignSelf = 'start';\n input.style.height = 'auto';\n // offsetHeight - clientHeight accounts for the border/padding.\n input.style.height = `${input.scrollHeight + (input.offsetHeight - input.clientHeight)}px`;\n input.style.overflow = prevOverflow;\n input.style.alignSelf = prevAlignment;\n }\n }, [isQuiet, inputRef, props.height]);\n\n useLayoutEffect(() => {\n if (inputRef.current) {\n onHeightChange();\n }\n }, [onHeightChange, inputValue, inputRef]);\n\n if (props.placeholder) {\n 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');\n }\n\n let result = useTextField({\n ...props,\n onChange: chain(onChange, setInputValue),\n inputElementType: 'textarea'\n }, inputRef);\n\n return (\n <TextFieldBase\n {...otherProps}\n ref={ref}\n inputRef={inputRef}\n {...result}\n multiLine\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n isReadOnly={isReadOnly}\n isRequired={isRequired} />\n );\n}\n\n/**\n * TextAreas are multiline text inputs, useful for cases where users have\n * a sizable amount of text to enter. They allow for all customizations that\n * are available to text fields.\n */\nlet _TextArea = React.forwardRef(TextArea);\nexport {_TextArea as TextArea};\n"],"names":[],"version":3,"file":"TextArea.main.js.map"}
@@ -0,0 +1,91 @@
1
+ import {TextFieldBase as $599adb75312e6492$export$d22444a338b6e3c2} from "./TextFieldBase.mjs";
2
+ import {useLayoutEffect as $hi3T0$useLayoutEffect, chain as $hi3T0$chain} from "@react-aria/utils";
3
+ import $hi3T0$react, {useRef as $hi3T0$useRef, useCallback as $hi3T0$useCallback} from "react";
4
+ import {useControlledState as $hi3T0$useControlledState} from "@react-stately/utils";
5
+ import {useFormProps as $hi3T0$useFormProps} from "@react-spectrum/form";
6
+ import {useProviderProps as $hi3T0$useProviderProps} from "@react-spectrum/provider";
7
+ import {useTextField as $hi3T0$useTextField} from "@react-aria/textfield";
8
+
9
+ /*
10
+ * Copyright 2020 Adobe. All rights reserved.
11
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
12
+ * you may not use this file except in compliance with the License. You may obtain a copy
13
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
14
+ *
15
+ * Unless required by applicable law or agreed to in writing, software distributed under
16
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
17
+ * OF ANY KIND, either express or implied. See the License for the specific language
18
+ * governing permissions and limitations under the License.
19
+ */
20
+
21
+
22
+
23
+
24
+
25
+
26
+ function $cc187bf91f8eea73$var$TextArea(props, ref) {
27
+ props = (0, $hi3T0$useProviderProps)(props);
28
+ props = (0, $hi3T0$useFormProps)(props);
29
+ let { isDisabled: isDisabled = false, isQuiet: isQuiet = false, isReadOnly: isReadOnly = false, isRequired: isRequired = false, onChange: onChange, ...otherProps } = props;
30
+ var _props_defaultValue;
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 : '', ()=>{});
33
+ let inputRef = (0, $hi3T0$useRef)(null);
34
+ let onHeightChange = (0, $hi3T0$useCallback)(()=>{
35
+ // Quiet textareas always grow based on their text content.
36
+ // Standard textareas also grow by default, unless an explicit height is set.
37
+ if ((isQuiet || !props.height) && inputRef.current) {
38
+ let input = inputRef.current;
39
+ let prevAlignment = input.style.alignSelf;
40
+ let prevOverflow = input.style.overflow;
41
+ // Firefox scroll position is lost when overflow: 'hidden' is applied so we skip applying it.
42
+ // The measure/applied height is also incorrect/reset if we turn on and off
43
+ // overflow: hidden in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1787062
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
+ // offsetHeight - clientHeight accounts for the border/padding.
49
+ input.style.height = `${input.scrollHeight + (input.offsetHeight - input.clientHeight)}px`;
50
+ input.style.overflow = prevOverflow;
51
+ input.style.alignSelf = prevAlignment;
52
+ }
53
+ }, [
54
+ isQuiet,
55
+ inputRef,
56
+ props.height
57
+ ]);
58
+ (0, $hi3T0$useLayoutEffect)(()=>{
59
+ if (inputRef.current) onHeightChange();
60
+ }, [
61
+ onHeightChange,
62
+ inputValue,
63
+ inputRef
64
+ ]);
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
+ let result = (0, $hi3T0$useTextField)({
67
+ ...props,
68
+ onChange: (0, $hi3T0$chain)(onChange, setInputValue),
69
+ inputElementType: 'textarea'
70
+ }, inputRef);
71
+ return /*#__PURE__*/ (0, $hi3T0$react).createElement((0, $599adb75312e6492$export$d22444a338b6e3c2), {
72
+ ...otherProps,
73
+ ref: ref,
74
+ inputRef: inputRef,
75
+ ...result,
76
+ multiLine: true,
77
+ isDisabled: isDisabled,
78
+ isQuiet: isQuiet,
79
+ isReadOnly: isReadOnly,
80
+ isRequired: isRequired
81
+ });
82
+ }
83
+ /**
84
+ * TextAreas are multiline text inputs, useful for cases where users have
85
+ * a sizable amount of text to enter. They allow for all customizations that
86
+ * are available to text fields.
87
+ */ let $cc187bf91f8eea73$export$f5c9f3c2c4054eec = /*#__PURE__*/ (0, $hi3T0$react).forwardRef($cc187bf91f8eea73$var$TextArea);
88
+
89
+
90
+ export {$cc187bf91f8eea73$export$f5c9f3c2c4054eec as TextArea};
91
+ //# sourceMappingURL=TextArea.module.js.map
@@ -0,0 +1,91 @@
1
+ import {TextFieldBase as $599adb75312e6492$export$d22444a338b6e3c2} from "./TextFieldBase.module.js";
2
+ import {useLayoutEffect as $hi3T0$useLayoutEffect, chain as $hi3T0$chain} from "@react-aria/utils";
3
+ import $hi3T0$react, {useRef as $hi3T0$useRef, useCallback as $hi3T0$useCallback} from "react";
4
+ import {useControlledState as $hi3T0$useControlledState} from "@react-stately/utils";
5
+ import {useFormProps as $hi3T0$useFormProps} from "@react-spectrum/form";
6
+ import {useProviderProps as $hi3T0$useProviderProps} from "@react-spectrum/provider";
7
+ import {useTextField as $hi3T0$useTextField} from "@react-aria/textfield";
8
+
9
+ /*
10
+ * Copyright 2020 Adobe. All rights reserved.
11
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
12
+ * you may not use this file except in compliance with the License. You may obtain a copy
13
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
14
+ *
15
+ * Unless required by applicable law or agreed to in writing, software distributed under
16
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
17
+ * OF ANY KIND, either express or implied. See the License for the specific language
18
+ * governing permissions and limitations under the License.
19
+ */
20
+
21
+
22
+
23
+
24
+
25
+
26
+ function $cc187bf91f8eea73$var$TextArea(props, ref) {
27
+ props = (0, $hi3T0$useProviderProps)(props);
28
+ props = (0, $hi3T0$useFormProps)(props);
29
+ let { isDisabled: isDisabled = false, isQuiet: isQuiet = false, isReadOnly: isReadOnly = false, isRequired: isRequired = false, onChange: onChange, ...otherProps } = props;
30
+ var _props_defaultValue;
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 : '', ()=>{});
33
+ let inputRef = (0, $hi3T0$useRef)(null);
34
+ let onHeightChange = (0, $hi3T0$useCallback)(()=>{
35
+ // Quiet textareas always grow based on their text content.
36
+ // Standard textareas also grow by default, unless an explicit height is set.
37
+ if ((isQuiet || !props.height) && inputRef.current) {
38
+ let input = inputRef.current;
39
+ let prevAlignment = input.style.alignSelf;
40
+ let prevOverflow = input.style.overflow;
41
+ // Firefox scroll position is lost when overflow: 'hidden' is applied so we skip applying it.
42
+ // The measure/applied height is also incorrect/reset if we turn on and off
43
+ // overflow: hidden in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1787062
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
+ // offsetHeight - clientHeight accounts for the border/padding.
49
+ input.style.height = `${input.scrollHeight + (input.offsetHeight - input.clientHeight)}px`;
50
+ input.style.overflow = prevOverflow;
51
+ input.style.alignSelf = prevAlignment;
52
+ }
53
+ }, [
54
+ isQuiet,
55
+ inputRef,
56
+ props.height
57
+ ]);
58
+ (0, $hi3T0$useLayoutEffect)(()=>{
59
+ if (inputRef.current) onHeightChange();
60
+ }, [
61
+ onHeightChange,
62
+ inputValue,
63
+ inputRef
64
+ ]);
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
+ let result = (0, $hi3T0$useTextField)({
67
+ ...props,
68
+ onChange: (0, $hi3T0$chain)(onChange, setInputValue),
69
+ inputElementType: 'textarea'
70
+ }, inputRef);
71
+ return /*#__PURE__*/ (0, $hi3T0$react).createElement((0, $599adb75312e6492$export$d22444a338b6e3c2), {
72
+ ...otherProps,
73
+ ref: ref,
74
+ inputRef: inputRef,
75
+ ...result,
76
+ multiLine: true,
77
+ isDisabled: isDisabled,
78
+ isQuiet: isQuiet,
79
+ isReadOnly: isReadOnly,
80
+ isRequired: isRequired
81
+ });
82
+ }
83
+ /**
84
+ * TextAreas are multiline text inputs, useful for cases where users have
85
+ * a sizable amount of text to enter. They allow for all customizations that
86
+ * are available to text fields.
87
+ */ let $cc187bf91f8eea73$export$f5c9f3c2c4054eec = /*#__PURE__*/ (0, $hi3T0$react).forwardRef($cc187bf91f8eea73$var$TextArea);
88
+
89
+
90
+ export {$cc187bf91f8eea73$export$f5c9f3c2c4054eec as TextArea};
91
+ //# sourceMappingURL=TextArea.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAWD,SAAS,+BAAS,KAA4B,EAAE,GAAsB;IACpE,QAAQ,CAAA,GAAA,uBAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,mBAAW,EAAE;IACrB,IAAI,cACF,aAAa,gBACb,UAAU,mBACV,aAAa,mBACb,aAAa,iBACb,QAAQ,EACR,GAAG,YACJ,GAAG;QAG8D;IADlE,2FAA2F;IAC3F,IAAI,CAAC,YAAY,cAAc,GAAG,CAAA,GAAA,yBAAiB,EAAE,MAAM,KAAK,EAAE,CAAA,sBAAA,MAAM,YAAY,cAAlB,iCAAA,sBAAsB,IAAI,KAAO;IACnG,IAAI,WAAW,CAAA,GAAA,aAAK,EAAuB;IAE3C,IAAI,iBAAiB,CAAA,GAAA,kBAAU,EAAE;QAC/B,2DAA2D;QAC3D,6EAA6E;QAC7E,IAAI,AAAC,CAAA,WAAW,CAAC,MAAM,MAAM,AAAD,KAAM,SAAS,OAAO,EAAE;YAClD,IAAI,QAAQ,SAAS,OAAO;YAC5B,IAAI,gBAAgB,MAAM,KAAK,CAAC,SAAS;YACzC,IAAI,eAAe,MAAM,KAAK,CAAC,QAAQ;YACvC,6FAA6F;YAC7F,2EAA2E;YAC3E,mFAAmF;YACnF,IAAI,YAAY,mBAAmB,MAAM,KAAK;YAC9C,IAAI,CAAC,WACH,MAAM,KAAK,CAAC,QAAQ,GAAG;YAEzB,MAAM,KAAK,CAAC,SAAS,GAAG;YACxB,MAAM,KAAK,CAAC,MAAM,GAAG;YACrB,+DAA+D;YAC/D,MAAM,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,MAAM,YAAY,GAAI,CAAA,MAAM,YAAY,GAAG,MAAM,YAAY,AAAD,EAAG,EAAE,CAAC;YAC1F,MAAM,KAAK,CAAC,QAAQ,GAAG;YACvB,MAAM,KAAK,CAAC,SAAS,GAAG;QAC1B;IACF,GAAG;QAAC;QAAS;QAAU,MAAM,MAAM;KAAC;IAEpC,CAAA,GAAA,sBAAc,EAAE;QACd,IAAI,SAAS,OAAO,EAClB;IAEJ,GAAG;QAAC;QAAgB;QAAY;KAAS;IAEzC,IAAI,MAAM,WAAW,EACnB,QAAQ,IAAI,CAAC;IAGf,IAAI,SAAS,CAAA,GAAA,mBAAW,EAAE;QACxB,GAAG,KAAK;QACR,UAAU,CAAA,GAAA,YAAI,EAAE,UAAU;QAC1B,kBAAkB;IACpB,GAAG;IAEH,qBACE,gCAAC,CAAA,GAAA,yCAAY;QACV,GAAG,UAAU;QACd,KAAK;QACL,UAAU;QACT,GAAG,MAAM;QACV,WAAA;QACA,YAAY;QACZ,SAAS;QACT,YAAY;QACZ,YAAY;;AAElB;AAEA;;;;CAIC,GACD,IAAI,0DAAY,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/textfield/src/TextArea.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 {chain, useLayoutEffect} from '@react-aria/utils';\nimport React, {Ref, useCallback, useRef} from 'react';\nimport {SpectrumTextAreaProps, TextFieldRef} from '@react-types/textfield';\nimport {TextFieldBase} from './TextFieldBase';\nimport {useControlledState} from '@react-stately/utils';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useProviderProps} from '@react-spectrum/provider';\nimport {useTextField} from '@react-aria/textfield';\n\nfunction TextArea(props: SpectrumTextAreaProps, ref: Ref<TextFieldRef>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n let {\n isDisabled = false,\n isQuiet = false,\n isReadOnly = false,\n isRequired = false,\n onChange,\n ...otherProps\n } = props;\n\n // not in stately because this is so we know when to re-measure, which is a spectrum design\n let [inputValue, setInputValue] = useControlledState(props.value, props.defaultValue ?? '', () => {});\n let inputRef = useRef<HTMLTextAreaElement>(null);\n\n let onHeightChange = useCallback(() => {\n // Quiet textareas always grow based on their text content.\n // Standard textareas also grow by default, unless an explicit height is set.\n if ((isQuiet || !props.height) && inputRef.current) {\n let input = inputRef.current;\n let prevAlignment = input.style.alignSelf;\n let prevOverflow = input.style.overflow;\n // Firefox scroll position is lost when overflow: 'hidden' is applied so we skip applying it.\n // The measure/applied height is also incorrect/reset if we turn on and off\n // overflow: hidden in Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1787062\n let isFirefox = 'MozAppearance' in input.style;\n if (!isFirefox) {\n input.style.overflow = 'hidden';\n }\n input.style.alignSelf = 'start';\n input.style.height = 'auto';\n // offsetHeight - clientHeight accounts for the border/padding.\n input.style.height = `${input.scrollHeight + (input.offsetHeight - input.clientHeight)}px`;\n input.style.overflow = prevOverflow;\n input.style.alignSelf = prevAlignment;\n }\n }, [isQuiet, inputRef, props.height]);\n\n useLayoutEffect(() => {\n if (inputRef.current) {\n onHeightChange();\n }\n }, [onHeightChange, inputValue, inputRef]);\n\n if (props.placeholder) {\n 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');\n }\n\n let result = useTextField({\n ...props,\n onChange: chain(onChange, setInputValue),\n inputElementType: 'textarea'\n }, inputRef);\n\n return (\n <TextFieldBase\n {...otherProps}\n ref={ref}\n inputRef={inputRef}\n {...result}\n multiLine\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n isReadOnly={isReadOnly}\n isRequired={isRequired} />\n );\n}\n\n/**\n * TextAreas are multiline text inputs, useful for cases where users have\n * a sizable amount of text to enter. They allow for all customizations that\n * are available to text fields.\n */\nlet _TextArea = React.forwardRef(TextArea);\nexport {_TextArea as TextArea};\n"],"names":[],"version":3,"file":"TextArea.module.js.map"}
@@ -0,0 +1,52 @@
1
+ var $86793250183ac29e$exports = require("./TextFieldBase.main.js");
2
+ var $em8OD$react = require("react");
3
+ var $em8OD$reactspectrumform = require("@react-spectrum/form");
4
+ var $em8OD$reactspectrumprovider = require("@react-spectrum/provider");
5
+ var $em8OD$reactariatextfield = require("@react-aria/textfield");
6
+
7
+
8
+ function $parcel$interopDefault(a) {
9
+ return a && a.__esModule ? a.default : a;
10
+ }
11
+
12
+ function $parcel$export(e, n, v, s) {
13
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
14
+ }
15
+
16
+ $parcel$export(module.exports, "TextField", () => $34fd51d50eb4b056$export$2c73285ae9390cec);
17
+ /*
18
+ * Copyright 2020 Adobe. All rights reserved.
19
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
20
+ * you may not use this file except in compliance with the License. You may obtain a copy
21
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
22
+ *
23
+ * Unless required by applicable law or agreed to in writing, software distributed under
24
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
25
+ * OF ANY KIND, either express or implied. See the License for the specific language
26
+ * governing permissions and limitations under the License.
27
+ */
28
+
29
+
30
+
31
+
32
+ function $34fd51d50eb4b056$var$TextField(props, ref) {
33
+ props = (0, $em8OD$reactspectrumprovider.useProviderProps)(props);
34
+ props = (0, $em8OD$reactspectrumform.useFormProps)(props);
35
+ let inputRef = (0, $em8OD$react.useRef)(null);
36
+ let result = (0, $em8OD$reactariatextfield.useTextField)(props, inputRef);
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
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($em8OD$react))).createElement((0, $86793250183ac29e$exports.TextFieldBase), {
39
+ ...props,
40
+ ...result,
41
+ ref: ref,
42
+ inputRef: inputRef
43
+ });
44
+ }
45
+ /**
46
+ * TextFields are text inputs that allow users to input custom text entries
47
+ * with a keyboard. Various decorations can be displayed around the field to
48
+ * communicate the entry requirements.
49
+ */ const $34fd51d50eb4b056$export$2c73285ae9390cec = /*#__PURE__*/ (0, $em8OD$react.forwardRef)($34fd51d50eb4b056$var$TextField);
50
+
51
+
52
+ //# sourceMappingURL=TextField.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AASD,SAAS,gCAAU,KAA6B,EAAE,GAAsB;IACtE,QAAQ,CAAA,GAAA,6CAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,qCAAW,EAAE;IAErB,IAAI,WAAW,CAAA,GAAA,mBAAK,EAAoB;IACxC,IAAI,SAAS,CAAA,GAAA,sCAAW,EAAE,OAAO;IAEjC,IAAI,MAAM,WAAW,EACnB,QAAQ,IAAI,CAAC;IAGf,qBACE,0DAAC,CAAA,GAAA,uCAAY;QACV,GAAG,KAAK;QACR,GAAG,MAAM;QACV,KAAK;QACL,UAAU;;AAEhB;AAEA;;;;CAIC,GACD,MAAM,0DAAa,CAAA,GAAA,uBAAS,EAAE","sources":["packages/@react-spectrum/textfield/src/TextField.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 React, {forwardRef, Ref, useRef} from 'react';\nimport {SpectrumTextFieldProps, TextFieldRef} from '@react-types/textfield';\nimport {TextFieldBase} from './TextFieldBase';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useProviderProps} from '@react-spectrum/provider';\nimport {useTextField} from '@react-aria/textfield';\n\nfunction TextField(props: SpectrumTextFieldProps, ref: Ref<TextFieldRef>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n\n let inputRef = useRef<HTMLInputElement>(null);\n let result = useTextField(props, inputRef);\n\n if (props.placeholder) {\n 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');\n }\n\n return (\n <TextFieldBase\n {...props}\n {...result}\n ref={ref}\n inputRef={inputRef} />\n );\n}\n\n/**\n * TextFields are text inputs that allow users to input custom text entries\n * with a keyboard. Various decorations can be displayed around the field to\n * communicate the entry requirements.\n */\nconst _TextField = forwardRef(TextField);\nexport {_TextField as TextField};\n"],"names":[],"version":3,"file":"TextField.main.js.map"}
@@ -0,0 +1,43 @@
1
+ import {TextFieldBase as $599adb75312e6492$export$d22444a338b6e3c2} from "./TextFieldBase.mjs";
2
+ import $9R76J$react, {useRef as $9R76J$useRef, forwardRef as $9R76J$forwardRef} from "react";
3
+ import {useFormProps as $9R76J$useFormProps} from "@react-spectrum/form";
4
+ import {useProviderProps as $9R76J$useProviderProps} from "@react-spectrum/provider";
5
+ import {useTextField as $9R76J$useTextField} from "@react-aria/textfield";
6
+
7
+ /*
8
+ * Copyright 2020 Adobe. All rights reserved.
9
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
10
+ * you may not use this file except in compliance with the License. You may obtain a copy
11
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software distributed under
14
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
15
+ * OF ANY KIND, either express or implied. See the License for the specific language
16
+ * governing permissions and limitations under the License.
17
+ */
18
+
19
+
20
+
21
+
22
+ function $265457f9427aa380$var$TextField(props, ref) {
23
+ props = (0, $9R76J$useProviderProps)(props);
24
+ props = (0, $9R76J$useFormProps)(props);
25
+ let inputRef = (0, $9R76J$useRef)(null);
26
+ let result = (0, $9R76J$useTextField)(props, inputRef);
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
+ return /*#__PURE__*/ (0, $9R76J$react).createElement((0, $599adb75312e6492$export$d22444a338b6e3c2), {
29
+ ...props,
30
+ ...result,
31
+ ref: ref,
32
+ inputRef: inputRef
33
+ });
34
+ }
35
+ /**
36
+ * TextFields are text inputs that allow users to input custom text entries
37
+ * with a keyboard. Various decorations can be displayed around the field to
38
+ * communicate the entry requirements.
39
+ */ const $265457f9427aa380$export$2c73285ae9390cec = /*#__PURE__*/ (0, $9R76J$forwardRef)($265457f9427aa380$var$TextField);
40
+
41
+
42
+ export {$265457f9427aa380$export$2c73285ae9390cec as TextField};
43
+ //# sourceMappingURL=TextField.module.js.map
@@ -0,0 +1,43 @@
1
+ import {TextFieldBase as $599adb75312e6492$export$d22444a338b6e3c2} from "./TextFieldBase.module.js";
2
+ import $9R76J$react, {useRef as $9R76J$useRef, forwardRef as $9R76J$forwardRef} from "react";
3
+ import {useFormProps as $9R76J$useFormProps} from "@react-spectrum/form";
4
+ import {useProviderProps as $9R76J$useProviderProps} from "@react-spectrum/provider";
5
+ import {useTextField as $9R76J$useTextField} from "@react-aria/textfield";
6
+
7
+ /*
8
+ * Copyright 2020 Adobe. All rights reserved.
9
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
10
+ * you may not use this file except in compliance with the License. You may obtain a copy
11
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software distributed under
14
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
15
+ * OF ANY KIND, either express or implied. See the License for the specific language
16
+ * governing permissions and limitations under the License.
17
+ */
18
+
19
+
20
+
21
+
22
+ function $265457f9427aa380$var$TextField(props, ref) {
23
+ props = (0, $9R76J$useProviderProps)(props);
24
+ props = (0, $9R76J$useFormProps)(props);
25
+ let inputRef = (0, $9R76J$useRef)(null);
26
+ let result = (0, $9R76J$useTextField)(props, inputRef);
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
+ return /*#__PURE__*/ (0, $9R76J$react).createElement((0, $599adb75312e6492$export$d22444a338b6e3c2), {
29
+ ...props,
30
+ ...result,
31
+ ref: ref,
32
+ inputRef: inputRef
33
+ });
34
+ }
35
+ /**
36
+ * TextFields are text inputs that allow users to input custom text entries
37
+ * with a keyboard. Various decorations can be displayed around the field to
38
+ * communicate the entry requirements.
39
+ */ const $265457f9427aa380$export$2c73285ae9390cec = /*#__PURE__*/ (0, $9R76J$forwardRef)($265457f9427aa380$var$TextField);
40
+
41
+
42
+ export {$265457f9427aa380$export$2c73285ae9390cec as TextField};
43
+ //# sourceMappingURL=TextField.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AASD,SAAS,gCAAU,KAA6B,EAAE,GAAsB;IACtE,QAAQ,CAAA,GAAA,uBAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,mBAAW,EAAE;IAErB,IAAI,WAAW,CAAA,GAAA,aAAK,EAAoB;IACxC,IAAI,SAAS,CAAA,GAAA,mBAAW,EAAE,OAAO;IAEjC,IAAI,MAAM,WAAW,EACnB,QAAQ,IAAI,CAAC;IAGf,qBACE,gCAAC,CAAA,GAAA,yCAAY;QACV,GAAG,KAAK;QACR,GAAG,MAAM;QACV,KAAK;QACL,UAAU;;AAEhB;AAEA;;;;CAIC,GACD,MAAM,0DAAa,CAAA,GAAA,iBAAS,EAAE","sources":["packages/@react-spectrum/textfield/src/TextField.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 React, {forwardRef, Ref, useRef} from 'react';\nimport {SpectrumTextFieldProps, TextFieldRef} from '@react-types/textfield';\nimport {TextFieldBase} from './TextFieldBase';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useProviderProps} from '@react-spectrum/provider';\nimport {useTextField} from '@react-aria/textfield';\n\nfunction TextField(props: SpectrumTextFieldProps, ref: Ref<TextFieldRef>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n\n let inputRef = useRef<HTMLInputElement>(null);\n let result = useTextField(props, inputRef);\n\n if (props.placeholder) {\n 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');\n }\n\n return (\n <TextFieldBase\n {...props}\n {...result}\n ref={ref}\n inputRef={inputRef} />\n );\n}\n\n/**\n * TextFields are text inputs that allow users to input custom text entries\n * with a keyboard. Various decorations can be displayed around the field to\n * communicate the entry requirements.\n */\nconst _TextField = forwardRef(TextField);\nexport {_TextField as TextField};\n"],"names":[],"version":3,"file":"TextField.module.js.map"}
@@ -0,0 +1,109 @@
1
+ require("./vars.07716e14.css");
2
+ var $40cb3a00c193680f$exports = require("./textfield_vars_css.main.js");
3
+ var $fWjzu$spectrumiconsuiAlertMedium = require("@spectrum-icons/ui/AlertMedium");
4
+ var $fWjzu$spectrumiconsuiCheckmarkMedium = require("@spectrum-icons/ui/CheckmarkMedium");
5
+ var $fWjzu$reactspectrumutils = require("@react-spectrum/utils");
6
+ var $fWjzu$reactspectrumlabel = require("@react-spectrum/label");
7
+ var $fWjzu$reactariautils = require("@react-aria/utils");
8
+ var $fWjzu$react = require("react");
9
+ var $fWjzu$reactariafocus = require("@react-aria/focus");
10
+ var $fWjzu$reactariainteractions = require("@react-aria/interactions");
11
+
12
+
13
+ function $parcel$interopDefault(a) {
14
+ return a && a.__esModule ? a.default : a;
15
+ }
16
+
17
+ function $parcel$export(e, n, v, s) {
18
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
19
+ }
20
+
21
+ $parcel$export(module.exports, "TextFieldBase", () => $86793250183ac29e$export$d22444a338b6e3c2);
22
+ /*
23
+ * Copyright 2020 Adobe. All rights reserved.
24
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
25
+ * you may not use this file except in compliance with the License. You may obtain a copy
26
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
27
+ *
28
+ * Unless required by applicable law or agreed to in writing, software distributed under
29
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
30
+ * OF ANY KIND, either express or implied. See the License for the specific language
31
+ * governing permissions and limitations under the License.
32
+ */
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+ function $86793250183ac29e$var$TextFieldBase(props, ref) {
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
+ let { hoverProps: hoverProps, isHovered: isHovered } = (0, $fWjzu$reactariainteractions.useHover)({
44
+ isDisabled: isDisabled
45
+ });
46
+ let domRef = (0, $fWjzu$react.useRef)(null);
47
+ let defaultInputRef = (0, $fWjzu$react.useRef)(null);
48
+ let inputRef = userInputRef || defaultInputRef;
49
+ // Expose imperative interface for ref
50
+ (0, $fWjzu$react.useImperativeHandle)(ref, ()=>({
51
+ ...(0, $fWjzu$reactspectrumutils.createFocusableRef)(domRef, inputRef),
52
+ select () {
53
+ if (inputRef.current) inputRef.current.select();
54
+ },
55
+ getInputElement () {
56
+ return inputRef.current;
57
+ }
58
+ }));
59
+ let ElementType = multiLine ? 'textarea' : 'input';
60
+ let isInvalid = validationState === 'invalid' && !isDisabled;
61
+ if (icon) {
62
+ let UNSAFE_className = (0, $fWjzu$reactspectrumutils.classNames)((0, ($parcel$interopDefault($40cb3a00c193680f$exports))), icon.props && icon.props.UNSAFE_className, 'spectrum-Textfield-icon');
63
+ icon = /*#__PURE__*/ (0, $fWjzu$react.cloneElement)(icon, {
64
+ UNSAFE_className: UNSAFE_className,
65
+ size: 'S'
66
+ });
67
+ }
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
+ let validation = /*#__PURE__*/ (0, $fWjzu$react.cloneElement)(validationIcon, {
70
+ UNSAFE_className: (0, $fWjzu$reactspectrumutils.classNames)((0, ($parcel$interopDefault($40cb3a00c193680f$exports))), 'spectrum-Textfield-validationIcon', validationIconClassName)
71
+ });
72
+ let { focusProps: focusProps, isFocusVisible: isFocusVisible } = (0, $fWjzu$reactariafocus.useFocusRing)({
73
+ isTextInput: true,
74
+ autoFocus: autoFocus
75
+ });
76
+ let textField = /*#__PURE__*/ (0, ($parcel$interopDefault($fWjzu$react))).createElement("div", {
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
+ })
85
+ }, /*#__PURE__*/ (0, ($parcel$interopDefault($fWjzu$react))).createElement(ElementType, {
86
+ ...(0, $fWjzu$reactariautils.mergeProps)(inputProps, hoverProps, focusProps),
87
+ ref: inputRef,
88
+ rows: multiLine ? 1 : undefined,
89
+ className: (0, $fWjzu$reactspectrumutils.classNames)((0, ($parcel$interopDefault($40cb3a00c193680f$exports))), 'spectrum-Textfield-input', {
90
+ 'spectrum-Textfield-inputIcon': icon,
91
+ 'is-hovered': isHovered
92
+ }, inputClassName)
93
+ }), icon, validationState && !isLoading && !isDisabled ? validation : null, isLoading && loadingIndicator, wrapperChildren);
94
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($fWjzu$react))).createElement((0, $fWjzu$reactspectrumlabel.Field), {
95
+ ...props,
96
+ labelProps: labelProps,
97
+ descriptionProps: descriptionProps,
98
+ errorMessageProps: errorMessageProps,
99
+ wrapperClassName: (0, $fWjzu$reactspectrumutils.classNames)((0, ($parcel$interopDefault($40cb3a00c193680f$exports))), 'spectrum-Textfield-wrapper', {
100
+ 'spectrum-Textfield-wrapper--quiet': isQuiet
101
+ }),
102
+ showErrorIcon: false,
103
+ ref: domRef
104
+ }, textField);
105
+ }
106
+ const $86793250183ac29e$export$d22444a338b6e3c2 = /*#__PURE__*/ (0, $fWjzu$react.forwardRef)($86793250183ac29e$var$TextFieldBase);
107
+
108
+
109
+ //# sourceMappingURL=TextFieldBase.main.js.map
@@ -0,0 +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,qCAAO,EAAE;oBAAC;IAAU;IAClD,IAAI,SAAS,CAAA,GAAA,mBAAK,EAAkB;IACpC,IAAI,kBAAkB,CAAA,GAAA,mBAAK,EAA0C;IACrE,IAAI,WAAW,gBAAgB;IAE/B,sCAAsC;IACtC,CAAA,GAAA,gCAAkB,EAAE,KAAK,IAAO,CAAA;YAC9B,GAAG,CAAA,GAAA,4CAAiB,EAAE,QAAQ,SAAS;YACvC;gBACE,IAAI,SAAS,OAAO,EAClB,SAAS,OAAO,CAAC,MAAM;YAE3B;YACA;gBACE,OAAO,SAAS,OAAO;YACzB;QACF,CAAA;IAEA,IAAI,cAAiC,YAAY,aAAa;IAC9D,IAAI,YAAY,oBAAoB,aAAa,CAAC;IAElD,IAAI,MAAM;QACR,IAAI,mBAAmB,CAAA,GAAA,oCAAS,EAC9B,CAAA,GAAA,mDAAK,GACL,KAAK,KAAK,IAAI,KAAK,KAAK,CAAC,gBAAgB,EACzC;QAGF,qBAAO,CAAA,GAAA,yBAAW,EAAE,MAAM;8BACxB;YACA,MAAM;QACR;IACF;IAEA,IAAI,iBAAiB,0BAAY,0DAAC,CAAA,GAAA,2DAAU,yBAAO,0DAAC,CAAA,GAAA,+DAAc;IAClE,IAAI,2BAAa,CAAA,GAAA,yBAAW,EAAE,gBAAgB;QAC5C,kBAAkB,CAAA,GAAA,oCAAS,EACzB,CAAA,GAAA,mDAAK,GACL,qCACA;IAEJ;IAEA,IAAI,cAAC,UAAU,kBAAE,cAAc,EAAC,GAAG,CAAA,GAAA,kCAAW,EAAE;QAC9C,aAAa;mBACb;IACF;IAEA,IAAI,0BACF,0DAAC;QACC,WACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAK,GACL,sBACA;YACE,+BAA+B;YAC/B,6BAA6B,oBAAoB,WAAW,CAAC;YAC7D,gCAAgC;YAChC,6BAA6B;YAC7B,iCAAiC;YACjC,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, ValidationResult} from '@react-types/shared';\nimport React, {cloneElement, forwardRef, HTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, ReactElement, Ref, RefObject, 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>,\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.UNSAFE_className,\n 'spectrum-Textfield-icon'\n );\n\n icon = cloneElement(icon, {\n UNSAFE_className,\n size: 'S'\n });\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"}