@webdevarif/dashui 0.3.3 → 0.3.5
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 +26 -2
- package/dist/index.d.ts +26 -2
- package/dist/index.js +325 -85
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +327 -85
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -1
package/dist/index.js
CHANGED
|
@@ -49,6 +49,12 @@ __export(index_exports, {
|
|
|
49
49
|
CardHeader: () => CardHeader,
|
|
50
50
|
CardTitle: () => CardTitle,
|
|
51
51
|
Checkbox: () => Checkbox,
|
|
52
|
+
ColorPicker: () => ColorPicker,
|
|
53
|
+
ColorPickerAlpha: () => ColorPickerAlpha,
|
|
54
|
+
ColorPickerEyeDropper: () => ColorPickerEyeDropper,
|
|
55
|
+
ColorPickerHexOutput: () => ColorPickerHexOutput,
|
|
56
|
+
ColorPickerHue: () => ColorPickerHue,
|
|
57
|
+
ColorPickerSelection: () => ColorPickerSelection,
|
|
52
58
|
ConfirmDialog: () => ConfirmDialog,
|
|
53
59
|
DashboardLayout: () => DashboardLayout,
|
|
54
60
|
DataTable: () => DataTable,
|
|
@@ -135,6 +141,7 @@ __export(index_exports, {
|
|
|
135
141
|
badgeVariants: () => badgeVariants,
|
|
136
142
|
buttonVariants: () => buttonVariants,
|
|
137
143
|
cn: () => cn,
|
|
144
|
+
useColorPicker: () => useColorPicker,
|
|
138
145
|
useDisclosure: () => useDisclosure,
|
|
139
146
|
usePagination: () => usePagination,
|
|
140
147
|
useTheme: () => import_next_themes2.useTheme
|
|
@@ -3308,92 +3315,318 @@ function PostSidebarSection({
|
|
|
3308
3315
|
}
|
|
3309
3316
|
|
|
3310
3317
|
// src/components/ui/hsl-color-input.tsx
|
|
3311
|
-
var
|
|
3312
|
-
var
|
|
3318
|
+
var import_react2 = require("react");
|
|
3319
|
+
var import_color2 = __toESM(require("color"));
|
|
3313
3320
|
var Popover2 = __toESM(require("@radix-ui/react-popover"));
|
|
3321
|
+
|
|
3322
|
+
// src/components/ui/color-picker.tsx
|
|
3323
|
+
var import_color = __toESM(require("color"));
|
|
3324
|
+
var import_react = require("react");
|
|
3325
|
+
var Slider = __toESM(require("@radix-ui/react-slider"));
|
|
3314
3326
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
const
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3327
|
+
var ColorPickerContext = (0, import_react.createContext)(void 0);
|
|
3328
|
+
var useColorPicker = () => {
|
|
3329
|
+
const ctx = (0, import_react.useContext)(ColorPickerContext);
|
|
3330
|
+
if (!ctx) throw new Error("useColorPicker must be used within ColorPicker");
|
|
3331
|
+
return ctx;
|
|
3332
|
+
};
|
|
3333
|
+
var ColorPicker = ({
|
|
3334
|
+
defaultValue = "#000000",
|
|
3335
|
+
onChange,
|
|
3336
|
+
className,
|
|
3337
|
+
children,
|
|
3338
|
+
...props
|
|
3339
|
+
}) => {
|
|
3340
|
+
const initial = (() => {
|
|
3341
|
+
try {
|
|
3342
|
+
return (0, import_color.default)(defaultValue);
|
|
3343
|
+
} catch {
|
|
3344
|
+
return (0, import_color.default)("#000000");
|
|
3345
|
+
}
|
|
3346
|
+
})();
|
|
3347
|
+
const [hue, setHueState] = (0, import_react.useState)(initial.hue());
|
|
3348
|
+
const [saturation, setSaturationState] = (0, import_react.useState)(initial.saturationl());
|
|
3349
|
+
const [lightness, setLightnessState] = (0, import_react.useState)(initial.lightness());
|
|
3350
|
+
const [alpha, setAlphaState] = (0, import_react.useState)(initial.alpha() * 100);
|
|
3351
|
+
const notifyRef = (0, import_react.useRef)(onChange);
|
|
3352
|
+
(0, import_react.useEffect)(() => {
|
|
3353
|
+
notifyRef.current = onChange;
|
|
3354
|
+
}, [onChange]);
|
|
3355
|
+
const notify = (0, import_react.useCallback)((h, s, l, a) => {
|
|
3356
|
+
const hex = import_color.default.hsl(h, s, l).alpha(a / 100).hexa();
|
|
3357
|
+
notifyRef.current?.(hex);
|
|
3358
|
+
}, []);
|
|
3359
|
+
const setHue = (0, import_react.useCallback)((h) => {
|
|
3360
|
+
setHueState(h);
|
|
3361
|
+
notify(h, saturation, lightness, alpha);
|
|
3362
|
+
}, [saturation, lightness, alpha, notify]);
|
|
3363
|
+
const setSaturation = (0, import_react.useCallback)((s) => {
|
|
3364
|
+
setSaturationState(s);
|
|
3365
|
+
notify(hue, s, lightness, alpha);
|
|
3366
|
+
}, [hue, lightness, alpha, notify]);
|
|
3367
|
+
const setLightness = (0, import_react.useCallback)((l) => {
|
|
3368
|
+
setLightnessState(l);
|
|
3369
|
+
notify(hue, saturation, l, alpha);
|
|
3370
|
+
}, [hue, saturation, alpha, notify]);
|
|
3371
|
+
const setAlpha = (0, import_react.useCallback)((a) => {
|
|
3372
|
+
setAlphaState(a);
|
|
3373
|
+
notify(hue, saturation, lightness, a);
|
|
3374
|
+
}, [hue, saturation, lightness, notify]);
|
|
3375
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ColorPickerContext.Provider, { value: { hue, saturation, lightness, alpha, setHue, setSaturation, setLightness, setAlpha }, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: cn("flex flex-col gap-3", className), ...props, children }) });
|
|
3376
|
+
};
|
|
3377
|
+
var ColorPickerSelection = (0, import_react.memo)(({ className, ...props }) => {
|
|
3378
|
+
const containerRef = (0, import_react.useRef)(null);
|
|
3379
|
+
const [isDragging, setIsDragging] = (0, import_react.useState)(false);
|
|
3380
|
+
const [posX, setPosX] = (0, import_react.useState)(0);
|
|
3381
|
+
const [posY, setPosY] = (0, import_react.useState)(0);
|
|
3382
|
+
const { hue, setSaturation, setLightness } = useColorPicker();
|
|
3383
|
+
const bg = (0, import_react.useMemo)(
|
|
3384
|
+
() => `linear-gradient(0deg,rgba(0,0,0,1),rgba(0,0,0,0)),linear-gradient(90deg,rgba(255,255,255,1),rgba(255,255,255,0)),hsl(${hue},100%,50%)`,
|
|
3385
|
+
[hue]
|
|
3386
|
+
);
|
|
3387
|
+
const handleMove = (0, import_react.useCallback)((e) => {
|
|
3388
|
+
if (!isDragging || !containerRef.current) return;
|
|
3389
|
+
const rect = containerRef.current.getBoundingClientRect();
|
|
3390
|
+
const x = Math.max(0, Math.min(1, (e.clientX - rect.left) / rect.width));
|
|
3391
|
+
const y = Math.max(0, Math.min(1, (e.clientY - rect.top) / rect.height));
|
|
3392
|
+
setPosX(x);
|
|
3393
|
+
setPosY(y);
|
|
3394
|
+
setSaturation(x * 100);
|
|
3395
|
+
const topL = x < 0.01 ? 100 : 50 + 50 * (1 - x);
|
|
3396
|
+
setLightness(topL * (1 - y));
|
|
3397
|
+
}, [isDragging, setSaturation, setLightness]);
|
|
3398
|
+
(0, import_react.useEffect)(() => {
|
|
3399
|
+
if (!isDragging) return;
|
|
3400
|
+
const up = () => setIsDragging(false);
|
|
3401
|
+
window.addEventListener("pointermove", handleMove);
|
|
3402
|
+
window.addEventListener("pointerup", up);
|
|
3403
|
+
return () => {
|
|
3404
|
+
window.removeEventListener("pointermove", handleMove);
|
|
3405
|
+
window.removeEventListener("pointerup", up);
|
|
3406
|
+
};
|
|
3407
|
+
}, [isDragging, handleMove]);
|
|
3408
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3409
|
+
"div",
|
|
3410
|
+
{
|
|
3411
|
+
ref: containerRef,
|
|
3412
|
+
className: cn("relative w-full cursor-crosshair rounded-lg", className),
|
|
3413
|
+
style: { background: bg },
|
|
3414
|
+
onPointerDown: (e) => {
|
|
3415
|
+
e.preventDefault();
|
|
3416
|
+
setIsDragging(true);
|
|
3417
|
+
handleMove(e.nativeEvent);
|
|
3418
|
+
},
|
|
3419
|
+
...props,
|
|
3420
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3421
|
+
"div",
|
|
3422
|
+
{
|
|
3423
|
+
className: "pointer-events-none absolute h-4 w-4 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white",
|
|
3424
|
+
style: {
|
|
3425
|
+
left: `${posX * 100}%`,
|
|
3426
|
+
top: `${posY * 100}%`,
|
|
3427
|
+
boxShadow: "0 0 0 1px rgba(0,0,0,0.6)"
|
|
3428
|
+
}
|
|
3429
|
+
}
|
|
3430
|
+
)
|
|
3431
|
+
}
|
|
3432
|
+
);
|
|
3433
|
+
});
|
|
3434
|
+
ColorPickerSelection.displayName = "ColorPickerSelection";
|
|
3435
|
+
var ColorPickerHue = ({ className, ...props }) => {
|
|
3436
|
+
const { hue, setHue } = useColorPicker();
|
|
3437
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
3438
|
+
Slider.Root,
|
|
3439
|
+
{
|
|
3440
|
+
className: cn("relative flex h-4 w-full touch-none items-center", className),
|
|
3441
|
+
max: 360,
|
|
3442
|
+
step: 1,
|
|
3443
|
+
value: [hue],
|
|
3444
|
+
onValueChange: ([h]) => setHue(h),
|
|
3445
|
+
...props,
|
|
3446
|
+
children: [
|
|
3447
|
+
/* @__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" }) }),
|
|
3448
|
+
/* @__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)" } })
|
|
3449
|
+
]
|
|
3450
|
+
}
|
|
3451
|
+
);
|
|
3452
|
+
};
|
|
3453
|
+
var ColorPickerAlpha = ({ className, ...props }) => {
|
|
3454
|
+
const { alpha, setAlpha, hue, saturation, lightness } = useColorPicker();
|
|
3455
|
+
const solidColor = `hsl(${hue},${saturation}%,${lightness}%)`;
|
|
3456
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
3457
|
+
Slider.Root,
|
|
3458
|
+
{
|
|
3459
|
+
className: cn("relative flex h-4 w-full touch-none items-center", className),
|
|
3460
|
+
max: 100,
|
|
3461
|
+
step: 1,
|
|
3462
|
+
value: [alpha],
|
|
3463
|
+
onValueChange: ([a]) => setAlpha(a),
|
|
3464
|
+
...props,
|
|
3465
|
+
children: [
|
|
3466
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3467
|
+
Slider.Track,
|
|
3468
|
+
{
|
|
3469
|
+
className: "relative h-3 w-full grow rounded-full",
|
|
3470
|
+
style: {
|
|
3471
|
+
backgroundImage: `linear-gradient(90deg, transparent, ${solidColor}), url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==")`
|
|
3472
|
+
},
|
|
3473
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Slider.Range, { className: "absolute h-full" })
|
|
3474
|
+
}
|
|
3475
|
+
),
|
|
3476
|
+
/* @__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)" } })
|
|
3477
|
+
]
|
|
3478
|
+
}
|
|
3479
|
+
);
|
|
3480
|
+
};
|
|
3481
|
+
var ColorPickerHexOutput = ({ className, ...props }) => {
|
|
3482
|
+
const { hue, saturation, lightness, alpha } = useColorPicker();
|
|
3483
|
+
const hex = import_color.default.hsl(hue, saturation, lightness).alpha(alpha / 100).hex();
|
|
3484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: cn("flex items-center gap-1.5 px-1", className), ...props, children: [
|
|
3485
|
+
/* @__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}%)` } }),
|
|
3486
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "text-xs font-mono text-white/50 flex-1", children: hex })
|
|
3487
|
+
] });
|
|
3488
|
+
};
|
|
3489
|
+
var ColorPickerEyeDropper = ({ className, ...props }) => {
|
|
3490
|
+
const { setHue, setSaturation, setLightness, setAlpha } = useColorPicker();
|
|
3491
|
+
const pick = async () => {
|
|
3492
|
+
try {
|
|
3493
|
+
const result = await new EyeDropper().open();
|
|
3494
|
+
const c = (0, import_color.default)(result.sRGBHex);
|
|
3495
|
+
setHue(c.hue());
|
|
3496
|
+
setSaturation(c.saturationl());
|
|
3497
|
+
setLightness(c.lightness());
|
|
3498
|
+
setAlpha(100);
|
|
3499
|
+
} catch {
|
|
3500
|
+
}
|
|
3322
3501
|
};
|
|
3502
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3503
|
+
"button",
|
|
3504
|
+
{
|
|
3505
|
+
type: "button",
|
|
3506
|
+
onClick: pick,
|
|
3507
|
+
title: "Eye dropper",
|
|
3508
|
+
className: cn(
|
|
3509
|
+
"w-7 h-7 flex items-center justify-center rounded-md",
|
|
3510
|
+
"border border-white/10 text-white/40 hover:text-white/70 hover:border-white/25",
|
|
3511
|
+
"transition-colors shrink-0",
|
|
3512
|
+
className
|
|
3513
|
+
),
|
|
3514
|
+
...props,
|
|
3515
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: [
|
|
3516
|
+
/* @__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" }),
|
|
3517
|
+
/* @__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" }),
|
|
3518
|
+
/* @__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" })
|
|
3519
|
+
] })
|
|
3520
|
+
}
|
|
3521
|
+
);
|
|
3522
|
+
};
|
|
3523
|
+
|
|
3524
|
+
// src/components/ui/hsl-color-input.tsx
|
|
3525
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
3526
|
+
function hslStringToHex(hsl) {
|
|
3527
|
+
if (!hsl) return "#000000";
|
|
3528
|
+
try {
|
|
3529
|
+
const parts = hsl.trim().split(/\s+/);
|
|
3530
|
+
const h = parseFloat(parts[0]) || 0;
|
|
3531
|
+
const s = parseFloat(parts[1]) || 0;
|
|
3532
|
+
const l = parseFloat(parts[2]) || 0;
|
|
3533
|
+
return import_color2.default.hsl(h, s, l).hex();
|
|
3534
|
+
} catch {
|
|
3535
|
+
return "#000000";
|
|
3536
|
+
}
|
|
3537
|
+
}
|
|
3538
|
+
function hexToHslString(hex) {
|
|
3539
|
+
try {
|
|
3540
|
+
const c = (0, import_color2.default)(hex);
|
|
3541
|
+
const h = Math.round(c.hue());
|
|
3542
|
+
const s = Math.round(c.saturationl());
|
|
3543
|
+
const l = Math.round(c.lightness());
|
|
3544
|
+
return `${h} ${s}% ${l}%`;
|
|
3545
|
+
} catch {
|
|
3546
|
+
return "0 0% 0%";
|
|
3547
|
+
}
|
|
3323
3548
|
}
|
|
3324
|
-
function
|
|
3325
|
-
|
|
3549
|
+
function ColorReader({ onHexChange }) {
|
|
3550
|
+
const { hue, saturation, lightness, alpha } = useColorPicker();
|
|
3551
|
+
(0, import_react2.useEffect)(() => {
|
|
3552
|
+
const hex = import_color2.default.hsl(hue, saturation, lightness).alpha(alpha / 100).hex();
|
|
3553
|
+
onHexChange(hex);
|
|
3554
|
+
}, [hue, saturation, lightness, alpha, onHexChange]);
|
|
3555
|
+
return null;
|
|
3326
3556
|
}
|
|
3327
3557
|
function HslColorInput({ value, onChange, className, inputClassName, disabled }) {
|
|
3328
|
-
const [
|
|
3329
|
-
(0,
|
|
3558
|
+
const [open, setOpen] = (0, import_react2.useState)(false);
|
|
3559
|
+
const [inputVal, setInputVal] = (0, import_react2.useState)(value);
|
|
3560
|
+
(0, import_react2.useEffect)(() => {
|
|
3330
3561
|
setInputVal(value);
|
|
3331
3562
|
}, [value]);
|
|
3332
|
-
const
|
|
3563
|
+
const hexValue = hslStringToHex(value);
|
|
3333
3564
|
const cssColor = value ? `hsl(${value})` : "transparent";
|
|
3334
|
-
const
|
|
3335
|
-
const
|
|
3336
|
-
setInputVal(
|
|
3337
|
-
onChange(
|
|
3565
|
+
const handlePickerHex = (0, import_react2.useCallback)((hex) => {
|
|
3566
|
+
const hsl = hexToHslString(hex);
|
|
3567
|
+
setInputVal(hsl);
|
|
3568
|
+
onChange(hsl);
|
|
3338
3569
|
}, [onChange]);
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
if (/^\d+(\.\d+)?\s+\d+(\.\d+)?%?\s+\d+(\.\d+)?%?$/.test(v.trim())) {
|
|
3343
|
-
onChange(v);
|
|
3344
|
-
}
|
|
3345
|
-
};
|
|
3346
|
-
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: cn("flex items-center gap-1.5", className), children: [
|
|
3347
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(Popover2.Root, { children: [
|
|
3348
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Popover2.Trigger, { asChild: true, disabled, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3570
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: cn("flex items-center gap-1.5", className), children: [
|
|
3571
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(Popover2.Root, { open, onOpenChange: disabled ? void 0 : setOpen, children: [
|
|
3572
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Popover2.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3349
3573
|
"button",
|
|
3350
3574
|
{
|
|
3351
3575
|
type: "button",
|
|
3576
|
+
disabled,
|
|
3352
3577
|
className: cn(
|
|
3353
3578
|
"w-5 h-5 rounded border border-white/10 shrink-0 transition-all",
|
|
3354
|
-
"hover:scale-110 hover:border-white/30 focus:outline-none
|
|
3579
|
+
"hover:scale-110 hover:border-white/30 focus:outline-none",
|
|
3355
3580
|
disabled && "opacity-50 cursor-not-allowed"
|
|
3356
3581
|
),
|
|
3357
3582
|
style: { background: cssColor },
|
|
3358
|
-
"aria-label": "
|
|
3583
|
+
"aria-label": "Pick color"
|
|
3359
3584
|
}
|
|
3360
3585
|
) }),
|
|
3361
|
-
/* @__PURE__ */ (0,
|
|
3586
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Popover2.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3362
3587
|
Popover2.Content,
|
|
3363
3588
|
{
|
|
3364
3589
|
sideOffset: 8,
|
|
3365
3590
|
align: "start",
|
|
3366
3591
|
className: cn(
|
|
3367
|
-
"z-[9999] rounded-xl shadow-2xl p-3",
|
|
3592
|
+
"z-[9999] rounded-xl shadow-2xl p-3 w-[220px]",
|
|
3368
3593
|
"bg-[#1a1c2e] border border-white/10",
|
|
3369
|
-
"
|
|
3370
|
-
"animate-in fade-in-0 zoom-in-95"
|
|
3594
|
+
"focus:outline-none"
|
|
3371
3595
|
),
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
/* @__PURE__ */ (0,
|
|
3375
|
-
|
|
3376
|
-
|
|
3596
|
+
onInteractOutside: () => setOpen(false),
|
|
3597
|
+
children: open && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(ColorPicker, { defaultValue: hexValue, children: [
|
|
3598
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ColorReader, { onHexChange: handlePickerHex }),
|
|
3599
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ColorPickerSelection, { className: "h-36 rounded-lg" }),
|
|
3600
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3601
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ColorPickerEyeDropper, {}),
|
|
3602
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col gap-1.5 flex-1", children: [
|
|
3603
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ColorPickerHue, {}),
|
|
3604
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ColorPickerAlpha, {})
|
|
3605
|
+
] })
|
|
3377
3606
|
] }),
|
|
3378
|
-
/* @__PURE__ */ (0,
|
|
3379
|
-
]
|
|
3607
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ColorPickerHexOutput, {})
|
|
3608
|
+
] })
|
|
3380
3609
|
}
|
|
3381
3610
|
) })
|
|
3382
3611
|
] }),
|
|
3383
|
-
/* @__PURE__ */ (0,
|
|
3612
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3384
3613
|
"input",
|
|
3385
3614
|
{
|
|
3386
3615
|
type: "text",
|
|
3387
3616
|
value: inputVal,
|
|
3388
|
-
onChange:
|
|
3617
|
+
onChange: (e) => {
|
|
3618
|
+
setInputVal(e.target.value);
|
|
3619
|
+
if (/^\d+(\.\d+)?\s+\d+(\.\d+)?%\s+\d+(\.\d+)?%$/.test(e.target.value.trim())) {
|
|
3620
|
+
onChange(e.target.value.trim());
|
|
3621
|
+
}
|
|
3622
|
+
},
|
|
3389
3623
|
onBlur: () => setInputVal(value),
|
|
3390
3624
|
disabled,
|
|
3391
3625
|
placeholder: "H S% L%",
|
|
3392
3626
|
className: cn(
|
|
3393
3627
|
"w-28 bg-white/5 border border-white/10 rounded px-1.5 py-0.5",
|
|
3394
|
-
"text-xs text-white/70 font-mono outline-none",
|
|
3395
|
-
"
|
|
3396
|
-
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
3628
|
+
"text-xs text-white/70 font-mono outline-none focus:border-white/30",
|
|
3629
|
+
"placeholder:text-white/20 disabled:opacity-50",
|
|
3397
3630
|
inputClassName
|
|
3398
3631
|
)
|
|
3399
3632
|
}
|
|
@@ -3402,9 +3635,9 @@ function HslColorInput({ value, onChange, className, inputClassName, disabled })
|
|
|
3402
3635
|
}
|
|
3403
3636
|
|
|
3404
3637
|
// src/hooks/index.ts
|
|
3405
|
-
var
|
|
3638
|
+
var import_react3 = require("react");
|
|
3406
3639
|
function useDisclosure(initial = false) {
|
|
3407
|
-
const [isOpen, setIsOpen] = (0,
|
|
3640
|
+
const [isOpen, setIsOpen] = (0, import_react3.useState)(initial);
|
|
3408
3641
|
return {
|
|
3409
3642
|
isOpen,
|
|
3410
3643
|
open: () => setIsOpen(true),
|
|
@@ -3414,15 +3647,15 @@ function useDisclosure(initial = false) {
|
|
|
3414
3647
|
};
|
|
3415
3648
|
}
|
|
3416
3649
|
function usePagination(total, pageSize = 20) {
|
|
3417
|
-
const [page, setPage] = (0,
|
|
3650
|
+
const [page, setPage] = (0, import_react3.useState)(1);
|
|
3418
3651
|
const totalPages = Math.ceil(total / pageSize);
|
|
3419
3652
|
return { page, setPage, pageSize, total, totalPages };
|
|
3420
3653
|
}
|
|
3421
3654
|
|
|
3422
3655
|
// src/components/auth/AuthShell.tsx
|
|
3423
|
-
var
|
|
3656
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
3424
3657
|
function AuthShell({ children, pattern = "dots", maxWidth = "520px" }) {
|
|
3425
|
-
return /* @__PURE__ */ (0,
|
|
3658
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
3426
3659
|
"div",
|
|
3427
3660
|
{
|
|
3428
3661
|
style: {
|
|
@@ -3437,7 +3670,7 @@ function AuthShell({ children, pattern = "dots", maxWidth = "520px" }) {
|
|
|
3437
3670
|
overflow: "hidden"
|
|
3438
3671
|
},
|
|
3439
3672
|
children: [
|
|
3440
|
-
pattern === "dots" && /* @__PURE__ */ (0,
|
|
3673
|
+
pattern === "dots" && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
3441
3674
|
"div",
|
|
3442
3675
|
{
|
|
3443
3676
|
"aria-hidden": true,
|
|
@@ -3451,7 +3684,7 @@ function AuthShell({ children, pattern = "dots", maxWidth = "520px" }) {
|
|
|
3451
3684
|
}
|
|
3452
3685
|
}
|
|
3453
3686
|
),
|
|
3454
|
-
pattern === "grid" && /* @__PURE__ */ (0,
|
|
3687
|
+
pattern === "grid" && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
3455
3688
|
"div",
|
|
3456
3689
|
{
|
|
3457
3690
|
"aria-hidden": true,
|
|
@@ -3465,16 +3698,16 @@ function AuthShell({ children, pattern = "dots", maxWidth = "520px" }) {
|
|
|
3465
3698
|
}
|
|
3466
3699
|
}
|
|
3467
3700
|
),
|
|
3468
|
-
/* @__PURE__ */ (0,
|
|
3701
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { style: { position: "relative", zIndex: 1, width: "100%", maxWidth }, children })
|
|
3469
3702
|
]
|
|
3470
3703
|
}
|
|
3471
3704
|
);
|
|
3472
3705
|
}
|
|
3473
3706
|
|
|
3474
3707
|
// src/components/auth/AuthCard.tsx
|
|
3475
|
-
var
|
|
3708
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
3476
3709
|
function AuthCard({ children, padding = "24px 28px" }) {
|
|
3477
|
-
return /* @__PURE__ */ (0,
|
|
3710
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
3478
3711
|
"div",
|
|
3479
3712
|
{
|
|
3480
3713
|
style: {
|
|
@@ -3491,10 +3724,10 @@ function AuthCard({ children, padding = "24px 28px" }) {
|
|
|
3491
3724
|
}
|
|
3492
3725
|
|
|
3493
3726
|
// src/components/auth/AuthLogo.tsx
|
|
3494
|
-
var
|
|
3727
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
3495
3728
|
function AuthLogo({ appName = "Builify CMS", letter = "B", imageUrl, size = 36 }) {
|
|
3496
|
-
return /* @__PURE__ */ (0,
|
|
3497
|
-
imageUrl ? /* @__PURE__ */ (0,
|
|
3729
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: "10px", marginBottom: "28px" }, children: [
|
|
3730
|
+
imageUrl ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
3498
3731
|
"img",
|
|
3499
3732
|
{
|
|
3500
3733
|
src: imageUrl,
|
|
@@ -3503,7 +3736,7 @@ function AuthLogo({ appName = "Builify CMS", letter = "B", imageUrl, size = 36 }
|
|
|
3503
3736
|
height: size,
|
|
3504
3737
|
style: { borderRadius: "calc(var(--radius, 0.5rem) * 1.2)", flexShrink: 0, display: "block" }
|
|
3505
3738
|
}
|
|
3506
|
-
) : /* @__PURE__ */ (0,
|
|
3739
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
3507
3740
|
"div",
|
|
3508
3741
|
{
|
|
3509
3742
|
style: {
|
|
@@ -3522,7 +3755,7 @@ function AuthLogo({ appName = "Builify CMS", letter = "B", imageUrl, size = 36 }
|
|
|
3522
3755
|
children: letter
|
|
3523
3756
|
}
|
|
3524
3757
|
),
|
|
3525
|
-
/* @__PURE__ */ (0,
|
|
3758
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
3526
3759
|
"span",
|
|
3527
3760
|
{
|
|
3528
3761
|
style: {
|
|
@@ -3538,10 +3771,10 @@ function AuthLogo({ appName = "Builify CMS", letter = "B", imageUrl, size = 36 }
|
|
|
3538
3771
|
}
|
|
3539
3772
|
|
|
3540
3773
|
// src/components/auth/AuthHeader.tsx
|
|
3541
|
-
var
|
|
3774
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
3542
3775
|
function AuthHeader({ title, description }) {
|
|
3543
|
-
return /* @__PURE__ */ (0,
|
|
3544
|
-
/* @__PURE__ */ (0,
|
|
3776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { style: { marginBottom: "24px", textAlign: "center" }, children: [
|
|
3777
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
3545
3778
|
"h1",
|
|
3546
3779
|
{
|
|
3547
3780
|
style: {
|
|
@@ -3554,7 +3787,7 @@ function AuthHeader({ title, description }) {
|
|
|
3554
3787
|
children: title
|
|
3555
3788
|
}
|
|
3556
3789
|
),
|
|
3557
|
-
description && /* @__PURE__ */ (0,
|
|
3790
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
3558
3791
|
"p",
|
|
3559
3792
|
{
|
|
3560
3793
|
style: {
|
|
@@ -3570,12 +3803,12 @@ function AuthHeader({ title, description }) {
|
|
|
3570
3803
|
}
|
|
3571
3804
|
|
|
3572
3805
|
// src/components/auth/AuthField.tsx
|
|
3573
|
-
var
|
|
3806
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
3574
3807
|
function AuthField({ label, error, hint, rightLabel, id, ...props }) {
|
|
3575
3808
|
const fieldId = id ?? label.toLowerCase().replace(/\s+/g, "-");
|
|
3576
|
-
return /* @__PURE__ */ (0,
|
|
3577
|
-
/* @__PURE__ */ (0,
|
|
3578
|
-
/* @__PURE__ */ (0,
|
|
3809
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: "6px" }, children: [
|
|
3810
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
|
|
3811
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
3579
3812
|
"label",
|
|
3580
3813
|
{
|
|
3581
3814
|
htmlFor: fieldId,
|
|
@@ -3587,9 +3820,9 @@ function AuthField({ label, error, hint, rightLabel, id, ...props }) {
|
|
|
3587
3820
|
children: label
|
|
3588
3821
|
}
|
|
3589
3822
|
),
|
|
3590
|
-
rightLabel && /* @__PURE__ */ (0,
|
|
3823
|
+
rightLabel && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { style: { fontSize: "0.8125rem" }, children: rightLabel })
|
|
3591
3824
|
] }),
|
|
3592
|
-
/* @__PURE__ */ (0,
|
|
3825
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
3593
3826
|
"input",
|
|
3594
3827
|
{
|
|
3595
3828
|
id: fieldId,
|
|
@@ -3619,13 +3852,13 @@ function AuthField({ label, error, hint, rightLabel, id, ...props }) {
|
|
|
3619
3852
|
...props
|
|
3620
3853
|
}
|
|
3621
3854
|
),
|
|
3622
|
-
error && /* @__PURE__ */ (0,
|
|
3623
|
-
hint && !error && /* @__PURE__ */ (0,
|
|
3855
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { style: { fontSize: "0.8rem", color: "var(--destructive)", margin: 0 }, children: error }),
|
|
3856
|
+
hint && !error && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { style: { fontSize: "0.8rem", color: "var(--muted-foreground)", margin: 0 }, children: hint })
|
|
3624
3857
|
] });
|
|
3625
3858
|
}
|
|
3626
3859
|
|
|
3627
3860
|
// src/components/auth/AuthButton.tsx
|
|
3628
|
-
var
|
|
3861
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
3629
3862
|
function AuthButton({
|
|
3630
3863
|
loading,
|
|
3631
3864
|
variant = "primary",
|
|
@@ -3668,7 +3901,7 @@ function AuthButton({
|
|
|
3668
3901
|
color: "var(--foreground)"
|
|
3669
3902
|
}
|
|
3670
3903
|
};
|
|
3671
|
-
return /* @__PURE__ */ (0,
|
|
3904
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
3672
3905
|
"button",
|
|
3673
3906
|
{
|
|
3674
3907
|
disabled: loading || disabled,
|
|
@@ -3680,8 +3913,8 @@ function AuthButton({
|
|
|
3680
3913
|
e.currentTarget.style.filter = "none";
|
|
3681
3914
|
},
|
|
3682
3915
|
...props,
|
|
3683
|
-
children: loading ? /* @__PURE__ */ (0,
|
|
3684
|
-
/* @__PURE__ */ (0,
|
|
3916
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
|
|
3917
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
3685
3918
|
"span",
|
|
3686
3919
|
{
|
|
3687
3920
|
style: {
|
|
@@ -3702,19 +3935,19 @@ function AuthButton({
|
|
|
3702
3935
|
}
|
|
3703
3936
|
|
|
3704
3937
|
// src/components/auth/AuthDivider.tsx
|
|
3705
|
-
var
|
|
3938
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
3706
3939
|
function AuthDivider({ label = "or" }) {
|
|
3707
|
-
return /* @__PURE__ */ (0,
|
|
3708
|
-
/* @__PURE__ */ (0,
|
|
3709
|
-
/* @__PURE__ */ (0,
|
|
3710
|
-
/* @__PURE__ */ (0,
|
|
3940
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "12px", margin: "20px 0" }, children: [
|
|
3941
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { style: { flex: 1, height: 1, background: "var(--border)" } }),
|
|
3942
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { style: { fontSize: "0.75rem", color: "var(--muted-foreground)", userSelect: "none" }, children: label }),
|
|
3943
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { style: { flex: 1, height: 1, background: "var(--border)" } })
|
|
3711
3944
|
] });
|
|
3712
3945
|
}
|
|
3713
3946
|
|
|
3714
3947
|
// src/components/auth/AuthFootnote.tsx
|
|
3715
|
-
var
|
|
3948
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
3716
3949
|
function AuthFootnote({ text, linkText, linkHref }) {
|
|
3717
|
-
return /* @__PURE__ */ (0,
|
|
3950
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("p", { style: {
|
|
3718
3951
|
textAlign: "center",
|
|
3719
3952
|
marginTop: "20px",
|
|
3720
3953
|
fontSize: "0.8125rem",
|
|
@@ -3722,7 +3955,7 @@ function AuthFootnote({ text, linkText, linkHref }) {
|
|
|
3722
3955
|
}, children: [
|
|
3723
3956
|
text,
|
|
3724
3957
|
" ",
|
|
3725
|
-
/* @__PURE__ */ (0,
|
|
3958
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
3726
3959
|
"a",
|
|
3727
3960
|
{
|
|
3728
3961
|
href: linkHref,
|
|
@@ -3762,6 +3995,12 @@ var import_next_themes2 = require("next-themes");
|
|
|
3762
3995
|
CardHeader,
|
|
3763
3996
|
CardTitle,
|
|
3764
3997
|
Checkbox,
|
|
3998
|
+
ColorPicker,
|
|
3999
|
+
ColorPickerAlpha,
|
|
4000
|
+
ColorPickerEyeDropper,
|
|
4001
|
+
ColorPickerHexOutput,
|
|
4002
|
+
ColorPickerHue,
|
|
4003
|
+
ColorPickerSelection,
|
|
3765
4004
|
ConfirmDialog,
|
|
3766
4005
|
DashboardLayout,
|
|
3767
4006
|
DataTable,
|
|
@@ -3848,6 +4087,7 @@ var import_next_themes2 = require("next-themes");
|
|
|
3848
4087
|
badgeVariants,
|
|
3849
4088
|
buttonVariants,
|
|
3850
4089
|
cn,
|
|
4090
|
+
useColorPicker,
|
|
3851
4091
|
useDisclosure,
|
|
3852
4092
|
usePagination,
|
|
3853
4093
|
useTheme
|