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
@@ -3,10 +3,18 @@ import { c } from "react/compiler-runtime";
3
3
  import React__default, { isValidElement, createContext, useContext, memo, forwardRef, useId, useMemo, useState } from "react";
4
4
  import { twMerge } from "tailwind-merge";
5
5
  import { T as Tooltip } from "../chunks/tooltip-BVafMD5T.js";
6
+ import { C as ChevronUp } from "../chunks/chevron-up-BBd-SipB.js";
7
+ import { C as ChevronDown } from "../chunks/chevron-down-D-14pIT_.js";
8
+ import { c as createLucideIcon } from "../chunks/createLucideIcon-C5oU6LEj.js";
6
9
  import { L as LoaderCircle } from "../chunks/loader-circle-CeKbzHTN.js";
7
10
  import clsx from "clsx";
8
11
  import { C as Checkbox } from "../chunks/checkbox-upIIzsyW.js";
9
12
  import { AnimatePresence, LazyMotion } from "framer-motion";
13
+ const __iconNode = [
14
+ ["path", { d: "m7 15 5 5 5-5", key: "1hf1tw" }],
15
+ ["path", { d: "m7 9 5-5 5 5", key: "sgt6xg" }]
16
+ ];
17
+ const ChevronsUpDown = createLucideIcon("chevrons-up-down", __iconNode);
10
18
  const TableHeader = React__default.memo((t0) => {
11
19
  const $ = c(14);
12
20
  let children;
@@ -68,8 +76,24 @@ const TableHeader = React__default.memo((t0) => {
68
76
  return t3;
69
77
  });
70
78
  TableHeader.displayName = "TableHeader";
79
+ const initialValues = {
80
+ color: "primary",
81
+ disabledKeys: [],
82
+ isChecks: true,
83
+ selectKeys: [],
84
+ isActions: true,
85
+ widthAction: 100,
86
+ totalColumn: 0,
87
+ sortDescriptors: [],
88
+ onSortChange: () => {
89
+ }
90
+ };
91
+ const TableContext = createContext(initialValues);
92
+ const useTableContext = () => {
93
+ return useContext(TableContext);
94
+ };
71
95
  const TableHeaderColumn = React__default.memo((t0) => {
72
- const $ = c(21);
96
+ const $ = c(41);
73
97
  const {
74
98
  children,
75
99
  className,
@@ -92,6 +116,10 @@ const TableHeaderColumn = React__default.memo((t0) => {
92
116
  const icon = t2 === void 0 ? null : t2;
93
117
  const text = t3 === void 0 ? "" : t3;
94
118
  const colspan = t4 === void 0 ? void 0 : t4;
119
+ const {
120
+ sortDescriptors,
121
+ onSortChange
122
+ } = useTableContext();
95
123
  let t6;
96
124
  if ($[2] !== className) {
97
125
  t6 = twMerge("px-2 border-b border-divider", className);
@@ -127,9 +155,86 @@ const TableHeaderColumn = React__default.memo((t0) => {
127
155
  t10 = $[9];
128
156
  }
129
157
  const isChildrenEmpty = t10;
158
+ const isSortable = header?.sort;
159
+ header?.id;
130
160
  let t11;
131
- if ($[10] !== children || $[11] !== header?.information || $[12] !== icon || $[13] !== isChildrenEmpty || $[14] !== text) {
132
- t11 = isChildrenEmpty ? /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center gap-x-2 font-medium", children: [
161
+ if ($[10] !== header?.id || $[11] !== sortDescriptors) {
162
+ t11 = sortDescriptors?.find((d) => d.column === header?.id);
163
+ $[10] = header?.id;
164
+ $[11] = sortDescriptors;
165
+ $[12] = t11;
166
+ } else {
167
+ t11 = $[12];
168
+ }
169
+ const currentSort = t11;
170
+ let t12;
171
+ if ($[13] !== currentSort || $[14] !== header?.id || $[15] !== sortDescriptors) {
172
+ t12 = () => {
173
+ if (!sortDescriptors || sortDescriptors.length <= 1 || !currentSort) {
174
+ return null;
175
+ }
176
+ return sortDescriptors.findIndex((d_0) => d_0.column === header?.id) + 1;
177
+ };
178
+ $[13] = currentSort;
179
+ $[14] = header?.id;
180
+ $[15] = sortDescriptors;
181
+ $[16] = t12;
182
+ } else {
183
+ t12 = $[16];
184
+ }
185
+ header?.id;
186
+ const sortOrderIndex = t12();
187
+ let t13;
188
+ if ($[17] !== header || $[18] !== isSortable || $[19] !== onSortChange) {
189
+ t13 = () => {
190
+ if (isSortable && onSortChange && header?.id) {
191
+ onSortChange(header.id);
192
+ }
193
+ };
194
+ $[17] = header;
195
+ $[18] = isSortable;
196
+ $[19] = onSortChange;
197
+ $[20] = t13;
198
+ } else {
199
+ t13 = $[20];
200
+ }
201
+ const handleSort = t13;
202
+ let t14;
203
+ if ($[21] !== currentSort || $[22] !== icon || $[23] !== isSortable || $[24] !== sortOrderIndex) {
204
+ t14 = () => {
205
+ if (!isSortable) {
206
+ return icon;
207
+ }
208
+ if (currentSort) {
209
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5", children: [
210
+ sortOrderIndex && /* @__PURE__ */ jsx("span", { className: "text-[10px] font-medium text-default-400", children: sortOrderIndex }),
211
+ currentSort.direction === "asc" ? /* @__PURE__ */ jsx(ChevronUp, { className: "h-4 w-4 text-primary" }) : /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4 text-primary" })
212
+ ] });
213
+ }
214
+ return /* @__PURE__ */ jsx(ChevronsUpDown, { className: "h-4 w-4 text-default-300" });
215
+ };
216
+ $[21] = currentSort;
217
+ $[22] = icon;
218
+ $[23] = isSortable;
219
+ $[24] = sortOrderIndex;
220
+ $[25] = t14;
221
+ } else {
222
+ t14 = $[25];
223
+ }
224
+ const renderSortIcon = t14;
225
+ const t15 = isSortable ? "cursor-pointer hover:bg-default-100 transition-colors" : "";
226
+ let t16;
227
+ if ($[26] !== mergedClass || $[27] !== t15) {
228
+ t16 = twMerge(mergedClass, t15);
229
+ $[26] = mergedClass;
230
+ $[27] = t15;
231
+ $[28] = t16;
232
+ } else {
233
+ t16 = $[28];
234
+ }
235
+ let t17;
236
+ if ($[29] !== children || $[30] !== header?.information || $[31] !== isChildrenEmpty || $[32] !== renderSortIcon || $[33] !== text) {
237
+ t17 = isChildrenEmpty ? /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center gap-x-2 font-medium", children: [
133
238
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2", children: [
134
239
  /* @__PURE__ */ jsx("p", { className: "line-clamp-1 text-xs text-foreground-500 dark:text-foreground-500 text-left", children: text }),
135
240
  header?.information && /* @__PURE__ */ jsx(Tooltip, { content: header?.information || "", children: /* @__PURE__ */ 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__ */ jsxs("g", { fill: "none", children: [
@@ -138,44 +243,32 @@ const TableHeaderColumn = React__default.memo((t0) => {
138
243
  /* @__PURE__ */ jsx("circle", { cx: 1, cy: 1, r: 1, fill: "currentColor", transform: "matrix(1 0 0 -1 11 9)" })
139
244
  ] }) }) })
140
245
  ] }),
141
- /* @__PURE__ */ jsx("div", { className: "flex-1 flex", children: icon })
246
+ /* @__PURE__ */ jsx("div", { className: "flex-1 flex justify-end", children: renderSortIcon() })
142
247
  ] }) : children;
143
- $[10] = children;
144
- $[11] = header?.information;
145
- $[12] = icon;
146
- $[13] = isChildrenEmpty;
147
- $[14] = text;
148
- $[15] = t11;
248
+ $[29] = children;
249
+ $[30] = header?.information;
250
+ $[31] = isChildrenEmpty;
251
+ $[32] = renderSortIcon;
252
+ $[33] = text;
253
+ $[34] = t17;
149
254
  } else {
150
- t11 = $[15];
255
+ t17 = $[34];
151
256
  }
152
- let t12;
153
- if ($[16] !== colspan || $[17] !== mergedClass || $[18] !== mergedStyle || $[19] !== t11) {
154
- t12 = /* @__PURE__ */ jsx("th", { className: mergedClass, style: mergedStyle, colSpan: colspan, children: t11 });
155
- $[16] = colspan;
156
- $[17] = mergedClass;
157
- $[18] = mergedStyle;
158
- $[19] = t11;
159
- $[20] = t12;
257
+ let t18;
258
+ if ($[35] !== colspan || $[36] !== handleSort || $[37] !== mergedStyle || $[38] !== t16 || $[39] !== t17) {
259
+ t18 = /* @__PURE__ */ jsx("th", { className: t16, style: mergedStyle, colSpan: colspan, onClick: handleSort, children: t17 });
260
+ $[35] = colspan;
261
+ $[36] = handleSort;
262
+ $[37] = mergedStyle;
263
+ $[38] = t16;
264
+ $[39] = t17;
265
+ $[40] = t18;
160
266
  } else {
161
- t12 = $[20];
267
+ t18 = $[40];
162
268
  }
163
- return t12;
269
+ return t18;
164
270
  });
165
271
  TableHeaderColumn.displayName = "TableHeaderColumn";
166
- const initialValues = {
167
- color: "primary",
168
- disabledKeys: [],
169
- isChecks: true,
170
- selectKeys: [],
171
- isActions: true,
172
- widthAction: 100,
173
- totalColumn: 0
174
- };
175
- const TableContext = createContext(initialValues);
176
- const useTableContext = () => {
177
- return useContext(TableContext);
178
- };
179
272
  const TableEmptyState = memo((t0) => {
180
273
  const $ = c(3);
181
274
  const {
@@ -204,7 +297,7 @@ const TableEmptyState = memo((t0) => {
204
297
  });
205
298
  TableEmptyState.displayName = "TableEmptyState";
206
299
  function TableBodyComponent(t0) {
207
- const $ = c(43);
300
+ const $ = c(45);
208
301
  let children;
209
302
  let className;
210
303
  let props;
@@ -261,27 +354,39 @@ function TableBodyComponent(t0) {
261
354
  isChecks
262
355
  } = useTableContext();
263
356
  const total = Number(totalColumn) + Number(isActions) + Number(isChecks);
264
- let t6;
265
- if ($[11] !== className) {
266
- t6 = twMerge(className);
267
- $[11] = className;
268
- $[12] = t6;
357
+ const t6 = props;
358
+ let domProps;
359
+ if ($[11] !== t6) {
360
+ domProps = {
361
+ ...t6
362
+ };
363
+ delete domProps.dataHeader;
364
+ $[11] = t6;
365
+ $[12] = domProps;
269
366
  } else {
270
- t6 = $[12];
367
+ domProps = $[12];
271
368
  }
272
- const mergedClass = t6;
273
369
  let t7;
370
+ if ($[13] !== className) {
371
+ t7 = twMerge(className);
372
+ $[13] = className;
373
+ $[14] = t7;
374
+ } else {
375
+ t7 = $[14];
376
+ }
377
+ const mergedClass = t7;
378
+ let t8;
274
379
  bb0: {
275
380
  if (!data || data.length === 0) {
276
- t7 = null;
381
+ t8 = null;
277
382
  break bb0;
278
383
  }
279
384
  if (typeof children === "function") {
280
- let t82;
281
- if ($[13] !== children || $[14] !== data || $[15] !== rowKey) {
282
- let t9;
283
- if ($[17] !== children || $[18] !== rowKey) {
284
- t9 = (el, index) => {
385
+ let t92;
386
+ if ($[15] !== children || $[16] !== data || $[17] !== rowKey) {
387
+ let t10;
388
+ if ($[19] !== children || $[20] !== rowKey) {
389
+ t10 = (el, index) => {
285
390
  const child = children({
286
391
  item: el,
287
392
  index
@@ -291,114 +396,114 @@ function TableBodyComponent(t0) {
291
396
  key: keyValue
292
397
  }) : null;
293
398
  };
294
- $[17] = children;
295
- $[18] = rowKey;
296
- $[19] = t9;
399
+ $[19] = children;
400
+ $[20] = rowKey;
401
+ $[21] = t10;
297
402
  } else {
298
- t9 = $[19];
403
+ t10 = $[21];
299
404
  }
300
- t82 = data.map(t9);
301
- $[13] = children;
302
- $[14] = data;
303
- $[15] = rowKey;
304
- $[16] = t82;
405
+ t92 = data.map(t10);
406
+ $[15] = children;
407
+ $[16] = data;
408
+ $[17] = rowKey;
409
+ $[18] = t92;
305
410
  } else {
306
- t82 = $[16];
411
+ t92 = $[18];
307
412
  }
308
- t7 = t82;
413
+ t8 = t92;
309
414
  } else {
310
- let t82;
311
- if ($[20] !== children || $[21] !== data || $[22] !== rowKey) {
312
- let t9;
313
- if ($[24] !== data || $[25] !== rowKey) {
314
- t9 = (child_0, index_0) => isValidElement(child_0) ? React__default.cloneElement(child_0, {
415
+ let t92;
416
+ if ($[22] !== children || $[23] !== data || $[24] !== rowKey) {
417
+ let t10;
418
+ if ($[26] !== data || $[27] !== rowKey) {
419
+ t10 = (child_0, index_0) => isValidElement(child_0) ? React__default.cloneElement(child_0, {
315
420
  key: rowKey ? rowKey(data[index_0], index_0) : index_0
316
421
  }) : child_0;
317
- $[24] = data;
318
- $[25] = rowKey;
319
- $[26] = t9;
422
+ $[26] = data;
423
+ $[27] = rowKey;
424
+ $[28] = t10;
320
425
  } else {
321
- t9 = $[26];
426
+ t10 = $[28];
322
427
  }
323
- t82 = React__default.Children.map(children, t9);
324
- $[20] = children;
325
- $[21] = data;
326
- $[22] = rowKey;
327
- $[23] = t82;
428
+ t92 = React__default.Children.map(children, t10);
429
+ $[22] = children;
430
+ $[23] = data;
431
+ $[24] = rowKey;
432
+ $[25] = t92;
328
433
  } else {
329
- t82 = $[23];
434
+ t92 = $[25];
330
435
  }
331
- t7 = t82;
436
+ t8 = t92;
332
437
  }
333
438
  }
334
- const renderedRows = t7;
439
+ const renderedRows = t8;
335
440
  let fallbackContent = null;
336
441
  if (isLoading) {
337
- let t82;
338
- if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
339
- t82 = /* @__PURE__ */ jsx("div", { className: "mt-3.5", children: /* @__PURE__ */ jsx(LoaderCircle, { size: 45 }) });
340
- $[27] = t82;
442
+ let t92;
443
+ if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
444
+ t92 = /* @__PURE__ */ jsx("div", { className: "mt-3.5", children: /* @__PURE__ */ jsx(LoaderCircle, { size: 45 }) });
445
+ $[29] = t92;
341
446
  } else {
342
- t82 = $[27];
447
+ t92 = $[29];
343
448
  }
344
- let t9;
345
- if ($[28] !== loadingLabel) {
346
- t9 = /* @__PURE__ */ jsx("div", { className: "flex justify-center relative", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col justify-center items-center gap-2", children: [
347
- t82,
449
+ let t10;
450
+ if ($[30] !== loadingLabel) {
451
+ t10 = /* @__PURE__ */ jsx("div", { className: "flex justify-center relative", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col justify-center items-center gap-2", children: [
452
+ t92,
348
453
  /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("p", { className: "line-clamp-1 text-sm text-default-800", children: loadingLabel }) })
349
454
  ] }) });
350
- $[28] = loadingLabel;
351
- $[29] = t9;
455
+ $[30] = loadingLabel;
456
+ $[31] = t10;
352
457
  } else {
353
- t9 = $[29];
458
+ t10 = $[31];
354
459
  }
355
- let t10;
356
- if ($[30] !== t9 || $[31] !== total) {
357
- t10 = /* @__PURE__ */ jsx("tr", { className: "border-b border-divider", children: /* @__PURE__ */ jsx("td", { className: "px-2 py-2.5 w-full", colSpan: total, children: t9 }) });
358
- $[30] = t9;
359
- $[31] = total;
460
+ let t11;
461
+ if ($[32] !== t10 || $[33] !== total) {
462
+ t11 = /* @__PURE__ */ jsx("tr", { className: "border-b border-divider", children: /* @__PURE__ */ jsx("td", { className: "px-2 py-2.5 w-full", colSpan: total, children: t10 }) });
360
463
  $[32] = t10;
464
+ $[33] = total;
465
+ $[34] = t11;
361
466
  } else {
362
- t10 = $[32];
467
+ t11 = $[34];
363
468
  }
364
- fallbackContent = t10;
469
+ fallbackContent = t11;
365
470
  } else {
366
471
  if (data.length === 0) {
367
- let t82;
368
- if ($[33] !== emptyText) {
369
- t82 = /* @__PURE__ */ jsx(TableEmptyState, { text: emptyText });
370
- $[33] = emptyText;
371
- $[34] = t82;
472
+ let t92;
473
+ if ($[35] !== emptyText) {
474
+ t92 = /* @__PURE__ */ jsx(TableEmptyState, { text: emptyText });
475
+ $[35] = emptyText;
476
+ $[36] = t92;
372
477
  } else {
373
- t82 = $[34];
478
+ t92 = $[36];
374
479
  }
375
- let t9;
376
- if ($[35] !== t82 || $[36] !== total) {
377
- t9 = /* @__PURE__ */ jsx("tr", { className: "border-b border-divider", children: /* @__PURE__ */ jsx("td", { className: "px-2 py-10 w-full", colSpan: total, children: t82 }) });
378
- $[35] = t82;
379
- $[36] = total;
380
- $[37] = t9;
480
+ let t10;
481
+ if ($[37] !== t92 || $[38] !== total) {
482
+ t10 = /* @__PURE__ */ jsx("tr", { className: "border-b border-divider", children: /* @__PURE__ */ jsx("td", { className: "px-2 py-10 w-full", colSpan: total, children: t92 }) });
483
+ $[37] = t92;
484
+ $[38] = total;
485
+ $[39] = t10;
381
486
  } else {
382
- t9 = $[37];
487
+ t10 = $[39];
383
488
  }
384
- fallbackContent = t9;
489
+ fallbackContent = t10;
385
490
  }
386
491
  }
387
- let t8;
388
- if ($[38] !== fallbackContent || $[39] !== mergedClass || $[40] !== props || $[41] !== renderedRows) {
389
- t8 = /* @__PURE__ */ jsxs("tbody", { className: mergedClass, ...props, children: [
492
+ let t9;
493
+ if ($[40] !== domProps || $[41] !== fallbackContent || $[42] !== mergedClass || $[43] !== renderedRows) {
494
+ t9 = /* @__PURE__ */ jsxs("tbody", { className: mergedClass, ...domProps, children: [
390
495
  renderedRows,
391
496
  fallbackContent
392
497
  ] });
393
- $[38] = fallbackContent;
394
- $[39] = mergedClass;
395
- $[40] = props;
396
- $[41] = renderedRows;
397
- $[42] = t8;
498
+ $[40] = domProps;
499
+ $[41] = fallbackContent;
500
+ $[42] = mergedClass;
501
+ $[43] = renderedRows;
502
+ $[44] = t9;
398
503
  } else {
399
- t8 = $[42];
504
+ t9 = $[44];
400
505
  }
401
- return t8;
506
+ return t9;
402
507
  }
403
508
  const TableBody = memo((props) => {
404
509
  const $ = c(2);
@@ -932,7 +1037,10 @@ const TableHOC = ({
932
1037
  selectKeys = [],
933
1038
  isActions = true,
934
1039
  widthAction = 100,
935
- dataHeader
1040
+ dataHeader,
1041
+ sortDescriptors,
1042
+ onSortChange,
1043
+ ...otherProps
936
1044
  } = props;
937
1045
  const tableClass = useMemo(() => twMerge("table-main-container w-full border-collapse table-auto", className), [className]);
938
1046
  const containerClass = useMemo(() => twMerge("max-w-full overflow-x-auto overflow-y-auto bg-content1", classNameContainer), [classNameContainer]);
@@ -943,9 +1051,12 @@ const TableHOC = ({
943
1051
  selectKeys,
944
1052
  isActions,
945
1053
  widthAction,
946
- totalColumn: dataHeader?.length || 0
1054
+ totalColumn: dataHeader?.length || 0,
1055
+ sortDescriptors,
1056
+ onSortChange
947
1057
  }, children: /* @__PURE__ */ jsx("div", { className: containerClass, children: /* @__PURE__ */ jsx(AnimatePresence, { children: /* @__PURE__ */ jsx(LazyMotion, { features: () => import("framer-motion").then((res) => res.domAnimation), children: /* @__PURE__ */ jsx("table", { className: tableClass, children: React__default.Children.map(children, (child) => isValidElement(child) ? React__default.cloneElement(child, {
948
- ...props
1058
+ dataHeader,
1059
+ ...otherProps
949
1060
  }) : child) }) }) }) }) });
950
1061
  };
951
1062
  const Table = Object.assign(TableHOC, {
@@ -959,45 +1070,56 @@ const Table = Object.assign(TableHOC, {
959
1070
  BodyColumn: TableBodyColumn
960
1071
  });
961
1072
  const useTable = (t0) => {
962
- const $ = c(15);
1073
+ const $ = c(19);
963
1074
  const {
964
1075
  initialDisabledKeys: t1,
965
1076
  initialSelectKey: t2,
966
- initialValueSearch: t3
1077
+ initialValueSearch: t3,
1078
+ initialSortDescriptors: t4
967
1079
  } = t0;
968
- let t4;
1080
+ let t5;
969
1081
  if ($[0] !== t1) {
970
- t4 = t1 === void 0 ? [] : t1;
1082
+ t5 = t1 === void 0 ? [] : t1;
971
1083
  $[0] = t1;
972
- $[1] = t4;
1084
+ $[1] = t5;
973
1085
  } else {
974
- t4 = $[1];
1086
+ t5 = $[1];
975
1087
  }
976
- const initialDisabledKeys = t4;
977
- let t5;
1088
+ const initialDisabledKeys = t5;
1089
+ let t6;
978
1090
  if ($[2] !== t2) {
979
- t5 = t2 === void 0 ? [] : t2;
1091
+ t6 = t2 === void 0 ? [] : t2;
980
1092
  $[2] = t2;
981
- $[3] = t5;
1093
+ $[3] = t6;
982
1094
  } else {
983
- t5 = $[3];
1095
+ t6 = $[3];
984
1096
  }
985
- const initialSelectKey = t5;
986
- let t6;
1097
+ const initialSelectKey = t6;
1098
+ let t7;
987
1099
  if ($[4] !== t3) {
988
- t6 = t3 === void 0 ? {} : t3;
1100
+ t7 = t3 === void 0 ? {} : t3;
989
1101
  $[4] = t3;
990
- $[5] = t6;
1102
+ $[5] = t7;
991
1103
  } else {
992
- t6 = $[5];
1104
+ t7 = $[5];
1105
+ }
1106
+ const initialValueSearch = t7;
1107
+ let t8;
1108
+ if ($[6] !== t4) {
1109
+ t8 = t4 === void 0 ? [] : t4;
1110
+ $[6] = t4;
1111
+ $[7] = t8;
1112
+ } else {
1113
+ t8 = $[7];
993
1114
  }
994
- const initialValueSearch = t6;
1115
+ const initialSortDescriptors = t8;
995
1116
  const [selectKeys, setSelectKeys] = useState(initialSelectKey);
996
1117
  const [disabledKeys, setDisabledKeys] = useState(initialDisabledKeys);
997
1118
  const [valueSearch, setValueSearch] = useState(initialValueSearch);
998
- let t7;
999
- if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
1000
- t7 = (value) => {
1119
+ const [sortDescriptors, setSortDescriptors] = useState(initialSortDescriptors);
1120
+ let t9;
1121
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
1122
+ t9 = (value) => {
1001
1123
  setSelectKeys((prev) => {
1002
1124
  const exists = prev.some((el) => el.id === value.id);
1003
1125
  if (exists) {
@@ -1006,44 +1128,44 @@ const useTable = (t0) => {
1006
1128
  return [...prev, value];
1007
1129
  });
1008
1130
  };
1009
- $[6] = t7;
1131
+ $[8] = t9;
1010
1132
  } else {
1011
- t7 = $[6];
1133
+ t9 = $[8];
1012
1134
  }
1013
- const handleSelectKey = t7;
1014
- let t8;
1015
- if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
1016
- t8 = (value_0) => {
1135
+ const handleSelectKey = t9;
1136
+ let t10;
1137
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
1138
+ t10 = (value_0) => {
1017
1139
  setSelectKeys(value_0);
1018
1140
  };
1019
- $[7] = t8;
1141
+ $[9] = t10;
1020
1142
  } else {
1021
- t8 = $[7];
1143
+ t10 = $[9];
1022
1144
  }
1023
- const handleSelectKeys = t8;
1024
- let t9;
1025
- if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
1026
- t9 = (value_1) => {
1145
+ const handleSelectKeys = t10;
1146
+ let t11;
1147
+ if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
1148
+ t11 = (value_1) => {
1027
1149
  setDisabledKeys(value_1);
1028
1150
  };
1029
- $[8] = t9;
1151
+ $[10] = t11;
1030
1152
  } else {
1031
- t9 = $[8];
1153
+ t11 = $[10];
1032
1154
  }
1033
- const handleDisabledKeys = t9;
1034
- let t10;
1035
- if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
1036
- t10 = () => {
1155
+ const handleDisabledKeys = t11;
1156
+ let t12;
1157
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
1158
+ t12 = () => {
1037
1159
  setSelectKeys([]);
1038
1160
  };
1039
- $[9] = t10;
1161
+ $[11] = t12;
1040
1162
  } else {
1041
- t10 = $[9];
1163
+ t12 = $[11];
1042
1164
  }
1043
- const handleResetSelectKeys = t10;
1044
- let t11;
1045
- if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
1046
- t11 = (key, value_2) => {
1165
+ const handleResetSelectKeys = t12;
1166
+ let t13;
1167
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
1168
+ t13 = (key, value_2) => {
1047
1169
  setValueSearch((prev_0) => {
1048
1170
  if (prev_0[key] === value_2) {
1049
1171
  return prev_0;
@@ -1059,31 +1181,63 @@ const useTable = (t0) => {
1059
1181
  return newState;
1060
1182
  });
1061
1183
  };
1062
- $[10] = t11;
1184
+ $[12] = t13;
1063
1185
  } else {
1064
- t11 = $[10];
1186
+ t13 = $[12];
1065
1187
  }
1066
- const handleSetValueSearch = t11;
1067
- let t12;
1068
- if ($[11] !== disabledKeys || $[12] !== selectKeys || $[13] !== valueSearch) {
1069
- t12 = {
1188
+ const handleSetValueSearch = t13;
1189
+ let t14;
1190
+ if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
1191
+ t14 = (column) => {
1192
+ setSortDescriptors((prev_1) => {
1193
+ const existingIndex = prev_1.findIndex((s) => s.column === column);
1194
+ if (existingIndex !== -1) {
1195
+ const existing = prev_1[existingIndex];
1196
+ if (existing.direction === "asc") {
1197
+ const newSorts = [...prev_1];
1198
+ newSorts[existingIndex] = {
1199
+ ...existing,
1200
+ direction: "desc"
1201
+ };
1202
+ return newSorts;
1203
+ } else {
1204
+ return prev_1.filter((s_0) => s_0.column !== column);
1205
+ }
1206
+ }
1207
+ return [...prev_1, {
1208
+ column,
1209
+ direction: "asc"
1210
+ }];
1211
+ });
1212
+ };
1213
+ $[13] = t14;
1214
+ } else {
1215
+ t14 = $[13];
1216
+ }
1217
+ const handleSort = t14;
1218
+ let t15;
1219
+ if ($[14] !== disabledKeys || $[15] !== selectKeys || $[16] !== sortDescriptors || $[17] !== valueSearch) {
1220
+ t15 = {
1070
1221
  selectKeys,
1071
1222
  disabledKeys,
1072
1223
  valueSearch,
1224
+ sortDescriptors,
1073
1225
  handleSelectKeys,
1074
1226
  handleSelectKey,
1075
1227
  handleDisabledKeys,
1076
1228
  handleSetValueSearch,
1077
- handleResetSelectKeys
1229
+ handleResetSelectKeys,
1230
+ handleSort
1078
1231
  };
1079
- $[11] = disabledKeys;
1080
- $[12] = selectKeys;
1081
- $[13] = valueSearch;
1082
- $[14] = t12;
1232
+ $[14] = disabledKeys;
1233
+ $[15] = selectKeys;
1234
+ $[16] = sortDescriptors;
1235
+ $[17] = valueSearch;
1236
+ $[18] = t15;
1083
1237
  } else {
1084
- t12 = $[14];
1238
+ t15 = $[18];
1085
1239
  }
1086
- return t12;
1240
+ return t15;
1087
1241
  };
1088
1242
  export {
1089
1243
  Table,