@react-spectrum/color 3.0.0-beta.6 → 3.0.0-beta.9
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/main.css +1 -2
- package/dist/main.js +583 -396
- package/dist/main.js.map +1 -1
- package/dist/module.js +565 -337
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +6 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +19 -19
- package/src/ColorArea.tsx +202 -0
- package/src/index.ts +1 -0
- package/dist/main.css.map +0 -1
package/dist/module.js
CHANGED
|
@@ -1,358 +1,586 @@
|
|
|
1
|
-
import { TextFieldBase } from "@react-spectrum/textfield";
|
|
2
|
-
import { useLocale } from "@react-aria/i18n";
|
|
3
|
-
import { useFocus, useFocusVisible } from "@react-aria/interactions";
|
|
4
|
-
import { Label } from "@react-spectrum/label";
|
|
5
|
-
import { Flex } from "@react-spectrum/layout";
|
|
6
|
-
import { useProviderProps } from "@react-spectrum/provider";
|
|
7
|
-
import { useFocusRing } from "@react-aria/focus";
|
|
8
|
-
import { useColorWheelState, useColorSliderState, useColorFieldState } from "@react-stately/color";
|
|
9
|
-
import { useColorWheel, useColorSlider, useColorField } from "@react-aria/color";
|
|
10
|
-
import { useId, useResizeObserver } from "@react-aria/utils";
|
|
11
|
-
import _react, { useCallback, useEffect, useRef, useState } from "react";
|
|
12
|
-
import _babelRuntimeHelpersEsmObjectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
13
|
-
import { classNames, dimensionValue, useFocusableRef, useStyleProps } from "@react-spectrum/utils";
|
|
14
|
-
import _babelRuntimeHelpersEsmExtends from "@babel/runtime/helpers/esm/extends";
|
|
15
1
|
import "./main.css";
|
|
2
|
+
import {dimensionValue as $kF0Zw$dimensionValue, useStyleProps as $kF0Zw$useStyleProps, useFocusableRef as $kF0Zw$useFocusableRef, classNames as $kF0Zw$classNames} from "@react-spectrum/utils";
|
|
3
|
+
import {mergeProps as $kF0Zw$mergeProps, useId as $kF0Zw$useId, useResizeObserver as $kF0Zw$useResizeObserver} from "@react-aria/utils";
|
|
4
|
+
import $kF0Zw$react, {useRef as $kF0Zw$useRef, useState as $kF0Zw$useState, useCallback as $kF0Zw$useCallback, useEffect as $kF0Zw$useEffect} from "react";
|
|
5
|
+
import {useColorArea as $kF0Zw$useColorArea, useColorWheel as $kF0Zw$useColorWheel, useColorSlider as $kF0Zw$useColorSlider, useColorField as $kF0Zw$useColorField} from "@react-aria/color";
|
|
6
|
+
import {useColorAreaState as $kF0Zw$useColorAreaState, useColorWheelState as $kF0Zw$useColorWheelState, useColorSliderState as $kF0Zw$useColorSliderState, useColorFieldState as $kF0Zw$useColorFieldState} from "@react-stately/color";
|
|
7
|
+
import {useFocusRing as $kF0Zw$useFocusRing} from "@react-aria/focus";
|
|
8
|
+
import {useLocale as $kF0Zw$useLocale} from "@react-aria/i18n";
|
|
9
|
+
import {useProviderProps as $kF0Zw$useProviderProps} from "@react-spectrum/provider";
|
|
10
|
+
import {Flex as $kF0Zw$Flex} from "@react-spectrum/layout";
|
|
11
|
+
import {Label as $kF0Zw$Label} from "@react-spectrum/label";
|
|
12
|
+
import {useFocusVisible as $kF0Zw$useFocusVisible, useFocus as $kF0Zw$useFocus} from "@react-aria/interactions";
|
|
13
|
+
import {TextFieldBase as $kF0Zw$TextFieldBase} from "@react-spectrum/textfield";
|
|
16
14
|
|
|
17
15
|
function $parcel$interopDefault(a) {
|
|
18
16
|
return a && a.__esModule ? a.default : a;
|
|
19
17
|
}
|
|
18
|
+
function $parcel$export(e, n, v, s) {
|
|
19
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
20
|
+
}
|
|
21
|
+
var $40046aa1a7ccb226$exports = {};
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
$
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
23
|
+
$parcel$export($40046aa1a7ccb226$exports, "ColorArea", () => $40046aa1a7ccb226$export$b2103f68a961418e);
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
var $9d103974e3e19727$exports = {};
|
|
28
|
+
|
|
29
|
+
$parcel$export($9d103974e3e19727$exports, "spectrum-ColorHandle", () => $9d103974e3e19727$export$cd9afaa621b6216f, (v) => $9d103974e3e19727$export$cd9afaa621b6216f = v);
|
|
30
|
+
$parcel$export($9d103974e3e19727$exports, "is-focused", () => $9d103974e3e19727$export$e7dc768d35940237, (v) => $9d103974e3e19727$export$e7dc768d35940237 = v);
|
|
31
|
+
$parcel$export($9d103974e3e19727$exports, "focus-ring", () => $9d103974e3e19727$export$f39a09f249340e2a, (v) => $9d103974e3e19727$export$f39a09f249340e2a = v);
|
|
32
|
+
$parcel$export($9d103974e3e19727$exports, "is-disabled", () => $9d103974e3e19727$export$d35bc1e505d1ebbf, (v) => $9d103974e3e19727$export$d35bc1e505d1ebbf = v);
|
|
33
|
+
$parcel$export($9d103974e3e19727$exports, "spectrum-ColorHandle-color", () => $9d103974e3e19727$export$afe4c366ed4e659c, (v) => $9d103974e3e19727$export$afe4c366ed4e659c = v);
|
|
34
|
+
var $9d103974e3e19727$export$cd9afaa621b6216f;
|
|
35
|
+
var $9d103974e3e19727$export$e7dc768d35940237;
|
|
36
|
+
var $9d103974e3e19727$export$f39a09f249340e2a;
|
|
37
|
+
var $9d103974e3e19727$export$d35bc1e505d1ebbf;
|
|
38
|
+
var $9d103974e3e19727$export$afe4c366ed4e659c;
|
|
39
|
+
$9d103974e3e19727$export$cd9afaa621b6216f = "spectrum-ColorHandle_5a9f41";
|
|
40
|
+
$9d103974e3e19727$export$e7dc768d35940237 = "is-focused_5a9f41";
|
|
41
|
+
$9d103974e3e19727$export$f39a09f249340e2a = "focus-ring_5a9f41";
|
|
42
|
+
$9d103974e3e19727$export$d35bc1e505d1ebbf = "is-disabled_5a9f41";
|
|
43
|
+
$9d103974e3e19727$export$afe4c366ed4e659c = "spectrum-ColorHandle-color_5a9f41";
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
var $f3cdcbdb4b87f010$exports = {};
|
|
47
|
+
|
|
48
|
+
$parcel$export($f3cdcbdb4b87f010$exports, "spectrum-ColorLoupe", () => $f3cdcbdb4b87f010$export$88d6ed2576b21809, (v) => $f3cdcbdb4b87f010$export$88d6ed2576b21809 = v);
|
|
49
|
+
$parcel$export($f3cdcbdb4b87f010$exports, "is-open", () => $f3cdcbdb4b87f010$export$a9781837241c946d, (v) => $f3cdcbdb4b87f010$export$a9781837241c946d = v);
|
|
50
|
+
$parcel$export($f3cdcbdb4b87f010$exports, "spectrum-ColorLoupe-outer", () => $f3cdcbdb4b87f010$export$d6ad38291e8aca9c, (v) => $f3cdcbdb4b87f010$export$d6ad38291e8aca9c = v);
|
|
51
|
+
$parcel$export($f3cdcbdb4b87f010$exports, "spectrum-ColorLoupe-inner-background", () => $f3cdcbdb4b87f010$export$397af82b48750fe5, (v) => $f3cdcbdb4b87f010$export$397af82b48750fe5 = v);
|
|
52
|
+
$parcel$export($f3cdcbdb4b87f010$exports, "spectrum-ColorLoupe-inner-checker", () => $f3cdcbdb4b87f010$export$f9a2a02e0b271024, (v) => $f3cdcbdb4b87f010$export$f9a2a02e0b271024 = v);
|
|
53
|
+
var $f3cdcbdb4b87f010$export$88d6ed2576b21809;
|
|
54
|
+
var $f3cdcbdb4b87f010$export$a9781837241c946d;
|
|
55
|
+
var $f3cdcbdb4b87f010$export$d6ad38291e8aca9c;
|
|
56
|
+
var $f3cdcbdb4b87f010$export$397af82b48750fe5;
|
|
57
|
+
var $f3cdcbdb4b87f010$export$f9a2a02e0b271024;
|
|
58
|
+
$f3cdcbdb4b87f010$export$88d6ed2576b21809 = "spectrum-ColorLoupe_c818a8";
|
|
59
|
+
$f3cdcbdb4b87f010$export$a9781837241c946d = "is-open_c818a8";
|
|
60
|
+
$f3cdcbdb4b87f010$export$d6ad38291e8aca9c = "spectrum-ColorLoupe-outer_c818a8";
|
|
61
|
+
$f3cdcbdb4b87f010$export$397af82b48750fe5 = "spectrum-ColorLoupe-inner-background_c818a8";
|
|
62
|
+
$f3cdcbdb4b87f010$export$f9a2a02e0b271024 = "spectrum-ColorLoupe-inner-checker_c818a8";
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
function $3a90e89d07d7bbd5$export$a3cc47cee1c1ccc(props) {
|
|
67
|
+
let { value: value , isDisabled: isDisabled , isDragging: isDragging , isFocused: isFocused , children: children , className: className = '' , ...otherProps } = props;
|
|
68
|
+
let patternId = $kF0Zw$useId();
|
|
69
|
+
let valueCSS = value.toString('css');
|
|
70
|
+
return(/*#__PURE__*/ $kF0Zw$react.createElement("div", {
|
|
71
|
+
className: $kF0Zw$classNames((/*@__PURE__*/$parcel$interopDefault($9d103974e3e19727$exports)), 'spectrum-ColorHandle', {
|
|
72
|
+
'is-focused': isFocused,
|
|
73
|
+
'is-disabled': isDisabled
|
|
74
|
+
}) + ' ' + className,
|
|
75
|
+
...otherProps
|
|
76
|
+
}, /*#__PURE__*/ $kF0Zw$react.createElement("div", {
|
|
77
|
+
className: $kF0Zw$classNames((/*@__PURE__*/$parcel$interopDefault($9d103974e3e19727$exports)), 'spectrum-ColorHandle-color'),
|
|
78
|
+
style: {
|
|
79
|
+
backgroundColor: valueCSS
|
|
80
|
+
}
|
|
81
|
+
}), /*#__PURE__*/ $kF0Zw$react.createElement("svg", {
|
|
82
|
+
className: $kF0Zw$classNames((/*@__PURE__*/$parcel$interopDefault($f3cdcbdb4b87f010$exports)), 'spectrum-ColorLoupe', {
|
|
83
|
+
'is-open': isDragging
|
|
84
|
+
}),
|
|
85
|
+
"aria-hidden": "true"
|
|
86
|
+
}, /*#__PURE__*/ $kF0Zw$react.createElement("pattern", {
|
|
87
|
+
id: patternId,
|
|
88
|
+
x: "0",
|
|
89
|
+
y: "0",
|
|
90
|
+
width: "16",
|
|
91
|
+
height: "16",
|
|
92
|
+
patternUnits: "userSpaceOnUse"
|
|
93
|
+
}, /*#__PURE__*/ $kF0Zw$react.createElement("rect", {
|
|
94
|
+
className: $kF0Zw$classNames((/*@__PURE__*/$parcel$interopDefault($f3cdcbdb4b87f010$exports)), 'spectrum-ColorLoupe-inner-background'),
|
|
95
|
+
x: "0",
|
|
96
|
+
y: "0",
|
|
97
|
+
width: "16",
|
|
98
|
+
height: "16"
|
|
99
|
+
}), /*#__PURE__*/ $kF0Zw$react.createElement("rect", {
|
|
100
|
+
className: $kF0Zw$classNames((/*@__PURE__*/$parcel$interopDefault($f3cdcbdb4b87f010$exports)), 'spectrum-ColorLoupe-inner-checker'),
|
|
101
|
+
x: "0",
|
|
102
|
+
y: "0",
|
|
103
|
+
width: "8",
|
|
104
|
+
height: "8"
|
|
105
|
+
}), /*#__PURE__*/ $kF0Zw$react.createElement("rect", {
|
|
106
|
+
className: $kF0Zw$classNames((/*@__PURE__*/$parcel$interopDefault($f3cdcbdb4b87f010$exports)), 'spectrum-ColorLoupe-inner-checker'),
|
|
107
|
+
x: "8",
|
|
108
|
+
y: "8",
|
|
109
|
+
width: "8",
|
|
110
|
+
height: "8"
|
|
111
|
+
})), /*#__PURE__*/ $kF0Zw$react.createElement("path", {
|
|
112
|
+
className: $kF0Zw$classNames((/*@__PURE__*/$parcel$interopDefault($f3cdcbdb4b87f010$exports)), 'spectrum-ColorLoupe-inner'),
|
|
113
|
+
d: "M25 1a24 24 0 0124 24c0 16.255-24 40-24 40S1 41.255 1 25A24 24 0 0125 1z",
|
|
114
|
+
fill: `url(#${patternId})`
|
|
115
|
+
}), /*#__PURE__*/ $kF0Zw$react.createElement("path", {
|
|
116
|
+
className: $kF0Zw$classNames((/*@__PURE__*/$parcel$interopDefault($f3cdcbdb4b87f010$exports)), 'spectrum-ColorLoupe-inner'),
|
|
117
|
+
d: "M25 1a24 24 0 0124 24c0 16.255-24 40-24 40S1 41.255 1 25A24 24 0 0125 1z",
|
|
118
|
+
fill: valueCSS
|
|
119
|
+
}), /*#__PURE__*/ $kF0Zw$react.createElement("path", {
|
|
120
|
+
className: $kF0Zw$classNames((/*@__PURE__*/$parcel$interopDefault($f3cdcbdb4b87f010$exports)), 'spectrum-ColorLoupe-outer'),
|
|
121
|
+
d: "M25 3A21.98 21.98 0 003 25c0 6.2 4 14.794 11.568 24.853A144.233 144.233 0 0025 62.132a144.085 144.085 0 0010.4-12.239C42.99 39.816 47 31.209 47 25A21.98 21.98 0 0025 3m0-2a24 24 0 0124 24c0 16.255-24 40-24 40S1 41.255 1 25A24 24 0 0125 1z"
|
|
122
|
+
})), children));
|
|
107
123
|
}
|
|
108
124
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
var $
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
var $7d12200010f0192e$exports = {};
|
|
129
|
+
|
|
130
|
+
$parcel$export($7d12200010f0192e$exports, "spectrum-ColorArea", () => $7d12200010f0192e$export$bb6257a55a3c1efc, (v) => $7d12200010f0192e$export$bb6257a55a3c1efc = v);
|
|
131
|
+
$parcel$export($7d12200010f0192e$exports, "is-focused", () => $7d12200010f0192e$export$e7dc768d35940237, (v) => $7d12200010f0192e$export$e7dc768d35940237 = v);
|
|
132
|
+
$parcel$export($7d12200010f0192e$exports, "focus-ring", () => $7d12200010f0192e$export$f39a09f249340e2a, (v) => $7d12200010f0192e$export$f39a09f249340e2a = v);
|
|
133
|
+
$parcel$export($7d12200010f0192e$exports, "spectrum-ColorArea-handle", () => $7d12200010f0192e$export$d8addbd273c4e00, (v) => $7d12200010f0192e$export$d8addbd273c4e00 = v);
|
|
134
|
+
$parcel$export($7d12200010f0192e$exports, "is-disabled", () => $7d12200010f0192e$export$d35bc1e505d1ebbf, (v) => $7d12200010f0192e$export$d35bc1e505d1ebbf = v);
|
|
135
|
+
$parcel$export($7d12200010f0192e$exports, "spectrum-ColorArea-gradient", () => $7d12200010f0192e$export$40686f4fcb8a9916, (v) => $7d12200010f0192e$export$40686f4fcb8a9916 = v);
|
|
136
|
+
$parcel$export($7d12200010f0192e$exports, "spectrum-ColorArea-slider", () => $7d12200010f0192e$export$7d727cacaa7cea1e, (v) => $7d12200010f0192e$export$7d727cacaa7cea1e = v);
|
|
137
|
+
$parcel$export($7d12200010f0192e$exports, "spectrum-ColorHandle-color", () => $7d12200010f0192e$export$afe4c366ed4e659c, (v) => $7d12200010f0192e$export$afe4c366ed4e659c = v);
|
|
138
|
+
var $7d12200010f0192e$export$bb6257a55a3c1efc;
|
|
139
|
+
var $7d12200010f0192e$export$e7dc768d35940237;
|
|
140
|
+
var $7d12200010f0192e$export$f39a09f249340e2a;
|
|
141
|
+
var $7d12200010f0192e$export$d8addbd273c4e00;
|
|
142
|
+
var $7d12200010f0192e$export$d35bc1e505d1ebbf;
|
|
143
|
+
var $7d12200010f0192e$export$40686f4fcb8a9916;
|
|
144
|
+
var $7d12200010f0192e$export$7d727cacaa7cea1e;
|
|
145
|
+
var $7d12200010f0192e$export$afe4c366ed4e659c;
|
|
146
|
+
$7d12200010f0192e$export$bb6257a55a3c1efc = "spectrum-ColorArea_35e2c0";
|
|
147
|
+
$7d12200010f0192e$export$e7dc768d35940237 = "is-focused_35e2c0";
|
|
148
|
+
$7d12200010f0192e$export$f39a09f249340e2a = "focus-ring_35e2c0";
|
|
149
|
+
$7d12200010f0192e$export$d8addbd273c4e00 = "spectrum-ColorArea-handle_35e2c0";
|
|
150
|
+
$7d12200010f0192e$export$d35bc1e505d1ebbf = "is-disabled_35e2c0";
|
|
151
|
+
$7d12200010f0192e$export$40686f4fcb8a9916 = "spectrum-ColorArea-gradient_35e2c0";
|
|
152
|
+
$7d12200010f0192e$export$7d727cacaa7cea1e = "spectrum-ColorArea-slider_35e2c0";
|
|
153
|
+
$7d12200010f0192e$export$afe4c366ed4e659c = "spectrum-ColorHandle-color_35e2c0";
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
function $40046aa1a7ccb226$var$ColorArea(props, ref) {
|
|
162
|
+
props = $kF0Zw$useProviderProps(props);
|
|
163
|
+
let { isDisabled: isDisabled } = props;
|
|
164
|
+
let size = props.size && $kF0Zw$dimensionValue(props.size);
|
|
165
|
+
let { styleProps: styleProps } = $kF0Zw$useStyleProps(props);
|
|
166
|
+
let inputXRef = $kF0Zw$useRef();
|
|
167
|
+
let inputYRef = $kF0Zw$useRef();
|
|
168
|
+
let containerRef = $kF0Zw$useFocusableRef(ref, inputXRef);
|
|
169
|
+
let state = $kF0Zw$useColorAreaState(props);
|
|
170
|
+
let { channels: { xChannel: xChannel , zChannel: zChannel } } = state;
|
|
171
|
+
let { colorAreaProps: colorAreaProps , gradientProps: gradientProps , xInputProps: xInputProps , yInputProps: yInputProps , thumbProps: thumbProps } = $kF0Zw$useColorArea({
|
|
172
|
+
...props,
|
|
173
|
+
inputXRef: inputXRef,
|
|
174
|
+
inputYRef: inputYRef,
|
|
175
|
+
containerRef: containerRef
|
|
176
|
+
}, state);
|
|
177
|
+
let { direction: direction } = $kF0Zw$useLocale();
|
|
178
|
+
let { colorAreaStyleProps: colorAreaStyleProps , gradientStyleProps: gradientStyleProps , thumbStyleProps: thumbStyleProps } = $40046aa1a7ccb226$var$useGradients({
|
|
179
|
+
direction: direction,
|
|
180
|
+
state: state,
|
|
181
|
+
xChannel: xChannel,
|
|
182
|
+
zChannel: zChannel,
|
|
183
|
+
isDisabled: props.isDisabled
|
|
184
|
+
});
|
|
185
|
+
let { focusProps: focusProps , isFocusVisible: isFocusVisible } = $kF0Zw$useFocusRing();
|
|
186
|
+
return(/*#__PURE__*/ $kF0Zw$react.createElement("div", {
|
|
187
|
+
...colorAreaProps,
|
|
188
|
+
className: $kF0Zw$classNames((/*@__PURE__*/$parcel$interopDefault($7d12200010f0192e$exports)), 'spectrum-ColorArea', {
|
|
189
|
+
'is-disabled': isDisabled
|
|
190
|
+
}, styleProps.className),
|
|
191
|
+
ref: containerRef,
|
|
192
|
+
style: {
|
|
193
|
+
...colorAreaStyleProps.style,
|
|
194
|
+
...styleProps.style,
|
|
195
|
+
// Workaround around https://github.com/adobe/spectrum-css/issues/1032
|
|
196
|
+
width: size,
|
|
197
|
+
height: size
|
|
198
|
+
}
|
|
199
|
+
}, /*#__PURE__*/ $kF0Zw$react.createElement("div", {
|
|
200
|
+
...gradientProps,
|
|
201
|
+
...gradientStyleProps,
|
|
202
|
+
className: $kF0Zw$classNames((/*@__PURE__*/$parcel$interopDefault($7d12200010f0192e$exports)), 'spectrum-ColorArea-gradient')
|
|
203
|
+
}), /*#__PURE__*/ $kF0Zw$react.createElement($3a90e89d07d7bbd5$export$a3cc47cee1c1ccc, {
|
|
204
|
+
value: state.getDisplayColor(),
|
|
205
|
+
isFocused: isFocusVisible,
|
|
206
|
+
isDisabled: isDisabled,
|
|
207
|
+
isDragging: state.isDragging,
|
|
208
|
+
className: $kF0Zw$classNames((/*@__PURE__*/$parcel$interopDefault($7d12200010f0192e$exports)), 'spectrum-ColorArea-handle'),
|
|
209
|
+
...thumbProps,
|
|
210
|
+
...thumbStyleProps
|
|
211
|
+
}, /*#__PURE__*/ $kF0Zw$react.createElement("div", {
|
|
212
|
+
role: "presentation"
|
|
213
|
+
}, /*#__PURE__*/ $kF0Zw$react.createElement("input", {
|
|
214
|
+
className: $kF0Zw$classNames((/*@__PURE__*/$parcel$interopDefault($7d12200010f0192e$exports)), 'spectrum-ColorArea-slider'),
|
|
215
|
+
...$kF0Zw$mergeProps(xInputProps, focusProps),
|
|
216
|
+
ref: inputXRef
|
|
217
|
+
}), /*#__PURE__*/ $kF0Zw$react.createElement("input", {
|
|
218
|
+
className: $kF0Zw$classNames((/*@__PURE__*/$parcel$interopDefault($7d12200010f0192e$exports)), 'spectrum-ColorArea-slider'),
|
|
219
|
+
...$kF0Zw$mergeProps(yInputProps, focusProps),
|
|
220
|
+
ref: inputYRef
|
|
221
|
+
})))));
|
|
222
|
+
}
|
|
223
|
+
let $40046aa1a7ccb226$export$b2103f68a961418e = /*#__PURE__*/ $kF0Zw$react.forwardRef($40046aa1a7ccb226$var$ColorArea);
|
|
224
|
+
// this function looks scary, but it's actually pretty quick, just generates some strings
|
|
225
|
+
function $40046aa1a7ccb226$var$useGradients({ direction: direction , state: state , zChannel: zChannel , xChannel: xChannel , isDisabled: isDisabled }) {
|
|
226
|
+
let orientation = [
|
|
227
|
+
'top',
|
|
228
|
+
direction === 'rtl' ? 'left' : 'right'
|
|
229
|
+
];
|
|
230
|
+
let dir = false;
|
|
231
|
+
let background = {
|
|
232
|
+
colorAreaStyles: {
|
|
233
|
+
},
|
|
234
|
+
gradientStyles: {
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
let zValue = state.value.getChannelValue(zChannel);
|
|
238
|
+
let maskImage;
|
|
239
|
+
if (!isDisabled) switch(zChannel){
|
|
240
|
+
case 'red':
|
|
241
|
+
dir = xChannel === 'green';
|
|
242
|
+
maskImage = `linear-gradient(to ${orientation[Number(!dir)]}, transparent, #000)`;
|
|
243
|
+
background.colorAreaStyles = {
|
|
244
|
+
/* the background represents the green channel as a linear gradient from min to max,
|
|
245
|
+
with the blue channel minimized, adjusted by the red channel value. */ backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(${zValue},0,0),rgb(${zValue},255,0))`
|
|
246
|
+
};
|
|
247
|
+
background.gradientStyles = {
|
|
248
|
+
/* the foreground represents the green channel as a linear gradient from min to max,
|
|
249
|
+
with the blue channel maximized, adjusted by the red channel value. */ backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(${zValue},0,255),rgb(${zValue},255,255))`,
|
|
250
|
+
/* the foreground gradient is masked by a perpendicular linear gradient from black to white */ 'WebkitMaskImage': maskImage,
|
|
251
|
+
maskImage: maskImage
|
|
252
|
+
};
|
|
253
|
+
break;
|
|
254
|
+
case 'green':
|
|
255
|
+
dir = xChannel === 'red';
|
|
256
|
+
maskImage = `linear-gradient(to ${orientation[Number(!dir)]}, transparent, #000)`;
|
|
257
|
+
background.colorAreaStyles = {
|
|
258
|
+
/* the background represents the red channel as a linear gradient from min to max,
|
|
259
|
+
with the blue channel minimized, adjusted by the green channel value. */ backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(0,${zValue},0),rgb(255,${zValue},0))`
|
|
260
|
+
};
|
|
261
|
+
background.gradientStyles = {
|
|
262
|
+
/* the foreground represents the red channel as a linear gradient from min to max,
|
|
263
|
+
with the blue channel maximized, adjusted by the green channel value. */ backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(0,${zValue},255),rgb(255,${zValue},255))`,
|
|
264
|
+
/* the foreground gradient is masked by a perpendicular linear gradient from black to white */ 'WebkitMaskImage': maskImage,
|
|
265
|
+
maskImage: maskImage
|
|
266
|
+
};
|
|
267
|
+
break;
|
|
268
|
+
case 'blue':
|
|
269
|
+
dir = xChannel === 'red';
|
|
270
|
+
maskImage = `linear-gradient(to ${orientation[Number(!dir)]}, transparent, #000)`;
|
|
271
|
+
background.colorAreaStyles = {
|
|
272
|
+
/* the background represents the red channel as a linear gradient from min to max,
|
|
273
|
+
with the green channel minimized, adjusted by the blue channel value. */ backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(0,0,${zValue}),rgb(255,0,${zValue}))`
|
|
274
|
+
};
|
|
275
|
+
background.gradientStyles = {
|
|
276
|
+
/* the foreground represents the red channel as a linear gradient from min to max,
|
|
277
|
+
with the green channel maximized, adjusted by the blue channel value. */ backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(0,255,${zValue}),rgb(255,255,${zValue}))`,
|
|
278
|
+
/* the foreground gradient is masked by a perpendicular linear gradient from black to white */ 'WebkitMaskImage': maskImage,
|
|
279
|
+
maskImage: maskImage
|
|
280
|
+
};
|
|
281
|
+
break;
|
|
151
282
|
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
283
|
+
let { x: x , y: y } = state.getThumbPosition();
|
|
284
|
+
if (direction === 'rtl') x = 1 - x;
|
|
285
|
+
return {
|
|
286
|
+
colorAreaStyleProps: {
|
|
287
|
+
style: {
|
|
288
|
+
position: 'relative',
|
|
289
|
+
touchAction: 'none',
|
|
290
|
+
...background.colorAreaStyles
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
gradientStyleProps: {
|
|
294
|
+
style: {
|
|
295
|
+
touchAction: 'none',
|
|
296
|
+
...background.gradientStyles
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
thumbStyleProps: {
|
|
300
|
+
style: {
|
|
301
|
+
position: 'absolute',
|
|
302
|
+
left: `${x * 100}%`,
|
|
303
|
+
top: `${y * 100}%`,
|
|
304
|
+
transform: 'translate(0%, 0%)',
|
|
305
|
+
touchAction: 'none'
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
var $3aac1c27203f04b5$exports = {};
|
|
313
|
+
|
|
314
|
+
$parcel$export($3aac1c27203f04b5$exports, "ColorWheel", () => $3aac1c27203f04b5$export$f80663f808113381);
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
var $f60625fffea2b12e$exports = {};
|
|
319
|
+
|
|
320
|
+
$parcel$export($f60625fffea2b12e$exports, "spectrum-ColorWheel", () => $f60625fffea2b12e$export$b70a5ca28702fbc6, (v) => $f60625fffea2b12e$export$b70a5ca28702fbc6 = v);
|
|
321
|
+
$parcel$export($f60625fffea2b12e$exports, "is-focused", () => $f60625fffea2b12e$export$e7dc768d35940237, (v) => $f60625fffea2b12e$export$e7dc768d35940237 = v);
|
|
322
|
+
$parcel$export($f60625fffea2b12e$exports, "spectrum-ColorWheel-handle", () => $f60625fffea2b12e$export$4cd23920eb8ac056, (v) => $f60625fffea2b12e$export$4cd23920eb8ac056 = v);
|
|
323
|
+
$parcel$export($f60625fffea2b12e$exports, "spectrum-ColorWheel-slider", () => $f60625fffea2b12e$export$f476ddda713d62b, (v) => $f60625fffea2b12e$export$f476ddda713d62b = v);
|
|
324
|
+
$parcel$export($f60625fffea2b12e$exports, "is-disabled", () => $f60625fffea2b12e$export$d35bc1e505d1ebbf, (v) => $f60625fffea2b12e$export$d35bc1e505d1ebbf = v);
|
|
325
|
+
$parcel$export($f60625fffea2b12e$exports, "is-dragged", () => $f60625fffea2b12e$export$8778c911bed6c759, (v) => $f60625fffea2b12e$export$8778c911bed6c759 = v);
|
|
326
|
+
$parcel$export($f60625fffea2b12e$exports, "spectrum-ColorWheel-gradient", () => $f60625fffea2b12e$export$9afaa791d7500a9b, (v) => $f60625fffea2b12e$export$9afaa791d7500a9b = v);
|
|
327
|
+
$parcel$export($f60625fffea2b12e$exports, "spectrum-ColorWheel-segment", () => $f60625fffea2b12e$export$ada9fbffdaa4f10, (v) => $f60625fffea2b12e$export$ada9fbffdaa4f10 = v);
|
|
328
|
+
var $f60625fffea2b12e$export$b70a5ca28702fbc6;
|
|
329
|
+
var $f60625fffea2b12e$export$e7dc768d35940237;
|
|
330
|
+
var $f60625fffea2b12e$export$4cd23920eb8ac056;
|
|
331
|
+
var $f60625fffea2b12e$export$f476ddda713d62b;
|
|
332
|
+
var $f60625fffea2b12e$export$d35bc1e505d1ebbf;
|
|
333
|
+
var $f60625fffea2b12e$export$8778c911bed6c759;
|
|
334
|
+
var $f60625fffea2b12e$export$9afaa791d7500a9b;
|
|
335
|
+
var $f60625fffea2b12e$export$ada9fbffdaa4f10;
|
|
336
|
+
$f60625fffea2b12e$export$b70a5ca28702fbc6 = "spectrum-ColorWheel_31462a";
|
|
337
|
+
$f60625fffea2b12e$export$e7dc768d35940237 = "is-focused_31462a";
|
|
338
|
+
$f60625fffea2b12e$export$4cd23920eb8ac056 = "spectrum-ColorWheel-handle_31462a";
|
|
339
|
+
$f60625fffea2b12e$export$f476ddda713d62b = "spectrum-ColorWheel-slider_31462a";
|
|
340
|
+
$f60625fffea2b12e$export$d35bc1e505d1ebbf = "is-disabled_31462a";
|
|
341
|
+
$f60625fffea2b12e$export$8778c911bed6c759 = "is-dragged_31462a";
|
|
342
|
+
$f60625fffea2b12e$export$9afaa791d7500a9b = "spectrum-ColorWheel-gradient_31462a";
|
|
343
|
+
$f60625fffea2b12e$export$ada9fbffdaa4f10 = "spectrum-ColorWheel-segment_31462a";
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
const $3aac1c27203f04b5$var$WHEEL_THICKNESS = 24;
|
|
352
|
+
function $3aac1c27203f04b5$var$ColorWheel(props, ref) {
|
|
353
|
+
props = $kF0Zw$useProviderProps(props);
|
|
354
|
+
let { isDisabled: isDisabled } = props;
|
|
355
|
+
let size = props.size && $kF0Zw$dimensionValue(props.size);
|
|
356
|
+
let { styleProps: styleProps } = $kF0Zw$useStyleProps(props);
|
|
357
|
+
let inputRef = $kF0Zw$useRef(null);
|
|
358
|
+
let containerRef = $kF0Zw$useFocusableRef(ref, inputRef);
|
|
359
|
+
let [wheelRadius, setWheelRadius] = $kF0Zw$useState(null);
|
|
360
|
+
let [wheelThickness, setWheelThickness] = $kF0Zw$useState($3aac1c27203f04b5$var$WHEEL_THICKNESS);
|
|
361
|
+
let resizeHandler = $kF0Zw$useCallback(()=>{
|
|
362
|
+
if (containerRef.current) {
|
|
363
|
+
setWheelRadius(containerRef.current.offsetWidth / 2);
|
|
364
|
+
let thickness = window.getComputedStyle(containerRef.current).getPropertyValue('--spectrum-colorwheel-track-thickness');
|
|
365
|
+
if (thickness) setWheelThickness(parseInt(thickness, 10));
|
|
366
|
+
}
|
|
367
|
+
}, [
|
|
368
|
+
containerRef,
|
|
369
|
+
setWheelRadius,
|
|
370
|
+
setWheelThickness
|
|
371
|
+
]);
|
|
372
|
+
$kF0Zw$useEffect(()=>{
|
|
373
|
+
// the size observer's fallback to the window resize event doesn't fire on mount
|
|
374
|
+
if (wheelRadius == null) resizeHandler();
|
|
375
|
+
}, [
|
|
376
|
+
wheelRadius,
|
|
377
|
+
resizeHandler
|
|
378
|
+
]);
|
|
379
|
+
$kF0Zw$useResizeObserver({
|
|
380
|
+
ref: containerRef,
|
|
381
|
+
onResize: resizeHandler
|
|
382
|
+
});
|
|
383
|
+
let state = $kF0Zw$useColorWheelState(props);
|
|
384
|
+
let { trackProps: trackProps , inputProps: inputProps , thumbProps: thumbProps } = $kF0Zw$useColorWheel({
|
|
385
|
+
...props,
|
|
386
|
+
innerRadius: wheelRadius - wheelThickness,
|
|
387
|
+
outerRadius: wheelRadius
|
|
388
|
+
}, state, inputRef);
|
|
389
|
+
let { focusProps: focusProps , isFocusVisible: isFocusVisible } = $kF0Zw$useFocusRing();
|
|
390
|
+
return(/*#__PURE__*/ $kF0Zw$react.createElement("div", {
|
|
391
|
+
className: $kF0Zw$classNames((/*@__PURE__*/$parcel$interopDefault($f60625fffea2b12e$exports)), 'spectrum-ColorWheel', {
|
|
392
|
+
'is-disabled': isDisabled
|
|
393
|
+
}, styleProps.className),
|
|
394
|
+
ref: containerRef,
|
|
395
|
+
style: {
|
|
396
|
+
...styleProps.style,
|
|
397
|
+
// Workaround around https://github.com/adobe/spectrum-css/issues/1032
|
|
398
|
+
// @ts-ignore
|
|
399
|
+
'width': size,
|
|
400
|
+
'height': size
|
|
401
|
+
}
|
|
402
|
+
}, /*#__PURE__*/ $kF0Zw$react.createElement("div", {
|
|
403
|
+
...trackProps,
|
|
404
|
+
className: $kF0Zw$classNames((/*@__PURE__*/$parcel$interopDefault($f60625fffea2b12e$exports)), 'spectrum-ColorWheel-gradient')
|
|
405
|
+
}), /*#__PURE__*/ $kF0Zw$react.createElement($3a90e89d07d7bbd5$export$a3cc47cee1c1ccc, {
|
|
406
|
+
value: state.getDisplayColor(),
|
|
407
|
+
isFocused: isFocusVisible,
|
|
408
|
+
isDisabled: isDisabled,
|
|
409
|
+
isDragging: state.isDragging,
|
|
410
|
+
className: $kF0Zw$classNames((/*@__PURE__*/$parcel$interopDefault($f60625fffea2b12e$exports)), 'spectrum-ColorWheel-handle'),
|
|
411
|
+
...thumbProps
|
|
412
|
+
}, /*#__PURE__*/ $kF0Zw$react.createElement("input", {
|
|
413
|
+
...focusProps,
|
|
414
|
+
className: $kF0Zw$classNames((/*@__PURE__*/$parcel$interopDefault($f60625fffea2b12e$exports)), 'spectrum-ColorWheel-slider'),
|
|
415
|
+
...inputProps,
|
|
416
|
+
ref: inputRef
|
|
417
|
+
}))));
|
|
194
418
|
}
|
|
195
419
|
/**
|
|
196
420
|
* ColorWheels allow users to adjust the hue of an HSL or HSB color value on a circular track.
|
|
197
|
-
*/
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
label
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
} = useFocus({
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
alignLabel = '
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
ref: inputRef,
|
|
317
|
-
className: classNames($d5576e4bc9a7ae94e3998a51423$$interop$default, 'spectrum-ColorSlider-slider')
|
|
318
|
-
})))));
|
|
421
|
+
*/ let $3aac1c27203f04b5$export$f80663f808113381 = /*#__PURE__*/ $kF0Zw$react.forwardRef($3aac1c27203f04b5$var$ColorWheel);
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
var $3870e4ce67ed7ee1$exports = {};
|
|
425
|
+
|
|
426
|
+
$parcel$export($3870e4ce67ed7ee1$exports, "ColorSlider", () => $3870e4ce67ed7ee1$export$44fd664bcca5b6fb);
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
var $670e80c7e5915fb5$exports = {};
|
|
433
|
+
|
|
434
|
+
$parcel$export($670e80c7e5915fb5$exports, "spectrum-ColorSlider", () => $670e80c7e5915fb5$export$a5f8b0989b27a604, (v) => $670e80c7e5915fb5$export$a5f8b0989b27a604 = v);
|
|
435
|
+
$parcel$export($670e80c7e5915fb5$exports, "is-focused", () => $670e80c7e5915fb5$export$e7dc768d35940237, (v) => $670e80c7e5915fb5$export$e7dc768d35940237 = v);
|
|
436
|
+
$parcel$export($670e80c7e5915fb5$exports, "spectrum-ColorSlider-handle", () => $670e80c7e5915fb5$export$8c273ba92fabe1f1, (v) => $670e80c7e5915fb5$export$8c273ba92fabe1f1 = v);
|
|
437
|
+
$parcel$export($670e80c7e5915fb5$exports, "spectrum-ColorSlider-slider", () => $670e80c7e5915fb5$export$2f08b72944af536, (v) => $670e80c7e5915fb5$export$2f08b72944af536 = v);
|
|
438
|
+
$parcel$export($670e80c7e5915fb5$exports, "spectrum-ColorSlider-container--horizontal", () => $670e80c7e5915fb5$export$33e97914f6746614, (v) => $670e80c7e5915fb5$export$33e97914f6746614 = v);
|
|
439
|
+
$parcel$export($670e80c7e5915fb5$exports, "spectrum-ColorSlider-container--vertical", () => $670e80c7e5915fb5$export$cd1c093289104c66, (v) => $670e80c7e5915fb5$export$cd1c093289104c66 = v);
|
|
440
|
+
$parcel$export($670e80c7e5915fb5$exports, "is-disabled", () => $670e80c7e5915fb5$export$d35bc1e505d1ebbf, (v) => $670e80c7e5915fb5$export$d35bc1e505d1ebbf = v);
|
|
441
|
+
$parcel$export($670e80c7e5915fb5$exports, "spectrum-ColorSlider--vertical", () => $670e80c7e5915fb5$export$83dcf61b398bfaf1, (v) => $670e80c7e5915fb5$export$83dcf61b398bfaf1 = v);
|
|
442
|
+
var $670e80c7e5915fb5$export$a5f8b0989b27a604;
|
|
443
|
+
var $670e80c7e5915fb5$export$e7dc768d35940237;
|
|
444
|
+
var $670e80c7e5915fb5$export$8c273ba92fabe1f1;
|
|
445
|
+
var $670e80c7e5915fb5$export$2f08b72944af536;
|
|
446
|
+
var $670e80c7e5915fb5$export$33e97914f6746614;
|
|
447
|
+
var $670e80c7e5915fb5$export$cd1c093289104c66;
|
|
448
|
+
var $670e80c7e5915fb5$export$d35bc1e505d1ebbf;
|
|
449
|
+
var $670e80c7e5915fb5$export$83dcf61b398bfaf1;
|
|
450
|
+
$670e80c7e5915fb5$export$a5f8b0989b27a604 = "spectrum-ColorSlider_a5bb06";
|
|
451
|
+
$670e80c7e5915fb5$export$e7dc768d35940237 = "is-focused_a5bb06";
|
|
452
|
+
$670e80c7e5915fb5$export$8c273ba92fabe1f1 = "spectrum-ColorSlider-handle_a5bb06";
|
|
453
|
+
$670e80c7e5915fb5$export$2f08b72944af536 = "spectrum-ColorSlider-slider_a5bb06";
|
|
454
|
+
$670e80c7e5915fb5$export$33e97914f6746614 = "spectrum-ColorSlider-container--horizontal_a5bb06";
|
|
455
|
+
$670e80c7e5915fb5$export$cd1c093289104c66 = "spectrum-ColorSlider-container--vertical_a5bb06";
|
|
456
|
+
$670e80c7e5915fb5$export$d35bc1e505d1ebbf = "is-disabled_a5bb06";
|
|
457
|
+
$670e80c7e5915fb5$export$83dcf61b398bfaf1 = "spectrum-ColorSlider--vertical_a5bb06";
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
function $3870e4ce67ed7ee1$var$ColorSlider(props, ref) {
|
|
466
|
+
props = $kF0Zw$useProviderProps(props);
|
|
467
|
+
let { isDisabled: isDisabled , channel: channel , orientation: orientation , label: label , showValueLabel: showValueLabel , 'aria-label': ariaLabel } = props;
|
|
468
|
+
let vertical = orientation === 'vertical';
|
|
469
|
+
let { styleProps: styleProps } = $kF0Zw$useStyleProps(props);
|
|
470
|
+
let { locale: locale } = $kF0Zw$useLocale();
|
|
471
|
+
let inputRef = $kF0Zw$useRef();
|
|
472
|
+
let trackRef = $kF0Zw$useRef();
|
|
473
|
+
let domRef = $kF0Zw$useFocusableRef(ref, inputRef);
|
|
474
|
+
let state = $kF0Zw$useColorSliderState({
|
|
475
|
+
...props,
|
|
476
|
+
locale: locale
|
|
477
|
+
});
|
|
478
|
+
// If vertical and a label is provided, use it as an aria-label instead.
|
|
479
|
+
if (vertical && label) {
|
|
480
|
+
ariaLabel = ariaLabel || (typeof label === 'string' ? label : null);
|
|
481
|
+
label = null;
|
|
482
|
+
}
|
|
483
|
+
// If no external label, aria-label or aria-labelledby is provided,
|
|
484
|
+
// default to displaying the localized channel value.
|
|
485
|
+
// Specifically check if label is undefined. If label is `null` then display no visible label.
|
|
486
|
+
// A default aria-label is provided by useColorSlider in that case.
|
|
487
|
+
if (label === undefined && !ariaLabel && !props['aria-labelledby'] && !vertical) label = state.value.getChannelName(channel, locale);
|
|
488
|
+
// Show the value label by default if there is a visible label
|
|
489
|
+
if (showValueLabel == null) showValueLabel = !!label;
|
|
490
|
+
let { inputProps: inputProps , thumbProps: thumbProps , trackProps: trackProps , labelProps: labelProps , outputProps: outputProps } = $kF0Zw$useColorSlider({
|
|
491
|
+
...props,
|
|
492
|
+
label: label,
|
|
493
|
+
'aria-label': ariaLabel,
|
|
494
|
+
trackRef: trackRef,
|
|
495
|
+
inputRef: inputRef
|
|
496
|
+
}, state);
|
|
497
|
+
let { isFocusVisible: isFocusVisible } = $kF0Zw$useFocusVisible();
|
|
498
|
+
let [isFocused, setIsFocused] = $kF0Zw$useState(false);
|
|
499
|
+
let { focusProps: focusProps } = $kF0Zw$useFocus({
|
|
500
|
+
isDisabled: isDisabled,
|
|
501
|
+
onFocusChange: setIsFocused
|
|
502
|
+
});
|
|
503
|
+
let alignLabel;
|
|
504
|
+
if (vertical) alignLabel = 'center';
|
|
505
|
+
else if (label != null && showValueLabel) alignLabel = 'space-between';
|
|
506
|
+
else if (label != null) alignLabel = 'flex-start';
|
|
507
|
+
else if (showValueLabel) alignLabel = 'flex-end';
|
|
508
|
+
return(/*#__PURE__*/ $kF0Zw$react.createElement("div", {
|
|
509
|
+
ref: domRef,
|
|
510
|
+
...styleProps,
|
|
511
|
+
className: $kF0Zw$classNames((/*@__PURE__*/$parcel$interopDefault($670e80c7e5915fb5$exports)), {
|
|
512
|
+
'spectrum-ColorSlider-container--horizontal': !vertical,
|
|
513
|
+
'spectrum-ColorSlider-container--vertical': vertical
|
|
514
|
+
})
|
|
515
|
+
}, label && /*#__PURE__*/ $kF0Zw$react.createElement($kF0Zw$Flex, {
|
|
516
|
+
direction: "row",
|
|
517
|
+
justifyContent: alignLabel
|
|
518
|
+
}, /*#__PURE__*/ $kF0Zw$react.createElement($kF0Zw$Label, labelProps, label), showValueLabel && /*#__PURE__*/ $kF0Zw$react.createElement($kF0Zw$Label, {
|
|
519
|
+
elementType: "span"
|
|
520
|
+
}, /*#__PURE__*/ $kF0Zw$react.createElement("output", outputProps, state.value.formatChannelValue(channel, locale)))), /*#__PURE__*/ $kF0Zw$react.createElement("div", {
|
|
521
|
+
...trackProps,
|
|
522
|
+
ref: trackRef,
|
|
523
|
+
className: $kF0Zw$classNames((/*@__PURE__*/$parcel$interopDefault($670e80c7e5915fb5$exports)), 'spectrum-ColorSlider', {
|
|
524
|
+
'is-disabled': isDisabled,
|
|
525
|
+
'spectrum-ColorSlider--vertical': vertical
|
|
526
|
+
})
|
|
527
|
+
}, /*#__PURE__*/ $kF0Zw$react.createElement($3a90e89d07d7bbd5$export$a3cc47cee1c1ccc, {
|
|
528
|
+
value: state.getDisplayColor(),
|
|
529
|
+
isFocused: isFocused && isFocusVisible,
|
|
530
|
+
isDisabled: isDisabled,
|
|
531
|
+
isDragging: state.isThumbDragging(0),
|
|
532
|
+
className: $kF0Zw$classNames((/*@__PURE__*/$parcel$interopDefault($670e80c7e5915fb5$exports)), 'spectrum-ColorSlider-handle'),
|
|
533
|
+
...thumbProps
|
|
534
|
+
}, /*#__PURE__*/ $kF0Zw$react.createElement("input", {
|
|
535
|
+
...inputProps,
|
|
536
|
+
...focusProps,
|
|
537
|
+
ref: inputRef,
|
|
538
|
+
className: $kF0Zw$classNames((/*@__PURE__*/$parcel$interopDefault($670e80c7e5915fb5$exports)), 'spectrum-ColorSlider-slider')
|
|
539
|
+
})))));
|
|
319
540
|
}
|
|
320
541
|
/**
|
|
321
542
|
* ColorSliders allow users to adjust an individual channel of a color value.
|
|
322
|
-
*/
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
};
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
inputRef
|
|
347
|
-
labelProps: labelProps,
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
543
|
+
*/ let $3870e4ce67ed7ee1$export$44fd664bcca5b6fb = /*#__PURE__*/ $kF0Zw$react.forwardRef($3870e4ce67ed7ee1$var$ColorSlider);
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
var $0077d47e004328f0$exports = {};
|
|
547
|
+
|
|
548
|
+
$parcel$export($0077d47e004328f0$exports, "ColorField", () => $0077d47e004328f0$export$b865d4358897bb17);
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
var $9d47b39540b9e48a$exports = {};
|
|
552
|
+
|
|
553
|
+
$parcel$export($9d47b39540b9e48a$exports, "react-spectrum-ColorField-input", () => $9d47b39540b9e48a$export$7d80c6630a750b1, (v) => $9d47b39540b9e48a$export$7d80c6630a750b1 = v);
|
|
554
|
+
var $9d47b39540b9e48a$export$7d80c6630a750b1;
|
|
555
|
+
$9d47b39540b9e48a$export$7d80c6630a750b1 = "react-spectrum-ColorField-input_7bde3a";
|
|
556
|
+
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
function $0077d47e004328f0$var$ColorField(props, ref) {
|
|
563
|
+
props = $kF0Zw$useProviderProps(props);
|
|
564
|
+
let { value: // These disabled props are handled by the state hook
|
|
565
|
+
value , defaultValue: defaultValue , onChange: onChange , ...otherProps } = props;
|
|
566
|
+
let state = $kF0Zw$useColorFieldState(props);
|
|
567
|
+
let inputRef = $kF0Zw$useRef();
|
|
568
|
+
let { labelProps: labelProps , inputProps: inputProps } = $kF0Zw$useColorField(otherProps, state, inputRef);
|
|
569
|
+
return(/*#__PURE__*/ $kF0Zw$react.createElement($kF0Zw$TextFieldBase, {
|
|
570
|
+
...otherProps,
|
|
571
|
+
ref: ref,
|
|
572
|
+
inputRef: inputRef,
|
|
573
|
+
labelProps: labelProps,
|
|
574
|
+
inputProps: inputProps,
|
|
575
|
+
inputClassName: $kF0Zw$classNames((/*@__PURE__*/$parcel$interopDefault($9d47b39540b9e48a$exports)), 'react-spectrum-ColorField-input')
|
|
576
|
+
}));
|
|
351
577
|
}
|
|
352
578
|
/**
|
|
353
579
|
* ColorFields allow users to enter a color in #rrggbb hexadecimal format.
|
|
354
|
-
*/
|
|
580
|
+
*/ const $0077d47e004328f0$export$b865d4358897bb17 = /*#__PURE__*/ $kF0Zw$react.forwardRef($0077d47e004328f0$var$ColorField);
|
|
581
|
+
|
|
582
|
+
|
|
355
583
|
|
|
356
584
|
|
|
357
|
-
export
|
|
585
|
+
export {$40046aa1a7ccb226$export$b2103f68a961418e as ColorArea, $3aac1c27203f04b5$export$f80663f808113381 as ColorWheel, $3870e4ce67ed7ee1$export$44fd664bcca5b6fb as ColorSlider, $0077d47e004328f0$export$b865d4358897bb17 as ColorField};
|
|
358
586
|
//# sourceMappingURL=module.js.map
|