@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.
Files changed (103) hide show
  1. package/dist/components/alert-dialog.js +22 -22
  2. package/dist/components/alert-dialog.js.map +1 -1
  3. package/dist/components/alert.js +1 -1
  4. package/dist/components/alert.js.map +1 -1
  5. package/dist/components/animated-tabs.js +1 -1
  6. package/dist/components/animated-tabs.js.map +1 -1
  7. package/dist/components/app-breadcrumbs.d.ts +34 -0
  8. package/dist/components/app-breadcrumbs.js +177 -0
  9. package/dist/components/app-breadcrumbs.js.map +1 -0
  10. package/dist/components/app-header-actions.d.ts +39 -0
  11. package/dist/components/app-header-actions.js +644 -0
  12. package/dist/components/app-header-actions.js.map +1 -0
  13. package/dist/components/app-sidebar.d.ts +24 -0
  14. package/dist/components/app-sidebar.js +669 -0
  15. package/dist/components/app-sidebar.js.map +1 -0
  16. package/dist/components/button-group.js +1 -1
  17. package/dist/components/button-group.js.map +1 -1
  18. package/dist/components/button.d.ts +6 -3
  19. package/dist/components/button.js +16 -8
  20. package/dist/components/button.js.map +1 -1
  21. package/dist/components/calendar.js +24 -16
  22. package/dist/components/calendar.js.map +1 -1
  23. package/dist/components/card.js +1 -1
  24. package/dist/components/card.js.map +1 -1
  25. package/dist/components/carousel.js +28 -20
  26. package/dist/components/carousel.js.map +1 -1
  27. package/dist/components/command.js +5 -5
  28. package/dist/components/command.js.map +1 -1
  29. package/dist/components/context-menu.js +2 -2
  30. package/dist/components/context-menu.js.map +1 -1
  31. package/dist/components/data-table/index.d.ts +9 -2
  32. package/dist/components/data-table/index.js +336 -152
  33. package/dist/components/data-table/index.js.map +1 -1
  34. package/dist/components/dialog.js +2 -2
  35. package/dist/components/dialog.js.map +1 -1
  36. package/dist/components/drawer.js +2 -2
  37. package/dist/components/drawer.js.map +1 -1
  38. package/dist/components/dropdown-menu.js +2 -2
  39. package/dist/components/dropdown-menu.js.map +1 -1
  40. package/dist/components/entity/index.d.ts +85 -9
  41. package/dist/components/entity/index.js +539 -414
  42. package/dist/components/entity/index.js.map +1 -1
  43. package/dist/components/hover-card.js +1 -1
  44. package/dist/components/hover-card.js.map +1 -1
  45. package/dist/components/input-group.d.ts +1 -1
  46. package/dist/components/input-group.js +27 -19
  47. package/dist/components/input-group.js.map +1 -1
  48. package/dist/components/item.d.ts +1 -1
  49. package/dist/components/link.d.ts +12 -0
  50. package/dist/components/link.js +51 -0
  51. package/dist/components/link.js.map +1 -0
  52. package/dist/components/menubar.js +3 -3
  53. package/dist/components/menubar.js.map +1 -1
  54. package/dist/components/mesob-context.d.ts +34 -0
  55. package/dist/components/mesob-context.js +53 -0
  56. package/dist/components/mesob-context.js.map +1 -0
  57. package/dist/components/navigation-menu.js +1 -1
  58. package/dist/components/navigation-menu.js.map +1 -1
  59. package/dist/components/page/index.d.ts +46 -0
  60. package/dist/components/page/index.js +205 -0
  61. package/dist/components/page/index.js.map +1 -0
  62. package/dist/components/pagination.js +20 -20
  63. package/dist/components/pagination.js.map +1 -1
  64. package/dist/components/popover.js +1 -1
  65. package/dist/components/popover.js.map +1 -1
  66. package/dist/components/powered-by.d.ts +4 -1
  67. package/dist/components/powered-by.js +28 -12
  68. package/dist/components/powered-by.js.map +1 -1
  69. package/dist/components/section/index.js +29 -21
  70. package/dist/components/section/index.js.map +1 -1
  71. package/dist/components/select.js +1 -1
  72. package/dist/components/select.js.map +1 -1
  73. package/dist/components/sheet.js +2 -2
  74. package/dist/components/sheet.js.map +1 -1
  75. package/dist/components/shell.d.ts +13 -0
  76. package/dist/components/shell.js +553 -0
  77. package/dist/components/shell.js.map +1 -0
  78. package/dist/components/sidebar.d.ts +4 -0
  79. package/dist/components/sidebar.js +119 -82
  80. package/dist/components/sidebar.js.map +1 -1
  81. package/dist/components/spotlight-search.js +67 -59
  82. package/dist/components/spotlight-search.js.map +1 -1
  83. package/dist/components/table.js +1 -1
  84. package/dist/components/table.js.map +1 -1
  85. package/dist/components/theme-toggle.js +21 -13
  86. package/dist/components/theme-toggle.js.map +1 -1
  87. package/dist/components/tooltip.d.ts +1 -1
  88. package/dist/components/tooltip.js +2 -1
  89. package/dist/components/tooltip.js.map +1 -1
  90. package/dist/hooks/use-router.d.ts +7 -0
  91. package/dist/hooks/use-router.js +36 -0
  92. package/dist/hooks/use-router.js.map +1 -0
  93. package/dist/hooks/use-translation.d.ts +5 -0
  94. package/dist/hooks/use-translation.js +42 -0
  95. package/dist/hooks/use-translation.js.map +1 -0
  96. package/dist/index.d.ts +1 -0
  97. package/dist/index.js +94 -1
  98. package/dist/index.js.map +1 -1
  99. package/dist/lib/theme-schema.d.ts +21 -0
  100. package/dist/lib/theme-schema.js +95 -0
  101. package/dist/lib/theme-schema.js.map +1 -0
  102. package/package.json +8 -5
  103. package/src/styles/globals.css +0 -126
@@ -30,7 +30,7 @@ function Table({ className, ...props }) {
30
30
  "table",
31
31
  {
32
32
  "data-slot": "table",
33
- className: cn("w-full caption-bottom text-sm", className),
33
+ className: cn("w-full caption-bottom text-sm px-2", className),
34
34
  ...props
35
35
  }
36
36
  )
@@ -118,9 +118,22 @@ function DataTable({
118
118
  const [internalColumnFilters, setInternalColumnFilters] = React.useState(columnFilters);
119
119
  const [internalColumnVisibility, setInternalColumnVisibility] = React.useState(columnVisibility);
120
120
  const [internalRowSelection, setInternalRowSelection] = React.useState(rowSelection);
121
+ const processedColumns = React.useMemo(() => {
122
+ return columns.map((col) => {
123
+ if ((col.id === "actions" || col.id === "select") && col.size === void 0) {
124
+ return {
125
+ ...col,
126
+ size: 50,
127
+ minSize: col.minSize,
128
+ maxSize: col.maxSize
129
+ };
130
+ }
131
+ return col;
132
+ });
133
+ }, [columns]);
121
134
  const table = useReactTable({
122
135
  data,
123
- columns,
136
+ columns: processedColumns,
124
137
  getRowId: getRowId || ((_, index) => String(index)),
125
138
  state: {
126
139
  sorting: onSortingChange ? sorting : internalSorting,
@@ -174,57 +187,81 @@ function DataTable({
174
187
  getFacetedUniqueValues: getFacetedUniqueValues()
175
188
  });
176
189
  return /* @__PURE__ */ jsx2("div", { className: "rounded-md border", children: /* @__PURE__ */ jsxs(Table, { children: [
177
- /* @__PURE__ */ jsx2(TableHeader, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx2(TableRow, { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx2(TableHead, { colSpan: header.colSpan, children: header.isPlaceholder ? null : flexRender(
178
- header.column.columnDef.header,
179
- header.getContext()
180
- ) }, header.id)) }, headerGroup.id)) }),
190
+ /* @__PURE__ */ jsx2(TableHeader, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx2(TableRow, { children: headerGroup.headers.map((header, index) => {
191
+ const isFirst = index === 0;
192
+ const isLast = index === headerGroup.headers.length - 1;
193
+ let className;
194
+ if (isFirst) {
195
+ className = "pl-4";
196
+ } else if (isLast) {
197
+ className = "pr-4";
198
+ }
199
+ return /* @__PURE__ */ jsx2(
200
+ TableHead,
201
+ {
202
+ colSpan: header.colSpan,
203
+ style: { width: header.getSize() },
204
+ className,
205
+ children: header.isPlaceholder ? null : flexRender(
206
+ header.column.columnDef.header,
207
+ header.getContext()
208
+ )
209
+ },
210
+ header.id
211
+ );
212
+ }) }, headerGroup.id)) }),
181
213
  /* @__PURE__ */ jsx2(TableBody, { children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx2(
182
214
  TableRow,
183
215
  {
184
216
  "data-state": row.getIsSelected() && "selected",
185
- children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx2(TableCell, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))
217
+ className: "group",
218
+ children: row.getVisibleCells().map((cell, index) => {
219
+ const visibleCells = row.getVisibleCells();
220
+ const isFirst = index === 0;
221
+ const isLast = index === visibleCells.length - 1;
222
+ let className;
223
+ if (isFirst) {
224
+ className = "pl-4";
225
+ } else if (isLast) {
226
+ className = "pr-4";
227
+ }
228
+ return /* @__PURE__ */ jsx2(
229
+ TableCell,
230
+ {
231
+ style: { width: cell.column.getSize() },
232
+ className,
233
+ children: flexRender(
234
+ cell.column.columnDef.cell,
235
+ cell.getContext()
236
+ )
237
+ },
238
+ cell.id
239
+ );
240
+ })
186
241
  },
187
242
  row.id
188
243
  )) : /* @__PURE__ */ jsx2(TableRow, { children: /* @__PURE__ */ jsx2(TableCell, { colSpan: columns.length, className: "h-24 text-center", children: "No results." }) }) })
189
244
  ] }) });
190
245
  }
191
246
 
192
- // src/components/data-table/data-table-column-header.tsx
193
- import { jsx as jsx3 } from "react/jsx-runtime";
194
- function DataTableColumnHeader({
195
- column,
196
- title,
197
- className
198
- }) {
199
- if (!column.getCanSort()) {
200
- return /* @__PURE__ */ jsx3("div", { className: cn(className), children: title });
201
- }
202
- return /* @__PURE__ */ jsx3("div", { className: cn("flex items-center gap-2", className), children: /* @__PURE__ */ jsx3("span", { children: title }) });
203
- }
204
-
205
- // src/components/data-table/data-table-pagination.tsx
206
- import {
207
- IconChevronLeft,
208
- IconChevronRight,
209
- IconChevronsLeft,
210
- IconChevronsRight
211
- } from "@tabler/icons-react";
247
+ // src/components/data-table/data-table-action.tsx
248
+ import { IconChevronRight } from "@tabler/icons-react";
212
249
 
213
250
  // src/components/button.tsx
214
251
  import { Slot } from "@radix-ui/react-slot";
215
252
  import { cva } from "class-variance-authority";
216
- import { jsx as jsx4 } from "react/jsx-runtime";
253
+ import { jsxs as jsxs2 } from "react/jsx-runtime";
217
254
  var buttonVariants = cva(
218
255
  "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",
219
256
  {
220
257
  variants: {
221
258
  variant: {
222
- default: "bg-primary text-primary-foreground hover:bg-primary/90",
223
- destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
224
- 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",
225
- secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
259
+ default: "bg-primary text-primary-foreground hover:bg-primary-600 dark:hover:bg-primary-400",
260
+ destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",
261
+ 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",
262
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary-600 dark:hover:bg-secondary-400",
226
263
  ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
227
- link: "text-primary underline-offset-4 hover:underline"
264
+ link: "text-primary underline-offset-4 hover:text-primary-600 dark:hover:text-primary-400 hover:underline"
228
265
  },
229
266
  size: {
230
267
  default: "h-9 px-4 py-2 has-[>svg]:px-3",
@@ -246,32 +283,116 @@ function Button({
246
283
  variant,
247
284
  size,
248
285
  asChild = false,
286
+ leftIcon,
287
+ rightIcon,
288
+ children,
249
289
  ...props
250
290
  }) {
251
291
  const Comp = asChild ? Slot : "button";
252
- return /* @__PURE__ */ jsx4(
292
+ return /* @__PURE__ */ jsxs2(
253
293
  Comp,
254
294
  {
255
295
  "data-slot": "button",
256
296
  className: cn(buttonVariants({ variant, size, className })),
257
- ...props
297
+ ...props,
298
+ children: [
299
+ leftIcon,
300
+ children,
301
+ rightIcon
302
+ ]
258
303
  }
259
304
  );
260
305
  }
261
306
 
307
+ // src/components/data-table/data-table-action.tsx
308
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
309
+ function DataTableAction({
310
+ onClick,
311
+ disabled,
312
+ "aria-label": ariaLabel = "Open menu"
313
+ }) {
314
+ return /* @__PURE__ */ jsx3("div", { className: "flex justify-end align-center", children: /* @__PURE__ */ jsxs3(
315
+ Button,
316
+ {
317
+ variant: "ghost",
318
+ className: "h-8 w-8 p-0 opacity-0 transition-opacity group-hover:opacity-100 cursor-pointer",
319
+ onClick,
320
+ disabled,
321
+ children: [
322
+ /* @__PURE__ */ jsx3("span", { className: "sr-only", children: ariaLabel }),
323
+ /* @__PURE__ */ jsx3(IconChevronRight, { className: "h-4 w-4" })
324
+ ]
325
+ }
326
+ ) });
327
+ }
328
+
329
+ // src/components/data-table/data-table-column-header.tsx
330
+ import { jsx as jsx4 } from "react/jsx-runtime";
331
+ function DataTableColumnHeader({
332
+ column,
333
+ title,
334
+ className
335
+ }) {
336
+ if (!column.getCanSort()) {
337
+ return /* @__PURE__ */ jsx4("div", { className: cn(className), children: title });
338
+ }
339
+ return /* @__PURE__ */ jsx4("div", { className: cn("flex items-center gap-2", className), children: /* @__PURE__ */ jsx4("span", { children: title }) });
340
+ }
341
+
342
+ // src/hooks/use-translation.ts
343
+ import { useTranslations } from "next-intl";
344
+ import { useMemo as useMemo3 } from "react";
345
+
346
+ // src/components/tooltip.tsx
347
+ import * as TooltipPrimitive from "@radix-ui/react-tooltip";
348
+ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
349
+
350
+ // src/components/mesob-context.tsx
351
+ import {
352
+ createContext,
353
+ useContext,
354
+ useMemo as useMemo2
355
+ } from "react";
356
+ import { jsx as jsx6 } from "react/jsx-runtime";
357
+ var MesobContext = createContext(null);
358
+ function useMesob() {
359
+ return useContext(MesobContext);
360
+ }
361
+
362
+ // src/hooks/use-translation.ts
363
+ function useTranslation(namespace) {
364
+ const mesob = useMesob();
365
+ const nextIntlT = useTranslations(namespace);
366
+ return useMemo3(() => {
367
+ const t = mesob?.t;
368
+ if (t) {
369
+ return (key, params) => t(namespace ? `${namespace}.${key}` : key, params);
370
+ }
371
+ return nextIntlT;
372
+ }, [mesob?.t, namespace, nextIntlT]);
373
+ }
374
+
375
+ // src/components/data-table/data-table-pagination.tsx
376
+ import {
377
+ IconChevronLeft,
378
+ IconChevronRight as IconChevronRight2,
379
+ IconChevronsLeft,
380
+ IconChevronsRight
381
+ } from "@tabler/icons-react";
382
+
262
383
  // src/components/select.tsx
263
384
  import * as SelectPrimitive from "@radix-ui/react-select";
264
385
  import { IconCheck, IconChevronDown, IconChevronUp } from "@tabler/icons-react";
265
- import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
386
+ import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
266
387
  function Select({
267
388
  ...props
268
389
  }) {
269
- return /* @__PURE__ */ jsx5(SelectPrimitive.Root, { "data-slot": "select", ...props });
390
+ return /* @__PURE__ */ jsx7(SelectPrimitive.Root, { "data-slot": "select", ...props });
270
391
  }
271
392
  function SelectValue({
272
393
  ...props
273
394
  }) {
274
- return /* @__PURE__ */ jsx5(SelectPrimitive.Value, { "data-slot": "select-value", ...props });
395
+ return /* @__PURE__ */ jsx7(SelectPrimitive.Value, { "data-slot": "select-value", ...props });
275
396
  }
276
397
  function SelectTrigger({
277
398
  className,
@@ -279,7 +400,7 @@ function SelectTrigger({
279
400
  children,
280
401
  ...props
281
402
  }) {
282
- return /* @__PURE__ */ jsxs2(
403
+ return /* @__PURE__ */ jsxs5(
283
404
  SelectPrimitive.Trigger,
284
405
  {
285
406
  "data-slot": "select-trigger",
@@ -291,7 +412,7 @@ function SelectTrigger({
291
412
  ...props,
292
413
  children: [
293
414
  children,
294
- /* @__PURE__ */ jsx5(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx5(IconChevronDown, { className: "size-4 opacity-50" }) })
415
+ /* @__PURE__ */ jsx7(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx7(IconChevronDown, { className: "size-4 opacity-50" }) })
295
416
  ]
296
417
  }
297
418
  );
@@ -303,12 +424,12 @@ function SelectContent({
303
424
  align = "center",
304
425
  ...props
305
426
  }) {
306
- return /* @__PURE__ */ jsx5(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs2(
427
+ return /* @__PURE__ */ jsx7(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs5(
307
428
  SelectPrimitive.Content,
308
429
  {
309
430
  "data-slot": "select-content",
310
431
  className: cn(
311
- "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",
432
+ "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",
312
433
  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",
313
434
  className
314
435
  ),
@@ -316,8 +437,8 @@ function SelectContent({
316
437
  align,
317
438
  ...props,
318
439
  children: [
319
- /* @__PURE__ */ jsx5(SelectScrollUpButton, {}),
320
- /* @__PURE__ */ jsx5(
440
+ /* @__PURE__ */ jsx7(SelectScrollUpButton, {}),
441
+ /* @__PURE__ */ jsx7(
321
442
  SelectPrimitive.Viewport,
322
443
  {
323
444
  className: cn(
@@ -327,7 +448,7 @@ function SelectContent({
327
448
  children
328
449
  }
329
450
  ),
330
- /* @__PURE__ */ jsx5(SelectScrollDownButton, {})
451
+ /* @__PURE__ */ jsx7(SelectScrollDownButton, {})
331
452
  ]
332
453
  }
333
454
  ) });
@@ -337,7 +458,7 @@ function SelectItem({
337
458
  children,
338
459
  ...props
339
460
  }) {
340
- return /* @__PURE__ */ jsxs2(
461
+ return /* @__PURE__ */ jsxs5(
341
462
  SelectPrimitive.Item,
342
463
  {
343
464
  "data-slot": "select-item",
@@ -347,8 +468,8 @@ function SelectItem({
347
468
  ),
348
469
  ...props,
349
470
  children: [
350
- /* @__PURE__ */ jsx5("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx5(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx5(IconCheck, { className: "size-4" }) }) }),
351
- /* @__PURE__ */ jsx5(SelectPrimitive.ItemText, { children })
471
+ /* @__PURE__ */ jsx7("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx7(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx7(IconCheck, { className: "size-4" }) }) }),
472
+ /* @__PURE__ */ jsx7(SelectPrimitive.ItemText, { children })
352
473
  ]
353
474
  }
354
475
  );
@@ -357,7 +478,7 @@ function SelectScrollUpButton({
357
478
  className,
358
479
  ...props
359
480
  }) {
360
- return /* @__PURE__ */ jsx5(
481
+ return /* @__PURE__ */ jsx7(
361
482
  SelectPrimitive.ScrollUpButton,
362
483
  {
363
484
  "data-slot": "select-scroll-up-button",
@@ -366,7 +487,7 @@ function SelectScrollUpButton({
366
487
  className
367
488
  ),
368
489
  ...props,
369
- children: /* @__PURE__ */ jsx5(IconChevronUp, { className: "size-4" })
490
+ children: /* @__PURE__ */ jsx7(IconChevronUp, { className: "size-4" })
370
491
  }
371
492
  );
372
493
  }
@@ -374,7 +495,7 @@ function SelectScrollDownButton({
374
495
  className,
375
496
  ...props
376
497
  }) {
377
- return /* @__PURE__ */ jsx5(
498
+ return /* @__PURE__ */ jsx7(
378
499
  SelectPrimitive.ScrollDownButton,
379
500
  {
380
501
  "data-slot": "select-scroll-down-button",
@@ -383,13 +504,45 @@ function SelectScrollDownButton({
383
504
  className
384
505
  ),
385
506
  ...props,
386
- children: /* @__PURE__ */ jsx5(IconChevronDown, { className: "size-4" })
507
+ children: /* @__PURE__ */ jsx7(IconChevronDown, { className: "size-4" })
387
508
  }
388
509
  );
389
510
  }
390
511
 
391
512
  // src/components/data-table/data-table-pagination.tsx
392
- import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
513
+ import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
514
+ function addRange(pages, start, end) {
515
+ for (let i = start; i <= end; i++) {
516
+ pages.push(i);
517
+ }
518
+ }
519
+ function getPageNumbers(pageIndex, pageCount) {
520
+ const total = pageCount || 1;
521
+ const current = pageIndex + 1;
522
+ const pages = [];
523
+ if (total <= 1) {
524
+ return [1];
525
+ }
526
+ if (total <= 5) {
527
+ addRange(pages, 1, total);
528
+ return pages;
529
+ }
530
+ pages.push(1);
531
+ const isNearStart = current <= 3;
532
+ const isNearEnd = current >= total - 2;
533
+ if (isNearStart) {
534
+ addRange(pages, 2, 4);
535
+ pages.push("ellipsis", total);
536
+ } else if (isNearEnd) {
537
+ pages.push("ellipsis");
538
+ addRange(pages, total - 3, total);
539
+ } else {
540
+ pages.push("ellipsis");
541
+ addRange(pages, current - 1, current + 1);
542
+ pages.push("ellipsis", total);
543
+ }
544
+ return pages;
545
+ }
393
546
  function DataTablePagination({
394
547
  pageIndex,
395
548
  pageSize,
@@ -400,101 +553,131 @@ function DataTablePagination({
400
553
  onPageSizeChange,
401
554
  pageSizeOptions = [10, 20, 30, 50]
402
555
  }) {
556
+ const t = useTranslation("Pagination");
557
+ if (pageCount <= 1) {
558
+ return null;
559
+ }
403
560
  const canPreviousPage = pageIndex > 0;
404
561
  const canNextPage = pageIndex < pageCount - 1;
405
- return /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between px-2 py-4", children: [
406
- /* @__PURE__ */ jsxs3("div", { className: "text-muted-foreground flex-1 text-sm", children: [
407
- selectedRows > 0 && /* @__PURE__ */ jsxs3("span", { children: [
408
- selectedRows,
409
- " of ",
410
- totalRows,
411
- " row(s) selected."
412
- ] }),
413
- selectedRows === 0 && /* @__PURE__ */ jsxs3("span", { children: [
414
- totalRows,
415
- " row(s) total."
416
- ] })
417
- ] }),
418
- /* @__PURE__ */ jsxs3("div", { className: "flex items-center space-x-6 lg:space-x-8", children: [
419
- /* @__PURE__ */ jsxs3("div", { className: "flex items-center space-x-2", children: [
420
- /* @__PURE__ */ jsx6("p", { className: "text-sm font-medium", children: "Rows per page" }),
421
- /* @__PURE__ */ jsxs3(
562
+ const pageNumbers = getPageNumbers(pageIndex, pageCount);
563
+ const rowLabel = totalRows === 1 ? t("row") : t("rows");
564
+ const hasSelection = selectedRows > 0;
565
+ const rowText = hasSelection ? `${selectedRows} ${t("of")} ${totalRows} ${rowLabel} ${t("selected")}` : `${totalRows} ${rowLabel} ${t("total")}`;
566
+ const pageText = `${t("page")} ${pageIndex + 1} ${t("of")} ${pageCount || 1}`;
567
+ return /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-4 px-2 sm:flex-row sm:items-center sm:justify-between", children: [
568
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-center gap-4 sm:justify-start", children: [
569
+ /* @__PURE__ */ jsx8("div", { className: "text-muted-foreground text-sm", children: /* @__PURE__ */ jsxs6("span", { children: [
570
+ rowText,
571
+ /* @__PURE__ */ jsx8("span", { className: "mx-2", children: "\xB7" }),
572
+ pageText
573
+ ] }) }),
574
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
575
+ /* @__PURE__ */ jsx8("span", { className: "text-sm font-medium whitespace-nowrap", children: t("rowsPerPage") }),
576
+ /* @__PURE__ */ jsxs6(
422
577
  Select,
423
578
  {
424
579
  value: `${pageSize}`,
425
580
  onValueChange: (value) => onPageSizeChange(Number(value)),
426
581
  children: [
427
- /* @__PURE__ */ jsx6(SelectTrigger, { className: "h-8 w-[70px]", children: /* @__PURE__ */ jsx6(SelectValue, { placeholder: pageSize }) }),
428
- /* @__PURE__ */ jsx6(SelectContent, { side: "top", children: pageSizeOptions.map((size) => /* @__PURE__ */ jsx6(SelectItem, { value: `${size}`, children: size }, size)) })
582
+ /* @__PURE__ */ jsx8(SelectTrigger, { className: "h-8 w-[70px]", children: /* @__PURE__ */ jsx8(SelectValue, { placeholder: pageSize }) }),
583
+ /* @__PURE__ */ jsx8(SelectContent, { side: "top", children: pageSizeOptions.map((size) => /* @__PURE__ */ jsx8(SelectItem, { value: `${size}`, children: size }, size)) })
429
584
  ]
430
585
  }
431
586
  )
432
- ] }),
433
- /* @__PURE__ */ jsxs3("div", { className: "flex w-[100px] items-center justify-center text-sm font-medium", children: [
434
- "Page ",
435
- pageIndex + 1,
436
- " of ",
437
- pageCount || 1
438
- ] }),
439
- /* @__PURE__ */ jsxs3("div", { className: "flex items-center space-x-2", children: [
440
- /* @__PURE__ */ jsxs3(
441
- Button,
442
- {
443
- variant: "outline",
444
- size: "icon",
445
- className: "hidden h-8 w-8 lg:flex",
446
- onClick: () => onPageChange(0),
447
- disabled: !canPreviousPage,
448
- children: [
449
- /* @__PURE__ */ jsx6("span", { className: "sr-only", children: "Go to first page" }),
450
- /* @__PURE__ */ jsx6(IconChevronsLeft, { className: "h-4 w-4" })
451
- ]
452
- }
453
- ),
454
- /* @__PURE__ */ jsxs3(
455
- Button,
456
- {
457
- variant: "outline",
458
- size: "icon",
459
- className: "h-8 w-8",
460
- onClick: () => onPageChange(pageIndex - 1),
461
- disabled: !canPreviousPage,
462
- children: [
463
- /* @__PURE__ */ jsx6("span", { className: "sr-only", children: "Go to previous page" }),
464
- /* @__PURE__ */ jsx6(IconChevronLeft, { className: "h-4 w-4" })
465
- ]
466
- }
467
- ),
468
- /* @__PURE__ */ jsxs3(
587
+ ] })
588
+ ] }),
589
+ /* @__PURE__ */ jsx8("div", { className: "flex justify-center sm:justify-end", children: /* @__PURE__ */ jsxs6("nav", { "aria-label": "Pagination", className: "flex items-center gap-1", children: [
590
+ /* @__PURE__ */ jsxs6(
591
+ Button,
592
+ {
593
+ variant: "outline",
594
+ size: "icon",
595
+ className: "hidden h-8 w-8 lg:flex",
596
+ onClick: () => onPageChange(0),
597
+ disabled: !canPreviousPage,
598
+ "aria-label": t("firstPage"),
599
+ children: [
600
+ /* @__PURE__ */ jsx8(IconChevronsLeft, { className: "h-4 w-4" }),
601
+ /* @__PURE__ */ jsx8("span", { className: "sr-only", children: t("firstPage") })
602
+ ]
603
+ }
604
+ ),
605
+ /* @__PURE__ */ jsxs6(
606
+ Button,
607
+ {
608
+ variant: "outline",
609
+ size: "icon",
610
+ className: "h-8 w-8",
611
+ onClick: () => onPageChange(pageIndex - 1),
612
+ disabled: !canPreviousPage,
613
+ "aria-label": t("previousPage"),
614
+ children: [
615
+ /* @__PURE__ */ jsx8(IconChevronLeft, { className: "h-4 w-4" }),
616
+ /* @__PURE__ */ jsx8("span", { className: "sr-only", children: t("previousPage") })
617
+ ]
618
+ }
619
+ ),
620
+ pageNumbers.map((page, idx) => {
621
+ if (page === "ellipsis") {
622
+ const prevPage = idx > 0 ? pageNumbers[idx - 1] : null;
623
+ const nextPage = idx < pageNumbers.length - 1 ? pageNumbers[idx + 1] : null;
624
+ return /* @__PURE__ */ jsx8(
625
+ "span",
626
+ {
627
+ className: "flex h-8 w-8 items-center justify-center text-muted-foreground",
628
+ "aria-hidden": "true",
629
+ children: "..."
630
+ },
631
+ `ellipsis-${prevPage}-${nextPage}`
632
+ );
633
+ }
634
+ const pageNum = page;
635
+ const isActive = pageNum === pageIndex + 1;
636
+ return /* @__PURE__ */ jsx8(
469
637
  Button,
470
638
  {
471
- variant: "outline",
639
+ variant: isActive ? "default" : "outline",
472
640
  size: "icon",
473
641
  className: "h-8 w-8",
474
- onClick: () => onPageChange(pageIndex + 1),
475
- disabled: !canNextPage,
476
- children: [
477
- /* @__PURE__ */ jsx6("span", { className: "sr-only", children: "Go to next page" }),
478
- /* @__PURE__ */ jsx6(IconChevronRight, { className: "h-4 w-4" })
479
- ]
480
- }
481
- ),
482
- /* @__PURE__ */ jsxs3(
483
- Button,
484
- {
485
- variant: "outline",
486
- size: "icon",
487
- className: "hidden h-8 w-8 lg:flex",
488
- onClick: () => onPageChange(pageCount - 1),
489
- disabled: !canNextPage,
490
- children: [
491
- /* @__PURE__ */ jsx6("span", { className: "sr-only", children: "Go to last page" }),
492
- /* @__PURE__ */ jsx6(IconChevronsRight, { className: "h-4 w-4" })
493
- ]
494
- }
495
- )
496
- ] })
497
- ] })
642
+ onClick: () => onPageChange(pageNum - 1),
643
+ "aria-label": `${t("goToPage")} ${pageNum}`,
644
+ "aria-current": isActive ? "page" : void 0,
645
+ children: pageNum
646
+ },
647
+ pageNum
648
+ );
649
+ }),
650
+ /* @__PURE__ */ jsxs6(
651
+ Button,
652
+ {
653
+ variant: "outline",
654
+ size: "icon",
655
+ className: "h-8 w-8",
656
+ onClick: () => onPageChange(pageIndex + 1),
657
+ disabled: !canNextPage,
658
+ "aria-label": t("nextPage"),
659
+ children: [
660
+ /* @__PURE__ */ jsx8(IconChevronRight2, { className: "h-4 w-4" }),
661
+ /* @__PURE__ */ jsx8("span", { className: "sr-only", children: t("nextPage") })
662
+ ]
663
+ }
664
+ ),
665
+ /* @__PURE__ */ jsxs6(
666
+ Button,
667
+ {
668
+ variant: "outline",
669
+ size: "icon",
670
+ className: "hidden h-8 w-8 lg:flex",
671
+ onClick: () => onPageChange(pageCount - 1),
672
+ disabled: !canNextPage,
673
+ "aria-label": t("lastPage"),
674
+ children: [
675
+ /* @__PURE__ */ jsx8(IconChevronsRight, { className: "h-4 w-4" }),
676
+ /* @__PURE__ */ jsx8("span", { className: "sr-only", children: t("lastPage") })
677
+ ]
678
+ }
679
+ )
680
+ ] }) })
498
681
  ] });
499
682
  }
500
683
 
@@ -503,17 +686,17 @@ import { IconSettings } from "@tabler/icons-react";
503
686
 
504
687
  // src/components/dropdown-menu.tsx
505
688
  import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
506
- import { IconCheck as IconCheck2, IconChevronRight as IconChevronRight2, IconCircle } from "@tabler/icons-react";
507
- import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
689
+ import { IconCheck as IconCheck2, IconChevronRight as IconChevronRight3, IconCircle } from "@tabler/icons-react";
690
+ import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
508
691
  function DropdownMenu({
509
692
  ...props
510
693
  }) {
511
- return /* @__PURE__ */ jsx7(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
694
+ return /* @__PURE__ */ jsx9(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
512
695
  }
513
696
  function DropdownMenuTrigger({
514
697
  ...props
515
698
  }) {
516
- return /* @__PURE__ */ jsx7(
699
+ return /* @__PURE__ */ jsx9(
517
700
  DropdownMenuPrimitive.Trigger,
518
701
  {
519
702
  "data-slot": "dropdown-menu-trigger",
@@ -526,13 +709,13 @@ function DropdownMenuContent({
526
709
  sideOffset = 4,
527
710
  ...props
528
711
  }) {
529
- return /* @__PURE__ */ jsx7(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx7(
712
+ return /* @__PURE__ */ jsx9(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx9(
530
713
  DropdownMenuPrimitive.Content,
531
714
  {
532
715
  "data-slot": "dropdown-menu-content",
533
716
  sideOffset,
534
717
  className: cn(
535
- "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",
718
+ "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",
536
719
  className
537
720
  ),
538
721
  ...props
@@ -545,7 +728,7 @@ function DropdownMenuCheckboxItem({
545
728
  checked,
546
729
  ...props
547
730
  }) {
548
- return /* @__PURE__ */ jsxs4(
731
+ return /* @__PURE__ */ jsxs7(
549
732
  DropdownMenuPrimitive.CheckboxItem,
550
733
  {
551
734
  "data-slot": "dropdown-menu-checkbox-item",
@@ -556,7 +739,7 @@ function DropdownMenuCheckboxItem({
556
739
  checked,
557
740
  ...props,
558
741
  children: [
559
- /* @__PURE__ */ jsx7("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx7(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx7(IconCheck2, { className: "size-4" }) }) }),
742
+ /* @__PURE__ */ jsx9("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx9(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx9(IconCheck2, { className: "size-4" }) }) }),
560
743
  children
561
744
  ]
562
745
  }
@@ -567,7 +750,7 @@ function DropdownMenuLabel({
567
750
  inset,
568
751
  ...props
569
752
  }) {
570
- return /* @__PURE__ */ jsx7(
753
+ return /* @__PURE__ */ jsx9(
571
754
  DropdownMenuPrimitive.Label,
572
755
  {
573
756
  "data-slot": "dropdown-menu-label",
@@ -584,7 +767,7 @@ function DropdownMenuSeparator({
584
767
  className,
585
768
  ...props
586
769
  }) {
587
- return /* @__PURE__ */ jsx7(
770
+ return /* @__PURE__ */ jsx9(
588
771
  DropdownMenuPrimitive.Separator,
589
772
  {
590
773
  "data-slot": "dropdown-menu-separator",
@@ -595,29 +778,29 @@ function DropdownMenuSeparator({
595
778
  }
596
779
 
597
780
  // src/components/data-table/data-table-view-options.tsx
598
- import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
781
+ import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
599
782
  function DataTableViewOptions({
600
783
  table
601
784
  }) {
602
- return /* @__PURE__ */ jsxs5(DropdownMenu, { children: [
603
- /* @__PURE__ */ jsx8(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs5(
785
+ return /* @__PURE__ */ jsxs8(DropdownMenu, { children: [
786
+ /* @__PURE__ */ jsx10(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs8(
604
787
  Button,
605
788
  {
606
789
  variant: "outline",
607
790
  size: "sm",
608
791
  className: "ml-auto hidden h-8 lg:flex",
609
792
  children: [
610
- /* @__PURE__ */ jsx8(IconSettings, { className: "mr-2 h-4 w-4" }),
793
+ /* @__PURE__ */ jsx10(IconSettings, { className: "mr-2 h-4 w-4" }),
611
794
  "View"
612
795
  ]
613
796
  }
614
797
  ) }),
615
- /* @__PURE__ */ jsxs5(DropdownMenuContent, { align: "end", className: "w-[150px]", children: [
616
- /* @__PURE__ */ jsx8(DropdownMenuLabel, { children: "Toggle columns" }),
617
- /* @__PURE__ */ jsx8(DropdownMenuSeparator, {}),
798
+ /* @__PURE__ */ jsxs8(DropdownMenuContent, { align: "end", className: "w-[150px]", children: [
799
+ /* @__PURE__ */ jsx10(DropdownMenuLabel, { children: "Toggle columns" }),
800
+ /* @__PURE__ */ jsx10(DropdownMenuSeparator, {}),
618
801
  table.getAllColumns().filter(
619
802
  (column) => typeof column.accessorFn !== "undefined" && column.getCanHide()
620
- ).map((column) => /* @__PURE__ */ jsx8(
803
+ ).map((column) => /* @__PURE__ */ jsx10(
621
804
  DropdownMenuCheckboxItem,
622
805
  {
623
806
  className: "capitalize",
@@ -632,6 +815,7 @@ function DataTableViewOptions({
632
815
  }
633
816
  export {
634
817
  DataTable,
818
+ DataTableAction,
635
819
  DataTableColumnHeader,
636
820
  DataTablePagination,
637
821
  DataTableViewOptions