@mesob/ui 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (230) hide show
  1. package/dist/components.d.ts +992 -0
  2. package/dist/components.js +8030 -0
  3. package/dist/components.js.map +1 -0
  4. package/dist/hooks.d.ts +6 -0
  5. package/dist/hooks.js +85 -0
  6. package/dist/hooks.js.map +1 -0
  7. package/dist/providers.d.ts +20 -0
  8. package/dist/providers.js +61 -0
  9. package/dist/providers.js.map +1 -0
  10. package/dist/use-entity-params-nqD69tdX.d.ts +82 -0
  11. package/package.json +14 -27
  12. package/dist/components/accordion.d.ts +0 -10
  13. package/dist/components/accordion.js +0 -74
  14. package/dist/components/accordion.js.map +0 -1
  15. package/dist/components/alert-dialog.d.ts +0 -17
  16. package/dist/components/alert-dialog.js +0 -187
  17. package/dist/components/alert-dialog.js.map +0 -1
  18. package/dist/components/alert.d.ts +0 -13
  19. package/dist/components/alert.js +0 -74
  20. package/dist/components/alert.js.map +0 -1
  21. package/dist/components/animated-tabs.d.ts +0 -26
  22. package/dist/components/animated-tabs.js +0 -290
  23. package/dist/components/animated-tabs.js.map +0 -1
  24. package/dist/components/app-breadcrumbs-context.d.ts +0 -19
  25. package/dist/components/app-breadcrumbs-context.js +0 -19
  26. package/dist/components/app-breadcrumbs-context.js.map +0 -1
  27. package/dist/components/app-breadcrumbs.d.ts +0 -25
  28. package/dist/components/app-breadcrumbs.js +0 -175
  29. package/dist/components/app-breadcrumbs.js.map +0 -1
  30. package/dist/components/app-header-actions.d.ts +0 -39
  31. package/dist/components/app-header-actions.js +0 -644
  32. package/dist/components/app-header-actions.js.map +0 -1
  33. package/dist/components/app-sidebar.d.ts +0 -24
  34. package/dist/components/app-sidebar.js +0 -667
  35. package/dist/components/app-sidebar.js.map +0 -1
  36. package/dist/components/aspect-ratio.d.ts +0 -6
  37. package/dist/components/aspect-ratio.js +0 -14
  38. package/dist/components/aspect-ratio.js.map +0 -1
  39. package/dist/components/avatar.d.ts +0 -9
  40. package/dist/components/avatar.js +0 -63
  41. package/dist/components/avatar.js.map +0 -1
  42. package/dist/components/badge.d.ts +0 -13
  43. package/dist/components/badge.js +0 -48
  44. package/dist/components/badge.js.map +0 -1
  45. package/dist/components/breadcrumb.d.ts +0 -14
  46. package/dist/components/breadcrumb.js +0 -110
  47. package/dist/components/breadcrumb.js.map +0 -1
  48. package/dist/components/button-group.d.ts +0 -17
  49. package/dist/components/button-group.js +0 -106
  50. package/dist/components/button-group.js.map +0 -1
  51. package/dist/components/button.d.ts +0 -17
  52. package/dist/components/button.js +0 -68
  53. package/dist/components/button.js.map +0 -1
  54. package/dist/components/calendar.d.ts +0 -13
  55. package/dist/components/calendar.js +0 -262
  56. package/dist/components/calendar.js.map +0 -1
  57. package/dist/components/card.d.ts +0 -12
  58. package/dist/components/card.js +0 -98
  59. package/dist/components/card.js.map +0 -1
  60. package/dist/components/carousel.d.ts +0 -24
  61. package/dist/components/carousel.js +0 -268
  62. package/dist/components/carousel.js.map +0 -1
  63. package/dist/components/chart.d.ts +0 -43
  64. package/dist/components/chart.js +0 -271
  65. package/dist/components/chart.js.map +0 -1
  66. package/dist/components/checkbox.d.ts +0 -7
  67. package/dist/components/checkbox.js +0 -41
  68. package/dist/components/checkbox.js.map +0 -1
  69. package/dist/components/collapsible.d.ts +0 -8
  70. package/dist/components/collapsible.js +0 -38
  71. package/dist/components/collapsible.js.map +0 -1
  72. package/dist/components/command.d.ts +0 -22
  73. package/dist/components/command.js +0 -281
  74. package/dist/components/command.js.map +0 -1
  75. package/dist/components/context-menu.d.ts +0 -28
  76. package/dist/components/context-menu.js +0 -233
  77. package/dist/components/context-menu.js.map +0 -1
  78. package/dist/components/data-table/index.d.ts +0 -53
  79. package/dist/components/data-table/index.js +0 -823
  80. package/dist/components/data-table/index.js.map +0 -1
  81. package/dist/components/dialog.d.ts +0 -18
  82. package/dist/components/dialog.js +0 -146
  83. package/dist/components/dialog.js.map +0 -1
  84. package/dist/components/drawer.d.ts +0 -16
  85. package/dist/components/drawer.js +0 -138
  86. package/dist/components/drawer.js.map +0 -1
  87. package/dist/components/dropdown-menu.d.ts +0 -28
  88. package/dist/components/dropdown-menu.js +0 -241
  89. package/dist/components/dropdown-menu.js.map +0 -1
  90. package/dist/components/empty.d.ts +0 -15
  91. package/dist/components/empty.js +0 -110
  92. package/dist/components/empty.js.map +0 -1
  93. package/dist/components/entity/index.d.ts +0 -236
  94. package/dist/components/entity/index.js +0 -1796
  95. package/dist/components/entity/index.js.map +0 -1
  96. package/dist/components/field.d.ts +0 -30
  97. package/dist/components/field.js +0 -279
  98. package/dist/components/field.js.map +0 -1
  99. package/dist/components/form.d.ts +0 -28
  100. package/dist/components/form.js +0 -150
  101. package/dist/components/form.js.map +0 -1
  102. package/dist/components/hover-card.d.ts +0 -9
  103. package/dist/components/hover-card.js +0 -48
  104. package/dist/components/hover-card.js.map +0 -1
  105. package/dist/components/input-group.d.ts +0 -20
  106. package/dist/components/input-group.js +0 -265
  107. package/dist/components/input-group.js.map +0 -1
  108. package/dist/components/input-otp.d.ts +0 -14
  109. package/dist/components/input-otp.js +0 -76
  110. package/dist/components/input-otp.js.map +0 -1
  111. package/dist/components/input.d.ts +0 -6
  112. package/dist/components/input.js +0 -29
  113. package/dist/components/input.js.map +0 -1
  114. package/dist/components/item.d.ts +0 -28
  115. package/dist/components/item.js +0 -220
  116. package/dist/components/item.js.map +0 -1
  117. package/dist/components/kbd.d.ts +0 -6
  118. package/dist/components/kbd.js +0 -39
  119. package/dist/components/kbd.js.map +0 -1
  120. package/dist/components/label.d.ts +0 -7
  121. package/dist/components/label.js +0 -32
  122. package/dist/components/label.js.map +0 -1
  123. package/dist/components/link.d.ts +0 -12
  124. package/dist/components/link.js +0 -51
  125. package/dist/components/link.js.map +0 -1
  126. package/dist/components/menubar.d.ts +0 -29
  127. package/dist/components/menubar.js +0 -261
  128. package/dist/components/menubar.js.map +0 -1
  129. package/dist/components/mesob-context.d.ts +0 -34
  130. package/dist/components/mesob-context.js +0 -53
  131. package/dist/components/mesob-context.js.map +0 -1
  132. package/dist/components/mesob-logo.d.ts +0 -13
  133. package/dist/components/mesob-logo.js +0 -80
  134. package/dist/components/mesob-logo.js.map +0 -1
  135. package/dist/components/navigation-menu.d.ts +0 -18
  136. package/dist/components/navigation-menu.js +0 -178
  137. package/dist/components/navigation-menu.js.map +0 -1
  138. package/dist/components/page/index.d.ts +0 -46
  139. package/dist/components/page/index.js +0 -205
  140. package/dist/components/page/index.js.map +0 -1
  141. package/dist/components/pagination.d.ts +0 -18
  142. package/dist/components/pagination.js +0 -160
  143. package/dist/components/pagination.js.map +0 -1
  144. package/dist/components/popover.d.ts +0 -10
  145. package/dist/components/popover.js +0 -54
  146. package/dist/components/popover.js.map +0 -1
  147. package/dist/components/powered-by.d.ts +0 -8
  148. package/dist/components/powered-by.js +0 -114
  149. package/dist/components/powered-by.js.map +0 -1
  150. package/dist/components/progress.d.ts +0 -7
  151. package/dist/components/progress.js +0 -41
  152. package/dist/components/progress.js.map +0 -1
  153. package/dist/components/radio-group.d.ts +0 -8
  154. package/dist/components/radio-group.js +0 -55
  155. package/dist/components/radio-group.js.map +0 -1
  156. package/dist/components/resizable.d.ts +0 -11
  157. package/dist/components/resizable.js +0 -58
  158. package/dist/components/resizable.js.map +0 -1
  159. package/dist/components/scroll-area.d.ts +0 -8
  160. package/dist/components/scroll-area.js +0 -70
  161. package/dist/components/scroll-area.js.map +0 -1
  162. package/dist/components/section/index.d.ts +0 -14
  163. package/dist/components/section/index.js +0 -147
  164. package/dist/components/section/index.js.map +0 -1
  165. package/dist/components/select.d.ts +0 -18
  166. package/dist/components/select.js +0 -181
  167. package/dist/components/select.js.map +0 -1
  168. package/dist/components/separator.d.ts +0 -7
  169. package/dist/components/separator.js +0 -36
  170. package/dist/components/separator.js.map +0 -1
  171. package/dist/components/sheet.d.ts +0 -16
  172. package/dist/components/sheet.js +0 -136
  173. package/dist/components/sheet.js.map +0 -1
  174. package/dist/components/shell.d.ts +0 -13
  175. package/dist/components/shell.js +0 -548
  176. package/dist/components/shell.js.map +0 -1
  177. package/dist/components/sidebar-context.d.ts +0 -19
  178. package/dist/components/sidebar-context.js +0 -17
  179. package/dist/components/sidebar-context.js.map +0 -1
  180. package/dist/components/sidebar.d.ts +0 -66
  181. package/dist/components/sidebar.js +0 -943
  182. package/dist/components/sidebar.js.map +0 -1
  183. package/dist/components/skeleton.d.ts +0 -5
  184. package/dist/components/skeleton.js +0 -23
  185. package/dist/components/skeleton.js.map +0 -1
  186. package/dist/components/slider.d.ts +0 -7
  187. package/dist/components/slider.js +0 -76
  188. package/dist/components/slider.js.map +0 -1
  189. package/dist/components/sonner.d.ts +0 -7
  190. package/dist/components/sonner.js +0 -43
  191. package/dist/components/sonner.js.map +0 -1
  192. package/dist/components/spinner.d.ts +0 -6
  193. package/dist/components/spinner.js +0 -28
  194. package/dist/components/spinner.js.map +0 -1
  195. package/dist/components/spotlight-search.d.ts +0 -25
  196. package/dist/components/spotlight-search.js +0 -395
  197. package/dist/components/spotlight-search.js.map +0 -1
  198. package/dist/components/switch.d.ts +0 -7
  199. package/dist/components/switch.js +0 -41
  200. package/dist/components/switch.js.map +0 -1
  201. package/dist/components/table.d.ts +0 -13
  202. package/dist/components/table.js +0 -124
  203. package/dist/components/table.js.map +0 -1
  204. package/dist/components/tabs.d.ts +0 -10
  205. package/dist/components/tabs.js +0 -77
  206. package/dist/components/tabs.js.map +0 -1
  207. package/dist/components/textarea.d.ts +0 -6
  208. package/dist/components/textarea.js +0 -26
  209. package/dist/components/textarea.js.map +0 -1
  210. package/dist/components/theme-toggle.d.ts +0 -8
  211. package/dist/components/theme-toggle.js +0 -94
  212. package/dist/components/theme-toggle.js.map +0 -1
  213. package/dist/components/toggle-group.d.ts +0 -14
  214. package/dist/components/toggle-group.js +0 -102
  215. package/dist/components/toggle-group.js.map +0 -1
  216. package/dist/components/toggle.d.ts +0 -13
  217. package/dist/components/toggle.js +0 -53
  218. package/dist/components/toggle.js.map +0 -1
  219. package/dist/components/tooltip.d.ts +0 -10
  220. package/dist/components/tooltip.js +0 -66
  221. package/dist/components/tooltip.js.map +0 -1
  222. package/dist/hooks/use-mobile.d.ts +0 -3
  223. package/dist/hooks/use-mobile.js +0 -22
  224. package/dist/hooks/use-mobile.js.map +0 -1
  225. package/dist/hooks/use-router.d.ts +0 -7
  226. package/dist/hooks/use-router.js +0 -36
  227. package/dist/hooks/use-router.js.map +0 -1
  228. package/dist/hooks/use-translation.d.ts +0 -5
  229. package/dist/hooks/use-translation.js +0 -42
  230. package/dist/hooks/use-translation.js.map +0 -1
@@ -1,823 +0,0 @@
1
- // src/components/data-table/data-table.tsx
2
- import {
3
- flexRender,
4
- getCoreRowModel,
5
- getFacetedRowModel,
6
- getFacetedUniqueValues,
7
- getFilteredRowModel,
8
- getPaginationRowModel,
9
- getSortedRowModel,
10
- useReactTable
11
- } from "@tanstack/react-table";
12
- import * as React from "react";
13
-
14
- // src/lib/utils.ts
15
- import { clsx } from "clsx";
16
- import { twMerge } from "tailwind-merge";
17
- function cn(...inputs) {
18
- return twMerge(clsx(inputs));
19
- }
20
-
21
- // src/components/table.tsx
22
- import { jsx } from "react/jsx-runtime";
23
- function Table({ className, ...props }) {
24
- return /* @__PURE__ */ jsx(
25
- "div",
26
- {
27
- "data-slot": "table-container",
28
- className: "relative w-full overflow-x-auto",
29
- children: /* @__PURE__ */ jsx(
30
- "table",
31
- {
32
- "data-slot": "table",
33
- className: cn("w-full caption-bottom text-sm px-2", className),
34
- ...props
35
- }
36
- )
37
- }
38
- );
39
- }
40
- function TableHeader({ className, ...props }) {
41
- return /* @__PURE__ */ jsx(
42
- "thead",
43
- {
44
- "data-slot": "table-header",
45
- className: cn("[&_tr]:border-b", className),
46
- ...props
47
- }
48
- );
49
- }
50
- function TableBody({ className, ...props }) {
51
- return /* @__PURE__ */ jsx(
52
- "tbody",
53
- {
54
- "data-slot": "table-body",
55
- className: cn("[&_tr:last-child]:border-0", className),
56
- ...props
57
- }
58
- );
59
- }
60
- function TableRow({ className, ...props }) {
61
- return /* @__PURE__ */ jsx(
62
- "tr",
63
- {
64
- "data-slot": "table-row",
65
- className: cn(
66
- "hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",
67
- className
68
- ),
69
- ...props
70
- }
71
- );
72
- }
73
- function TableHead({ className, ...props }) {
74
- return /* @__PURE__ */ jsx(
75
- "th",
76
- {
77
- "data-slot": "table-head",
78
- className: cn(
79
- "text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
80
- className
81
- ),
82
- ...props
83
- }
84
- );
85
- }
86
- function TableCell({ className, ...props }) {
87
- return /* @__PURE__ */ jsx(
88
- "td",
89
- {
90
- "data-slot": "table-cell",
91
- className: cn(
92
- "p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
93
- className
94
- ),
95
- ...props
96
- }
97
- );
98
- }
99
-
100
- // src/components/data-table/data-table.tsx
101
- import { jsx as jsx2, jsxs } from "react/jsx-runtime";
102
- function DataTable({
103
- columns,
104
- data,
105
- sorting = [],
106
- onSortingChange,
107
- columnFilters = [],
108
- onColumnFiltersChange,
109
- columnVisibility = {},
110
- onColumnVisibilityChange,
111
- rowSelection = {},
112
- onRowSelectionChange,
113
- pageSize = 10,
114
- pageIndex = 0,
115
- getRowId
116
- }) {
117
- const [internalSorting, setInternalSorting] = React.useState(sorting);
118
- const [internalColumnFilters, setInternalColumnFilters] = React.useState(columnFilters);
119
- const [internalColumnVisibility, setInternalColumnVisibility] = React.useState(columnVisibility);
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]);
134
- const table = useReactTable({
135
- data,
136
- columns: processedColumns,
137
- getRowId: getRowId || ((_, index) => String(index)),
138
- state: {
139
- sorting: onSortingChange ? sorting : internalSorting,
140
- columnFilters: onColumnFiltersChange ? columnFilters : internalColumnFilters,
141
- columnVisibility: onColumnVisibilityChange ? columnVisibility : internalColumnVisibility,
142
- rowSelection: onRowSelectionChange ? rowSelection : internalRowSelection,
143
- pagination: { pageIndex, pageSize }
144
- },
145
- enableRowSelection: true,
146
- onSortingChange: (updater) => {
147
- const newSorting = typeof updater === "function" ? updater(onSortingChange ? sorting : internalSorting) : updater;
148
- if (onSortingChange) {
149
- onSortingChange(newSorting);
150
- } else {
151
- setInternalSorting(newSorting);
152
- }
153
- },
154
- onColumnFiltersChange: (updater) => {
155
- const newFilters = typeof updater === "function" ? updater(
156
- onColumnFiltersChange ? columnFilters : internalColumnFilters
157
- ) : updater;
158
- if (onColumnFiltersChange) {
159
- onColumnFiltersChange(newFilters);
160
- } else {
161
- setInternalColumnFilters(newFilters);
162
- }
163
- },
164
- onColumnVisibilityChange: (updater) => {
165
- const newVisibility = typeof updater === "function" ? updater(
166
- onColumnVisibilityChange ? columnVisibility : internalColumnVisibility
167
- ) : updater;
168
- if (onColumnVisibilityChange) {
169
- onColumnVisibilityChange(newVisibility);
170
- } else {
171
- setInternalColumnVisibility(newVisibility);
172
- }
173
- },
174
- onRowSelectionChange: (updater) => {
175
- const newSelection = typeof updater === "function" ? updater(onRowSelectionChange ? rowSelection : internalRowSelection) : updater;
176
- if (onRowSelectionChange) {
177
- onRowSelectionChange(newSelection);
178
- } else {
179
- setInternalRowSelection(newSelection);
180
- }
181
- },
182
- getCoreRowModel: getCoreRowModel(),
183
- getFilteredRowModel: getFilteredRowModel(),
184
- getPaginationRowModel: getPaginationRowModel(),
185
- getSortedRowModel: getSortedRowModel(),
186
- getFacetedRowModel: getFacetedRowModel(),
187
- getFacetedUniqueValues: getFacetedUniqueValues()
188
- });
189
- return /* @__PURE__ */ jsx2("div", { className: "rounded-md border", children: /* @__PURE__ */ jsxs(Table, { children: [
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)) }),
213
- /* @__PURE__ */ jsx2(TableBody, { children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx2(
214
- TableRow,
215
- {
216
- "data-state": row.getIsSelected() && "selected",
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
- })
241
- },
242
- row.id
243
- )) : /* @__PURE__ */ jsx2(TableRow, { children: /* @__PURE__ */ jsx2(TableCell, { colSpan: columns.length, className: "h-24 text-center", children: "No results." }) }) })
244
- ] }) });
245
- }
246
-
247
- // src/components/data-table/data-table-action.tsx
248
- import { IconChevronRight } from "@tabler/icons-react";
249
-
250
- // src/components/button.tsx
251
- import { Slot } from "@radix-ui/react-slot";
252
- import { cva } from "class-variance-authority";
253
- import { Fragment, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
254
- var buttonVariants = cva(
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",
256
- {
257
- variants: {
258
- variant: {
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",
263
- ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
264
- link: "text-primary underline-offset-4 hover:text-primary-600 dark:hover:text-primary-400 hover:underline"
265
- },
266
- size: {
267
- default: "h-9 px-4 py-2 has-[>svg]:px-3",
268
- sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
269
- lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
270
- icon: "size-9",
271
- "icon-sm": "size-8",
272
- "icon-lg": "size-10"
273
- }
274
- },
275
- defaultVariants: {
276
- variant: "default",
277
- size: "default"
278
- }
279
- }
280
- );
281
- function Button({
282
- className,
283
- variant,
284
- size,
285
- asChild = false,
286
- leftIcon,
287
- rightIcon,
288
- children,
289
- ...props
290
- }) {
291
- const Comp = asChild ? Slot : "button";
292
- return /* @__PURE__ */ jsx3(
293
- Comp,
294
- {
295
- "data-slot": "button",
296
- className: cn(buttonVariants({ variant, size, className })),
297
- ...props,
298
- children: asChild ? children : /* @__PURE__ */ jsxs2(Fragment, { children: [
299
- leftIcon,
300
- children,
301
- rightIcon
302
- ] })
303
- }
304
- );
305
- }
306
-
307
- // src/components/data-table/data-table-action.tsx
308
- import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
309
- function DataTableAction({
310
- onClick,
311
- disabled,
312
- "aria-label": ariaLabel = "Open menu"
313
- }) {
314
- return /* @__PURE__ */ jsx4("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__ */ jsx4("span", { className: "sr-only", children: ariaLabel }),
323
- /* @__PURE__ */ jsx4(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 jsx5 } from "react/jsx-runtime";
331
- function DataTableColumnHeader({
332
- column,
333
- title,
334
- className
335
- }) {
336
- if (!column.getCanSort()) {
337
- return /* @__PURE__ */ jsx5("div", { className: cn(className), children: title });
338
- }
339
- return /* @__PURE__ */ jsx5("div", { className: cn("flex items-center gap-2", className), children: /* @__PURE__ */ jsx5("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 jsx6, 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 jsx7 } 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
-
383
- // src/components/select.tsx
384
- import * as SelectPrimitive from "@radix-ui/react-select";
385
- import { IconCheck, IconChevronDown, IconChevronUp } from "@tabler/icons-react";
386
- import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
387
- function Select({
388
- ...props
389
- }) {
390
- return /* @__PURE__ */ jsx8(SelectPrimitive.Root, { "data-slot": "select", ...props });
391
- }
392
- function SelectValue({
393
- ...props
394
- }) {
395
- return /* @__PURE__ */ jsx8(SelectPrimitive.Value, { "data-slot": "select-value", ...props });
396
- }
397
- function SelectTrigger({
398
- className,
399
- size = "default",
400
- children,
401
- ...props
402
- }) {
403
- return /* @__PURE__ */ jsxs5(
404
- SelectPrimitive.Trigger,
405
- {
406
- "data-slot": "select-trigger",
407
- "data-size": size,
408
- className: cn(
409
- "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",
410
- className
411
- ),
412
- ...props,
413
- children: [
414
- children,
415
- /* @__PURE__ */ jsx8(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx8(IconChevronDown, { className: "size-4 opacity-50" }) })
416
- ]
417
- }
418
- );
419
- }
420
- function SelectContent({
421
- className,
422
- children,
423
- position = "popper",
424
- align = "center",
425
- ...props
426
- }) {
427
- return /* @__PURE__ */ jsx8(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs5(
428
- SelectPrimitive.Content,
429
- {
430
- "data-slot": "select-content",
431
- className: cn(
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",
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",
434
- className
435
- ),
436
- position,
437
- align,
438
- ...props,
439
- children: [
440
- /* @__PURE__ */ jsx8(SelectScrollUpButton, {}),
441
- /* @__PURE__ */ jsx8(
442
- SelectPrimitive.Viewport,
443
- {
444
- className: cn(
445
- "p-1",
446
- position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
447
- ),
448
- children
449
- }
450
- ),
451
- /* @__PURE__ */ jsx8(SelectScrollDownButton, {})
452
- ]
453
- }
454
- ) });
455
- }
456
- function SelectItem({
457
- className,
458
- children,
459
- ...props
460
- }) {
461
- return /* @__PURE__ */ jsxs5(
462
- SelectPrimitive.Item,
463
- {
464
- "data-slot": "select-item",
465
- className: cn(
466
- "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",
467
- className
468
- ),
469
- ...props,
470
- children: [
471
- /* @__PURE__ */ jsx8("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx8(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx8(IconCheck, { className: "size-4" }) }) }),
472
- /* @__PURE__ */ jsx8(SelectPrimitive.ItemText, { children })
473
- ]
474
- }
475
- );
476
- }
477
- function SelectScrollUpButton({
478
- className,
479
- ...props
480
- }) {
481
- return /* @__PURE__ */ jsx8(
482
- SelectPrimitive.ScrollUpButton,
483
- {
484
- "data-slot": "select-scroll-up-button",
485
- className: cn(
486
- "flex cursor-default items-center justify-center py-1",
487
- className
488
- ),
489
- ...props,
490
- children: /* @__PURE__ */ jsx8(IconChevronUp, { className: "size-4" })
491
- }
492
- );
493
- }
494
- function SelectScrollDownButton({
495
- className,
496
- ...props
497
- }) {
498
- return /* @__PURE__ */ jsx8(
499
- SelectPrimitive.ScrollDownButton,
500
- {
501
- "data-slot": "select-scroll-down-button",
502
- className: cn(
503
- "flex cursor-default items-center justify-center py-1",
504
- className
505
- ),
506
- ...props,
507
- children: /* @__PURE__ */ jsx8(IconChevronDown, { className: "size-4" })
508
- }
509
- );
510
- }
511
-
512
- // src/components/data-table/data-table-pagination.tsx
513
- import { jsx as jsx9, 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
- }
546
- function DataTablePagination({
547
- pageIndex,
548
- pageSize,
549
- pageCount,
550
- totalRows,
551
- selectedRows = 0,
552
- onPageChange,
553
- onPageSizeChange,
554
- pageSizeOptions = [10, 20, 30, 50]
555
- }) {
556
- const t = useTranslation("Pagination");
557
- if (pageCount <= 1) {
558
- return null;
559
- }
560
- const canPreviousPage = pageIndex > 0;
561
- const canNextPage = pageIndex < pageCount - 1;
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__ */ jsx9("div", { className: "text-muted-foreground text-sm", children: /* @__PURE__ */ jsxs6("span", { children: [
570
- rowText,
571
- /* @__PURE__ */ jsx9("span", { className: "mx-2", children: "\xB7" }),
572
- pageText
573
- ] }) }),
574
- /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
575
- /* @__PURE__ */ jsx9("span", { className: "text-sm font-medium whitespace-nowrap", children: t("rowsPerPage") }),
576
- /* @__PURE__ */ jsxs6(
577
- Select,
578
- {
579
- value: `${pageSize}`,
580
- onValueChange: (value) => onPageSizeChange(Number(value)),
581
- children: [
582
- /* @__PURE__ */ jsx9(SelectTrigger, { className: "h-8 w-[70px]", children: /* @__PURE__ */ jsx9(SelectValue, { placeholder: pageSize }) }),
583
- /* @__PURE__ */ jsx9(SelectContent, { side: "top", children: pageSizeOptions.map((size) => /* @__PURE__ */ jsx9(SelectItem, { value: `${size}`, children: size }, size)) })
584
- ]
585
- }
586
- )
587
- ] })
588
- ] }),
589
- /* @__PURE__ */ jsx9("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__ */ jsx9(IconChevronsLeft, { className: "h-4 w-4" }),
601
- /* @__PURE__ */ jsx9("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__ */ jsx9(IconChevronLeft, { className: "h-4 w-4" }),
616
- /* @__PURE__ */ jsx9("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__ */ jsx9(
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__ */ jsx9(
637
- Button,
638
- {
639
- variant: isActive ? "default" : "outline",
640
- size: "icon",
641
- className: "h-8 w-8",
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__ */ jsx9(IconChevronRight2, { className: "h-4 w-4" }),
661
- /* @__PURE__ */ jsx9("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__ */ jsx9(IconChevronsRight, { className: "h-4 w-4" }),
676
- /* @__PURE__ */ jsx9("span", { className: "sr-only", children: t("lastPage") })
677
- ]
678
- }
679
- )
680
- ] }) })
681
- ] });
682
- }
683
-
684
- // src/components/data-table/data-table-view-options.tsx
685
- import { IconSettings } from "@tabler/icons-react";
686
-
687
- // src/components/dropdown-menu.tsx
688
- import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
689
- import { IconCheck as IconCheck2, IconChevronRight as IconChevronRight3, IconCircle } from "@tabler/icons-react";
690
- import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
691
- function DropdownMenu({
692
- ...props
693
- }) {
694
- return /* @__PURE__ */ jsx10(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
695
- }
696
- function DropdownMenuTrigger({
697
- ...props
698
- }) {
699
- return /* @__PURE__ */ jsx10(
700
- DropdownMenuPrimitive.Trigger,
701
- {
702
- "data-slot": "dropdown-menu-trigger",
703
- ...props
704
- }
705
- );
706
- }
707
- function DropdownMenuContent({
708
- className,
709
- sideOffset = 4,
710
- ...props
711
- }) {
712
- return /* @__PURE__ */ jsx10(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx10(
713
- DropdownMenuPrimitive.Content,
714
- {
715
- "data-slot": "dropdown-menu-content",
716
- sideOffset,
717
- className: cn(
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",
719
- className
720
- ),
721
- ...props
722
- }
723
- ) });
724
- }
725
- function DropdownMenuCheckboxItem({
726
- className,
727
- children,
728
- checked,
729
- ...props
730
- }) {
731
- return /* @__PURE__ */ jsxs7(
732
- DropdownMenuPrimitive.CheckboxItem,
733
- {
734
- "data-slot": "dropdown-menu-checkbox-item",
735
- className: cn(
736
- "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 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",
737
- className
738
- ),
739
- checked,
740
- ...props,
741
- children: [
742
- /* @__PURE__ */ jsx10("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx10(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx10(IconCheck2, { className: "size-4" }) }) }),
743
- children
744
- ]
745
- }
746
- );
747
- }
748
- function DropdownMenuLabel({
749
- className,
750
- inset,
751
- ...props
752
- }) {
753
- return /* @__PURE__ */ jsx10(
754
- DropdownMenuPrimitive.Label,
755
- {
756
- "data-slot": "dropdown-menu-label",
757
- "data-inset": inset,
758
- className: cn(
759
- "px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
760
- className
761
- ),
762
- ...props
763
- }
764
- );
765
- }
766
- function DropdownMenuSeparator({
767
- className,
768
- ...props
769
- }) {
770
- return /* @__PURE__ */ jsx10(
771
- DropdownMenuPrimitive.Separator,
772
- {
773
- "data-slot": "dropdown-menu-separator",
774
- className: cn("bg-border -mx-1 my-1 h-px", className),
775
- ...props
776
- }
777
- );
778
- }
779
-
780
- // src/components/data-table/data-table-view-options.tsx
781
- import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
782
- function DataTableViewOptions({
783
- table
784
- }) {
785
- return /* @__PURE__ */ jsxs8(DropdownMenu, { children: [
786
- /* @__PURE__ */ jsx11(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs8(
787
- Button,
788
- {
789
- variant: "outline",
790
- size: "sm",
791
- className: "ml-auto hidden h-8 lg:flex",
792
- children: [
793
- /* @__PURE__ */ jsx11(IconSettings, { className: "mr-2 h-4 w-4" }),
794
- "View"
795
- ]
796
- }
797
- ) }),
798
- /* @__PURE__ */ jsxs8(DropdownMenuContent, { align: "end", className: "w-[150px]", children: [
799
- /* @__PURE__ */ jsx11(DropdownMenuLabel, { children: "Toggle columns" }),
800
- /* @__PURE__ */ jsx11(DropdownMenuSeparator, {}),
801
- table.getAllColumns().filter(
802
- (column) => typeof column.accessorFn !== "undefined" && column.getCanHide()
803
- ).map((column) => /* @__PURE__ */ jsx11(
804
- DropdownMenuCheckboxItem,
805
- {
806
- className: "capitalize",
807
- checked: column.getIsVisible(),
808
- onCheckedChange: (value) => column.toggleVisibility(!!value),
809
- children: column.id
810
- },
811
- column.id
812
- ))
813
- ] })
814
- ] });
815
- }
816
- export {
817
- DataTable,
818
- DataTableAction,
819
- DataTableColumnHeader,
820
- DataTablePagination,
821
- DataTableViewOptions
822
- };
823
- //# sourceMappingURL=index.js.map