@yamada-ui/color-picker 1.4.8 → 1.4.9-dev-20241109080944
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/alpha-slider.d.mts +1 -1
- package/dist/alpha-slider.d.ts +1 -1
- package/dist/alpha-slider.js +98 -45
- package/dist/alpha-slider.js.map +1 -1
- package/dist/alpha-slider.mjs +2 -2
- package/dist/{chunk-XL5VWGU4.mjs → chunk-FP3X3PED.mjs} +78 -43
- package/dist/chunk-FP3X3PED.mjs.map +1 -0
- package/dist/{chunk-CZCTI6T2.mjs → chunk-HJMXAALX.mjs} +2 -2
- package/dist/{chunk-62A7F566.mjs → chunk-HPP26MVU.mjs} +3 -3
- package/dist/{chunk-CAVDEKGO.mjs → chunk-LJHUX2RB.mjs} +2 -2
- package/dist/{chunk-APTJWP7T.mjs → chunk-OJVCLBAG.mjs} +2 -2
- package/dist/{chunk-F5EYME2W.mjs → chunk-SGAM4TJL.mjs} +26 -7
- package/dist/chunk-SGAM4TJL.mjs.map +1 -0
- package/dist/chunk-WZEWATJ3.mjs +139 -0
- package/dist/chunk-WZEWATJ3.mjs.map +1 -0
- package/dist/color-picker.js +170 -80
- package/dist/color-picker.js.map +1 -1
- package/dist/color-picker.mjs +7 -7
- package/dist/color-selector-body.js +170 -80
- package/dist/color-selector-body.js.map +1 -1
- package/dist/color-selector-body.mjs +5 -5
- package/dist/color-selector-sliders.js +170 -80
- package/dist/color-selector-sliders.js.map +1 -1
- package/dist/color-selector-sliders.mjs +4 -4
- package/dist/color-selector.js +170 -80
- package/dist/color-selector.js.map +1 -1
- package/dist/color-selector.mjs +6 -6
- package/dist/hue-slider.d.mts +1 -1
- package/dist/hue-slider.d.ts +1 -1
- package/dist/hue-slider.js +95 -40
- package/dist/hue-slider.js.map +1 -1
- package/dist/hue-slider.mjs +2 -2
- package/dist/index.js +170 -80
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -7
- package/dist/use-color-slider.d.mts +7 -1
- package/dist/use-color-slider.d.ts +7 -1
- package/dist/use-color-slider.js +25 -5
- package/dist/use-color-slider.js.map +1 -1
- package/dist/use-color-slider.mjs +3 -1
- package/package.json +1 -1
- package/dist/chunk-7NWT5PKE.mjs +0 -102
- package/dist/chunk-7NWT5PKE.mjs.map +0 -1
- package/dist/chunk-F5EYME2W.mjs.map +0 -1
- package/dist/chunk-XL5VWGU4.mjs.map +0 -1
- /package/dist/{chunk-CZCTI6T2.mjs.map → chunk-HJMXAALX.mjs.map} +0 -0
- /package/dist/{chunk-62A7F566.mjs.map → chunk-HPP26MVU.mjs.map} +0 -0
- /package/dist/{chunk-CAVDEKGO.mjs.map → chunk-LJHUX2RB.mjs.map} +0 -0
- /package/dist/{chunk-APTJWP7T.mjs.map → chunk-OJVCLBAG.mjs.map} +0 -0
package/dist/color-picker.mjs
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
"use client"
|
2
2
|
import {
|
3
3
|
ColorPicker
|
4
|
-
} from "./chunk-
|
4
|
+
} from "./chunk-OJVCLBAG.mjs";
|
5
5
|
import "./chunk-MEG43CIO.mjs";
|
6
|
-
import "./chunk-
|
6
|
+
import "./chunk-HJMXAALX.mjs";
|
7
7
|
import "./chunk-YU3KOEL7.mjs";
|
8
8
|
import "./chunk-XCHWCHHP.mjs";
|
9
|
-
import "./chunk-
|
9
|
+
import "./chunk-LJHUX2RB.mjs";
|
10
10
|
import "./chunk-YPPP72VM.mjs";
|
11
11
|
import "./chunk-DJST5TK2.mjs";
|
12
|
-
import "./chunk-
|
13
|
-
import "./chunk-
|
14
|
-
import "./chunk-
|
15
|
-
import "./chunk-
|
12
|
+
import "./chunk-HPP26MVU.mjs";
|
13
|
+
import "./chunk-WZEWATJ3.mjs";
|
14
|
+
import "./chunk-FP3X3PED.mjs";
|
15
|
+
import "./chunk-SGAM4TJL.mjs";
|
16
16
|
import "./chunk-JRSGQRFQ.mjs";
|
17
17
|
import "./chunk-YYXTR7W7.mjs";
|
18
18
|
import "./chunk-X2EYDFTM.mjs";
|
@@ -115,6 +115,7 @@ var useColorSlider = ({
|
|
115
115
|
id,
|
116
116
|
name,
|
117
117
|
style: styleProp,
|
118
|
+
channel = "hue",
|
118
119
|
defaultValue,
|
119
120
|
max,
|
120
121
|
min = 0,
|
@@ -331,6 +332,7 @@ var useColorSlider = ({
|
|
331
332
|
"aria-valuemax": max,
|
332
333
|
"aria-valuemin": min,
|
333
334
|
"aria-valuenow": value,
|
335
|
+
"aria-valuetext": getAriaValueText(channel, value),
|
334
336
|
"data-active": (0, import_utils3.dataAttr)(isDragging && focusThumbOnChange),
|
335
337
|
role: "slider",
|
336
338
|
tabIndex: isInteractive && focusThumbOnChange ? 0 : void 0,
|
@@ -346,14 +348,15 @@ var useColorSlider = ({
|
|
346
348
|
value,
|
347
349
|
formControlProps,
|
348
350
|
ariaReadonly,
|
349
|
-
isInteractive,
|
350
|
-
focusThumbOnChange,
|
351
|
-
min,
|
352
351
|
max,
|
352
|
+
min,
|
353
|
+
channel,
|
353
354
|
isDragging,
|
354
|
-
|
355
|
+
focusThumbOnChange,
|
356
|
+
isInteractive,
|
357
|
+
onBlurProp,
|
355
358
|
onFocusProp,
|
356
|
-
|
359
|
+
onKeyDown
|
357
360
|
]
|
358
361
|
);
|
359
362
|
return {
|
@@ -364,9 +367,30 @@ var useColorSlider = ({
|
|
364
367
|
getTrackProps
|
365
368
|
};
|
366
369
|
};
|
370
|
+
var getAriaValueText = (channel, value) => {
|
371
|
+
if (channel === "hue") {
|
372
|
+
return `${value}\xB0, ${getColorName(value)}`;
|
373
|
+
} else {
|
374
|
+
return `${value * 100}%`;
|
375
|
+
}
|
376
|
+
};
|
377
|
+
var getColorName = (hue) => {
|
378
|
+
if (hue < 30 || hue >= 330) return "Red";
|
379
|
+
if (hue < 90) return "Yellow";
|
380
|
+
if (hue < 150) return "Green";
|
381
|
+
if (hue < 210) return "Cyan";
|
382
|
+
if (hue < 270) return "Blue";
|
383
|
+
return "Magenta";
|
384
|
+
};
|
367
385
|
|
368
386
|
// src/alpha-slider.tsx
|
369
387
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
388
|
+
var [AlphaSliderProvider, useAlphaSlider] = (0, import_utils4.createContext)(
|
389
|
+
{
|
390
|
+
name: "SliderContext",
|
391
|
+
errorMessage: `useSliderContext returned is 'undefined'. Seems you forgot to wrap the components in "<AlphaSlider />" `
|
392
|
+
}
|
393
|
+
);
|
370
394
|
var defaultOverlays = (color, min, max, withShadow) => {
|
371
395
|
let overlays = [
|
372
396
|
{
|
@@ -420,14 +444,15 @@ var AlphaSlider = (0, import_core2.forwardRef)(
|
|
420
444
|
min,
|
421
445
|
step: 0.01,
|
422
446
|
thumbColor: "transparent",
|
423
|
-
...computedProps
|
447
|
+
...computedProps,
|
448
|
+
channel: "alpha"
|
424
449
|
});
|
425
450
|
const css = {
|
426
451
|
position: "relative",
|
427
452
|
...styles.container,
|
428
453
|
...__css
|
429
454
|
};
|
430
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
455
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AlphaSliderProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
431
456
|
import_core2.ui.div,
|
432
457
|
{
|
433
458
|
className: (0, import_utils4.cx)("ui-alpha-slider", className),
|
@@ -435,55 +460,87 @@ var AlphaSlider = (0, import_core2.forwardRef)(
|
|
435
460
|
...getContainerProps(),
|
436
461
|
children: [
|
437
462
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core2.ui.input, { ...getInputProps(inputProps, ref) }),
|
438
|
-
overlays.map((props2, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
439
|
-
|
440
|
-
{
|
441
|
-
className: "ui-alpha-slider__overlay",
|
442
|
-
__css: {
|
443
|
-
bottom: 0,
|
444
|
-
left: 0,
|
445
|
-
position: "absolute",
|
446
|
-
right: 0,
|
447
|
-
top: 0,
|
448
|
-
...styles.overlay
|
449
|
-
},
|
450
|
-
...props2
|
451
|
-
},
|
452
|
-
index
|
453
|
-
)),
|
454
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
455
|
-
import_core2.ui.div,
|
456
|
-
{
|
457
|
-
className: "ui-alpha-slider__track",
|
458
|
-
__css: {
|
459
|
-
h: "100%",
|
460
|
-
position: "relative",
|
461
|
-
w: "100%",
|
462
|
-
...styles.track
|
463
|
-
},
|
464
|
-
...getTrackProps(trackProps),
|
465
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
466
|
-
import_core2.ui.div,
|
467
|
-
{
|
468
|
-
className: "ui-alpha-slider__thumb",
|
469
|
-
__css: { ...styles.thumb },
|
470
|
-
...getThumbProps(thumbProps)
|
471
|
-
}
|
472
|
-
)
|
473
|
-
}
|
474
|
-
)
|
463
|
+
overlays.map((props2, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AlphaSliderOverlay, { ...props2 }, index)),
|
464
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AlphaSliderTrack, { ...getTrackProps(trackProps), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AlphaSliderThumb, { ...getThumbProps(thumbProps) }) })
|
475
465
|
]
|
476
466
|
}
|
477
|
-
);
|
467
|
+
) });
|
478
468
|
}
|
479
469
|
);
|
480
470
|
AlphaSlider.displayName = "AlphaSlider";
|
481
471
|
AlphaSlider.__ui__ = "AlphaSlider";
|
472
|
+
var AlphaSliderOverlay = (0, import_core2.forwardRef)(
|
473
|
+
({ className, ...rest }, ref) => {
|
474
|
+
const { styles } = useAlphaSlider();
|
475
|
+
const css = {
|
476
|
+
bottom: 0,
|
477
|
+
left: 0,
|
478
|
+
position: "absolute",
|
479
|
+
right: 0,
|
480
|
+
top: 0,
|
481
|
+
...styles.overlay
|
482
|
+
};
|
483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
484
|
+
import_core2.ui.div,
|
485
|
+
{
|
486
|
+
ref,
|
487
|
+
className: (0, import_utils4.cx)("ui-alpha-slider__overlay", className),
|
488
|
+
__css: css,
|
489
|
+
...rest
|
490
|
+
}
|
491
|
+
);
|
492
|
+
}
|
493
|
+
);
|
494
|
+
AlphaSliderOverlay.displayName = "AlphaSliderOverlay";
|
495
|
+
AlphaSliderOverlay.__ui__ = "AlphaSliderOverlay";
|
496
|
+
var AlphaSliderTrack = (0, import_core2.forwardRef)(
|
497
|
+
({ className, ...rest }, ref) => {
|
498
|
+
const { styles } = useAlphaSlider();
|
499
|
+
const css = {
|
500
|
+
h: "100%",
|
501
|
+
position: "relative",
|
502
|
+
w: "100%",
|
503
|
+
...styles.track
|
504
|
+
};
|
505
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
506
|
+
import_core2.ui.div,
|
507
|
+
{
|
508
|
+
ref,
|
509
|
+
className: (0, import_utils4.cx)("ui-alpha-slider__track", className),
|
510
|
+
__css: css,
|
511
|
+
...rest
|
512
|
+
}
|
513
|
+
);
|
514
|
+
}
|
515
|
+
);
|
516
|
+
AlphaSliderTrack.displayName = "AlphaSliderTrack";
|
517
|
+
AlphaSliderTrack.__ui__ = "AlphaSliderTrack";
|
518
|
+
var AlphaSliderThumb = (0, import_core2.forwardRef)(
|
519
|
+
({ className, ...rest }, ref) => {
|
520
|
+
const { styles } = useAlphaSlider();
|
521
|
+
const css = { ...styles.thumb };
|
522
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
523
|
+
import_core2.ui.div,
|
524
|
+
{
|
525
|
+
ref,
|
526
|
+
className: (0, import_utils4.cx)("ui-alpha-slider__thumb", className),
|
527
|
+
__css: css,
|
528
|
+
...rest
|
529
|
+
}
|
530
|
+
);
|
531
|
+
}
|
532
|
+
);
|
533
|
+
AlphaSliderThumb.displayName = "AlphaSliderThumb";
|
534
|
+
AlphaSliderThumb.__ui__ = "AlphaSliderThumb";
|
482
535
|
|
483
536
|
// src/hue-slider.tsx
|
484
537
|
var import_core3 = require("@yamada-ui/core");
|
485
538
|
var import_utils5 = require("@yamada-ui/utils");
|
486
539
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
540
|
+
var [HueSliderProvider, useHueSlider] = (0, import_utils5.createContext)({
|
541
|
+
name: "SliderContext",
|
542
|
+
errorMessage: `useSliderContext returned is 'undefined'. Seems you forgot to wrap the components in "<HueSlider />" `
|
543
|
+
});
|
487
544
|
var defaultOverlays2 = (min, max, withShadow) => {
|
488
545
|
let overlays = [
|
489
546
|
{
|
@@ -515,13 +572,13 @@ var HueSlider = (0, import_core3.forwardRef)((props, ref) => {
|
|
515
572
|
__css,
|
516
573
|
...computedProps
|
517
574
|
} = (0, import_core3.omitThemeProps)(mergedProps);
|
518
|
-
const { getContainerProps, getInputProps, getThumbProps, getTrackProps } = useColorSlider({ max, min, step: 1, ...computedProps });
|
575
|
+
const { getContainerProps, getInputProps, getThumbProps, getTrackProps } = useColorSlider({ max, min, step: 1, ...computedProps, channel: "hue" });
|
519
576
|
const css = {
|
520
577
|
position: "relative",
|
521
578
|
...styles.container,
|
522
579
|
...__css
|
523
580
|
};
|
524
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
581
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(HueSliderProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
525
582
|
import_core3.ui.div,
|
526
583
|
{
|
527
584
|
className: (0, import_utils5.cx)("ui-hue-slider", className),
|
@@ -529,44 +586,77 @@ var HueSlider = (0, import_core3.forwardRef)((props, ref) => {
|
|
529
586
|
...getContainerProps(),
|
530
587
|
children: [
|
531
588
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core3.ui.input, { ...getInputProps(inputProps, ref) }),
|
532
|
-
overlays.map((props2, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
533
|
-
|
534
|
-
{
|
535
|
-
className: "ui-hue-slider__overlay",
|
536
|
-
__css: {
|
537
|
-
bottom: 0,
|
538
|
-
left: 0,
|
539
|
-
position: "absolute",
|
540
|
-
right: 0,
|
541
|
-
top: 0,
|
542
|
-
...styles.overlay
|
543
|
-
},
|
544
|
-
...props2
|
545
|
-
},
|
546
|
-
index
|
547
|
-
)),
|
548
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
549
|
-
import_core3.ui.div,
|
550
|
-
{
|
551
|
-
className: "ui-hue-slider__track",
|
552
|
-
__css: { h: "100%", position: "relative", w: "100%", ...styles.track },
|
553
|
-
...getTrackProps(trackProps),
|
554
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
555
|
-
import_core3.ui.div,
|
556
|
-
{
|
557
|
-
className: "ui-hue-slider__thumb",
|
558
|
-
__css: { ...styles.thumb },
|
559
|
-
...getThumbProps(thumbProps)
|
560
|
-
}
|
561
|
-
)
|
562
|
-
}
|
563
|
-
)
|
589
|
+
overlays.map((props2, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(HueSliderOverlay, { ...props2 }, index)),
|
590
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(HueSliderTrack, { ...getTrackProps(trackProps), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(HueSliderThumb, { ...getThumbProps(thumbProps) }) })
|
564
591
|
]
|
565
592
|
}
|
566
|
-
);
|
593
|
+
) });
|
567
594
|
});
|
568
595
|
HueSlider.displayName = "HueSlider";
|
569
596
|
HueSlider.__ui__ = "HueSlider";
|
597
|
+
var HueSliderOverlay = (0, import_core3.forwardRef)(
|
598
|
+
({ className, ...rest }, ref) => {
|
599
|
+
const { styles } = useHueSlider();
|
600
|
+
const css = {
|
601
|
+
bottom: 0,
|
602
|
+
left: 0,
|
603
|
+
position: "absolute",
|
604
|
+
right: 0,
|
605
|
+
top: 0,
|
606
|
+
...styles.overlay
|
607
|
+
};
|
608
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
609
|
+
import_core3.ui.div,
|
610
|
+
{
|
611
|
+
ref,
|
612
|
+
className: (0, import_utils5.cx)("ui-hue-slider__overlay", className),
|
613
|
+
__css: css,
|
614
|
+
...rest
|
615
|
+
}
|
616
|
+
);
|
617
|
+
}
|
618
|
+
);
|
619
|
+
HueSliderOverlay.displayName = "HueSliderOverlay";
|
620
|
+
HueSliderOverlay.__ui__ = "HueSliderOverlay";
|
621
|
+
var HueSliderTrack = (0, import_core3.forwardRef)(
|
622
|
+
({ className, ...rest }, ref) => {
|
623
|
+
const { styles } = useHueSlider();
|
624
|
+
const css = {
|
625
|
+
h: "100%",
|
626
|
+
position: "relative",
|
627
|
+
w: "100%",
|
628
|
+
...styles.track
|
629
|
+
};
|
630
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
631
|
+
import_core3.ui.div,
|
632
|
+
{
|
633
|
+
ref,
|
634
|
+
className: (0, import_utils5.cx)("ui-hue-slider__track", className),
|
635
|
+
__css: css,
|
636
|
+
...rest
|
637
|
+
}
|
638
|
+
);
|
639
|
+
}
|
640
|
+
);
|
641
|
+
HueSliderTrack.displayName = "HueSliderTrack";
|
642
|
+
HueSliderTrack.__ui__ = "HueSliderTrack";
|
643
|
+
var HueSliderThumb = (0, import_core3.forwardRef)(
|
644
|
+
({ className, ...rest }, ref) => {
|
645
|
+
const { styles } = useHueSlider();
|
646
|
+
const css = { ...styles.thumb };
|
647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
648
|
+
import_core3.ui.div,
|
649
|
+
{
|
650
|
+
ref,
|
651
|
+
className: (0, import_utils5.cx)("ui-hue-slider__thumb", className),
|
652
|
+
__css: css,
|
653
|
+
...rest
|
654
|
+
}
|
655
|
+
);
|
656
|
+
}
|
657
|
+
);
|
658
|
+
HueSliderThumb.displayName = "HueSliderThumb";
|
659
|
+
HueSliderThumb.__ui__ = "HueSliderThumb";
|
570
660
|
|
571
661
|
// src/color-selector-sliders.tsx
|
572
662
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|