@webdevarif/dashui 0.3.1 → 0.3.3
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 +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +135 -39
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +134 -39
- package/dist/index.mjs.map +1 -1
- package/dist/styles/globals.css +23 -4
- package/package.json +80 -79
package/dist/index.mjs
CHANGED
|
@@ -3164,10 +3164,104 @@ function PostSidebarSection({
|
|
|
3164
3164
|
] });
|
|
3165
3165
|
}
|
|
3166
3166
|
|
|
3167
|
+
// src/components/ui/hsl-color-input.tsx
|
|
3168
|
+
import { useState as useState7, useEffect as useEffect5, useCallback } from "react";
|
|
3169
|
+
import { HslColorPicker } from "react-colorful";
|
|
3170
|
+
import * as Popover2 from "@radix-ui/react-popover";
|
|
3171
|
+
import { jsx as jsx49, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
3172
|
+
function parseHsl(value) {
|
|
3173
|
+
if (!value) return { h: 0, s: 0, l: 0 };
|
|
3174
|
+
const parts = value.trim().split(/\s+/);
|
|
3175
|
+
return {
|
|
3176
|
+
h: parseFloat(parts[0]) || 0,
|
|
3177
|
+
s: parseFloat(parts[1]) || 0,
|
|
3178
|
+
l: parseFloat(parts[2]) || 0
|
|
3179
|
+
};
|
|
3180
|
+
}
|
|
3181
|
+
function formatHsl(color) {
|
|
3182
|
+
return `${Math.round(color.h)} ${Math.round(color.s)}% ${Math.round(color.l)}%`;
|
|
3183
|
+
}
|
|
3184
|
+
function HslColorInput({ value, onChange, className, inputClassName, disabled }) {
|
|
3185
|
+
const [inputVal, setInputVal] = useState7(value);
|
|
3186
|
+
useEffect5(() => {
|
|
3187
|
+
setInputVal(value);
|
|
3188
|
+
}, [value]);
|
|
3189
|
+
const hslColor = parseHsl(value);
|
|
3190
|
+
const cssColor = value ? `hsl(${value})` : "transparent";
|
|
3191
|
+
const handlePickerChange = useCallback((color) => {
|
|
3192
|
+
const formatted = formatHsl(color);
|
|
3193
|
+
setInputVal(formatted);
|
|
3194
|
+
onChange(formatted);
|
|
3195
|
+
}, [onChange]);
|
|
3196
|
+
const handleInputChange = (e) => {
|
|
3197
|
+
const v = e.target.value;
|
|
3198
|
+
setInputVal(v);
|
|
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(
|
|
3206
|
+
"button",
|
|
3207
|
+
{
|
|
3208
|
+
type: "button",
|
|
3209
|
+
className: cn(
|
|
3210
|
+
"w-5 h-5 rounded border border-white/10 shrink-0 transition-all",
|
|
3211
|
+
"hover:scale-110 hover:border-white/30 focus:outline-none focus:ring-1 focus:ring-white/20",
|
|
3212
|
+
disabled && "opacity-50 cursor-not-allowed"
|
|
3213
|
+
),
|
|
3214
|
+
style: { background: cssColor },
|
|
3215
|
+
"aria-label": "Open color picker"
|
|
3216
|
+
}
|
|
3217
|
+
) }),
|
|
3218
|
+
/* @__PURE__ */ jsx49(Popover2.Portal, { children: /* @__PURE__ */ jsxs33(
|
|
3219
|
+
Popover2.Content,
|
|
3220
|
+
{
|
|
3221
|
+
sideOffset: 8,
|
|
3222
|
+
align: "start",
|
|
3223
|
+
className: cn(
|
|
3224
|
+
"z-[9999] rounded-xl shadow-2xl p-3",
|
|
3225
|
+
"bg-[#1a1c2e] border border-white/10",
|
|
3226
|
+
"flex flex-col gap-3",
|
|
3227
|
+
"animate-in fade-in-0 zoom-in-95"
|
|
3228
|
+
),
|
|
3229
|
+
children: [
|
|
3230
|
+
/* @__PURE__ */ jsx49(HslColorPicker, { color: hslColor, onChange: handlePickerChange }),
|
|
3231
|
+
/* @__PURE__ */ jsxs33("div", { className: "flex items-center gap-2", children: [
|
|
3232
|
+
/* @__PURE__ */ jsx49("div", { className: "w-6 h-6 rounded border border-white/10 shrink-0", style: { background: cssColor } }),
|
|
3233
|
+
/* @__PURE__ */ jsx49("span", { className: "text-xs font-mono text-white/50 truncate", children: value || "none" })
|
|
3234
|
+
] }),
|
|
3235
|
+
/* @__PURE__ */ jsx49(Popover2.Arrow, { className: "fill-white/10" })
|
|
3236
|
+
]
|
|
3237
|
+
}
|
|
3238
|
+
) })
|
|
3239
|
+
] }),
|
|
3240
|
+
/* @__PURE__ */ jsx49(
|
|
3241
|
+
"input",
|
|
3242
|
+
{
|
|
3243
|
+
type: "text",
|
|
3244
|
+
value: inputVal,
|
|
3245
|
+
onChange: handleInputChange,
|
|
3246
|
+
onBlur: () => setInputVal(value),
|
|
3247
|
+
disabled,
|
|
3248
|
+
placeholder: "H S% L%",
|
|
3249
|
+
className: cn(
|
|
3250
|
+
"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
|
+
"focus:border-white/30 placeholder:text-white/20",
|
|
3253
|
+
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
3254
|
+
inputClassName
|
|
3255
|
+
)
|
|
3256
|
+
}
|
|
3257
|
+
)
|
|
3258
|
+
] });
|
|
3259
|
+
}
|
|
3260
|
+
|
|
3167
3261
|
// src/hooks/index.ts
|
|
3168
|
-
import { useState as
|
|
3262
|
+
import { useState as useState8 } from "react";
|
|
3169
3263
|
function useDisclosure(initial = false) {
|
|
3170
|
-
const [isOpen, setIsOpen] =
|
|
3264
|
+
const [isOpen, setIsOpen] = useState8(initial);
|
|
3171
3265
|
return {
|
|
3172
3266
|
isOpen,
|
|
3173
3267
|
open: () => setIsOpen(true),
|
|
@@ -3177,15 +3271,15 @@ function useDisclosure(initial = false) {
|
|
|
3177
3271
|
};
|
|
3178
3272
|
}
|
|
3179
3273
|
function usePagination(total, pageSize = 20) {
|
|
3180
|
-
const [page, setPage] =
|
|
3274
|
+
const [page, setPage] = useState8(1);
|
|
3181
3275
|
const totalPages = Math.ceil(total / pageSize);
|
|
3182
3276
|
return { page, setPage, pageSize, total, totalPages };
|
|
3183
3277
|
}
|
|
3184
3278
|
|
|
3185
3279
|
// src/components/auth/AuthShell.tsx
|
|
3186
|
-
import { jsx as
|
|
3280
|
+
import { jsx as jsx50, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
3187
3281
|
function AuthShell({ children, pattern = "dots", maxWidth = "520px" }) {
|
|
3188
|
-
return /* @__PURE__ */
|
|
3282
|
+
return /* @__PURE__ */ jsxs34(
|
|
3189
3283
|
"div",
|
|
3190
3284
|
{
|
|
3191
3285
|
style: {
|
|
@@ -3200,7 +3294,7 @@ function AuthShell({ children, pattern = "dots", maxWidth = "520px" }) {
|
|
|
3200
3294
|
overflow: "hidden"
|
|
3201
3295
|
},
|
|
3202
3296
|
children: [
|
|
3203
|
-
pattern === "dots" && /* @__PURE__ */
|
|
3297
|
+
pattern === "dots" && /* @__PURE__ */ jsx50(
|
|
3204
3298
|
"div",
|
|
3205
3299
|
{
|
|
3206
3300
|
"aria-hidden": true,
|
|
@@ -3214,7 +3308,7 @@ function AuthShell({ children, pattern = "dots", maxWidth = "520px" }) {
|
|
|
3214
3308
|
}
|
|
3215
3309
|
}
|
|
3216
3310
|
),
|
|
3217
|
-
pattern === "grid" && /* @__PURE__ */
|
|
3311
|
+
pattern === "grid" && /* @__PURE__ */ jsx50(
|
|
3218
3312
|
"div",
|
|
3219
3313
|
{
|
|
3220
3314
|
"aria-hidden": true,
|
|
@@ -3228,16 +3322,16 @@ function AuthShell({ children, pattern = "dots", maxWidth = "520px" }) {
|
|
|
3228
3322
|
}
|
|
3229
3323
|
}
|
|
3230
3324
|
),
|
|
3231
|
-
/* @__PURE__ */
|
|
3325
|
+
/* @__PURE__ */ jsx50("div", { style: { position: "relative", zIndex: 1, width: "100%", maxWidth }, children })
|
|
3232
3326
|
]
|
|
3233
3327
|
}
|
|
3234
3328
|
);
|
|
3235
3329
|
}
|
|
3236
3330
|
|
|
3237
3331
|
// src/components/auth/AuthCard.tsx
|
|
3238
|
-
import { jsx as
|
|
3332
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
3239
3333
|
function AuthCard({ children, padding = "24px 28px" }) {
|
|
3240
|
-
return /* @__PURE__ */
|
|
3334
|
+
return /* @__PURE__ */ jsx51(
|
|
3241
3335
|
"div",
|
|
3242
3336
|
{
|
|
3243
3337
|
style: {
|
|
@@ -3254,10 +3348,10 @@ function AuthCard({ children, padding = "24px 28px" }) {
|
|
|
3254
3348
|
}
|
|
3255
3349
|
|
|
3256
3350
|
// src/components/auth/AuthLogo.tsx
|
|
3257
|
-
import { jsx as
|
|
3351
|
+
import { jsx as jsx52, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
3258
3352
|
function AuthLogo({ appName = "Builify CMS", letter = "B", imageUrl, size = 36 }) {
|
|
3259
|
-
return /* @__PURE__ */
|
|
3260
|
-
imageUrl ? /* @__PURE__ */
|
|
3353
|
+
return /* @__PURE__ */ jsxs35("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: "10px", marginBottom: "28px" }, children: [
|
|
3354
|
+
imageUrl ? /* @__PURE__ */ jsx52(
|
|
3261
3355
|
"img",
|
|
3262
3356
|
{
|
|
3263
3357
|
src: imageUrl,
|
|
@@ -3266,7 +3360,7 @@ function AuthLogo({ appName = "Builify CMS", letter = "B", imageUrl, size = 36 }
|
|
|
3266
3360
|
height: size,
|
|
3267
3361
|
style: { borderRadius: "calc(var(--radius, 0.5rem) * 1.2)", flexShrink: 0, display: "block" }
|
|
3268
3362
|
}
|
|
3269
|
-
) : /* @__PURE__ */
|
|
3363
|
+
) : /* @__PURE__ */ jsx52(
|
|
3270
3364
|
"div",
|
|
3271
3365
|
{
|
|
3272
3366
|
style: {
|
|
@@ -3285,7 +3379,7 @@ function AuthLogo({ appName = "Builify CMS", letter = "B", imageUrl, size = 36 }
|
|
|
3285
3379
|
children: letter
|
|
3286
3380
|
}
|
|
3287
3381
|
),
|
|
3288
|
-
/* @__PURE__ */
|
|
3382
|
+
/* @__PURE__ */ jsx52(
|
|
3289
3383
|
"span",
|
|
3290
3384
|
{
|
|
3291
3385
|
style: {
|
|
@@ -3301,10 +3395,10 @@ function AuthLogo({ appName = "Builify CMS", letter = "B", imageUrl, size = 36 }
|
|
|
3301
3395
|
}
|
|
3302
3396
|
|
|
3303
3397
|
// src/components/auth/AuthHeader.tsx
|
|
3304
|
-
import { jsx as
|
|
3398
|
+
import { jsx as jsx53, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
3305
3399
|
function AuthHeader({ title, description }) {
|
|
3306
|
-
return /* @__PURE__ */
|
|
3307
|
-
/* @__PURE__ */
|
|
3400
|
+
return /* @__PURE__ */ jsxs36("div", { style: { marginBottom: "24px", textAlign: "center" }, children: [
|
|
3401
|
+
/* @__PURE__ */ jsx53(
|
|
3308
3402
|
"h1",
|
|
3309
3403
|
{
|
|
3310
3404
|
style: {
|
|
@@ -3317,7 +3411,7 @@ function AuthHeader({ title, description }) {
|
|
|
3317
3411
|
children: title
|
|
3318
3412
|
}
|
|
3319
3413
|
),
|
|
3320
|
-
description && /* @__PURE__ */
|
|
3414
|
+
description && /* @__PURE__ */ jsx53(
|
|
3321
3415
|
"p",
|
|
3322
3416
|
{
|
|
3323
3417
|
style: {
|
|
@@ -3333,12 +3427,12 @@ function AuthHeader({ title, description }) {
|
|
|
3333
3427
|
}
|
|
3334
3428
|
|
|
3335
3429
|
// src/components/auth/AuthField.tsx
|
|
3336
|
-
import { jsx as
|
|
3430
|
+
import { jsx as jsx54, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
3337
3431
|
function AuthField({ label, error, hint, rightLabel, id, ...props }) {
|
|
3338
3432
|
const fieldId = id ?? label.toLowerCase().replace(/\s+/g, "-");
|
|
3339
|
-
return /* @__PURE__ */
|
|
3340
|
-
/* @__PURE__ */
|
|
3341
|
-
/* @__PURE__ */
|
|
3433
|
+
return /* @__PURE__ */ jsxs37("div", { style: { display: "flex", flexDirection: "column", gap: "6px" }, children: [
|
|
3434
|
+
/* @__PURE__ */ jsxs37("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
|
|
3435
|
+
/* @__PURE__ */ jsx54(
|
|
3342
3436
|
"label",
|
|
3343
3437
|
{
|
|
3344
3438
|
htmlFor: fieldId,
|
|
@@ -3350,9 +3444,9 @@ function AuthField({ label, error, hint, rightLabel, id, ...props }) {
|
|
|
3350
3444
|
children: label
|
|
3351
3445
|
}
|
|
3352
3446
|
),
|
|
3353
|
-
rightLabel && /* @__PURE__ */
|
|
3447
|
+
rightLabel && /* @__PURE__ */ jsx54("span", { style: { fontSize: "0.8125rem" }, children: rightLabel })
|
|
3354
3448
|
] }),
|
|
3355
|
-
/* @__PURE__ */
|
|
3449
|
+
/* @__PURE__ */ jsx54(
|
|
3356
3450
|
"input",
|
|
3357
3451
|
{
|
|
3358
3452
|
id: fieldId,
|
|
@@ -3382,13 +3476,13 @@ function AuthField({ label, error, hint, rightLabel, id, ...props }) {
|
|
|
3382
3476
|
...props
|
|
3383
3477
|
}
|
|
3384
3478
|
),
|
|
3385
|
-
error && /* @__PURE__ */
|
|
3386
|
-
hint && !error && /* @__PURE__ */
|
|
3479
|
+
error && /* @__PURE__ */ jsx54("p", { style: { fontSize: "0.8rem", color: "var(--destructive)", margin: 0 }, children: error }),
|
|
3480
|
+
hint && !error && /* @__PURE__ */ jsx54("p", { style: { fontSize: "0.8rem", color: "var(--muted-foreground)", margin: 0 }, children: hint })
|
|
3387
3481
|
] });
|
|
3388
3482
|
}
|
|
3389
3483
|
|
|
3390
3484
|
// src/components/auth/AuthButton.tsx
|
|
3391
|
-
import { Fragment as Fragment5, jsx as
|
|
3485
|
+
import { Fragment as Fragment5, jsx as jsx55, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
3392
3486
|
function AuthButton({
|
|
3393
3487
|
loading,
|
|
3394
3488
|
variant = "primary",
|
|
@@ -3431,7 +3525,7 @@ function AuthButton({
|
|
|
3431
3525
|
color: "var(--foreground)"
|
|
3432
3526
|
}
|
|
3433
3527
|
};
|
|
3434
|
-
return /* @__PURE__ */
|
|
3528
|
+
return /* @__PURE__ */ jsx55(
|
|
3435
3529
|
"button",
|
|
3436
3530
|
{
|
|
3437
3531
|
disabled: loading || disabled,
|
|
@@ -3443,8 +3537,8 @@ function AuthButton({
|
|
|
3443
3537
|
e.currentTarget.style.filter = "none";
|
|
3444
3538
|
},
|
|
3445
3539
|
...props,
|
|
3446
|
-
children: loading ? /* @__PURE__ */
|
|
3447
|
-
/* @__PURE__ */
|
|
3540
|
+
children: loading ? /* @__PURE__ */ jsxs38(Fragment5, { children: [
|
|
3541
|
+
/* @__PURE__ */ jsx55(
|
|
3448
3542
|
"span",
|
|
3449
3543
|
{
|
|
3450
3544
|
style: {
|
|
@@ -3465,19 +3559,19 @@ function AuthButton({
|
|
|
3465
3559
|
}
|
|
3466
3560
|
|
|
3467
3561
|
// src/components/auth/AuthDivider.tsx
|
|
3468
|
-
import { jsx as
|
|
3562
|
+
import { jsx as jsx56, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
3469
3563
|
function AuthDivider({ label = "or" }) {
|
|
3470
|
-
return /* @__PURE__ */
|
|
3471
|
-
/* @__PURE__ */
|
|
3472
|
-
/* @__PURE__ */
|
|
3473
|
-
/* @__PURE__ */
|
|
3564
|
+
return /* @__PURE__ */ jsxs39("div", { style: { display: "flex", alignItems: "center", gap: "12px", margin: "20px 0" }, children: [
|
|
3565
|
+
/* @__PURE__ */ jsx56("div", { style: { flex: 1, height: 1, background: "var(--border)" } }),
|
|
3566
|
+
/* @__PURE__ */ jsx56("span", { style: { fontSize: "0.75rem", color: "var(--muted-foreground)", userSelect: "none" }, children: label }),
|
|
3567
|
+
/* @__PURE__ */ jsx56("div", { style: { flex: 1, height: 1, background: "var(--border)" } })
|
|
3474
3568
|
] });
|
|
3475
3569
|
}
|
|
3476
3570
|
|
|
3477
3571
|
// src/components/auth/AuthFootnote.tsx
|
|
3478
|
-
import { jsx as
|
|
3572
|
+
import { jsx as jsx57, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
3479
3573
|
function AuthFootnote({ text, linkText, linkHref }) {
|
|
3480
|
-
return /* @__PURE__ */
|
|
3574
|
+
return /* @__PURE__ */ jsxs40("p", { style: {
|
|
3481
3575
|
textAlign: "center",
|
|
3482
3576
|
marginTop: "20px",
|
|
3483
3577
|
fontSize: "0.8125rem",
|
|
@@ -3485,7 +3579,7 @@ function AuthFootnote({ text, linkText, linkHref }) {
|
|
|
3485
3579
|
}, children: [
|
|
3486
3580
|
text,
|
|
3487
3581
|
" ",
|
|
3488
|
-
/* @__PURE__ */
|
|
3582
|
+
/* @__PURE__ */ jsx57(
|
|
3489
3583
|
"a",
|
|
3490
3584
|
{
|
|
3491
3585
|
href: linkHref,
|
|
@@ -3556,6 +3650,7 @@ export {
|
|
|
3556
3650
|
FormField,
|
|
3557
3651
|
FormLayout,
|
|
3558
3652
|
FormSection,
|
|
3653
|
+
HslColorInput,
|
|
3559
3654
|
ImagePickerField,
|
|
3560
3655
|
Input,
|
|
3561
3656
|
Label2 as Label,
|