@kilnonedre/foundation 0.0.24 → 0.0.26
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.js +61 -70
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
1
3
|
// src/render/form/index.tsx
|
|
2
4
|
import { EyeIcon, EyeOffIcon } from "lucide-react";
|
|
3
5
|
|
|
@@ -3261,25 +3263,7 @@ var FormTimePicker = (props) => {
|
|
|
3261
3263
|
// src/components/media-uploader/index.tsx
|
|
3262
3264
|
import { useCallback as useCallback2, useEffect as useEffect3, useRef as useRef2, useState as useState8 } from "react";
|
|
3263
3265
|
import { Eye as Eye2, Loader2, Plus, Trash2 } from "lucide-react";
|
|
3264
|
-
|
|
3265
|
-
// src/shadcn/components/card.tsx
|
|
3266
|
-
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
3267
|
-
function Card({ className, ...props }) {
|
|
3268
|
-
return /* @__PURE__ */ jsx46(
|
|
3269
|
-
"div",
|
|
3270
|
-
{
|
|
3271
|
-
"data-slot": "card",
|
|
3272
|
-
className: cn(
|
|
3273
|
-
"flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm",
|
|
3274
|
-
className
|
|
3275
|
-
),
|
|
3276
|
-
...props
|
|
3277
|
-
}
|
|
3278
|
-
);
|
|
3279
|
-
}
|
|
3280
|
-
|
|
3281
|
-
// src/components/media-uploader/index.tsx
|
|
3282
|
-
import { jsx as jsx47, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
3266
|
+
import { jsx as jsx46, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
3283
3267
|
var MediaUploader = ({ value = [], ...props }) => {
|
|
3284
3268
|
const inputRef = useRef2(null);
|
|
3285
3269
|
const [items, setItems] = useState8([]);
|
|
@@ -3406,7 +3390,7 @@ var MediaUploader = ({ value = [], ...props }) => {
|
|
|
3406
3390
|
};
|
|
3407
3391
|
const showUploadButton = canEdit && (!props.multiple && items.length === 0 || props.multiple);
|
|
3408
3392
|
return /* @__PURE__ */ jsxs28("div", { className: cn2("space-y-3", props.className), children: [
|
|
3409
|
-
/* @__PURE__ */
|
|
3393
|
+
/* @__PURE__ */ jsx46(
|
|
3410
3394
|
"input",
|
|
3411
3395
|
{
|
|
3412
3396
|
ref: inputRef,
|
|
@@ -3423,56 +3407,63 @@ var MediaUploader = ({ value = [], ...props }) => {
|
|
|
3423
3407
|
}
|
|
3424
3408
|
}
|
|
3425
3409
|
),
|
|
3426
|
-
/* @__PURE__ */
|
|
3427
|
-
items.map((it, index) => /* @__PURE__ */
|
|
3428
|
-
|
|
3429
|
-
"img",
|
|
3430
|
-
{
|
|
3431
|
-
src: it.url ?? it.localUrl,
|
|
3432
|
-
alt: "",
|
|
3433
|
-
className: "h-full w-full object-cover"
|
|
3434
|
-
}
|
|
3435
|
-
) : /* @__PURE__ */ jsx47("div", { className: "h-full w-full" }),
|
|
3436
|
-
it.uploading && /* @__PURE__ */ jsx47("div", { className: "absolute inset-0 flex items-center justify-center bg-black/40", children: /* @__PURE__ */ jsx47(Loader2, { className: "h-6 w-6 animate-spin text-white" }) }),
|
|
3437
|
-
!it.uploading && (it.url || it.localUrl) && /* @__PURE__ */ jsxs28("div", { className: "absolute inset-0 flex items-start justify-end gap-2 p-2 opacity-0 transition group-hover:opacity-100", children: [
|
|
3438
|
-
/* @__PURE__ */ jsx47(
|
|
3439
|
-
Button,
|
|
3440
|
-
{
|
|
3441
|
-
size: "icon",
|
|
3442
|
-
variant: "secondary",
|
|
3443
|
-
className: "h-8 w-8",
|
|
3444
|
-
onClick: () => setPreview(it),
|
|
3445
|
-
type: "button",
|
|
3446
|
-
children: /* @__PURE__ */ jsx47(Eye2, { className: "h-4 w-4" })
|
|
3447
|
-
}
|
|
3448
|
-
),
|
|
3449
|
-
canEdit && /* @__PURE__ */ jsx47(
|
|
3450
|
-
Button,
|
|
3451
|
-
{
|
|
3452
|
-
size: "icon",
|
|
3453
|
-
variant: "destructive",
|
|
3454
|
-
className: "h-8 w-8",
|
|
3455
|
-
onClick: () => remove(it.id),
|
|
3456
|
-
type: "button",
|
|
3457
|
-
children: /* @__PURE__ */ jsx47(Trash2, { className: "h-4 w-4" })
|
|
3458
|
-
}
|
|
3459
|
-
)
|
|
3460
|
-
] })
|
|
3461
|
-
] }) }, it.id + index)),
|
|
3462
|
-
showUploadButton && /* @__PURE__ */ jsx47(
|
|
3463
|
-
Card,
|
|
3410
|
+
/* @__PURE__ */ jsx46(ScrollArea, { className: "rounded-lg border", children: /* @__PURE__ */ jsxs28("div", { className: "grid grid-cols-2 gap-3 p-3 sm:grid-cols-3 lg:grid-cols-4", children: [
|
|
3411
|
+
items.map((it, index) => /* @__PURE__ */ jsx46(
|
|
3412
|
+
"div",
|
|
3464
3413
|
{
|
|
3465
|
-
className: "
|
|
3414
|
+
className: "rounded-xl border bg-card text-card-foreground shadow group overflow-hidden",
|
|
3415
|
+
children: /* @__PURE__ */ jsxs28("div", { className: "relative aspect-square bg-muted", children: [
|
|
3416
|
+
it.url || it.localUrl ? /* @__PURE__ */ jsx46(
|
|
3417
|
+
"img",
|
|
3418
|
+
{
|
|
3419
|
+
src: it.url ?? it.localUrl,
|
|
3420
|
+
alt: "",
|
|
3421
|
+
className: "h-full w-full object-cover"
|
|
3422
|
+
}
|
|
3423
|
+
) : /* @__PURE__ */ jsx46("div", { className: "h-full w-full" }),
|
|
3424
|
+
it.uploading && /* @__PURE__ */ jsx46("div", { className: "absolute inset-0 flex items-center justify-center bg-black/40", children: /* @__PURE__ */ jsx46(Loader2, { className: "h-6 w-6 animate-spin text-white" }) }),
|
|
3425
|
+
!it.uploading && (it.url || it.localUrl) && /* @__PURE__ */ jsxs28("div", { className: "absolute inset-0 flex items-start justify-end gap-2 p-2 opacity-0 transition group-hover:opacity-100", children: [
|
|
3426
|
+
/* @__PURE__ */ jsx46(
|
|
3427
|
+
Button,
|
|
3428
|
+
{
|
|
3429
|
+
size: "icon",
|
|
3430
|
+
variant: "secondary",
|
|
3431
|
+
className: "h-8 w-8",
|
|
3432
|
+
onClick: () => setPreview(it),
|
|
3433
|
+
type: "button",
|
|
3434
|
+
children: /* @__PURE__ */ jsx46(Eye2, { className: "h-4 w-4" })
|
|
3435
|
+
}
|
|
3436
|
+
),
|
|
3437
|
+
canEdit && /* @__PURE__ */ jsx46(
|
|
3438
|
+
Button,
|
|
3439
|
+
{
|
|
3440
|
+
size: "icon",
|
|
3441
|
+
variant: "destructive",
|
|
3442
|
+
className: "h-8 w-8",
|
|
3443
|
+
onClick: () => remove(it.id),
|
|
3444
|
+
type: "button",
|
|
3445
|
+
children: /* @__PURE__ */ jsx46(Trash2, { className: "h-4 w-4" })
|
|
3446
|
+
}
|
|
3447
|
+
)
|
|
3448
|
+
] })
|
|
3449
|
+
] })
|
|
3450
|
+
},
|
|
3451
|
+
it.id + index
|
|
3452
|
+
)),
|
|
3453
|
+
showUploadButton && /* @__PURE__ */ jsx46(
|
|
3454
|
+
"div",
|
|
3455
|
+
{
|
|
3456
|
+
className: "rounded-xl border bg-card text-card-foreground shadow flex aspect-square cursor-pointer items-center justify-center hover:bg-muted/50",
|
|
3466
3457
|
onClick: () => {
|
|
3467
3458
|
inputRef.current?.click();
|
|
3468
3459
|
},
|
|
3469
|
-
children: /* @__PURE__ */
|
|
3460
|
+
children: /* @__PURE__ */ jsx46(Plus, { className: "h-6 w-6 text-muted-foreground" })
|
|
3470
3461
|
}
|
|
3471
3462
|
)
|
|
3472
3463
|
] }) }),
|
|
3473
|
-
/* @__PURE__ */
|
|
3474
|
-
/* @__PURE__ */
|
|
3475
|
-
preview && /* @__PURE__ */
|
|
3464
|
+
/* @__PURE__ */ jsx46(Dialog, { open: !!preview, onOpenChange: () => setPreview(null), children: /* @__PURE__ */ jsxs28(DialogContent, { className: "max-w-3xl", children: [
|
|
3465
|
+
/* @__PURE__ */ jsx46(DialogHeader, { children: /* @__PURE__ */ jsx46(DialogTitle, { children: "\u9884\u89C8" }) }),
|
|
3466
|
+
preview && /* @__PURE__ */ jsx46("div", { className: "relative aspect-video w-full overflow-hidden rounded-lg bg-muted", children: /* @__PURE__ */ jsx46(
|
|
3476
3467
|
"img",
|
|
3477
3468
|
{
|
|
3478
3469
|
src: preview.url ?? preview.localUrl ?? "",
|
|
@@ -3485,27 +3476,27 @@ var MediaUploader = ({ value = [], ...props }) => {
|
|
|
3485
3476
|
};
|
|
3486
3477
|
|
|
3487
3478
|
// src/components/provider/index.tsx
|
|
3488
|
-
import { jsx as
|
|
3479
|
+
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
3489
3480
|
var Provider = ({ children }) => {
|
|
3490
|
-
return /* @__PURE__ */
|
|
3481
|
+
return /* @__PURE__ */ jsx47(TooltipProvider, { children });
|
|
3491
3482
|
};
|
|
3492
3483
|
|
|
3493
3484
|
// src/components/title/index.tsx
|
|
3494
|
-
import { jsx as
|
|
3485
|
+
import { jsx as jsx48 } from "react/jsx-runtime";
|
|
3495
3486
|
var Title = (props) => {
|
|
3496
|
-
return /* @__PURE__ */
|
|
3487
|
+
return /* @__PURE__ */ jsx48("div", { className: cn2("text-lg font-bold", props.className), children: props.children });
|
|
3497
3488
|
};
|
|
3498
3489
|
|
|
3499
3490
|
// src/render/column/build-column/index.tsx
|
|
3500
|
-
import { jsx as
|
|
3491
|
+
import { jsx as jsx49 } from "react/jsx-runtime";
|
|
3501
3492
|
var buildColumn = () => (props) => {
|
|
3502
3493
|
const { key, label, render } = props;
|
|
3503
3494
|
return {
|
|
3504
3495
|
accessorKey: key,
|
|
3505
|
-
header: () => /* @__PURE__ */
|
|
3496
|
+
header: () => /* @__PURE__ */ jsx49(TableHeaderText, { text: label }),
|
|
3506
3497
|
cell: ({ row }) => {
|
|
3507
3498
|
const value = row.original[key];
|
|
3508
|
-
return render ? render(value, row.original) : /* @__PURE__ */
|
|
3499
|
+
return render ? render(value, row.original) : /* @__PURE__ */ jsx49(TableText, { text: String(value ?? "") });
|
|
3509
3500
|
},
|
|
3510
3501
|
meta: {
|
|
3511
3502
|
label
|