@react-spectrum/color 3.0.0-nightly.4567 → 3.0.0-nightly.4578
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/ColorArea.main.js +11 -10
- package/dist/ColorArea.main.js.map +1 -1
- package/dist/ColorArea.mjs +12 -11
- package/dist/ColorArea.module.js +12 -11
- package/dist/ColorArea.module.js.map +1 -1
- package/dist/ColorEditor.32e497e8.css +20 -0
- package/dist/ColorEditor.32e497e8.css.map +1 -0
- package/dist/ColorEditor.main.js +116 -0
- package/dist/ColorEditor.main.js.map +1 -0
- package/dist/ColorEditor.mjs +111 -0
- package/dist/ColorEditor.module.js +111 -0
- package/dist/ColorEditor.module.js.map +1 -0
- package/dist/ColorField.main.js +44 -6
- package/dist/ColorField.main.js.map +1 -1
- package/dist/ColorField.mjs +46 -8
- package/dist/ColorField.module.js +46 -8
- package/dist/ColorField.module.js.map +1 -1
- package/dist/ColorPicker.ab9f47c0.css +204 -0
- package/dist/ColorPicker.ab9f47c0.css.map +1 -0
- package/dist/ColorPicker.main.js +125 -0
- package/dist/ColorPicker.main.js.map +1 -0
- package/dist/ColorPicker.mjs +116 -0
- package/dist/ColorPicker.module.js +116 -0
- package/dist/ColorPicker.module.js.map +1 -0
- package/dist/ColorSlider.main.js +8 -4
- package/dist/ColorSlider.main.js.map +1 -1
- package/dist/ColorSlider.mjs +9 -5
- package/dist/ColorSlider.module.js +9 -5
- package/dist/ColorSlider.module.js.map +1 -1
- package/dist/ColorSwatch.f6e6f811.css +260 -0
- package/dist/ColorSwatch.f6e6f811.css.map +1 -0
- package/dist/ColorSwatch.main.js +94 -0
- package/dist/ColorSwatch.main.js.map +1 -0
- package/dist/ColorSwatch.mjs +84 -0
- package/dist/ColorSwatch.module.js +84 -0
- package/dist/ColorSwatch.module.js.map +1 -0
- package/dist/ColorSwatchPicker.1575be06.css +356 -0
- package/dist/ColorSwatchPicker.1575be06.css.map +1 -0
- package/dist/ColorSwatchPicker.main.js +115 -0
- package/dist/ColorSwatchPicker.main.js.map +1 -0
- package/dist/ColorSwatchPicker.mjs +106 -0
- package/dist/ColorSwatchPicker.module.js +106 -0
- package/dist/ColorSwatchPicker.module.js.map +1 -0
- package/dist/ColorThumb.main.js +57 -7
- package/dist/ColorThumb.main.js.map +1 -1
- package/dist/ColorThumb.mjs +59 -9
- package/dist/ColorThumb.module.js +59 -9
- package/dist/ColorThumb.module.js.map +1 -1
- package/dist/ColorWheel.main.js +6 -2
- package/dist/ColorWheel.main.js.map +1 -1
- package/dist/ColorWheel.mjs +7 -3
- package/dist/ColorWheel.module.js +7 -3
- package/dist/ColorWheel.module.js.map +1 -1
- package/dist/colorarea_vars_css.main.js +0 -3
- package/dist/colorarea_vars_css.main.js.map +1 -1
- package/dist/colorarea_vars_css.mjs +0 -3
- package/dist/colorarea_vars_css.module.js +0 -3
- package/dist/colorarea_vars_css.module.js.map +1 -1
- package/dist/en-US.main.js +10 -0
- package/dist/en-US.main.js.map +1 -0
- package/dist/en-US.mjs +12 -0
- package/dist/en-US.module.js +12 -0
- package/dist/en-US.module.js.map +1 -0
- package/dist/import.mjs +11 -1
- package/dist/intlStrings.main.js +9 -0
- package/dist/intlStrings.main.js.map +1 -0
- package/dist/intlStrings.mjs +11 -0
- package/dist/intlStrings.module.js +11 -0
- package/dist/intlStrings.module.js.map +1 -0
- package/dist/main.js +16 -0
- package/dist/main.js.map +1 -1
- package/dist/module.js +11 -1
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +75 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/{vars.08ba4b4c.css → vars.53b417c1.css} +2 -3
- package/dist/vars.53b417c1.css.map +1 -0
- package/dist/{vars.6f3d3943.css → vars.6fa9fa04.css} +6 -18
- package/dist/vars.6fa9fa04.css.map +1 -0
- package/dist/{vars.571f903e.css → vars.aa07b6d2.css} +2 -2
- package/dist/{vars.571f903e.css.map → vars.aa07b6d2.css.map} +1 -1
- package/dist/{vars.ef2c01b8.css → vars.cc682729.css} +4 -4
- package/dist/{vars.ef2c01b8.css.map → vars.cc682729.css.map} +1 -1
- package/package.json +23 -17
- package/src/ColorArea.tsx +7 -6
- package/src/ColorEditor.tsx +63 -0
- package/src/ColorField.tsx +67 -14
- package/src/ColorPicker.tsx +122 -0
- package/src/ColorSlider.tsx +6 -4
- package/src/ColorSwatch.tsx +102 -0
- package/src/ColorSwatchPicker.tsx +118 -0
- package/src/ColorThumb.tsx +72 -25
- package/src/ColorWheel.tsx +5 -2
- package/src/index.ts +10 -0
- package/dist/vars.08ba4b4c.css.map +0 -1
- package/dist/vars.6f3d3943.css.map +0 -1
package/dist/ColorArea.main.js
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
var $2b9adc23f6c7cae1$exports = require("./ColorThumb.main.js");
|
2
|
-
require("./vars.
|
2
|
+
require("./vars.6fa9fa04.css");
|
3
3
|
var $d4b4e0a63f9ca8c1$exports = require("./colorarea_vars_css.main.js");
|
4
4
|
var $6Gwd1$reactspectrumutils = require("@react-spectrum/utils");
|
5
|
+
var $6Gwd1$reactariacomponents = require("react-aria-components");
|
5
6
|
var $6Gwd1$reactariautils = require("@react-aria/utils");
|
6
7
|
var $6Gwd1$react = require("react");
|
7
8
|
var $6Gwd1$reactariacolor = require("@react-aria/color");
|
@@ -38,16 +39,18 @@ $parcel$export(module.exports, "ColorArea", () => $5f016e950c2dc3a6$export$b2103
|
|
38
39
|
|
39
40
|
|
40
41
|
|
42
|
+
|
41
43
|
function $5f016e950c2dc3a6$var$ColorArea(props, ref) {
|
42
44
|
props = (0, $6Gwd1$reactspectrumprovider.useProviderProps)(props);
|
43
|
-
let { isDisabled: isDisabled } = props;
|
44
|
-
let size = props.size && (0, $6Gwd1$reactspectrumutils.dimensionValue)(props.size);
|
45
|
-
let { styleProps: styleProps } = (0, $6Gwd1$reactspectrumutils.useStyleProps)(props);
|
46
45
|
let inputXRef = (0, $6Gwd1$react.useRef)(null);
|
47
46
|
let inputYRef = (0, $6Gwd1$react.useRef)(null);
|
48
47
|
let containerRef = (0, $6Gwd1$reactspectrumutils.useFocusableRef)(ref, inputXRef);
|
48
|
+
[props, containerRef] = (0, $6Gwd1$reactariacomponents.useContextProps)(props, containerRef, (0, $6Gwd1$reactariacomponents.ColorAreaContext));
|
49
|
+
let { isDisabled: isDisabled } = props;
|
50
|
+
let size = props.size && (0, $6Gwd1$reactspectrumutils.dimensionValue)(props.size);
|
51
|
+
let { styleProps: styleProps } = (0, $6Gwd1$reactspectrumutils.useStyleProps)(props);
|
49
52
|
let state = (0, $6Gwd1$reactstatelycolor.useColorAreaState)(props);
|
50
|
-
let { colorAreaProps: colorAreaProps,
|
53
|
+
let { colorAreaProps: colorAreaProps, xInputProps: xInputProps, yInputProps: yInputProps, thumbProps: thumbProps } = (0, $6Gwd1$reactariacolor.useColorArea)({
|
51
54
|
...props,
|
52
55
|
inputXRef: inputXRef,
|
53
56
|
inputYRef: inputYRef,
|
@@ -61,20 +64,18 @@ function $5f016e950c2dc3a6$var$ColorArea(props, ref) {
|
|
61
64
|
}, styleProps.className),
|
62
65
|
ref: containerRef,
|
63
66
|
style: {
|
64
|
-
...colorAreaProps.style,
|
67
|
+
...isDisabled ? {} : colorAreaProps.style,
|
65
68
|
...styleProps.style,
|
66
69
|
// Workaround around https://github.com/adobe/spectrum-css/issues/1032
|
67
70
|
width: size,
|
68
71
|
height: size
|
69
72
|
}
|
70
|
-
}, /*#__PURE__*/ (0, ($parcel$interopDefault($6Gwd1$react))).createElement(
|
71
|
-
...gradientProps,
|
72
|
-
className: (0, $6Gwd1$reactspectrumutils.classNames)((0, ($parcel$interopDefault($d4b4e0a63f9ca8c1$exports))), "spectrum-ColorArea-gradient")
|
73
|
-
}), /*#__PURE__*/ (0, ($parcel$interopDefault($6Gwd1$react))).createElement((0, $2b9adc23f6c7cae1$exports.ColorThumb), {
|
73
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($6Gwd1$react))).createElement((0, $2b9adc23f6c7cae1$exports.ColorThumb), {
|
74
74
|
value: state.getDisplayColor(),
|
75
75
|
isFocused: isFocusVisible,
|
76
76
|
isDisabled: isDisabled,
|
77
77
|
isDragging: state.isDragging,
|
78
|
+
containerRef: containerRef,
|
78
79
|
className: (0, $6Gwd1$reactspectrumutils.classNames)((0, ($parcel$interopDefault($d4b4e0a63f9ca8c1$exports))), "spectrum-ColorArea-handle"),
|
79
80
|
...thumbProps
|
80
81
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($6Gwd1$react))).createElement("div", {
|
@@ -1 +1 @@
|
|
1
|
-
{"mappings":"
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAeD,SAAS,gCAAU,KAA6B,EAAE,GAAiC;IACjF,QAAQ,CAAA,GAAA,6CAAe,EAAE;IACzB,IAAI,YAAY,CAAA,GAAA,mBAAK,EAAE;IACvB,IAAI,YAAY,CAAA,GAAA,mBAAK,EAAE;IACvB,IAAI,eAAe,CAAA,GAAA,yCAAc,EAAE,KAAK;IACxC,CAAC,OAAO,aAAa,GAAG,CAAA,GAAA,0CAAc,EAAE,OAAO,cAAc,CAAA,GAAA,2CAAe;IAE5E,IAAI,cAAC,UAAU,EAAC,GAAG;IACnB,IAAI,OAAO,MAAM,IAAI,IAAI,CAAA,GAAA,wCAAa,EAAE,MAAM,IAAI;IAClD,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,uCAAY,EAAE;IAGjC,IAAI,QAAQ,CAAA,GAAA,0CAAgB,EAAE;IAE9B,IAAI,kBACF,cAAc,eACd,WAAW,eACX,WAAW,cACX,UAAU,EACX,GAAG,CAAA,GAAA,kCAAW,EAAE;QAAC,GAAG,KAAK;mBAAE;mBAAW;sBAAW;IAAY,GAAG;IACjE,IAAI,cAAC,UAAU,kBAAE,cAAc,EAAC,GAAG,CAAA,GAAA,kCAAW;IAE9C,qBACE,0DAAC;QACE,GAAG,cAAc;QAClB,WACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAK,GACL,sBACA;YACE,eAAe;QACjB,GACA,WAAW,SAAS;QAGxB,KAAK;QACL,OAAO;YACL,GAAI,aAAa,CAAC,IAAI,eAAe,KAAK;YAC1C,GAAG,WAAW,KAAK;YACnB,sEAAsE;YACtE,OAAO;YACP,QAAQ;QACV;qBACA,0DAAC,CAAA,GAAA,oCAAS;QACR,OAAO,MAAM,eAAe;QAC5B,WAAW;QACX,YAAY;QACZ,YAAY,MAAM,UAAU;QAC5B,cAAc;QACd,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;QAC7B,GAAG,UAAU;qBACd,0DAAC;QAAI,MAAK;qBACR,0DAAC;QAAM,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;QAA+B,GAAG,CAAA,GAAA,gCAAS,EAAE,aAAa,WAAW;QAAE,KAAK;sBACjH,0DAAC;QAAM,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;QAA+B,GAAG,CAAA,GAAA,gCAAS,EAAE,aAAa,WAAW;QAAE,KAAK;;AAK3H;AAEA;;CAEC,GACD,IAAI,0DAAa,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/color/src/ColorArea.tsx"],"sourcesContent":["/*\n * Copyright 2021 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, dimensionValue, useFocusableRef, useStyleProps} from '@react-spectrum/utils';\nimport {ColorAreaContext, useContextProps} from 'react-aria-components';\nimport {ColorThumb} from './ColorThumb';\nimport {FocusableRef} from '@react-types/shared';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {ReactElement, useRef} from 'react';\nimport {SpectrumColorAreaProps} from '@react-types/color';\nimport styles from '@adobe/spectrum-css-temp/components/colorarea/vars.css';\nimport {useColorArea} from '@react-aria/color';\nimport {useColorAreaState} from '@react-stately/color';\nimport {useFocusRing} from '@react-aria/focus';\nimport {useProviderProps} from '@react-spectrum/provider';\n\nfunction ColorArea(props: SpectrumColorAreaProps, ref: FocusableRef<HTMLDivElement>) {\n props = useProviderProps(props);\n let inputXRef = useRef(null);\n let inputYRef = useRef(null);\n let containerRef = useFocusableRef(ref, inputXRef);\n [props, containerRef] = useContextProps(props, containerRef, ColorAreaContext);\n\n let {isDisabled} = props;\n let size = props.size && dimensionValue(props.size);\n let {styleProps} = useStyleProps(props);\n\n\n let state = useColorAreaState(props);\n\n let {\n colorAreaProps,\n xInputProps,\n yInputProps,\n thumbProps\n } = useColorArea({...props, inputXRef, inputYRef, containerRef}, state);\n let {focusProps, isFocusVisible} = useFocusRing();\n\n return (\n <div\n {...colorAreaProps}\n className={\n classNames(\n styles,\n 'spectrum-ColorArea',\n {\n 'is-disabled': isDisabled\n },\n styleProps.className\n )\n }\n ref={containerRef}\n style={{\n ...(isDisabled ? {} : colorAreaProps.style),\n ...styleProps.style,\n // Workaround around https://github.com/adobe/spectrum-css/issues/1032\n width: size,\n height: size\n }}>\n <ColorThumb\n value={state.getDisplayColor()}\n isFocused={isFocusVisible}\n isDisabled={isDisabled}\n isDragging={state.isDragging}\n containerRef={containerRef}\n className={classNames(styles, 'spectrum-ColorArea-handle')}\n {...thumbProps}>\n <div role=\"presentation\">\n <input className={classNames(styles, 'spectrum-ColorArea-slider')} {...mergeProps(xInputProps, focusProps)} ref={inputXRef} />\n <input className={classNames(styles, 'spectrum-ColorArea-slider')} {...mergeProps(yInputProps, focusProps)} ref={inputYRef} />\n </div>\n </ColorThumb>\n </div>\n );\n}\n\n/**\n * ColorArea allows users to adjust two channels of an RGB, HSL or HSB color value against a two-dimensional gradient background.\n */\nlet _ColorArea = React.forwardRef(ColorArea) as (props: SpectrumColorAreaProps & {ref?: FocusableRef<HTMLDivElement>}) => ReactElement;\nexport {_ColorArea as ColorArea};\n"],"names":[],"version":3,"file":"ColorArea.main.js.map"}
|
package/dist/ColorArea.mjs
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
import {ColorThumb as $3a90e89d07d7bbd5$export$a3cc47cee1c1ccc} from "./ColorThumb.mjs";
|
2
|
-
import "./vars.
|
2
|
+
import "./vars.6fa9fa04.css";
|
3
3
|
import $4eSry$colorarea_vars_cssmodulejs from "./colorarea_vars_css.mjs";
|
4
|
-
import {
|
4
|
+
import {useFocusableRef as $4eSry$useFocusableRef, dimensionValue as $4eSry$dimensionValue, useStyleProps as $4eSry$useStyleProps, classNames as $4eSry$classNames} from "@react-spectrum/utils";
|
5
|
+
import {useContextProps as $4eSry$useContextProps, ColorAreaContext as $4eSry$ColorAreaContext} from "react-aria-components";
|
5
6
|
import {mergeProps as $4eSry$mergeProps} from "@react-aria/utils";
|
6
7
|
import $4eSry$react, {useRef as $4eSry$useRef} from "react";
|
7
8
|
import {useColorArea as $4eSry$useColorArea} from "@react-aria/color";
|
@@ -32,16 +33,18 @@ function $parcel$interopDefault(a) {
|
|
32
33
|
|
33
34
|
|
34
35
|
|
36
|
+
|
35
37
|
function $40046aa1a7ccb226$var$ColorArea(props, ref) {
|
36
38
|
props = (0, $4eSry$useProviderProps)(props);
|
37
|
-
let { isDisabled: isDisabled } = props;
|
38
|
-
let size = props.size && (0, $4eSry$dimensionValue)(props.size);
|
39
|
-
let { styleProps: styleProps } = (0, $4eSry$useStyleProps)(props);
|
40
39
|
let inputXRef = (0, $4eSry$useRef)(null);
|
41
40
|
let inputYRef = (0, $4eSry$useRef)(null);
|
42
41
|
let containerRef = (0, $4eSry$useFocusableRef)(ref, inputXRef);
|
42
|
+
[props, containerRef] = (0, $4eSry$useContextProps)(props, containerRef, (0, $4eSry$ColorAreaContext));
|
43
|
+
let { isDisabled: isDisabled } = props;
|
44
|
+
let size = props.size && (0, $4eSry$dimensionValue)(props.size);
|
45
|
+
let { styleProps: styleProps } = (0, $4eSry$useStyleProps)(props);
|
43
46
|
let state = (0, $4eSry$useColorAreaState)(props);
|
44
|
-
let { colorAreaProps: colorAreaProps,
|
47
|
+
let { colorAreaProps: colorAreaProps, xInputProps: xInputProps, yInputProps: yInputProps, thumbProps: thumbProps } = (0, $4eSry$useColorArea)({
|
45
48
|
...props,
|
46
49
|
inputXRef: inputXRef,
|
47
50
|
inputYRef: inputYRef,
|
@@ -55,20 +58,18 @@ function $40046aa1a7ccb226$var$ColorArea(props, ref) {
|
|
55
58
|
}, styleProps.className),
|
56
59
|
ref: containerRef,
|
57
60
|
style: {
|
58
|
-
...colorAreaProps.style,
|
61
|
+
...isDisabled ? {} : colorAreaProps.style,
|
59
62
|
...styleProps.style,
|
60
63
|
// Workaround around https://github.com/adobe/spectrum-css/issues/1032
|
61
64
|
width: size,
|
62
65
|
height: size
|
63
66
|
}
|
64
|
-
}, /*#__PURE__*/ (0, $4eSry$react).createElement(
|
65
|
-
...gradientProps,
|
66
|
-
className: (0, $4eSry$classNames)((0, ($parcel$interopDefault($4eSry$colorarea_vars_cssmodulejs))), "spectrum-ColorArea-gradient")
|
67
|
-
}), /*#__PURE__*/ (0, $4eSry$react).createElement((0, $3a90e89d07d7bbd5$export$a3cc47cee1c1ccc), {
|
67
|
+
}, /*#__PURE__*/ (0, $4eSry$react).createElement((0, $3a90e89d07d7bbd5$export$a3cc47cee1c1ccc), {
|
68
68
|
value: state.getDisplayColor(),
|
69
69
|
isFocused: isFocusVisible,
|
70
70
|
isDisabled: isDisabled,
|
71
71
|
isDragging: state.isDragging,
|
72
|
+
containerRef: containerRef,
|
72
73
|
className: (0, $4eSry$classNames)((0, ($parcel$interopDefault($4eSry$colorarea_vars_cssmodulejs))), "spectrum-ColorArea-handle"),
|
73
74
|
...thumbProps
|
74
75
|
}, /*#__PURE__*/ (0, $4eSry$react).createElement("div", {
|
package/dist/ColorArea.module.js
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
import {ColorThumb as $3a90e89d07d7bbd5$export$a3cc47cee1c1ccc} from "./ColorThumb.module.js";
|
2
|
-
import "./vars.
|
2
|
+
import "./vars.6fa9fa04.css";
|
3
3
|
import $4eSry$colorarea_vars_cssmodulejs from "./colorarea_vars_css.module.js";
|
4
|
-
import {
|
4
|
+
import {useFocusableRef as $4eSry$useFocusableRef, dimensionValue as $4eSry$dimensionValue, useStyleProps as $4eSry$useStyleProps, classNames as $4eSry$classNames} from "@react-spectrum/utils";
|
5
|
+
import {useContextProps as $4eSry$useContextProps, ColorAreaContext as $4eSry$ColorAreaContext} from "react-aria-components";
|
5
6
|
import {mergeProps as $4eSry$mergeProps} from "@react-aria/utils";
|
6
7
|
import $4eSry$react, {useRef as $4eSry$useRef} from "react";
|
7
8
|
import {useColorArea as $4eSry$useColorArea} from "@react-aria/color";
|
@@ -32,16 +33,18 @@ function $parcel$interopDefault(a) {
|
|
32
33
|
|
33
34
|
|
34
35
|
|
36
|
+
|
35
37
|
function $40046aa1a7ccb226$var$ColorArea(props, ref) {
|
36
38
|
props = (0, $4eSry$useProviderProps)(props);
|
37
|
-
let { isDisabled: isDisabled } = props;
|
38
|
-
let size = props.size && (0, $4eSry$dimensionValue)(props.size);
|
39
|
-
let { styleProps: styleProps } = (0, $4eSry$useStyleProps)(props);
|
40
39
|
let inputXRef = (0, $4eSry$useRef)(null);
|
41
40
|
let inputYRef = (0, $4eSry$useRef)(null);
|
42
41
|
let containerRef = (0, $4eSry$useFocusableRef)(ref, inputXRef);
|
42
|
+
[props, containerRef] = (0, $4eSry$useContextProps)(props, containerRef, (0, $4eSry$ColorAreaContext));
|
43
|
+
let { isDisabled: isDisabled } = props;
|
44
|
+
let size = props.size && (0, $4eSry$dimensionValue)(props.size);
|
45
|
+
let { styleProps: styleProps } = (0, $4eSry$useStyleProps)(props);
|
43
46
|
let state = (0, $4eSry$useColorAreaState)(props);
|
44
|
-
let { colorAreaProps: colorAreaProps,
|
47
|
+
let { colorAreaProps: colorAreaProps, xInputProps: xInputProps, yInputProps: yInputProps, thumbProps: thumbProps } = (0, $4eSry$useColorArea)({
|
45
48
|
...props,
|
46
49
|
inputXRef: inputXRef,
|
47
50
|
inputYRef: inputYRef,
|
@@ -55,20 +58,18 @@ function $40046aa1a7ccb226$var$ColorArea(props, ref) {
|
|
55
58
|
}, styleProps.className),
|
56
59
|
ref: containerRef,
|
57
60
|
style: {
|
58
|
-
...colorAreaProps.style,
|
61
|
+
...isDisabled ? {} : colorAreaProps.style,
|
59
62
|
...styleProps.style,
|
60
63
|
// Workaround around https://github.com/adobe/spectrum-css/issues/1032
|
61
64
|
width: size,
|
62
65
|
height: size
|
63
66
|
}
|
64
|
-
}, /*#__PURE__*/ (0, $4eSry$react).createElement(
|
65
|
-
...gradientProps,
|
66
|
-
className: (0, $4eSry$classNames)((0, ($parcel$interopDefault($4eSry$colorarea_vars_cssmodulejs))), "spectrum-ColorArea-gradient")
|
67
|
-
}), /*#__PURE__*/ (0, $4eSry$react).createElement((0, $3a90e89d07d7bbd5$export$a3cc47cee1c1ccc), {
|
67
|
+
}, /*#__PURE__*/ (0, $4eSry$react).createElement((0, $3a90e89d07d7bbd5$export$a3cc47cee1c1ccc), {
|
68
68
|
value: state.getDisplayColor(),
|
69
69
|
isFocused: isFocusVisible,
|
70
70
|
isDisabled: isDisabled,
|
71
71
|
isDragging: state.isDragging,
|
72
|
+
containerRef: containerRef,
|
72
73
|
className: (0, $4eSry$classNames)((0, ($parcel$interopDefault($4eSry$colorarea_vars_cssmodulejs))), "spectrum-ColorArea-handle"),
|
73
74
|
...thumbProps
|
74
75
|
}, /*#__PURE__*/ (0, $4eSry$react).createElement("div", {
|
@@ -1 +1 @@
|
|
1
|
-
{"mappings":"
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAeD,SAAS,gCAAU,KAA6B,EAAE,GAAiC;IACjF,QAAQ,CAAA,GAAA,uBAAe,EAAE;IACzB,IAAI,YAAY,CAAA,GAAA,aAAK,EAAE;IACvB,IAAI,YAAY,CAAA,GAAA,aAAK,EAAE;IACvB,IAAI,eAAe,CAAA,GAAA,sBAAc,EAAE,KAAK;IACxC,CAAC,OAAO,aAAa,GAAG,CAAA,GAAA,sBAAc,EAAE,OAAO,cAAc,CAAA,GAAA,uBAAe;IAE5E,IAAI,cAAC,UAAU,EAAC,GAAG;IACnB,IAAI,OAAO,MAAM,IAAI,IAAI,CAAA,GAAA,qBAAa,EAAE,MAAM,IAAI;IAClD,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,oBAAY,EAAE;IAGjC,IAAI,QAAQ,CAAA,GAAA,wBAAgB,EAAE;IAE9B,IAAI,kBACF,cAAc,eACd,WAAW,eACX,WAAW,cACX,UAAU,EACX,GAAG,CAAA,GAAA,mBAAW,EAAE;QAAC,GAAG,KAAK;mBAAE;mBAAW;sBAAW;IAAY,GAAG;IACjE,IAAI,cAAC,UAAU,kBAAE,cAAc,EAAC,GAAG,CAAA,GAAA,mBAAW;IAE9C,qBACE,gCAAC;QACE,GAAG,cAAc;QAClB,WACE,CAAA,GAAA,iBAAS,EACP,CAAA,GAAA,2DAAK,GACL,sBACA;YACE,eAAe;QACjB,GACA,WAAW,SAAS;QAGxB,KAAK;QACL,OAAO;YACL,GAAI,aAAa,CAAC,IAAI,eAAe,KAAK;YAC1C,GAAG,WAAW,KAAK;YACnB,sEAAsE;YACtE,OAAO;YACP,QAAQ;QACV;qBACA,gCAAC,CAAA,GAAA,wCAAS;QACR,OAAO,MAAM,eAAe;QAC5B,WAAW;QACX,YAAY;QACZ,YAAY,MAAM,UAAU;QAC5B,cAAc;QACd,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,2DAAK,GAAG;QAC7B,GAAG,UAAU;qBACd,gCAAC;QAAI,MAAK;qBACR,gCAAC;QAAM,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,2DAAK,GAAG;QAA+B,GAAG,CAAA,GAAA,iBAAS,EAAE,aAAa,WAAW;QAAE,KAAK;sBACjH,gCAAC;QAAM,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,2DAAK,GAAG;QAA+B,GAAG,CAAA,GAAA,iBAAS,EAAE,aAAa,WAAW;QAAE,KAAK;;AAK3H;AAEA;;CAEC,GACD,IAAI,0DAAa,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/color/src/ColorArea.tsx"],"sourcesContent":["/*\n * Copyright 2021 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, dimensionValue, useFocusableRef, useStyleProps} from '@react-spectrum/utils';\nimport {ColorAreaContext, useContextProps} from 'react-aria-components';\nimport {ColorThumb} from './ColorThumb';\nimport {FocusableRef} from '@react-types/shared';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {ReactElement, useRef} from 'react';\nimport {SpectrumColorAreaProps} from '@react-types/color';\nimport styles from '@adobe/spectrum-css-temp/components/colorarea/vars.css';\nimport {useColorArea} from '@react-aria/color';\nimport {useColorAreaState} from '@react-stately/color';\nimport {useFocusRing} from '@react-aria/focus';\nimport {useProviderProps} from '@react-spectrum/provider';\n\nfunction ColorArea(props: SpectrumColorAreaProps, ref: FocusableRef<HTMLDivElement>) {\n props = useProviderProps(props);\n let inputXRef = useRef(null);\n let inputYRef = useRef(null);\n let containerRef = useFocusableRef(ref, inputXRef);\n [props, containerRef] = useContextProps(props, containerRef, ColorAreaContext);\n\n let {isDisabled} = props;\n let size = props.size && dimensionValue(props.size);\n let {styleProps} = useStyleProps(props);\n\n\n let state = useColorAreaState(props);\n\n let {\n colorAreaProps,\n xInputProps,\n yInputProps,\n thumbProps\n } = useColorArea({...props, inputXRef, inputYRef, containerRef}, state);\n let {focusProps, isFocusVisible} = useFocusRing();\n\n return (\n <div\n {...colorAreaProps}\n className={\n classNames(\n styles,\n 'spectrum-ColorArea',\n {\n 'is-disabled': isDisabled\n },\n styleProps.className\n )\n }\n ref={containerRef}\n style={{\n ...(isDisabled ? {} : colorAreaProps.style),\n ...styleProps.style,\n // Workaround around https://github.com/adobe/spectrum-css/issues/1032\n width: size,\n height: size\n }}>\n <ColorThumb\n value={state.getDisplayColor()}\n isFocused={isFocusVisible}\n isDisabled={isDisabled}\n isDragging={state.isDragging}\n containerRef={containerRef}\n className={classNames(styles, 'spectrum-ColorArea-handle')}\n {...thumbProps}>\n <div role=\"presentation\">\n <input className={classNames(styles, 'spectrum-ColorArea-slider')} {...mergeProps(xInputProps, focusProps)} ref={inputXRef} />\n <input className={classNames(styles, 'spectrum-ColorArea-slider')} {...mergeProps(yInputProps, focusProps)} ref={inputYRef} />\n </div>\n </ColorThumb>\n </div>\n );\n}\n\n/**\n * ColorArea allows users to adjust two channels of an RGB, HSL or HSB color value against a two-dimensional gradient background.\n */\nlet _ColorArea = React.forwardRef(ColorArea) as (props: SpectrumColorAreaProps & {ref?: FocusableRef<HTMLDivElement>}) => ReactElement;\nexport {_ColorArea as ColorArea};\n"],"names":[],"version":3,"file":"ColorArea.module.js.map"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"mappings":"ACAA;EASE;;;;EANA;;;;EAMA;;;;EAMA;;;;;AAfF","sources":["831a302ce8de66a2","packages/@react-spectrum/color/src/ColorEditor.tsx"],"sourcesContent":["@import \"61db59ad802e5cd4\";\n@import \"4bcaf5321f340d0a\";\n@import \"76e53872e9d29f42\";\n","@layer a, b;\n\n@layer a {\n ._Sd {\n display: flex;\n }\n}\n\n@layer a {\n ._Zb {\n flex-direction: column;\n }\n}\n\n@layer a {\n .le {\n row-gap: 1rem;\n }\n}\n\n@layer a {\n .me {\n column-gap: 1rem;\n }\n}\n\n"],"names":[],"version":3,"file":"ColorEditor.32e497e8.css.map"}
|
@@ -0,0 +1,116 @@
|
|
1
|
+
require("./ColorEditor.32e497e8.css");
|
2
|
+
var $5f016e950c2dc3a6$exports = require("./ColorArea.main.js");
|
3
|
+
var $8bdb9bc27ff3debb$exports = require("./ColorField.main.js");
|
4
|
+
var $4537dec0de08c277$exports = require("./ColorSlider.main.js");
|
5
|
+
var $54ac9df6f63399af$exports = require("./intlStrings.main.js");
|
6
|
+
var $2H14s$reactstatelycolor = require("@react-stately/color");
|
7
|
+
var $2H14s$reactspectrumpicker = require("@react-spectrum/picker");
|
8
|
+
var $2H14s$react = require("react");
|
9
|
+
var $2H14s$reactspectrumutils = require("@react-spectrum/utils");
|
10
|
+
var $2H14s$reactariai18n = require("@react-aria/i18n");
|
11
|
+
|
12
|
+
|
13
|
+
function $parcel$interopDefault(a) {
|
14
|
+
return a && a.__esModule ? a.default : a;
|
15
|
+
}
|
16
|
+
|
17
|
+
function $parcel$export(e, n, v, s) {
|
18
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
19
|
+
}
|
20
|
+
|
21
|
+
$parcel$export(module.exports, "ColorEditor", () => $ecaab91cad36cb44$export$5aa54fd21eb08d23);
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
function $ecaab91cad36cb44$var$ColorEditor(props, ref) {
|
32
|
+
let [format, setFormat] = (0, $2H14s$react.useState)("hex");
|
33
|
+
let domRef = (0, $2H14s$reactspectrumutils.useDOMRef)(ref);
|
34
|
+
let formatter = (0, $2H14s$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($54ac9df6f63399af$exports))), "@react-spectrum/color");
|
35
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($2H14s$react))).createElement("div", {
|
36
|
+
className: function anonymous(props) {
|
37
|
+
let rules = "";
|
38
|
+
rules += " _Sd";
|
39
|
+
rules += " _Zb";
|
40
|
+
rules += " le";
|
41
|
+
rules += " me";
|
42
|
+
return rules;
|
43
|
+
}(),
|
44
|
+
ref: domRef
|
45
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($2H14s$react))).createElement("div", {
|
46
|
+
className: function anonymous(props) {
|
47
|
+
let rules = "";
|
48
|
+
rules += " _Sd";
|
49
|
+
rules += " le";
|
50
|
+
rules += " me";
|
51
|
+
return rules;
|
52
|
+
}()
|
53
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($2H14s$react))).createElement((0, $5f016e950c2dc3a6$exports.ColorArea), {
|
54
|
+
colorSpace: "hsb",
|
55
|
+
xChannel: "saturation",
|
56
|
+
yChannel: "brightness"
|
57
|
+
}), /*#__PURE__*/ (0, ($parcel$interopDefault($2H14s$react))).createElement((0, $4537dec0de08c277$exports.ColorSlider), {
|
58
|
+
colorSpace: "hsb",
|
59
|
+
channel: "hue",
|
60
|
+
orientation: "vertical"
|
61
|
+
}), !props.hideAlphaChannel && /*#__PURE__*/ (0, ($parcel$interopDefault($2H14s$react))).createElement((0, $4537dec0de08c277$exports.ColorSlider), {
|
62
|
+
channel: "alpha",
|
63
|
+
orientation: "vertical"
|
64
|
+
})), /*#__PURE__*/ (0, ($parcel$interopDefault($2H14s$react))).createElement("div", {
|
65
|
+
className: function anonymous(props) {
|
66
|
+
let rules = "";
|
67
|
+
rules += " _Sd";
|
68
|
+
rules += " le";
|
69
|
+
rules += " me";
|
70
|
+
return rules;
|
71
|
+
}()
|
72
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($2H14s$react))).createElement((0, $2H14s$reactspectrumpicker.Picker), {
|
73
|
+
"aria-label": formatter.format("colorFormat"),
|
74
|
+
isQuiet: true,
|
75
|
+
width: "size-700",
|
76
|
+
menuWidth: "size-1000",
|
77
|
+
selectedKey: format,
|
78
|
+
onSelectionChange: (f)=>setFormat(f)
|
79
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($2H14s$react))).createElement((0, $2H14s$reactspectrumpicker.Item), {
|
80
|
+
key: "hex"
|
81
|
+
}, formatter.format("hex")), /*#__PURE__*/ (0, ($parcel$interopDefault($2H14s$react))).createElement((0, $2H14s$reactspectrumpicker.Item), {
|
82
|
+
key: "rgb"
|
83
|
+
}, formatter.format("rgb")), /*#__PURE__*/ (0, ($parcel$interopDefault($2H14s$react))).createElement((0, $2H14s$reactspectrumpicker.Item), {
|
84
|
+
key: "hsl"
|
85
|
+
}, formatter.format("hsl")), /*#__PURE__*/ (0, ($parcel$interopDefault($2H14s$react))).createElement((0, $2H14s$reactspectrumpicker.Item), {
|
86
|
+
key: "hsb"
|
87
|
+
}, formatter.format("hsb"))), format === "hex" ? /*#__PURE__*/ (0, ($parcel$interopDefault($2H14s$react))).createElement((0, $8bdb9bc27ff3debb$exports.ColorField), {
|
88
|
+
isQuiet: true,
|
89
|
+
width: "size-1000",
|
90
|
+
"aria-label": formatter.format("hex")
|
91
|
+
}) : (0, $2H14s$reactstatelycolor.getColorChannels)(format).map((channel)=>/*#__PURE__*/ (0, ($parcel$interopDefault($2H14s$react))).createElement((0, $8bdb9bc27ff3debb$exports.ColorField), {
|
92
|
+
key: channel,
|
93
|
+
colorSpace: format === "hex" ? "rgb" : format,
|
94
|
+
channel: channel,
|
95
|
+
isQuiet: true,
|
96
|
+
width: "size-400",
|
97
|
+
flex: true,
|
98
|
+
UNSAFE_style: {
|
99
|
+
"--spectrum-textfield-min-width": 0
|
100
|
+
}
|
101
|
+
})), !props.hideAlphaChannel && /*#__PURE__*/ (0, ($parcel$interopDefault($2H14s$react))).createElement((0, $8bdb9bc27ff3debb$exports.ColorField), {
|
102
|
+
channel: "alpha",
|
103
|
+
isQuiet: true,
|
104
|
+
width: "size-400",
|
105
|
+
flex: true,
|
106
|
+
UNSAFE_style: {
|
107
|
+
"--spectrum-textfield-min-width": 0
|
108
|
+
}
|
109
|
+
})));
|
110
|
+
}
|
111
|
+
/**
|
112
|
+
* ColorEditor provides a default UI for editing colors within a ColorPicker.
|
113
|
+
*/ let $ecaab91cad36cb44$export$5aa54fd21eb08d23 = /*#__PURE__*/ (0, ($parcel$interopDefault($2H14s$react))).forwardRef($ecaab91cad36cb44$var$ColorEditor);
|
114
|
+
|
115
|
+
|
116
|
+
//# sourceMappingURL=ColorEditor.main.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,SAAS,kCAAY,KAA+B,EAAE,GAA2B;IAC/E,IAAI,CAAC,QAAQ,UAAU,GAAG,CAAA,GAAA,qBAAO,EAAsB;IACvD,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IACvB,IAAI,YAAY,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAE1D,qBACE,0DAAC;QAAI,WAAW;;;;;;;;QAA6D,KAAK;qBAChF,0DAAC;QAAI,WAAW;;;;;;;qBACd,0DAAC,CAAA,GAAA,mCAAQ;QAAE,YAAW;QAAM,UAAS;QAAa,UAAS;sBAC3D,0DAAC,CAAA,GAAA,qCAAU;QAAE,YAAW;QAAM,SAAQ;QAAM,aAAY;QACvD,CAAC,MAAM,gBAAgB,kBACtB,0DAAC,CAAA,GAAA,qCAAU;QAAE,SAAQ;QAAQ,aAAY;uBAG7C,0DAAC;QAAI,WAAW;;;;;;;qBACd,0DAAC,CAAA,GAAA,iCAAK;QACJ,cAAY,UAAU,MAAM,CAAC;QAC7B,SAAA;QACA,OAAM;QACN,WAAU;QACV,aAAa;QACb,mBAAmB,CAAA,IAAK,UAAU;qBAClC,0DAAC,CAAA,GAAA,+BAAG;QAAE,KAAI;OAAO,UAAU,MAAM,CAAC,uBAClC,0DAAC,CAAA,GAAA,+BAAG;QAAE,KAAI;OAAO,UAAU,MAAM,CAAC,uBAClC,0DAAC,CAAA,GAAA,+BAAG;QAAE,KAAI;OAAO,UAAU,MAAM,CAAC,uBAClC,0DAAC,CAAA,GAAA,+BAAG;QAAE,KAAI;OAAO,UAAU,MAAM,CAAC,UAEnC,WAAW,sBACR,0DAAC,CAAA,GAAA,oCAAS;QAAE,SAAA;QAAQ,OAAM;QAAY,cAAY,UAAU,MAAM,CAAC;SACnE,CAAA,GAAA,yCAAe,EAAE,QAAQ,GAAG,CAAC,CAAA,wBAC7B,0DAAC,CAAA,GAAA,oCAAS;YAAE,KAAK;YAAS,YAAY,WAAW,QAAQ,QAAQ;YAAQ,SAAS;YAAS,SAAA;YAAQ,OAAM;YAAW,MAAA;YAAK,cAAc;gBAAC,kCAAkC;YAAC;aAE9K,CAAC,MAAM,gBAAgB,kBACtB,0DAAC,CAAA,GAAA,oCAAS;QAAE,SAAQ;QAAQ,SAAA;QAAQ,OAAM;QAAW,MAAA;QAAK,cAAc;YAAC,kCAAkC;QAAC;;AAItH;AAEA;;CAEC,GACD,IAAI,0DAAe,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/color/src/ColorEditor.tsx"],"sourcesContent":["import {ColorArea} from './ColorArea';\nimport {ColorField} from './ColorField';\nimport {ColorSlider} from './ColorSlider';\nimport {ColorSpace} from '@react-types/color';\nimport {DOMRef} from '@react-types/shared';\nimport {getColorChannels} from '@react-stately/color';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {Item, Picker} from '@react-spectrum/picker';\nimport React, {CSSProperties, useState} from 'react';\nimport {style} from '@react-spectrum/style-macro-s1' with {type: 'macro'};\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface SpectrumColorEditorProps {\n /** Whether to hide the alpha channel color slider and color field. */\n hideAlphaChannel?: boolean\n}\n\nfunction ColorEditor(props: SpectrumColorEditorProps, ref: DOMRef<HTMLDivElement>) {\n let [format, setFormat] = useState<ColorSpace | 'hex'>('hex');\n let domRef = useDOMRef(ref);\n let formatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/color');\n\n return (\n <div className={style({display: 'flex', flexDirection: 'column', gap: 4})()} ref={domRef}>\n <div className={style({display: 'flex', gap: 4})()}>\n <ColorArea colorSpace=\"hsb\" xChannel=\"saturation\" yChannel=\"brightness\" />\n <ColorSlider colorSpace=\"hsb\" channel=\"hue\" orientation=\"vertical\" />\n {!props.hideAlphaChannel &&\n <ColorSlider channel=\"alpha\" orientation=\"vertical\" />\n }\n </div>\n <div className={style({display: 'flex', gap: 4})()}>\n <Picker \n aria-label={formatter.format('colorFormat')}\n isQuiet\n width=\"size-700\"\n menuWidth=\"size-1000\"\n selectedKey={format}\n onSelectionChange={f => setFormat(f as typeof format)}>\n <Item key=\"hex\">{formatter.format('hex')}</Item>\n <Item key=\"rgb\">{formatter.format('rgb')}</Item>\n <Item key=\"hsl\">{formatter.format('hsl')}</Item>\n <Item key=\"hsb\">{formatter.format('hsb')}</Item>\n </Picker>\n {format === 'hex'\n ? <ColorField isQuiet width=\"size-1000\" aria-label={formatter.format('hex')} />\n : getColorChannels(format).map(channel => (\n <ColorField key={channel} colorSpace={format === 'hex' ? 'rgb' : format} channel={channel} isQuiet width=\"size-400\" flex UNSAFE_style={{'--spectrum-textfield-min-width': 0} as CSSProperties} />\n ))}\n {!props.hideAlphaChannel &&\n <ColorField channel=\"alpha\" isQuiet width=\"size-400\" flex UNSAFE_style={{'--spectrum-textfield-min-width': 0} as CSSProperties} />}\n </div>\n </div>\n );\n}\n\n/**\n * ColorEditor provides a default UI for editing colors within a ColorPicker.\n */\nlet _ColorEditor = React.forwardRef(ColorEditor);\nexport {_ColorEditor as ColorEditor};\n"],"names":[],"version":3,"file":"ColorEditor.main.js.map"}
|
@@ -0,0 +1,111 @@
|
|
1
|
+
import "./ColorEditor.32e497e8.css";
|
2
|
+
import {ColorArea as $40046aa1a7ccb226$export$b2103f68a961418e} from "./ColorArea.mjs";
|
3
|
+
import {ColorField as $0077d47e004328f0$export$b865d4358897bb17} from "./ColorField.mjs";
|
4
|
+
import {ColorSlider as $3870e4ce67ed7ee1$export$44fd664bcca5b6fb} from "./ColorSlider.mjs";
|
5
|
+
import $3Vio4$intlStringsmodulejs from "./intlStrings.mjs";
|
6
|
+
import {getColorChannels as $3Vio4$getColorChannels} from "@react-stately/color";
|
7
|
+
import {Picker as $3Vio4$Picker, Item as $3Vio4$Item} from "@react-spectrum/picker";
|
8
|
+
import $3Vio4$react, {useState as $3Vio4$useState} from "react";
|
9
|
+
import {useDOMRef as $3Vio4$useDOMRef} from "@react-spectrum/utils";
|
10
|
+
import {useLocalizedStringFormatter as $3Vio4$useLocalizedStringFormatter} from "@react-aria/i18n";
|
11
|
+
|
12
|
+
|
13
|
+
function $parcel$interopDefault(a) {
|
14
|
+
return a && a.__esModule ? a.default : a;
|
15
|
+
}
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
function $49352c629f2d8349$var$ColorEditor(props, ref) {
|
26
|
+
let [format, setFormat] = (0, $3Vio4$useState)("hex");
|
27
|
+
let domRef = (0, $3Vio4$useDOMRef)(ref);
|
28
|
+
let formatter = (0, $3Vio4$useLocalizedStringFormatter)((0, ($parcel$interopDefault($3Vio4$intlStringsmodulejs))), "@react-spectrum/color");
|
29
|
+
return /*#__PURE__*/ (0, $3Vio4$react).createElement("div", {
|
30
|
+
className: function anonymous(props) {
|
31
|
+
let rules = "";
|
32
|
+
rules += " _Sd";
|
33
|
+
rules += " _Zb";
|
34
|
+
rules += " le";
|
35
|
+
rules += " me";
|
36
|
+
return rules;
|
37
|
+
}(),
|
38
|
+
ref: domRef
|
39
|
+
}, /*#__PURE__*/ (0, $3Vio4$react).createElement("div", {
|
40
|
+
className: function anonymous(props) {
|
41
|
+
let rules = "";
|
42
|
+
rules += " _Sd";
|
43
|
+
rules += " le";
|
44
|
+
rules += " me";
|
45
|
+
return rules;
|
46
|
+
}()
|
47
|
+
}, /*#__PURE__*/ (0, $3Vio4$react).createElement((0, $40046aa1a7ccb226$export$b2103f68a961418e), {
|
48
|
+
colorSpace: "hsb",
|
49
|
+
xChannel: "saturation",
|
50
|
+
yChannel: "brightness"
|
51
|
+
}), /*#__PURE__*/ (0, $3Vio4$react).createElement((0, $3870e4ce67ed7ee1$export$44fd664bcca5b6fb), {
|
52
|
+
colorSpace: "hsb",
|
53
|
+
channel: "hue",
|
54
|
+
orientation: "vertical"
|
55
|
+
}), !props.hideAlphaChannel && /*#__PURE__*/ (0, $3Vio4$react).createElement((0, $3870e4ce67ed7ee1$export$44fd664bcca5b6fb), {
|
56
|
+
channel: "alpha",
|
57
|
+
orientation: "vertical"
|
58
|
+
})), /*#__PURE__*/ (0, $3Vio4$react).createElement("div", {
|
59
|
+
className: function anonymous(props) {
|
60
|
+
let rules = "";
|
61
|
+
rules += " _Sd";
|
62
|
+
rules += " le";
|
63
|
+
rules += " me";
|
64
|
+
return rules;
|
65
|
+
}()
|
66
|
+
}, /*#__PURE__*/ (0, $3Vio4$react).createElement((0, $3Vio4$Picker), {
|
67
|
+
"aria-label": formatter.format("colorFormat"),
|
68
|
+
isQuiet: true,
|
69
|
+
width: "size-700",
|
70
|
+
menuWidth: "size-1000",
|
71
|
+
selectedKey: format,
|
72
|
+
onSelectionChange: (f)=>setFormat(f)
|
73
|
+
}, /*#__PURE__*/ (0, $3Vio4$react).createElement((0, $3Vio4$Item), {
|
74
|
+
key: "hex"
|
75
|
+
}, formatter.format("hex")), /*#__PURE__*/ (0, $3Vio4$react).createElement((0, $3Vio4$Item), {
|
76
|
+
key: "rgb"
|
77
|
+
}, formatter.format("rgb")), /*#__PURE__*/ (0, $3Vio4$react).createElement((0, $3Vio4$Item), {
|
78
|
+
key: "hsl"
|
79
|
+
}, formatter.format("hsl")), /*#__PURE__*/ (0, $3Vio4$react).createElement((0, $3Vio4$Item), {
|
80
|
+
key: "hsb"
|
81
|
+
}, formatter.format("hsb"))), format === "hex" ? /*#__PURE__*/ (0, $3Vio4$react).createElement((0, $0077d47e004328f0$export$b865d4358897bb17), {
|
82
|
+
isQuiet: true,
|
83
|
+
width: "size-1000",
|
84
|
+
"aria-label": formatter.format("hex")
|
85
|
+
}) : (0, $3Vio4$getColorChannels)(format).map((channel)=>/*#__PURE__*/ (0, $3Vio4$react).createElement((0, $0077d47e004328f0$export$b865d4358897bb17), {
|
86
|
+
key: channel,
|
87
|
+
colorSpace: format === "hex" ? "rgb" : format,
|
88
|
+
channel: channel,
|
89
|
+
isQuiet: true,
|
90
|
+
width: "size-400",
|
91
|
+
flex: true,
|
92
|
+
UNSAFE_style: {
|
93
|
+
"--spectrum-textfield-min-width": 0
|
94
|
+
}
|
95
|
+
})), !props.hideAlphaChannel && /*#__PURE__*/ (0, $3Vio4$react).createElement((0, $0077d47e004328f0$export$b865d4358897bb17), {
|
96
|
+
channel: "alpha",
|
97
|
+
isQuiet: true,
|
98
|
+
width: "size-400",
|
99
|
+
flex: true,
|
100
|
+
UNSAFE_style: {
|
101
|
+
"--spectrum-textfield-min-width": 0
|
102
|
+
}
|
103
|
+
})));
|
104
|
+
}
|
105
|
+
/**
|
106
|
+
* ColorEditor provides a default UI for editing colors within a ColorPicker.
|
107
|
+
*/ let $49352c629f2d8349$export$5aa54fd21eb08d23 = /*#__PURE__*/ (0, $3Vio4$react).forwardRef($49352c629f2d8349$var$ColorEditor);
|
108
|
+
|
109
|
+
|
110
|
+
export {$49352c629f2d8349$export$5aa54fd21eb08d23 as ColorEditor};
|
111
|
+
//# sourceMappingURL=ColorEditor.mjs.map
|
@@ -0,0 +1,111 @@
|
|
1
|
+
import "./ColorEditor.32e497e8.css";
|
2
|
+
import {ColorArea as $40046aa1a7ccb226$export$b2103f68a961418e} from "./ColorArea.module.js";
|
3
|
+
import {ColorField as $0077d47e004328f0$export$b865d4358897bb17} from "./ColorField.module.js";
|
4
|
+
import {ColorSlider as $3870e4ce67ed7ee1$export$44fd664bcca5b6fb} from "./ColorSlider.module.js";
|
5
|
+
import $3Vio4$intlStringsmodulejs from "./intlStrings.module.js";
|
6
|
+
import {getColorChannels as $3Vio4$getColorChannels} from "@react-stately/color";
|
7
|
+
import {Picker as $3Vio4$Picker, Item as $3Vio4$Item} from "@react-spectrum/picker";
|
8
|
+
import $3Vio4$react, {useState as $3Vio4$useState} from "react";
|
9
|
+
import {useDOMRef as $3Vio4$useDOMRef} from "@react-spectrum/utils";
|
10
|
+
import {useLocalizedStringFormatter as $3Vio4$useLocalizedStringFormatter} from "@react-aria/i18n";
|
11
|
+
|
12
|
+
|
13
|
+
function $parcel$interopDefault(a) {
|
14
|
+
return a && a.__esModule ? a.default : a;
|
15
|
+
}
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
function $49352c629f2d8349$var$ColorEditor(props, ref) {
|
26
|
+
let [format, setFormat] = (0, $3Vio4$useState)("hex");
|
27
|
+
let domRef = (0, $3Vio4$useDOMRef)(ref);
|
28
|
+
let formatter = (0, $3Vio4$useLocalizedStringFormatter)((0, ($parcel$interopDefault($3Vio4$intlStringsmodulejs))), "@react-spectrum/color");
|
29
|
+
return /*#__PURE__*/ (0, $3Vio4$react).createElement("div", {
|
30
|
+
className: function anonymous(props) {
|
31
|
+
let rules = "";
|
32
|
+
rules += " _Sd";
|
33
|
+
rules += " _Zb";
|
34
|
+
rules += " le";
|
35
|
+
rules += " me";
|
36
|
+
return rules;
|
37
|
+
}(),
|
38
|
+
ref: domRef
|
39
|
+
}, /*#__PURE__*/ (0, $3Vio4$react).createElement("div", {
|
40
|
+
className: function anonymous(props) {
|
41
|
+
let rules = "";
|
42
|
+
rules += " _Sd";
|
43
|
+
rules += " le";
|
44
|
+
rules += " me";
|
45
|
+
return rules;
|
46
|
+
}()
|
47
|
+
}, /*#__PURE__*/ (0, $3Vio4$react).createElement((0, $40046aa1a7ccb226$export$b2103f68a961418e), {
|
48
|
+
colorSpace: "hsb",
|
49
|
+
xChannel: "saturation",
|
50
|
+
yChannel: "brightness"
|
51
|
+
}), /*#__PURE__*/ (0, $3Vio4$react).createElement((0, $3870e4ce67ed7ee1$export$44fd664bcca5b6fb), {
|
52
|
+
colorSpace: "hsb",
|
53
|
+
channel: "hue",
|
54
|
+
orientation: "vertical"
|
55
|
+
}), !props.hideAlphaChannel && /*#__PURE__*/ (0, $3Vio4$react).createElement((0, $3870e4ce67ed7ee1$export$44fd664bcca5b6fb), {
|
56
|
+
channel: "alpha",
|
57
|
+
orientation: "vertical"
|
58
|
+
})), /*#__PURE__*/ (0, $3Vio4$react).createElement("div", {
|
59
|
+
className: function anonymous(props) {
|
60
|
+
let rules = "";
|
61
|
+
rules += " _Sd";
|
62
|
+
rules += " le";
|
63
|
+
rules += " me";
|
64
|
+
return rules;
|
65
|
+
}()
|
66
|
+
}, /*#__PURE__*/ (0, $3Vio4$react).createElement((0, $3Vio4$Picker), {
|
67
|
+
"aria-label": formatter.format("colorFormat"),
|
68
|
+
isQuiet: true,
|
69
|
+
width: "size-700",
|
70
|
+
menuWidth: "size-1000",
|
71
|
+
selectedKey: format,
|
72
|
+
onSelectionChange: (f)=>setFormat(f)
|
73
|
+
}, /*#__PURE__*/ (0, $3Vio4$react).createElement((0, $3Vio4$Item), {
|
74
|
+
key: "hex"
|
75
|
+
}, formatter.format("hex")), /*#__PURE__*/ (0, $3Vio4$react).createElement((0, $3Vio4$Item), {
|
76
|
+
key: "rgb"
|
77
|
+
}, formatter.format("rgb")), /*#__PURE__*/ (0, $3Vio4$react).createElement((0, $3Vio4$Item), {
|
78
|
+
key: "hsl"
|
79
|
+
}, formatter.format("hsl")), /*#__PURE__*/ (0, $3Vio4$react).createElement((0, $3Vio4$Item), {
|
80
|
+
key: "hsb"
|
81
|
+
}, formatter.format("hsb"))), format === "hex" ? /*#__PURE__*/ (0, $3Vio4$react).createElement((0, $0077d47e004328f0$export$b865d4358897bb17), {
|
82
|
+
isQuiet: true,
|
83
|
+
width: "size-1000",
|
84
|
+
"aria-label": formatter.format("hex")
|
85
|
+
}) : (0, $3Vio4$getColorChannels)(format).map((channel)=>/*#__PURE__*/ (0, $3Vio4$react).createElement((0, $0077d47e004328f0$export$b865d4358897bb17), {
|
86
|
+
key: channel,
|
87
|
+
colorSpace: format === "hex" ? "rgb" : format,
|
88
|
+
channel: channel,
|
89
|
+
isQuiet: true,
|
90
|
+
width: "size-400",
|
91
|
+
flex: true,
|
92
|
+
UNSAFE_style: {
|
93
|
+
"--spectrum-textfield-min-width": 0
|
94
|
+
}
|
95
|
+
})), !props.hideAlphaChannel && /*#__PURE__*/ (0, $3Vio4$react).createElement((0, $0077d47e004328f0$export$b865d4358897bb17), {
|
96
|
+
channel: "alpha",
|
97
|
+
isQuiet: true,
|
98
|
+
width: "size-400",
|
99
|
+
flex: true,
|
100
|
+
UNSAFE_style: {
|
101
|
+
"--spectrum-textfield-min-width": 0
|
102
|
+
}
|
103
|
+
})));
|
104
|
+
}
|
105
|
+
/**
|
106
|
+
* ColorEditor provides a default UI for editing colors within a ColorPicker.
|
107
|
+
*/ let $49352c629f2d8349$export$5aa54fd21eb08d23 = /*#__PURE__*/ (0, $3Vio4$react).forwardRef($49352c629f2d8349$var$ColorEditor);
|
108
|
+
|
109
|
+
|
110
|
+
export {$49352c629f2d8349$export$5aa54fd21eb08d23 as ColorEditor};
|
111
|
+
//# sourceMappingURL=ColorEditor.module.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAmBA,SAAS,kCAAY,KAA+B,EAAE,GAA2B;IAC/E,IAAI,CAAC,QAAQ,UAAU,GAAG,CAAA,GAAA,eAAO,EAAsB;IACvD,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE;IACvB,IAAI,YAAY,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAE1D,qBACE,gCAAC;QAAI,WAAW;;;;;;;;QAA6D,KAAK;qBAChF,gCAAC;QAAI,WAAW;;;;;;;qBACd,gCAAC,CAAA,GAAA,yCAAQ;QAAE,YAAW;QAAM,UAAS;QAAa,UAAS;sBAC3D,gCAAC,CAAA,GAAA,yCAAU;QAAE,YAAW;QAAM,SAAQ;QAAM,aAAY;QACvD,CAAC,MAAM,gBAAgB,kBACtB,gCAAC,CAAA,GAAA,yCAAU;QAAE,SAAQ;QAAQ,aAAY;uBAG7C,gCAAC;QAAI,WAAW;;;;;;;qBACd,gCAAC,CAAA,GAAA,aAAK;QACJ,cAAY,UAAU,MAAM,CAAC;QAC7B,SAAA;QACA,OAAM;QACN,WAAU;QACV,aAAa;QACb,mBAAmB,CAAA,IAAK,UAAU;qBAClC,gCAAC,CAAA,GAAA,WAAG;QAAE,KAAI;OAAO,UAAU,MAAM,CAAC,uBAClC,gCAAC,CAAA,GAAA,WAAG;QAAE,KAAI;OAAO,UAAU,MAAM,CAAC,uBAClC,gCAAC,CAAA,GAAA,WAAG;QAAE,KAAI;OAAO,UAAU,MAAM,CAAC,uBAClC,gCAAC,CAAA,GAAA,WAAG;QAAE,KAAI;OAAO,UAAU,MAAM,CAAC,UAEnC,WAAW,sBACR,gCAAC,CAAA,GAAA,yCAAS;QAAE,SAAA;QAAQ,OAAM;QAAY,cAAY,UAAU,MAAM,CAAC;SACnE,CAAA,GAAA,uBAAe,EAAE,QAAQ,GAAG,CAAC,CAAA,wBAC7B,gCAAC,CAAA,GAAA,yCAAS;YAAE,KAAK;YAAS,YAAY,WAAW,QAAQ,QAAQ;YAAQ,SAAS;YAAS,SAAA;YAAQ,OAAM;YAAW,MAAA;YAAK,cAAc;gBAAC,kCAAkC;YAAC;aAE9K,CAAC,MAAM,gBAAgB,kBACtB,gCAAC,CAAA,GAAA,yCAAS;QAAE,SAAQ;QAAQ,SAAA;QAAQ,OAAM;QAAW,MAAA;QAAK,cAAc;YAAC,kCAAkC;QAAC;;AAItH;AAEA;;CAEC,GACD,IAAI,0DAAe,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/color/src/ColorEditor.tsx"],"sourcesContent":["import {ColorArea} from './ColorArea';\nimport {ColorField} from './ColorField';\nimport {ColorSlider} from './ColorSlider';\nimport {ColorSpace} from '@react-types/color';\nimport {DOMRef} from '@react-types/shared';\nimport {getColorChannels} from '@react-stately/color';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {Item, Picker} from '@react-spectrum/picker';\nimport React, {CSSProperties, useState} from 'react';\nimport {style} from '@react-spectrum/style-macro-s1' with {type: 'macro'};\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface SpectrumColorEditorProps {\n /** Whether to hide the alpha channel color slider and color field. */\n hideAlphaChannel?: boolean\n}\n\nfunction ColorEditor(props: SpectrumColorEditorProps, ref: DOMRef<HTMLDivElement>) {\n let [format, setFormat] = useState<ColorSpace | 'hex'>('hex');\n let domRef = useDOMRef(ref);\n let formatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/color');\n\n return (\n <div className={style({display: 'flex', flexDirection: 'column', gap: 4})()} ref={domRef}>\n <div className={style({display: 'flex', gap: 4})()}>\n <ColorArea colorSpace=\"hsb\" xChannel=\"saturation\" yChannel=\"brightness\" />\n <ColorSlider colorSpace=\"hsb\" channel=\"hue\" orientation=\"vertical\" />\n {!props.hideAlphaChannel &&\n <ColorSlider channel=\"alpha\" orientation=\"vertical\" />\n }\n </div>\n <div className={style({display: 'flex', gap: 4})()}>\n <Picker \n aria-label={formatter.format('colorFormat')}\n isQuiet\n width=\"size-700\"\n menuWidth=\"size-1000\"\n selectedKey={format}\n onSelectionChange={f => setFormat(f as typeof format)}>\n <Item key=\"hex\">{formatter.format('hex')}</Item>\n <Item key=\"rgb\">{formatter.format('rgb')}</Item>\n <Item key=\"hsl\">{formatter.format('hsl')}</Item>\n <Item key=\"hsb\">{formatter.format('hsb')}</Item>\n </Picker>\n {format === 'hex'\n ? <ColorField isQuiet width=\"size-1000\" aria-label={formatter.format('hex')} />\n : getColorChannels(format).map(channel => (\n <ColorField key={channel} colorSpace={format === 'hex' ? 'rgb' : format} channel={channel} isQuiet width=\"size-400\" flex UNSAFE_style={{'--spectrum-textfield-min-width': 0} as CSSProperties} />\n ))}\n {!props.hideAlphaChannel &&\n <ColorField channel=\"alpha\" isQuiet width=\"size-400\" flex UNSAFE_style={{'--spectrum-textfield-min-width': 0} as CSSProperties} />}\n </div>\n </div>\n );\n}\n\n/**\n * ColorEditor provides a default UI for editing colors within a ColorPicker.\n */\nlet _ColorEditor = React.forwardRef(ColorEditor);\nexport {_ColorEditor as ColorEditor};\n"],"names":[],"version":3,"file":"ColorEditor.module.js.map"}
|