@webdevarif/dashui 0.3.11 → 0.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +82 -101
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +82 -101
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -552,11 +552,11 @@ interface ColorPickerContextValue {
|
|
|
552
552
|
saturation: number;
|
|
553
553
|
lightness: number;
|
|
554
554
|
alpha: number;
|
|
555
|
+
mode: string;
|
|
555
556
|
setHue: (h: number) => void;
|
|
556
557
|
setSaturation: (s: number) => void;
|
|
557
558
|
setLightness: (l: number) => void;
|
|
558
559
|
setAlpha: (a: number) => void;
|
|
559
|
-
mode: string;
|
|
560
560
|
setMode: (mode: string) => void;
|
|
561
561
|
}
|
|
562
562
|
declare const useColorPicker: () => ColorPickerContextValue;
|
|
@@ -568,12 +568,12 @@ declare const ColorPicker: ({ defaultValue, onChange, className, children, ...pr
|
|
|
568
568
|
declare const ColorPickerSelection: React.MemoExoticComponent<({ className, ...props }: HTMLAttributes<HTMLDivElement>) => react_jsx_runtime.JSX.Element>;
|
|
569
569
|
declare const ColorPickerHue: ({ className, ...props }: Omit<ComponentProps<typeof Slider.Root>, "value" | "onValueChange" | "max" | "step">) => react_jsx_runtime.JSX.Element;
|
|
570
570
|
declare const ColorPickerAlpha: ({ className, ...props }: Omit<ComponentProps<typeof Slider.Root>, "value" | "onValueChange" | "max" | "step">) => react_jsx_runtime.JSX.Element;
|
|
571
|
-
declare const ColorPickerHexOutput: ({ className, ...props }: HTMLAttributes<HTMLDivElement>) => react_jsx_runtime.JSX.Element;
|
|
572
571
|
declare const ColorPickerEyeDropper: ({ className, ...props }: HTMLAttributes<HTMLButtonElement>) => react_jsx_runtime.JSX.Element;
|
|
573
572
|
type ColorPickerOutputProps = HTMLAttributes<HTMLDivElement>;
|
|
574
573
|
declare const ColorPickerOutput: ({ className, ...props }: ColorPickerOutputProps) => react_jsx_runtime.JSX.Element;
|
|
575
574
|
type ColorPickerFormatProps = HTMLAttributes<HTMLInputElement>;
|
|
576
575
|
declare const ColorPickerFormat: ({ className, ...props }: ColorPickerFormatProps) => react_jsx_runtime.JSX.Element;
|
|
576
|
+
declare const ColorPickerHexOutput: ({ className, ...props }: HTMLAttributes<HTMLDivElement>) => react_jsx_runtime.JSX.Element;
|
|
577
577
|
|
|
578
578
|
declare function useDisclosure(initial?: boolean): {
|
|
579
579
|
isOpen: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -552,11 +552,11 @@ interface ColorPickerContextValue {
|
|
|
552
552
|
saturation: number;
|
|
553
553
|
lightness: number;
|
|
554
554
|
alpha: number;
|
|
555
|
+
mode: string;
|
|
555
556
|
setHue: (h: number) => void;
|
|
556
557
|
setSaturation: (s: number) => void;
|
|
557
558
|
setLightness: (l: number) => void;
|
|
558
559
|
setAlpha: (a: number) => void;
|
|
559
|
-
mode: string;
|
|
560
560
|
setMode: (mode: string) => void;
|
|
561
561
|
}
|
|
562
562
|
declare const useColorPicker: () => ColorPickerContextValue;
|
|
@@ -568,12 +568,12 @@ declare const ColorPicker: ({ defaultValue, onChange, className, children, ...pr
|
|
|
568
568
|
declare const ColorPickerSelection: React.MemoExoticComponent<({ className, ...props }: HTMLAttributes<HTMLDivElement>) => react_jsx_runtime.JSX.Element>;
|
|
569
569
|
declare const ColorPickerHue: ({ className, ...props }: Omit<ComponentProps<typeof Slider.Root>, "value" | "onValueChange" | "max" | "step">) => react_jsx_runtime.JSX.Element;
|
|
570
570
|
declare const ColorPickerAlpha: ({ className, ...props }: Omit<ComponentProps<typeof Slider.Root>, "value" | "onValueChange" | "max" | "step">) => react_jsx_runtime.JSX.Element;
|
|
571
|
-
declare const ColorPickerHexOutput: ({ className, ...props }: HTMLAttributes<HTMLDivElement>) => react_jsx_runtime.JSX.Element;
|
|
572
571
|
declare const ColorPickerEyeDropper: ({ className, ...props }: HTMLAttributes<HTMLButtonElement>) => react_jsx_runtime.JSX.Element;
|
|
573
572
|
type ColorPickerOutputProps = HTMLAttributes<HTMLDivElement>;
|
|
574
573
|
declare const ColorPickerOutput: ({ className, ...props }: ColorPickerOutputProps) => react_jsx_runtime.JSX.Element;
|
|
575
574
|
type ColorPickerFormatProps = HTMLAttributes<HTMLInputElement>;
|
|
576
575
|
declare const ColorPickerFormat: ({ className, ...props }: ColorPickerFormatProps) => react_jsx_runtime.JSX.Element;
|
|
576
|
+
declare const ColorPickerHexOutput: ({ className, ...props }: HTMLAttributes<HTMLDivElement>) => react_jsx_runtime.JSX.Element;
|
|
577
577
|
|
|
578
578
|
declare function useDisclosure(initial?: boolean): {
|
|
579
579
|
isOpen: boolean;
|
package/dist/index.js
CHANGED
|
@@ -3356,8 +3356,7 @@ var ColorPicker = ({
|
|
|
3356
3356
|
notifyRef.current = onChange;
|
|
3357
3357
|
}, [onChange]);
|
|
3358
3358
|
const notify = (0, import_react.useCallback)((h, s, l, a) => {
|
|
3359
|
-
|
|
3360
|
-
notifyRef.current?.(hex);
|
|
3359
|
+
notifyRef.current?.(import_color.default.hsl(h, s, l).alpha(a / 100).hexa());
|
|
3361
3360
|
}, []);
|
|
3362
3361
|
const setHue = (0, import_react.useCallback)((h) => {
|
|
3363
3362
|
setHueState(h);
|
|
@@ -3375,7 +3374,7 @@ var ColorPicker = ({
|
|
|
3375
3374
|
setAlphaState(a);
|
|
3376
3375
|
notify(hue, saturation, lightness, a);
|
|
3377
3376
|
}, [hue, saturation, lightness, notify]);
|
|
3378
|
-
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ColorPickerContext.Provider, { value: { hue, saturation, lightness, alpha, setHue, setSaturation, setLightness, setAlpha,
|
|
3377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ColorPickerContext.Provider, { value: { hue, saturation, lightness, alpha, mode, setHue, setSaturation, setLightness, setAlpha, setMode }, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: cn("flex flex-col gap-3", className), ...props, children }) });
|
|
3379
3378
|
};
|
|
3380
3379
|
var ColorPickerSelection = (0, import_react.memo)(({ className, ...props }) => {
|
|
3381
3380
|
const containerRef = (0, import_react.useRef)(null);
|
|
@@ -3399,8 +3398,7 @@ var ColorPickerSelection = (0, import_react.memo)(({ className, ...props }) => {
|
|
|
3399
3398
|
setPosX(x);
|
|
3400
3399
|
setPosY(y);
|
|
3401
3400
|
setSaturation(x * 100);
|
|
3402
|
-
|
|
3403
|
-
setLightness(topL * (1 - y));
|
|
3401
|
+
setLightness((x < 0.01 ? 100 : 50 + 50 * (1 - x)) * (1 - y));
|
|
3404
3402
|
}, [isDragging, setSaturation, setLightness]);
|
|
3405
3403
|
(0, import_react.useEffect)(() => {
|
|
3406
3404
|
if (!isDragging) return;
|
|
@@ -3428,11 +3426,7 @@ var ColorPickerSelection = (0, import_react.memo)(({ className, ...props }) => {
|
|
|
3428
3426
|
"div",
|
|
3429
3427
|
{
|
|
3430
3428
|
className: "pointer-events-none absolute h-4 w-4 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white",
|
|
3431
|
-
style: {
|
|
3432
|
-
left: `${posX * 100}%`,
|
|
3433
|
-
top: `${posY * 100}%`,
|
|
3434
|
-
boxShadow: "0 0 0 1px rgba(0,0,0,0.6)"
|
|
3435
|
-
}
|
|
3429
|
+
style: { left: `${posX * 100}%`, top: `${posY * 100}%`, boxShadow: "0 0 0 1px rgba(0,0,0,0.6)" }
|
|
3436
3430
|
}
|
|
3437
3431
|
)
|
|
3438
3432
|
}
|
|
@@ -3441,85 +3435,42 @@ var ColorPickerSelection = (0, import_react.memo)(({ className, ...props }) => {
|
|
|
3441
3435
|
ColorPickerSelection.displayName = "ColorPickerSelection";
|
|
3442
3436
|
var ColorPickerHue = ({ className, ...props }) => {
|
|
3443
3437
|
const { hue, setHue } = useColorPicker();
|
|
3444
|
-
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
3445
|
-
Slider.
|
|
3446
|
-
{
|
|
3447
|
-
|
|
3448
|
-
max: 360,
|
|
3449
|
-
step: 1,
|
|
3450
|
-
value: [hue],
|
|
3451
|
-
onValueChange: ([h]) => setHue(h),
|
|
3452
|
-
...props,
|
|
3453
|
-
children: [
|
|
3454
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Slider.Track, { className: "relative h-3 w-full grow rounded-full bg-[linear-gradient(90deg,#f00,#ff0,#0f0,#0ff,#00f,#f0f,#f00)]", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Slider.Range, { className: "absolute h-full" }) }),
|
|
3455
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Slider.Thumb, { className: "block h-4 w-4 rounded-full border-2 border-white shadow-md focus:outline-none", style: { boxShadow: "0 0 0 1px rgba(0,0,0,0.4)" } })
|
|
3456
|
-
]
|
|
3457
|
-
}
|
|
3458
|
-
);
|
|
3438
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(Slider.Root, { className: cn("relative flex h-4 w-full touch-none items-center", className), max: 360, step: 1, value: [hue], onValueChange: ([h]) => setHue(h), ...props, children: [
|
|
3439
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Slider.Track, { className: "relative h-3 w-full grow rounded-full bg-[linear-gradient(90deg,#f00,#ff0,#0f0,#0ff,#00f,#f0f,#f00)]", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Slider.Range, { className: "absolute h-full" }) }),
|
|
3440
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Slider.Thumb, { className: "block h-4 w-4 rounded-full border-2 border-white shadow-md focus:outline-none", style: { boxShadow: "0 0 0 1px rgba(0,0,0,0.4)" } })
|
|
3441
|
+
] });
|
|
3459
3442
|
};
|
|
3460
3443
|
var ColorPickerAlpha = ({ className, ...props }) => {
|
|
3461
3444
|
const { alpha, setAlpha, hue, saturation, lightness } = useColorPicker();
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
{
|
|
3466
|
-
|
|
3467
|
-
max: 100,
|
|
3468
|
-
step: 1,
|
|
3469
|
-
value: [alpha],
|
|
3470
|
-
onValueChange: ([a]) => setAlpha(a),
|
|
3471
|
-
...props,
|
|
3472
|
-
children: [
|
|
3473
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3474
|
-
Slider.Track,
|
|
3475
|
-
{
|
|
3476
|
-
className: "relative h-3 w-full grow rounded-full",
|
|
3477
|
-
style: {
|
|
3478
|
-
backgroundImage: `linear-gradient(90deg, transparent, ${solidColor}), url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==")`
|
|
3479
|
-
},
|
|
3480
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Slider.Range, { className: "absolute h-full" })
|
|
3481
|
-
}
|
|
3482
|
-
),
|
|
3483
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Slider.Thumb, { className: "block h-4 w-4 rounded-full border-2 border-white shadow-md focus:outline-none", style: { boxShadow: "0 0 0 1px rgba(0,0,0,0.4)" } })
|
|
3484
|
-
]
|
|
3485
|
-
}
|
|
3486
|
-
);
|
|
3487
|
-
};
|
|
3488
|
-
var ColorPickerHexOutput = ({ className, ...props }) => {
|
|
3489
|
-
const { hue, saturation, lightness, alpha } = useColorPicker();
|
|
3490
|
-
const hex = import_color.default.hsl(hue, saturation, lightness).alpha(alpha / 100).hex();
|
|
3491
|
-
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: cn("flex items-center gap-1.5 px-1", className), ...props, children: [
|
|
3492
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "w-5 h-5 rounded border border-white/20 shrink-0", style: { background: `hsl(${hue},${saturation}%,${lightness}%)` } }),
|
|
3493
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "text-xs font-mono text-white/50 flex-1", children: hex })
|
|
3445
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(Slider.Root, { className: cn("relative flex h-4 w-full touch-none items-center", className), max: 100, step: 1, value: [alpha], onValueChange: ([a]) => setAlpha(a), ...props, children: [
|
|
3446
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Slider.Track, { className: "relative h-3 w-full grow rounded-full", style: {
|
|
3447
|
+
backgroundImage: `linear-gradient(90deg,transparent,hsl(${hue},${saturation}%,${lightness}%)),url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==")`
|
|
3448
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Slider.Range, { className: "absolute h-full" }) }),
|
|
3449
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Slider.Thumb, { className: "block h-4 w-4 rounded-full border-2 border-white shadow-md focus:outline-none", style: { boxShadow: "0 0 0 1px rgba(0,0,0,0.4)" } })
|
|
3494
3450
|
] });
|
|
3495
3451
|
};
|
|
3496
3452
|
var ColorPickerEyeDropper = ({ className, ...props }) => {
|
|
3497
3453
|
const { setHue, setSaturation, setLightness, setAlpha } = useColorPicker();
|
|
3498
|
-
const pick = async () => {
|
|
3499
|
-
try {
|
|
3500
|
-
const result = await new EyeDropper().open();
|
|
3501
|
-
const c = (0, import_color.default)(result.sRGBHex);
|
|
3502
|
-
setHue(c.hue());
|
|
3503
|
-
setSaturation(c.saturationl());
|
|
3504
|
-
setLightness(c.lightness());
|
|
3505
|
-
setAlpha(100);
|
|
3506
|
-
} catch {
|
|
3507
|
-
}
|
|
3508
|
-
};
|
|
3509
3454
|
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3510
3455
|
"button",
|
|
3511
3456
|
{
|
|
3512
3457
|
type: "button",
|
|
3513
|
-
onClick: pick,
|
|
3514
3458
|
title: "Eye dropper",
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3459
|
+
onClick: async () => {
|
|
3460
|
+
try {
|
|
3461
|
+
const r = await new EyeDropper().open();
|
|
3462
|
+
const c = (0, import_color.default)(r.sRGBHex);
|
|
3463
|
+
setHue(c.hue());
|
|
3464
|
+
setSaturation(c.saturationl());
|
|
3465
|
+
setLightness(c.lightness());
|
|
3466
|
+
setAlpha(100);
|
|
3467
|
+
} catch {
|
|
3468
|
+
}
|
|
3469
|
+
},
|
|
3470
|
+
className: cn("shrink-0 focus:outline-none", className),
|
|
3471
|
+
style: { width: 32, height: 32, display: "flex", alignItems: "center", justifyContent: "center", borderRadius: 6, border: "1px solid rgba(255,255,255,0.12)", backgroundColor: "rgba(255,255,255,0.05)", color: "rgba(255,255,255,0.5)", cursor: "pointer" },
|
|
3521
3472
|
...props,
|
|
3522
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("svg", {
|
|
3473
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: [
|
|
3523
3474
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("path", { d: "M9.53 16.122a3 3 0 0 0-5.78 1.128 2.25 2.25 0 0 1-2.4 2.245 4.5 4.5 0 0 0 8.4-2.245c0-.399-.078-.78-.22-1.128Z" }),
|
|
3524
3475
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("path", { d: "m13.5 10.5 2.25-2.25m0 0 2.25-2.25M15.75 8.25l2.25 2.25M15.75 8.25 13.5 6m4.5-1.5 1.5-1.5" }),
|
|
3525
3476
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("path", { d: "M6.75 7.5 10.5 4.5c.5-.375 1.25-.375 1.5 0l6.75 6.75c.375.5.375 1.25 0 1.5L15 16.5" })
|
|
@@ -3529,17 +3480,31 @@ var ColorPickerEyeDropper = ({ className, ...props }) => {
|
|
|
3529
3480
|
};
|
|
3530
3481
|
var ColorPickerOutput = ({ className, ...props }) => {
|
|
3531
3482
|
const { mode, setMode } = useColorPicker();
|
|
3532
|
-
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
3533
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3534
|
-
|
|
3535
|
-
SelectItem,
|
|
3483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: cn("relative shrink-0", className), ...props, children: [
|
|
3484
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3485
|
+
"select",
|
|
3536
3486
|
{
|
|
3537
|
-
value:
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3487
|
+
value: mode,
|
|
3488
|
+
onChange: (e) => setMode(e.target.value),
|
|
3489
|
+
style: {
|
|
3490
|
+
height: 32,
|
|
3491
|
+
width: 72,
|
|
3492
|
+
backgroundColor: "rgba(255,255,255,0.06)",
|
|
3493
|
+
border: "1px solid rgba(255,255,255,0.12)",
|
|
3494
|
+
borderRadius: 6,
|
|
3495
|
+
color: "rgba(255,255,255,0.75)",
|
|
3496
|
+
fontSize: 12,
|
|
3497
|
+
paddingLeft: 8,
|
|
3498
|
+
paddingRight: 24,
|
|
3499
|
+
outline: "none",
|
|
3500
|
+
cursor: "pointer",
|
|
3501
|
+
appearance: "none",
|
|
3502
|
+
WebkitAppearance: "none"
|
|
3503
|
+
},
|
|
3504
|
+
children: ["HEX", "HSL", "RGB"].map((f) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("option", { value: f, style: { backgroundColor: "#1e2130", color: "rgba(255,255,255,0.8)" }, children: f }, f))
|
|
3505
|
+
}
|
|
3506
|
+
),
|
|
3507
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("svg", { style: { position: "absolute", right: 6, top: "50%", transform: "translateY(-50%)", width: 12, height: 12, color: "rgba(255,255,255,0.35)", pointerEvents: "none" }, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("path", { d: "m6 9 6 6 6-6" }) })
|
|
3543
3508
|
] });
|
|
3544
3509
|
};
|
|
3545
3510
|
var ColorPickerFormat = ({ className, ...props }) => {
|
|
@@ -3565,23 +3530,22 @@ var ColorPickerFormat = ({ className, ...props }) => {
|
|
|
3565
3530
|
const tryApply = (raw) => {
|
|
3566
3531
|
try {
|
|
3567
3532
|
if (mode === "HEX") {
|
|
3568
|
-
const
|
|
3569
|
-
const c = (0, import_color.default)(hex);
|
|
3533
|
+
const c = (0, import_color.default)(raw.startsWith("#") ? raw : `#${raw}`);
|
|
3570
3534
|
setHue(c.hue());
|
|
3571
3535
|
setSaturation(c.saturationl());
|
|
3572
3536
|
setLightness(c.lightness());
|
|
3573
3537
|
setAlpha(c.alpha() * 100);
|
|
3574
3538
|
} else if (mode === "HSL") {
|
|
3575
|
-
const
|
|
3576
|
-
if (
|
|
3577
|
-
setHue(+
|
|
3578
|
-
setSaturation(+
|
|
3579
|
-
setLightness(+
|
|
3539
|
+
const p = raw.split(/[\s,%]+/).filter(Boolean);
|
|
3540
|
+
if (p.length >= 3) {
|
|
3541
|
+
setHue(+p[0]);
|
|
3542
|
+
setSaturation(+p[1]);
|
|
3543
|
+
setLightness(+p[2]);
|
|
3580
3544
|
}
|
|
3581
3545
|
} else if (mode === "RGB") {
|
|
3582
|
-
const
|
|
3583
|
-
if (
|
|
3584
|
-
const c = import_color.default.rgb(+
|
|
3546
|
+
const p = raw.split(/[\s,]+/).filter(Boolean);
|
|
3547
|
+
if (p.length >= 3) {
|
|
3548
|
+
const c = import_color.default.rgb(+p[0], +p[1], +p[2]);
|
|
3585
3549
|
setHue(c.hue());
|
|
3586
3550
|
setSaturation(c.saturationl());
|
|
3587
3551
|
setLightness(c.lightness());
|
|
@@ -3607,15 +3571,32 @@ var ColorPickerFormat = ({ className, ...props }) => {
|
|
|
3607
3571
|
tryApply(localVal);
|
|
3608
3572
|
setFocused(false);
|
|
3609
3573
|
},
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3574
|
+
style: {
|
|
3575
|
+
flex: 1,
|
|
3576
|
+
minWidth: 0,
|
|
3577
|
+
height: 32,
|
|
3578
|
+
backgroundColor: "rgba(255,255,255,0.05)",
|
|
3579
|
+
border: "1px solid rgba(255,255,255,0.12)",
|
|
3580
|
+
borderRadius: 6,
|
|
3581
|
+
padding: "0 8px",
|
|
3582
|
+
color: "rgba(255,255,255,0.75)",
|
|
3583
|
+
fontSize: 12,
|
|
3584
|
+
fontFamily: "monospace",
|
|
3585
|
+
outline: "none"
|
|
3586
|
+
},
|
|
3587
|
+
className,
|
|
3615
3588
|
...props
|
|
3616
3589
|
}
|
|
3617
3590
|
);
|
|
3618
3591
|
};
|
|
3592
|
+
var ColorPickerHexOutput = ({ className, ...props }) => {
|
|
3593
|
+
const { hue, saturation, lightness } = useColorPicker();
|
|
3594
|
+
const hex = import_color.default.hsl(hue, saturation, lightness).hex();
|
|
3595
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: cn("flex items-center gap-1.5 px-0.5", className), ...props, children: [
|
|
3596
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "w-5 h-5 rounded border border-white/20 shrink-0", style: { background: `hsl(${hue},${saturation}%,${lightness}%)` } }),
|
|
3597
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "text-xs font-mono text-white/50", children: hex })
|
|
3598
|
+
] });
|
|
3599
|
+
};
|
|
3619
3600
|
|
|
3620
3601
|
// src/components/ui/hsl-color-input.tsx
|
|
3621
3602
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|