@react-aria/color 3.0.0-beta.18 → 3.0.0-beta.19

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.
Files changed (2) hide show
  1. package/dist/import.mjs +1354 -0
  2. package/package.json +18 -13
@@ -0,0 +1,1354 @@
1
+ import {useGlobalListeners as $7KHxM$useGlobalListeners, focusWithoutScrolling as $7KHxM$focusWithoutScrolling, mergeProps as $7KHxM$mergeProps, isIOS as $7KHxM$isIOS, isAndroid as $7KHxM$isAndroid, useLabels as $7KHxM$useLabels, useId as $7KHxM$useId} from "@react-aria/utils";
2
+ import {useRef as $7KHxM$useRef, useCallback as $7KHxM$useCallback, useMemo as $7KHxM$useMemo, useState as $7KHxM$useState} from "react";
3
+ import {useKeyboard as $7KHxM$useKeyboard, useMove as $7KHxM$useMove, useFocusWithin as $7KHxM$useFocusWithin, useFocus as $7KHxM$useFocus, useScrollWheel as $7KHxM$useScrollWheel} from "@react-aria/interactions";
4
+ import {useLocalizedStringFormatter as $7KHxM$useLocalizedStringFormatter, useLocale as $7KHxM$useLocale} from "@react-aria/i18n";
5
+ import {useVisuallyHidden as $7KHxM$useVisuallyHidden} from "@react-aria/visually-hidden";
6
+ import {useSlider as $7KHxM$useSlider, useSliderThumb as $7KHxM$useSliderThumb} from "@react-aria/slider";
7
+ import {useFormattedTextField as $7KHxM$useFormattedTextField} from "@react-aria/textfield";
8
+ import {useSpinButton as $7KHxM$useSpinButton} from "@react-aria/spinbutton";
9
+
10
+ function $parcel$interopDefault(a) {
11
+ return a && a.__esModule ? a.default : a;
12
+ }
13
+ /*
14
+ * Copyright 2020 Adobe. All rights reserved.
15
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
16
+ * you may not use this file except in compliance with the License. You may obtain a copy
17
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
18
+ *
19
+ * Unless required by applicable law or agreed to in writing, software distributed under
20
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
21
+ * OF ANY KIND, either express or implied. See the License for the specific language
22
+ * governing permissions and limitations under the License.
23
+ */ /*
24
+ * Copyright 2020 Adobe. All rights reserved.
25
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
26
+ * you may not use this file except in compliance with the License. You may obtain a copy
27
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
28
+ *
29
+ * Unless required by applicable law or agreed to in writing, software distributed under
30
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
31
+ * OF ANY KIND, either express or implied. See the License for the specific language
32
+ * governing permissions and limitations under the License.
33
+ */
34
+ var $052cfdf4c32eb7c3$exports = {};
35
+ var $eccab2b0118aef08$exports = {};
36
+ $eccab2b0118aef08$exports = {
37
+ "colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
38
+ "colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
39
+ "colorPicker": `أداة انتقاء اللون`,
40
+ "twoDimensionalSlider": `مُنزلق 2D`
41
+ };
42
+
43
+
44
+ var $bf2b4507594e3d45$exports = {};
45
+ $bf2b4507594e3d45$exports = {
46
+ "colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
47
+ "colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
48
+ "colorPicker": `Средство за избиране на цвят`,
49
+ "twoDimensionalSlider": `2D плъзгач`
50
+ };
51
+
52
+
53
+ var $01c08487af7ecd14$exports = {};
54
+ $01c08487af7ecd14$exports = {
55
+ "colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
56
+ "colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
57
+ "colorPicker": `Výběr barvy`,
58
+ "twoDimensionalSlider": `2D posuvník`
59
+ };
60
+
61
+
62
+ var $5e997db6ea0d10f6$exports = {};
63
+ $5e997db6ea0d10f6$exports = {
64
+ "colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
65
+ "colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
66
+ "colorPicker": `Farvevælger`,
67
+ "twoDimensionalSlider": `2D-skyder`
68
+ };
69
+
70
+
71
+ var $fe5998f640a79fd2$exports = {};
72
+ $fe5998f640a79fd2$exports = {
73
+ "colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
74
+ "colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
75
+ "colorPicker": `Farbwähler`,
76
+ "twoDimensionalSlider": `2D-Schieberegler`
77
+ };
78
+
79
+
80
+ var $18e4d1d5b500a9ee$exports = {};
81
+ $18e4d1d5b500a9ee$exports = {
82
+ "colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
83
+ "colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
84
+ "colorPicker": `Επιλογέας χρωμάτων`,
85
+ "twoDimensionalSlider": `Ρυθμιστικό 2D`
86
+ };
87
+
88
+
89
+ var $bf90a11a7a42a0f7$exports = {};
90
+ $bf90a11a7a42a0f7$exports = {
91
+ "colorPicker": `Color picker`,
92
+ "twoDimensionalSlider": `2D slider`,
93
+ "colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
94
+ "colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`
95
+ };
96
+
97
+
98
+ var $dd0d25f885b5c5f3$exports = {};
99
+ $dd0d25f885b5c5f3$exports = {
100
+ "colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
101
+ "colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
102
+ "colorPicker": `Selector de color`,
103
+ "twoDimensionalSlider": `Regulador 2D`
104
+ };
105
+
106
+
107
+ var $d950967017e3485b$exports = {};
108
+ $d950967017e3485b$exports = {
109
+ "colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
110
+ "colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
111
+ "colorPicker": `Värvivalija`,
112
+ "twoDimensionalSlider": `2D-liugur`
113
+ };
114
+
115
+
116
+ var $00a415a3f0ab315a$exports = {};
117
+ $00a415a3f0ab315a$exports = {
118
+ "colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
119
+ "colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
120
+ "colorPicker": `Värimuokkain`,
121
+ "twoDimensionalSlider": `2D-liukusäädin`
122
+ };
123
+
124
+
125
+ var $d80f30fe86c95741$exports = {};
126
+ $d80f30fe86c95741$exports = {
127
+ "colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
128
+ "colorNameAndValue": (args)=>`${args.name} : ${args.value}`,
129
+ "colorPicker": `Sélecteur de couleurs`,
130
+ "twoDimensionalSlider": `Curseur 2D`
131
+ };
132
+
133
+
134
+ var $6912afb584340a2e$exports = {};
135
+ $6912afb584340a2e$exports = {
136
+ "colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
137
+ "colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
138
+ "colorPicker": `בוחר הצבעים`,
139
+ "twoDimensionalSlider": `מחוון דו מימדי`
140
+ };
141
+
142
+
143
+ var $7b97fcacd84ec90f$exports = {};
144
+ $7b97fcacd84ec90f$exports = {
145
+ "colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
146
+ "colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
147
+ "colorPicker": `Odabir boje`,
148
+ "twoDimensionalSlider": `2D klizač`
149
+ };
150
+
151
+
152
+ var $da9b443e89eebc6b$exports = {};
153
+ $da9b443e89eebc6b$exports = {
154
+ "colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
155
+ "colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
156
+ "colorPicker": `Színválasztó`,
157
+ "twoDimensionalSlider": `2D-csúszka`
158
+ };
159
+
160
+
161
+ var $35f135b45eb4d95b$exports = {};
162
+ $35f135b45eb4d95b$exports = {
163
+ "colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
164
+ "colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
165
+ "colorPicker": `Selettore colore`,
166
+ "twoDimensionalSlider": `Cursore 2D`
167
+ };
168
+
169
+
170
+ var $760b09448e39c6cd$exports = {};
171
+ $760b09448e39c6cd$exports = {
172
+ "colorInputLabel": (args)=>`${args.label}、${args.channelLabel}`,
173
+ "colorNameAndValue": (args)=>`${args.name} : ${args.value}`,
174
+ "colorPicker": `カラーピッカー`,
175
+ "twoDimensionalSlider": `2D スライダー`
176
+ };
177
+
178
+
179
+ var $fc7b7d43be9703ec$exports = {};
180
+ $fc7b7d43be9703ec$exports = {
181
+ "colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
182
+ "colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
183
+ "colorPicker": `색상 피커`,
184
+ "twoDimensionalSlider": `2D 슬라이더`
185
+ };
186
+
187
+
188
+ var $74918a1664156912$exports = {};
189
+ $74918a1664156912$exports = {
190
+ "colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
191
+ "colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
192
+ "colorPicker": `Spalvų parinkiklis`,
193
+ "twoDimensionalSlider": `2D slankiklis`
194
+ };
195
+
196
+
197
+ var $4e6cde11c2bc9840$exports = {};
198
+ $4e6cde11c2bc9840$exports = {
199
+ "colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
200
+ "colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
201
+ "colorPicker": `Krāsu atlasītājs`,
202
+ "twoDimensionalSlider": `2D slīdnis`
203
+ };
204
+
205
+
206
+ var $6faa3defebc3eb72$exports = {};
207
+ $6faa3defebc3eb72$exports = {
208
+ "colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
209
+ "colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
210
+ "colorPicker": `Fargevelger`,
211
+ "twoDimensionalSlider": `2D-glidebryter`
212
+ };
213
+
214
+
215
+ var $6ac9b6b1b7e3ca12$exports = {};
216
+ $6ac9b6b1b7e3ca12$exports = {
217
+ "colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
218
+ "colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
219
+ "colorPicker": `Kleurkiezer`,
220
+ "twoDimensionalSlider": `2D-schuifregelaar`
221
+ };
222
+
223
+
224
+ var $1be8b0ee8841f1e7$exports = {};
225
+ $1be8b0ee8841f1e7$exports = {
226
+ "colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
227
+ "colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
228
+ "colorPicker": `Próbnik kolorów`,
229
+ "twoDimensionalSlider": `Suwak 2D`
230
+ };
231
+
232
+
233
+ var $f9507c2d404ed689$exports = {};
234
+ $f9507c2d404ed689$exports = {
235
+ "colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
236
+ "colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
237
+ "colorPicker": `Seletor de cores`,
238
+ "twoDimensionalSlider": `Controle deslizante 2D`
239
+ };
240
+
241
+
242
+ var $8f872ea59c02d67e$exports = {};
243
+ $8f872ea59c02d67e$exports = {
244
+ "colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
245
+ "colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
246
+ "colorPicker": `Seletor de cores`,
247
+ "twoDimensionalSlider": `Controle deslizante 2D`
248
+ };
249
+
250
+
251
+ var $b03b45b62a7ccae4$exports = {};
252
+ $b03b45b62a7ccae4$exports = {
253
+ "colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
254
+ "colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
255
+ "colorPicker": `Selector de culori`,
256
+ "twoDimensionalSlider": `Glisor 2D`
257
+ };
258
+
259
+
260
+ var $f1107d94c09df9b8$exports = {};
261
+ $f1107d94c09df9b8$exports = {
262
+ "colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
263
+ "colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
264
+ "colorPicker": `Палитра цветов`,
265
+ "twoDimensionalSlider": `Ползунок 2D`
266
+ };
267
+
268
+
269
+ var $b61325f242fafc7c$exports = {};
270
+ $b61325f242fafc7c$exports = {
271
+ "colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
272
+ "colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
273
+ "colorPicker": `Výber farieb`,
274
+ "twoDimensionalSlider": `2D jazdec`
275
+ };
276
+
277
+
278
+ var $f44b7cf39ac8f315$exports = {};
279
+ $f44b7cf39ac8f315$exports = {
280
+ "colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
281
+ "colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
282
+ "colorPicker": `Izbirnik barv`,
283
+ "twoDimensionalSlider": `2D drsnik`
284
+ };
285
+
286
+
287
+ var $aa8cd83fc8d4982b$exports = {};
288
+ $aa8cd83fc8d4982b$exports = {
289
+ "colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
290
+ "colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
291
+ "colorPicker": `Birač boja`,
292
+ "twoDimensionalSlider": `2D klizač`
293
+ };
294
+
295
+
296
+ var $7c4f4e5bb7c06f1e$exports = {};
297
+ $7c4f4e5bb7c06f1e$exports = {
298
+ "colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
299
+ "colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
300
+ "colorPicker": `Färgväljaren`,
301
+ "twoDimensionalSlider": `2D-reglage`
302
+ };
303
+
304
+
305
+ var $8045cf930ef745aa$exports = {};
306
+ $8045cf930ef745aa$exports = {
307
+ "colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
308
+ "colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
309
+ "colorPicker": `Renk Seçici`,
310
+ "twoDimensionalSlider": `2D sürgü`
311
+ };
312
+
313
+
314
+ var $ee2044a77f24b118$exports = {};
315
+ $ee2044a77f24b118$exports = {
316
+ "colorInputLabel": (args)=>`${args.label}, ${args.channelLabel}`,
317
+ "colorNameAndValue": (args)=>`${args.name}: ${args.value}`,
318
+ "colorPicker": `Палітра кольорів`,
319
+ "twoDimensionalSlider": `Повзунок 2D`
320
+ };
321
+
322
+
323
+ var $4e1dbc65a687dd93$exports = {};
324
+ $4e1dbc65a687dd93$exports = {
325
+ "colorInputLabel": (args)=>`${args.label}、${args.channelLabel}`,
326
+ "colorNameAndValue": (args)=>`${args.name}:${args.value}`,
327
+ "colorPicker": `拾色器`,
328
+ "twoDimensionalSlider": `2D 滑块`
329
+ };
330
+
331
+
332
+ var $b0fef28529309aa6$exports = {};
333
+ $b0fef28529309aa6$exports = {
334
+ "colorInputLabel": (args)=>`${args.label},${args.channelLabel}`,
335
+ "colorNameAndValue": (args)=>`${args.name}:${args.value}`,
336
+ "colorPicker": `檢色器`,
337
+ "twoDimensionalSlider": `2D 滑桿`
338
+ };
339
+
340
+
341
+ $052cfdf4c32eb7c3$exports = {
342
+ "ar-AE": $eccab2b0118aef08$exports,
343
+ "bg-BG": $bf2b4507594e3d45$exports,
344
+ "cs-CZ": $01c08487af7ecd14$exports,
345
+ "da-DK": $5e997db6ea0d10f6$exports,
346
+ "de-DE": $fe5998f640a79fd2$exports,
347
+ "el-GR": $18e4d1d5b500a9ee$exports,
348
+ "en-US": $bf90a11a7a42a0f7$exports,
349
+ "es-ES": $dd0d25f885b5c5f3$exports,
350
+ "et-EE": $d950967017e3485b$exports,
351
+ "fi-FI": $00a415a3f0ab315a$exports,
352
+ "fr-FR": $d80f30fe86c95741$exports,
353
+ "he-IL": $6912afb584340a2e$exports,
354
+ "hr-HR": $7b97fcacd84ec90f$exports,
355
+ "hu-HU": $da9b443e89eebc6b$exports,
356
+ "it-IT": $35f135b45eb4d95b$exports,
357
+ "ja-JP": $760b09448e39c6cd$exports,
358
+ "ko-KR": $fc7b7d43be9703ec$exports,
359
+ "lt-LT": $74918a1664156912$exports,
360
+ "lv-LV": $4e6cde11c2bc9840$exports,
361
+ "nb-NO": $6faa3defebc3eb72$exports,
362
+ "nl-NL": $6ac9b6b1b7e3ca12$exports,
363
+ "pl-PL": $1be8b0ee8841f1e7$exports,
364
+ "pt-BR": $f9507c2d404ed689$exports,
365
+ "pt-PT": $8f872ea59c02d67e$exports,
366
+ "ro-RO": $b03b45b62a7ccae4$exports,
367
+ "ru-RU": $f1107d94c09df9b8$exports,
368
+ "sk-SK": $b61325f242fafc7c$exports,
369
+ "sl-SI": $f44b7cf39ac8f315$exports,
370
+ "sr-SP": $aa8cd83fc8d4982b$exports,
371
+ "sv-SE": $7c4f4e5bb7c06f1e$exports,
372
+ "tr-TR": $8045cf930ef745aa$exports,
373
+ "uk-UA": $ee2044a77f24b118$exports,
374
+ "zh-CN": $4e1dbc65a687dd93$exports,
375
+ "zh-TW": $b0fef28529309aa6$exports
376
+ };
377
+
378
+
379
+
380
+ /*
381
+ * Copyright 2022 Adobe. All rights reserved.
382
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
383
+ * you may not use this file except in compliance with the License. You may obtain a copy
384
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
385
+ *
386
+ * Unless required by applicable law or agreed to in writing, software distributed under
387
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
388
+ * OF ANY KIND, either express or implied. See the License for the specific language
389
+ * governing permissions and limitations under the License.
390
+ */
391
+ const $40297c24c53588e6$var$generateRGB_R = (orientation, dir, zValue)=>{
392
+ let maskImage = `linear-gradient(to ${orientation[Number(!dir)]}, transparent, #000)`;
393
+ let result = {
394
+ colorAreaStyles: {
395
+ backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(${zValue},0,0),rgb(${zValue},255,0))`
396
+ },
397
+ gradientStyles: {
398
+ backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(${zValue},0,255),rgb(${zValue},255,255))`,
399
+ "WebkitMaskImage": maskImage,
400
+ maskImage: maskImage
401
+ }
402
+ };
403
+ return result;
404
+ };
405
+ const $40297c24c53588e6$var$generateRGB_G = (orientation, dir, zValue)=>{
406
+ let maskImage = `linear-gradient(to ${orientation[Number(!dir)]}, transparent, #000)`;
407
+ let result = {
408
+ colorAreaStyles: {
409
+ backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(0,${zValue},0),rgb(255,${zValue},0))`
410
+ },
411
+ gradientStyles: {
412
+ backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(0,${zValue},255),rgb(255,${zValue},255))`,
413
+ "WebkitMaskImage": maskImage,
414
+ maskImage: maskImage
415
+ }
416
+ };
417
+ return result;
418
+ };
419
+ const $40297c24c53588e6$var$generateRGB_B = (orientation, dir, zValue)=>{
420
+ let maskImage = `linear-gradient(to ${orientation[Number(!dir)]}, transparent, #000)`;
421
+ let result = {
422
+ colorAreaStyles: {
423
+ backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(0,0,${zValue}),rgb(255,0,${zValue}))`
424
+ },
425
+ gradientStyles: {
426
+ backgroundImage: `linear-gradient(to ${orientation[Number(dir)]},rgb(0,255,${zValue}),rgb(255,255,${zValue}))`,
427
+ "WebkitMaskImage": maskImage,
428
+ maskImage: maskImage
429
+ }
430
+ };
431
+ return result;
432
+ };
433
+ const $40297c24c53588e6$var$generateHSL_H = (orientation, dir, zValue)=>{
434
+ let result = {
435
+ colorAreaStyles: {},
436
+ gradientStyles: {
437
+ background: [
438
+ `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%)`,
439
+ `linear-gradient(to ${orientation[Number(!dir)]},hsl(0,0%,50%),hsla(0,0%,50%,0))`,
440
+ `hsl(${zValue}, 100%, 50%)`
441
+ ].join(",")
442
+ }
443
+ };
444
+ return result;
445
+ };
446
+ const $40297c24c53588e6$var$generateHSL_S = (orientation, dir, alphaValue)=>{
447
+ let result = {
448
+ colorAreaStyles: {},
449
+ gradientStyles: {
450
+ background: [
451
+ `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%)`,
452
+ `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}))`,
453
+ "hsl(0, 0%, 50%)"
454
+ ].join(",")
455
+ }
456
+ };
457
+ return result;
458
+ };
459
+ const $40297c24c53588e6$var$generateHSL_L = (orientation, dir, zValue)=>{
460
+ let result = {
461
+ colorAreaStyles: {},
462
+ gradientStyles: {
463
+ backgroundImage: [
464
+ `linear-gradient(to ${orientation[Number(!dir)]},hsl(0,0%,${zValue}%),hsla(0,0%,${zValue}%,0))`,
465
+ `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}%))`
466
+ ].join(",")
467
+ }
468
+ };
469
+ return result;
470
+ };
471
+ const $40297c24c53588e6$var$generateHSB_H = (orientation, dir, zValue)=>{
472
+ let result = {
473
+ colorAreaStyles: {},
474
+ gradientStyles: {
475
+ background: [
476
+ `linear-gradient(to ${orientation[Number(dir)]},hsl(0,0%,0%),hsla(0,0%,0%,0))`,
477
+ `linear-gradient(to ${orientation[Number(!dir)]},hsl(0,0%,100%),hsla(0,0%,100%,0))`,
478
+ `hsl(${zValue}, 100%, 50%)`
479
+ ].join(",")
480
+ }
481
+ };
482
+ return result;
483
+ };
484
+ const $40297c24c53588e6$var$generateHSB_S = (orientation, dir, alphaValue)=>{
485
+ let result = {
486
+ colorAreaStyles: {},
487
+ gradientStyles: {
488
+ background: [
489
+ `linear-gradient(to ${orientation[Number(!dir)]},hsla(0,0%,0%,${alphaValue}),hsla(0,0%,0%,0))`,
490
+ `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}))`,
491
+ `linear-gradient(to ${orientation[Number(!dir)]},hsl(0,0%,0%),hsl(0,0%,100%))`
492
+ ].join(",")
493
+ }
494
+ };
495
+ return result;
496
+ };
497
+ const $40297c24c53588e6$var$generateHSB_B = (orientation, dir, alphaValue)=>{
498
+ let result = {
499
+ colorAreaStyles: {},
500
+ gradientStyles: {
501
+ background: [
502
+ `linear-gradient(to ${orientation[Number(!dir)]},hsla(0,0%,100%,${alphaValue}),hsla(0,0%,100%,0))`,
503
+ `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}))`,
504
+ "#000"
505
+ ].join(",")
506
+ }
507
+ };
508
+ return result;
509
+ };
510
+ function $40297c24c53588e6$export$dd62420467d245ca({ direction: direction , state: state , zChannel: zChannel , xChannel: xChannel , isDisabled: isDisabled }) {
511
+ let returnVal = (0, $7KHxM$useMemo)(()=>{
512
+ let orientation = [
513
+ "top",
514
+ direction === "rtl" ? "left" : "right"
515
+ ];
516
+ let dir = false;
517
+ let background = {
518
+ colorAreaStyles: {},
519
+ gradientStyles: {}
520
+ };
521
+ let zValue = state.value.getChannelValue(zChannel);
522
+ let { minValue: zMin , maxValue: zMax } = state.value.getChannelRange(zChannel);
523
+ let alphaValue = (zValue - zMin) / (zMax - zMin);
524
+ let isHSL = state.value.getColorSpace() === "hsl";
525
+ if (!isDisabled) switch(zChannel){
526
+ case "red":
527
+ dir = xChannel === "green";
528
+ background = $40297c24c53588e6$var$generateRGB_R(orientation, dir, zValue);
529
+ break;
530
+ case "green":
531
+ dir = xChannel === "red";
532
+ background = $40297c24c53588e6$var$generateRGB_G(orientation, dir, zValue);
533
+ break;
534
+ case "blue":
535
+ dir = xChannel === "red";
536
+ background = $40297c24c53588e6$var$generateRGB_B(orientation, dir, zValue);
537
+ break;
538
+ case "hue":
539
+ dir = xChannel !== "saturation";
540
+ if (isHSL) background = $40297c24c53588e6$var$generateHSL_H(orientation, dir, zValue);
541
+ else background = $40297c24c53588e6$var$generateHSB_H(orientation, dir, zValue);
542
+ break;
543
+ case "saturation":
544
+ dir = xChannel === "hue";
545
+ if (isHSL) background = $40297c24c53588e6$var$generateHSL_S(orientation, dir, alphaValue);
546
+ else background = $40297c24c53588e6$var$generateHSB_S(orientation, dir, alphaValue);
547
+ break;
548
+ case "brightness":
549
+ dir = xChannel === "hue";
550
+ background = $40297c24c53588e6$var$generateHSB_B(orientation, dir, alphaValue);
551
+ break;
552
+ case "lightness":
553
+ dir = xChannel === "hue";
554
+ background = $40297c24c53588e6$var$generateHSL_L(orientation, dir, zValue);
555
+ break;
556
+ }
557
+ let { x: x , y: y } = state.getThumbPosition();
558
+ if (direction === "rtl") x = 1 - x;
559
+ let forcedColorAdjustNoneStyle = {
560
+ forcedColorAdjust: "none"
561
+ };
562
+ return {
563
+ colorAreaStyleProps: {
564
+ style: {
565
+ position: "relative",
566
+ touchAction: "none",
567
+ ...forcedColorAdjustNoneStyle,
568
+ ...background.colorAreaStyles
569
+ }
570
+ },
571
+ gradientStyleProps: {
572
+ style: {
573
+ touchAction: "none",
574
+ ...forcedColorAdjustNoneStyle,
575
+ ...background.gradientStyles
576
+ }
577
+ },
578
+ thumbStyleProps: {
579
+ style: {
580
+ position: "absolute",
581
+ left: `${x * 100}%`,
582
+ top: `${y * 100}%`,
583
+ transform: "translate(0%, 0%)",
584
+ touchAction: "none",
585
+ ...forcedColorAdjustNoneStyle
586
+ }
587
+ }
588
+ };
589
+ }, [
590
+ direction,
591
+ state,
592
+ zChannel,
593
+ xChannel,
594
+ isDisabled
595
+ ]);
596
+ return returnVal;
597
+ }
598
+
599
+
600
+
601
+
602
+
603
+ function $60bd7d6e45dcddfa$export$2f92a7a615a014f6(props, state) {
604
+ let { isDisabled: isDisabled , inputXRef: inputXRef , inputYRef: inputYRef , containerRef: containerRef , "aria-label": ariaLabel } = props;
605
+ let stringFormatter = (0, $7KHxM$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($052cfdf4c32eb7c3$exports))));
606
+ let { addGlobalListener: addGlobalListener , removeGlobalListener: removeGlobalListener } = (0, $7KHxM$useGlobalListeners)();
607
+ let { direction: direction , locale: locale } = (0, $7KHxM$useLocale)();
608
+ let focusedInputRef = (0, $7KHxM$useRef)(null);
609
+ let focusInput = (0, $7KHxM$useCallback)((inputRef = inputXRef)=>{
610
+ if (inputRef.current) (0, $7KHxM$focusWithoutScrolling)(inputRef.current);
611
+ }, [
612
+ inputXRef
613
+ ]);
614
+ let stateRef = (0, $7KHxM$useRef)(null);
615
+ stateRef.current = state;
616
+ let { xChannel: xChannel , yChannel: yChannel , zChannel: zChannel } = stateRef.current.channels;
617
+ let xChannelStep = stateRef.current.xChannelStep;
618
+ let yChannelStep = stateRef.current.yChannelStep;
619
+ let currentPosition = (0, $7KHxM$useRef)(null);
620
+ let { keyboardProps: keyboardProps } = (0, $7KHxM$useKeyboard)({
621
+ onKeyDown (e) {
622
+ // these are the cases that useMove doesn't handle
623
+ if (!/^(PageUp|PageDown|Home|End)$/.test(e.key)) {
624
+ e.continuePropagation();
625
+ return;
626
+ }
627
+ // same handling as useMove, don't need to stop propagation, useKeyboard will do that for us
628
+ e.preventDefault();
629
+ // remember to set this and unset it so that onChangeEnd is fired
630
+ stateRef.current.setDragging(true);
631
+ valueChangedViaKeyboard.current = true;
632
+ switch(e.key){
633
+ case "PageUp":
634
+ stateRef.current.incrementY(stateRef.current.yChannelPageStep);
635
+ focusedInputRef.current = inputYRef.current;
636
+ break;
637
+ case "PageDown":
638
+ stateRef.current.decrementY(stateRef.current.yChannelPageStep);
639
+ focusedInputRef.current = inputYRef.current;
640
+ break;
641
+ case "Home":
642
+ direction === "rtl" ? stateRef.current.incrementX(stateRef.current.xChannelPageStep) : stateRef.current.decrementX(stateRef.current.xChannelPageStep);
643
+ focusedInputRef.current = inputXRef.current;
644
+ break;
645
+ case "End":
646
+ direction === "rtl" ? stateRef.current.decrementX(stateRef.current.xChannelPageStep) : stateRef.current.incrementX(stateRef.current.xChannelPageStep);
647
+ focusedInputRef.current = inputXRef.current;
648
+ break;
649
+ }
650
+ stateRef.current.setDragging(false);
651
+ if (focusedInputRef.current) focusInput(focusedInputRef.current ? focusedInputRef : inputXRef);
652
+ }
653
+ });
654
+ let moveHandler = {
655
+ onMoveStart () {
656
+ currentPosition.current = null;
657
+ stateRef.current.setDragging(true);
658
+ },
659
+ onMove ({ deltaX: deltaX , deltaY: deltaY , pointerType: pointerType , shiftKey: shiftKey }) {
660
+ let { incrementX: incrementX , decrementX: decrementX , incrementY: incrementY , decrementY: decrementY , xChannelPageStep: xChannelPageStep , xChannelStep: xChannelStep , yChannelPageStep: yChannelPageStep , yChannelStep: yChannelStep , getThumbPosition: getThumbPosition , setColorFromPoint: setColorFromPoint } = stateRef.current;
661
+ if (currentPosition.current == null) currentPosition.current = getThumbPosition();
662
+ let { width: width , height: height } = containerRef.current.getBoundingClientRect();
663
+ let valueChanged = deltaX !== 0 || deltaY !== 0;
664
+ if (pointerType === "keyboard") {
665
+ let deltaXValue = shiftKey && xChannelPageStep > xChannelStep ? xChannelPageStep : xChannelStep;
666
+ let deltaYValue = shiftKey && yChannelPageStep > yChannelStep ? yChannelPageStep : yChannelStep;
667
+ if (deltaX > 0 && direction === "ltr" || deltaX < 0 && direction === "rtl") incrementX(deltaXValue);
668
+ else if (deltaX < 0 && direction === "ltr" || deltaX > 0 && direction === "rtl") decrementX(deltaXValue);
669
+ else if (deltaY > 0) decrementY(deltaYValue);
670
+ else if (deltaY < 0) incrementY(deltaYValue);
671
+ valueChangedViaKeyboard.current = valueChanged;
672
+ // set the focused input based on which axis has the greater delta
673
+ focusedInputRef.current = valueChanged && Math.abs(deltaY) > Math.abs(deltaX) ? inputYRef.current : inputXRef.current;
674
+ } else {
675
+ currentPosition.current.x += (direction === "rtl" ? -1 : 1) * deltaX / width;
676
+ currentPosition.current.y += deltaY / height;
677
+ setColorFromPoint(currentPosition.current.x, currentPosition.current.y);
678
+ }
679
+ },
680
+ onMoveEnd () {
681
+ isOnColorArea.current = undefined;
682
+ stateRef.current.setDragging(false);
683
+ focusInput(focusedInputRef.current ? focusedInputRef : inputXRef);
684
+ }
685
+ };
686
+ let { moveProps: movePropsThumb } = (0, $7KHxM$useMove)(moveHandler);
687
+ let valueChangedViaKeyboard = (0, $7KHxM$useRef)(false);
688
+ let { focusWithinProps: focusWithinProps } = (0, $7KHxM$useFocusWithin)({
689
+ onFocusWithinChange: (focusWithin)=>{
690
+ if (!focusWithin) {
691
+ valueChangedViaKeyboard.current = false;
692
+ focusedInputRef.current;
693
+ }
694
+ }
695
+ });
696
+ let currentPointer = (0, $7KHxM$useRef)(undefined);
697
+ let isOnColorArea = (0, $7KHxM$useRef)(false);
698
+ let { moveProps: movePropsContainer } = (0, $7KHxM$useMove)({
699
+ onMoveStart () {
700
+ if (isOnColorArea.current) moveHandler.onMoveStart();
701
+ },
702
+ onMove (e) {
703
+ if (isOnColorArea.current) moveHandler.onMove(e);
704
+ },
705
+ onMoveEnd () {
706
+ if (isOnColorArea.current) moveHandler.onMoveEnd();
707
+ }
708
+ });
709
+ let onThumbDown = (id)=>{
710
+ if (!state.isDragging) {
711
+ currentPointer.current = id;
712
+ valueChangedViaKeyboard.current = false;
713
+ focusInput();
714
+ state.setDragging(true);
715
+ if (typeof PointerEvent !== "undefined") addGlobalListener(window, "pointerup", onThumbUp, false);
716
+ else {
717
+ addGlobalListener(window, "mouseup", onThumbUp, false);
718
+ addGlobalListener(window, "touchend", onThumbUp, false);
719
+ }
720
+ }
721
+ };
722
+ let onThumbUp = (e)=>{
723
+ var _e_changedTouches;
724
+ var _e_pointerId;
725
+ let id = (_e_pointerId = e.pointerId) !== null && _e_pointerId !== void 0 ? _e_pointerId : (_e_changedTouches = e.changedTouches) === null || _e_changedTouches === void 0 ? void 0 : _e_changedTouches[0].identifier;
726
+ if (id === currentPointer.current) {
727
+ valueChangedViaKeyboard.current = false;
728
+ focusInput();
729
+ state.setDragging(false);
730
+ currentPointer.current = undefined;
731
+ isOnColorArea.current = false;
732
+ if (typeof PointerEvent !== "undefined") removeGlobalListener(window, "pointerup", onThumbUp, false);
733
+ else {
734
+ removeGlobalListener(window, "mouseup", onThumbUp, false);
735
+ removeGlobalListener(window, "touchend", onThumbUp, false);
736
+ }
737
+ }
738
+ };
739
+ let onColorAreaDown = (colorArea, id, clientX, clientY)=>{
740
+ let rect = colorArea.getBoundingClientRect();
741
+ let { width: width , height: height } = rect;
742
+ let x = (clientX - rect.x) / width;
743
+ let y = (clientY - rect.y) / height;
744
+ if (direction === "rtl") x = 1 - x;
745
+ if (x >= 0 && x <= 1 && y >= 0 && y <= 1 && !state.isDragging && currentPointer.current === undefined) {
746
+ isOnColorArea.current = true;
747
+ valueChangedViaKeyboard.current = false;
748
+ currentPointer.current = id;
749
+ state.setColorFromPoint(x, y);
750
+ focusInput();
751
+ state.setDragging(true);
752
+ if (typeof PointerEvent !== "undefined") addGlobalListener(window, "pointerup", onColorAreaUp, false);
753
+ else {
754
+ addGlobalListener(window, "mouseup", onColorAreaUp, false);
755
+ addGlobalListener(window, "touchend", onColorAreaUp, false);
756
+ }
757
+ }
758
+ };
759
+ let onColorAreaUp = (e)=>{
760
+ var _e_changedTouches;
761
+ var _e_pointerId;
762
+ let id = (_e_pointerId = e.pointerId) !== null && _e_pointerId !== void 0 ? _e_pointerId : (_e_changedTouches = e.changedTouches) === null || _e_changedTouches === void 0 ? void 0 : _e_changedTouches[0].identifier;
763
+ if (isOnColorArea.current && id === currentPointer.current) {
764
+ isOnColorArea.current = false;
765
+ valueChangedViaKeyboard.current = false;
766
+ currentPointer.current = undefined;
767
+ state.setDragging(false);
768
+ focusInput();
769
+ if (typeof PointerEvent !== "undefined") removeGlobalListener(window, "pointerup", onColorAreaUp, false);
770
+ else {
771
+ removeGlobalListener(window, "mouseup", onColorAreaUp, false);
772
+ removeGlobalListener(window, "touchend", onColorAreaUp, false);
773
+ }
774
+ }
775
+ };
776
+ let colorAreaInteractions = isDisabled ? {} : (0, $7KHxM$mergeProps)({
777
+ ...typeof PointerEvent !== "undefined" ? {
778
+ onPointerDown: (e)=>{
779
+ if (e.pointerType === "mouse" && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) return;
780
+ onColorAreaDown(e.currentTarget, e.pointerId, e.clientX, e.clientY);
781
+ }
782
+ } : {
783
+ onMouseDown: (e)=>{
784
+ if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
785
+ onColorAreaDown(e.currentTarget, undefined, e.clientX, e.clientY);
786
+ },
787
+ onTouchStart: (e)=>{
788
+ onColorAreaDown(e.currentTarget, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY);
789
+ }
790
+ }
791
+ }, movePropsContainer);
792
+ let thumbInteractions = isDisabled ? {} : (0, $7KHxM$mergeProps)({
793
+ ...typeof PointerEvent !== "undefined" ? {
794
+ onPointerDown: (e)=>{
795
+ if (e.pointerType === "mouse" && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) return;
796
+ onThumbDown(e.pointerId);
797
+ }
798
+ } : {
799
+ onMouseDown: (e)=>{
800
+ if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
801
+ onThumbDown(undefined);
802
+ },
803
+ onTouchStart: (e)=>{
804
+ onThumbDown(e.changedTouches[0].identifier);
805
+ }
806
+ }
807
+ }, focusWithinProps, keyboardProps, movePropsThumb);
808
+ let { focusProps: xInputFocusProps } = (0, $7KHxM$useFocus)({
809
+ onFocus: ()=>{
810
+ focusedInputRef.current = inputXRef.current;
811
+ }
812
+ });
813
+ let { focusProps: yInputFocusProps } = (0, $7KHxM$useFocus)({
814
+ onFocus: ()=>{
815
+ focusedInputRef.current = inputYRef.current;
816
+ }
817
+ });
818
+ let isMobile = (0, $7KHxM$isIOS)() || (0, $7KHxM$isAndroid)();
819
+ function getAriaValueTextForChannel(channel) {
820
+ return valueChangedViaKeyboard.current ? stringFormatter.format("colorNameAndValue", {
821
+ name: state.value.getChannelName(channel, locale),
822
+ value: state.value.formatChannelValue(channel, locale)
823
+ }) : [
824
+ stringFormatter.format("colorNameAndValue", {
825
+ name: state.value.getChannelName(channel, locale),
826
+ value: state.value.formatChannelValue(channel, locale)
827
+ }),
828
+ stringFormatter.format("colorNameAndValue", {
829
+ name: state.value.getChannelName(channel === yChannel ? xChannel : yChannel, locale),
830
+ value: state.value.formatChannelValue(channel === yChannel ? xChannel : yChannel, locale)
831
+ })
832
+ ].join(", ");
833
+ }
834
+ let colorPickerLabel = stringFormatter.format("colorPicker");
835
+ let xInputLabellingProps = (0, $7KHxM$useLabels)({
836
+ ...props,
837
+ "aria-label": ariaLabel ? stringFormatter.format("colorInputLabel", {
838
+ label: ariaLabel,
839
+ channelLabel: colorPickerLabel
840
+ }) : colorPickerLabel
841
+ });
842
+ let yInputLabellingProps = (0, $7KHxM$useLabels)({
843
+ ...props,
844
+ "aria-label": ariaLabel ? stringFormatter.format("colorInputLabel", {
845
+ label: ariaLabel,
846
+ channelLabel: colorPickerLabel
847
+ }) : colorPickerLabel
848
+ });
849
+ let colorAreaLabellingProps = (0, $7KHxM$useLabels)({
850
+ ...props,
851
+ "aria-label": ariaLabel ? `${ariaLabel}, ${colorPickerLabel}` : undefined
852
+ }, isMobile ? colorPickerLabel : undefined);
853
+ let ariaRoleDescription = stringFormatter.format("twoDimensionalSlider");
854
+ let { visuallyHiddenProps: visuallyHiddenProps } = (0, $7KHxM$useVisuallyHidden)({
855
+ style: {
856
+ opacity: "0.0001",
857
+ width: "100%",
858
+ height: "100%",
859
+ pointerEvents: "none"
860
+ }
861
+ });
862
+ let { colorAreaStyleProps: colorAreaStyleProps , gradientStyleProps: gradientStyleProps , thumbStyleProps: thumbStyleProps } = (0, $40297c24c53588e6$export$dd62420467d245ca)({
863
+ direction: direction,
864
+ state: state,
865
+ xChannel: xChannel,
866
+ zChannel: zChannel,
867
+ isDisabled: props.isDisabled
868
+ });
869
+ return {
870
+ colorAreaProps: {
871
+ ...colorAreaLabellingProps,
872
+ ...colorAreaInteractions,
873
+ ...colorAreaStyleProps,
874
+ role: "group"
875
+ },
876
+ gradientProps: {
877
+ ...gradientStyleProps,
878
+ role: "presentation"
879
+ },
880
+ thumbProps: {
881
+ ...thumbInteractions,
882
+ ...thumbStyleProps,
883
+ role: "presentation"
884
+ },
885
+ xInputProps: {
886
+ ...xInputLabellingProps,
887
+ ...visuallyHiddenProps,
888
+ ...xInputFocusProps,
889
+ type: "range",
890
+ min: state.value.getChannelRange(xChannel).minValue,
891
+ max: state.value.getChannelRange(xChannel).maxValue,
892
+ step: xChannelStep,
893
+ "aria-roledescription": ariaRoleDescription,
894
+ "aria-valuetext": getAriaValueTextForChannel(xChannel),
895
+ disabled: isDisabled,
896
+ value: state.value.getChannelValue(xChannel),
897
+ tabIndex: isMobile || !focusedInputRef.current || focusedInputRef.current === inputXRef.current ? undefined : -1,
898
+ /*
899
+ So that only a single "2d slider" control shows up when listing form elements for screen readers,
900
+ add aria-hidden="true" to the unfocused control when the value has not changed via the keyboard,
901
+ but remove aria-hidden to reveal the input for each channel when the value has changed with the keyboard.
902
+ */ "aria-hidden": isMobile || !focusedInputRef.current || focusedInputRef.current === inputXRef.current || valueChangedViaKeyboard.current ? undefined : "true",
903
+ onChange: (e)=>{
904
+ state.setXValue(parseFloat(e.target.value));
905
+ }
906
+ },
907
+ yInputProps: {
908
+ ...yInputLabellingProps,
909
+ ...visuallyHiddenProps,
910
+ ...yInputFocusProps,
911
+ type: "range",
912
+ min: state.value.getChannelRange(yChannel).minValue,
913
+ max: state.value.getChannelRange(yChannel).maxValue,
914
+ step: yChannelStep,
915
+ "aria-roledescription": ariaRoleDescription,
916
+ "aria-valuetext": getAriaValueTextForChannel(yChannel),
917
+ "aria-orientation": "vertical",
918
+ disabled: isDisabled,
919
+ value: state.value.getChannelValue(yChannel),
920
+ tabIndex: isMobile || focusedInputRef.current && focusedInputRef.current === inputYRef.current ? undefined : -1,
921
+ /*
922
+ So that only a single "2d slider" control shows up when listing form elements for screen readers,
923
+ add aria-hidden="true" to the unfocused input when the value has not changed via the keyboard,
924
+ but remove aria-hidden to reveal the input for each channel when the value has changed with the keyboard.
925
+ */ "aria-hidden": isMobile || focusedInputRef.current && focusedInputRef.current === inputYRef.current || valueChangedViaKeyboard.current ? undefined : "true",
926
+ onChange: (e)=>{
927
+ state.setYValue(parseFloat(e.target.value));
928
+ }
929
+ }
930
+ };
931
+ }
932
+
933
+
934
+ /*
935
+ * Copyright 2020 Adobe. All rights reserved.
936
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
937
+ * you may not use this file except in compliance with the License. You may obtain a copy
938
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
939
+ *
940
+ * Unless required by applicable law or agreed to in writing, software distributed under
941
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
942
+ * OF ANY KIND, either express or implied. See the License for the specific language
943
+ * governing permissions and limitations under the License.
944
+ */
945
+
946
+
947
+ function $40af666d6c251e36$export$106b7a4e66508f66(props, state) {
948
+ let { trackRef: trackRef , inputRef: inputRef , orientation: orientation , channel: channel , "aria-label": ariaLabel } = props;
949
+ let { locale: locale , direction: direction } = (0, $7KHxM$useLocale)();
950
+ // Provide a default aria-label if there is no other label provided.
951
+ if (!props.label && !ariaLabel && !props["aria-labelledby"]) ariaLabel = state.value.getChannelName(channel, locale);
952
+ // @ts-ignore - ignore unused incompatible props
953
+ let { groupProps: groupProps , trackProps: trackProps , labelProps: labelProps , outputProps: outputProps } = (0, $7KHxM$useSlider)({
954
+ ...props,
955
+ "aria-label": ariaLabel
956
+ }, state, trackRef);
957
+ let { inputProps: inputProps , thumbProps: thumbProps } = (0, $7KHxM$useSliderThumb)({
958
+ index: 0,
959
+ orientation: orientation,
960
+ isDisabled: props.isDisabled,
961
+ trackRef: trackRef,
962
+ inputRef: inputRef
963
+ }, state);
964
+ let generateBackground = ()=>{
965
+ let value = state.getDisplayColor();
966
+ let to;
967
+ if (orientation === "vertical") to = "top";
968
+ else if (direction === "ltr") to = "right";
969
+ else to = "left";
970
+ switch(channel){
971
+ case "hue":
972
+ 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%)`;
973
+ case "lightness":
974
+ {
975
+ // We have to add an extra color stop in the middle so that the hue shows up at all.
976
+ // Otherwise it will always just be black to white.
977
+ let min = state.getThumbMinValue(0);
978
+ let max = state.getThumbMaxValue(0);
979
+ let start = value.withChannelValue(channel, min).toString("css");
980
+ let middle = value.withChannelValue(channel, (max - min) / 2).toString("css");
981
+ let end = value.withChannelValue(channel, max).toString("css");
982
+ return `linear-gradient(to ${to}, ${start}, ${middle}, ${end})`;
983
+ }
984
+ case "saturation":
985
+ case "brightness":
986
+ case "red":
987
+ case "green":
988
+ case "blue":
989
+ case "alpha":
990
+ {
991
+ let start1 = value.withChannelValue(channel, state.getThumbMinValue(0)).toString("css");
992
+ let end1 = value.withChannelValue(channel, state.getThumbMaxValue(0)).toString("css");
993
+ return `linear-gradient(to ${to}, ${start1}, ${end1})`;
994
+ }
995
+ default:
996
+ throw new Error("Unknown color channel: " + channel);
997
+ }
998
+ };
999
+ let forcedColorAdjustNoneStyle = {
1000
+ forcedColorAdjust: "none"
1001
+ };
1002
+ return {
1003
+ trackProps: {
1004
+ ...(0, $7KHxM$mergeProps)(groupProps, trackProps),
1005
+ style: {
1006
+ ...trackProps.style,
1007
+ ...forcedColorAdjustNoneStyle,
1008
+ background: generateBackground()
1009
+ }
1010
+ },
1011
+ inputProps: inputProps,
1012
+ thumbProps: {
1013
+ ...thumbProps,
1014
+ style: {
1015
+ ...thumbProps.style,
1016
+ ...forcedColorAdjustNoneStyle
1017
+ }
1018
+ },
1019
+ labelProps: labelProps,
1020
+ outputProps: outputProps
1021
+ };
1022
+ }
1023
+
1024
+
1025
+ /*
1026
+ * Copyright 2020 Adobe. All rights reserved.
1027
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
1028
+ * you may not use this file except in compliance with the License. You may obtain a copy
1029
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
1030
+ *
1031
+ * Unless required by applicable law or agreed to in writing, software distributed under
1032
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
1033
+ * OF ANY KIND, either express or implied. See the License for the specific language
1034
+ * governing permissions and limitations under the License.
1035
+ */
1036
+
1037
+
1038
+
1039
+ function $b4a0a4fdc900495e$export$9064ff4e44b3729a(props, state, inputRef) {
1040
+ let { isDisabled: isDisabled , innerRadius: innerRadius , outerRadius: outerRadius , "aria-label": ariaLabel } = props;
1041
+ let { addGlobalListener: addGlobalListener , removeGlobalListener: removeGlobalListener } = (0, $7KHxM$useGlobalListeners)();
1042
+ let thumbRadius = (innerRadius + outerRadius) / 2;
1043
+ let focusInput = (0, $7KHxM$useCallback)(()=>{
1044
+ if (inputRef.current) (0, $7KHxM$focusWithoutScrolling)(inputRef.current);
1045
+ }, [
1046
+ inputRef
1047
+ ]);
1048
+ let stateRef = (0, $7KHxM$useRef)(null);
1049
+ stateRef.current = state;
1050
+ let currentPosition = (0, $7KHxM$useRef)(null);
1051
+ let { keyboardProps: keyboardProps } = (0, $7KHxM$useKeyboard)({
1052
+ onKeyDown (e) {
1053
+ // these are the cases that useMove doesn't handle
1054
+ if (!/^(PageUp|PageDown)$/.test(e.key)) {
1055
+ e.continuePropagation();
1056
+ return;
1057
+ }
1058
+ // same handling as useMove, don't need to stop propagation, useKeyboard will do that for us
1059
+ e.preventDefault();
1060
+ // remember to set this and unset it so that onChangeEnd is fired
1061
+ stateRef.current.setDragging(true);
1062
+ switch(e.key){
1063
+ case "PageUp":
1064
+ e.preventDefault();
1065
+ state.increment(stateRef.current.pageStep);
1066
+ break;
1067
+ case "PageDown":
1068
+ e.preventDefault();
1069
+ state.decrement(stateRef.current.pageStep);
1070
+ break;
1071
+ }
1072
+ stateRef.current.setDragging(false);
1073
+ }
1074
+ });
1075
+ let moveHandler = {
1076
+ onMoveStart () {
1077
+ currentPosition.current = null;
1078
+ state.setDragging(true);
1079
+ },
1080
+ onMove ({ deltaX: deltaX , deltaY: deltaY , pointerType: pointerType , shiftKey: shiftKey }) {
1081
+ if (currentPosition.current == null) currentPosition.current = stateRef.current.getThumbPosition(thumbRadius);
1082
+ currentPosition.current.x += deltaX;
1083
+ currentPosition.current.y += deltaY;
1084
+ if (pointerType === "keyboard") {
1085
+ if (deltaX > 0 || deltaY < 0) state.increment(shiftKey ? stateRef.current.pageStep : stateRef.current.step);
1086
+ else if (deltaX < 0 || deltaY > 0) state.decrement(shiftKey ? stateRef.current.pageStep : stateRef.current.step);
1087
+ } else stateRef.current.setHueFromPoint(currentPosition.current.x, currentPosition.current.y, thumbRadius);
1088
+ },
1089
+ onMoveEnd () {
1090
+ isOnTrack.current = undefined;
1091
+ state.setDragging(false);
1092
+ focusInput();
1093
+ }
1094
+ };
1095
+ let { moveProps: movePropsThumb } = (0, $7KHxM$useMove)(moveHandler);
1096
+ let currentPointer = (0, $7KHxM$useRef)(undefined);
1097
+ let isOnTrack = (0, $7KHxM$useRef)(false);
1098
+ let { moveProps: movePropsContainer } = (0, $7KHxM$useMove)({
1099
+ onMoveStart () {
1100
+ if (isOnTrack.current) moveHandler.onMoveStart();
1101
+ },
1102
+ onMove (e) {
1103
+ if (isOnTrack.current) moveHandler.onMove(e);
1104
+ },
1105
+ onMoveEnd () {
1106
+ if (isOnTrack.current) moveHandler.onMoveEnd();
1107
+ }
1108
+ });
1109
+ let onThumbDown = (id)=>{
1110
+ if (!state.isDragging) {
1111
+ currentPointer.current = id;
1112
+ focusInput();
1113
+ state.setDragging(true);
1114
+ if (typeof PointerEvent !== "undefined") addGlobalListener(window, "pointerup", onThumbUp, false);
1115
+ else {
1116
+ addGlobalListener(window, "mouseup", onThumbUp, false);
1117
+ addGlobalListener(window, "touchend", onThumbUp, false);
1118
+ }
1119
+ }
1120
+ };
1121
+ let onThumbUp = (e)=>{
1122
+ var _e_changedTouches;
1123
+ var _e_pointerId;
1124
+ let id = (_e_pointerId = e.pointerId) !== null && _e_pointerId !== void 0 ? _e_pointerId : (_e_changedTouches = e.changedTouches) === null || _e_changedTouches === void 0 ? void 0 : _e_changedTouches[0].identifier;
1125
+ if (id === currentPointer.current) {
1126
+ focusInput();
1127
+ state.setDragging(false);
1128
+ currentPointer.current = undefined;
1129
+ isOnTrack.current = false;
1130
+ if (typeof PointerEvent !== "undefined") removeGlobalListener(window, "pointerup", onThumbUp, false);
1131
+ else {
1132
+ removeGlobalListener(window, "mouseup", onThumbUp, false);
1133
+ removeGlobalListener(window, "touchend", onThumbUp, false);
1134
+ }
1135
+ }
1136
+ };
1137
+ let onTrackDown = (track, id, pageX, pageY)=>{
1138
+ let rect = track.getBoundingClientRect();
1139
+ let x = pageX - rect.x - rect.width / 2;
1140
+ let y = pageY - rect.y - rect.height / 2;
1141
+ let radius = Math.sqrt(x * x + y * y);
1142
+ if (innerRadius < radius && radius < outerRadius && !state.isDragging && currentPointer.current === undefined) {
1143
+ isOnTrack.current = true;
1144
+ currentPointer.current = id;
1145
+ stateRef.current.setHueFromPoint(x, y, radius);
1146
+ focusInput();
1147
+ state.setDragging(true);
1148
+ if (typeof PointerEvent !== "undefined") addGlobalListener(window, "pointerup", onTrackUp, false);
1149
+ else {
1150
+ addGlobalListener(window, "mouseup", onTrackUp, false);
1151
+ addGlobalListener(window, "touchend", onTrackUp, false);
1152
+ }
1153
+ }
1154
+ };
1155
+ let onTrackUp = (e)=>{
1156
+ var _e_changedTouches;
1157
+ var _e_pointerId;
1158
+ let id = (_e_pointerId = e.pointerId) !== null && _e_pointerId !== void 0 ? _e_pointerId : (_e_changedTouches = e.changedTouches) === null || _e_changedTouches === void 0 ? void 0 : _e_changedTouches[0].identifier;
1159
+ if (isOnTrack.current && id === currentPointer.current) {
1160
+ isOnTrack.current = false;
1161
+ currentPointer.current = undefined;
1162
+ state.setDragging(false);
1163
+ focusInput();
1164
+ if (typeof PointerEvent !== "undefined") removeGlobalListener(window, "pointerup", onTrackUp, false);
1165
+ else {
1166
+ removeGlobalListener(window, "mouseup", onTrackUp, false);
1167
+ removeGlobalListener(window, "touchend", onTrackUp, false);
1168
+ }
1169
+ }
1170
+ };
1171
+ let trackInteractions = isDisabled ? {} : (0, $7KHxM$mergeProps)({
1172
+ ...typeof PointerEvent !== "undefined" ? {
1173
+ onPointerDown: (e)=>{
1174
+ if (e.pointerType === "mouse" && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) return;
1175
+ onTrackDown(e.currentTarget, e.pointerId, e.clientX, e.clientY);
1176
+ }
1177
+ } : {
1178
+ onMouseDown: (e)=>{
1179
+ if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
1180
+ onTrackDown(e.currentTarget, undefined, e.clientX, e.clientY);
1181
+ },
1182
+ onTouchStart: (e)=>{
1183
+ onTrackDown(e.currentTarget, e.changedTouches[0].identifier, e.changedTouches[0].clientX, e.changedTouches[0].clientY);
1184
+ }
1185
+ }
1186
+ }, movePropsContainer);
1187
+ let thumbInteractions = isDisabled ? {} : (0, $7KHxM$mergeProps)({
1188
+ onMouseDown: (e)=>{
1189
+ if (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey) return;
1190
+ onThumbDown(undefined);
1191
+ },
1192
+ onPointerDown: (e)=>{
1193
+ if (e.pointerType === "mouse" && (e.button !== 0 || e.altKey || e.ctrlKey || e.metaKey)) return;
1194
+ onThumbDown(e.pointerId);
1195
+ },
1196
+ onTouchStart: (e)=>{
1197
+ onThumbDown(e.changedTouches[0].identifier);
1198
+ }
1199
+ }, keyboardProps, movePropsThumb);
1200
+ let { x: x , y: y } = state.getThumbPosition(thumbRadius);
1201
+ // Provide a default aria-label if none is given
1202
+ let { locale: locale } = (0, $7KHxM$useLocale)();
1203
+ if (ariaLabel == null && props["aria-labelledby"] == null) ariaLabel = state.value.getChannelName("hue", locale);
1204
+ let inputLabellingProps = (0, $7KHxM$useLabels)({
1205
+ ...props,
1206
+ "aria-label": ariaLabel
1207
+ });
1208
+ let { minValue: minValue , maxValue: maxValue , step: step } = state.value.getChannelRange("hue");
1209
+ let forcedColorAdjustNoneStyle = {
1210
+ forcedColorAdjust: "none"
1211
+ };
1212
+ return {
1213
+ trackProps: {
1214
+ ...trackInteractions,
1215
+ style: {
1216
+ position: "relative",
1217
+ touchAction: "none",
1218
+ width: outerRadius * 2,
1219
+ height: outerRadius * 2,
1220
+ background: `
1221
+ conic-gradient(
1222
+ from 90deg,
1223
+ hsl(0, 100%, 50%),
1224
+ hsl(30, 100%, 50%),
1225
+ hsl(60, 100%, 50%),
1226
+ hsl(90, 100%, 50%),
1227
+ hsl(120, 100%, 50%),
1228
+ hsl(150, 100%, 50%),
1229
+ hsl(180, 100%, 50%),
1230
+ hsl(210, 100%, 50%),
1231
+ hsl(240, 100%, 50%),
1232
+ hsl(270, 100%, 50%),
1233
+ hsl(300, 100%, 50%),
1234
+ hsl(330, 100%, 50%),
1235
+ hsl(360, 100%, 50%)
1236
+ )
1237
+ `,
1238
+ clipPath: `path(evenodd, "${$b4a0a4fdc900495e$var$circlePath(outerRadius, outerRadius, outerRadius)} ${$b4a0a4fdc900495e$var$circlePath(outerRadius, outerRadius, innerRadius)}")`,
1239
+ ...forcedColorAdjustNoneStyle
1240
+ }
1241
+ },
1242
+ thumbProps: {
1243
+ ...thumbInteractions,
1244
+ style: {
1245
+ position: "absolute",
1246
+ left: "50%",
1247
+ top: "50%",
1248
+ transform: `translate(calc(${x}px - 50%), calc(${y}px - 50%))`,
1249
+ touchAction: "none",
1250
+ ...forcedColorAdjustNoneStyle
1251
+ }
1252
+ },
1253
+ inputProps: (0, $7KHxM$mergeProps)(inputLabellingProps, {
1254
+ type: "range",
1255
+ min: String(minValue),
1256
+ max: String(maxValue),
1257
+ step: String(step),
1258
+ "aria-valuetext": state.value.formatChannelValue("hue", locale),
1259
+ disabled: isDisabled,
1260
+ value: `${state.value.getChannelValue("hue")}`,
1261
+ onChange: (e)=>{
1262
+ state.setHue(parseFloat(e.target.value));
1263
+ }
1264
+ })
1265
+ };
1266
+ }
1267
+ // Creates an SVG path string for a circle.
1268
+ function $b4a0a4fdc900495e$var$circlePath(cx, cy, r) {
1269
+ 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`;
1270
+ }
1271
+
1272
+
1273
+ /*
1274
+ * Copyright 2020 Adobe. All rights reserved.
1275
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
1276
+ * you may not use this file except in compliance with the License. You may obtain a copy
1277
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
1278
+ *
1279
+ * Unless required by applicable law or agreed to in writing, software distributed under
1280
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
1281
+ * OF ANY KIND, either express or implied. See the License for the specific language
1282
+ * governing permissions and limitations under the License.
1283
+ */
1284
+
1285
+
1286
+
1287
+
1288
+ function $f6896b05b2ecad12$export$77e32ca575a28fdf(props, state, ref) {
1289
+ let { isDisabled: isDisabled , isReadOnly: isReadOnly , isRequired: isRequired } = props;
1290
+ let { colorValue: colorValue , inputValue: inputValue , commit: commit , increment: increment , decrement: decrement , incrementToMax: incrementToMax , decrementToMin: decrementToMin } = state;
1291
+ let inputId = (0, $7KHxM$useId)();
1292
+ let { spinButtonProps: spinButtonProps } = (0, $7KHxM$useSpinButton)({
1293
+ isDisabled: isDisabled,
1294
+ isReadOnly: isReadOnly,
1295
+ isRequired: isRequired,
1296
+ maxValue: 0xFFFFFF,
1297
+ minValue: 0,
1298
+ onIncrement: increment,
1299
+ onIncrementToMax: incrementToMax,
1300
+ onDecrement: decrement,
1301
+ onDecrementToMin: decrementToMin,
1302
+ value: colorValue ? colorValue.toHexInt() : undefined,
1303
+ textValue: colorValue ? colorValue.toString("hex") : undefined
1304
+ });
1305
+ let [focusWithin, setFocusWithin] = (0, $7KHxM$useState)(false);
1306
+ let { focusWithinProps: focusWithinProps } = (0, $7KHxM$useFocusWithin)({
1307
+ isDisabled: isDisabled,
1308
+ onFocusWithinChange: setFocusWithin
1309
+ });
1310
+ let onWheel = (0, $7KHxM$useCallback)((e)=>{
1311
+ if (Math.abs(e.deltaY) <= Math.abs(e.deltaX)) return;
1312
+ if (e.deltaY > 0) increment();
1313
+ else if (e.deltaY < 0) decrement();
1314
+ }, [
1315
+ decrement,
1316
+ increment
1317
+ ]);
1318
+ // If the input isn't supposed to receive input, disable scrolling.
1319
+ let scrollingDisabled = isDisabled || isReadOnly || !focusWithin;
1320
+ (0, $7KHxM$useScrollWheel)({
1321
+ onScroll: onWheel,
1322
+ isDisabled: scrollingDisabled
1323
+ }, ref);
1324
+ let onChange = (value)=>{
1325
+ state.setInputValue(value);
1326
+ };
1327
+ let { labelProps: labelProps , inputProps: inputProps } = (0, $7KHxM$useFormattedTextField)((0, $7KHxM$mergeProps)(props, {
1328
+ id: inputId,
1329
+ value: inputValue,
1330
+ defaultValue: undefined,
1331
+ type: "text",
1332
+ autoComplete: "off",
1333
+ onChange: onChange
1334
+ }), state, ref);
1335
+ return {
1336
+ labelProps: labelProps,
1337
+ inputProps: (0, $7KHxM$mergeProps)(inputProps, spinButtonProps, focusWithinProps, {
1338
+ role: "textbox",
1339
+ "aria-valuemax": null,
1340
+ "aria-valuemin": null,
1341
+ "aria-valuenow": null,
1342
+ "aria-valuetext": null,
1343
+ autoCorrect: "off",
1344
+ spellCheck: "false",
1345
+ onBlur: commit
1346
+ })
1347
+ };
1348
+ }
1349
+
1350
+
1351
+
1352
+
1353
+ export {$60bd7d6e45dcddfa$export$2f92a7a615a014f6 as useColorArea, $40af666d6c251e36$export$106b7a4e66508f66 as useColorSlider, $b4a0a4fdc900495e$export$9064ff4e44b3729a as useColorWheel, $f6896b05b2ecad12$export$77e32ca575a28fdf as useColorField};
1354
+ //# sourceMappingURL=module.js.map