@mesob/ui 0.1.1 → 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/dist/components/alert-dialog.js +22 -22
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/alert.js +1 -1
- package/dist/components/alert.js.map +1 -1
- package/dist/components/animated-tabs.js +1 -1
- package/dist/components/animated-tabs.js.map +1 -1
- package/dist/components/app-breadcrumbs.d.ts +34 -0
- package/dist/components/app-breadcrumbs.js +177 -0
- package/dist/components/app-breadcrumbs.js.map +1 -0
- package/dist/components/app-header-actions.d.ts +39 -0
- package/dist/components/app-header-actions.js +644 -0
- package/dist/components/app-header-actions.js.map +1 -0
- package/dist/components/app-sidebar.d.ts +24 -0
- package/dist/components/app-sidebar.js +669 -0
- package/dist/components/app-sidebar.js.map +1 -0
- package/dist/components/button-group.js +1 -1
- package/dist/components/button-group.js.map +1 -1
- package/dist/components/button.d.ts +6 -3
- package/dist/components/button.js +16 -8
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar.js +24 -16
- package/dist/components/calendar.js.map +1 -1
- package/dist/components/card.js +1 -1
- package/dist/components/card.js.map +1 -1
- package/dist/components/carousel.js +28 -20
- package/dist/components/carousel.js.map +1 -1
- package/dist/components/command.js +5 -5
- package/dist/components/command.js.map +1 -1
- package/dist/components/context-menu.js +2 -2
- package/dist/components/context-menu.js.map +1 -1
- package/dist/components/data-table/index.d.ts +9 -2
- package/dist/components/data-table/index.js +336 -152
- package/dist/components/data-table/index.js.map +1 -1
- package/dist/components/dialog.js +2 -2
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/drawer.js +2 -2
- package/dist/components/drawer.js.map +1 -1
- package/dist/components/dropdown-menu.js +2 -2
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/entity/index.d.ts +85 -9
- package/dist/components/entity/index.js +539 -414
- package/dist/components/entity/index.js.map +1 -1
- package/dist/components/hover-card.js +1 -1
- package/dist/components/hover-card.js.map +1 -1
- package/dist/components/input-group.d.ts +1 -1
- package/dist/components/input-group.js +27 -19
- package/dist/components/input-group.js.map +1 -1
- package/dist/components/item.d.ts +1 -1
- package/dist/components/link.d.ts +12 -0
- package/dist/components/link.js +51 -0
- package/dist/components/link.js.map +1 -0
- package/dist/components/menubar.js +3 -3
- package/dist/components/menubar.js.map +1 -1
- package/dist/components/mesob-context.d.ts +34 -0
- package/dist/components/mesob-context.js +53 -0
- package/dist/components/mesob-context.js.map +1 -0
- package/dist/components/navigation-menu.js +1 -1
- package/dist/components/navigation-menu.js.map +1 -1
- package/dist/components/page/index.d.ts +46 -0
- package/dist/components/page/index.js +205 -0
- package/dist/components/page/index.js.map +1 -0
- package/dist/components/pagination.js +20 -20
- package/dist/components/pagination.js.map +1 -1
- package/dist/components/popover.js +1 -1
- package/dist/components/popover.js.map +1 -1
- package/dist/components/powered-by.d.ts +4 -1
- package/dist/components/powered-by.js +28 -12
- package/dist/components/powered-by.js.map +1 -1
- package/dist/components/section/index.js +29 -21
- package/dist/components/section/index.js.map +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/select.js.map +1 -1
- package/dist/components/sheet.js +2 -2
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/shell.d.ts +13 -0
- package/dist/components/shell.js +553 -0
- package/dist/components/shell.js.map +1 -0
- package/dist/components/sidebar.d.ts +4 -0
- package/dist/components/sidebar.js +119 -82
- package/dist/components/sidebar.js.map +1 -1
- package/dist/components/spotlight-search.js +67 -59
- package/dist/components/spotlight-search.js.map +1 -1
- package/dist/components/table.js +1 -1
- package/dist/components/table.js.map +1 -1
- package/dist/components/theme-toggle.js +21 -13
- package/dist/components/theme-toggle.js.map +1 -1
- package/dist/components/tooltip.d.ts +1 -1
- package/dist/components/tooltip.js +2 -1
- package/dist/components/tooltip.js.map +1 -1
- package/dist/hooks/use-router.d.ts +7 -0
- package/dist/hooks/use-router.js +36 -0
- package/dist/hooks/use-router.js.map +1 -0
- package/dist/hooks/use-translation.d.ts +5 -0
- package/dist/hooks/use-translation.js +42 -0
- package/dist/hooks/use-translation.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +94 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/theme-schema.d.ts +21 -0
- package/dist/lib/theme-schema.js +95 -0
- package/dist/lib/theme-schema.js.map +1 -0
- package/package.json +8 -5
- package/src/styles/globals.css +0 -126
|
@@ -0,0 +1,644 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/lib/utils.ts
|
|
4
|
+
import { clsx } from "clsx";
|
|
5
|
+
import { twMerge } from "tailwind-merge";
|
|
6
|
+
function cn(...inputs) {
|
|
7
|
+
return twMerge(clsx(inputs));
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// src/components/avatar.tsx
|
|
11
|
+
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
12
|
+
import { jsx } from "react/jsx-runtime";
|
|
13
|
+
function Avatar({
|
|
14
|
+
className,
|
|
15
|
+
...props
|
|
16
|
+
}) {
|
|
17
|
+
return /* @__PURE__ */ jsx(
|
|
18
|
+
AvatarPrimitive.Root,
|
|
19
|
+
{
|
|
20
|
+
"data-slot": "avatar",
|
|
21
|
+
className: cn(
|
|
22
|
+
"relative flex size-8 shrink-0 overflow-hidden rounded-full",
|
|
23
|
+
className
|
|
24
|
+
),
|
|
25
|
+
...props
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
function AvatarImage({
|
|
30
|
+
className,
|
|
31
|
+
...props
|
|
32
|
+
}) {
|
|
33
|
+
return /* @__PURE__ */ jsx(
|
|
34
|
+
AvatarPrimitive.Image,
|
|
35
|
+
{
|
|
36
|
+
"data-slot": "avatar-image",
|
|
37
|
+
className: cn("aspect-square size-full", className),
|
|
38
|
+
...props
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
function AvatarFallback({
|
|
43
|
+
className,
|
|
44
|
+
...props
|
|
45
|
+
}) {
|
|
46
|
+
return /* @__PURE__ */ jsx(
|
|
47
|
+
AvatarPrimitive.Fallback,
|
|
48
|
+
{
|
|
49
|
+
"data-slot": "avatar-fallback",
|
|
50
|
+
className: cn(
|
|
51
|
+
"bg-muted flex size-full items-center justify-center rounded-full",
|
|
52
|
+
className
|
|
53
|
+
),
|
|
54
|
+
...props
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// src/components/button.tsx
|
|
60
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
61
|
+
import { cva } from "class-variance-authority";
|
|
62
|
+
import { jsxs } from "react/jsx-runtime";
|
|
63
|
+
var buttonVariants = cva(
|
|
64
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
65
|
+
{
|
|
66
|
+
variants: {
|
|
67
|
+
variant: {
|
|
68
|
+
default: "bg-primary text-primary-foreground hover:bg-primary-600 dark:hover:bg-primary-400",
|
|
69
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",
|
|
70
|
+
outline: "border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
71
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary-600 dark:hover:bg-secondary-400",
|
|
72
|
+
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
73
|
+
link: "text-primary underline-offset-4 hover:text-primary-600 dark:hover:text-primary-400 hover:underline"
|
|
74
|
+
},
|
|
75
|
+
size: {
|
|
76
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
77
|
+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
78
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
79
|
+
icon: "size-9",
|
|
80
|
+
"icon-sm": "size-8",
|
|
81
|
+
"icon-lg": "size-10"
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
defaultVariants: {
|
|
85
|
+
variant: "default",
|
|
86
|
+
size: "default"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
function Button({
|
|
91
|
+
className,
|
|
92
|
+
variant,
|
|
93
|
+
size,
|
|
94
|
+
asChild = false,
|
|
95
|
+
leftIcon,
|
|
96
|
+
rightIcon,
|
|
97
|
+
children,
|
|
98
|
+
...props
|
|
99
|
+
}) {
|
|
100
|
+
const Comp = asChild ? Slot : "button";
|
|
101
|
+
return /* @__PURE__ */ jsxs(
|
|
102
|
+
Comp,
|
|
103
|
+
{
|
|
104
|
+
"data-slot": "button",
|
|
105
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
106
|
+
...props,
|
|
107
|
+
children: [
|
|
108
|
+
leftIcon,
|
|
109
|
+
children,
|
|
110
|
+
rightIcon
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// src/components/dropdown-menu.tsx
|
|
117
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
118
|
+
import { IconCheck, IconChevronRight, IconCircle } from "@tabler/icons-react";
|
|
119
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
120
|
+
function DropdownMenu({
|
|
121
|
+
...props
|
|
122
|
+
}) {
|
|
123
|
+
return /* @__PURE__ */ jsx2(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
|
|
124
|
+
}
|
|
125
|
+
function DropdownMenuTrigger({
|
|
126
|
+
...props
|
|
127
|
+
}) {
|
|
128
|
+
return /* @__PURE__ */ jsx2(
|
|
129
|
+
DropdownMenuPrimitive.Trigger,
|
|
130
|
+
{
|
|
131
|
+
"data-slot": "dropdown-menu-trigger",
|
|
132
|
+
...props
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
function DropdownMenuContent({
|
|
137
|
+
className,
|
|
138
|
+
sideOffset = 4,
|
|
139
|
+
...props
|
|
140
|
+
}) {
|
|
141
|
+
return /* @__PURE__ */ jsx2(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx2(
|
|
142
|
+
DropdownMenuPrimitive.Content,
|
|
143
|
+
{
|
|
144
|
+
"data-slot": "dropdown-menu-content",
|
|
145
|
+
sideOffset,
|
|
146
|
+
className: cn(
|
|
147
|
+
"bg-popover text-popover-foreground border-border 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 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 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 p-1 shadow-md",
|
|
148
|
+
className
|
|
149
|
+
),
|
|
150
|
+
...props
|
|
151
|
+
}
|
|
152
|
+
) });
|
|
153
|
+
}
|
|
154
|
+
function DropdownMenuItem({
|
|
155
|
+
className,
|
|
156
|
+
inset,
|
|
157
|
+
variant = "default",
|
|
158
|
+
...props
|
|
159
|
+
}) {
|
|
160
|
+
return /* @__PURE__ */ jsx2(
|
|
161
|
+
DropdownMenuPrimitive.Item,
|
|
162
|
+
{
|
|
163
|
+
"data-slot": "dropdown-menu-item",
|
|
164
|
+
"data-inset": inset,
|
|
165
|
+
"data-variant": variant,
|
|
166
|
+
className: cn(
|
|
167
|
+
"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
168
|
+
className
|
|
169
|
+
),
|
|
170
|
+
...props
|
|
171
|
+
}
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
function DropdownMenuSeparator({
|
|
175
|
+
className,
|
|
176
|
+
...props
|
|
177
|
+
}) {
|
|
178
|
+
return /* @__PURE__ */ jsx2(
|
|
179
|
+
DropdownMenuPrimitive.Separator,
|
|
180
|
+
{
|
|
181
|
+
"data-slot": "dropdown-menu-separator",
|
|
182
|
+
className: cn("bg-border -mx-1 my-1 h-px", className),
|
|
183
|
+
...props
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// src/components/tooltip.tsx
|
|
189
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
190
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
191
|
+
|
|
192
|
+
// src/components/mesob-context.tsx
|
|
193
|
+
import {
|
|
194
|
+
createContext,
|
|
195
|
+
useContext,
|
|
196
|
+
useMemo
|
|
197
|
+
} from "react";
|
|
198
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
199
|
+
var MesobContext = createContext(null);
|
|
200
|
+
function useMesob() {
|
|
201
|
+
return useContext(MesobContext);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// src/components/link.tsx
|
|
205
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
206
|
+
function Link({
|
|
207
|
+
href,
|
|
208
|
+
children,
|
|
209
|
+
className,
|
|
210
|
+
onClick,
|
|
211
|
+
...props
|
|
212
|
+
}) {
|
|
213
|
+
const mesob = useMesob();
|
|
214
|
+
const LinkComponent = mesob?.linkComponent ?? "a";
|
|
215
|
+
if (LinkComponent === "a") {
|
|
216
|
+
return /* @__PURE__ */ jsx5("a", { href, className, onClick, ...props, children });
|
|
217
|
+
}
|
|
218
|
+
return /* @__PURE__ */ jsx5(
|
|
219
|
+
LinkComponent,
|
|
220
|
+
{
|
|
221
|
+
href,
|
|
222
|
+
className,
|
|
223
|
+
onClick,
|
|
224
|
+
...props,
|
|
225
|
+
children
|
|
226
|
+
}
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// src/components/dialog.tsx
|
|
231
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
232
|
+
import { IconX } from "@tabler/icons-react";
|
|
233
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
234
|
+
function Dialog({
|
|
235
|
+
...props
|
|
236
|
+
}) {
|
|
237
|
+
return /* @__PURE__ */ jsx6(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
238
|
+
}
|
|
239
|
+
function DialogPortal({
|
|
240
|
+
...props
|
|
241
|
+
}) {
|
|
242
|
+
return /* @__PURE__ */ jsx6(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
|
|
243
|
+
}
|
|
244
|
+
function DialogOverlay({
|
|
245
|
+
className,
|
|
246
|
+
...props
|
|
247
|
+
}) {
|
|
248
|
+
return /* @__PURE__ */ jsx6(
|
|
249
|
+
DialogPrimitive.Overlay,
|
|
250
|
+
{
|
|
251
|
+
"data-slot": "dialog-overlay",
|
|
252
|
+
className: cn(
|
|
253
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=open]:opacity-100 fixed inset-0 z-50 bg-[var(--overlay,oklch(0_0_0/0.5))]",
|
|
254
|
+
className
|
|
255
|
+
),
|
|
256
|
+
...props
|
|
257
|
+
}
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
function DialogContent({
|
|
261
|
+
className,
|
|
262
|
+
children,
|
|
263
|
+
showCloseButton = true,
|
|
264
|
+
...props
|
|
265
|
+
}) {
|
|
266
|
+
return /* @__PURE__ */ jsxs4(DialogPortal, { "data-slot": "dialog-portal", children: [
|
|
267
|
+
/* @__PURE__ */ jsx6(DialogOverlay, {}),
|
|
268
|
+
/* @__PURE__ */ jsxs4(
|
|
269
|
+
DialogPrimitive.Content,
|
|
270
|
+
{
|
|
271
|
+
"data-slot": "dialog-content",
|
|
272
|
+
className: cn(
|
|
273
|
+
"bg-background text-foreground border-border 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 fixed top-[50%] left-[50%] z-[51] grid w-full min-w-[280px] max-w-[calc(100vw-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:min-w-[320px] sm:max-w-[32rem]",
|
|
274
|
+
className
|
|
275
|
+
),
|
|
276
|
+
...props,
|
|
277
|
+
children: [
|
|
278
|
+
children,
|
|
279
|
+
showCloseButton && /* @__PURE__ */ jsxs4(
|
|
280
|
+
DialogPrimitive.Close,
|
|
281
|
+
{
|
|
282
|
+
"data-slot": "dialog-close",
|
|
283
|
+
className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
284
|
+
children: [
|
|
285
|
+
/* @__PURE__ */ jsx6(IconX, {}),
|
|
286
|
+
/* @__PURE__ */ jsx6("span", { className: "sr-only", children: "Close" })
|
|
287
|
+
]
|
|
288
|
+
}
|
|
289
|
+
)
|
|
290
|
+
]
|
|
291
|
+
}
|
|
292
|
+
)
|
|
293
|
+
] });
|
|
294
|
+
}
|
|
295
|
+
function DialogHeader({ className, ...props }) {
|
|
296
|
+
return /* @__PURE__ */ jsx6(
|
|
297
|
+
"div",
|
|
298
|
+
{
|
|
299
|
+
"data-slot": "dialog-header",
|
|
300
|
+
className: cn("flex flex-col gap-2 text-center sm:text-left", className),
|
|
301
|
+
...props
|
|
302
|
+
}
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
function DialogTitle({
|
|
306
|
+
className,
|
|
307
|
+
...props
|
|
308
|
+
}) {
|
|
309
|
+
return /* @__PURE__ */ jsx6(
|
|
310
|
+
DialogPrimitive.Title,
|
|
311
|
+
{
|
|
312
|
+
"data-slot": "dialog-title",
|
|
313
|
+
className: cn("text-lg leading-none font-semibold", className),
|
|
314
|
+
...props
|
|
315
|
+
}
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
function DialogDescription({
|
|
319
|
+
className,
|
|
320
|
+
...props
|
|
321
|
+
}) {
|
|
322
|
+
return /* @__PURE__ */ jsx6(
|
|
323
|
+
DialogPrimitive.Description,
|
|
324
|
+
{
|
|
325
|
+
"data-slot": "dialog-description",
|
|
326
|
+
className: cn("text-muted-foreground text-sm", className),
|
|
327
|
+
...props
|
|
328
|
+
}
|
|
329
|
+
);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// src/components/command.tsx
|
|
333
|
+
import { IconSearch } from "@tabler/icons-react";
|
|
334
|
+
import { Command as CommandPrimitive } from "cmdk";
|
|
335
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
336
|
+
function Command({
|
|
337
|
+
className,
|
|
338
|
+
...props
|
|
339
|
+
}) {
|
|
340
|
+
return /* @__PURE__ */ jsx7(
|
|
341
|
+
CommandPrimitive,
|
|
342
|
+
{
|
|
343
|
+
"data-slot": "command",
|
|
344
|
+
className: cn(
|
|
345
|
+
"bg-popover text-popover-foreground flex h-full min-h-0 w-full flex-col overflow-hidden rounded-md",
|
|
346
|
+
className
|
|
347
|
+
),
|
|
348
|
+
...props
|
|
349
|
+
}
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
function CommandDialog({
|
|
353
|
+
title = "Command Palette",
|
|
354
|
+
description = "Search for a command to run...",
|
|
355
|
+
children,
|
|
356
|
+
className,
|
|
357
|
+
showCloseButton = true,
|
|
358
|
+
...props
|
|
359
|
+
}) {
|
|
360
|
+
return /* @__PURE__ */ jsxs5(Dialog, { ...props, children: [
|
|
361
|
+
/* @__PURE__ */ jsxs5(DialogHeader, { className: "sr-only", children: [
|
|
362
|
+
/* @__PURE__ */ jsx7(DialogTitle, { children: title }),
|
|
363
|
+
/* @__PURE__ */ jsx7(DialogDescription, { children: description })
|
|
364
|
+
] }),
|
|
365
|
+
/* @__PURE__ */ jsx7(
|
|
366
|
+
DialogContent,
|
|
367
|
+
{
|
|
368
|
+
className: cn("overflow-hidden p-0", className),
|
|
369
|
+
showCloseButton,
|
|
370
|
+
children: /* @__PURE__ */ jsx7(Command, { className: "[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5", children })
|
|
371
|
+
}
|
|
372
|
+
)
|
|
373
|
+
] });
|
|
374
|
+
}
|
|
375
|
+
function CommandInput({
|
|
376
|
+
className,
|
|
377
|
+
...props
|
|
378
|
+
}) {
|
|
379
|
+
return /* @__PURE__ */ jsxs5(
|
|
380
|
+
"div",
|
|
381
|
+
{
|
|
382
|
+
"data-slot": "command-input-wrapper",
|
|
383
|
+
className: "border-border flex h-9 items-center gap-2 border-b px-3",
|
|
384
|
+
children: [
|
|
385
|
+
/* @__PURE__ */ jsx7(IconSearch, { className: "size-4 shrink-0 opacity-50" }),
|
|
386
|
+
/* @__PURE__ */ jsx7(
|
|
387
|
+
CommandPrimitive.Input,
|
|
388
|
+
{
|
|
389
|
+
"data-slot": "command-input",
|
|
390
|
+
className: cn(
|
|
391
|
+
"placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
|
|
392
|
+
className
|
|
393
|
+
),
|
|
394
|
+
...props
|
|
395
|
+
}
|
|
396
|
+
)
|
|
397
|
+
]
|
|
398
|
+
}
|
|
399
|
+
);
|
|
400
|
+
}
|
|
401
|
+
function CommandList({
|
|
402
|
+
className,
|
|
403
|
+
...props
|
|
404
|
+
}) {
|
|
405
|
+
return /* @__PURE__ */ jsx7(
|
|
406
|
+
CommandPrimitive.List,
|
|
407
|
+
{
|
|
408
|
+
"data-slot": "command-list",
|
|
409
|
+
className: cn(
|
|
410
|
+
"max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",
|
|
411
|
+
className
|
|
412
|
+
),
|
|
413
|
+
...props
|
|
414
|
+
}
|
|
415
|
+
);
|
|
416
|
+
}
|
|
417
|
+
function CommandEmpty({
|
|
418
|
+
...props
|
|
419
|
+
}) {
|
|
420
|
+
return /* @__PURE__ */ jsx7(
|
|
421
|
+
CommandPrimitive.Empty,
|
|
422
|
+
{
|
|
423
|
+
"data-slot": "command-empty",
|
|
424
|
+
className: "text-muted-foreground py-6 text-center text-sm",
|
|
425
|
+
...props
|
|
426
|
+
}
|
|
427
|
+
);
|
|
428
|
+
}
|
|
429
|
+
function CommandGroup({
|
|
430
|
+
className,
|
|
431
|
+
...props
|
|
432
|
+
}) {
|
|
433
|
+
return /* @__PURE__ */ jsx7(
|
|
434
|
+
CommandPrimitive.Group,
|
|
435
|
+
{
|
|
436
|
+
"data-slot": "command-group",
|
|
437
|
+
className: cn(
|
|
438
|
+
"text-foreground [&_[cmdk-group-heading]]:text-muted-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",
|
|
439
|
+
className
|
|
440
|
+
),
|
|
441
|
+
...props
|
|
442
|
+
}
|
|
443
|
+
);
|
|
444
|
+
}
|
|
445
|
+
function CommandSeparator({
|
|
446
|
+
className,
|
|
447
|
+
...props
|
|
448
|
+
}) {
|
|
449
|
+
return /* @__PURE__ */ jsx7(
|
|
450
|
+
CommandPrimitive.Separator,
|
|
451
|
+
{
|
|
452
|
+
"data-slot": "command-separator",
|
|
453
|
+
className: cn("bg-border -mx-1 h-px", className),
|
|
454
|
+
...props
|
|
455
|
+
}
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
function CommandItem({
|
|
459
|
+
className,
|
|
460
|
+
...props
|
|
461
|
+
}) {
|
|
462
|
+
return /* @__PURE__ */ jsx7(
|
|
463
|
+
CommandPrimitive.Item,
|
|
464
|
+
{
|
|
465
|
+
"data-slot": "command-item",
|
|
466
|
+
className: cn(
|
|
467
|
+
"data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
468
|
+
className
|
|
469
|
+
),
|
|
470
|
+
...props
|
|
471
|
+
}
|
|
472
|
+
);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
// src/components/spotlight-search.tsx
|
|
476
|
+
import { IconSearch as IconSearch2 } from "@tabler/icons-react";
|
|
477
|
+
import * as React from "react";
|
|
478
|
+
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
479
|
+
function SpotlightSearch({
|
|
480
|
+
groups = [],
|
|
481
|
+
placeholder = "Search...",
|
|
482
|
+
emptyMessage = "No results found.",
|
|
483
|
+
className,
|
|
484
|
+
triggerClassName,
|
|
485
|
+
onSearch
|
|
486
|
+
}) {
|
|
487
|
+
const [open, setOpen] = React.useState(false);
|
|
488
|
+
React.useEffect(() => {
|
|
489
|
+
const down = (e) => {
|
|
490
|
+
if (e.key === "k" && (e.metaKey || e.ctrlKey)) {
|
|
491
|
+
e.preventDefault();
|
|
492
|
+
setOpen((open2) => !open2);
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
document.addEventListener("keydown", down);
|
|
496
|
+
return () => document.removeEventListener("keydown", down);
|
|
497
|
+
}, []);
|
|
498
|
+
return /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
499
|
+
/* @__PURE__ */ jsxs6(
|
|
500
|
+
Button,
|
|
501
|
+
{
|
|
502
|
+
variant: "outline",
|
|
503
|
+
className: cn(
|
|
504
|
+
"relative h-9 min-w-9 p-0 xl:h-9 xl:min-w-[12rem] xl:w-60 xl:justify-start xl:px-3 xl:py-2",
|
|
505
|
+
triggerClassName
|
|
506
|
+
),
|
|
507
|
+
onClick: () => setOpen(true),
|
|
508
|
+
children: [
|
|
509
|
+
/* @__PURE__ */ jsx8(IconSearch2, { className: "h-4 w-4 xl:mr-2" }),
|
|
510
|
+
/* @__PURE__ */ jsx8("span", { className: "hidden xl:inline-flex", children: "Search..." }),
|
|
511
|
+
/* @__PURE__ */ jsxs6("kbd", { className: "border-border pointer-events-none absolute right-1.5 top-1/2 hidden h-5 -translate-y-1/2 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium opacity-100 xl:flex", children: [
|
|
512
|
+
/* @__PURE__ */ jsx8("span", { className: "text-xs", children: "\u2318" }),
|
|
513
|
+
"K"
|
|
514
|
+
] })
|
|
515
|
+
]
|
|
516
|
+
}
|
|
517
|
+
),
|
|
518
|
+
/* @__PURE__ */ jsxs6(
|
|
519
|
+
CommandDialog,
|
|
520
|
+
{
|
|
521
|
+
open,
|
|
522
|
+
onOpenChange: setOpen,
|
|
523
|
+
title: "Search",
|
|
524
|
+
description: "Search for pages, actions, and more",
|
|
525
|
+
showCloseButton: false,
|
|
526
|
+
className,
|
|
527
|
+
children: [
|
|
528
|
+
/* @__PURE__ */ jsx8(CommandInput, { placeholder, onValueChange: onSearch }),
|
|
529
|
+
/* @__PURE__ */ jsxs6(CommandList, { children: [
|
|
530
|
+
/* @__PURE__ */ jsx8(CommandEmpty, { children: emptyMessage }),
|
|
531
|
+
groups.map((group, index) => /* @__PURE__ */ jsxs6(React.Fragment, { children: [
|
|
532
|
+
index > 0 && /* @__PURE__ */ jsx8(CommandSeparator, {}),
|
|
533
|
+
/* @__PURE__ */ jsx8(CommandGroup, { heading: group.heading, children: group.items.map((item) => /* @__PURE__ */ jsxs6(
|
|
534
|
+
CommandItem,
|
|
535
|
+
{
|
|
536
|
+
onSelect: () => {
|
|
537
|
+
item.onSelect?.();
|
|
538
|
+
setOpen(false);
|
|
539
|
+
},
|
|
540
|
+
children: [
|
|
541
|
+
item.icon,
|
|
542
|
+
/* @__PURE__ */ jsx8("span", { children: item.title }),
|
|
543
|
+
item.shortcut && /* @__PURE__ */ jsx8("kbd", { className: "border-border pointer-events-none ml-auto hidden h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium opacity-100 sm:flex", children: item.shortcut })
|
|
544
|
+
]
|
|
545
|
+
},
|
|
546
|
+
item.id
|
|
547
|
+
)) })
|
|
548
|
+
] }, group.heading))
|
|
549
|
+
] })
|
|
550
|
+
]
|
|
551
|
+
}
|
|
552
|
+
)
|
|
553
|
+
] });
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
// src/components/app-header-actions.tsx
|
|
557
|
+
import { IconBell, IconLogout } from "@tabler/icons-react";
|
|
558
|
+
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
559
|
+
function AppHeaderActions({
|
|
560
|
+
user,
|
|
561
|
+
onLogout,
|
|
562
|
+
isLoggingOut = false,
|
|
563
|
+
searchGroups = [],
|
|
564
|
+
menuItems = [],
|
|
565
|
+
topMenuItems = [],
|
|
566
|
+
actions,
|
|
567
|
+
accountMenuFooter
|
|
568
|
+
}) {
|
|
569
|
+
const initials = user?.fullName?.split(" ").map((n) => n[0]).join("").toUpperCase().slice(0, 2) || "U";
|
|
570
|
+
const displayName = user?.fullName ?? "Account";
|
|
571
|
+
const displaySubtext = user?.email ?? user?.phone ?? user?.handle ?? "";
|
|
572
|
+
return /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-2", children: [
|
|
573
|
+
/* @__PURE__ */ jsx9(SpotlightSearch, { groups: searchGroups }),
|
|
574
|
+
actions,
|
|
575
|
+
/* @__PURE__ */ jsx9(Button, { variant: "ghost", size: "icon", className: "relative", children: /* @__PURE__ */ jsx9(IconBell, { className: "size-5" }) }),
|
|
576
|
+
/* @__PURE__ */ jsxs7(DropdownMenu, { children: [
|
|
577
|
+
/* @__PURE__ */ jsx9(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs7(
|
|
578
|
+
Button,
|
|
579
|
+
{
|
|
580
|
+
variant: "ghost",
|
|
581
|
+
className: "flex items-center gap-3 px-3 py-2 h-auto rounded-md min-h-9 hover:bg-accent/70 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
|
|
582
|
+
children: [
|
|
583
|
+
/* @__PURE__ */ jsxs7(Avatar, { className: "size-8 shrink-0", children: [
|
|
584
|
+
/* @__PURE__ */ jsx9(AvatarImage, { src: user?.image ?? void 0 }),
|
|
585
|
+
/* @__PURE__ */ jsx9(AvatarFallback, { className: "text-xs", children: initials })
|
|
586
|
+
] }),
|
|
587
|
+
/* @__PURE__ */ jsxs7("div", { className: "hidden flex-col items-start text-left md:flex min-w-0", children: [
|
|
588
|
+
/* @__PURE__ */ jsx9("span", { className: "text-sm font-medium", children: displayName }),
|
|
589
|
+
/* @__PURE__ */ jsx9("span", { className: "text-xs text-muted-foreground", children: displaySubtext })
|
|
590
|
+
] })
|
|
591
|
+
]
|
|
592
|
+
}
|
|
593
|
+
) }),
|
|
594
|
+
/* @__PURE__ */ jsxs7(DropdownMenuContent, { align: "end", className: "w-56", children: [
|
|
595
|
+
topMenuItems.map((item) => /* @__PURE__ */ jsx9(
|
|
596
|
+
DropdownMenuItem,
|
|
597
|
+
{
|
|
598
|
+
onClick: item.onClick,
|
|
599
|
+
variant: item.variant,
|
|
600
|
+
asChild: item.href ? true : void 0,
|
|
601
|
+
children: item.href ? /* @__PURE__ */ jsxs7(Link, { href: item.href, onClick: item.onClick, children: [
|
|
602
|
+
item.icon && /* @__PURE__ */ jsx9("span", { className: "mr-2", children: item.icon }),
|
|
603
|
+
item.label
|
|
604
|
+
] }) : /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
605
|
+
item.icon && /* @__PURE__ */ jsx9("span", { className: "mr-2", children: item.icon }),
|
|
606
|
+
item.label
|
|
607
|
+
] })
|
|
608
|
+
},
|
|
609
|
+
item.href ?? item.label
|
|
610
|
+
)),
|
|
611
|
+
topMenuItems.length > 0 && menuItems.length > 0 && /* @__PURE__ */ jsx9(DropdownMenuSeparator, {}),
|
|
612
|
+
menuItems.map((item) => /* @__PURE__ */ jsx9(
|
|
613
|
+
DropdownMenuItem,
|
|
614
|
+
{
|
|
615
|
+
onClick: item.onClick,
|
|
616
|
+
variant: item.variant,
|
|
617
|
+
asChild: item.href ? true : void 0,
|
|
618
|
+
children: item.href ? /* @__PURE__ */ jsxs7(Link, { href: item.href, onClick: item.onClick, children: [
|
|
619
|
+
item.icon && /* @__PURE__ */ jsx9("span", { className: "mr-2", children: item.icon }),
|
|
620
|
+
item.label
|
|
621
|
+
] }) : /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
622
|
+
item.icon && /* @__PURE__ */ jsx9("span", { className: "mr-2", children: item.icon }),
|
|
623
|
+
item.label
|
|
624
|
+
] })
|
|
625
|
+
},
|
|
626
|
+
item.href ?? item.label
|
|
627
|
+
)),
|
|
628
|
+
accountMenuFooter && (topMenuItems.length > 0 || menuItems.length > 0) && /* @__PURE__ */ jsx9(DropdownMenuSeparator, {}),
|
|
629
|
+
accountMenuFooter,
|
|
630
|
+
onLogout && /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
631
|
+
(topMenuItems.length > 0 || menuItems.length > 0 || accountMenuFooter) && /* @__PURE__ */ jsx9(DropdownMenuSeparator, {}),
|
|
632
|
+
/* @__PURE__ */ jsxs7(DropdownMenuItem, { onClick: onLogout, variant: "destructive", children: [
|
|
633
|
+
isLoggingOut ? /* @__PURE__ */ jsx9("span", { className: "mr-2", children: "..." }) : /* @__PURE__ */ jsx9(IconLogout, { className: "mr-2 size-4" }),
|
|
634
|
+
"Log out"
|
|
635
|
+
] })
|
|
636
|
+
] })
|
|
637
|
+
] })
|
|
638
|
+
] })
|
|
639
|
+
] });
|
|
640
|
+
}
|
|
641
|
+
export {
|
|
642
|
+
AppHeaderActions
|
|
643
|
+
};
|
|
644
|
+
//# sourceMappingURL=app-header-actions.js.map
|