@runlume/admin-ui 0.1.0 → 0.2.1
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 +6 -13
- package/README.md +5 -11
- 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,183 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/utils.js";
|
|
2
|
+
import { useUiTranslation as t } from "../../lib/use-ui-translation.js";
|
|
3
|
+
import { inputBaseClass as n } from "./input.js";
|
|
4
|
+
import * as r from "react";
|
|
5
|
+
import { Popover as i } from "radix-ui";
|
|
6
|
+
import { CalendarDays as a, ChevronLeft as o, ChevronRight as s } from "lucide-react";
|
|
7
|
+
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/ui/date-input.tsx
|
|
9
|
+
var d = (e) => `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`, f = (e) => {
|
|
10
|
+
let [t, n, r] = e.slice(0, 10).split("-").map(Number);
|
|
11
|
+
return t && n && r ? new Date(t, n - 1, r) : /* @__PURE__ */ new Date();
|
|
12
|
+
};
|
|
13
|
+
function p({ ref: p, className: m, onChange: h, onKeyDown: g, disabled: _, readOnly: v, ...y }) {
|
|
14
|
+
let { i18n: b } = t(), x = b.language.startsWith("en"), S = r.useRef(null), C = r.useRef(null), [w, T] = r.useState(!1), [E, D] = r.useState("day"), [O, k] = r.useState(() => f(String(y.value ?? y.defaultValue ?? ""))), [A, j] = r.useState(""), [M, N] = r.useState("");
|
|
15
|
+
r.useImperativeHandle(p, () => S.current);
|
|
16
|
+
let P = String(y.min ?? "").slice(0, 10), F = String(y.max ?? "").slice(0, 10), I = (e) => !!P && e < P || !!F && e > F;
|
|
17
|
+
function L(e) {
|
|
18
|
+
if (e) {
|
|
19
|
+
let e = S.current.value.slice(0, 10), t = e || d(/* @__PURE__ */ new Date());
|
|
20
|
+
P && t < P && (t = P), F && t > F && (t = F), k(f(t)), j(t), N(e);
|
|
21
|
+
}
|
|
22
|
+
T(e);
|
|
23
|
+
}
|
|
24
|
+
r.useEffect(() => {
|
|
25
|
+
w && C.current?.querySelector(`[data-day="${A}"]`)?.focus();
|
|
26
|
+
}, [w, A]);
|
|
27
|
+
function R(e) {
|
|
28
|
+
let t = S.current, n = e && y.type === "datetime-local" ? `${e}T${t.value.split("T")[1] || "00:00"}` : e;
|
|
29
|
+
Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value").set.call(t, n), t.dispatchEvent(new Event("input", { bubbles: !0 })), t.dispatchEvent(new Event("change", { bubbles: !0 })), T(!1);
|
|
30
|
+
}
|
|
31
|
+
function z(e) {
|
|
32
|
+
let t = new Date(O.getFullYear(), O.getMonth() + e, 1);
|
|
33
|
+
k(t), j(d(t));
|
|
34
|
+
}
|
|
35
|
+
let B = new Date(O.getFullYear(), O.getMonth(), 1);
|
|
36
|
+
B.setDate(1 - B.getDay());
|
|
37
|
+
let V = Array.from({ length: 42 }, (e, t) => new Date(B.getFullYear(), B.getMonth(), B.getDate() + t));
|
|
38
|
+
return /* @__PURE__ */ u(i.Root, {
|
|
39
|
+
open: w,
|
|
40
|
+
onOpenChange: L,
|
|
41
|
+
children: [/* @__PURE__ */ u("div", {
|
|
42
|
+
className: "relative min-w-0 w-full",
|
|
43
|
+
children: [/* @__PURE__ */ l("input", {
|
|
44
|
+
...y,
|
|
45
|
+
ref: S,
|
|
46
|
+
disabled: _,
|
|
47
|
+
readOnly: v,
|
|
48
|
+
"data-slot": "input",
|
|
49
|
+
className: e(n, "themed-date-input pr-10", m),
|
|
50
|
+
onChange: h,
|
|
51
|
+
onKeyDown: (e) => {
|
|
52
|
+
g?.(e), !e.defaultPrevented && e.altKey && e.key === "ArrowDown" && !_ && !v && (e.preventDefault(), L(!0));
|
|
53
|
+
}
|
|
54
|
+
}), /* @__PURE__ */ l(i.Trigger, {
|
|
55
|
+
asChild: !0,
|
|
56
|
+
children: /* @__PURE__ */ l("button", {
|
|
57
|
+
type: "button",
|
|
58
|
+
disabled: _ || v,
|
|
59
|
+
"aria-label": x ? "Choose date" : "选择日期",
|
|
60
|
+
className: "absolute right-1 top-1/2 flex size-8 -translate-y-1/2 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-50",
|
|
61
|
+
children: /* @__PURE__ */ l(a, { className: "size-4" })
|
|
62
|
+
})
|
|
63
|
+
})]
|
|
64
|
+
}), /* @__PURE__ */ l(i.Portal, { children: /* @__PURE__ */ u(i.Content, {
|
|
65
|
+
ref: C,
|
|
66
|
+
sideOffset: 4,
|
|
67
|
+
align: "start",
|
|
68
|
+
"aria-label": x ? "Calendar" : "日历",
|
|
69
|
+
onOpenAutoFocus: (e) => {
|
|
70
|
+
e.preventDefault(), C.current?.querySelector(`[data-day="${A}"]`)?.focus();
|
|
71
|
+
},
|
|
72
|
+
className: "z-50 w-72 max-w-[calc(100vw-2rem)] rounded-xl border bg-popover p-3 text-popover-foreground shadow-md",
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ u("div", {
|
|
75
|
+
className: "mb-2 flex items-center justify-between",
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ l("button", {
|
|
78
|
+
type: "button",
|
|
79
|
+
"aria-label": x ? "Previous month" : "上个月",
|
|
80
|
+
onClick: () => z(-1),
|
|
81
|
+
className: "flex size-8 items-center justify-center rounded-md hover:bg-accent",
|
|
82
|
+
children: /* @__PURE__ */ l(o, { className: "size-4" })
|
|
83
|
+
}),
|
|
84
|
+
/* @__PURE__ */ l("button", {
|
|
85
|
+
type: "button",
|
|
86
|
+
"aria-label": x ? "Switch to month or year view" : "切换到月/年视图",
|
|
87
|
+
className: "rounded-md px-2 py-1 text-sm font-medium hover:bg-accent",
|
|
88
|
+
onClick: () => D(E === "day" ? "month" : E === "month" ? "year" : "day"),
|
|
89
|
+
children: new Intl.DateTimeFormat(b.language, {
|
|
90
|
+
year: "numeric",
|
|
91
|
+
month: "long"
|
|
92
|
+
}).format(O)
|
|
93
|
+
}),
|
|
94
|
+
/* @__PURE__ */ l("button", {
|
|
95
|
+
type: "button",
|
|
96
|
+
"aria-label": x ? "Next month" : "下个月",
|
|
97
|
+
onClick: () => z(1),
|
|
98
|
+
className: "flex size-8 items-center justify-center rounded-md hover:bg-accent",
|
|
99
|
+
children: /* @__PURE__ */ l(s, { className: "size-4" })
|
|
100
|
+
})
|
|
101
|
+
]
|
|
102
|
+
}),
|
|
103
|
+
E === "month" && /* @__PURE__ */ l("div", {
|
|
104
|
+
className: "grid grid-cols-3 gap-1",
|
|
105
|
+
children: Array.from({ length: 12 }, (e, t) => t).map((t) => /* @__PURE__ */ l("button", {
|
|
106
|
+
type: "button",
|
|
107
|
+
className: e("rounded-md px-2 py-2 text-sm hover:bg-accent", O.getMonth() === t && "bg-primary/10 text-primary"),
|
|
108
|
+
onClick: () => {
|
|
109
|
+
k(new Date(O.getFullYear(), t, 1)), D("day");
|
|
110
|
+
},
|
|
111
|
+
children: new Intl.DateTimeFormat(b.language, { month: "short" }).format(new Date(O.getFullYear(), t, 1))
|
|
112
|
+
}, t))
|
|
113
|
+
}),
|
|
114
|
+
E === "year" && /* @__PURE__ */ l("div", {
|
|
115
|
+
className: "grid grid-cols-3 gap-1",
|
|
116
|
+
children: Array.from({ length: 12 }, (e, t) => O.getFullYear() - 6 + t).map((t) => /* @__PURE__ */ l("button", {
|
|
117
|
+
type: "button",
|
|
118
|
+
className: e("rounded-md px-2 py-2 text-sm hover:bg-accent", O.getFullYear() === t && "bg-primary/10 text-primary"),
|
|
119
|
+
onClick: () => {
|
|
120
|
+
k(new Date(t, O.getMonth(), 1)), D("month");
|
|
121
|
+
},
|
|
122
|
+
children: t
|
|
123
|
+
}, t))
|
|
124
|
+
}),
|
|
125
|
+
E === "day" && /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("div", {
|
|
126
|
+
className: "grid grid-cols-7 text-center text-xs text-muted-foreground",
|
|
127
|
+
children: V.slice(0, 7).map((e) => /* @__PURE__ */ l("span", {
|
|
128
|
+
className: "py-2",
|
|
129
|
+
children: new Intl.DateTimeFormat(b.language, { weekday: "narrow" }).format(e)
|
|
130
|
+
}, d(e)))
|
|
131
|
+
}), /* @__PURE__ */ l("div", {
|
|
132
|
+
className: "grid grid-cols-7 gap-0.5",
|
|
133
|
+
onKeyDown: (e) => {
|
|
134
|
+
let t = {
|
|
135
|
+
ArrowLeft: -1,
|
|
136
|
+
ArrowRight: 1,
|
|
137
|
+
ArrowUp: -7,
|
|
138
|
+
ArrowDown: 7
|
|
139
|
+
}[e.key];
|
|
140
|
+
if (t === void 0) return;
|
|
141
|
+
e.preventDefault();
|
|
142
|
+
let n = f(A);
|
|
143
|
+
n.setDate(n.getDate() + t);
|
|
144
|
+
let r = d(n);
|
|
145
|
+
I(r) || (k(n), j(r));
|
|
146
|
+
},
|
|
147
|
+
children: V.map((t) => {
|
|
148
|
+
let n = d(t);
|
|
149
|
+
return /* @__PURE__ */ l("button", {
|
|
150
|
+
type: "button",
|
|
151
|
+
"data-day": n,
|
|
152
|
+
tabIndex: n === A ? 0 : -1,
|
|
153
|
+
"aria-label": n,
|
|
154
|
+
"aria-pressed": M === n,
|
|
155
|
+
"aria-current": n === d(/* @__PURE__ */ new Date()) ? "date" : void 0,
|
|
156
|
+
disabled: I(n),
|
|
157
|
+
onClick: () => R(n),
|
|
158
|
+
className: e("h-8 rounded-md text-sm hover:bg-accent hover:text-accent-foreground disabled:opacity-30", t.getMonth() !== O.getMonth() && "text-muted-foreground", M === n && "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground"),
|
|
159
|
+
children: t.getDate()
|
|
160
|
+
}, n);
|
|
161
|
+
})
|
|
162
|
+
})] }),
|
|
163
|
+
/* @__PURE__ */ u("div", {
|
|
164
|
+
className: "mt-2 flex justify-between border-t pt-2",
|
|
165
|
+
children: [/* @__PURE__ */ l("button", {
|
|
166
|
+
type: "button",
|
|
167
|
+
onClick: () => R(""),
|
|
168
|
+
className: "rounded-md px-2 py-1 text-sm text-muted-foreground hover:bg-accent",
|
|
169
|
+
children: x ? "Clear" : "清除"
|
|
170
|
+
}), /* @__PURE__ */ l("button", {
|
|
171
|
+
type: "button",
|
|
172
|
+
disabled: I(d(/* @__PURE__ */ new Date())),
|
|
173
|
+
onClick: () => R(d(/* @__PURE__ */ new Date())),
|
|
174
|
+
className: "rounded-md px-2 py-1 text-sm text-primary hover:bg-accent disabled:opacity-30",
|
|
175
|
+
children: x ? "Today" : "今天"
|
|
176
|
+
})]
|
|
177
|
+
})
|
|
178
|
+
]
|
|
179
|
+
}) })]
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
//#endregion
|
|
183
|
+
export { p as DateInput };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../../lib/utils.cjs"),t=require("./button.cjs"),n=require("../../lib/use-ui-translation.cjs"),r=require("./date-input.cjs"),i=require("../../lib/range.cjs"),a=require("./label.cjs");let o=require("react"),s=require("radix-ui"),c=require("lucide-react"),l=require("react/jsx-runtime");function u({value:u,onValueChange:d,label:f,className:p}){let{t:m,i18n:h}=n.useUiTranslation(),[g,_]=(0,o.useState)(u),[v,y]=(0,o.useState)(!1),b=i.invalidRange(g),x=i.rangeShortcuts(),S=i.rangeLabel(u),[C,w]=(0,o.useState)(()=>new Date(u.from??Date.now())),[T,E]=(0,o.useState)(),D=(0,o.useRef)(null),O=i.monthGrid(C),k=new Intl.DateTimeFormat(h.language,{year:`numeric`,month:`long`}).format(C);function A(e){_(t=>!t.from||t.from&&t.to?{from:e,to:void 0}:e<t.from?{from:e,to:t.from}:{...t,to:e})}function j(e){let t=D.current;if(t){if(!t.dragging){if(e===t.key)return;t.dragging=!0}_(()=>e<t.key?{from:e,to:t.key}:{from:t.key,to:e})}}return(0,l.jsxs)(s.Popover.Root,{open:v,onOpenChange:e=>{y(e),e&&_(u)},children:[(0,l.jsx)(s.Popover.Trigger,{asChild:!0,children:(0,l.jsxs)(t.Button,{type:`button`,variant:`outline`,"aria-label":f,className:e.cn(`w-full justify-start bg-card font-normal`,p),children:[(0,l.jsx)(c.CalendarRange,{"aria-hidden":`true`,className:`size-4 opacity-60`}),(0,l.jsx)(`span`,{className:e.cn(`truncate`,!S&&`text-muted-foreground`),children:S||m(`dateRange.placeholder`)})]})}),(0,l.jsx)(s.Popover.Portal,{children:(0,l.jsxs)(s.Popover.Content,{align:`start`,sideOffset:4,className:`z-50 w-80 rounded-lg border bg-popover p-3 shadow-lg outline-none`,onMouseLeave:()=>{D.current=null},children:[(0,l.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,l.jsx)(t.Button,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":m(`dateRange.previousMonth`),onClick:()=>w(new Date(C.getFullYear(),C.getMonth()-1,1)),children:(0,l.jsx)(c.ChevronLeft,{"aria-hidden":`true`})}),(0,l.jsx)(`p`,{className:`text-sm font-medium`,children:k}),(0,l.jsx)(t.Button,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":m(`dateRange.nextMonth`),onClick:()=>w(new Date(C.getFullYear(),C.getMonth()+1,1)),children:(0,l.jsx)(c.ChevronRight,{"aria-hidden":`true`})})]}),(0,l.jsx)(`div`,{className:`grid grid-cols-7 text-center text-xs text-muted-foreground`,children:O.slice(0,7).map(e=>(0,l.jsx)(`span`,{className:`py-1`,children:new Intl.DateTimeFormat(h.language,{weekday:`narrow`}).format(e)},i.dayKey(e)))}),(0,l.jsx)(`div`,{className:`grid grid-cols-7 gap-0.5`,children:O.map(t=>{let n=i.dayKey(t),r=g.from&&!g.to?{from:g.from,to:T}:g,a=i.rangeState(r,n),o=t.getMonth()!==C.getMonth();return(0,l.jsx)(`button`,{type:`button`,"data-day":n,"aria-label":n,"aria-pressed":a!==`outside`,onMouseEnter:()=>{E(n),j(n)},onMouseLeave:()=>E(void 0),onMouseDown:()=>{D.current={key:n,dragging:!1}},onMouseUp:()=>{let e=D.current;D.current=null,e&&!e.dragging&&A(n)},className:e.cn(`h-8 rounded-md text-sm tabular-nums hover:bg-accent`,o&&`text-muted-foreground`,a===`in-range`&&`bg-primary/10 text-primary`,(a===`start`||a===`end`)&&`bg-primary text-primary-foreground hover:bg-primary`),children:t.getDate()},n)})}),(0,l.jsxs)(`div`,{className:`mt-2 grid gap-3 sm:grid-cols-2`,children:[(0,l.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,l.jsx)(a.Label,{htmlFor:`range-from`,children:m(`dateRange.from`)}),(0,l.jsx)(r.DateInput,{id:`range-from`,value:g.from??``,max:g.to,onChange:e=>_({...g,from:e.target.value})})]}),(0,l.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,l.jsx)(a.Label,{htmlFor:`range-to`,children:m(`dateRange.to`)}),(0,l.jsx)(r.DateInput,{id:`range-to`,value:g.to??``,min:g.from,onChange:e=>_({...g,to:e.target.value})})]})]}),(0,l.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:x.map(e=>(0,l.jsx)(t.Button,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>{_(e.range),d(e.range),y(!1)},children:m(`dateRange.shortcuts.${e.key}`)},e.key))}),b&&(0,l.jsx)(`p`,{className:`mt-2 text-xs text-destructive`,children:m(`dateRange.invalid`)}),(0,l.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2 border-t pt-3`,children:[(0,l.jsx)(t.Button,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>{_({}),d({}),y(!1)},children:m(`clear`)}),(0,l.jsx)(t.Button,{type:`button`,size:`sm`,disabled:b,onClick:()=>{d(g),y(!1)},children:m(`confirm`)})]})]})})]})}exports.DateRangeInput=u;
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/utils.js";
|
|
2
|
+
import { Button as t } from "./button.js";
|
|
3
|
+
import { useUiTranslation as n } from "../../lib/use-ui-translation.js";
|
|
4
|
+
import { DateInput as r } from "./date-input.js";
|
|
5
|
+
import { dayKey as i, invalidRange as a, monthGrid as o, rangeLabel as s, rangeShortcuts as c, rangeState as l } from "../../lib/range.js";
|
|
6
|
+
import { Label as u } from "./label.js";
|
|
7
|
+
import { useRef as d, useState as f } from "react";
|
|
8
|
+
import { Popover as p } from "radix-ui";
|
|
9
|
+
import { CalendarRange as m, ChevronLeft as h, ChevronRight as g } from "lucide-react";
|
|
10
|
+
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
11
|
+
//#region src/components/ui/date-range-input.tsx
|
|
12
|
+
function y({ value: y, onValueChange: b, label: x, className: S }) {
|
|
13
|
+
let { t: C, i18n: w } = n(), [T, E] = f(y), [D, O] = f(!1), k = a(T), A = c(), j = s(y), [M, N] = f(() => new Date(y.from ?? Date.now())), [P, F] = f(), I = d(null), L = o(M), R = new Intl.DateTimeFormat(w.language, {
|
|
14
|
+
year: "numeric",
|
|
15
|
+
month: "long"
|
|
16
|
+
}).format(M);
|
|
17
|
+
function z(e) {
|
|
18
|
+
E((t) => !t.from || t.from && t.to ? {
|
|
19
|
+
from: e,
|
|
20
|
+
to: void 0
|
|
21
|
+
} : e < t.from ? {
|
|
22
|
+
from: e,
|
|
23
|
+
to: t.from
|
|
24
|
+
} : {
|
|
25
|
+
...t,
|
|
26
|
+
to: e
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function B(e) {
|
|
30
|
+
let t = I.current;
|
|
31
|
+
if (t) {
|
|
32
|
+
if (!t.dragging) {
|
|
33
|
+
if (e === t.key) return;
|
|
34
|
+
t.dragging = !0;
|
|
35
|
+
}
|
|
36
|
+
E(() => e < t.key ? {
|
|
37
|
+
from: e,
|
|
38
|
+
to: t.key
|
|
39
|
+
} : {
|
|
40
|
+
from: t.key,
|
|
41
|
+
to: e
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return /* @__PURE__ */ v(p.Root, {
|
|
46
|
+
open: D,
|
|
47
|
+
onOpenChange: (e) => {
|
|
48
|
+
O(e), e && E(y);
|
|
49
|
+
},
|
|
50
|
+
children: [/* @__PURE__ */ _(p.Trigger, {
|
|
51
|
+
asChild: !0,
|
|
52
|
+
children: /* @__PURE__ */ v(t, {
|
|
53
|
+
type: "button",
|
|
54
|
+
variant: "outline",
|
|
55
|
+
"aria-label": x,
|
|
56
|
+
className: e("w-full justify-start bg-card font-normal", S),
|
|
57
|
+
children: [/* @__PURE__ */ _(m, {
|
|
58
|
+
"aria-hidden": "true",
|
|
59
|
+
className: "size-4 opacity-60"
|
|
60
|
+
}), /* @__PURE__ */ _("span", {
|
|
61
|
+
className: e("truncate", !j && "text-muted-foreground"),
|
|
62
|
+
children: j || C("dateRange.placeholder")
|
|
63
|
+
})]
|
|
64
|
+
})
|
|
65
|
+
}), /* @__PURE__ */ _(p.Portal, { children: /* @__PURE__ */ v(p.Content, {
|
|
66
|
+
align: "start",
|
|
67
|
+
sideOffset: 4,
|
|
68
|
+
className: "z-50 w-80 rounded-lg border bg-popover p-3 shadow-lg outline-none",
|
|
69
|
+
onMouseLeave: () => {
|
|
70
|
+
I.current = null;
|
|
71
|
+
},
|
|
72
|
+
children: [
|
|
73
|
+
/* @__PURE__ */ v("div", {
|
|
74
|
+
className: "mb-2 flex items-center justify-between",
|
|
75
|
+
children: [
|
|
76
|
+
/* @__PURE__ */ _(t, {
|
|
77
|
+
type: "button",
|
|
78
|
+
variant: "ghost",
|
|
79
|
+
size: "icon-sm",
|
|
80
|
+
"aria-label": C("dateRange.previousMonth"),
|
|
81
|
+
onClick: () => N(new Date(M.getFullYear(), M.getMonth() - 1, 1)),
|
|
82
|
+
children: /* @__PURE__ */ _(h, { "aria-hidden": "true" })
|
|
83
|
+
}),
|
|
84
|
+
/* @__PURE__ */ _("p", {
|
|
85
|
+
className: "text-sm font-medium",
|
|
86
|
+
children: R
|
|
87
|
+
}),
|
|
88
|
+
/* @__PURE__ */ _(t, {
|
|
89
|
+
type: "button",
|
|
90
|
+
variant: "ghost",
|
|
91
|
+
size: "icon-sm",
|
|
92
|
+
"aria-label": C("dateRange.nextMonth"),
|
|
93
|
+
onClick: () => N(new Date(M.getFullYear(), M.getMonth() + 1, 1)),
|
|
94
|
+
children: /* @__PURE__ */ _(g, { "aria-hidden": "true" })
|
|
95
|
+
})
|
|
96
|
+
]
|
|
97
|
+
}),
|
|
98
|
+
/* @__PURE__ */ _("div", {
|
|
99
|
+
className: "grid grid-cols-7 text-center text-xs text-muted-foreground",
|
|
100
|
+
children: L.slice(0, 7).map((e) => /* @__PURE__ */ _("span", {
|
|
101
|
+
className: "py-1",
|
|
102
|
+
children: new Intl.DateTimeFormat(w.language, { weekday: "narrow" }).format(e)
|
|
103
|
+
}, i(e)))
|
|
104
|
+
}),
|
|
105
|
+
/* @__PURE__ */ _("div", {
|
|
106
|
+
className: "grid grid-cols-7 gap-0.5",
|
|
107
|
+
children: L.map((t) => {
|
|
108
|
+
let n = i(t), r = T.from && !T.to ? {
|
|
109
|
+
from: T.from,
|
|
110
|
+
to: P
|
|
111
|
+
} : T, a = l(r, n), o = t.getMonth() !== M.getMonth();
|
|
112
|
+
return /* @__PURE__ */ _("button", {
|
|
113
|
+
type: "button",
|
|
114
|
+
"data-day": n,
|
|
115
|
+
"aria-label": n,
|
|
116
|
+
"aria-pressed": a !== "outside",
|
|
117
|
+
onMouseEnter: () => {
|
|
118
|
+
F(n), B(n);
|
|
119
|
+
},
|
|
120
|
+
onMouseLeave: () => F(void 0),
|
|
121
|
+
onMouseDown: () => {
|
|
122
|
+
I.current = {
|
|
123
|
+
key: n,
|
|
124
|
+
dragging: !1
|
|
125
|
+
};
|
|
126
|
+
},
|
|
127
|
+
onMouseUp: () => {
|
|
128
|
+
let e = I.current;
|
|
129
|
+
I.current = null, e && !e.dragging && z(n);
|
|
130
|
+
},
|
|
131
|
+
className: e("h-8 rounded-md text-sm tabular-nums hover:bg-accent", o && "text-muted-foreground", a === "in-range" && "bg-primary/10 text-primary", (a === "start" || a === "end") && "bg-primary text-primary-foreground hover:bg-primary"),
|
|
132
|
+
children: t.getDate()
|
|
133
|
+
}, n);
|
|
134
|
+
})
|
|
135
|
+
}),
|
|
136
|
+
/* @__PURE__ */ v("div", {
|
|
137
|
+
className: "mt-2 grid gap-3 sm:grid-cols-2",
|
|
138
|
+
children: [/* @__PURE__ */ v("div", {
|
|
139
|
+
className: "grid gap-1.5",
|
|
140
|
+
children: [/* @__PURE__ */ _(u, {
|
|
141
|
+
htmlFor: "range-from",
|
|
142
|
+
children: C("dateRange.from")
|
|
143
|
+
}), /* @__PURE__ */ _(r, {
|
|
144
|
+
id: "range-from",
|
|
145
|
+
value: T.from ?? "",
|
|
146
|
+
max: T.to,
|
|
147
|
+
onChange: (e) => E({
|
|
148
|
+
...T,
|
|
149
|
+
from: e.target.value
|
|
150
|
+
})
|
|
151
|
+
})]
|
|
152
|
+
}), /* @__PURE__ */ v("div", {
|
|
153
|
+
className: "grid gap-1.5",
|
|
154
|
+
children: [/* @__PURE__ */ _(u, {
|
|
155
|
+
htmlFor: "range-to",
|
|
156
|
+
children: C("dateRange.to")
|
|
157
|
+
}), /* @__PURE__ */ _(r, {
|
|
158
|
+
id: "range-to",
|
|
159
|
+
value: T.to ?? "",
|
|
160
|
+
min: T.from,
|
|
161
|
+
onChange: (e) => E({
|
|
162
|
+
...T,
|
|
163
|
+
to: e.target.value
|
|
164
|
+
})
|
|
165
|
+
})]
|
|
166
|
+
})]
|
|
167
|
+
}),
|
|
168
|
+
/* @__PURE__ */ _("div", {
|
|
169
|
+
className: "mt-3 flex flex-wrap gap-1.5",
|
|
170
|
+
children: A.map((e) => /* @__PURE__ */ _(t, {
|
|
171
|
+
type: "button",
|
|
172
|
+
size: "sm",
|
|
173
|
+
variant: "outline",
|
|
174
|
+
onClick: () => {
|
|
175
|
+
E(e.range), b(e.range), O(!1);
|
|
176
|
+
},
|
|
177
|
+
children: C(`dateRange.shortcuts.${e.key}`)
|
|
178
|
+
}, e.key))
|
|
179
|
+
}),
|
|
180
|
+
k && /* @__PURE__ */ _("p", {
|
|
181
|
+
className: "mt-2 text-xs text-destructive",
|
|
182
|
+
children: C("dateRange.invalid")
|
|
183
|
+
}),
|
|
184
|
+
/* @__PURE__ */ v("div", {
|
|
185
|
+
className: "mt-3 flex justify-end gap-2 border-t pt-3",
|
|
186
|
+
children: [/* @__PURE__ */ _(t, {
|
|
187
|
+
type: "button",
|
|
188
|
+
variant: "outline",
|
|
189
|
+
size: "sm",
|
|
190
|
+
onClick: () => {
|
|
191
|
+
E({}), b({}), O(!1);
|
|
192
|
+
},
|
|
193
|
+
children: C("clear")
|
|
194
|
+
}), /* @__PURE__ */ _(t, {
|
|
195
|
+
type: "button",
|
|
196
|
+
size: "sm",
|
|
197
|
+
disabled: k,
|
|
198
|
+
onClick: () => {
|
|
199
|
+
b(T), O(!1);
|
|
200
|
+
},
|
|
201
|
+
children: C("confirm")
|
|
202
|
+
})]
|
|
203
|
+
})
|
|
204
|
+
]
|
|
205
|
+
}) })]
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
//#endregion
|
|
209
|
+
export { y as DateRangeInput };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../../lib/utils.cjs"),t=require("./time-input.cjs"),n=require("./date-input.cjs");let r=require("react/jsx-runtime");function i({value:i,onValueChange:a,label:o,className:s}){let[c=``,l=``]=(i??``).split(`T`);return(0,r.jsxs)(`div`,{"data-slot":`date-time-input`,className:e.cn(`flex gap-2`,s),children:[(0,r.jsx)(n.DateInput,{"aria-label":`${o}·日期`,value:c,onChange:e=>a(`${e.target.value}T${l}`)}),(0,r.jsx)(t.TimeInput,{"aria-label":`${o}·时间`,value:l,onChange:e=>a(`${c}T${e.target.value}`)})]})}exports.DateTimeInput=i;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/utils.js";
|
|
2
|
+
import { TimeInput as t } from "./time-input.js";
|
|
3
|
+
import { DateInput as n } from "./date-input.js";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/ui/date-time-input.tsx
|
|
6
|
+
function a({ value: a, onValueChange: o, label: s, className: c }) {
|
|
7
|
+
let [l = "", u = ""] = (a ?? "").split("T");
|
|
8
|
+
return /* @__PURE__ */ i("div", {
|
|
9
|
+
"data-slot": "date-time-input",
|
|
10
|
+
className: e("flex gap-2", c),
|
|
11
|
+
children: [/* @__PURE__ */ r(n, {
|
|
12
|
+
"aria-label": `${s}·日期`,
|
|
13
|
+
value: l,
|
|
14
|
+
onChange: (e) => o(`${e.target.value}T${u}`)
|
|
15
|
+
}), /* @__PURE__ */ r(t, {
|
|
16
|
+
"aria-label": `${s}·时间`,
|
|
17
|
+
value: u,
|
|
18
|
+
onChange: (e) => o(`${l}T${e.target.value}`)
|
|
19
|
+
})]
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { a as DateTimeInput };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/utils.cjs"),n=require("./button.cjs"),r=require("../../lib/use-ui-translation.cjs"),i=require("../../lib/dialog-focus.cjs");let a=require("react");a=e.__toESM(a,1);let o=require("radix-ui"),s=require("lucide-react"),c=require("react/jsx-runtime");function l({...e}){return(0,c.jsx)(o.Dialog.Root,{"data-slot":`dialog`,...e})}function u({...e}){return(0,c.jsx)(o.Dialog.Trigger,{"data-slot":`dialog-trigger`,...e})}function d({...e}){return(0,c.jsx)(o.Dialog.Portal,{"data-slot":`dialog-portal`,...e})}function f({...e}){return(0,c.jsx)(o.Dialog.Close,{"data-slot":`dialog-close`,...e})}function p({className:e,...n}){return(0,c.jsx)(o.Dialog.Overlay,{"data-slot":`dialog-overlay`,className:t.cn(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...n})}function m({className:e,children:l,showCloseButton:u=!0,onOpenAutoFocus:f,draggable:m=!1,zIndex:h,top:g,..._}){let{t:v}=r.useUiTranslation(),[y,b]=a.useState({x:0,y:0}),[x,S]=a.useState(!1),C=a.useRef(null),w=a.useRef(null);a.useEffect(()=>{let e=C.current;e&&(x?e.style.transitionProperty=`none`:e.style.removeProperty(`transition-property`))},[x]),a.useEffect(()=>{let e=C.current;e&&g!==void 0&&(e.style.top=`${g}px`)},[g]);let T=!!m,E=String(m)===`always`,D=T?{"--tw-translate-x":`calc(-50% + ${y.x}px)`,"--tw-translate-y":g===void 0?`calc(-50% + ${y.y}px)`:`${y.y}px`}:void 0;return(0,c.jsxs)(d,{"data-slot":`dialog-portal`,children:[(0,c.jsx)(p,{style:h?{zIndex:h}:void 0}),(0,c.jsxs)(o.Dialog.Content,{"data-slot":`dialog-content`,"data-draggable":T||void 0,"data-drag-touch":E||void 0,"data-dragging":x||void 0,ref:C,style:{...h?{zIndex:h}:{},...D},onDoubleClick:()=>{T&&b({x:0,y:0})},onKeyDown:e=>{if(!T||e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target;if(t.tagName===`INPUT`||t.tagName===`TEXTAREA`)return;let n=e.shiftKey?48:16,r={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]}[e.key];r&&(e.preventDefault(),b(e=>({x:Math.max(-320,Math.min(320,e.x+(r[0]??0)*n)),y:Math.max(-320,Math.min(320,e.y+(r[1]??0)*n))})))},className:t.cn(`fixed left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg`,g===void 0?`top-[50%] translate-x-[-50%] translate-y-[-50%]`:`translate-x-[-50%]`,e),..._,onOpenAutoFocus:e=>{f?.(e),e.defaultPrevented||i.avoidInitialCloseFocus(e)},children:[T&&(0,c.jsx)(`span`,{"data-slot":`dialog-drag-handle`,"aria-hidden":`true`,onPointerDown:e=>{(E||window.matchMedia(`(hover: hover) and (pointer: fine)`).matches)&&(e.currentTarget.setPointerCapture(e.pointerId),w.current={x:e.clientX,y:e.clientY,origin:y})},onPointerMove:e=>{if(!w.current)return;let t=Math.hypot(e.clientX-w.current.x,e.clientY-w.current.y);if(!x&&t<4)return;x||S(!0);let n={x:w.current.origin.x+(e.clientX-w.current.x),y:w.current.origin.y+(e.clientY-w.current.y)};b({x:Math.max(-320,Math.min(320,n.x)),y:Math.max(-320,Math.min(320,n.y))})},onPointerUp:()=>{w.current=null,S(!1)},onPointerCancel:()=>{w.current=null,S(!1)},className:`absolute inset-x-0 top-0 h-14 cursor-grab active:cursor-grabbing`}),l,T&&(y.x!==0||y.y!==0)&&(0,c.jsx)(n.Button,{type:`button`,variant:`ghost`,size:`xs`,className:`absolute bottom-3 left-4 text-xs text-muted-foreground`,onClick:()=>b({x:0,y:0}),children:v(`resetPosition`)}),u&&(0,c.jsxs)(o.Dialog.Close,{"data-slot":`dialog-close`,className:`absolute top-4 right-4 z-10 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,c.jsx)(s.XIcon,{}),(0,c.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function h({className:e,...n}){return(0,c.jsx)(`div`,{"data-slot":`dialog-header`,className:t.cn(`flex flex-col gap-2 text-center sm:text-left`,e),...n})}function g({className:e,showCloseButton:r=!1,children:i,...a}){return(0,c.jsxs)(`div`,{"data-slot":`dialog-footer`,className:t.cn(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...a,children:[i,r&&(0,c.jsx)(o.Dialog.Close,{asChild:!0,children:(0,c.jsx)(n.Button,{variant:`outline`,children:`Close`})})]})}function _({className:e,...n}){return(0,c.jsx)(o.Dialog.Title,{"data-slot":`dialog-title`,className:t.cn(`text-lg leading-none font-semibold`,e),...n})}function v({className:e,...n}){return(0,c.jsx)(o.Dialog.Description,{"data-slot":`dialog-description`,className:t.cn(`text-sm text-muted-foreground`,e),...n})}exports.Dialog=l,exports.DialogClose=f,exports.DialogContent=m,exports.DialogDescription=v,exports.DialogFooter=g,exports.DialogHeader=h,exports.DialogOverlay=p,exports.DialogPortal=d,exports.DialogTitle=_,exports.DialogTrigger=u;
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../lib/utils.js";
|
|
3
|
+
import { Button as t } from "./button.js";
|
|
4
|
+
import { useUiTranslation as n } from "../../lib/use-ui-translation.js";
|
|
5
|
+
import { avoidInitialCloseFocus as r } from "../../lib/dialog-focus.js";
|
|
6
|
+
import * as i from "react";
|
|
7
|
+
import { Dialog as a } from "radix-ui";
|
|
8
|
+
import { XIcon as o } from "lucide-react";
|
|
9
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
10
|
+
//#region src/components/ui/dialog.tsx
|
|
11
|
+
function l({ ...e }) {
|
|
12
|
+
return /* @__PURE__ */ s(a.Root, {
|
|
13
|
+
"data-slot": "dialog",
|
|
14
|
+
...e
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function u({ ...e }) {
|
|
18
|
+
return /* @__PURE__ */ s(a.Trigger, {
|
|
19
|
+
"data-slot": "dialog-trigger",
|
|
20
|
+
...e
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function d({ ...e }) {
|
|
24
|
+
return /* @__PURE__ */ s(a.Portal, {
|
|
25
|
+
"data-slot": "dialog-portal",
|
|
26
|
+
...e
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function f({ ...e }) {
|
|
30
|
+
return /* @__PURE__ */ s(a.Close, {
|
|
31
|
+
"data-slot": "dialog-close",
|
|
32
|
+
...e
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function p({ className: t, ...n }) {
|
|
36
|
+
return /* @__PURE__ */ s(a.Overlay, {
|
|
37
|
+
"data-slot": "dialog-overlay",
|
|
38
|
+
className: e("fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0", t),
|
|
39
|
+
...n
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function m({ className: l, children: u, showCloseButton: f = !0, onOpenAutoFocus: m, draggable: h = !1, zIndex: g, top: _, ...v }) {
|
|
43
|
+
let { t: y } = n(), [b, x] = i.useState({
|
|
44
|
+
x: 0,
|
|
45
|
+
y: 0
|
|
46
|
+
}), [S, C] = i.useState(!1), w = i.useRef(null), T = i.useRef(null);
|
|
47
|
+
i.useEffect(() => {
|
|
48
|
+
let e = w.current;
|
|
49
|
+
e && (S ? e.style.transitionProperty = "none" : e.style.removeProperty("transition-property"));
|
|
50
|
+
}, [S]), i.useEffect(() => {
|
|
51
|
+
let e = w.current;
|
|
52
|
+
e && _ !== void 0 && (e.style.top = `${_}px`);
|
|
53
|
+
}, [_]);
|
|
54
|
+
let E = !!h, D = String(h) === "always", O = E ? {
|
|
55
|
+
"--tw-translate-x": `calc(-50% + ${b.x}px)`,
|
|
56
|
+
"--tw-translate-y": _ === void 0 ? `calc(-50% + ${b.y}px)` : `${b.y}px`
|
|
57
|
+
} : void 0;
|
|
58
|
+
return /* @__PURE__ */ c(d, {
|
|
59
|
+
"data-slot": "dialog-portal",
|
|
60
|
+
children: [/* @__PURE__ */ s(p, { style: g ? { zIndex: g } : void 0 }), /* @__PURE__ */ c(a.Content, {
|
|
61
|
+
"data-slot": "dialog-content",
|
|
62
|
+
"data-draggable": E || void 0,
|
|
63
|
+
"data-drag-touch": D || void 0,
|
|
64
|
+
"data-dragging": S || void 0,
|
|
65
|
+
ref: w,
|
|
66
|
+
style: {
|
|
67
|
+
...g ? { zIndex: g } : {},
|
|
68
|
+
...O
|
|
69
|
+
},
|
|
70
|
+
onDoubleClick: () => {
|
|
71
|
+
E && x({
|
|
72
|
+
x: 0,
|
|
73
|
+
y: 0
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
onKeyDown: (e) => {
|
|
77
|
+
if (!E || e.metaKey || e.ctrlKey || e.altKey) return;
|
|
78
|
+
let t = e.target;
|
|
79
|
+
if (t.tagName === "INPUT" || t.tagName === "TEXTAREA") return;
|
|
80
|
+
let n = e.shiftKey ? 48 : 16, r = {
|
|
81
|
+
ArrowLeft: [-1, 0],
|
|
82
|
+
ArrowRight: [1, 0],
|
|
83
|
+
ArrowUp: [0, -1],
|
|
84
|
+
ArrowDown: [0, 1]
|
|
85
|
+
}[e.key];
|
|
86
|
+
r && (e.preventDefault(), x((e) => ({
|
|
87
|
+
x: Math.max(-320, Math.min(320, e.x + (r[0] ?? 0) * n)),
|
|
88
|
+
y: Math.max(-320, Math.min(320, e.y + (r[1] ?? 0) * n))
|
|
89
|
+
})));
|
|
90
|
+
},
|
|
91
|
+
className: e("fixed left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg", _ === void 0 ? "top-[50%] translate-x-[-50%] translate-y-[-50%]" : "translate-x-[-50%]", l),
|
|
92
|
+
...v,
|
|
93
|
+
onOpenAutoFocus: (e) => {
|
|
94
|
+
m?.(e), e.defaultPrevented || r(e);
|
|
95
|
+
},
|
|
96
|
+
children: [
|
|
97
|
+
E && /* @__PURE__ */ s("span", {
|
|
98
|
+
"data-slot": "dialog-drag-handle",
|
|
99
|
+
"aria-hidden": "true",
|
|
100
|
+
onPointerDown: (e) => {
|
|
101
|
+
(D || window.matchMedia("(hover: hover) and (pointer: fine)").matches) && (e.currentTarget.setPointerCapture(e.pointerId), T.current = {
|
|
102
|
+
x: e.clientX,
|
|
103
|
+
y: e.clientY,
|
|
104
|
+
origin: b
|
|
105
|
+
});
|
|
106
|
+
},
|
|
107
|
+
onPointerMove: (e) => {
|
|
108
|
+
if (!T.current) return;
|
|
109
|
+
let t = Math.hypot(e.clientX - T.current.x, e.clientY - T.current.y);
|
|
110
|
+
if (!S && t < 4) return;
|
|
111
|
+
S || C(!0);
|
|
112
|
+
let n = {
|
|
113
|
+
x: T.current.origin.x + (e.clientX - T.current.x),
|
|
114
|
+
y: T.current.origin.y + (e.clientY - T.current.y)
|
|
115
|
+
};
|
|
116
|
+
x({
|
|
117
|
+
x: Math.max(-320, Math.min(320, n.x)),
|
|
118
|
+
y: Math.max(-320, Math.min(320, n.y))
|
|
119
|
+
});
|
|
120
|
+
},
|
|
121
|
+
onPointerUp: () => {
|
|
122
|
+
T.current = null, C(!1);
|
|
123
|
+
},
|
|
124
|
+
onPointerCancel: () => {
|
|
125
|
+
T.current = null, C(!1);
|
|
126
|
+
},
|
|
127
|
+
className: "absolute inset-x-0 top-0 h-14 cursor-grab active:cursor-grabbing"
|
|
128
|
+
}),
|
|
129
|
+
u,
|
|
130
|
+
E && (b.x !== 0 || b.y !== 0) && /* @__PURE__ */ s(t, {
|
|
131
|
+
type: "button",
|
|
132
|
+
variant: "ghost",
|
|
133
|
+
size: "xs",
|
|
134
|
+
className: "absolute bottom-3 left-4 text-xs text-muted-foreground",
|
|
135
|
+
onClick: () => x({
|
|
136
|
+
x: 0,
|
|
137
|
+
y: 0
|
|
138
|
+
}),
|
|
139
|
+
children: y("resetPosition")
|
|
140
|
+
}),
|
|
141
|
+
f && /* @__PURE__ */ c(a.Close, {
|
|
142
|
+
"data-slot": "dialog-close",
|
|
143
|
+
className: "absolute top-4 right-4 z-10 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
144
|
+
children: [/* @__PURE__ */ s(o, {}), /* @__PURE__ */ s("span", {
|
|
145
|
+
className: "sr-only",
|
|
146
|
+
children: "Close"
|
|
147
|
+
})]
|
|
148
|
+
})
|
|
149
|
+
]
|
|
150
|
+
})]
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
function h({ className: t, ...n }) {
|
|
154
|
+
return /* @__PURE__ */ s("div", {
|
|
155
|
+
"data-slot": "dialog-header",
|
|
156
|
+
className: e("flex flex-col gap-2 text-center sm:text-left", t),
|
|
157
|
+
...n
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
function g({ className: n, showCloseButton: r = !1, children: i, ...o }) {
|
|
161
|
+
return /* @__PURE__ */ c("div", {
|
|
162
|
+
"data-slot": "dialog-footer",
|
|
163
|
+
className: e("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", n),
|
|
164
|
+
...o,
|
|
165
|
+
children: [i, r && /* @__PURE__ */ s(a.Close, {
|
|
166
|
+
asChild: !0,
|
|
167
|
+
children: /* @__PURE__ */ s(t, {
|
|
168
|
+
variant: "outline",
|
|
169
|
+
children: "Close"
|
|
170
|
+
})
|
|
171
|
+
})]
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
function _({ className: t, ...n }) {
|
|
175
|
+
return /* @__PURE__ */ s(a.Title, {
|
|
176
|
+
"data-slot": "dialog-title",
|
|
177
|
+
className: e("text-lg leading-none font-semibold", t),
|
|
178
|
+
...n
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
function v({ className: t, ...n }) {
|
|
182
|
+
return /* @__PURE__ */ s(a.Description, {
|
|
183
|
+
"data-slot": "dialog-description",
|
|
184
|
+
className: e("text-sm text-muted-foreground", t),
|
|
185
|
+
...n
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
//#endregion
|
|
189
|
+
export { l as Dialog, f as DialogClose, m as DialogContent, v as DialogDescription, g as DialogFooter, h as DialogHeader, p as DialogOverlay, d as DialogPortal, _ as DialogTitle, u as DialogTrigger };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/utils.cjs");let n=require("react");n=e.__toESM(n,1);let r=require("radix-ui"),i=require("lucide-react"),a=require("react/jsx-runtime");function o({...e}){return(0,a.jsx)(r.DropdownMenu.Root,{"data-slot":`dropdown-menu`,...e})}function s({...e}){return(0,a.jsx)(r.DropdownMenu.Portal,{"data-slot":`dropdown-menu-portal`,...e})}function c({...e}){return(0,a.jsx)(r.DropdownMenu.Trigger,{"data-slot":`dropdown-menu-trigger`,...e})}function l({className:e,sideOffset:n=4,...i}){return(0,a.jsx)(r.DropdownMenu.Portal,{children:(0,a.jsx)(r.DropdownMenu.Content,{"data-slot":`dropdown-menu-content`,sideOffset:n,className:t.cn(`z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...i})})}function u({...e}){return(0,a.jsx)(r.DropdownMenu.Group,{"data-slot":`dropdown-menu-group`,...e})}function d({className:e,inset:n,variant:i=`default`,...o}){return(0,a.jsx)(r.DropdownMenu.Item,{"data-slot":`dropdown-menu-item`,"data-inset":n,"data-variant":i,className:t.cn(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!`,e),...o})}function f({className:e,children:n,checked:o,indicator:s=`leading`,...c}){let l=s===`trailing`;return(0,a.jsxs)(r.DropdownMenu.CheckboxItem,{"data-slot":`dropdown-menu-checkbox-item`,className:t.cn(`relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,l&&`gap-2 pl-2`,e),checked:o,...c,children:[(0,a.jsx)(`span`,{className:t.cn(`pointer-events-none flex size-3.5 items-center justify-center`,l?`order-last`:`absolute left-2`),children:(0,a.jsx)(r.DropdownMenu.ItemIndicator,{children:(0,a.jsx)(i.CheckIcon,{className:`size-4`})})}),n]})}function p({...e}){return(0,a.jsx)(r.DropdownMenu.RadioGroup,{"data-slot":`dropdown-menu-radio-group`,...e})}function m({className:e,children:n,...o}){return(0,a.jsxs)(r.DropdownMenu.RadioItem,{"data-slot":`dropdown-menu-radio-item`,className:t.cn(`relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...o,children:[(0,a.jsx)(`span`,{className:`pointer-events-none absolute left-2 flex size-3.5 items-center justify-center`,children:(0,a.jsx)(r.DropdownMenu.ItemIndicator,{children:(0,a.jsx)(i.CircleIcon,{className:`size-2 fill-current`})})}),n]})}function h({className:e,inset:n,...i}){return(0,a.jsx)(r.DropdownMenu.Label,{"data-slot":`dropdown-menu-label`,"data-inset":n,className:t.cn(`px-2 py-1.5 text-sm font-medium data-[inset]:pl-8`,e),...i})}function g({className:e,...n}){return(0,a.jsx)(r.DropdownMenu.Separator,{"data-slot":`dropdown-menu-separator`,className:t.cn(`-mx-1 my-1 h-px bg-border`,e),...n})}function _({className:e,...n}){return(0,a.jsx)(`span`,{"data-slot":`dropdown-menu-shortcut`,className:t.cn(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...n})}function v({...e}){return(0,a.jsx)(r.DropdownMenu.Sub,{"data-slot":`dropdown-menu-sub`,...e})}function y({className:e,inset:n,children:o,...s}){return(0,a.jsxs)(r.DropdownMenu.SubTrigger,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":n,className:t.cn(`flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...s,children:[o,(0,a.jsx)(i.ChevronRightIcon,{className:`ml-auto size-4`})]})}function b({className:e,...n}){return(0,a.jsx)(r.DropdownMenu.SubContent,{"data-slot":`dropdown-menu-sub-content`,className:t.cn(`z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...n})}exports.DropdownMenu=o,exports.DropdownMenuCheckboxItem=f,exports.DropdownMenuContent=l,exports.DropdownMenuGroup=u,exports.DropdownMenuItem=d,exports.DropdownMenuLabel=h,exports.DropdownMenuPortal=s,exports.DropdownMenuRadioGroup=p,exports.DropdownMenuRadioItem=m,exports.DropdownMenuSeparator=g,exports.DropdownMenuShortcut=_,exports.DropdownMenuSub=v,exports.DropdownMenuSubContent=b,exports.DropdownMenuSubTrigger=y,exports.DropdownMenuTrigger=c;
|