@react-aria/color 3.0.0-beta.1 → 3.0.0-beta.10

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.js CHANGED
@@ -1,500 +1,1143 @@
1
- var {
2
- useTextField
3
- } = require("@react-aria/textfield");
4
-
5
- var {
6
- useSpinButton
7
- } = require("@react-aria/spinbutton");
8
-
9
- var {
10
- useKeyboard,
11
- useMove
12
- } = require("@react-aria/interactions");
13
-
14
- var {
15
- useCallback,
16
- useRef
17
- } = require("react");
18
-
19
- var {
20
- useSlider,
21
- useSliderThumb
22
- } = require("@react-aria/slider");
23
-
24
- var {
25
- useLocale
26
- } = require("@react-aria/i18n");
27
-
28
- var {
29
- mergeProps,
30
- focusWithoutScrolling,
31
- useGlobalListeners,
32
- useLabels,
33
- useId
34
- } = require("@react-aria/utils");
35
-
36
- var _babelRuntimeHelpersExtends = $parcel$interopDefault(require("@babel/runtime/helpers/extends"));
1
+ var $kZqDi$reactariautils = require("@react-aria/utils");
2
+ var $kZqDi$react = require("react");
3
+ var $kZqDi$reactariainteractions = require("@react-aria/interactions");
4
+ var $kZqDi$reactariai18n = require("@react-aria/i18n");
5
+ var $kZqDi$reactariavisuallyhidden = require("@react-aria/visually-hidden");
6
+ var $kZqDi$reactariaslider = require("@react-aria/slider");
7
+ var $kZqDi$reactariatextfield = require("@react-aria/textfield");
8
+ var $kZqDi$reactariaspinbutton = require("@react-aria/spinbutton");
37
9
 
10
+ function $parcel$exportWildcard(dest, source) {
11
+ Object.keys(source).forEach(function(key) {
12
+ if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
13
+ return;
14
+ }
15
+
16
+ Object.defineProperty(dest, key, {
17
+ enumerable: true,
18
+ get: function get() {
19
+ return source[key];
20
+ }
21
+ });
22
+ });
23
+
24
+ return dest;
25
+ }
38
26
  function $parcel$interopDefault(a) {
39
27
  return a && a.__esModule ? a.default : a;
40
28
  }
29
+ function $parcel$export(e, n, v, s) {
30
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
31
+ }
32
+ var $47925bd68062ac17$exports = {};
41
33
 
42
- /**
43
- * Provides the behavior and accessibility implementation for a color slider component.
44
- * Color sliders allow users to adjust an individual channel of a color value.
45
- */
46
- function useColorSlider(props, state) {
47
- let {
48
- trackRef,
49
- inputRef,
50
- orientation,
51
- channel,
52
- 'aria-label': ariaLabel
53
- } = props;
54
- let {
55
- locale,
56
- direction
57
- } = useLocale(); // Provide a default aria-label if there is no other label provided.
58
-
59
- if (!props.label && !ariaLabel && !props['aria-labelledby']) {
60
- ariaLabel = state.value.getChannelName(channel, locale);
61
- } // @ts-ignore - ignore unused incompatible props
62
-
63
-
64
- let {
65
- groupProps,
66
- trackProps,
67
- labelProps,
68
- outputProps
69
- } = useSlider(_babelRuntimeHelpersExtends({}, props, {
70
- 'aria-label': ariaLabel
71
- }), state, trackRef);
72
- let {
73
- inputProps,
74
- thumbProps
75
- } = useSliderThumb({
76
- index: 0,
77
- orientation,
78
- isDisabled: props.isDisabled,
79
- trackRef,
80
- inputRef
81
- }, state);
82
-
83
- let generateBackground = () => {
84
- let value = state.getDisplayColor();
85
- let to;
86
-
87
- if (orientation === 'vertical') {
88
- to = 'top';
89
- } else if (direction === 'ltr') {
90
- to = 'right';
91
- } else {
92
- to = 'left';
93
- }
34
+ $parcel$export($47925bd68062ac17$exports, "useColorArea", () => $47925bd68062ac17$export$2f92a7a615a014f6);
94
35
 
95
- switch (channel) {
96
- case 'hue':
97
- return "linear-gradient(to " + to + ", rgb(255, 0, 0) 0%, rgb(255, 255, 0) 17%, rgb(0, 255, 0) 33%, rgb(0, 255, 255) 50%, rgb(0, 0, 255) 67%, rgb(255, 0, 255) 83%, rgb(255, 0, 0) 100%)";
98
-
99
- case 'lightness':
100
- {
101
- // We have to add an extra color stop in the middle so that the hue shows up at all.
102
- // Otherwise it will always just be black to white.
103
- let min = state.getThumbMinValue(0);
104
- let max = state.getThumbMaxValue(0);
105
- let start = value.withChannelValue(channel, min).toString('css');
106
- let middle = value.withChannelValue(channel, (max - min) / 2).toString('css');
107
- let end = value.withChannelValue(channel, max).toString('css');
108
- return "linear-gradient(to " + to + ", " + start + ", " + middle + ", " + end + ")";
109
- }
36
+ var $4f97b428b4cbcd4e$exports = {};
37
+ var $f141a15c3076a67b$exports = {};
38
+ $f141a15c3076a67b$exports = JSON.parse("{\"twoDimensionalSlider\":\"شريط تمرير ثنائي الأبعاد\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
110
39
 
111
- case 'saturation':
112
- case 'brightness':
113
- case 'red':
114
- case 'green':
115
- case 'blue':
116
- case 'alpha':
117
- {
118
- let start = value.withChannelValue(channel, state.getThumbMinValue(0)).toString('css');
119
- let end = value.withChannelValue(channel, state.getThumbMaxValue(0)).toString('css');
120
- return "linear-gradient(to " + to + ", " + start + ", " + end + ")";
121
- }
122
40
 
123
- default:
124
- throw new Error('Unknown color channel: ' + channel);
125
- }
126
- };
41
+ var $435ac2a9fdd2ae5e$exports = {};
42
+ $435ac2a9fdd2ae5e$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D плъзгач\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
127
43
 
128
- let thumbPosition = state.getThumbPercent(0);
129
44
 
130
- if (orientation === 'vertical' || direction === 'rtl') {
131
- thumbPosition = 1 - thumbPosition;
132
- }
45
+ var $6b29758b432284f5$exports = {};
46
+ $6b29758b432284f5$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D posuvník\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
133
47
 
134
- return {
135
- trackProps: _babelRuntimeHelpersExtends({}, mergeProps(groupProps, trackProps), {
136
- style: {
137
- position: 'relative',
138
- touchAction: 'none',
139
- background: generateBackground()
140
- }
141
- }),
142
- inputProps,
143
- thumbProps: _babelRuntimeHelpersExtends({}, thumbProps, {
144
- style: {
145
- touchAction: 'none',
146
- position: 'absolute',
147
- [orientation === 'vertical' ? 'top' : 'left']: thumbPosition * 100 + "%",
148
- transform: 'translate(-50%, -50%)'
149
- }
150
- }),
151
- labelProps,
152
- outputProps
153
- };
48
+
49
+ var $357597bcf4afd6fb$exports = {};
50
+ $357597bcf4afd6fb$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D-skyder\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
51
+
52
+
53
+ var $ddc6333960e2b591$exports = {};
54
+ $ddc6333960e2b591$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D-Schieberegler\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
55
+
56
+
57
+ var $417ee93d3ca474c0$exports = {};
58
+ $417ee93d3ca474c0$exports = JSON.parse("{\"twoDimensionalSlider\":\"Ρυθμιστικό 2D\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
59
+
60
+
61
+ var $519561bc6dcff98b$exports = {};
62
+ $519561bc6dcff98b$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D slider\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
63
+
64
+
65
+ var $7a34c3fcc03402b8$exports = {};
66
+ $7a34c3fcc03402b8$exports = JSON.parse("{\"twoDimensionalSlider\":\"Control deslizante en 2D\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
67
+
68
+
69
+ var $860f86d6eae22cba$exports = {};
70
+ $860f86d6eae22cba$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D-liugur\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
71
+
72
+
73
+ var $8525d3c77b8a51b0$exports = {};
74
+ $8525d3c77b8a51b0$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D-liukusäädin\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
75
+
76
+
77
+ var $8240fe6825e900ec$exports = {};
78
+ $8240fe6825e900ec$exports = JSON.parse("{\"twoDimensionalSlider\":\"Curseur 2D\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
79
+
80
+
81
+ var $377849238307c673$exports = {};
82
+ $377849238307c673$exports = JSON.parse("{\"twoDimensionalSlider\":\"מחוון דו-ממדי\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
83
+
84
+
85
+ var $5a6f44e0ec14b083$exports = {};
86
+ $5a6f44e0ec14b083$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D kliznik\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
87
+
88
+
89
+ var $82327d6e71e3e273$exports = {};
90
+ $82327d6e71e3e273$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D csúszka\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
91
+
92
+
93
+ var $b1e297275c248ab8$exports = {};
94
+ $b1e297275c248ab8$exports = JSON.parse("{\"twoDimensionalSlider\":\"Dispositivo di scorrimento 2D\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
95
+
96
+
97
+ var $b39c9f2638b4d2b9$exports = {};
98
+ $b39c9f2638b4d2b9$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D スライダー\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
99
+
100
+
101
+ var $2d2fbf4195848a62$exports = {};
102
+ $2d2fbf4195848a62$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D 슬라이더\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
103
+
104
+
105
+ var $ea88350d0828fa2c$exports = {};
106
+ $ea88350d0828fa2c$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D slankiklis\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
107
+
108
+
109
+ var $0e0acd541630120a$exports = {};
110
+ $0e0acd541630120a$exports = JSON.parse("{\"twoDimensionalSlider\":\"Plaknes slīdnis\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
111
+
112
+
113
+ var $952a458224052046$exports = {};
114
+ $952a458224052046$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D-glidebryter\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
115
+
116
+
117
+ var $2d8e195bc5683483$exports = {};
118
+ $2d8e195bc5683483$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D-schuifregelaar\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
119
+
120
+
121
+ var $750d83f83c5f38d4$exports = {};
122
+ $750d83f83c5f38d4$exports = JSON.parse("{\"twoDimensionalSlider\":\"Suwak 2D\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
123
+
124
+
125
+ var $656b2846f611067c$exports = {};
126
+ $656b2846f611067c$exports = JSON.parse("{\"twoDimensionalSlider\":\"Controle deslizante 2D\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
127
+
128
+
129
+ var $58ce120874d069dd$exports = {};
130
+ $58ce120874d069dd$exports = JSON.parse("{\"twoDimensionalSlider\":\"Controlo de deslize 2D\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
131
+
132
+
133
+ var $fd6c85b4eba18825$exports = {};
134
+ $fd6c85b4eba18825$exports = JSON.parse("{\"twoDimensionalSlider\":\"Cursor 2D\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
135
+
136
+
137
+ var $8849a15ecc435984$exports = {};
138
+ $8849a15ecc435984$exports = JSON.parse("{\"twoDimensionalSlider\":\"Двумерный ползунок\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
139
+
140
+
141
+ var $5192372f064be783$exports = {};
142
+ $5192372f064be783$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D jazdec\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
143
+
144
+
145
+ var $094525f9176df65d$exports = {};
146
+ $094525f9176df65d$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D-drsnik\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
147
+
148
+
149
+ var $9795aa59b4ad40ed$exports = {};
150
+ $9795aa59b4ad40ed$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D клизач\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
151
+
152
+
153
+ var $9ebaa0b485f13e4d$exports = {};
154
+ $9ebaa0b485f13e4d$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D-reglage\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
155
+
156
+
157
+ var $ad58e2e4e0f2e750$exports = {};
158
+ $ad58e2e4e0f2e750$exports = JSON.parse("{\"twoDimensionalSlider\":\"2B slayt gösterisi\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
159
+
160
+
161
+ var $dafc19306f8b2dfc$exports = {};
162
+ $dafc19306f8b2dfc$exports = JSON.parse("{\"twoDimensionalSlider\":\"Повзунок 2D\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
163
+
164
+
165
+ var $d31a8b80af5acc16$exports = {};
166
+ $d31a8b80af5acc16$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D 滑块\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
167
+
168
+
169
+ var $7377d28aec5fa200$exports = {};
170
+ $7377d28aec5fa200$exports = JSON.parse("{\"twoDimensionalSlider\":\"2D 滑桿\",\"colorNameAndValue\":\"{name}: {value}\",\"x/y\":\"{x} / {y}\"}");
171
+
172
+
173
+ $4f97b428b4cbcd4e$exports = {
174
+ "ar-AE": $f141a15c3076a67b$exports,
175
+ "bg-BG": $435ac2a9fdd2ae5e$exports,
176
+ "cs-CZ": $6b29758b432284f5$exports,
177
+ "da-DK": $357597bcf4afd6fb$exports,
178
+ "de-DE": $ddc6333960e2b591$exports,
179
+ "el-GR": $417ee93d3ca474c0$exports,
180
+ "en-US": $519561bc6dcff98b$exports,
181
+ "es-ES": $7a34c3fcc03402b8$exports,
182
+ "et-EE": $860f86d6eae22cba$exports,
183
+ "fi-FI": $8525d3c77b8a51b0$exports,
184
+ "fr-FR": $8240fe6825e900ec$exports,
185
+ "he-IL": $377849238307c673$exports,
186
+ "hr-HR": $5a6f44e0ec14b083$exports,
187
+ "hu-HU": $82327d6e71e3e273$exports,
188
+ "it-IT": $b1e297275c248ab8$exports,
189
+ "ja-JP": $b39c9f2638b4d2b9$exports,
190
+ "ko-KR": $2d2fbf4195848a62$exports,
191
+ "lt-LT": $ea88350d0828fa2c$exports,
192
+ "lv-LV": $0e0acd541630120a$exports,
193
+ "nb-NO": $952a458224052046$exports,
194
+ "nl-NL": $2d8e195bc5683483$exports,
195
+ "pl-PL": $750d83f83c5f38d4$exports,
196
+ "pt-BR": $656b2846f611067c$exports,
197
+ "pt-PT": $58ce120874d069dd$exports,
198
+ "ro-RO": $fd6c85b4eba18825$exports,
199
+ "ru-RU": $8849a15ecc435984$exports,
200
+ "sk-SK": $5192372f064be783$exports,
201
+ "sl-SI": $094525f9176df65d$exports,
202
+ "sr-SP": $9795aa59b4ad40ed$exports,
203
+ "sv-SE": $9ebaa0b485f13e4d$exports,
204
+ "tr-TR": $ad58e2e4e0f2e750$exports,
205
+ "uk-UA": $dafc19306f8b2dfc$exports,
206
+ "zh-CN": $d31a8b80af5acc16$exports,
207
+ "zh-TW": $7377d28aec5fa200$exports
208
+ };
209
+
210
+
211
+
212
+
213
+ const $99936ad0bf67c8c4$var$generateRGB_R = (orientation, dir, zValue)=>{
214
+ let maskImage = `linear-gradient(to ${orientation[Number(!dir)]}, transparent, #000)`;
215
+ let result = {
216
+ colorAreaStyles: {
217
+ backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(${zValue},0,0),rgb(${zValue},255,0))`
218
+ },
219
+ gradientStyles: {
220
+ backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(${zValue},0,255),rgb(${zValue},255,255))`,
221
+ 'WebkitMaskImage': maskImage,
222
+ maskImage: maskImage
223
+ }
224
+ };
225
+ return result;
226
+ };
227
+ const $99936ad0bf67c8c4$var$generateRGB_G = (orientation, dir, zValue)=>{
228
+ let maskImage = `linear-gradient(to ${orientation[Number(!dir)]}, transparent, #000)`;
229
+ let result = {
230
+ colorAreaStyles: {
231
+ backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(0,${zValue},0),rgb(255,${zValue},0))`
232
+ },
233
+ gradientStyles: {
234
+ backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(0,${zValue},255),rgb(255,${zValue},255))`,
235
+ 'WebkitMaskImage': maskImage,
236
+ maskImage: maskImage
237
+ }
238
+ };
239
+ return result;
240
+ };
241
+ const $99936ad0bf67c8c4$var$generateRGB_B = (orientation, dir, zValue)=>{
242
+ let maskImage = `linear-gradient(to ${orientation[Number(!dir)]}, transparent, #000)`;
243
+ let result = {
244
+ colorAreaStyles: {
245
+ backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(0,0,${zValue}),rgb(255,0,${zValue}))`
246
+ },
247
+ gradientStyles: {
248
+ backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(0,255,${zValue}),rgb(255,255,${zValue}))`,
249
+ 'WebkitMaskImage': maskImage,
250
+ maskImage: maskImage
251
+ }
252
+ };
253
+ return result;
254
+ };
255
+ const $99936ad0bf67c8c4$var$generateHSL_H = (orientation, dir, zValue)=>{
256
+ let result = {
257
+ colorAreaStyles: {
258
+ },
259
+ gradientStyles: {
260
+ background: [
261
+ `linear-gradient(to ${orientation[Number(dir)]}, hsla(0,0%,0%,1) 0%, hsla(0,0%,0%,0) 50%, hsla(0,0%,100%,0) 50%, hsla(0,0%,100%,1) 100%)`,
262
+ `linear-gradient(to ${orientation[Number(!dir)]},hsl(0,0%,50%),hsla(0,0%,50%,0))`,
263
+ `hsl(${zValue}, 100%, 50%)`
264
+ ].join(',')
265
+ }
266
+ };
267
+ return result;
268
+ };
269
+ const $99936ad0bf67c8c4$var$generateHSL_S = (orientation, dir, alphaValue)=>{
270
+ let result = {
271
+ colorAreaStyles: {
272
+ },
273
+ gradientStyles: {
274
+ background: [
275
+ `linear-gradient(to ${orientation[Number(!dir)]}, hsla(0,0%,0%,${alphaValue}) 0%, hsla(0,0%,0%,0) 50%, hsla(0,0%,100%,0) 50%, hsla(0,0%,100%,${alphaValue}) 100%)`,
276
+ `linear-gradient(to ${orientation[Number(dir)]},hsla(0,100%,50%,${alphaValue}),hsla(60,100%,50%,${alphaValue}),hsla(120,100%,50%,${alphaValue}),hsla(180,100%,50%,${alphaValue}),hsla(240,100%,50%,${alphaValue}),hsla(300,100%,50%,${alphaValue}),hsla(359,100%,50%,${alphaValue}))`,
277
+ 'hsl(0, 0%, 50%)'
278
+ ].join(',')
279
+ }
280
+ };
281
+ return result;
282
+ };
283
+ const $99936ad0bf67c8c4$var$generateHSL_L = (orientation, dir, zValue)=>{
284
+ let result = {
285
+ colorAreaStyles: {
286
+ },
287
+ gradientStyles: {
288
+ backgroundImage: [
289
+ `linear-gradient(to ${orientation[Number(!dir)]},hsl(0,0%,${zValue}%),hsla(0,0%,${zValue}%,0))`,
290
+ `linear-gradient(to ${orientation[Number(dir)]},hsl(0,100%,${zValue}%),hsl(60,100%,${zValue}%),hsl(120,100%,${zValue}%),hsl(180,100%,${zValue}%),hsl(240,100%,${zValue}%),hsl(300,100%,${zValue}%),hsl(360,100%,${zValue}%))`
291
+ ].join(',')
292
+ }
293
+ };
294
+ return result;
295
+ };
296
+ const $99936ad0bf67c8c4$var$generateHSB_H = (orientation, dir, zValue)=>{
297
+ let result = {
298
+ colorAreaStyles: {
299
+ },
300
+ gradientStyles: {
301
+ background: [
302
+ `linear-gradient(to ${orientation[Number(dir)]},hsl(0,0%,0%),hsla(0,0%,0%,0))`,
303
+ `linear-gradient(to ${orientation[Number(!dir)]},hsl(0,0%,100%),hsla(0,0%,100%,0))`,
304
+ `hsl(${zValue}, 100%, 50%)`
305
+ ].join(',')
306
+ }
307
+ };
308
+ return result;
309
+ };
310
+ const $99936ad0bf67c8c4$var$generateHSB_S = (orientation, dir, alphaValue)=>{
311
+ let result = {
312
+ colorAreaStyles: {
313
+ },
314
+ gradientStyles: {
315
+ background: [
316
+ `linear-gradient(to ${orientation[Number(!dir)]},hsla(0,0%,0%,${alphaValue}),hsla(0,0%,0%,0))`,
317
+ `linear-gradient(to ${orientation[Number(dir)]},hsla(0,100%,50%,${alphaValue}),hsla(60,100%,50%,${alphaValue}),hsla(120,100%,50%,${alphaValue}),hsla(180,100%,50%,${alphaValue}),hsla(240,100%,50%,${alphaValue}),hsla(300,100%,50%,${alphaValue}),hsla(359,100%,50%,${alphaValue}))`,
318
+ `linear-gradient(to ${orientation[Number(!dir)]},hsl(0,0%,0%),hsl(0,0%,100%))`
319
+ ].join(',')
320
+ }
321
+ };
322
+ return result;
323
+ };
324
+ const $99936ad0bf67c8c4$var$generateHSB_B = (orientation, dir, alphaValue)=>{
325
+ let result = {
326
+ colorAreaStyles: {
327
+ },
328
+ gradientStyles: {
329
+ background: [
330
+ `linear-gradient(to ${orientation[Number(!dir)]},hsla(0,0%,100%,${alphaValue}),hsla(0,0%,100%,0))`,
331
+ `linear-gradient(to ${orientation[Number(dir)]},hsla(0,100%,50%,${alphaValue}),hsla(60,100%,50%,${alphaValue}),hsla(120,100%,50%,${alphaValue}),hsla(180,100%,50%,${alphaValue}),hsla(240,100%,50%,${alphaValue}),hsla(300,100%,50%,${alphaValue}),hsla(359,100%,50%,${alphaValue}))`,
332
+ '#000'
333
+ ].join(',')
334
+ }
335
+ };
336
+ return result;
337
+ };
338
+ function $99936ad0bf67c8c4$export$dd62420467d245ca({ direction: direction , state: state , zChannel: zChannel , xChannel: xChannel , isDisabled: isDisabled }) {
339
+ let returnVal = $kZqDi$react.useMemo(()=>{
340
+ let orientation = [
341
+ 'top',
342
+ direction === 'rtl' ? 'left' : 'right'
343
+ ];
344
+ let dir = false;
345
+ let background = {
346
+ colorAreaStyles: {
347
+ },
348
+ gradientStyles: {
349
+ }
350
+ };
351
+ let zValue = state.value.getChannelValue(zChannel);
352
+ let { minValue: zMin , maxValue: zMax } = state.value.getChannelRange(zChannel);
353
+ let alphaValue = (zValue - zMin) / (zMax - zMin);
354
+ let isHSL = state.value.getColorSpace() === 'hsl';
355
+ if (!isDisabled) switch(zChannel){
356
+ case 'red':
357
+ dir = xChannel === 'green';
358
+ background = $99936ad0bf67c8c4$var$generateRGB_R(orientation, dir, zValue);
359
+ break;
360
+ case 'green':
361
+ dir = xChannel === 'red';
362
+ background = $99936ad0bf67c8c4$var$generateRGB_G(orientation, dir, zValue);
363
+ break;
364
+ case 'blue':
365
+ dir = xChannel === 'red';
366
+ background = $99936ad0bf67c8c4$var$generateRGB_B(orientation, dir, zValue);
367
+ break;
368
+ case 'hue':
369
+ dir = xChannel !== 'saturation';
370
+ if (isHSL) background = $99936ad0bf67c8c4$var$generateHSL_H(orientation, dir, zValue);
371
+ else background = $99936ad0bf67c8c4$var$generateHSB_H(orientation, dir, zValue);
372
+ break;
373
+ case 'saturation':
374
+ dir = xChannel === 'hue';
375
+ if (isHSL) background = $99936ad0bf67c8c4$var$generateHSL_S(orientation, dir, alphaValue);
376
+ else background = $99936ad0bf67c8c4$var$generateHSB_S(orientation, dir, alphaValue);
377
+ break;
378
+ case 'brightness':
379
+ dir = xChannel === 'hue';
380
+ background = $99936ad0bf67c8c4$var$generateHSB_B(orientation, dir, alphaValue);
381
+ break;
382
+ case 'lightness':
383
+ dir = xChannel === 'hue';
384
+ background = $99936ad0bf67c8c4$var$generateHSL_L(orientation, dir, zValue);
385
+ break;
386
+ }
387
+ let { x: x , y: y } = state.getThumbPosition();
388
+ if (direction === 'rtl') x = 1 - x;
389
+ return {
390
+ colorAreaStyleProps: {
391
+ style: {
392
+ position: 'relative',
393
+ touchAction: 'none',
394
+ ...background.colorAreaStyles
395
+ }
396
+ },
397
+ gradientStyleProps: {
398
+ style: {
399
+ touchAction: 'none',
400
+ ...background.gradientStyles
401
+ }
402
+ },
403
+ thumbStyleProps: {
404
+ style: {
405
+ position: 'absolute',
406
+ left: `${x * 100}%`,
407
+ top: `${y * 100}%`,
408
+ transform: 'translate(0%, 0%)',
409
+ touchAction: 'none'
410
+ }
411
+ }
412
+ };
413
+ }, [
414
+ direction,
415
+ state,
416
+ zChannel,
417
+ xChannel,
418
+ isDisabled
419
+ ]);
420
+ return returnVal;
154
421
  }
155
422
 
156
- exports.useColorSlider = useColorSlider;
157
- const $c5e318998f160f365e09b073e8447c3d$var$PAGE_MIN_STEP_SIZE = 6;
158
- /**
159
- * Provides the behavior and accessibility implementation for a color wheel component.
160
- * Color wheels allow users to adjust the hue of an HSL or HSB color value on a circular track.
161
- */
162
-
163
- function useColorWheel(props, state, inputRef) {
164
- let {
165
- isDisabled,
166
- step = 1,
167
- innerRadius,
168
- outerRadius,
169
- 'aria-label': ariaLabel
170
- } = props;
171
- let {
172
- addGlobalListener,
173
- removeGlobalListener
174
- } = useGlobalListeners();
175
- let thumbRadius = (innerRadius + outerRadius) / 2;
176
- let focusInput = useCallback(() => {
177
- if (inputRef.current) {
178
- focusWithoutScrolling(inputRef.current);
179
- }
180
- }, [inputRef]);
181
- let stateRef = useRef(null);
182
- stateRef.current = state;
183
- let currentPosition = useRef(null);
184
- let moveHandler = {
185
- onMoveStart() {
186
- currentPosition.current = null;
187
- state.setDragging(true);
188
- },
189
-
190
- onMove(_ref) {
191
- let {
192
- deltaX,
193
- deltaY,
194
- pointerType
195
- } = _ref;
196
-
197
- if (currentPosition.current == null) {
198
- currentPosition.current = stateRef.current.getThumbPosition(thumbRadius);
199
- }
200
423
 
201
- currentPosition.current.x += deltaX;
202
- currentPosition.current.y += deltaY;
203
424
 
204
- if (pointerType === 'keyboard') {
205
- if (deltaX > 0 || deltaY < 0) {
206
- state.increment();
207
- } else if (deltaX < 0 || deltaY > 0) {
208
- state.decrement();
425
+
426
+
427
+ function $47925bd68062ac17$export$2f92a7a615a014f6(props, state) {
428
+ let { isDisabled: isDisabled , inputXRef: inputXRef , inputYRef: inputYRef , containerRef: containerRef } = props;
429
+ let formatMessage = $kZqDi$reactariai18n.useMessageFormatter((/*@__PURE__*/$parcel$interopDefault($4f97b428b4cbcd4e$exports)));
430
+ let { addGlobalListener: addGlobalListener , removeGlobalListener: removeGlobalListener } = $kZqDi$reactariautils.useGlobalListeners();
431
+ let { direction: direction , locale: locale } = $kZqDi$reactariai18n.useLocale();
432
+ let focusedInputRef = $kZqDi$react.useRef(null);
433
+ let focusInput = $kZqDi$react.useCallback((inputRef = inputXRef)=>{
434
+ if (inputRef.current) $kZqDi$reactariautils.focusWithoutScrolling(inputRef.current);
435
+ }, [
436
+ inputXRef
437
+ ]);
438
+ let stateRef = $kZqDi$react.useRef(null);
439
+ stateRef.current = state;
440
+ let { xChannel: xChannel , yChannel: yChannel , zChannel: zChannel } = stateRef.current.channels;
441
+ let xChannelStep1 = stateRef.current.xChannelStep;
442
+ let yChannelStep1 = stateRef.current.yChannelStep;
443
+ let currentPosition = $kZqDi$react.useRef(null);
444
+ let { keyboardProps: keyboardProps } = $kZqDi$reactariainteractions.useKeyboard({
445
+ onKeyDown (e) {
446
+ // these are the cases that useMove doesn't handle
447
+ if (!/^(PageUp|PageDown|Home|End)$/.test(e.key)) {
448
+ e.continuePropagation();
449
+ return;
450
+ }
451
+ // same handling as useMove, don't need to stop propagation, useKeyboard will do that for us
452
+ e.preventDefault();
453
+ // remember to set this and unset it so that onChangeEnd is fired
454
+ stateRef.current.setDragging(true);
455
+ switch(e.key){
456
+ case 'PageUp':
457
+ stateRef.current.incrementY(stateRef.current.yChannelPageStep);
458
+ focusedInputRef.current = inputYRef.current;
459
+ break;
460
+ case 'PageDown':
461
+ stateRef.current.decrementY(stateRef.current.yChannelPageStep);
462
+ focusedInputRef.current = inputYRef.current;
463
+ break;
464
+ case 'Home':
465
+ direction === 'rtl' ? stateRef.current.incrementX(stateRef.current.xChannelPageStep) : stateRef.current.decrementX(stateRef.current.xChannelPageStep);
466
+ focusedInputRef.current = inputXRef.current;
467
+ break;
468
+ case 'End':
469
+ direction === 'rtl' ? stateRef.current.decrementX(stateRef.current.xChannelPageStep) : stateRef.current.incrementX(stateRef.current.xChannelPageStep);
470
+ focusedInputRef.current = inputXRef.current;
471
+ break;
472
+ }
473
+ stateRef.current.setDragging(false);
474
+ if (focusedInputRef.current) {
475
+ focusInput(focusedInputRef.current ? focusedInputRef : inputXRef);
476
+ focusedInputRef.current = undefined;
477
+ }
209
478
  }
210
- } else {
211
- stateRef.current.setHueFromPoint(currentPosition.current.x, currentPosition.current.y, thumbRadius);
212
- }
213
- },
479
+ });
480
+ let moveHandler = {
481
+ onMoveStart () {
482
+ currentPosition.current = null;
483
+ stateRef.current.setDragging(true);
484
+ },
485
+ onMove ({ deltaX: deltaX , deltaY: deltaY , pointerType: pointerType , shiftKey: shiftKey }) {
486
+ let { incrementX: incrementX , decrementX: decrementX , incrementY: incrementY , decrementY: decrementY , xChannelPageStep: xChannelPageStep , xChannelStep: xChannelStep , yChannelPageStep: yChannelPageStep , yChannelStep: yChannelStep , getThumbPosition: getThumbPosition , setColorFromPoint: setColorFromPoint } = stateRef.current;
487
+ if (currentPosition.current == null) currentPosition.current = getThumbPosition();
488
+ let { width: width , height: height } = containerRef.current.getBoundingClientRect();
489
+ if (pointerType === 'keyboard') {
490
+ let deltaXValue = shiftKey && xChannelPageStep > xChannelStep ? xChannelPageStep : xChannelStep;
491
+ let deltaYValue = shiftKey && yChannelPageStep > yChannelStep ? yChannelPageStep : yChannelStep;
492
+ if (deltaX > 0 && direction === 'ltr' || deltaX < 0 && direction === 'rtl') incrementX(deltaXValue);
493
+ else if (deltaX < 0 && direction === 'ltr' || deltaX > 0 && direction === 'rtl') decrementX(deltaXValue);
494
+ else if (deltaY > 0) decrementY(deltaYValue);
495
+ else if (deltaY < 0) incrementY(deltaYValue);
496
+ // set the focused input based on which axis has the greater delta
497
+ focusedInputRef.current = (deltaX !== 0 || deltaY !== 0) && Math.abs(deltaY) > Math.abs(deltaX) ? inputYRef.current : inputXRef.current;
498
+ } else {
499
+ currentPosition.current.x += (direction === 'rtl' ? -1 : 1) * deltaX / width;
500
+ currentPosition.current.y += deltaY / height;
501
+ setColorFromPoint(currentPosition.current.x, currentPosition.current.y);
502
+ }
503
+ },
504
+ onMoveEnd () {
505
+ isOnColorArea.current = undefined;
506
+ stateRef.current.setDragging(false);
507
+ focusInput(focusedInputRef.current ? focusedInputRef : inputXRef);
508
+ focusedInputRef.current = undefined;
509
+ }
510
+ };
511
+ let { moveProps: movePropsThumb } = $kZqDi$reactariainteractions.useMove(moveHandler);
512
+ let currentPointer = $kZqDi$react.useRef(undefined);
513
+ let isOnColorArea = $kZqDi$react.useRef(false);
514
+ let { moveProps: movePropsContainer } = $kZqDi$reactariainteractions.useMove({
515
+ onMoveStart () {
516
+ if (isOnColorArea.current) moveHandler.onMoveStart();
517
+ },
518
+ onMove (e) {
519
+ if (isOnColorArea.current) moveHandler.onMove(e);
520
+ },
521
+ onMoveEnd () {
522
+ if (isOnColorArea.current) moveHandler.onMoveEnd();
523
+ }
524
+ });
525
+ let onThumbDown = (id)=>{
526
+ if (!state.isDragging) {
527
+ currentPointer.current = id;
528
+ focusInput();
529
+ state.setDragging(true);
530
+ if (typeof PointerEvent !== 'undefined') addGlobalListener(window, 'pointerup', onThumbUp, false);
531
+ else {
532
+ addGlobalListener(window, 'mouseup', onThumbUp, false);
533
+ addGlobalListener(window, 'touchend', onThumbUp, false);
534
+ }
535
+ }
536
+ };
537
+ let onThumbUp = (e)=>{
538
+ var ref;
539
+ var _pointerId;
540
+ let id = (_pointerId = e.pointerId) !== null && _pointerId !== void 0 ? _pointerId : (ref = e.changedTouches) === null || ref === void 0 ? void 0 : ref[0].identifier;
541
+ if (id === currentPointer.current) {
542
+ focusInput();
543
+ state.setDragging(false);
544
+ currentPointer.current = undefined;
545
+ isOnColorArea.current = false;
546
+ if (typeof PointerEvent !== 'undefined') removeGlobalListener(window, 'pointerup', onThumbUp, false);
547
+ else {
548
+ removeGlobalListener(window, 'mouseup', onThumbUp, false);
549
+ removeGlobalListener(window, 'touchend', onThumbUp, false);
550
+ }
551
+ }
552
+ };
553
+ let onColorAreaDown = (colorArea, id, clientX, clientY)=>{
554
+ let rect = colorArea.getBoundingClientRect();
555
+ let { width: width , height: height } = rect;
556
+ let x = (clientX - rect.x) / width;
557
+ let y = (clientY - rect.y) / height;
558
+ if (direction === 'rtl') x = 1 - x;
559
+ if (x >= 0 && x <= 1 && y >= 0 && y <= 1 && !state.isDragging && currentPointer.current === undefined) {
560
+ isOnColorArea.current = true;
561
+ currentPointer.current = id;
562
+ state.setColorFromPoint(x, y);
563
+ focusInput();
564
+ state.setDragging(true);
565
+ if (typeof PointerEvent !== 'undefined') addGlobalListener(window, 'pointerup', onColorAreaUp, false);
566
+ else {
567
+ addGlobalListener(window, 'mouseup', onColorAreaUp, false);
568
+ addGlobalListener(window, 'touchend', onColorAreaUp, false);
569
+ }
570
+ }
571
+ };
572
+ let onColorAreaUp = (e)=>{
573
+ var ref;
574
+ var _pointerId;
575
+ let id = (_pointerId = e.pointerId) !== null && _pointerId !== void 0 ? _pointerId : (ref = e.changedTouches) === null || ref === void 0 ? void 0 : ref[0].identifier;
576
+ if (isOnColorArea.current && id === currentPointer.current) {
577
+ isOnColorArea.current = false;
578
+ currentPointer.current = undefined;
579
+ state.setDragging(false);
580
+ focusInput();
581
+ if (typeof PointerEvent !== 'undefined') removeGlobalListener(window, 'pointerup', onColorAreaUp, false);
582
+ else {
583
+ removeGlobalListener(window, 'mouseup', onColorAreaUp, false);
584
+ removeGlobalListener(window, 'touchend', onColorAreaUp, false);
585
+ }
586
+ }
587
+ };
588
+ let colorAreaInteractions = isDisabled ? {
589
+ } : $kZqDi$reactariautils.mergeProps({
590
+ ...typeof PointerEvent !== 'undefined' ? {
591
+ onPointerDown: (e)=>{
592
+ if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) return;
593
+ onColorAreaDown(e.currentTarget, e.pointerId, e.clientX, e.clientY);
594
+ }
595
+ } : {
596
+ onMouseDown: (e)=>{
597
+ if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
598
+ onColorAreaDown(e.currentTarget, undefined, e.clientX, e.clientY);
599
+ },
600
+ onTouchStart: (e)=>{
601
+ onColorAreaDown(e.currentTarget, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY);
602
+ }
603
+ }
604
+ }, movePropsContainer);
605
+ let thumbInteractions = isDisabled ? {
606
+ } : $kZqDi$reactariautils.mergeProps({
607
+ ...typeof PointerEvent !== 'undefined' ? {
608
+ onPointerDown: (e)=>{
609
+ if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) return;
610
+ onThumbDown(e.pointerId);
611
+ }
612
+ } : {
613
+ onMouseDown: (e)=>{
614
+ if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
615
+ onThumbDown(undefined);
616
+ },
617
+ onTouchStart: (e)=>{
618
+ onThumbDown(e.changedTouches[0].identifier);
619
+ }
620
+ }
621
+ }, keyboardProps, movePropsThumb);
622
+ let isMobile = $kZqDi$reactariautils.isIOS() || $kZqDi$reactariautils.isAndroid();
623
+ let xInputLabellingProps = $kZqDi$reactariautils.useLabels({
624
+ ...props,
625
+ 'aria-label': isMobile ? state.value.getChannelName(xChannel, locale) : formatMessage('x/y', {
626
+ x: state.value.getChannelName(xChannel, locale),
627
+ y: state.value.getChannelName(yChannel, locale)
628
+ })
629
+ });
630
+ let yInputLabellingProps = $kZqDi$reactariautils.useLabels({
631
+ ...props,
632
+ 'aria-label': isMobile ? state.value.getChannelName(yChannel, locale) : formatMessage('x/y', {
633
+ x: state.value.getChannelName(xChannel, locale),
634
+ y: state.value.getChannelName(yChannel, locale)
635
+ })
636
+ });
637
+ let colorAriaLabellingProps = $kZqDi$reactariautils.useLabels(props);
638
+ let getValueTitle = ()=>{
639
+ const channels = state.value.getColorChannels();
640
+ const colorNamesAndValues = [];
641
+ channels.forEach((channel)=>colorNamesAndValues.push(formatMessage('colorNameAndValue', {
642
+ name: state.value.getChannelName(channel, locale),
643
+ value: state.value.formatChannelValue(channel, locale)
644
+ }))
645
+ );
646
+ return colorNamesAndValues.length ? colorNamesAndValues.join(', ') : null;
647
+ };
648
+ let ariaRoleDescription = isMobile ? null : formatMessage('twoDimensionalSlider');
649
+ let { visuallyHiddenProps: visuallyHiddenProps } = $kZqDi$reactariavisuallyhidden.useVisuallyHidden({
650
+ style: {
651
+ opacity: '0.0001',
652
+ width: '100%',
653
+ height: '100%',
654
+ pointerEvents: 'none'
655
+ }
656
+ });
657
+ let { colorAreaStyleProps: colorAreaStyleProps , gradientStyleProps: gradientStyleProps , thumbStyleProps: thumbStyleProps } = $99936ad0bf67c8c4$export$dd62420467d245ca({
658
+ direction: direction,
659
+ state: state,
660
+ xChannel: xChannel,
661
+ zChannel: zChannel,
662
+ isDisabled: props.isDisabled
663
+ });
664
+ return {
665
+ colorAreaProps: {
666
+ ...colorAriaLabellingProps,
667
+ ...colorAreaInteractions,
668
+ ...colorAreaStyleProps,
669
+ role: 'group'
670
+ },
671
+ gradientProps: {
672
+ ...gradientStyleProps,
673
+ role: 'presentation'
674
+ },
675
+ thumbProps: {
676
+ ...thumbInteractions,
677
+ ...thumbStyleProps,
678
+ role: 'presentation'
679
+ },
680
+ xInputProps: {
681
+ ...xInputLabellingProps,
682
+ ...visuallyHiddenProps,
683
+ type: 'range',
684
+ min: state.value.getChannelRange(xChannel).minValue,
685
+ max: state.value.getChannelRange(xChannel).maxValue,
686
+ step: xChannelStep1,
687
+ 'aria-roledescription': ariaRoleDescription,
688
+ 'aria-valuetext': isMobile ? formatMessage('colorNameAndValue', {
689
+ name: state.value.getChannelName(xChannel, locale),
690
+ value: state.value.formatChannelValue(xChannel, locale)
691
+ }) : [
692
+ formatMessage('colorNameAndValue', {
693
+ name: state.value.getChannelName(xChannel, locale),
694
+ value: state.value.formatChannelValue(xChannel, locale)
695
+ }),
696
+ formatMessage('colorNameAndValue', {
697
+ name: state.value.getChannelName(yChannel, locale),
698
+ value: state.value.formatChannelValue(yChannel, locale)
699
+ })
700
+ ].join(', '),
701
+ title: getValueTitle(),
702
+ disabled: isDisabled,
703
+ value: state.value.getChannelValue(xChannel),
704
+ tabIndex: 0,
705
+ onChange: (e)=>{
706
+ state.setXValue(parseFloat(e.target.value));
707
+ }
708
+ },
709
+ yInputProps: {
710
+ ...yInputLabellingProps,
711
+ ...visuallyHiddenProps,
712
+ type: 'range',
713
+ min: state.value.getChannelRange(yChannel).minValue,
714
+ max: state.value.getChannelRange(yChannel).maxValue,
715
+ step: yChannelStep1,
716
+ 'aria-roledescription': ariaRoleDescription,
717
+ 'aria-valuetext': isMobile ? formatMessage('colorNameAndValue', {
718
+ name: state.value.getChannelName(yChannel, locale),
719
+ value: state.value.formatChannelValue(yChannel, locale)
720
+ }) : [
721
+ formatMessage('colorNameAndValue', {
722
+ name: state.value.getChannelName(yChannel, locale),
723
+ value: state.value.formatChannelValue(yChannel, locale)
724
+ }),
725
+ formatMessage('colorNameAndValue', {
726
+ name: state.value.getChannelName(xChannel, locale),
727
+ value: state.value.formatChannelValue(xChannel, locale)
728
+ })
729
+ ].join(', '),
730
+ 'aria-orientation': 'vertical',
731
+ title: getValueTitle(),
732
+ disabled: isDisabled,
733
+ value: state.value.getChannelValue(yChannel),
734
+ tabIndex: -1,
735
+ onChange: (e)=>{
736
+ state.setYValue(parseFloat(e.target.value));
737
+ }
738
+ }
739
+ };
740
+ }
214
741
 
215
- onMoveEnd() {
216
- isOnTrack.current = undefined;
217
- state.setDragging(false);
218
- focusInput();
219
- }
220
742
 
221
- };
222
- let {
223
- moveProps: movePropsThumb
224
- } = useMove(moveHandler);
225
- let currentPointer = useRef(undefined);
226
- let isOnTrack = useRef(false);
227
- let {
228
- moveProps: movePropsContainer
229
- } = useMove({
230
- onMoveStart() {
231
- if (isOnTrack.current) {
232
- moveHandler.onMoveStart();
233
- }
234
- },
743
+ var $afbb9647440a7f5b$exports = {};
235
744
 
236
- onMove(e) {
237
- if (isOnTrack.current) {
238
- moveHandler.onMove(e);
239
- }
240
- },
745
+ $parcel$export($afbb9647440a7f5b$exports, "useColorSlider", () => $afbb9647440a7f5b$export$106b7a4e66508f66);
241
746
 
242
- onMoveEnd() {
243
- if (isOnTrack.current) {
244
- moveHandler.onMoveEnd();
245
- }
246
- }
247
747
 
248
- });
249
748
 
250
- let onThumbDown = id => {
251
- if (!state.isDragging) {
252
- currentPointer.current = id;
253
- focusInput();
254
- state.setDragging(true);
255
- addGlobalListener(window, 'mouseup', onThumbUp, false);
256
- addGlobalListener(window, 'touchend', onThumbUp, false);
257
- addGlobalListener(window, 'pointerup', onThumbUp, false);
258
- }
259
- };
749
+ function $afbb9647440a7f5b$export$106b7a4e66508f66(props, state) {
750
+ let { trackRef: trackRef , inputRef: inputRef , orientation: orientation , channel: channel , 'aria-label': ariaLabel } = props;
751
+ let { locale: locale , direction: direction } = $kZqDi$reactariai18n.useLocale();
752
+ // Provide a default aria-label if there is no other label provided.
753
+ if (!props.label && !ariaLabel && !props['aria-labelledby']) ariaLabel = state.value.getChannelName(channel, locale);
754
+ // @ts-ignore - ignore unused incompatible props
755
+ let { groupProps: groupProps , trackProps: trackProps , labelProps: labelProps , outputProps: outputProps } = $kZqDi$reactariaslider.useSlider({
756
+ ...props,
757
+ 'aria-label': ariaLabel
758
+ }, state, trackRef);
759
+ let { inputProps: inputProps , thumbProps: thumbProps } = $kZqDi$reactariaslider.useSliderThumb({
760
+ index: 0,
761
+ orientation: orientation,
762
+ isDisabled: props.isDisabled,
763
+ trackRef: trackRef,
764
+ inputRef: inputRef
765
+ }, state);
766
+ let generateBackground = ()=>{
767
+ let value = state.getDisplayColor();
768
+ let to;
769
+ if (orientation === 'vertical') to = 'top';
770
+ else if (direction === 'ltr') to = 'right';
771
+ else to = 'left';
772
+ switch(channel){
773
+ case 'hue':
774
+ return `linear-gradient(to ${to}, rgb(255, 0, 0) 0%, rgb(255, 255, 0) 17%, rgb(0, 255, 0) 33%, rgb(0, 255, 255) 50%, rgb(0, 0, 255) 67%, rgb(255, 0, 255) 83%, rgb(255, 0, 0) 100%)`;
775
+ case 'lightness':
776
+ {
777
+ // We have to add an extra color stop in the middle so that the hue shows up at all.
778
+ // Otherwise it will always just be black to white.
779
+ let min = state.getThumbMinValue(0);
780
+ let max = state.getThumbMaxValue(0);
781
+ let start = value.withChannelValue(channel, min).toString('css');
782
+ let middle = value.withChannelValue(channel, (max - min) / 2).toString('css');
783
+ let end = value.withChannelValue(channel, max).toString('css');
784
+ return `linear-gradient(to ${to}, ${start}, ${middle}, ${end})`;
785
+ }
786
+ case 'saturation':
787
+ case 'brightness':
788
+ case 'red':
789
+ case 'green':
790
+ case 'blue':
791
+ case 'alpha':
792
+ {
793
+ let start = value.withChannelValue(channel, state.getThumbMinValue(0)).toString('css');
794
+ let end = value.withChannelValue(channel, state.getThumbMaxValue(0)).toString('css');
795
+ return `linear-gradient(to ${to}, ${start}, ${end})`;
796
+ }
797
+ default:
798
+ throw new Error('Unknown color channel: ' + channel);
799
+ }
800
+ };
801
+ let thumbPosition = state.getThumbPercent(0);
802
+ if (orientation === 'vertical' || direction === 'rtl') thumbPosition = 1 - thumbPosition;
803
+ return {
804
+ trackProps: {
805
+ ...$kZqDi$reactariautils.mergeProps(groupProps, trackProps),
806
+ style: {
807
+ position: 'relative',
808
+ touchAction: 'none',
809
+ background: generateBackground()
810
+ }
811
+ },
812
+ inputProps: inputProps,
813
+ thumbProps: {
814
+ ...thumbProps,
815
+ style: {
816
+ touchAction: 'none',
817
+ position: 'absolute',
818
+ [orientation === 'vertical' ? 'top' : 'left']: `${thumbPosition * 100}%`,
819
+ transform: 'translate(-50%, -50%)'
820
+ }
821
+ },
822
+ labelProps: labelProps,
823
+ outputProps: outputProps
824
+ };
825
+ }
260
826
 
261
- let onThumbUp = e => {
262
- var _e$pointerId, _e$changedTouches;
263
827
 
264
- let id = (_e$pointerId = e.pointerId) != null ? _e$pointerId : (_e$changedTouches = e.changedTouches) == null ? void 0 : _e$changedTouches[0].identifier;
828
+ var $1d29bf243d4a9a53$exports = {};
265
829
 
266
- if (id === currentPointer.current) {
267
- focusInput();
268
- state.setDragging(false);
269
- currentPointer.current = undefined;
270
- isOnTrack.current = false;
271
- removeGlobalListener(window, 'mouseup', onThumbUp, false);
272
- removeGlobalListener(window, 'touchend', onThumbUp, false);
273
- removeGlobalListener(window, 'pointerup', onThumbUp, false);
274
- }
275
- };
276
-
277
- let onTrackDown = (track, id, pageX, pageY) => {
278
- let rect = track.getBoundingClientRect();
279
- let x = pageX - rect.x - rect.width / 2;
280
- let y = pageY - rect.y - rect.height / 2;
281
- let radius = Math.sqrt(x * x + y * y);
282
-
283
- if (innerRadius < radius && radius < outerRadius && !state.isDragging && currentPointer.current === undefined) {
284
- isOnTrack.current = true;
285
- currentPointer.current = id;
286
- stateRef.current.setHueFromPoint(x, y, radius);
287
- focusInput();
288
- state.setDragging(true);
289
- addGlobalListener(window, 'mouseup', onTrackUp, false);
290
- addGlobalListener(window, 'touchend', onTrackUp, false);
291
- addGlobalListener(window, 'pointerup', onTrackUp, false);
292
- }
293
- };
830
+ $parcel$export($1d29bf243d4a9a53$exports, "useColorWheel", () => $1d29bf243d4a9a53$export$9064ff4e44b3729a);
294
831
 
295
- let onTrackUp = e => {
296
- var _e$pointerId2, _e$changedTouches2;
297
832
 
298
- let id = (_e$pointerId2 = e.pointerId) != null ? _e$pointerId2 : (_e$changedTouches2 = e.changedTouches) == null ? void 0 : _e$changedTouches2[0].identifier;
299
833
 
300
- if (isOnTrack.current && id === currentPointer.current) {
301
- isOnTrack.current = false;
302
- currentPointer.current = undefined;
303
- state.setDragging(false);
304
- focusInput();
305
- removeGlobalListener(window, 'mouseup', onTrackUp, false);
306
- removeGlobalListener(window, 'touchend', onTrackUp, false);
307
- removeGlobalListener(window, 'pointerup', onTrackUp, false);
308
- }
309
- };
310
-
311
- let {
312
- keyboardProps
313
- } = useKeyboard({
314
- onKeyDown(e) {
315
- switch (e.key) {
316
- case 'PageUp':
317
- e.preventDefault();
318
- state.increment($c5e318998f160f365e09b073e8447c3d$var$PAGE_MIN_STEP_SIZE);
319
- break;
320
-
321
- case 'PageDown':
322
- e.preventDefault();
323
- state.decrement($c5e318998f160f365e09b073e8447c3d$var$PAGE_MIN_STEP_SIZE);
324
- break;
325
- }
326
- }
327
834
 
328
- });
329
- let trackInteractions = isDisabled ? {} : mergeProps({
330
- onMouseDown: e => {
331
- if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {
332
- return;
333
- }
835
+ function $1d29bf243d4a9a53$export$9064ff4e44b3729a(props, state, inputRef) {
836
+ let { isDisabled: isDisabled , innerRadius: innerRadius , outerRadius: outerRadius , 'aria-label': ariaLabel } = props;
837
+ let { addGlobalListener: addGlobalListener , removeGlobalListener: removeGlobalListener } = $kZqDi$reactariautils.useGlobalListeners();
838
+ let thumbRadius = (innerRadius + outerRadius) / 2;
839
+ let focusInput = $kZqDi$react.useCallback(()=>{
840
+ if (inputRef.current) $kZqDi$reactariautils.focusWithoutScrolling(inputRef.current);
841
+ }, [
842
+ inputRef
843
+ ]);
844
+ let stateRef = $kZqDi$react.useRef(null);
845
+ stateRef.current = state;
846
+ let currentPosition = $kZqDi$react.useRef(null);
847
+ let { keyboardProps: keyboardProps } = $kZqDi$reactariainteractions.useKeyboard({
848
+ onKeyDown (e) {
849
+ // these are the cases that useMove doesn't handle
850
+ if (!/^(PageUp|PageDown)$/.test(e.key)) {
851
+ e.continuePropagation();
852
+ return;
853
+ }
854
+ // same handling as useMove, don't need to stop propagation, useKeyboard will do that for us
855
+ e.preventDefault();
856
+ // remember to set this and unset it so that onChangeEnd is fired
857
+ stateRef.current.setDragging(true);
858
+ switch(e.key){
859
+ case 'PageUp':
860
+ e.preventDefault();
861
+ state.increment(stateRef.current.pageStep);
862
+ break;
863
+ case 'PageDown':
864
+ e.preventDefault();
865
+ state.decrement(stateRef.current.pageStep);
866
+ break;
867
+ }
868
+ stateRef.current.setDragging(false);
869
+ }
870
+ });
871
+ let moveHandler = {
872
+ onMoveStart () {
873
+ currentPosition.current = null;
874
+ state.setDragging(true);
875
+ },
876
+ onMove ({ deltaX: deltaX , deltaY: deltaY , pointerType: pointerType , shiftKey: shiftKey }) {
877
+ if (currentPosition.current == null) currentPosition.current = stateRef.current.getThumbPosition(thumbRadius);
878
+ currentPosition.current.x += deltaX;
879
+ currentPosition.current.y += deltaY;
880
+ if (pointerType === 'keyboard') {
881
+ if (deltaX > 0 || deltaY < 0) state.increment(shiftKey ? stateRef.current.pageStep : stateRef.current.step);
882
+ else if (deltaX < 0 || deltaY > 0) state.decrement(shiftKey ? stateRef.current.pageStep : stateRef.current.step);
883
+ } else stateRef.current.setHueFromPoint(currentPosition.current.x, currentPosition.current.y, thumbRadius);
884
+ },
885
+ onMoveEnd () {
886
+ isOnTrack.current = undefined;
887
+ state.setDragging(false);
888
+ focusInput();
889
+ }
890
+ };
891
+ let { moveProps: movePropsThumb } = $kZqDi$reactariainteractions.useMove(moveHandler);
892
+ let currentPointer = $kZqDi$react.useRef(undefined);
893
+ let isOnTrack = $kZqDi$react.useRef(false);
894
+ let { moveProps: movePropsContainer } = $kZqDi$reactariainteractions.useMove({
895
+ onMoveStart () {
896
+ if (isOnTrack.current) moveHandler.onMoveStart();
897
+ },
898
+ onMove (e) {
899
+ if (isOnTrack.current) moveHandler.onMove(e);
900
+ },
901
+ onMoveEnd () {
902
+ if (isOnTrack.current) moveHandler.onMoveEnd();
903
+ }
904
+ });
905
+ let onThumbDown = (id)=>{
906
+ if (!state.isDragging) {
907
+ currentPointer.current = id;
908
+ focusInput();
909
+ state.setDragging(true);
910
+ if (typeof PointerEvent !== 'undefined') addGlobalListener(window, 'pointerup', onThumbUp, false);
911
+ else {
912
+ addGlobalListener(window, 'mouseup', onThumbUp, false);
913
+ addGlobalListener(window, 'touchend', onThumbUp, false);
914
+ }
915
+ }
916
+ };
917
+ let onThumbUp = (e)=>{
918
+ var ref;
919
+ var _pointerId;
920
+ let id = (_pointerId = e.pointerId) !== null && _pointerId !== void 0 ? _pointerId : (ref = e.changedTouches) === null || ref === void 0 ? void 0 : ref[0].identifier;
921
+ if (id === currentPointer.current) {
922
+ focusInput();
923
+ state.setDragging(false);
924
+ currentPointer.current = undefined;
925
+ isOnTrack.current = false;
926
+ if (typeof PointerEvent !== 'undefined') removeGlobalListener(window, 'pointerup', onThumbUp, false);
927
+ else {
928
+ removeGlobalListener(window, 'mouseup', onThumbUp, false);
929
+ removeGlobalListener(window, 'touchend', onThumbUp, false);
930
+ }
931
+ }
932
+ };
933
+ let onTrackDown = (track, id, pageX, pageY)=>{
934
+ let rect = track.getBoundingClientRect();
935
+ let x = pageX - rect.x - rect.width / 2;
936
+ let y = pageY - rect.y - rect.height / 2;
937
+ let radius = Math.sqrt(x * x + y * y);
938
+ if (innerRadius < radius && radius < outerRadius && !state.isDragging && currentPointer.current === undefined) {
939
+ isOnTrack.current = true;
940
+ currentPointer.current = id;
941
+ stateRef.current.setHueFromPoint(x, y, radius);
942
+ focusInput();
943
+ state.setDragging(true);
944
+ if (typeof PointerEvent !== 'undefined') addGlobalListener(window, 'pointerup', onTrackUp, false);
945
+ else {
946
+ addGlobalListener(window, 'mouseup', onTrackUp, false);
947
+ addGlobalListener(window, 'touchend', onTrackUp, false);
948
+ }
949
+ }
950
+ };
951
+ let onTrackUp = (e)=>{
952
+ var ref;
953
+ var _pointerId;
954
+ let id = (_pointerId = e.pointerId) !== null && _pointerId !== void 0 ? _pointerId : (ref = e.changedTouches) === null || ref === void 0 ? void 0 : ref[0].identifier;
955
+ if (isOnTrack.current && id === currentPointer.current) {
956
+ isOnTrack.current = false;
957
+ currentPointer.current = undefined;
958
+ state.setDragging(false);
959
+ focusInput();
960
+ if (typeof PointerEvent !== 'undefined') removeGlobalListener(window, 'pointerup', onTrackUp, false);
961
+ else {
962
+ removeGlobalListener(window, 'mouseup', onTrackUp, false);
963
+ removeGlobalListener(window, 'touchend', onTrackUp, false);
964
+ }
965
+ }
966
+ };
967
+ let trackInteractions = isDisabled ? {
968
+ } : $kZqDi$reactariautils.mergeProps({
969
+ ...typeof PointerEvent !== 'undefined' ? {
970
+ onPointerDown: (e)=>{
971
+ if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) return;
972
+ onTrackDown(e.currentTarget, e.pointerId, e.clientX, e.clientY);
973
+ }
974
+ } : {
975
+ onMouseDown: (e)=>{
976
+ if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
977
+ onTrackDown(e.currentTarget, undefined, e.clientX, e.clientY);
978
+ },
979
+ onTouchStart: (e)=>{
980
+ onTrackDown(e.currentTarget, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY);
981
+ }
982
+ }
983
+ }, movePropsContainer);
984
+ let thumbInteractions = isDisabled ? {
985
+ } : $kZqDi$reactariautils.mergeProps({
986
+ onMouseDown: (e)=>{
987
+ if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
988
+ onThumbDown(undefined);
989
+ },
990
+ onPointerDown: (e)=>{
991
+ if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) return;
992
+ onThumbDown(e.pointerId);
993
+ },
994
+ onTouchStart: (e)=>{
995
+ onThumbDown(e.changedTouches[0].identifier);
996
+ }
997
+ }, keyboardProps, movePropsThumb);
998
+ let { x: x1 , y: y1 } = state.getThumbPosition(thumbRadius);
999
+ // Provide a default aria-label if none is given
1000
+ let { locale: locale } = $kZqDi$reactariai18n.useLocale();
1001
+ if (ariaLabel == null && props['aria-labelledby'] == null) ariaLabel = state.value.getChannelName('hue', locale);
1002
+ let inputLabellingProps = $kZqDi$reactariautils.useLabels({
1003
+ ...props,
1004
+ 'aria-label': ariaLabel
1005
+ });
1006
+ let { minValue: minValue , maxValue: maxValue , step: step } = state.value.getChannelRange('hue');
1007
+ return {
1008
+ trackProps: {
1009
+ ...trackInteractions,
1010
+ style: {
1011
+ position: 'relative',
1012
+ touchAction: 'none',
1013
+ width: outerRadius * 2,
1014
+ height: outerRadius * 2,
1015
+ background: `
1016
+ conic-gradient(
1017
+ from 90deg,
1018
+ hsl(0, 100%, 50%),
1019
+ hsl(30, 100%, 50%),
1020
+ hsl(60, 100%, 50%),
1021
+ hsl(90, 100%, 50%),
1022
+ hsl(120, 100%, 50%),
1023
+ hsl(150, 100%, 50%),
1024
+ hsl(180, 100%, 50%),
1025
+ hsl(210, 100%, 50%),
1026
+ hsl(240, 100%, 50%),
1027
+ hsl(270, 100%, 50%),
1028
+ hsl(300, 100%, 50%),
1029
+ hsl(330, 100%, 50%),
1030
+ hsl(360, 100%, 50%)
1031
+ )
1032
+ `,
1033
+ clipPath: `path(evenodd, "${$1d29bf243d4a9a53$var$circlePath(outerRadius, outerRadius, outerRadius)} ${$1d29bf243d4a9a53$var$circlePath(outerRadius, outerRadius, innerRadius)}")`
1034
+ }
1035
+ },
1036
+ thumbProps: {
1037
+ ...thumbInteractions,
1038
+ style: {
1039
+ position: 'absolute',
1040
+ left: '50%',
1041
+ top: '50%',
1042
+ transform: `translate(calc(${x1}px - 50%), calc(${y1}px - 50%))`,
1043
+ touchAction: 'none'
1044
+ }
1045
+ },
1046
+ inputProps: $kZqDi$reactariautils.mergeProps(inputLabellingProps, {
1047
+ type: 'range',
1048
+ min: String(minValue),
1049
+ max: String(maxValue),
1050
+ step: String(step),
1051
+ 'aria-valuetext': state.value.formatChannelValue('hue', locale),
1052
+ disabled: isDisabled,
1053
+ value: `${state.value.getChannelValue('hue')}`,
1054
+ onChange: (e)=>{
1055
+ state.setHue(parseFloat(e.target.value));
1056
+ }
1057
+ })
1058
+ };
1059
+ }
1060
+ // Creates an SVG path string for a circle.
1061
+ function $1d29bf243d4a9a53$var$circlePath(cx, cy, r) {
1062
+ return `M ${cx}, ${cy} m ${-r}, 0 a ${r}, ${r}, 0, 1, 0, ${r * 2}, 0 a ${r}, ${r}, 0, 1, 0 ${-r * 2}, 0`;
1063
+ }
334
1064
 
335
- onTrackDown(e.currentTarget, undefined, e.clientX, e.clientY);
336
- },
337
- onPointerDown: e => {
338
- if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) {
339
- return;
340
- }
341
1065
 
342
- onTrackDown(e.currentTarget, e.pointerId, e.clientX, e.clientY);
343
- },
344
- onTouchStart: e => {
345
- onTrackDown(e.currentTarget, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY);
346
- }
347
- }, movePropsContainer);
348
- let thumbInteractions = isDisabled ? {} : mergeProps({
349
- onMouseDown: e => {
350
- if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {
351
- return;
352
- }
1066
+ var $58c850037bc7a7ce$exports = {};
353
1067
 
354
- onThumbDown(undefined);
355
- },
356
- onPointerDown: e => {
357
- if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) {
358
- return;
359
- }
1068
+ $parcel$export($58c850037bc7a7ce$exports, "useColorField", () => $58c850037bc7a7ce$export$77e32ca575a28fdf);
360
1069
 
361
- onThumbDown(e.pointerId);
362
- },
363
- onTouchStart: e => {
364
- onThumbDown(e.changedTouches[0].identifier);
365
- }
366
- }, movePropsThumb, keyboardProps);
367
- let {
368
- x,
369
- y
370
- } = state.getThumbPosition(thumbRadius); // Provide a default aria-label if none is given
371
-
372
- let {
373
- locale
374
- } = useLocale();
375
-
376
- if (ariaLabel == null && props['aria-labelledby'] == null) {
377
- ariaLabel = state.value.getChannelName('hue', locale);
378
- }
379
-
380
- let inputLabellingProps = useLabels(_babelRuntimeHelpersExtends({}, props, {
381
- 'aria-label': ariaLabel
382
- }));
383
- return {
384
- trackProps: _babelRuntimeHelpersExtends({}, trackInteractions, {
385
- style: {
386
- position: 'relative',
387
- touchAction: 'none',
388
- width: outerRadius * 2,
389
- height: outerRadius * 2,
390
- background: "\n conic-gradient(\n from 90deg,\n hsl(0, 100%, 50%),\n hsl(30, 100%, 50%),\n hsl(60, 100%, 50%),\n hsl(90, 100%, 50%),\n hsl(120, 100%, 50%),\n hsl(150, 100%, 50%),\n hsl(180, 100%, 50%),\n hsl(210, 100%, 50%),\n hsl(240, 100%, 50%),\n hsl(270, 100%, 50%),\n hsl(300, 100%, 50%),\n hsl(330, 100%, 50%),\n hsl(360, 100%, 50%)\n )\n ",
391
- clipPath: "path(evenodd, \"" + $c5e318998f160f365e09b073e8447c3d$var$circlePath(outerRadius, outerRadius, outerRadius) + " " + $c5e318998f160f365e09b073e8447c3d$var$circlePath(outerRadius, outerRadius, innerRadius) + "\")"
392
- }
393
- }),
394
- thumbProps: _babelRuntimeHelpersExtends({}, thumbInteractions, {
395
- style: {
396
- position: 'absolute',
397
- left: '50%',
398
- top: '50%',
399
- transform: "translate(calc(" + x + "px - 50%), calc(" + y + "px - 50%))",
400
- touchAction: 'none'
401
- }
402
- }),
403
- inputProps: mergeProps(inputLabellingProps, {
404
- type: 'range',
405
- min: '0',
406
- max: '360',
407
- step: String(step),
408
- 'aria-valuetext': state.value.formatChannelValue('hue', locale),
409
- disabled: isDisabled,
410
- value: "" + state.value.getChannelValue('hue'),
411
- onChange: e => {
412
- state.setHue(parseFloat(e.target.value));
413
- }
414
- })
415
- };
416
- } // Creates an SVG path string for a circle.
417
1070
 
418
1071
 
419
- exports.useColorWheel = useColorWheel;
420
1072
 
421
- function $c5e318998f160f365e09b073e8447c3d$var$circlePath(cx, cy, r) {
422
- return "M " + cx + ", " + cy + " m " + -r + ", 0 a " + r + ", " + r + ", 0, 1, 0, " + r * 2 + ", 0 a " + r + ", " + r + ", 0, 1, 0 " + -r * 2 + ", 0";
1073
+
1074
+ function $58c850037bc7a7ce$export$77e32ca575a28fdf(props, state, ref) {
1075
+ let { isDisabled: isDisabled , isReadOnly: isReadOnly , isRequired: isRequired } = props;
1076
+ let { colorValue: colorValue , inputValue: inputValue , commit: commit , increment: increment , decrement: decrement , incrementToMax: incrementToMax , decrementToMin: decrementToMin } = state;
1077
+ let inputId = $kZqDi$reactariautils.useId();
1078
+ let { spinButtonProps: spinButtonProps } = $kZqDi$reactariaspinbutton.useSpinButton({
1079
+ isDisabled: isDisabled,
1080
+ isReadOnly: isReadOnly,
1081
+ isRequired: isRequired,
1082
+ maxValue: 16777215,
1083
+ minValue: 0,
1084
+ onIncrement: increment,
1085
+ onIncrementToMax: incrementToMax,
1086
+ onDecrement: decrement,
1087
+ onDecrementToMin: decrementToMin,
1088
+ value: colorValue ? colorValue.toHexInt() : undefined,
1089
+ textValue: colorValue ? colorValue.toString('hex') : undefined
1090
+ });
1091
+ let [focusWithin, setFocusWithin] = $kZqDi$react.useState(false);
1092
+ let { focusWithinProps: focusWithinProps } = $kZqDi$reactariainteractions.useFocusWithin({
1093
+ isDisabled: isDisabled,
1094
+ onFocusWithinChange: setFocusWithin
1095
+ });
1096
+ let onWheel = $kZqDi$react.useCallback((e)=>{
1097
+ if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) return;
1098
+ if (e.deltaY > 0) increment();
1099
+ else if (e.deltaY < 0) decrement();
1100
+ }, [
1101
+ decrement,
1102
+ increment
1103
+ ]);
1104
+ // If the input isn't supposed to receive input, disable scrolling.
1105
+ let scrollingDisabled = isDisabled || isReadOnly || !focusWithin;
1106
+ $kZqDi$reactariainteractions.useScrollWheel({
1107
+ onScroll: onWheel,
1108
+ isDisabled: scrollingDisabled
1109
+ }, ref);
1110
+ let onChange = (value)=>{
1111
+ state.setInputValue(value);
1112
+ };
1113
+ let { labelProps: labelProps , inputProps: inputProps } = $kZqDi$reactariatextfield.useFormattedTextField($kZqDi$reactariautils.mergeProps(props, {
1114
+ id: inputId,
1115
+ value: inputValue,
1116
+ defaultValue: undefined,
1117
+ type: 'text',
1118
+ autoComplete: 'off',
1119
+ onChange: onChange
1120
+ }), state, ref);
1121
+ return {
1122
+ labelProps: labelProps,
1123
+ inputProps: $kZqDi$reactariautils.mergeProps(inputProps, spinButtonProps, focusWithinProps, {
1124
+ role: 'textbox',
1125
+ 'aria-valuemax': null,
1126
+ 'aria-valuemin': null,
1127
+ 'aria-valuenow': null,
1128
+ 'aria-valuetext': null,
1129
+ autoCorrect: 'off',
1130
+ spellCheck: 'false',
1131
+ onBlur: commit
1132
+ })
1133
+ };
423
1134
  }
424
1135
 
425
- /**
426
- * Provides the behavior and accessibility implementation for a color field component.
427
- * Color fields allow users to enter and adjust a hex color value.
428
- */
429
- function useColorField(props, state, ref) {
430
- let {
431
- isDisabled,
432
- isReadOnly,
433
- isRequired
434
- } = props;
435
- let {
436
- colorValue,
437
- inputValue,
438
- setInputValue,
439
- commit,
440
- increment,
441
- decrement,
442
- incrementToMax,
443
- decrementToMin
444
- } = state;
445
- let inputId = useId();
446
- let {
447
- spinButtonProps
448
- } = useSpinButton({
449
- isDisabled,
450
- isReadOnly,
451
- isRequired,
452
- maxValue: 0xFFFFFF,
453
- minValue: 0,
454
- onIncrement: increment,
455
- onIncrementToMax: incrementToMax,
456
- onDecrement: decrement,
457
- onDecrementToMin: decrementToMin,
458
- value: colorValue ? colorValue.toHexInt() : undefined,
459
- textValue: colorValue ? colorValue.toString('hex') : undefined
460
- });
461
1136
 
462
- let onWheel = e => {
463
- if (isDisabled || isReadOnly) {
464
- return;
465
- }
1137
+ $parcel$exportWildcard(module.exports, $47925bd68062ac17$exports);
1138
+ $parcel$exportWildcard(module.exports, $afbb9647440a7f5b$exports);
1139
+ $parcel$exportWildcard(module.exports, $1d29bf243d4a9a53$exports);
1140
+ $parcel$exportWildcard(module.exports, $58c850037bc7a7ce$exports);
466
1141
 
467
- if (e.deltaY < 0) {
468
- increment();
469
- } else {
470
- decrement();
471
- }
472
- };
473
-
474
- let {
475
- labelProps,
476
- inputProps
477
- } = useTextField(mergeProps(props, {
478
- id: inputId,
479
- value: inputValue,
480
- type: 'text',
481
- autoComplete: 'off',
482
- onChange: setInputValue
483
- }), ref);
484
- return {
485
- labelProps,
486
- inputProps: mergeProps(inputProps, spinButtonProps, {
487
- role: 'textbox',
488
- 'aria-valuemax': null,
489
- 'aria-valuemin': null,
490
- 'aria-valuenow': null,
491
- 'aria-valuetext': null,
492
- autoCorrect: 'off',
493
- onBlur: commit,
494
- onWheel
495
- })
496
- };
497
- }
498
1142
 
499
- exports.useColorField = useColorField;
500
1143
  //# sourceMappingURL=main.js.map