@craftzbay/ui 0.11.3 → 0.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-lib/_virtual/_rolldown/runtime.js +11 -0
- package/dist-lib/components/ui/Accordion.js +42 -67
- package/dist-lib/components/ui/Accordion.js.map +1 -1
- package/dist-lib/components/ui/Alert.js +71 -77
- package/dist-lib/components/ui/Alert.js.map +1 -1
- package/dist-lib/components/ui/Avatar.js +67 -92
- package/dist-lib/components/ui/Avatar.js.map +1 -1
- package/dist-lib/components/ui/Badge.js +119 -74
- package/dist-lib/components/ui/Badge.js.map +1 -1
- package/dist-lib/components/ui/Breadcrumbs.js +62 -50
- package/dist-lib/components/ui/Breadcrumbs.js.map +1 -1
- package/dist-lib/components/ui/Button.js +129 -131
- package/dist-lib/components/ui/Button.js.map +1 -1
- package/dist-lib/components/ui/Calendar.d.ts +1 -1
- package/dist-lib/components/ui/Calendar.js +99 -136
- package/dist-lib/components/ui/Calendar.js.map +1 -1
- package/dist-lib/components/ui/Card.js +88 -94
- package/dist-lib/components/ui/Card.js.map +1 -1
- package/dist-lib/components/ui/Carousel.js +125 -170
- package/dist-lib/components/ui/Carousel.js.map +1 -1
- package/dist-lib/components/ui/Chart.d.ts +3 -3
- package/dist-lib/components/ui/Chart.js +435 -464
- package/dist-lib/components/ui/Chart.js.map +1 -1
- package/dist-lib/components/ui/Checkbox.js +60 -69
- package/dist-lib/components/ui/Checkbox.js.map +1 -1
- package/dist-lib/components/ui/Combobox.js +179 -192
- package/dist-lib/components/ui/Combobox.js.map +1 -1
- package/dist-lib/components/ui/CommandPalette.d.ts +2 -2
- package/dist-lib/components/ui/CommandPalette.js +106 -167
- package/dist-lib/components/ui/CommandPalette.js.map +1 -1
- package/dist-lib/components/ui/ContextMenu.d.ts +1 -1
- package/dist-lib/components/ui/ContextMenu.js +89 -154
- package/dist-lib/components/ui/ContextMenu.js.map +1 -1
- package/dist-lib/components/ui/DataGrid.d.ts +1 -1
- package/dist-lib/components/ui/DataGrid.js +99 -96
- package/dist-lib/components/ui/DataGrid.js.map +1 -1
- package/dist-lib/components/ui/DatePicker.js +151 -188
- package/dist-lib/components/ui/DatePicker.js.map +1 -1
- package/dist-lib/components/ui/DesignSystemProvider.d.ts +1 -1
- package/dist-lib/components/ui/DesignSystemProvider.js +120 -130
- package/dist-lib/components/ui/DesignSystemProvider.js.map +1 -1
- package/dist-lib/components/ui/Dialog.d.ts +3 -3
- package/dist-lib/components/ui/Dialog.js +108 -156
- package/dist-lib/components/ui/Dialog.js.map +1 -1
- package/dist-lib/components/ui/Drawer.d.ts +3 -3
- package/dist-lib/components/ui/Drawer.js +90 -124
- package/dist-lib/components/ui/Drawer.js.map +1 -1
- package/dist-lib/components/ui/DropdownMenu.d.ts +1 -1
- package/dist-lib/components/ui/DropdownMenu.js +92 -158
- package/dist-lib/components/ui/DropdownMenu.js.map +1 -1
- package/dist-lib/components/ui/EmptyState.js +31 -44
- package/dist-lib/components/ui/EmptyState.js.map +1 -1
- package/dist-lib/components/ui/ErrorState.js +57 -67
- package/dist-lib/components/ui/ErrorState.js.map +1 -1
- package/dist-lib/components/ui/FileUpload.js +113 -107
- package/dist-lib/components/ui/FileUpload.js.map +1 -1
- package/dist-lib/components/ui/Form.d.ts +6 -4
- package/dist-lib/components/ui/Form.js +117 -122
- package/dist-lib/components/ui/Form.js.map +1 -1
- package/dist-lib/components/ui/Icon.d.ts +1 -1
- package/dist-lib/components/ui/Icon.js +30 -29
- package/dist-lib/components/ui/Icon.js.map +1 -1
- package/dist-lib/components/ui/IconButton.js +61 -63
- package/dist-lib/components/ui/IconButton.js.map +1 -1
- package/dist-lib/components/ui/Input.js +133 -156
- package/dist-lib/components/ui/Input.js.map +1 -1
- package/dist-lib/components/ui/Kbd.js +14 -21
- package/dist-lib/components/ui/Kbd.js.map +1 -1
- package/dist-lib/components/ui/MultiSelect.js +176 -208
- package/dist-lib/components/ui/MultiSelect.js.map +1 -1
- package/dist-lib/components/ui/Pagination.js +152 -149
- package/dist-lib/components/ui/Pagination.js.map +1 -1
- package/dist-lib/components/ui/Popover.js +18 -33
- package/dist-lib/components/ui/Popover.js.map +1 -1
- package/dist-lib/components/ui/Progress.js +77 -99
- package/dist-lib/components/ui/Progress.js.map +1 -1
- package/dist-lib/components/ui/RadioGroup.js +51 -80
- package/dist-lib/components/ui/RadioGroup.js.map +1 -1
- package/dist-lib/components/ui/RelativeTime.js +22 -29
- package/dist-lib/components/ui/RelativeTime.js.map +1 -1
- package/dist-lib/components/ui/ScrollArea.js +39 -58
- package/dist-lib/components/ui/ScrollArea.js.map +1 -1
- package/dist-lib/components/ui/Select.js +108 -131
- package/dist-lib/components/ui/Select.js.map +1 -1
- package/dist-lib/components/ui/Separator.js +18 -24
- package/dist-lib/components/ui/Separator.js.map +1 -1
- package/dist-lib/components/ui/Sheet.d.ts +2 -2
- package/dist-lib/components/ui/Sheet.js +77 -129
- package/dist-lib/components/ui/Sheet.js.map +1 -1
- package/dist-lib/components/ui/Sidebar.d.ts +1 -1
- package/dist-lib/components/ui/Sidebar.js +168 -207
- package/dist-lib/components/ui/Sidebar.js.map +1 -1
- package/dist-lib/components/ui/Skeleton.js +17 -27
- package/dist-lib/components/ui/Skeleton.js.map +1 -1
- package/dist-lib/components/ui/Slider.js +45 -62
- package/dist-lib/components/ui/Slider.js.map +1 -1
- package/dist-lib/components/ui/Snackbar.js +75 -55
- package/dist-lib/components/ui/Snackbar.js.map +1 -1
- package/dist-lib/components/ui/Spinner.js +45 -52
- package/dist-lib/components/ui/Spinner.js.map +1 -1
- package/dist-lib/components/ui/Stepper.js +56 -108
- package/dist-lib/components/ui/Stepper.js.map +1 -1
- package/dist-lib/components/ui/Switch.js +46 -79
- package/dist-lib/components/ui/Switch.js.map +1 -1
- package/dist-lib/components/ui/Table.js +108 -169
- package/dist-lib/components/ui/Table.js.map +1 -1
- package/dist-lib/components/ui/Tabs.js +57 -88
- package/dist-lib/components/ui/Tabs.js.map +1 -1
- package/dist-lib/components/ui/TagInput.js +76 -109
- package/dist-lib/components/ui/TagInput.js.map +1 -1
- package/dist-lib/components/ui/Textarea.js +74 -86
- package/dist-lib/components/ui/Textarea.js.map +1 -1
- package/dist-lib/components/ui/Timeline.d.ts +3 -3
- package/dist-lib/components/ui/Timeline.js +61 -49
- package/dist-lib/components/ui/Timeline.js.map +1 -1
- package/dist-lib/components/ui/Toast.d.ts +1 -1
- package/dist-lib/components/ui/Toast.js +136 -150
- package/dist-lib/components/ui/Toast.js.map +1 -1
- package/dist-lib/components/ui/Tooltip.d.ts +2 -2
- package/dist-lib/components/ui/Tooltip.js +35 -56
- package/dist-lib/components/ui/Tooltip.js.map +1 -1
- package/dist-lib/components/ui/TopNav.js +46 -66
- package/dist-lib/components/ui/TopNav.js.map +1 -1
- package/dist-lib/components/ui/Tree.js +134 -168
- package/dist-lib/components/ui/Tree.js.map +1 -1
- package/dist-lib/hooks/use-debounce.js +27 -33
- package/dist-lib/hooks/use-debounce.js.map +1 -1
- package/dist-lib/hooks/use-delayed-loading.js +19 -18
- package/dist-lib/hooks/use-delayed-loading.js.map +1 -1
- package/dist-lib/hooks/use-field-ids.js +14 -16
- package/dist-lib/hooks/use-field-ids.js.map +1 -1
- package/dist-lib/hooks/use-media-query.js +15 -19
- package/dist-lib/hooks/use-media-query.js.map +1 -1
- package/dist-lib/hooks/use-modifier-key.js +20 -15
- package/dist-lib/hooks/use-modifier-key.js.map +1 -1
- package/dist-lib/hooks/use-strings.js +10 -10
- package/dist-lib/hooks/use-strings.js.map +1 -1
- package/dist-lib/hooks/use-toast.js +73 -62
- package/dist-lib/hooks/use-toast.js.map +1 -1
- package/dist-lib/icon.js +2 -6
- package/dist-lib/icons/index.js +166 -163
- package/dist-lib/icons/index.js.map +1 -1
- package/dist-lib/illustrations/index.d.ts +7 -7
- package/dist-lib/illustrations/index.js +255 -106
- package/dist-lib/illustrations/index.js.map +1 -1
- package/dist-lib/index.js +69 -291
- package/dist-lib/lib/cva.js +2 -0
- package/dist-lib/lib/format.js +71 -87
- package/dist-lib/lib/format.js.map +1 -1
- package/dist-lib/lib/return-focus.js +11 -11
- package/dist-lib/lib/return-focus.js.map +1 -1
- package/dist-lib/lib/strings.js +167 -135
- package/dist-lib/lib/strings.js.map +1 -1
- package/dist-lib/lib/strings.mn.js +150 -113
- package/dist-lib/lib/strings.mn.js.map +1 -1
- package/dist-lib/lib/utils.js +9 -9
- package/dist-lib/lib/utils.js.map +1 -1
- package/dist-lib/styles.css +3 -1
- package/package.json +50 -50
- package/dist-lib/__tests__/helpers/color.d.ts +0 -9
- package/dist-lib/__tests__/helpers/theme.d.ts +0 -18
- package/dist-lib/icon.js.map +0 -1
- package/dist-lib/index.js.map +0 -1
|
@@ -1,179 +1,118 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { cn as e } from "../../lib/utils.js";
|
|
3
|
+
import { useStrings as t } from "../../hooks/use-strings.js";
|
|
4
|
+
import { Search as n } from "../../icons/index.js";
|
|
5
|
+
import { forwardRef as r, useEffect as i, useRef as a } from "react";
|
|
6
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
|
+
import { Command as c } from "cmdk";
|
|
5
8
|
import * as l from "@radix-ui/react-dialog";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
ref: o,
|
|
14
|
-
className: r(
|
|
15
|
-
"bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-lg",
|
|
16
|
-
t
|
|
17
|
-
),
|
|
18
|
-
...e
|
|
19
|
-
}
|
|
20
|
-
);
|
|
9
|
+
//#region src/components/ui/CommandPalette.tsx
|
|
10
|
+
var u = r(function({ className: t, ...n }, r) {
|
|
11
|
+
return /* @__PURE__ */ o(c, {
|
|
12
|
+
ref: r,
|
|
13
|
+
className: e("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-lg", t),
|
|
14
|
+
...n
|
|
15
|
+
});
|
|
21
16
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
)
|
|
38
|
-
] });
|
|
17
|
+
u.displayName = "Command";
|
|
18
|
+
var d = r(function({ className: t, ...r }, i) {
|
|
19
|
+
return /* @__PURE__ */ s("div", {
|
|
20
|
+
className: "border-border flex items-center gap-2 border-b px-3",
|
|
21
|
+
"cmdk-input-wrapper": "",
|
|
22
|
+
children: [/* @__PURE__ */ o(n, {
|
|
23
|
+
className: "text-foreground-subtle size-4 shrink-0",
|
|
24
|
+
"aria-hidden": !0
|
|
25
|
+
}), /* @__PURE__ */ o(c.Input, {
|
|
26
|
+
ref: i,
|
|
27
|
+
className: e("flex h-11 w-full bg-transparent py-3 text-lg outline-none md:text-sm", "placeholder:text-foreground-subtle disabled:cursor-not-allowed disabled:opacity-50", t),
|
|
28
|
+
...r
|
|
29
|
+
})]
|
|
30
|
+
});
|
|
39
31
|
});
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
...o
|
|
50
|
-
}
|
|
51
|
-
);
|
|
32
|
+
d.displayName = "CommandInput";
|
|
33
|
+
var f = r(function({ className: n, label: r, ...i }, a) {
|
|
34
|
+
let s = t();
|
|
35
|
+
return /* @__PURE__ */ o(c.List, {
|
|
36
|
+
ref: a,
|
|
37
|
+
label: r ?? s.command.suggestions,
|
|
38
|
+
className: e("max-h-[320px] overflow-y-auto p-1", n),
|
|
39
|
+
...i
|
|
40
|
+
});
|
|
52
41
|
});
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
...e
|
|
61
|
-
}
|
|
62
|
-
);
|
|
42
|
+
f.displayName = "CommandList";
|
|
43
|
+
var p = r(function({ className: t, ...n }, r) {
|
|
44
|
+
return /* @__PURE__ */ o(c.Empty, {
|
|
45
|
+
ref: r,
|
|
46
|
+
className: e("text-foreground-subtle py-8 text-center text-sm", t),
|
|
47
|
+
...n
|
|
48
|
+
});
|
|
63
49
|
});
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"text-foreground overflow-hidden p-1",
|
|
72
|
-
"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5",
|
|
73
|
-
"[&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",
|
|
74
|
-
"[&_[cmdk-group-heading]]:text-foreground-subtle",
|
|
75
|
-
t
|
|
76
|
-
),
|
|
77
|
-
...e
|
|
78
|
-
}
|
|
79
|
-
);
|
|
50
|
+
p.displayName = "CommandEmpty";
|
|
51
|
+
var m = r(function({ className: t, ...n }, r) {
|
|
52
|
+
return /* @__PURE__ */ o(c.Group, {
|
|
53
|
+
ref: r,
|
|
54
|
+
className: e("text-foreground overflow-hidden p-1", "[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5", "[&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium", "[&_[cmdk-group-heading]]:text-foreground-subtle", t),
|
|
55
|
+
...n
|
|
56
|
+
});
|
|
80
57
|
});
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
58
|
+
m.displayName = "CommandGroup";
|
|
59
|
+
var h = r(function({ className: t, ...n }, r) {
|
|
60
|
+
return /* @__PURE__ */ o(c.Separator, {
|
|
61
|
+
ref: r,
|
|
62
|
+
asChild: !0,
|
|
63
|
+
...n,
|
|
64
|
+
children: /* @__PURE__ */ o("div", {
|
|
65
|
+
role: "none",
|
|
66
|
+
className: e("bg-border -mx-1 my-1 h-px", t)
|
|
67
|
+
})
|
|
68
|
+
});
|
|
84
69
|
});
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
"text-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none",
|
|
93
|
-
"data-[selected=true]:bg-background-muted data-[selected=true]:text-foreground",
|
|
94
|
-
"data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50",
|
|
95
|
-
"[&_svg]:text-foreground-subtle [&_svg]:size-4",
|
|
96
|
-
t
|
|
97
|
-
),
|
|
98
|
-
...e
|
|
99
|
-
}
|
|
100
|
-
);
|
|
70
|
+
h.displayName = "CommandSeparator";
|
|
71
|
+
var g = r(function({ className: t, ...n }, r) {
|
|
72
|
+
return /* @__PURE__ */ o(c.Item, {
|
|
73
|
+
ref: r,
|
|
74
|
+
className: e("text-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none", "data-[selected=true]:bg-background-muted data-[selected=true]:text-foreground", "data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50", "[&_svg]:text-foreground-subtle [&_svg]:size-4", t),
|
|
75
|
+
...n
|
|
76
|
+
});
|
|
101
77
|
});
|
|
102
|
-
|
|
103
|
-
function
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
"span",
|
|
109
|
-
{
|
|
110
|
-
className: r(
|
|
111
|
-
"text-foreground-subtle ml-auto inline-flex items-center gap-0.5 font-mono text-xs tracking-widest",
|
|
112
|
-
t
|
|
113
|
-
),
|
|
114
|
-
children: n
|
|
115
|
-
}
|
|
116
|
-
);
|
|
78
|
+
g.displayName = "CommandItem";
|
|
79
|
+
function _({ children: t, className: n }) {
|
|
80
|
+
return /* @__PURE__ */ o("span", {
|
|
81
|
+
className: e("text-foreground-subtle ml-auto inline-flex items-center gap-0.5 font-mono text-xs tracking-widest", n),
|
|
82
|
+
children: t
|
|
83
|
+
});
|
|
117
84
|
}
|
|
118
|
-
|
|
119
|
-
function
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
onCloseAutoFocus: (g) => {
|
|
140
|
-
var c;
|
|
141
|
-
g.preventDefault(), (c = s.current) == null || c.focus(), s.current = null;
|
|
142
|
-
},
|
|
143
|
-
className: r(
|
|
144
|
-
"fixed top-[20%] left-1/2 z-[var(--z-modal)] -translate-x-1/2",
|
|
145
|
-
"w-[calc(100%-2rem)] max-w-[640px] overflow-hidden",
|
|
146
|
-
"border-border bg-popover text-popover-foreground rounded-lg border shadow-lg",
|
|
147
|
-
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
148
|
-
"data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0",
|
|
149
|
-
"data-[state=open]:zoom-in-95 data-[state=closed]:zoom-out-95"
|
|
150
|
-
),
|
|
151
|
-
children: [
|
|
152
|
-
/* @__PURE__ */ a(l.Title, { className: "sr-only", children: o ?? i.commandDialog.title }),
|
|
153
|
-
/* @__PURE__ */ a(f, { children: e })
|
|
154
|
-
]
|
|
155
|
-
}
|
|
156
|
-
)
|
|
157
|
-
] }) });
|
|
85
|
+
_.displayName = "CommandShortcut";
|
|
86
|
+
function v({ open: n, onOpenChange: r, children: i, title: c }) {
|
|
87
|
+
let d = t(), f = a(null);
|
|
88
|
+
return /* @__PURE__ */ o(l.Root, {
|
|
89
|
+
open: n,
|
|
90
|
+
onOpenChange: r,
|
|
91
|
+
children: /* @__PURE__ */ s(l.Portal, { children: [/* @__PURE__ */ o(l.Overlay, { className: e("bg-overlay fixed inset-0 z-[var(--z-overlay)]", "data-[state=open]:animate-in data-[state=closed]:animate-out", "data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0") }), /* @__PURE__ */ s(l.Content, {
|
|
92
|
+
"aria-describedby": void 0,
|
|
93
|
+
onOpenAutoFocus: () => {
|
|
94
|
+
f.current = document.activeElement;
|
|
95
|
+
},
|
|
96
|
+
onCloseAutoFocus: (e) => {
|
|
97
|
+
e.preventDefault(), f.current?.focus(), f.current = null;
|
|
98
|
+
},
|
|
99
|
+
className: e("fixed top-[20%] left-1/2 z-[var(--z-modal)] -translate-x-1/2", "w-[calc(100%-2rem)] max-w-[640px] overflow-hidden", "border-border bg-popover text-popover-foreground rounded-lg border shadow-lg", "data-[state=open]:animate-in data-[state=closed]:animate-out", "data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0", "data-[state=open]:zoom-in-95 data-[state=closed]:zoom-out-95"),
|
|
100
|
+
children: [/* @__PURE__ */ o(l.Title, {
|
|
101
|
+
className: "sr-only",
|
|
102
|
+
children: c ?? d.commandDialog.title
|
|
103
|
+
}), /* @__PURE__ */ o(u, { children: i })]
|
|
104
|
+
})] })
|
|
105
|
+
});
|
|
158
106
|
}
|
|
159
|
-
function
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
107
|
+
function y(e) {
|
|
108
|
+
i(() => {
|
|
109
|
+
let t = (t) => {
|
|
110
|
+
(t.key === "k" || t.key === "K") && (t.metaKey || t.ctrlKey) && !t.altKey && (t.preventDefault(), e((e) => !e));
|
|
111
|
+
};
|
|
112
|
+
return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
|
|
113
|
+
}, [e]);
|
|
166
114
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
N as CommandGroup,
|
|
172
|
-
b as CommandInput,
|
|
173
|
-
k as CommandItem,
|
|
174
|
-
h as CommandList,
|
|
175
|
-
w as CommandSeparator,
|
|
176
|
-
S as CommandShortcut,
|
|
177
|
-
G as useCommandPaletteShortcut
|
|
178
|
-
};
|
|
179
|
-
//# sourceMappingURL=CommandPalette.js.map
|
|
115
|
+
//#endregion
|
|
116
|
+
export { u as Command, v as CommandDialog, p as CommandEmpty, m as CommandGroup, d as CommandInput, g as CommandItem, f as CommandList, h as CommandSeparator, _ as CommandShortcut, y as useCommandPaletteShortcut };
|
|
117
|
+
|
|
118
|
+
//# sourceMappingURL=CommandPalette.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandPalette.js","sources":["../../../src/components/ui/CommandPalette.tsx"],"sourcesContent":["'use client';\n\nimport {\n forwardRef,\n useEffect,\n useRef,\n type ComponentPropsWithoutRef,\n type Dispatch,\n type ElementRef,\n type ReactNode,\n type SetStateAction,\n} from 'react';\nimport { Command as CommandPrimitive } from 'cmdk';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { Search } from '@/icons';\nimport { cn } from '@/lib/utils';\nimport { useStrings } from '@/hooks/use-strings';\n\n/* -----------------------------------------------------------------------------\n * CommandPalette is a Dialog hosting a `cmdk` Command. It supports grouped\n * items, keyboard navigation (handled by cmdk), an empty state, and a\n * pluggable list of \"recent\" items shown when the search input is empty.\n * --------------------------------------------------------------------------- */\n\nexport const Command = forwardRef<\n ElementRef<typeof CommandPrimitive>,\n ComponentPropsWithoutRef<typeof CommandPrimitive>\n>(function Command({ className, ...props }, ref) {\n return (\n <CommandPrimitive\n ref={ref}\n className={cn(\n 'bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-lg',\n className,\n )}\n {...props}\n />\n );\n});\nCommand.displayName = 'Command';\n\nexport const CommandInput = forwardRef<\n ElementRef<typeof CommandPrimitive.Input>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.Input>\n>(function CommandInput({ className, ...props }, ref) {\n return (\n <div className=\"border-border flex items-center gap-2 border-b px-3\" cmdk-input-wrapper=\"\">\n <Search className=\"text-foreground-subtle size-4 shrink-0\" aria-hidden />\n <CommandPrimitive.Input\n ref={ref}\n className={cn(\n 'flex h-11 w-full bg-transparent py-3 text-lg outline-none md:text-sm',\n 'placeholder:text-foreground-subtle disabled:cursor-not-allowed disabled:opacity-50',\n className,\n )}\n {...props}\n />\n </div>\n );\n});\nCommandInput.displayName = 'CommandInput';\n\nexport const CommandList = forwardRef<\n ElementRef<typeof CommandPrimitive.List>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.List>\n>(function CommandList({ className, label, ...props }, ref) {\n const strings = useStrings();\n return (\n <CommandPrimitive.List\n ref={ref}\n label={label ?? strings.command.suggestions}\n className={cn('max-h-[320px] overflow-y-auto p-1', className)}\n {...props}\n />\n );\n});\nCommandList.displayName = 'CommandList';\n\nexport const CommandEmpty = forwardRef<\n ElementRef<typeof CommandPrimitive.Empty>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>\n>(function CommandEmpty({ className, ...props }, ref) {\n return (\n <CommandPrimitive.Empty\n ref={ref}\n className={cn('text-foreground-subtle py-8 text-center text-sm', className)}\n {...props}\n />\n );\n});\nCommandEmpty.displayName = 'CommandEmpty';\n\nexport const CommandGroup = forwardRef<\n ElementRef<typeof CommandPrimitive.Group>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.Group>\n>(function CommandGroup({ className, ...props }, ref) {\n return (\n <CommandPrimitive.Group\n ref={ref}\n className={cn(\n 'text-foreground overflow-hidden p-1',\n '[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5',\n '[&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium',\n '[&_[cmdk-group-heading]]:text-foreground-subtle',\n className,\n )}\n {...props}\n />\n );\n});\nCommandGroup.displayName = 'CommandGroup';\n\nexport const CommandSeparator = forwardRef<\n ElementRef<typeof CommandPrimitive.Separator>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>\n>(function CommandSeparator({ className, ...props }, ref) {\n // cmdk hard-codes role=\"separator\", which is not a permitted child of the\n // listbox. asChild lets the child's role win: the divider is purely visual.\n return (\n <CommandPrimitive.Separator ref={ref} asChild {...props}>\n <div role=\"none\" className={cn('bg-border -mx-1 my-1 h-px', className)} />\n </CommandPrimitive.Separator>\n );\n});\nCommandSeparator.displayName = 'CommandSeparator';\n\nexport const CommandItem = forwardRef<\n ElementRef<typeof CommandPrimitive.Item>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.Item>\n>(function CommandItem({ className, ...props }, ref) {\n return (\n <CommandPrimitive.Item\n ref={ref}\n className={cn(\n 'text-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none',\n 'data-[selected=true]:bg-background-muted data-[selected=true]:text-foreground',\n 'data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50',\n '[&_svg]:text-foreground-subtle [&_svg]:size-4',\n className,\n )}\n {...props}\n />\n );\n});\nCommandItem.displayName = 'CommandItem';\n\nexport function CommandShortcut({\n children,\n className,\n}: {\n children: ReactNode;\n className?: string;\n}) {\n return (\n <span\n className={cn(\n 'text-foreground-subtle ml-auto inline-flex items-center gap-0.5 font-mono text-xs tracking-widest',\n className,\n )}\n >\n {children}\n </span>\n );\n}\nCommandShortcut.displayName = 'CommandShortcut';\n\n/* -----------------------------------------------------------------------------\n * Dialog wrapper — a ready-to-use ⌘K palette.\n * --------------------------------------------------------------------------- */\n\nexport interface CommandDialogProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n children: ReactNode;\n /** Visible label for screen readers. */\n title?: string;\n}\n\nexport function CommandDialog({ open, onOpenChange, children, title }: CommandDialogProps) {\n const strings = useStrings();\n // The palette has no DialogTrigger (⌘K / any button opens it), so Radix has\n // no trigger to return focus to and would drop it on <body>. Remember what\n // was focused when the dialog opened and restore it on close.\n const returnFocusRef = useRef<HTMLElement | null>(null);\n return (\n <DialogPrimitive.Root open={open} onOpenChange={onOpenChange}>\n <DialogPrimitive.Portal>\n <DialogPrimitive.Overlay\n className={cn(\n 'bg-overlay fixed inset-0 z-[var(--z-overlay)]',\n 'data-[state=open]:animate-in data-[state=closed]:animate-out',\n 'data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0',\n )}\n />\n <DialogPrimitive.Content\n aria-describedby={undefined}\n onOpenAutoFocus={() => {\n returnFocusRef.current = document.activeElement as HTMLElement | null;\n }}\n onCloseAutoFocus={(event) => {\n event.preventDefault();\n returnFocusRef.current?.focus();\n returnFocusRef.current = null;\n }}\n className={cn(\n 'fixed top-[20%] left-1/2 z-[var(--z-modal)] -translate-x-1/2',\n 'w-[calc(100%-2rem)] max-w-[640px] overflow-hidden',\n 'border-border bg-popover text-popover-foreground rounded-lg border shadow-lg',\n 'data-[state=open]:animate-in data-[state=closed]:animate-out',\n 'data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0',\n 'data-[state=open]:zoom-in-95 data-[state=closed]:zoom-out-95',\n )}\n >\n <DialogPrimitive.Title className=\"sr-only\">\n {title ?? strings.commandDialog.title}\n </DialogPrimitive.Title>\n <Command>{children}</Command>\n </DialogPrimitive.Content>\n </DialogPrimitive.Portal>\n </DialogPrimitive.Root>\n );\n}\n\n/**\n * Hook that wires ⌘K / Ctrl+K to a setter — the canonical way to mount the\n * palette in an app shell.\n *\n * @example\n * const [open, setOpen] = useState(false);\n * useCommandPaletteShortcut(setOpen);\n * …\n * <CommandDialog open={open} onOpenChange={setOpen}>\n * <CommandInput placeholder=\"Type a command…\" />\n * <CommandList>\n * <CommandEmpty>No results.</CommandEmpty>\n * <CommandGroup heading=\"Suggestions\">\n * <CommandItem>Create project</CommandItem>\n * <CommandItem>Invite teammate</CommandItem>\n * </CommandGroup>\n * </CommandList>\n * </CommandDialog>\n *\n * @do Group items by category. Show \"Recent\" first when the query is empty.\n * @dont Hide essential actions behind the palette only — keep at least one\n * button entry in the UI.\n */\nexport function useCommandPaletteShortcut(setOpen: Dispatch<SetStateAction<boolean>>): void {\n useEffect(() => {\n const onKey = (e: KeyboardEvent) => {\n if ((e.key === 'k' || e.key === 'K') && (e.metaKey || e.ctrlKey) && !e.altKey) {\n e.preventDefault();\n // Functional update: ⌘K toggles without the hook tracking open state.\n setOpen((prev) => !prev);\n }\n };\n window.addEventListener('keydown', onKey);\n return () => window.removeEventListener('keydown', onKey);\n }, [setOpen]);\n}\n"],"names":["Command","forwardRef","className","props","ref","jsx","CommandPrimitive","cn","CommandInput","jsxs","Search","CommandList","label","strings","useStrings","CommandEmpty","CommandGroup","CommandSeparator","CommandItem","CommandShortcut","children","CommandDialog","open","onOpenChange","title","returnFocusRef","useRef","DialogPrimitive","event","_a","useCommandPaletteShortcut","setOpen","useEffect","onKey","prev"],"mappings":";;;;;;;;AAwBO,MAAMA,IAAUC,EAGrB,SAAiB,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,GAAK;AAC/C,SACE,gBAAAC;AAAA,IAACC;AAAAA,IAAA;AAAA,MACC,KAAAF;AAAA,MACA,WAAWG;AAAA,QACT;AAAA,QACAL;AAAA,MAAA;AAAA,MAED,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV,CAAC;AACDH,EAAQ,cAAc;AAEf,MAAMQ,IAAeP,EAG1B,SAAsB,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,GAAK;AACpD,SACE,gBAAAK,EAAC,OAAA,EAAI,WAAU,uDAAsD,sBAAmB,IACtF,UAAA;AAAA,IAAA,gBAAAJ,EAACK,GAAA,EAAO,WAAU,0CAAyC,eAAW,IAAC;AAAA,IACvE,gBAAAL;AAAA,MAACC,EAAiB;AAAA,MAAjB;AAAA,QACC,KAAAF;AAAA,QACA,WAAWG;AAAA,UACT;AAAA,UACA;AAAA,UACAL;AAAA,QAAA;AAAA,QAED,GAAGC;AAAA,MAAA;AAAA,IAAA;AAAA,EACN,GACF;AAEJ,CAAC;AACDK,EAAa,cAAc;AAEpB,MAAMG,IAAcV,EAGzB,SAAqB,EAAE,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A;AAAA,QAGF,UAAA;AAAA,UAAA,gBAAAF,EAACsB,EAAgB,OAAhB,EAAsB,WAAU,WAC9B,UAAAH,KAASX,EAAQ,cAAc,MAAA,CAClC;AAAA,UACA,gBAAAR,EAACL,KAAS,UAAAoB,EAAA,CAAS;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACrB,EAAA,CACF,EAAA,CACF;AAEJ;AAyBO,SAASU,EAA0BC,GAAkD;AAC1F,EAAAC,EAAU,MAAM;AACd,UAAMC,IAAQ,CAAC,MAAqB;AAClC,OAAK,EAAE,QAAQ,OAAO,EAAE,QAAQ,SAAS,EAAE,WAAW,EAAE,YAAY,CAAC,EAAE,WACrE,EAAE,eAAA,GAEFF,EAAQ,CAACG,MAAS,CAACA,CAAI;AAAA,IAE3B;AACA,kBAAO,iBAAiB,WAAWD,CAAK,GACjC,MAAM,OAAO,oBAAoB,WAAWA,CAAK;AAAA,EAC1D,GAAG,CAACF,CAAO,CAAC;AACd;"}
|
|
1
|
+
{"version":3,"file":"CommandPalette.js","names":[],"sources":["../../../src/components/ui/CommandPalette.tsx"],"sourcesContent":["'use client';\n\nimport {\n forwardRef,\n useEffect,\n useRef,\n type ComponentPropsWithoutRef,\n type Dispatch,\n type ElementRef,\n type ReactNode,\n type SetStateAction,\n} from 'react';\nimport { Command as CommandPrimitive } from 'cmdk';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { Search } from '@/icons';\nimport { cn } from '@/lib/utils';\nimport { useStrings } from '@/hooks/use-strings';\n\n/* -----------------------------------------------------------------------------\n * CommandPalette is a Dialog hosting a `cmdk` Command. It supports grouped\n * items, keyboard navigation (handled by cmdk), an empty state, and a\n * pluggable list of \"recent\" items shown when the search input is empty.\n * --------------------------------------------------------------------------- */\n\nexport const Command = forwardRef<\n ElementRef<typeof CommandPrimitive>,\n ComponentPropsWithoutRef<typeof CommandPrimitive>\n>(function Command({ className, ...props }, ref) {\n return (\n <CommandPrimitive\n ref={ref}\n className={cn(\n 'bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-lg',\n className,\n )}\n {...props}\n />\n );\n});\nCommand.displayName = 'Command';\n\nexport const CommandInput = forwardRef<\n ElementRef<typeof CommandPrimitive.Input>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.Input>\n>(function CommandInput({ className, ...props }, ref) {\n return (\n <div className=\"border-border flex items-center gap-2 border-b px-3\" cmdk-input-wrapper=\"\">\n <Search className=\"text-foreground-subtle size-4 shrink-0\" aria-hidden />\n <CommandPrimitive.Input\n ref={ref}\n className={cn(\n 'flex h-11 w-full bg-transparent py-3 text-lg outline-none md:text-sm',\n 'placeholder:text-foreground-subtle disabled:cursor-not-allowed disabled:opacity-50',\n className,\n )}\n {...props}\n />\n </div>\n );\n});\nCommandInput.displayName = 'CommandInput';\n\nexport const CommandList = forwardRef<\n ElementRef<typeof CommandPrimitive.List>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.List>\n>(function CommandList({ className, label, ...props }, ref) {\n const strings = useStrings();\n return (\n <CommandPrimitive.List\n ref={ref}\n label={label ?? strings.command.suggestions}\n className={cn('max-h-[320px] overflow-y-auto p-1', className)}\n {...props}\n />\n );\n});\nCommandList.displayName = 'CommandList';\n\nexport const CommandEmpty = forwardRef<\n ElementRef<typeof CommandPrimitive.Empty>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>\n>(function CommandEmpty({ className, ...props }, ref) {\n return (\n <CommandPrimitive.Empty\n ref={ref}\n className={cn('text-foreground-subtle py-8 text-center text-sm', className)}\n {...props}\n />\n );\n});\nCommandEmpty.displayName = 'CommandEmpty';\n\nexport const CommandGroup = forwardRef<\n ElementRef<typeof CommandPrimitive.Group>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.Group>\n>(function CommandGroup({ className, ...props }, ref) {\n return (\n <CommandPrimitive.Group\n ref={ref}\n className={cn(\n 'text-foreground overflow-hidden p-1',\n '[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5',\n '[&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium',\n '[&_[cmdk-group-heading]]:text-foreground-subtle',\n className,\n )}\n {...props}\n />\n );\n});\nCommandGroup.displayName = 'CommandGroup';\n\nexport const CommandSeparator = forwardRef<\n ElementRef<typeof CommandPrimitive.Separator>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>\n>(function CommandSeparator({ className, ...props }, ref) {\n // cmdk hard-codes role=\"separator\", which is not a permitted child of the\n // listbox. asChild lets the child's role win: the divider is purely visual.\n return (\n <CommandPrimitive.Separator ref={ref} asChild {...props}>\n <div role=\"none\" className={cn('bg-border -mx-1 my-1 h-px', className)} />\n </CommandPrimitive.Separator>\n );\n});\nCommandSeparator.displayName = 'CommandSeparator';\n\nexport const CommandItem = forwardRef<\n ElementRef<typeof CommandPrimitive.Item>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.Item>\n>(function CommandItem({ className, ...props }, ref) {\n return (\n <CommandPrimitive.Item\n ref={ref}\n className={cn(\n 'text-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none',\n 'data-[selected=true]:bg-background-muted data-[selected=true]:text-foreground',\n 'data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50',\n '[&_svg]:text-foreground-subtle [&_svg]:size-4',\n className,\n )}\n {...props}\n />\n );\n});\nCommandItem.displayName = 'CommandItem';\n\nexport function CommandShortcut({\n children,\n className,\n}: {\n children: ReactNode;\n className?: string;\n}) {\n return (\n <span\n className={cn(\n 'text-foreground-subtle ml-auto inline-flex items-center gap-0.5 font-mono text-xs tracking-widest',\n className,\n )}\n >\n {children}\n </span>\n );\n}\nCommandShortcut.displayName = 'CommandShortcut';\n\n/* -----------------------------------------------------------------------------\n * Dialog wrapper — a ready-to-use ⌘K palette.\n * --------------------------------------------------------------------------- */\n\nexport interface CommandDialogProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n children: ReactNode;\n /** Visible label for screen readers. */\n title?: string;\n}\n\nexport function CommandDialog({ open, onOpenChange, children, title }: CommandDialogProps) {\n const strings = useStrings();\n // The palette has no DialogTrigger (⌘K / any button opens it), so Radix has\n // no trigger to return focus to and would drop it on <body>. Remember what\n // was focused when the dialog opened and restore it on close.\n const returnFocusRef = useRef<HTMLElement | null>(null);\n return (\n <DialogPrimitive.Root open={open} onOpenChange={onOpenChange}>\n <DialogPrimitive.Portal>\n <DialogPrimitive.Overlay\n className={cn(\n 'bg-overlay fixed inset-0 z-[var(--z-overlay)]',\n 'data-[state=open]:animate-in data-[state=closed]:animate-out',\n 'data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0',\n )}\n />\n <DialogPrimitive.Content\n aria-describedby={undefined}\n onOpenAutoFocus={() => {\n returnFocusRef.current = document.activeElement as HTMLElement | null;\n }}\n onCloseAutoFocus={(event) => {\n event.preventDefault();\n returnFocusRef.current?.focus();\n returnFocusRef.current = null;\n }}\n className={cn(\n 'fixed top-[20%] left-1/2 z-[var(--z-modal)] -translate-x-1/2',\n 'w-[calc(100%-2rem)] max-w-[640px] overflow-hidden',\n 'border-border bg-popover text-popover-foreground rounded-lg border shadow-lg',\n 'data-[state=open]:animate-in data-[state=closed]:animate-out',\n 'data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0',\n 'data-[state=open]:zoom-in-95 data-[state=closed]:zoom-out-95',\n )}\n >\n <DialogPrimitive.Title className=\"sr-only\">\n {title ?? strings.commandDialog.title}\n </DialogPrimitive.Title>\n <Command>{children}</Command>\n </DialogPrimitive.Content>\n </DialogPrimitive.Portal>\n </DialogPrimitive.Root>\n );\n}\n\n/**\n * Hook that wires ⌘K / Ctrl+K to a setter — the canonical way to mount the\n * palette in an app shell.\n *\n * @example\n * const [open, setOpen] = useState(false);\n * useCommandPaletteShortcut(setOpen);\n * …\n * <CommandDialog open={open} onOpenChange={setOpen}>\n * <CommandInput placeholder=\"Type a command…\" />\n * <CommandList>\n * <CommandEmpty>No results.</CommandEmpty>\n * <CommandGroup heading=\"Suggestions\">\n * <CommandItem>Create project</CommandItem>\n * <CommandItem>Invite teammate</CommandItem>\n * </CommandGroup>\n * </CommandList>\n * </CommandDialog>\n *\n * @do Group items by category. Show \"Recent\" first when the query is empty.\n * @dont Hide essential actions behind the palette only — keep at least one\n * button entry in the UI.\n */\nexport function useCommandPaletteShortcut(setOpen: Dispatch<SetStateAction<boolean>>): void {\n useEffect(() => {\n const onKey = (e: KeyboardEvent) => {\n if ((e.key === 'k' || e.key === 'K') && (e.metaKey || e.ctrlKey) && !e.altKey) {\n e.preventDefault();\n // Functional update: ⌘K toggles without the hook tracking open state.\n setOpen((prev) => !prev);\n }\n };\n window.addEventListener('keydown', onKey);\n return () => window.removeEventListener('keydown', onKey);\n }, [setOpen]);\n}\n"],"mappings":";;;;;;;;;AAwBA,IAAa,IAAU,EAGrB,SAAiB,EAAE,cAAW,GAAG,KAAS,GAAK;CAC/C,OACE,kBAAC,GAAD;EACO;EACL,WAAW,EACT,6FACA,CACF;EACA,GAAI;CACL,CAAA;AAEL,CAAC;AACD,EAAQ,cAAc;AAEtB,IAAa,IAAe,EAG1B,SAAsB,EAAE,cAAW,GAAG,KAAS,GAAK;CACpD,OACE,kBAAC,OAAD;EAAK,WAAU;EAAsD,sBAAmB;EAAxF,UAAA,CACE,kBAAC,GAAD;GAAQ,WAAU;GAAyC,eAAA;EAAa,CAAA,GACxE,kBAAC,EAAiB,OAAlB;GACO;GACL,WAAW,EACT,wEACA,sFACA,CACF;GACA,GAAI;EACL,CAAA,CACE;;AAET,CAAC;AACD,EAAa,cAAc;AAE3B,IAAa,IAAc,EAGzB,SAAqB,EAAE,cAAW,UAAO,GAAG,KAAS,GAAK;CAC1D,IAAM,IAAU,EAAW;CAC3B,OACE,kBAAC,EAAiB,MAAlB;EACO;EACL,OAAO,KAAS,EAAQ,QAAQ;EAChC,WAAW,EAAG,qCAAqC,CAAS;EAC5D,GAAI;CACL,CAAA;AAEL,CAAC;AACD,EAAY,cAAc;AAE1B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D,kBAAC,EAAgB,SAAjB;GACE,oBAAkB,KAAA;GAClB,uBAAuB;IACrB,EAAe,UAAU,SAAS;GACpC;GACA,mBAAmB,MAAU;IAG3B,AAFA,EAAM,eAAe,GACrB,EAAe,SAAS,MAAM,GAC9B,EAAe,UAAU;GAC3B;GACA,WAAW,EACT,gEACA,qDACA,gFACA,gEACA,8DACA,8DACF;GAjBF,UAAA,CAmBE,kBAAC,EAAgB,OAAjB;IAAuB,WAAU;IAC9B,UAAA,KAAS,EAAQ,cAAc;GACX,CAAA,GACvB,kBAAC,GAAD,EAAU,YAAkB,CAAA,CACL;EACH,CAAA,CAAA,EAAA,CAAA;CACJ,CAAA;AAE1B;AAyBA,SAAgB,EAA0B,GAAkD;CAC1F,QAAgB;EACd,IAAM,KAAS,MAAqB;GAClC,CAAK,EAAE,QAAQ,OAAO,EAAE,QAAQ,SAAS,EAAE,WAAW,EAAE,YAAY,CAAC,EAAE,WACrE,EAAE,eAAe,GAEjB,GAAS,MAAS,CAAC,CAAI;EAE3B;EAEA,OADA,OAAO,iBAAiB,WAAW,CAAK,SAC3B,OAAO,oBAAoB,WAAW,CAAK;CAC1D,GAAG,CAAC,CAAO,CAAC;AACd"}
|
|
@@ -44,7 +44,7 @@ export declare const ContextMenuLabel: import('react').ForwardRefExoticComponent
|
|
|
44
44
|
inset?: boolean;
|
|
45
45
|
} & import('react').RefAttributes<HTMLDivElement>>;
|
|
46
46
|
export declare const ContextMenuSeparator: import('react').ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuSeparatorProps & import('react').RefAttributes<HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
47
|
-
export declare function ContextMenuShortcut({ className, ...props }: HTMLAttributes<HTMLSpanElement>): import("react
|
|
47
|
+
export declare function ContextMenuShortcut({ className, ...props }: HTMLAttributes<HTMLSpanElement>): import("react").JSX.Element;
|
|
48
48
|
export declare namespace ContextMenuShortcut {
|
|
49
49
|
var displayName: string;
|
|
50
50
|
}
|
|
@@ -1,165 +1,100 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
i,
|
|
19
|
-
"data-[state=open]:bg-background-muted",
|
|
20
|
-
n && "pl-8",
|
|
21
|
-
e
|
|
22
|
-
),
|
|
23
|
-
...d,
|
|
24
|
-
children: [
|
|
25
|
-
o,
|
|
26
|
-
/* @__PURE__ */ a(p, { className: "text-foreground-subtle ml-auto size-4", "aria-hidden": !0 })
|
|
27
|
-
]
|
|
28
|
-
}
|
|
29
|
-
);
|
|
2
|
+
import { cn as e } from "../../lib/utils.js";
|
|
3
|
+
import { Check as t, ChevronRight as n, Circle as r } from "../../icons/index.js";
|
|
4
|
+
import { forwardRef as i } from "react";
|
|
5
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
|
+
import * as s from "@radix-ui/react-context-menu";
|
|
7
|
+
//#region src/components/ui/ContextMenu.tsx
|
|
8
|
+
var c = s.Root, l = s.Trigger, u = s.Group, d = s.Portal, f = s.Sub, p = s.RadioGroup, m = e("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm text-foreground outline-none", "data-[highlighted]:bg-background-muted data-[highlighted]:text-foreground", "data-[disabled]:pointer-events-none data-[disabled]:opacity-50", "transition-colors duration-[var(--duration-fast)]"), h = i(function({ className: t, inset: r, children: i, ...c }, l) {
|
|
9
|
+
return /* @__PURE__ */ o(s.SubTrigger, {
|
|
10
|
+
ref: l,
|
|
11
|
+
className: e(m, "data-[state=open]:bg-background-muted", r && "pl-8", t),
|
|
12
|
+
...c,
|
|
13
|
+
children: [i, /* @__PURE__ */ a(n, {
|
|
14
|
+
className: "text-foreground-subtle ml-auto size-4",
|
|
15
|
+
"aria-hidden": !0
|
|
16
|
+
})]
|
|
17
|
+
});
|
|
30
18
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"border-border bg-popover text-popover-foreground z-[var(--z-popover)] min-w-[8rem] overflow-hidden rounded-lg border p-1 shadow-md",
|
|
39
|
-
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
40
|
-
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
41
|
-
"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
|
|
42
|
-
e
|
|
43
|
-
),
|
|
44
|
-
...n
|
|
45
|
-
}
|
|
46
|
-
);
|
|
19
|
+
h.displayName = "ContextMenuSubTrigger";
|
|
20
|
+
var g = i(function({ className: t, ...n }, r) {
|
|
21
|
+
return /* @__PURE__ */ a(s.SubContent, {
|
|
22
|
+
ref: r,
|
|
23
|
+
className: e("border-border bg-popover text-popover-foreground z-[var(--z-popover)] min-w-[8rem] overflow-hidden rounded-lg border p-1 shadow-md", "data-[state=open]:animate-in data-[state=closed]:animate-out", "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95", t),
|
|
24
|
+
...n
|
|
25
|
+
});
|
|
47
26
|
});
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"border-border bg-popover text-popover-foreground z-[var(--z-popover)] min-w-[12rem] overflow-hidden rounded-lg border p-1 shadow-md",
|
|
56
|
-
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
57
|
-
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
58
|
-
"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
|
|
59
|
-
e
|
|
60
|
-
),
|
|
61
|
-
...n
|
|
62
|
-
}
|
|
63
|
-
) });
|
|
27
|
+
g.displayName = "ContextMenuSubContent";
|
|
28
|
+
var _ = i(function({ className: t, ...n }, r) {
|
|
29
|
+
return /* @__PURE__ */ a(d, { children: /* @__PURE__ */ a(s.Content, {
|
|
30
|
+
ref: r,
|
|
31
|
+
className: e("border-border bg-popover text-popover-foreground z-[var(--z-popover)] min-w-[12rem] overflow-hidden rounded-lg border p-1 shadow-md", "data-[state=open]:animate-in data-[state=closed]:animate-out", "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95", t),
|
|
32
|
+
...n
|
|
33
|
+
}) });
|
|
64
34
|
});
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
i,
|
|
73
|
-
n && "pl-8",
|
|
74
|
-
o && "text-danger-text data-[highlighted]:bg-danger-soft data-[highlighted]:text-danger-text",
|
|
75
|
-
e
|
|
76
|
-
),
|
|
77
|
-
...d
|
|
78
|
-
}
|
|
79
|
-
);
|
|
35
|
+
_.displayName = "ContextMenuContent";
|
|
36
|
+
var v = i(function({ className: t, inset: n, destructive: r, ...i }, o) {
|
|
37
|
+
return /* @__PURE__ */ a(s.Item, {
|
|
38
|
+
ref: o,
|
|
39
|
+
className: e(m, n && "pl-8", r && "text-danger-text data-[highlighted]:bg-danger-soft data-[highlighted]:text-danger-text", t),
|
|
40
|
+
...i
|
|
41
|
+
});
|
|
80
42
|
});
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
43
|
+
v.displayName = "ContextMenuItem";
|
|
44
|
+
var y = i(function({ className: n, children: r, ...i }, c) {
|
|
45
|
+
return /* @__PURE__ */ o(s.CheckboxItem, {
|
|
46
|
+
ref: c,
|
|
47
|
+
className: e(m, "pl-8", n),
|
|
48
|
+
...i,
|
|
49
|
+
children: [/* @__PURE__ */ a("span", {
|
|
50
|
+
className: "absolute left-2 flex size-4 items-center justify-center",
|
|
51
|
+
children: /* @__PURE__ */ a(s.ItemIndicator, { children: /* @__PURE__ */ a(t, {
|
|
52
|
+
className: "text-accent size-4",
|
|
53
|
+
"aria-hidden": !0
|
|
54
|
+
}) })
|
|
55
|
+
}), r]
|
|
56
|
+
});
|
|
95
57
|
});
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
58
|
+
y.displayName = "ContextMenuCheckboxItem";
|
|
59
|
+
var b = i(function({ className: t, children: n, ...i }, c) {
|
|
60
|
+
return /* @__PURE__ */ o(s.RadioItem, {
|
|
61
|
+
ref: c,
|
|
62
|
+
className: e(m, "pl-8", t),
|
|
63
|
+
...i,
|
|
64
|
+
children: [/* @__PURE__ */ a("span", {
|
|
65
|
+
className: "absolute left-2 flex size-4 items-center justify-center",
|
|
66
|
+
children: /* @__PURE__ */ a(s.ItemIndicator, { children: /* @__PURE__ */ a(r, {
|
|
67
|
+
className: "fill-accent text-accent size-2",
|
|
68
|
+
"aria-hidden": !0
|
|
69
|
+
}) })
|
|
70
|
+
}), n]
|
|
71
|
+
});
|
|
110
72
|
});
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
"text-foreground-subtle px-2 py-1.5 text-xs font-medium",
|
|
119
|
-
n && "pl-8",
|
|
120
|
-
e
|
|
121
|
-
),
|
|
122
|
-
...o
|
|
123
|
-
}
|
|
124
|
-
);
|
|
73
|
+
b.displayName = "ContextMenuRadioItem";
|
|
74
|
+
var x = i(function({ className: t, inset: n, ...r }, i) {
|
|
75
|
+
return /* @__PURE__ */ a(s.Label, {
|
|
76
|
+
ref: i,
|
|
77
|
+
className: e("text-foreground-subtle px-2 py-1.5 text-xs font-medium", n && "pl-8", t),
|
|
78
|
+
...r
|
|
79
|
+
});
|
|
125
80
|
});
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
...n
|
|
134
|
-
}
|
|
135
|
-
);
|
|
81
|
+
x.displayName = "ContextMenuLabel";
|
|
82
|
+
var S = i(function({ className: t, ...n }, r) {
|
|
83
|
+
return /* @__PURE__ */ a(s.Separator, {
|
|
84
|
+
ref: r,
|
|
85
|
+
className: e("bg-border -mx-1 my-1 h-px", t),
|
|
86
|
+
...n
|
|
87
|
+
});
|
|
136
88
|
});
|
|
137
89
|
S.displayName = "ContextMenuSeparator";
|
|
138
|
-
function
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
...e
|
|
144
|
-
}
|
|
145
|
-
);
|
|
90
|
+
function C({ className: t, ...n }) {
|
|
91
|
+
return /* @__PURE__ */ a("span", {
|
|
92
|
+
className: e("text-foreground-subtle ml-auto font-mono text-xs tracking-widest", t),
|
|
93
|
+
...n
|
|
94
|
+
});
|
|
146
95
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
j as ContextMenuGroup,
|
|
153
|
-
h as ContextMenuItem,
|
|
154
|
-
I as ContextMenuLabel,
|
|
155
|
-
C as ContextMenuPortal,
|
|
156
|
-
L as ContextMenuRadioGroup,
|
|
157
|
-
N as ContextMenuRadioItem,
|
|
158
|
-
S as ContextMenuSeparator,
|
|
159
|
-
v as ContextMenuShortcut,
|
|
160
|
-
G as ContextMenuSub,
|
|
161
|
-
f as ContextMenuSubContent,
|
|
162
|
-
g as ContextMenuSubTrigger,
|
|
163
|
-
T as ContextMenuTrigger
|
|
164
|
-
};
|
|
165
|
-
//# sourceMappingURL=ContextMenu.js.map
|
|
96
|
+
C.displayName = "ContextMenuShortcut";
|
|
97
|
+
//#endregion
|
|
98
|
+
export { c as ContextMenu, y as ContextMenuCheckboxItem, _ as ContextMenuContent, u as ContextMenuGroup, v as ContextMenuItem, x as ContextMenuLabel, d as ContextMenuPortal, p as ContextMenuRadioGroup, b as ContextMenuRadioItem, S as ContextMenuSeparator, C as ContextMenuShortcut, f as ContextMenuSub, g as ContextMenuSubContent, h as ContextMenuSubTrigger, l as ContextMenuTrigger };
|
|
99
|
+
|
|
100
|
+
//# sourceMappingURL=ContextMenu.js.map
|