@yamada-ui/color-picker 1.0.0

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 (83) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +28 -0
  3. package/dist/alpha-slider.d.mts +62 -0
  4. package/dist/alpha-slider.d.ts +62 -0
  5. package/dist/alpha-slider.js +438 -0
  6. package/dist/alpha-slider.mjs +8 -0
  7. package/dist/chunk-3EO2XBIZ.mjs +54 -0
  8. package/dist/chunk-3KASGDAY.mjs +122 -0
  9. package/dist/chunk-3N443XSV.mjs +105 -0
  10. package/dist/chunk-73BVTMII.mjs +73 -0
  11. package/dist/chunk-7QGCTVDG.mjs +66 -0
  12. package/dist/chunk-DTB2Z3IJ.mjs +278 -0
  13. package/dist/chunk-EMWFECJD.mjs +123 -0
  14. package/dist/chunk-HNVFOSAM.mjs +210 -0
  15. package/dist/chunk-KJS52X4M.mjs +330 -0
  16. package/dist/chunk-MAHWFXUG.mjs +294 -0
  17. package/dist/chunk-N2GG5L7Q.mjs +39 -0
  18. package/dist/chunk-NR2XCTSD.mjs +430 -0
  19. package/dist/chunk-PTTNJPGJ.mjs +98 -0
  20. package/dist/chunk-PVWIBTBL.mjs +67 -0
  21. package/dist/chunk-TFQ62YSQ.mjs +68 -0
  22. package/dist/chunk-U6OJ4TDG.mjs +127 -0
  23. package/dist/color-input.d.mts +79 -0
  24. package/dist/color-input.d.ts +79 -0
  25. package/dist/color-input.js +2283 -0
  26. package/dist/color-input.mjs +21 -0
  27. package/dist/color-picker-body.d.mts +38 -0
  28. package/dist/color-picker-body.d.ts +38 -0
  29. package/dist/color-picker-body.js +794 -0
  30. package/dist/color-picker-body.mjs +14 -0
  31. package/dist/color-picker-channels.d.mts +20 -0
  32. package/dist/color-picker-channels.d.ts +20 -0
  33. package/dist/color-picker-channels.js +101 -0
  34. package/dist/color-picker-channels.mjs +10 -0
  35. package/dist/color-picker-eye-dropper.d.mts +10 -0
  36. package/dist/color-picker-eye-dropper.d.ts +10 -0
  37. package/dist/color-picker-eye-dropper.js +88 -0
  38. package/dist/color-picker-eye-dropper.mjs +10 -0
  39. package/dist/color-picker-sliders.d.mts +30 -0
  40. package/dist/color-picker-sliders.d.ts +30 -0
  41. package/dist/color-picker-sliders.js +590 -0
  42. package/dist/color-picker-sliders.mjs +11 -0
  43. package/dist/color-picker-swatches.d.mts +34 -0
  44. package/dist/color-picker-swatches.d.ts +34 -0
  45. package/dist/color-picker-swatches.js +195 -0
  46. package/dist/color-picker-swatches.mjs +9 -0
  47. package/dist/color-picker.d.mts +59 -0
  48. package/dist/color-picker.d.ts +59 -0
  49. package/dist/color-picker.js +1790 -0
  50. package/dist/color-picker.mjs +19 -0
  51. package/dist/color-swatch.d.mts +36 -0
  52. package/dist/color-swatch.d.ts +36 -0
  53. package/dist/color-swatch.js +124 -0
  54. package/dist/color-swatch.mjs +6 -0
  55. package/dist/hue-slider.d.mts +56 -0
  56. package/dist/hue-slider.d.ts +56 -0
  57. package/dist/hue-slider.js +409 -0
  58. package/dist/hue-slider.mjs +8 -0
  59. package/dist/index.d.mts +23 -0
  60. package/dist/index.d.ts +23 -0
  61. package/dist/index.js +2295 -0
  62. package/dist/index.mjs +36 -0
  63. package/dist/saturation-slider.d.mts +33 -0
  64. package/dist/saturation-slider.d.ts +33 -0
  65. package/dist/saturation-slider.js +414 -0
  66. package/dist/saturation-slider.mjs +7 -0
  67. package/dist/use-color-input.d.mts +90 -0
  68. package/dist/use-color-input.d.ts +90 -0
  69. package/dist/use-color-input.js +340 -0
  70. package/dist/use-color-input.mjs +10 -0
  71. package/dist/use-color-picker.d.mts +131 -0
  72. package/dist/use-color-picker.d.ts +131 -0
  73. package/dist/use-color-picker.js +472 -0
  74. package/dist/use-color-picker.mjs +11 -0
  75. package/dist/use-color-slider.d.mts +69 -0
  76. package/dist/use-color-slider.d.ts +69 -0
  77. package/dist/use-color-slider.js +321 -0
  78. package/dist/use-color-slider.mjs +7 -0
  79. package/dist/use-saturation-slider.d.mts +77 -0
  80. package/dist/use-saturation-slider.d.ts +77 -0
  81. package/dist/use-saturation-slider.js +302 -0
  82. package/dist/use-saturation-slider.mjs +6 -0
  83. package/package.json +88 -0
package/dist/index.js ADDED
@@ -0,0 +1,2295 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ AlphaSlider: () => AlphaSlider,
24
+ ColorInput: () => ColorInput,
25
+ ColorPicker: () => ColorPicker,
26
+ ColorSwatch: () => ColorSwatch,
27
+ HueSlider: () => HueSlider,
28
+ SaturationSlider: () => SaturationSlider
29
+ });
30
+ module.exports = __toCommonJS(src_exports);
31
+
32
+ // src/color-picker.tsx
33
+ var import_core10 = require("@yamada-ui/core");
34
+ var import_utils13 = require("@yamada-ui/utils");
35
+
36
+ // src/color-picker-body.tsx
37
+ var import_core6 = require("@yamada-ui/core");
38
+ var import_utils8 = require("@yamada-ui/utils");
39
+
40
+ // src/color-picker-eye-dropper.tsx
41
+ var import_button = require("@yamada-ui/button");
42
+ var import_core = require("@yamada-ui/core");
43
+ var import_icon = require("@yamada-ui/icon");
44
+ var import_utils2 = require("@yamada-ui/utils");
45
+
46
+ // src/use-color-picker.ts
47
+ var import_form_control = require("@yamada-ui/form-control");
48
+ var import_use_controllable_state = require("@yamada-ui/use-controllable-state");
49
+ var import_use_eye_dropper = require("@yamada-ui/use-eye-dropper");
50
+ var import_utils = require("@yamada-ui/utils");
51
+ var import_react = require("react");
52
+
53
+ // ../../utils/src/object.ts
54
+ var pickObject = (obj, keys) => {
55
+ const result = {};
56
+ keys.forEach((key) => {
57
+ if (key in obj)
58
+ result[key] = obj[key];
59
+ });
60
+ return result;
61
+ };
62
+ var getObject = (obj, path, fallback, i) => {
63
+ const k = typeof path === "string" ? path.split(".") : [path];
64
+ for (i = 0; i < k.length; i += 1) {
65
+ if (!obj)
66
+ break;
67
+ obj = obj[k[i]];
68
+ }
69
+ return obj === void 0 ? fallback : obj;
70
+ };
71
+ var memoizeObject = (func) => {
72
+ const cache = /* @__PURE__ */ new WeakMap();
73
+ const memoizedFunc = (obj, path, fallback, i) => {
74
+ if (typeof obj === "undefined")
75
+ return func(obj, path, fallback);
76
+ if (!cache.has(obj))
77
+ cache.set(obj, /* @__PURE__ */ new Map());
78
+ const map = cache.get(obj);
79
+ if (map.has(path))
80
+ return map.get(path);
81
+ const value = func(obj, path, fallback, i);
82
+ map.set(path, value);
83
+ return value;
84
+ };
85
+ return memoizedFunc;
86
+ };
87
+ var getMemoizedObject = memoizeObject(getObject);
88
+
89
+ // src/use-color-picker.ts
90
+ var convertHsla = (value, fallback) => {
91
+ var _a;
92
+ let [h, s, l, a] = (_a = (0, import_utils.parseToHsla)(value, fallback)) != null ? _a : [0, 0, 1, 1];
93
+ if (a > 1)
94
+ a = 1;
95
+ return { h, s, l, a };
96
+ };
97
+ var convertRgba = (value, fallback) => {
98
+ var _a;
99
+ let [r, g, b, a] = (_a = (0, import_utils.parseToRgba)(value, fallback)) != null ? _a : [255, 255, 255, 1];
100
+ if (r > 255)
101
+ r = 255;
102
+ if (g > 255)
103
+ g = 255;
104
+ if (b > 255)
105
+ b = 255;
106
+ if (a > 1)
107
+ a = 1;
108
+ return { r, g, b, a };
109
+ };
110
+ var convertHsva = (value, fallback) => {
111
+ const [h, s, v, a] = (0, import_utils.parseToHsv)(value, fallback);
112
+ return { h, s, v, a };
113
+ };
114
+ var [ColorPickerProvider, useColorPickerContext] = (0, import_utils.createContext)({
115
+ name: "ColorPickerContext",
116
+ errorMessage: `useColorPickerContext returned is 'undefined'. Seems you forgot to wrap the components in "<ColorPicker />"`
117
+ });
118
+ var useColorPicker = ({
119
+ isInvalid,
120
+ ...props
121
+ }) => {
122
+ var _a;
123
+ let {
124
+ id,
125
+ name,
126
+ value: valueProp,
127
+ defaultValue,
128
+ fallbackValue,
129
+ onChange: onChangeProp,
130
+ onChangeStart: onChangeStartProp,
131
+ onChangeEnd: onChangeEndProp,
132
+ format,
133
+ required,
134
+ disabled,
135
+ readOnly,
136
+ onSwatchClick,
137
+ ...rest
138
+ } = (0, import_form_control.useFormControlProps)({ isInvalid, ...props });
139
+ const onChangeStartRef = (0, import_utils.useCallbackRef)(onChangeStartProp);
140
+ const onChangeEndRef = (0, import_utils.useCallbackRef)(onChangeEndProp);
141
+ const { supported: eyeDropperSupported, onOpen } = (0, import_use_eye_dropper.useEyeDropper)();
142
+ const [value, setValue] = (0, import_use_controllable_state.useControllableState)({
143
+ value: valueProp,
144
+ defaultValue: (_a = defaultValue != null ? defaultValue : fallbackValue) != null ? _a : "#ffffffff",
145
+ onChange: onChangeProp
146
+ });
147
+ const timeoutId = (0, import_react.useRef)(void 0);
148
+ const formatRef = (0, import_react.useRef)(format != null ? format : (0, import_utils.calcFormat)(value));
149
+ const isDraggingRef = (0, import_react.useRef)(false);
150
+ const [parsedValue, setParsedValue] = (0, import_react.useState)(
151
+ convertHsva(value, fallbackValue)
152
+ );
153
+ const { h, s, v, a } = parsedValue;
154
+ const withAlpha = formatRef.current.endsWith("a");
155
+ const isInteractive = !(disabled || readOnly);
156
+ const channels = (0, import_react.useMemo)(() => {
157
+ if (value.startsWith("hsl")) {
158
+ const { h: h2, s: s2, l, a: a2 } = convertHsla(value, fallbackValue);
159
+ let channels2 = [
160
+ { label: "H", space: "h", value: Math.round(h2), min: 0, max: 360 },
161
+ {
162
+ label: "S(%)",
163
+ space: "s",
164
+ value: Math.round(s2 * 100),
165
+ min: 0,
166
+ max: 100
167
+ },
168
+ {
169
+ label: "L(%)",
170
+ space: "l",
171
+ value: Math.round(l * 100),
172
+ min: 0,
173
+ max: 100
174
+ }
175
+ ];
176
+ if (withAlpha) {
177
+ channels2 = [
178
+ ...channels2,
179
+ {
180
+ label: "A(%)",
181
+ space: "a",
182
+ value: Math.round(a2 * 100),
183
+ min: 0,
184
+ max: 100
185
+ }
186
+ ];
187
+ }
188
+ return channels2;
189
+ } else {
190
+ const { r, g, b, a: a2 } = convertRgba(value, fallbackValue);
191
+ let channels2 = [
192
+ { label: "R", space: "r", value: Math.round(r), min: 0, max: 255 },
193
+ { label: "G", space: "g", value: Math.round(g), min: 0, max: 255 },
194
+ { label: "B", space: "b", value: Math.round(b), min: 0, max: 255 }
195
+ ];
196
+ if (withAlpha) {
197
+ channels2 = [
198
+ ...channels2,
199
+ {
200
+ label: "A(%)",
201
+ space: "a",
202
+ value: Math.round(a2 * 100),
203
+ min: 0,
204
+ max: 100
205
+ }
206
+ ];
207
+ }
208
+ return channels2;
209
+ }
210
+ }, [value, withAlpha, fallbackValue]);
211
+ const onChange = (0, import_react.useCallback)(
212
+ (value2) => {
213
+ if ((0, import_utils.isString)(value2)) {
214
+ setParsedValue(convertHsva(value2, fallbackValue));
215
+ } else {
216
+ setParsedValue((prev) => ({ ...prev, ...value2 }));
217
+ }
218
+ },
219
+ [fallbackValue]
220
+ );
221
+ const onChangeStart = (0, import_react.useCallback)(
222
+ (value2) => {
223
+ window.clearTimeout(timeoutId.current);
224
+ isDraggingRef.current = true;
225
+ const { h: h2, s: s2, v: v2, a: a2 } = { ...parsedValue, ...value2 };
226
+ const nextValue = (0, import_utils.hsvTo)([h2, s2, v2, a2], fallbackValue)(formatRef.current);
227
+ if (nextValue)
228
+ onChangeStartRef(nextValue);
229
+ },
230
+ [formatRef, onChangeStartRef, fallbackValue, parsedValue]
231
+ );
232
+ const onChangeEnd = (0, import_react.useCallback)(
233
+ (value2) => {
234
+ window.clearTimeout(timeoutId.current);
235
+ timeoutId.current = window.setTimeout(() => {
236
+ isDraggingRef.current = false;
237
+ }, 200);
238
+ let nextValue;
239
+ if ((0, import_utils.isString)(value2)) {
240
+ nextValue = (0, import_utils.convertColor)(value2, fallbackValue)(formatRef.current);
241
+ } else {
242
+ const { h: h2, s: s2, v: v2, a: a2 } = { ...parsedValue, ...value2 };
243
+ nextValue = (0, import_utils.hsvTo)([h2, s2, v2, a2], fallbackValue)(formatRef.current);
244
+ }
245
+ if (nextValue)
246
+ onChangeEndRef(nextValue);
247
+ },
248
+ [formatRef, onChangeEndRef, fallbackValue, parsedValue]
249
+ );
250
+ const onChannelChange = (0, import_react.useCallback)(
251
+ (ev, space) => {
252
+ let n = Math.floor(parseFloat(ev.target.value));
253
+ if (isNaN(n))
254
+ n = 0;
255
+ if (["s", "l", "a"].includes(space))
256
+ n = n / 100;
257
+ let nextValue;
258
+ if (value.startsWith("hsl")) {
259
+ const { h: h2, s: s2, l, a: a2 } = Object.assign(
260
+ convertHsla(value, fallbackValue),
261
+ { [space]: n }
262
+ );
263
+ nextValue = (0, import_utils.hslaTo)([h2, s2, l, a2], fallbackValue)(formatRef.current);
264
+ } else {
265
+ const { r, g, b, a: a2 } = Object.assign(
266
+ convertRgba(value, fallbackValue),
267
+ { [space]: n }
268
+ );
269
+ nextValue = (0, import_utils.rgbaTo)([r, g, b, a2], fallbackValue)(formatRef.current);
270
+ }
271
+ if (!nextValue)
272
+ return;
273
+ onChange(nextValue);
274
+ onChangeEnd(nextValue);
275
+ },
276
+ [value, onChange, onChangeEnd, formatRef, fallbackValue]
277
+ );
278
+ const onEyeDropperClick = (0, import_react.useCallback)(async () => {
279
+ var _a2;
280
+ try {
281
+ const { sRGBHex } = (_a2 = await onOpen()) != null ? _a2 : {};
282
+ if (!sRGBHex)
283
+ return;
284
+ onChange(sRGBHex);
285
+ onChangeEnd(sRGBHex);
286
+ } catch {
287
+ }
288
+ }, [onOpen, onChange, onChangeEnd]);
289
+ (0, import_utils.useUpdateEffect)(() => {
290
+ const value2 = (0, import_utils.hsvTo)([h, s, v, a], fallbackValue)(formatRef.current);
291
+ if (value2)
292
+ setValue(value2);
293
+ }, [h, s, v, a, fallbackValue]);
294
+ (0, import_utils.useUpdateEffect)(() => {
295
+ if (isDraggingRef.current)
296
+ return;
297
+ if (valueProp)
298
+ setParsedValue(convertHsva(valueProp, fallbackValue));
299
+ }, [valueProp]);
300
+ (0, import_utils.useUpdateEffect)(() => {
301
+ if (!format)
302
+ return;
303
+ formatRef.current = format;
304
+ const nextValue = (0, import_utils.convertColor)(value, fallbackValue)(format);
305
+ if (nextValue)
306
+ setValue(nextValue);
307
+ }, [format, fallbackValue]);
308
+ const getContainerProps = (props2 = {}, ref = null) => ({
309
+ ...props2,
310
+ ref,
311
+ ...(0, import_utils.omitObject)(rest, ["aria-readonly"])
312
+ });
313
+ const getInputProps = (0, import_react.useCallback)(
314
+ (props2 = {}, ref = null) => ({
315
+ ...pickObject(rest, import_form_control.formControlProperties),
316
+ ...props2,
317
+ id,
318
+ ref,
319
+ type: "hidden",
320
+ name,
321
+ value,
322
+ required,
323
+ disabled,
324
+ readOnly
325
+ }),
326
+ [disabled, id, name, readOnly, required, rest, value]
327
+ );
328
+ const getSaturationSliderProps = (0, import_react.useCallback)(
329
+ (props2 = {}, ref = null) => ({
330
+ required,
331
+ disabled,
332
+ readOnly,
333
+ isInvalid,
334
+ ...props2,
335
+ ref,
336
+ value: [h, s, v],
337
+ onChange: (0, import_utils.handlerAll)(props2.onChange, ([, s2, v2]) => onChange({ s: s2, v: v2 })),
338
+ onChangeStart: (0, import_utils.handlerAll)(
339
+ props2.onChangeStart,
340
+ ([, s2, v2]) => onChangeStart({ s: s2, v: v2 })
341
+ ),
342
+ onChangeEnd: (0, import_utils.handlerAll)(
343
+ props2.onChangeEnd,
344
+ ([, s2, v2]) => onChangeEnd({ s: s2, v: v2 })
345
+ )
346
+ }),
347
+ [
348
+ required,
349
+ disabled,
350
+ readOnly,
351
+ isInvalid,
352
+ h,
353
+ s,
354
+ v,
355
+ onChange,
356
+ onChangeStart,
357
+ onChangeEnd
358
+ ]
359
+ );
360
+ const getHueSliderProps = (0, import_react.useCallback)(
361
+ (props2 = {}, ref = null) => ({
362
+ required,
363
+ disabled,
364
+ readOnly,
365
+ isInvalid,
366
+ ...props2,
367
+ ref,
368
+ value: h,
369
+ onChange: (0, import_utils.handlerAll)(props2.onChange, (h2) => onChange({ h: h2 })),
370
+ onChangeStart: (0, import_utils.handlerAll)(
371
+ props2.onChangeStart,
372
+ (h2) => onChangeStart({ h: h2 })
373
+ ),
374
+ onChangeEnd: (0, import_utils.handlerAll)(props2.onChangeEnd, (h2) => onChangeEnd({ h: h2 }))
375
+ }),
376
+ [
377
+ required,
378
+ disabled,
379
+ readOnly,
380
+ isInvalid,
381
+ h,
382
+ onChange,
383
+ onChangeStart,
384
+ onChangeEnd
385
+ ]
386
+ );
387
+ const getAlphaSliderProps = (0, import_react.useCallback)(
388
+ (props2 = {}, ref = null) => ({
389
+ required,
390
+ disabled,
391
+ readOnly,
392
+ isInvalid,
393
+ ...props2,
394
+ ref,
395
+ value: a,
396
+ color: (0, import_utils.hsvTo)([h, s, v, a], fallbackValue)(formatRef.current),
397
+ onChange: (0, import_utils.handlerAll)(props2.onChange, (a2) => onChange({ a: a2 })),
398
+ onChangeStart: (0, import_utils.handlerAll)(
399
+ props2.onChangeStart,
400
+ (a2) => onChangeStart({ a: a2 })
401
+ ),
402
+ onChangeEnd: (0, import_utils.handlerAll)(props2.onChangeEnd, (a2) => onChangeEnd({ a: a2 }))
403
+ }),
404
+ [
405
+ fallbackValue,
406
+ required,
407
+ disabled,
408
+ readOnly,
409
+ isInvalid,
410
+ formatRef,
411
+ h,
412
+ s,
413
+ v,
414
+ a,
415
+ onChange,
416
+ onChangeStart,
417
+ onChangeEnd
418
+ ]
419
+ );
420
+ const getChannelProps = (0, import_react.useCallback)(
421
+ ({ space, ...props2 }, ref = null) => {
422
+ return {
423
+ required,
424
+ disabled,
425
+ readOnly,
426
+ isInvalid,
427
+ ...props2,
428
+ ref,
429
+ type: "number",
430
+ step: 1,
431
+ onChange: (0, import_utils.handlerAll)(
432
+ props2.onChange,
433
+ (ev) => onChannelChange(ev, space)
434
+ )
435
+ };
436
+ },
437
+ [required, disabled, readOnly, isInvalid, onChannelChange]
438
+ );
439
+ const getEyeDropperProps = (0, import_react.useCallback)(
440
+ (props2 = {}, ref = null) => ({
441
+ disabled,
442
+ "aria-label": "Pick a color",
443
+ ...props2,
444
+ ref,
445
+ onClick: (0, import_utils.handlerAll)(props2.onClick, onEyeDropperClick)
446
+ }),
447
+ [disabled, onEyeDropperClick]
448
+ );
449
+ const getSwatchProps = (0, import_react.useCallback)(
450
+ ({ color, ...props2 } = {}, ref = null) => ({
451
+ "aria-label": `select ${color} as the color`,
452
+ disabled,
453
+ readOnly,
454
+ ...props2,
455
+ ref,
456
+ color,
457
+ onClick: (0, import_utils.handlerAll)(props2.onClick, () => {
458
+ if (!color)
459
+ return;
460
+ onSwatchClick == null ? void 0 : onSwatchClick(color);
461
+ onChange(color);
462
+ onChangeEnd(color);
463
+ })
464
+ }),
465
+ [disabled, readOnly, onSwatchClick, onChange, onChangeEnd]
466
+ );
467
+ return {
468
+ value,
469
+ onChange,
470
+ eyeDropperSupported,
471
+ withAlpha,
472
+ isInteractive,
473
+ disabled,
474
+ readOnly,
475
+ channels,
476
+ getContainerProps,
477
+ getInputProps,
478
+ getSaturationSliderProps,
479
+ getHueSliderProps,
480
+ getAlphaSliderProps,
481
+ getEyeDropperProps,
482
+ getChannelProps,
483
+ getSwatchProps
484
+ };
485
+ };
486
+
487
+ // src/color-picker-eye-dropper.tsx
488
+ var import_jsx_runtime = require("react/jsx-runtime");
489
+ var ColorPickerEyeDropper = (0, import_core.forwardRef)(({ className, ...rest }, ref) => {
490
+ const { getEyeDropperProps, readOnly, size, styles } = useColorPickerContext();
491
+ const css = {
492
+ h: "auto",
493
+ minW: "auto",
494
+ pointerEvents: readOnly ? "none" : void 0,
495
+ ...styles.eyeDropper
496
+ };
497
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
498
+ import_button.IconButton,
499
+ {
500
+ className: (0, import_utils2.cx)("ui-color-picker__eye-dropper", className),
501
+ variant: "outline",
502
+ size,
503
+ __css: css,
504
+ ...getEyeDropperProps(rest, ref),
505
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EyeDropperIcon, { className: "ui-color-picker__eye-dropper__icon" })
506
+ }
507
+ );
508
+ });
509
+ var EyeDropperIcon = ({ ...rest }) => {
510
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
511
+ import_icon.Icon,
512
+ {
513
+ viewBox: "0 0 24 24",
514
+ fill: "none",
515
+ stroke: "currentColor",
516
+ strokeWidth: "2",
517
+ strokeLinecap: "round",
518
+ strokeLinejoin: "round",
519
+ ...rest,
520
+ children: [
521
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m2 22 1-1h3l9-9" }),
522
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M3 21v-3l9-9" }),
523
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m15 6 3.4-3.4a2.1 2.1 0 1 1 3 3L18 9l.4.4a2.1 2.1 0 1 1-3 3l-3.8-3.8a2.1 2.1 0 1 1 3-3l.4.4Z" })
524
+ ]
525
+ }
526
+ );
527
+ };
528
+
529
+ // src/color-picker-sliders.tsx
530
+ var import_core4 = require("@yamada-ui/core");
531
+ var import_utils6 = require("@yamada-ui/utils");
532
+
533
+ // src/alpha-slider.tsx
534
+ var import_core2 = require("@yamada-ui/core");
535
+ var import_utils4 = require("@yamada-ui/utils");
536
+
537
+ // src/use-color-slider.ts
538
+ var import_form_control2 = require("@yamada-ui/form-control");
539
+ var import_use_controllable_state2 = require("@yamada-ui/use-controllable-state");
540
+ var import_use_latest_ref = require("@yamada-ui/use-latest-ref");
541
+ var import_use_pan_event = require("@yamada-ui/use-pan-event");
542
+ var import_use_size = require("@yamada-ui/use-size");
543
+ var import_utils3 = require("@yamada-ui/utils");
544
+ var import_react2 = require("react");
545
+ var useColorSlider = ({
546
+ focusThumbOnChange = true,
547
+ ...props
548
+ }) => {
549
+ if (!focusThumbOnChange)
550
+ props.isReadOnly = true;
551
+ let {
552
+ id,
553
+ name,
554
+ value: valueProp,
555
+ defaultValue,
556
+ min = 0,
557
+ max,
558
+ step = 1,
559
+ onChange: onChangeProp,
560
+ onChangeStart: onChangeStartProp,
561
+ onChangeEnd: onChangeEndProp,
562
+ thumbColor,
563
+ required,
564
+ disabled,
565
+ readOnly,
566
+ ...rest
567
+ } = (0, import_form_control2.useFormControlProps)(props);
568
+ const onChangeStart = (0, import_utils3.useCallbackRef)(onChangeStartProp);
569
+ const onChangeEnd = (0, import_utils3.useCallbackRef)(onChangeEndProp);
570
+ const [computedValue, setValue] = (0, import_use_controllable_state2.useControllableState)({
571
+ value: valueProp,
572
+ defaultValue: defaultValue != null ? defaultValue : min + (max - min) / 2,
573
+ onChange: onChangeProp
574
+ });
575
+ const value = (0, import_utils3.clampNumber)(computedValue, min, max);
576
+ const thumbPercent = (0, import_utils3.valueToPercent)(value, min, max);
577
+ const [isDragging, setDragging] = (0, import_react2.useState)(false);
578
+ const isInteractive = !(disabled || readOnly);
579
+ const oneStep = step || (max - min) / 100;
580
+ const tenStep = (max - min) / 10;
581
+ const containerRef = (0, import_react2.useRef)(null);
582
+ const trackRef = (0, import_react2.useRef)(null);
583
+ const thumbRef = (0, import_react2.useRef)(null);
584
+ const latestRef = (0, import_use_latest_ref.useLatestRef)({
585
+ value,
586
+ min,
587
+ max,
588
+ step,
589
+ isInteractive,
590
+ eventSource: null,
591
+ focusThumbOnChange
592
+ });
593
+ const thumbSize = (0, import_use_size.useSize)(thumbRef);
594
+ const getValueFromPointer = (0, import_react2.useCallback)(
595
+ (ev) => {
596
+ var _a, _b;
597
+ if (!trackRef.current)
598
+ return;
599
+ const { min: min2, max: max2, step: step2 } = latestRef.current;
600
+ latestRef.current.eventSource = "pointer";
601
+ const { left, width } = trackRef.current.getBoundingClientRect();
602
+ const { clientX } = (_b = (_a = ev.touches) == null ? void 0 : _a[0]) != null ? _b : ev;
603
+ let percent = (clientX - left) / width;
604
+ let nextValue = (0, import_utils3.percentToValue)(percent, min2, max2);
605
+ if (step2)
606
+ nextValue = parseFloat((0, import_utils3.roundNumberToStep)(nextValue, min2, step2));
607
+ nextValue = (0, import_utils3.clampNumber)(nextValue, min2, max2);
608
+ return nextValue;
609
+ },
610
+ [latestRef]
611
+ );
612
+ const setValueFromPointer = (ev) => {
613
+ const { value: value2 } = latestRef.current;
614
+ const nextValue = getValueFromPointer(ev);
615
+ if (nextValue != null && nextValue !== value2)
616
+ setValue(nextValue);
617
+ };
618
+ const focusThumb = (0, import_react2.useCallback)(() => {
619
+ const { focusThumbOnChange: focusThumbOnChange2 } = latestRef.current;
620
+ if (focusThumbOnChange2)
621
+ setTimeout(() => {
622
+ var _a;
623
+ return (_a = thumbRef.current) == null ? void 0 : _a.focus();
624
+ });
625
+ }, [latestRef]);
626
+ const constrain = (0, import_react2.useCallback)(
627
+ (value2) => {
628
+ const { isInteractive: isInteractive2, min: min2, max: max2 } = latestRef.current;
629
+ if (!isInteractive2)
630
+ return;
631
+ value2 = parseFloat((0, import_utils3.roundNumberToStep)(value2, min2, oneStep));
632
+ value2 = (0, import_utils3.clampNumber)(value2, min2, max2);
633
+ setValue(value2);
634
+ },
635
+ [setValue, latestRef, oneStep]
636
+ );
637
+ const stepUp = (0, import_react2.useCallback)(
638
+ (step2 = oneStep) => constrain(value + step2),
639
+ [constrain, value, oneStep]
640
+ );
641
+ const stepDown = (0, import_react2.useCallback)(
642
+ (step2 = oneStep) => constrain(value - step2),
643
+ [constrain, value, oneStep]
644
+ );
645
+ const onKeyDown = (0, import_react2.useCallback)(
646
+ (ev) => {
647
+ const { min: min2, max: max2 } = latestRef.current;
648
+ const actions = {
649
+ ArrowRight: () => stepUp(),
650
+ ArrowUp: () => stepUp(),
651
+ ArrowLeft: () => stepDown(),
652
+ ArrowDown: () => stepDown(),
653
+ PageUp: () => stepUp(tenStep),
654
+ PageDown: () => stepDown(tenStep),
655
+ Home: () => constrain(min2),
656
+ End: () => constrain(max2)
657
+ };
658
+ const action = actions[ev.key];
659
+ if (!action)
660
+ return;
661
+ ev.preventDefault();
662
+ ev.stopPropagation();
663
+ action(ev);
664
+ latestRef.current.eventSource = "keyboard";
665
+ },
666
+ [constrain, latestRef, stepDown, stepUp, tenStep]
667
+ );
668
+ (0, import_use_pan_event.usePanEvent)(containerRef, {
669
+ onSessionStart: (ev) => {
670
+ const { isInteractive: isInteractive2, value: value2 } = latestRef.current;
671
+ if (!isInteractive2)
672
+ return;
673
+ setDragging(true);
674
+ focusThumb();
675
+ setValueFromPointer(ev);
676
+ onChangeStart(value2);
677
+ },
678
+ onSessionEnd: () => {
679
+ const { isInteractive: isInteractive2, value: value2 } = latestRef.current;
680
+ if (!isInteractive2)
681
+ return;
682
+ setDragging(false);
683
+ onChangeEnd(value2);
684
+ },
685
+ onMove: (ev) => {
686
+ const { isInteractive: isInteractive2 } = latestRef.current;
687
+ if (!isInteractive2)
688
+ return;
689
+ setValueFromPointer(ev);
690
+ }
691
+ });
692
+ (0, import_utils3.useUpdateEffect)(() => {
693
+ const { eventSource, value: value2 } = latestRef.current;
694
+ if (eventSource === "keyboard")
695
+ onChangeEnd(value2);
696
+ }, [value, onChangeEnd]);
697
+ const getContainerProps = (0, import_react2.useCallback)(
698
+ (props2 = {}, ref = null) => {
699
+ const { width: w } = thumbSize != null ? thumbSize : { width: 0 };
700
+ const style = {
701
+ ...props2.style,
702
+ ...rest.style,
703
+ paddingInline: `${w / 2}px`
704
+ };
705
+ return {
706
+ ...props2,
707
+ ...(0, import_utils3.omitObject)(rest, ["aria-readonly"]),
708
+ ref: (0, import_utils3.mergeRefs)(ref, containerRef),
709
+ tabIndex: -1,
710
+ style
711
+ };
712
+ },
713
+ [rest, thumbSize]
714
+ );
715
+ const getInputProps = (0, import_react2.useCallback)(
716
+ (props2 = {}, ref = null) => ({
717
+ ...pickObject(rest, import_form_control2.formControlProperties),
718
+ ...props2,
719
+ id,
720
+ ref,
721
+ type: "hidden",
722
+ name,
723
+ value,
724
+ required,
725
+ disabled,
726
+ readOnly
727
+ }),
728
+ [disabled, id, name, readOnly, required, rest, value]
729
+ );
730
+ const getTrackProps = (0, import_react2.useCallback)(
731
+ (props2 = {}, ref = null) => ({
732
+ ...pickObject(
733
+ rest,
734
+ (0, import_form_control2.getFormControlProperties)({ omit: ["aria-readonly"] })
735
+ ),
736
+ ...props2,
737
+ ref: (0, import_utils3.mergeRefs)(ref, trackRef)
738
+ }),
739
+ [rest]
740
+ );
741
+ const getThumbProps = (0, import_react2.useCallback)(
742
+ (props2 = {}, ref = null) => {
743
+ const n = thumbPercent;
744
+ const { width: w } = thumbSize != null ? thumbSize : { width: 0 };
745
+ const style = {
746
+ ...props2.style,
747
+ position: "absolute",
748
+ userSelect: "none",
749
+ touchAction: "none",
750
+ left: `calc(${n}% - ${w / 2}px)`
751
+ };
752
+ return {
753
+ "aria-label": "Slider thumb",
754
+ bg: thumbColor != null ? thumbColor : `hsl(${value}, 100%, 50%)`,
755
+ ...pickObject(rest, import_form_control2.formControlProperties),
756
+ ...props2,
757
+ ref: (0, import_utils3.mergeRefs)(ref, thumbRef),
758
+ tabIndex: isInteractive && focusThumbOnChange ? 0 : void 0,
759
+ role: "slider",
760
+ "aria-valuenow": value,
761
+ "aria-valuemin": min,
762
+ "aria-valuemax": max,
763
+ "data-active": (0, import_utils3.dataAttr)(isDragging && focusThumbOnChange),
764
+ onKeyDown: (0, import_utils3.handlerAll)(props2.onKeyDown, onKeyDown),
765
+ onFocus: (0, import_utils3.handlerAll)(props2.onFocus, rest.onFocus),
766
+ onBlur: (0, import_utils3.handlerAll)(props2.onBlur, rest.onBlur),
767
+ style
768
+ };
769
+ },
770
+ [
771
+ thumbColor,
772
+ focusThumbOnChange,
773
+ isDragging,
774
+ isInteractive,
775
+ min,
776
+ max,
777
+ onKeyDown,
778
+ rest,
779
+ thumbPercent,
780
+ thumbSize,
781
+ value
782
+ ]
783
+ );
784
+ return {
785
+ value,
786
+ getContainerProps,
787
+ getTrackProps,
788
+ getInputProps,
789
+ getThumbProps
790
+ };
791
+ };
792
+
793
+ // src/alpha-slider.tsx
794
+ var import_jsx_runtime2 = require("react/jsx-runtime");
795
+ var defaultOverlays = (color, min, max, withShadow) => {
796
+ let overlays = [
797
+ {
798
+ bgImage: "linear-gradient(45deg, var(--ui-checkers) 25%, transparent 25%), linear-gradient(-45deg, var(--ui-checkers) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--ui-checkers) 75%), linear-gradient(-45deg, var(--ui-body) 75%, var(--ui-checkers) 75%)",
799
+ bgSize: `8px 8px`,
800
+ bgPosition: `0 0, 0 4px, 4px -4px, -4px 0`,
801
+ var: [
802
+ {
803
+ name: "checkers",
804
+ token: "colors",
805
+ value: ["blackAlpha.300", "whiteAlpha.300"]
806
+ },
807
+ {
808
+ name: "body",
809
+ token: "colors",
810
+ value: ["whiteAlpha.500", "blackAlpha.500"]
811
+ }
812
+ ]
813
+ },
814
+ {
815
+ bgGradient: `linear(to-r, ${(0, import_utils4.convertColor)(color)("hex") + (0, import_utils4.alphaToHex)(min)}, ${(0, import_utils4.convertColor)(color)("hex") + (0, import_utils4.alphaToHex)(max)})`
816
+ }
817
+ ];
818
+ if (withShadow)
819
+ overlays = [
820
+ ...overlays,
821
+ {
822
+ boxShadow: `rgba(0, 0, 0, .1) 0 0 0 1px inset, rgb(0, 0, 0, .15) 0 0 4px inset`
823
+ }
824
+ ];
825
+ return overlays;
826
+ };
827
+ var AlphaSlider = (0, import_core2.forwardRef)(
828
+ (props, ref) => {
829
+ const [styles, mergedProps] = (0, import_core2.useMultiComponentStyle)("AlphaSlider", props);
830
+ const {
831
+ className,
832
+ inputProps,
833
+ trackProps,
834
+ thumbProps,
835
+ color = "#ffffff",
836
+ min = 0,
837
+ max = 1,
838
+ withShadow = true,
839
+ overlays = defaultOverlays(color, min, max, withShadow),
840
+ __css,
841
+ ...computedProps
842
+ } = (0, import_core2.omitThemeProps)(mergedProps);
843
+ const { getContainerProps, getTrackProps, getInputProps, getThumbProps } = useColorSlider({
844
+ min,
845
+ max,
846
+ step: 0.01,
847
+ thumbColor: "transparent",
848
+ ...computedProps
849
+ });
850
+ const css = {
851
+ position: "relative",
852
+ ...styles.container,
853
+ ...__css
854
+ };
855
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
856
+ import_core2.ui.div,
857
+ {
858
+ className: (0, import_utils4.cx)("ui-alpha-slider", className),
859
+ __css: css,
860
+ ...getContainerProps(),
861
+ children: [
862
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core2.ui.input, { ...getInputProps(inputProps, ref) }),
863
+ overlays.map((props2, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
864
+ import_core2.ui.div,
865
+ {
866
+ className: "ui-alpha-slider__overlay",
867
+ __css: {
868
+ position: "absolute",
869
+ top: 0,
870
+ left: 0,
871
+ right: 0,
872
+ bottom: 0,
873
+ ...styles.overlay
874
+ },
875
+ ...props2
876
+ },
877
+ index
878
+ )),
879
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
880
+ import_core2.ui.div,
881
+ {
882
+ className: "ui-alpha-slider__track",
883
+ __css: {
884
+ position: "relative",
885
+ w: "full",
886
+ h: "full",
887
+ ...styles.track
888
+ },
889
+ ...getTrackProps(trackProps),
890
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
891
+ import_core2.ui.div,
892
+ {
893
+ className: "ui-alpha-slider__thumb",
894
+ __css: { ...styles.thumb },
895
+ ...getThumbProps(thumbProps)
896
+ }
897
+ )
898
+ }
899
+ )
900
+ ]
901
+ }
902
+ );
903
+ }
904
+ );
905
+
906
+ // src/hue-slider.tsx
907
+ var import_core3 = require("@yamada-ui/core");
908
+ var import_utils5 = require("@yamada-ui/utils");
909
+ var import_jsx_runtime3 = require("react/jsx-runtime");
910
+ var defaultOverlays2 = (min, max, withShadow) => {
911
+ let overlays = [
912
+ {
913
+ bgGradient: `linear(to-r, ${[...Array(7)].map(
914
+ (_, index) => `hsl(${Math.round(min + (max - min) / 6 * index)}, 100%, 50%)`
915
+ ).join(", ")})`
916
+ }
917
+ ];
918
+ if (withShadow)
919
+ overlays = [
920
+ ...overlays,
921
+ {
922
+ boxShadow: `rgba(0, 0, 0, .1) 0 0 0 1px inset, rgb(0, 0, 0, .15) 0 0 4px inset`
923
+ }
924
+ ];
925
+ return overlays;
926
+ };
927
+ var HueSlider = (0, import_core3.forwardRef)((props, ref) => {
928
+ const [styles, mergedProps] = (0, import_core3.useMultiComponentStyle)("HueSlider", props);
929
+ const {
930
+ className,
931
+ inputProps,
932
+ trackProps,
933
+ thumbProps,
934
+ min = 0,
935
+ max = 360,
936
+ withShadow = true,
937
+ overlays = defaultOverlays2(min, max, withShadow),
938
+ __css,
939
+ ...computedProps
940
+ } = (0, import_core3.omitThemeProps)(mergedProps);
941
+ const { getContainerProps, getTrackProps, getInputProps, getThumbProps } = useColorSlider({ min, max, step: 1, ...computedProps });
942
+ const css = {
943
+ position: "relative",
944
+ ...styles.container,
945
+ ...__css
946
+ };
947
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
948
+ import_core3.ui.div,
949
+ {
950
+ className: (0, import_utils5.cx)("ui-hue-slider", className),
951
+ __css: css,
952
+ ...getContainerProps(),
953
+ children: [
954
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core3.ui.input, { ...getInputProps(inputProps, ref) }),
955
+ overlays.map((props2, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
956
+ import_core3.ui.div,
957
+ {
958
+ className: "ui-hue-slider__overlay",
959
+ __css: {
960
+ position: "absolute",
961
+ top: 0,
962
+ left: 0,
963
+ right: 0,
964
+ bottom: 0,
965
+ ...styles.overlay
966
+ },
967
+ ...props2
968
+ },
969
+ index
970
+ )),
971
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
972
+ import_core3.ui.div,
973
+ {
974
+ className: "ui-hue-slider__track",
975
+ __css: { position: "relative", w: "full", h: "full", ...styles.track },
976
+ ...getTrackProps(trackProps),
977
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
978
+ import_core3.ui.div,
979
+ {
980
+ className: "ui-hue-slider__thumb",
981
+ __css: { ...styles.thumb },
982
+ ...getThumbProps(thumbProps)
983
+ }
984
+ )
985
+ }
986
+ )
987
+ ]
988
+ }
989
+ );
990
+ });
991
+
992
+ // src/color-picker-sliders.tsx
993
+ var import_jsx_runtime4 = require("react/jsx-runtime");
994
+ var ColorPickerSliders = (0, import_core4.forwardRef)(
995
+ ({
996
+ className,
997
+ hueSliderRef,
998
+ hueSliderProps,
999
+ alphaSliderRef,
1000
+ alphaSliderProps,
1001
+ ...rest
1002
+ }, ref) => {
1003
+ let { size, withAlpha, getHueSliderProps, getAlphaSliderProps, styles } = useColorPickerContext();
1004
+ if (size === "full")
1005
+ size = "lg";
1006
+ const css = {
1007
+ display: "flex",
1008
+ flexDirection: "column",
1009
+ ...styles.sliders
1010
+ };
1011
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1012
+ import_core4.ui.div,
1013
+ {
1014
+ ref,
1015
+ className: (0, import_utils6.cx)("ui-color-picker__sliders", className),
1016
+ __css: css,
1017
+ ...rest,
1018
+ children: [
1019
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1020
+ HueSlider,
1021
+ {
1022
+ size,
1023
+ className: "ui-color-picker__hue-slider",
1024
+ __css: { ...styles.hueSlider },
1025
+ ...getHueSliderProps(hueSliderProps, hueSliderRef)
1026
+ }
1027
+ ),
1028
+ withAlpha ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1029
+ AlphaSlider,
1030
+ {
1031
+ size,
1032
+ className: "ui-color-picker__alpha-slider",
1033
+ __css: { ...styles.alphaSlider },
1034
+ ...getAlphaSliderProps(alphaSliderProps, alphaSliderRef)
1035
+ }
1036
+ ) : null
1037
+ ]
1038
+ }
1039
+ );
1040
+ }
1041
+ );
1042
+
1043
+ // src/color-swatch.tsx
1044
+ var import_core5 = require("@yamada-ui/core");
1045
+ var import_utils7 = require("@yamada-ui/utils");
1046
+ var import_jsx_runtime5 = require("react/jsx-runtime");
1047
+ var defaultOverlays3 = (background, withShadow) => {
1048
+ let overlays = [
1049
+ {
1050
+ bgImage: "linear-gradient(45deg, var(--ui-checkers) 25%, transparent 25%), linear-gradient(-45deg, var(--ui-checkers) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--ui-checkers) 75%), linear-gradient(-45deg, var(--ui-body) 75%, var(--ui-checkers) 75%)",
1051
+ bgSize: `8px 8px`,
1052
+ bgPosition: `0 0, 0 4px, 4px -4px, -4px 0`,
1053
+ var: [
1054
+ {
1055
+ name: "checkers",
1056
+ token: "colors",
1057
+ value: ["blackAlpha.300", "whiteAlpha.300"]
1058
+ },
1059
+ {
1060
+ name: "body",
1061
+ token: "colors",
1062
+ value: ["whiteAlpha.500", "blackAlpha.500"]
1063
+ }
1064
+ ]
1065
+ },
1066
+ { background }
1067
+ ];
1068
+ if (withShadow)
1069
+ overlays = [
1070
+ ...overlays,
1071
+ {
1072
+ boxShadow: `rgba(0, 0, 0, .1) 0 0 0 1px inset, rgb(0, 0, 0, .15) 0 0 4px inset`
1073
+ }
1074
+ ];
1075
+ return overlays;
1076
+ };
1077
+ var ColorSwatch = (0, import_core5.forwardRef)((props, ref) => {
1078
+ const [styles, mergedProps] = (0, import_core5.useMultiComponentStyle)("ColorSwatch", props);
1079
+ const {
1080
+ className,
1081
+ color = "#ffffff00",
1082
+ withShadow = true,
1083
+ overlays = defaultOverlays3(color, withShadow),
1084
+ isRounded,
1085
+ __css,
1086
+ ...rest
1087
+ } = (0, import_core5.omitThemeProps)(mergedProps);
1088
+ const css = {
1089
+ position: "relative",
1090
+ _before: {
1091
+ content: `""`,
1092
+ display: "block",
1093
+ h: 0,
1094
+ pb: "100%"
1095
+ },
1096
+ "& > *": {
1097
+ overflow: "hidden",
1098
+ position: "absolute",
1099
+ top: "0",
1100
+ right: "0",
1101
+ bottom: "0",
1102
+ left: "0",
1103
+ display: "flex",
1104
+ justifyContent: "center",
1105
+ alignItems: "center",
1106
+ w: "100%",
1107
+ h: "100%"
1108
+ },
1109
+ ...styles.container,
1110
+ ...__css
1111
+ };
1112
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1113
+ import_core5.ui.div,
1114
+ {
1115
+ ref,
1116
+ className: (0, import_utils7.cx)("ui-color-swatch", className),
1117
+ ...isRounded ? { rounded: "full" } : {},
1118
+ __css: css,
1119
+ ...rest,
1120
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_core5.ui.div, { ...isRounded ? { rounded: "full" } : {}, children: overlays.map((props2, index) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1121
+ import_core5.ui.div,
1122
+ {
1123
+ __css: {
1124
+ position: "absolute",
1125
+ top: 0,
1126
+ left: 0,
1127
+ right: 0,
1128
+ bottom: 0,
1129
+ ...styles.overlay
1130
+ },
1131
+ ...isRounded ? { rounded: "full" } : {},
1132
+ ...props2
1133
+ },
1134
+ index
1135
+ )) })
1136
+ }
1137
+ );
1138
+ });
1139
+
1140
+ // src/color-picker-body.tsx
1141
+ var import_jsx_runtime6 = require("react/jsx-runtime");
1142
+ var ColorPickerBody = (0, import_core6.forwardRef)(
1143
+ ({
1144
+ className,
1145
+ withEyeDropper = true,
1146
+ withResult,
1147
+ eyeDropperRef,
1148
+ eyeDropperProps,
1149
+ hueSliderRef,
1150
+ hueSliderProps,
1151
+ alphaSliderRef,
1152
+ alphaSliderProps,
1153
+ ...rest
1154
+ }, ref) => {
1155
+ const { value, eyeDropperSupported, styles } = useColorPickerContext();
1156
+ const css = {
1157
+ display: "flex",
1158
+ w: "full",
1159
+ ...styles.body
1160
+ };
1161
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1162
+ import_core6.ui.div,
1163
+ {
1164
+ ref,
1165
+ className: (0, import_utils8.cx)("ui-color-picker__body", className),
1166
+ __css: css,
1167
+ ...rest,
1168
+ children: [
1169
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1170
+ ColorPickerSliders,
1171
+ {
1172
+ ...{
1173
+ hueSliderRef,
1174
+ hueSliderProps,
1175
+ alphaSliderRef,
1176
+ alphaSliderProps
1177
+ }
1178
+ }
1179
+ ),
1180
+ withEyeDropper && eyeDropperSupported ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ColorPickerEyeDropper, { ref: eyeDropperRef, ...eyeDropperProps }) : null,
1181
+ withResult ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1182
+ ColorSwatch,
1183
+ {
1184
+ className: "ui-color-picker__result",
1185
+ color: value,
1186
+ __css: { ...styles.result }
1187
+ }
1188
+ ) : null
1189
+ ]
1190
+ }
1191
+ );
1192
+ }
1193
+ );
1194
+
1195
+ // src/color-picker-channels.tsx
1196
+ var import_core7 = require("@yamada-ui/core");
1197
+ var import_input = require("@yamada-ui/input");
1198
+ var import_utils9 = require("@yamada-ui/utils");
1199
+ var import_react3 = require("react");
1200
+ var import_jsx_runtime7 = require("react/jsx-runtime");
1201
+ var ColorPickerChannels = (0, import_core7.forwardRef)(
1202
+ ({ className, channelProps, ...rest }, ref) => {
1203
+ const { withAlpha, channels, getChannelProps, styles } = useColorPickerContext();
1204
+ const css = {
1205
+ display: "grid",
1206
+ gridTemplateColumns: `repeat(${withAlpha ? "4" : "3"}, 1fr)`,
1207
+ ...styles.channels
1208
+ };
1209
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1210
+ import_core7.ui.div,
1211
+ {
1212
+ ref,
1213
+ className: (0, import_utils9.cx)("ui-color-picker__channels", className),
1214
+ __css: css,
1215
+ ...rest,
1216
+ children: channels.map(({ label, space, value, min, max }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1217
+ ColorPickerChannel,
1218
+ {
1219
+ channelLabel: label,
1220
+ ...getChannelProps({ ...channelProps, space, value, min, max })
1221
+ },
1222
+ label
1223
+ ))
1224
+ }
1225
+ );
1226
+ }
1227
+ );
1228
+ var ColorPickerChannel = (0, import_core7.forwardRef)(
1229
+ ({ className, channelLabel, ...rest }, ref) => {
1230
+ const id = (0, import_react3.useId)();
1231
+ let { size, disabled, readOnly, styles } = useColorPickerContext();
1232
+ if (size === "full")
1233
+ size = "lg";
1234
+ const css = { ...styles.channel };
1235
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_core7.ui.div, { className: (0, import_utils9.cx)("ui-color-picker__channel", className), children: [
1236
+ channelLabel ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1237
+ import_core7.ui.label,
1238
+ {
1239
+ htmlFor: id,
1240
+ style: { cursor: disabled ? "not-allowed" : void 0 },
1241
+ __css: {
1242
+ display: "block",
1243
+ pointerEvents: readOnly ? "none" : void 0,
1244
+ ...styles.channelLabel
1245
+ },
1246
+ children: channelLabel
1247
+ }
1248
+ ) : null,
1249
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_input.Input, { ref, id, size, __css: css, ...rest })
1250
+ ] });
1251
+ }
1252
+ );
1253
+
1254
+ // src/color-picker-swatches.tsx
1255
+ var import_core8 = require("@yamada-ui/core");
1256
+ var import_utils10 = require("@yamada-ui/utils");
1257
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1258
+ var ColorPickerSwatches = (0, import_core8.forwardRef)(
1259
+ ({
1260
+ className,
1261
+ swatchesLabel,
1262
+ swatches,
1263
+ swatchesContainerProps,
1264
+ swatchProps,
1265
+ swatchesColumns,
1266
+ ...rest
1267
+ }, ref) => {
1268
+ const { getSwatchProps, readOnly, styles } = useColorPickerContext();
1269
+ const css = {
1270
+ display: "grid",
1271
+ gridTemplateColumns: (0, import_utils10.replaceObject)(
1272
+ swatchesColumns,
1273
+ (value) => value != null ? `repeat(${value}, minmax(0, 1fr))` : void 0
1274
+ ),
1275
+ ...styles.swatches
1276
+ };
1277
+ return (swatches == null ? void 0 : swatches.length) ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_core8.ui.div, { ...swatchesContainerProps, children: [
1278
+ swatchesLabel ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1279
+ import_core8.ui.p,
1280
+ {
1281
+ className: "ui-color-picker__swatches__label",
1282
+ __css: { ...styles.swatchesLabel },
1283
+ children: swatchesLabel
1284
+ }
1285
+ ) : null,
1286
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1287
+ import_core8.ui.div,
1288
+ {
1289
+ ref,
1290
+ className: (0, import_utils10.cx)("ui-color-picker__swatches", className),
1291
+ __css: css,
1292
+ ...rest,
1293
+ children: swatches.map((color) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1294
+ ColorSwatch,
1295
+ {
1296
+ as: "button",
1297
+ __css: {
1298
+ boxSize: "full",
1299
+ pointerEvents: readOnly ? "none" : void 0,
1300
+ ...styles.swatch
1301
+ },
1302
+ ...getSwatchProps({ color, ...swatchProps })
1303
+ },
1304
+ color
1305
+ ))
1306
+ }
1307
+ )
1308
+ ] }) : null;
1309
+ }
1310
+ );
1311
+
1312
+ // src/saturation-slider.tsx
1313
+ var import_core9 = require("@yamada-ui/core");
1314
+ var import_utils12 = require("@yamada-ui/utils");
1315
+
1316
+ // src/use-saturation-slider.ts
1317
+ var import_form_control3 = require("@yamada-ui/form-control");
1318
+ var import_use_controllable_state3 = require("@yamada-ui/use-controllable-state");
1319
+ var import_use_latest_ref2 = require("@yamada-ui/use-latest-ref");
1320
+ var import_use_pan_event2 = require("@yamada-ui/use-pan-event");
1321
+ var import_use_size2 = require("@yamada-ui/use-size");
1322
+ var import_utils11 = require("@yamada-ui/utils");
1323
+ var import_react4 = require("react");
1324
+ var defaultOverlays4 = (withShadow) => {
1325
+ let overlays = [
1326
+ ([h]) => ({
1327
+ bg: `hsl(${h}, 100%, 50%)`,
1328
+ bgImage: "linear-gradient(0deg, #000, transparent), linear-gradient(90deg, #fff, transparent)"
1329
+ })
1330
+ ];
1331
+ if (withShadow)
1332
+ overlays = [
1333
+ ...overlays,
1334
+ {
1335
+ boxShadow: `rgba(0, 0, 0, .1) 0 0 0 1px inset, rgb(0, 0, 0, .15) 0 0 4px inset`
1336
+ }
1337
+ ];
1338
+ return overlays;
1339
+ };
1340
+ var useSaturationSlider = ({
1341
+ focusThumbOnChange = true,
1342
+ ...props
1343
+ }) => {
1344
+ if (!focusThumbOnChange)
1345
+ props.isReadOnly = true;
1346
+ let {
1347
+ id,
1348
+ name,
1349
+ value: valueProp,
1350
+ defaultValue = [0, 0, 1],
1351
+ onChange: onChangeProp,
1352
+ onChangeStart: onChangeStartProp,
1353
+ onChangeEnd: onChangeEndProp,
1354
+ step = 0.01,
1355
+ thumbColor,
1356
+ required,
1357
+ disabled,
1358
+ readOnly,
1359
+ withShadow = true,
1360
+ overlays: overlaysProp = defaultOverlays4(withShadow),
1361
+ ...rest
1362
+ } = (0, import_form_control3.useFormControlProps)(props);
1363
+ const onChangeStart = (0, import_utils11.useCallbackRef)(onChangeStartProp);
1364
+ const onChangeEnd = (0, import_utils11.useCallbackRef)(onChangeEndProp);
1365
+ const [value, setValue] = (0, import_use_controllable_state3.useControllableState)({
1366
+ value: valueProp,
1367
+ defaultValue,
1368
+ onChange: onChangeProp
1369
+ });
1370
+ const [isDragging, setDragging] = (0, import_react4.useState)(false);
1371
+ const isInteractive = !(disabled || readOnly);
1372
+ let [h, s, v] = value;
1373
+ s = (0, import_utils11.clampNumber)(s, 0, 1);
1374
+ v = (0, import_utils11.clampNumber)(v, 0, 1);
1375
+ const containerRef = (0, import_react4.useRef)(null);
1376
+ const trackRef = (0, import_react4.useRef)(null);
1377
+ const thumbRef = (0, import_react4.useRef)(null);
1378
+ const latestRef = (0, import_use_latest_ref2.useLatestRef)({
1379
+ value,
1380
+ step,
1381
+ isInteractive,
1382
+ eventSource: null,
1383
+ focusThumbOnChange
1384
+ });
1385
+ const thumbSize = (0, import_use_size2.useSize)(thumbRef);
1386
+ const overlays = (0, import_react4.useMemo)(
1387
+ () => overlaysProp.map((propsOrFunc) => (0, import_utils11.runIfFunc)(propsOrFunc, [h, s, v])),
1388
+ [overlaysProp, h, s, v]
1389
+ );
1390
+ const getValueFromPointer = (0, import_react4.useCallback)(
1391
+ (ev) => {
1392
+ var _a, _b;
1393
+ if (!trackRef.current)
1394
+ return [];
1395
+ const { step: step2 } = latestRef.current;
1396
+ latestRef.current.eventSource = "pointer";
1397
+ const { bottom, left, height, width } = trackRef.current.getBoundingClientRect();
1398
+ const { clientX, clientY } = (_b = (_a = ev.touches) == null ? void 0 : _a[0]) != null ? _b : ev;
1399
+ let s2 = (0, import_utils11.clampNumber)((clientX - left) / width, 0, 1);
1400
+ let v2 = (0, import_utils11.clampNumber)((bottom - clientY) / height, 0, 1);
1401
+ if (step2) {
1402
+ s2 = parseFloat((0, import_utils11.roundNumberToStep)(s2, 0, step2));
1403
+ v2 = parseFloat((0, import_utils11.roundNumberToStep)(v2, 0, step2));
1404
+ }
1405
+ return [s2, v2];
1406
+ },
1407
+ [latestRef]
1408
+ );
1409
+ const setValueFromPointer = (ev) => {
1410
+ const { value: value2 } = latestRef.current;
1411
+ const [nextS, nextV] = getValueFromPointer(ev);
1412
+ if (nextS == null || nextV == null)
1413
+ return;
1414
+ const [, s2, v2] = value2;
1415
+ if (nextS !== s2 || nextV !== v2)
1416
+ setValue(([h2]) => [h2, nextS, nextV]);
1417
+ };
1418
+ const focusThumb = (0, import_react4.useCallback)(() => {
1419
+ const { focusThumbOnChange: focusThumbOnChange2 } = latestRef.current;
1420
+ if (focusThumbOnChange2)
1421
+ setTimeout(() => {
1422
+ var _a;
1423
+ return (_a = thumbRef.current) == null ? void 0 : _a.focus();
1424
+ });
1425
+ }, [latestRef]);
1426
+ const constrain = (0, import_react4.useCallback)(
1427
+ ([s2, v2]) => {
1428
+ const { isInteractive: isInteractive2 } = latestRef.current;
1429
+ if (!isInteractive2)
1430
+ return;
1431
+ s2 = (0, import_utils11.clampNumber)(s2, 0, 1);
1432
+ v2 = (0, import_utils11.clampNumber)(v2, 0, 1);
1433
+ setValue(([h2]) => [h2, s2, v2]);
1434
+ },
1435
+ [latestRef, setValue]
1436
+ );
1437
+ const onKeyDown = (0, import_react4.useCallback)(
1438
+ (ev) => {
1439
+ const actions = {
1440
+ ArrowRight: () => constrain([s + step, v]),
1441
+ ArrowUp: () => constrain([s, v + step]),
1442
+ ArrowLeft: () => constrain([s - step, v]),
1443
+ ArrowDown: () => constrain([s, v - step])
1444
+ };
1445
+ const action = actions[ev.key];
1446
+ if (!action)
1447
+ return;
1448
+ ev.preventDefault();
1449
+ ev.stopPropagation();
1450
+ action(ev);
1451
+ latestRef.current.eventSource = "keyboard";
1452
+ },
1453
+ [latestRef, constrain, s, v, step]
1454
+ );
1455
+ (0, import_use_pan_event2.usePanEvent)(containerRef, {
1456
+ onSessionStart: (ev) => {
1457
+ const { isInteractive: isInteractive2, value: value2 } = latestRef.current;
1458
+ if (!isInteractive2)
1459
+ return;
1460
+ setDragging(true);
1461
+ focusThumb();
1462
+ setValueFromPointer(ev);
1463
+ onChangeStart(value2);
1464
+ },
1465
+ onSessionEnd: () => {
1466
+ const { isInteractive: isInteractive2, value: value2 } = latestRef.current;
1467
+ if (!isInteractive2)
1468
+ return;
1469
+ setDragging(false);
1470
+ onChangeEnd(value2);
1471
+ },
1472
+ onMove: (ev) => {
1473
+ const { isInteractive: isInteractive2 } = latestRef.current;
1474
+ if (!isInteractive2)
1475
+ return;
1476
+ setValueFromPointer(ev);
1477
+ }
1478
+ });
1479
+ (0, import_utils11.useUpdateEffect)(() => {
1480
+ const { eventSource, value: value2 } = latestRef.current;
1481
+ if (eventSource === "keyboard")
1482
+ onChangeEnd(value2);
1483
+ }, [value, onChangeEnd]);
1484
+ const getContainerProps = (0, import_react4.useCallback)(
1485
+ (props2 = {}, ref = null) => ({
1486
+ ...props2,
1487
+ ...(0, import_utils11.omitObject)(rest, ["aria-readonly"]),
1488
+ ref: (0, import_utils11.mergeRefs)(ref, containerRef),
1489
+ tabIndex: -1
1490
+ }),
1491
+ [rest]
1492
+ );
1493
+ const getInnerProps = (0, import_react4.useCallback)(
1494
+ (props2 = {}, ref = null) => {
1495
+ const { width: w } = thumbSize != null ? thumbSize : { width: 0 };
1496
+ const style = {
1497
+ ...props2.style,
1498
+ ...rest.style,
1499
+ padding: `${w / 2}px`
1500
+ };
1501
+ return {
1502
+ ...props2,
1503
+ ref,
1504
+ style
1505
+ };
1506
+ },
1507
+ [rest, thumbSize]
1508
+ );
1509
+ const getInputProps = (0, import_react4.useCallback)(
1510
+ (props2 = {}, ref = null) => ({
1511
+ ...(0, import_utils11.pickObject)(rest, import_form_control3.formControlProperties),
1512
+ ...props2,
1513
+ id,
1514
+ ref,
1515
+ type: "hidden",
1516
+ name,
1517
+ value: [h, s, v].toString(),
1518
+ required,
1519
+ disabled,
1520
+ readOnly
1521
+ }),
1522
+ [disabled, id, name, readOnly, required, rest, h, s, v]
1523
+ );
1524
+ const getTrackProps = (0, import_react4.useCallback)(
1525
+ (props2 = {}, ref = null) => ({
1526
+ ...(0, import_utils11.pickObject)(
1527
+ rest,
1528
+ (0, import_form_control3.getFormControlProperties)({ omit: ["aria-readonly"] })
1529
+ ),
1530
+ ...props2,
1531
+ ref: (0, import_utils11.mergeRefs)(ref, trackRef)
1532
+ }),
1533
+ [rest]
1534
+ );
1535
+ const getThumbProps = (0, import_react4.useCallback)(
1536
+ (props2 = {}, ref = null) => {
1537
+ const { width, height } = thumbSize != null ? thumbSize : { width: 0, height: 0 };
1538
+ const x = s * 100;
1539
+ const y = v * 100;
1540
+ const style = {
1541
+ ...props2.style,
1542
+ position: "absolute",
1543
+ userSelect: "none",
1544
+ touchAction: "none",
1545
+ left: `calc(${x}% - ${width / 2}px)`,
1546
+ bottom: `calc(${y}% - ${height / 2}px)`
1547
+ };
1548
+ return {
1549
+ "aria-label": "Saturation and brightness thumb",
1550
+ bg: thumbColor != null ? thumbColor : (0, import_utils11.hsvTo)([h, s, v])(),
1551
+ ...(0, import_utils11.pickObject)(rest, import_form_control3.formControlProperties),
1552
+ ...props2,
1553
+ ref: (0, import_utils11.mergeRefs)(ref, thumbRef),
1554
+ tabIndex: isInteractive && focusThumbOnChange ? 0 : void 0,
1555
+ role: "slider",
1556
+ "aria-valuenow": s,
1557
+ "aria-valuemin": 0,
1558
+ "aria-valuemax": 100,
1559
+ "aria-valuetext": `saturation ${s}, brightness ${v}`,
1560
+ "data-active": (0, import_utils11.dataAttr)(isDragging && focusThumbOnChange),
1561
+ onKeyDown: (0, import_utils11.handlerAll)(props2.onKeyDown, onKeyDown),
1562
+ onFocus: (0, import_utils11.handlerAll)(props2.onFocus, rest.onFocus),
1563
+ onBlur: (0, import_utils11.handlerAll)(props2.onBlur, rest.onBlur),
1564
+ style
1565
+ };
1566
+ },
1567
+ [
1568
+ h,
1569
+ s,
1570
+ v,
1571
+ thumbColor,
1572
+ focusThumbOnChange,
1573
+ isDragging,
1574
+ isInteractive,
1575
+ onKeyDown,
1576
+ rest,
1577
+ thumbSize
1578
+ ]
1579
+ );
1580
+ return {
1581
+ value,
1582
+ overlays,
1583
+ getContainerProps,
1584
+ getInnerProps,
1585
+ getTrackProps,
1586
+ getInputProps,
1587
+ getThumbProps
1588
+ };
1589
+ };
1590
+
1591
+ // src/saturation-slider.tsx
1592
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1593
+ var SaturationSlider = (0, import_core9.forwardRef)(
1594
+ (props, ref) => {
1595
+ const [styles, mergedProps] = (0, import_core9.useMultiComponentStyle)(
1596
+ "SaturationSlider",
1597
+ props
1598
+ );
1599
+ const {
1600
+ className,
1601
+ ratio = 16 / 9,
1602
+ innerProps,
1603
+ inputProps,
1604
+ trackProps,
1605
+ thumbProps,
1606
+ __css,
1607
+ ...computedProps
1608
+ } = (0, import_core9.omitThemeProps)(mergedProps);
1609
+ const {
1610
+ overlays,
1611
+ getContainerProps,
1612
+ getInnerProps,
1613
+ getTrackProps,
1614
+ getInputProps,
1615
+ getThumbProps
1616
+ } = useSaturationSlider(computedProps);
1617
+ const css = {
1618
+ position: "relative",
1619
+ _before: {
1620
+ content: `""`,
1621
+ display: "block",
1622
+ h: 0,
1623
+ pb: (0, import_utils12.replaceObject)(ratio, (r) => `${1 / r * 100}%`)
1624
+ },
1625
+ "& > *": {
1626
+ position: "absolute",
1627
+ top: "0",
1628
+ right: "0",
1629
+ bottom: "0",
1630
+ left: "0",
1631
+ display: "flex",
1632
+ justifyContent: "center",
1633
+ alignItems: "center",
1634
+ w: "100%",
1635
+ h: "100%"
1636
+ },
1637
+ ...styles.container,
1638
+ ...__css
1639
+ };
1640
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1641
+ import_core9.ui.div,
1642
+ {
1643
+ className: (0, import_utils12.cx)("ui-saturation-slider", className),
1644
+ __css: css,
1645
+ ...getContainerProps(),
1646
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1647
+ import_core9.ui.div,
1648
+ {
1649
+ className: (0, import_utils12.cx)("ui-saturation-slider__inner", className),
1650
+ __css: { ...styles.inner },
1651
+ ...getInnerProps(innerProps),
1652
+ children: [
1653
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core9.ui.input, { ...getInputProps(inputProps, ref) }),
1654
+ overlays.map((props2, index) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1655
+ import_core9.ui.div,
1656
+ {
1657
+ className: "ui-saturation-slider__overlay",
1658
+ __css: {
1659
+ position: "absolute",
1660
+ top: 0,
1661
+ left: 0,
1662
+ right: 0,
1663
+ bottom: 0,
1664
+ ...styles.overlay
1665
+ },
1666
+ ...props2
1667
+ },
1668
+ index
1669
+ )),
1670
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1671
+ import_core9.ui.div,
1672
+ {
1673
+ className: "ui-saturation-slider__track",
1674
+ __css: {
1675
+ position: "relative",
1676
+ w: "full",
1677
+ h: "full",
1678
+ ...styles.track
1679
+ },
1680
+ ...getTrackProps(trackProps),
1681
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1682
+ import_core9.ui.div,
1683
+ {
1684
+ className: "ui-saturation-slider__thumb",
1685
+ __css: { ...styles.thumb },
1686
+ ...getThumbProps(thumbProps)
1687
+ }
1688
+ )
1689
+ }
1690
+ )
1691
+ ]
1692
+ }
1693
+ )
1694
+ }
1695
+ );
1696
+ }
1697
+ );
1698
+
1699
+ // src/color-picker.tsx
1700
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1701
+ var ColorPicker = (0, import_core10.forwardRef)(
1702
+ ({ size, ...props }, ref) => {
1703
+ const [styles, mergedProps] = (0, import_core10.useMultiComponentStyle)("ColorPicker", {
1704
+ size,
1705
+ ...props
1706
+ });
1707
+ const {
1708
+ className,
1709
+ withResult = true,
1710
+ withPicker = true,
1711
+ withChannel = true,
1712
+ swatches,
1713
+ swatchesColumns = 7,
1714
+ inputProps,
1715
+ withEyeDropper,
1716
+ eyeDropperRef,
1717
+ eyeDropperProps,
1718
+ saturationSliderRef,
1719
+ saturationSliderProps,
1720
+ hueSliderRef,
1721
+ hueSliderProps,
1722
+ alphaSliderRef,
1723
+ alphaSliderProps,
1724
+ swatchesLabel,
1725
+ swatchProps,
1726
+ swatchesProps,
1727
+ ...computedProps
1728
+ } = (0, import_core10.omitThemeProps)(mergedProps);
1729
+ const {
1730
+ getContainerProps,
1731
+ getInputProps,
1732
+ getSaturationSliderProps,
1733
+ ...rest
1734
+ } = useColorPicker(computedProps);
1735
+ const css = {
1736
+ display: "flex",
1737
+ flexDirection: "column",
1738
+ ...styles.container
1739
+ };
1740
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ColorPickerProvider, { value: { styles, size, ...rest }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1741
+ import_core10.ui.div,
1742
+ {
1743
+ ref,
1744
+ className: (0, import_utils13.cx)("ui-color-picker", className),
1745
+ __css: css,
1746
+ ...getContainerProps(),
1747
+ children: [
1748
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_core10.ui.input, { ...getInputProps(inputProps, ref) }),
1749
+ withPicker ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1750
+ SaturationSlider,
1751
+ {
1752
+ size,
1753
+ className: "ui-color-picker__saturation-slider",
1754
+ __css: { ...styles.saturationSlider },
1755
+ ...getSaturationSliderProps(
1756
+ saturationSliderProps,
1757
+ saturationSliderRef
1758
+ )
1759
+ }
1760
+ ) : null,
1761
+ withPicker ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1762
+ ColorPickerBody,
1763
+ {
1764
+ ...{
1765
+ withResult,
1766
+ withEyeDropper,
1767
+ eyeDropperRef,
1768
+ eyeDropperProps,
1769
+ hueSliderRef,
1770
+ hueSliderProps,
1771
+ alphaSliderRef,
1772
+ alphaSliderProps
1773
+ }
1774
+ }
1775
+ ) : null,
1776
+ withPicker && withChannel ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ColorPickerChannels, {}) : null,
1777
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1778
+ ColorPickerSwatches,
1779
+ {
1780
+ ...{
1781
+ swatchesLabel,
1782
+ swatches,
1783
+ swatchesColumns,
1784
+ swatchProps,
1785
+ ...swatchesProps
1786
+ }
1787
+ }
1788
+ )
1789
+ ]
1790
+ }
1791
+ ) });
1792
+ }
1793
+ );
1794
+
1795
+ // src/color-input.tsx
1796
+ var import_core12 = require("@yamada-ui/core");
1797
+ var import_popover = require("@yamada-ui/popover");
1798
+ var import_portal = require("@yamada-ui/portal");
1799
+ var import_utils15 = require("@yamada-ui/utils");
1800
+ var import_react6 = require("react");
1801
+
1802
+ // src/use-color-input.ts
1803
+ var import_core11 = require("@yamada-ui/core");
1804
+ var import_form_control4 = require("@yamada-ui/form-control");
1805
+ var import_use_controllable_state4 = require("@yamada-ui/use-controllable-state");
1806
+ var import_use_eye_dropper2 = require("@yamada-ui/use-eye-dropper");
1807
+ var import_use_outside_click = require("@yamada-ui/use-outside-click");
1808
+ var import_utils14 = require("@yamada-ui/utils");
1809
+ var import_react5 = require("react");
1810
+ var [ColorInputProvider, useColorInputContext] = (0, import_utils14.createContext)({
1811
+ name: "ColorInputContext",
1812
+ errorMessage: `useColorInputContext returned is 'undefined'. Seems you forgot to wrap the components in "<ColorInput />"`
1813
+ });
1814
+ var useColorInput = ({
1815
+ value: valueProp,
1816
+ defaultValue,
1817
+ fallbackValue,
1818
+ defaultColor,
1819
+ onChange: onChangeProp,
1820
+ onChangeStart,
1821
+ onChangeEnd,
1822
+ onSwatchClick,
1823
+ formatInput = (value) => value,
1824
+ closeOnBlur = true,
1825
+ closeOnEsc = true,
1826
+ placement = "bottom-start",
1827
+ duration = 0.2,
1828
+ defaultIsOpen,
1829
+ onOpen: onOpenProp,
1830
+ onClose: onCloseProp,
1831
+ allowInput = true,
1832
+ closeOnSelectSwatch,
1833
+ format,
1834
+ swatchesLabel,
1835
+ swatches,
1836
+ swatchesColumns,
1837
+ withPicker,
1838
+ withChannel,
1839
+ withResult = false,
1840
+ withColorPickerEyeDropper = false,
1841
+ colorPickerVariant,
1842
+ colorPickerSize,
1843
+ colorPickerColorScheme,
1844
+ ...rest
1845
+ }) => {
1846
+ rest = (0, import_form_control4.useFormControlProps)(rest);
1847
+ const formControlProps = (0, import_utils14.pickObject)(
1848
+ rest,
1849
+ (0, import_form_control4.getFormControlProperties)({ omit: ["aria-readonly"] })
1850
+ );
1851
+ const { disabled, readOnly } = formControlProps;
1852
+ const computedProps = (0, import_utils14.splitObject)(rest, import_core11.layoutStyleProperties);
1853
+ const containerRef = (0, import_react5.useRef)(null);
1854
+ const fieldRef = (0, import_react5.useRef)(null);
1855
+ const { supported: eyeDropperSupported, onOpen: onEyeDropperOpen } = (0, import_use_eye_dropper2.useEyeDropper)();
1856
+ const [value, setValue] = (0, import_use_controllable_state4.useControllableState)({
1857
+ value: valueProp,
1858
+ defaultValue,
1859
+ onChange: onChangeProp
1860
+ });
1861
+ const formatRef = (0, import_react5.useRef)(format != null ? format : (0, import_utils14.calcFormat)(value != null ? value : ""));
1862
+ const isInputFocused = (0, import_react5.useRef)(false);
1863
+ const [inputValue, setInputValue] = (0, import_react5.useState)(value != null ? value : "");
1864
+ const [isOpen, setIsOpen] = (0, import_react5.useState)(defaultIsOpen != null ? defaultIsOpen : false);
1865
+ const isColorPickerFull = colorPickerSize === "full";
1866
+ const onOpen = (0, import_react5.useCallback)(() => {
1867
+ if (disabled || readOnly)
1868
+ return;
1869
+ setIsOpen(true);
1870
+ onOpenProp == null ? void 0 : onOpenProp();
1871
+ }, [onOpenProp, disabled, readOnly]);
1872
+ const onClose = (0, import_react5.useCallback)(() => {
1873
+ if (!isOpen)
1874
+ return;
1875
+ const next = (0, import_utils14.convertColor)(value, fallbackValue)(formatRef.current);
1876
+ setValue((prev) => !next || prev === next ? prev : next);
1877
+ setInputValue(formatInput(next != null ? next : ""));
1878
+ setIsOpen(false);
1879
+ onCloseProp == null ? void 0 : onCloseProp();
1880
+ }, [
1881
+ formatRef,
1882
+ isOpen,
1883
+ setValue,
1884
+ onCloseProp,
1885
+ value,
1886
+ formatInput,
1887
+ setInputValue,
1888
+ fallbackValue
1889
+ ]);
1890
+ const onContainerClick = (0, import_react5.useCallback)(() => {
1891
+ if (isOpen)
1892
+ return;
1893
+ onOpen();
1894
+ }, [isOpen, onOpen]);
1895
+ const onInputFocus = (0, import_react5.useCallback)(() => {
1896
+ isInputFocused.current = true;
1897
+ if (isOpen)
1898
+ return;
1899
+ onOpen();
1900
+ }, [isOpen, onOpen]);
1901
+ const onInputBlur = (0, import_react5.useCallback)(() => {
1902
+ isInputFocused.current = false;
1903
+ }, []);
1904
+ const onContainerBlur = (0, import_react5.useCallback)(
1905
+ (ev) => {
1906
+ const relatedTarget = (0, import_utils14.getEventRelatedTarget)(ev);
1907
+ if ((0, import_utils14.isContains)(containerRef.current, relatedTarget))
1908
+ return;
1909
+ if (!closeOnBlur)
1910
+ return;
1911
+ if (isOpen)
1912
+ onClose();
1913
+ },
1914
+ [closeOnBlur, isOpen, onClose]
1915
+ );
1916
+ const onInputKeyDown = (0, import_react5.useCallback)(
1917
+ (ev) => {
1918
+ if (ev.key === " ")
1919
+ ev.key = ev.code;
1920
+ if (disabled || readOnly)
1921
+ return;
1922
+ const actions = {
1923
+ Space: !isOpen ? onOpen : void 0,
1924
+ Enter: !isOpen ? onOpen : void 0,
1925
+ Escape: closeOnEsc ? onClose : void 0
1926
+ };
1927
+ const action = actions[ev.key];
1928
+ if (!action)
1929
+ return;
1930
+ ev.preventDefault();
1931
+ ev.stopPropagation();
1932
+ action();
1933
+ },
1934
+ [disabled, readOnly, isOpen, onOpen, closeOnEsc, onClose]
1935
+ );
1936
+ const onInputChange = (0, import_react5.useCallback)(
1937
+ (ev) => {
1938
+ const value2 = ev.target.value;
1939
+ setInputValue(formatInput(value2));
1940
+ setValue(value2);
1941
+ },
1942
+ [setInputValue, formatInput, setValue]
1943
+ );
1944
+ const onColorPickerChange = (0, import_react5.useCallback)(
1945
+ (value2) => {
1946
+ setValue(value2);
1947
+ if (!isInputFocused.current)
1948
+ setInputValue(formatInput(value2));
1949
+ },
1950
+ [setValue, formatInput]
1951
+ );
1952
+ const onEyeDropperClick = (0, import_react5.useCallback)(
1953
+ async (ev) => {
1954
+ var _a;
1955
+ ev.preventDefault();
1956
+ ev.stopPropagation();
1957
+ try {
1958
+ const { sRGBHex } = (_a = await onEyeDropperOpen()) != null ? _a : {};
1959
+ if (!sRGBHex)
1960
+ return;
1961
+ onColorPickerChange(sRGBHex);
1962
+ } catch {
1963
+ }
1964
+ },
1965
+ [onEyeDropperOpen, onColorPickerChange]
1966
+ );
1967
+ (0, import_use_outside_click.useOutsideClick)({
1968
+ ref: containerRef,
1969
+ handler: onClose,
1970
+ enabled: closeOnBlur
1971
+ });
1972
+ (0, import_utils14.useUpdateEffect)(() => {
1973
+ if (!format)
1974
+ return;
1975
+ formatRef.current = format;
1976
+ const nextValue = (0, import_utils14.convertColor)(value, fallbackValue)(format);
1977
+ if (!nextValue)
1978
+ return;
1979
+ setInputValue(formatInput(nextValue));
1980
+ setValue(nextValue);
1981
+ }, [format, fallbackValue]);
1982
+ const getPopoverProps = (0, import_react5.useCallback)(
1983
+ (props) => ({
1984
+ matchWidth: isColorPickerFull,
1985
+ ...rest,
1986
+ ...props,
1987
+ isOpen,
1988
+ onOpen,
1989
+ onClose,
1990
+ placement,
1991
+ duration,
1992
+ trigger: "never",
1993
+ closeOnButton: false
1994
+ }),
1995
+ [isColorPickerFull, duration, onClose, onOpen, placement, rest, isOpen]
1996
+ );
1997
+ const getContainerProps = (0, import_react5.useCallback)(
1998
+ (props = {}, ref = null) => ({
1999
+ ref: (0, import_utils14.mergeRefs)(containerRef, ref),
2000
+ ...computedProps[0],
2001
+ ...props,
2002
+ ...formControlProps,
2003
+ onClick: (0, import_utils14.handlerAll)(props.onClick, rest.onClick, onContainerClick),
2004
+ onBlur: (0, import_utils14.handlerAll)(props.onBlur, rest.onBlur, onContainerBlur)
2005
+ }),
2006
+ [computedProps, formControlProps, onContainerBlur, onContainerClick, rest]
2007
+ );
2008
+ const getFieldProps = (0, import_react5.useCallback)(
2009
+ (props = {}, ref = null) => ({
2010
+ ref: (0, import_utils14.mergeRefs)(fieldRef, ref),
2011
+ tabIndex: !allowInput ? -1 : 0,
2012
+ ...(0, import_utils14.omitObject)(computedProps[1], ["aria-readonly"]),
2013
+ ...props,
2014
+ style: {
2015
+ ...props.style,
2016
+ ...!allowInput ? { pointerEvents: "none" } : {}
2017
+ },
2018
+ value: inputValue,
2019
+ "data-active": (0, import_utils14.dataAttr)(isOpen),
2020
+ "aria-expanded": (0, import_utils14.dataAttr)(isOpen),
2021
+ onFocus: (0, import_utils14.handlerAll)(props.onFocus, rest.onFocus, onInputFocus),
2022
+ onKeyDown: (0, import_utils14.handlerAll)(props.onKeyDown, rest.onKeyDown, onInputKeyDown),
2023
+ onChange: (0, import_utils14.handlerAll)(props.onChange, onInputChange),
2024
+ onBlur: (0, import_utils14.handlerAll)(props.onFocus, onInputBlur)
2025
+ }),
2026
+ [
2027
+ allowInput,
2028
+ computedProps,
2029
+ inputValue,
2030
+ isOpen,
2031
+ rest,
2032
+ onInputFocus,
2033
+ onInputKeyDown,
2034
+ onInputChange,
2035
+ onInputBlur
2036
+ ]
2037
+ );
2038
+ const getEyeDropperProps = (0, import_react5.useCallback)(
2039
+ (props = {}, ref = null) => ({
2040
+ disabled,
2041
+ "aria-label": "Pick a color",
2042
+ ...props,
2043
+ ref,
2044
+ style: { ...props.style, pointerEvents: readOnly ? "none" : void 0 },
2045
+ onClick: (0, import_utils14.handlerAll)(props.onClick, onEyeDropperClick)
2046
+ }),
2047
+ [disabled, onEyeDropperClick, readOnly]
2048
+ );
2049
+ const getPickerProps = (0, import_react5.useCallback)(
2050
+ (props) => ({
2051
+ ...formControlProps,
2052
+ ...props,
2053
+ value,
2054
+ defaultValue: defaultColor,
2055
+ fallbackValue,
2056
+ onChange: onColorPickerChange,
2057
+ onChangeStart,
2058
+ onChangeEnd,
2059
+ onSwatchClick: (0, import_utils14.handlerAll)(
2060
+ onSwatchClick,
2061
+ closeOnSelectSwatch ? onClose : void 0
2062
+ ),
2063
+ format: formatRef.current,
2064
+ withPicker,
2065
+ withChannel,
2066
+ withResult,
2067
+ withEyeDropper: withColorPickerEyeDropper,
2068
+ swatchesLabel,
2069
+ swatches,
2070
+ swatchesColumns,
2071
+ variant: colorPickerVariant,
2072
+ size: colorPickerSize,
2073
+ colorScheme: colorPickerColorScheme
2074
+ }),
2075
+ [
2076
+ formControlProps,
2077
+ value,
2078
+ fallbackValue,
2079
+ defaultColor,
2080
+ onColorPickerChange,
2081
+ onChangeStart,
2082
+ onChangeEnd,
2083
+ onSwatchClick,
2084
+ onClose,
2085
+ closeOnSelectSwatch,
2086
+ formatRef,
2087
+ withPicker,
2088
+ withChannel,
2089
+ withResult,
2090
+ withColorPickerEyeDropper,
2091
+ swatchesLabel,
2092
+ swatches,
2093
+ swatchesColumns,
2094
+ colorPickerColorScheme,
2095
+ colorPickerSize,
2096
+ colorPickerVariant
2097
+ ]
2098
+ );
2099
+ return {
2100
+ value,
2101
+ eyeDropperSupported,
2102
+ allowInput,
2103
+ getPopoverProps,
2104
+ getContainerProps,
2105
+ getFieldProps,
2106
+ getPickerProps,
2107
+ getEyeDropperProps
2108
+ };
2109
+ };
2110
+
2111
+ // src/color-input.tsx
2112
+ var import_jsx_runtime11 = require("react/jsx-runtime");
2113
+ var ColorInput = (0, import_core12.forwardRef)(
2114
+ ({ withSwatch = true, ...props }, ref) => {
2115
+ const [styles, mergedProps] = (0, import_core12.useMultiComponentStyle)("ColorInput", {
2116
+ withSwatch,
2117
+ ...props
2118
+ });
2119
+ let {
2120
+ className,
2121
+ withEyeDropper = true,
2122
+ color,
2123
+ h,
2124
+ height,
2125
+ minH,
2126
+ minHeight,
2127
+ containerProps,
2128
+ inputProps,
2129
+ swatchProps,
2130
+ eyeDropperProps,
2131
+ portalProps = { isDisabled: true },
2132
+ ...computedProps
2133
+ } = (0, import_core12.omitThemeProps)((0, import_utils15.omitObject)(mergedProps, ["withSwatch"]));
2134
+ const {
2135
+ allowInput,
2136
+ getPopoverProps,
2137
+ getContainerProps,
2138
+ getFieldProps,
2139
+ getPickerProps,
2140
+ getEyeDropperProps,
2141
+ ...rest
2142
+ } = useColorInput(computedProps);
2143
+ h != null ? h : h = height;
2144
+ minH != null ? minH : minH = minHeight;
2145
+ const css = {
2146
+ w: "100%",
2147
+ h: "fit-content",
2148
+ color,
2149
+ ...styles.container
2150
+ };
2151
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ColorInputProvider, { value: { styles, ...rest }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_popover.Popover, { ...getPopoverProps(), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2152
+ import_core12.ui.div,
2153
+ {
2154
+ className: (0, import_utils15.cx)("ui-color-input", className),
2155
+ __css: css,
2156
+ ...getContainerProps(containerProps),
2157
+ children: [
2158
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2159
+ import_core12.ui.div,
2160
+ {
2161
+ className: "ui-color-input__inner",
2162
+ __css: {
2163
+ position: "relative",
2164
+ cursor: !allowInput ? "pointer" : void 0,
2165
+ ...styles.inner
2166
+ },
2167
+ children: [
2168
+ withSwatch ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ColorInputSwatch, { ...swatchProps }) : null,
2169
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_popover.PopoverTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2170
+ ColorInputField,
2171
+ {
2172
+ h,
2173
+ minH,
2174
+ ...getFieldProps(inputProps, ref)
2175
+ }
2176
+ ) }),
2177
+ withEyeDropper ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2178
+ ColorInputEyeDropper,
2179
+ {
2180
+ ...getEyeDropperProps(eyeDropperProps)
2181
+ }
2182
+ ) : null
2183
+ ]
2184
+ }
2185
+ ),
2186
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_portal.Portal, { ...portalProps, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2187
+ import_popover.PopoverContent,
2188
+ {
2189
+ className: "ui-color-input__popover",
2190
+ __css: { ...styles.list },
2191
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2192
+ ColorPicker,
2193
+ {
2194
+ className: "ui-color-input__picker",
2195
+ ...getPickerProps()
2196
+ }
2197
+ )
2198
+ }
2199
+ ) })
2200
+ ]
2201
+ }
2202
+ ) }) });
2203
+ }
2204
+ );
2205
+ var ColorInputField = (0, import_core12.forwardRef)(
2206
+ ({ className, h, minH, ...rest }, ref) => {
2207
+ const { styles } = useColorInputContext();
2208
+ const css = {
2209
+ ps: "2rem",
2210
+ pe: "2rem",
2211
+ h,
2212
+ minH,
2213
+ display: "flex",
2214
+ alignItems: "center",
2215
+ ...styles.field
2216
+ };
2217
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2218
+ import_core12.ui.input,
2219
+ {
2220
+ ref,
2221
+ className: (0, import_utils15.cx)("ui-color-input__field", className),
2222
+ __css: css,
2223
+ ...rest
2224
+ }
2225
+ );
2226
+ }
2227
+ );
2228
+ var ColorInputSwatch = (0, import_core12.forwardRef)(
2229
+ ({ className, ...rest }, ref) => {
2230
+ const { value, styles } = useColorInputContext();
2231
+ const css = {
2232
+ position: "absolute",
2233
+ top: "50%",
2234
+ transform: "translateY(-50%)",
2235
+ ...styles.swatch
2236
+ };
2237
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2238
+ ColorSwatch,
2239
+ {
2240
+ ref,
2241
+ className: (0, import_utils15.cx)("ui-color-input__swatch", className),
2242
+ __css: css,
2243
+ color: value,
2244
+ isRounded: true,
2245
+ ...rest
2246
+ }
2247
+ );
2248
+ }
2249
+ );
2250
+ var ColorInputEyeDropper = (0, import_core12.forwardRef)(
2251
+ ({ className, children, ...rest }, ref) => {
2252
+ const { styles } = useColorInputContext();
2253
+ const css = {
2254
+ position: "absolute",
2255
+ top: "50%",
2256
+ transform: "translateY(-50%)",
2257
+ display: "inline-flex",
2258
+ alignItems: "center",
2259
+ justifyContent: "center",
2260
+ zIndex: 1,
2261
+ ...styles.eyeDropper
2262
+ };
2263
+ const validChildren = (0, import_utils15.getValidChildren)(children);
2264
+ const cloneChildren = validChildren.map(
2265
+ (child) => (0, import_react6.cloneElement)(child, {
2266
+ focusable: false,
2267
+ "aria-hidden": true,
2268
+ style: {
2269
+ maxWidth: "1em",
2270
+ maxHeight: "1em",
2271
+ color: "currentColor"
2272
+ }
2273
+ })
2274
+ );
2275
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2276
+ import_core12.ui.button,
2277
+ {
2278
+ ref,
2279
+ className: (0, import_utils15.cx)("ui-color-input__eye-dropper", className),
2280
+ __css: css,
2281
+ ...rest,
2282
+ children: (0, import_utils15.isValidElement)(children) ? cloneChildren : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(EyeDropperIcon, { className: "ui-color-input__eye-dropper__icon" })
2283
+ }
2284
+ );
2285
+ }
2286
+ );
2287
+ // Annotate the CommonJS export names for ESM import in node:
2288
+ 0 && (module.exports = {
2289
+ AlphaSlider,
2290
+ ColorInput,
2291
+ ColorPicker,
2292
+ ColorSwatch,
2293
+ HueSlider,
2294
+ SaturationSlider
2295
+ });