@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
@@ -0,0 +1,590 @@
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/color-picker-sliders.tsx
21
+ var color_picker_sliders_exports = {};
22
+ __export(color_picker_sliders_exports, {
23
+ ColorPickerSliders: () => ColorPickerSliders
24
+ });
25
+ module.exports = __toCommonJS(color_picker_sliders_exports);
26
+ var import_core3 = require("@yamada-ui/core");
27
+ var import_utils5 = require("@yamada-ui/utils");
28
+
29
+ // src/alpha-slider.tsx
30
+ var import_core = require("@yamada-ui/core");
31
+ var import_utils2 = require("@yamada-ui/utils");
32
+
33
+ // src/use-color-slider.ts
34
+ var import_form_control = require("@yamada-ui/form-control");
35
+ var import_use_controllable_state = require("@yamada-ui/use-controllable-state");
36
+ var import_use_latest_ref = require("@yamada-ui/use-latest-ref");
37
+ var import_use_pan_event = require("@yamada-ui/use-pan-event");
38
+ var import_use_size = require("@yamada-ui/use-size");
39
+ var import_utils = require("@yamada-ui/utils");
40
+ var import_react = require("react");
41
+
42
+ // ../../utils/src/object.ts
43
+ var pickObject = (obj, keys) => {
44
+ const result = {};
45
+ keys.forEach((key) => {
46
+ if (key in obj)
47
+ result[key] = obj[key];
48
+ });
49
+ return result;
50
+ };
51
+ var getObject = (obj, path, fallback, i) => {
52
+ const k = typeof path === "string" ? path.split(".") : [path];
53
+ for (i = 0; i < k.length; i += 1) {
54
+ if (!obj)
55
+ break;
56
+ obj = obj[k[i]];
57
+ }
58
+ return obj === void 0 ? fallback : obj;
59
+ };
60
+ var memoizeObject = (func) => {
61
+ const cache = /* @__PURE__ */ new WeakMap();
62
+ const memoizedFunc = (obj, path, fallback, i) => {
63
+ if (typeof obj === "undefined")
64
+ return func(obj, path, fallback);
65
+ if (!cache.has(obj))
66
+ cache.set(obj, /* @__PURE__ */ new Map());
67
+ const map = cache.get(obj);
68
+ if (map.has(path))
69
+ return map.get(path);
70
+ const value = func(obj, path, fallback, i);
71
+ map.set(path, value);
72
+ return value;
73
+ };
74
+ return memoizedFunc;
75
+ };
76
+ var getMemoizedObject = memoizeObject(getObject);
77
+
78
+ // src/use-color-slider.ts
79
+ var useColorSlider = ({
80
+ focusThumbOnChange = true,
81
+ ...props
82
+ }) => {
83
+ if (!focusThumbOnChange)
84
+ props.isReadOnly = true;
85
+ let {
86
+ id,
87
+ name,
88
+ value: valueProp,
89
+ defaultValue,
90
+ min = 0,
91
+ max,
92
+ step = 1,
93
+ onChange: onChangeProp,
94
+ onChangeStart: onChangeStartProp,
95
+ onChangeEnd: onChangeEndProp,
96
+ thumbColor,
97
+ required,
98
+ disabled,
99
+ readOnly,
100
+ ...rest
101
+ } = (0, import_form_control.useFormControlProps)(props);
102
+ const onChangeStart = (0, import_utils.useCallbackRef)(onChangeStartProp);
103
+ const onChangeEnd = (0, import_utils.useCallbackRef)(onChangeEndProp);
104
+ const [computedValue, setValue] = (0, import_use_controllable_state.useControllableState)({
105
+ value: valueProp,
106
+ defaultValue: defaultValue != null ? defaultValue : min + (max - min) / 2,
107
+ onChange: onChangeProp
108
+ });
109
+ const value = (0, import_utils.clampNumber)(computedValue, min, max);
110
+ const thumbPercent = (0, import_utils.valueToPercent)(value, min, max);
111
+ const [isDragging, setDragging] = (0, import_react.useState)(false);
112
+ const isInteractive = !(disabled || readOnly);
113
+ const oneStep = step || (max - min) / 100;
114
+ const tenStep = (max - min) / 10;
115
+ const containerRef = (0, import_react.useRef)(null);
116
+ const trackRef = (0, import_react.useRef)(null);
117
+ const thumbRef = (0, import_react.useRef)(null);
118
+ const latestRef = (0, import_use_latest_ref.useLatestRef)({
119
+ value,
120
+ min,
121
+ max,
122
+ step,
123
+ isInteractive,
124
+ eventSource: null,
125
+ focusThumbOnChange
126
+ });
127
+ const thumbSize = (0, import_use_size.useSize)(thumbRef);
128
+ const getValueFromPointer = (0, import_react.useCallback)(
129
+ (ev) => {
130
+ var _a, _b;
131
+ if (!trackRef.current)
132
+ return;
133
+ const { min: min2, max: max2, step: step2 } = latestRef.current;
134
+ latestRef.current.eventSource = "pointer";
135
+ const { left, width } = trackRef.current.getBoundingClientRect();
136
+ const { clientX } = (_b = (_a = ev.touches) == null ? void 0 : _a[0]) != null ? _b : ev;
137
+ let percent = (clientX - left) / width;
138
+ let nextValue = (0, import_utils.percentToValue)(percent, min2, max2);
139
+ if (step2)
140
+ nextValue = parseFloat((0, import_utils.roundNumberToStep)(nextValue, min2, step2));
141
+ nextValue = (0, import_utils.clampNumber)(nextValue, min2, max2);
142
+ return nextValue;
143
+ },
144
+ [latestRef]
145
+ );
146
+ const setValueFromPointer = (ev) => {
147
+ const { value: value2 } = latestRef.current;
148
+ const nextValue = getValueFromPointer(ev);
149
+ if (nextValue != null && nextValue !== value2)
150
+ setValue(nextValue);
151
+ };
152
+ const focusThumb = (0, import_react.useCallback)(() => {
153
+ const { focusThumbOnChange: focusThumbOnChange2 } = latestRef.current;
154
+ if (focusThumbOnChange2)
155
+ setTimeout(() => {
156
+ var _a;
157
+ return (_a = thumbRef.current) == null ? void 0 : _a.focus();
158
+ });
159
+ }, [latestRef]);
160
+ const constrain = (0, import_react.useCallback)(
161
+ (value2) => {
162
+ const { isInteractive: isInteractive2, min: min2, max: max2 } = latestRef.current;
163
+ if (!isInteractive2)
164
+ return;
165
+ value2 = parseFloat((0, import_utils.roundNumberToStep)(value2, min2, oneStep));
166
+ value2 = (0, import_utils.clampNumber)(value2, min2, max2);
167
+ setValue(value2);
168
+ },
169
+ [setValue, latestRef, oneStep]
170
+ );
171
+ const stepUp = (0, import_react.useCallback)(
172
+ (step2 = oneStep) => constrain(value + step2),
173
+ [constrain, value, oneStep]
174
+ );
175
+ const stepDown = (0, import_react.useCallback)(
176
+ (step2 = oneStep) => constrain(value - step2),
177
+ [constrain, value, oneStep]
178
+ );
179
+ const onKeyDown = (0, import_react.useCallback)(
180
+ (ev) => {
181
+ const { min: min2, max: max2 } = latestRef.current;
182
+ const actions = {
183
+ ArrowRight: () => stepUp(),
184
+ ArrowUp: () => stepUp(),
185
+ ArrowLeft: () => stepDown(),
186
+ ArrowDown: () => stepDown(),
187
+ PageUp: () => stepUp(tenStep),
188
+ PageDown: () => stepDown(tenStep),
189
+ Home: () => constrain(min2),
190
+ End: () => constrain(max2)
191
+ };
192
+ const action = actions[ev.key];
193
+ if (!action)
194
+ return;
195
+ ev.preventDefault();
196
+ ev.stopPropagation();
197
+ action(ev);
198
+ latestRef.current.eventSource = "keyboard";
199
+ },
200
+ [constrain, latestRef, stepDown, stepUp, tenStep]
201
+ );
202
+ (0, import_use_pan_event.usePanEvent)(containerRef, {
203
+ onSessionStart: (ev) => {
204
+ const { isInteractive: isInteractive2, value: value2 } = latestRef.current;
205
+ if (!isInteractive2)
206
+ return;
207
+ setDragging(true);
208
+ focusThumb();
209
+ setValueFromPointer(ev);
210
+ onChangeStart(value2);
211
+ },
212
+ onSessionEnd: () => {
213
+ const { isInteractive: isInteractive2, value: value2 } = latestRef.current;
214
+ if (!isInteractive2)
215
+ return;
216
+ setDragging(false);
217
+ onChangeEnd(value2);
218
+ },
219
+ onMove: (ev) => {
220
+ const { isInteractive: isInteractive2 } = latestRef.current;
221
+ if (!isInteractive2)
222
+ return;
223
+ setValueFromPointer(ev);
224
+ }
225
+ });
226
+ (0, import_utils.useUpdateEffect)(() => {
227
+ const { eventSource, value: value2 } = latestRef.current;
228
+ if (eventSource === "keyboard")
229
+ onChangeEnd(value2);
230
+ }, [value, onChangeEnd]);
231
+ const getContainerProps = (0, import_react.useCallback)(
232
+ (props2 = {}, ref = null) => {
233
+ const { width: w } = thumbSize != null ? thumbSize : { width: 0 };
234
+ const style = {
235
+ ...props2.style,
236
+ ...rest.style,
237
+ paddingInline: `${w / 2}px`
238
+ };
239
+ return {
240
+ ...props2,
241
+ ...(0, import_utils.omitObject)(rest, ["aria-readonly"]),
242
+ ref: (0, import_utils.mergeRefs)(ref, containerRef),
243
+ tabIndex: -1,
244
+ style
245
+ };
246
+ },
247
+ [rest, thumbSize]
248
+ );
249
+ const getInputProps = (0, import_react.useCallback)(
250
+ (props2 = {}, ref = null) => ({
251
+ ...pickObject(rest, import_form_control.formControlProperties),
252
+ ...props2,
253
+ id,
254
+ ref,
255
+ type: "hidden",
256
+ name,
257
+ value,
258
+ required,
259
+ disabled,
260
+ readOnly
261
+ }),
262
+ [disabled, id, name, readOnly, required, rest, value]
263
+ );
264
+ const getTrackProps = (0, import_react.useCallback)(
265
+ (props2 = {}, ref = null) => ({
266
+ ...pickObject(
267
+ rest,
268
+ (0, import_form_control.getFormControlProperties)({ omit: ["aria-readonly"] })
269
+ ),
270
+ ...props2,
271
+ ref: (0, import_utils.mergeRefs)(ref, trackRef)
272
+ }),
273
+ [rest]
274
+ );
275
+ const getThumbProps = (0, import_react.useCallback)(
276
+ (props2 = {}, ref = null) => {
277
+ const n = thumbPercent;
278
+ const { width: w } = thumbSize != null ? thumbSize : { width: 0 };
279
+ const style = {
280
+ ...props2.style,
281
+ position: "absolute",
282
+ userSelect: "none",
283
+ touchAction: "none",
284
+ left: `calc(${n}% - ${w / 2}px)`
285
+ };
286
+ return {
287
+ "aria-label": "Slider thumb",
288
+ bg: thumbColor != null ? thumbColor : `hsl(${value}, 100%, 50%)`,
289
+ ...pickObject(rest, import_form_control.formControlProperties),
290
+ ...props2,
291
+ ref: (0, import_utils.mergeRefs)(ref, thumbRef),
292
+ tabIndex: isInteractive && focusThumbOnChange ? 0 : void 0,
293
+ role: "slider",
294
+ "aria-valuenow": value,
295
+ "aria-valuemin": min,
296
+ "aria-valuemax": max,
297
+ "data-active": (0, import_utils.dataAttr)(isDragging && focusThumbOnChange),
298
+ onKeyDown: (0, import_utils.handlerAll)(props2.onKeyDown, onKeyDown),
299
+ onFocus: (0, import_utils.handlerAll)(props2.onFocus, rest.onFocus),
300
+ onBlur: (0, import_utils.handlerAll)(props2.onBlur, rest.onBlur),
301
+ style
302
+ };
303
+ },
304
+ [
305
+ thumbColor,
306
+ focusThumbOnChange,
307
+ isDragging,
308
+ isInteractive,
309
+ min,
310
+ max,
311
+ onKeyDown,
312
+ rest,
313
+ thumbPercent,
314
+ thumbSize,
315
+ value
316
+ ]
317
+ );
318
+ return {
319
+ value,
320
+ getContainerProps,
321
+ getTrackProps,
322
+ getInputProps,
323
+ getThumbProps
324
+ };
325
+ };
326
+
327
+ // src/alpha-slider.tsx
328
+ var import_jsx_runtime = require("react/jsx-runtime");
329
+ var defaultOverlays = (color, min, max, withShadow) => {
330
+ let overlays = [
331
+ {
332
+ 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%)",
333
+ bgSize: `8px 8px`,
334
+ bgPosition: `0 0, 0 4px, 4px -4px, -4px 0`,
335
+ var: [
336
+ {
337
+ name: "checkers",
338
+ token: "colors",
339
+ value: ["blackAlpha.300", "whiteAlpha.300"]
340
+ },
341
+ {
342
+ name: "body",
343
+ token: "colors",
344
+ value: ["whiteAlpha.500", "blackAlpha.500"]
345
+ }
346
+ ]
347
+ },
348
+ {
349
+ bgGradient: `linear(to-r, ${(0, import_utils2.convertColor)(color)("hex") + (0, import_utils2.alphaToHex)(min)}, ${(0, import_utils2.convertColor)(color)("hex") + (0, import_utils2.alphaToHex)(max)})`
350
+ }
351
+ ];
352
+ if (withShadow)
353
+ overlays = [
354
+ ...overlays,
355
+ {
356
+ boxShadow: `rgba(0, 0, 0, .1) 0 0 0 1px inset, rgb(0, 0, 0, .15) 0 0 4px inset`
357
+ }
358
+ ];
359
+ return overlays;
360
+ };
361
+ var AlphaSlider = (0, import_core.forwardRef)(
362
+ (props, ref) => {
363
+ const [styles, mergedProps] = (0, import_core.useMultiComponentStyle)("AlphaSlider", props);
364
+ const {
365
+ className,
366
+ inputProps,
367
+ trackProps,
368
+ thumbProps,
369
+ color = "#ffffff",
370
+ min = 0,
371
+ max = 1,
372
+ withShadow = true,
373
+ overlays = defaultOverlays(color, min, max, withShadow),
374
+ __css,
375
+ ...computedProps
376
+ } = (0, import_core.omitThemeProps)(mergedProps);
377
+ const { getContainerProps, getTrackProps, getInputProps, getThumbProps } = useColorSlider({
378
+ min,
379
+ max,
380
+ step: 0.01,
381
+ thumbColor: "transparent",
382
+ ...computedProps
383
+ });
384
+ const css = {
385
+ position: "relative",
386
+ ...styles.container,
387
+ ...__css
388
+ };
389
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
390
+ import_core.ui.div,
391
+ {
392
+ className: (0, import_utils2.cx)("ui-alpha-slider", className),
393
+ __css: css,
394
+ ...getContainerProps(),
395
+ children: [
396
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.ui.input, { ...getInputProps(inputProps, ref) }),
397
+ overlays.map((props2, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
398
+ import_core.ui.div,
399
+ {
400
+ className: "ui-alpha-slider__overlay",
401
+ __css: {
402
+ position: "absolute",
403
+ top: 0,
404
+ left: 0,
405
+ right: 0,
406
+ bottom: 0,
407
+ ...styles.overlay
408
+ },
409
+ ...props2
410
+ },
411
+ index
412
+ )),
413
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
414
+ import_core.ui.div,
415
+ {
416
+ className: "ui-alpha-slider__track",
417
+ __css: {
418
+ position: "relative",
419
+ w: "full",
420
+ h: "full",
421
+ ...styles.track
422
+ },
423
+ ...getTrackProps(trackProps),
424
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
425
+ import_core.ui.div,
426
+ {
427
+ className: "ui-alpha-slider__thumb",
428
+ __css: { ...styles.thumb },
429
+ ...getThumbProps(thumbProps)
430
+ }
431
+ )
432
+ }
433
+ )
434
+ ]
435
+ }
436
+ );
437
+ }
438
+ );
439
+
440
+ // src/hue-slider.tsx
441
+ var import_core2 = require("@yamada-ui/core");
442
+ var import_utils3 = require("@yamada-ui/utils");
443
+ var import_jsx_runtime2 = require("react/jsx-runtime");
444
+ var defaultOverlays2 = (min, max, withShadow) => {
445
+ let overlays = [
446
+ {
447
+ bgGradient: `linear(to-r, ${[...Array(7)].map(
448
+ (_, index) => `hsl(${Math.round(min + (max - min) / 6 * index)}, 100%, 50%)`
449
+ ).join(", ")})`
450
+ }
451
+ ];
452
+ if (withShadow)
453
+ overlays = [
454
+ ...overlays,
455
+ {
456
+ boxShadow: `rgba(0, 0, 0, .1) 0 0 0 1px inset, rgb(0, 0, 0, .15) 0 0 4px inset`
457
+ }
458
+ ];
459
+ return overlays;
460
+ };
461
+ var HueSlider = (0, import_core2.forwardRef)((props, ref) => {
462
+ const [styles, mergedProps] = (0, import_core2.useMultiComponentStyle)("HueSlider", props);
463
+ const {
464
+ className,
465
+ inputProps,
466
+ trackProps,
467
+ thumbProps,
468
+ min = 0,
469
+ max = 360,
470
+ withShadow = true,
471
+ overlays = defaultOverlays2(min, max, withShadow),
472
+ __css,
473
+ ...computedProps
474
+ } = (0, import_core2.omitThemeProps)(mergedProps);
475
+ const { getContainerProps, getTrackProps, getInputProps, getThumbProps } = useColorSlider({ min, max, step: 1, ...computedProps });
476
+ const css = {
477
+ position: "relative",
478
+ ...styles.container,
479
+ ...__css
480
+ };
481
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
482
+ import_core2.ui.div,
483
+ {
484
+ className: (0, import_utils3.cx)("ui-hue-slider", className),
485
+ __css: css,
486
+ ...getContainerProps(),
487
+ children: [
488
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core2.ui.input, { ...getInputProps(inputProps, ref) }),
489
+ overlays.map((props2, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
490
+ import_core2.ui.div,
491
+ {
492
+ className: "ui-hue-slider__overlay",
493
+ __css: {
494
+ position: "absolute",
495
+ top: 0,
496
+ left: 0,
497
+ right: 0,
498
+ bottom: 0,
499
+ ...styles.overlay
500
+ },
501
+ ...props2
502
+ },
503
+ index
504
+ )),
505
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
506
+ import_core2.ui.div,
507
+ {
508
+ className: "ui-hue-slider__track",
509
+ __css: { position: "relative", w: "full", h: "full", ...styles.track },
510
+ ...getTrackProps(trackProps),
511
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
512
+ import_core2.ui.div,
513
+ {
514
+ className: "ui-hue-slider__thumb",
515
+ __css: { ...styles.thumb },
516
+ ...getThumbProps(thumbProps)
517
+ }
518
+ )
519
+ }
520
+ )
521
+ ]
522
+ }
523
+ );
524
+ });
525
+
526
+ // src/use-color-picker.ts
527
+ var import_form_control2 = require("@yamada-ui/form-control");
528
+ var import_use_controllable_state2 = require("@yamada-ui/use-controllable-state");
529
+ var import_use_eye_dropper = require("@yamada-ui/use-eye-dropper");
530
+ var import_utils4 = require("@yamada-ui/utils");
531
+ var import_react2 = require("react");
532
+ var [ColorPickerProvider, useColorPickerContext] = (0, import_utils4.createContext)({
533
+ name: "ColorPickerContext",
534
+ errorMessage: `useColorPickerContext returned is 'undefined'. Seems you forgot to wrap the components in "<ColorPicker />"`
535
+ });
536
+
537
+ // src/color-picker-sliders.tsx
538
+ var import_jsx_runtime3 = require("react/jsx-runtime");
539
+ var ColorPickerSliders = (0, import_core3.forwardRef)(
540
+ ({
541
+ className,
542
+ hueSliderRef,
543
+ hueSliderProps,
544
+ alphaSliderRef,
545
+ alphaSliderProps,
546
+ ...rest
547
+ }, ref) => {
548
+ let { size, withAlpha, getHueSliderProps, getAlphaSliderProps, styles } = useColorPickerContext();
549
+ if (size === "full")
550
+ size = "lg";
551
+ const css = {
552
+ display: "flex",
553
+ flexDirection: "column",
554
+ ...styles.sliders
555
+ };
556
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
557
+ import_core3.ui.div,
558
+ {
559
+ ref,
560
+ className: (0, import_utils5.cx)("ui-color-picker__sliders", className),
561
+ __css: css,
562
+ ...rest,
563
+ children: [
564
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
565
+ HueSlider,
566
+ {
567
+ size,
568
+ className: "ui-color-picker__hue-slider",
569
+ __css: { ...styles.hueSlider },
570
+ ...getHueSliderProps(hueSliderProps, hueSliderRef)
571
+ }
572
+ ),
573
+ withAlpha ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
574
+ AlphaSlider,
575
+ {
576
+ size,
577
+ className: "ui-color-picker__alpha-slider",
578
+ __css: { ...styles.alphaSlider },
579
+ ...getAlphaSliderProps(alphaSliderProps, alphaSliderRef)
580
+ }
581
+ ) : null
582
+ ]
583
+ }
584
+ );
585
+ }
586
+ );
587
+ // Annotate the CommonJS export names for ESM import in node:
588
+ 0 && (module.exports = {
589
+ ColorPickerSliders
590
+ });
@@ -0,0 +1,11 @@
1
+ import {
2
+ ColorPickerSliders
3
+ } from "./chunk-7QGCTVDG.mjs";
4
+ import "./chunk-PTTNJPGJ.mjs";
5
+ import "./chunk-U6OJ4TDG.mjs";
6
+ import "./chunk-DTB2Z3IJ.mjs";
7
+ import "./chunk-NR2XCTSD.mjs";
8
+ import "./chunk-N2GG5L7Q.mjs";
9
+ export {
10
+ ColorPickerSliders
11
+ };
@@ -0,0 +1,34 @@
1
+ import * as _yamada_ui_core from '@yamada-ui/core';
2
+ import { HTMLUIProps, Token } from '@yamada-ui/core';
3
+ import { ReactNode } from 'react';
4
+ import { ColorSwatchProps } from './color-swatch.mjs';
5
+
6
+ type ColorPickerSwatchesOptions = {
7
+ /**
8
+ * The swatches label to use.
9
+ */
10
+ swatchesLabel?: ReactNode;
11
+ /**
12
+ * An array of colors in one of the supported formats.
13
+ * Used to render swatches list below the color picker.
14
+ */
15
+ swatches?: string[];
16
+ /**
17
+ * Number of swatches grid columns.
18
+ *
19
+ * @default 7
20
+ */
21
+ swatchesColumns?: Token<number>;
22
+ /**
23
+ * Props for the color swatch component.
24
+ */
25
+ swatchProps?: ColorSwatchProps;
26
+ /**
27
+ * Props for the swatches container element.
28
+ */
29
+ swatchesContainerProps?: Omit<HTMLUIProps<"div">, "children">;
30
+ };
31
+ type ColorPickerSwatchesProps = Omit<HTMLUIProps<"div">, "children"> & ColorPickerSwatchesOptions;
32
+ declare const ColorPickerSwatches: _yamada_ui_core.Component<"div", ColorPickerSwatchesProps>;
33
+
34
+ export { ColorPickerSwatches, type ColorPickerSwatchesProps };
@@ -0,0 +1,34 @@
1
+ import * as _yamada_ui_core from '@yamada-ui/core';
2
+ import { HTMLUIProps, Token } from '@yamada-ui/core';
3
+ import { ReactNode } from 'react';
4
+ import { ColorSwatchProps } from './color-swatch.js';
5
+
6
+ type ColorPickerSwatchesOptions = {
7
+ /**
8
+ * The swatches label to use.
9
+ */
10
+ swatchesLabel?: ReactNode;
11
+ /**
12
+ * An array of colors in one of the supported formats.
13
+ * Used to render swatches list below the color picker.
14
+ */
15
+ swatches?: string[];
16
+ /**
17
+ * Number of swatches grid columns.
18
+ *
19
+ * @default 7
20
+ */
21
+ swatchesColumns?: Token<number>;
22
+ /**
23
+ * Props for the color swatch component.
24
+ */
25
+ swatchProps?: ColorSwatchProps;
26
+ /**
27
+ * Props for the swatches container element.
28
+ */
29
+ swatchesContainerProps?: Omit<HTMLUIProps<"div">, "children">;
30
+ };
31
+ type ColorPickerSwatchesProps = Omit<HTMLUIProps<"div">, "children"> & ColorPickerSwatchesOptions;
32
+ declare const ColorPickerSwatches: _yamada_ui_core.Component<"div", ColorPickerSwatchesProps>;
33
+
34
+ export { ColorPickerSwatches, type ColorPickerSwatchesProps };