lizaui 9.0.52 → 9.0.54

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 (47) hide show
  1. package/dist/chunks/chevron-down-BTrLI_vJ.js +6 -0
  2. package/dist/chunks/chevron-down-BTrLI_vJ.js.map +1 -0
  3. package/dist/chunks/chevron-down-D-14pIT_.js +7 -0
  4. package/dist/chunks/chevron-down-D-14pIT_.js.map +1 -0
  5. package/dist/chunks/chevron-up-BBd-SipB.js +7 -0
  6. package/dist/chunks/chevron-up-BBd-SipB.js.map +1 -0
  7. package/dist/chunks/chevron-up-egHdliKz.js +6 -0
  8. package/dist/chunks/chevron-up-egHdliKz.js.map +1 -0
  9. package/dist/chunks/{index--Lp5VMoT.js → index-Cqht2FCn.js} +3 -6
  10. package/dist/chunks/index-Cqht2FCn.js.map +1 -0
  11. package/dist/chunks/{index-xVewW5kR.js → index-D6rBzjZf.js} +3 -6
  12. package/dist/chunks/index-D6rBzjZf.js.map +1 -0
  13. package/dist/chunks/{scroll-area-DTgVLYwQ.js → scroll-area-DDEg3_oz.js} +2 -2
  14. package/dist/chunks/{scroll-area-DTgVLYwQ.js.map → scroll-area-DDEg3_oz.js.map} +1 -1
  15. package/dist/chunks/{scroll-area-Bv006UzS.js → scroll-area-_ap_QsnE.js} +2 -2
  16. package/dist/chunks/{scroll-area-Bv006UzS.js.map → scroll-area-_ap_QsnE.js.map} +1 -1
  17. package/dist/chunks/{select-JfY1UjKe.js → select-BROp3S0I.js} +4 -5
  18. package/dist/chunks/select-BROp3S0I.js.map +1 -0
  19. package/dist/chunks/{select-Bm7MENHi.js → select-CqltFRiu.js} +7 -8
  20. package/dist/chunks/select-CqltFRiu.js.map +1 -0
  21. package/dist/components/table/body/table-body.d.ts.map +1 -1
  22. package/dist/components/table/context/table.context.d.ts.map +1 -1
  23. package/dist/components/table/header/table-header-column.d.ts.map +1 -1
  24. package/dist/components/table/hook/use-table.d.ts +3 -2
  25. package/dist/components/table/hook/use-table.d.ts.map +1 -1
  26. package/dist/components/table/interface/table.interface.d.ts +9 -0
  27. package/dist/components/table/interface/table.interface.d.ts.map +1 -1
  28. package/dist/components/table/table.d.ts.map +1 -1
  29. package/dist/pagination/index.cjs.js +1 -1
  30. package/dist/pagination/index.es.js +1 -1
  31. package/dist/phone-input/index.cjs.js +4 -3
  32. package/dist/phone-input/index.cjs.js.map +1 -1
  33. package/dist/phone-input/index.es.js +3 -2
  34. package/dist/phone-input/index.es.js.map +1 -1
  35. package/dist/table/index.cjs.js +333 -179
  36. package/dist/table/index.cjs.js.map +1 -1
  37. package/dist/table/index.es.js +333 -179
  38. package/dist/table/index.es.js.map +1 -1
  39. package/dist/ui/index.cjs.js +6 -5
  40. package/dist/ui/index.cjs.js.map +1 -1
  41. package/dist/ui/index.es.js +6 -5
  42. package/dist/ui/index.es.js.map +1 -1
  43. package/package.json +1 -1
  44. package/dist/chunks/index--Lp5VMoT.js.map +0 -1
  45. package/dist/chunks/index-xVewW5kR.js.map +0 -1
  46. package/dist/chunks/select-Bm7MENHi.js.map +0 -1
  47. package/dist/chunks/select-JfY1UjKe.js.map +0 -1
@@ -27,10 +27,18 @@ const compilerRuntime = require("react/compiler-runtime");
27
27
  const React = require("react");
28
28
  const tailwindMerge = require("tailwind-merge");
29
29
  const tooltip = require("../chunks/tooltip-hhxclHkr.js");
30
+ const chevronUp = require("../chunks/chevron-up-egHdliKz.js");
31
+ const chevronDown = require("../chunks/chevron-down-BTrLI_vJ.js");
32
+ const createLucideIcon = require("../chunks/createLucideIcon-Bxsl-Fn_.js");
30
33
  const loaderCircle = require("../chunks/loader-circle-DVLrRYRP.js");
31
34
  const clsx = require("clsx");
32
35
  const checkbox = require("../chunks/checkbox-tCMzL33G.js");
33
36
  const framerMotion = require("framer-motion");
37
+ const __iconNode = [
38
+ ["path", { d: "m7 15 5 5 5-5", key: "1hf1tw" }],
39
+ ["path", { d: "m7 9 5-5 5 5", key: "sgt6xg" }]
40
+ ];
41
+ const ChevronsUpDown = createLucideIcon.createLucideIcon("chevrons-up-down", __iconNode);
34
42
  const TableHeader = React.memo((t0) => {
35
43
  const $ = compilerRuntime.c(14);
36
44
  let children;
@@ -92,8 +100,24 @@ const TableHeader = React.memo((t0) => {
92
100
  return t3;
93
101
  });
94
102
  TableHeader.displayName = "TableHeader";
103
+ const initialValues = {
104
+ color: "primary",
105
+ disabledKeys: [],
106
+ isChecks: true,
107
+ selectKeys: [],
108
+ isActions: true,
109
+ widthAction: 100,
110
+ totalColumn: 0,
111
+ sortDescriptors: [],
112
+ onSortChange: () => {
113
+ }
114
+ };
115
+ const TableContext = React.createContext(initialValues);
116
+ const useTableContext = () => {
117
+ return React.useContext(TableContext);
118
+ };
95
119
  const TableHeaderColumn = React.memo((t0) => {
96
- const $ = compilerRuntime.c(21);
120
+ const $ = compilerRuntime.c(41);
97
121
  const {
98
122
  children,
99
123
  className,
@@ -116,6 +140,10 @@ const TableHeaderColumn = React.memo((t0) => {
116
140
  const icon = t2 === void 0 ? null : t2;
117
141
  const text = t3 === void 0 ? "" : t3;
118
142
  const colspan = t4 === void 0 ? void 0 : t4;
143
+ const {
144
+ sortDescriptors,
145
+ onSortChange
146
+ } = useTableContext();
119
147
  let t6;
120
148
  if ($[2] !== className) {
121
149
  t6 = tailwindMerge.twMerge("px-2 border-b border-divider", className);
@@ -151,9 +179,86 @@ const TableHeaderColumn = React.memo((t0) => {
151
179
  t10 = $[9];
152
180
  }
153
181
  const isChildrenEmpty = t10;
182
+ const isSortable = header?.sort;
183
+ header?.id;
154
184
  let t11;
155
- if ($[10] !== children || $[11] !== header?.information || $[12] !== icon || $[13] !== isChildrenEmpty || $[14] !== text) {
156
- t11 = isChildrenEmpty ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-center gap-x-2 font-medium", children: [
185
+ if ($[10] !== header?.id || $[11] !== sortDescriptors) {
186
+ t11 = sortDescriptors?.find((d) => d.column === header?.id);
187
+ $[10] = header?.id;
188
+ $[11] = sortDescriptors;
189
+ $[12] = t11;
190
+ } else {
191
+ t11 = $[12];
192
+ }
193
+ const currentSort = t11;
194
+ let t12;
195
+ if ($[13] !== currentSort || $[14] !== header?.id || $[15] !== sortDescriptors) {
196
+ t12 = () => {
197
+ if (!sortDescriptors || sortDescriptors.length <= 1 || !currentSort) {
198
+ return null;
199
+ }
200
+ return sortDescriptors.findIndex((d_0) => d_0.column === header?.id) + 1;
201
+ };
202
+ $[13] = currentSort;
203
+ $[14] = header?.id;
204
+ $[15] = sortDescriptors;
205
+ $[16] = t12;
206
+ } else {
207
+ t12 = $[16];
208
+ }
209
+ header?.id;
210
+ const sortOrderIndex = t12();
211
+ let t13;
212
+ if ($[17] !== header || $[18] !== isSortable || $[19] !== onSortChange) {
213
+ t13 = () => {
214
+ if (isSortable && onSortChange && header?.id) {
215
+ onSortChange(header.id);
216
+ }
217
+ };
218
+ $[17] = header;
219
+ $[18] = isSortable;
220
+ $[19] = onSortChange;
221
+ $[20] = t13;
222
+ } else {
223
+ t13 = $[20];
224
+ }
225
+ const handleSort = t13;
226
+ let t14;
227
+ if ($[21] !== currentSort || $[22] !== icon || $[23] !== isSortable || $[24] !== sortOrderIndex) {
228
+ t14 = () => {
229
+ if (!isSortable) {
230
+ return icon;
231
+ }
232
+ if (currentSort) {
233
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-0.5", children: [
234
+ sortOrderIndex && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-medium text-default-400", children: sortOrderIndex }),
235
+ currentSort.direction === "asc" ? /* @__PURE__ */ jsxRuntime.jsx(chevronUp.ChevronUp, { className: "h-4 w-4 text-primary" }) : /* @__PURE__ */ jsxRuntime.jsx(chevronDown.ChevronDown, { className: "h-4 w-4 text-primary" })
236
+ ] });
237
+ }
238
+ return /* @__PURE__ */ jsxRuntime.jsx(ChevronsUpDown, { className: "h-4 w-4 text-default-300" });
239
+ };
240
+ $[21] = currentSort;
241
+ $[22] = icon;
242
+ $[23] = isSortable;
243
+ $[24] = sortOrderIndex;
244
+ $[25] = t14;
245
+ } else {
246
+ t14 = $[25];
247
+ }
248
+ const renderSortIcon = t14;
249
+ const t15 = isSortable ? "cursor-pointer hover:bg-default-100 transition-colors" : "";
250
+ let t16;
251
+ if ($[26] !== mergedClass || $[27] !== t15) {
252
+ t16 = tailwindMerge.twMerge(mergedClass, t15);
253
+ $[26] = mergedClass;
254
+ $[27] = t15;
255
+ $[28] = t16;
256
+ } else {
257
+ t16 = $[28];
258
+ }
259
+ let t17;
260
+ if ($[29] !== children || $[30] !== header?.information || $[31] !== isChildrenEmpty || $[32] !== renderSortIcon || $[33] !== text) {
261
+ t17 = isChildrenEmpty ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-center gap-x-2 font-medium", children: [
157
262
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-2", children: [
158
263
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "line-clamp-1 text-xs text-foreground-500 dark:text-foreground-500 text-left", children: text }),
159
264
  header?.information && /* @__PURE__ */ jsxRuntime.jsx(tooltip.Tooltip, { content: header?.information || "", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { "aria-hidden": "true", role: "img", className: "text-default-300 cursor-pointer dark:text-foreground-500", width: 16, height: 16, viewBox: "0 0 24 24", children: /* @__PURE__ */ jsxRuntime.jsxs("g", { fill: "none", children: [
@@ -162,44 +267,32 @@ const TableHeaderColumn = React.memo((t0) => {
162
267
  /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: 1, cy: 1, r: 1, fill: "currentColor", transform: "matrix(1 0 0 -1 11 9)" })
163
268
  ] }) }) })
164
269
  ] }),
165
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 flex", children: icon })
270
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 flex justify-end", children: renderSortIcon() })
166
271
  ] }) : children;
167
- $[10] = children;
168
- $[11] = header?.information;
169
- $[12] = icon;
170
- $[13] = isChildrenEmpty;
171
- $[14] = text;
172
- $[15] = t11;
272
+ $[29] = children;
273
+ $[30] = header?.information;
274
+ $[31] = isChildrenEmpty;
275
+ $[32] = renderSortIcon;
276
+ $[33] = text;
277
+ $[34] = t17;
173
278
  } else {
174
- t11 = $[15];
279
+ t17 = $[34];
175
280
  }
176
- let t12;
177
- if ($[16] !== colspan || $[17] !== mergedClass || $[18] !== mergedStyle || $[19] !== t11) {
178
- t12 = /* @__PURE__ */ jsxRuntime.jsx("th", { className: mergedClass, style: mergedStyle, colSpan: colspan, children: t11 });
179
- $[16] = colspan;
180
- $[17] = mergedClass;
181
- $[18] = mergedStyle;
182
- $[19] = t11;
183
- $[20] = t12;
281
+ let t18;
282
+ if ($[35] !== colspan || $[36] !== handleSort || $[37] !== mergedStyle || $[38] !== t16 || $[39] !== t17) {
283
+ t18 = /* @__PURE__ */ jsxRuntime.jsx("th", { className: t16, style: mergedStyle, colSpan: colspan, onClick: handleSort, children: t17 });
284
+ $[35] = colspan;
285
+ $[36] = handleSort;
286
+ $[37] = mergedStyle;
287
+ $[38] = t16;
288
+ $[39] = t17;
289
+ $[40] = t18;
184
290
  } else {
185
- t12 = $[20];
291
+ t18 = $[40];
186
292
  }
187
- return t12;
293
+ return t18;
188
294
  });
189
295
  TableHeaderColumn.displayName = "TableHeaderColumn";
190
- const initialValues = {
191
- color: "primary",
192
- disabledKeys: [],
193
- isChecks: true,
194
- selectKeys: [],
195
- isActions: true,
196
- widthAction: 100,
197
- totalColumn: 0
198
- };
199
- const TableContext = React.createContext(initialValues);
200
- const useTableContext = () => {
201
- return React.useContext(TableContext);
202
- };
203
296
  const TableEmptyState = React.memo((t0) => {
204
297
  const $ = compilerRuntime.c(3);
205
298
  const {
@@ -228,7 +321,7 @@ const TableEmptyState = React.memo((t0) => {
228
321
  });
229
322
  TableEmptyState.displayName = "TableEmptyState";
230
323
  function TableBodyComponent(t0) {
231
- const $ = compilerRuntime.c(43);
324
+ const $ = compilerRuntime.c(45);
232
325
  let children;
233
326
  let className;
234
327
  let props;
@@ -285,27 +378,39 @@ function TableBodyComponent(t0) {
285
378
  isChecks
286
379
  } = useTableContext();
287
380
  const total = Number(totalColumn) + Number(isActions) + Number(isChecks);
288
- let t6;
289
- if ($[11] !== className) {
290
- t6 = tailwindMerge.twMerge(className);
291
- $[11] = className;
292
- $[12] = t6;
381
+ const t6 = props;
382
+ let domProps;
383
+ if ($[11] !== t6) {
384
+ domProps = {
385
+ ...t6
386
+ };
387
+ delete domProps.dataHeader;
388
+ $[11] = t6;
389
+ $[12] = domProps;
293
390
  } else {
294
- t6 = $[12];
391
+ domProps = $[12];
295
392
  }
296
- const mergedClass = t6;
297
393
  let t7;
394
+ if ($[13] !== className) {
395
+ t7 = tailwindMerge.twMerge(className);
396
+ $[13] = className;
397
+ $[14] = t7;
398
+ } else {
399
+ t7 = $[14];
400
+ }
401
+ const mergedClass = t7;
402
+ let t8;
298
403
  bb0: {
299
404
  if (!data || data.length === 0) {
300
- t7 = null;
405
+ t8 = null;
301
406
  break bb0;
302
407
  }
303
408
  if (typeof children === "function") {
304
- let t82;
305
- if ($[13] !== children || $[14] !== data || $[15] !== rowKey) {
306
- let t9;
307
- if ($[17] !== children || $[18] !== rowKey) {
308
- t9 = (el, index) => {
409
+ let t92;
410
+ if ($[15] !== children || $[16] !== data || $[17] !== rowKey) {
411
+ let t10;
412
+ if ($[19] !== children || $[20] !== rowKey) {
413
+ t10 = (el, index) => {
309
414
  const child = children({
310
415
  item: el,
311
416
  index
@@ -315,114 +420,114 @@ function TableBodyComponent(t0) {
315
420
  key: keyValue
316
421
  }) : null;
317
422
  };
318
- $[17] = children;
319
- $[18] = rowKey;
320
- $[19] = t9;
423
+ $[19] = children;
424
+ $[20] = rowKey;
425
+ $[21] = t10;
321
426
  } else {
322
- t9 = $[19];
427
+ t10 = $[21];
323
428
  }
324
- t82 = data.map(t9);
325
- $[13] = children;
326
- $[14] = data;
327
- $[15] = rowKey;
328
- $[16] = t82;
429
+ t92 = data.map(t10);
430
+ $[15] = children;
431
+ $[16] = data;
432
+ $[17] = rowKey;
433
+ $[18] = t92;
329
434
  } else {
330
- t82 = $[16];
435
+ t92 = $[18];
331
436
  }
332
- t7 = t82;
437
+ t8 = t92;
333
438
  } else {
334
- let t82;
335
- if ($[20] !== children || $[21] !== data || $[22] !== rowKey) {
336
- let t9;
337
- if ($[24] !== data || $[25] !== rowKey) {
338
- t9 = (child_0, index_0) => React.isValidElement(child_0) ? React.cloneElement(child_0, {
439
+ let t92;
440
+ if ($[22] !== children || $[23] !== data || $[24] !== rowKey) {
441
+ let t10;
442
+ if ($[26] !== data || $[27] !== rowKey) {
443
+ t10 = (child_0, index_0) => React.isValidElement(child_0) ? React.cloneElement(child_0, {
339
444
  key: rowKey ? rowKey(data[index_0], index_0) : index_0
340
445
  }) : child_0;
341
- $[24] = data;
342
- $[25] = rowKey;
343
- $[26] = t9;
446
+ $[26] = data;
447
+ $[27] = rowKey;
448
+ $[28] = t10;
344
449
  } else {
345
- t9 = $[26];
450
+ t10 = $[28];
346
451
  }
347
- t82 = React.Children.map(children, t9);
348
- $[20] = children;
349
- $[21] = data;
350
- $[22] = rowKey;
351
- $[23] = t82;
452
+ t92 = React.Children.map(children, t10);
453
+ $[22] = children;
454
+ $[23] = data;
455
+ $[24] = rowKey;
456
+ $[25] = t92;
352
457
  } else {
353
- t82 = $[23];
458
+ t92 = $[25];
354
459
  }
355
- t7 = t82;
460
+ t8 = t92;
356
461
  }
357
462
  }
358
- const renderedRows = t7;
463
+ const renderedRows = t8;
359
464
  let fallbackContent = null;
360
465
  if (isLoading) {
361
- let t82;
362
- if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
363
- t82 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3.5", children: /* @__PURE__ */ jsxRuntime.jsx(loaderCircle.LoaderCircle, { size: 45 }) });
364
- $[27] = t82;
466
+ let t92;
467
+ if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
468
+ t92 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3.5", children: /* @__PURE__ */ jsxRuntime.jsx(loaderCircle.LoaderCircle, { size: 45 }) });
469
+ $[29] = t92;
365
470
  } else {
366
- t82 = $[27];
471
+ t92 = $[29];
367
472
  }
368
- let t9;
369
- if ($[28] !== loadingLabel) {
370
- t9 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center relative", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col justify-center items-center gap-2", children: [
371
- t82,
473
+ let t10;
474
+ if ($[30] !== loadingLabel) {
475
+ t10 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center relative", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col justify-center items-center gap-2", children: [
476
+ t92,
372
477
  /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "line-clamp-1 text-sm text-default-800", children: loadingLabel }) })
373
478
  ] }) });
374
- $[28] = loadingLabel;
375
- $[29] = t9;
479
+ $[30] = loadingLabel;
480
+ $[31] = t10;
376
481
  } else {
377
- t9 = $[29];
482
+ t10 = $[31];
378
483
  }
379
- let t10;
380
- if ($[30] !== t9 || $[31] !== total) {
381
- t10 = /* @__PURE__ */ jsxRuntime.jsx("tr", { className: "border-b border-divider", children: /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-2 py-2.5 w-full", colSpan: total, children: t9 }) });
382
- $[30] = t9;
383
- $[31] = total;
484
+ let t11;
485
+ if ($[32] !== t10 || $[33] !== total) {
486
+ t11 = /* @__PURE__ */ jsxRuntime.jsx("tr", { className: "border-b border-divider", children: /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-2 py-2.5 w-full", colSpan: total, children: t10 }) });
384
487
  $[32] = t10;
488
+ $[33] = total;
489
+ $[34] = t11;
385
490
  } else {
386
- t10 = $[32];
491
+ t11 = $[34];
387
492
  }
388
- fallbackContent = t10;
493
+ fallbackContent = t11;
389
494
  } else {
390
495
  if (data.length === 0) {
391
- let t82;
392
- if ($[33] !== emptyText) {
393
- t82 = /* @__PURE__ */ jsxRuntime.jsx(TableEmptyState, { text: emptyText });
394
- $[33] = emptyText;
395
- $[34] = t82;
496
+ let t92;
497
+ if ($[35] !== emptyText) {
498
+ t92 = /* @__PURE__ */ jsxRuntime.jsx(TableEmptyState, { text: emptyText });
499
+ $[35] = emptyText;
500
+ $[36] = t92;
396
501
  } else {
397
- t82 = $[34];
502
+ t92 = $[36];
398
503
  }
399
- let t9;
400
- if ($[35] !== t82 || $[36] !== total) {
401
- t9 = /* @__PURE__ */ jsxRuntime.jsx("tr", { className: "border-b border-divider", children: /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-2 py-10 w-full", colSpan: total, children: t82 }) });
402
- $[35] = t82;
403
- $[36] = total;
404
- $[37] = t9;
504
+ let t10;
505
+ if ($[37] !== t92 || $[38] !== total) {
506
+ t10 = /* @__PURE__ */ jsxRuntime.jsx("tr", { className: "border-b border-divider", children: /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-2 py-10 w-full", colSpan: total, children: t92 }) });
507
+ $[37] = t92;
508
+ $[38] = total;
509
+ $[39] = t10;
405
510
  } else {
406
- t9 = $[37];
511
+ t10 = $[39];
407
512
  }
408
- fallbackContent = t9;
513
+ fallbackContent = t10;
409
514
  }
410
515
  }
411
- let t8;
412
- if ($[38] !== fallbackContent || $[39] !== mergedClass || $[40] !== props || $[41] !== renderedRows) {
413
- t8 = /* @__PURE__ */ jsxRuntime.jsxs("tbody", { className: mergedClass, ...props, children: [
516
+ let t9;
517
+ if ($[40] !== domProps || $[41] !== fallbackContent || $[42] !== mergedClass || $[43] !== renderedRows) {
518
+ t9 = /* @__PURE__ */ jsxRuntime.jsxs("tbody", { className: mergedClass, ...domProps, children: [
414
519
  renderedRows,
415
520
  fallbackContent
416
521
  ] });
417
- $[38] = fallbackContent;
418
- $[39] = mergedClass;
419
- $[40] = props;
420
- $[41] = renderedRows;
421
- $[42] = t8;
522
+ $[40] = domProps;
523
+ $[41] = fallbackContent;
524
+ $[42] = mergedClass;
525
+ $[43] = renderedRows;
526
+ $[44] = t9;
422
527
  } else {
423
- t8 = $[42];
528
+ t9 = $[44];
424
529
  }
425
- return t8;
530
+ return t9;
426
531
  }
427
532
  const TableBody = React.memo((props) => {
428
533
  const $ = compilerRuntime.c(2);
@@ -956,7 +1061,10 @@ const TableHOC = ({
956
1061
  selectKeys = [],
957
1062
  isActions = true,
958
1063
  widthAction = 100,
959
- dataHeader
1064
+ dataHeader,
1065
+ sortDescriptors,
1066
+ onSortChange,
1067
+ ...otherProps
960
1068
  } = props;
961
1069
  const tableClass = React.useMemo(() => tailwindMerge.twMerge("table-main-container w-full border-collapse table-auto", className), [className]);
962
1070
  const containerClass = React.useMemo(() => tailwindMerge.twMerge("max-w-full overflow-x-auto overflow-y-auto bg-content1", classNameContainer), [classNameContainer]);
@@ -967,9 +1075,12 @@ const TableHOC = ({
967
1075
  selectKeys,
968
1076
  isActions,
969
1077
  widthAction,
970
- totalColumn: dataHeader?.length || 0
1078
+ totalColumn: dataHeader?.length || 0,
1079
+ sortDescriptors,
1080
+ onSortChange
971
1081
  }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: containerClass, children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.LazyMotion, { features: () => import("framer-motion").then((res) => res.domAnimation), children: /* @__PURE__ */ jsxRuntime.jsx("table", { className: tableClass, children: React.Children.map(children, (child) => React.isValidElement(child) ? React.cloneElement(child, {
972
- ...props
1082
+ dataHeader,
1083
+ ...otherProps
973
1084
  }) : child) }) }) }) }) });
974
1085
  };
975
1086
  const Table = Object.assign(TableHOC, {
@@ -983,45 +1094,56 @@ const Table = Object.assign(TableHOC, {
983
1094
  BodyColumn: TableBodyColumn
984
1095
  });
985
1096
  const useTable = (t0) => {
986
- const $ = compilerRuntime.c(15);
1097
+ const $ = compilerRuntime.c(19);
987
1098
  const {
988
1099
  initialDisabledKeys: t1,
989
1100
  initialSelectKey: t2,
990
- initialValueSearch: t3
1101
+ initialValueSearch: t3,
1102
+ initialSortDescriptors: t4
991
1103
  } = t0;
992
- let t4;
1104
+ let t5;
993
1105
  if ($[0] !== t1) {
994
- t4 = t1 === void 0 ? [] : t1;
1106
+ t5 = t1 === void 0 ? [] : t1;
995
1107
  $[0] = t1;
996
- $[1] = t4;
1108
+ $[1] = t5;
997
1109
  } else {
998
- t4 = $[1];
1110
+ t5 = $[1];
999
1111
  }
1000
- const initialDisabledKeys = t4;
1001
- let t5;
1112
+ const initialDisabledKeys = t5;
1113
+ let t6;
1002
1114
  if ($[2] !== t2) {
1003
- t5 = t2 === void 0 ? [] : t2;
1115
+ t6 = t2 === void 0 ? [] : t2;
1004
1116
  $[2] = t2;
1005
- $[3] = t5;
1117
+ $[3] = t6;
1006
1118
  } else {
1007
- t5 = $[3];
1119
+ t6 = $[3];
1008
1120
  }
1009
- const initialSelectKey = t5;
1010
- let t6;
1121
+ const initialSelectKey = t6;
1122
+ let t7;
1011
1123
  if ($[4] !== t3) {
1012
- t6 = t3 === void 0 ? {} : t3;
1124
+ t7 = t3 === void 0 ? {} : t3;
1013
1125
  $[4] = t3;
1014
- $[5] = t6;
1126
+ $[5] = t7;
1015
1127
  } else {
1016
- t6 = $[5];
1128
+ t7 = $[5];
1129
+ }
1130
+ const initialValueSearch = t7;
1131
+ let t8;
1132
+ if ($[6] !== t4) {
1133
+ t8 = t4 === void 0 ? [] : t4;
1134
+ $[6] = t4;
1135
+ $[7] = t8;
1136
+ } else {
1137
+ t8 = $[7];
1017
1138
  }
1018
- const initialValueSearch = t6;
1139
+ const initialSortDescriptors = t8;
1019
1140
  const [selectKeys, setSelectKeys] = React.useState(initialSelectKey);
1020
1141
  const [disabledKeys, setDisabledKeys] = React.useState(initialDisabledKeys);
1021
1142
  const [valueSearch, setValueSearch] = React.useState(initialValueSearch);
1022
- let t7;
1023
- if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
1024
- t7 = (value) => {
1143
+ const [sortDescriptors, setSortDescriptors] = React.useState(initialSortDescriptors);
1144
+ let t9;
1145
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
1146
+ t9 = (value) => {
1025
1147
  setSelectKeys((prev) => {
1026
1148
  const exists = prev.some((el) => el.id === value.id);
1027
1149
  if (exists) {
@@ -1030,44 +1152,44 @@ const useTable = (t0) => {
1030
1152
  return [...prev, value];
1031
1153
  });
1032
1154
  };
1033
- $[6] = t7;
1155
+ $[8] = t9;
1034
1156
  } else {
1035
- t7 = $[6];
1157
+ t9 = $[8];
1036
1158
  }
1037
- const handleSelectKey = t7;
1038
- let t8;
1039
- if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
1040
- t8 = (value_0) => {
1159
+ const handleSelectKey = t9;
1160
+ let t10;
1161
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
1162
+ t10 = (value_0) => {
1041
1163
  setSelectKeys(value_0);
1042
1164
  };
1043
- $[7] = t8;
1165
+ $[9] = t10;
1044
1166
  } else {
1045
- t8 = $[7];
1167
+ t10 = $[9];
1046
1168
  }
1047
- const handleSelectKeys = t8;
1048
- let t9;
1049
- if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
1050
- t9 = (value_1) => {
1169
+ const handleSelectKeys = t10;
1170
+ let t11;
1171
+ if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
1172
+ t11 = (value_1) => {
1051
1173
  setDisabledKeys(value_1);
1052
1174
  };
1053
- $[8] = t9;
1175
+ $[10] = t11;
1054
1176
  } else {
1055
- t9 = $[8];
1177
+ t11 = $[10];
1056
1178
  }
1057
- const handleDisabledKeys = t9;
1058
- let t10;
1059
- if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
1060
- t10 = () => {
1179
+ const handleDisabledKeys = t11;
1180
+ let t12;
1181
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
1182
+ t12 = () => {
1061
1183
  setSelectKeys([]);
1062
1184
  };
1063
- $[9] = t10;
1185
+ $[11] = t12;
1064
1186
  } else {
1065
- t10 = $[9];
1187
+ t12 = $[11];
1066
1188
  }
1067
- const handleResetSelectKeys = t10;
1068
- let t11;
1069
- if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
1070
- t11 = (key, value_2) => {
1189
+ const handleResetSelectKeys = t12;
1190
+ let t13;
1191
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
1192
+ t13 = (key, value_2) => {
1071
1193
  setValueSearch((prev_0) => {
1072
1194
  if (prev_0[key] === value_2) {
1073
1195
  return prev_0;
@@ -1083,31 +1205,63 @@ const useTable = (t0) => {
1083
1205
  return newState;
1084
1206
  });
1085
1207
  };
1086
- $[10] = t11;
1208
+ $[12] = t13;
1087
1209
  } else {
1088
- t11 = $[10];
1210
+ t13 = $[12];
1089
1211
  }
1090
- const handleSetValueSearch = t11;
1091
- let t12;
1092
- if ($[11] !== disabledKeys || $[12] !== selectKeys || $[13] !== valueSearch) {
1093
- t12 = {
1212
+ const handleSetValueSearch = t13;
1213
+ let t14;
1214
+ if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
1215
+ t14 = (column) => {
1216
+ setSortDescriptors((prev_1) => {
1217
+ const existingIndex = prev_1.findIndex((s) => s.column === column);
1218
+ if (existingIndex !== -1) {
1219
+ const existing = prev_1[existingIndex];
1220
+ if (existing.direction === "asc") {
1221
+ const newSorts = [...prev_1];
1222
+ newSorts[existingIndex] = {
1223
+ ...existing,
1224
+ direction: "desc"
1225
+ };
1226
+ return newSorts;
1227
+ } else {
1228
+ return prev_1.filter((s_0) => s_0.column !== column);
1229
+ }
1230
+ }
1231
+ return [...prev_1, {
1232
+ column,
1233
+ direction: "asc"
1234
+ }];
1235
+ });
1236
+ };
1237
+ $[13] = t14;
1238
+ } else {
1239
+ t14 = $[13];
1240
+ }
1241
+ const handleSort = t14;
1242
+ let t15;
1243
+ if ($[14] !== disabledKeys || $[15] !== selectKeys || $[16] !== sortDescriptors || $[17] !== valueSearch) {
1244
+ t15 = {
1094
1245
  selectKeys,
1095
1246
  disabledKeys,
1096
1247
  valueSearch,
1248
+ sortDescriptors,
1097
1249
  handleSelectKeys,
1098
1250
  handleSelectKey,
1099
1251
  handleDisabledKeys,
1100
1252
  handleSetValueSearch,
1101
- handleResetSelectKeys
1253
+ handleResetSelectKeys,
1254
+ handleSort
1102
1255
  };
1103
- $[11] = disabledKeys;
1104
- $[12] = selectKeys;
1105
- $[13] = valueSearch;
1106
- $[14] = t12;
1256
+ $[14] = disabledKeys;
1257
+ $[15] = selectKeys;
1258
+ $[16] = sortDescriptors;
1259
+ $[17] = valueSearch;
1260
+ $[18] = t15;
1107
1261
  } else {
1108
- t12 = $[14];
1262
+ t15 = $[18];
1109
1263
  }
1110
- return t12;
1264
+ return t15;
1111
1265
  };
1112
1266
  exports.Table = Table;
1113
1267
  exports.TableHOC = TableHOC;