@react-spectrum/textfield 3.13.5 → 3.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/TextArea.main.js +9 -1
- package/dist/TextArea.main.js.map +1 -1
- package/dist/TextArea.mjs +10 -2
- package/dist/TextArea.module.js +10 -2
- package/dist/TextArea.module.js.map +1 -1
- package/dist/TextField.main.js +9 -1
- package/dist/TextField.main.js.map +1 -1
- package/dist/TextField.mjs +10 -2
- package/dist/TextField.module.js +10 -2
- package/dist/TextField.module.js.map +1 -1
- package/dist/TextFieldBase.main.js +17 -1
- package/dist/TextFieldBase.main.js.map +1 -1
- package/dist/TextFieldBase.mjs +18 -2
- package/dist/TextFieldBase.module.js +18 -2
- package/dist/TextFieldBase.module.js.map +1 -1
- package/dist/ar-AE.main.js +6 -0
- package/dist/ar-AE.main.js.map +1 -0
- package/dist/ar-AE.mjs +8 -0
- package/dist/ar-AE.module.js +8 -0
- package/dist/ar-AE.module.js.map +1 -0
- package/dist/bg-BG.main.js +6 -0
- package/dist/bg-BG.main.js.map +1 -0
- package/dist/bg-BG.mjs +8 -0
- package/dist/bg-BG.module.js +8 -0
- package/dist/bg-BG.module.js.map +1 -0
- package/dist/cs-CZ.main.js +6 -0
- package/dist/cs-CZ.main.js.map +1 -0
- package/dist/cs-CZ.mjs +8 -0
- package/dist/cs-CZ.module.js +8 -0
- package/dist/cs-CZ.module.js.map +1 -0
- package/dist/da-DK.main.js +6 -0
- package/dist/da-DK.main.js.map +1 -0
- package/dist/da-DK.mjs +8 -0
- package/dist/da-DK.module.js +8 -0
- package/dist/da-DK.module.js.map +1 -0
- package/dist/de-DE.main.js +6 -0
- package/dist/de-DE.main.js.map +1 -0
- package/dist/de-DE.mjs +8 -0
- package/dist/de-DE.module.js +8 -0
- package/dist/de-DE.module.js.map +1 -0
- package/dist/el-GR.main.js +6 -0
- package/dist/el-GR.main.js.map +1 -0
- package/dist/el-GR.mjs +8 -0
- package/dist/el-GR.module.js +8 -0
- package/dist/el-GR.module.js.map +1 -0
- package/dist/en-US.main.js +6 -0
- package/dist/en-US.main.js.map +1 -0
- package/dist/en-US.mjs +8 -0
- package/dist/en-US.module.js +8 -0
- package/dist/en-US.module.js.map +1 -0
- package/dist/es-ES.main.js +6 -0
- package/dist/es-ES.main.js.map +1 -0
- package/dist/es-ES.mjs +8 -0
- package/dist/es-ES.module.js +8 -0
- package/dist/es-ES.module.js.map +1 -0
- package/dist/et-EE.main.js +6 -0
- package/dist/et-EE.main.js.map +1 -0
- package/dist/et-EE.mjs +8 -0
- package/dist/et-EE.module.js +8 -0
- package/dist/et-EE.module.js.map +1 -0
- package/dist/fi-FI.main.js +6 -0
- package/dist/fi-FI.main.js.map +1 -0
- package/dist/fi-FI.mjs +8 -0
- package/dist/fi-FI.module.js +8 -0
- package/dist/fi-FI.module.js.map +1 -0
- package/dist/fr-FR.main.js +6 -0
- package/dist/fr-FR.main.js.map +1 -0
- package/dist/fr-FR.mjs +8 -0
- package/dist/fr-FR.module.js +8 -0
- package/dist/fr-FR.module.js.map +1 -0
- package/dist/he-IL.main.js +6 -0
- package/dist/he-IL.main.js.map +1 -0
- package/dist/he-IL.mjs +8 -0
- package/dist/he-IL.module.js +8 -0
- package/dist/he-IL.module.js.map +1 -0
- package/dist/hr-HR.main.js +6 -0
- package/dist/hr-HR.main.js.map +1 -0
- package/dist/hr-HR.mjs +8 -0
- package/dist/hr-HR.module.js +8 -0
- package/dist/hr-HR.module.js.map +1 -0
- package/dist/hu-HU.main.js +6 -0
- package/dist/hu-HU.main.js.map +1 -0
- package/dist/hu-HU.mjs +8 -0
- package/dist/hu-HU.module.js +8 -0
- package/dist/hu-HU.module.js.map +1 -0
- package/dist/intlStrings.main.js +108 -0
- package/dist/intlStrings.main.js.map +1 -0
- package/dist/intlStrings.mjs +110 -0
- package/dist/intlStrings.module.js +110 -0
- package/dist/intlStrings.module.js.map +1 -0
- package/dist/it-IT.main.js +6 -0
- package/dist/it-IT.main.js.map +1 -0
- package/dist/it-IT.mjs +8 -0
- package/dist/it-IT.module.js +8 -0
- package/dist/it-IT.module.js.map +1 -0
- package/dist/ja-JP.main.js +6 -0
- package/dist/ja-JP.main.js.map +1 -0
- package/dist/ja-JP.mjs +8 -0
- package/dist/ja-JP.module.js +8 -0
- package/dist/ja-JP.module.js.map +1 -0
- package/dist/ko-KR.main.js +6 -0
- package/dist/ko-KR.main.js.map +1 -0
- package/dist/ko-KR.mjs +8 -0
- package/dist/ko-KR.module.js +8 -0
- package/dist/ko-KR.module.js.map +1 -0
- package/dist/lt-LT.main.js +6 -0
- package/dist/lt-LT.main.js.map +1 -0
- package/dist/lt-LT.mjs +8 -0
- package/dist/lt-LT.module.js +8 -0
- package/dist/lt-LT.module.js.map +1 -0
- package/dist/lv-LV.main.js +6 -0
- package/dist/lv-LV.main.js.map +1 -0
- package/dist/lv-LV.mjs +8 -0
- package/dist/lv-LV.module.js +8 -0
- package/dist/lv-LV.module.js.map +1 -0
- package/dist/nb-NO.main.js +6 -0
- package/dist/nb-NO.main.js.map +1 -0
- package/dist/nb-NO.mjs +8 -0
- package/dist/nb-NO.module.js +8 -0
- package/dist/nb-NO.module.js.map +1 -0
- package/dist/nl-NL.main.js +6 -0
- package/dist/nl-NL.main.js.map +1 -0
- package/dist/nl-NL.mjs +8 -0
- package/dist/nl-NL.module.js +8 -0
- package/dist/nl-NL.module.js.map +1 -0
- package/dist/pl-PL.main.js +6 -0
- package/dist/pl-PL.main.js.map +1 -0
- package/dist/pl-PL.mjs +8 -0
- package/dist/pl-PL.module.js +8 -0
- package/dist/pl-PL.module.js.map +1 -0
- package/dist/pt-BR.main.js +6 -0
- package/dist/pt-BR.main.js.map +1 -0
- package/dist/pt-BR.mjs +8 -0
- package/dist/pt-BR.module.js +8 -0
- package/dist/pt-BR.module.js.map +1 -0
- package/dist/pt-PT.main.js +6 -0
- package/dist/pt-PT.main.js.map +1 -0
- package/dist/pt-PT.mjs +8 -0
- package/dist/pt-PT.module.js +8 -0
- package/dist/pt-PT.module.js.map +1 -0
- package/dist/ro-RO.main.js +6 -0
- package/dist/ro-RO.main.js.map +1 -0
- package/dist/ro-RO.mjs +8 -0
- package/dist/ro-RO.module.js +8 -0
- package/dist/ro-RO.module.js.map +1 -0
- package/dist/ru-RU.main.js +6 -0
- package/dist/ru-RU.main.js.map +1 -0
- package/dist/ru-RU.mjs +8 -0
- package/dist/ru-RU.module.js +8 -0
- package/dist/ru-RU.module.js.map +1 -0
- package/dist/sk-SK.main.js +6 -0
- package/dist/sk-SK.main.js.map +1 -0
- package/dist/sk-SK.mjs +8 -0
- package/dist/sk-SK.module.js +8 -0
- package/dist/sk-SK.module.js.map +1 -0
- package/dist/sl-SI.main.js +6 -0
- package/dist/sl-SI.main.js.map +1 -0
- package/dist/sl-SI.mjs +8 -0
- package/dist/sl-SI.module.js +8 -0
- package/dist/sl-SI.module.js.map +1 -0
- package/dist/sr-SP.main.js +6 -0
- package/dist/sr-SP.main.js.map +1 -0
- package/dist/sr-SP.mjs +8 -0
- package/dist/sr-SP.module.js +8 -0
- package/dist/sr-SP.module.js.map +1 -0
- package/dist/sv-SE.main.js +6 -0
- package/dist/sv-SE.main.js.map +1 -0
- package/dist/sv-SE.mjs +8 -0
- package/dist/sv-SE.module.js +8 -0
- package/dist/sv-SE.module.js.map +1 -0
- package/dist/tr-TR.main.js +6 -0
- package/dist/tr-TR.main.js.map +1 -0
- package/dist/tr-TR.mjs +8 -0
- package/dist/tr-TR.module.js +8 -0
- package/dist/tr-TR.module.js.map +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/uk-UA.main.js +6 -0
- package/dist/uk-UA.main.js.map +1 -0
- package/dist/uk-UA.mjs +8 -0
- package/dist/uk-UA.module.js +8 -0
- package/dist/uk-UA.module.js.map +1 -0
- package/dist/zh-CN.main.js +6 -0
- package/dist/zh-CN.main.js.map +1 -0
- package/dist/zh-CN.mjs +8 -0
- package/dist/zh-CN.module.js +8 -0
- package/dist/zh-CN.module.js.map +1 -0
- package/dist/zh-TW.main.js +6 -0
- package/dist/zh-TW.main.js.map +1 -0
- package/dist/zh-TW.mjs +8 -0
- package/dist/zh-TW.module.js +8 -0
- package/dist/zh-TW.module.js.map +1 -0
- package/package.json +14 -13
- package/src/TextArea.tsx +8 -4
- package/src/TextField.tsx +8 -4
- package/src/TextFieldBase.tsx +18 -2
package/dist/TextArea.main.js
CHANGED
@@ -72,7 +72,15 @@ const $eec649e464f3832d$export$f5c9f3c2c4054eec = /*#__PURE__*/ (0, ($parcel$int
|
|
72
72
|
inputValue,
|
73
73
|
inputRef
|
74
74
|
]);
|
75
|
-
|
75
|
+
let hasWarned = (0, $5VIId$react.useRef)(false);
|
76
|
+
(0, $5VIId$react.useEffect)(()=>{
|
77
|
+
if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {
|
78
|
+
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');
|
79
|
+
hasWarned.current = true;
|
80
|
+
}
|
81
|
+
}, [
|
82
|
+
props.placeholder
|
83
|
+
]);
|
76
84
|
let result = (0, $5VIId$reactariatextfield.useTextField)({
|
77
85
|
...props,
|
78
86
|
onChange: (0, $5VIId$reactariautils.chain)(onChange, setInputValue),
|
@@ -1 +1 @@
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAgBM,MAAM,0DAAW,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC,SAAS,SAAS,KAA4B,EAAE,GAA2C;IAClI,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,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AAA,GAAA,mBAAK,EAAE;IACvB,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,MAAM,WAAW,IAAI,CAAC,UAAU,OAAO,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAAc;YACpF,QAAQ,IAAI,CAAC;YACb,UAAU,OAAO,GAAG;QACtB;IACF,GAAG;QAAC,MAAM,WAAW;KAAC;IAEtB,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","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, useEffect, useRef} from 'react';\nimport {SpectrumTextAreaProps, SpectrumTextFieldBaseProps, 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\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 */\nexport const TextArea = React.forwardRef(function TextArea(props: SpectrumTextAreaProps, ref: Ref<TextFieldRef<HTMLTextAreaElement>>) {\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 let hasWarned = useRef(false);\n useEffect(() => {\n if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {\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 hasWarned.current = true;\n }\n }, [props.placeholder]);\n\n let result = useTextField({\n ...props,\n onChange: chain(onChange, setInputValue),\n inputElementType: 'textarea'\n }, inputRef);\n\n return (\n <TextFieldBase\n {...otherProps as SpectrumTextFieldBaseProps}\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"],"names":[],"version":3,"file":"TextArea.main.js.map"}
|
package/dist/TextArea.mjs
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import {TextFieldBase as $599adb75312e6492$export$d22444a338b6e3c2} from "./TextFieldBase.mjs";
|
2
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";
|
3
|
+
import $hi3T0$react, {useRef as $hi3T0$useRef, useCallback as $hi3T0$useCallback, useEffect as $hi3T0$useEffect} from "react";
|
4
4
|
import {useControlledState as $hi3T0$useControlledState} from "@react-stately/utils";
|
5
5
|
import {useFormProps as $hi3T0$useFormProps} from "@react-spectrum/form";
|
6
6
|
import {useProviderProps as $hi3T0$useProviderProps} from "@react-spectrum/provider";
|
@@ -62,7 +62,15 @@ const $cc187bf91f8eea73$export$f5c9f3c2c4054eec = /*#__PURE__*/ (0, $hi3T0$react
|
|
62
62
|
inputValue,
|
63
63
|
inputRef
|
64
64
|
]);
|
65
|
-
|
65
|
+
let hasWarned = (0, $hi3T0$useRef)(false);
|
66
|
+
(0, $hi3T0$useEffect)(()=>{
|
67
|
+
if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {
|
68
|
+
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');
|
69
|
+
hasWarned.current = true;
|
70
|
+
}
|
71
|
+
}, [
|
72
|
+
props.placeholder
|
73
|
+
]);
|
66
74
|
let result = (0, $hi3T0$useTextField)({
|
67
75
|
...props,
|
68
76
|
onChange: (0, $hi3T0$chain)(onChange, setInputValue),
|
package/dist/TextArea.module.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import {TextFieldBase as $599adb75312e6492$export$d22444a338b6e3c2} from "./TextFieldBase.module.js";
|
2
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";
|
3
|
+
import $hi3T0$react, {useRef as $hi3T0$useRef, useCallback as $hi3T0$useCallback, useEffect as $hi3T0$useEffect} from "react";
|
4
4
|
import {useControlledState as $hi3T0$useControlledState} from "@react-stately/utils";
|
5
5
|
import {useFormProps as $hi3T0$useFormProps} from "@react-spectrum/form";
|
6
6
|
import {useProviderProps as $hi3T0$useProviderProps} from "@react-spectrum/provider";
|
@@ -62,7 +62,15 @@ const $cc187bf91f8eea73$export$f5c9f3c2c4054eec = /*#__PURE__*/ (0, $hi3T0$react
|
|
62
62
|
inputValue,
|
63
63
|
inputRef
|
64
64
|
]);
|
65
|
-
|
65
|
+
let hasWarned = (0, $hi3T0$useRef)(false);
|
66
|
+
(0, $hi3T0$useEffect)(()=>{
|
67
|
+
if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {
|
68
|
+
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');
|
69
|
+
hasWarned.current = true;
|
70
|
+
}
|
71
|
+
}, [
|
72
|
+
props.placeholder
|
73
|
+
]);
|
66
74
|
let result = (0, $hi3T0$useTextField)({
|
67
75
|
...props,
|
68
76
|
onChange: (0, $hi3T0$chain)(onChange, setInputValue),
|
@@ -1 +1 @@
|
|
1
|
-
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAgBM,MAAM,0DAAW,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,SAAS,SAAS,KAA4B,EAAE,GAA2C;IAClI,QAAQ,CAAA,GAAA,uBAAe,EAAE;IACzB,QAAQ,CAAA,GA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;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,YAAY,CAAA,GAAA,aAAK,EAAE;IACvB,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,MAAM,WAAW,IAAI,CAAC,UAAU,OAAO,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAAc;YACpF,QAAQ,IAAI,CAAC;YACb,UAAU,OAAO,GAAG;QACtB;IACF,GAAG;QAAC,MAAM,WAAW;KAAC;IAEtB,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","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, useEffect, useRef} from 'react';\nimport {SpectrumTextAreaProps, SpectrumTextFieldBaseProps, 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\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 */\nexport const TextArea = React.forwardRef(function TextArea(props: SpectrumTextAreaProps, ref: Ref<TextFieldRef<HTMLTextAreaElement>>) {\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 let hasWarned = useRef(false);\n useEffect(() => {\n if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {\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 hasWarned.current = true;\n }\n }, [props.placeholder]);\n\n let result = useTextField({\n ...props,\n onChange: chain(onChange, setInputValue),\n inputElementType: 'textarea'\n }, inputRef);\n\n return (\n <TextFieldBase\n {...otherProps as SpectrumTextFieldBaseProps}\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"],"names":[],"version":3,"file":"TextArea.module.js.map"}
|
package/dist/TextField.main.js
CHANGED
@@ -34,7 +34,15 @@ const $34fd51d50eb4b056$export$2c73285ae9390cec = /*#__PURE__*/ (0, $em8OD$react
|
|
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
|
-
|
37
|
+
let hasWarned = (0, $em8OD$react.useRef)(false);
|
38
|
+
(0, $em8OD$react.useEffect)(()=>{
|
39
|
+
if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {
|
40
|
+
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');
|
41
|
+
hasWarned.current = true;
|
42
|
+
}
|
43
|
+
}, [
|
44
|
+
props.placeholder
|
45
|
+
]);
|
38
46
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($em8OD$react))).createElement((0, $86793250183ac29e$exports.TextFieldBase), {
|
39
47
|
...props,
|
40
48
|
...result,
|
@@ -1 +1 @@
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAcM,MAAM,0DAAY,CAAA,GAAA,uBAAS,EAAE,SAAS,UAAU,KAA6B,EAAE,GAAsB;IAC1G,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,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAcM,MAAM,0DAAY,CAAA,GAAA,uBAAS,EAAE,SAAS,UAAU,KAA6B,EAAE,GAAsB;IAC1G,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,YAAY,CAAA,GAAA,mBAAK,EAAE;IACvB,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,MAAM,WAAW,IAAI,CAAC,UAAU,OAAO,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAAc;YACpF,QAAQ,IAAI,CAAC;YACb,UAAU,OAAO,GAAG;QACtB;IACF,GAAG;QAAC,MAAM,WAAW;KAAC;IAEtB,qBACE,0DAAC,CAAA,GAAA,uCAAY;QACV,GAAG,KAAK;QACR,GAAG,MAAM;QACV,KAAK;QACL,UAAU;;AAEhB","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, useEffect, 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\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 */\nexport const TextField = forwardRef(function 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 let hasWarned = useRef(false);\n useEffect(() => {\n if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {\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 hasWarned.current = true;\n }\n }, [props.placeholder]);\n\n return (\n <TextFieldBase\n {...props}\n {...result}\n ref={ref}\n inputRef={inputRef} />\n );\n});\n"],"names":[],"version":3,"file":"TextField.main.js.map"}
|
package/dist/TextField.mjs
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import {TextFieldBase as $599adb75312e6492$export$d22444a338b6e3c2} from "./TextFieldBase.mjs";
|
2
|
-
import $9R76J$react, {forwardRef as $9R76J$forwardRef, useRef as $9R76J$useRef} from "react";
|
2
|
+
import $9R76J$react, {forwardRef as $9R76J$forwardRef, useRef as $9R76J$useRef, useEffect as $9R76J$useEffect} from "react";
|
3
3
|
import {useFormProps as $9R76J$useFormProps} from "@react-spectrum/form";
|
4
4
|
import {useProviderProps as $9R76J$useProviderProps} from "@react-spectrum/provider";
|
5
5
|
import {useTextField as $9R76J$useTextField} from "@react-aria/textfield";
|
@@ -24,7 +24,15 @@ const $265457f9427aa380$export$2c73285ae9390cec = /*#__PURE__*/ (0, $9R76J$forwa
|
|
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
|
-
|
27
|
+
let hasWarned = (0, $9R76J$useRef)(false);
|
28
|
+
(0, $9R76J$useEffect)(()=>{
|
29
|
+
if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {
|
30
|
+
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');
|
31
|
+
hasWarned.current = true;
|
32
|
+
}
|
33
|
+
}, [
|
34
|
+
props.placeholder
|
35
|
+
]);
|
28
36
|
return /*#__PURE__*/ (0, $9R76J$react).createElement((0, $599adb75312e6492$export$d22444a338b6e3c2), {
|
29
37
|
...props,
|
30
38
|
...result,
|
package/dist/TextField.module.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import {TextFieldBase as $599adb75312e6492$export$d22444a338b6e3c2} from "./TextFieldBase.module.js";
|
2
|
-
import $9R76J$react, {forwardRef as $9R76J$forwardRef, useRef as $9R76J$useRef} from "react";
|
2
|
+
import $9R76J$react, {forwardRef as $9R76J$forwardRef, useRef as $9R76J$useRef, useEffect as $9R76J$useEffect} from "react";
|
3
3
|
import {useFormProps as $9R76J$useFormProps} from "@react-spectrum/form";
|
4
4
|
import {useProviderProps as $9R76J$useProviderProps} from "@react-spectrum/provider";
|
5
5
|
import {useTextField as $9R76J$useTextField} from "@react-aria/textfield";
|
@@ -24,7 +24,15 @@ const $265457f9427aa380$export$2c73285ae9390cec = /*#__PURE__*/ (0, $9R76J$forwa
|
|
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
|
-
|
27
|
+
let hasWarned = (0, $9R76J$useRef)(false);
|
28
|
+
(0, $9R76J$useEffect)(()=>{
|
29
|
+
if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {
|
30
|
+
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');
|
31
|
+
hasWarned.current = true;
|
32
|
+
}
|
33
|
+
}, [
|
34
|
+
props.placeholder
|
35
|
+
]);
|
28
36
|
return /*#__PURE__*/ (0, $9R76J$react).createElement((0, $599adb75312e6492$export$d22444a338b6e3c2), {
|
29
37
|
...props,
|
30
38
|
...result,
|
@@ -1 +1 @@
|
|
1
|
-
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAcM,MAAM,0DAAY,CAAA,GAAA,iBAAS,EAAE,SAAS,UAAU,KAA6B,EAAE,GAAsB;IAC1G,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,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,
|
1
|
+
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAcM,MAAM,0DAAY,CAAA,GAAA,iBAAS,EAAE,SAAS,UAAU,KAA6B,EAAE,GAAsB;IAC1G,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,YAAY,CAAA,GAAA,aAAK,EAAE;IACvB,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,MAAM,WAAW,IAAI,CAAC,UAAU,OAAO,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAAc;YACpF,QAAQ,IAAI,CAAC;YACb,UAAU,OAAO,GAAG;QACtB;IACF,GAAG;QAAC,MAAM,WAAW;KAAC;IAEtB,qBACE,gCAAC,CAAA,GAAA,yCAAY;QACV,GAAG,KAAK;QACR,GAAG,MAAM;QACV,KAAK;QACL,UAAU;;AAEhB","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, useEffect, 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\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 */\nexport const TextField = forwardRef(function 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 let hasWarned = useRef(false);\n useEffect(() => {\n if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {\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 hasWarned.current = true;\n }\n }, [props.placeholder]);\n\n return (\n <TextFieldBase\n {...props}\n {...result}\n ref={ref}\n inputRef={inputRef} />\n );\n});\n"],"names":[],"version":3,"file":"TextField.module.js.map"}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
var $286a257fb3d9a493$exports = require("./intlStrings.main.js");
|
1
2
|
require("./textfield.54643fd6.css");
|
2
3
|
var $40cb3a00c193680f$exports = require("./textfield_vars_css.main.js");
|
3
4
|
var $fWjzu$spectrumiconsuiAlertMedium = require("@spectrum-icons/ui/AlertMedium");
|
@@ -8,6 +9,7 @@ var $fWjzu$reactariautils = require("@react-aria/utils");
|
|
8
9
|
var $fWjzu$react = require("react");
|
9
10
|
var $fWjzu$reactariafocus = require("@react-aria/focus");
|
10
11
|
var $fWjzu$reactariainteractions = require("@react-aria/interactions");
|
12
|
+
var $fWjzu$reactariai18n = require("@react-aria/i18n");
|
11
13
|
|
12
14
|
|
13
15
|
function $parcel$interopDefault(a) {
|
@@ -38,6 +40,8 @@ $parcel$export(module.exports, "TextFieldBase", () => $86793250183ac29e$export$d
|
|
38
40
|
|
39
41
|
|
40
42
|
|
43
|
+
|
44
|
+
|
41
45
|
const $86793250183ac29e$export$d22444a338b6e3c2 = /*#__PURE__*/ (0, $fWjzu$react.forwardRef)(function TextFieldBase(props, ref) {
|
42
46
|
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
47
|
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $fWjzu$reactariainteractions.useHover)({
|
@@ -65,10 +69,22 @@ const $86793250183ac29e$export$d22444a338b6e3c2 = /*#__PURE__*/ (0, $fWjzu$react
|
|
65
69
|
size: 'S'
|
66
70
|
});
|
67
71
|
}
|
68
|
-
let
|
72
|
+
let stringFormatter = (0, $fWjzu$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($286a257fb3d9a493$exports))), '@react-spectrum/textfield');
|
73
|
+
let validId = (0, $fWjzu$reactariautils.useId)();
|
74
|
+
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))), {
|
75
|
+
id: validId,
|
76
|
+
"aria-hidden": true,
|
77
|
+
"aria-label": stringFormatter.format('valid')
|
78
|
+
});
|
69
79
|
let validation = /*#__PURE__*/ (0, $fWjzu$react.cloneElement)(validationIcon, {
|
70
80
|
UNSAFE_className: (0, $fWjzu$reactspectrumutils.classNames)((0, ($parcel$interopDefault($40cb3a00c193680f$exports))), 'spectrum-Textfield-validationIcon', validationIconClassName)
|
71
81
|
});
|
82
|
+
// Add validation icon IDREF to aria-describedby when validationState is valid
|
83
|
+
let inputPropsAriaDescribedBy = inputProps['aria-describedby'];
|
84
|
+
if (!isInvalid && validationState === 'valid' && !isLoading && !isDisabled && (!inputPropsAriaDescribedBy || !inputPropsAriaDescribedBy.includes(validId))) inputProps['aria-describedby'] = [
|
85
|
+
inputPropsAriaDescribedBy,
|
86
|
+
validId
|
87
|
+
].join(' ').trim();
|
72
88
|
let { focusProps: focusProps, isFocusVisible: isFocusVisible } = (0, $fWjzu$reactariafocus.useFocusRing)({
|
73
89
|
isTextInput: true,
|
74
90
|
autoFocus: autoFocus
|
@@ -1 +1 @@
|
|
1
|
-
{"mappings":"
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;AAgCM,MAAM,0DAAgB,CAAA,GAAA,uBAAS,EAAE,SAAS,cAAc,KAAyB,EAAE,GAA8D;IACtJ,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,gB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;IAC9E,IAAI,4BAA4B,UAAU,CAAC,mBAAmB;IAC9D,IACE,CAAC,aAAa,oBAAoB,WAAW,CAAC,aAAa,CAAC,cAC3D,CAAA,CAAC,6BAA6B,CAAC,0BAA0B,QAAQ,CAAC,QAAO,GAE1E,UAAU,CAAC,mBAAmB,GAAG;QAAC;QAA2B;KAAQ,CAAC,IAAI,CAAC,KAAK,IAAI;IAGtF,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","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';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {mergeProps, useId} 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';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\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\nexport const TextFieldBase = forwardRef(function TextFieldBase(props: TextFieldBaseProps, ref: Ref<TextFieldRef<HTMLInputElement | HTMLTextAreaElement>>) {\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 stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/textfield');\n let validId = useId();\n let validationIcon = isInvalid\n ? <AlertMedium />\n : <CheckmarkMedium id={validId} aria-hidden aria-label={stringFormatter.format('valid')} />;\n let validation = cloneElement(validationIcon, {\n UNSAFE_className: classNames(\n styles,\n 'spectrum-Textfield-validationIcon',\n validationIconClassName\n )\n });\n\n // Add validation icon IDREF to aria-describedby when validationState is valid\n let inputPropsAriaDescribedBy = inputProps['aria-describedby'];\n if (\n !isInvalid && validationState === 'valid' && !isLoading && !isDisabled &&\n (!inputPropsAriaDescribedBy || !inputPropsAriaDescribedBy.includes(validId))\n ) {\n inputProps['aria-describedby'] = [inputPropsAriaDescribedBy, validId].join(' ').trim();\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"],"names":[],"version":3,"file":"TextFieldBase.main.js.map"}
|
package/dist/TextFieldBase.mjs
CHANGED
@@ -1,13 +1,15 @@
|
|
1
|
+
import $264pK$intlStringsmodulejs from "./intlStrings.mjs";
|
1
2
|
import "./textfield.54643fd6.css";
|
2
3
|
import $264pK$textfield_vars_cssmodulejs from "./textfield_vars_css.mjs";
|
3
4
|
import $264pK$spectrumiconsuiAlertMedium from "@spectrum-icons/ui/AlertMedium";
|
4
5
|
import $264pK$spectrumiconsuiCheckmarkMedium from "@spectrum-icons/ui/CheckmarkMedium";
|
5
6
|
import {createFocusableRef as $264pK$createFocusableRef, classNames as $264pK$classNames} from "@react-spectrum/utils";
|
6
7
|
import {Field as $264pK$Field} from "@react-spectrum/label";
|
7
|
-
import {mergeProps as $264pK$mergeProps} from "@react-aria/utils";
|
8
|
+
import {useId as $264pK$useId, mergeProps as $264pK$mergeProps} from "@react-aria/utils";
|
8
9
|
import $264pK$react, {forwardRef as $264pK$forwardRef, useRef as $264pK$useRef, useImperativeHandle as $264pK$useImperativeHandle, cloneElement as $264pK$cloneElement} from "react";
|
9
10
|
import {useFocusRing as $264pK$useFocusRing} from "@react-aria/focus";
|
10
11
|
import {useHover as $264pK$useHover} from "@react-aria/interactions";
|
12
|
+
import {useLocalizedStringFormatter as $264pK$useLocalizedStringFormatter} from "@react-aria/i18n";
|
11
13
|
|
12
14
|
|
13
15
|
function $parcel$interopDefault(a) {
|
@@ -32,6 +34,8 @@ function $parcel$interopDefault(a) {
|
|
32
34
|
|
33
35
|
|
34
36
|
|
37
|
+
|
38
|
+
|
35
39
|
const $599adb75312e6492$export$d22444a338b6e3c2 = /*#__PURE__*/ (0, $264pK$forwardRef)(function TextFieldBase(props, ref) {
|
36
40
|
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
41
|
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $264pK$useHover)({
|
@@ -59,10 +63,22 @@ const $599adb75312e6492$export$d22444a338b6e3c2 = /*#__PURE__*/ (0, $264pK$forwa
|
|
59
63
|
size: 'S'
|
60
64
|
});
|
61
65
|
}
|
62
|
-
let
|
66
|
+
let stringFormatter = (0, $264pK$useLocalizedStringFormatter)((0, ($parcel$interopDefault($264pK$intlStringsmodulejs))), '@react-spectrum/textfield');
|
67
|
+
let validId = (0, $264pK$useId)();
|
68
|
+
let validationIcon = isInvalid ? /*#__PURE__*/ (0, $264pK$react).createElement((0, $264pK$spectrumiconsuiAlertMedium), null) : /*#__PURE__*/ (0, $264pK$react).createElement((0, $264pK$spectrumiconsuiCheckmarkMedium), {
|
69
|
+
id: validId,
|
70
|
+
"aria-hidden": true,
|
71
|
+
"aria-label": stringFormatter.format('valid')
|
72
|
+
});
|
63
73
|
let validation = /*#__PURE__*/ (0, $264pK$cloneElement)(validationIcon, {
|
64
74
|
UNSAFE_className: (0, $264pK$classNames)((0, ($parcel$interopDefault($264pK$textfield_vars_cssmodulejs))), 'spectrum-Textfield-validationIcon', validationIconClassName)
|
65
75
|
});
|
76
|
+
// Add validation icon IDREF to aria-describedby when validationState is valid
|
77
|
+
let inputPropsAriaDescribedBy = inputProps['aria-describedby'];
|
78
|
+
if (!isInvalid && validationState === 'valid' && !isLoading && !isDisabled && (!inputPropsAriaDescribedBy || !inputPropsAriaDescribedBy.includes(validId))) inputProps['aria-describedby'] = [
|
79
|
+
inputPropsAriaDescribedBy,
|
80
|
+
validId
|
81
|
+
].join(' ').trim();
|
66
82
|
let { focusProps: focusProps, isFocusVisible: isFocusVisible } = (0, $264pK$useFocusRing)({
|
67
83
|
isTextInput: true,
|
68
84
|
autoFocus: autoFocus
|
@@ -1,13 +1,15 @@
|
|
1
|
+
import $264pK$intlStringsmodulejs from "./intlStrings.module.js";
|
1
2
|
import "./textfield.54643fd6.css";
|
2
3
|
import $264pK$textfield_vars_cssmodulejs from "./textfield_vars_css.module.js";
|
3
4
|
import $264pK$spectrumiconsuiAlertMedium from "@spectrum-icons/ui/AlertMedium";
|
4
5
|
import $264pK$spectrumiconsuiCheckmarkMedium from "@spectrum-icons/ui/CheckmarkMedium";
|
5
6
|
import {createFocusableRef as $264pK$createFocusableRef, classNames as $264pK$classNames} from "@react-spectrum/utils";
|
6
7
|
import {Field as $264pK$Field} from "@react-spectrum/label";
|
7
|
-
import {mergeProps as $264pK$mergeProps} from "@react-aria/utils";
|
8
|
+
import {useId as $264pK$useId, mergeProps as $264pK$mergeProps} from "@react-aria/utils";
|
8
9
|
import $264pK$react, {forwardRef as $264pK$forwardRef, useRef as $264pK$useRef, useImperativeHandle as $264pK$useImperativeHandle, cloneElement as $264pK$cloneElement} from "react";
|
9
10
|
import {useFocusRing as $264pK$useFocusRing} from "@react-aria/focus";
|
10
11
|
import {useHover as $264pK$useHover} from "@react-aria/interactions";
|
12
|
+
import {useLocalizedStringFormatter as $264pK$useLocalizedStringFormatter} from "@react-aria/i18n";
|
11
13
|
|
12
14
|
|
13
15
|
function $parcel$interopDefault(a) {
|
@@ -32,6 +34,8 @@ function $parcel$interopDefault(a) {
|
|
32
34
|
|
33
35
|
|
34
36
|
|
37
|
+
|
38
|
+
|
35
39
|
const $599adb75312e6492$export$d22444a338b6e3c2 = /*#__PURE__*/ (0, $264pK$forwardRef)(function TextFieldBase(props, ref) {
|
36
40
|
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
41
|
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $264pK$useHover)({
|
@@ -59,10 +63,22 @@ const $599adb75312e6492$export$d22444a338b6e3c2 = /*#__PURE__*/ (0, $264pK$forwa
|
|
59
63
|
size: 'S'
|
60
64
|
});
|
61
65
|
}
|
62
|
-
let
|
66
|
+
let stringFormatter = (0, $264pK$useLocalizedStringFormatter)((0, ($parcel$interopDefault($264pK$intlStringsmodulejs))), '@react-spectrum/textfield');
|
67
|
+
let validId = (0, $264pK$useId)();
|
68
|
+
let validationIcon = isInvalid ? /*#__PURE__*/ (0, $264pK$react).createElement((0, $264pK$spectrumiconsuiAlertMedium), null) : /*#__PURE__*/ (0, $264pK$react).createElement((0, $264pK$spectrumiconsuiCheckmarkMedium), {
|
69
|
+
id: validId,
|
70
|
+
"aria-hidden": true,
|
71
|
+
"aria-label": stringFormatter.format('valid')
|
72
|
+
});
|
63
73
|
let validation = /*#__PURE__*/ (0, $264pK$cloneElement)(validationIcon, {
|
64
74
|
UNSAFE_className: (0, $264pK$classNames)((0, ($parcel$interopDefault($264pK$textfield_vars_cssmodulejs))), 'spectrum-Textfield-validationIcon', validationIconClassName)
|
65
75
|
});
|
76
|
+
// Add validation icon IDREF to aria-describedby when validationState is valid
|
77
|
+
let inputPropsAriaDescribedBy = inputProps['aria-describedby'];
|
78
|
+
if (!isInvalid && validationState === 'valid' && !isLoading && !isDisabled && (!inputPropsAriaDescribedBy || !inputPropsAriaDescribedBy.includes(validId))) inputProps['aria-describedby'] = [
|
79
|
+
inputPropsAriaDescribedBy,
|
80
|
+
validId
|
81
|
+
].join(' ').trim();
|
66
82
|
let { focusProps: focusProps, isFocusVisible: isFocusVisible } = (0, $264pK$useFocusRing)({
|
67
83
|
isTextInput: true,
|
68
84
|
autoFocus: autoFocus
|
@@ -1 +1 @@
|
|
1
|
-
{"mappings":"
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;AAgCM,MAAM,0DAAgB,CAAA,GAAA,iBAAS,EAAE,SAAS,cAAc,KAAyB,EAAE,GAA8D;IACtJ,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,GAAA,aAAK,EAA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IAAI;IAGtF,IAAI,cAAC,UAAU,kBAAE,cAAc,EAAC,GAAG,CAAA,GAAA,mBAAW,EAAE;QAC9C,aAAa;mBACb;IACF;IAEA,IAAI,0BACF,gCAAC;QACC,WACE,CAAA,GAAA,iBAAS,EACP,CAAA,GAAA,2DAAK,GACL,sBACA;YACE,+BAA+B;YAC/B,6BAA6B,oBAAoB,WAAW,CAAC;YAC7D,gCAAgC;YAChC,6BAA6B;YAC7B,iCAAiC;YACjC,cAAc,CAAC,oBAAoB;QACrC;qBAGJ,gCAAC;QACE,GAAG,CAAA,GAAA,iBAAS,EAAE,YAAY,YAAY,WAAW;QAClD,KAAK;QACL,MAAM,YAAY,IAAI;QACtB,WACE,CAAA,GAAA,iBAAS,EACP,CAAA,GAAA,2DAAK,GACL,4BACA;YACE,gCAAgC;YAChC,cAAc;QAChB,GACA;QAGL,MACA,mBAAmB,CAAC,aAAa,CAAC,aAAa,aAAa,MAC5D,aAAa,kBACb;IAIL,qBACE,gCAAC,CAAA,GAAA,YAAI;QACF,GAAG,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","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';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {mergeProps, useId} 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';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\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\nexport const TextFieldBase = forwardRef(function TextFieldBase(props: TextFieldBaseProps, ref: Ref<TextFieldRef<HTMLInputElement | HTMLTextAreaElement>>) {\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 stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/textfield');\n let validId = useId();\n let validationIcon = isInvalid\n ? <AlertMedium />\n : <CheckmarkMedium id={validId} aria-hidden aria-label={stringFormatter.format('valid')} />;\n let validation = cloneElement(validationIcon, {\n UNSAFE_className: classNames(\n styles,\n 'spectrum-Textfield-validationIcon',\n validationIconClassName\n )\n });\n\n // Add validation icon IDREF to aria-describedby when validationState is valid\n let inputPropsAriaDescribedBy = inputProps['aria-describedby'];\n if (\n !isInvalid && validationState === 'valid' && !isLoading && !isDisabled &&\n (!inputPropsAriaDescribedBy || !inputPropsAriaDescribedBy.includes(validId))\n ) {\n inputProps['aria-describedby'] = [inputPropsAriaDescribedBy, validId].join(' ').trim();\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"],"names":[],"version":3,"file":"TextFieldBase.module.js.map"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"mappings":"AAAA,iBAAiB;IAAG,SAAS,CAAC,4BAAI,CAAC;AACnC","sources":["packages/@react-spectrum/textfield/intl/ar-AE.json"],"sourcesContent":["{\n \"valid\": \"صالح\"\n}\n"],"names":[],"version":3,"file":"ar-AE.main.js.map"}
|
package/dist/ar-AE.mjs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"mappings":";AAAA,4BAAiB;IAAG,SAAS,CAAC,4BAAI,CAAC;AACnC","sources":["packages/@react-spectrum/textfield/intl/ar-AE.json"],"sourcesContent":["{\n \"valid\": \"صالح\"\n}\n"],"names":[],"version":3,"file":"ar-AE.module.js.map"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"mappings":"AAAA,iBAAiB;IAAG,SAAS,CAAC,iDAAO,CAAC;AACtC","sources":["packages/@react-spectrum/textfield/intl/bg-BG.json"],"sourcesContent":["{\n \"valid\": \"Валиден\"\n}\n"],"names":[],"version":3,"file":"bg-BG.main.js.map"}
|
package/dist/bg-BG.mjs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"mappings":";AAAA,4BAAiB;IAAG,SAAS,CAAC,iDAAO,CAAC;AACtC","sources":["packages/@react-spectrum/textfield/intl/bg-BG.json"],"sourcesContent":["{\n \"valid\": \"Валиден\"\n}\n"],"names":[],"version":3,"file":"bg-BG.module.js.map"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"mappings":"AAAA,iBAAiB;IAAG,SAAS,CAAC,SAAM,CAAC;AACrC","sources":["packages/@react-spectrum/textfield/intl/cs-CZ.json"],"sourcesContent":["{\n \"valid\": \"Platné\"\n}\n"],"names":[],"version":3,"file":"cs-CZ.main.js.map"}
|
package/dist/cs-CZ.mjs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"mappings":";AAAA,4BAAiB;IAAG,SAAS,CAAC,SAAM,CAAC;AACrC","sources":["packages/@react-spectrum/textfield/intl/cs-CZ.json"],"sourcesContent":["{\n \"valid\": \"Platné\"\n}\n"],"names":[],"version":3,"file":"cs-CZ.module.js.map"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"mappings":"AAAA,iBAAiB;IAAG,SAAS,CAAC,MAAM,CAAC;AACrC","sources":["packages/@react-spectrum/textfield/intl/da-DK.json"],"sourcesContent":["{\n \"valid\": \"Gyldig\"\n}\n"],"names":[],"version":3,"file":"da-DK.main.js.map"}
|