componenteszw-package 1.0.80 → 1.0.82

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.
package/dist/index.js CHANGED
@@ -56,7 +56,7 @@ var h = "-", g = (e) => {
56
56
  nextPart: /* @__PURE__ */ new Map(),
57
57
  validators: []
58
58
  };
59
- return w(Object.entries(e.classGroups), n).forEach(([e, n]) => {
59
+ return C(Object.entries(e.classGroups), n).forEach(([e, n]) => {
60
60
  x(n, r, e, t);
61
61
  }), r;
62
62
  }, x = (e, t, n, r) => {
@@ -67,7 +67,7 @@ var h = "-", g = (e) => {
67
67
  return;
68
68
  }
69
69
  if (typeof e == "function") {
70
- if (C(e)) {
70
+ if (ee(e)) {
71
71
  x(e(r), t, n, r);
72
72
  return;
73
73
  }
@@ -89,7 +89,7 @@ var h = "-", g = (e) => {
89
89
  validators: []
90
90
  }), n = n.nextPart.get(e);
91
91
  }), n;
92
- }, C = (e) => e.isThemeGetter, w = (e, t) => t ? e.map(([e, n]) => [e, n.map((e) => typeof e == "string" ? t + e : typeof e == "object" ? Object.fromEntries(Object.entries(e).map(([e, n]) => [t + e, n])) : e)]) : e, T = (e) => {
92
+ }, ee = (e) => e.isThemeGetter, C = (e, t) => t ? e.map(([e, n]) => [e, n.map((e) => typeof e == "string" ? t + e : typeof e == "object" ? Object.fromEntries(Object.entries(e).map(([e, n]) => [t + e, n])) : e)]) : e, w = (e) => {
93
93
  if (e < 1) return {
94
94
  get: () => void 0,
95
95
  set: () => {}
@@ -107,7 +107,7 @@ var h = "-", g = (e) => {
107
107
  n.has(e) ? n.set(e, t) : i(e, t);
108
108
  }
109
109
  };
110
- }, E = "!", ee = (e) => {
110
+ }, T = "!", E = (e) => {
111
111
  let { separator: t, experimentalParseClassName: n } = e, r = t.length === 1, i = t[0], a = t.length, o = (e) => {
112
112
  let n = [], o = 0, s = 0, c;
113
113
  for (let l = 0; l < e.length; l++) {
@@ -124,7 +124,7 @@ var h = "-", g = (e) => {
124
124
  }
125
125
  u === "[" ? o++ : u === "]" && o--;
126
126
  }
127
- let l = n.length === 0 ? e : e.substring(s), u = l.startsWith(E);
127
+ let l = n.length === 0 ? e : e.substring(s), u = l.startsWith(T);
128
128
  return {
129
129
  modifiers: n,
130
130
  hasImportantModifier: u,
@@ -143,8 +143,8 @@ var h = "-", g = (e) => {
143
143
  e[0] === "[" ? (t.push(...n.sort(), e), n = []) : n.push(e);
144
144
  }), t.push(...n.sort()), t;
145
145
  }, te = (e) => ({
146
- cache: T(e.cacheSize),
147
- parseClassName: ee(e),
146
+ cache: w(e.cacheSize),
147
+ parseClassName: E(e),
148
148
  ...g(e)
149
149
  }), ne = /\s+/, re = (e, t) => {
150
150
  let { parseClassName: n, getClassGroupId: r, getConflictingClassGroupIds: i } = t, a = [], o = e.trim().split(ne), s = "";
@@ -161,7 +161,7 @@ var h = "-", g = (e) => {
161
161
  }
162
162
  f = !1;
163
163
  }
164
- let m = D(c).join(":"), h = l ? m + E : m, g = h + p;
164
+ let m = D(c).join(":"), h = l ? m + T : m, g = h + p;
165
165
  if (a.includes(g)) continue;
166
166
  a.push(g);
167
167
  let _ = i(p, f);
@@ -214,17 +214,17 @@ var O = (e) => {
214
214
  let r = se.exec(e);
215
215
  return r ? r[1] ? typeof t == "string" ? r[1] === t : t.has(r[1]) : n(r[2]) : !1;
216
216
  }, Ee = (e) => ue.test(e) && !de.test(e), De = () => !1, Oe = (e) => fe.test(e), ke = (e) => pe.test(e), Ae = /* @__PURE__ */ oe(() => {
217
- let e = O("colors"), t = O("spacing"), n = O("blur"), r = O("brightness"), i = O("borderColor"), a = O("borderRadius"), o = O("borderSpacing"), s = O("borderWidth"), c = O("contrast"), l = O("grayscale"), u = O("hueRotate"), d = O("invert"), f = O("gap"), p = O("gradientColorStops"), m = O("gradientColorStopPositions"), h = O("inset"), g = O("margin"), _ = O("opacity"), v = O("padding"), y = O("saturate"), b = O("scale"), x = O("sepia"), S = O("skew"), C = O("space"), w = O("translate"), T = () => [
217
+ let e = O("colors"), t = O("spacing"), n = O("blur"), r = O("brightness"), i = O("borderColor"), a = O("borderRadius"), o = O("borderSpacing"), s = O("borderWidth"), c = O("contrast"), l = O("grayscale"), u = O("hueRotate"), d = O("invert"), f = O("gap"), p = O("gradientColorStops"), m = O("gradientColorStopPositions"), h = O("inset"), g = O("margin"), _ = O("opacity"), v = O("padding"), y = O("saturate"), b = O("scale"), x = O("sepia"), S = O("skew"), ee = O("space"), C = O("translate"), w = () => [
218
218
  "auto",
219
219
  "contain",
220
220
  "none"
221
- ], E = () => [
221
+ ], T = () => [
222
222
  "auto",
223
223
  "hidden",
224
224
  "clip",
225
225
  "visible",
226
226
  "scroll"
227
- ], ee = () => [
227
+ ], E = () => [
228
228
  "auto",
229
229
  M,
230
230
  t
@@ -321,8 +321,8 @@ var O = (e) => {
321
321
  gap: D(),
322
322
  gradientColorStops: [e],
323
323
  gradientColorStopPositions: [_e, j],
324
- inset: ee(),
325
- margin: ee(),
324
+ inset: E(),
325
+ margin: E(),
326
326
  opacity: k(),
327
327
  padding: D(),
328
328
  saturate: k(),
@@ -398,12 +398,12 @@ var O = (e) => {
398
398
  "scale-down"
399
399
  ] }],
400
400
  "object-position": [{ object: [...re(), M] }],
401
- overflow: [{ overflow: E() }],
402
- "overflow-x": [{ "overflow-x": E() }],
403
- "overflow-y": [{ "overflow-y": E() }],
404
- overscroll: [{ overscroll: T() }],
405
- "overscroll-x": [{ "overscroll-x": T() }],
406
- "overscroll-y": [{ "overscroll-y": T() }],
401
+ overflow: [{ overflow: T() }],
402
+ "overflow-x": [{ "overflow-x": T() }],
403
+ "overflow-y": [{ "overflow-y": T() }],
404
+ overscroll: [{ overscroll: w() }],
405
+ "overscroll-x": [{ "overscroll-x": w() }],
406
+ "overscroll-y": [{ "overscroll-y": w() }],
407
407
  position: [
408
408
  "static",
409
409
  "fixed",
@@ -430,7 +430,7 @@ var O = (e) => {
430
430
  ge,
431
431
  M
432
432
  ] }],
433
- basis: [{ basis: ee() }],
433
+ basis: [{ basis: E() }],
434
434
  "flex-direction": [{ flex: [
435
435
  "row",
436
436
  "row-reverse",
@@ -569,9 +569,9 @@ var O = (e) => {
569
569
  mr: [{ mr: [g] }],
570
570
  mb: [{ mb: [g] }],
571
571
  ml: [{ ml: [g] }],
572
- "space-x": [{ "space-x": [C] }],
572
+ "space-x": [{ "space-x": [ee] }],
573
573
  "space-x-reverse": ["space-x-reverse"],
574
- "space-y": [{ "space-y": [C] }],
574
+ "space-y": [{ "space-y": [ee] }],
575
575
  "space-y-reverse": ["space-y-reverse"],
576
576
  w: [{ w: [
577
577
  "auto",
@@ -966,8 +966,8 @@ var O = (e) => {
966
966
  "scale-x": [{ "scale-x": [b] }],
967
967
  "scale-y": [{ "scale-y": [b] }],
968
968
  rotate: [{ rotate: [ge, M] }],
969
- "translate-x": [{ "translate-x": [w] }],
970
- "translate-y": [{ "translate-y": [w] }],
969
+ "translate-x": [{ "translate-x": [C] }],
970
+ "translate-y": [{ "translate-y": [C] }],
971
971
  "skew-x": [{ "skew-x": [S] }],
972
972
  "skew-y": [{ "skew-y": [S] }],
973
973
  "transform-origin": [{ origin: [
@@ -27080,7 +27080,7 @@ var Pe = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Fe = (e)
27080
27080
  y1: "19",
27081
27081
  y2: "19",
27082
27082
  key: "q2wloq"
27083
- }]]), UE = F("test-tube-diagonal", [
27083
+ }]]), Q = F("test-tube-diagonal", [
27084
27084
  ["path", {
27085
27085
  d: "M21 7 6.82 21.18a2.83 2.83 0 0 1-3.99-.01a2.83 2.83 0 0 1 0-4L17 3",
27086
27086
  key: "1ub6xw"
@@ -27093,7 +27093,7 @@ var Pe = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Fe = (e)
27093
27093
  d: "M12 16H4",
27094
27094
  key: "1cjfip"
27095
27095
  }]
27096
- ]), WE = F("test-tube", [
27096
+ ]), UE = F("test-tube", [
27097
27097
  ["path", {
27098
27098
  d: "M14.5 2v17.5c0 1.4-1.1 2.5-2.5 2.5c-1.4 0-2.5-1.1-2.5-2.5V2",
27099
27099
  key: "125lnx"
@@ -27106,7 +27106,7 @@ var Pe = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Fe = (e)
27106
27106
  d: "M14.5 16h-5",
27107
27107
  key: "1ox875"
27108
27108
  }]
27109
- ]), GE = F("test-tubes", [
27109
+ ]), WE = F("test-tubes", [
27110
27110
  ["path", {
27111
27111
  d: "M9 2v17.5A2.5 2.5 0 0 1 6.5 22A2.5 2.5 0 0 1 4 19.5V2",
27112
27112
  key: "1hjrqt"
@@ -27131,7 +27131,7 @@ var Pe = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Fe = (e)
27131
27131
  d: "M20 16h-5",
27132
27132
  key: "ddnjpe"
27133
27133
  }]
27134
- ]), KE = F("text-cursor-input", [
27134
+ ]), GE = F("text-cursor-input", [
27135
27135
  ["path", {
27136
27136
  d: "M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6",
27137
27137
  key: "1528k5"
@@ -27152,7 +27152,7 @@ var Pe = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Fe = (e)
27152
27152
  d: "M9 6v12",
27153
27153
  key: "velyjx"
27154
27154
  }]
27155
- ]), qE = F("text-cursor", [
27155
+ ]), KE = F("text-cursor", [
27156
27156
  ["path", {
27157
27157
  d: "M17 22h-1a4 4 0 0 1-4-4V6a4 4 0 0 1 4-4h1",
27158
27158
  key: "uvaxm9"
@@ -27165,7 +27165,7 @@ var Pe = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Fe = (e)
27165
27165
  d: "M7 2h1a4 4 0 0 1 4 4v1",
27166
27166
  key: "1uw06m"
27167
27167
  }]
27168
- ]), JE = F("text-quote", [
27168
+ ]), qE = F("text-quote", [
27169
27169
  ["path", {
27170
27170
  d: "M17 6H3",
27171
27171
  key: "16j9eg"
@@ -27182,7 +27182,7 @@ var Pe = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Fe = (e)
27182
27182
  d: "M3 12v6",
27183
27183
  key: "fv4c87"
27184
27184
  }]
27185
- ]), YE = F("text-search", [
27185
+ ]), JE = F("text-search", [
27186
27186
  ["path", {
27187
27187
  d: "M21 6H3",
27188
27188
  key: "1jwq7v"
@@ -27205,7 +27205,7 @@ var Pe = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Fe = (e)
27205
27205
  d: "m21 19-1.9-1.9",
27206
27206
  key: "dwi7p8"
27207
27207
  }]
27208
- ]), Q = F("text-select", [
27208
+ ]), YE = F("text-select", [
27209
27209
  ["path", {
27210
27210
  d: "M14 21h1",
27211
27211
  key: "v9vybs"
@@ -31557,15 +31557,15 @@ var Pe = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Fe = (e)
31557
31557
  Tent: () => VE,
31558
31558
  TentTree: () => BE,
31559
31559
  Terminal: () => HE,
31560
- TestTube: () => WE,
31561
- TestTubeDiagonal: () => UE,
31562
- TestTubes: () => GE,
31560
+ TestTube: () => UE,
31561
+ TestTubeDiagonal: () => Q,
31562
+ TestTubes: () => WE,
31563
31563
  Text: () => ZE,
31564
- TextCursor: () => qE,
31565
- TextCursorInput: () => KE,
31566
- TextQuote: () => JE,
31567
- TextSearch: () => YE,
31568
- TextSelect: () => Q,
31564
+ TextCursor: () => KE,
31565
+ TextCursorInput: () => GE,
31566
+ TextQuote: () => qE,
31567
+ TextSearch: () => JE,
31568
+ TextSelect: () => YE,
31569
31569
  Theater: () => XE,
31570
31570
  Thermometer: () => eD,
31571
31571
  ThermometerSnowflake: () => QE,
@@ -35306,17 +35306,17 @@ var Pe = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Fe = (e)
35306
35306
  LucideTentTree: () => BE,
35307
35307
  LucideTerminal: () => HE,
35308
35308
  LucideTerminalSquare: () => PT,
35309
- LucideTestTube: () => WE,
35310
- LucideTestTube2: () => UE,
35311
- LucideTestTubeDiagonal: () => UE,
35312
- LucideTestTubes: () => GE,
35309
+ LucideTestTube: () => UE,
35310
+ LucideTestTube2: () => Q,
35311
+ LucideTestTubeDiagonal: () => Q,
35312
+ LucideTestTubes: () => WE,
35313
35313
  LucideText: () => ZE,
35314
- LucideTextCursor: () => qE,
35315
- LucideTextCursorInput: () => KE,
35316
- LucideTextQuote: () => JE,
35317
- LucideTextSearch: () => YE,
35318
- LucideTextSelect: () => Q,
35319
- LucideTextSelection: () => Q,
35314
+ LucideTextCursor: () => KE,
35315
+ LucideTextCursorInput: () => GE,
35316
+ LucideTextQuote: () => qE,
35317
+ LucideTextSearch: () => JE,
35318
+ LucideTextSelect: () => YE,
35319
+ LucideTextSelection: () => YE,
35320
35320
  LucideTheater: () => XE,
35321
35321
  LucideThermometer: () => eD,
35322
35322
  LucideThermometerSnowflake: () => QE,
@@ -36703,28 +36703,28 @@ var Pe = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Fe = (e)
36703
36703
  TerminalIcon: () => HE,
36704
36704
  TerminalSquare: () => PT,
36705
36705
  TerminalSquareIcon: () => PT,
36706
- TestTube: () => WE,
36707
- TestTube2: () => UE,
36708
- TestTube2Icon: () => UE,
36709
- TestTubeDiagonal: () => UE,
36710
- TestTubeDiagonalIcon: () => UE,
36711
- TestTubeIcon: () => WE,
36712
- TestTubes: () => GE,
36713
- TestTubesIcon: () => GE,
36706
+ TestTube: () => UE,
36707
+ TestTube2: () => Q,
36708
+ TestTube2Icon: () => Q,
36709
+ TestTubeDiagonal: () => Q,
36710
+ TestTubeDiagonalIcon: () => Q,
36711
+ TestTubeIcon: () => UE,
36712
+ TestTubes: () => WE,
36713
+ TestTubesIcon: () => WE,
36714
36714
  Text: () => ZE,
36715
- TextCursor: () => qE,
36716
- TextCursorIcon: () => qE,
36717
- TextCursorInput: () => KE,
36718
- TextCursorInputIcon: () => KE,
36715
+ TextCursor: () => KE,
36716
+ TextCursorIcon: () => KE,
36717
+ TextCursorInput: () => GE,
36718
+ TextCursorInputIcon: () => GE,
36719
36719
  TextIcon: () => ZE,
36720
- TextQuote: () => JE,
36721
- TextQuoteIcon: () => JE,
36722
- TextSearch: () => YE,
36723
- TextSearchIcon: () => YE,
36724
- TextSelect: () => Q,
36725
- TextSelectIcon: () => Q,
36726
- TextSelection: () => Q,
36727
- TextSelectionIcon: () => Q,
36720
+ TextQuote: () => qE,
36721
+ TextQuoteIcon: () => qE,
36722
+ TextSearch: () => JE,
36723
+ TextSearchIcon: () => JE,
36724
+ TextSelect: () => YE,
36725
+ TextSelectIcon: () => YE,
36726
+ TextSelection: () => YE,
36727
+ TextSelectionIcon: () => YE,
36728
36728
  Theater: () => XE,
36729
36729
  TheaterIcon: () => XE,
36730
36730
  Thermometer: () => eD,
@@ -37270,7 +37270,7 @@ var Kk = ({ title: e, subtitle: n, iconFile: r, loading: i = !1, state: a = "def
37270
37270
  /* @__PURE__ */ l("div", { className: P("w-6 h-6 rounded-md bg-gray-100 ml-6", a) })
37271
37271
  ] })
37272
37272
  })
37273
- }), Jk = ({ open: e, onClose: n, variant: r = "content", title: i, description: a, children: o, primaryAction: s, secondaryAction: c, size: d = "medium", closeOnOverlayClick: f = !0, closeOnEsc: p = !0, hideIcon: m = !1, className: h, overlayClassName: g, contentClassName: _, headerClassName: v, bodyClassName: y, footerClassName: b, iconClassName: x, titleClassName: S, descriptionClassName: C }) => {
37273
+ }), Jk = ({ open: e, onClose: n, variant: r = "content", title: i, description: a, children: o, primaryAction: s, secondaryAction: c, size: d = "medium", closeOnOverlayClick: f = !0, closeOnEsc: p = !0, hideIcon: m = !1, className: h, overlayClassName: g, contentClassName: _, headerClassName: v, bodyClassName: y, footerClassName: b, iconClassName: x, titleClassName: S, descriptionClassName: ee }) => {
37274
37274
  if (t.useEffect(() => {
37275
37275
  if (!e) return;
37276
37276
  document.body.style.overflow = "hidden";
@@ -37285,11 +37285,11 @@ var Kk = ({ title: e, subtitle: n, iconFile: r, loading: i = !1, state: a = "def
37285
37285
  p,
37286
37286
  n
37287
37287
  ]), !e) return null;
37288
- let w = {
37288
+ let C = {
37289
37289
  small: "w-[360px]",
37290
37290
  medium: "w-[480px]",
37291
37291
  large: "w-[640px]"
37292
- }, T = {
37292
+ }, w = {
37293
37293
  success: {
37294
37294
  icon: "✓",
37295
37295
  bg: "bg-green-100",
@@ -37319,21 +37319,21 @@ var Kk = ({ title: e, subtitle: n, iconFile: r, loading: i = !1, state: a = "def
37319
37319
  f && n();
37320
37320
  }
37321
37321
  }), /* @__PURE__ */ u("div", {
37322
- className: P("relative z-10 bg-white rounded-2xl shadow-2xl border border-gray-200 overflow-hidden animate-in fade-in zoom-in-95 duration-200", w[d], _),
37322
+ className: P("relative z-10 bg-white rounded-2xl shadow-2xl border border-gray-200 overflow-hidden animate-in fade-in zoom-in-95 duration-200", C[d], _),
37323
37323
  children: [
37324
37324
  /* @__PURE__ */ u("div", {
37325
37325
  className: P("px-6 pt-6 pb-4 text-center", v),
37326
37326
  children: [
37327
37327
  !m && /* @__PURE__ */ l("div", {
37328
- className: P("w-14 h-14 mx-auto mb-4 rounded-full flex items-center justify-center text-2xl font-bold", T.bg, T.text, x),
37329
- children: T.icon
37328
+ className: P("w-14 h-14 mx-auto mb-4 rounded-full flex items-center justify-center text-2xl font-bold", w.bg, w.text, x),
37329
+ children: w.icon
37330
37330
  }),
37331
37331
  /* @__PURE__ */ l("h2", {
37332
37332
  className: P("text-lg font-semibold text-gray-900", S),
37333
37333
  children: i
37334
37334
  }),
37335
37335
  a && /* @__PURE__ */ l("p", {
37336
- className: P("mt-2 text-sm text-gray-500", C),
37336
+ className: P("mt-2 text-sm text-gray-500", ee),
37337
37337
  children: a
37338
37338
  })
37339
37339
  ]
@@ -37377,31 +37377,38 @@ var Kk = ({ title: e, subtitle: n, iconFile: r, loading: i = !1, state: a = "def
37377
37377
  let t = Uk[e];
37378
37378
  return t ? /* @__PURE__ */ l(t, { className: "w-4 h-4 shrink-0" }) : null;
37379
37379
  };
37380
- function Zk({ columns: e, data: t, itemsPerPage: n = 5, title: r, className: d = "", titleAction: f, onActionClick: p }) {
37381
- let [m, h] = s(1), [g, _] = s({}), [v, y] = s(null), b = o(null), x = (e, t) => {
37382
- _((n) => ({
37380
+ function Zk({ columns: e, data: t, itemsPerPage: n = 5, title: r, className: d = "", titleAction: f, onActionClick: p, externalPagination: m }) {
37381
+ let [h, g] = s(1), [_, v] = s({}), [y, b] = s(null), x = o(null), S = !!m, ee = (e, t) => {
37382
+ v((n) => ({
37383
37383
  ...n,
37384
37384
  [e]: t
37385
- })), h(1);
37385
+ })), g(1);
37386
37386
  };
37387
37387
  i(() => {
37388
37388
  let e = (e) => {
37389
- b.current && !b.current.contains(e.target) && y(null);
37389
+ x.current && !x.current.contains(e.target) && b(null);
37390
37390
  };
37391
37391
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
37392
37392
  }, []);
37393
- let S = a(() => t.filter((t) => e.every((e) => {
37394
- let n = g[e.key]?.toLowerCase() || "";
37393
+ let C = a(() => S ? t : t.filter((t) => e.every((e) => {
37394
+ let n = _[e.key]?.toLowerCase() || "";
37395
37395
  return n ? String(t[e.key]).toLowerCase().includes(n) : !0;
37396
37396
  })), [
37397
37397
  t,
37398
- g,
37399
- e
37400
- ]), C = Math.max(1, Math.ceil(S.length / n)), w = (m - 1) * n, T = S.slice(w, w + n), E = (e) => {
37401
- e >= 1 && e <= C && h(e);
37402
- }, ee = (e, t) => {
37403
- y(null), e.onClick ? e.onClick(t) : p && p(e, t);
37404
- };
37398
+ _,
37399
+ e,
37400
+ S
37401
+ ]), w = S ? m.currentPage : h, T = S ? m.lastPage : Math.max(1, Math.ceil(C.length / n)), E = (h - 1) * n, D = S ? t : C.slice(E, E + n), te = (e) => {
37402
+ e < 1 || e > T || (S ? m.onPageChange(e) : g(e));
37403
+ }, ne = (e, t) => {
37404
+ b(null), e.onClick ? e.onClick(t) : p && p(e, t);
37405
+ }, re = () => {
37406
+ if (T <= 7) return Array.from({ length: T }, (e, t) => t + 1);
37407
+ let e = [];
37408
+ e.push(1), w > 3 && e.push("...");
37409
+ for (let t = Math.max(2, w - 1); t <= Math.min(T - 1, w + 1); t++) e.push(t);
37410
+ return w < T - 2 && e.push("..."), e.push(T), e;
37411
+ }, ie = S ? m.total : C.length;
37405
37412
  return /* @__PURE__ */ l("div", {
37406
37413
  className: `w-full p-4 ${d}`,
37407
37414
  children: /* @__PURE__ */ u("div", {
@@ -37443,8 +37450,8 @@ function Zk({ columns: e, data: t, itemsPerPage: n = 5, title: r, className: d =
37443
37450
  children: /* @__PURE__ */ l("input", {
37444
37451
  type: "text",
37445
37452
  placeholder: "",
37446
- value: g[e.key] || "",
37447
- onChange: (t) => x(e.key, t.target.value),
37453
+ value: _[e.key] || "",
37454
+ onChange: (t) => ee(e.key, t.target.value),
37448
37455
  style: {
37449
37456
  outline: "none",
37450
37457
  boxShadow: "none"
@@ -37454,12 +37461,12 @@ function Zk({ columns: e, data: t, itemsPerPage: n = 5, title: r, className: d =
37454
37461
  }, e.key)), /* @__PURE__ */ l("th", {})]
37455
37462
  })
37456
37463
  ]
37457
- }), /* @__PURE__ */ l("tbody", { children: T.length === 0 ? /* @__PURE__ */ l("tr", { children: /* @__PURE__ */ l("td", {
37464
+ }), /* @__PURE__ */ l("tbody", { children: D.length === 0 ? /* @__PURE__ */ l("tr", { children: /* @__PURE__ */ l("td", {
37458
37465
  colSpan: e.length + 1,
37459
37466
  className: "p-4 text-center text-sm text-gray-500",
37460
37467
  children: "No hay resultados"
37461
- }) }) : T.map((t, n) => {
37462
- let r = w + n, i = Array.isArray(t.actions) && t.actions.length > 0, a = n >= T.length - 2;
37468
+ }) }) : D.map((t, n) => {
37469
+ let r = S ? n : E + n, i = Array.isArray(t.actions) && t.actions.length > 0, a = n >= D.length - 2;
37463
37470
  return /* @__PURE__ */ u("tr", {
37464
37471
  className: "border-t border-gray-100 hover:bg-gray-50 transition",
37465
37472
  children: [e.map((e) => /* @__PURE__ */ l("td", {
@@ -37469,16 +37476,16 @@ function Zk({ columns: e, data: t, itemsPerPage: n = 5, title: r, className: d =
37469
37476
  className: "p-3 text-right relative",
37470
37477
  children: i && /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("button", {
37471
37478
  type: "button",
37472
- onClick: () => y(v === r ? null : r),
37479
+ onClick: () => b(y === r ? null : r),
37473
37480
  className: "px-2 py-1 rounded hover:bg-gray-200 transition cursor-pointer text-gray-400 hover:text-gray-600",
37474
37481
  "aria-label": "Acciones",
37475
37482
  children: "•••"
37476
- }), v === r && /* @__PURE__ */ l("div", {
37477
- ref: b,
37483
+ }), y === r && /* @__PURE__ */ l("div", {
37484
+ ref: x,
37478
37485
  className: `absolute right-3 z-50 min-w-[160px] bg-white border border-gray-200 rounded-lg shadow-lg py-1 ${a ? "bottom-full mb-1" : "top-full mt-1"}`,
37479
37486
  children: t.actions.filter((e) => e.isActive !== !1).map((e, n) => /* @__PURE__ */ u("button", {
37480
37487
  type: "button",
37481
- onClick: () => ee(e, t),
37488
+ onClick: () => ne(e, t),
37482
37489
  className: "w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 transition cursor-pointer flex items-center gap-2",
37483
37490
  children: [Xk(e.icon), /* @__PURE__ */ l("span", { children: e.descripcion })]
37484
37491
  }, n))
@@ -37491,42 +37498,36 @@ function Zk({ columns: e, data: t, itemsPerPage: n = 5, title: r, className: d =
37491
37498
  className: "flex items-center justify-between p-3 text-sm border-t border-gray-200",
37492
37499
  children: [/* @__PURE__ */ u("span", { children: [
37493
37500
  "Mostrando ",
37494
- T.length,
37501
+ D.length,
37495
37502
  " de ",
37496
- S.length,
37503
+ ie,
37497
37504
  " resultados"
37498
37505
  ] }), /* @__PURE__ */ u("div", {
37499
37506
  className: "flex gap-1 items-center",
37500
37507
  children: [
37501
37508
  /* @__PURE__ */ l("button", {
37502
- onClick: () => E(m - 1),
37509
+ onClick: () => te(w - 1),
37503
37510
  className: "w-8 h-8 flex items-center justify-center rounded-md border border-gray-200 text-gray-500 disabled:opacity-40 hover:bg-gray-50",
37504
- disabled: m === 1,
37511
+ disabled: w === 1,
37505
37512
  children: "‹"
37506
37513
  }),
37507
- (() => {
37508
- if (C <= 7) return Array.from({ length: C }, (e, t) => t + 1);
37509
- let e = [];
37510
- e.push(1), m > 3 && e.push("...");
37511
- for (let t = Math.max(2, m - 1); t <= Math.min(C - 1, m + 1); t++) e.push(t);
37512
- return m < C - 2 && e.push("..."), e.push(C), e;
37513
- })().map((e, t) => e === "..." ? /* @__PURE__ */ l("span", {
37514
+ re().map((e, t) => e === "..." ? /* @__PURE__ */ l("span", {
37514
37515
  className: "w-8 h-8 flex items-center justify-center text-gray-400 text-sm",
37515
37516
  children: "…"
37516
37517
  }, `ellipsis-${t}`) : /* @__PURE__ */ l("button", {
37517
- onClick: () => E(e),
37518
+ onClick: () => te(e),
37518
37519
  className: "w-8 h-8 flex items-center justify-center rounded-md text-sm font-medium",
37519
37520
  style: {
37520
- backgroundColor: m === e ? "#0B3564" : "transparent",
37521
- color: m === e ? "#ffffff" : "#374151",
37522
- border: m === e ? "none" : "1px solid #E5E7EB"
37521
+ backgroundColor: w === e ? "#0B3564" : "transparent",
37522
+ color: w === e ? "#ffffff" : "#374151",
37523
+ border: w === e ? "none" : "1px solid #E5E7EB"
37523
37524
  },
37524
37525
  children: e
37525
37526
  }, e)),
37526
37527
  /* @__PURE__ */ l("button", {
37527
- onClick: () => E(m + 1),
37528
+ onClick: () => te(w + 1),
37528
37529
  className: "w-8 h-8 flex items-center justify-center rounded-md border border-gray-200 text-gray-500 disabled:opacity-40 hover:bg-gray-50",
37529
- disabled: m === C,
37530
+ disabled: w === T,
37530
37531
  children: "›"
37531
37532
  })
37532
37533
  ]
@@ -37538,22 +37539,22 @@ function Zk({ columns: e, data: t, itemsPerPage: n = 5, title: r, className: d =
37538
37539
  //#endregion
37539
37540
  //#region src/Select.tsx
37540
37541
  var Qk = ({ options: e, multiple: t = !1, placeholder: n = "Select...", label: r, required: a, hint: c, value: d, onChange: f, className: p, triggerClassName: m, dropdownClassName: h, optionClassName: g, labelClassName: _, hintClassName: v, searchClassName: y }) => {
37541
- let [b, x] = s(!1), [S, C] = s(""), w = o(null), T = (e) => t && Array.isArray(d) ? d.includes(e) : d === e, E = (e) => {
37542
+ let [b, x] = s(!1), [S, ee] = s(""), C = o(null), w = (e) => t && Array.isArray(d) ? d.includes(e) : d === e, T = (e) => {
37542
37543
  if (t) {
37543
37544
  let t = Array.isArray(d) ? [...d] : [];
37544
37545
  t.includes(e) ? t = t.filter((t) => t !== e) : t.push(e), f?.(t);
37545
37546
  } else f?.(e), x(!1);
37546
- }, ee = (e) => {
37547
+ }, E = (e) => {
37547
37548
  !t || !Array.isArray(d) || f?.(d.filter((t) => t !== e));
37548
37549
  }, D = e.filter((e) => e.label.toLowerCase().includes(S.toLowerCase()));
37549
37550
  return i(() => {
37550
37551
  let e = (e) => {
37551
- w.current?.contains(e.target) || x(!1);
37552
+ C.current?.contains(e.target) || x(!1);
37552
37553
  };
37553
37554
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
37554
37555
  }, []), /* @__PURE__ */ u("div", {
37555
37556
  className: P("w-[300px] text-sm", p),
37556
- ref: w,
37557
+ ref: C,
37557
37558
  children: [
37558
37559
  r && /* @__PURE__ */ u("label", {
37559
37560
  className: P("block mb-1 font-medium", _),
@@ -37573,7 +37574,7 @@ var Qk = ({ options: e, multiple: t = !1, placeholder: n = "Select...", label: r
37573
37574
  className: "bg-gray-200 px-2 py-1 rounded flex items-center gap-1",
37574
37575
  children: [e.find((e) => e.value === t)?.label, /* @__PURE__ */ l("button", {
37575
37576
  onClick: (e) => {
37576
- e.stopPropagation(), ee(t);
37577
+ e.stopPropagation(), E(t);
37577
37578
  },
37578
37579
  children: "×"
37579
37580
  })]
@@ -37592,20 +37593,20 @@ var Qk = ({ options: e, multiple: t = !1, placeholder: n = "Select...", label: r
37592
37593
  placeholder: "Buscar...",
37593
37594
  className: P("w-full border px-2 py-1 mb-2 rounded", y),
37594
37595
  value: S,
37595
- onChange: (e) => C(e.target.value)
37596
+ onChange: (e) => ee(e.target.value)
37596
37597
  }), /* @__PURE__ */ l("div", {
37597
37598
  className: "max-h-40 overflow-auto",
37598
37599
  children: D.map((e) => /* @__PURE__ */ u("div", {
37599
37600
  className: P("flex items-center gap-2 px-2 py-1 hover:bg-gray-100 cursor-pointer", g),
37600
- onClick: () => E(e.value),
37601
+ onClick: () => T(e.value),
37601
37602
  children: [
37602
37603
  t && /* @__PURE__ */ l("input", {
37603
37604
  type: "checkbox",
37604
- checked: T(e.value),
37605
+ checked: w(e.value),
37605
37606
  readOnly: !0
37606
37607
  }),
37607
37608
  /* @__PURE__ */ l("span", { children: e.label }),
37608
- !t && T(e.value) && /* @__PURE__ */ l("span", {
37609
+ !t && w(e.value) && /* @__PURE__ */ l("span", {
37609
37610
  className: "ml-auto",
37610
37611
  children: "✔"
37611
37612
  })
package/dist/table.d.ts CHANGED
@@ -18,6 +18,13 @@ type DataRow = {
18
18
  [key: string]: any;
19
19
  actions?: RowAction[];
20
20
  };
21
+ type ExternalPagination = {
22
+ currentPage: number;
23
+ lastPage: number;
24
+ total: number;
25
+ perPage: number;
26
+ onPageChange: (page: number) => void;
27
+ };
21
28
  type TableProps = {
22
29
  columns: Column[];
23
30
  data: DataRow[];
@@ -26,6 +33,7 @@ type TableProps = {
26
33
  className?: string;
27
34
  titleAction?: React.ReactNode;
28
35
  onActionClick?: (action: RowAction, row: DataRow) => void;
36
+ externalPagination?: ExternalPagination;
29
37
  };
30
- export declare function Table({ columns, data, itemsPerPage, title, className, titleAction, onActionClick, }: TableProps): import("react/jsx-runtime").JSX.Element;
38
+ export declare function Table({ columns, data, itemsPerPage, title, className, titleAction, onActionClick, externalPagination, }: TableProps): import("react/jsx-runtime").JSX.Element;
31
39
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "componenteszw-package",
3
- "version": "1.0.80",
3
+ "version": "1.0.82",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",