@react-spectrum/color 3.1.0 → 3.1.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/ColorField.main.js +9 -1
- package/dist/ColorField.main.js.map +1 -1
- package/dist/ColorField.mjs +10 -2
- package/dist/ColorField.module.js +10 -2
- package/dist/ColorField.module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +20 -20
- package/src/ColorField.tsx +9 -4
package/dist/ColorField.main.js
CHANGED
@@ -44,7 +44,15 @@ const $8bdb9bc27ff3debb$export$b865d4358897bb17 = /*#__PURE__*/ (0, ($parcel$int
|
|
44
44
|
props = (0, $4ivT8$reactspectrumprovider.useProviderProps)(props);
|
45
45
|
props = (0, $4ivT8$reactspectrumform.useFormProps)(props);
|
46
46
|
[props] = (0, $4ivT8$reactariacomponents.useContextProps)(props, null, (0, $4ivT8$reactariacomponents.ColorFieldContext));
|
47
|
-
|
47
|
+
let hasWarned = (0, $4ivT8$react.useRef)(false);
|
48
|
+
(0, $4ivT8$react.useEffect)(()=>{
|
49
|
+
if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {
|
50
|
+
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/ColorField.html#help-text');
|
51
|
+
hasWarned.current = true;
|
52
|
+
}
|
53
|
+
}, [
|
54
|
+
props.placeholder
|
55
|
+
]);
|
48
56
|
if (props.channel) return /*#__PURE__*/ (0, ($parcel$interopDefault($4ivT8$react))).createElement($8bdb9bc27ff3debb$var$ColorChannelField, {
|
49
57
|
...props,
|
50
58
|
channel: props.channel,
|
@@ -1 +1 @@
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAkBM,MAAM,0DAAa,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC,SAAS,WAAW,KAA8B,EAAE,GAAsB;IACnH,QA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AA,GAAA,0CAAmB,EAAE,YAAY,OAAO;IAErD,qBACE,oIACE,0DAAC,CAAA,GAAA,2CAAY;QACV,GAAG,UAAU;QACd,KAAK;QACL,UAAU;QACT,GAAG,MAAM;QACV,gBAAgB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;QACpC,MAAM,IAAI,kBAAI,0DAAC;QAAM,MAAK;QAAS,MAAM,MAAM,IAAI;QAAE,MAAM,MAAM,IAAI;QAAE,OAAO,MAAM,MAAM,WAAW,IAAI,KAAK,MAAM,WAAW;;AAGtI;AAMA,SAAS,oCAAc,KAAyB;IAC9C,IAAI,SACF,qDAAqD;IACrD,KAAK,gBACL,YAAY,YACZ,QAAQ,gBACR,YAAY,EACZ,GAAG,YACJ,GAAG;IACJ,IAAI,QAAQ,CAAA,GAAA,2CAAiB,EAAE;IAC/B,IAAI,WAAW,CAAA,GAAA,mBAAK,EAA0C;IAC9D,IAAI,SAAS,CAAA,GAAA,mCAAY,EAAE,YAAY,OAAO;IAE9C,qBACE,0DAAC,CAAA,GAAA,2CAAY;QACV,GAAG,UAAU;QACd,KAAK;QACL,UAAU;QACT,GAAG,MAAM;QACV,gBAAgB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;;AAEzC","sources":["packages/@react-spectrum/color/src/ColorField.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 {classNames} from '@react-spectrum/utils';\nimport {ColorChannel, SpectrumColorFieldProps} from '@react-types/color';\nimport {ColorFieldContext, useContextProps} from 'react-aria-components';\nimport React, {Ref, useEffect, useRef} from 'react';\nimport styles from './colorfield.css';\nimport {TextFieldBase} from '@react-spectrum/textfield';\nimport {TextFieldRef} from '@react-types/textfield';\nimport {useColorChannelField, useColorField} from '@react-aria/color';\nimport {useColorChannelFieldState, useColorFieldState} from '@react-stately/color';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useLocale} from '@react-aria/i18n';\nimport {useProviderProps} from '@react-spectrum/provider';\n\n/**\n * A color field allows users to edit a hex color or individual color channel value.\n */\nexport const ColorField = React.forwardRef(function ColorField(props: SpectrumColorFieldProps, ref: Ref<TextFieldRef>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n [props] = useContextProps(props, null, ColorFieldContext);\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/ColorField.html#help-text');\n hasWarned.current = true;\n }\n }, [props.placeholder]);\n\n if (props.channel) {\n return <ColorChannelField {...props} channel={props.channel} forwardedRef={ref} />;\n } else {\n return <HexColorField {...props} forwardedRef={ref} />;\n }\n});\n\ninterface ColorChannelFieldProps extends Omit<SpectrumColorFieldProps, 'channel'> {\n channel: ColorChannel,\n forwardedRef: Ref<TextFieldRef>\n}\n\nfunction ColorChannelField(props: ColorChannelFieldProps) {\n let {\n // These disabled props are handled by the state hook\n value, // eslint-disable-line @typescript-eslint/no-unused-vars\n defaultValue, // eslint-disable-line @typescript-eslint/no-unused-vars\n onChange, // eslint-disable-line @typescript-eslint/no-unused-vars\n validate, // eslint-disable-line @typescript-eslint/no-unused-vars\n forwardedRef,\n ...otherProps\n } = props;\n let {locale} = useLocale();\n let state = useColorChannelFieldState({\n ...props,\n locale\n });\n\n let inputRef = useRef<HTMLInputElement & HTMLTextAreaElement>(null);\n let result = useColorChannelField(otherProps, state, inputRef);\n\n return (\n <>\n <TextFieldBase\n {...otherProps}\n ref={forwardedRef}\n inputRef={inputRef}\n {...result}\n inputClassName={classNames(styles, 'react-spectrum-ColorField-input')} />\n {props.name && <input type=\"hidden\" name={props.name} form={props.form} value={isNaN(state.numberValue) ? '' : state.numberValue} />}\n </>\n );\n}\n\ninterface HexColorFieldProps extends SpectrumColorFieldProps {\n forwardedRef: Ref<TextFieldRef>\n}\n\nfunction HexColorField(props: HexColorFieldProps) {\n let {\n // These disabled props are handled by the state hook\n value, // eslint-disable-line @typescript-eslint/no-unused-vars\n defaultValue, // eslint-disable-line @typescript-eslint/no-unused-vars\n onChange, // eslint-disable-line @typescript-eslint/no-unused-vars\n forwardedRef,\n ...otherProps\n } = props;\n let state = useColorFieldState(props);\n let inputRef = useRef<HTMLInputElement & HTMLTextAreaElement>(null);\n let result = useColorField(otherProps, state, inputRef);\n\n return (\n <TextFieldBase\n {...otherProps}\n ref={forwardedRef}\n inputRef={inputRef}\n {...result}\n inputClassName={classNames(styles, 'react-spectrum-ColorField-input')} />\n );\n}\n"],"names":[],"version":3,"file":"ColorField.main.js.map"}
|
package/dist/ColorField.mjs
CHANGED
@@ -2,7 +2,7 @@ import "./color.85d29c28.css";
|
|
2
2
|
import $b4uus$colorfield_cssmodulejs from "./colorfield_css.mjs";
|
3
3
|
import {classNames as $b4uus$classNames} from "@react-spectrum/utils";
|
4
4
|
import {useContextProps as $b4uus$useContextProps, ColorFieldContext as $b4uus$ColorFieldContext} from "react-aria-components";
|
5
|
-
import $b4uus$react, {useRef as $b4uus$useRef} from "react";
|
5
|
+
import $b4uus$react, {useRef as $b4uus$useRef, useEffect as $b4uus$useEffect} from "react";
|
6
6
|
import {TextFieldBase as $b4uus$TextFieldBase} from "@react-spectrum/textfield";
|
7
7
|
import {useColorChannelField as $b4uus$useColorChannelField, useColorField as $b4uus$useColorField} from "@react-aria/color";
|
8
8
|
import {useColorChannelFieldState as $b4uus$useColorChannelFieldState, useColorFieldState as $b4uus$useColorFieldState} from "@react-stately/color";
|
@@ -38,7 +38,15 @@ const $0077d47e004328f0$export$b865d4358897bb17 = /*#__PURE__*/ (0, $b4uus$react
|
|
38
38
|
props = (0, $b4uus$useProviderProps)(props);
|
39
39
|
props = (0, $b4uus$useFormProps)(props);
|
40
40
|
[props] = (0, $b4uus$useContextProps)(props, null, (0, $b4uus$ColorFieldContext));
|
41
|
-
|
41
|
+
let hasWarned = (0, $b4uus$useRef)(false);
|
42
|
+
(0, $b4uus$useEffect)(()=>{
|
43
|
+
if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {
|
44
|
+
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/ColorField.html#help-text');
|
45
|
+
hasWarned.current = true;
|
46
|
+
}
|
47
|
+
}, [
|
48
|
+
props.placeholder
|
49
|
+
]);
|
42
50
|
if (props.channel) return /*#__PURE__*/ (0, $b4uus$react).createElement($0077d47e004328f0$var$ColorChannelField, {
|
43
51
|
...props,
|
44
52
|
channel: props.channel,
|
@@ -2,7 +2,7 @@ import "./color.85d29c28.css";
|
|
2
2
|
import $b4uus$colorfield_cssmodulejs from "./colorfield_css.module.js";
|
3
3
|
import {classNames as $b4uus$classNames} from "@react-spectrum/utils";
|
4
4
|
import {useContextProps as $b4uus$useContextProps, ColorFieldContext as $b4uus$ColorFieldContext} from "react-aria-components";
|
5
|
-
import $b4uus$react, {useRef as $b4uus$useRef} from "react";
|
5
|
+
import $b4uus$react, {useRef as $b4uus$useRef, useEffect as $b4uus$useEffect} from "react";
|
6
6
|
import {TextFieldBase as $b4uus$TextFieldBase} from "@react-spectrum/textfield";
|
7
7
|
import {useColorChannelField as $b4uus$useColorChannelField, useColorField as $b4uus$useColorField} from "@react-aria/color";
|
8
8
|
import {useColorChannelFieldState as $b4uus$useColorChannelFieldState, useColorFieldState as $b4uus$useColorFieldState} from "@react-stately/color";
|
@@ -38,7 +38,15 @@ const $0077d47e004328f0$export$b865d4358897bb17 = /*#__PURE__*/ (0, $b4uus$react
|
|
38
38
|
props = (0, $b4uus$useProviderProps)(props);
|
39
39
|
props = (0, $b4uus$useFormProps)(props);
|
40
40
|
[props] = (0, $b4uus$useContextProps)(props, null, (0, $b4uus$ColorFieldContext));
|
41
|
-
|
41
|
+
let hasWarned = (0, $b4uus$useRef)(false);
|
42
|
+
(0, $b4uus$useEffect)(()=>{
|
43
|
+
if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {
|
44
|
+
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/ColorField.html#help-text');
|
45
|
+
hasWarned.current = true;
|
46
|
+
}
|
47
|
+
}, [
|
48
|
+
props.placeholder
|
49
|
+
]);
|
42
50
|
if (props.channel) return /*#__PURE__*/ (0, $b4uus$react).createElement($0077d47e004328f0$var$ColorChannelField, {
|
43
51
|
...props,
|
44
52
|
channel: props.channel,
|
@@ -1 +1 @@
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAkBM,MAAM,0DAAa,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,SAAS,WAAW,KAA8B,EAAE,GAAsB;IACnH,QAAQ,CAAA,GAAA,uBAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,mBAAW,EAAE;IACrB,CAAC,MAAM,GAAG,CAAA,GAAA,sBAAc,EAAE,OAAO,MAAM,CAAA,GAAA,wBAAgB;
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAkBM,MAAM,0DAAa,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,SAAS,WAAW,KAA8B,EAAE,GAAsB;IACnH,QAAQ,CAAA,GAAA,uBAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,mBAAW,EAAE;IACrB,CAAC,MAAM,GAAG,CAAA,GAAA,sBAAc,EAAE,OAAO,MAAM,CAAA,GAAA,wBAAgB;IAEvD,IAAI,YAAY,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,CAAA,GAAA,yBAAiB,EAAE;IAC/B,IAAI,WAAW,CAAA,GAAA,aAAK,EAA0C;IAC9D,IAAI,SAAS,CAAA,GAAA,oBAAY,EAAE,YAAY,OAAO;IAE9C,qBACE,gCAAC,CAAA,GAAA,oBAAY;QACV,GAAG,UAAU;QACd,KAAK;QACL,UAAU;QACT,GAAG,MAAM;QACV,gBAAgB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,uDAAK,GAAG;;AAEzC","sources":["packages/@react-spectrum/color/src/ColorField.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 {classNames} from '@react-spectrum/utils';\nimport {ColorChannel, SpectrumColorFieldProps} from '@react-types/color';\nimport {ColorFieldContext, useContextProps} from 'react-aria-components';\nimport React, {Ref, useEffect, useRef} from 'react';\nimport styles from './colorfield.css';\nimport {TextFieldBase} from '@react-spectrum/textfield';\nimport {TextFieldRef} from '@react-types/textfield';\nimport {useColorChannelField, useColorField} from '@react-aria/color';\nimport {useColorChannelFieldState, useColorFieldState} from '@react-stately/color';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useLocale} from '@react-aria/i18n';\nimport {useProviderProps} from '@react-spectrum/provider';\n\n/**\n * A color field allows users to edit a hex color or individual color channel value.\n */\nexport const ColorField = React.forwardRef(function ColorField(props: SpectrumColorFieldProps, ref: Ref<TextFieldRef>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n [props] = useContextProps(props, null, ColorFieldContext);\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/ColorField.html#help-text');\n hasWarned.current = true;\n }\n }, [props.placeholder]);\n\n if (props.channel) {\n return <ColorChannelField {...props} channel={props.channel} forwardedRef={ref} />;\n } else {\n return <HexColorField {...props} forwardedRef={ref} />;\n }\n});\n\ninterface ColorChannelFieldProps extends Omit<SpectrumColorFieldProps, 'channel'> {\n channel: ColorChannel,\n forwardedRef: Ref<TextFieldRef>\n}\n\nfunction ColorChannelField(props: ColorChannelFieldProps) {\n let {\n // These disabled props are handled by the state hook\n value, // eslint-disable-line @typescript-eslint/no-unused-vars\n defaultValue, // eslint-disable-line @typescript-eslint/no-unused-vars\n onChange, // eslint-disable-line @typescript-eslint/no-unused-vars\n validate, // eslint-disable-line @typescript-eslint/no-unused-vars\n forwardedRef,\n ...otherProps\n } = props;\n let {locale} = useLocale();\n let state = useColorChannelFieldState({\n ...props,\n locale\n });\n\n let inputRef = useRef<HTMLInputElement & HTMLTextAreaElement>(null);\n let result = useColorChannelField(otherProps, state, inputRef);\n\n return (\n <>\n <TextFieldBase\n {...otherProps}\n ref={forwardedRef}\n inputRef={inputRef}\n {...result}\n inputClassName={classNames(styles, 'react-spectrum-ColorField-input')} />\n {props.name && <input type=\"hidden\" name={props.name} form={props.form} value={isNaN(state.numberValue) ? '' : state.numberValue} />}\n </>\n );\n}\n\ninterface HexColorFieldProps extends SpectrumColorFieldProps {\n forwardedRef: Ref<TextFieldRef>\n}\n\nfunction HexColorField(props: HexColorFieldProps) {\n let {\n // These disabled props are handled by the state hook\n value, // eslint-disable-line @typescript-eslint/no-unused-vars\n defaultValue, // eslint-disable-line @typescript-eslint/no-unused-vars\n onChange, // eslint-disable-line @typescript-eslint/no-unused-vars\n forwardedRef,\n ...otherProps\n } = props;\n let state = useColorFieldState(props);\n let inputRef = useRef<HTMLInputElement & HTMLTextAreaElement>(null);\n let result = useColorField(otherProps, state, inputRef);\n\n return (\n <TextFieldBase\n {...otherProps}\n ref={forwardedRef}\n inputRef={inputRef}\n {...result}\n inputClassName={classNames(styles, 'react-spectrum-ColorField-input')} />\n );\n}\n"],"names":[],"version":3,"file":"ColorField.module.js.map"}
|
package/dist/types.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"mappings":";;;;;;ACyBA;;GAEG;AACH,OAAO,MAAM,WA0DP,CAAC,KAAK,EAAE,sBAAsB,GAAG;IAAC,GAAG,CAAC,EAAE,aAAa,cAAc,CAAC,CAAA;CAAC,KAAK,YAAY,CAAC;AC3D7F;;GAEG;AACH,OAAO,MAAM,6IA+EX,CAAC;ACnFH;;GAEG;AACH,OAAO,MAAM,+IAgHX,CAAC;ACpHH;;GAEG;AACH,OAAO,MAAM,
|
1
|
+
{"mappings":";;;;;;ACyBA;;GAEG;AACH,OAAO,MAAM,WA0DP,CAAC,KAAK,EAAE,sBAAsB,GAAG;IAAC,GAAG,CAAC,EAAE,aAAa,cAAc,CAAC,CAAA;CAAC,KAAK,YAAY,CAAC;AC3D7F;;GAEG;AACH,OAAO,MAAM,6IA+EX,CAAC;ACnFH;;GAEG;AACH,OAAO,MAAM,+IAgHX,CAAC;ACpHH;;GAEG;AACH,OAAO,MAAM,0HAkBX,CAAC;AC1BH,yCAA0C,SAAQ,oBAAoB,EAAE,UAAU;IAChF;;;OAGG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,MAAM,CAAA;CACvC;AAQD;;GAEG;AACH,OAAO,MAAM,yHAwDX,CAAC;AC5EH,yCAA0C,SAAQ,UAAU,MAAM,GAAG,KAAK,EAAE,KAAK,CAAC,EAAE,iBAAiB;IACnG,2CAA2C;IAC3C,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;OAGG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,MAAM,CAAA;CACvC;AAED;;GAEG;AACH,OAAO,MAAM,qJA6EX,CAAC;ACzGH;IACE,sEAAsE;IACtE,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B;AAED;;GAEG;AACH,OAAO,MAAM,yHAqCX,CAAC;ACvCH,+CAAgD,SAAQ,UAAU,MAAM,GAAG,OAAK,EAAE,OAAK,CAAC,EAAE,UAAU;IAClG,sDAAsD;IACtD,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;IAC7C;;;OAGG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAA;CACvC;AAED;;GAEG;AACH,OAAO,MAAM,qIA+BX,CAAC;ACrDH,OAAO,EAAC,UAAU,EAAE,gBAAgB,EAAC,MAAM,sBAAsB,CAAC;AAClE,YAAY,EAAC,sBAAsB,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,uBAAuB,EAAC,MAAM,oBAAoB,CAAC;AAK3I,YAAY,EAAC,KAAK,EAAE,UAAU,EAAE,WAAW,EAAC,MAAM,oBAAoB,CAAC","sources":["packages/@react-spectrum/color/src/packages/@react-spectrum/color/src/ColorThumb.tsx","packages/@react-spectrum/color/src/packages/@react-spectrum/color/src/ColorArea.tsx","packages/@react-spectrum/color/src/packages/@react-spectrum/color/src/ColorWheel.tsx","packages/@react-spectrum/color/src/packages/@react-spectrum/color/src/ColorSlider.tsx","packages/@react-spectrum/color/src/packages/@react-spectrum/color/src/ColorField.tsx","packages/@react-spectrum/color/src/packages/@react-spectrum/color/src/ColorSwatch.tsx","packages/@react-spectrum/color/src/packages/@react-spectrum/color/src/ColorPicker.tsx","packages/@react-spectrum/color/src/packages/@react-spectrum/color/src/ColorEditor.tsx","packages/@react-spectrum/color/src/packages/@react-spectrum/color/src/ColorSwatchPicker.tsx","packages/@react-spectrum/color/src/packages/@react-spectrum/color/src/index.ts","packages/@react-spectrum/color/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,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\" />\nexport {ColorArea} from './ColorArea';\nexport {ColorWheel} from './ColorWheel';\nexport {ColorSlider} from './ColorSlider';\nexport {ColorField} from './ColorField';\nexport {ColorSwatch} from './ColorSwatch';\nexport {ColorPicker} from './ColorPicker';\nexport {ColorEditor} from './ColorEditor';\nexport {ColorSwatchPicker} from './ColorSwatchPicker';\nexport {parseColor, getColorChannels} from '@react-stately/color';\nexport type {SpectrumColorAreaProps, SpectrumColorFieldProps, SpectrumColorSliderProps, SpectrumColorWheelProps} from '@react-types/color';\nexport type {SpectrumColorSwatchProps} from './ColorSwatch';\nexport type {SpectrumColorPickerProps} from './ColorPicker';\nexport type {SpectrumColorEditorProps} from './ColorEditor';\nexport type {SpectrumColorSwatchPickerProps} from './ColorSwatchPicker';\nexport type {Color, ColorSpace, ColorFormat} from '@react-types/color';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@react-spectrum/color",
|
3
|
-
"version": "3.1.
|
3
|
+
"version": "3.1.1",
|
4
4
|
"description": "Spectrum UI components in React",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"main": "dist/main.js",
|
@@ -40,25 +40,25 @@
|
|
40
40
|
"url": "https://github.com/adobe/react-spectrum"
|
41
41
|
},
|
42
42
|
"dependencies": {
|
43
|
-
"@react-aria/color": "^3.1.
|
44
|
-
"@react-aria/focus": "^3.21.
|
45
|
-
"@react-aria/i18n": "^3.12.
|
46
|
-
"@react-aria/interactions": "^3.25.
|
47
|
-
"@react-aria/utils": "^3.30.
|
48
|
-
"@react-spectrum/dialog": "^3.9.
|
49
|
-
"@react-spectrum/form": "^3.7.
|
50
|
-
"@react-spectrum/label": "^3.16.
|
51
|
-
"@react-spectrum/overlays": "^5.8.
|
52
|
-
"@react-spectrum/picker": "^3.16.
|
53
|
-
"@react-spectrum/textfield": "^3.14.
|
54
|
-
"@react-spectrum/utils": "^3.12.
|
55
|
-
"@react-spectrum/view": "^3.6.
|
56
|
-
"@react-stately/color": "^3.9.
|
57
|
-
"@react-types/color": "^3.1.
|
58
|
-
"@react-types/shared": "^3.
|
59
|
-
"@react-types/textfield": "^3.12.
|
43
|
+
"@react-aria/color": "^3.1.1",
|
44
|
+
"@react-aria/focus": "^3.21.1",
|
45
|
+
"@react-aria/i18n": "^3.12.12",
|
46
|
+
"@react-aria/interactions": "^3.25.5",
|
47
|
+
"@react-aria/utils": "^3.30.1",
|
48
|
+
"@react-spectrum/dialog": "^3.9.1",
|
49
|
+
"@react-spectrum/form": "^3.7.18",
|
50
|
+
"@react-spectrum/label": "^3.16.18",
|
51
|
+
"@react-spectrum/overlays": "^5.8.1",
|
52
|
+
"@react-spectrum/picker": "^3.16.1",
|
53
|
+
"@react-spectrum/textfield": "^3.14.1",
|
54
|
+
"@react-spectrum/utils": "^3.12.8",
|
55
|
+
"@react-spectrum/view": "^3.6.22",
|
56
|
+
"@react-stately/color": "^3.9.1",
|
57
|
+
"@react-types/color": "^3.1.1",
|
58
|
+
"@react-types/shared": "^3.32.0",
|
59
|
+
"@react-types/textfield": "^3.12.5",
|
60
60
|
"@swc/helpers": "^0.5.0",
|
61
|
-
"react-aria-components": "^1.
|
61
|
+
"react-aria-components": "^1.12.0"
|
62
62
|
},
|
63
63
|
"devDependencies": {
|
64
64
|
"@adobe/spectrum-css-temp": "3.0.0-alpha.1",
|
@@ -72,5 +72,5 @@
|
|
72
72
|
"publishConfig": {
|
73
73
|
"access": "public"
|
74
74
|
},
|
75
|
-
"gitHead": "
|
75
|
+
"gitHead": "2c58ed3ddd9be9100af9b1d0cfd137fcdc95ba2d"
|
76
76
|
}
|
package/src/ColorField.tsx
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
import {classNames} from '@react-spectrum/utils';
|
14
14
|
import {ColorChannel, SpectrumColorFieldProps} from '@react-types/color';
|
15
15
|
import {ColorFieldContext, useContextProps} from 'react-aria-components';
|
16
|
-
import React, {Ref, useRef} from 'react';
|
16
|
+
import React, {Ref, useEffect, useRef} from 'react';
|
17
17
|
import styles from './colorfield.css';
|
18
18
|
import {TextFieldBase} from '@react-spectrum/textfield';
|
19
19
|
import {TextFieldRef} from '@react-types/textfield';
|
@@ -30,9 +30,14 @@ export const ColorField = React.forwardRef(function ColorField(props: SpectrumCo
|
|
30
30
|
props = useProviderProps(props);
|
31
31
|
props = useFormProps(props);
|
32
32
|
[props] = useContextProps(props, null, ColorFieldContext);
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
|
34
|
+
let hasWarned = useRef(false);
|
35
|
+
useEffect(() => {
|
36
|
+
if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {
|
37
|
+
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/ColorField.html#help-text');
|
38
|
+
hasWarned.current = true;
|
39
|
+
}
|
40
|
+
}, [props.placeholder]);
|
36
41
|
|
37
42
|
if (props.channel) {
|
38
43
|
return <ColorChannelField {...props} channel={props.channel} forwardedRef={ref} />;
|