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

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,1160 @@
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
- }
110
-
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
-
123
- default:
124
- throw new Error('Unknown color channel: ' + channel);
125
- }
126
- };
36
+ var $4f97b428b4cbcd4e$exports = {};
37
+ var $f141a15c3076a67b$exports = {};
38
+ $f141a15c3076a67b$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"أداة انتقاء اللون\",\"twoDimensionalSlider\":\"مُنزلق 2D\"}");
127
39
 
128
- let thumbPosition = state.getThumbPercent(0);
129
40
 
130
- if (orientation === 'vertical' || direction === 'rtl') {
131
- thumbPosition = 1 - thumbPosition;
132
- }
41
+ var $435ac2a9fdd2ae5e$exports = {};
42
+ $435ac2a9fdd2ae5e$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Средство за избиране на цвят\",\"twoDimensionalSlider\":\"2D плъзгач\"}");
133
43
 
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
- };
154
- }
155
44
 
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
- }
45
+ var $6b29758b432284f5$exports = {};
46
+ $6b29758b432284f5$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Výběr barvy\",\"twoDimensionalSlider\":\"2D posuvník\"}");
200
47
 
201
- currentPosition.current.x += deltaX;
202
- currentPosition.current.y += deltaY;
203
48
 
204
- if (pointerType === 'keyboard') {
205
- if (deltaX > 0 || deltaY < 0) {
206
- state.increment();
207
- } else if (deltaX < 0 || deltaY > 0) {
208
- state.decrement();
209
- }
210
- } else {
211
- stateRef.current.setHueFromPoint(currentPosition.current.x, currentPosition.current.y, thumbRadius);
212
- }
213
- },
49
+ var $357597bcf4afd6fb$exports = {};
50
+ $357597bcf4afd6fb$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Farvevælger\",\"twoDimensionalSlider\":\"2D-skyder\"}");
214
51
 
215
- onMoveEnd() {
216
- isOnTrack.current = undefined;
217
- state.setDragging(false);
218
- focusInput();
219
- }
220
52
 
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
- },
53
+ var $ddc6333960e2b591$exports = {};
54
+ $ddc6333960e2b591$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Farbwähler\",\"twoDimensionalSlider\":\"2D-Schieberegler\"}");
235
55
 
236
- onMove(e) {
237
- if (isOnTrack.current) {
238
- moveHandler.onMove(e);
239
- }
240
- },
241
56
 
242
- onMoveEnd() {
243
- if (isOnTrack.current) {
244
- moveHandler.onMoveEnd();
245
- }
246
- }
57
+ var $417ee93d3ca474c0$exports = {};
58
+ $417ee93d3ca474c0$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Επιλογέας χρωμάτων\",\"twoDimensionalSlider\":\"Ρυθμιστικό 2D\"}");
247
59
 
248
- });
249
60
 
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
- };
61
+ var $519561bc6dcff98b$exports = {};
62
+ $519561bc6dcff98b$exports = JSON.parse("{\"colorPicker\":\"Color picker\",\"twoDimensionalSlider\":\"2D slider\",\"colorNameAndValue\":\"{name}: {value}\",\"colorInputLabel\":\"{label}, {channelLabel}\"}");
260
63
 
261
- let onThumbUp = e => {
262
- var _e$pointerId, _e$changedTouches;
263
64
 
264
- let id = (_e$pointerId = e.pointerId) != null ? _e$pointerId : (_e$changedTouches = e.changedTouches) == null ? void 0 : _e$changedTouches[0].identifier;
65
+ var $7a34c3fcc03402b8$exports = {};
66
+ $7a34c3fcc03402b8$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Selector de color\",\"twoDimensionalSlider\":\"Regulador 2D\"}");
265
67
 
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
- };
294
68
 
295
- let onTrackUp = e => {
296
- var _e$pointerId2, _e$changedTouches2;
69
+ var $860f86d6eae22cba$exports = {};
70
+ $860f86d6eae22cba$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Värvivalija\",\"twoDimensionalSlider\":\"2D-liugur\"}");
297
71
 
298
- let id = (_e$pointerId2 = e.pointerId) != null ? _e$pointerId2 : (_e$changedTouches2 = e.changedTouches) == null ? void 0 : _e$changedTouches2[0].identifier;
299
72
 
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
- }
73
+ var $8525d3c77b8a51b0$exports = {};
74
+ $8525d3c77b8a51b0$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Värimuokkain\",\"twoDimensionalSlider\":\"2D-liukusäädin\"}");
327
75
 
328
- });
329
- let trackInteractions = isDisabled ? {} : mergeProps({
330
- onMouseDown: e => {
331
- if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) {
332
- return;
333
- }
334
76
 
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
- }
77
+ var $8240fe6825e900ec$exports = {};
78
+ $8240fe6825e900ec$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name} : {value}\",\"colorPicker\":\"Sélecteur de couleurs\",\"twoDimensionalSlider\":\"Curseur 2D\"}");
341
79
 
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
- }
353
80
 
354
- onThumbDown(undefined);
355
- },
356
- onPointerDown: e => {
357
- if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) {
358
- return;
359
- }
81
+ var $377849238307c673$exports = {};
82
+ $377849238307c673$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"בוחר הצבעים\",\"twoDimensionalSlider\":\"מחוון דו מימדי\"}");
360
83
 
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.
84
+
85
+ var $5a6f44e0ec14b083$exports = {};
86
+ $5a6f44e0ec14b083$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Odabir boje\",\"twoDimensionalSlider\":\"2D klizač\"}");
87
+
88
+
89
+ var $82327d6e71e3e273$exports = {};
90
+ $82327d6e71e3e273$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Színválasztó\",\"twoDimensionalSlider\":\"2D-csúszka\"}");
91
+
92
+
93
+ var $b1e297275c248ab8$exports = {};
94
+ $b1e297275c248ab8$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Selettore colore\",\"twoDimensionalSlider\":\"Cursore 2D\"}");
95
+
96
+
97
+ var $b39c9f2638b4d2b9$exports = {};
98
+ $b39c9f2638b4d2b9$exports = JSON.parse("{\"colorInputLabel\":\"{label}、{channelLabel}\",\"colorNameAndValue\":\"{name} : {value}\",\"colorPicker\":\"カラーピッカー\",\"twoDimensionalSlider\":\"2D スライダー\"}");
99
+
100
+
101
+ var $2d2fbf4195848a62$exports = {};
102
+ $2d2fbf4195848a62$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"색상 피커\",\"twoDimensionalSlider\":\"2D 슬라이더\"}");
103
+
104
+
105
+ var $ea88350d0828fa2c$exports = {};
106
+ $ea88350d0828fa2c$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Spalvų parinkiklis\",\"twoDimensionalSlider\":\"2D slankiklis\"}");
107
+
108
+
109
+ var $0e0acd541630120a$exports = {};
110
+ $0e0acd541630120a$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Krāsu atlasītājs\",\"twoDimensionalSlider\":\"2D slīdnis\"}");
111
+
112
+
113
+ var $952a458224052046$exports = {};
114
+ $952a458224052046$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Fargevelger\",\"twoDimensionalSlider\":\"2D-glidebryter\"}");
115
+
116
+
117
+ var $2d8e195bc5683483$exports = {};
118
+ $2d8e195bc5683483$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Kleurkiezer\",\"twoDimensionalSlider\":\"2D-schuifregelaar\"}");
119
+
120
+
121
+ var $750d83f83c5f38d4$exports = {};
122
+ $750d83f83c5f38d4$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Próbnik kolorów\",\"twoDimensionalSlider\":\"Suwak 2D\"}");
123
+
124
+
125
+ var $656b2846f611067c$exports = {};
126
+ $656b2846f611067c$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Seletor de cores\",\"twoDimensionalSlider\":\"Controle deslizante 2D\"}");
127
+
128
+
129
+ var $58ce120874d069dd$exports = {};
130
+ $58ce120874d069dd$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Seletor de cores\",\"twoDimensionalSlider\":\"Controle deslizante 2D\"}");
131
+
132
+
133
+ var $fd6c85b4eba18825$exports = {};
134
+ $fd6c85b4eba18825$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Selector de culori\",\"twoDimensionalSlider\":\"Glisor 2D\"}");
135
+
136
+
137
+ var $8849a15ecc435984$exports = {};
138
+ $8849a15ecc435984$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Палитра цветов\",\"twoDimensionalSlider\":\"Ползунок 2D\"}");
139
+
140
+
141
+ var $5192372f064be783$exports = {};
142
+ $5192372f064be783$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Výber farieb\",\"twoDimensionalSlider\":\"2D jazdec\"}");
143
+
144
+
145
+ var $094525f9176df65d$exports = {};
146
+ $094525f9176df65d$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Izbirnik barv\",\"twoDimensionalSlider\":\"2D drsnik\"}");
147
+
148
+
149
+ var $9795aa59b4ad40ed$exports = {};
150
+ $9795aa59b4ad40ed$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Birač boja\",\"twoDimensionalSlider\":\"2D klizač\"}");
151
+
152
+
153
+ var $9ebaa0b485f13e4d$exports = {};
154
+ $9ebaa0b485f13e4d$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Färgväljaren\",\"twoDimensionalSlider\":\"2D-reglage\"}");
155
+
156
+
157
+ var $ad58e2e4e0f2e750$exports = {};
158
+ $ad58e2e4e0f2e750$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Renk Seçici\",\"twoDimensionalSlider\":\"2D sürgü\"}");
417
159
 
418
160
 
419
- exports.useColorWheel = useColorWheel;
161
+ var $dafc19306f8b2dfc$exports = {};
162
+ $dafc19306f8b2dfc$exports = JSON.parse("{\"colorInputLabel\":\"{label}, {channelLabel}\",\"colorNameAndValue\":\"{name}: {value}\",\"colorPicker\":\"Палітра кольорів\",\"twoDimensionalSlider\":\"Повзунок 2D\"}");
420
163
 
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";
164
+
165
+ var $d31a8b80af5acc16$exports = {};
166
+ $d31a8b80af5acc16$exports = JSON.parse("{\"colorInputLabel\":\"{label}、{channelLabel}\",\"colorNameAndValue\":\"{name}:{value}\",\"colorPicker\":\"拾色器\",\"twoDimensionalSlider\":\"2D 滑块\"}");
167
+
168
+
169
+ var $7377d28aec5fa200$exports = {};
170
+ $7377d28aec5fa200$exports = JSON.parse("{\"colorInputLabel\":\"{label},{channelLabel}\",\"colorNameAndValue\":\"{name}:{value}\",\"colorPicker\":\"檢色器\",\"twoDimensionalSlider\":\"2D 滑桿\"}");
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;
423
421
  }
424
422
 
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
423
 
462
- let onWheel = e => {
463
- if (isDisabled || isReadOnly) {
464
- return;
465
- }
466
424
 
467
- if (e.deltaY < 0) {
468
- increment();
469
- } else {
470
- decrement();
425
+
426
+
427
+ function $47925bd68062ac17$export$2f92a7a615a014f6(props, state) {
428
+ let { isDisabled: isDisabled , inputXRef: inputXRef , inputYRef: inputYRef , containerRef: containerRef , 'aria-label': ariaLabel } = 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
+ valueChangedViaKeyboard.current = true;
456
+ switch(e.key){
457
+ case 'PageUp':
458
+ stateRef.current.incrementY(stateRef.current.yChannelPageStep);
459
+ focusedInputRef.current = inputYRef.current;
460
+ break;
461
+ case 'PageDown':
462
+ stateRef.current.decrementY(stateRef.current.yChannelPageStep);
463
+ focusedInputRef.current = inputYRef.current;
464
+ break;
465
+ case 'Home':
466
+ direction === 'rtl' ? stateRef.current.incrementX(stateRef.current.xChannelPageStep) : stateRef.current.decrementX(stateRef.current.xChannelPageStep);
467
+ focusedInputRef.current = inputXRef.current;
468
+ break;
469
+ case 'End':
470
+ direction === 'rtl' ? stateRef.current.decrementX(stateRef.current.xChannelPageStep) : stateRef.current.incrementX(stateRef.current.xChannelPageStep);
471
+ focusedInputRef.current = inputXRef.current;
472
+ break;
473
+ }
474
+ stateRef.current.setDragging(false);
475
+ if (focusedInputRef.current) focusInput(focusedInputRef.current ? focusedInputRef : inputXRef);
476
+ }
477
+ });
478
+ let moveHandler = {
479
+ onMoveStart () {
480
+ currentPosition.current = null;
481
+ stateRef.current.setDragging(true);
482
+ },
483
+ onMove ({ deltaX: deltaX , deltaY: deltaY , pointerType: pointerType , shiftKey: shiftKey }) {
484
+ let { incrementX: incrementX , decrementX: decrementX , incrementY: incrementY , decrementY: decrementY , xChannelPageStep: xChannelPageStep , xChannelStep: xChannelStep , yChannelPageStep: yChannelPageStep , yChannelStep: yChannelStep , getThumbPosition: getThumbPosition , setColorFromPoint: setColorFromPoint } = stateRef.current;
485
+ if (currentPosition.current == null) currentPosition.current = getThumbPosition();
486
+ let { width: width , height: height } = containerRef.current.getBoundingClientRect();
487
+ let valueChanged = deltaX !== 0 || deltaY !== 0;
488
+ if (pointerType === 'keyboard') {
489
+ let deltaXValue = shiftKey && xChannelPageStep > xChannelStep ? xChannelPageStep : xChannelStep;
490
+ let deltaYValue = shiftKey && yChannelPageStep > yChannelStep ? yChannelPageStep : yChannelStep;
491
+ if (deltaX > 0 && direction === 'ltr' || deltaX < 0 && direction === 'rtl') incrementX(deltaXValue);
492
+ else if (deltaX < 0 && direction === 'ltr' || deltaX > 0 && direction === 'rtl') decrementX(deltaXValue);
493
+ else if (deltaY > 0) decrementY(deltaYValue);
494
+ else if (deltaY < 0) incrementY(deltaYValue);
495
+ valueChangedViaKeyboard.current = valueChanged;
496
+ // set the focused input based on which axis has the greater delta
497
+ focusedInputRef.current = valueChanged && 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
+ }
509
+ };
510
+ let { moveProps: movePropsThumb } = $kZqDi$reactariainteractions.useMove(moveHandler);
511
+ let valueChangedViaKeyboard = $kZqDi$react.useRef(false);
512
+ let { focusWithinProps: focusWithinProps } = $kZqDi$reactariainteractions.useFocusWithin({
513
+ onFocusWithinChange: (focusWithin)=>{
514
+ if (!focusWithin) {
515
+ valueChangedViaKeyboard.current = false;
516
+ focusedInputRef.current;
517
+ }
518
+ }
519
+ });
520
+ let currentPointer = $kZqDi$react.useRef(undefined);
521
+ let isOnColorArea = $kZqDi$react.useRef(false);
522
+ let { moveProps: movePropsContainer } = $kZqDi$reactariainteractions.useMove({
523
+ onMoveStart () {
524
+ if (isOnColorArea.current) moveHandler.onMoveStart();
525
+ },
526
+ onMove (e) {
527
+ if (isOnColorArea.current) moveHandler.onMove(e);
528
+ },
529
+ onMoveEnd () {
530
+ if (isOnColorArea.current) moveHandler.onMoveEnd();
531
+ }
532
+ });
533
+ let onThumbDown = (id)=>{
534
+ if (!state.isDragging) {
535
+ currentPointer.current = id;
536
+ valueChangedViaKeyboard.current = false;
537
+ focusInput();
538
+ state.setDragging(true);
539
+ if (typeof PointerEvent !== 'undefined') addGlobalListener(window, 'pointerup', onThumbUp, false);
540
+ else {
541
+ addGlobalListener(window, 'mouseup', onThumbUp, false);
542
+ addGlobalListener(window, 'touchend', onThumbUp, false);
543
+ }
544
+ }
545
+ };
546
+ let onThumbUp = (e)=>{
547
+ var ref;
548
+ var _pointerId;
549
+ let id = (_pointerId = e.pointerId) !== null && _pointerId !== void 0 ? _pointerId : (ref = e.changedTouches) === null || ref === void 0 ? void 0 : ref[0].identifier;
550
+ if (id === currentPointer.current) {
551
+ valueChangedViaKeyboard.current = false;
552
+ focusInput();
553
+ state.setDragging(false);
554
+ currentPointer.current = undefined;
555
+ isOnColorArea.current = false;
556
+ if (typeof PointerEvent !== 'undefined') removeGlobalListener(window, 'pointerup', onThumbUp, false);
557
+ else {
558
+ removeGlobalListener(window, 'mouseup', onThumbUp, false);
559
+ removeGlobalListener(window, 'touchend', onThumbUp, false);
560
+ }
561
+ }
562
+ };
563
+ let onColorAreaDown = (colorArea, id, clientX, clientY)=>{
564
+ let rect = colorArea.getBoundingClientRect();
565
+ let { width: width , height: height } = rect;
566
+ let x = (clientX - rect.x) / width;
567
+ let y = (clientY - rect.y) / height;
568
+ if (direction === 'rtl') x = 1 - x;
569
+ if (x >= 0 && x <= 1 && y >= 0 && y <= 1 && !state.isDragging && currentPointer.current === undefined) {
570
+ isOnColorArea.current = true;
571
+ valueChangedViaKeyboard.current = false;
572
+ currentPointer.current = id;
573
+ state.setColorFromPoint(x, y);
574
+ focusInput();
575
+ state.setDragging(true);
576
+ if (typeof PointerEvent !== 'undefined') addGlobalListener(window, 'pointerup', onColorAreaUp, false);
577
+ else {
578
+ addGlobalListener(window, 'mouseup', onColorAreaUp, false);
579
+ addGlobalListener(window, 'touchend', onColorAreaUp, false);
580
+ }
581
+ }
582
+ };
583
+ let onColorAreaUp = (e)=>{
584
+ var ref;
585
+ var _pointerId;
586
+ let id = (_pointerId = e.pointerId) !== null && _pointerId !== void 0 ? _pointerId : (ref = e.changedTouches) === null || ref === void 0 ? void 0 : ref[0].identifier;
587
+ if (isOnColorArea.current && id === currentPointer.current) {
588
+ isOnColorArea.current = false;
589
+ valueChangedViaKeyboard.current = false;
590
+ currentPointer.current = undefined;
591
+ state.setDragging(false);
592
+ focusInput();
593
+ if (typeof PointerEvent !== 'undefined') removeGlobalListener(window, 'pointerup', onColorAreaUp, false);
594
+ else {
595
+ removeGlobalListener(window, 'mouseup', onColorAreaUp, false);
596
+ removeGlobalListener(window, 'touchend', onColorAreaUp, false);
597
+ }
598
+ }
599
+ };
600
+ let colorAreaInteractions = isDisabled ? {
601
+ } : $kZqDi$reactariautils.mergeProps({
602
+ ...typeof PointerEvent !== 'undefined' ? {
603
+ onPointerDown: (e)=>{
604
+ if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) return;
605
+ onColorAreaDown(e.currentTarget, e.pointerId, e.clientX, e.clientY);
606
+ }
607
+ } : {
608
+ onMouseDown: (e)=>{
609
+ if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
610
+ onColorAreaDown(e.currentTarget, undefined, e.clientX, e.clientY);
611
+ },
612
+ onTouchStart: (e)=>{
613
+ onColorAreaDown(e.currentTarget, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY);
614
+ }
615
+ }
616
+ }, movePropsContainer);
617
+ let thumbInteractions = isDisabled ? {
618
+ } : $kZqDi$reactariautils.mergeProps({
619
+ ...typeof PointerEvent !== 'undefined' ? {
620
+ onPointerDown: (e)=>{
621
+ if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) return;
622
+ onThumbDown(e.pointerId);
623
+ }
624
+ } : {
625
+ onMouseDown: (e)=>{
626
+ if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
627
+ onThumbDown(undefined);
628
+ },
629
+ onTouchStart: (e)=>{
630
+ onThumbDown(e.changedTouches[0].identifier);
631
+ }
632
+ }
633
+ }, focusWithinProps, keyboardProps, movePropsThumb);
634
+ let { focusProps: xInputFocusProps } = $kZqDi$reactariainteractions.useFocus({
635
+ onFocus: ()=>{
636
+ focusedInputRef.current = inputXRef.current;
637
+ }
638
+ });
639
+ let { focusProps: yInputFocusProps } = $kZqDi$reactariainteractions.useFocus({
640
+ onFocus: ()=>{
641
+ focusedInputRef.current = inputYRef.current;
642
+ }
643
+ });
644
+ let isMobile = $kZqDi$reactariautils.isIOS() || $kZqDi$reactariautils.isAndroid();
645
+ function getAriaValueTextForChannel(channel) {
646
+ return valueChangedViaKeyboard.current ? formatMessage('colorNameAndValue', {
647
+ name: state.value.getChannelName(channel, locale),
648
+ value: state.value.formatChannelValue(channel, locale)
649
+ }) : [
650
+ formatMessage('colorNameAndValue', {
651
+ name: state.value.getChannelName(channel, locale),
652
+ value: state.value.formatChannelValue(channel, locale)
653
+ }),
654
+ formatMessage('colorNameAndValue', {
655
+ name: state.value.getChannelName(channel === yChannel ? xChannel : yChannel, locale),
656
+ value: state.value.formatChannelValue(channel === yChannel ? xChannel : yChannel, locale)
657
+ })
658
+ ].join(', ');
471
659
  }
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
- };
660
+ let colorPickerLabel = formatMessage('colorPicker');
661
+ let xInputLabellingProps = $kZqDi$reactariautils.useLabels({
662
+ ...props,
663
+ 'aria-label': ariaLabel ? formatMessage('colorInputLabel', {
664
+ label: ariaLabel,
665
+ channelLabel: colorPickerLabel
666
+ }) : colorPickerLabel
667
+ });
668
+ let yInputLabellingProps = $kZqDi$reactariautils.useLabels({
669
+ ...props,
670
+ 'aria-label': ariaLabel ? formatMessage('colorInputLabel', {
671
+ label: ariaLabel,
672
+ channelLabel: colorPickerLabel
673
+ }) : colorPickerLabel
674
+ });
675
+ let colorAriaLabellingProps = $kZqDi$reactariautils.useLabels({
676
+ ...props,
677
+ 'aria-label': ariaLabel ? `${ariaLabel} ${colorPickerLabel}` : undefined
678
+ }, isMobile ? colorPickerLabel : undefined);
679
+ let ariaRoleDescription = formatMessage('twoDimensionalSlider');
680
+ let { visuallyHiddenProps: visuallyHiddenProps } = $kZqDi$reactariavisuallyhidden.useVisuallyHidden({
681
+ style: {
682
+ opacity: '0.0001',
683
+ width: '100%',
684
+ height: '100%',
685
+ pointerEvents: 'none'
686
+ }
687
+ });
688
+ let { colorAreaStyleProps: colorAreaStyleProps , gradientStyleProps: gradientStyleProps , thumbStyleProps: thumbStyleProps } = $99936ad0bf67c8c4$export$dd62420467d245ca({
689
+ direction: direction,
690
+ state: state,
691
+ xChannel: xChannel,
692
+ zChannel: zChannel,
693
+ isDisabled: props.isDisabled
694
+ });
695
+ return {
696
+ colorAreaProps: {
697
+ ...colorAriaLabellingProps,
698
+ ...colorAreaInteractions,
699
+ ...colorAreaStyleProps,
700
+ role: 'group'
701
+ },
702
+ gradientProps: {
703
+ ...gradientStyleProps,
704
+ role: 'presentation'
705
+ },
706
+ thumbProps: {
707
+ ...thumbInteractions,
708
+ ...thumbStyleProps,
709
+ role: 'presentation'
710
+ },
711
+ xInputProps: {
712
+ ...xInputLabellingProps,
713
+ ...visuallyHiddenProps,
714
+ ...xInputFocusProps,
715
+ type: 'range',
716
+ min: state.value.getChannelRange(xChannel).minValue,
717
+ max: state.value.getChannelRange(xChannel).maxValue,
718
+ step: xChannelStep1,
719
+ 'aria-roledescription': ariaRoleDescription,
720
+ 'aria-valuetext': getAriaValueTextForChannel(xChannel),
721
+ disabled: isDisabled,
722
+ value: state.value.getChannelValue(xChannel),
723
+ tabIndex: isMobile || !focusedInputRef.current || focusedInputRef.current === inputXRef.current ? undefined : -1,
724
+ /*
725
+ So that only a single "2d slider" control shows up when listing form elements for screen readers,
726
+ add aria-hidden="true" to the unfocused control when the value has not changed via the keyboard,
727
+ but remove aria-hidden to reveal the input for each channel when the value has changed with the keyboard.
728
+ */ 'aria-hidden': !isMobile && focusedInputRef.current === inputYRef.current && !valueChangedViaKeyboard.current ? 'true' : undefined,
729
+ onChange: (e)=>{
730
+ state.setXValue(parseFloat(e.target.value));
731
+ }
732
+ },
733
+ yInputProps: {
734
+ ...yInputLabellingProps,
735
+ ...visuallyHiddenProps,
736
+ ...yInputFocusProps,
737
+ type: 'range',
738
+ min: state.value.getChannelRange(yChannel).minValue,
739
+ max: state.value.getChannelRange(yChannel).maxValue,
740
+ step: yChannelStep1,
741
+ 'aria-roledescription': ariaRoleDescription,
742
+ 'aria-valuetext': getAriaValueTextForChannel(yChannel),
743
+ 'aria-orientation': 'vertical',
744
+ disabled: isDisabled,
745
+ value: state.value.getChannelValue(yChannel),
746
+ tabIndex: isMobile || focusedInputRef.current === inputYRef.current ? undefined : -1,
747
+ /*
748
+ So that only a single "2d slider" control shows up when listing form elements for screen readers,
749
+ add aria-hidden="true" to the unfocused input when the value has not changed via the keyboard,
750
+ but remove aria-hidden to reveal the input for each channel when the value has changed with the keyboard.
751
+ */ 'aria-hidden': isMobile || focusedInputRef.current === inputYRef.current || valueChangedViaKeyboard.current ? undefined : 'true',
752
+ onChange: (e)=>{
753
+ state.setYValue(parseFloat(e.target.value));
754
+ }
755
+ }
756
+ };
497
757
  }
498
758
 
499
- exports.useColorField = useColorField;
759
+
760
+ var $afbb9647440a7f5b$exports = {};
761
+
762
+ $parcel$export($afbb9647440a7f5b$exports, "useColorSlider", () => $afbb9647440a7f5b$export$106b7a4e66508f66);
763
+
764
+
765
+
766
+ function $afbb9647440a7f5b$export$106b7a4e66508f66(props, state) {
767
+ let { trackRef: trackRef , inputRef: inputRef , orientation: orientation , channel: channel , 'aria-label': ariaLabel } = props;
768
+ let { locale: locale , direction: direction } = $kZqDi$reactariai18n.useLocale();
769
+ // Provide a default aria-label if there is no other label provided.
770
+ if (!props.label && !ariaLabel && !props['aria-labelledby']) ariaLabel = state.value.getChannelName(channel, locale);
771
+ // @ts-ignore - ignore unused incompatible props
772
+ let { groupProps: groupProps , trackProps: trackProps , labelProps: labelProps , outputProps: outputProps } = $kZqDi$reactariaslider.useSlider({
773
+ ...props,
774
+ 'aria-label': ariaLabel
775
+ }, state, trackRef);
776
+ let { inputProps: inputProps , thumbProps: thumbProps } = $kZqDi$reactariaslider.useSliderThumb({
777
+ index: 0,
778
+ orientation: orientation,
779
+ isDisabled: props.isDisabled,
780
+ trackRef: trackRef,
781
+ inputRef: inputRef
782
+ }, state);
783
+ let generateBackground = ()=>{
784
+ let value = state.getDisplayColor();
785
+ let to;
786
+ if (orientation === 'vertical') to = 'top';
787
+ else if (direction === 'ltr') to = 'right';
788
+ else to = 'left';
789
+ switch(channel){
790
+ case 'hue':
791
+ 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%)`;
792
+ case 'lightness':
793
+ {
794
+ // We have to add an extra color stop in the middle so that the hue shows up at all.
795
+ // Otherwise it will always just be black to white.
796
+ let min = state.getThumbMinValue(0);
797
+ let max = state.getThumbMaxValue(0);
798
+ let start = value.withChannelValue(channel, min).toString('css');
799
+ let middle = value.withChannelValue(channel, (max - min) / 2).toString('css');
800
+ let end = value.withChannelValue(channel, max).toString('css');
801
+ return `linear-gradient(to ${to}, ${start}, ${middle}, ${end})`;
802
+ }
803
+ case 'saturation':
804
+ case 'brightness':
805
+ case 'red':
806
+ case 'green':
807
+ case 'blue':
808
+ case 'alpha':
809
+ {
810
+ let start = value.withChannelValue(channel, state.getThumbMinValue(0)).toString('css');
811
+ let end = value.withChannelValue(channel, state.getThumbMaxValue(0)).toString('css');
812
+ return `linear-gradient(to ${to}, ${start}, ${end})`;
813
+ }
814
+ default:
815
+ throw new Error('Unknown color channel: ' + channel);
816
+ }
817
+ };
818
+ let thumbPosition = state.getThumbPercent(0);
819
+ if (orientation === 'vertical' || direction === 'rtl') thumbPosition = 1 - thumbPosition;
820
+ return {
821
+ trackProps: {
822
+ ...$kZqDi$reactariautils.mergeProps(groupProps, trackProps),
823
+ style: {
824
+ position: 'relative',
825
+ touchAction: 'none',
826
+ background: generateBackground()
827
+ }
828
+ },
829
+ inputProps: inputProps,
830
+ thumbProps: {
831
+ ...thumbProps,
832
+ style: {
833
+ touchAction: 'none',
834
+ position: 'absolute',
835
+ [orientation === 'vertical' ? 'top' : 'left']: `${thumbPosition * 100}%`,
836
+ transform: 'translate(-50%, -50%)'
837
+ }
838
+ },
839
+ labelProps: labelProps,
840
+ outputProps: outputProps
841
+ };
842
+ }
843
+
844
+
845
+ var $1d29bf243d4a9a53$exports = {};
846
+
847
+ $parcel$export($1d29bf243d4a9a53$exports, "useColorWheel", () => $1d29bf243d4a9a53$export$9064ff4e44b3729a);
848
+
849
+
850
+
851
+
852
+ function $1d29bf243d4a9a53$export$9064ff4e44b3729a(props, state, inputRef) {
853
+ let { isDisabled: isDisabled , innerRadius: innerRadius , outerRadius: outerRadius , 'aria-label': ariaLabel } = props;
854
+ let { addGlobalListener: addGlobalListener , removeGlobalListener: removeGlobalListener } = $kZqDi$reactariautils.useGlobalListeners();
855
+ let thumbRadius = (innerRadius + outerRadius) / 2;
856
+ let focusInput = $kZqDi$react.useCallback(()=>{
857
+ if (inputRef.current) $kZqDi$reactariautils.focusWithoutScrolling(inputRef.current);
858
+ }, [
859
+ inputRef
860
+ ]);
861
+ let stateRef = $kZqDi$react.useRef(null);
862
+ stateRef.current = state;
863
+ let currentPosition = $kZqDi$react.useRef(null);
864
+ let { keyboardProps: keyboardProps } = $kZqDi$reactariainteractions.useKeyboard({
865
+ onKeyDown (e) {
866
+ // these are the cases that useMove doesn't handle
867
+ if (!/^(PageUp|PageDown)$/.test(e.key)) {
868
+ e.continuePropagation();
869
+ return;
870
+ }
871
+ // same handling as useMove, don't need to stop propagation, useKeyboard will do that for us
872
+ e.preventDefault();
873
+ // remember to set this and unset it so that onChangeEnd is fired
874
+ stateRef.current.setDragging(true);
875
+ switch(e.key){
876
+ case 'PageUp':
877
+ e.preventDefault();
878
+ state.increment(stateRef.current.pageStep);
879
+ break;
880
+ case 'PageDown':
881
+ e.preventDefault();
882
+ state.decrement(stateRef.current.pageStep);
883
+ break;
884
+ }
885
+ stateRef.current.setDragging(false);
886
+ }
887
+ });
888
+ let moveHandler = {
889
+ onMoveStart () {
890
+ currentPosition.current = null;
891
+ state.setDragging(true);
892
+ },
893
+ onMove ({ deltaX: deltaX , deltaY: deltaY , pointerType: pointerType , shiftKey: shiftKey }) {
894
+ if (currentPosition.current == null) currentPosition.current = stateRef.current.getThumbPosition(thumbRadius);
895
+ currentPosition.current.x += deltaX;
896
+ currentPosition.current.y += deltaY;
897
+ if (pointerType === 'keyboard') {
898
+ if (deltaX > 0 || deltaY < 0) state.increment(shiftKey ? stateRef.current.pageStep : stateRef.current.step);
899
+ else if (deltaX < 0 || deltaY > 0) state.decrement(shiftKey ? stateRef.current.pageStep : stateRef.current.step);
900
+ } else stateRef.current.setHueFromPoint(currentPosition.current.x, currentPosition.current.y, thumbRadius);
901
+ },
902
+ onMoveEnd () {
903
+ isOnTrack.current = undefined;
904
+ state.setDragging(false);
905
+ focusInput();
906
+ }
907
+ };
908
+ let { moveProps: movePropsThumb } = $kZqDi$reactariainteractions.useMove(moveHandler);
909
+ let currentPointer = $kZqDi$react.useRef(undefined);
910
+ let isOnTrack = $kZqDi$react.useRef(false);
911
+ let { moveProps: movePropsContainer } = $kZqDi$reactariainteractions.useMove({
912
+ onMoveStart () {
913
+ if (isOnTrack.current) moveHandler.onMoveStart();
914
+ },
915
+ onMove (e) {
916
+ if (isOnTrack.current) moveHandler.onMove(e);
917
+ },
918
+ onMoveEnd () {
919
+ if (isOnTrack.current) moveHandler.onMoveEnd();
920
+ }
921
+ });
922
+ let onThumbDown = (id)=>{
923
+ if (!state.isDragging) {
924
+ currentPointer.current = id;
925
+ focusInput();
926
+ state.setDragging(true);
927
+ if (typeof PointerEvent !== 'undefined') addGlobalListener(window, 'pointerup', onThumbUp, false);
928
+ else {
929
+ addGlobalListener(window, 'mouseup', onThumbUp, false);
930
+ addGlobalListener(window, 'touchend', onThumbUp, false);
931
+ }
932
+ }
933
+ };
934
+ let onThumbUp = (e)=>{
935
+ var ref;
936
+ var _pointerId;
937
+ let id = (_pointerId = e.pointerId) !== null && _pointerId !== void 0 ? _pointerId : (ref = e.changedTouches) === null || ref === void 0 ? void 0 : ref[0].identifier;
938
+ if (id === currentPointer.current) {
939
+ focusInput();
940
+ state.setDragging(false);
941
+ currentPointer.current = undefined;
942
+ isOnTrack.current = false;
943
+ if (typeof PointerEvent !== 'undefined') removeGlobalListener(window, 'pointerup', onThumbUp, false);
944
+ else {
945
+ removeGlobalListener(window, 'mouseup', onThumbUp, false);
946
+ removeGlobalListener(window, 'touchend', onThumbUp, false);
947
+ }
948
+ }
949
+ };
950
+ let onTrackDown = (track, id, pageX, pageY)=>{
951
+ let rect = track.getBoundingClientRect();
952
+ let x = pageX - rect.x - rect.width / 2;
953
+ let y = pageY - rect.y - rect.height / 2;
954
+ let radius = Math.sqrt(x * x + y * y);
955
+ if (innerRadius < radius && radius < outerRadius && !state.isDragging && currentPointer.current === undefined) {
956
+ isOnTrack.current = true;
957
+ currentPointer.current = id;
958
+ stateRef.current.setHueFromPoint(x, y, radius);
959
+ focusInput();
960
+ state.setDragging(true);
961
+ if (typeof PointerEvent !== 'undefined') addGlobalListener(window, 'pointerup', onTrackUp, false);
962
+ else {
963
+ addGlobalListener(window, 'mouseup', onTrackUp, false);
964
+ addGlobalListener(window, 'touchend', onTrackUp, false);
965
+ }
966
+ }
967
+ };
968
+ let onTrackUp = (e)=>{
969
+ var ref;
970
+ var _pointerId;
971
+ let id = (_pointerId = e.pointerId) !== null && _pointerId !== void 0 ? _pointerId : (ref = e.changedTouches) === null || ref === void 0 ? void 0 : ref[0].identifier;
972
+ if (isOnTrack.current && id === currentPointer.current) {
973
+ isOnTrack.current = false;
974
+ currentPointer.current = undefined;
975
+ state.setDragging(false);
976
+ focusInput();
977
+ if (typeof PointerEvent !== 'undefined') removeGlobalListener(window, 'pointerup', onTrackUp, false);
978
+ else {
979
+ removeGlobalListener(window, 'mouseup', onTrackUp, false);
980
+ removeGlobalListener(window, 'touchend', onTrackUp, false);
981
+ }
982
+ }
983
+ };
984
+ let trackInteractions = isDisabled ? {
985
+ } : $kZqDi$reactariautils.mergeProps({
986
+ ...typeof PointerEvent !== 'undefined' ? {
987
+ onPointerDown: (e)=>{
988
+ if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) return;
989
+ onTrackDown(e.currentTarget, e.pointerId, e.clientX, e.clientY);
990
+ }
991
+ } : {
992
+ onMouseDown: (e)=>{
993
+ if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
994
+ onTrackDown(e.currentTarget, undefined, e.clientX, e.clientY);
995
+ },
996
+ onTouchStart: (e)=>{
997
+ onTrackDown(e.currentTarget, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY);
998
+ }
999
+ }
1000
+ }, movePropsContainer);
1001
+ let thumbInteractions = isDisabled ? {
1002
+ } : $kZqDi$reactariautils.mergeProps({
1003
+ onMouseDown: (e)=>{
1004
+ if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
1005
+ onThumbDown(undefined);
1006
+ },
1007
+ onPointerDown: (e)=>{
1008
+ if (e.pointerType === 'mouse' && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) return;
1009
+ onThumbDown(e.pointerId);
1010
+ },
1011
+ onTouchStart: (e)=>{
1012
+ onThumbDown(e.changedTouches[0].identifier);
1013
+ }
1014
+ }, keyboardProps, movePropsThumb);
1015
+ let { x: x1 , y: y1 } = state.getThumbPosition(thumbRadius);
1016
+ // Provide a default aria-label if none is given
1017
+ let { locale: locale } = $kZqDi$reactariai18n.useLocale();
1018
+ if (ariaLabel == null && props['aria-labelledby'] == null) ariaLabel = state.value.getChannelName('hue', locale);
1019
+ let inputLabellingProps = $kZqDi$reactariautils.useLabels({
1020
+ ...props,
1021
+ 'aria-label': ariaLabel
1022
+ });
1023
+ let { minValue: minValue , maxValue: maxValue , step: step } = state.value.getChannelRange('hue');
1024
+ return {
1025
+ trackProps: {
1026
+ ...trackInteractions,
1027
+ style: {
1028
+ position: 'relative',
1029
+ touchAction: 'none',
1030
+ width: outerRadius * 2,
1031
+ height: outerRadius * 2,
1032
+ background: `
1033
+ conic-gradient(
1034
+ from 90deg,
1035
+ hsl(0, 100%, 50%),
1036
+ hsl(30, 100%, 50%),
1037
+ hsl(60, 100%, 50%),
1038
+ hsl(90, 100%, 50%),
1039
+ hsl(120, 100%, 50%),
1040
+ hsl(150, 100%, 50%),
1041
+ hsl(180, 100%, 50%),
1042
+ hsl(210, 100%, 50%),
1043
+ hsl(240, 100%, 50%),
1044
+ hsl(270, 100%, 50%),
1045
+ hsl(300, 100%, 50%),
1046
+ hsl(330, 100%, 50%),
1047
+ hsl(360, 100%, 50%)
1048
+ )
1049
+ `,
1050
+ clipPath: `path(evenodd, "${$1d29bf243d4a9a53$var$circlePath(outerRadius, outerRadius, outerRadius)} ${$1d29bf243d4a9a53$var$circlePath(outerRadius, outerRadius, innerRadius)}")`
1051
+ }
1052
+ },
1053
+ thumbProps: {
1054
+ ...thumbInteractions,
1055
+ style: {
1056
+ position: 'absolute',
1057
+ left: '50%',
1058
+ top: '50%',
1059
+ transform: `translate(calc(${x1}px - 50%), calc(${y1}px - 50%))`,
1060
+ touchAction: 'none'
1061
+ }
1062
+ },
1063
+ inputProps: $kZqDi$reactariautils.mergeProps(inputLabellingProps, {
1064
+ type: 'range',
1065
+ min: String(minValue),
1066
+ max: String(maxValue),
1067
+ step: String(step),
1068
+ 'aria-valuetext': state.value.formatChannelValue('hue', locale),
1069
+ disabled: isDisabled,
1070
+ value: `${state.value.getChannelValue('hue')}`,
1071
+ onChange: (e)=>{
1072
+ state.setHue(parseFloat(e.target.value));
1073
+ }
1074
+ })
1075
+ };
1076
+ }
1077
+ // Creates an SVG path string for a circle.
1078
+ function $1d29bf243d4a9a53$var$circlePath(cx, cy, r) {
1079
+ 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`;
1080
+ }
1081
+
1082
+
1083
+ var $58c850037bc7a7ce$exports = {};
1084
+
1085
+ $parcel$export($58c850037bc7a7ce$exports, "useColorField", () => $58c850037bc7a7ce$export$77e32ca575a28fdf);
1086
+
1087
+
1088
+
1089
+
1090
+
1091
+ function $58c850037bc7a7ce$export$77e32ca575a28fdf(props, state, ref) {
1092
+ let { isDisabled: isDisabled , isReadOnly: isReadOnly , isRequired: isRequired } = props;
1093
+ let { colorValue: colorValue , inputValue: inputValue , commit: commit , increment: increment , decrement: decrement , incrementToMax: incrementToMax , decrementToMin: decrementToMin } = state;
1094
+ let inputId = $kZqDi$reactariautils.useId();
1095
+ let { spinButtonProps: spinButtonProps } = $kZqDi$reactariaspinbutton.useSpinButton({
1096
+ isDisabled: isDisabled,
1097
+ isReadOnly: isReadOnly,
1098
+ isRequired: isRequired,
1099
+ maxValue: 16777215,
1100
+ minValue: 0,
1101
+ onIncrement: increment,
1102
+ onIncrementToMax: incrementToMax,
1103
+ onDecrement: decrement,
1104
+ onDecrementToMin: decrementToMin,
1105
+ value: colorValue ? colorValue.toHexInt() : undefined,
1106
+ textValue: colorValue ? colorValue.toString('hex') : undefined
1107
+ });
1108
+ let [focusWithin, setFocusWithin] = $kZqDi$react.useState(false);
1109
+ let { focusWithinProps: focusWithinProps } = $kZqDi$reactariainteractions.useFocusWithin({
1110
+ isDisabled: isDisabled,
1111
+ onFocusWithinChange: setFocusWithin
1112
+ });
1113
+ let onWheel = $kZqDi$react.useCallback((e)=>{
1114
+ if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) return;
1115
+ if (e.deltaY > 0) increment();
1116
+ else if (e.deltaY < 0) decrement();
1117
+ }, [
1118
+ decrement,
1119
+ increment
1120
+ ]);
1121
+ // If the input isn't supposed to receive input, disable scrolling.
1122
+ let scrollingDisabled = isDisabled || isReadOnly || !focusWithin;
1123
+ $kZqDi$reactariainteractions.useScrollWheel({
1124
+ onScroll: onWheel,
1125
+ isDisabled: scrollingDisabled
1126
+ }, ref);
1127
+ let onChange = (value)=>{
1128
+ state.setInputValue(value);
1129
+ };
1130
+ let { labelProps: labelProps , inputProps: inputProps } = $kZqDi$reactariatextfield.useFormattedTextField($kZqDi$reactariautils.mergeProps(props, {
1131
+ id: inputId,
1132
+ value: inputValue,
1133
+ defaultValue: undefined,
1134
+ type: 'text',
1135
+ autoComplete: 'off',
1136
+ onChange: onChange
1137
+ }), state, ref);
1138
+ return {
1139
+ labelProps: labelProps,
1140
+ inputProps: $kZqDi$reactariautils.mergeProps(inputProps, spinButtonProps, focusWithinProps, {
1141
+ role: 'textbox',
1142
+ 'aria-valuemax': null,
1143
+ 'aria-valuemin': null,
1144
+ 'aria-valuenow': null,
1145
+ 'aria-valuetext': null,
1146
+ autoCorrect: 'off',
1147
+ spellCheck: 'false',
1148
+ onBlur: commit
1149
+ })
1150
+ };
1151
+ }
1152
+
1153
+
1154
+ $parcel$exportWildcard(module.exports, $47925bd68062ac17$exports);
1155
+ $parcel$exportWildcard(module.exports, $afbb9647440a7f5b$exports);
1156
+ $parcel$exportWildcard(module.exports, $1d29bf243d4a9a53$exports);
1157
+ $parcel$exportWildcard(module.exports, $58c850037bc7a7ce$exports);
1158
+
1159
+
500
1160
  //# sourceMappingURL=main.js.map