@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
|
@@ -12,18 +12,18 @@ function cn(...inputs) {
|
|
|
12
12
|
// src/components/button.tsx
|
|
13
13
|
import { Slot } from "@radix-ui/react-slot";
|
|
14
14
|
import { cva } from "class-variance-authority";
|
|
15
|
-
import {
|
|
15
|
+
import { jsxs } from "react/jsx-runtime";
|
|
16
16
|
var buttonVariants = cva(
|
|
17
17
|
"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",
|
|
18
18
|
{
|
|
19
19
|
variants: {
|
|
20
20
|
variant: {
|
|
21
|
-
default: "bg-primary text-primary-foreground hover:bg-primary
|
|
22
|
-
destructive: "bg-destructive text-
|
|
23
|
-
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
24
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary
|
|
21
|
+
default: "bg-primary text-primary-foreground hover:bg-primary-600 dark:hover:bg-primary-400",
|
|
22
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",
|
|
23
|
+
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",
|
|
24
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary-600 dark:hover:bg-secondary-400",
|
|
25
25
|
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
26
|
-
link: "text-primary underline-offset-4 hover:underline"
|
|
26
|
+
link: "text-primary underline-offset-4 hover:text-primary-600 dark:hover:text-primary-400 hover:underline"
|
|
27
27
|
},
|
|
28
28
|
size: {
|
|
29
29
|
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
@@ -45,47 +45,55 @@ function Button({
|
|
|
45
45
|
variant,
|
|
46
46
|
size,
|
|
47
47
|
asChild = false,
|
|
48
|
+
leftIcon,
|
|
49
|
+
rightIcon,
|
|
50
|
+
children,
|
|
48
51
|
...props
|
|
49
52
|
}) {
|
|
50
53
|
const Comp = asChild ? Slot : "button";
|
|
51
|
-
return /* @__PURE__ */
|
|
54
|
+
return /* @__PURE__ */ jsxs(
|
|
52
55
|
Comp,
|
|
53
56
|
{
|
|
54
57
|
"data-slot": "button",
|
|
55
58
|
className: cn(buttonVariants({ variant, size, className })),
|
|
56
|
-
...props
|
|
59
|
+
...props,
|
|
60
|
+
children: [
|
|
61
|
+
leftIcon,
|
|
62
|
+
children,
|
|
63
|
+
rightIcon
|
|
64
|
+
]
|
|
57
65
|
}
|
|
58
66
|
);
|
|
59
67
|
}
|
|
60
68
|
|
|
61
69
|
// src/components/alert-dialog.tsx
|
|
62
70
|
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
|
|
63
|
-
import { jsx as
|
|
71
|
+
import { jsx, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
64
72
|
function AlertDialog({
|
|
65
73
|
...props
|
|
66
74
|
}) {
|
|
67
|
-
return /* @__PURE__ */
|
|
75
|
+
return /* @__PURE__ */ jsx(AlertDialogPrimitive.Root, { "data-slot": "alert-dialog", ...props });
|
|
68
76
|
}
|
|
69
77
|
function AlertDialogTrigger({
|
|
70
78
|
...props
|
|
71
79
|
}) {
|
|
72
|
-
return /* @__PURE__ */
|
|
80
|
+
return /* @__PURE__ */ jsx(AlertDialogPrimitive.Trigger, { "data-slot": "alert-dialog-trigger", ...props });
|
|
73
81
|
}
|
|
74
82
|
function AlertDialogPortal({
|
|
75
83
|
...props
|
|
76
84
|
}) {
|
|
77
|
-
return /* @__PURE__ */
|
|
85
|
+
return /* @__PURE__ */ jsx(AlertDialogPrimitive.Portal, { "data-slot": "alert-dialog-portal", ...props });
|
|
78
86
|
}
|
|
79
87
|
function AlertDialogOverlay({
|
|
80
88
|
className,
|
|
81
89
|
...props
|
|
82
90
|
}) {
|
|
83
|
-
return /* @__PURE__ */
|
|
91
|
+
return /* @__PURE__ */ jsx(
|
|
84
92
|
AlertDialogPrimitive.Overlay,
|
|
85
93
|
{
|
|
86
94
|
"data-slot": "alert-dialog-overlay",
|
|
87
95
|
className: cn(
|
|
88
|
-
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-
|
|
96
|
+
"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))]",
|
|
89
97
|
className
|
|
90
98
|
),
|
|
91
99
|
...props
|
|
@@ -96,14 +104,14 @@ function AlertDialogContent({
|
|
|
96
104
|
className,
|
|
97
105
|
...props
|
|
98
106
|
}) {
|
|
99
|
-
return /* @__PURE__ */
|
|
100
|
-
/* @__PURE__ */
|
|
101
|
-
/* @__PURE__ */
|
|
107
|
+
return /* @__PURE__ */ jsxs2(AlertDialogPortal, { children: [
|
|
108
|
+
/* @__PURE__ */ jsx(AlertDialogOverlay, {}),
|
|
109
|
+
/* @__PURE__ */ jsx(
|
|
102
110
|
AlertDialogPrimitive.Content,
|
|
103
111
|
{
|
|
104
112
|
"data-slot": "alert-dialog-content",
|
|
105
113
|
className: cn(
|
|
106
|
-
"bg-background 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-
|
|
114
|
+
"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]",
|
|
107
115
|
className
|
|
108
116
|
),
|
|
109
117
|
...props
|
|
@@ -115,7 +123,7 @@ function AlertDialogHeader({
|
|
|
115
123
|
className,
|
|
116
124
|
...props
|
|
117
125
|
}) {
|
|
118
|
-
return /* @__PURE__ */
|
|
126
|
+
return /* @__PURE__ */ jsx(
|
|
119
127
|
"div",
|
|
120
128
|
{
|
|
121
129
|
"data-slot": "alert-dialog-header",
|
|
@@ -128,7 +136,7 @@ function AlertDialogFooter({
|
|
|
128
136
|
className,
|
|
129
137
|
...props
|
|
130
138
|
}) {
|
|
131
|
-
return /* @__PURE__ */
|
|
139
|
+
return /* @__PURE__ */ jsx(
|
|
132
140
|
"div",
|
|
133
141
|
{
|
|
134
142
|
"data-slot": "alert-dialog-footer",
|
|
@@ -144,7 +152,7 @@ function AlertDialogTitle({
|
|
|
144
152
|
className,
|
|
145
153
|
...props
|
|
146
154
|
}) {
|
|
147
|
-
return /* @__PURE__ */
|
|
155
|
+
return /* @__PURE__ */ jsx(
|
|
148
156
|
AlertDialogPrimitive.Title,
|
|
149
157
|
{
|
|
150
158
|
"data-slot": "alert-dialog-title",
|
|
@@ -157,7 +165,7 @@ function AlertDialogDescription({
|
|
|
157
165
|
className,
|
|
158
166
|
...props
|
|
159
167
|
}) {
|
|
160
|
-
return /* @__PURE__ */
|
|
168
|
+
return /* @__PURE__ */ jsx(
|
|
161
169
|
AlertDialogPrimitive.Description,
|
|
162
170
|
{
|
|
163
171
|
"data-slot": "alert-dialog-description",
|
|
@@ -170,7 +178,7 @@ function AlertDialogAction({
|
|
|
170
178
|
className,
|
|
171
179
|
...props
|
|
172
180
|
}) {
|
|
173
|
-
return /* @__PURE__ */
|
|
181
|
+
return /* @__PURE__ */ jsx(
|
|
174
182
|
AlertDialogPrimitive.Action,
|
|
175
183
|
{
|
|
176
184
|
className: cn(buttonVariants(), className),
|
|
@@ -182,7 +190,7 @@ function AlertDialogCancel({
|
|
|
182
190
|
className,
|
|
183
191
|
...props
|
|
184
192
|
}) {
|
|
185
|
-
return /* @__PURE__ */
|
|
193
|
+
return /* @__PURE__ */ jsx(
|
|
186
194
|
AlertDialogPrimitive.Cancel,
|
|
187
195
|
{
|
|
188
196
|
className: cn(buttonVariants({ variant: "outline" }), className),
|
|
@@ -194,16 +202,16 @@ function AlertDialogCancel({
|
|
|
194
202
|
// src/components/dropdown-menu.tsx
|
|
195
203
|
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
196
204
|
import { IconCheck, IconChevronRight, IconCircle } from "@tabler/icons-react";
|
|
197
|
-
import { jsx as
|
|
205
|
+
import { jsx as jsx2, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
198
206
|
function DropdownMenu({
|
|
199
207
|
...props
|
|
200
208
|
}) {
|
|
201
|
-
return /* @__PURE__ */
|
|
209
|
+
return /* @__PURE__ */ jsx2(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
|
|
202
210
|
}
|
|
203
211
|
function DropdownMenuTrigger({
|
|
204
212
|
...props
|
|
205
213
|
}) {
|
|
206
|
-
return /* @__PURE__ */
|
|
214
|
+
return /* @__PURE__ */ jsx2(
|
|
207
215
|
DropdownMenuPrimitive.Trigger,
|
|
208
216
|
{
|
|
209
217
|
"data-slot": "dropdown-menu-trigger",
|
|
@@ -216,13 +224,13 @@ function DropdownMenuContent({
|
|
|
216
224
|
sideOffset = 4,
|
|
217
225
|
...props
|
|
218
226
|
}) {
|
|
219
|
-
return /* @__PURE__ */
|
|
227
|
+
return /* @__PURE__ */ jsx2(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx2(
|
|
220
228
|
DropdownMenuPrimitive.Content,
|
|
221
229
|
{
|
|
222
230
|
"data-slot": "dropdown-menu-content",
|
|
223
231
|
sideOffset,
|
|
224
232
|
className: cn(
|
|
225
|
-
"bg-popover text-popover-foreground 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",
|
|
233
|
+
"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",
|
|
226
234
|
className
|
|
227
235
|
),
|
|
228
236
|
...props
|
|
@@ -235,7 +243,7 @@ function DropdownMenuItem({
|
|
|
235
243
|
variant = "default",
|
|
236
244
|
...props
|
|
237
245
|
}) {
|
|
238
|
-
return /* @__PURE__ */
|
|
246
|
+
return /* @__PURE__ */ jsx2(
|
|
239
247
|
DropdownMenuPrimitive.Item,
|
|
240
248
|
{
|
|
241
249
|
"data-slot": "dropdown-menu-item",
|
|
@@ -253,7 +261,7 @@ function DropdownMenuSeparator({
|
|
|
253
261
|
className,
|
|
254
262
|
...props
|
|
255
263
|
}) {
|
|
256
|
-
return /* @__PURE__ */
|
|
264
|
+
return /* @__PURE__ */ jsx2(
|
|
257
265
|
DropdownMenuPrimitive.Separator,
|
|
258
266
|
{
|
|
259
267
|
"data-slot": "dropdown-menu-separator",
|
|
@@ -264,7 +272,7 @@ function DropdownMenuSeparator({
|
|
|
264
272
|
}
|
|
265
273
|
|
|
266
274
|
// src/components/entity/entity-bulk-actions.tsx
|
|
267
|
-
import { Fragment, jsx as
|
|
275
|
+
import { Fragment, jsx as jsx3, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
268
276
|
function EntityBulkActions({
|
|
269
277
|
selectedCount,
|
|
270
278
|
actions,
|
|
@@ -278,22 +286,22 @@ function EntityBulkActions({
|
|
|
278
286
|
if (onExport) {
|
|
279
287
|
defaultActions.push({
|
|
280
288
|
label: "Export",
|
|
281
|
-
icon: /* @__PURE__ */
|
|
289
|
+
icon: /* @__PURE__ */ jsx3(IconDownload, { className: "mr-2 h-4 w-4" }),
|
|
282
290
|
onClick: onExport
|
|
283
291
|
});
|
|
284
292
|
}
|
|
285
293
|
if (onDelete) {
|
|
286
294
|
defaultActions.push({
|
|
287
295
|
label: "Delete",
|
|
288
|
-
icon: /* @__PURE__ */
|
|
296
|
+
icon: /* @__PURE__ */ jsx3(IconTrash, { className: "mr-2 h-4 w-4" }),
|
|
289
297
|
onClick: () => setShowDeleteConfirm(true),
|
|
290
298
|
variant: "destructive"
|
|
291
299
|
});
|
|
292
300
|
}
|
|
293
301
|
const allActions = actions ? [...actions, ...defaultActions] : defaultActions;
|
|
294
|
-
return /* @__PURE__ */
|
|
295
|
-
/* @__PURE__ */
|
|
296
|
-
/* @__PURE__ */
|
|
302
|
+
return /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
303
|
+
/* @__PURE__ */ jsxs4(DropdownMenu, { children: [
|
|
304
|
+
/* @__PURE__ */ jsx3(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs4(
|
|
297
305
|
Button,
|
|
298
306
|
{
|
|
299
307
|
variant: "outline",
|
|
@@ -302,13 +310,13 @@ function EntityBulkActions({
|
|
|
302
310
|
className: "min-w-[140px]",
|
|
303
311
|
children: [
|
|
304
312
|
hasSelection ? `${selectedCount} selected` : "Bulk Actions",
|
|
305
|
-
/* @__PURE__ */
|
|
313
|
+
/* @__PURE__ */ jsx3(IconChevronDown, { className: "ml-2 h-4 w-4" })
|
|
306
314
|
]
|
|
307
315
|
}
|
|
308
316
|
) }),
|
|
309
|
-
/* @__PURE__ */
|
|
310
|
-
action.variant === "destructive" && index > 0 && /* @__PURE__ */
|
|
311
|
-
/* @__PURE__ */
|
|
317
|
+
/* @__PURE__ */ jsx3(DropdownMenuContent, { align: "end", children: allActions.map((action, index) => /* @__PURE__ */ jsxs4("div", { children: [
|
|
318
|
+
action.variant === "destructive" && index > 0 && /* @__PURE__ */ jsx3(DropdownMenuSeparator, {}),
|
|
319
|
+
/* @__PURE__ */ jsxs4(
|
|
312
320
|
DropdownMenuItem,
|
|
313
321
|
{
|
|
314
322
|
onClick: action.onClick,
|
|
@@ -321,24 +329,24 @@ function EntityBulkActions({
|
|
|
321
329
|
)
|
|
322
330
|
] }, action.label)) })
|
|
323
331
|
] }),
|
|
324
|
-
/* @__PURE__ */
|
|
325
|
-
/* @__PURE__ */
|
|
326
|
-
/* @__PURE__ */
|
|
332
|
+
/* @__PURE__ */ jsx3(AlertDialog, { open: showDeleteConfirm, onOpenChange: setShowDeleteConfirm, children: /* @__PURE__ */ jsxs4(AlertDialogContent, { children: [
|
|
333
|
+
/* @__PURE__ */ jsxs4(AlertDialogHeader, { children: [
|
|
334
|
+
/* @__PURE__ */ jsxs4(AlertDialogTitle, { children: [
|
|
327
335
|
"Delete ",
|
|
328
336
|
selectedCount,
|
|
329
337
|
" ",
|
|
330
338
|
itemName,
|
|
331
339
|
"(s)?"
|
|
332
340
|
] }),
|
|
333
|
-
/* @__PURE__ */
|
|
341
|
+
/* @__PURE__ */ jsxs4(AlertDialogDescription, { children: [
|
|
334
342
|
"This will permanently delete the selected ",
|
|
335
343
|
itemName,
|
|
336
344
|
"(s). This action cannot be undone."
|
|
337
345
|
] })
|
|
338
346
|
] }),
|
|
339
|
-
/* @__PURE__ */
|
|
340
|
-
/* @__PURE__ */
|
|
341
|
-
/* @__PURE__ */
|
|
347
|
+
/* @__PURE__ */ jsxs4(AlertDialogFooter, { children: [
|
|
348
|
+
/* @__PURE__ */ jsx3(AlertDialogCancel, { children: "Cancel" }),
|
|
349
|
+
/* @__PURE__ */ jsx3(
|
|
342
350
|
AlertDialogAction,
|
|
343
351
|
{
|
|
344
352
|
onClick: () => {
|
|
@@ -355,19 +363,19 @@ function EntityBulkActions({
|
|
|
355
363
|
}
|
|
356
364
|
|
|
357
365
|
// src/components/entity/entity-detail-header.tsx
|
|
358
|
-
import { IconChevronDown as
|
|
366
|
+
import { IconChevronDown as IconChevronDown3, IconMenu2 } from "@tabler/icons-react";
|
|
359
367
|
import { motion } from "motion/react";
|
|
360
368
|
import { useLayoutEffect, useMemo, useRef, useState as useState2 } from "react";
|
|
361
369
|
|
|
362
370
|
// src/components/card.tsx
|
|
363
|
-
import { jsx as
|
|
371
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
364
372
|
function Card({ className, ...props }) {
|
|
365
|
-
return /* @__PURE__ */
|
|
373
|
+
return /* @__PURE__ */ jsx4(
|
|
366
374
|
"div",
|
|
367
375
|
{
|
|
368
376
|
"data-slot": "card",
|
|
369
377
|
className: cn(
|
|
370
|
-
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6
|
|
378
|
+
"bg-card text-card-foreground border-border flex flex-col gap-6 rounded-xl border py-6",
|
|
371
379
|
className
|
|
372
380
|
),
|
|
373
381
|
...props
|
|
@@ -375,8 +383,137 @@ function Card({ className, ...props }) {
|
|
|
375
383
|
);
|
|
376
384
|
}
|
|
377
385
|
|
|
386
|
+
// src/components/select.tsx
|
|
387
|
+
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
388
|
+
import { IconCheck as IconCheck2, IconChevronDown as IconChevronDown2, IconChevronUp } from "@tabler/icons-react";
|
|
389
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
390
|
+
function Select({
|
|
391
|
+
...props
|
|
392
|
+
}) {
|
|
393
|
+
return /* @__PURE__ */ jsx5(SelectPrimitive.Root, { "data-slot": "select", ...props });
|
|
394
|
+
}
|
|
395
|
+
function SelectValue({
|
|
396
|
+
...props
|
|
397
|
+
}) {
|
|
398
|
+
return /* @__PURE__ */ jsx5(SelectPrimitive.Value, { "data-slot": "select-value", ...props });
|
|
399
|
+
}
|
|
400
|
+
function SelectTrigger({
|
|
401
|
+
className,
|
|
402
|
+
size = "default",
|
|
403
|
+
children,
|
|
404
|
+
...props
|
|
405
|
+
}) {
|
|
406
|
+
return /* @__PURE__ */ jsxs5(
|
|
407
|
+
SelectPrimitive.Trigger,
|
|
408
|
+
{
|
|
409
|
+
"data-slot": "select-trigger",
|
|
410
|
+
"data-size": size,
|
|
411
|
+
className: cn(
|
|
412
|
+
"border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
413
|
+
className
|
|
414
|
+
),
|
|
415
|
+
...props,
|
|
416
|
+
children: [
|
|
417
|
+
children,
|
|
418
|
+
/* @__PURE__ */ jsx5(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx5(IconChevronDown2, { className: "size-4 opacity-50" }) })
|
|
419
|
+
]
|
|
420
|
+
}
|
|
421
|
+
);
|
|
422
|
+
}
|
|
423
|
+
function SelectContent({
|
|
424
|
+
className,
|
|
425
|
+
children,
|
|
426
|
+
position = "popper",
|
|
427
|
+
align = "center",
|
|
428
|
+
...props
|
|
429
|
+
}) {
|
|
430
|
+
return /* @__PURE__ */ jsx5(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs5(
|
|
431
|
+
SelectPrimitive.Content,
|
|
432
|
+
{
|
|
433
|
+
"data-slot": "select-content",
|
|
434
|
+
className: cn(
|
|
435
|
+
"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 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
|
|
436
|
+
position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
437
|
+
className
|
|
438
|
+
),
|
|
439
|
+
position,
|
|
440
|
+
align,
|
|
441
|
+
...props,
|
|
442
|
+
children: [
|
|
443
|
+
/* @__PURE__ */ jsx5(SelectScrollUpButton, {}),
|
|
444
|
+
/* @__PURE__ */ jsx5(
|
|
445
|
+
SelectPrimitive.Viewport,
|
|
446
|
+
{
|
|
447
|
+
className: cn(
|
|
448
|
+
"p-1",
|
|
449
|
+
position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
|
|
450
|
+
),
|
|
451
|
+
children
|
|
452
|
+
}
|
|
453
|
+
),
|
|
454
|
+
/* @__PURE__ */ jsx5(SelectScrollDownButton, {})
|
|
455
|
+
]
|
|
456
|
+
}
|
|
457
|
+
) });
|
|
458
|
+
}
|
|
459
|
+
function SelectItem({
|
|
460
|
+
className,
|
|
461
|
+
children,
|
|
462
|
+
...props
|
|
463
|
+
}) {
|
|
464
|
+
return /* @__PURE__ */ jsxs5(
|
|
465
|
+
SelectPrimitive.Item,
|
|
466
|
+
{
|
|
467
|
+
"data-slot": "select-item",
|
|
468
|
+
className: cn(
|
|
469
|
+
"focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
470
|
+
className
|
|
471
|
+
),
|
|
472
|
+
...props,
|
|
473
|
+
children: [
|
|
474
|
+
/* @__PURE__ */ jsx5("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx5(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx5(IconCheck2, { className: "size-4" }) }) }),
|
|
475
|
+
/* @__PURE__ */ jsx5(SelectPrimitive.ItemText, { children })
|
|
476
|
+
]
|
|
477
|
+
}
|
|
478
|
+
);
|
|
479
|
+
}
|
|
480
|
+
function SelectScrollUpButton({
|
|
481
|
+
className,
|
|
482
|
+
...props
|
|
483
|
+
}) {
|
|
484
|
+
return /* @__PURE__ */ jsx5(
|
|
485
|
+
SelectPrimitive.ScrollUpButton,
|
|
486
|
+
{
|
|
487
|
+
"data-slot": "select-scroll-up-button",
|
|
488
|
+
className: cn(
|
|
489
|
+
"flex cursor-default items-center justify-center py-1",
|
|
490
|
+
className
|
|
491
|
+
),
|
|
492
|
+
...props,
|
|
493
|
+
children: /* @__PURE__ */ jsx5(IconChevronUp, { className: "size-4" })
|
|
494
|
+
}
|
|
495
|
+
);
|
|
496
|
+
}
|
|
497
|
+
function SelectScrollDownButton({
|
|
498
|
+
className,
|
|
499
|
+
...props
|
|
500
|
+
}) {
|
|
501
|
+
return /* @__PURE__ */ jsx5(
|
|
502
|
+
SelectPrimitive.ScrollDownButton,
|
|
503
|
+
{
|
|
504
|
+
"data-slot": "select-scroll-down-button",
|
|
505
|
+
className: cn(
|
|
506
|
+
"flex cursor-default items-center justify-center py-1",
|
|
507
|
+
className
|
|
508
|
+
),
|
|
509
|
+
...props,
|
|
510
|
+
children: /* @__PURE__ */ jsx5(IconChevronDown2, { className: "size-4" })
|
|
511
|
+
}
|
|
512
|
+
);
|
|
513
|
+
}
|
|
514
|
+
|
|
378
515
|
// src/components/entity/entity-detail-header.tsx
|
|
379
|
-
import { jsx as jsx6, jsxs as
|
|
516
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
380
517
|
function EntityDetailHeader({
|
|
381
518
|
title,
|
|
382
519
|
icon,
|
|
@@ -408,6 +545,11 @@ function EntityDetailHeader({
|
|
|
408
545
|
};
|
|
409
546
|
useLayoutEffect(() => {
|
|
410
547
|
const updateTabs = () => {
|
|
548
|
+
if (typeof window !== "undefined" && !window.matchMedia("(min-width: 640px)").matches) {
|
|
549
|
+
setVisibleTabs(tabs);
|
|
550
|
+
setOverflowTabs([]);
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
411
553
|
if (!containerRef.current) {
|
|
412
554
|
return;
|
|
413
555
|
}
|
|
@@ -549,57 +691,73 @@ function EntityDetailHeader({
|
|
|
549
691
|
tab.value
|
|
550
692
|
);
|
|
551
693
|
};
|
|
552
|
-
return /* @__PURE__ */
|
|
553
|
-
/* @__PURE__ */
|
|
554
|
-
/* @__PURE__ */
|
|
555
|
-
/* @__PURE__ */
|
|
694
|
+
return /* @__PURE__ */ jsxs6("div", { className: cn("flex flex-col", className), children: [
|
|
695
|
+
/* @__PURE__ */ jsxs6(Card, { className: "overflow-hidden p-0 gap-0", children: [
|
|
696
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between gap-2 p-4 pb-2 ", children: [
|
|
697
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
|
|
556
698
|
backButton,
|
|
557
699
|
icon,
|
|
558
700
|
/* @__PURE__ */ jsx6("span", { className: "text-lg font-semibold", children: title })
|
|
559
701
|
] }),
|
|
560
702
|
actions && /* @__PURE__ */ jsx6("div", { className: "flex items-center gap-2", children: actions })
|
|
561
703
|
] }),
|
|
562
|
-
/* @__PURE__ */
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
(
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
{
|
|
573
|
-
ref: dropdownTriggerRef,
|
|
574
|
-
className: cn(
|
|
575
|
-
"relative z-10 flex items-center gap-1 px-4 py-3 text-sm font-medium transition-all duration-200",
|
|
576
|
-
"hover:bg-muted/60 rounded-t-md",
|
|
577
|
-
overflowTabs.some((tab) => tab.value === activeTab) ? "text-primary" : "text-muted-foreground hover:text-foreground"
|
|
578
|
-
),
|
|
579
|
-
children: [
|
|
580
|
-
"More",
|
|
581
|
-
/* @__PURE__ */ jsx6(IconChevronDown2, { className: "h-4 w-4" })
|
|
582
|
-
]
|
|
583
|
-
}
|
|
584
|
-
),
|
|
585
|
-
/* @__PURE__ */ jsx6(DropdownMenuContent, { align: "start", className: "min-w-40", children: overflowTabs.map(renderDropdownItem) })
|
|
586
|
-
] }),
|
|
587
|
-
/* @__PURE__ */ jsx6(
|
|
588
|
-
motion.div,
|
|
704
|
+
/* @__PURE__ */ jsxs6("div", { ref: containerRef, className: "w-full px-4", children: [
|
|
705
|
+
/* @__PURE__ */ jsx6("div", { className: "mb-3 w-full sm:hidden", children: /* @__PURE__ */ jsxs6(Select, { value: activeTab, onValueChange: handleTabChange, children: [
|
|
706
|
+
/* @__PURE__ */ jsxs6(SelectTrigger, { className: "h-9 w-full gap-2 [&>svg:first-child]:shrink-0", children: [
|
|
707
|
+
/* @__PURE__ */ jsx6(IconMenu2, { className: "size-4 text-muted-foreground" }),
|
|
708
|
+
/* @__PURE__ */ jsx6(SelectValue, {})
|
|
709
|
+
] }),
|
|
710
|
+
/* @__PURE__ */ jsx6(SelectContent, { children: tabs.map((tab) => /* @__PURE__ */ jsx6(SelectItem, { value: tab.value, children: tab.name }, tab.value)) })
|
|
711
|
+
] }) }),
|
|
712
|
+
/* @__PURE__ */ jsxs6(
|
|
713
|
+
"div",
|
|
589
714
|
{
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
715
|
+
ref: tabsListRef,
|
|
716
|
+
className: "relative hidden items-center sm:flex",
|
|
717
|
+
children: [
|
|
718
|
+
visibleTabs.map((tab) => {
|
|
719
|
+
const originalIndex = tabs.findIndex(
|
|
720
|
+
(t) => t.value === tab.value
|
|
721
|
+
);
|
|
722
|
+
return renderTab(tab, originalIndex);
|
|
723
|
+
}),
|
|
724
|
+
overflowTabs.length > 0 && /* @__PURE__ */ jsxs6(DropdownMenu, { children: [
|
|
725
|
+
/* @__PURE__ */ jsxs6(
|
|
726
|
+
DropdownMenuTrigger,
|
|
727
|
+
{
|
|
728
|
+
ref: dropdownTriggerRef,
|
|
729
|
+
className: cn(
|
|
730
|
+
"relative z-10 flex items-center gap-1 px-4 py-3 text-sm font-medium transition-all duration-200",
|
|
731
|
+
"hover:bg-muted/60 rounded-t-md",
|
|
732
|
+
overflowTabs.some((tab) => tab.value === activeTab) ? "text-primary" : "text-muted-foreground hover:text-foreground"
|
|
733
|
+
),
|
|
734
|
+
children: [
|
|
735
|
+
"More",
|
|
736
|
+
/* @__PURE__ */ jsx6(IconChevronDown3, { className: "h-4 w-4" })
|
|
737
|
+
]
|
|
738
|
+
}
|
|
739
|
+
),
|
|
740
|
+
/* @__PURE__ */ jsx6(DropdownMenuContent, { align: "start", className: "min-w-40", children: overflowTabs.map(renderDropdownItem) })
|
|
741
|
+
] }),
|
|
742
|
+
/* @__PURE__ */ jsx6(
|
|
743
|
+
motion.div,
|
|
744
|
+
{
|
|
745
|
+
className: "absolute bottom-0 left-0 z-20 h-0.5 bg-primary",
|
|
746
|
+
animate: {
|
|
747
|
+
left: underlineStyle.left,
|
|
748
|
+
width: underlineStyle.width
|
|
749
|
+
},
|
|
750
|
+
transition: {
|
|
751
|
+
type: "spring",
|
|
752
|
+
stiffness: 400,
|
|
753
|
+
damping: 40
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
)
|
|
757
|
+
]
|
|
600
758
|
}
|
|
601
759
|
)
|
|
602
|
-
] })
|
|
760
|
+
] })
|
|
603
761
|
] }),
|
|
604
762
|
activeTabData?.content && /* @__PURE__ */ jsx6("div", { className: "flex-1", children: activeTabData.content })
|
|
605
763
|
] });
|
|
@@ -611,7 +769,7 @@ import { useState as useState3 } from "react";
|
|
|
611
769
|
// src/components/sheet.tsx
|
|
612
770
|
import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
613
771
|
import { IconX } from "@tabler/icons-react";
|
|
614
|
-
import { jsx as jsx7, jsxs as
|
|
772
|
+
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
615
773
|
function Sheet({ ...props }) {
|
|
616
774
|
return /* @__PURE__ */ jsx7(SheetPrimitive.Root, { "data-slot": "sheet", ...props });
|
|
617
775
|
}
|
|
@@ -629,7 +787,7 @@ function SheetOverlay({
|
|
|
629
787
|
{
|
|
630
788
|
"data-slot": "sheet-overlay",
|
|
631
789
|
className: cn(
|
|
632
|
-
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-
|
|
790
|
+
"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))]",
|
|
633
791
|
className
|
|
634
792
|
),
|
|
635
793
|
...props
|
|
@@ -642,14 +800,14 @@ function SheetContent({
|
|
|
642
800
|
side = "right",
|
|
643
801
|
...props
|
|
644
802
|
}) {
|
|
645
|
-
return /* @__PURE__ */
|
|
803
|
+
return /* @__PURE__ */ jsxs7(SheetPortal, { children: [
|
|
646
804
|
/* @__PURE__ */ jsx7(SheetOverlay, {}),
|
|
647
|
-
/* @__PURE__ */
|
|
805
|
+
/* @__PURE__ */ jsxs7(
|
|
648
806
|
SheetPrimitive.Content,
|
|
649
807
|
{
|
|
650
808
|
"data-slot": "sheet-content",
|
|
651
809
|
className: cn(
|
|
652
|
-
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-
|
|
810
|
+
"bg-background text-foreground border-border data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=open]:opacity-100 fixed z-[51] flex min-w-0 flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
|
|
653
811
|
side === "right" && "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
|
|
654
812
|
side === "left" && "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",
|
|
655
813
|
side === "top" && "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",
|
|
@@ -659,7 +817,7 @@ function SheetContent({
|
|
|
659
817
|
...props,
|
|
660
818
|
children: [
|
|
661
819
|
children,
|
|
662
|
-
/* @__PURE__ */
|
|
820
|
+
/* @__PURE__ */ jsxs7(SheetPrimitive.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-secondary 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", children: [
|
|
663
821
|
/* @__PURE__ */ jsx7(IconX, { className: "size-4" }),
|
|
664
822
|
/* @__PURE__ */ jsx7("span", { className: "sr-only", children: "Close" })
|
|
665
823
|
] })
|
|
@@ -693,12 +851,12 @@ function SheetTitle({
|
|
|
693
851
|
}
|
|
694
852
|
|
|
695
853
|
// src/components/entity/entity-drawer.tsx
|
|
696
|
-
import { Fragment as Fragment2, jsx as jsx8, jsxs as
|
|
854
|
+
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
697
855
|
var sizeClasses = {
|
|
698
|
-
sm: "sm
|
|
699
|
-
md: "sm
|
|
700
|
-
lg: "sm
|
|
701
|
-
xl: "sm
|
|
856
|
+
sm: "w-full min-w-0 sm:!max-w-[24rem]",
|
|
857
|
+
md: "w-full min-w-0 sm:!max-w-[28rem]",
|
|
858
|
+
lg: "w-full min-w-0 sm:!max-w-[32rem]",
|
|
859
|
+
xl: "w-full min-w-0 sm:!max-w-[36rem]"
|
|
702
860
|
};
|
|
703
861
|
function EntityDrawer({
|
|
704
862
|
title,
|
|
@@ -721,11 +879,11 @@ function EntityDrawer({
|
|
|
721
879
|
setShowConfirm(false);
|
|
722
880
|
onClose();
|
|
723
881
|
};
|
|
724
|
-
return /* @__PURE__ */
|
|
725
|
-
/* @__PURE__ */ jsx8(Sheet, { open, onOpenChange: (isOpen) => !isOpen && handleClose(), children: /* @__PURE__ */
|
|
882
|
+
return /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
883
|
+
/* @__PURE__ */ jsx8(Sheet, { open, onOpenChange: (isOpen) => !isOpen && handleClose(), children: /* @__PURE__ */ jsxs8(
|
|
726
884
|
SheetContent,
|
|
727
885
|
{
|
|
728
|
-
className: `${sizeClasses[size]} flex flex-col p-0`,
|
|
886
|
+
className: `${sizeClasses[size]} flex min-h-0 flex-col overflow-hidden p-0`,
|
|
729
887
|
onInteractOutside: (e) => {
|
|
730
888
|
if (isDirty) {
|
|
731
889
|
e.preventDefault();
|
|
@@ -739,18 +897,18 @@ function EntityDrawer({
|
|
|
739
897
|
}
|
|
740
898
|
},
|
|
741
899
|
children: [
|
|
742
|
-
/* @__PURE__ */ jsx8(SheetHeader, { className: "border-b px-6 py-4", children: /* @__PURE__ */ jsx8(SheetTitle, { children: title }) }),
|
|
743
|
-
/* @__PURE__ */ jsx8("div", { className: "flex-1 overflow-y-auto px-6 py-4", children: form }),
|
|
744
|
-
/* @__PURE__ */ jsx8("div", { className: "border-t px-6 py-4", children: actions })
|
|
900
|
+
/* @__PURE__ */ jsx8(SheetHeader, { className: "border-border bg-background border-b px-6 py-4", children: /* @__PURE__ */ jsx8(SheetTitle, { children: title }) }),
|
|
901
|
+
/* @__PURE__ */ jsx8("div", { className: "bg-background flex-1 overflow-y-auto px-6 py-4", children: form }),
|
|
902
|
+
/* @__PURE__ */ jsx8("div", { className: "border-border bg-background border-t px-6 py-4", children: actions })
|
|
745
903
|
]
|
|
746
904
|
}
|
|
747
905
|
) }),
|
|
748
|
-
/* @__PURE__ */ jsx8(AlertDialog, { open: showConfirm, onOpenChange: setShowConfirm, children: /* @__PURE__ */
|
|
749
|
-
/* @__PURE__ */
|
|
906
|
+
/* @__PURE__ */ jsx8(AlertDialog, { open: showConfirm, onOpenChange: setShowConfirm, children: /* @__PURE__ */ jsxs8(AlertDialogContent, { children: [
|
|
907
|
+
/* @__PURE__ */ jsxs8(AlertDialogHeader, { children: [
|
|
750
908
|
/* @__PURE__ */ jsx8(AlertDialogTitle, { children: "Discard changes?" }),
|
|
751
909
|
/* @__PURE__ */ jsx8(AlertDialogDescription, { children: "You have unsaved changes. Are you sure you want to discard them?" })
|
|
752
910
|
] }),
|
|
753
|
-
/* @__PURE__ */
|
|
911
|
+
/* @__PURE__ */ jsxs8(AlertDialogFooter, { children: [
|
|
754
912
|
/* @__PURE__ */ jsx8(AlertDialogCancel, { children: "Cancel" }),
|
|
755
913
|
/* @__PURE__ */ jsx8(
|
|
756
914
|
AlertDialogAction,
|
|
@@ -768,7 +926,7 @@ function EntityDrawer({
|
|
|
768
926
|
// src/components/entity/entity-drawer-trigger.tsx
|
|
769
927
|
import { IconChevronRight as IconChevronRight2, IconPencil, IconPlus } from "@tabler/icons-react";
|
|
770
928
|
import { useState as useState4 } from "react";
|
|
771
|
-
import { Fragment as Fragment3, jsx as jsx9, jsxs as
|
|
929
|
+
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
772
930
|
function EntityDrawerTrigger({
|
|
773
931
|
mode,
|
|
774
932
|
entity,
|
|
@@ -798,19 +956,19 @@ function EntityDrawerTrigger({
|
|
|
798
956
|
}
|
|
799
957
|
};
|
|
800
958
|
const buttonLabel = label || (mode === "new" ? `New ${entity}` : `Edit ${entity}`);
|
|
801
|
-
return /* @__PURE__ */
|
|
959
|
+
return /* @__PURE__ */ jsxs9(Fragment3, { children: [
|
|
802
960
|
mode === "edit" && variant === "icon" && /* @__PURE__ */ jsx9(
|
|
803
961
|
Button,
|
|
804
962
|
{
|
|
805
963
|
variant: "ghost",
|
|
806
964
|
size: "icon",
|
|
807
|
-
className: `
|
|
965
|
+
className: `size-8 opacity-0 group-hover:opacity-100 transition-opacity ${className}`,
|
|
808
966
|
onClick: handleOpen,
|
|
809
967
|
disabled,
|
|
810
|
-
children: /* @__PURE__ */ jsx9(IconChevronRight2, { className: "
|
|
968
|
+
children: /* @__PURE__ */ jsx9(IconChevronRight2, { className: "size-4" })
|
|
811
969
|
}
|
|
812
970
|
),
|
|
813
|
-
mode === "edit" && variant !== "icon" && /* @__PURE__ */
|
|
971
|
+
mode === "edit" && variant !== "icon" && /* @__PURE__ */ jsx9(
|
|
814
972
|
Button,
|
|
815
973
|
{
|
|
816
974
|
variant: variant === "outline" ? "outline" : "default",
|
|
@@ -818,24 +976,23 @@ function EntityDrawerTrigger({
|
|
|
818
976
|
onClick: handleOpen,
|
|
819
977
|
disabled,
|
|
820
978
|
className,
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
buttonLabel
|
|
824
|
-
]
|
|
979
|
+
leftIcon: /* @__PURE__ */ jsx9(IconPencil, { className: "size-4" }),
|
|
980
|
+
children: buttonLabel
|
|
825
981
|
}
|
|
826
982
|
),
|
|
827
|
-
mode === "new" && /* @__PURE__ */
|
|
983
|
+
mode === "new" && /* @__PURE__ */ jsx9(
|
|
828
984
|
Button,
|
|
829
985
|
{
|
|
830
986
|
variant: variant === "outline" ? "outline" : "default",
|
|
831
987
|
size: "sm",
|
|
832
988
|
onClick: handleOpen,
|
|
833
989
|
disabled,
|
|
834
|
-
className
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
990
|
+
className: cn(
|
|
991
|
+
"max-sm:h-8 max-sm:w-8 max-sm:shrink-0 max-sm:justify-center max-sm:p-0",
|
|
992
|
+
className
|
|
993
|
+
),
|
|
994
|
+
leftIcon: /* @__PURE__ */ jsx9(IconPlus, { className: "size-4" }),
|
|
995
|
+
children: /* @__PURE__ */ jsx9("span", { className: "hidden sm:inline", children: buttonLabel })
|
|
839
996
|
}
|
|
840
997
|
),
|
|
841
998
|
open && children(open, handleClose)
|
|
@@ -941,7 +1098,7 @@ function EmptyContent({ className, ...props }) {
|
|
|
941
1098
|
}
|
|
942
1099
|
|
|
943
1100
|
// src/components/entity/entity-empty-state.tsx
|
|
944
|
-
import { jsx as jsx11, jsxs as
|
|
1101
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
945
1102
|
function EntityEmptyState({
|
|
946
1103
|
icon: Icon2 = IconPackage,
|
|
947
1104
|
title,
|
|
@@ -955,8 +1112,8 @@ function EntityEmptyState({
|
|
|
955
1112
|
const defaultTitle = `No ${entityName}s yet`;
|
|
956
1113
|
const defaultDescription = `Get started by creating your first ${entityName}.`;
|
|
957
1114
|
const defaultActionLabel = `Create ${entityName}`;
|
|
958
|
-
return /* @__PURE__ */
|
|
959
|
-
/* @__PURE__ */
|
|
1115
|
+
return /* @__PURE__ */ jsxs10(Empty, { className: cn("border py-12", className), children: [
|
|
1116
|
+
/* @__PURE__ */ jsxs10(EmptyHeader, { children: [
|
|
960
1117
|
/* @__PURE__ */ jsx11(EmptyMedia, { variant: "icon", children: /* @__PURE__ */ jsx11(Icon2, { className: "size-5" }) }),
|
|
961
1118
|
/* @__PURE__ */ jsx11(EmptyTitle, { children: title ?? defaultTitle }),
|
|
962
1119
|
/* @__PURE__ */ jsx11(EmptyDescription, { children: description ?? defaultDescription })
|
|
@@ -967,185 +1124,56 @@ function EntityEmptyState({
|
|
|
967
1124
|
|
|
968
1125
|
// src/components/entity/entity-filter.tsx
|
|
969
1126
|
import { IconFilter } from "@tabler/icons-react";
|
|
970
|
-
import { parseAsString, useQueryState } from "nuqs";
|
|
971
|
-
|
|
972
|
-
// src/components/select.tsx
|
|
973
|
-
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
974
|
-
import { IconCheck as IconCheck2, IconChevronDown as IconChevronDown3, IconChevronUp } from "@tabler/icons-react";
|
|
975
|
-
import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
976
|
-
function Select({
|
|
977
|
-
...props
|
|
978
|
-
}) {
|
|
979
|
-
return /* @__PURE__ */ jsx12(SelectPrimitive.Root, { "data-slot": "select", ...props });
|
|
980
|
-
}
|
|
981
|
-
function SelectValue({
|
|
982
|
-
...props
|
|
983
|
-
}) {
|
|
984
|
-
return /* @__PURE__ */ jsx12(SelectPrimitive.Value, { "data-slot": "select-value", ...props });
|
|
985
|
-
}
|
|
986
|
-
function SelectTrigger({
|
|
987
|
-
className,
|
|
988
|
-
size = "default",
|
|
989
|
-
children,
|
|
990
|
-
...props
|
|
991
|
-
}) {
|
|
992
|
-
return /* @__PURE__ */ jsxs9(
|
|
993
|
-
SelectPrimitive.Trigger,
|
|
994
|
-
{
|
|
995
|
-
"data-slot": "select-trigger",
|
|
996
|
-
"data-size": size,
|
|
997
|
-
className: cn(
|
|
998
|
-
"border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
999
|
-
className
|
|
1000
|
-
),
|
|
1001
|
-
...props,
|
|
1002
|
-
children: [
|
|
1003
|
-
children,
|
|
1004
|
-
/* @__PURE__ */ jsx12(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx12(IconChevronDown3, { className: "size-4 opacity-50" }) })
|
|
1005
|
-
]
|
|
1006
|
-
}
|
|
1007
|
-
);
|
|
1008
|
-
}
|
|
1009
|
-
function SelectContent({
|
|
1010
|
-
className,
|
|
1011
|
-
children,
|
|
1012
|
-
position = "popper",
|
|
1013
|
-
align = "center",
|
|
1014
|
-
...props
|
|
1015
|
-
}) {
|
|
1016
|
-
return /* @__PURE__ */ jsx12(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs9(
|
|
1017
|
-
SelectPrimitive.Content,
|
|
1018
|
-
{
|
|
1019
|
-
"data-slot": "select-content",
|
|
1020
|
-
className: cn(
|
|
1021
|
-
"bg-popover text-popover-foreground 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 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
|
|
1022
|
-
position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
1023
|
-
className
|
|
1024
|
-
),
|
|
1025
|
-
position,
|
|
1026
|
-
align,
|
|
1027
|
-
...props,
|
|
1028
|
-
children: [
|
|
1029
|
-
/* @__PURE__ */ jsx12(SelectScrollUpButton, {}),
|
|
1030
|
-
/* @__PURE__ */ jsx12(
|
|
1031
|
-
SelectPrimitive.Viewport,
|
|
1032
|
-
{
|
|
1033
|
-
className: cn(
|
|
1034
|
-
"p-1",
|
|
1035
|
-
position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
|
|
1036
|
-
),
|
|
1037
|
-
children
|
|
1038
|
-
}
|
|
1039
|
-
),
|
|
1040
|
-
/* @__PURE__ */ jsx12(SelectScrollDownButton, {})
|
|
1041
|
-
]
|
|
1042
|
-
}
|
|
1043
|
-
) });
|
|
1044
|
-
}
|
|
1045
|
-
function SelectItem({
|
|
1046
|
-
className,
|
|
1047
|
-
children,
|
|
1048
|
-
...props
|
|
1049
|
-
}) {
|
|
1050
|
-
return /* @__PURE__ */ jsxs9(
|
|
1051
|
-
SelectPrimitive.Item,
|
|
1052
|
-
{
|
|
1053
|
-
"data-slot": "select-item",
|
|
1054
|
-
className: cn(
|
|
1055
|
-
"focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
1056
|
-
className
|
|
1057
|
-
),
|
|
1058
|
-
...props,
|
|
1059
|
-
children: [
|
|
1060
|
-
/* @__PURE__ */ jsx12("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx12(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx12(IconCheck2, { className: "size-4" }) }) }),
|
|
1061
|
-
/* @__PURE__ */ jsx12(SelectPrimitive.ItemText, { children })
|
|
1062
|
-
]
|
|
1063
|
-
}
|
|
1064
|
-
);
|
|
1065
|
-
}
|
|
1066
|
-
function SelectScrollUpButton({
|
|
1067
|
-
className,
|
|
1068
|
-
...props
|
|
1069
|
-
}) {
|
|
1070
|
-
return /* @__PURE__ */ jsx12(
|
|
1071
|
-
SelectPrimitive.ScrollUpButton,
|
|
1072
|
-
{
|
|
1073
|
-
"data-slot": "select-scroll-up-button",
|
|
1074
|
-
className: cn(
|
|
1075
|
-
"flex cursor-default items-center justify-center py-1",
|
|
1076
|
-
className
|
|
1077
|
-
),
|
|
1078
|
-
...props,
|
|
1079
|
-
children: /* @__PURE__ */ jsx12(IconChevronUp, { className: "size-4" })
|
|
1080
|
-
}
|
|
1081
|
-
);
|
|
1082
|
-
}
|
|
1083
|
-
function SelectScrollDownButton({
|
|
1084
|
-
className,
|
|
1085
|
-
...props
|
|
1086
|
-
}) {
|
|
1087
|
-
return /* @__PURE__ */ jsx12(
|
|
1088
|
-
SelectPrimitive.ScrollDownButton,
|
|
1089
|
-
{
|
|
1090
|
-
"data-slot": "select-scroll-down-button",
|
|
1091
|
-
className: cn(
|
|
1092
|
-
"flex cursor-default items-center justify-center py-1",
|
|
1093
|
-
className
|
|
1094
|
-
),
|
|
1095
|
-
...props,
|
|
1096
|
-
children: /* @__PURE__ */ jsx12(IconChevronDown3, { className: "size-4" })
|
|
1097
|
-
}
|
|
1098
|
-
);
|
|
1099
|
-
}
|
|
1100
|
-
|
|
1101
|
-
// src/components/entity/entity-filter.tsx
|
|
1102
|
-
import { jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1127
|
+
import { parseAsInteger, parseAsString, useQueryState } from "nuqs";
|
|
1128
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1103
1129
|
function EntityFilter({
|
|
1104
|
-
paramKey = "filter",
|
|
1105
1130
|
options,
|
|
1106
1131
|
placeholder = "Filter",
|
|
1107
1132
|
className,
|
|
1108
1133
|
label
|
|
1109
1134
|
}) {
|
|
1110
|
-
const [
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
}
|
|
1129
|
-
|
|
1135
|
+
const [value, setValue] = useQueryState("filter", parseAsString);
|
|
1136
|
+
const [, setPage] = useQueryState("page", parseAsInteger.withDefault(1));
|
|
1137
|
+
const handleChange = (newValue) => {
|
|
1138
|
+
if (newValue === "__all__") {
|
|
1139
|
+
setValue(null);
|
|
1140
|
+
} else {
|
|
1141
|
+
setValue(newValue || null);
|
|
1142
|
+
}
|
|
1143
|
+
setPage(1);
|
|
1144
|
+
};
|
|
1145
|
+
const validOptions = options.filter((opt) => opt.value !== "");
|
|
1146
|
+
const displayValue = value || (options.some((opt) => opt.value === "") ? "__all__" : void 0);
|
|
1147
|
+
return /* @__PURE__ */ jsxs11("div", { className: cn("flex w-full items-center gap-2", className), children: [
|
|
1148
|
+
label && /* @__PURE__ */ jsx12("span", { className: "shrink-0 text-sm text-muted-foreground", children: label }),
|
|
1149
|
+
/* @__PURE__ */ jsx12("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsxs11(Select, { value: displayValue, onValueChange: handleChange, children: [
|
|
1150
|
+
/* @__PURE__ */ jsxs11(SelectTrigger, { className: "h-9 w-full min-w-[150px]", children: [
|
|
1151
|
+
/* @__PURE__ */ jsx12(IconFilter, { className: "size-4" }),
|
|
1152
|
+
/* @__PURE__ */ jsx12(SelectValue, { placeholder })
|
|
1153
|
+
] }),
|
|
1154
|
+
/* @__PURE__ */ jsxs11(SelectContent, { children: [
|
|
1155
|
+
options.some((opt) => opt.value === "") && /* @__PURE__ */ jsx12(SelectItem, { value: "__all__", children: options.find((opt) => opt.value === "")?.label || "All" }, "__all__"),
|
|
1156
|
+
validOptions.map((option) => /* @__PURE__ */ jsx12(SelectItem, { value: option.value, children: option.label }, option.value))
|
|
1157
|
+
] })
|
|
1158
|
+
] }) })
|
|
1130
1159
|
] });
|
|
1131
1160
|
}
|
|
1132
1161
|
|
|
1133
1162
|
// src/components/entity/entity-form-actions.tsx
|
|
1134
1163
|
import {
|
|
1135
|
-
|
|
1136
|
-
IconPlus as IconPlus2,
|
|
1164
|
+
IconDeviceFloppy,
|
|
1137
1165
|
IconRotateClockwise,
|
|
1138
1166
|
IconTrash as IconTrash2
|
|
1139
1167
|
} from "@tabler/icons-react";
|
|
1140
1168
|
|
|
1141
1169
|
// src/components/spinner.tsx
|
|
1142
1170
|
import { IconLoader2 } from "@tabler/icons-react";
|
|
1143
|
-
import { jsx as
|
|
1171
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1144
1172
|
function Spinner({
|
|
1145
1173
|
className,
|
|
1146
1174
|
...props
|
|
1147
1175
|
}) {
|
|
1148
|
-
return /* @__PURE__ */
|
|
1176
|
+
return /* @__PURE__ */ jsx13(
|
|
1149
1177
|
IconLoader2,
|
|
1150
1178
|
{
|
|
1151
1179
|
role: "status",
|
|
@@ -1157,7 +1185,7 @@ function Spinner({
|
|
|
1157
1185
|
}
|
|
1158
1186
|
|
|
1159
1187
|
// src/components/entity/entity-form-actions.tsx
|
|
1160
|
-
import { jsx as
|
|
1188
|
+
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1161
1189
|
function EntityFormActions({
|
|
1162
1190
|
mode,
|
|
1163
1191
|
onSubmit,
|
|
@@ -1173,22 +1201,18 @@ function EntityFormActions({
|
|
|
1173
1201
|
}) {
|
|
1174
1202
|
const defaultSubmitLabel = mode === "new" ? "Create" : "Update";
|
|
1175
1203
|
const label = submitLabel || defaultSubmitLabel;
|
|
1176
|
-
return /* @__PURE__ */
|
|
1177
|
-
onSubmit && /* @__PURE__ */
|
|
1204
|
+
return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-3", children: [
|
|
1205
|
+
onSubmit && /* @__PURE__ */ jsx14(
|
|
1178
1206
|
Button,
|
|
1179
1207
|
{
|
|
1180
1208
|
onClick: onSubmit,
|
|
1181
1209
|
disabled: disabled || isSubmitting,
|
|
1182
1210
|
className: "cursor-pointer",
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
!isSubmitting && mode === "new" && /* @__PURE__ */ jsx15(IconPlus2, { className: "mr-2 h-4 w-4" }),
|
|
1186
|
-
!isSubmitting && mode === "edit" && /* @__PURE__ */ jsx15(IconCheck3, { className: "mr-2 h-4 w-4" }),
|
|
1187
|
-
label
|
|
1188
|
-
]
|
|
1211
|
+
leftIcon: isSubmitting ? /* @__PURE__ */ jsx14(Spinner, { className: "size-4" }) : /* @__PURE__ */ jsx14(IconDeviceFloppy, { className: "size-4" }),
|
|
1212
|
+
children: label
|
|
1189
1213
|
}
|
|
1190
1214
|
),
|
|
1191
|
-
mode === "new" && onReset && /* @__PURE__ */
|
|
1215
|
+
mode === "new" && onReset && /* @__PURE__ */ jsxs12(
|
|
1192
1216
|
Button,
|
|
1193
1217
|
{
|
|
1194
1218
|
variant: "outline",
|
|
@@ -1196,37 +1220,34 @@ function EntityFormActions({
|
|
|
1196
1220
|
disabled,
|
|
1197
1221
|
className: "cursor-pointer",
|
|
1198
1222
|
children: [
|
|
1199
|
-
/* @__PURE__ */
|
|
1223
|
+
/* @__PURE__ */ jsx14(IconRotateClockwise, { className: " h-4 w-4" }),
|
|
1200
1224
|
"Reset"
|
|
1201
1225
|
]
|
|
1202
1226
|
}
|
|
1203
1227
|
),
|
|
1204
|
-
mode === "edit" && onDelete && /* @__PURE__ */
|
|
1205
|
-
/* @__PURE__ */
|
|
1228
|
+
mode === "edit" && onDelete && /* @__PURE__ */ jsxs12(AlertDialog, { children: [
|
|
1229
|
+
/* @__PURE__ */ jsx14(AlertDialogTrigger, { asChild: true, children: /* @__PURE__ */ jsx14(
|
|
1206
1230
|
Button,
|
|
1207
1231
|
{
|
|
1208
1232
|
variant: "destructive",
|
|
1209
1233
|
disabled: disabled || isDeleting,
|
|
1210
1234
|
className: "cursor-pointer",
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
/* @__PURE__ */ jsx15(IconTrash2, { className: "mr-2 h-4 w-4" }),
|
|
1214
|
-
deleteLabel
|
|
1215
|
-
]
|
|
1235
|
+
leftIcon: isDeleting ? /* @__PURE__ */ jsx14(Spinner, { className: "size-4" }) : /* @__PURE__ */ jsx14(IconTrash2, { className: "size-4" }),
|
|
1236
|
+
children: deleteLabel
|
|
1216
1237
|
}
|
|
1217
1238
|
) }),
|
|
1218
|
-
/* @__PURE__ */
|
|
1219
|
-
/* @__PURE__ */
|
|
1220
|
-
/* @__PURE__ */
|
|
1221
|
-
/* @__PURE__ */
|
|
1239
|
+
/* @__PURE__ */ jsxs12(AlertDialogContent, { children: [
|
|
1240
|
+
/* @__PURE__ */ jsxs12(AlertDialogHeader, { children: [
|
|
1241
|
+
/* @__PURE__ */ jsx14(AlertDialogTitle, { children: "Are you sure?" }),
|
|
1242
|
+
/* @__PURE__ */ jsxs12(AlertDialogDescription, { children: [
|
|
1222
1243
|
"This will permanently delete this ",
|
|
1223
1244
|
itemName,
|
|
1224
1245
|
". This action cannot be undone."
|
|
1225
1246
|
] })
|
|
1226
1247
|
] }),
|
|
1227
|
-
/* @__PURE__ */
|
|
1228
|
-
/* @__PURE__ */
|
|
1229
|
-
/* @__PURE__ */
|
|
1248
|
+
/* @__PURE__ */ jsxs12(AlertDialogFooter, { children: [
|
|
1249
|
+
/* @__PURE__ */ jsx14(AlertDialogCancel, { children: "Cancel" }),
|
|
1250
|
+
/* @__PURE__ */ jsx14(
|
|
1230
1251
|
AlertDialogAction,
|
|
1231
1252
|
{
|
|
1232
1253
|
onClick: onDelete,
|
|
@@ -1237,7 +1258,7 @@ function EntityFormActions({
|
|
|
1237
1258
|
] })
|
|
1238
1259
|
] })
|
|
1239
1260
|
] }),
|
|
1240
|
-
onCancel && /* @__PURE__ */
|
|
1261
|
+
onCancel && /* @__PURE__ */ jsx14(
|
|
1241
1262
|
Button,
|
|
1242
1263
|
{
|
|
1243
1264
|
variant: "ghost",
|
|
@@ -1251,7 +1272,9 @@ function EntityFormActions({
|
|
|
1251
1272
|
}
|
|
1252
1273
|
|
|
1253
1274
|
// src/components/entity/entity-header.tsx
|
|
1254
|
-
import {
|
|
1275
|
+
import { IconChevronDown as IconChevronDown4, IconChevronUp as IconChevronUp2 } from "@tabler/icons-react";
|
|
1276
|
+
import { useState as useState5 } from "react";
|
|
1277
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1255
1278
|
function EntityHeader({
|
|
1256
1279
|
title,
|
|
1257
1280
|
icon,
|
|
@@ -1261,29 +1284,55 @@ function EntityHeader({
|
|
|
1261
1284
|
sort,
|
|
1262
1285
|
view
|
|
1263
1286
|
}) {
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1287
|
+
const [toolbarOpen, setToolbarOpen] = useState5(false);
|
|
1288
|
+
const hasToolbar = [search, filter, sort, view].some(Boolean);
|
|
1289
|
+
return /* @__PURE__ */ jsx15(Card, { className: "p-4", children: /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-4", children: [
|
|
1290
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between", children: [
|
|
1291
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
|
|
1267
1292
|
icon,
|
|
1268
|
-
/* @__PURE__ */
|
|
1293
|
+
/* @__PURE__ */ jsx15("span", { className: "text-lg font-semibold", children: title })
|
|
1269
1294
|
] }),
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1295
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-3", children: [
|
|
1296
|
+
actions,
|
|
1297
|
+
hasToolbar && /* @__PURE__ */ jsx15(
|
|
1298
|
+
Button,
|
|
1299
|
+
{
|
|
1300
|
+
variant: "secondary",
|
|
1301
|
+
size: "icon-sm",
|
|
1302
|
+
className: "md:hidden",
|
|
1303
|
+
onClick: () => setToolbarOpen((o) => !o),
|
|
1304
|
+
"aria-expanded": toolbarOpen,
|
|
1305
|
+
"aria-label": toolbarOpen ? "Hide filters" : "Show filters",
|
|
1306
|
+
children: toolbarOpen ? /* @__PURE__ */ jsx15(IconChevronUp2, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx15(IconChevronDown4, { className: "h-4 w-4" })
|
|
1307
|
+
}
|
|
1308
|
+
)
|
|
1278
1309
|
] })
|
|
1279
|
-
] })
|
|
1310
|
+
] }),
|
|
1311
|
+
hasToolbar && /* @__PURE__ */ jsxs13(
|
|
1312
|
+
"div",
|
|
1313
|
+
{
|
|
1314
|
+
className: cn(
|
|
1315
|
+
"flex flex-col gap-2 md:flex-row md:items-center md:gap-2 md:justify-between",
|
|
1316
|
+
!toolbarOpen && "hidden",
|
|
1317
|
+
"md:flex"
|
|
1318
|
+
),
|
|
1319
|
+
children: [
|
|
1320
|
+
/* @__PURE__ */ jsx15("div", { className: "w-full min-w-0 flex-1 md:min-w-[12rem]", children: search }),
|
|
1321
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex w-full shrink-0 flex-col gap-2 *:w-full md:w-auto md:flex-row md:items-center md:gap-2 md:*:w-auto", children: [
|
|
1322
|
+
filter,
|
|
1323
|
+
sort,
|
|
1324
|
+
view
|
|
1325
|
+
] })
|
|
1326
|
+
]
|
|
1327
|
+
}
|
|
1328
|
+
)
|
|
1280
1329
|
] }) });
|
|
1281
1330
|
}
|
|
1282
1331
|
|
|
1283
1332
|
// src/components/skeleton.tsx
|
|
1284
|
-
import { jsx as
|
|
1333
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1285
1334
|
function Skeleton({ className, ...props }) {
|
|
1286
|
-
return /* @__PURE__ */
|
|
1335
|
+
return /* @__PURE__ */ jsx16(
|
|
1287
1336
|
"div",
|
|
1288
1337
|
{
|
|
1289
1338
|
"data-slot": "skeleton",
|
|
@@ -1294,18 +1343,18 @@ function Skeleton({ className, ...props }) {
|
|
|
1294
1343
|
}
|
|
1295
1344
|
|
|
1296
1345
|
// src/components/table.tsx
|
|
1297
|
-
import { jsx as
|
|
1346
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
1298
1347
|
function Table({ className, ...props }) {
|
|
1299
|
-
return /* @__PURE__ */
|
|
1348
|
+
return /* @__PURE__ */ jsx17(
|
|
1300
1349
|
"div",
|
|
1301
1350
|
{
|
|
1302
1351
|
"data-slot": "table-container",
|
|
1303
1352
|
className: "relative w-full overflow-x-auto",
|
|
1304
|
-
children: /* @__PURE__ */
|
|
1353
|
+
children: /* @__PURE__ */ jsx17(
|
|
1305
1354
|
"table",
|
|
1306
1355
|
{
|
|
1307
1356
|
"data-slot": "table",
|
|
1308
|
-
className: cn("w-full caption-bottom text-sm", className),
|
|
1357
|
+
className: cn("w-full caption-bottom text-sm px-2", className),
|
|
1309
1358
|
...props
|
|
1310
1359
|
}
|
|
1311
1360
|
)
|
|
@@ -1313,7 +1362,7 @@ function Table({ className, ...props }) {
|
|
|
1313
1362
|
);
|
|
1314
1363
|
}
|
|
1315
1364
|
function TableHeader({ className, ...props }) {
|
|
1316
|
-
return /* @__PURE__ */
|
|
1365
|
+
return /* @__PURE__ */ jsx17(
|
|
1317
1366
|
"thead",
|
|
1318
1367
|
{
|
|
1319
1368
|
"data-slot": "table-header",
|
|
@@ -1323,7 +1372,7 @@ function TableHeader({ className, ...props }) {
|
|
|
1323
1372
|
);
|
|
1324
1373
|
}
|
|
1325
1374
|
function TableBody({ className, ...props }) {
|
|
1326
|
-
return /* @__PURE__ */
|
|
1375
|
+
return /* @__PURE__ */ jsx17(
|
|
1327
1376
|
"tbody",
|
|
1328
1377
|
{
|
|
1329
1378
|
"data-slot": "table-body",
|
|
@@ -1333,7 +1382,7 @@ function TableBody({ className, ...props }) {
|
|
|
1333
1382
|
);
|
|
1334
1383
|
}
|
|
1335
1384
|
function TableRow({ className, ...props }) {
|
|
1336
|
-
return /* @__PURE__ */
|
|
1385
|
+
return /* @__PURE__ */ jsx17(
|
|
1337
1386
|
"tr",
|
|
1338
1387
|
{
|
|
1339
1388
|
"data-slot": "table-row",
|
|
@@ -1346,7 +1395,7 @@ function TableRow({ className, ...props }) {
|
|
|
1346
1395
|
);
|
|
1347
1396
|
}
|
|
1348
1397
|
function TableHead({ className, ...props }) {
|
|
1349
|
-
return /* @__PURE__ */
|
|
1398
|
+
return /* @__PURE__ */ jsx17(
|
|
1350
1399
|
"th",
|
|
1351
1400
|
{
|
|
1352
1401
|
"data-slot": "table-head",
|
|
@@ -1359,7 +1408,7 @@ function TableHead({ className, ...props }) {
|
|
|
1359
1408
|
);
|
|
1360
1409
|
}
|
|
1361
1410
|
function TableCell({ className, ...props }) {
|
|
1362
|
-
return /* @__PURE__ */
|
|
1411
|
+
return /* @__PURE__ */ jsx17(
|
|
1363
1412
|
"td",
|
|
1364
1413
|
{
|
|
1365
1414
|
"data-slot": "table-cell",
|
|
@@ -1373,7 +1422,7 @@ function TableCell({ className, ...props }) {
|
|
|
1373
1422
|
}
|
|
1374
1423
|
|
|
1375
1424
|
// src/components/entity/entity-loading-state.tsx
|
|
1376
|
-
import { jsx as
|
|
1425
|
+
import { jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1377
1426
|
function EntityLoadingState({
|
|
1378
1427
|
view,
|
|
1379
1428
|
rowCount = 5,
|
|
@@ -1382,45 +1431,52 @@ function EntityLoadingState({
|
|
|
1382
1431
|
className
|
|
1383
1432
|
}) {
|
|
1384
1433
|
if (view === "table") {
|
|
1385
|
-
return /* @__PURE__ */
|
|
1386
|
-
/* @__PURE__ */
|
|
1387
|
-
/* @__PURE__ */
|
|
1434
|
+
return /* @__PURE__ */ jsx18("div", { className: cn("rounded-md border", className), children: /* @__PURE__ */ jsxs14(Table, { children: [
|
|
1435
|
+
/* @__PURE__ */ jsx18(TableHeader, { children: /* @__PURE__ */ jsx18(TableRow, { children: Array.from({ length: columnCount }).map((_, i) => /* @__PURE__ */ jsx18(TableHead, { children: /* @__PURE__ */ jsx18(Skeleton, { className: "h-4 w-24" }) }, `header-${i}`)) }) }),
|
|
1436
|
+
/* @__PURE__ */ jsx18(TableBody, { children: Array.from({ length: rowCount }).map((_, rowIndex) => /* @__PURE__ */ jsx18(TableRow, { children: Array.from({ length: columnCount }).map((_2, colIndex) => /* @__PURE__ */ jsx18(TableCell, { children: /* @__PURE__ */ jsx18(Skeleton, { className: "h-4 w-full" }) }, `cell-${rowIndex}-${colIndex}`)) }, `row-${rowIndex}`)) })
|
|
1388
1437
|
] }) });
|
|
1389
1438
|
}
|
|
1390
|
-
return /* @__PURE__ */
|
|
1439
|
+
return /* @__PURE__ */ jsx18(
|
|
1391
1440
|
"div",
|
|
1392
1441
|
{
|
|
1393
1442
|
className: cn(
|
|
1394
1443
|
"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",
|
|
1395
1444
|
className
|
|
1396
1445
|
),
|
|
1397
|
-
children: Array.from({ length: cardCount }).map((_, i) => /* @__PURE__ */
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1446
|
+
children: Array.from({ length: cardCount }).map((_, i) => /* @__PURE__ */ jsxs14(
|
|
1447
|
+
"div",
|
|
1448
|
+
{
|
|
1449
|
+
className: "border-border space-y-3 rounded-lg border p-4",
|
|
1450
|
+
children: [
|
|
1451
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2", children: [
|
|
1452
|
+
/* @__PURE__ */ jsx18(Skeleton, { className: "h-4 w-4 rounded-full" }),
|
|
1453
|
+
/* @__PURE__ */ jsx18(Skeleton, { className: "h-5 w-32" })
|
|
1454
|
+
] }),
|
|
1455
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex gap-2", children: [
|
|
1456
|
+
/* @__PURE__ */ jsx18(Skeleton, { className: "h-5 w-16" }),
|
|
1457
|
+
/* @__PURE__ */ jsx18(Skeleton, { className: "h-5 w-16" })
|
|
1458
|
+
] }),
|
|
1459
|
+
/* @__PURE__ */ jsx18(Skeleton, { className: "h-4 w-full" }),
|
|
1460
|
+
/* @__PURE__ */ jsx18(Skeleton, { className: "h-4 w-3/4" }),
|
|
1461
|
+
/* @__PURE__ */ jsx18(Skeleton, { className: "h-3 w-24" })
|
|
1462
|
+
]
|
|
1463
|
+
},
|
|
1464
|
+
`card-${i}`
|
|
1465
|
+
))
|
|
1410
1466
|
}
|
|
1411
1467
|
);
|
|
1412
1468
|
}
|
|
1413
1469
|
|
|
1414
1470
|
// src/components/entity/entity-search.tsx
|
|
1415
1471
|
import { IconSearch, IconX as IconX2 } from "@tabler/icons-react";
|
|
1416
|
-
import { parseAsString as parseAsString2, useQueryState as useQueryState2 } from "nuqs";
|
|
1472
|
+
import { parseAsInteger as parseAsInteger2, parseAsString as parseAsString2, useQueryState as useQueryState2 } from "nuqs";
|
|
1417
1473
|
import { useRef as useRef2 } from "react";
|
|
1418
1474
|
import { useDebouncedCallback } from "use-debounce";
|
|
1419
1475
|
|
|
1420
1476
|
// src/components/input.tsx
|
|
1421
|
-
import { jsx as
|
|
1477
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
1422
1478
|
function Input({ className, type, ...props }) {
|
|
1423
|
-
return /* @__PURE__ */
|
|
1479
|
+
return /* @__PURE__ */ jsx19(
|
|
1424
1480
|
"input",
|
|
1425
1481
|
{
|
|
1426
1482
|
type,
|
|
@@ -1437,45 +1493,48 @@ function Input({ className, type, ...props }) {
|
|
|
1437
1493
|
}
|
|
1438
1494
|
|
|
1439
1495
|
// src/components/entity/entity-search.tsx
|
|
1440
|
-
import { jsx as
|
|
1496
|
+
import { jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1441
1497
|
function EntitySearch({
|
|
1442
1498
|
paramKey = "search",
|
|
1443
1499
|
placeholder = "Search...",
|
|
1444
1500
|
className
|
|
1445
1501
|
}) {
|
|
1446
|
-
const
|
|
1447
|
-
const [search, setSearch] = useQueryState2(
|
|
1502
|
+
const [value, setValue] = useQueryState2(
|
|
1448
1503
|
paramKey,
|
|
1449
|
-
parseAsString2.withDefault("")
|
|
1504
|
+
parseAsString2.withDefault("")
|
|
1450
1505
|
);
|
|
1506
|
+
const [, setPage] = useQueryState2("page", parseAsInteger2.withDefault(1));
|
|
1507
|
+
const ref = useRef2(null);
|
|
1451
1508
|
const handleSearch = useDebouncedCallback((term) => {
|
|
1452
|
-
|
|
1509
|
+
setValue(term || null);
|
|
1510
|
+
setPage(1);
|
|
1453
1511
|
}, 300);
|
|
1454
1512
|
const handleClear = () => {
|
|
1455
|
-
|
|
1513
|
+
setValue(null);
|
|
1514
|
+
setPage(1);
|
|
1456
1515
|
if (ref.current) {
|
|
1457
1516
|
ref.current.value = "";
|
|
1458
1517
|
}
|
|
1459
1518
|
};
|
|
1460
|
-
return /* @__PURE__ */
|
|
1461
|
-
/* @__PURE__ */
|
|
1462
|
-
/* @__PURE__ */
|
|
1519
|
+
return /* @__PURE__ */ jsxs15("div", { className: cn("relative w-full min-w-0", className), children: [
|
|
1520
|
+
/* @__PURE__ */ jsx20(IconSearch, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
1521
|
+
/* @__PURE__ */ jsx20(
|
|
1463
1522
|
Input,
|
|
1464
1523
|
{
|
|
1465
1524
|
ref,
|
|
1466
1525
|
placeholder,
|
|
1467
|
-
defaultValue:
|
|
1526
|
+
defaultValue: value,
|
|
1468
1527
|
onChange: (e) => handleSearch(e.target.value),
|
|
1469
|
-
className: "pl-9 pr-9"
|
|
1528
|
+
className: "w-full min-w-0 pl-9 pr-9"
|
|
1470
1529
|
}
|
|
1471
1530
|
),
|
|
1472
|
-
|
|
1531
|
+
value && /* @__PURE__ */ jsx20(
|
|
1473
1532
|
"button",
|
|
1474
1533
|
{
|
|
1475
1534
|
type: "button",
|
|
1476
1535
|
onClick: handleClear,
|
|
1477
1536
|
className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",
|
|
1478
|
-
children: /* @__PURE__ */
|
|
1537
|
+
children: /* @__PURE__ */ jsx20(IconX2, { className: "h-4 w-4" })
|
|
1479
1538
|
}
|
|
1480
1539
|
)
|
|
1481
1540
|
] });
|
|
@@ -1486,39 +1545,44 @@ import {
|
|
|
1486
1545
|
IconSortAscendingLetters,
|
|
1487
1546
|
IconSortDescendingLetters
|
|
1488
1547
|
} from "@tabler/icons-react";
|
|
1489
|
-
import { parseAsString as parseAsString3, useQueryState as useQueryState3 } from "nuqs";
|
|
1490
|
-
import { jsx as
|
|
1548
|
+
import { parseAsInteger as parseAsInteger3, parseAsString as parseAsString3, useQueryState as useQueryState3 } from "nuqs";
|
|
1549
|
+
import { jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1491
1550
|
function EntitySort({
|
|
1492
|
-
sortKey = "sort",
|
|
1493
|
-
orderKey = "order",
|
|
1494
1551
|
options,
|
|
1495
|
-
defaultSort,
|
|
1552
|
+
defaultSort = "createdAt",
|
|
1553
|
+
defaultOrder = "desc",
|
|
1496
1554
|
className
|
|
1497
1555
|
}) {
|
|
1498
1556
|
const [sort, setSort] = useQueryState3(
|
|
1499
|
-
|
|
1500
|
-
parseAsString3.withDefault(defaultSort
|
|
1557
|
+
"sort",
|
|
1558
|
+
parseAsString3.withDefault(defaultSort)
|
|
1501
1559
|
);
|
|
1502
1560
|
const [order, setOrder] = useQueryState3(
|
|
1503
|
-
|
|
1504
|
-
parseAsString3.withDefault(
|
|
1561
|
+
"order",
|
|
1562
|
+
parseAsString3.withDefault(defaultOrder)
|
|
1505
1563
|
);
|
|
1564
|
+
const [, setPage] = useQueryState3("page", parseAsInteger3.withDefault(1));
|
|
1565
|
+
const handleSortChange = (value) => {
|
|
1566
|
+
setSort(value);
|
|
1567
|
+
setPage(1);
|
|
1568
|
+
};
|
|
1506
1569
|
const toggleOrder = () => {
|
|
1507
1570
|
setOrder(order === "asc" ? "desc" : "asc");
|
|
1571
|
+
setPage(1);
|
|
1508
1572
|
};
|
|
1509
|
-
return /* @__PURE__ */
|
|
1510
|
-
/* @__PURE__ */
|
|
1511
|
-
/* @__PURE__ */
|
|
1512
|
-
/* @__PURE__ */
|
|
1513
|
-
] }),
|
|
1514
|
-
/* @__PURE__ */
|
|
1573
|
+
return /* @__PURE__ */ jsxs16("div", { className: cn("flex w-full items-center gap-0", className), children: [
|
|
1574
|
+
/* @__PURE__ */ jsx21("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsxs16(Select, { value: sort, onValueChange: handleSortChange, children: [
|
|
1575
|
+
/* @__PURE__ */ jsx21(SelectTrigger, { className: "h-9 w-full min-w-[150px] rounded-r-none border-r-0", children: /* @__PURE__ */ jsx21(SelectValue, { placeholder: "Sort by" }) }),
|
|
1576
|
+
/* @__PURE__ */ jsx21(SelectContent, { children: options.map((option) => /* @__PURE__ */ jsx21(SelectItem, { value: option.value, children: option.label }, option.value)) })
|
|
1577
|
+
] }) }),
|
|
1578
|
+
/* @__PURE__ */ jsx21(
|
|
1515
1579
|
Button,
|
|
1516
1580
|
{
|
|
1517
1581
|
variant: "outline",
|
|
1518
1582
|
size: "icon",
|
|
1519
|
-
className: "h-9 rounded-l-none",
|
|
1583
|
+
className: "h-9 shrink-0 rounded-l-none",
|
|
1520
1584
|
onClick: toggleOrder,
|
|
1521
|
-
children: order === "asc" ? /* @__PURE__ */
|
|
1585
|
+
children: order === "asc" ? /* @__PURE__ */ jsx21(IconSortAscendingLetters, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx21(IconSortDescendingLetters, { className: "h-4 w-4" })
|
|
1522
1586
|
}
|
|
1523
1587
|
)
|
|
1524
1588
|
] });
|
|
@@ -1531,7 +1595,7 @@ import { parseAsString as parseAsString4, useQueryState as useQueryState4 } from
|
|
|
1531
1595
|
// src/components/toggle.tsx
|
|
1532
1596
|
import * as TogglePrimitive from "@radix-ui/react-toggle";
|
|
1533
1597
|
import { cva as cva3 } from "class-variance-authority";
|
|
1534
|
-
import { jsx as
|
|
1598
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
1535
1599
|
var toggleVariants = cva3(
|
|
1536
1600
|
"inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",
|
|
1537
1601
|
{
|
|
@@ -1556,7 +1620,7 @@ var toggleVariants = cva3(
|
|
|
1556
1620
|
// src/components/toggle-group.tsx
|
|
1557
1621
|
import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group";
|
|
1558
1622
|
import * as React from "react";
|
|
1559
|
-
import { jsx as
|
|
1623
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
1560
1624
|
var ToggleGroupContext = React.createContext({
|
|
1561
1625
|
size: "default",
|
|
1562
1626
|
variant: "default",
|
|
@@ -1570,7 +1634,7 @@ function ToggleGroup({
|
|
|
1570
1634
|
children,
|
|
1571
1635
|
...props
|
|
1572
1636
|
}) {
|
|
1573
|
-
return /* @__PURE__ */
|
|
1637
|
+
return /* @__PURE__ */ jsx23(
|
|
1574
1638
|
ToggleGroupPrimitive.Root,
|
|
1575
1639
|
{
|
|
1576
1640
|
"data-slot": "toggle-group",
|
|
@@ -1583,7 +1647,7 @@ function ToggleGroup({
|
|
|
1583
1647
|
className
|
|
1584
1648
|
),
|
|
1585
1649
|
...props,
|
|
1586
|
-
children: /* @__PURE__ */
|
|
1650
|
+
children: /* @__PURE__ */ jsx23(ToggleGroupContext.Provider, { value: { variant, size, spacing }, children })
|
|
1587
1651
|
}
|
|
1588
1652
|
);
|
|
1589
1653
|
}
|
|
@@ -1595,7 +1659,7 @@ function ToggleGroupItem({
|
|
|
1595
1659
|
...props
|
|
1596
1660
|
}) {
|
|
1597
1661
|
const context = React.useContext(ToggleGroupContext);
|
|
1598
|
-
return /* @__PURE__ */
|
|
1662
|
+
return /* @__PURE__ */ jsx23(
|
|
1599
1663
|
ToggleGroupPrimitive.Item,
|
|
1600
1664
|
{
|
|
1601
1665
|
"data-slot": "toggle-group-item",
|
|
@@ -1618,35 +1682,33 @@ function ToggleGroupItem({
|
|
|
1618
1682
|
}
|
|
1619
1683
|
|
|
1620
1684
|
// src/components/entity/entity-view-toggle.tsx
|
|
1621
|
-
import { jsx as
|
|
1685
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
1622
1686
|
var viewIcons = {
|
|
1623
|
-
table: /* @__PURE__ */
|
|
1624
|
-
card: /* @__PURE__ */
|
|
1625
|
-
list: /* @__PURE__ */
|
|
1687
|
+
table: /* @__PURE__ */ jsx24(IconTable, { className: "h-4 w-4" }),
|
|
1688
|
+
card: /* @__PURE__ */ jsx24(IconGridDots, { className: "h-4 w-4" }),
|
|
1689
|
+
list: /* @__PURE__ */ jsx24(IconList, { className: "h-4 w-4" })
|
|
1626
1690
|
};
|
|
1627
1691
|
function EntityViewToggle({
|
|
1628
|
-
paramKey = "view",
|
|
1629
|
-
defaultView = "table",
|
|
1630
1692
|
views = ["table", "card"],
|
|
1631
1693
|
className
|
|
1632
1694
|
}) {
|
|
1633
|
-
const [
|
|
1634
|
-
|
|
1635
|
-
parseAsString4.withDefault(
|
|
1695
|
+
const [value, setValue] = useQueryState4(
|
|
1696
|
+
"view",
|
|
1697
|
+
parseAsString4.withDefault("table")
|
|
1636
1698
|
);
|
|
1637
|
-
return /* @__PURE__ */
|
|
1699
|
+
return /* @__PURE__ */ jsx24(
|
|
1638
1700
|
ToggleGroup,
|
|
1639
1701
|
{
|
|
1640
1702
|
type: "single",
|
|
1641
|
-
value
|
|
1642
|
-
onValueChange: (
|
|
1643
|
-
className: cn("border rounded-md", className),
|
|
1644
|
-
children: views.map((v) => /* @__PURE__ */
|
|
1703
|
+
value,
|
|
1704
|
+
onValueChange: (v) => v && setValue(v),
|
|
1705
|
+
className: cn("w-full! border rounded-md md:w-auto!", className),
|
|
1706
|
+
children: views.map((v) => /* @__PURE__ */ jsx24(
|
|
1645
1707
|
ToggleGroupItem,
|
|
1646
1708
|
{
|
|
1647
1709
|
value: v,
|
|
1648
1710
|
"aria-label": `${v} view`,
|
|
1649
|
-
className: "h-9 px-3",
|
|
1711
|
+
className: "h-9 min-w-0 flex-1 px-3",
|
|
1650
1712
|
children: viewIcons[v]
|
|
1651
1713
|
},
|
|
1652
1714
|
v
|
|
@@ -1654,6 +1716,67 @@ function EntityViewToggle({
|
|
|
1654
1716
|
}
|
|
1655
1717
|
);
|
|
1656
1718
|
}
|
|
1719
|
+
|
|
1720
|
+
// src/components/entity/use-entity-pagination.ts
|
|
1721
|
+
function useEntityPagination({
|
|
1722
|
+
items,
|
|
1723
|
+
total,
|
|
1724
|
+
pageSize
|
|
1725
|
+
}) {
|
|
1726
|
+
const totalCount = Number(total ?? items.length);
|
|
1727
|
+
const pageCount = Math.ceil(totalCount / pageSize);
|
|
1728
|
+
return {
|
|
1729
|
+
total: totalCount,
|
|
1730
|
+
pageCount,
|
|
1731
|
+
hasData: items.length > 0,
|
|
1732
|
+
isEmpty: totalCount === 0
|
|
1733
|
+
};
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1736
|
+
// src/components/entity/use-entity-params.ts
|
|
1737
|
+
import { parseAsInteger as parseAsInteger4, parseAsString as parseAsString5, useQueryStates } from "nuqs";
|
|
1738
|
+
import { useMemo as useMemo2 } from "react";
|
|
1739
|
+
function useEntityParams(config = {}) {
|
|
1740
|
+
const {
|
|
1741
|
+
searchKey = "search",
|
|
1742
|
+
searchParamName,
|
|
1743
|
+
defaultSort = "createdAt",
|
|
1744
|
+
defaultOrder = "desc",
|
|
1745
|
+
defaultPageSize = 10
|
|
1746
|
+
} = config;
|
|
1747
|
+
const [params, setParams] = useQueryStates({
|
|
1748
|
+
...searchKey && {
|
|
1749
|
+
[searchKey]: parseAsString5.withDefault("")
|
|
1750
|
+
},
|
|
1751
|
+
view: parseAsString5.withDefault("table"),
|
|
1752
|
+
page: parseAsInteger4.withDefault(1),
|
|
1753
|
+
pageSize: parseAsInteger4.withDefault(defaultPageSize),
|
|
1754
|
+
filter: parseAsString5,
|
|
1755
|
+
sort: parseAsString5.withDefault(defaultSort),
|
|
1756
|
+
order: parseAsString5.withDefault(defaultOrder)
|
|
1757
|
+
});
|
|
1758
|
+
const queryConfig = useMemo2(
|
|
1759
|
+
() => ({
|
|
1760
|
+
params: {
|
|
1761
|
+
query: {
|
|
1762
|
+
page: params.page,
|
|
1763
|
+
limit: params.pageSize,
|
|
1764
|
+
...searchKey && params[searchKey] && {
|
|
1765
|
+
[searchParamName || (searchKey === "search" ? "search" : "handle")]: params[searchKey]
|
|
1766
|
+
},
|
|
1767
|
+
...params.filter && { filter: params.filter },
|
|
1768
|
+
...params.sort && { sort: params.sort, order: params.order }
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1771
|
+
}),
|
|
1772
|
+
[params, searchKey, searchParamName]
|
|
1773
|
+
);
|
|
1774
|
+
return {
|
|
1775
|
+
params,
|
|
1776
|
+
setParams,
|
|
1777
|
+
queryConfig
|
|
1778
|
+
};
|
|
1779
|
+
}
|
|
1657
1780
|
export {
|
|
1658
1781
|
EntityBulkActions,
|
|
1659
1782
|
EntityDetailHeader,
|
|
@@ -1666,6 +1789,8 @@ export {
|
|
|
1666
1789
|
EntityLoadingState,
|
|
1667
1790
|
EntitySearch,
|
|
1668
1791
|
EntitySort,
|
|
1669
|
-
EntityViewToggle
|
|
1792
|
+
EntityViewToggle,
|
|
1793
|
+
useEntityPagination,
|
|
1794
|
+
useEntityParams
|
|
1670
1795
|
};
|
|
1671
1796
|
//# sourceMappingURL=index.js.map
|