lizaui 9.0.53 → 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 (46) 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/context/table.context.d.ts.map +1 -1
  22. package/dist/components/table/header/table-header-column.d.ts.map +1 -1
  23. package/dist/components/table/hook/use-table.d.ts +3 -2
  24. package/dist/components/table/hook/use-table.d.ts.map +1 -1
  25. package/dist/components/table/interface/table.interface.d.ts +9 -0
  26. package/dist/components/table/interface/table.interface.d.ts.map +1 -1
  27. package/dist/components/table/table.d.ts.map +1 -1
  28. package/dist/pagination/index.cjs.js +1 -1
  29. package/dist/pagination/index.es.js +1 -1
  30. package/dist/phone-input/index.cjs.js +4 -3
  31. package/dist/phone-input/index.cjs.js.map +1 -1
  32. package/dist/phone-input/index.es.js +3 -2
  33. package/dist/phone-input/index.es.js.map +1 -1
  34. package/dist/table/index.cjs.js +232 -92
  35. package/dist/table/index.cjs.js.map +1 -1
  36. package/dist/table/index.es.js +232 -92
  37. package/dist/table/index.es.js.map +1 -1
  38. package/dist/ui/index.cjs.js +6 -5
  39. package/dist/ui/index.cjs.js.map +1 -1
  40. package/dist/ui/index.es.js +6 -5
  41. package/dist/ui/index.es.js.map +1 -1
  42. package/package.json +1 -1
  43. package/dist/chunks/index--Lp5VMoT.js.map +0 -1
  44. package/dist/chunks/index-xVewW5kR.js.map +0 -1
  45. package/dist/chunks/select-Bm7MENHi.js.map +0 -1
  46. 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 {
@@ -969,6 +1062,8 @@ const TableHOC = ({
969
1062
  isActions = true,
970
1063
  widthAction = 100,
971
1064
  dataHeader,
1065
+ sortDescriptors,
1066
+ onSortChange,
972
1067
  ...otherProps
973
1068
  } = props;
974
1069
  const tableClass = React.useMemo(() => tailwindMerge.twMerge("table-main-container w-full border-collapse table-auto", className), [className]);
@@ -980,7 +1075,9 @@ const TableHOC = ({
980
1075
  selectKeys,
981
1076
  isActions,
982
1077
  widthAction,
983
- totalColumn: dataHeader?.length || 0
1078
+ totalColumn: dataHeader?.length || 0,
1079
+ sortDescriptors,
1080
+ onSortChange
984
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, {
985
1082
  dataHeader,
986
1083
  ...otherProps
@@ -997,45 +1094,56 @@ const Table = Object.assign(TableHOC, {
997
1094
  BodyColumn: TableBodyColumn
998
1095
  });
999
1096
  const useTable = (t0) => {
1000
- const $ = compilerRuntime.c(15);
1097
+ const $ = compilerRuntime.c(19);
1001
1098
  const {
1002
1099
  initialDisabledKeys: t1,
1003
1100
  initialSelectKey: t2,
1004
- initialValueSearch: t3
1101
+ initialValueSearch: t3,
1102
+ initialSortDescriptors: t4
1005
1103
  } = t0;
1006
- let t4;
1104
+ let t5;
1007
1105
  if ($[0] !== t1) {
1008
- t4 = t1 === void 0 ? [] : t1;
1106
+ t5 = t1 === void 0 ? [] : t1;
1009
1107
  $[0] = t1;
1010
- $[1] = t4;
1108
+ $[1] = t5;
1011
1109
  } else {
1012
- t4 = $[1];
1110
+ t5 = $[1];
1013
1111
  }
1014
- const initialDisabledKeys = t4;
1015
- let t5;
1112
+ const initialDisabledKeys = t5;
1113
+ let t6;
1016
1114
  if ($[2] !== t2) {
1017
- t5 = t2 === void 0 ? [] : t2;
1115
+ t6 = t2 === void 0 ? [] : t2;
1018
1116
  $[2] = t2;
1019
- $[3] = t5;
1117
+ $[3] = t6;
1020
1118
  } else {
1021
- t5 = $[3];
1119
+ t6 = $[3];
1022
1120
  }
1023
- const initialSelectKey = t5;
1024
- let t6;
1121
+ const initialSelectKey = t6;
1122
+ let t7;
1025
1123
  if ($[4] !== t3) {
1026
- t6 = t3 === void 0 ? {} : t3;
1124
+ t7 = t3 === void 0 ? {} : t3;
1027
1125
  $[4] = t3;
1028
- $[5] = t6;
1126
+ $[5] = t7;
1127
+ } else {
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;
1029
1136
  } else {
1030
- t6 = $[5];
1137
+ t8 = $[7];
1031
1138
  }
1032
- const initialValueSearch = t6;
1139
+ const initialSortDescriptors = t8;
1033
1140
  const [selectKeys, setSelectKeys] = React.useState(initialSelectKey);
1034
1141
  const [disabledKeys, setDisabledKeys] = React.useState(initialDisabledKeys);
1035
1142
  const [valueSearch, setValueSearch] = React.useState(initialValueSearch);
1036
- let t7;
1037
- if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
1038
- t7 = (value) => {
1143
+ const [sortDescriptors, setSortDescriptors] = React.useState(initialSortDescriptors);
1144
+ let t9;
1145
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
1146
+ t9 = (value) => {
1039
1147
  setSelectKeys((prev) => {
1040
1148
  const exists = prev.some((el) => el.id === value.id);
1041
1149
  if (exists) {
@@ -1044,44 +1152,44 @@ const useTable = (t0) => {
1044
1152
  return [...prev, value];
1045
1153
  });
1046
1154
  };
1047
- $[6] = t7;
1155
+ $[8] = t9;
1048
1156
  } else {
1049
- t7 = $[6];
1157
+ t9 = $[8];
1050
1158
  }
1051
- const handleSelectKey = t7;
1052
- let t8;
1053
- if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
1054
- t8 = (value_0) => {
1159
+ const handleSelectKey = t9;
1160
+ let t10;
1161
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
1162
+ t10 = (value_0) => {
1055
1163
  setSelectKeys(value_0);
1056
1164
  };
1057
- $[7] = t8;
1165
+ $[9] = t10;
1058
1166
  } else {
1059
- t8 = $[7];
1167
+ t10 = $[9];
1060
1168
  }
1061
- const handleSelectKeys = t8;
1062
- let t9;
1063
- if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
1064
- t9 = (value_1) => {
1169
+ const handleSelectKeys = t10;
1170
+ let t11;
1171
+ if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
1172
+ t11 = (value_1) => {
1065
1173
  setDisabledKeys(value_1);
1066
1174
  };
1067
- $[8] = t9;
1175
+ $[10] = t11;
1068
1176
  } else {
1069
- t9 = $[8];
1177
+ t11 = $[10];
1070
1178
  }
1071
- const handleDisabledKeys = t9;
1072
- let t10;
1073
- if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
1074
- t10 = () => {
1179
+ const handleDisabledKeys = t11;
1180
+ let t12;
1181
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
1182
+ t12 = () => {
1075
1183
  setSelectKeys([]);
1076
1184
  };
1077
- $[9] = t10;
1185
+ $[11] = t12;
1078
1186
  } else {
1079
- t10 = $[9];
1187
+ t12 = $[11];
1080
1188
  }
1081
- const handleResetSelectKeys = t10;
1082
- let t11;
1083
- if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
1084
- 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) => {
1085
1193
  setValueSearch((prev_0) => {
1086
1194
  if (prev_0[key] === value_2) {
1087
1195
  return prev_0;
@@ -1097,31 +1205,63 @@ const useTable = (t0) => {
1097
1205
  return newState;
1098
1206
  });
1099
1207
  };
1100
- $[10] = t11;
1208
+ $[12] = t13;
1101
1209
  } else {
1102
- t11 = $[10];
1210
+ t13 = $[12];
1103
1211
  }
1104
- const handleSetValueSearch = t11;
1105
- let t12;
1106
- if ($[11] !== disabledKeys || $[12] !== selectKeys || $[13] !== valueSearch) {
1107
- 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 = {
1108
1245
  selectKeys,
1109
1246
  disabledKeys,
1110
1247
  valueSearch,
1248
+ sortDescriptors,
1111
1249
  handleSelectKeys,
1112
1250
  handleSelectKey,
1113
1251
  handleDisabledKeys,
1114
1252
  handleSetValueSearch,
1115
- handleResetSelectKeys
1253
+ handleResetSelectKeys,
1254
+ handleSort
1116
1255
  };
1117
- $[11] = disabledKeys;
1118
- $[12] = selectKeys;
1119
- $[13] = valueSearch;
1120
- $[14] = t12;
1256
+ $[14] = disabledKeys;
1257
+ $[15] = selectKeys;
1258
+ $[16] = sortDescriptors;
1259
+ $[17] = valueSearch;
1260
+ $[18] = t15;
1121
1261
  } else {
1122
- t12 = $[14];
1262
+ t15 = $[18];
1123
1263
  }
1124
- return t12;
1264
+ return t15;
1125
1265
  };
1126
1266
  exports.Table = Table;
1127
1267
  exports.TableHOC = TableHOC;