@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,124 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../lib/utils.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { DropdownMenu as t } from "radix-ui";
|
|
5
|
+
import { CheckIcon as n, ChevronRightIcon as r, CircleIcon as i } from "lucide-react";
|
|
6
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/ui/dropdown-menu.tsx
|
|
8
|
+
function s({ ...e }) {
|
|
9
|
+
return /* @__PURE__ */ a(t.Root, {
|
|
10
|
+
"data-slot": "dropdown-menu",
|
|
11
|
+
...e
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function c({ ...e }) {
|
|
15
|
+
return /* @__PURE__ */ a(t.Portal, {
|
|
16
|
+
"data-slot": "dropdown-menu-portal",
|
|
17
|
+
...e
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function l({ ...e }) {
|
|
21
|
+
return /* @__PURE__ */ a(t.Trigger, {
|
|
22
|
+
"data-slot": "dropdown-menu-trigger",
|
|
23
|
+
...e
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function u({ className: n, sideOffset: r = 4, ...i }) {
|
|
27
|
+
return /* @__PURE__ */ a(t.Portal, { children: /* @__PURE__ */ a(t.Content, {
|
|
28
|
+
"data-slot": "dropdown-menu-content",
|
|
29
|
+
sideOffset: r,
|
|
30
|
+
className: e("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", n),
|
|
31
|
+
...i
|
|
32
|
+
}) });
|
|
33
|
+
}
|
|
34
|
+
function d({ ...e }) {
|
|
35
|
+
return /* @__PURE__ */ a(t.Group, {
|
|
36
|
+
"data-slot": "dropdown-menu-group",
|
|
37
|
+
...e
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function f({ className: n, inset: r, variant: i = "default", ...o }) {
|
|
41
|
+
return /* @__PURE__ */ a(t.Item, {
|
|
42
|
+
"data-slot": "dropdown-menu-item",
|
|
43
|
+
"data-inset": r,
|
|
44
|
+
"data-variant": i,
|
|
45
|
+
className: e("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!", n),
|
|
46
|
+
...o
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function p({ className: r, children: i, checked: s, indicator: c = "leading", ...l }) {
|
|
50
|
+
let u = c === "trailing";
|
|
51
|
+
return /* @__PURE__ */ o(t.CheckboxItem, {
|
|
52
|
+
"data-slot": "dropdown-menu-checkbox-item",
|
|
53
|
+
className: e("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", u && "gap-2 pl-2", r),
|
|
54
|
+
checked: s,
|
|
55
|
+
...l,
|
|
56
|
+
children: [/* @__PURE__ */ a("span", {
|
|
57
|
+
className: e("pointer-events-none flex size-3.5 items-center justify-center", u ? "order-last" : "absolute left-2"),
|
|
58
|
+
children: /* @__PURE__ */ a(t.ItemIndicator, { children: /* @__PURE__ */ a(n, { className: "size-4" }) })
|
|
59
|
+
}), i]
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function m({ ...e }) {
|
|
63
|
+
return /* @__PURE__ */ a(t.RadioGroup, {
|
|
64
|
+
"data-slot": "dropdown-menu-radio-group",
|
|
65
|
+
...e
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function h({ className: n, children: r, ...s }) {
|
|
69
|
+
return /* @__PURE__ */ o(t.RadioItem, {
|
|
70
|
+
"data-slot": "dropdown-menu-radio-item",
|
|
71
|
+
className: e("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", n),
|
|
72
|
+
...s,
|
|
73
|
+
children: [/* @__PURE__ */ a("span", {
|
|
74
|
+
className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",
|
|
75
|
+
children: /* @__PURE__ */ a(t.ItemIndicator, { children: /* @__PURE__ */ a(i, { className: "size-2 fill-current" }) })
|
|
76
|
+
}), r]
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function g({ className: n, inset: r, ...i }) {
|
|
80
|
+
return /* @__PURE__ */ a(t.Label, {
|
|
81
|
+
"data-slot": "dropdown-menu-label",
|
|
82
|
+
"data-inset": r,
|
|
83
|
+
className: e("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8", n),
|
|
84
|
+
...i
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
function _({ className: n, ...r }) {
|
|
88
|
+
return /* @__PURE__ */ a(t.Separator, {
|
|
89
|
+
"data-slot": "dropdown-menu-separator",
|
|
90
|
+
className: e("-mx-1 my-1 h-px bg-border", n),
|
|
91
|
+
...r
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function v({ className: t, ...n }) {
|
|
95
|
+
return /* @__PURE__ */ a("span", {
|
|
96
|
+
"data-slot": "dropdown-menu-shortcut",
|
|
97
|
+
className: e("ml-auto text-xs tracking-widest text-muted-foreground", t),
|
|
98
|
+
...n
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
function y({ ...e }) {
|
|
102
|
+
return /* @__PURE__ */ a(t.Sub, {
|
|
103
|
+
"data-slot": "dropdown-menu-sub",
|
|
104
|
+
...e
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function b({ className: n, inset: i, children: s, ...c }) {
|
|
108
|
+
return /* @__PURE__ */ o(t.SubTrigger, {
|
|
109
|
+
"data-slot": "dropdown-menu-sub-trigger",
|
|
110
|
+
"data-inset": i,
|
|
111
|
+
className: e("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", n),
|
|
112
|
+
...c,
|
|
113
|
+
children: [s, /* @__PURE__ */ a(r, { className: "ml-auto size-4" })]
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
function x({ className: n, ...r }) {
|
|
117
|
+
return /* @__PURE__ */ a(t.SubContent, {
|
|
118
|
+
"data-slot": "dropdown-menu-sub-content",
|
|
119
|
+
className: e("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", n),
|
|
120
|
+
...r
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
//#endregion
|
|
124
|
+
export { s as DropdownMenu, p as DropdownMenuCheckboxItem, u as DropdownMenuContent, d as DropdownMenuGroup, f as DropdownMenuItem, g as DropdownMenuLabel, c as DropdownMenuPortal, m as DropdownMenuRadioGroup, h as DropdownMenuRadioItem, _ as DropdownMenuSeparator, v as DropdownMenuShortcut, y as DropdownMenuSub, x as DropdownMenuSubContent, b as DropdownMenuSubTrigger, l as DropdownMenuTrigger };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../../lib/utils.cjs"),t=require("./button.cjs"),n=require("../../lib/use-ui-translation.cjs"),r=require("./progress.cjs");let i=require("react"),a=require("lucide-react"),o=require("react/jsx-runtime");function s(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function c({files:c,onFilesChange:l,accept:u,maxSize:d=10485760,multiple:f=!0,concurrency:p=3,uploader:m,label:h,className:g}){let{t:_}=n.useUiTranslation(),v=(0,i.useRef)(null),[y,b]=(0,i.useState)(!1),x=(0,i.useRef)(new Map);function S(e){if(!e?.length)return;let t=Array.from(e).slice(0,f?void 0:1).map(e=>{let t=`.${e.name.split(`.`).pop()?.toLowerCase()??``}`,n=u&&!u.split(`,`).some(e=>e.trim().toLowerCase()===t)?_(`fileUpload.typeError`,{accept:u}):e.size>d?_(`fileUpload.sizeError`,{size:s(d)}):void 0,r=new AbortController,i={id:`${e.name}-${e.size}-${e.lastModified}`,name:e.name,size:e.size,progress:n?0:100,error:n,status:n?`failed`:`pending`};if(m&&!n){let t=i.id;x.current.set(t,r),i.status=`uploading`,m(e,r.signal,e=>{l(c.map(n=>n.id===t?{...n,progress:e}:n))}).then(()=>l(c.map(e=>e.id===t?{...e,status:`done`}:e))).catch(e=>{let n=e?.name===`AbortError`;l(c.map(e=>e.id===t?n?{...e,status:`pending`,progress:0}:{...e,status:`failed`,error:`上传失败,请重试`}:e))}).finally(()=>x.current.delete(t))}return i});l(f?[...c,...t]:t)}return(0,o.jsxs)(`div`,{"data-slot":`file-upload`,className:e.cn(`space-y-3`,g),children:[(0,o.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":h,onClick:()=>v.current?.click(),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),v.current?.click())},onDragOver:e=>{e.preventDefault(),b(!0)},onDragLeave:()=>b(!1),onDrop:e=>{e.preventDefault(),b(!1),S(e.dataTransfer.files)},className:e.cn(`flex cursor-pointer flex-col items-center justify-center gap-2 rounded-xl border border-dashed p-6 text-center text-sm`,`hover:border-primary/50 hover:bg-accent/40 focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:outline-none`,y&&`border-primary bg-accent/50`),children:[(0,o.jsx)(a.UploadCloud,{"aria-hidden":`true`,className:`size-6 text-muted-foreground`}),(0,o.jsx)(`span`,{children:_(`fileUpload.hint`)}),(0,o.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[u?`${u} · `:``,_(`fileUpload.limit`,{size:s(d)})]}),(0,o.jsx)(`input`,{ref:v,type:`file`,hidden:!0,accept:u,multiple:f,onChange:e=>{S(e.target.files),e.target.value=``}})]}),c.length>0&&(0,o.jsx)(`ul`,{className:`space-y-2`,children:c.map(e=>(0,o.jsxs)(`li`,{className:`rounded-lg border p-2.5`,children:[(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,o.jsx)(a.FileUp,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),(0,o.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:e.name}),(0,o.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:s(e.size)}),e.status===`uploading`&&(0,o.jsx)(t.Button,{type:`button`,variant:`ghost`,size:`xs`,onClick:()=>{x.current.get(e.id)?.abort(),l(c.filter(t=>t.id!==e.id))},children:_(`cancel`)}),(0,o.jsx)(t.Button,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":`${_(`sample.remove`)} ${e.name}`,onClick:()=>l(c.filter(t=>t.id!==e.id)),children:(0,o.jsx)(a.Trash2,{"aria-hidden":`true`})})]}),e.error?(0,o.jsxs)(`div`,{className:`mt-1 flex items-center justify-between gap-2`,children:[(0,o.jsx)(`p`,{className:`text-xs text-destructive`,children:e.error}),(0,o.jsx)(`button`,{type:`button`,className:`text-xs text-primary hover:underline`,onClick:()=>l(c.map(t=>t.id===e.id?{...t,error:void 0,status:`pending`,progress:0}:t)),children:_(`retry`)})]}):(0,o.jsxs)(`div`,{className:`mt-2 space-y-1`,children:[(0,o.jsx)(r.Progress,{value:e.progress,label:e.name}),(0,o.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] text-muted-foreground`,children:[(0,o.jsx)(`span`,{children:e.status===`uploading`?_(`fileUpload.uploading`):e.status===`done`?_(`fileUpload.done`):_(`fileUpload.pending`)}),(0,o.jsx)(`span`,{children:_(`fileUpload.concurrent`,{count:p})})]})]})]},e.id))})]})}exports.FileUpload=c;
|
|
@@ -0,0 +1,160 @@
|
|
|
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 { Progress as r } from "./progress.js";
|
|
5
|
+
import { useRef as i, useState as a } from "react";
|
|
6
|
+
import { FileUp as o, Trash2 as s, UploadCloud as c } from "lucide-react";
|
|
7
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/ui/file-upload.tsx
|
|
9
|
+
function d(e) {
|
|
10
|
+
return e < 1024 ? `${e} B` : e < 1048576 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1024 / 1024).toFixed(1)} MB`;
|
|
11
|
+
}
|
|
12
|
+
function f({ files: f, onFilesChange: p, accept: m, maxSize: h = 10485760, multiple: g = !0, concurrency: _ = 3, uploader: v, label: y, className: b }) {
|
|
13
|
+
let { t: x } = n(), S = i(null), [C, w] = a(!1), T = i(/* @__PURE__ */ new Map());
|
|
14
|
+
function E(e) {
|
|
15
|
+
if (!e?.length) return;
|
|
16
|
+
let t = Array.from(e).slice(0, g ? void 0 : 1).map((e) => {
|
|
17
|
+
let t = `.${e.name.split(".").pop()?.toLowerCase() ?? ""}`, n = m && !m.split(",").some((e) => e.trim().toLowerCase() === t) ? x("fileUpload.typeError", { accept: m }) : e.size > h ? x("fileUpload.sizeError", { size: d(h) }) : void 0, r = new AbortController(), i = {
|
|
18
|
+
id: `${e.name}-${e.size}-${e.lastModified}`,
|
|
19
|
+
name: e.name,
|
|
20
|
+
size: e.size,
|
|
21
|
+
progress: n ? 0 : 100,
|
|
22
|
+
error: n,
|
|
23
|
+
status: n ? "failed" : "pending"
|
|
24
|
+
};
|
|
25
|
+
if (v && !n) {
|
|
26
|
+
let t = i.id;
|
|
27
|
+
T.current.set(t, r), i.status = "uploading", v(e, r.signal, (e) => {
|
|
28
|
+
p(f.map((n) => n.id === t ? {
|
|
29
|
+
...n,
|
|
30
|
+
progress: e
|
|
31
|
+
} : n));
|
|
32
|
+
}).then(() => p(f.map((e) => e.id === t ? {
|
|
33
|
+
...e,
|
|
34
|
+
status: "done"
|
|
35
|
+
} : e))).catch((e) => {
|
|
36
|
+
let n = e?.name === "AbortError";
|
|
37
|
+
p(f.map((e) => e.id === t ? n ? {
|
|
38
|
+
...e,
|
|
39
|
+
status: "pending",
|
|
40
|
+
progress: 0
|
|
41
|
+
} : {
|
|
42
|
+
...e,
|
|
43
|
+
status: "failed",
|
|
44
|
+
error: "上传失败,请重试"
|
|
45
|
+
} : e));
|
|
46
|
+
}).finally(() => T.current.delete(t));
|
|
47
|
+
}
|
|
48
|
+
return i;
|
|
49
|
+
});
|
|
50
|
+
p(g ? [...f, ...t] : t);
|
|
51
|
+
}
|
|
52
|
+
return /* @__PURE__ */ u("div", {
|
|
53
|
+
"data-slot": "file-upload",
|
|
54
|
+
className: e("space-y-3", b),
|
|
55
|
+
children: [/* @__PURE__ */ u("div", {
|
|
56
|
+
role: "button",
|
|
57
|
+
tabIndex: 0,
|
|
58
|
+
"aria-label": y,
|
|
59
|
+
onClick: () => S.current?.click(),
|
|
60
|
+
onKeyDown: (e) => {
|
|
61
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), S.current?.click());
|
|
62
|
+
},
|
|
63
|
+
onDragOver: (e) => {
|
|
64
|
+
e.preventDefault(), w(!0);
|
|
65
|
+
},
|
|
66
|
+
onDragLeave: () => w(!1),
|
|
67
|
+
onDrop: (e) => {
|
|
68
|
+
e.preventDefault(), w(!1), E(e.dataTransfer.files);
|
|
69
|
+
},
|
|
70
|
+
className: e("flex cursor-pointer flex-col items-center justify-center gap-2 rounded-xl border border-dashed p-6 text-center text-sm", "hover:border-primary/50 hover:bg-accent/40 focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:outline-none", C && "border-primary bg-accent/50"),
|
|
71
|
+
children: [
|
|
72
|
+
/* @__PURE__ */ l(c, {
|
|
73
|
+
"aria-hidden": "true",
|
|
74
|
+
className: "size-6 text-muted-foreground"
|
|
75
|
+
}),
|
|
76
|
+
/* @__PURE__ */ l("span", { children: x("fileUpload.hint") }),
|
|
77
|
+
/* @__PURE__ */ u("span", {
|
|
78
|
+
className: "text-xs text-muted-foreground",
|
|
79
|
+
children: [m ? `${m} · ` : "", x("fileUpload.limit", { size: d(h) })]
|
|
80
|
+
}),
|
|
81
|
+
/* @__PURE__ */ l("input", {
|
|
82
|
+
ref: S,
|
|
83
|
+
type: "file",
|
|
84
|
+
hidden: !0,
|
|
85
|
+
accept: m,
|
|
86
|
+
multiple: g,
|
|
87
|
+
onChange: (e) => {
|
|
88
|
+
E(e.target.files), e.target.value = "";
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
]
|
|
92
|
+
}), f.length > 0 && /* @__PURE__ */ l("ul", {
|
|
93
|
+
className: "space-y-2",
|
|
94
|
+
children: f.map((e) => /* @__PURE__ */ u("li", {
|
|
95
|
+
className: "rounded-lg border p-2.5",
|
|
96
|
+
children: [/* @__PURE__ */ u("div", {
|
|
97
|
+
className: "flex items-center gap-2",
|
|
98
|
+
children: [
|
|
99
|
+
/* @__PURE__ */ l(o, {
|
|
100
|
+
"aria-hidden": "true",
|
|
101
|
+
className: "size-4 shrink-0 text-muted-foreground"
|
|
102
|
+
}),
|
|
103
|
+
/* @__PURE__ */ l("span", {
|
|
104
|
+
className: "min-w-0 flex-1 truncate text-sm",
|
|
105
|
+
children: e.name
|
|
106
|
+
}),
|
|
107
|
+
/* @__PURE__ */ l("span", {
|
|
108
|
+
className: "shrink-0 text-xs text-muted-foreground",
|
|
109
|
+
children: d(e.size)
|
|
110
|
+
}),
|
|
111
|
+
e.status === "uploading" && /* @__PURE__ */ l(t, {
|
|
112
|
+
type: "button",
|
|
113
|
+
variant: "ghost",
|
|
114
|
+
size: "xs",
|
|
115
|
+
onClick: () => {
|
|
116
|
+
T.current.get(e.id)?.abort(), p(f.filter((t) => t.id !== e.id));
|
|
117
|
+
},
|
|
118
|
+
children: x("cancel")
|
|
119
|
+
}),
|
|
120
|
+
/* @__PURE__ */ l(t, {
|
|
121
|
+
type: "button",
|
|
122
|
+
variant: "ghost",
|
|
123
|
+
size: "icon-xs",
|
|
124
|
+
"aria-label": `${x("sample.remove")} ${e.name}`,
|
|
125
|
+
onClick: () => p(f.filter((t) => t.id !== e.id)),
|
|
126
|
+
children: /* @__PURE__ */ l(s, { "aria-hidden": "true" })
|
|
127
|
+
})
|
|
128
|
+
]
|
|
129
|
+
}), e.error ? /* @__PURE__ */ u("div", {
|
|
130
|
+
className: "mt-1 flex items-center justify-between gap-2",
|
|
131
|
+
children: [/* @__PURE__ */ l("p", {
|
|
132
|
+
className: "text-xs text-destructive",
|
|
133
|
+
children: e.error
|
|
134
|
+
}), /* @__PURE__ */ l("button", {
|
|
135
|
+
type: "button",
|
|
136
|
+
className: "text-xs text-primary hover:underline",
|
|
137
|
+
onClick: () => p(f.map((t) => t.id === e.id ? {
|
|
138
|
+
...t,
|
|
139
|
+
error: void 0,
|
|
140
|
+
status: "pending",
|
|
141
|
+
progress: 0
|
|
142
|
+
} : t)),
|
|
143
|
+
children: x("retry")
|
|
144
|
+
})]
|
|
145
|
+
}) : /* @__PURE__ */ u("div", {
|
|
146
|
+
className: "mt-2 space-y-1",
|
|
147
|
+
children: [/* @__PURE__ */ l(r, {
|
|
148
|
+
value: e.progress,
|
|
149
|
+
label: e.name
|
|
150
|
+
}), /* @__PURE__ */ u("div", {
|
|
151
|
+
className: "flex items-center justify-between text-[11px] text-muted-foreground",
|
|
152
|
+
children: [/* @__PURE__ */ l("span", { children: e.status === "uploading" ? x("fileUpload.uploading") : e.status === "done" ? x("fileUpload.done") : x("fileUpload.pending") }), /* @__PURE__ */ l("span", { children: x("fileUpload.concurrent", { count: _ }) })]
|
|
153
|
+
})]
|
|
154
|
+
})]
|
|
155
|
+
}, e.id))
|
|
156
|
+
})]
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
//#endregion
|
|
160
|
+
export { f as FileUpload };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../../lib/utils.cjs");let t=require("radix-ui"),n=require("react/jsx-runtime");function r(e){return(0,n.jsx)(t.HoverCard.Root,{"data-slot":`hover-card`,closeDelay:80,...e})}function i(e){return(0,n.jsx)(t.HoverCard.Trigger,{"data-slot":`hover-card-trigger`,...e})}function a({className:r,align:i=`start`,sideOffset:a=6,...o}){return(0,n.jsx)(t.HoverCard.Portal,{children:(0,n.jsx)(t.HoverCard.Content,{"data-slot":`hover-card-content`,align:i,sideOffset:a,className:e.cn(`z-50 w-64 rounded-lg border bg-popover p-3 text-sm shadow-md outline-none`,`data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,r),...o})})}exports.HoverCard=r,exports.HoverCardContent=a,exports.HoverCardTrigger=i;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/utils.js";
|
|
2
|
+
import { HoverCard as t } from "radix-ui";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/ui/hover-card.tsx
|
|
5
|
+
function r(e) {
|
|
6
|
+
return /* @__PURE__ */ n(t.Root, {
|
|
7
|
+
"data-slot": "hover-card",
|
|
8
|
+
closeDelay: 80,
|
|
9
|
+
...e
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function i(e) {
|
|
13
|
+
return /* @__PURE__ */ n(t.Trigger, {
|
|
14
|
+
"data-slot": "hover-card-trigger",
|
|
15
|
+
...e
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function a({ className: r, align: i = "start", sideOffset: a = 6, ...o }) {
|
|
19
|
+
return /* @__PURE__ */ n(t.Portal, { children: /* @__PURE__ */ n(t.Content, {
|
|
20
|
+
"data-slot": "hover-card-content",
|
|
21
|
+
align: i,
|
|
22
|
+
sideOffset: a,
|
|
23
|
+
className: e("z-50 w-64 rounded-lg border bg-popover p-3 text-sm shadow-md outline-none", "data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0", r),
|
|
24
|
+
...o
|
|
25
|
+
}) });
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { r as HoverCard, a as HoverCardContent, i as HoverCardTrigger };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../../lib/utils.cjs");let t=require("react"),n=require("react/jsx-runtime");function r({value:r,onValueChange:i,length:a=6,id:o,label:s,fill:c=!1,invalid:l=!1,describedBy:u,className:d}){let f=(0,t.useRef)(null),p=Array.from({length:a},(e,t)=>r[t]??``);return(0,n.jsxs)(`div`,{className:e.cn(`relative`,d),children:[(0,n.jsx)(`input`,{ref:f,id:o,"aria-label":s,"aria-invalid":l||void 0,"aria-describedby":u,inputMode:`numeric`,autoComplete:`one-time-code`,maxLength:a,value:r,className:`absolute inset-0 z-10 h-full w-full cursor-text appearance-none border-0 bg-transparent p-0 text-transparent caret-transparent shadow-none outline-none focus:border-0 focus:ring-0 focus-visible:border-0 focus-visible:ring-0 focus-visible:outline-none`,onChange:e=>i(e.target.value.replace(/\D/g,``).slice(0,a))}),(0,n.jsx)(`div`,{"aria-hidden":`true`,className:e.cn(`flex items-center gap-2`,c&&`w-full`),onClick:()=>f.current?.focus(),children:p.map((t,i)=>(0,n.jsx)(`span`,{className:e.cn(`flex h-10 items-center justify-center rounded-lg border bg-card text-base font-medium tabular-nums`,c?`min-w-0 flex-1`:`size-10`,t&&`border-primary/50`,l&&`border-destructive`,i===r.length&&`border-ring ring-2 ring-ring/20`),children:t},i))})]})}exports.InputOTP=r;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/utils.js";
|
|
2
|
+
import { useRef as t } from "react";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/ui/input-otp.tsx
|
|
5
|
+
function i({ value: i, onValueChange: a, length: o = 6, id: s, label: c, fill: l = !1, invalid: u = !1, describedBy: d, className: f }) {
|
|
6
|
+
let p = t(null), m = Array.from({ length: o }, (e, t) => i[t] ?? "");
|
|
7
|
+
return /* @__PURE__ */ r("div", {
|
|
8
|
+
className: e("relative", f),
|
|
9
|
+
children: [/* @__PURE__ */ n("input", {
|
|
10
|
+
ref: p,
|
|
11
|
+
id: s,
|
|
12
|
+
"aria-label": c,
|
|
13
|
+
"aria-invalid": u || void 0,
|
|
14
|
+
"aria-describedby": d,
|
|
15
|
+
inputMode: "numeric",
|
|
16
|
+
autoComplete: "one-time-code",
|
|
17
|
+
maxLength: o,
|
|
18
|
+
value: i,
|
|
19
|
+
className: "absolute inset-0 z-10 h-full w-full cursor-text appearance-none border-0 bg-transparent p-0 text-transparent caret-transparent shadow-none outline-none focus:border-0 focus:ring-0 focus-visible:border-0 focus-visible:ring-0 focus-visible:outline-none",
|
|
20
|
+
onChange: (e) => a(e.target.value.replace(/\D/g, "").slice(0, o))
|
|
21
|
+
}), /* @__PURE__ */ n("div", {
|
|
22
|
+
"aria-hidden": "true",
|
|
23
|
+
className: e("flex items-center gap-2", l && "w-full"),
|
|
24
|
+
onClick: () => p.current?.focus(),
|
|
25
|
+
children: m.map((t, r) => /* @__PURE__ */ n("span", {
|
|
26
|
+
className: e("flex h-10 items-center justify-center rounded-lg border bg-card text-base font-medium tabular-nums", l ? "min-w-0 flex-1" : "size-10", t && "border-primary/50", u && "border-destructive", r === i.length && "border-ring ring-2 ring-ring/20"),
|
|
27
|
+
children: t
|
|
28
|
+
}, r))
|
|
29
|
+
})]
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { i as InputOTP };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/utils.cjs"),n=require("../../lib/use-ui-translation.cjs"),r=require("./time-input.cjs"),i=require("./date-input.cjs");let a=require("react");a=e.__toESM(a,1);let o=require("lucide-react"),s=require("react/jsx-runtime");function c({className:e,type:c,start:d,end:f,clearable:p=!1,onClear:m,ref:h,...g}){let{t:_}=n.useUiTranslation(),[v,y]=a.useState(!1),b=c===`password`,x=b&&v?`text`:c,S=x===`date`||x===`datetime-local`?i.DateInput:x===`time`?r.TimeInput:`input`,C=p&&String(g.value??``).length>0;return!d&&!f&&!p&&!b?(0,s.jsx)(S,{ref:h,type:x,"data-slot":`input`,className:t.cn(l,e),...g}):(0,s.jsxs)(`div`,{"data-slot":`input-wrapper`,className:t.cn(`group relative flex h-10 w-full items-center overflow-hidden rounded-lg border border-input bg-card transition-[border-color,box-shadow,background-color] dark:bg-input/30`,`focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/20`,`has-[[aria-invalid=true]]:border-destructive has-[[aria-invalid=true]]:ring-2 has-[[aria-invalid=true]]:ring-destructive/20`,`has-[:disabled]:pointer-events-none has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-50`),children:[d&&(0,s.jsx)(`span`,{className:`flex shrink-0 items-center pl-3 text-muted-foreground [&_svg:not([class*='size-'])]:size-4`,children:d}),(0,s.jsx)(S,{ref:h,type:x,"data-slot":`input`,className:t.cn(u,e),...g}),(0,s.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 pr-2 text-muted-foreground [&_svg:not([class*='size-'])]:size-4`,children:[f,C&&(0,s.jsx)(`button`,{type:`button`,"aria-label":_(`clear`),className:`rounded p-0.5 hover:text-foreground`,onClick:()=>{m?.()},children:(0,s.jsx)(o.X,{"aria-hidden":`true`,className:`size-3.5`})}),b&&(0,s.jsx)(`button`,{type:`button`,"aria-label":_(v?`hidePassword`:`showPassword`),className:`rounded p-0.5 hover:text-foreground`,onClick:()=>y(e=>!e),children:v?(0,s.jsx)(o.EyeOff,{"aria-hidden":`true`,className:`size-3.5`}):(0,s.jsx)(o.Eye,{"aria-hidden":`true`,className:`size-3.5`})})]})]})}var l=`h-10 w-full min-w-0 rounded-lg border border-input bg-card px-3.5 py-2 text-base shadow-none transition-[border-color,box-shadow,background-color] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-accent file:rounded-md file:mr-3 file:px-3 file:text-sm file:font-medium file:text-accent-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/20 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40`,u=`h-full w-full min-w-0 border-0 bg-transparent px-3.5 py-2 text-base shadow-none outline-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus:border-0 focus:ring-0 focus-visible:border-0 focus-visible:ring-0 focus-visible:outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`;exports.Input=c,exports.inputBaseClass=l;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/utils.js";
|
|
2
|
+
import { useUiTranslation as t } from "../../lib/use-ui-translation.js";
|
|
3
|
+
import { TimeInput as n } from "./time-input.js";
|
|
4
|
+
import { DateInput as r } from "./date-input.js";
|
|
5
|
+
import * as i from "react";
|
|
6
|
+
import { Eye as a, EyeOff as o, X as s } from "lucide-react";
|
|
7
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/ui/input.tsx
|
|
9
|
+
function u({ className: u, type: p, start: m, end: h, clearable: g = !1, onClear: _, ref: v, ...y }) {
|
|
10
|
+
let { t: b } = t(), [x, S] = i.useState(!1), C = p === "password", w = C && x ? "text" : p, T = w === "date" || w === "datetime-local" ? r : w === "time" ? n : "input", E = g && String(y.value ?? "").length > 0;
|
|
11
|
+
return !m && !h && !g && !C ? /* @__PURE__ */ c(T, {
|
|
12
|
+
ref: v,
|
|
13
|
+
type: w,
|
|
14
|
+
"data-slot": "input",
|
|
15
|
+
className: e(d, u),
|
|
16
|
+
...y
|
|
17
|
+
}) : /* @__PURE__ */ l("div", {
|
|
18
|
+
"data-slot": "input-wrapper",
|
|
19
|
+
className: e("group relative flex h-10 w-full items-center overflow-hidden rounded-lg border border-input bg-card transition-[border-color,box-shadow,background-color] dark:bg-input/30", "focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/20", "has-[[aria-invalid=true]]:border-destructive has-[[aria-invalid=true]]:ring-2 has-[[aria-invalid=true]]:ring-destructive/20", "has-[:disabled]:pointer-events-none has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-50"),
|
|
20
|
+
children: [
|
|
21
|
+
m && /* @__PURE__ */ c("span", {
|
|
22
|
+
className: "flex shrink-0 items-center pl-3 text-muted-foreground [&_svg:not([class*='size-'])]:size-4",
|
|
23
|
+
children: m
|
|
24
|
+
}),
|
|
25
|
+
/* @__PURE__ */ c(T, {
|
|
26
|
+
ref: v,
|
|
27
|
+
type: w,
|
|
28
|
+
"data-slot": "input",
|
|
29
|
+
className: e(f, u),
|
|
30
|
+
...y
|
|
31
|
+
}),
|
|
32
|
+
/* @__PURE__ */ l("span", {
|
|
33
|
+
className: "flex shrink-0 items-center gap-1 pr-2 text-muted-foreground [&_svg:not([class*='size-'])]:size-4",
|
|
34
|
+
children: [
|
|
35
|
+
h,
|
|
36
|
+
E && /* @__PURE__ */ c("button", {
|
|
37
|
+
type: "button",
|
|
38
|
+
"aria-label": b("clear"),
|
|
39
|
+
className: "rounded p-0.5 hover:text-foreground",
|
|
40
|
+
onClick: () => {
|
|
41
|
+
_?.();
|
|
42
|
+
},
|
|
43
|
+
children: /* @__PURE__ */ c(s, {
|
|
44
|
+
"aria-hidden": "true",
|
|
45
|
+
className: "size-3.5"
|
|
46
|
+
})
|
|
47
|
+
}),
|
|
48
|
+
C && /* @__PURE__ */ c("button", {
|
|
49
|
+
type: "button",
|
|
50
|
+
"aria-label": b(x ? "hidePassword" : "showPassword"),
|
|
51
|
+
className: "rounded p-0.5 hover:text-foreground",
|
|
52
|
+
onClick: () => S((e) => !e),
|
|
53
|
+
children: c(x ? o : a, {
|
|
54
|
+
"aria-hidden": "true",
|
|
55
|
+
className: "size-3.5"
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
]
|
|
59
|
+
})
|
|
60
|
+
]
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
var d = "h-10 w-full min-w-0 rounded-lg border border-input bg-card px-3.5 py-2 text-base shadow-none transition-[border-color,box-shadow,background-color] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-accent file:rounded-md file:mr-3 file:px-3 file:text-sm file:font-medium file:text-accent-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/20 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40", f = "h-full w-full min-w-0 border-0 bg-transparent px-3.5 py-2 text-base shadow-none outline-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus:border-0 focus:ring-0 focus-visible:border-0 focus-visible:ring-0 focus-visible:outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm";
|
|
64
|
+
//#endregion
|
|
65
|
+
export { u as Input, d as inputBaseClass };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../../lib/utils.cjs");let t=require("react/jsx-runtime");function n({className:n,children:r,...i}){return(0,t.jsx)(`kbd`,{"data-slot":`kbd`,className:e.cn(`inline-flex h-5 min-w-5 items-center justify-center rounded border bg-muted px-1.5 font-mono text-[11px] font-medium text-muted-foreground`,n),...i,children:r})}function r({className:n,children:r}){return(0,t.jsx)(`span`,{"data-slot":`kbd-group`,className:e.cn(`inline-flex items-center gap-1`,n),children:r})}exports.Kbd=n,exports.KbdGroup=r;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/utils.js";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/ui/kbd.tsx
|
|
4
|
+
function n({ className: n, children: r, ...i }) {
|
|
5
|
+
return /* @__PURE__ */ t("kbd", {
|
|
6
|
+
"data-slot": "kbd",
|
|
7
|
+
className: e("inline-flex h-5 min-w-5 items-center justify-center rounded border bg-muted px-1.5 font-mono text-[11px] font-medium text-muted-foreground", n),
|
|
8
|
+
...i,
|
|
9
|
+
children: r
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function r({ className: n, children: r }) {
|
|
13
|
+
return /* @__PURE__ */ t("span", {
|
|
14
|
+
"data-slot": "kbd-group",
|
|
15
|
+
className: e("inline-flex items-center gap-1", n),
|
|
16
|
+
children: r
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { n as Kbd, r as KbdGroup };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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("react/jsx-runtime");function a({className:e,...n}){return(0,i.jsx)(r.Label.Root,{"data-slot":`label`,className:t.cn(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...n})}exports.Label=a;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/utils.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { Label as t } from "radix-ui";
|
|
4
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/ui/label.tsx
|
|
6
|
+
function r({ className: r, ...i }) {
|
|
7
|
+
return /* @__PURE__ */ n(t.Root, {
|
|
8
|
+
"data-slot": "label",
|
|
9
|
+
className: e("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", r),
|
|
10
|
+
...i
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { r as Label };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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,t,r=!1){return n.Children.toArray(e).flatMap(e=>n.isValidElement(e)?e.type===n.Fragment?o(e.props.children,t,r):e.type===`optgroup`||e.type===l?o(e.props.children,e.props.label,e.props.disabled):[{value:String(e.props.value??e.props.children??``),label:e.props.children,disabled:r||e.props.disabled,group:t}]:[])}function s({className:e,size:s=`default`,children:c,value:l,defaultValue:u,onChange:d,ref:f,id:p,name:m,disabled:h,required:g,onInvalid:_,...v}){let y=o(c),b=String(u??y.find(e=>!e.disabled)?.value??``),[x,S]=n.useState(b),C=l===void 0?x:String(l),w=y.findIndex(e=>e.value===C),T=w>=0?w:y.findIndex(e=>!e.disabled),E=y[T]?.value??``,D=n.useRef(l===void 0?b:E);n.useLayoutEffect(()=>{D.current=l===void 0?b:E},[l,b,E]);let O=n.useRef(!1),k=n.useRef(null),A=n.useRef(null);n.useImperativeHandle(f,()=>k.current),n.useEffect(()=>{let e=k.current;e.focus=e=>A.current?.focus(e);let t=t=>{O.current=!0,queueMicrotask(()=>{t.defaultPrevented||(S(b),e.value=D.current),O.current=!1})},n=e.form;return n?.addEventListener(`reset`,t,!0),()=>n?.removeEventListener(`reset`,t,!0)},[b]);function j(e){if(O.current||e===``||y[Number(e)]?.value===E)return;let t=k.current,n=y[Number(e)]?.value;n!==void 0&&(Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,`value`).set.call(t,n),t.dispatchEvent(new Event(`change`,{bubbles:!0})))}return(0,a.jsxs)(`div`,{"data-slot":`native-select-wrapper`,className:`relative w-full min-w-0`,children:[(0,a.jsxs)(r.Select.Root,{value:T<0?``:String(T),onValueChange:j,disabled:h,children:[(0,a.jsxs)(r.Select.Trigger,{value:E,ref:A,id:p,onBlur:()=>k.current?.dispatchEvent(new FocusEvent(`focusout`,{bubbles:!0})),"aria-label":v[`aria-label`],"aria-labelledby":v[`aria-labelledby`],"aria-describedby":v[`aria-describedby`],"aria-invalid":v[`aria-invalid`],"aria-required":g,"data-slot":`select-trigger`,"data-size":s,className:t.cn(`flex h-10 w-full min-w-0 items-center justify-between gap-2 rounded-lg border border-input bg-card px-3.5 text-sm font-normal shadow-none outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/20 disabled:cursor-not-allowed disabled:opacity-50 data-[size=sm]:h-8 aria-invalid:border-destructive [&>span:first-child]:truncate`,e),children:[(0,a.jsx)(`span`,{children:y[T]?.label}),(0,a.jsx)(r.Select.Icon,{children:(0,a.jsx)(i.ChevronDown,{"data-slot":`native-select-icon`,className:`size-4 shrink-0 text-muted-foreground`})})]}),(0,a.jsx)(r.Select.Portal,{children:(0,a.jsxs)(r.Select.Content,{position:`popper`,sideOffset:4,"data-slot":`select-content`,className:`z-50 max-h-[min(20rem,var(--radix-select-content-available-height))] min-w-[var(--radix-select-trigger-width)] max-w-[calc(100vw-2rem)] overflow-hidden rounded-lg border bg-popover text-popover-foreground shadow-md`,children:[(0,a.jsx)(r.Select.ScrollUpButton,{className:`flex justify-center py-1`,children:(0,a.jsx)(i.ChevronUp,{className:`size-4`})}),(0,a.jsx)(r.Select.Viewport,{className:`p-1`,children:y.map((e,t)=>(0,a.jsxs)(n.Fragment,{children:[e.group&&y[t-1]?.group!==e.group&&(0,a.jsx)(`div`,{className:`px-3 py-2 text-xs font-medium text-muted-foreground`,children:e.group}),(0,a.jsxs)(r.Select.Item,{value:String(t),"data-value":e.value,disabled:e.disabled,className:`relative flex min-h-9 cursor-default items-center rounded-md py-2 pl-8 pr-3 text-sm outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[state=checked]:text-primary data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,children:[(0,a.jsx)(r.Select.ItemIndicator,{className:`absolute left-2`,children:(0,a.jsx)(i.Check,{className:`size-4`})}),(0,a.jsx)(r.Select.ItemText,{children:e.label})]})]},e.value))}),(0,a.jsx)(r.Select.ScrollDownButton,{className:`flex justify-center py-1`,children:(0,a.jsx)(i.ChevronDown,{className:`size-4`})})]})})]}),(0,a.jsx)(`select`,{...v,ref:k,name:m,disabled:h,required:g,value:E,tabIndex:-1,"aria-label":void 0,"aria-labelledby":void 0,"aria-hidden":`true`,className:`sr-only pointer-events-none`,onInvalid:e=>{e.preventDefault(),A.current?.focus(),_?.(e)},onChange:e=>{S(e.target.value),d?.(e)},children:c})]})}function c(e){return(0,a.jsx)(`option`,{...e})}function l(e){return(0,a.jsx)(`optgroup`,{...e})}exports.NativeSelect=s,exports.NativeSelectOptGroup=l,exports.NativeSelectOption=c;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/utils.js";
|
|
2
|
+
import * as t from "react";
|
|
3
|
+
import { Select as n } from "radix-ui";
|
|
4
|
+
import { Check as r, ChevronDown as i, ChevronUp as a } from "lucide-react";
|
|
5
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/ui/native-select.tsx
|
|
7
|
+
function c(e, n, r = !1) {
|
|
8
|
+
return t.Children.toArray(e).flatMap((e) => t.isValidElement(e) ? e.type === t.Fragment ? c(e.props.children, n, r) : e.type === "optgroup" || e.type === d ? c(e.props.children, e.props.label, e.props.disabled) : [{
|
|
9
|
+
value: String(e.props.value ?? e.props.children ?? ""),
|
|
10
|
+
label: e.props.children,
|
|
11
|
+
disabled: r || e.props.disabled,
|
|
12
|
+
group: n
|
|
13
|
+
}] : []);
|
|
14
|
+
}
|
|
15
|
+
function l({ className: l, size: u = "default", children: d, value: f, defaultValue: p, onChange: m, ref: h, id: g, name: _, disabled: v, required: y, onInvalid: b, ...x }) {
|
|
16
|
+
let S = c(d), C = String(p ?? S.find((e) => !e.disabled)?.value ?? ""), [w, T] = t.useState(C), E = f === void 0 ? w : String(f), D = S.findIndex((e) => e.value === E), O = D >= 0 ? D : S.findIndex((e) => !e.disabled), k = S[O]?.value ?? "", A = t.useRef(f === void 0 ? C : k);
|
|
17
|
+
t.useLayoutEffect(() => {
|
|
18
|
+
A.current = f === void 0 ? C : k;
|
|
19
|
+
}, [
|
|
20
|
+
f,
|
|
21
|
+
C,
|
|
22
|
+
k
|
|
23
|
+
]);
|
|
24
|
+
let j = t.useRef(!1), M = t.useRef(null), N = t.useRef(null);
|
|
25
|
+
t.useImperativeHandle(h, () => M.current), t.useEffect(() => {
|
|
26
|
+
let e = M.current;
|
|
27
|
+
e.focus = (e) => N.current?.focus(e);
|
|
28
|
+
let t = (t) => {
|
|
29
|
+
j.current = !0, queueMicrotask(() => {
|
|
30
|
+
t.defaultPrevented || (T(C), e.value = A.current), j.current = !1;
|
|
31
|
+
});
|
|
32
|
+
}, n = e.form;
|
|
33
|
+
return n?.addEventListener("reset", t, !0), () => n?.removeEventListener("reset", t, !0);
|
|
34
|
+
}, [C]);
|
|
35
|
+
function P(e) {
|
|
36
|
+
if (j.current || e === "" || S[Number(e)]?.value === k) return;
|
|
37
|
+
let t = M.current, n = S[Number(e)]?.value;
|
|
38
|
+
n !== void 0 && (Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype, "value").set.call(t, n), t.dispatchEvent(new Event("change", { bubbles: !0 })));
|
|
39
|
+
}
|
|
40
|
+
return /* @__PURE__ */ s("div", {
|
|
41
|
+
"data-slot": "native-select-wrapper",
|
|
42
|
+
className: "relative w-full min-w-0",
|
|
43
|
+
children: [/* @__PURE__ */ s(n.Root, {
|
|
44
|
+
value: O < 0 ? "" : String(O),
|
|
45
|
+
onValueChange: P,
|
|
46
|
+
disabled: v,
|
|
47
|
+
children: [/* @__PURE__ */ s(n.Trigger, {
|
|
48
|
+
value: k,
|
|
49
|
+
ref: N,
|
|
50
|
+
id: g,
|
|
51
|
+
onBlur: () => M.current?.dispatchEvent(new FocusEvent("focusout", { bubbles: !0 })),
|
|
52
|
+
"aria-label": x["aria-label"],
|
|
53
|
+
"aria-labelledby": x["aria-labelledby"],
|
|
54
|
+
"aria-describedby": x["aria-describedby"],
|
|
55
|
+
"aria-invalid": x["aria-invalid"],
|
|
56
|
+
"aria-required": y,
|
|
57
|
+
"data-slot": "select-trigger",
|
|
58
|
+
"data-size": u,
|
|
59
|
+
className: e("flex h-10 w-full min-w-0 items-center justify-between gap-2 rounded-lg border border-input bg-card px-3.5 text-sm font-normal shadow-none outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/20 disabled:cursor-not-allowed disabled:opacity-50 data-[size=sm]:h-8 aria-invalid:border-destructive [&>span:first-child]:truncate", l),
|
|
60
|
+
children: [/* @__PURE__ */ o("span", { children: S[O]?.label }), /* @__PURE__ */ o(n.Icon, { children: /* @__PURE__ */ o(i, {
|
|
61
|
+
"data-slot": "native-select-icon",
|
|
62
|
+
className: "size-4 shrink-0 text-muted-foreground"
|
|
63
|
+
}) })]
|
|
64
|
+
}), /* @__PURE__ */ o(n.Portal, { children: /* @__PURE__ */ s(n.Content, {
|
|
65
|
+
position: "popper",
|
|
66
|
+
sideOffset: 4,
|
|
67
|
+
"data-slot": "select-content",
|
|
68
|
+
className: "z-50 max-h-[min(20rem,var(--radix-select-content-available-height))] min-w-[var(--radix-select-trigger-width)] max-w-[calc(100vw-2rem)] overflow-hidden rounded-lg border bg-popover text-popover-foreground shadow-md",
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ o(n.ScrollUpButton, {
|
|
71
|
+
className: "flex justify-center py-1",
|
|
72
|
+
children: /* @__PURE__ */ o(a, { className: "size-4" })
|
|
73
|
+
}),
|
|
74
|
+
/* @__PURE__ */ o(n.Viewport, {
|
|
75
|
+
className: "p-1",
|
|
76
|
+
children: S.map((e, i) => /* @__PURE__ */ s(t.Fragment, { children: [e.group && S[i - 1]?.group !== e.group && /* @__PURE__ */ o("div", {
|
|
77
|
+
className: "px-3 py-2 text-xs font-medium text-muted-foreground",
|
|
78
|
+
children: e.group
|
|
79
|
+
}), /* @__PURE__ */ s(n.Item, {
|
|
80
|
+
value: String(i),
|
|
81
|
+
"data-value": e.value,
|
|
82
|
+
disabled: e.disabled,
|
|
83
|
+
className: "relative flex min-h-9 cursor-default items-center rounded-md py-2 pl-8 pr-3 text-sm outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[state=checked]:text-primary data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
84
|
+
children: [/* @__PURE__ */ o(n.ItemIndicator, {
|
|
85
|
+
className: "absolute left-2",
|
|
86
|
+
children: /* @__PURE__ */ o(r, { className: "size-4" })
|
|
87
|
+
}), /* @__PURE__ */ o(n.ItemText, { children: e.label })]
|
|
88
|
+
})] }, e.value))
|
|
89
|
+
}),
|
|
90
|
+
/* @__PURE__ */ o(n.ScrollDownButton, {
|
|
91
|
+
className: "flex justify-center py-1",
|
|
92
|
+
children: /* @__PURE__ */ o(i, { className: "size-4" })
|
|
93
|
+
})
|
|
94
|
+
]
|
|
95
|
+
}) })]
|
|
96
|
+
}), /* @__PURE__ */ o("select", {
|
|
97
|
+
...x,
|
|
98
|
+
ref: M,
|
|
99
|
+
name: _,
|
|
100
|
+
disabled: v,
|
|
101
|
+
required: y,
|
|
102
|
+
value: k,
|
|
103
|
+
tabIndex: -1,
|
|
104
|
+
"aria-label": void 0,
|
|
105
|
+
"aria-labelledby": void 0,
|
|
106
|
+
"aria-hidden": "true",
|
|
107
|
+
className: "sr-only pointer-events-none",
|
|
108
|
+
onInvalid: (e) => {
|
|
109
|
+
e.preventDefault(), N.current?.focus(), b?.(e);
|
|
110
|
+
},
|
|
111
|
+
onChange: (e) => {
|
|
112
|
+
T(e.target.value), m?.(e);
|
|
113
|
+
},
|
|
114
|
+
children: d
|
|
115
|
+
})]
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
function u(e) {
|
|
119
|
+
return /* @__PURE__ */ o("option", { ...e });
|
|
120
|
+
}
|
|
121
|
+
function d(e) {
|
|
122
|
+
return /* @__PURE__ */ o("optgroup", { ...e });
|
|
123
|
+
}
|
|
124
|
+
//#endregion
|
|
125
|
+
export { l as NativeSelect, d as NativeSelectOptGroup, u as NativeSelectOption };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../../lib/utils.cjs"),t=require("./button.cjs"),n=require("../../lib/use-ui-translation.cjs");let r=require("lucide-react"),i=require("react/jsx-runtime");function a({value:a,onValueChange:o,min:s=0,max:c=2**53-1,step:l=1,disabled:u=!1,label:d,unit:f,className:p}){let{t:m}=n.useUiTranslation(),h=e=>Number(Math.min(c,Math.max(s,e)).toFixed(l<1?2:0));return(0,i.jsxs)(`div`,{"data-slot":`number-field`,className:e.cn(`inline-flex h-10 items-center rounded-lg border border-input bg-card`,u&&`opacity-50`,p),children:[(0,i.jsx)(t.Button,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`${d} ${m(`numberField.decrease`)}`,disabled:u||a<=s,onClick:()=>o(h(a-l)),children:(0,i.jsx)(r.Minus,{"aria-hidden":`true`})}),f&&(0,i.jsx)(`span`,{className:`pl-1 text-xs text-muted-foreground`,children:f}),(0,i.jsx)(`input`,{"aria-label":d,inputMode:`decimal`,value:a,disabled:u,className:`h-full w-16 min-w-0 border-x border-input bg-transparent text-center text-sm tabular-nums outline-none`,onChange:e=>{let t=Number(e.target.value);Number.isNaN(t)||o(h(t))}}),(0,i.jsx)(t.Button,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`${d} ${m(`numberField.increase`)}`,disabled:u||a>=c,onClick:()=>o(h(a+l)),children:(0,i.jsx)(r.Plus,{"aria-hidden":`true`})})]})}exports.NumberField=a;
|