@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.mjs
CHANGED
|
@@ -3165,92 +3165,327 @@ function PostSidebarSection({
|
|
|
3165
3165
|
}
|
|
3166
3166
|
|
|
3167
3167
|
// src/components/ui/hsl-color-input.tsx
|
|
3168
|
-
import { useState as
|
|
3169
|
-
import
|
|
3168
|
+
import { useState as useState8, useEffect as useEffect6, useCallback as useCallback2 } from "react";
|
|
3169
|
+
import Color2 from "color";
|
|
3170
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
|
-
|
|
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);
|
|
3211
|
+
useEffect5(() => {
|
|
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);
|
|
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]);
|
|
3257
|
+
useEffect5(() => {
|
|
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);
|
|
3265
|
+
};
|
|
3266
|
+
}, [isDragging, handleMove]);
|
|
3267
|
+
return /* @__PURE__ */ jsx49(
|
|
3268
|
+
"div",
|
|
3269
|
+
{
|
|
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,
|
|
3324
|
+
children: [
|
|
3325
|
+
/* @__PURE__ */ jsx49(
|
|
3326
|
+
Slider.Track,
|
|
3327
|
+
{
|
|
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" })
|
|
3333
|
+
}
|
|
3334
|
+
),
|
|
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)" } })
|
|
3336
|
+
]
|
|
3337
|
+
}
|
|
3338
|
+
);
|
|
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
|
+
}
|
|
3179
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
|
+
}
|
|
3180
3407
|
}
|
|
3181
|
-
function
|
|
3182
|
-
|
|
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;
|
|
3183
3415
|
}
|
|
3184
3416
|
function HslColorInput({ value, onChange, className, inputClassName, disabled }) {
|
|
3185
|
-
const [
|
|
3186
|
-
|
|
3417
|
+
const [open, setOpen] = useState8(false);
|
|
3418
|
+
const [inputVal, setInputVal] = useState8(value);
|
|
3419
|
+
useEffect6(() => {
|
|
3187
3420
|
setInputVal(value);
|
|
3188
3421
|
}, [value]);
|
|
3189
|
-
const
|
|
3422
|
+
const hexValue = hslStringToHex(value);
|
|
3190
3423
|
const cssColor = value ? `hsl(${value})` : "transparent";
|
|
3191
|
-
const
|
|
3192
|
-
const
|
|
3193
|
-
setInputVal(
|
|
3194
|
-
onChange(
|
|
3424
|
+
const handlePickerHex = useCallback2((hex) => {
|
|
3425
|
+
const hsl = hexToHslString(hex);
|
|
3426
|
+
setInputVal(hsl);
|
|
3427
|
+
onChange(hsl);
|
|
3195
3428
|
}, [onChange]);
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
if (/^\d+(\.\d+)?\s+\d+(\.\d+)?%?\s+\d+(\.\d+)?%?$/.test(v.trim())) {
|
|
3200
|
-
onChange(v);
|
|
3201
|
-
}
|
|
3202
|
-
};
|
|
3203
|
-
return /* @__PURE__ */ jsxs33("div", { className: cn("flex items-center gap-1.5", className), children: [
|
|
3204
|
-
/* @__PURE__ */ jsxs33(Popover2.Root, { children: [
|
|
3205
|
-
/* @__PURE__ */ jsx49(Popover2.Trigger, { asChild: true, disabled, children: /* @__PURE__ */ jsx49(
|
|
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(
|
|
3206
3432
|
"button",
|
|
3207
3433
|
{
|
|
3208
3434
|
type: "button",
|
|
3435
|
+
disabled,
|
|
3209
3436
|
className: cn(
|
|
3210
3437
|
"w-5 h-5 rounded border border-white/10 shrink-0 transition-all",
|
|
3211
|
-
"hover:scale-110 hover:border-white/30 focus:outline-none
|
|
3438
|
+
"hover:scale-110 hover:border-white/30 focus:outline-none",
|
|
3212
3439
|
disabled && "opacity-50 cursor-not-allowed"
|
|
3213
3440
|
),
|
|
3214
3441
|
style: { background: cssColor },
|
|
3215
|
-
"aria-label": "
|
|
3442
|
+
"aria-label": "Pick color"
|
|
3216
3443
|
}
|
|
3217
3444
|
) }),
|
|
3218
|
-
/* @__PURE__ */
|
|
3445
|
+
/* @__PURE__ */ jsx50(Popover2.Portal, { children: /* @__PURE__ */ jsx50(
|
|
3219
3446
|
Popover2.Content,
|
|
3220
3447
|
{
|
|
3221
3448
|
sideOffset: 8,
|
|
3222
3449
|
align: "start",
|
|
3223
3450
|
className: cn(
|
|
3224
|
-
"z-[9999] rounded-xl shadow-2xl p-3",
|
|
3451
|
+
"z-[9999] rounded-xl shadow-2xl p-3 w-[220px]",
|
|
3225
3452
|
"bg-[#1a1c2e] border border-white/10",
|
|
3226
|
-
"
|
|
3227
|
-
"animate-in fade-in-0 zoom-in-95"
|
|
3453
|
+
"focus:outline-none"
|
|
3228
3454
|
),
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
/* @__PURE__ */
|
|
3232
|
-
|
|
3233
|
-
|
|
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
|
+
] })
|
|
3234
3465
|
] }),
|
|
3235
|
-
/* @__PURE__ */
|
|
3236
|
-
]
|
|
3466
|
+
/* @__PURE__ */ jsx50(ColorPickerHexOutput, {})
|
|
3467
|
+
] })
|
|
3237
3468
|
}
|
|
3238
3469
|
) })
|
|
3239
3470
|
] }),
|
|
3240
|
-
/* @__PURE__ */
|
|
3471
|
+
/* @__PURE__ */ jsx50(
|
|
3241
3472
|
"input",
|
|
3242
3473
|
{
|
|
3243
3474
|
type: "text",
|
|
3244
3475
|
value: inputVal,
|
|
3245
|
-
onChange:
|
|
3476
|
+
onChange: (e) => {
|
|
3477
|
+
setInputVal(e.target.value);
|
|
3478
|
+
if (/^\d+(\.\d+)?\s+\d+(\.\d+)?%\s+\d+(\.\d+)?%$/.test(e.target.value.trim())) {
|
|
3479
|
+
onChange(e.target.value.trim());
|
|
3480
|
+
}
|
|
3481
|
+
},
|
|
3246
3482
|
onBlur: () => setInputVal(value),
|
|
3247
3483
|
disabled,
|
|
3248
3484
|
placeholder: "H S% L%",
|
|
3249
3485
|
className: cn(
|
|
3250
3486
|
"w-28 bg-white/5 border border-white/10 rounded px-1.5 py-0.5",
|
|
3251
|
-
"text-xs text-white/70 font-mono outline-none",
|
|
3252
|
-
"
|
|
3253
|
-
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
3487
|
+
"text-xs text-white/70 font-mono outline-none focus:border-white/30",
|
|
3488
|
+
"placeholder:text-white/20 disabled:opacity-50",
|
|
3254
3489
|
inputClassName
|
|
3255
3490
|
)
|
|
3256
3491
|
}
|
|
@@ -3259,9 +3494,9 @@ function HslColorInput({ value, onChange, className, inputClassName, disabled })
|
|
|
3259
3494
|
}
|
|
3260
3495
|
|
|
3261
3496
|
// src/hooks/index.ts
|
|
3262
|
-
import { useState as
|
|
3497
|
+
import { useState as useState9 } from "react";
|
|
3263
3498
|
function useDisclosure(initial = false) {
|
|
3264
|
-
const [isOpen, setIsOpen] =
|
|
3499
|
+
const [isOpen, setIsOpen] = useState9(initial);
|
|
3265
3500
|
return {
|
|
3266
3501
|
isOpen,
|
|
3267
3502
|
open: () => setIsOpen(true),
|
|
@@ -3271,15 +3506,15 @@ function useDisclosure(initial = false) {
|
|
|
3271
3506
|
};
|
|
3272
3507
|
}
|
|
3273
3508
|
function usePagination(total, pageSize = 20) {
|
|
3274
|
-
const [page, setPage] =
|
|
3509
|
+
const [page, setPage] = useState9(1);
|
|
3275
3510
|
const totalPages = Math.ceil(total / pageSize);
|
|
3276
3511
|
return { page, setPage, pageSize, total, totalPages };
|
|
3277
3512
|
}
|
|
3278
3513
|
|
|
3279
3514
|
// src/components/auth/AuthShell.tsx
|
|
3280
|
-
import { jsx as
|
|
3515
|
+
import { jsx as jsx51, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
3281
3516
|
function AuthShell({ children, pattern = "dots", maxWidth = "520px" }) {
|
|
3282
|
-
return /* @__PURE__ */
|
|
3517
|
+
return /* @__PURE__ */ jsxs35(
|
|
3283
3518
|
"div",
|
|
3284
3519
|
{
|
|
3285
3520
|
style: {
|
|
@@ -3294,7 +3529,7 @@ function AuthShell({ children, pattern = "dots", maxWidth = "520px" }) {
|
|
|
3294
3529
|
overflow: "hidden"
|
|
3295
3530
|
},
|
|
3296
3531
|
children: [
|
|
3297
|
-
pattern === "dots" && /* @__PURE__ */
|
|
3532
|
+
pattern === "dots" && /* @__PURE__ */ jsx51(
|
|
3298
3533
|
"div",
|
|
3299
3534
|
{
|
|
3300
3535
|
"aria-hidden": true,
|
|
@@ -3308,7 +3543,7 @@ function AuthShell({ children, pattern = "dots", maxWidth = "520px" }) {
|
|
|
3308
3543
|
}
|
|
3309
3544
|
}
|
|
3310
3545
|
),
|
|
3311
|
-
pattern === "grid" && /* @__PURE__ */
|
|
3546
|
+
pattern === "grid" && /* @__PURE__ */ jsx51(
|
|
3312
3547
|
"div",
|
|
3313
3548
|
{
|
|
3314
3549
|
"aria-hidden": true,
|
|
@@ -3322,16 +3557,16 @@ function AuthShell({ children, pattern = "dots", maxWidth = "520px" }) {
|
|
|
3322
3557
|
}
|
|
3323
3558
|
}
|
|
3324
3559
|
),
|
|
3325
|
-
/* @__PURE__ */
|
|
3560
|
+
/* @__PURE__ */ jsx51("div", { style: { position: "relative", zIndex: 1, width: "100%", maxWidth }, children })
|
|
3326
3561
|
]
|
|
3327
3562
|
}
|
|
3328
3563
|
);
|
|
3329
3564
|
}
|
|
3330
3565
|
|
|
3331
3566
|
// src/components/auth/AuthCard.tsx
|
|
3332
|
-
import { jsx as
|
|
3567
|
+
import { jsx as jsx52 } from "react/jsx-runtime";
|
|
3333
3568
|
function AuthCard({ children, padding = "24px 28px" }) {
|
|
3334
|
-
return /* @__PURE__ */
|
|
3569
|
+
return /* @__PURE__ */ jsx52(
|
|
3335
3570
|
"div",
|
|
3336
3571
|
{
|
|
3337
3572
|
style: {
|
|
@@ -3348,10 +3583,10 @@ function AuthCard({ children, padding = "24px 28px" }) {
|
|
|
3348
3583
|
}
|
|
3349
3584
|
|
|
3350
3585
|
// src/components/auth/AuthLogo.tsx
|
|
3351
|
-
import { jsx as
|
|
3586
|
+
import { jsx as jsx53, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
3352
3587
|
function AuthLogo({ appName = "Builify CMS", letter = "B", imageUrl, size = 36 }) {
|
|
3353
|
-
return /* @__PURE__ */
|
|
3354
|
-
imageUrl ? /* @__PURE__ */
|
|
3588
|
+
return /* @__PURE__ */ jsxs36("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: "10px", marginBottom: "28px" }, children: [
|
|
3589
|
+
imageUrl ? /* @__PURE__ */ jsx53(
|
|
3355
3590
|
"img",
|
|
3356
3591
|
{
|
|
3357
3592
|
src: imageUrl,
|
|
@@ -3360,7 +3595,7 @@ function AuthLogo({ appName = "Builify CMS", letter = "B", imageUrl, size = 36 }
|
|
|
3360
3595
|
height: size,
|
|
3361
3596
|
style: { borderRadius: "calc(var(--radius, 0.5rem) * 1.2)", flexShrink: 0, display: "block" }
|
|
3362
3597
|
}
|
|
3363
|
-
) : /* @__PURE__ */
|
|
3598
|
+
) : /* @__PURE__ */ jsx53(
|
|
3364
3599
|
"div",
|
|
3365
3600
|
{
|
|
3366
3601
|
style: {
|
|
@@ -3379,7 +3614,7 @@ function AuthLogo({ appName = "Builify CMS", letter = "B", imageUrl, size = 36 }
|
|
|
3379
3614
|
children: letter
|
|
3380
3615
|
}
|
|
3381
3616
|
),
|
|
3382
|
-
/* @__PURE__ */
|
|
3617
|
+
/* @__PURE__ */ jsx53(
|
|
3383
3618
|
"span",
|
|
3384
3619
|
{
|
|
3385
3620
|
style: {
|
|
@@ -3395,10 +3630,10 @@ function AuthLogo({ appName = "Builify CMS", letter = "B", imageUrl, size = 36 }
|
|
|
3395
3630
|
}
|
|
3396
3631
|
|
|
3397
3632
|
// src/components/auth/AuthHeader.tsx
|
|
3398
|
-
import { jsx as
|
|
3633
|
+
import { jsx as jsx54, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
3399
3634
|
function AuthHeader({ title, description }) {
|
|
3400
|
-
return /* @__PURE__ */
|
|
3401
|
-
/* @__PURE__ */
|
|
3635
|
+
return /* @__PURE__ */ jsxs37("div", { style: { marginBottom: "24px", textAlign: "center" }, children: [
|
|
3636
|
+
/* @__PURE__ */ jsx54(
|
|
3402
3637
|
"h1",
|
|
3403
3638
|
{
|
|
3404
3639
|
style: {
|
|
@@ -3411,7 +3646,7 @@ function AuthHeader({ title, description }) {
|
|
|
3411
3646
|
children: title
|
|
3412
3647
|
}
|
|
3413
3648
|
),
|
|
3414
|
-
description && /* @__PURE__ */
|
|
3649
|
+
description && /* @__PURE__ */ jsx54(
|
|
3415
3650
|
"p",
|
|
3416
3651
|
{
|
|
3417
3652
|
style: {
|
|
@@ -3427,12 +3662,12 @@ function AuthHeader({ title, description }) {
|
|
|
3427
3662
|
}
|
|
3428
3663
|
|
|
3429
3664
|
// src/components/auth/AuthField.tsx
|
|
3430
|
-
import { jsx as
|
|
3665
|
+
import { jsx as jsx55, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
3431
3666
|
function AuthField({ label, error, hint, rightLabel, id, ...props }) {
|
|
3432
3667
|
const fieldId = id ?? label.toLowerCase().replace(/\s+/g, "-");
|
|
3433
|
-
return /* @__PURE__ */
|
|
3434
|
-
/* @__PURE__ */
|
|
3435
|
-
/* @__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(
|
|
3436
3671
|
"label",
|
|
3437
3672
|
{
|
|
3438
3673
|
htmlFor: fieldId,
|
|
@@ -3444,9 +3679,9 @@ function AuthField({ label, error, hint, rightLabel, id, ...props }) {
|
|
|
3444
3679
|
children: label
|
|
3445
3680
|
}
|
|
3446
3681
|
),
|
|
3447
|
-
rightLabel && /* @__PURE__ */
|
|
3682
|
+
rightLabel && /* @__PURE__ */ jsx55("span", { style: { fontSize: "0.8125rem" }, children: rightLabel })
|
|
3448
3683
|
] }),
|
|
3449
|
-
/* @__PURE__ */
|
|
3684
|
+
/* @__PURE__ */ jsx55(
|
|
3450
3685
|
"input",
|
|
3451
3686
|
{
|
|
3452
3687
|
id: fieldId,
|
|
@@ -3476,13 +3711,13 @@ function AuthField({ label, error, hint, rightLabel, id, ...props }) {
|
|
|
3476
3711
|
...props
|
|
3477
3712
|
}
|
|
3478
3713
|
),
|
|
3479
|
-
error && /* @__PURE__ */
|
|
3480
|
-
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 })
|
|
3481
3716
|
] });
|
|
3482
3717
|
}
|
|
3483
3718
|
|
|
3484
3719
|
// src/components/auth/AuthButton.tsx
|
|
3485
|
-
import { Fragment as Fragment5, jsx as
|
|
3720
|
+
import { Fragment as Fragment5, jsx as jsx56, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
3486
3721
|
function AuthButton({
|
|
3487
3722
|
loading,
|
|
3488
3723
|
variant = "primary",
|
|
@@ -3525,7 +3760,7 @@ function AuthButton({
|
|
|
3525
3760
|
color: "var(--foreground)"
|
|
3526
3761
|
}
|
|
3527
3762
|
};
|
|
3528
|
-
return /* @__PURE__ */
|
|
3763
|
+
return /* @__PURE__ */ jsx56(
|
|
3529
3764
|
"button",
|
|
3530
3765
|
{
|
|
3531
3766
|
disabled: loading || disabled,
|
|
@@ -3537,8 +3772,8 @@ function AuthButton({
|
|
|
3537
3772
|
e.currentTarget.style.filter = "none";
|
|
3538
3773
|
},
|
|
3539
3774
|
...props,
|
|
3540
|
-
children: loading ? /* @__PURE__ */
|
|
3541
|
-
/* @__PURE__ */
|
|
3775
|
+
children: loading ? /* @__PURE__ */ jsxs39(Fragment5, { children: [
|
|
3776
|
+
/* @__PURE__ */ jsx56(
|
|
3542
3777
|
"span",
|
|
3543
3778
|
{
|
|
3544
3779
|
style: {
|
|
@@ -3559,19 +3794,19 @@ function AuthButton({
|
|
|
3559
3794
|
}
|
|
3560
3795
|
|
|
3561
3796
|
// src/components/auth/AuthDivider.tsx
|
|
3562
|
-
import { jsx as
|
|
3797
|
+
import { jsx as jsx57, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
3563
3798
|
function AuthDivider({ label = "or" }) {
|
|
3564
|
-
return /* @__PURE__ */
|
|
3565
|
-
/* @__PURE__ */
|
|
3566
|
-
/* @__PURE__ */
|
|
3567
|
-
/* @__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)" } })
|
|
3568
3803
|
] });
|
|
3569
3804
|
}
|
|
3570
3805
|
|
|
3571
3806
|
// src/components/auth/AuthFootnote.tsx
|
|
3572
|
-
import { jsx as
|
|
3807
|
+
import { jsx as jsx58, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
3573
3808
|
function AuthFootnote({ text, linkText, linkHref }) {
|
|
3574
|
-
return /* @__PURE__ */
|
|
3809
|
+
return /* @__PURE__ */ jsxs41("p", { style: {
|
|
3575
3810
|
textAlign: "center",
|
|
3576
3811
|
marginTop: "20px",
|
|
3577
3812
|
fontSize: "0.8125rem",
|
|
@@ -3579,7 +3814,7 @@ function AuthFootnote({ text, linkText, linkHref }) {
|
|
|
3579
3814
|
}, children: [
|
|
3580
3815
|
text,
|
|
3581
3816
|
" ",
|
|
3582
|
-
/* @__PURE__ */
|
|
3817
|
+
/* @__PURE__ */ jsx58(
|
|
3583
3818
|
"a",
|
|
3584
3819
|
{
|
|
3585
3820
|
href: linkHref,
|
|
@@ -3618,6 +3853,12 @@ export {
|
|
|
3618
3853
|
CardHeader,
|
|
3619
3854
|
CardTitle,
|
|
3620
3855
|
Checkbox,
|
|
3856
|
+
ColorPicker,
|
|
3857
|
+
ColorPickerAlpha,
|
|
3858
|
+
ColorPickerEyeDropper,
|
|
3859
|
+
ColorPickerHexOutput,
|
|
3860
|
+
ColorPickerHue,
|
|
3861
|
+
ColorPickerSelection,
|
|
3621
3862
|
ConfirmDialog,
|
|
3622
3863
|
DashboardLayout,
|
|
3623
3864
|
DataTable,
|
|
@@ -3704,6 +3945,7 @@ export {
|
|
|
3704
3945
|
badgeVariants,
|
|
3705
3946
|
buttonVariants,
|
|
3706
3947
|
cn,
|
|
3948
|
+
useColorPicker,
|
|
3707
3949
|
useDisclosure,
|
|
3708
3950
|
usePagination,
|
|
3709
3951
|
useTheme2 as useTheme
|