@react-spectrum/textfield 3.14.0 → 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/types.d.ts.map +1 -1
- package/package.json +13 -13
- package/src/TextArea.tsx +8 -4
- package/src/TextField.tsx +8 -4
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,EA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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,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,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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,GAAG;YACrB,+DAA+D;YAC/D,MAAM,KAAK,CAAC,MAAM,GAAG,GAAG,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,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"}
|
package/dist/types.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"mappings":";;;AA2BA,4BAA6B,SAAQ,IAAI,CAAC,sBAAsB,EAAE,UAAU,GAAG,UAAU,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,gBAAgB,CAAC;IAChI,eAAe,CAAC,EAAE,YAAY,GAAG,YAAY,EAAE,CAAC;IAChD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,oBAAoB,gBAAgB,CAAC,CAAC;IACnD,UAAU,EAAE,oBAAoB,gBAAgB,CAAC,GAAG,uBAAuB,mBAAmB,CAAC,CAAC;IAChG,gBAAgB,CAAC,EAAE,eAAe,WAAW,CAAC,CAAC;IAC/C,iBAAiB,CAAC,EAAE,eAAe,WAAW,CAAC,CAAC;IAChD,QAAQ,CAAC,EAAE,UAAU,gBAAgB,GAAG,mBAAmB,GAAG,IAAI,CAAC,CAAC;IACpE,gBAAgB,CAAC,EAAE,YAAY,CAAC;IAChC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B;AAED,OAAO,MAAM,8IA2IX,CAAC;AChKH;;;;GAIG;AACH,OAAO,MAAM,
|
1
|
+
{"mappings":";;;AA2BA,4BAA6B,SAAQ,IAAI,CAAC,sBAAsB,EAAE,UAAU,GAAG,UAAU,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,gBAAgB,CAAC;IAChI,eAAe,CAAC,EAAE,YAAY,GAAG,YAAY,EAAE,CAAC;IAChD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,oBAAoB,gBAAgB,CAAC,CAAC;IACnD,UAAU,EAAE,oBAAoB,gBAAgB,CAAC,GAAG,uBAAuB,mBAAmB,CAAC,CAAC;IAChG,gBAAgB,CAAC,EAAE,eAAe,WAAW,CAAC,CAAC;IAC/C,iBAAiB,CAAC,EAAE,eAAe,WAAW,CAAC,CAAC;IAChD,QAAQ,CAAC,EAAE,UAAU,gBAAgB,GAAG,mBAAmB,GAAG,IAAI,CAAC,CAAC;IACpE,gBAAgB,CAAC,EAAE,YAAY,CAAC;IAChC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B;AAED,OAAO,MAAM,8IA2IX,CAAC;AChKH;;;;GAIG;AACH,OAAO,MAAM,yHAuEX,CAAC;AC9EH;;;;GAIG;AACH,OAAO,MAAM,wHAsBX,CAAC;AC7BH,YAAY,EAAC,sBAAsB,EAAE,qBAAqB,EAAC,MAAM,wBAAwB,CAAC","sources":["packages/@react-spectrum/textfield/src/packages/@react-spectrum/textfield/src/TextFieldBase.tsx","packages/@react-spectrum/textfield/src/packages/@react-spectrum/textfield/src/TextArea.tsx","packages/@react-spectrum/textfield/src/packages/@react-spectrum/textfield/src/TextField.tsx","packages/@react-spectrum/textfield/src/packages/@react-spectrum/textfield/src/index.ts","packages/@react-spectrum/textfield/src/index.ts"],"sourcesContent":[null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/// <reference types=\"css-module-types\" />\n\nexport {TextArea} from './TextArea';\nexport {TextField} from './TextField';\nexport {TextFieldBase} from './TextFieldBase';\nexport type {SpectrumTextFieldProps, SpectrumTextAreaProps} from '@react-types/textfield';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@react-spectrum/textfield",
|
3
|
-
"version": "3.14.
|
3
|
+
"version": "3.14.1",
|
4
4
|
"description": "Spectrum UI components in React",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"main": "dist/main.js",
|
@@ -40,18 +40,18 @@
|
|
40
40
|
"url": "https://github.com/adobe/react-spectrum"
|
41
41
|
},
|
42
42
|
"dependencies": {
|
43
|
-
"@react-aria/focus": "^3.21.
|
44
|
-
"@react-aria/i18n": "^3.12.
|
45
|
-
"@react-aria/interactions": "^3.25.
|
46
|
-
"@react-aria/textfield": "^3.18.
|
47
|
-
"@react-aria/utils": "^3.30.
|
48
|
-
"@react-spectrum/form": "^3.7.
|
49
|
-
"@react-spectrum/label": "^3.16.
|
50
|
-
"@react-spectrum/utils": "^3.12.
|
43
|
+
"@react-aria/focus": "^3.21.1",
|
44
|
+
"@react-aria/i18n": "^3.12.12",
|
45
|
+
"@react-aria/interactions": "^3.25.5",
|
46
|
+
"@react-aria/textfield": "^3.18.1",
|
47
|
+
"@react-aria/utils": "^3.30.1",
|
48
|
+
"@react-spectrum/form": "^3.7.18",
|
49
|
+
"@react-spectrum/label": "^3.16.18",
|
50
|
+
"@react-spectrum/utils": "^3.12.8",
|
51
51
|
"@react-stately/utils": "^3.10.8",
|
52
|
-
"@react-types/shared": "^3.
|
53
|
-
"@react-types/textfield": "^3.12.
|
54
|
-
"@spectrum-icons/ui": "^3.6.
|
52
|
+
"@react-types/shared": "^3.32.0",
|
53
|
+
"@react-types/textfield": "^3.12.5",
|
54
|
+
"@spectrum-icons/ui": "^3.6.19",
|
55
55
|
"@swc/helpers": "^0.5.0"
|
56
56
|
},
|
57
57
|
"devDependencies": {
|
@@ -66,5 +66,5 @@
|
|
66
66
|
"publishConfig": {
|
67
67
|
"access": "public"
|
68
68
|
},
|
69
|
-
"gitHead": "
|
69
|
+
"gitHead": "2c58ed3ddd9be9100af9b1d0cfd137fcdc95ba2d"
|
70
70
|
}
|
package/src/TextArea.tsx
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
*/
|
12
12
|
|
13
13
|
import {chain, useLayoutEffect} from '@react-aria/utils';
|
14
|
-
import React, {Ref, useCallback, useRef} from 'react';
|
14
|
+
import React, {Ref, useCallback, useEffect, useRef} from 'react';
|
15
15
|
import {SpectrumTextAreaProps, SpectrumTextFieldBaseProps, TextFieldRef} from '@react-types/textfield';
|
16
16
|
import {TextFieldBase} from './TextFieldBase';
|
17
17
|
import {useControlledState} from '@react-stately/utils';
|
@@ -69,9 +69,13 @@ export const TextArea = React.forwardRef(function TextArea(props: SpectrumTextAr
|
|
69
69
|
}
|
70
70
|
}, [onHeightChange, inputValue, inputRef]);
|
71
71
|
|
72
|
-
|
73
|
-
|
74
|
-
|
72
|
+
let hasWarned = useRef(false);
|
73
|
+
useEffect(() => {
|
74
|
+
if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {
|
75
|
+
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
|
+
hasWarned.current = true;
|
77
|
+
}
|
78
|
+
}, [props.placeholder]);
|
75
79
|
|
76
80
|
let result = useTextField({
|
77
81
|
...props,
|
package/src/TextField.tsx
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
* governing permissions and limitations under the License.
|
11
11
|
*/
|
12
12
|
|
13
|
-
import React, {forwardRef, Ref, useRef} from 'react';
|
13
|
+
import React, {forwardRef, Ref, useEffect, useRef} from 'react';
|
14
14
|
import {SpectrumTextFieldProps, TextFieldRef} from '@react-types/textfield';
|
15
15
|
import {TextFieldBase} from './TextFieldBase';
|
16
16
|
import {useFormProps} from '@react-spectrum/form';
|
@@ -29,9 +29,13 @@ export const TextField = forwardRef(function TextField(props: SpectrumTextFieldP
|
|
29
29
|
let inputRef = useRef<HTMLInputElement>(null);
|
30
30
|
let result = useTextField(props, inputRef);
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
let hasWarned = useRef(false);
|
33
|
+
useEffect(() => {
|
34
|
+
if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {
|
35
|
+
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');
|
36
|
+
hasWarned.current = true;
|
37
|
+
}
|
38
|
+
}, [props.placeholder]);
|
35
39
|
|
36
40
|
return (
|
37
41
|
<TextFieldBase
|