@runlume/admin-ui 0.1.0 → 0.2.0
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/README.en.md +7 -5
- package/README.md +5 -4
- package/dist-package/_virtual/_rolldown/runtime.cjs +1 -0
- package/dist-package/admin-ui.cjs +1 -0
- package/dist-package/admin-ui.d.ts +41 -1
- package/dist-package/admin-ui.d.ts.map +1 -1
- package/dist-package/admin-ui.js +79 -0
- package/dist-package/components/calendar.cjs +1 -0
- package/dist-package/components/calendar.d.ts +13 -0
- package/dist-package/components/calendar.d.ts.map +1 -0
- package/dist-package/components/calendar.js +91 -0
- package/dist-package/components/cascader.cjs +1 -0
- package/dist-package/components/cascader.d.ts +19 -0
- package/dist-package/components/cascader.d.ts.map +1 -0
- package/dist-package/components/cascader.js +85 -0
- package/dist-package/components/charts.cjs +1 -0
- package/dist-package/components/charts.d.ts +80 -0
- package/dist-package/components/charts.d.ts.map +1 -0
- package/dist-package/components/charts.js +374 -0
- package/dist-package/components/code-block.cjs +1 -0
- package/dist-package/components/code-block.d.ts +7 -0
- package/dist-package/components/code-block.d.ts.map +1 -0
- package/dist-package/components/code-block.js +47 -0
- package/dist-package/components/column-chart.cjs +1 -0
- package/dist-package/components/column-chart.d.ts +18 -0
- package/dist-package/components/column-chart.d.ts.map +1 -0
- package/dist-package/components/column-chart.js +89 -0
- package/dist-package/components/combobox.cjs +1 -0
- package/dist-package/components/combobox.d.ts +24 -0
- package/dist-package/components/combobox.d.ts.map +1 -0
- package/dist-package/components/combobox.js +111 -0
- package/dist-package/components/confirm-dialog.cjs +1 -0
- package/dist-package/components/confirm-dialog.d.ts +17 -0
- package/dist-package/components/confirm-dialog.d.ts.map +1 -0
- package/dist-package/components/confirm-dialog.js +44 -0
- package/dist-package/components/count-to.cjs +1 -0
- package/dist-package/components/count-to.d.ts +13 -0
- package/dist-package/components/count-to.d.ts.map +1 -0
- package/dist-package/components/count-to.js +36 -0
- package/dist-package/components/cursor-pagination.cjs +1 -0
- package/dist-package/components/cursor-pagination.d.ts +11 -0
- package/dist-package/components/cursor-pagination.d.ts.map +1 -0
- package/dist-package/components/cursor-pagination.js +39 -0
- package/dist-package/components/data-table.cjs +1 -0
- package/dist-package/components/data-table.d.ts +69 -0
- package/dist-package/components/data-table.d.ts.map +1 -0
- package/dist-package/components/data-table.js +377 -0
- package/dist-package/components/descriptions.cjs +1 -0
- package/dist-package/components/descriptions.d.ts +16 -0
- package/dist-package/components/descriptions.d.ts.map +1 -0
- package/dist-package/components/descriptions.js +28 -0
- package/dist-package/components/editable-table.cjs +1 -0
- package/dist-package/components/editable-table.d.ts +27 -0
- package/dist-package/components/editable-table.d.ts.map +1 -0
- package/dist-package/components/editable-table.js +212 -0
- package/dist-package/components/filter-presets.cjs +1 -0
- package/dist-package/components/filter-presets.d.ts +11 -0
- package/dist-package/components/filter-presets.d.ts.map +1 -0
- package/dist-package/components/filter-presets.js +17 -0
- package/dist-package/components/fixed-bar.cjs +1 -0
- package/dist-package/components/fixed-bar.d.ts +11 -0
- package/dist-package/components/fixed-bar.d.ts.map +1 -0
- package/dist-package/components/fixed-bar.js +18 -0
- package/dist-package/components/image-preview.cjs +1 -0
- package/dist-package/components/image-preview.d.ts +14 -0
- package/dist-package/components/image-preview.d.ts.map +1 -0
- package/dist-package/components/image-preview.js +166 -0
- package/dist-package/components/layout-container.cjs +1 -0
- package/dist-package/components/layout-container.d.ts +17 -0
- package/dist-package/components/layout-container.d.ts.map +1 -0
- package/dist-package/components/layout-container.js +85 -0
- package/dist-package/components/mention.cjs +1 -0
- package/dist-package/components/mention.d.ts +20 -0
- package/dist-package/components/mention.d.ts.map +1 -0
- package/dist-package/components/mention.js +126 -0
- package/dist-package/components/multi-select.cjs +1 -0
- package/dist-package/components/multi-select.d.ts +17 -0
- package/dist-package/components/multi-select.d.ts.map +1 -0
- package/dist-package/components/multi-select.js +126 -0
- package/dist-package/components/multi-step-loader.cjs +1 -0
- package/dist-package/components/multi-step-loader.d.ts +18 -0
- package/dist-package/components/multi-step-loader.d.ts.map +1 -0
- package/dist-package/components/multi-step-loader.js +38 -0
- package/dist-package/components/page-button.cjs +1 -0
- package/dist-package/components/page-button.d.ts +6 -0
- package/dist-package/components/page-button.d.ts.map +1 -0
- package/dist-package/components/page-button.js +24 -0
- package/dist-package/components/page-pager.cjs +1 -0
- package/dist-package/components/page-pager.d.ts +11 -0
- package/dist-package/components/page-pager.d.ts.map +1 -0
- package/dist-package/components/page-pager.js +51 -0
- package/dist-package/components/page.cjs +1 -0
- package/dist-package/components/page.d.ts +34 -0
- package/dist-package/components/page.d.ts.map +1 -0
- package/dist-package/components/page.js +208 -0
- package/dist-package/components/pagination-bar.cjs +1 -0
- package/dist-package/components/pagination-bar.d.ts +8 -0
- package/dist-package/components/pagination-bar.d.ts.map +1 -0
- package/dist-package/components/pagination-bar.js +23 -0
- package/dist-package/components/password-strength.cjs +1 -0
- package/dist-package/components/password-strength.d.ts +11 -0
- package/dist-package/components/password-strength.d.ts.map +1 -0
- package/dist-package/components/password-strength.js +70 -0
- package/dist-package/components/rate.cjs +1 -0
- package/dist-package/components/rate.d.ts +13 -0
- package/dist-package/components/rate.d.ts.map +1 -0
- package/dist-package/components/rate.js +56 -0
- package/dist-package/components/resizable-panel.cjs +1 -0
- package/dist-package/components/resizable-panel.d.ts +15 -0
- package/dist-package/components/resizable-panel.d.ts.map +1 -0
- package/dist-package/components/resizable-panel.js +56 -0
- package/dist-package/components/search-filters.cjs +1 -0
- package/dist-package/components/search-filters.d.ts +31 -0
- package/dist-package/components/search-filters.d.ts.map +1 -0
- package/dist-package/components/search-filters.js +110 -0
- package/dist-package/components/sortable-list.cjs +1 -0
- package/dist-package/components/sortable-list.d.ts +14 -0
- package/dist-package/components/sortable-list.d.ts.map +1 -0
- package/dist-package/components/sortable-list.js +48 -0
- package/dist-package/components/sparkline.cjs +1 -0
- package/dist-package/components/sparkline.d.ts +11 -0
- package/dist-package/components/sparkline.d.ts.map +1 -0
- package/dist-package/components/sparkline.js +50 -0
- package/dist-package/components/status-badge.cjs +1 -0
- package/dist-package/components/status-badge.d.ts +4 -0
- package/dist-package/components/status-badge.d.ts.map +1 -0
- package/dist-package/components/status-badge.js +28 -0
- package/dist-package/components/steps.cjs +1 -0
- package/dist-package/components/steps.d.ts +15 -0
- package/dist-package/components/steps.d.ts.map +1 -0
- package/dist-package/components/steps.js +41 -0
- package/dist-package/components/storage-box.cjs +1 -0
- package/dist-package/components/storage-box.d.ts +19 -0
- package/dist-package/components/storage-box.d.ts.map +1 -0
- package/dist-package/components/storage-box.js +153 -0
- package/dist-package/components/table-cell-overflow.cjs +1 -0
- package/dist-package/components/table-cell-overflow.d.ts +5 -0
- package/dist-package/components/table-cell-overflow.d.ts.map +1 -0
- package/dist-package/components/table-cell-overflow.js +31 -0
- package/dist-package/components/table-toolbar.cjs +1 -0
- package/dist-package/components/table-toolbar.d.ts +5 -0
- package/dist-package/components/table-toolbar.d.ts.map +1 -0
- package/dist-package/components/table-toolbar.js +11 -0
- package/dist-package/components/timeline.cjs +1 -0
- package/dist-package/components/timeline.d.ts +14 -0
- package/dist-package/components/timeline.d.ts.map +1 -0
- package/dist-package/components/timeline.js +40 -0
- package/dist-package/components/transfer.cjs +1 -0
- package/dist-package/components/transfer.d.ts +18 -0
- package/dist-package/components/transfer.d.ts.map +1 -0
- package/dist-package/components/transfer.js +98 -0
- package/dist-package/components/tree-table.cjs +1 -0
- package/dist-package/components/tree-table.d.ts +23 -0
- package/dist-package/components/tree-table.d.ts.map +1 -0
- package/dist-package/components/tree-table.js +53 -0
- package/dist-package/components/tree.cjs +1 -0
- package/dist-package/components/tree.d.ts +36 -0
- package/dist-package/components/tree.d.ts.map +1 -0
- package/dist-package/components/tree.js +204 -0
- package/dist-package/components/trend.cjs +1 -0
- package/dist-package/components/trend.d.ts +19 -0
- package/dist-package/components/trend.d.ts.map +1 -0
- package/dist-package/components/trend.js +18 -0
- package/dist-package/components/ui/alert-dialog.cjs +1 -0
- package/dist-package/components/ui/alert-dialog.js +57 -0
- package/dist-package/components/ui/alert.cjs +1 -0
- package/dist-package/components/ui/alert.js +63 -0
- package/dist-package/components/ui/avatar.cjs +1 -0
- package/dist-package/components/ui/avatar.js +27 -0
- package/dist-package/components/ui/badge.cjs +1 -0
- package/dist-package/components/ui/badge.js +40 -0
- package/dist-package/components/ui/breadcrumb.cjs +1 -0
- package/dist-package/components/ui/breadcrumb.js +70 -0
- package/dist-package/components/ui/button.cjs +1 -0
- package/dist-package/components/ui/button.js +58 -0
- package/dist-package/components/ui/card.cjs +1 -0
- package/dist-package/components/ui/card.js +55 -0
- package/dist-package/components/ui/checkbox.cjs +1 -0
- package/dist-package/components/ui/checkbox.js +19 -0
- package/dist-package/components/ui/collapsible.cjs +1 -0
- package/dist-package/components/ui/collapsible.js +32 -0
- package/dist-package/components/ui/context-menu.cjs +1 -0
- package/dist-package/components/ui/context-menu.js +46 -0
- package/dist-package/components/ui/date-input.cjs +1 -0
- package/dist-package/components/ui/date-input.js +183 -0
- package/dist-package/components/ui/date-range-input.cjs +1 -0
- package/dist-package/components/ui/date-range-input.js +209 -0
- package/dist-package/components/ui/date-time-input.cjs +1 -0
- package/dist-package/components/ui/date-time-input.js +23 -0
- package/dist-package/components/ui/dialog.cjs +1 -0
- package/dist-package/components/ui/dialog.js +189 -0
- package/dist-package/components/ui/dropdown-menu.cjs +1 -0
- package/dist-package/components/ui/dropdown-menu.js +124 -0
- package/dist-package/components/ui/file-upload.cjs +1 -0
- package/dist-package/components/ui/file-upload.js +160 -0
- package/dist-package/components/ui/hover-card.cjs +1 -0
- package/dist-package/components/ui/hover-card.js +28 -0
- package/dist-package/components/ui/input-otp.cjs +1 -0
- package/dist-package/components/ui/input-otp.js +33 -0
- package/dist-package/components/ui/input.cjs +1 -0
- package/dist-package/components/ui/input.js +65 -0
- package/dist-package/components/ui/kbd.cjs +1 -0
- package/dist-package/components/ui/kbd.js +20 -0
- package/dist-package/components/ui/label.cjs +1 -0
- package/dist-package/components/ui/label.js +14 -0
- package/dist-package/components/ui/native-select.cjs +1 -0
- package/dist-package/components/ui/native-select.js +125 -0
- package/dist-package/components/ui/number-field.cjs +1 -0
- package/dist-package/components/ui/number-field.js +50 -0
- package/dist-package/components/ui/progress.cjs +1 -0
- package/dist-package/components/ui/progress.js +28 -0
- package/dist-package/components/ui/radio-group.cjs +1 -0
- package/dist-package/components/ui/radio-group.js +27 -0
- package/dist-package/components/ui/scroll-area.cjs +1 -0
- package/dist-package/components/ui/scroll-area.js +25 -0
- package/dist-package/components/ui/select.cjs +1 -0
- package/dist-package/components/ui/select.js +23 -0
- package/dist-package/components/ui/separator.cjs +1 -0
- package/dist-package/components/ui/separator.js +17 -0
- package/dist-package/components/ui/sheet.cjs +1 -0
- package/dist-package/components/ui/sheet.js +86 -0
- package/dist-package/components/ui/sidebar.cjs +1 -0
- package/dist-package/components/ui/sidebar.js +350 -0
- package/dist-package/components/ui/skeleton.cjs +1 -0
- package/dist-package/components/ui/skeleton.js +12 -0
- package/dist-package/components/ui/slider.cjs +1 -0
- package/dist-package/components/ui/slider.js +36 -0
- package/dist-package/components/ui/switch.cjs +1 -0
- package/dist-package/components/ui/switch.js +14 -0
- package/dist-package/components/ui/table.cjs +1 -0
- package/dist-package/components/ui/table.js +66 -0
- package/dist-package/components/ui/tabs.cjs +1 -0
- package/dist-package/components/ui/tabs.js +47 -0
- package/dist-package/components/ui/tag-variants.cjs +1 -0
- package/dist-package/components/ui/tag-variants.js +15 -0
- package/dist-package/components/ui/tag.cjs +1 -0
- package/dist-package/components/ui/tag.js +31 -0
- package/dist-package/components/ui/textarea.cjs +1 -0
- package/dist-package/components/ui/textarea.js +13 -0
- package/dist-package/components/ui/time-input.cjs +1 -0
- package/dist-package/components/ui/time-input.js +89 -0
- package/dist-package/components/ui/tooltip.cjs +1 -0
- package/dist-package/components/ui/tooltip.js +35 -0
- package/dist-package/hooks/use-mobile.cjs +1 -0
- package/dist-package/hooks/use-mobile.js +11 -0
- package/dist-package/lib/dialog-focus.cjs +1 -0
- package/dist-package/lib/dialog-focus.js +10 -0
- package/dist-package/lib/metrics.cjs +1 -0
- package/dist-package/lib/metrics.d.ts +18 -0
- package/dist-package/lib/metrics.d.ts.map +1 -0
- package/dist-package/lib/metrics.js +22 -0
- package/dist-package/lib/pager.cjs +1 -0
- package/dist-package/lib/pager.d.ts +8 -0
- package/dist-package/lib/pager.d.ts.map +1 -0
- package/dist-package/lib/pager.js +18 -0
- package/dist-package/lib/password.cjs +1 -0
- package/dist-package/lib/password.d.ts +14 -0
- package/dist-package/lib/password.d.ts.map +1 -0
- package/dist-package/lib/password.js +34 -0
- package/dist-package/lib/presets.cjs +1 -0
- package/dist-package/lib/presets.d.ts +25 -0
- package/dist-package/lib/presets.d.ts.map +1 -0
- package/dist-package/lib/presets.js +48 -0
- package/dist-package/lib/range.cjs +1 -0
- package/dist-package/lib/range.js +57 -0
- package/dist-package/lib/storage-key.cjs +1 -0
- package/dist-package/lib/storage-key.d.ts +2 -0
- package/dist-package/lib/storage-key.d.ts.map +1 -0
- package/dist-package/lib/storage-key.js +6 -0
- package/dist-package/lib/table-prefs.cjs +1 -0
- package/dist-package/lib/table-prefs.d.ts +17 -0
- package/dist-package/lib/table-prefs.d.ts.map +1 -0
- package/dist-package/lib/table-prefs.js +64 -0
- package/dist-package/lib/tree.cjs +1 -0
- package/dist-package/lib/tree.d.ts +37 -0
- package/dist-package/lib/tree.d.ts.map +1 -0
- package/dist-package/lib/tree.js +57 -0
- package/dist-package/lib/use-ui-translation.cjs +1 -0
- package/dist-package/lib/use-ui-translation.d.ts +15 -0
- package/dist-package/lib/use-ui-translation.d.ts.map +1 -0
- package/dist-package/lib/use-ui-translation.js +65 -0
- package/dist-package/lib/utils.cjs +1 -0
- package/dist-package/lib/utils.js +8 -0
- package/dist-package/styles.css +1 -1
- package/package.json +25 -15
- package/dist-package/index.js +0 -12212
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { cn as e } from "../lib/utils.js";
|
|
2
|
+
import { Button as t } from "./ui/button.js";
|
|
3
|
+
import { useUiTranslation as n } from "../lib/use-ui-translation.js";
|
|
4
|
+
import { AlertCircle as r, ArrowLeft as i, Copy as a, Inbox as o, LoaderCircle as s, RefreshCw as c } from "lucide-react";
|
|
5
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
6
|
+
import { toast as d } from "sonner";
|
|
7
|
+
//#region src/components/page.tsx
|
|
8
|
+
function f({ title: e, description: t, eyebrow: n, actions: r }) {
|
|
9
|
+
return /* @__PURE__ */ u("header", {
|
|
10
|
+
className: "mb-8 flex flex-wrap items-end justify-between gap-5",
|
|
11
|
+
children: [/* @__PURE__ */ u("div", {
|
|
12
|
+
className: "min-w-0",
|
|
13
|
+
children: [
|
|
14
|
+
/* @__PURE__ */ l("p", {
|
|
15
|
+
"data-slot": "page-eyebrow",
|
|
16
|
+
className: "mb-2 text-xs font-medium tracking-wide text-primary",
|
|
17
|
+
children: n
|
|
18
|
+
}),
|
|
19
|
+
/* @__PURE__ */ l("h1", {
|
|
20
|
+
className: "text-2xl font-semibold tracking-tight sm:text-[28px]",
|
|
21
|
+
children: e
|
|
22
|
+
}),
|
|
23
|
+
t && /* @__PURE__ */ l("p", {
|
|
24
|
+
className: "mt-2 max-w-2xl text-sm leading-6 text-muted-foreground",
|
|
25
|
+
children: t
|
|
26
|
+
})
|
|
27
|
+
]
|
|
28
|
+
}), r && /* @__PURE__ */ l("div", {
|
|
29
|
+
className: "flex shrink-0 items-center gap-2",
|
|
30
|
+
children: r
|
|
31
|
+
})]
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function p({ title: t, description: r, action: i, icon: a, size: s = "default" }) {
|
|
35
|
+
let { t: c } = n();
|
|
36
|
+
return /* @__PURE__ */ u("div", {
|
|
37
|
+
"data-size": s,
|
|
38
|
+
className: e("flex flex-col items-center justify-center rounded-xl bg-muted/35 px-6 py-10 text-center", s === "compact" ? "min-h-32" : "min-h-64"),
|
|
39
|
+
children: [
|
|
40
|
+
/* @__PURE__ */ l("div", {
|
|
41
|
+
className: "mb-4 flex size-11 items-center justify-center rounded-xl border bg-muted",
|
|
42
|
+
children: a ?? /* @__PURE__ */ l(o, { className: "size-5 text-muted-foreground" })
|
|
43
|
+
}),
|
|
44
|
+
/* @__PURE__ */ l("h3", {
|
|
45
|
+
className: "text-sm font-medium",
|
|
46
|
+
children: t ?? c("empty")
|
|
47
|
+
}),
|
|
48
|
+
/* @__PURE__ */ l("p", {
|
|
49
|
+
className: "mt-2 max-w-sm text-sm leading-6 text-muted-foreground",
|
|
50
|
+
children: r ?? c("emptyDescription")
|
|
51
|
+
}),
|
|
52
|
+
i && /* @__PURE__ */ l("div", {
|
|
53
|
+
className: "mt-5",
|
|
54
|
+
children: i
|
|
55
|
+
})
|
|
56
|
+
]
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function m({ message: e, traceId: i, retry: a }) {
|
|
60
|
+
let { t: o } = n();
|
|
61
|
+
return /* @__PURE__ */ l("section", {
|
|
62
|
+
role: "alert",
|
|
63
|
+
className: "rounded-lg border border-danger/25 bg-danger-soft px-5 py-4",
|
|
64
|
+
children: /* @__PURE__ */ u("div", {
|
|
65
|
+
className: "flex items-start gap-3",
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ l(r, { className: "mt-0.5 size-5 shrink-0 text-danger" }),
|
|
68
|
+
/* @__PURE__ */ u("div", {
|
|
69
|
+
className: "min-w-0 flex-1",
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ l("h2", {
|
|
72
|
+
className: "font-medium text-danger",
|
|
73
|
+
children: o("errorTitle")
|
|
74
|
+
}),
|
|
75
|
+
/* @__PURE__ */ l("p", {
|
|
76
|
+
className: "mt-1 text-sm leading-6 text-foreground",
|
|
77
|
+
children: e
|
|
78
|
+
}),
|
|
79
|
+
i && /* @__PURE__ */ u("p", {
|
|
80
|
+
className: "mt-2 text-xs text-muted-foreground",
|
|
81
|
+
children: [
|
|
82
|
+
o("trace"),
|
|
83
|
+
": ",
|
|
84
|
+
/* @__PURE__ */ l(g, { value: i })
|
|
85
|
+
]
|
|
86
|
+
})
|
|
87
|
+
]
|
|
88
|
+
}),
|
|
89
|
+
a && /* @__PURE__ */ u(t, {
|
|
90
|
+
variant: "outline",
|
|
91
|
+
size: "sm",
|
|
92
|
+
onClick: a,
|
|
93
|
+
children: [/* @__PURE__ */ l(c, { className: "size-3.5" }), o("retry")]
|
|
94
|
+
})
|
|
95
|
+
]
|
|
96
|
+
})
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function h({ variant: t = "spinner", label: r } = {}) {
|
|
100
|
+
let { t: i } = n();
|
|
101
|
+
return t === "spinner" ? /* @__PURE__ */ u("div", {
|
|
102
|
+
role: "status",
|
|
103
|
+
className: "flex min-h-60 items-center justify-center gap-3 text-muted-foreground",
|
|
104
|
+
children: [/* @__PURE__ */ l(s, { className: "size-5 animate-spin" }), /* @__PURE__ */ l("span", { children: r ?? i("loading") })]
|
|
105
|
+
}) : /* @__PURE__ */ u("div", {
|
|
106
|
+
role: "status",
|
|
107
|
+
className: "flex min-h-60 flex-col items-center justify-center gap-3 text-muted-foreground",
|
|
108
|
+
children: [/* @__PURE__ */ l("span", {
|
|
109
|
+
"aria-hidden": "true",
|
|
110
|
+
className: "flex items-end gap-1",
|
|
111
|
+
children: [
|
|
112
|
+
0,
|
|
113
|
+
1,
|
|
114
|
+
2,
|
|
115
|
+
3
|
|
116
|
+
].map((n) => /* @__PURE__ */ l("span", {
|
|
117
|
+
className: e("w-1.5 rounded-full bg-primary/60", t === "dots" ? "size-2 animate-bounce" : "animate-pulse"),
|
|
118
|
+
style: {
|
|
119
|
+
animationDelay: `${n * 120}ms`,
|
|
120
|
+
height: t === "bars" ? `${10 + n * 4}px` : void 0
|
|
121
|
+
}
|
|
122
|
+
}, n))
|
|
123
|
+
}), /* @__PURE__ */ l("span", { children: r ?? i("loading") })]
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
function g({ value: e }) {
|
|
127
|
+
let { t: r } = n();
|
|
128
|
+
async function i() {
|
|
129
|
+
try {
|
|
130
|
+
await navigator.clipboard.writeText(e), d.success(r("copied"));
|
|
131
|
+
} catch {
|
|
132
|
+
d.error(r("copyFailed"));
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return /* @__PURE__ */ u("span", {
|
|
136
|
+
className: "inline-flex max-w-full items-center gap-1 align-middle",
|
|
137
|
+
children: [/* @__PURE__ */ l("code", {
|
|
138
|
+
className: "break-all font-mono text-xs",
|
|
139
|
+
children: e
|
|
140
|
+
}), /* @__PURE__ */ l(t, {
|
|
141
|
+
variant: "ghost",
|
|
142
|
+
size: "icon",
|
|
143
|
+
className: "size-7 shrink-0",
|
|
144
|
+
"aria-label": `${r("copy")} ${e}`,
|
|
145
|
+
onClick: () => void i(),
|
|
146
|
+
children: /* @__PURE__ */ l(a, { className: "size-3" })
|
|
147
|
+
})]
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
function _() {
|
|
151
|
+
let { t: e } = n();
|
|
152
|
+
return /* @__PURE__ */ u("main", {
|
|
153
|
+
className: "flex min-h-screen flex-col items-center justify-center p-6 text-center",
|
|
154
|
+
children: [
|
|
155
|
+
/* @__PURE__ */ l("p", {
|
|
156
|
+
className: "font-mono text-primary",
|
|
157
|
+
children: "404"
|
|
158
|
+
}),
|
|
159
|
+
/* @__PURE__ */ l("h1", {
|
|
160
|
+
className: "mt-5 text-2xl font-semibold",
|
|
161
|
+
children: e("unavailable")
|
|
162
|
+
}),
|
|
163
|
+
/* @__PURE__ */ l("p", {
|
|
164
|
+
className: "mt-3 text-muted-foreground",
|
|
165
|
+
children: e("unavailableDescription")
|
|
166
|
+
}),
|
|
167
|
+
/* @__PURE__ */ l(t, {
|
|
168
|
+
className: "mt-6",
|
|
169
|
+
asChild: !0,
|
|
170
|
+
children: /* @__PURE__ */ u("a", {
|
|
171
|
+
href: "/",
|
|
172
|
+
children: [/* @__PURE__ */ l(i, { className: "size-4" }), e("backHome")]
|
|
173
|
+
})
|
|
174
|
+
})
|
|
175
|
+
]
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
function v() {
|
|
179
|
+
let { t: e } = n();
|
|
180
|
+
return /* @__PURE__ */ u("section", {
|
|
181
|
+
role: "alert",
|
|
182
|
+
className: "flex flex-col items-center py-20 text-center",
|
|
183
|
+
children: [
|
|
184
|
+
/* @__PURE__ */ l("p", {
|
|
185
|
+
className: "font-mono text-primary",
|
|
186
|
+
children: "403"
|
|
187
|
+
}),
|
|
188
|
+
/* @__PURE__ */ l("h1", {
|
|
189
|
+
className: "mt-5 text-2xl font-semibold",
|
|
190
|
+
children: e("forbidden")
|
|
191
|
+
}),
|
|
192
|
+
/* @__PURE__ */ l("p", {
|
|
193
|
+
className: "mt-3 max-w-md text-muted-foreground",
|
|
194
|
+
children: e("forbiddenDescription")
|
|
195
|
+
}),
|
|
196
|
+
/* @__PURE__ */ l(t, {
|
|
197
|
+
className: "mt-6",
|
|
198
|
+
asChild: !0,
|
|
199
|
+
children: /* @__PURE__ */ u("a", {
|
|
200
|
+
href: "/",
|
|
201
|
+
children: [/* @__PURE__ */ l(i, { className: "size-4" }), e("backHome")]
|
|
202
|
+
})
|
|
203
|
+
})
|
|
204
|
+
]
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
//#endregion
|
|
208
|
+
export { g as CopyValue, p as EmptyState, m as ErrorState, v as ForbiddenPage, h as LoadingState, _ as NotFoundPage, f as PageHeader };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=require("react/jsx-runtime");function t({mode:t,summary:n,pageSize:r,children:i}){return(0,e.jsxs)(`div`,{"data-pagination":t,className:`flex w-full flex-wrap items-center justify-between gap-3 text-sm`,children:[(0,e.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n}),(0,e.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center justify-end gap-3`,children:[r&&(0,e.jsx)(`div`,{className:`[&_[data-slot=native-select-wrapper]]:w-auto [&_[data-slot=native-select-wrapper]]:shrink-0 [&_[data-slot=select-trigger]]:h-8 [&_[data-slot=select-trigger]]:w-auto`,children:r}),(0,e.jsx)(`div`,{className:`flex items-center gap-2`,children:i})]})]})}exports.PaginationBar=t;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export declare function PaginationBar({ mode, summary, pageSize, children, }: {
|
|
3
|
+
mode: 'cursor' | 'fixed';
|
|
4
|
+
summary?: ReactNode;
|
|
5
|
+
pageSize?: ReactNode;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}): import("react").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=pagination-bar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination-bar.d.ts","sourceRoot":"","sources":["../../src/components/pagination-bar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,QAAQ,GACT,EAAE;IACD,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAA;IACxB,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,QAAQ,EAAE,SAAS,CAAA;CACpB,+BAiBA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
//#region src/components/pagination-bar.tsx
|
|
3
|
+
function n({ mode: n, summary: r, pageSize: i, children: a }) {
|
|
4
|
+
return /* @__PURE__ */ t("div", {
|
|
5
|
+
"data-pagination": n,
|
|
6
|
+
className: "flex w-full flex-wrap items-center justify-between gap-3 text-sm",
|
|
7
|
+
children: [/* @__PURE__ */ e("span", {
|
|
8
|
+
className: "text-xs text-muted-foreground",
|
|
9
|
+
children: r
|
|
10
|
+
}), /* @__PURE__ */ t("div", {
|
|
11
|
+
className: "ml-auto flex flex-wrap items-center justify-end gap-3",
|
|
12
|
+
children: [i && /* @__PURE__ */ e("div", {
|
|
13
|
+
className: "[&_[data-slot=native-select-wrapper]]:w-auto [&_[data-slot=native-select-wrapper]]:shrink-0 [&_[data-slot=select-trigger]]:h-8 [&_[data-slot=select-trigger]]:w-auto",
|
|
14
|
+
children: i
|
|
15
|
+
}), /* @__PURE__ */ e("div", {
|
|
16
|
+
className: "flex items-center gap-2",
|
|
17
|
+
children: a
|
|
18
|
+
})]
|
|
19
|
+
})]
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { n as PaginationBar };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../lib/utils.cjs"),t=require("../lib/use-ui-translation.cjs"),n=require("./ui/hover-card.cjs"),r=require("../lib/password.cjs");let i=require("lucide-react"),a=require("react/jsx-runtime");var o={empty:`bg-border`,weak:`bg-danger`,medium:`bg-warning`,strong:`bg-success`};function s({password:s,compact:c=!1,className:l}){let{t:u}=t.useUiTranslation(),d=r.passwordStrength(s),f=d.score/r.passwordRules.length*100,p=(0,a.jsx)(`ul`,{className:e.cn(`grid gap-1 text-xs text-muted-foreground`,!c&&`sm:grid-cols-2`),children:r.passwordRules.map(t=>{let n=d.matched.includes(t.key);return(0,a.jsxs)(`li`,{className:e.cn(`flex items-center gap-1.5`,n&&`text-success`),children:[n?(0,a.jsx)(i.Check,{"aria-hidden":`true`,className:`size-3 shrink-0`}):(0,a.jsx)(i.X,{"aria-hidden":`true`,className:`size-3 shrink-0`}),u(`password.rules.`+t.key)]},t.key)})});return(0,a.jsxs)(`div`,{"data-slot":`password-strength`,className:e.cn(`space-y-2`,l),children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,a.jsx)(`div`,{className:`h-1.5 flex-1 overflow-hidden rounded-full bg-border`,children:(0,a.jsx)(`div`,{className:e.cn(`h-full transition-all duration-300`,o[d.level]),style:{width:`${f}%`}})}),d.level!==`empty`&&(0,a.jsx)(`span`,{className:e.cn(`shrink-0 text-right text-xs text-muted-foreground`,c?`w-8`:`w-20`),children:u(`password.levels.`+d.level)}),c&&(0,a.jsxs)(n.HoverCard,{children:[(0,a.jsx)(n.HoverCardTrigger,{asChild:!0,children:(0,a.jsx)(`button`,{type:`button`,"aria-label":u(`password.rulesTitle`),title:u(`password.rulesTitle`),className:`shrink-0 rounded-full text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/30`,children:(0,a.jsx)(i.CircleQuestionMark,{"aria-hidden":`true`,className:`size-4`})})}),(0,a.jsxs)(n.HoverCardContent,{align:`end`,className:`w-60`,children:[(0,a.jsx)(`p`,{className:`mb-2 text-xs font-medium`,children:u(`password.rulesTitle`)}),p]})]})]}),!c&&p]})}exports.PasswordStrength=s;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 密码强度与规则清单。
|
|
3
|
+
* `compact` 只留强度条 + 问号提示(悬停/聚焦展开规则),适合表单页;默认连规则一起铺开,
|
|
4
|
+
* 组件总览里的示例用默认形态。
|
|
5
|
+
*/
|
|
6
|
+
export declare function PasswordStrength({ password, compact, className, }: {
|
|
7
|
+
password: string;
|
|
8
|
+
compact?: boolean;
|
|
9
|
+
className?: string;
|
|
10
|
+
}): import("react").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=password-strength.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"password-strength.d.ts","sourceRoot":"","sources":["../../src/components/password-strength.tsx"],"names":[],"mappings":"AAaA;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,OAAe,EACf,SAAS,GACV,EAAE;IACD,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,+BA8DA"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { cn as e } from "../lib/utils.js";
|
|
2
|
+
import { useUiTranslation as t } from "../lib/use-ui-translation.js";
|
|
3
|
+
import { HoverCard as n, HoverCardContent as r, HoverCardTrigger as i } from "./ui/hover-card.js";
|
|
4
|
+
import { passwordRules as a, passwordStrength as o } from "../lib/password.js";
|
|
5
|
+
import { Check as s, CircleQuestionMark as c, X as l } from "lucide-react";
|
|
6
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/password-strength.tsx
|
|
8
|
+
var f = {
|
|
9
|
+
empty: "bg-border",
|
|
10
|
+
weak: "bg-danger",
|
|
11
|
+
medium: "bg-warning",
|
|
12
|
+
strong: "bg-success"
|
|
13
|
+
};
|
|
14
|
+
function p({ password: p, compact: m = !1, className: h }) {
|
|
15
|
+
let { t: g } = t(), _ = o(p), v = _.score / a.length * 100, y = /* @__PURE__ */ u("ul", {
|
|
16
|
+
className: e("grid gap-1 text-xs text-muted-foreground", !m && "sm:grid-cols-2"),
|
|
17
|
+
children: a.map((t) => {
|
|
18
|
+
let n = _.matched.includes(t.key);
|
|
19
|
+
return /* @__PURE__ */ d("li", {
|
|
20
|
+
className: e("flex items-center gap-1.5", n && "text-success"),
|
|
21
|
+
children: [u(n ? s : l, {
|
|
22
|
+
"aria-hidden": "true",
|
|
23
|
+
className: "size-3 shrink-0"
|
|
24
|
+
}), g("password.rules." + t.key)]
|
|
25
|
+
}, t.key);
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
return /* @__PURE__ */ d("div", {
|
|
29
|
+
"data-slot": "password-strength",
|
|
30
|
+
className: e("space-y-2", h),
|
|
31
|
+
children: [/* @__PURE__ */ d("div", {
|
|
32
|
+
className: "flex items-center gap-2",
|
|
33
|
+
children: [
|
|
34
|
+
/* @__PURE__ */ u("div", {
|
|
35
|
+
className: "h-1.5 flex-1 overflow-hidden rounded-full bg-border",
|
|
36
|
+
children: /* @__PURE__ */ u("div", {
|
|
37
|
+
className: e("h-full transition-all duration-300", f[_.level]),
|
|
38
|
+
style: { width: `${v}%` }
|
|
39
|
+
})
|
|
40
|
+
}),
|
|
41
|
+
_.level !== "empty" && /* @__PURE__ */ u("span", {
|
|
42
|
+
className: e("shrink-0 text-right text-xs text-muted-foreground", m ? "w-8" : "w-20"),
|
|
43
|
+
children: g("password.levels." + _.level)
|
|
44
|
+
}),
|
|
45
|
+
m && /* @__PURE__ */ d(n, { children: [/* @__PURE__ */ u(i, {
|
|
46
|
+
asChild: !0,
|
|
47
|
+
children: /* @__PURE__ */ u("button", {
|
|
48
|
+
type: "button",
|
|
49
|
+
"aria-label": g("password.rulesTitle"),
|
|
50
|
+
title: g("password.rulesTitle"),
|
|
51
|
+
className: "shrink-0 rounded-full text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/30",
|
|
52
|
+
children: /* @__PURE__ */ u(c, {
|
|
53
|
+
"aria-hidden": "true",
|
|
54
|
+
className: "size-4"
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
}), /* @__PURE__ */ d(r, {
|
|
58
|
+
align: "end",
|
|
59
|
+
className: "w-60",
|
|
60
|
+
children: [/* @__PURE__ */ u("p", {
|
|
61
|
+
className: "mb-2 text-xs font-medium",
|
|
62
|
+
children: g("password.rulesTitle")
|
|
63
|
+
}), y]
|
|
64
|
+
})] })
|
|
65
|
+
]
|
|
66
|
+
}), !m && y]
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
export { p as PasswordStrength };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../lib/utils.cjs");let t=require("react"),n=require("lucide-react"),r=require("react/jsx-runtime");function i({value:i,defaultValue:a=0,onValueChange:o,max:s=5,precision:c=1,clearable:l=!0,disabled:u,label:d=`评分`,className:f}){let[p,m]=(0,t.useState)(a),[h,g]=(0,t.useState)(),_=i??p,v=h??_;function y(e){if(u)return;let t=l&&e===_?0:e;i===void 0&&m(t),o?.(t)}return(0,r.jsx)(`div`,{role:`slider`,tabIndex:u?-1:0,"aria-label":d,"aria-valuemin":0,"aria-valuemax":s,"aria-valuenow":_,"aria-disabled":u,className:e.cn(`inline-flex items-center gap-1 rounded-md focus-visible:ring-2 focus-visible:ring-ring`,f),onBlur:()=>g(void 0),onKeyDown:e=>{let t=c;e.key===`ArrowRight`||e.key===`ArrowUp`?(e.preventDefault(),y(Math.min(s,_+t))):e.key===`ArrowLeft`||e.key===`ArrowDown`?(e.preventDefault(),y(Math.max(0,_-t))):e.key===`Home`?y(0):e.key===`End`&&y(s)},onMouseLeave:()=>g(void 0),children:Array.from({length:s},(e,t)=>{let i=t+1,a=v>=i?100:v>=i-.5?50:0;return(0,r.jsxs)(`button`,{type:`button`,disabled:u,"aria-label":`${i} ${d}`,className:`relative size-7 text-muted-foreground transition-transform hover:scale-110 disabled:pointer-events-none`,onMouseMove:e=>{let t=c===.5&&e.nativeEvent.offsetX<e.currentTarget.offsetWidth/2;g(t?i-.5:i)},onClick:()=>y(h??i),children:[(0,r.jsx)(n.Star,{className:`absolute inset-1 size-5`,"aria-hidden":`true`}),(0,r.jsx)(`span`,{className:`absolute inset-1 overflow-hidden text-warning`,style:{width:`${a}%`},children:(0,r.jsx)(n.Star,{className:`size-5 fill-current`,"aria-hidden":`true`})})]},i)})})}exports.Rate=i;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type RateProps = {
|
|
2
|
+
value?: number;
|
|
3
|
+
defaultValue?: number;
|
|
4
|
+
onValueChange?: (value: number) => void;
|
|
5
|
+
max?: number;
|
|
6
|
+
precision?: 1 | 0.5;
|
|
7
|
+
clearable?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
label?: string;
|
|
10
|
+
className?: string;
|
|
11
|
+
};
|
|
12
|
+
export declare function Rate({ value, defaultValue, onValueChange, max, precision, clearable, disabled, label, className, }: RateProps): import("react").JSX.Element;
|
|
13
|
+
//# sourceMappingURL=rate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rate.d.ts","sourceRoot":"","sources":["../../src/components/rate.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,CAAC,GAAG,GAAG,CAAA;IACnB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,wBAAgB,IAAI,CAAC,EACnB,KAAK,EACL,YAAgB,EAChB,aAAa,EACb,GAAO,EACP,SAAa,EACb,SAAgB,EAChB,QAAQ,EACR,KAAY,EACZ,SAAS,GACV,EAAE,SAAS,+BAqEX"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { cn as e } from "../lib/utils.js";
|
|
2
|
+
import { useState as t } from "react";
|
|
3
|
+
import { Star as n } from "lucide-react";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/rate.tsx
|
|
6
|
+
function a({ value: a, defaultValue: o = 0, onValueChange: s, max: c = 5, precision: l = 1, clearable: u = !0, disabled: d, label: f = "评分", className: p }) {
|
|
7
|
+
let [m, h] = t(o), [g, _] = t(), v = a ?? m, y = g ?? v;
|
|
8
|
+
function b(e) {
|
|
9
|
+
if (d) return;
|
|
10
|
+
let t = u && e === v ? 0 : e;
|
|
11
|
+
a === void 0 && h(t), s?.(t);
|
|
12
|
+
}
|
|
13
|
+
return /* @__PURE__ */ r("div", {
|
|
14
|
+
role: "slider",
|
|
15
|
+
tabIndex: d ? -1 : 0,
|
|
16
|
+
"aria-label": f,
|
|
17
|
+
"aria-valuemin": 0,
|
|
18
|
+
"aria-valuemax": c,
|
|
19
|
+
"aria-valuenow": v,
|
|
20
|
+
"aria-disabled": d,
|
|
21
|
+
className: e("inline-flex items-center gap-1 rounded-md focus-visible:ring-2 focus-visible:ring-ring", p),
|
|
22
|
+
onBlur: () => _(void 0),
|
|
23
|
+
onKeyDown: (e) => {
|
|
24
|
+
let t = l;
|
|
25
|
+
e.key === "ArrowRight" || e.key === "ArrowUp" ? (e.preventDefault(), b(Math.min(c, v + t))) : e.key === "ArrowLeft" || e.key === "ArrowDown" ? (e.preventDefault(), b(Math.max(0, v - t))) : e.key === "Home" ? b(0) : e.key === "End" && b(c);
|
|
26
|
+
},
|
|
27
|
+
onMouseLeave: () => _(void 0),
|
|
28
|
+
children: Array.from({ length: c }, (e, t) => {
|
|
29
|
+
let a = t + 1, o = y >= a ? 100 : y >= a - .5 ? 50 : 0;
|
|
30
|
+
return /* @__PURE__ */ i("button", {
|
|
31
|
+
type: "button",
|
|
32
|
+
disabled: d,
|
|
33
|
+
"aria-label": `${a} ${f}`,
|
|
34
|
+
className: "relative size-7 text-muted-foreground transition-transform hover:scale-110 disabled:pointer-events-none",
|
|
35
|
+
onMouseMove: (e) => {
|
|
36
|
+
let t = l === .5 && e.nativeEvent.offsetX < e.currentTarget.offsetWidth / 2;
|
|
37
|
+
_(t ? a - .5 : a);
|
|
38
|
+
},
|
|
39
|
+
onClick: () => b(g ?? a),
|
|
40
|
+
children: [/* @__PURE__ */ r(n, {
|
|
41
|
+
className: "absolute inset-1 size-5",
|
|
42
|
+
"aria-hidden": "true"
|
|
43
|
+
}), /* @__PURE__ */ r("span", {
|
|
44
|
+
className: "absolute inset-1 overflow-hidden text-warning",
|
|
45
|
+
style: { width: `${o}%` },
|
|
46
|
+
children: /* @__PURE__ */ r(n, {
|
|
47
|
+
className: "size-5 fill-current",
|
|
48
|
+
"aria-hidden": "true"
|
|
49
|
+
})
|
|
50
|
+
})]
|
|
51
|
+
}, a);
|
|
52
|
+
})
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
export { a as Rate };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../lib/utils.cjs");let t=require("react"),n=require("react/jsx-runtime");function r({first:r,second:i,direction:a=`horizontal`,defaultSize:o=50,minSize:s=20,maxSize:c=80,onSizeChange:l,firstLabel:u=`第一个面板`,secondLabel:d=`第二个面板`,className:f}){let p=(0,t.useRef)(null),[m,h]=(0,t.useState)(o);function g(e){let t=Math.min(c,Math.max(s,e));h(t),l?.(t)}function _(e){e.currentTarget.setPointerCapture(e.pointerId)}function v(e){if(!e.currentTarget.hasPointerCapture(e.pointerId)||!p.current)return;let t=p.current.getBoundingClientRect();g(a===`horizontal`?(e.clientX-t.left)/t.width*100:(e.clientY-t.top)/t.height*100)}let y=a===`horizontal`;return(0,n.jsxs)(`div`,{ref:p,className:e.cn(`flex min-h-56 overflow-hidden rounded-lg border`,!y&&`flex-col`,f),children:[(0,n.jsx)(`section`,{"aria-label":u,className:`min-h-0 min-w-0 overflow-auto p-4`,style:{flexBasis:`${m}%`},children:r}),(0,n.jsx)(`div`,{role:`separator`,tabIndex:0,"aria-label":`调整面板大小`,"aria-orientation":y?`vertical`:`horizontal`,"aria-valuemin":s,"aria-valuemax":c,"aria-valuenow":Math.round(m),className:e.cn(`relative shrink-0 bg-border hover:bg-primary focus-visible:bg-primary focus-visible:outline-none`,y?`w-1 cursor-col-resize`:`h-1 cursor-row-resize`),onDoubleClick:()=>g(o),onPointerDown:_,onPointerMove:v,onKeyDown:e=>{let t=y?e.key===`ArrowLeft`:e.key===`ArrowUp`,n=y?e.key===`ArrowRight`:e.key===`ArrowDown`;(t||n)&&(e.preventDefault(),g(m+(n?5:-5)))}}),(0,n.jsx)(`section`,{"aria-label":d,className:`min-h-0 min-w-0 flex-1 overflow-auto p-4`,children:i})]})}exports.ResizablePanel=r;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export type ResizablePanelProps = {
|
|
3
|
+
first: ReactNode;
|
|
4
|
+
second: ReactNode;
|
|
5
|
+
direction?: 'horizontal' | 'vertical';
|
|
6
|
+
defaultSize?: number;
|
|
7
|
+
minSize?: number;
|
|
8
|
+
maxSize?: number;
|
|
9
|
+
onSizeChange?: (size: number) => void;
|
|
10
|
+
firstLabel?: string;
|
|
11
|
+
secondLabel?: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function ResizablePanel({ first, second, direction, defaultSize, minSize, maxSize, onSizeChange, firstLabel, secondLabel, className, }: ResizablePanelProps): import("react").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=resizable-panel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resizable-panel.d.ts","sourceRoot":"","sources":["../../src/components/resizable-panel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAGxD,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,SAAS,CAAA;IAChB,MAAM,EAAE,SAAS,CAAA;IACjB,SAAS,CAAC,EAAE,YAAY,GAAG,UAAU,CAAA;IACrC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACrC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,MAAM,EACN,SAAwB,EACxB,WAAgB,EAChB,OAAY,EACZ,OAAY,EACZ,YAAY,EACZ,UAAoB,EACpB,WAAqB,EACrB,SAAS,GACV,EAAE,mBAAmB,+BAsErB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { cn as e } from "../lib/utils.js";
|
|
2
|
+
import { useRef as t, useState as n } from "react";
|
|
3
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/resizable-panel.tsx
|
|
5
|
+
function a({ first: a, second: o, direction: s = "horizontal", defaultSize: c = 50, minSize: l = 20, maxSize: u = 80, onSizeChange: d, firstLabel: f = "第一个面板", secondLabel: p = "第二个面板", className: m }) {
|
|
6
|
+
let h = t(null), [g, _] = n(c);
|
|
7
|
+
function v(e) {
|
|
8
|
+
let t = Math.min(u, Math.max(l, e));
|
|
9
|
+
_(t), d?.(t);
|
|
10
|
+
}
|
|
11
|
+
function y(e) {
|
|
12
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
13
|
+
}
|
|
14
|
+
function b(e) {
|
|
15
|
+
if (!e.currentTarget.hasPointerCapture(e.pointerId) || !h.current) return;
|
|
16
|
+
let t = h.current.getBoundingClientRect();
|
|
17
|
+
v(s === "horizontal" ? (e.clientX - t.left) / t.width * 100 : (e.clientY - t.top) / t.height * 100);
|
|
18
|
+
}
|
|
19
|
+
let x = s === "horizontal";
|
|
20
|
+
return /* @__PURE__ */ i("div", {
|
|
21
|
+
ref: h,
|
|
22
|
+
className: e("flex min-h-56 overflow-hidden rounded-lg border", !x && "flex-col", m),
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ r("section", {
|
|
25
|
+
"aria-label": f,
|
|
26
|
+
className: "min-h-0 min-w-0 overflow-auto p-4",
|
|
27
|
+
style: { flexBasis: `${g}%` },
|
|
28
|
+
children: a
|
|
29
|
+
}),
|
|
30
|
+
/* @__PURE__ */ r("div", {
|
|
31
|
+
role: "separator",
|
|
32
|
+
tabIndex: 0,
|
|
33
|
+
"aria-label": "调整面板大小",
|
|
34
|
+
"aria-orientation": x ? "vertical" : "horizontal",
|
|
35
|
+
"aria-valuemin": l,
|
|
36
|
+
"aria-valuemax": u,
|
|
37
|
+
"aria-valuenow": Math.round(g),
|
|
38
|
+
className: e("relative shrink-0 bg-border hover:bg-primary focus-visible:bg-primary focus-visible:outline-none", x ? "w-1 cursor-col-resize" : "h-1 cursor-row-resize"),
|
|
39
|
+
onDoubleClick: () => v(c),
|
|
40
|
+
onPointerDown: y,
|
|
41
|
+
onPointerMove: b,
|
|
42
|
+
onKeyDown: (e) => {
|
|
43
|
+
let t = x ? e.key === "ArrowLeft" : e.key === "ArrowUp", n = x ? e.key === "ArrowRight" : e.key === "ArrowDown";
|
|
44
|
+
(t || n) && (e.preventDefault(), v(g + (n ? 5 : -5)));
|
|
45
|
+
}
|
|
46
|
+
}),
|
|
47
|
+
/* @__PURE__ */ r("section", {
|
|
48
|
+
"aria-label": p,
|
|
49
|
+
className: "min-h-0 min-w-0 flex-1 overflow-auto p-4",
|
|
50
|
+
children: o
|
|
51
|
+
})
|
|
52
|
+
]
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
export { a as ResizablePanel };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../lib/utils.cjs"),t=require("./ui/button.cjs"),n=require("../lib/use-ui-translation.cjs"),r=require("./filter-presets.cjs");let i=require("react"),a=require("lucide-react"),o=require("react/jsx-runtime"),s=require("react-dom");function c(e){return i.Children.toArray(e).flatMap(e=>(0,i.isValidElement)(e)&&e.type===i.Fragment?c(e.props.children):[e])}function l({presets:l,labelPosition:f=`left`,columns:p=3,collapsedCount:m=p,style:h,description:g,descriptionPosition:_=`bottom`,togglePosition:v=`inline`,collapsible:y=!0,defaultExpanded:b=!1,className:x,children:S,onInvalidCapture:C,...w}){let{t:T}=n.useUiTranslation(),[E,D]=(0,i.useState)(b),O=(0,i.useId)(),k=(0,i.useRef)(null);(0,i.useLayoutEffect)(()=>{let e=k.current;if(!e||f!==`left`)return;let t=()=>{let t=getComputedStyle(e).display===`contents`?e.parentElement:e,n=getComputedStyle(t).gridTemplateColumns.split(` `).length,r=Array.from(e.querySelectorAll(`:scope > .search-filter-field`)),i=Array.from({length:n},()=>0);r.forEach((e,t)=>{let r=e.querySelector(`:scope > label, :scope > .search-filter-label`);i[t%n]=Math.max(i[t%n]??0,r?.getBoundingClientRect().width??0)}),r.forEach((e,t)=>e.style.setProperty(`--search-label-width`,`${i[t%n]}px`))};t();let n=new ResizeObserver(t);return n.observe(e),e.parentElement&&n.observe(e.parentElement),e.querySelectorAll(`:scope > .search-filter-field > label, :scope > .search-filter-field > .search-filter-label`).forEach(e=>n.observe(e)),()=>n.disconnect()},[S,p,f,E]);let A=c(S),j=A.filter(e=>(0,i.isValidElement)(e)&&e.type===u),M=y&&j.length>m,N=!M||E,P=M?(0,o.jsxs)(t.Button,{type:`button`,variant:`ghost`,size:`sm`,"aria-expanded":M&&N,"aria-controls":O,onClick:()=>D(e=>!e),children:[T(M&&N?`searchCollapse`:`searchExpand`),M&&N?(0,o.jsx)(a.ChevronUp,{"aria-hidden":`true`}):(0,o.jsx)(a.ChevronDown,{"aria-hidden":`true`})]}):null,F=g?(0,o.jsx)(`p`,{className:`text-xs leading-5 text-muted-foreground`,children:g}):null,I=(0,o.jsxs)(o.Fragment,{children:[_===`inline`&&F,v===`inline`&&P]}),L=_===`inline`&&!!F||v===`inline`&&!!P,R=_===`bottom`&&!!F||v===`bottom`&&!!P,z=0,B=A.some(e=>(0,i.isValidElement)(e)&&e.type===d);return(0,o.jsxs)(`form`,{role:`search`,...w,onInvalidCapture:e=>{N||(0,s.flushSync)(()=>D(!0)),C?.(e)},style:{...h,"--search-columns":p},"data-columns":p,"data-label-position":f,"data-expanded":N,"data-inline-actions":!M||!N,className:e.cn(`search-filters w-full rounded-xl border bg-card p-4`,x),children:[(0,o.jsx)(`div`,{ref:k,id:O,className:`search-filter-fields`,children:A.map(e=>(0,i.isValidElement)(e)&&e.type===u?(0,i.cloneElement)(e,{hidden:e.props.hidden||!N&&z++>=m}):(0,i.isValidElement)(e)&&e.type===d?null:e)}),(B||L||R)&&(0,o.jsxs)(`div`,{className:`search-filter-footer`,children:[_===`bottom`&&F,(0,o.jsxs)(`div`,{className:`search-filter-footer-actions`,children:[A.map(e=>(0,i.isValidElement)(e)&&e.type===d?(0,i.cloneElement)(e,{children:(0,o.jsxs)(o.Fragment,{children:[e.props.children,I]})}):null),!B&&L&&(0,o.jsx)(d,{children:I}),l&&(0,o.jsx)(r.FilterPresets,{storageId:l.storageId,value:l.value,onApply:l.onApply,summary:l.summary}),v===`bottom`&&P]})]})]})}function u(t){if(t.as===`label`){let{as:n,className:r,children:a,...s}=t;return(0,o.jsx)(`label`,{...s,className:e.cn(`search-filter-field`,r),children:i.Children.map(a,e=>typeof e==`string`||typeof e==`number`?(0,o.jsx)(`span`,{className:`search-filter-label`,children:e}):e)})}let{as:n,className:r,...a}=t;return(0,o.jsx)(`div`,{...a,className:e.cn(`search-filter-field`,r)})}function d({className:t,...n}){return(0,o.jsx)(`div`,{...n,className:e.cn(`search-filter-actions`,t)})}exports.SearchActions=d,exports.SearchField=u,exports.SearchFilters=l;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type ComponentProps, type ReactNode } from 'react';
|
|
2
|
+
export declare function SearchFilters({ presets, labelPosition, columns, collapsedCount, style, description, descriptionPosition, togglePosition, collapsible, defaultExpanded, className, children, onInvalidCapture, ...props }: ComponentProps<'form'> & {
|
|
3
|
+
/**
|
|
4
|
+
* 通过配置开关启用"筛选预设":传入存储键、当前条件快照与恢复回调即可,
|
|
5
|
+
* 组件会在操作区自动渲染预设入口。
|
|
6
|
+
*/
|
|
7
|
+
presets?: {
|
|
8
|
+
storageId: string;
|
|
9
|
+
value: unknown;
|
|
10
|
+
onApply: (value: unknown) => void;
|
|
11
|
+
/** 预设列表里的摘要文案,默认用通用格式化 */
|
|
12
|
+
summary?: (value: unknown) => string;
|
|
13
|
+
};
|
|
14
|
+
labelPosition?: 'left' | 'top';
|
|
15
|
+
columns?: 1 | 2 | 3;
|
|
16
|
+
collapsedCount?: number;
|
|
17
|
+
description?: ReactNode;
|
|
18
|
+
descriptionPosition?: 'bottom' | 'inline';
|
|
19
|
+
togglePosition?: 'bottom' | 'inline';
|
|
20
|
+
collapsible?: boolean;
|
|
21
|
+
defaultExpanded?: boolean;
|
|
22
|
+
}): import("react").JSX.Element;
|
|
23
|
+
type SearchFieldProps = ({
|
|
24
|
+
as: 'label';
|
|
25
|
+
} & ComponentProps<'label'>) | ({
|
|
26
|
+
as?: 'div';
|
|
27
|
+
} & ComponentProps<'div'>);
|
|
28
|
+
export declare function SearchField(props: SearchFieldProps): import("react").JSX.Element;
|
|
29
|
+
export declare function SearchActions({ className, ...props }: ComponentProps<'div'>): import("react").JSX.Element;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=search-filters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-filters.d.ts","sourceRoot":"","sources":["../../src/components/search-filters.tsx"],"names":[],"mappings":"AACA,OAAO,EASL,KAAK,cAAc,EAEnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AAed,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,aAAsB,EACtB,OAAW,EACX,cAAwB,EACxB,KAAK,EACL,WAAW,EACX,mBAA8B,EAC9B,cAAyB,EACzB,WAAkB,EAClB,eAAuB,EACvB,SAAS,EACT,QAAQ,EACR,gBAAgB,EAChB,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG;IAC1B;;;OAGG;IACH,OAAO,CAAC,EAAE;QACR,SAAS,EAAE,MAAM,CAAA;QACjB,KAAK,EAAE,OAAO,CAAA;QACd,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;QACjC,0BAA0B;QAC1B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,CAAA;KACrC,CAAA;IACD,aAAa,CAAC,EAAE,MAAM,GAAG,KAAK,CAAA;IAC9B,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACnB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,mBAAmB,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAA;IACzC,cAAc,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAA;IACpC,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,+BAgIA;AAED,KAAK,gBAAgB,GACnB,CAAC;IAAE,EAAE,EAAE,OAAO,CAAA;CAAE,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC;IAAE,EAAE,CAAC,EAAE,KAAK,CAAA;CAAE,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC,CAAA;AAExF,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,+BAiBlD;AAED,wBAAgB,aAAa,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,KAAK,CAAC,+BAE3E"}
|