@webdevarif/dashui 0.3.4 → 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 +333 -127
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +336 -128
- 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,108 +3315,301 @@ function PostSidebarSection({
|
|
|
3308
3315
|
}
|
|
3309
3316
|
|
|
3310
3317
|
// src/components/ui/hsl-color-input.tsx
|
|
3318
|
+
var import_react2 = require("react");
|
|
3319
|
+
var import_color2 = __toESM(require("color"));
|
|
3320
|
+
var Popover2 = __toESM(require("@radix-ui/react-popover"));
|
|
3321
|
+
|
|
3322
|
+
// src/components/ui/color-picker.tsx
|
|
3323
|
+
var import_color = __toESM(require("color"));
|
|
3311
3324
|
var import_react = require("react");
|
|
3312
|
-
var
|
|
3313
|
-
var import_react_colorful = require("react-colorful");
|
|
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
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
const
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
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);
|
|
3337
3352
|
(0, import_react.useEffect)(() => {
|
|
3338
|
-
|
|
3339
|
-
}, [
|
|
3340
|
-
const
|
|
3341
|
-
const
|
|
3342
|
-
|
|
3343
|
-
const pickerW = 228;
|
|
3344
|
-
let left = rect.left;
|
|
3345
|
-
if (left + pickerW > window.innerWidth - 8) left = window.innerWidth - pickerW - 8;
|
|
3346
|
-
setPos({ top: rect.bottom + 6, left: Math.max(8, left) });
|
|
3347
|
-
setOpen(true);
|
|
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);
|
|
3348
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]);
|
|
3349
3398
|
(0, import_react.useEffect)(() => {
|
|
3350
|
-
if (!
|
|
3351
|
-
const
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
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);
|
|
3356
3406
|
};
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
}, [open]);
|
|
3360
|
-
const cssColor = value ? `hsl(${value})` : "transparent";
|
|
3361
|
-
const picker = /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
3407
|
+
}, [isDragging, handleMove]);
|
|
3408
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3362
3409
|
"div",
|
|
3363
3410
|
{
|
|
3364
|
-
ref:
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
onPointerDown: (e) =>
|
|
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,
|
|
3368
3465
|
children: [
|
|
3369
3466
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3370
|
-
|
|
3467
|
+
Slider.Track,
|
|
3371
3468
|
{
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
}
|
|
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" })
|
|
3378
3474
|
}
|
|
3379
3475
|
),
|
|
3380
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.
|
|
3381
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "w-5 h-5 rounded border border-white/10 shrink-0", style: { background: cssColor } }),
|
|
3382
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "text-xs font-mono text-white/40 flex-1 truncate", children: value || "none" }),
|
|
3383
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3384
|
-
"button",
|
|
3385
|
-
{
|
|
3386
|
-
onClick: () => setOpen(false),
|
|
3387
|
-
className: "text-white/30 hover:text-white/70 text-xs px-1.5 py-0.5 rounded hover:bg-white/5 transition-colors",
|
|
3388
|
-
children: "Done"
|
|
3389
|
-
}
|
|
3390
|
-
)
|
|
3391
|
-
] })
|
|
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)" } })
|
|
3392
3477
|
]
|
|
3393
3478
|
}
|
|
3394
3479
|
);
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
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
|
+
}
|
|
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
|
+
}
|
|
3548
|
+
}
|
|
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;
|
|
3556
|
+
}
|
|
3557
|
+
function HslColorInput({ value, onChange, className, inputClassName, disabled }) {
|
|
3558
|
+
const [open, setOpen] = (0, import_react2.useState)(false);
|
|
3559
|
+
const [inputVal, setInputVal] = (0, import_react2.useState)(value);
|
|
3560
|
+
(0, import_react2.useEffect)(() => {
|
|
3561
|
+
setInputVal(value);
|
|
3562
|
+
}, [value]);
|
|
3563
|
+
const hexValue = hslStringToHex(value);
|
|
3564
|
+
const cssColor = value ? `hsl(${value})` : "transparent";
|
|
3565
|
+
const handlePickerHex = (0, import_react2.useCallback)((hex) => {
|
|
3566
|
+
const hsl = hexToHslString(hex);
|
|
3567
|
+
setInputVal(hsl);
|
|
3568
|
+
onChange(hsl);
|
|
3569
|
+
}, [onChange]);
|
|
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)(
|
|
3573
|
+
"button",
|
|
3574
|
+
{
|
|
3575
|
+
type: "button",
|
|
3576
|
+
disabled,
|
|
3577
|
+
className: cn(
|
|
3578
|
+
"w-5 h-5 rounded border border-white/10 shrink-0 transition-all",
|
|
3579
|
+
"hover:scale-110 hover:border-white/30 focus:outline-none",
|
|
3580
|
+
disabled && "opacity-50 cursor-not-allowed"
|
|
3581
|
+
),
|
|
3582
|
+
style: { background: cssColor },
|
|
3583
|
+
"aria-label": "Pick color"
|
|
3584
|
+
}
|
|
3585
|
+
) }),
|
|
3586
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Popover2.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3587
|
+
Popover2.Content,
|
|
3588
|
+
{
|
|
3589
|
+
sideOffset: 8,
|
|
3590
|
+
align: "start",
|
|
3591
|
+
className: cn(
|
|
3592
|
+
"z-[9999] rounded-xl shadow-2xl p-3 w-[220px]",
|
|
3593
|
+
"bg-[#1a1c2e] border border-white/10",
|
|
3594
|
+
"focus:outline-none"
|
|
3595
|
+
),
|
|
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
|
+
] })
|
|
3606
|
+
] }),
|
|
3607
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ColorPickerHexOutput, {})
|
|
3608
|
+
] })
|
|
3609
|
+
}
|
|
3610
|
+
) })
|
|
3611
|
+
] }),
|
|
3612
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3413
3613
|
"input",
|
|
3414
3614
|
{
|
|
3415
3615
|
type: "text",
|
|
@@ -3430,15 +3630,14 @@ function HslColorInput({ value, onChange, className, inputClassName, disabled })
|
|
|
3430
3630
|
inputClassName
|
|
3431
3631
|
)
|
|
3432
3632
|
}
|
|
3433
|
-
)
|
|
3434
|
-
mounted && open && (0, import_react_dom.createPortal)(picker, document.body)
|
|
3633
|
+
)
|
|
3435
3634
|
] });
|
|
3436
3635
|
}
|
|
3437
3636
|
|
|
3438
3637
|
// src/hooks/index.ts
|
|
3439
|
-
var
|
|
3638
|
+
var import_react3 = require("react");
|
|
3440
3639
|
function useDisclosure(initial = false) {
|
|
3441
|
-
const [isOpen, setIsOpen] = (0,
|
|
3640
|
+
const [isOpen, setIsOpen] = (0, import_react3.useState)(initial);
|
|
3442
3641
|
return {
|
|
3443
3642
|
isOpen,
|
|
3444
3643
|
open: () => setIsOpen(true),
|
|
@@ -3448,15 +3647,15 @@ function useDisclosure(initial = false) {
|
|
|
3448
3647
|
};
|
|
3449
3648
|
}
|
|
3450
3649
|
function usePagination(total, pageSize = 20) {
|
|
3451
|
-
const [page, setPage] = (0,
|
|
3650
|
+
const [page, setPage] = (0, import_react3.useState)(1);
|
|
3452
3651
|
const totalPages = Math.ceil(total / pageSize);
|
|
3453
3652
|
return { page, setPage, pageSize, total, totalPages };
|
|
3454
3653
|
}
|
|
3455
3654
|
|
|
3456
3655
|
// src/components/auth/AuthShell.tsx
|
|
3457
|
-
var
|
|
3656
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
3458
3657
|
function AuthShell({ children, pattern = "dots", maxWidth = "520px" }) {
|
|
3459
|
-
return /* @__PURE__ */ (0,
|
|
3658
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
3460
3659
|
"div",
|
|
3461
3660
|
{
|
|
3462
3661
|
style: {
|
|
@@ -3471,7 +3670,7 @@ function AuthShell({ children, pattern = "dots", maxWidth = "520px" }) {
|
|
|
3471
3670
|
overflow: "hidden"
|
|
3472
3671
|
},
|
|
3473
3672
|
children: [
|
|
3474
|
-
pattern === "dots" && /* @__PURE__ */ (0,
|
|
3673
|
+
pattern === "dots" && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
3475
3674
|
"div",
|
|
3476
3675
|
{
|
|
3477
3676
|
"aria-hidden": true,
|
|
@@ -3485,7 +3684,7 @@ function AuthShell({ children, pattern = "dots", maxWidth = "520px" }) {
|
|
|
3485
3684
|
}
|
|
3486
3685
|
}
|
|
3487
3686
|
),
|
|
3488
|
-
pattern === "grid" && /* @__PURE__ */ (0,
|
|
3687
|
+
pattern === "grid" && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
3489
3688
|
"div",
|
|
3490
3689
|
{
|
|
3491
3690
|
"aria-hidden": true,
|
|
@@ -3499,16 +3698,16 @@ function AuthShell({ children, pattern = "dots", maxWidth = "520px" }) {
|
|
|
3499
3698
|
}
|
|
3500
3699
|
}
|
|
3501
3700
|
),
|
|
3502
|
-
/* @__PURE__ */ (0,
|
|
3701
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { style: { position: "relative", zIndex: 1, width: "100%", maxWidth }, children })
|
|
3503
3702
|
]
|
|
3504
3703
|
}
|
|
3505
3704
|
);
|
|
3506
3705
|
}
|
|
3507
3706
|
|
|
3508
3707
|
// src/components/auth/AuthCard.tsx
|
|
3509
|
-
var
|
|
3708
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
3510
3709
|
function AuthCard({ children, padding = "24px 28px" }) {
|
|
3511
|
-
return /* @__PURE__ */ (0,
|
|
3710
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
3512
3711
|
"div",
|
|
3513
3712
|
{
|
|
3514
3713
|
style: {
|
|
@@ -3525,10 +3724,10 @@ function AuthCard({ children, padding = "24px 28px" }) {
|
|
|
3525
3724
|
}
|
|
3526
3725
|
|
|
3527
3726
|
// src/components/auth/AuthLogo.tsx
|
|
3528
|
-
var
|
|
3727
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
3529
3728
|
function AuthLogo({ appName = "Builify CMS", letter = "B", imageUrl, size = 36 }) {
|
|
3530
|
-
return /* @__PURE__ */ (0,
|
|
3531
|
-
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)(
|
|
3532
3731
|
"img",
|
|
3533
3732
|
{
|
|
3534
3733
|
src: imageUrl,
|
|
@@ -3537,7 +3736,7 @@ function AuthLogo({ appName = "Builify CMS", letter = "B", imageUrl, size = 36 }
|
|
|
3537
3736
|
height: size,
|
|
3538
3737
|
style: { borderRadius: "calc(var(--radius, 0.5rem) * 1.2)", flexShrink: 0, display: "block" }
|
|
3539
3738
|
}
|
|
3540
|
-
) : /* @__PURE__ */ (0,
|
|
3739
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
3541
3740
|
"div",
|
|
3542
3741
|
{
|
|
3543
3742
|
style: {
|
|
@@ -3556,7 +3755,7 @@ function AuthLogo({ appName = "Builify CMS", letter = "B", imageUrl, size = 36 }
|
|
|
3556
3755
|
children: letter
|
|
3557
3756
|
}
|
|
3558
3757
|
),
|
|
3559
|
-
/* @__PURE__ */ (0,
|
|
3758
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
3560
3759
|
"span",
|
|
3561
3760
|
{
|
|
3562
3761
|
style: {
|
|
@@ -3572,10 +3771,10 @@ function AuthLogo({ appName = "Builify CMS", letter = "B", imageUrl, size = 36 }
|
|
|
3572
3771
|
}
|
|
3573
3772
|
|
|
3574
3773
|
// src/components/auth/AuthHeader.tsx
|
|
3575
|
-
var
|
|
3774
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
3576
3775
|
function AuthHeader({ title, description }) {
|
|
3577
|
-
return /* @__PURE__ */ (0,
|
|
3578
|
-
/* @__PURE__ */ (0,
|
|
3776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { style: { marginBottom: "24px", textAlign: "center" }, children: [
|
|
3777
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
3579
3778
|
"h1",
|
|
3580
3779
|
{
|
|
3581
3780
|
style: {
|
|
@@ -3588,7 +3787,7 @@ function AuthHeader({ title, description }) {
|
|
|
3588
3787
|
children: title
|
|
3589
3788
|
}
|
|
3590
3789
|
),
|
|
3591
|
-
description && /* @__PURE__ */ (0,
|
|
3790
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
3592
3791
|
"p",
|
|
3593
3792
|
{
|
|
3594
3793
|
style: {
|
|
@@ -3604,12 +3803,12 @@ function AuthHeader({ title, description }) {
|
|
|
3604
3803
|
}
|
|
3605
3804
|
|
|
3606
3805
|
// src/components/auth/AuthField.tsx
|
|
3607
|
-
var
|
|
3806
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
3608
3807
|
function AuthField({ label, error, hint, rightLabel, id, ...props }) {
|
|
3609
3808
|
const fieldId = id ?? label.toLowerCase().replace(/\s+/g, "-");
|
|
3610
|
-
return /* @__PURE__ */ (0,
|
|
3611
|
-
/* @__PURE__ */ (0,
|
|
3612
|
-
/* @__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)(
|
|
3613
3812
|
"label",
|
|
3614
3813
|
{
|
|
3615
3814
|
htmlFor: fieldId,
|
|
@@ -3621,9 +3820,9 @@ function AuthField({ label, error, hint, rightLabel, id, ...props }) {
|
|
|
3621
3820
|
children: label
|
|
3622
3821
|
}
|
|
3623
3822
|
),
|
|
3624
|
-
rightLabel && /* @__PURE__ */ (0,
|
|
3823
|
+
rightLabel && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { style: { fontSize: "0.8125rem" }, children: rightLabel })
|
|
3625
3824
|
] }),
|
|
3626
|
-
/* @__PURE__ */ (0,
|
|
3825
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
3627
3826
|
"input",
|
|
3628
3827
|
{
|
|
3629
3828
|
id: fieldId,
|
|
@@ -3653,13 +3852,13 @@ function AuthField({ label, error, hint, rightLabel, id, ...props }) {
|
|
|
3653
3852
|
...props
|
|
3654
3853
|
}
|
|
3655
3854
|
),
|
|
3656
|
-
error && /* @__PURE__ */ (0,
|
|
3657
|
-
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 })
|
|
3658
3857
|
] });
|
|
3659
3858
|
}
|
|
3660
3859
|
|
|
3661
3860
|
// src/components/auth/AuthButton.tsx
|
|
3662
|
-
var
|
|
3861
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
3663
3862
|
function AuthButton({
|
|
3664
3863
|
loading,
|
|
3665
3864
|
variant = "primary",
|
|
@@ -3702,7 +3901,7 @@ function AuthButton({
|
|
|
3702
3901
|
color: "var(--foreground)"
|
|
3703
3902
|
}
|
|
3704
3903
|
};
|
|
3705
|
-
return /* @__PURE__ */ (0,
|
|
3904
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
3706
3905
|
"button",
|
|
3707
3906
|
{
|
|
3708
3907
|
disabled: loading || disabled,
|
|
@@ -3714,8 +3913,8 @@ function AuthButton({
|
|
|
3714
3913
|
e.currentTarget.style.filter = "none";
|
|
3715
3914
|
},
|
|
3716
3915
|
...props,
|
|
3717
|
-
children: loading ? /* @__PURE__ */ (0,
|
|
3718
|
-
/* @__PURE__ */ (0,
|
|
3916
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
|
|
3917
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
3719
3918
|
"span",
|
|
3720
3919
|
{
|
|
3721
3920
|
style: {
|
|
@@ -3736,19 +3935,19 @@ function AuthButton({
|
|
|
3736
3935
|
}
|
|
3737
3936
|
|
|
3738
3937
|
// src/components/auth/AuthDivider.tsx
|
|
3739
|
-
var
|
|
3938
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
3740
3939
|
function AuthDivider({ label = "or" }) {
|
|
3741
|
-
return /* @__PURE__ */ (0,
|
|
3742
|
-
/* @__PURE__ */ (0,
|
|
3743
|
-
/* @__PURE__ */ (0,
|
|
3744
|
-
/* @__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)" } })
|
|
3745
3944
|
] });
|
|
3746
3945
|
}
|
|
3747
3946
|
|
|
3748
3947
|
// src/components/auth/AuthFootnote.tsx
|
|
3749
|
-
var
|
|
3948
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
3750
3949
|
function AuthFootnote({ text, linkText, linkHref }) {
|
|
3751
|
-
return /* @__PURE__ */ (0,
|
|
3950
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("p", { style: {
|
|
3752
3951
|
textAlign: "center",
|
|
3753
3952
|
marginTop: "20px",
|
|
3754
3953
|
fontSize: "0.8125rem",
|
|
@@ -3756,7 +3955,7 @@ function AuthFootnote({ text, linkText, linkHref }) {
|
|
|
3756
3955
|
}, children: [
|
|
3757
3956
|
text,
|
|
3758
3957
|
" ",
|
|
3759
|
-
/* @__PURE__ */ (0,
|
|
3958
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
3760
3959
|
"a",
|
|
3761
3960
|
{
|
|
3762
3961
|
href: linkHref,
|
|
@@ -3796,6 +3995,12 @@ var import_next_themes2 = require("next-themes");
|
|
|
3796
3995
|
CardHeader,
|
|
3797
3996
|
CardTitle,
|
|
3798
3997
|
Checkbox,
|
|
3998
|
+
ColorPicker,
|
|
3999
|
+
ColorPickerAlpha,
|
|
4000
|
+
ColorPickerEyeDropper,
|
|
4001
|
+
ColorPickerHexOutput,
|
|
4002
|
+
ColorPickerHue,
|
|
4003
|
+
ColorPickerSelection,
|
|
3799
4004
|
ConfirmDialog,
|
|
3800
4005
|
DashboardLayout,
|
|
3801
4006
|
DataTable,
|
|
@@ -3882,6 +4087,7 @@ var import_next_themes2 = require("next-themes");
|
|
|
3882
4087
|
badgeVariants,
|
|
3883
4088
|
buttonVariants,
|
|
3884
4089
|
cn,
|
|
4090
|
+
useColorPicker,
|
|
3885
4091
|
useDisclosure,
|
|
3886
4092
|
usePagination,
|
|
3887
4093
|
useTheme
|