@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.mjs
CHANGED
|
@@ -3165,108 +3165,310 @@ function PostSidebarSection({
|
|
|
3165
3165
|
}
|
|
3166
3166
|
|
|
3167
3167
|
// src/components/ui/hsl-color-input.tsx
|
|
3168
|
-
import { useState as
|
|
3169
|
-
import
|
|
3170
|
-
import
|
|
3168
|
+
import { useState as useState8, useEffect as useEffect6, useCallback as useCallback2 } from "react";
|
|
3169
|
+
import Color2 from "color";
|
|
3170
|
+
import * as Popover2 from "@radix-ui/react-popover";
|
|
3171
|
+
|
|
3172
|
+
// src/components/ui/color-picker.tsx
|
|
3173
|
+
import Color from "color";
|
|
3174
|
+
import {
|
|
3175
|
+
createContext,
|
|
3176
|
+
memo,
|
|
3177
|
+
useCallback,
|
|
3178
|
+
useContext,
|
|
3179
|
+
useEffect as useEffect5,
|
|
3180
|
+
useMemo as useMemo2,
|
|
3181
|
+
useRef as useRef4,
|
|
3182
|
+
useState as useState7
|
|
3183
|
+
} from "react";
|
|
3184
|
+
import * as Slider from "@radix-ui/react-slider";
|
|
3171
3185
|
import { jsx as jsx49, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
const
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
const
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3186
|
+
var ColorPickerContext = createContext(void 0);
|
|
3187
|
+
var useColorPicker = () => {
|
|
3188
|
+
const ctx = useContext(ColorPickerContext);
|
|
3189
|
+
if (!ctx) throw new Error("useColorPicker must be used within ColorPicker");
|
|
3190
|
+
return ctx;
|
|
3191
|
+
};
|
|
3192
|
+
var ColorPicker = ({
|
|
3193
|
+
defaultValue = "#000000",
|
|
3194
|
+
onChange,
|
|
3195
|
+
className,
|
|
3196
|
+
children,
|
|
3197
|
+
...props
|
|
3198
|
+
}) => {
|
|
3199
|
+
const initial = (() => {
|
|
3200
|
+
try {
|
|
3201
|
+
return Color(defaultValue);
|
|
3202
|
+
} catch {
|
|
3203
|
+
return Color("#000000");
|
|
3204
|
+
}
|
|
3205
|
+
})();
|
|
3206
|
+
const [hue, setHueState] = useState7(initial.hue());
|
|
3207
|
+
const [saturation, setSaturationState] = useState7(initial.saturationl());
|
|
3208
|
+
const [lightness, setLightnessState] = useState7(initial.lightness());
|
|
3209
|
+
const [alpha, setAlphaState] = useState7(initial.alpha() * 100);
|
|
3210
|
+
const notifyRef = useRef4(onChange);
|
|
3194
3211
|
useEffect5(() => {
|
|
3195
|
-
|
|
3196
|
-
}, [
|
|
3197
|
-
const
|
|
3198
|
-
const
|
|
3199
|
-
|
|
3200
|
-
const pickerW = 228;
|
|
3201
|
-
let left = rect.left;
|
|
3202
|
-
if (left + pickerW > window.innerWidth - 8) left = window.innerWidth - pickerW - 8;
|
|
3203
|
-
setPos({ top: rect.bottom + 6, left: Math.max(8, left) });
|
|
3204
|
-
setOpen(true);
|
|
3212
|
+
notifyRef.current = onChange;
|
|
3213
|
+
}, [onChange]);
|
|
3214
|
+
const notify = useCallback((h, s, l, a) => {
|
|
3215
|
+
const hex = Color.hsl(h, s, l).alpha(a / 100).hexa();
|
|
3216
|
+
notifyRef.current?.(hex);
|
|
3205
3217
|
}, []);
|
|
3218
|
+
const setHue = useCallback((h) => {
|
|
3219
|
+
setHueState(h);
|
|
3220
|
+
notify(h, saturation, lightness, alpha);
|
|
3221
|
+
}, [saturation, lightness, alpha, notify]);
|
|
3222
|
+
const setSaturation = useCallback((s) => {
|
|
3223
|
+
setSaturationState(s);
|
|
3224
|
+
notify(hue, s, lightness, alpha);
|
|
3225
|
+
}, [hue, lightness, alpha, notify]);
|
|
3226
|
+
const setLightness = useCallback((l) => {
|
|
3227
|
+
setLightnessState(l);
|
|
3228
|
+
notify(hue, saturation, l, alpha);
|
|
3229
|
+
}, [hue, saturation, alpha, notify]);
|
|
3230
|
+
const setAlpha = useCallback((a) => {
|
|
3231
|
+
setAlphaState(a);
|
|
3232
|
+
notify(hue, saturation, lightness, a);
|
|
3233
|
+
}, [hue, saturation, lightness, notify]);
|
|
3234
|
+
return /* @__PURE__ */ jsx49(ColorPickerContext.Provider, { value: { hue, saturation, lightness, alpha, setHue, setSaturation, setLightness, setAlpha }, children: /* @__PURE__ */ jsx49("div", { className: cn("flex flex-col gap-3", className), ...props, children }) });
|
|
3235
|
+
};
|
|
3236
|
+
var ColorPickerSelection = memo(({ className, ...props }) => {
|
|
3237
|
+
const containerRef = useRef4(null);
|
|
3238
|
+
const [isDragging, setIsDragging] = useState7(false);
|
|
3239
|
+
const [posX, setPosX] = useState7(0);
|
|
3240
|
+
const [posY, setPosY] = useState7(0);
|
|
3241
|
+
const { hue, setSaturation, setLightness } = useColorPicker();
|
|
3242
|
+
const bg = useMemo2(
|
|
3243
|
+
() => `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%)`,
|
|
3244
|
+
[hue]
|
|
3245
|
+
);
|
|
3246
|
+
const handleMove = useCallback((e) => {
|
|
3247
|
+
if (!isDragging || !containerRef.current) return;
|
|
3248
|
+
const rect = containerRef.current.getBoundingClientRect();
|
|
3249
|
+
const x = Math.max(0, Math.min(1, (e.clientX - rect.left) / rect.width));
|
|
3250
|
+
const y = Math.max(0, Math.min(1, (e.clientY - rect.top) / rect.height));
|
|
3251
|
+
setPosX(x);
|
|
3252
|
+
setPosY(y);
|
|
3253
|
+
setSaturation(x * 100);
|
|
3254
|
+
const topL = x < 0.01 ? 100 : 50 + 50 * (1 - x);
|
|
3255
|
+
setLightness(topL * (1 - y));
|
|
3256
|
+
}, [isDragging, setSaturation, setLightness]);
|
|
3206
3257
|
useEffect5(() => {
|
|
3207
|
-
if (!
|
|
3208
|
-
const
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3258
|
+
if (!isDragging) return;
|
|
3259
|
+
const up = () => setIsDragging(false);
|
|
3260
|
+
window.addEventListener("pointermove", handleMove);
|
|
3261
|
+
window.addEventListener("pointerup", up);
|
|
3262
|
+
return () => {
|
|
3263
|
+
window.removeEventListener("pointermove", handleMove);
|
|
3264
|
+
window.removeEventListener("pointerup", up);
|
|
3213
3265
|
};
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
}, [open]);
|
|
3217
|
-
const cssColor = value ? `hsl(${value})` : "transparent";
|
|
3218
|
-
const picker = /* @__PURE__ */ jsxs33(
|
|
3266
|
+
}, [isDragging, handleMove]);
|
|
3267
|
+
return /* @__PURE__ */ jsx49(
|
|
3219
3268
|
"div",
|
|
3220
3269
|
{
|
|
3221
|
-
ref:
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
onPointerDown: (e) =>
|
|
3270
|
+
ref: containerRef,
|
|
3271
|
+
className: cn("relative w-full cursor-crosshair rounded-lg", className),
|
|
3272
|
+
style: { background: bg },
|
|
3273
|
+
onPointerDown: (e) => {
|
|
3274
|
+
e.preventDefault();
|
|
3275
|
+
setIsDragging(true);
|
|
3276
|
+
handleMove(e.nativeEvent);
|
|
3277
|
+
},
|
|
3278
|
+
...props,
|
|
3279
|
+
children: /* @__PURE__ */ jsx49(
|
|
3280
|
+
"div",
|
|
3281
|
+
{
|
|
3282
|
+
className: "pointer-events-none absolute h-4 w-4 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white",
|
|
3283
|
+
style: {
|
|
3284
|
+
left: `${posX * 100}%`,
|
|
3285
|
+
top: `${posY * 100}%`,
|
|
3286
|
+
boxShadow: "0 0 0 1px rgba(0,0,0,0.6)"
|
|
3287
|
+
}
|
|
3288
|
+
}
|
|
3289
|
+
)
|
|
3290
|
+
}
|
|
3291
|
+
);
|
|
3292
|
+
});
|
|
3293
|
+
ColorPickerSelection.displayName = "ColorPickerSelection";
|
|
3294
|
+
var ColorPickerHue = ({ className, ...props }) => {
|
|
3295
|
+
const { hue, setHue } = useColorPicker();
|
|
3296
|
+
return /* @__PURE__ */ jsxs33(
|
|
3297
|
+
Slider.Root,
|
|
3298
|
+
{
|
|
3299
|
+
className: cn("relative flex h-4 w-full touch-none items-center", className),
|
|
3300
|
+
max: 360,
|
|
3301
|
+
step: 1,
|
|
3302
|
+
value: [hue],
|
|
3303
|
+
onValueChange: ([h]) => setHue(h),
|
|
3304
|
+
...props,
|
|
3305
|
+
children: [
|
|
3306
|
+
/* @__PURE__ */ jsx49(Slider.Track, { className: "relative h-3 w-full grow rounded-full bg-[linear-gradient(90deg,#f00,#ff0,#0f0,#0ff,#00f,#f0f,#f00)]", children: /* @__PURE__ */ jsx49(Slider.Range, { className: "absolute h-full" }) }),
|
|
3307
|
+
/* @__PURE__ */ jsx49(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)" } })
|
|
3308
|
+
]
|
|
3309
|
+
}
|
|
3310
|
+
);
|
|
3311
|
+
};
|
|
3312
|
+
var ColorPickerAlpha = ({ className, ...props }) => {
|
|
3313
|
+
const { alpha, setAlpha, hue, saturation, lightness } = useColorPicker();
|
|
3314
|
+
const solidColor = `hsl(${hue},${saturation}%,${lightness}%)`;
|
|
3315
|
+
return /* @__PURE__ */ jsxs33(
|
|
3316
|
+
Slider.Root,
|
|
3317
|
+
{
|
|
3318
|
+
className: cn("relative flex h-4 w-full touch-none items-center", className),
|
|
3319
|
+
max: 100,
|
|
3320
|
+
step: 1,
|
|
3321
|
+
value: [alpha],
|
|
3322
|
+
onValueChange: ([a]) => setAlpha(a),
|
|
3323
|
+
...props,
|
|
3225
3324
|
children: [
|
|
3226
3325
|
/* @__PURE__ */ jsx49(
|
|
3227
|
-
|
|
3326
|
+
Slider.Track,
|
|
3228
3327
|
{
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
}
|
|
3328
|
+
className: "relative h-3 w-full grow rounded-full",
|
|
3329
|
+
style: {
|
|
3330
|
+
backgroundImage: `linear-gradient(90deg, transparent, ${solidColor}), url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==")`
|
|
3331
|
+
},
|
|
3332
|
+
children: /* @__PURE__ */ jsx49(Slider.Range, { className: "absolute h-full" })
|
|
3235
3333
|
}
|
|
3236
3334
|
),
|
|
3237
|
-
/* @__PURE__ */
|
|
3238
|
-
/* @__PURE__ */ jsx49("div", { className: "w-5 h-5 rounded border border-white/10 shrink-0", style: { background: cssColor } }),
|
|
3239
|
-
/* @__PURE__ */ jsx49("span", { className: "text-xs font-mono text-white/40 flex-1 truncate", children: value || "none" }),
|
|
3240
|
-
/* @__PURE__ */ jsx49(
|
|
3241
|
-
"button",
|
|
3242
|
-
{
|
|
3243
|
-
onClick: () => setOpen(false),
|
|
3244
|
-
className: "text-white/30 hover:text-white/70 text-xs px-1.5 py-0.5 rounded hover:bg-white/5 transition-colors",
|
|
3245
|
-
children: "Done"
|
|
3246
|
-
}
|
|
3247
|
-
)
|
|
3248
|
-
] })
|
|
3335
|
+
/* @__PURE__ */ jsx49(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)" } })
|
|
3249
3336
|
]
|
|
3250
3337
|
}
|
|
3251
3338
|
);
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3339
|
+
};
|
|
3340
|
+
var ColorPickerHexOutput = ({ className, ...props }) => {
|
|
3341
|
+
const { hue, saturation, lightness, alpha } = useColorPicker();
|
|
3342
|
+
const hex = Color.hsl(hue, saturation, lightness).alpha(alpha / 100).hex();
|
|
3343
|
+
return /* @__PURE__ */ jsxs33("div", { className: cn("flex items-center gap-1.5 px-1", className), ...props, children: [
|
|
3344
|
+
/* @__PURE__ */ jsx49("div", { className: "w-5 h-5 rounded border border-white/20 shrink-0", style: { background: `hsl(${hue},${saturation}%,${lightness}%)` } }),
|
|
3345
|
+
/* @__PURE__ */ jsx49("span", { className: "text-xs font-mono text-white/50 flex-1", children: hex })
|
|
3346
|
+
] });
|
|
3347
|
+
};
|
|
3348
|
+
var ColorPickerEyeDropper = ({ className, ...props }) => {
|
|
3349
|
+
const { setHue, setSaturation, setLightness, setAlpha } = useColorPicker();
|
|
3350
|
+
const pick = async () => {
|
|
3351
|
+
try {
|
|
3352
|
+
const result = await new EyeDropper().open();
|
|
3353
|
+
const c = Color(result.sRGBHex);
|
|
3354
|
+
setHue(c.hue());
|
|
3355
|
+
setSaturation(c.saturationl());
|
|
3356
|
+
setLightness(c.lightness());
|
|
3357
|
+
setAlpha(100);
|
|
3358
|
+
} catch {
|
|
3359
|
+
}
|
|
3360
|
+
};
|
|
3361
|
+
return /* @__PURE__ */ jsx49(
|
|
3362
|
+
"button",
|
|
3363
|
+
{
|
|
3364
|
+
type: "button",
|
|
3365
|
+
onClick: pick,
|
|
3366
|
+
title: "Eye dropper",
|
|
3367
|
+
className: cn(
|
|
3368
|
+
"w-7 h-7 flex items-center justify-center rounded-md",
|
|
3369
|
+
"border border-white/10 text-white/40 hover:text-white/70 hover:border-white/25",
|
|
3370
|
+
"transition-colors shrink-0",
|
|
3371
|
+
className
|
|
3372
|
+
),
|
|
3373
|
+
...props,
|
|
3374
|
+
children: /* @__PURE__ */ jsxs33("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: [
|
|
3375
|
+
/* @__PURE__ */ jsx49("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" }),
|
|
3376
|
+
/* @__PURE__ */ jsx49("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" }),
|
|
3377
|
+
/* @__PURE__ */ jsx49("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" })
|
|
3378
|
+
] })
|
|
3379
|
+
}
|
|
3380
|
+
);
|
|
3381
|
+
};
|
|
3382
|
+
|
|
3383
|
+
// src/components/ui/hsl-color-input.tsx
|
|
3384
|
+
import { jsx as jsx50, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
3385
|
+
function hslStringToHex(hsl) {
|
|
3386
|
+
if (!hsl) return "#000000";
|
|
3387
|
+
try {
|
|
3388
|
+
const parts = hsl.trim().split(/\s+/);
|
|
3389
|
+
const h = parseFloat(parts[0]) || 0;
|
|
3390
|
+
const s = parseFloat(parts[1]) || 0;
|
|
3391
|
+
const l = parseFloat(parts[2]) || 0;
|
|
3392
|
+
return Color2.hsl(h, s, l).hex();
|
|
3393
|
+
} catch {
|
|
3394
|
+
return "#000000";
|
|
3395
|
+
}
|
|
3396
|
+
}
|
|
3397
|
+
function hexToHslString(hex) {
|
|
3398
|
+
try {
|
|
3399
|
+
const c = Color2(hex);
|
|
3400
|
+
const h = Math.round(c.hue());
|
|
3401
|
+
const s = Math.round(c.saturationl());
|
|
3402
|
+
const l = Math.round(c.lightness());
|
|
3403
|
+
return `${h} ${s}% ${l}%`;
|
|
3404
|
+
} catch {
|
|
3405
|
+
return "0 0% 0%";
|
|
3406
|
+
}
|
|
3407
|
+
}
|
|
3408
|
+
function ColorReader({ onHexChange }) {
|
|
3409
|
+
const { hue, saturation, lightness, alpha } = useColorPicker();
|
|
3410
|
+
useEffect6(() => {
|
|
3411
|
+
const hex = Color2.hsl(hue, saturation, lightness).alpha(alpha / 100).hex();
|
|
3412
|
+
onHexChange(hex);
|
|
3413
|
+
}, [hue, saturation, lightness, alpha, onHexChange]);
|
|
3414
|
+
return null;
|
|
3415
|
+
}
|
|
3416
|
+
function HslColorInput({ value, onChange, className, inputClassName, disabled }) {
|
|
3417
|
+
const [open, setOpen] = useState8(false);
|
|
3418
|
+
const [inputVal, setInputVal] = useState8(value);
|
|
3419
|
+
useEffect6(() => {
|
|
3420
|
+
setInputVal(value);
|
|
3421
|
+
}, [value]);
|
|
3422
|
+
const hexValue = hslStringToHex(value);
|
|
3423
|
+
const cssColor = value ? `hsl(${value})` : "transparent";
|
|
3424
|
+
const handlePickerHex = useCallback2((hex) => {
|
|
3425
|
+
const hsl = hexToHslString(hex);
|
|
3426
|
+
setInputVal(hsl);
|
|
3427
|
+
onChange(hsl);
|
|
3428
|
+
}, [onChange]);
|
|
3429
|
+
return /* @__PURE__ */ jsxs34("div", { className: cn("flex items-center gap-1.5", className), children: [
|
|
3430
|
+
/* @__PURE__ */ jsxs34(Popover2.Root, { open, onOpenChange: disabled ? void 0 : setOpen, children: [
|
|
3431
|
+
/* @__PURE__ */ jsx50(Popover2.Trigger, { asChild: true, children: /* @__PURE__ */ jsx50(
|
|
3432
|
+
"button",
|
|
3433
|
+
{
|
|
3434
|
+
type: "button",
|
|
3435
|
+
disabled,
|
|
3436
|
+
className: cn(
|
|
3437
|
+
"w-5 h-5 rounded border border-white/10 shrink-0 transition-all",
|
|
3438
|
+
"hover:scale-110 hover:border-white/30 focus:outline-none",
|
|
3439
|
+
disabled && "opacity-50 cursor-not-allowed"
|
|
3440
|
+
),
|
|
3441
|
+
style: { background: cssColor },
|
|
3442
|
+
"aria-label": "Pick color"
|
|
3443
|
+
}
|
|
3444
|
+
) }),
|
|
3445
|
+
/* @__PURE__ */ jsx50(Popover2.Portal, { children: /* @__PURE__ */ jsx50(
|
|
3446
|
+
Popover2.Content,
|
|
3447
|
+
{
|
|
3448
|
+
sideOffset: 8,
|
|
3449
|
+
align: "start",
|
|
3450
|
+
className: cn(
|
|
3451
|
+
"z-[9999] rounded-xl shadow-2xl p-3 w-[220px]",
|
|
3452
|
+
"bg-[#1a1c2e] border border-white/10",
|
|
3453
|
+
"focus:outline-none"
|
|
3454
|
+
),
|
|
3455
|
+
onInteractOutside: () => setOpen(false),
|
|
3456
|
+
children: open && /* @__PURE__ */ jsxs34(ColorPicker, { defaultValue: hexValue, children: [
|
|
3457
|
+
/* @__PURE__ */ jsx50(ColorReader, { onHexChange: handlePickerHex }),
|
|
3458
|
+
/* @__PURE__ */ jsx50(ColorPickerSelection, { className: "h-36 rounded-lg" }),
|
|
3459
|
+
/* @__PURE__ */ jsxs34("div", { className: "flex items-center gap-2", children: [
|
|
3460
|
+
/* @__PURE__ */ jsx50(ColorPickerEyeDropper, {}),
|
|
3461
|
+
/* @__PURE__ */ jsxs34("div", { className: "flex flex-col gap-1.5 flex-1", children: [
|
|
3462
|
+
/* @__PURE__ */ jsx50(ColorPickerHue, {}),
|
|
3463
|
+
/* @__PURE__ */ jsx50(ColorPickerAlpha, {})
|
|
3464
|
+
] })
|
|
3465
|
+
] }),
|
|
3466
|
+
/* @__PURE__ */ jsx50(ColorPickerHexOutput, {})
|
|
3467
|
+
] })
|
|
3468
|
+
}
|
|
3469
|
+
) })
|
|
3470
|
+
] }),
|
|
3471
|
+
/* @__PURE__ */ jsx50(
|
|
3270
3472
|
"input",
|
|
3271
3473
|
{
|
|
3272
3474
|
type: "text",
|
|
@@ -3287,15 +3489,14 @@ function HslColorInput({ value, onChange, className, inputClassName, disabled })
|
|
|
3287
3489
|
inputClassName
|
|
3288
3490
|
)
|
|
3289
3491
|
}
|
|
3290
|
-
)
|
|
3291
|
-
mounted && open && createPortal(picker, document.body)
|
|
3492
|
+
)
|
|
3292
3493
|
] });
|
|
3293
3494
|
}
|
|
3294
3495
|
|
|
3295
3496
|
// src/hooks/index.ts
|
|
3296
|
-
import { useState as
|
|
3497
|
+
import { useState as useState9 } from "react";
|
|
3297
3498
|
function useDisclosure(initial = false) {
|
|
3298
|
-
const [isOpen, setIsOpen] =
|
|
3499
|
+
const [isOpen, setIsOpen] = useState9(initial);
|
|
3299
3500
|
return {
|
|
3300
3501
|
isOpen,
|
|
3301
3502
|
open: () => setIsOpen(true),
|
|
@@ -3305,15 +3506,15 @@ function useDisclosure(initial = false) {
|
|
|
3305
3506
|
};
|
|
3306
3507
|
}
|
|
3307
3508
|
function usePagination(total, pageSize = 20) {
|
|
3308
|
-
const [page, setPage] =
|
|
3509
|
+
const [page, setPage] = useState9(1);
|
|
3309
3510
|
const totalPages = Math.ceil(total / pageSize);
|
|
3310
3511
|
return { page, setPage, pageSize, total, totalPages };
|
|
3311
3512
|
}
|
|
3312
3513
|
|
|
3313
3514
|
// src/components/auth/AuthShell.tsx
|
|
3314
|
-
import { jsx as
|
|
3515
|
+
import { jsx as jsx51, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
3315
3516
|
function AuthShell({ children, pattern = "dots", maxWidth = "520px" }) {
|
|
3316
|
-
return /* @__PURE__ */
|
|
3517
|
+
return /* @__PURE__ */ jsxs35(
|
|
3317
3518
|
"div",
|
|
3318
3519
|
{
|
|
3319
3520
|
style: {
|
|
@@ -3328,7 +3529,7 @@ function AuthShell({ children, pattern = "dots", maxWidth = "520px" }) {
|
|
|
3328
3529
|
overflow: "hidden"
|
|
3329
3530
|
},
|
|
3330
3531
|
children: [
|
|
3331
|
-
pattern === "dots" && /* @__PURE__ */
|
|
3532
|
+
pattern === "dots" && /* @__PURE__ */ jsx51(
|
|
3332
3533
|
"div",
|
|
3333
3534
|
{
|
|
3334
3535
|
"aria-hidden": true,
|
|
@@ -3342,7 +3543,7 @@ function AuthShell({ children, pattern = "dots", maxWidth = "520px" }) {
|
|
|
3342
3543
|
}
|
|
3343
3544
|
}
|
|
3344
3545
|
),
|
|
3345
|
-
pattern === "grid" && /* @__PURE__ */
|
|
3546
|
+
pattern === "grid" && /* @__PURE__ */ jsx51(
|
|
3346
3547
|
"div",
|
|
3347
3548
|
{
|
|
3348
3549
|
"aria-hidden": true,
|
|
@@ -3356,16 +3557,16 @@ function AuthShell({ children, pattern = "dots", maxWidth = "520px" }) {
|
|
|
3356
3557
|
}
|
|
3357
3558
|
}
|
|
3358
3559
|
),
|
|
3359
|
-
/* @__PURE__ */
|
|
3560
|
+
/* @__PURE__ */ jsx51("div", { style: { position: "relative", zIndex: 1, width: "100%", maxWidth }, children })
|
|
3360
3561
|
]
|
|
3361
3562
|
}
|
|
3362
3563
|
);
|
|
3363
3564
|
}
|
|
3364
3565
|
|
|
3365
3566
|
// src/components/auth/AuthCard.tsx
|
|
3366
|
-
import { jsx as
|
|
3567
|
+
import { jsx as jsx52 } from "react/jsx-runtime";
|
|
3367
3568
|
function AuthCard({ children, padding = "24px 28px" }) {
|
|
3368
|
-
return /* @__PURE__ */
|
|
3569
|
+
return /* @__PURE__ */ jsx52(
|
|
3369
3570
|
"div",
|
|
3370
3571
|
{
|
|
3371
3572
|
style: {
|
|
@@ -3382,10 +3583,10 @@ function AuthCard({ children, padding = "24px 28px" }) {
|
|
|
3382
3583
|
}
|
|
3383
3584
|
|
|
3384
3585
|
// src/components/auth/AuthLogo.tsx
|
|
3385
|
-
import { jsx as
|
|
3586
|
+
import { jsx as jsx53, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
3386
3587
|
function AuthLogo({ appName = "Builify CMS", letter = "B", imageUrl, size = 36 }) {
|
|
3387
|
-
return /* @__PURE__ */
|
|
3388
|
-
imageUrl ? /* @__PURE__ */
|
|
3588
|
+
return /* @__PURE__ */ jsxs36("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: "10px", marginBottom: "28px" }, children: [
|
|
3589
|
+
imageUrl ? /* @__PURE__ */ jsx53(
|
|
3389
3590
|
"img",
|
|
3390
3591
|
{
|
|
3391
3592
|
src: imageUrl,
|
|
@@ -3394,7 +3595,7 @@ function AuthLogo({ appName = "Builify CMS", letter = "B", imageUrl, size = 36 }
|
|
|
3394
3595
|
height: size,
|
|
3395
3596
|
style: { borderRadius: "calc(var(--radius, 0.5rem) * 1.2)", flexShrink: 0, display: "block" }
|
|
3396
3597
|
}
|
|
3397
|
-
) : /* @__PURE__ */
|
|
3598
|
+
) : /* @__PURE__ */ jsx53(
|
|
3398
3599
|
"div",
|
|
3399
3600
|
{
|
|
3400
3601
|
style: {
|
|
@@ -3413,7 +3614,7 @@ function AuthLogo({ appName = "Builify CMS", letter = "B", imageUrl, size = 36 }
|
|
|
3413
3614
|
children: letter
|
|
3414
3615
|
}
|
|
3415
3616
|
),
|
|
3416
|
-
/* @__PURE__ */
|
|
3617
|
+
/* @__PURE__ */ jsx53(
|
|
3417
3618
|
"span",
|
|
3418
3619
|
{
|
|
3419
3620
|
style: {
|
|
@@ -3429,10 +3630,10 @@ function AuthLogo({ appName = "Builify CMS", letter = "B", imageUrl, size = 36 }
|
|
|
3429
3630
|
}
|
|
3430
3631
|
|
|
3431
3632
|
// src/components/auth/AuthHeader.tsx
|
|
3432
|
-
import { jsx as
|
|
3633
|
+
import { jsx as jsx54, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
3433
3634
|
function AuthHeader({ title, description }) {
|
|
3434
|
-
return /* @__PURE__ */
|
|
3435
|
-
/* @__PURE__ */
|
|
3635
|
+
return /* @__PURE__ */ jsxs37("div", { style: { marginBottom: "24px", textAlign: "center" }, children: [
|
|
3636
|
+
/* @__PURE__ */ jsx54(
|
|
3436
3637
|
"h1",
|
|
3437
3638
|
{
|
|
3438
3639
|
style: {
|
|
@@ -3445,7 +3646,7 @@ function AuthHeader({ title, description }) {
|
|
|
3445
3646
|
children: title
|
|
3446
3647
|
}
|
|
3447
3648
|
),
|
|
3448
|
-
description && /* @__PURE__ */
|
|
3649
|
+
description && /* @__PURE__ */ jsx54(
|
|
3449
3650
|
"p",
|
|
3450
3651
|
{
|
|
3451
3652
|
style: {
|
|
@@ -3461,12 +3662,12 @@ function AuthHeader({ title, description }) {
|
|
|
3461
3662
|
}
|
|
3462
3663
|
|
|
3463
3664
|
// src/components/auth/AuthField.tsx
|
|
3464
|
-
import { jsx as
|
|
3665
|
+
import { jsx as jsx55, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
3465
3666
|
function AuthField({ label, error, hint, rightLabel, id, ...props }) {
|
|
3466
3667
|
const fieldId = id ?? label.toLowerCase().replace(/\s+/g, "-");
|
|
3467
|
-
return /* @__PURE__ */
|
|
3468
|
-
/* @__PURE__ */
|
|
3469
|
-
/* @__PURE__ */
|
|
3668
|
+
return /* @__PURE__ */ jsxs38("div", { style: { display: "flex", flexDirection: "column", gap: "6px" }, children: [
|
|
3669
|
+
/* @__PURE__ */ jsxs38("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
|
|
3670
|
+
/* @__PURE__ */ jsx55(
|
|
3470
3671
|
"label",
|
|
3471
3672
|
{
|
|
3472
3673
|
htmlFor: fieldId,
|
|
@@ -3478,9 +3679,9 @@ function AuthField({ label, error, hint, rightLabel, id, ...props }) {
|
|
|
3478
3679
|
children: label
|
|
3479
3680
|
}
|
|
3480
3681
|
),
|
|
3481
|
-
rightLabel && /* @__PURE__ */
|
|
3682
|
+
rightLabel && /* @__PURE__ */ jsx55("span", { style: { fontSize: "0.8125rem" }, children: rightLabel })
|
|
3482
3683
|
] }),
|
|
3483
|
-
/* @__PURE__ */
|
|
3684
|
+
/* @__PURE__ */ jsx55(
|
|
3484
3685
|
"input",
|
|
3485
3686
|
{
|
|
3486
3687
|
id: fieldId,
|
|
@@ -3510,13 +3711,13 @@ function AuthField({ label, error, hint, rightLabel, id, ...props }) {
|
|
|
3510
3711
|
...props
|
|
3511
3712
|
}
|
|
3512
3713
|
),
|
|
3513
|
-
error && /* @__PURE__ */
|
|
3514
|
-
hint && !error && /* @__PURE__ */
|
|
3714
|
+
error && /* @__PURE__ */ jsx55("p", { style: { fontSize: "0.8rem", color: "var(--destructive)", margin: 0 }, children: error }),
|
|
3715
|
+
hint && !error && /* @__PURE__ */ jsx55("p", { style: { fontSize: "0.8rem", color: "var(--muted-foreground)", margin: 0 }, children: hint })
|
|
3515
3716
|
] });
|
|
3516
3717
|
}
|
|
3517
3718
|
|
|
3518
3719
|
// src/components/auth/AuthButton.tsx
|
|
3519
|
-
import { Fragment as Fragment5, jsx as
|
|
3720
|
+
import { Fragment as Fragment5, jsx as jsx56, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
3520
3721
|
function AuthButton({
|
|
3521
3722
|
loading,
|
|
3522
3723
|
variant = "primary",
|
|
@@ -3559,7 +3760,7 @@ function AuthButton({
|
|
|
3559
3760
|
color: "var(--foreground)"
|
|
3560
3761
|
}
|
|
3561
3762
|
};
|
|
3562
|
-
return /* @__PURE__ */
|
|
3763
|
+
return /* @__PURE__ */ jsx56(
|
|
3563
3764
|
"button",
|
|
3564
3765
|
{
|
|
3565
3766
|
disabled: loading || disabled,
|
|
@@ -3571,8 +3772,8 @@ function AuthButton({
|
|
|
3571
3772
|
e.currentTarget.style.filter = "none";
|
|
3572
3773
|
},
|
|
3573
3774
|
...props,
|
|
3574
|
-
children: loading ? /* @__PURE__ */
|
|
3575
|
-
/* @__PURE__ */
|
|
3775
|
+
children: loading ? /* @__PURE__ */ jsxs39(Fragment5, { children: [
|
|
3776
|
+
/* @__PURE__ */ jsx56(
|
|
3576
3777
|
"span",
|
|
3577
3778
|
{
|
|
3578
3779
|
style: {
|
|
@@ -3593,19 +3794,19 @@ function AuthButton({
|
|
|
3593
3794
|
}
|
|
3594
3795
|
|
|
3595
3796
|
// src/components/auth/AuthDivider.tsx
|
|
3596
|
-
import { jsx as
|
|
3797
|
+
import { jsx as jsx57, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
3597
3798
|
function AuthDivider({ label = "or" }) {
|
|
3598
|
-
return /* @__PURE__ */
|
|
3599
|
-
/* @__PURE__ */
|
|
3600
|
-
/* @__PURE__ */
|
|
3601
|
-
/* @__PURE__ */
|
|
3799
|
+
return /* @__PURE__ */ jsxs40("div", { style: { display: "flex", alignItems: "center", gap: "12px", margin: "20px 0" }, children: [
|
|
3800
|
+
/* @__PURE__ */ jsx57("div", { style: { flex: 1, height: 1, background: "var(--border)" } }),
|
|
3801
|
+
/* @__PURE__ */ jsx57("span", { style: { fontSize: "0.75rem", color: "var(--muted-foreground)", userSelect: "none" }, children: label }),
|
|
3802
|
+
/* @__PURE__ */ jsx57("div", { style: { flex: 1, height: 1, background: "var(--border)" } })
|
|
3602
3803
|
] });
|
|
3603
3804
|
}
|
|
3604
3805
|
|
|
3605
3806
|
// src/components/auth/AuthFootnote.tsx
|
|
3606
|
-
import { jsx as
|
|
3807
|
+
import { jsx as jsx58, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
3607
3808
|
function AuthFootnote({ text, linkText, linkHref }) {
|
|
3608
|
-
return /* @__PURE__ */
|
|
3809
|
+
return /* @__PURE__ */ jsxs41("p", { style: {
|
|
3609
3810
|
textAlign: "center",
|
|
3610
3811
|
marginTop: "20px",
|
|
3611
3812
|
fontSize: "0.8125rem",
|
|
@@ -3613,7 +3814,7 @@ function AuthFootnote({ text, linkText, linkHref }) {
|
|
|
3613
3814
|
}, children: [
|
|
3614
3815
|
text,
|
|
3615
3816
|
" ",
|
|
3616
|
-
/* @__PURE__ */
|
|
3817
|
+
/* @__PURE__ */ jsx58(
|
|
3617
3818
|
"a",
|
|
3618
3819
|
{
|
|
3619
3820
|
href: linkHref,
|
|
@@ -3652,6 +3853,12 @@ export {
|
|
|
3652
3853
|
CardHeader,
|
|
3653
3854
|
CardTitle,
|
|
3654
3855
|
Checkbox,
|
|
3856
|
+
ColorPicker,
|
|
3857
|
+
ColorPickerAlpha,
|
|
3858
|
+
ColorPickerEyeDropper,
|
|
3859
|
+
ColorPickerHexOutput,
|
|
3860
|
+
ColorPickerHue,
|
|
3861
|
+
ColorPickerSelection,
|
|
3655
3862
|
ConfirmDialog,
|
|
3656
3863
|
DashboardLayout,
|
|
3657
3864
|
DataTable,
|
|
@@ -3738,6 +3945,7 @@ export {
|
|
|
3738
3945
|
badgeVariants,
|
|
3739
3946
|
buttonVariants,
|
|
3740
3947
|
cn,
|
|
3948
|
+
useColorPicker,
|
|
3741
3949
|
useDisclosure,
|
|
3742
3950
|
usePagination,
|
|
3743
3951
|
useTheme2 as useTheme
|