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
@@ -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 {
@@ -945,6 +1038,8 @@ const TableHOC = ({
945
1038
  isActions = true,
946
1039
  widthAction = 100,
947
1040
  dataHeader,
1041
+ sortDescriptors,
1042
+ onSortChange,
948
1043
  ...otherProps
949
1044
  } = props;
950
1045
  const tableClass = useMemo(() => twMerge("table-main-container w-full border-collapse table-auto", className), [className]);
@@ -956,7 +1051,9 @@ const TableHOC = ({
956
1051
  selectKeys,
957
1052
  isActions,
958
1053
  widthAction,
959
- totalColumn: dataHeader?.length || 0
1054
+ totalColumn: dataHeader?.length || 0,
1055
+ sortDescriptors,
1056
+ onSortChange
960
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, {
961
1058
  dataHeader,
962
1059
  ...otherProps
@@ -973,45 +1070,56 @@ const Table = Object.assign(TableHOC, {
973
1070
  BodyColumn: TableBodyColumn
974
1071
  });
975
1072
  const useTable = (t0) => {
976
- const $ = c(15);
1073
+ const $ = c(19);
977
1074
  const {
978
1075
  initialDisabledKeys: t1,
979
1076
  initialSelectKey: t2,
980
- initialValueSearch: t3
1077
+ initialValueSearch: t3,
1078
+ initialSortDescriptors: t4
981
1079
  } = t0;
982
- let t4;
1080
+ let t5;
983
1081
  if ($[0] !== t1) {
984
- t4 = t1 === void 0 ? [] : t1;
1082
+ t5 = t1 === void 0 ? [] : t1;
985
1083
  $[0] = t1;
986
- $[1] = t4;
1084
+ $[1] = t5;
987
1085
  } else {
988
- t4 = $[1];
1086
+ t5 = $[1];
989
1087
  }
990
- const initialDisabledKeys = t4;
991
- let t5;
1088
+ const initialDisabledKeys = t5;
1089
+ let t6;
992
1090
  if ($[2] !== t2) {
993
- t5 = t2 === void 0 ? [] : t2;
1091
+ t6 = t2 === void 0 ? [] : t2;
994
1092
  $[2] = t2;
995
- $[3] = t5;
1093
+ $[3] = t6;
996
1094
  } else {
997
- t5 = $[3];
1095
+ t6 = $[3];
998
1096
  }
999
- const initialSelectKey = t5;
1000
- let t6;
1097
+ const initialSelectKey = t6;
1098
+ let t7;
1001
1099
  if ($[4] !== t3) {
1002
- t6 = t3 === void 0 ? {} : t3;
1100
+ t7 = t3 === void 0 ? {} : t3;
1003
1101
  $[4] = t3;
1004
- $[5] = t6;
1102
+ $[5] = t7;
1103
+ } else {
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;
1005
1112
  } else {
1006
- t6 = $[5];
1113
+ t8 = $[7];
1007
1114
  }
1008
- const initialValueSearch = t6;
1115
+ const initialSortDescriptors = t8;
1009
1116
  const [selectKeys, setSelectKeys] = useState(initialSelectKey);
1010
1117
  const [disabledKeys, setDisabledKeys] = useState(initialDisabledKeys);
1011
1118
  const [valueSearch, setValueSearch] = useState(initialValueSearch);
1012
- let t7;
1013
- if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
1014
- t7 = (value) => {
1119
+ const [sortDescriptors, setSortDescriptors] = useState(initialSortDescriptors);
1120
+ let t9;
1121
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
1122
+ t9 = (value) => {
1015
1123
  setSelectKeys((prev) => {
1016
1124
  const exists = prev.some((el) => el.id === value.id);
1017
1125
  if (exists) {
@@ -1020,44 +1128,44 @@ const useTable = (t0) => {
1020
1128
  return [...prev, value];
1021
1129
  });
1022
1130
  };
1023
- $[6] = t7;
1131
+ $[8] = t9;
1024
1132
  } else {
1025
- t7 = $[6];
1133
+ t9 = $[8];
1026
1134
  }
1027
- const handleSelectKey = t7;
1028
- let t8;
1029
- if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
1030
- t8 = (value_0) => {
1135
+ const handleSelectKey = t9;
1136
+ let t10;
1137
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
1138
+ t10 = (value_0) => {
1031
1139
  setSelectKeys(value_0);
1032
1140
  };
1033
- $[7] = t8;
1141
+ $[9] = t10;
1034
1142
  } else {
1035
- t8 = $[7];
1143
+ t10 = $[9];
1036
1144
  }
1037
- const handleSelectKeys = t8;
1038
- let t9;
1039
- if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
1040
- t9 = (value_1) => {
1145
+ const handleSelectKeys = t10;
1146
+ let t11;
1147
+ if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
1148
+ t11 = (value_1) => {
1041
1149
  setDisabledKeys(value_1);
1042
1150
  };
1043
- $[8] = t9;
1151
+ $[10] = t11;
1044
1152
  } else {
1045
- t9 = $[8];
1153
+ t11 = $[10];
1046
1154
  }
1047
- const handleDisabledKeys = t9;
1048
- let t10;
1049
- if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
1050
- t10 = () => {
1155
+ const handleDisabledKeys = t11;
1156
+ let t12;
1157
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
1158
+ t12 = () => {
1051
1159
  setSelectKeys([]);
1052
1160
  };
1053
- $[9] = t10;
1161
+ $[11] = t12;
1054
1162
  } else {
1055
- t10 = $[9];
1163
+ t12 = $[11];
1056
1164
  }
1057
- const handleResetSelectKeys = t10;
1058
- let t11;
1059
- if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
1060
- 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) => {
1061
1169
  setValueSearch((prev_0) => {
1062
1170
  if (prev_0[key] === value_2) {
1063
1171
  return prev_0;
@@ -1073,31 +1181,63 @@ const useTable = (t0) => {
1073
1181
  return newState;
1074
1182
  });
1075
1183
  };
1076
- $[10] = t11;
1184
+ $[12] = t13;
1077
1185
  } else {
1078
- t11 = $[10];
1186
+ t13 = $[12];
1079
1187
  }
1080
- const handleSetValueSearch = t11;
1081
- let t12;
1082
- if ($[11] !== disabledKeys || $[12] !== selectKeys || $[13] !== valueSearch) {
1083
- 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 = {
1084
1221
  selectKeys,
1085
1222
  disabledKeys,
1086
1223
  valueSearch,
1224
+ sortDescriptors,
1087
1225
  handleSelectKeys,
1088
1226
  handleSelectKey,
1089
1227
  handleDisabledKeys,
1090
1228
  handleSetValueSearch,
1091
- handleResetSelectKeys
1229
+ handleResetSelectKeys,
1230
+ handleSort
1092
1231
  };
1093
- $[11] = disabledKeys;
1094
- $[12] = selectKeys;
1095
- $[13] = valueSearch;
1096
- $[14] = t12;
1232
+ $[14] = disabledKeys;
1233
+ $[15] = selectKeys;
1234
+ $[16] = sortDescriptors;
1235
+ $[17] = valueSearch;
1236
+ $[18] = t15;
1097
1237
  } else {
1098
- t12 = $[14];
1238
+ t15 = $[18];
1099
1239
  }
1100
- return t12;
1240
+ return t15;
1101
1241
  };
1102
1242
  export {
1103
1243
  Table,