@react-spectrum/color 3.0.0-beta.3 → 3.0.0-beta.7
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 +393 -398
- package/dist/main.js.map +1 -1
- package/dist/module.js +375 -338
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +19 -19
- package/dist/main.css.map +0 -1
package/dist/module.js
CHANGED
|
@@ -1,358 +1,395 @@
|
|
|
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 $9M5jc$dimensionValue, useStyleProps as $9M5jc$useStyleProps, useFocusableRef as $9M5jc$useFocusableRef, classNames as $9M5jc$classNames} from "@react-spectrum/utils";
|
|
3
|
+
import $9M5jc$react, {useRef as $9M5jc$useRef, useState as $9M5jc$useState, useCallback as $9M5jc$useCallback, useEffect as $9M5jc$useEffect} from "react";
|
|
4
|
+
import {useColorWheel as $9M5jc$useColorWheel, useColorSlider as $9M5jc$useColorSlider, useColorField as $9M5jc$useColorField} from "@react-aria/color";
|
|
5
|
+
import {useColorWheelState as $9M5jc$useColorWheelState, useColorSliderState as $9M5jc$useColorSliderState, useColorFieldState as $9M5jc$useColorFieldState} from "@react-stately/color";
|
|
6
|
+
import {useFocusRing as $9M5jc$useFocusRing} from "@react-aria/focus";
|
|
7
|
+
import {useProviderProps as $9M5jc$useProviderProps} from "@react-spectrum/provider";
|
|
8
|
+
import {useResizeObserver as $9M5jc$useResizeObserver, useId as $9M5jc$useId} from "@react-aria/utils";
|
|
9
|
+
import {Flex as $9M5jc$Flex} from "@react-spectrum/layout";
|
|
10
|
+
import {Label as $9M5jc$Label} from "@react-spectrum/label";
|
|
11
|
+
import {useFocusVisible as $9M5jc$useFocusVisible, useFocus as $9M5jc$useFocus} from "@react-aria/interactions";
|
|
12
|
+
import {useLocale as $9M5jc$useLocale} from "@react-aria/i18n";
|
|
13
|
+
import {TextFieldBase as $9M5jc$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 $ee47bd58c80bd295$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($ee47bd58c80bd295$exports, "ColorWheel", () => $ee47bd58c80bd295$export$f80663f808113381);
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
var $2ef7a2c8cc412994$exports = {};
|
|
28
|
+
|
|
29
|
+
$parcel$export($2ef7a2c8cc412994$exports, "spectrum-ColorHandle", () => $2ef7a2c8cc412994$export$cd9afaa621b6216f, (v) => $2ef7a2c8cc412994$export$cd9afaa621b6216f = v);
|
|
30
|
+
$parcel$export($2ef7a2c8cc412994$exports, "is-focused", () => $2ef7a2c8cc412994$export$e7dc768d35940237, (v) => $2ef7a2c8cc412994$export$e7dc768d35940237 = v);
|
|
31
|
+
$parcel$export($2ef7a2c8cc412994$exports, "focus-ring", () => $2ef7a2c8cc412994$export$f39a09f249340e2a, (v) => $2ef7a2c8cc412994$export$f39a09f249340e2a = v);
|
|
32
|
+
$parcel$export($2ef7a2c8cc412994$exports, "is-disabled", () => $2ef7a2c8cc412994$export$d35bc1e505d1ebbf, (v) => $2ef7a2c8cc412994$export$d35bc1e505d1ebbf = v);
|
|
33
|
+
$parcel$export($2ef7a2c8cc412994$exports, "spectrum-ColorHandle-color", () => $2ef7a2c8cc412994$export$afe4c366ed4e659c, (v) => $2ef7a2c8cc412994$export$afe4c366ed4e659c = v);
|
|
34
|
+
var $2ef7a2c8cc412994$export$cd9afaa621b6216f;
|
|
35
|
+
var $2ef7a2c8cc412994$export$e7dc768d35940237;
|
|
36
|
+
var $2ef7a2c8cc412994$export$f39a09f249340e2a;
|
|
37
|
+
var $2ef7a2c8cc412994$export$d35bc1e505d1ebbf;
|
|
38
|
+
var $2ef7a2c8cc412994$export$afe4c366ed4e659c;
|
|
39
|
+
$2ef7a2c8cc412994$export$cd9afaa621b6216f = "spectrum-ColorHandle_5a9f41";
|
|
40
|
+
$2ef7a2c8cc412994$export$e7dc768d35940237 = "is-focused_5a9f41";
|
|
41
|
+
$2ef7a2c8cc412994$export$f39a09f249340e2a = "focus-ring_5a9f41";
|
|
42
|
+
$2ef7a2c8cc412994$export$d35bc1e505d1ebbf = "is-disabled_5a9f41";
|
|
43
|
+
$2ef7a2c8cc412994$export$afe4c366ed4e659c = "spectrum-ColorHandle-color_5a9f41";
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
var $188390a38326ab24$exports = {};
|
|
47
|
+
|
|
48
|
+
$parcel$export($188390a38326ab24$exports, "spectrum-ColorLoupe", () => $188390a38326ab24$export$88d6ed2576b21809, (v) => $188390a38326ab24$export$88d6ed2576b21809 = v);
|
|
49
|
+
$parcel$export($188390a38326ab24$exports, "is-open", () => $188390a38326ab24$export$a9781837241c946d, (v) => $188390a38326ab24$export$a9781837241c946d = v);
|
|
50
|
+
$parcel$export($188390a38326ab24$exports, "spectrum-ColorLoupe-outer", () => $188390a38326ab24$export$d6ad38291e8aca9c, (v) => $188390a38326ab24$export$d6ad38291e8aca9c = v);
|
|
51
|
+
$parcel$export($188390a38326ab24$exports, "spectrum-ColorLoupe-inner-background", () => $188390a38326ab24$export$397af82b48750fe5, (v) => $188390a38326ab24$export$397af82b48750fe5 = v);
|
|
52
|
+
$parcel$export($188390a38326ab24$exports, "spectrum-ColorLoupe-inner-checker", () => $188390a38326ab24$export$f9a2a02e0b271024, (v) => $188390a38326ab24$export$f9a2a02e0b271024 = v);
|
|
53
|
+
var $188390a38326ab24$export$88d6ed2576b21809;
|
|
54
|
+
var $188390a38326ab24$export$a9781837241c946d;
|
|
55
|
+
var $188390a38326ab24$export$d6ad38291e8aca9c;
|
|
56
|
+
var $188390a38326ab24$export$397af82b48750fe5;
|
|
57
|
+
var $188390a38326ab24$export$f9a2a02e0b271024;
|
|
58
|
+
$188390a38326ab24$export$88d6ed2576b21809 = "spectrum-ColorLoupe_c818a8";
|
|
59
|
+
$188390a38326ab24$export$a9781837241c946d = "is-open_c818a8";
|
|
60
|
+
$188390a38326ab24$export$d6ad38291e8aca9c = "spectrum-ColorLoupe-outer_c818a8";
|
|
61
|
+
$188390a38326ab24$export$397af82b48750fe5 = "spectrum-ColorLoupe-inner-background_c818a8";
|
|
62
|
+
$188390a38326ab24$export$f9a2a02e0b271024 = "spectrum-ColorLoupe-inner-checker_c818a8";
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
function $9be84ecc913588d9$export$a3cc47cee1c1ccc(props) {
|
|
67
|
+
let { value: value , isDisabled: isDisabled , isDragging: isDragging , isFocused: isFocused , children: children , className: className = '' , ...otherProps } = props;
|
|
68
|
+
let patternId = $9M5jc$useId();
|
|
69
|
+
let valueCSS = value.toString('css');
|
|
70
|
+
return(/*#__PURE__*/ $9M5jc$react.createElement("div", {
|
|
71
|
+
className: $9M5jc$classNames((/*@__PURE__*/$parcel$interopDefault($2ef7a2c8cc412994$exports)), 'spectrum-ColorHandle', {
|
|
72
|
+
'is-focused': isFocused,
|
|
73
|
+
'is-disabled': isDisabled
|
|
74
|
+
}) + ' ' + className,
|
|
75
|
+
...otherProps
|
|
76
|
+
}, /*#__PURE__*/ $9M5jc$react.createElement("div", {
|
|
77
|
+
className: $9M5jc$classNames((/*@__PURE__*/$parcel$interopDefault($2ef7a2c8cc412994$exports)), 'spectrum-ColorHandle-color'),
|
|
78
|
+
style: {
|
|
79
|
+
backgroundColor: valueCSS
|
|
80
|
+
}
|
|
81
|
+
}), /*#__PURE__*/ $9M5jc$react.createElement("svg", {
|
|
82
|
+
className: $9M5jc$classNames((/*@__PURE__*/$parcel$interopDefault($188390a38326ab24$exports)), 'spectrum-ColorLoupe', {
|
|
83
|
+
'is-open': isDragging
|
|
84
|
+
}),
|
|
85
|
+
"aria-hidden": "true"
|
|
86
|
+
}, /*#__PURE__*/ $9M5jc$react.createElement("pattern", {
|
|
87
|
+
id: patternId,
|
|
88
|
+
x: "0",
|
|
89
|
+
y: "0",
|
|
90
|
+
width: "16",
|
|
91
|
+
height: "16",
|
|
92
|
+
patternUnits: "userSpaceOnUse"
|
|
93
|
+
}, /*#__PURE__*/ $9M5jc$react.createElement("rect", {
|
|
94
|
+
className: $9M5jc$classNames((/*@__PURE__*/$parcel$interopDefault($188390a38326ab24$exports)), 'spectrum-ColorLoupe-inner-background'),
|
|
95
|
+
x: "0",
|
|
96
|
+
y: "0",
|
|
97
|
+
width: "16",
|
|
98
|
+
height: "16"
|
|
99
|
+
}), /*#__PURE__*/ $9M5jc$react.createElement("rect", {
|
|
100
|
+
className: $9M5jc$classNames((/*@__PURE__*/$parcel$interopDefault($188390a38326ab24$exports)), 'spectrum-ColorLoupe-inner-checker'),
|
|
101
|
+
x: "0",
|
|
102
|
+
y: "0",
|
|
103
|
+
width: "8",
|
|
104
|
+
height: "8"
|
|
105
|
+
}), /*#__PURE__*/ $9M5jc$react.createElement("rect", {
|
|
106
|
+
className: $9M5jc$classNames((/*@__PURE__*/$parcel$interopDefault($188390a38326ab24$exports)), 'spectrum-ColorLoupe-inner-checker'),
|
|
107
|
+
x: "8",
|
|
108
|
+
y: "8",
|
|
109
|
+
width: "8",
|
|
110
|
+
height: "8"
|
|
111
|
+
})), /*#__PURE__*/ $9M5jc$react.createElement("path", {
|
|
112
|
+
className: $9M5jc$classNames((/*@__PURE__*/$parcel$interopDefault($188390a38326ab24$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__*/ $9M5jc$react.createElement("path", {
|
|
116
|
+
className: $9M5jc$classNames((/*@__PURE__*/$parcel$interopDefault($188390a38326ab24$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__*/ $9M5jc$react.createElement("path", {
|
|
120
|
+
className: $9M5jc$classNames((/*@__PURE__*/$parcel$interopDefault($188390a38326ab24$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
|
-
|
|
151
|
-
|
|
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
|
-
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
var $3be09cf107a19f45$exports = {};
|
|
128
|
+
|
|
129
|
+
$parcel$export($3be09cf107a19f45$exports, "spectrum-ColorWheel", () => $3be09cf107a19f45$export$b70a5ca28702fbc6, (v) => $3be09cf107a19f45$export$b70a5ca28702fbc6 = v);
|
|
130
|
+
$parcel$export($3be09cf107a19f45$exports, "is-focused", () => $3be09cf107a19f45$export$e7dc768d35940237, (v) => $3be09cf107a19f45$export$e7dc768d35940237 = v);
|
|
131
|
+
$parcel$export($3be09cf107a19f45$exports, "spectrum-ColorWheel-handle", () => $3be09cf107a19f45$export$4cd23920eb8ac056, (v) => $3be09cf107a19f45$export$4cd23920eb8ac056 = v);
|
|
132
|
+
$parcel$export($3be09cf107a19f45$exports, "spectrum-ColorWheel-slider", () => $3be09cf107a19f45$export$f476ddda713d62b, (v) => $3be09cf107a19f45$export$f476ddda713d62b = v);
|
|
133
|
+
$parcel$export($3be09cf107a19f45$exports, "is-disabled", () => $3be09cf107a19f45$export$d35bc1e505d1ebbf, (v) => $3be09cf107a19f45$export$d35bc1e505d1ebbf = v);
|
|
134
|
+
$parcel$export($3be09cf107a19f45$exports, "is-dragged", () => $3be09cf107a19f45$export$8778c911bed6c759, (v) => $3be09cf107a19f45$export$8778c911bed6c759 = v);
|
|
135
|
+
$parcel$export($3be09cf107a19f45$exports, "spectrum-ColorWheel-gradient", () => $3be09cf107a19f45$export$9afaa791d7500a9b, (v) => $3be09cf107a19f45$export$9afaa791d7500a9b = v);
|
|
136
|
+
$parcel$export($3be09cf107a19f45$exports, "spectrum-ColorWheel-segment", () => $3be09cf107a19f45$export$ada9fbffdaa4f10, (v) => $3be09cf107a19f45$export$ada9fbffdaa4f10 = v);
|
|
137
|
+
var $3be09cf107a19f45$export$b70a5ca28702fbc6;
|
|
138
|
+
var $3be09cf107a19f45$export$e7dc768d35940237;
|
|
139
|
+
var $3be09cf107a19f45$export$4cd23920eb8ac056;
|
|
140
|
+
var $3be09cf107a19f45$export$f476ddda713d62b;
|
|
141
|
+
var $3be09cf107a19f45$export$d35bc1e505d1ebbf;
|
|
142
|
+
var $3be09cf107a19f45$export$8778c911bed6c759;
|
|
143
|
+
var $3be09cf107a19f45$export$9afaa791d7500a9b;
|
|
144
|
+
var $3be09cf107a19f45$export$ada9fbffdaa4f10;
|
|
145
|
+
$3be09cf107a19f45$export$b70a5ca28702fbc6 = "spectrum-ColorWheel_31462a";
|
|
146
|
+
$3be09cf107a19f45$export$e7dc768d35940237 = "is-focused_31462a";
|
|
147
|
+
$3be09cf107a19f45$export$4cd23920eb8ac056 = "spectrum-ColorWheel-handle_31462a";
|
|
148
|
+
$3be09cf107a19f45$export$f476ddda713d62b = "spectrum-ColorWheel-slider_31462a";
|
|
149
|
+
$3be09cf107a19f45$export$d35bc1e505d1ebbf = "is-disabled_31462a";
|
|
150
|
+
$3be09cf107a19f45$export$8778c911bed6c759 = "is-dragged_31462a";
|
|
151
|
+
$3be09cf107a19f45$export$9afaa791d7500a9b = "spectrum-ColorWheel-gradient_31462a";
|
|
152
|
+
$3be09cf107a19f45$export$ada9fbffdaa4f10 = "spectrum-ColorWheel-segment_31462a";
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
const $ee47bd58c80bd295$var$WHEEL_THICKNESS = 24;
|
|
161
|
+
function $ee47bd58c80bd295$var$ColorWheel(props, ref) {
|
|
162
|
+
props = $9M5jc$useProviderProps(props);
|
|
163
|
+
let { isDisabled: isDisabled } = props;
|
|
164
|
+
let size = props.size && $9M5jc$dimensionValue(props.size);
|
|
165
|
+
let { styleProps: styleProps } = $9M5jc$useStyleProps(props);
|
|
166
|
+
let inputRef = $9M5jc$useRef(null);
|
|
167
|
+
let containerRef = $9M5jc$useFocusableRef(ref, inputRef);
|
|
168
|
+
let [wheelRadius, setWheelRadius] = $9M5jc$useState(null);
|
|
169
|
+
let [wheelThickness, setWheelThickness] = $9M5jc$useState($ee47bd58c80bd295$var$WHEEL_THICKNESS);
|
|
170
|
+
let resizeHandler = $9M5jc$useCallback(()=>{
|
|
171
|
+
if (containerRef.current) {
|
|
172
|
+
setWheelRadius(containerRef.current.offsetWidth / 2);
|
|
173
|
+
let thickness = window.getComputedStyle(containerRef.current).getPropertyValue('--spectrum-colorwheel-track-thickness');
|
|
174
|
+
if (thickness) setWheelThickness(parseInt(thickness, 10));
|
|
175
|
+
}
|
|
176
|
+
}, [
|
|
177
|
+
containerRef,
|
|
178
|
+
setWheelRadius,
|
|
179
|
+
setWheelThickness
|
|
180
|
+
]);
|
|
181
|
+
$9M5jc$useEffect(()=>{
|
|
182
|
+
// the size observer's fallback to the window resize event doesn't fire on mount
|
|
183
|
+
if (wheelRadius == null) resizeHandler();
|
|
184
|
+
}, [
|
|
185
|
+
wheelRadius,
|
|
186
|
+
resizeHandler
|
|
187
|
+
]);
|
|
188
|
+
$9M5jc$useResizeObserver({
|
|
189
|
+
ref: containerRef,
|
|
190
|
+
onResize: resizeHandler
|
|
191
|
+
});
|
|
192
|
+
let state = $9M5jc$useColorWheelState(props);
|
|
193
|
+
let { trackProps: trackProps , inputProps: inputProps , thumbProps: thumbProps } = $9M5jc$useColorWheel({
|
|
194
|
+
...props,
|
|
195
|
+
innerRadius: wheelRadius - wheelThickness,
|
|
196
|
+
outerRadius: wheelRadius
|
|
197
|
+
}, state, inputRef);
|
|
198
|
+
let { focusProps: focusProps , isFocusVisible: isFocusVisible } = $9M5jc$useFocusRing();
|
|
199
|
+
return(/*#__PURE__*/ $9M5jc$react.createElement("div", {
|
|
200
|
+
className: $9M5jc$classNames((/*@__PURE__*/$parcel$interopDefault($3be09cf107a19f45$exports)), 'spectrum-ColorWheel', {
|
|
201
|
+
'is-disabled': isDisabled
|
|
202
|
+
}, styleProps.className),
|
|
203
|
+
ref: containerRef,
|
|
204
|
+
style: {
|
|
205
|
+
...styleProps.style,
|
|
206
|
+
// Workaround around https://github.com/adobe/spectrum-css/issues/1032
|
|
207
|
+
// @ts-ignore
|
|
208
|
+
'width': size,
|
|
209
|
+
'height': size
|
|
210
|
+
}
|
|
211
|
+
}, /*#__PURE__*/ $9M5jc$react.createElement("div", {
|
|
212
|
+
...trackProps,
|
|
213
|
+
className: $9M5jc$classNames((/*@__PURE__*/$parcel$interopDefault($3be09cf107a19f45$exports)), 'spectrum-ColorWheel-gradient')
|
|
214
|
+
}), /*#__PURE__*/ $9M5jc$react.createElement($9be84ecc913588d9$export$a3cc47cee1c1ccc, {
|
|
215
|
+
value: state.getDisplayColor(),
|
|
216
|
+
isFocused: isFocusVisible,
|
|
217
|
+
isDisabled: isDisabled,
|
|
218
|
+
isDragging: state.isDragging,
|
|
219
|
+
className: $9M5jc$classNames((/*@__PURE__*/$parcel$interopDefault($3be09cf107a19f45$exports)), 'spectrum-ColorWheel-handle'),
|
|
220
|
+
...thumbProps
|
|
221
|
+
}, /*#__PURE__*/ $9M5jc$react.createElement("input", {
|
|
222
|
+
...focusProps,
|
|
223
|
+
className: $9M5jc$classNames((/*@__PURE__*/$parcel$interopDefault($3be09cf107a19f45$exports)), 'spectrum-ColorWheel-slider'),
|
|
224
|
+
...inputProps,
|
|
225
|
+
ref: inputRef
|
|
226
|
+
}))));
|
|
194
227
|
}
|
|
195
228
|
/**
|
|
196
229
|
* 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
|
-
})))));
|
|
230
|
+
*/ let $ee47bd58c80bd295$export$f80663f808113381 = /*#__PURE__*/ $9M5jc$react.forwardRef($ee47bd58c80bd295$var$ColorWheel);
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
var $3a860cf91ce0b231$exports = {};
|
|
234
|
+
|
|
235
|
+
$parcel$export($3a860cf91ce0b231$exports, "ColorSlider", () => $3a860cf91ce0b231$export$44fd664bcca5b6fb);
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
var $e37e067892fdabf2$exports = {};
|
|
242
|
+
|
|
243
|
+
$parcel$export($e37e067892fdabf2$exports, "spectrum-ColorSlider", () => $e37e067892fdabf2$export$a5f8b0989b27a604, (v) => $e37e067892fdabf2$export$a5f8b0989b27a604 = v);
|
|
244
|
+
$parcel$export($e37e067892fdabf2$exports, "is-focused", () => $e37e067892fdabf2$export$e7dc768d35940237, (v) => $e37e067892fdabf2$export$e7dc768d35940237 = v);
|
|
245
|
+
$parcel$export($e37e067892fdabf2$exports, "spectrum-ColorSlider-handle", () => $e37e067892fdabf2$export$8c273ba92fabe1f1, (v) => $e37e067892fdabf2$export$8c273ba92fabe1f1 = v);
|
|
246
|
+
$parcel$export($e37e067892fdabf2$exports, "spectrum-ColorSlider-slider", () => $e37e067892fdabf2$export$2f08b72944af536, (v) => $e37e067892fdabf2$export$2f08b72944af536 = v);
|
|
247
|
+
$parcel$export($e37e067892fdabf2$exports, "spectrum-ColorSlider-container--horizontal", () => $e37e067892fdabf2$export$33e97914f6746614, (v) => $e37e067892fdabf2$export$33e97914f6746614 = v);
|
|
248
|
+
$parcel$export($e37e067892fdabf2$exports, "spectrum-ColorSlider-container--vertical", () => $e37e067892fdabf2$export$cd1c093289104c66, (v) => $e37e067892fdabf2$export$cd1c093289104c66 = v);
|
|
249
|
+
$parcel$export($e37e067892fdabf2$exports, "is-disabled", () => $e37e067892fdabf2$export$d35bc1e505d1ebbf, (v) => $e37e067892fdabf2$export$d35bc1e505d1ebbf = v);
|
|
250
|
+
$parcel$export($e37e067892fdabf2$exports, "spectrum-ColorSlider--vertical", () => $e37e067892fdabf2$export$83dcf61b398bfaf1, (v) => $e37e067892fdabf2$export$83dcf61b398bfaf1 = v);
|
|
251
|
+
var $e37e067892fdabf2$export$a5f8b0989b27a604;
|
|
252
|
+
var $e37e067892fdabf2$export$e7dc768d35940237;
|
|
253
|
+
var $e37e067892fdabf2$export$8c273ba92fabe1f1;
|
|
254
|
+
var $e37e067892fdabf2$export$2f08b72944af536;
|
|
255
|
+
var $e37e067892fdabf2$export$33e97914f6746614;
|
|
256
|
+
var $e37e067892fdabf2$export$cd1c093289104c66;
|
|
257
|
+
var $e37e067892fdabf2$export$d35bc1e505d1ebbf;
|
|
258
|
+
var $e37e067892fdabf2$export$83dcf61b398bfaf1;
|
|
259
|
+
$e37e067892fdabf2$export$a5f8b0989b27a604 = "spectrum-ColorSlider_a5bb06";
|
|
260
|
+
$e37e067892fdabf2$export$e7dc768d35940237 = "is-focused_a5bb06";
|
|
261
|
+
$e37e067892fdabf2$export$8c273ba92fabe1f1 = "spectrum-ColorSlider-handle_a5bb06";
|
|
262
|
+
$e37e067892fdabf2$export$2f08b72944af536 = "spectrum-ColorSlider-slider_a5bb06";
|
|
263
|
+
$e37e067892fdabf2$export$33e97914f6746614 = "spectrum-ColorSlider-container--horizontal_a5bb06";
|
|
264
|
+
$e37e067892fdabf2$export$cd1c093289104c66 = "spectrum-ColorSlider-container--vertical_a5bb06";
|
|
265
|
+
$e37e067892fdabf2$export$d35bc1e505d1ebbf = "is-disabled_a5bb06";
|
|
266
|
+
$e37e067892fdabf2$export$83dcf61b398bfaf1 = "spectrum-ColorSlider--vertical_a5bb06";
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
function $3a860cf91ce0b231$var$ColorSlider(props, ref) {
|
|
275
|
+
props = $9M5jc$useProviderProps(props);
|
|
276
|
+
let { isDisabled: isDisabled , channel: channel , orientation: orientation , label: label , showValueLabel: showValueLabel , 'aria-label': ariaLabel } = props;
|
|
277
|
+
let vertical = orientation === 'vertical';
|
|
278
|
+
let { styleProps: styleProps } = $9M5jc$useStyleProps(props);
|
|
279
|
+
let { locale: locale } = $9M5jc$useLocale();
|
|
280
|
+
let inputRef = $9M5jc$useRef();
|
|
281
|
+
let trackRef = $9M5jc$useRef();
|
|
282
|
+
let domRef = $9M5jc$useFocusableRef(ref, inputRef);
|
|
283
|
+
let state = $9M5jc$useColorSliderState({
|
|
284
|
+
...props,
|
|
285
|
+
locale: locale
|
|
286
|
+
});
|
|
287
|
+
// If vertical and a label is provided, use it as an aria-label instead.
|
|
288
|
+
if (vertical && label) {
|
|
289
|
+
ariaLabel = ariaLabel || (typeof label === 'string' ? label : null);
|
|
290
|
+
label = null;
|
|
291
|
+
}
|
|
292
|
+
// If no external label, aria-label or aria-labelledby is provided,
|
|
293
|
+
// default to displaying the localized channel value.
|
|
294
|
+
// Specifically check if label is undefined. If label is `null` then display no visible label.
|
|
295
|
+
// A default aria-label is provided by useColorSlider in that case.
|
|
296
|
+
if (label === undefined && !ariaLabel && !props['aria-labelledby'] && !vertical) label = state.value.getChannelName(channel, locale);
|
|
297
|
+
// Show the value label by default if there is a visible label
|
|
298
|
+
if (showValueLabel == null) showValueLabel = !!label;
|
|
299
|
+
let { inputProps: inputProps , thumbProps: thumbProps , trackProps: trackProps , labelProps: labelProps , outputProps: outputProps } = $9M5jc$useColorSlider({
|
|
300
|
+
...props,
|
|
301
|
+
label: label,
|
|
302
|
+
'aria-label': ariaLabel,
|
|
303
|
+
trackRef: trackRef,
|
|
304
|
+
inputRef: inputRef
|
|
305
|
+
}, state);
|
|
306
|
+
let { isFocusVisible: isFocusVisible } = $9M5jc$useFocusVisible();
|
|
307
|
+
let [isFocused, setIsFocused] = $9M5jc$useState(false);
|
|
308
|
+
let { focusProps: focusProps } = $9M5jc$useFocus({
|
|
309
|
+
isDisabled: isDisabled,
|
|
310
|
+
onFocusChange: setIsFocused
|
|
311
|
+
});
|
|
312
|
+
let alignLabel;
|
|
313
|
+
if (vertical) alignLabel = 'center';
|
|
314
|
+
else if (label != null && showValueLabel) alignLabel = 'space-between';
|
|
315
|
+
else if (label != null) alignLabel = 'flex-start';
|
|
316
|
+
else if (showValueLabel) alignLabel = 'flex-end';
|
|
317
|
+
return(/*#__PURE__*/ $9M5jc$react.createElement("div", {
|
|
318
|
+
ref: domRef,
|
|
319
|
+
...styleProps,
|
|
320
|
+
className: $9M5jc$classNames((/*@__PURE__*/$parcel$interopDefault($e37e067892fdabf2$exports)), {
|
|
321
|
+
'spectrum-ColorSlider-container--horizontal': !vertical,
|
|
322
|
+
'spectrum-ColorSlider-container--vertical': vertical
|
|
323
|
+
})
|
|
324
|
+
}, label && /*#__PURE__*/ $9M5jc$react.createElement($9M5jc$Flex, {
|
|
325
|
+
direction: "row",
|
|
326
|
+
justifyContent: alignLabel
|
|
327
|
+
}, /*#__PURE__*/ $9M5jc$react.createElement($9M5jc$Label, labelProps, label), showValueLabel && /*#__PURE__*/ $9M5jc$react.createElement($9M5jc$Label, {
|
|
328
|
+
elementType: "span"
|
|
329
|
+
}, /*#__PURE__*/ $9M5jc$react.createElement("output", outputProps, state.value.formatChannelValue(channel, locale)))), /*#__PURE__*/ $9M5jc$react.createElement("div", {
|
|
330
|
+
...trackProps,
|
|
331
|
+
ref: trackRef,
|
|
332
|
+
className: $9M5jc$classNames((/*@__PURE__*/$parcel$interopDefault($e37e067892fdabf2$exports)), 'spectrum-ColorSlider', {
|
|
333
|
+
'is-disabled': isDisabled,
|
|
334
|
+
'spectrum-ColorSlider--vertical': vertical
|
|
335
|
+
})
|
|
336
|
+
}, /*#__PURE__*/ $9M5jc$react.createElement($9be84ecc913588d9$export$a3cc47cee1c1ccc, {
|
|
337
|
+
value: state.getDisplayColor(),
|
|
338
|
+
isFocused: isFocused && isFocusVisible,
|
|
339
|
+
isDisabled: isDisabled,
|
|
340
|
+
isDragging: state.isThumbDragging(0),
|
|
341
|
+
className: $9M5jc$classNames((/*@__PURE__*/$parcel$interopDefault($e37e067892fdabf2$exports)), 'spectrum-ColorSlider-handle'),
|
|
342
|
+
...thumbProps
|
|
343
|
+
}, /*#__PURE__*/ $9M5jc$react.createElement("input", {
|
|
344
|
+
...inputProps,
|
|
345
|
+
...focusProps,
|
|
346
|
+
ref: inputRef,
|
|
347
|
+
className: $9M5jc$classNames((/*@__PURE__*/$parcel$interopDefault($e37e067892fdabf2$exports)), 'spectrum-ColorSlider-slider')
|
|
348
|
+
})))));
|
|
319
349
|
}
|
|
320
350
|
/**
|
|
321
351
|
* 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
|
-
|
|
352
|
+
*/ let $3a860cf91ce0b231$export$44fd664bcca5b6fb = /*#__PURE__*/ $9M5jc$react.forwardRef($3a860cf91ce0b231$var$ColorSlider);
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
var $b3466a7ffffb1cfe$exports = {};
|
|
356
|
+
|
|
357
|
+
$parcel$export($b3466a7ffffb1cfe$exports, "ColorField", () => $b3466a7ffffb1cfe$export$b865d4358897bb17);
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
var $ff19ef76a694e21a$exports = {};
|
|
361
|
+
|
|
362
|
+
$parcel$export($ff19ef76a694e21a$exports, "react-spectrum-ColorField-input", () => $ff19ef76a694e21a$export$7d80c6630a750b1, (v) => $ff19ef76a694e21a$export$7d80c6630a750b1 = v);
|
|
363
|
+
var $ff19ef76a694e21a$export$7d80c6630a750b1;
|
|
364
|
+
$ff19ef76a694e21a$export$7d80c6630a750b1 = "react-spectrum-ColorField-input_7bde3a";
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
function $b3466a7ffffb1cfe$var$ColorField(props, ref) {
|
|
372
|
+
props = $9M5jc$useProviderProps(props);
|
|
373
|
+
let { value: // These disabled props are handled by the state hook
|
|
374
|
+
value , defaultValue: defaultValue , onChange: onChange , ...otherProps } = props;
|
|
375
|
+
let state = $9M5jc$useColorFieldState(props);
|
|
376
|
+
let inputRef = $9M5jc$useRef();
|
|
377
|
+
let { labelProps: labelProps , inputProps: inputProps } = $9M5jc$useColorField(otherProps, state, inputRef);
|
|
378
|
+
return(/*#__PURE__*/ $9M5jc$react.createElement($9M5jc$TextFieldBase, {
|
|
379
|
+
...otherProps,
|
|
380
|
+
ref: ref,
|
|
381
|
+
inputRef: inputRef,
|
|
382
|
+
labelProps: labelProps,
|
|
383
|
+
inputProps: inputProps,
|
|
384
|
+
inputClassName: $9M5jc$classNames((/*@__PURE__*/$parcel$interopDefault($ff19ef76a694e21a$exports)), 'react-spectrum-ColorField-input')
|
|
385
|
+
}));
|
|
351
386
|
}
|
|
352
387
|
/**
|
|
353
388
|
* ColorFields allow users to enter a color in #rrggbb hexadecimal format.
|
|
354
|
-
*/
|
|
389
|
+
*/ const $b3466a7ffffb1cfe$export$b865d4358897bb17 = /*#__PURE__*/ $9M5jc$react.forwardRef($b3466a7ffffb1cfe$var$ColorField);
|
|
390
|
+
|
|
391
|
+
|
|
355
392
|
|
|
356
393
|
|
|
357
|
-
export
|
|
394
|
+
export {$ee47bd58c80bd295$export$f80663f808113381 as ColorWheel, $3a860cf91ce0b231$export$44fd664bcca5b6fb as ColorSlider, $b3466a7ffffb1cfe$export$b865d4358897bb17 as ColorField};
|
|
358
395
|
//# sourceMappingURL=module.js.map
|