@react-spectrum/color 3.0.0-nightly.4567 → 3.0.0-nightly.4582
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
@@ -0,0 +1 @@
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AA6BD,SAAS,kCAAY,KAA+B,EAAE,GAAoC;IACxF,IAAI,YAAY,CAAA,GAAA,mBAAK,EAAE;IACvB,IAAI,SAAS,CAAA,GAAA,yCAAc,EAAE;IAC7B,IAAI,UAAU,CAAA,GAAA,2BAAI;IAClB,qBACE,0DAAC,CAAA,GAAA,sCAAc,GAAM,qBACnB,0DAAC,CAAA,GAAA,wCAAY;QAAE,MAAK;QAAU,YAAW;QAAO,WAAW,CAAA,GAAA,sCAAW,EAAE;qBACtE,0DAAC,CAAA,GAAA,iCAAK;QACJ,KAAK;QACL,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;UAkBR;YAAC,MAAM,MAAM,IAAI,IAAI;QAAG;OAC1B,CAAC,kBAAC,cAAc,EAAC,iBAChB,oIACE,0DAAC;YACC,WAAW;;;;;;;;;;;;;cASR;gCAAC;YAAc;yBAClB,0DAAC,CAAA,GAAA,qCAAU;YACT,KAAK;YACL,MAAM,MAAM,IAAI;YAChB,UAAU,MAAM,QAAQ;YACxB,cAAY,KAAK,CAAC,aAAa;YAC/B,mBAAiB,KAAK,CAAC,kBAAkB;YACzC,oBAAkB,KAAK,CAAC,mBAAmB;YAC3C,gBAAc,KAAK,CAAC,eAAe;aAEtC,MAAM,KAAK,kBACV,0DAAC;YAAK,IAAI;WAAU,MAAM,KAAK,mBAKvC,0DAAC,CAAA,GAAA,iCAAK;QACJ,mBAAiB,MAAM,KAAK,GAAG,UAAU,KAAK,CAAC,kBAAkB;QACjE,cAAY,KAAK,CAAC,aAAa;QAC/B,cAAc;YACZ,OAAO;YACP,UAAU;YACV,QAAQ,SAAS,sBAAsB;QACzC;qBACA,0DAAC,CAAA,GAAA,gCAAM;QACL,cAAc;YACZ,UAAU;YACV,QAAQ;YACR,SAAS;QACX;OACC,MAAM,QAAQ;AAM3B;AAEA;;CAEC,GACD,IAAI,0DAAe,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/color/src/ColorPicker.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 {ColorPicker as AriaColorPicker, Button, Color} from 'react-aria-components';\nimport {AriaLabelingProps, FocusableRef, ValueBase} from '@react-types/shared';\nimport {ColorSwatch} from './ColorSwatch';\nimport {Content} from '@react-spectrum/view';\nimport {Dialog, DialogTrigger} from '@react-spectrum/dialog';\nimport React, {ReactNode, useRef} from 'react';\nimport {style} from '@react-spectrum/style-macro-s1' with {type: 'macro'};\nimport {unwrapDOMRef, useFocusableRef} from '@react-spectrum/utils';\nimport {useId} from '@react-aria/utils';\n\nexport interface SpectrumColorPickerProps extends ValueBase<string | Color, Color>, AriaLabelingProps {\n /** A visual label for the color picker. */\n label?: ReactNode,\n /** The contents of the color picker popover, e.g. `<ColorEditor />`. */\n children?: ReactNode,\n /**\n * The size of the color swatch.\n * @default \"M\"\n */\n size?: 'XS' | 'S' | 'M' | 'L',\n /**\n * The corner rounding of the color swatch.\n * @default \"default\"\n */\n rounding?: 'default' | 'none' | 'full'\n}\n\nfunction ColorPicker(props: SpectrumColorPickerProps, ref: FocusableRef<HTMLButtonElement>) {\n let swatchRef = useRef(null);\n let domRef = useFocusableRef(ref);\n let labelId = useId();\n return (\n <AriaColorPicker {...props}>\n <DialogTrigger type=\"popover\" mobileType=\"tray\" targetRef={unwrapDOMRef(swatchRef)}>\n <Button \n ref={domRef}\n className={style({\n backgroundColor: 'transparent',\n borderStyle: 'none',\n padding: 0,\n display: 'flex',\n alignItems: 'center',\n gap: 'text-to-control',\n outlineStyle: 'none',\n fontFamily: 'sans',\n color: 'body',\n fontSize: {\n size: {\n XS: 'xs',\n S: 'sm',\n M: 'base',\n L: 'lg'\n }\n }\n })({size: props.size || 'M'})}>\n {({isFocusVisible}) => (\n <>\n <div\n className={style({\n outlineStyle: {\n default: 'none',\n isFocusVisible: 'solid'\n },\n outlineColor: 'focus-ring',\n outlineWidth: 2,\n outlineOffset: 2,\n borderRadius: 'default'\n })({isFocusVisible})}>\n <ColorSwatch\n ref={swatchRef}\n size={props.size}\n rounding={props.rounding}\n aria-label={props['aria-label']}\n aria-labelledby={props['aria-labelledby']}\n aria-describedby={props['aria-describedby']}\n aria-details={props['aria-details']} />\n </div>\n {props.label && \n <span id={labelId}>{props.label}</span>\n }\n </>\n )}\n </Button>\n <Dialog \n aria-labelledby={props.label ? labelId : props['aria-labelledby']}\n aria-label={props['aria-label']}\n UNSAFE_style={{\n width: 'fit-content',\n minWidth: 0,\n margin: '0 auto' // Center within tray.\n }}>\n <Content \n UNSAFE_style={{\n position: 'relative',\n margin: 'calc(var(--spectrum-dialog-padding) * -1)',\n padding: 'var(--spectrum-global-dimension-size-200)'\n }}>\n {props.children}\n </Content>\n </Dialog>\n </DialogTrigger>\n </AriaColorPicker>\n );\n}\n\n/**\n * A ColorPicker combines a swatch with a customizable popover for editing a color.\n */\nlet _ColorPicker = React.forwardRef(ColorPicker);\nexport {_ColorPicker as ColorPicker};\n"],"names":[],"version":3,"file":"ColorPicker.main.js.map"}
|
@@ -0,0 +1,116 @@
|
|
1
|
+
import "./ColorPicker.ab9f47c0.css";
|
2
|
+
import {ColorSwatch as $d68786ae409fa722$export$cae13e90592f246a} from "./ColorSwatch.mjs";
|
3
|
+
import {ColorPicker as $5bRyn$ColorPicker, Button as $5bRyn$Button} from "react-aria-components";
|
4
|
+
import {Content as $5bRyn$Content} from "@react-spectrum/view";
|
5
|
+
import {DialogTrigger as $5bRyn$DialogTrigger, Dialog as $5bRyn$Dialog} from "@react-spectrum/dialog";
|
6
|
+
import $5bRyn$react, {useRef as $5bRyn$useRef} from "react";
|
7
|
+
import {useFocusableRef as $5bRyn$useFocusableRef, unwrapDOMRef as $5bRyn$unwrapDOMRef} from "@react-spectrum/utils";
|
8
|
+
import {useId as $5bRyn$useId} from "@react-aria/utils";
|
9
|
+
|
10
|
+
/*
|
11
|
+
* Copyright 2024 Adobe. All rights reserved.
|
12
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
13
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
14
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
15
|
+
*
|
16
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
17
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
18
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
19
|
+
* governing permissions and limitations under the License.
|
20
|
+
*/
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
function $d9654c66f3a7e70a$var$ColorPicker(props, ref) {
|
28
|
+
let swatchRef = (0, $5bRyn$useRef)(null);
|
29
|
+
let domRef = (0, $5bRyn$useFocusableRef)(ref);
|
30
|
+
let labelId = (0, $5bRyn$useId)();
|
31
|
+
return /*#__PURE__*/ (0, $5bRyn$react).createElement((0, $5bRyn$ColorPicker), props, /*#__PURE__*/ (0, $5bRyn$react).createElement((0, $5bRyn$DialogTrigger), {
|
32
|
+
type: "popover",
|
33
|
+
mobileType: "tray",
|
34
|
+
targetRef: (0, $5bRyn$unwrapDOMRef)(swatchRef)
|
35
|
+
}, /*#__PURE__*/ (0, $5bRyn$react).createElement((0, $5bRyn$Button), {
|
36
|
+
ref: domRef,
|
37
|
+
className: function anonymous(props) {
|
38
|
+
let rules = "";
|
39
|
+
rules += " ba";
|
40
|
+
rules += " Af";
|
41
|
+
rules += " Ia";
|
42
|
+
rules += " Ja";
|
43
|
+
rules += " Ga";
|
44
|
+
rules += " Ha";
|
45
|
+
rules += " _Sd";
|
46
|
+
rules += " _Uc";
|
47
|
+
rules += " lM";
|
48
|
+
rules += " mM";
|
49
|
+
rules += " _Ea";
|
50
|
+
rules += " _5-bc1l9oh";
|
51
|
+
rules += " _5-1uotwbwg";
|
52
|
+
rules += " _5-eo0c6sf";
|
53
|
+
rules += " _5-enzzrge";
|
54
|
+
rules += " _5-enzykdd";
|
55
|
+
rules += " _5-enzwzjc";
|
56
|
+
rules += " _5-enzrfpb";
|
57
|
+
rules += " _5a";
|
58
|
+
rules += " a___K";
|
59
|
+
if (props.size === "L") rules += " _6d";
|
60
|
+
else if (props.size === "M") rules += " _6c";
|
61
|
+
else if (props.size === "S") rules += " _6b";
|
62
|
+
else if (props.size === "XS") rules += " _6a";
|
63
|
+
return rules;
|
64
|
+
}({
|
65
|
+
size: props.size || "M"
|
66
|
+
})
|
67
|
+
}, ({ isFocusVisible: isFocusVisible })=>/*#__PURE__*/ (0, $5bRyn$react).createElement((0, $5bRyn$react).Fragment, null, /*#__PURE__*/ (0, $5bRyn$react).createElement("div", {
|
68
|
+
className: function anonymous(props) {
|
69
|
+
let rules = "";
|
70
|
+
if (props.isFocusVisible) rules += " _Eb";
|
71
|
+
else rules += " _Ea";
|
72
|
+
rules += " da___D";
|
73
|
+
rules += " d___I";
|
74
|
+
rules += " _Gc";
|
75
|
+
rules += " _Fc";
|
76
|
+
rules += " _pc";
|
77
|
+
rules += " _qc";
|
78
|
+
rules += " _rc";
|
79
|
+
rules += " _sc";
|
80
|
+
return rules;
|
81
|
+
}({
|
82
|
+
isFocusVisible: isFocusVisible
|
83
|
+
})
|
84
|
+
}, /*#__PURE__*/ (0, $5bRyn$react).createElement((0, $d68786ae409fa722$export$cae13e90592f246a), {
|
85
|
+
ref: swatchRef,
|
86
|
+
size: props.size,
|
87
|
+
rounding: props.rounding,
|
88
|
+
"aria-label": props["aria-label"],
|
89
|
+
"aria-labelledby": props["aria-labelledby"],
|
90
|
+
"aria-describedby": props["aria-describedby"],
|
91
|
+
"aria-details": props["aria-details"]
|
92
|
+
})), props.label && /*#__PURE__*/ (0, $5bRyn$react).createElement("span", {
|
93
|
+
id: labelId
|
94
|
+
}, props.label))), /*#__PURE__*/ (0, $5bRyn$react).createElement((0, $5bRyn$Dialog), {
|
95
|
+
"aria-labelledby": props.label ? labelId : props["aria-labelledby"],
|
96
|
+
"aria-label": props["aria-label"],
|
97
|
+
UNSAFE_style: {
|
98
|
+
width: "fit-content",
|
99
|
+
minWidth: 0,
|
100
|
+
margin: "0 auto" // Center within tray.
|
101
|
+
}
|
102
|
+
}, /*#__PURE__*/ (0, $5bRyn$react).createElement((0, $5bRyn$Content), {
|
103
|
+
UNSAFE_style: {
|
104
|
+
position: "relative",
|
105
|
+
margin: "calc(var(--spectrum-dialog-padding) * -1)",
|
106
|
+
padding: "var(--spectrum-global-dimension-size-200)"
|
107
|
+
}
|
108
|
+
}, props.children))));
|
109
|
+
}
|
110
|
+
/**
|
111
|
+
* A ColorPicker combines a swatch with a customizable popover for editing a color.
|
112
|
+
*/ let $d9654c66f3a7e70a$export$9feb1bc2e5f1ccb3 = /*#__PURE__*/ (0, $5bRyn$react).forwardRef($d9654c66f3a7e70a$var$ColorPicker);
|
113
|
+
|
114
|
+
|
115
|
+
export {$d9654c66f3a7e70a$export$9feb1bc2e5f1ccb3 as ColorPicker};
|
116
|
+
//# sourceMappingURL=ColorPicker.mjs.map
|
@@ -0,0 +1,116 @@
|
|
1
|
+
import "./ColorPicker.ab9f47c0.css";
|
2
|
+
import {ColorSwatch as $d68786ae409fa722$export$cae13e90592f246a} from "./ColorSwatch.module.js";
|
3
|
+
import {ColorPicker as $5bRyn$ColorPicker, Button as $5bRyn$Button} from "react-aria-components";
|
4
|
+
import {Content as $5bRyn$Content} from "@react-spectrum/view";
|
5
|
+
import {DialogTrigger as $5bRyn$DialogTrigger, Dialog as $5bRyn$Dialog} from "@react-spectrum/dialog";
|
6
|
+
import $5bRyn$react, {useRef as $5bRyn$useRef} from "react";
|
7
|
+
import {useFocusableRef as $5bRyn$useFocusableRef, unwrapDOMRef as $5bRyn$unwrapDOMRef} from "@react-spectrum/utils";
|
8
|
+
import {useId as $5bRyn$useId} from "@react-aria/utils";
|
9
|
+
|
10
|
+
/*
|
11
|
+
* Copyright 2024 Adobe. All rights reserved.
|
12
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
13
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
14
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
15
|
+
*
|
16
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
17
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
18
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
19
|
+
* governing permissions and limitations under the License.
|
20
|
+
*/
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
function $d9654c66f3a7e70a$var$ColorPicker(props, ref) {
|
28
|
+
let swatchRef = (0, $5bRyn$useRef)(null);
|
29
|
+
let domRef = (0, $5bRyn$useFocusableRef)(ref);
|
30
|
+
let labelId = (0, $5bRyn$useId)();
|
31
|
+
return /*#__PURE__*/ (0, $5bRyn$react).createElement((0, $5bRyn$ColorPicker), props, /*#__PURE__*/ (0, $5bRyn$react).createElement((0, $5bRyn$DialogTrigger), {
|
32
|
+
type: "popover",
|
33
|
+
mobileType: "tray",
|
34
|
+
targetRef: (0, $5bRyn$unwrapDOMRef)(swatchRef)
|
35
|
+
}, /*#__PURE__*/ (0, $5bRyn$react).createElement((0, $5bRyn$Button), {
|
36
|
+
ref: domRef,
|
37
|
+
className: function anonymous(props) {
|
38
|
+
let rules = "";
|
39
|
+
rules += " ba";
|
40
|
+
rules += " Af";
|
41
|
+
rules += " Ia";
|
42
|
+
rules += " Ja";
|
43
|
+
rules += " Ga";
|
44
|
+
rules += " Ha";
|
45
|
+
rules += " _Sd";
|
46
|
+
rules += " _Uc";
|
47
|
+
rules += " lM";
|
48
|
+
rules += " mM";
|
49
|
+
rules += " _Ea";
|
50
|
+
rules += " _5-bc1l9oh";
|
51
|
+
rules += " _5-1uotwbwg";
|
52
|
+
rules += " _5-eo0c6sf";
|
53
|
+
rules += " _5-enzzrge";
|
54
|
+
rules += " _5-enzykdd";
|
55
|
+
rules += " _5-enzwzjc";
|
56
|
+
rules += " _5-enzrfpb";
|
57
|
+
rules += " _5a";
|
58
|
+
rules += " a___K";
|
59
|
+
if (props.size === "L") rules += " _6d";
|
60
|
+
else if (props.size === "M") rules += " _6c";
|
61
|
+
else if (props.size === "S") rules += " _6b";
|
62
|
+
else if (props.size === "XS") rules += " _6a";
|
63
|
+
return rules;
|
64
|
+
}({
|
65
|
+
size: props.size || "M"
|
66
|
+
})
|
67
|
+
}, ({ isFocusVisible: isFocusVisible })=>/*#__PURE__*/ (0, $5bRyn$react).createElement((0, $5bRyn$react).Fragment, null, /*#__PURE__*/ (0, $5bRyn$react).createElement("div", {
|
68
|
+
className: function anonymous(props) {
|
69
|
+
let rules = "";
|
70
|
+
if (props.isFocusVisible) rules += " _Eb";
|
71
|
+
else rules += " _Ea";
|
72
|
+
rules += " da___D";
|
73
|
+
rules += " d___I";
|
74
|
+
rules += " _Gc";
|
75
|
+
rules += " _Fc";
|
76
|
+
rules += " _pc";
|
77
|
+
rules += " _qc";
|
78
|
+
rules += " _rc";
|
79
|
+
rules += " _sc";
|
80
|
+
return rules;
|
81
|
+
}({
|
82
|
+
isFocusVisible: isFocusVisible
|
83
|
+
})
|
84
|
+
}, /*#__PURE__*/ (0, $5bRyn$react).createElement((0, $d68786ae409fa722$export$cae13e90592f246a), {
|
85
|
+
ref: swatchRef,
|
86
|
+
size: props.size,
|
87
|
+
rounding: props.rounding,
|
88
|
+
"aria-label": props["aria-label"],
|
89
|
+
"aria-labelledby": props["aria-labelledby"],
|
90
|
+
"aria-describedby": props["aria-describedby"],
|
91
|
+
"aria-details": props["aria-details"]
|
92
|
+
})), props.label && /*#__PURE__*/ (0, $5bRyn$react).createElement("span", {
|
93
|
+
id: labelId
|
94
|
+
}, props.label))), /*#__PURE__*/ (0, $5bRyn$react).createElement((0, $5bRyn$Dialog), {
|
95
|
+
"aria-labelledby": props.label ? labelId : props["aria-labelledby"],
|
96
|
+
"aria-label": props["aria-label"],
|
97
|
+
UNSAFE_style: {
|
98
|
+
width: "fit-content",
|
99
|
+
minWidth: 0,
|
100
|
+
margin: "0 auto" // Center within tray.
|
101
|
+
}
|
102
|
+
}, /*#__PURE__*/ (0, $5bRyn$react).createElement((0, $5bRyn$Content), {
|
103
|
+
UNSAFE_style: {
|
104
|
+
position: "relative",
|
105
|
+
margin: "calc(var(--spectrum-dialog-padding) * -1)",
|
106
|
+
padding: "var(--spectrum-global-dimension-size-200)"
|
107
|
+
}
|
108
|
+
}, props.children))));
|
109
|
+
}
|
110
|
+
/**
|
111
|
+
* A ColorPicker combines a swatch with a customizable popover for editing a color.
|
112
|
+
*/ let $d9654c66f3a7e70a$export$9feb1bc2e5f1ccb3 = /*#__PURE__*/ (0, $5bRyn$react).forwardRef($d9654c66f3a7e70a$var$ColorPicker);
|
113
|
+
|
114
|
+
|
115
|
+
export {$d9654c66f3a7e70a$export$9feb1bc2e5f1ccb3 as ColorPicker};
|
116
|
+
//# sour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,GACD,IAAI,0DAAe,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/color/src/ColorPicker.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 {ColorPicker as AriaColorPicker, Button, Color} from 'react-aria-components';\nimport {AriaLabelingProps, FocusableRef, ValueBase} from '@react-types/shared';\nimport {ColorSwatch} from './ColorSwatch';\nimport {Content} from '@react-spectrum/view';\nimport {Dialog, DialogTrigger} from '@react-spectrum/dialog';\nimport React, {ReactNode, useRef} from 'react';\nimport {style} from '@react-spectrum/style-macro-s1' with {type: 'macro'};\nimport {unwrapDOMRef, useFocusableRef} from '@react-spectrum/utils';\nimport {useId} from '@react-aria/utils';\n\nexport interface SpectrumColorPickerProps extends ValueBase<string | Color, Color>, AriaLabelingProps {\n /** A visual label for the color picker. */\n label?: ReactNode,\n /** The contents of the color picker popover, e.g. `<ColorEditor />`. */\n children?: ReactNode,\n /**\n * The size of the color swatch.\n * @default \"M\"\n */\n size?: 'XS' | 'S' | 'M' | 'L',\n /**\n * The corner rounding of the color swatch.\n * @default \"default\"\n */\n rounding?: 'default' | 'none' | 'full'\n}\n\nfunction ColorPicker(props: SpectrumColorPickerProps, ref: FocusableRef<HTMLButtonElement>) {\n let swatchRef = useRef(null);\n let domRef = useFocusableRef(ref);\n let labelId = useId();\n return (\n <AriaColorPicker {...props}>\n <DialogTrigger type=\"popover\" mobileType=\"tray\" targetRef={unwrapDOMRef(swatchRef)}>\n <Button \n ref={domRef}\n className={style({\n backgroundColor: 'transparent',\n borderStyle: 'none',\n padding: 0,\n display: 'flex',\n alignItems: 'center',\n gap: 'text-to-control',\n outlineStyle: 'none',\n fontFamily: 'sans',\n color: 'body',\n fontSize: {\n size: {\n XS: 'xs',\n S: 'sm',\n M: 'base',\n L: 'lg'\n }\n }\n })({size: props.size || 'M'})}>\n {({isFocusVisible}) => (\n <>\n <div\n className={style({\n outlineStyle: {\n default: 'none',\n isFocusVisible: 'solid'\n },\n outlineColor: 'focus-ring',\n outlineWidth: 2,\n outlineOffset: 2,\n borderRadius: 'default'\n })({isFocusVisible})}>\n <ColorSwatch\n ref={swatchRef}\n size={props.size}\n rounding={props.rounding}\n aria-label={props['aria-label']}\n aria-labelledby={props['aria-labelledby']}\n aria-describedby={props['aria-describedby']}\n aria-details={props['aria-details']} />\n </div>\n {props.label && \n <span id={labelId}>{props.label}</span>\n }\n </>\n )}\n </Button>\n <Dialog \n aria-labelledby={props.label ? labelId : props['aria-labelledby']}\n aria-label={props['aria-label']}\n UNSAFE_style={{\n width: 'fit-content',\n minWidth: 0,\n margin: '0 auto' // Center within tray.\n }}>\n <Content \n UNSAFE_style={{\n position: 'relative',\n margin: 'calc(var(--spectrum-dialog-padding) * -1)',\n padding: 'var(--spectrum-global-dimension-size-200)'\n }}>\n {props.children}\n </Content>\n </Dialog>\n </DialogTrigger>\n </AriaColorPicker>\n );\n}\n\n/**\n * A ColorPicker combines a swatch with a customizable popover for editing a color.\n */\nlet _ColorPicker = React.forwardRef(ColorPicker);\nexport {_ColorPicker as ColorPicker};\n"],"names":[],"version":3,"file":"ColorPicker.module.js.map"}
|
package/dist/ColorSlider.main.js
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
var $2b9adc23f6c7cae1$exports = require("./ColorThumb.main.js");
|
2
|
-
require("./vars.
|
2
|
+
require("./vars.aa07b6d2.css");
|
3
3
|
var $28060baf29cc5ac7$exports = require("./colorslider_vars_css.main.js");
|
4
4
|
var $5EHW1$reactspectrumutils = require("@react-spectrum/utils");
|
5
|
+
var $5EHW1$reactariacomponents = require("react-aria-components");
|
5
6
|
var $5EHW1$reactspectrumlabel = require("@react-spectrum/label");
|
6
7
|
var $5EHW1$react = require("react");
|
7
8
|
var $5EHW1$reactariacolor = require("@react-aria/color");
|
@@ -40,15 +41,17 @@ $parcel$export(module.exports, "ColorSlider", () => $4537dec0de08c277$export$44f
|
|
40
41
|
|
41
42
|
|
42
43
|
|
44
|
+
|
43
45
|
function $4537dec0de08c277$var$ColorSlider(props, ref) {
|
44
46
|
props = (0, $5EHW1$reactspectrumprovider.useProviderProps)(props);
|
47
|
+
let inputRef = (0, $5EHW1$react.useRef)(null);
|
48
|
+
let trackRef = (0, $5EHW1$react.useRef)(null);
|
49
|
+
let domRef = (0, $5EHW1$reactspectrumutils.useFocusableRef)(ref, inputRef);
|
50
|
+
[props, domRef] = (0, $5EHW1$reactariacomponents.useContextProps)(props, domRef, (0, $5EHW1$reactariacomponents.ColorSliderContext));
|
45
51
|
let { isDisabled: isDisabled, channel: channel, orientation: orientation, label: label, showValueLabel: showValueLabel, "aria-label": ariaLabel } = props;
|
46
52
|
let vertical = orientation === "vertical";
|
47
53
|
let { styleProps: styleProps } = (0, $5EHW1$reactspectrumutils.useStyleProps)(props);
|
48
54
|
let { locale: locale } = (0, $5EHW1$reactariai18n.useLocale)();
|
49
|
-
let inputRef = (0, $5EHW1$react.useRef)(null);
|
50
|
-
let trackRef = (0, $5EHW1$react.useRef)(null);
|
51
|
-
let domRef = (0, $5EHW1$reactspectrumutils.useFocusableRef)(ref, inputRef);
|
52
55
|
let state = (0, $5EHW1$reactstatelycolor.useColorSliderState)({
|
53
56
|
...props,
|
54
57
|
locale: locale
|
@@ -108,6 +111,7 @@ function $4537dec0de08c277$var$ColorSlider(props, ref) {
|
|
108
111
|
isFocused: isFocused && isFocusVisible,
|
109
112
|
isDisabled: isDisabled,
|
110
113
|
isDragging: state.isThumbDragging(0),
|
114
|
+
containerRef: trackRef,
|
111
115
|
className: (0, $5EHW1$reactspectrumutils.classNames)((0, ($parcel$interopDefault($28060baf29cc5ac7$exports))), "spectrum-ColorSlider-handle"),
|
112
116
|
...thumbProps
|
113
117
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($5EHW1$react))).createElement("input", {
|
@@ -1 +1 @@
|
|
1
|
-
{"mappings":"
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;AAgBD,SAAS,kCAAY,KAA+B,EAAE,GAAiC;IACrF,QAAQ,CAAA,GAAA,6CAAe,EAAE;IACzB,IAAI,WAAW,CAAA,GAAA,mBAAK,EAAE;IACtB,IAAI,WAAW,CAAA,GAAA,mBAAK,EAAE;IACtB,IAAI,SAAS,CAAA,GAAA,yCAAc,EAAE,KAAK;IAClC,CAAC,OAAO,OAAO,GAAG,CAAA,GAAA,0CAAc,EAAE,OAAO,QAAQ,CAAA,GAAA,6CAAiB;IAElE,IAAI,cACF,UAAU,WACV,OAAO,eACP,WAAW,SACX,KAAK,kBACL,cAAc,EACd,cAAc,SAAS,EACxB,GAAG;IACJ,IAAI,WAAW,gBAAgB;IAE/B,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,uCAAY,EAAE;IACjC,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,8BAAQ;IAEvB,IAAI,QAAQ,CAAA,GAAA,4CAAkB,EAAE;QAAC,GAAG,KAAK;gBAAE;IAAM;IAEjD,wEAAwE;IACxE,IAAI,YAAY,OAAO;QACrB,YAAY,aAAc,CAAA,OAAO,UAAU,WAAW,QAAQ,SAAQ;QACtE,QAAQ;IACV;IAEA,mEAAmE;IACnE,qDAAqD;IACrD,8FAA8F;IAC9F,mEAAmE;IACnE,IAAI,UAAU,aAAa,CAAC,aAAa,CAAC,KAAK,CAAC,kBAAkB,IAAI,CAAC,UACrE,QAAQ,MAAM,KAAK,CAAC,cAAc,CAAC,SAAS;IAG9C,8DAA8D;IAC9D,IAAI,kBAAkB,MACpB,iBAAiB,CAAC,CA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;QACZ,YAAY,MAAM,eAAe,CAAC;QAClC,cAAc;QACd,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;QAC7B,GAAG,UAAU;qBACd,0DAAC;QAAO,GAAG,UAAU;QAAG,GAAG,UAAU;QAAE,KAAK;QAAU,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;;AAK9F;AAEA;;CAEC,GACD,IAAI,0DAAe,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/color/src/ColorSlider.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, SlotProvider, useFocusableRef, useStyleProps} from '@react-spectrum/utils';\nimport {ColorSliderContext, useContextProps} from 'react-aria-components';\nimport {ColorThumb} from './ColorThumb';\nimport {FocusableRef} from '@react-types/shared';\nimport {Label} from '@react-spectrum/label';\nimport React, {useRef, useState} from 'react';\nimport {SpectrumColorSliderProps} from '@react-types/color';\nimport styles from '@adobe/spectrum-css-temp/components/colorslider/vars.css';\nimport {useColorSlider} from '@react-aria/color';\nimport {useColorSliderState} from '@react-stately/color';\nimport {useFocus, useFocusVisible} from '@react-aria/interactions';\nimport {useLocale} from '@react-aria/i18n';\nimport {useProviderProps} from '@react-spectrum/provider';\n\nfunction ColorSlider(props: SpectrumColorSliderProps, ref: FocusableRef<HTMLDivElement>) {\n props = useProviderProps(props);\n let inputRef = useRef(null);\n let trackRef = useRef(null);\n let domRef = useFocusableRef(ref, inputRef);\n [props, domRef] = useContextProps(props, domRef, ColorSliderContext);\n\n let {\n isDisabled,\n channel,\n orientation,\n label,\n showValueLabel,\n 'aria-label': ariaLabel\n } = props;\n let vertical = orientation === 'vertical';\n\n let {styleProps} = useStyleProps(props);\n let {locale} = useLocale();\n\n let state = useColorSliderState({...props, locale});\n\n // If vertical and a label is provided, use it as an aria-label instead.\n if (vertical && label) {\n ariaLabel = ariaLabel || (typeof label === 'string' ? label : undefined);\n label = null;\n }\n\n // If no external label, aria-label or aria-labelledby is provided,\n // default to displaying the localized channel value.\n // Specifically check if label is undefined. If label is `null` then display no visible label.\n // A default aria-label is provided by useColorSlider in that case.\n if (label === undefined && !ariaLabel && !props['aria-labelledby'] && !vertical) {\n label = state.value.getChannelName(channel, locale);\n }\n\n // Show the value label by default if there is a visible label\n if (showValueLabel == null) {\n showValueLabel = !!label;\n }\n\n let {inputProps, thumbProps, trackProps, labelProps, outputProps} = useColorSlider({\n ...props,\n label,\n 'aria-label': ariaLabel,\n trackRef,\n inputRef\n }, state);\n\n let {isFocusVisible} = useFocusVisible();\n let [isFocused, setIsFocused] = useState(false);\n let {focusProps} = useFocus({\n isDisabled,\n onFocusChange: setIsFocused\n });\n\n return (\n <div\n ref={domRef}\n {...styleProps}\n className={classNames(\n styles,\n {\n 'spectrum-ColorSlider-container--horizontal': !vertical,\n 'spectrum-ColorSlider-container--vertical': vertical\n }\n )}>\n {label &&\n <div className={classNames(styles, 'spectrum-ColorSlider-labelContainer')}>\n <Label {...labelProps}>{label}</Label>\n {props.contextualHelp &&\n <SlotProvider\n slots={{\n actionButton: {\n UNSAFE_className: classNames(styles, 'spectrum-ColorSlider-contextualHelp')\n }\n }}>\n {props.contextualHelp}\n </SlotProvider>\n }\n {showValueLabel && (\n <Label elementType=\"span\" UNSAFE_className={classNames(styles, 'spectrum-ColorSlider-valueLabel')}>\n <output {...outputProps}>{state.value.formatChannelValue(channel, locale)}</output>\n </Label>\n )}\n </div>\n }\n <div\n {...trackProps}\n ref={trackRef}\n className={classNames(\n styles,\n 'spectrum-ColorSlider', {\n 'is-disabled': isDisabled,\n 'spectrum-ColorSlider--vertical': vertical\n }\n )\n }>\n <ColorThumb\n value={state.getDisplayColor()}\n isFocused={isFocused && isFocusVisible}\n isDisabled={isDisabled}\n isDragging={state.isThumbDragging(0)}\n containerRef={trackRef}\n className={classNames(styles, 'spectrum-ColorSlider-handle')}\n {...thumbProps}>\n <input {...inputProps} {...focusProps} ref={inputRef} className={classNames(styles, 'spectrum-ColorSlider-slider')} />\n </ColorThumb>\n </div>\n </div>\n );\n}\n\n/**\n * ColorSliders allow users to adjust an individual channel of a color value.\n */\nlet _ColorSlider = React.forwardRef(ColorSlider);\nexport {_ColorSlider as ColorSlider};\n"],"names":[],"version":3,"file":"ColorSlider.main.js.map"}
|
package/dist/ColorSlider.mjs
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
import {ColorThumb as $3a90e89d07d7bbd5$export$a3cc47cee1c1ccc} from "./ColorThumb.mjs";
|
2
|
-
import "./vars.
|
2
|
+
import "./vars.aa07b6d2.css";
|
3
3
|
import $fxUYb$colorslider_vars_cssmodulejs from "./colorslider_vars_css.mjs";
|
4
|
-
import {
|
4
|
+
import {useFocusableRef as $fxUYb$useFocusableRef, useStyleProps as $fxUYb$useStyleProps, classNames as $fxUYb$classNames, SlotProvider as $fxUYb$SlotProvider} from "@react-spectrum/utils";
|
5
|
+
import {useContextProps as $fxUYb$useContextProps, ColorSliderContext as $fxUYb$ColorSliderContext} from "react-aria-components";
|
5
6
|
import {Label as $fxUYb$Label} from "@react-spectrum/label";
|
6
7
|
import $fxUYb$react, {useRef as $fxUYb$useRef, useState as $fxUYb$useState} from "react";
|
7
8
|
import {useColorSlider as $fxUYb$useColorSlider} from "@react-aria/color";
|
@@ -34,15 +35,17 @@ function $parcel$interopDefault(a) {
|
|
34
35
|
|
35
36
|
|
36
37
|
|
38
|
+
|
37
39
|
function $3870e4ce67ed7ee1$var$ColorSlider(props, ref) {
|
38
40
|
props = (0, $fxUYb$useProviderProps)(props);
|
41
|
+
let inputRef = (0, $fxUYb$useRef)(null);
|
42
|
+
let trackRef = (0, $fxUYb$useRef)(null);
|
43
|
+
let domRef = (0, $fxUYb$useFocusableRef)(ref, inputRef);
|
44
|
+
[props, domRef] = (0, $fxUYb$useContextProps)(props, domRef, (0, $fxUYb$ColorSliderContext));
|
39
45
|
let { isDisabled: isDisabled, channel: channel, orientation: orientation, label: label, showValueLabel: showValueLabel, "aria-label": ariaLabel } = props;
|
40
46
|
let vertical = orientation === "vertical";
|
41
47
|
let { styleProps: styleProps } = (0, $fxUYb$useStyleProps)(props);
|
42
48
|
let { locale: locale } = (0, $fxUYb$useLocale)();
|
43
|
-
let inputRef = (0, $fxUYb$useRef)(null);
|
44
|
-
let trackRef = (0, $fxUYb$useRef)(null);
|
45
|
-
let domRef = (0, $fxUYb$useFocusableRef)(ref, inputRef);
|
46
49
|
let state = (0, $fxUYb$useColorSliderState)({
|
47
50
|
...props,
|
48
51
|
locale: locale
|
@@ -102,6 +105,7 @@ function $3870e4ce67ed7ee1$var$ColorSlider(props, ref) {
|
|
102
105
|
isFocused: isFocused && isFocusVisible,
|
103
106
|
isDisabled: isDisabled,
|
104
107
|
isDragging: state.isThumbDragging(0),
|
108
|
+
containerRef: trackRef,
|
105
109
|
className: (0, $fxUYb$classNames)((0, ($parcel$interopDefault($fxUYb$colorslider_vars_cssmodulejs))), "spectrum-ColorSlider-handle"),
|
106
110
|
...thumbProps
|
107
111
|
}, /*#__PURE__*/ (0, $fxUYb$react).createElement("input", {
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import {ColorThumb as $3a90e89d07d7bbd5$export$a3cc47cee1c1ccc} from "./ColorThumb.module.js";
|
2
|
-
import "./vars.
|
2
|
+
import "./vars.aa07b6d2.css";
|
3
3
|
import $fxUYb$colorslider_vars_cssmodulejs from "./colorslider_vars_css.module.js";
|
4
|
-
import {
|
4
|
+
import {useFocusableRef as $fxUYb$useFocusableRef, useStyleProps as $fxUYb$useStyleProps, classNames as $fxUYb$classNames, SlotProvider as $fxUYb$SlotProvider} from "@react-spectrum/utils";
|
5
|
+
import {useContextProps as $fxUYb$useContextProps, ColorSliderContext as $fxUYb$ColorSliderContext} from "react-aria-components";
|
5
6
|
import {Label as $fxUYb$Label} from "@react-spectrum/label";
|
6
7
|
import $fxUYb$react, {useRef as $fxUYb$useRef, useState as $fxUYb$useState} from "react";
|
7
8
|
import {useColorSlider as $fxUYb$useColorSlider} from "@react-aria/color";
|
@@ -34,15 +35,17 @@ function $parcel$interopDefault(a) {
|
|
34
35
|
|
35
36
|
|
36
37
|
|
38
|
+
|
37
39
|
function $3870e4ce67ed7ee1$var$ColorSlider(props, ref) {
|
38
40
|
props = (0, $fxUYb$useProviderProps)(props);
|
41
|
+
let inputRef = (0, $fxUYb$useRef)(null);
|
42
|
+
let trackRef = (0, $fxUYb$useRef)(null);
|
43
|
+
let domRef = (0, $fxUYb$useFocusableRef)(ref, inputRef);
|
44
|
+
[props, domRef] = (0, $fxUYb$useContextProps)(props, domRef, (0, $fxUYb$ColorSliderContext));
|
39
45
|
let { isDisabled: isDisabled, channel: channel, orientation: orientation, label: label, showValueLabel: showValueLabel, "aria-label": ariaLabel } = props;
|
40
46
|
let vertical = orientation === "vertical";
|
41
47
|
let { styleProps: styleProps } = (0, $fxUYb$useStyleProps)(props);
|
42
48
|
let { locale: locale } = (0, $fxUYb$useLocale)();
|
43
|
-
let inputRef = (0, $fxUYb$useRef)(null);
|
44
|
-
let trackRef = (0, $fxUYb$useRef)(null);
|
45
|
-
let domRef = (0, $fxUYb$useFocusableRef)(ref, inputRef);
|
46
49
|
let state = (0, $fxUYb$useColorSliderState)({
|
47
50
|
...props,
|
48
51
|
locale: locale
|
@@ -102,6 +105,7 @@ function $3870e4ce67ed7ee1$var$ColorSlider(props, ref) {
|
|
102
105
|
isFocused: isFocused && isFocusVisible,
|
103
106
|
isDisabled: isDisabled,
|
104
107
|
isDragging: state.isThumbDragging(0),
|
108
|
+
containerRef: trackRef,
|
105
109
|
className: (0, $fxUYb$classNames)((0, ($parcel$interopDefault($fxUYb$colorslider_vars_cssmodulejs))), "spectrum-ColorSlider-handle"),
|
106
110
|
...thumbProps
|
107
111
|
}, /*#__PURE__*/ (0, $fxUYb$react).createElement("input", {
|
@@ -1 +1 @@
|
|
1
|
-
{"mappings":"
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;AAgBD,SAAS,kCAAY,KAA+B,EAAE,GAAiC;IACrF,QAAQ,CAAA,GAAA,uBAAe,EAAE;IACzB,IAAI,WAAW,CAAA,GAAA,aAAK,EAAE;IACtB,IAAI,WAAW,CAAA,GAAA,aAAK,EAAE;IACtB,IAAI,SAAS,CAAA,GAAA,sBAAc,EAAE,KAAK;IAClC,CAAC,OAAO,OAAO,GAAG,CAAA,GAAA,sBAAc,EAAE,OAAO,QAAQ,CAAA,GAAA,yBAAiB;IAElE,IAAI,cACF,UAAU,WACV,OAAO,eACP,WAAW,SACX,KAAK,kBACL,cAAc,EACd,cAAc,SAAS,EACxB,GAAG;IACJ,IAAI,WAAW,gBAAgB;IAE/B,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,oBAAY,EAAE;IACjC,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,gBAAQ;IAEvB,IAAI,QAAQ,CAAA,GAAA,0BAAkB,EAAE;QAAC,GAAG,KAAK;gBAAE;IAAM;IAEjD,wEAAwE;IACxE,IAAI,YAAY,OAAO;QACrB,YAAY,aAAc,CAAA,OAAO,UAAU,WAAW,QAAQ,SAAQ;QACtE,QAAQ;IACV;IAEA,mEAAmE;IACnE,qDAAqD;IACrD,8FAA8F;IAC9F,mEAAmE;IACnE,IAAI,UAAU,aAAa,CAAC,aAAa,CAAC,KAAK,CAAC,kBAAkB,IAAI,CAAC,UACrE,QAAQ,MAAM,KAAK,CAAC,cAAc,CAAC,SAAS;IAG9C,8DAA8D;IAC9D,IAAI,kBAAkB,MACpB,iBA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xB,YAAY;QACZ,YAAY,MAAM,eAAe,CAAC;QAClC,cAAc;QACd,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,6DAAK,GAAG;QAC7B,GAAG,UAAU;qBACd,gCAAC;QAAO,GAAG,UAAU;QAAG,GAAG,UAAU;QAAE,KAAK;QAAU,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,6DAAK,GAAG;;AAK9F;AAEA;;CAEC,GACD,IAAI,0DAAe,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/color/src/ColorSlider.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, SlotProvider, useFocusableRef, useStyleProps} from '@react-spectrum/utils';\nimport {ColorSliderContext, useContextProps} from 'react-aria-components';\nimport {ColorThumb} from './ColorThumb';\nimport {FocusableRef} from '@react-types/shared';\nimport {Label} from '@react-spectrum/label';\nimport React, {useRef, useState} from 'react';\nimport {SpectrumColorSliderProps} from '@react-types/color';\nimport styles from '@adobe/spectrum-css-temp/components/colorslider/vars.css';\nimport {useColorSlider} from '@react-aria/color';\nimport {useColorSliderState} from '@react-stately/color';\nimport {useFocus, useFocusVisible} from '@react-aria/interactions';\nimport {useLocale} from '@react-aria/i18n';\nimport {useProviderProps} from '@react-spectrum/provider';\n\nfunction ColorSlider(props: SpectrumColorSliderProps, ref: FocusableRef<HTMLDivElement>) {\n props = useProviderProps(props);\n let inputRef = useRef(null);\n let trackRef = useRef(null);\n let domRef = useFocusableRef(ref, inputRef);\n [props, domRef] = useContextProps(props, domRef, ColorSliderContext);\n\n let {\n isDisabled,\n channel,\n orientation,\n label,\n showValueLabel,\n 'aria-label': ariaLabel\n } = props;\n let vertical = orientation === 'vertical';\n\n let {styleProps} = useStyleProps(props);\n let {locale} = useLocale();\n\n let state = useColorSliderState({...props, locale});\n\n // If vertical and a label is provided, use it as an aria-label instead.\n if (vertical && label) {\n ariaLabel = ariaLabel || (typeof label === 'string' ? label : undefined);\n label = null;\n }\n\n // If no external label, aria-label or aria-labelledby is provided,\n // default to displaying the localized channel value.\n // Specifically check if label is undefined. If label is `null` then display no visible label.\n // A default aria-label is provided by useColorSlider in that case.\n if (label === undefined && !ariaLabel && !props['aria-labelledby'] && !vertical) {\n label = state.value.getChannelName(channel, locale);\n }\n\n // Show the value label by default if there is a visible label\n if (showValueLabel == null) {\n showValueLabel = !!label;\n }\n\n let {inputProps, thumbProps, trackProps, labelProps, outputProps} = useColorSlider({\n ...props,\n label,\n 'aria-label': ariaLabel,\n trackRef,\n inputRef\n }, state);\n\n let {isFocusVisible} = useFocusVisible();\n let [isFocused, setIsFocused] = useState(false);\n let {focusProps} = useFocus({\n isDisabled,\n onFocusChange: setIsFocused\n });\n\n return (\n <div\n ref={domRef}\n {...styleProps}\n className={classNames(\n styles,\n {\n 'spectrum-ColorSlider-container--horizontal': !vertical,\n 'spectrum-ColorSlider-container--vertical': vertical\n }\n )}>\n {label &&\n <div className={classNames(styles, 'spectrum-ColorSlider-labelContainer')}>\n <Label {...labelProps}>{label}</Label>\n {props.contextualHelp &&\n <SlotProvider\n slots={{\n actionButton: {\n UNSAFE_className: classNames(styles, 'spectrum-ColorSlider-contextualHelp')\n }\n }}>\n {props.contextualHelp}\n </SlotProvider>\n }\n {showValueLabel && (\n <Label elementType=\"span\" UNSAFE_className={classNames(styles, 'spectrum-ColorSlider-valueLabel')}>\n <output {...outputProps}>{state.value.formatChannelValue(channel, locale)}</output>\n </Label>\n )}\n </div>\n }\n <div\n {...trackProps}\n ref={trackRef}\n className={classNames(\n styles,\n 'spectrum-ColorSlider', {\n 'is-disabled': isDisabled,\n 'spectrum-ColorSlider--vertical': vertical\n }\n )\n }>\n <ColorThumb\n value={state.getDisplayColor()}\n isFocused={isFocused && isFocusVisible}\n isDisabled={isDisabled}\n isDragging={state.isThumbDragging(0)}\n containerRef={trackRef}\n className={classNames(styles, 'spectrum-ColorSlider-handle')}\n {...thumbProps}>\n <input {...inputProps} {...focusProps} ref={inputRef} className={classNames(styles, 'spectrum-ColorSlider-slider')} />\n </ColorThumb>\n </div>\n </div>\n );\n}\n\n/**\n * ColorSliders allow users to adjust an individual channel of a color value.\n */\nlet _ColorSlider = React.forwardRef(ColorSlider);\nexport {_ColorSlider as ColorSlider};\n"],"names":[],"version":3,"file":"ColorSlider.module.js.map"}
|