next-recomponents 2.0.34 → 2.0.35

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.d.mts CHANGED
@@ -235,7 +235,7 @@ declare function usePopup(): {
235
235
  confirm: (message: string, color?: PopupColor) => Promise<boolean>;
236
236
  prompt: (message: string, color?: PopupColor) => Promise<string | null>;
237
237
  modal: (message: ReactNode, color?: PopupColor, icons?: boolean, full?: boolean) => Promise<void>;
238
- PopupComponent: () => react_jsx_runtime.JSX.Element | null;
238
+ PopupComponent: react_jsx_runtime.JSX.Element | null;
239
239
  close: (confirmed: boolean, value?: string) => void;
240
240
  updateMessage: (message: ReactNode) => void;
241
241
  };
package/dist/index.d.ts CHANGED
@@ -235,7 +235,7 @@ declare function usePopup(): {
235
235
  confirm: (message: string, color?: PopupColor) => Promise<boolean>;
236
236
  prompt: (message: string, color?: PopupColor) => Promise<string | null>;
237
237
  modal: (message: ReactNode, color?: PopupColor, icons?: boolean, full?: boolean) => Promise<void>;
238
- PopupComponent: () => react_jsx_runtime.JSX.Element | null;
238
+ PopupComponent: react_jsx_runtime.JSX.Element | null;
239
239
  close: (confirmed: boolean, value?: string) => void;
240
240
  updateMessage: (message: ReactNode) => void;
241
241
  };
package/dist/index.js CHANGED
@@ -37268,17 +37268,14 @@ function usePopup() {
37268
37268
  messageRef.current = message;
37269
37269
  setPopup((prev) => ({ ...prev }));
37270
37270
  }, []);
37271
- const PopupComponent = (0, import_react10.useCallback)(() => {
37272
- if (!popup.visible) return null;
37273
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
37274
- PopupOverlay,
37275
- {
37276
- popup: { ...popup, message: messageRef.current },
37277
- onClose: close,
37278
- onInputChange: (v) => setPopup((prev) => ({ ...prev, inputValue: v }))
37279
- }
37280
- );
37281
- }, [popup, close]);
37271
+ const PopupComponent = popup.visible ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
37272
+ PopupOverlay,
37273
+ {
37274
+ popup: { ...popup, message: messageRef.current },
37275
+ onClose: close,
37276
+ onInputChange: (v) => setPopup((prev) => ({ ...prev, inputValue: v }))
37277
+ }
37278
+ ) : null;
37282
37279
  return {
37283
37280
  alert: alert2,
37284
37281
  confirm,
@@ -37299,17 +37296,24 @@ function Modal({
37299
37296
  title
37300
37297
  }) {
37301
37298
  const pop = usePopup();
37302
- const hide = (0, import_react11.useCallback)(() => pop.close(false), [pop.close]);
37299
+ const hide = () => pop.close(false);
37300
+ const childrenWithHide = (0, import_react11.useMemo)(
37301
+ () => (0, import_react11.cloneElement)(children, { hide }),
37302
+ [children]
37303
+ );
37304
+ (0, import_react11.useEffect)(() => {
37305
+ pop.updateMessage(childrenWithHide);
37306
+ }, [childrenWithHide]);
37303
37307
  const props = button == null ? void 0 : button.props;
37304
37308
  const onClick = props == null ? void 0 : props.onClick;
37305
37309
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
37306
37310
  (0, import_react11.cloneElement)(button, {
37307
37311
  onClick: (e) => {
37308
37312
  onClick == null ? void 0 : onClick(e);
37309
- pop.modal((0, import_react11.cloneElement)(children, { hide }), color, false, true);
37313
+ pop.modal(childrenWithHide, color, false, true);
37310
37314
  }
37311
37315
  }),
37312
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(pop.PopupComponent, {})
37316
+ pop.PopupComponent
37313
37317
  ] });
37314
37318
  }
37315
37319
 
package/dist/index.mjs CHANGED
@@ -36935,7 +36935,7 @@ function Select({
36935
36935
  }
36936
36936
 
36937
36937
  // src/modal/index.tsx
36938
- import { cloneElement as cloneElement2, useCallback as useCallback2 } from "react";
36938
+ import { cloneElement as cloneElement2, useEffect as useEffect6, useMemo as useMemo4 } from "react";
36939
36939
 
36940
36940
  // src/pop/index.tsx
36941
36941
  import { useState as useState9, useCallback, useRef as useRef3 } from "react";
@@ -37254,17 +37254,14 @@ function usePopup() {
37254
37254
  messageRef.current = message;
37255
37255
  setPopup((prev) => ({ ...prev }));
37256
37256
  }, []);
37257
- const PopupComponent = useCallback(() => {
37258
- if (!popup.visible) return null;
37259
- return /* @__PURE__ */ jsx15(
37260
- PopupOverlay,
37261
- {
37262
- popup: { ...popup, message: messageRef.current },
37263
- onClose: close,
37264
- onInputChange: (v) => setPopup((prev) => ({ ...prev, inputValue: v }))
37265
- }
37266
- );
37267
- }, [popup, close]);
37257
+ const PopupComponent = popup.visible ? /* @__PURE__ */ jsx15(
37258
+ PopupOverlay,
37259
+ {
37260
+ popup: { ...popup, message: messageRef.current },
37261
+ onClose: close,
37262
+ onInputChange: (v) => setPopup((prev) => ({ ...prev, inputValue: v }))
37263
+ }
37264
+ ) : null;
37268
37265
  return {
37269
37266
  alert: alert2,
37270
37267
  confirm,
@@ -37277,7 +37274,7 @@ function usePopup() {
37277
37274
  }
37278
37275
 
37279
37276
  // src/modal/index.tsx
37280
- import { Fragment as Fragment2, jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
37277
+ import { Fragment as Fragment2, jsxs as jsxs10 } from "react/jsx-runtime";
37281
37278
  function Modal({
37282
37279
  button,
37283
37280
  children,
@@ -37285,25 +37282,32 @@ function Modal({
37285
37282
  title
37286
37283
  }) {
37287
37284
  const pop = usePopup();
37288
- const hide = useCallback2(() => pop.close(false), [pop.close]);
37285
+ const hide = () => pop.close(false);
37286
+ const childrenWithHide = useMemo4(
37287
+ () => cloneElement2(children, { hide }),
37288
+ [children]
37289
+ );
37290
+ useEffect6(() => {
37291
+ pop.updateMessage(childrenWithHide);
37292
+ }, [childrenWithHide]);
37289
37293
  const props = button == null ? void 0 : button.props;
37290
37294
  const onClick = props == null ? void 0 : props.onClick;
37291
37295
  return /* @__PURE__ */ jsxs10(Fragment2, { children: [
37292
37296
  cloneElement2(button, {
37293
37297
  onClick: (e) => {
37294
37298
  onClick == null ? void 0 : onClick(e);
37295
- pop.modal(cloneElement2(children, { hide }), color, false, true);
37299
+ pop.modal(childrenWithHide, color, false, true);
37296
37300
  }
37297
37301
  }),
37298
- /* @__PURE__ */ jsx16(pop.PopupComponent, {})
37302
+ pop.PopupComponent
37299
37303
  ] });
37300
37304
  }
37301
37305
 
37302
37306
  // src/pre/index.tsx
37303
- import { jsx as jsx17 } from "react/jsx-runtime";
37307
+ import { jsx as jsx16 } from "react/jsx-runtime";
37304
37308
  var Pre = ({ data }) => {
37305
37309
  const formatted = JSON.stringify(data, null, 2);
37306
- return /* @__PURE__ */ jsx17(
37310
+ return /* @__PURE__ */ jsx16(
37307
37311
  "pre",
37308
37312
  {
37309
37313
  style: {
@@ -37354,9 +37358,9 @@ import {
37354
37358
  import DatePicker from "react-datepicker";
37355
37359
 
37356
37360
  // src/calendar/calendar.icon.tsx
37357
- import { jsx as jsx18 } from "react/jsx-runtime";
37361
+ import { jsx as jsx17 } from "react/jsx-runtime";
37358
37362
  function CalendarIcon() {
37359
- return /* @__PURE__ */ jsx18(
37363
+ return /* @__PURE__ */ jsx17(
37360
37364
  "svg",
37361
37365
  {
37362
37366
  stroke: "currentColor",
@@ -37366,14 +37370,14 @@ function CalendarIcon() {
37366
37370
  height: "20px",
37367
37371
  width: "20px",
37368
37372
  xmlns: "http://www.w3.org/2000/svg",
37369
- children: /* @__PURE__ */ jsx18("path", { d: "M12 192h424c6.6 0 12 5.4 12 12v260c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V204c0-6.6 5.4-12 12-12zm436-44v-36c0-26.5-21.5-48-48-48h-48V12c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v52H160V12c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v52H48C21.5 64 0 85.5 0 112v36c0 6.6 5.4 12 12 12h424c6.6 0 12-5.4 12-12z" })
37373
+ children: /* @__PURE__ */ jsx17("path", { d: "M12 192h424c6.6 0 12 5.4 12 12v260c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V204c0-6.6 5.4-12 12-12zm436-44v-36c0-26.5-21.5-48-48-48h-48V12c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v52H160V12c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v52H48C21.5 64 0 85.5 0 112v36c0 6.6 5.4 12 12 12h424c6.6 0 12-5.4 12-12z" })
37370
37374
  }
37371
37375
  );
37372
37376
  }
37373
37377
 
37374
37378
  // src/calendar/index.tsx
37375
37379
  import { Dialog as Dialog2 } from "@mui/material";
37376
- import { jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
37380
+ import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
37377
37381
  function MyCalendar({
37378
37382
  enabledDates,
37379
37383
  onChange,
@@ -37409,15 +37413,15 @@ function MyCalendar({
37409
37413
  /* @__PURE__ */ jsxs11("div", { className: "font-bold", children: [
37410
37414
  label,
37411
37415
  " ",
37412
- (otherProps == null ? void 0 : otherProps.required) && /* @__PURE__ */ jsx19("span", { className: "text-red-500", children: "*" })
37416
+ (otherProps == null ? void 0 : otherProps.required) && /* @__PURE__ */ jsx18("span", { className: "text-red-500", children: "*" })
37413
37417
  ] }),
37414
- /* @__PURE__ */ jsx19("div", { children: /* @__PURE__ */ jsxs11(
37418
+ /* @__PURE__ */ jsx18("div", { children: /* @__PURE__ */ jsxs11(
37415
37419
  "div",
37416
37420
  {
37417
37421
  className: "cursor-pointer flex items-center justify-center",
37418
37422
  onClick: (e) => setOpen(true),
37419
37423
  children: [
37420
- /* @__PURE__ */ jsx19(
37424
+ /* @__PURE__ */ jsx18(
37421
37425
  "input",
37422
37426
  {
37423
37427
  ...otherProps,
@@ -37432,13 +37436,13 @@ function MyCalendar({
37432
37436
  readOnly: true
37433
37437
  }
37434
37438
  ),
37435
- /* @__PURE__ */ jsx19("div", { className: "absolute", style: { right: "10px" }, children: /* @__PURE__ */ jsx19(CalendarIcon, {}) })
37439
+ /* @__PURE__ */ jsx18("div", { className: "absolute", style: { right: "10px" }, children: /* @__PURE__ */ jsx18(CalendarIcon, {}) })
37436
37440
  ]
37437
37441
  }
37438
37442
  ) })
37439
37443
  ] }),
37440
37444
  /* @__PURE__ */ jsxs11(Dialog2, { open, children: [
37441
- /* @__PURE__ */ jsx19("div", { className: "flex justify-end p-5 font-bold", children: /* @__PURE__ */ jsx19(
37445
+ /* @__PURE__ */ jsx18("div", { className: "flex justify-end p-5 font-bold", children: /* @__PURE__ */ jsx18(
37442
37446
  "button",
37443
37447
  {
37444
37448
  className: " border-lg w-[20px] bg-red-500 text-white shadow rounded",
@@ -37446,7 +37450,7 @@ function MyCalendar({
37446
37450
  children: "x"
37447
37451
  }
37448
37452
  ) }),
37449
- /* @__PURE__ */ jsx19("div", { className: " w-[300px] flex items-start justify-center h-[300px] p-5", children: /* @__PURE__ */ jsx19(
37453
+ /* @__PURE__ */ jsx18("div", { className: " w-[300px] flex items-start justify-center h-[300px] p-5", children: /* @__PURE__ */ jsx18(
37450
37454
  DatePicker,
37451
37455
  {
37452
37456
  inline: true,
@@ -37460,9 +37464,9 @@ function MyCalendar({
37460
37464
  }
37461
37465
 
37462
37466
  // src/doc-viewer/icon.tsx
37463
- import { jsx as jsx20 } from "react/jsx-runtime";
37467
+ import { jsx as jsx19 } from "react/jsx-runtime";
37464
37468
  function Icon() {
37465
- return /* @__PURE__ */ jsx20(
37469
+ return /* @__PURE__ */ jsx19(
37466
37470
  "svg",
37467
37471
  {
37468
37472
  stroke: "currentColor",
@@ -37472,13 +37476,13 @@ function Icon() {
37472
37476
  height: "200px",
37473
37477
  width: "200px",
37474
37478
  xmlns: "http://www.w3.org/2000/svg",
37475
- children: /* @__PURE__ */ jsx20("path", { d: "M212.24,83.76l-56-56A6,6,0,0,0,152,26H56A14,14,0,0,0,42,40v88a6,6,0,0,0,12,0V40a2,2,0,0,1,2-2h90V88a6,6,0,0,0,6,6h50V216a2,2,0,0,1-2,2H176a6,6,0,0,0,0,12h24a14,14,0,0,0,14-14V88A6,6,0,0,0,212.24,83.76ZM158,46.48,193.52,82H158ZM108,130a50,50,0,0,0-46.66,32H60a34,34,0,0,0,0,68h48a50,50,0,0,0,0-100Zm0,88H60a22,22,0,0,1-1.65-43.94c-.06.47-.1.93-.15,1.4a6,6,0,1,0,12,1.08A38.57,38.57,0,0,1,71.3,170a5.71,5.71,0,0,0,.24-.86A38,38,0,1,1,108,218Z" })
37479
+ children: /* @__PURE__ */ jsx19("path", { d: "M212.24,83.76l-56-56A6,6,0,0,0,152,26H56A14,14,0,0,0,42,40v88a6,6,0,0,0,12,0V40a2,2,0,0,1,2-2h90V88a6,6,0,0,0,6,6h50V216a2,2,0,0,1-2,2H176a6,6,0,0,0,0,12h24a14,14,0,0,0,14-14V88A6,6,0,0,0,212.24,83.76ZM158,46.48,193.52,82H158ZM108,130a50,50,0,0,0-46.66,32H60a34,34,0,0,0,0,68h48a50,50,0,0,0,0-100Zm0,88H60a22,22,0,0,1-1.65-43.94c-.06.47-.1.93-.15,1.4a6,6,0,1,0,12,1.08A38.57,38.57,0,0,1,71.3,170a5.71,5.71,0,0,0,.24-.86A38,38,0,1,1,108,218Z" })
37476
37480
  }
37477
37481
  );
37478
37482
  }
37479
37483
 
37480
37484
  // src/doc-viewer/index.tsx
37481
- import { jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
37485
+ import { jsx as jsx20, jsxs as jsxs12 } from "react/jsx-runtime";
37482
37486
  function DocumentViewer({ item }) {
37483
37487
  const { url, name, contentType, width = "100%", height = "100%" } = item;
37484
37488
  const isImage = contentType.startsWith("image/");
@@ -37489,8 +37493,8 @@ function DocumentViewer({ item }) {
37489
37493
  )}&embedded=true` : url;
37490
37494
  return /* @__PURE__ */ jsxs12("div", { className: "border shadow rounded p-2 h-[100%]", children: [
37491
37495
  /* @__PURE__ */ jsxs12("div", { className: "mb-1 flex justify-between ", children: [
37492
- /* @__PURE__ */ jsx21("h3", { className: "font-bold", children: name }),
37493
- /* @__PURE__ */ jsx21(
37496
+ /* @__PURE__ */ jsx20("h3", { className: "font-bold", children: name }),
37497
+ /* @__PURE__ */ jsx20(
37494
37498
  "a",
37495
37499
  {
37496
37500
  href: url,
@@ -37502,7 +37506,7 @@ function DocumentViewer({ item }) {
37502
37506
  }
37503
37507
  )
37504
37508
  ] }),
37505
- isImage ? /* @__PURE__ */ jsx21(
37509
+ isImage ? /* @__PURE__ */ jsx20(
37506
37510
  "img",
37507
37511
  {
37508
37512
  src: url,
@@ -37515,7 +37519,7 @@ function DocumentViewer({ item }) {
37515
37519
  display: "block"
37516
37520
  }
37517
37521
  }
37518
- ) : isGoogleDocCompatible ? /* @__PURE__ */ jsx21(
37522
+ ) : isGoogleDocCompatible ? /* @__PURE__ */ jsx20(
37519
37523
  "iframe",
37520
37524
  {
37521
37525
  title: name,
@@ -37523,7 +37527,7 @@ function DocumentViewer({ item }) {
37523
37527
  style: { width, height, border: "none" },
37524
37528
  allowFullScreen: true
37525
37529
  }
37526
- ) : /* @__PURE__ */ jsx21(
37530
+ ) : /* @__PURE__ */ jsx20(
37527
37531
  "div",
37528
37532
  {
37529
37533
  style: {
@@ -37533,7 +37537,7 @@ function DocumentViewer({ item }) {
37533
37537
  objectFit: "cover",
37534
37538
  display: "block"
37535
37539
  },
37536
- children: /* @__PURE__ */ jsx21(Icon, {})
37540
+ children: /* @__PURE__ */ jsx20(Icon, {})
37537
37541
  }
37538
37542
  )
37539
37543
  ] });
@@ -37541,20 +37545,20 @@ function DocumentViewer({ item }) {
37541
37545
 
37542
37546
  // src/table3/index.tsx
37543
37547
  import React9, {
37544
- useEffect as useEffect8,
37545
- useMemo as useMemo6,
37548
+ useEffect as useEffect9,
37549
+ useMemo as useMemo7,
37546
37550
  useReducer as useReducer2,
37547
37551
  useRef as useRef5,
37548
37552
  useState as useState13
37549
37553
  } from "react";
37550
37554
 
37551
37555
  // src/table3/filter.tsx
37552
- import { useEffect as useEffect7, useMemo as useMemo4, useState as useState11 } from "react";
37556
+ import { useEffect as useEffect8, useMemo as useMemo5, useState as useState11 } from "react";
37553
37557
 
37554
37558
  // src/table3/filters.tsx
37555
- import { jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
37559
+ import { jsx as jsx21, jsxs as jsxs13 } from "react/jsx-runtime";
37556
37560
  function FilterOffIcon() {
37557
- return /* @__PURE__ */ jsx22(
37561
+ return /* @__PURE__ */ jsx21(
37558
37562
  "svg",
37559
37563
  {
37560
37564
  stroke: "currentColor",
@@ -37564,12 +37568,12 @@ function FilterOffIcon() {
37564
37568
  height: "20px",
37565
37569
  width: "20px",
37566
37570
  xmlns: "http://www.w3.org/2000/svg",
37567
- children: /* @__PURE__ */ jsx22("path", { d: "M6.92893 0.514648L21.0711 14.6568L19.6569 16.071L15.834 12.2486L14 14.9999V21.9999H10V14.9999L4 5.99993H3V3.99993L7.585 3.99965L5.51472 1.92886L6.92893 0.514648ZM21 3.99993V5.99993H20L18.085 8.87193L13.213 3.99993H21Z" })
37571
+ children: /* @__PURE__ */ jsx21("path", { d: "M6.92893 0.514648L21.0711 14.6568L19.6569 16.071L15.834 12.2486L14 14.9999V21.9999H10V14.9999L4 5.99993H3V3.99993L7.585 3.99965L5.51472 1.92886L6.92893 0.514648ZM21 3.99993V5.99993H20L18.085 8.87193L13.213 3.99993H21Z" })
37568
37572
  }
37569
37573
  );
37570
37574
  }
37571
37575
  function OrderDesc() {
37572
- return /* @__PURE__ */ jsx22(
37576
+ return /* @__PURE__ */ jsx21(
37573
37577
  "svg",
37574
37578
  {
37575
37579
  stroke: "currentColor",
@@ -37579,12 +37583,12 @@ function OrderDesc() {
37579
37583
  height: "20px",
37580
37584
  width: "20px",
37581
37585
  xmlns: "http://www.w3.org/2000/svg",
37582
- children: /* @__PURE__ */ jsx22("path", { d: "M176 352h-48V48a16 16 0 0 0-16-16H80a16 16 0 0 0-16 16v304H16c-14.19 0-21.36 17.24-11.29 27.31l80 96a16 16 0 0 0 22.62 0l80-96C197.35 369.26 190.22 352 176 352zm112-128h128a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16h-56l61.26-70.45A32 32 0 0 0 432 65.63V48a16 16 0 0 0-16-16H288a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h56l-61.26 70.45A32 32 0 0 0 272 190.37V208a16 16 0 0 0 16 16zm159.06 234.62l-59.27-160A16 16 0 0 0 372.72 288h-41.44a16 16 0 0 0-15.07 10.62l-59.27 160A16 16 0 0 0 272 480h24.83a16 16 0 0 0 15.23-11.08l4.42-12.92h71l4.41 12.92A16 16 0 0 0 407.16 480H432a16 16 0 0 0 15.06-21.38zM335.61 400L352 352l16.39 48z" })
37586
+ children: /* @__PURE__ */ jsx21("path", { d: "M176 352h-48V48a16 16 0 0 0-16-16H80a16 16 0 0 0-16 16v304H16c-14.19 0-21.36 17.24-11.29 27.31l80 96a16 16 0 0 0 22.62 0l80-96C197.35 369.26 190.22 352 176 352zm112-128h128a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16h-56l61.26-70.45A32 32 0 0 0 432 65.63V48a16 16 0 0 0-16-16H288a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h56l-61.26 70.45A32 32 0 0 0 272 190.37V208a16 16 0 0 0 16 16zm159.06 234.62l-59.27-160A16 16 0 0 0 372.72 288h-41.44a16 16 0 0 0-15.07 10.62l-59.27 160A16 16 0 0 0 272 480h24.83a16 16 0 0 0 15.23-11.08l4.42-12.92h71l4.41 12.92A16 16 0 0 0 407.16 480H432a16 16 0 0 0 15.06-21.38zM335.61 400L352 352l16.39 48z" })
37583
37587
  }
37584
37588
  );
37585
37589
  }
37586
37590
  function OrderAsc() {
37587
- return /* @__PURE__ */ jsx22(
37591
+ return /* @__PURE__ */ jsx21(
37588
37592
  "svg",
37589
37593
  {
37590
37594
  stroke: "currentColor",
@@ -37594,12 +37598,12 @@ function OrderAsc() {
37594
37598
  height: "20px",
37595
37599
  width: "20px",
37596
37600
  xmlns: "http://www.w3.org/2000/svg",
37597
- children: /* @__PURE__ */ jsx22("path", { d: "M176 352h-48V48a16 16 0 0 0-16-16H80a16 16 0 0 0-16 16v304H16c-14.19 0-21.36 17.24-11.29 27.31l80 96a16 16 0 0 0 22.62 0l80-96C197.35 369.26 190.22 352 176 352zm240-64H288a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h56l-61.26 70.45A32 32 0 0 0 272 446.37V464a16 16 0 0 0 16 16h128a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16h-56l61.26-70.45A32 32 0 0 0 432 321.63V304a16 16 0 0 0-16-16zm31.06-85.38l-59.27-160A16 16 0 0 0 372.72 32h-41.44a16 16 0 0 0-15.07 10.62l-59.27 160A16 16 0 0 0 272 224h24.83a16 16 0 0 0 15.23-11.08l4.42-12.92h71l4.41 12.92A16 16 0 0 0 407.16 224H432a16 16 0 0 0 15.06-21.38zM335.61 144L352 96l16.39 48z" })
37601
+ children: /* @__PURE__ */ jsx21("path", { d: "M176 352h-48V48a16 16 0 0 0-16-16H80a16 16 0 0 0-16 16v304H16c-14.19 0-21.36 17.24-11.29 27.31l80 96a16 16 0 0 0 22.62 0l80-96C197.35 369.26 190.22 352 176 352zm240-64H288a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h56l-61.26 70.45A32 32 0 0 0 272 446.37V464a16 16 0 0 0 16 16h128a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16h-56l61.26-70.45A32 32 0 0 0 432 321.63V304a16 16 0 0 0-16-16zm31.06-85.38l-59.27-160A16 16 0 0 0 372.72 32h-41.44a16 16 0 0 0-15.07 10.62l-59.27 160A16 16 0 0 0 272 224h24.83a16 16 0 0 0 15.23-11.08l4.42-12.92h71l4.41 12.92A16 16 0 0 0 407.16 224H432a16 16 0 0 0 15.06-21.38zM335.61 144L352 96l16.39 48z" })
37598
37602
  }
37599
37603
  );
37600
37604
  }
37601
37605
  function EditIcon2() {
37602
- return /* @__PURE__ */ jsx22(
37606
+ return /* @__PURE__ */ jsx21(
37603
37607
  "svg",
37604
37608
  {
37605
37609
  stroke: "currentColor",
@@ -37609,7 +37613,7 @@ function EditIcon2() {
37609
37613
  height: "20px",
37610
37614
  width: "20px",
37611
37615
  xmlns: "http://www.w3.org/2000/svg",
37612
- children: /* @__PURE__ */ jsx22("path", { d: "M402.6 83.2l90.2 90.2c3.8 3.8 3.8 10 0 13.8L274.4 405.6l-92.8 10.3c-12.4 1.4-22.9-9.1-21.5-21.5l10.3-92.8L388.8 83.2c3.8-3.8 10-3.8 13.8 0zm162-22.9l-48.8-48.8c-15.2-15.2-39.9-15.2-55.2 0l-35.4 35.4c-3.8 3.8-3.8 10 0 13.8l90.2 90.2c3.8 3.8 10 3.8 13.8 0l35.4-35.4c15.2-15.3 15.2-40 0-55.2zM384 346.2V448H64V128h229.8c3.2 0 6.2-1.3 8.5-3.5l40-40c7.6-7.6 2.2-20.5-8.5-20.5H48C21.5 64 0 85.5 0 112v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V306.2c0-10.7-12.9-16-20.5-8.5l-40 40c-2.2 2.3-3.5 5.3-3.5 8.5z" })
37616
+ children: /* @__PURE__ */ jsx21("path", { d: "M402.6 83.2l90.2 90.2c3.8 3.8 3.8 10 0 13.8L274.4 405.6l-92.8 10.3c-12.4 1.4-22.9-9.1-21.5-21.5l10.3-92.8L388.8 83.2c3.8-3.8 10-3.8 13.8 0zm162-22.9l-48.8-48.8c-15.2-15.2-39.9-15.2-55.2 0l-35.4 35.4c-3.8 3.8-3.8 10 0 13.8l90.2 90.2c3.8 3.8 10 3.8 13.8 0l35.4-35.4c15.2-15.3 15.2-40 0-55.2zM384 346.2V448H64V128h229.8c3.2 0 6.2-1.3 8.5-3.5l40-40c7.6-7.6 2.2-20.5-8.5-20.5H48C21.5 64 0 85.5 0 112v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V306.2c0-10.7-12.9-16-20.5-8.5l-40 40c-2.2 2.3-3.5 5.3-3.5 8.5z" })
37613
37617
  }
37614
37618
  );
37615
37619
  }
@@ -37625,14 +37629,14 @@ function SaveIcon() {
37625
37629
  width: "20px",
37626
37630
  xmlns: "http://www.w3.org/2000/svg",
37627
37631
  children: [
37628
- /* @__PURE__ */ jsx22("path", { d: "M272 64h-16c-4.4 0-8 3.6-8 8v72c0 4.4 7.6 8 12 8h12c4.4 0 8-3.6 8-8V72c0-4.4-3.6-8-8-8z" }),
37629
- /* @__PURE__ */ jsx22("path", { d: "M433.9 130.1L382 78.2c-9-9-21.3-14.2-34.1-14.2h-28c-8.8 0-16 7.3-16 16.2v80c0 8.8-7.2 16-16 16H160c-8.8 0-16-7.2-16-16v-80c0-8.8-7.2-16.2-16-16.2H96c-17.6 0-32 14.4-32 32v320c0 17.6 14.4 32 32 32h320c17.6 0 32-14.4 32-32V164c0-12.7-5.1-24.9-14.1-33.9zM322 400.1c0 8.8-8 16-17.8 16H143.8c-9.8 0-17.8-7.2-17.8-16v-96c0-8.8 8-16 17.8-16h160.4c9.8 0 17.8 7.2 17.8 16v96z" })
37632
+ /* @__PURE__ */ jsx21("path", { d: "M272 64h-16c-4.4 0-8 3.6-8 8v72c0 4.4 7.6 8 12 8h12c4.4 0 8-3.6 8-8V72c0-4.4-3.6-8-8-8z" }),
37633
+ /* @__PURE__ */ jsx21("path", { d: "M433.9 130.1L382 78.2c-9-9-21.3-14.2-34.1-14.2h-28c-8.8 0-16 7.3-16 16.2v80c0 8.8-7.2 16-16 16H160c-8.8 0-16-7.2-16-16v-80c0-8.8-7.2-16.2-16-16.2H96c-17.6 0-32 14.4-32 32v320c0 17.6 14.4 32 32 32h320c17.6 0 32-14.4 32-32V164c0-12.7-5.1-24.9-14.1-33.9zM322 400.1c0 8.8-8 16-17.8 16H143.8c-9.8 0-17.8-7.2-17.8-16v-96c0-8.8 8-16 17.8-16h160.4c9.8 0 17.8 7.2 17.8 16v96z" })
37630
37634
  ]
37631
37635
  }
37632
37636
  );
37633
37637
  }
37634
37638
  function ExcelIcon() {
37635
- return /* @__PURE__ */ jsx22(
37639
+ return /* @__PURE__ */ jsx21(
37636
37640
  "svg",
37637
37641
  {
37638
37642
  stroke: "currentColor",
@@ -37642,13 +37646,13 @@ function ExcelIcon() {
37642
37646
  height: "20px",
37643
37647
  width: "20px",
37644
37648
  xmlns: "http://www.w3.org/2000/svg",
37645
- children: /* @__PURE__ */ jsx22("path", { d: "M2.85858 2.87732L15.4293 1.0815C15.7027 1.04245 15.9559 1.2324 15.995 1.50577C15.9983 1.52919 16 1.55282 16 1.57648V22.4235C16 22.6996 15.7761 22.9235 15.5 22.9235C15.4763 22.9235 15.4527 22.9218 15.4293 22.9184L2.85858 21.1226C2.36593 21.0522 2 20.6303 2 20.1327V3.86727C2 3.36962 2.36593 2.9477 2.85858 2.87732ZM17 2.99997H21C21.5523 2.99997 22 3.44769 22 3.99997V20C22 20.5523 21.5523 21 21 21H17V2.99997ZM10.2 12L13 7.99997H10.6L9 10.2857L7.39999 7.99997H5L7.8 12L5 16H7.39999L9 13.7143L10.6 16H13L10.2 12Z" })
37649
+ children: /* @__PURE__ */ jsx21("path", { d: "M2.85858 2.87732L15.4293 1.0815C15.7027 1.04245 15.9559 1.2324 15.995 1.50577C15.9983 1.52919 16 1.55282 16 1.57648V22.4235C16 22.6996 15.7761 22.9235 15.5 22.9235C15.4763 22.9235 15.4527 22.9218 15.4293 22.9184L2.85858 21.1226C2.36593 21.0522 2 20.6303 2 20.1327V3.86727C2 3.36962 2.36593 2.9477 2.85858 2.87732ZM17 2.99997H21C21.5523 2.99997 22 3.44769 22 3.99997V20C22 20.5523 21.5523 21 21 21H17V2.99997ZM10.2 12L13 7.99997H10.6L9 10.2857L7.39999 7.99997H5L7.8 12L5 16H7.39999L9 13.7143L10.6 16H13L10.2 12Z" })
37646
37650
  }
37647
37651
  );
37648
37652
  }
37649
37653
 
37650
37654
  // src/table3/filter.tsx
37651
- import { jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
37655
+ import { jsx as jsx22, jsxs as jsxs14 } from "react/jsx-runtime";
37652
37656
  function Filter({
37653
37657
  h,
37654
37658
  objectData,
@@ -37661,12 +37665,12 @@ function Filter({
37661
37665
  }) {
37662
37666
  const [visible, setVisible] = useState11(false);
37663
37667
  const [text, setText] = useState11("");
37664
- const items = useMemo4(
37668
+ const items = useMemo5(
37665
37669
  () => [...new Set(Object.values(objectData).map((o) => o[h]))],
37666
37670
  [objectData]
37667
37671
  );
37668
37672
  const [selected, setSelected] = useState11(items);
37669
- const itemsFiltered = useMemo4(
37673
+ const itemsFiltered = useMemo5(
37670
37674
  () => items.sort((a, b) => `${a}`.localeCompare(b)).filter((item) => {
37671
37675
  if (!text) return true;
37672
37676
  return `${item}`.toLowerCase().includes(text.toLowerCase());
@@ -37703,14 +37707,14 @@ function Filter({
37703
37707
  const hidden = Object.values(objectData).filter(
37704
37708
  (d) => d._visible === false
37705
37709
  );
37706
- useEffect7(() => {
37710
+ useEffect8(() => {
37707
37711
  if (data.length != Object.values(objectData).map((o) => (o == null ? void 0 : o._id) || (o == null ? void 0 : o.id)).length) {
37708
37712
  const news = [...new Set(data.map((o) => o[h]))];
37709
37713
  setSelected(news);
37710
37714
  }
37711
37715
  }, [data]);
37712
37716
  return /* @__PURE__ */ jsxs14("th", { className: "cursor-pointer", children: [
37713
- /* @__PURE__ */ jsx23("div", { className: "relative", children: visible && /* @__PURE__ */ jsx23(
37717
+ /* @__PURE__ */ jsx22("div", { className: "relative", children: visible && /* @__PURE__ */ jsx22(
37714
37718
  "div",
37715
37719
  {
37716
37720
  className: " w-full h-screen top-0 left-0 fixed ",
@@ -37731,13 +37735,13 @@ function Filter({
37731
37735
  onClick: (e) => setVisible(!visible),
37732
37736
  children: [
37733
37737
  sort && //
37734
- Object.keys(sort)[0] == h && ((sort == null ? void 0 : sort[h]) == "asc" ? /* @__PURE__ */ jsx23("div", { className: "text-green-300", children: /* @__PURE__ */ jsx23(OrderAsc, {}) }) : (sort == null ? void 0 : sort[h]) == "desc" && /* @__PURE__ */ jsx23("div", { className: "text-green-300", children: /* @__PURE__ */ jsx23(OrderDesc, {}) })),
37735
- /* @__PURE__ */ jsx23("div", { children: h }),
37736
- selected.length < items.length && /* @__PURE__ */ jsx23("div", { className: "text-red-500 ", children: /* @__PURE__ */ jsx23(FilterOffIcon, {}) })
37738
+ Object.keys(sort)[0] == h && ((sort == null ? void 0 : sort[h]) == "asc" ? /* @__PURE__ */ jsx22("div", { className: "text-green-300", children: /* @__PURE__ */ jsx22(OrderAsc, {}) }) : (sort == null ? void 0 : sort[h]) == "desc" && /* @__PURE__ */ jsx22("div", { className: "text-green-300", children: /* @__PURE__ */ jsx22(OrderDesc, {}) })),
37739
+ /* @__PURE__ */ jsx22("div", { children: h }),
37740
+ selected.length < items.length && /* @__PURE__ */ jsx22("div", { className: "text-red-500 ", children: /* @__PURE__ */ jsx22(FilterOffIcon, {}) })
37737
37741
  ]
37738
37742
  }
37739
37743
  ),
37740
- visible && /* @__PURE__ */ jsx23(
37744
+ visible && /* @__PURE__ */ jsx22(
37741
37745
  "div",
37742
37746
  {
37743
37747
  className: "border shadow rounded bg-white p-1 absolute left-0 text-black",
@@ -37760,7 +37764,7 @@ function Filter({
37760
37764
  },
37761
37765
  className: "flex items-center gap-2 border p-1 hover:bg-blue-100",
37762
37766
  children: [
37763
- /* @__PURE__ */ jsx23(OrderAsc, {}),
37767
+ /* @__PURE__ */ jsx22(OrderAsc, {}),
37764
37768
  " Ordenar de la A a la Z"
37765
37769
  ]
37766
37770
  }
@@ -37782,7 +37786,7 @@ function Filter({
37782
37786
  },
37783
37787
  className: "flex items-center gap-2 border p-1 hover:bg-blue-100",
37784
37788
  children: [
37785
- /* @__PURE__ */ jsx23(OrderDesc, {}),
37789
+ /* @__PURE__ */ jsx22(OrderDesc, {}),
37786
37790
  "Ordenar de la Z a la A"
37787
37791
  ]
37788
37792
  }
@@ -37796,11 +37800,11 @@ function Filter({
37796
37800
  },
37797
37801
  children: [
37798
37802
  "Borrar Filtro",
37799
- /* @__PURE__ */ jsx23("div", { className: "text-white ", children: /* @__PURE__ */ jsx23(FilterOffIcon, {}) })
37803
+ /* @__PURE__ */ jsx22("div", { className: "text-white ", children: /* @__PURE__ */ jsx22(FilterOffIcon, {}) })
37800
37804
  ]
37801
37805
  }
37802
37806
  ),
37803
- /* @__PURE__ */ jsx23("div", { className: "", children: /* @__PURE__ */ jsx23(
37807
+ /* @__PURE__ */ jsx22("div", { className: "", children: /* @__PURE__ */ jsx22(
37804
37808
  "input",
37805
37809
  {
37806
37810
  className: "border shadow rounded p-2 w-full",
@@ -37819,8 +37823,8 @@ function Filter({
37819
37823
  }
37820
37824
  }
37821
37825
  ) }),
37822
- /* @__PURE__ */ jsx23("div", { children: /* @__PURE__ */ jsxs14("label", { className: "flex gap-1 cursor-pointer px-1", children: [
37823
- /* @__PURE__ */ jsx23(
37826
+ /* @__PURE__ */ jsx22("div", { children: /* @__PURE__ */ jsxs14("label", { className: "flex gap-1 cursor-pointer px-1", children: [
37827
+ /* @__PURE__ */ jsx22(
37824
37828
  "input",
37825
37829
  {
37826
37830
  type: "checkbox",
@@ -37836,9 +37840,9 @@ function Filter({
37836
37840
  ),
37837
37841
  "(Seleccionar Todo)"
37838
37842
  ] }) }),
37839
- /* @__PURE__ */ jsx23("div", { className: "overflow-auto flex gap-1 flex-col p-1 border shadow rounded h-[300px]", children: itemsFiltered.map((item) => {
37840
- return /* @__PURE__ */ jsx23("div", { className: "hover:bg-gray-100 ", children: /* @__PURE__ */ jsxs14("label", { className: "flex gap-1 cursor-pointer truncate", children: [
37841
- /* @__PURE__ */ jsx23(
37843
+ /* @__PURE__ */ jsx22("div", { className: "overflow-auto flex gap-1 flex-col p-1 border shadow rounded h-[300px]", children: itemsFiltered.map((item) => {
37844
+ return /* @__PURE__ */ jsx22("div", { className: "hover:bg-gray-100 ", children: /* @__PURE__ */ jsxs14("label", { className: "flex gap-1 cursor-pointer truncate", children: [
37845
+ /* @__PURE__ */ jsx22(
37842
37846
  "input",
37843
37847
  {
37844
37848
  type: "checkbox",
@@ -37860,7 +37864,7 @@ function Filter({
37860
37864
  ] }) }, item);
37861
37865
  }) }),
37862
37866
  /* @__PURE__ */ jsxs14("div", { className: "flex justify-between px-1", children: [
37863
- /* @__PURE__ */ jsx23(
37867
+ /* @__PURE__ */ jsx22(
37864
37868
  "button",
37865
37869
  {
37866
37870
  className: "p-1 shadow rounded border bg-red-500 text-white",
@@ -37871,7 +37875,7 @@ function Filter({
37871
37875
  children: "Cancelar"
37872
37876
  }
37873
37877
  ),
37874
- /* @__PURE__ */ jsx23(
37878
+ /* @__PURE__ */ jsx22(
37875
37879
  "button",
37876
37880
  {
37877
37881
  className: "p-1 shadow rounded border bg-blue-500 text-white",
@@ -37890,7 +37894,7 @@ function Filter({
37890
37894
  }
37891
37895
 
37892
37896
  // src/table3/head.tsx
37893
- import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
37897
+ import { jsx as jsx23, jsxs as jsxs15 } from "react/jsx-runtime";
37894
37898
  function TableHead({
37895
37899
  headers,
37896
37900
  selectItems,
@@ -37905,9 +37909,9 @@ function TableHead({
37905
37909
  sort,
37906
37910
  setSort
37907
37911
  }) {
37908
- return /* @__PURE__ */ jsx24("thead", { children: /* @__PURE__ */ jsxs15("tr", { className: "bg-blue-500 text-white font-bold", children: [
37909
- modal && /* @__PURE__ */ jsx24("th", { children: "-" }),
37910
- selectItems && /* @__PURE__ */ jsx24("th", { children: /* @__PURE__ */ jsx24(
37912
+ return /* @__PURE__ */ jsx23("thead", { children: /* @__PURE__ */ jsxs15("tr", { className: "bg-blue-500 text-white font-bold", children: [
37913
+ modal && /* @__PURE__ */ jsx23("th", { children: "-" }),
37914
+ selectItems && /* @__PURE__ */ jsx23("th", { children: /* @__PURE__ */ jsx23(
37911
37915
  "input",
37912
37916
  {
37913
37917
  className: "m-2",
@@ -37935,7 +37939,7 @@ function TableHead({
37935
37939
  ) }),
37936
37940
  Object.values(headers).map((h) => {
37937
37941
  if (h.startsWith("_")) return null;
37938
- return /* @__PURE__ */ jsx24(
37942
+ return /* @__PURE__ */ jsx23(
37939
37943
  Filter,
37940
37944
  {
37941
37945
  objectData,
@@ -37958,7 +37962,7 @@ import { useState as useState12 } from "react";
37958
37962
 
37959
37963
  // src/table3/tr.tsx
37960
37964
  import React7 from "react";
37961
- import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
37965
+ import { jsx as jsx24, jsxs as jsxs16 } from "react/jsx-runtime";
37962
37966
  function TR({
37963
37967
  handlers,
37964
37968
  setObjectData,
@@ -37986,7 +37990,7 @@ function TR({
37986
37990
  setSelected(selected == index ? -1 : index);
37987
37991
  },
37988
37992
  children: [
37989
- modal && /* @__PURE__ */ jsx25("th", { className: "border", children: /* @__PURE__ */ jsx25(
37993
+ modal && /* @__PURE__ */ jsx24("th", { className: "border", children: /* @__PURE__ */ jsx24(
37990
37994
  "button",
37991
37995
  {
37992
37996
  className: "p-1 border shadow-rounded bg-blue-500 rounded text-white",
@@ -37995,10 +37999,10 @@ function TR({
37995
37999
  (_a = modalRef.current) == null ? void 0 : _a.showModal();
37996
38000
  setDialogRow(row);
37997
38001
  },
37998
- children: /* @__PURE__ */ jsx25(EditIcon2, {})
38002
+ children: /* @__PURE__ */ jsx24(EditIcon2, {})
37999
38003
  }
38000
38004
  ) }),
38001
- selectItems && /* @__PURE__ */ jsx25("th", { className: "border", children: /* @__PURE__ */ jsx25(
38005
+ selectItems && /* @__PURE__ */ jsx24("th", { className: "border", children: /* @__PURE__ */ jsx24(
38002
38006
  "input",
38003
38007
  {
38004
38008
  type: "checkbox",
@@ -38066,13 +38070,13 @@ function TR({
38066
38070
  return acc;
38067
38071
  }, {})
38068
38072
  });
38069
- return /* @__PURE__ */ jsx25("td", { className: `text-black `, children: cloned }, h);
38073
+ return /* @__PURE__ */ jsx24("td", { className: `text-black `, children: cloned }, h);
38070
38074
  }
38071
- return symbols && (symbols == null ? void 0 : symbols[h]) ? /* @__PURE__ */ jsx25("td", { className: `text-center border max-w-[${colSize}px] `, children: /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-1 w-full", children: [
38075
+ return symbols && (symbols == null ? void 0 : symbols[h]) ? /* @__PURE__ */ jsx24("td", { className: `text-center border max-w-[${colSize}px] `, children: /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-1 w-full", children: [
38072
38076
  symbols[h],
38073
38077
  " ",
38074
38078
  row[h]
38075
- ] }) }, h) : /* @__PURE__ */ jsx25("td", { className: `text-center border max-w-[${colSize}px]`, children: row[h] }, h);
38079
+ ] }) }, h) : /* @__PURE__ */ jsx24("td", { className: `text-center border max-w-[${colSize}px]`, children: row[h] }, h);
38076
38080
  })
38077
38081
  ]
38078
38082
  },
@@ -38081,7 +38085,7 @@ function TR({
38081
38085
  }
38082
38086
 
38083
38087
  // src/table3/body.tsx
38084
- import { jsx as jsx26 } from "react/jsx-runtime";
38088
+ import { jsx as jsx25 } from "react/jsx-runtime";
38085
38089
  function TableBody({
38086
38090
  objectData,
38087
38091
  setObjectData,
@@ -38125,7 +38129,7 @@ function TableBody({
38125
38129
  return key >= start && key < end;
38126
38130
  }).map(([id, k], index) => {
38127
38131
  const row = objectData[id];
38128
- return /* @__PURE__ */ jsx26(
38132
+ return /* @__PURE__ */ jsx25(
38129
38133
  TR,
38130
38134
  {
38131
38135
  ...{
@@ -38150,11 +38154,11 @@ function TableBody({
38150
38154
  id
38151
38155
  );
38152
38156
  });
38153
- return /* @__PURE__ */ jsx26("tbody", { children: sorted });
38157
+ return /* @__PURE__ */ jsx25("tbody", { children: sorted });
38154
38158
  }
38155
38159
 
38156
38160
  // src/table3/panel.tsx
38157
- import { jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
38161
+ import { jsx as jsx26, jsxs as jsxs17 } from "react/jsx-runtime";
38158
38162
  function Panel({
38159
38163
  page,
38160
38164
  setPage,
@@ -38176,7 +38180,7 @@ function Panel({
38176
38180
  },
38177
38181
  children: [
38178
38182
  " ",
38179
- /* @__PURE__ */ jsx27(SaveIcon, {}),
38183
+ /* @__PURE__ */ jsx26(SaveIcon, {}),
38180
38184
  "Guardar"
38181
38185
  ]
38182
38186
  }
@@ -38195,22 +38199,22 @@ function Panel({
38195
38199
  );
38196
38200
  },
38197
38201
  children: [
38198
- /* @__PURE__ */ jsx27(ExcelIcon, {}),
38202
+ /* @__PURE__ */ jsx26(ExcelIcon, {}),
38199
38203
  "Exportar"
38200
38204
  ]
38201
38205
  }
38202
38206
  )
38203
38207
  ] }),
38204
38208
  maxItems !== Infinity && /* @__PURE__ */ jsxs17("div", { className: "flex gap-2 items-center text-2xl", children: [
38205
- /* @__PURE__ */ jsx27("button", { onClick: () => setPage(1), disabled: page === 1, children: "\u23EE" }),
38206
- /* @__PURE__ */ jsx27("button", { onClick: () => setPage(page - 1), disabled: page === 1, children: "\u25C0" }),
38209
+ /* @__PURE__ */ jsx26("button", { onClick: () => setPage(1), disabled: page === 1, children: "\u23EE" }),
38210
+ /* @__PURE__ */ jsx26("button", { onClick: () => setPage(page - 1), disabled: page === 1, children: "\u25C0" }),
38207
38211
  /* @__PURE__ */ jsxs17("span", { className: "text-sm", children: [
38208
38212
  "P\xE1gina ",
38209
38213
  page,
38210
38214
  " / ",
38211
38215
  totalPages
38212
38216
  ] }),
38213
- /* @__PURE__ */ jsx27(
38217
+ /* @__PURE__ */ jsx26(
38214
38218
  "button",
38215
38219
  {
38216
38220
  onClick: () => setPage(page + 1),
@@ -38218,7 +38222,7 @@ function Panel({
38218
38222
  children: "\u25B6"
38219
38223
  }
38220
38224
  ),
38221
- /* @__PURE__ */ jsx27(
38225
+ /* @__PURE__ */ jsx26(
38222
38226
  "button",
38223
38227
  {
38224
38228
  onClick: () => setPage(totalPages),
@@ -38231,7 +38235,7 @@ function Panel({
38231
38235
  }
38232
38236
 
38233
38237
  // src/table3/footer.tsx
38234
- import { jsx as jsx28, jsxs as jsxs18 } from "react/jsx-runtime";
38238
+ import { jsx as jsx27, jsxs as jsxs18 } from "react/jsx-runtime";
38235
38239
  function TableFooter({
38236
38240
  objectData,
38237
38241
  headers,
@@ -38256,9 +38260,9 @@ function TableFooter({
38256
38260
  return null;
38257
38261
  }
38258
38262
  }
38259
- return footer && /* @__PURE__ */ jsx28("tfoot", { children: /* @__PURE__ */ jsxs18("tr", { className: "bg-blue-500 text-white", children: [
38260
- selectItems && /* @__PURE__ */ jsx28("th", {}),
38261
- modal && /* @__PURE__ */ jsx28("th", {}),
38263
+ return footer && /* @__PURE__ */ jsx27("tfoot", { children: /* @__PURE__ */ jsxs18("tr", { className: "bg-blue-500 text-white", children: [
38264
+ selectItems && /* @__PURE__ */ jsx27("th", {}),
38265
+ modal && /* @__PURE__ */ jsx27("th", {}),
38262
38266
  headers.map((header) => {
38263
38267
  if (header.startsWith("_")) {
38264
38268
  return null;
@@ -38267,16 +38271,16 @@ function TableFooter({
38267
38271
  symbols[header],
38268
38272
  " ",
38269
38273
  operacion(footer[header], header)
38270
- ] }, header) : /* @__PURE__ */ jsx28("th", { children: operacion(footer[header], header) }, header);
38274
+ ] }, header) : /* @__PURE__ */ jsx27("th", { children: operacion(footer[header], header) }, header);
38271
38275
  }
38272
- return /* @__PURE__ */ jsx28("th", {}, header);
38276
+ return /* @__PURE__ */ jsx27("th", {}, header);
38273
38277
  })
38274
38278
  ] }) });
38275
38279
  }
38276
38280
 
38277
38281
  // src/table3/dialog.tsx
38278
- import React8, { useMemo as useMemo5 } from "react";
38279
- import { jsx as jsx29, jsxs as jsxs19 } from "react/jsx-runtime";
38282
+ import React8, { useMemo as useMemo6 } from "react";
38283
+ import { jsx as jsx28, jsxs as jsxs19 } from "react/jsx-runtime";
38280
38284
  function Dialog3({
38281
38285
  modalRef,
38282
38286
  children,
@@ -38292,7 +38296,7 @@ function Dialog3({
38292
38296
  var _a;
38293
38297
  return (_a = modalRef.current) == null ? void 0 : _a.close();
38294
38298
  };
38295
- const clonedModal = useMemo5(() => {
38299
+ const clonedModal = useMemo6(() => {
38296
38300
  if (dialogRow && React8.isValidElement(children)) {
38297
38301
  return React8.cloneElement(children, {
38298
38302
  key: JSON.stringify(dialogRow),
@@ -38311,8 +38315,8 @@ function Dialog3({
38311
38315
  className: "p-6 rounded-xl shadow-2xl backdrop:bg-black/50 w-[100%] h-screen",
38312
38316
  children: [
38313
38317
  /* @__PURE__ */ jsxs19("div", { className: "flex justify-between items-center mb-4", children: [
38314
- /* @__PURE__ */ jsx29("div", {}),
38315
- /* @__PURE__ */ jsx29(
38318
+ /* @__PURE__ */ jsx28("div", {}),
38319
+ /* @__PURE__ */ jsx28(
38316
38320
  "button",
38317
38321
  {
38318
38322
  onClick: () => {
@@ -38324,7 +38328,7 @@ function Dialog3({
38324
38328
  }
38325
38329
  )
38326
38330
  ] }),
38327
- /* @__PURE__ */ jsx29("div", { className: "text-gray-700", children: clonedModal })
38331
+ /* @__PURE__ */ jsx28("div", { className: "text-gray-700", children: clonedModal })
38328
38332
  ]
38329
38333
  }
38330
38334
  );
@@ -38332,7 +38336,7 @@ function Dialog3({
38332
38336
  var dialog_default = Dialog3;
38333
38337
 
38334
38338
  // src/table3/index.tsx
38335
- import { jsx as jsx30, jsxs as jsxs20 } from "react/jsx-runtime";
38339
+ import { jsx as jsx29, jsxs as jsxs20 } from "react/jsx-runtime";
38336
38340
  function Table3({
38337
38341
  data,
38338
38342
  selectItems,
@@ -38391,11 +38395,11 @@ function Table3({
38391
38395
  }
38392
38396
  }
38393
38397
  const [objectData, setObjectData] = useReducer2(dataReducer, null);
38394
- useEffect8(() => {
38398
+ useEffect9(() => {
38395
38399
  setObjectData(data);
38396
38400
  setPage(1);
38397
38401
  }, [data]);
38398
- const headers = useMemo6(() => {
38402
+ const headers = useMemo7(() => {
38399
38403
  if (!objectData) return [];
38400
38404
  return [
38401
38405
  ...new Set(
@@ -38403,7 +38407,7 @@ function Table3({
38403
38407
  )
38404
38408
  ];
38405
38409
  }, [objectData]);
38406
- const totalPages = useMemo6(() => {
38410
+ const totalPages = useMemo7(() => {
38407
38411
  if (!objectData) return 0;
38408
38412
  return maxItems ? Math.ceil(Object.keys(objectData).length / maxItems) : 1;
38409
38413
  }, [objectData, maxItems]);
@@ -38436,7 +38440,7 @@ function Table3({
38436
38440
  setSort,
38437
38441
  ...props
38438
38442
  };
38439
- useEffect8(() => {
38443
+ useEffect9(() => {
38440
38444
  if ((dialogRow == null ? void 0 : dialogRow.id) || (dialogRow == null ? void 0 : dialogRow._id)) {
38441
38445
  const newDialogRow = objectData[dialogRow == null ? void 0 : dialogRow.id] || objectData[dialogRow == null ? void 0 : dialogRow._id];
38442
38446
  setDialogRow(newDialogRow);
@@ -38445,7 +38449,7 @@ function Table3({
38445
38449
  const style = (props == null ? void 0 : props.style) ? { ...props.style, tableLayout: "fixed" } : { tableLayout: "fixed" };
38446
38450
  if (!objectData) return null;
38447
38451
  return /* @__PURE__ */ jsxs20("div", { className: "border shadow rounded m-1 p-1 bg-white", children: [
38448
- modal && /* @__PURE__ */ jsx30(
38452
+ modal && /* @__PURE__ */ jsx29(
38449
38453
  dialog_default,
38450
38454
  {
38451
38455
  modalRef,
@@ -38455,12 +38459,12 @@ function Table3({
38455
38459
  children: modal
38456
38460
  }
38457
38461
  ),
38458
- header && /* @__PURE__ */ jsx30("div", { className: "font-bold text-2xl py-5 px-2 bg-blue-50", children: header }),
38459
- /* @__PURE__ */ jsx30(Panel, { ...context }),
38462
+ header && /* @__PURE__ */ jsx29("div", { className: "font-bold text-2xl py-5 px-2 bg-blue-50", children: header }),
38463
+ /* @__PURE__ */ jsx29(Panel, { ...context }),
38460
38464
  /* @__PURE__ */ jsxs20("table", { ...props, style, children: [
38461
- /* @__PURE__ */ jsx30(TableHead, { ...context }),
38462
- /* @__PURE__ */ jsx30(TableBody, { ...context }),
38463
- /* @__PURE__ */ jsx30(TableFooter, { ...context })
38465
+ /* @__PURE__ */ jsx29(TableHead, { ...context }),
38466
+ /* @__PURE__ */ jsx29(TableBody, { ...context }),
38467
+ /* @__PURE__ */ jsx29(TableFooter, { ...context })
38464
38468
  ] })
38465
38469
  ] });
38466
38470
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-recomponents",
3
- "version": "2.0.34",
3
+ "version": "2.0.35",
4
4
  "description": "description nueva",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,5 +1,4 @@
1
- "use client";
2
- import React, { ReactElement, cloneElement, useCallback } from "react";
1
+ import React, { ReactElement, cloneElement, useEffect, useMemo } from "react";
3
2
  import usePopup from "../pop";
4
3
 
5
4
  export type PopupColor =
@@ -25,8 +24,16 @@ export default function Modal({
25
24
  title?: string;
26
25
  }) {
27
26
  const pop = usePopup();
27
+ const hide = () => pop.close(false);
28
28
 
29
- const hide = useCallback(() => pop.close(false), [pop.close]);
29
+ const childrenWithHide = useMemo(
30
+ () => cloneElement(children, { hide }),
31
+ [children],
32
+ );
33
+
34
+ useEffect(() => {
35
+ pop.updateMessage(childrenWithHide);
36
+ }, [childrenWithHide]);
30
37
 
31
38
  const props = button?.props;
32
39
  const onClick = props?.onClick;
@@ -36,13 +43,10 @@ export default function Modal({
36
43
  {cloneElement(button, {
37
44
  onClick: (e) => {
38
45
  onClick?.(e as any);
39
- // En la apertura pasamos children con hide
40
- pop.modal(cloneElement(children, { hide }), color, false, true);
46
+ pop.modal(childrenWithHide, color, false, true);
41
47
  },
42
48
  })}
43
-
44
- {/* ✅ Componente, no elemento JSX */}
45
- <pop.PopupComponent />
49
+ {pop.PopupComponent}
46
50
  </>
47
51
  );
48
52
  }
package/src/pop/index.tsx CHANGED
@@ -1,9 +1,12 @@
1
1
  // usePopup.ts - Solución definitiva
2
2
  "use client";
3
+
3
4
  import { useState, useCallback, useRef, type ReactNode } from "react";
4
5
  import { PopupColor, PopupState } from "./types";
5
6
  import { PopupOverlay } from "./overlay";
7
+
6
8
  type PopupStateWithoutMessage = Omit<PopupState, "message">;
9
+
7
10
  const INITIAL_STATE: PopupStateWithoutMessage = {
8
11
  type: "alert",
9
12
  visible: false,
@@ -12,10 +15,12 @@ const INITIAL_STATE: PopupStateWithoutMessage = {
12
15
  icons: true,
13
16
  full: false,
14
17
  };
18
+
15
19
  export default function usePopup() {
16
20
  const [popup, setPopup] = useState<PopupStateWithoutMessage>(INITIAL_STATE);
17
21
  // El message vive FUERA del estado para no quedar congelado
18
22
  const messageRef = useRef<ReactNode>(null);
23
+
19
24
  const open = useCallback(
20
25
  (partial: Omit<PopupState, "visible" | "inputValue">) => {
21
26
  const { message, ...rest } = partial;
@@ -24,6 +29,7 @@ export default function usePopup() {
24
29
  },
25
30
  [],
26
31
  );
32
+
27
33
  const close = useCallback((confirmed: boolean, value?: string) => {
28
34
  setPopup((prev) => {
29
35
  if (confirmed) prev.onConfirm?.(value);
@@ -31,6 +37,7 @@ export default function usePopup() {
31
37
  return { ...prev, visible: false, inputValue: "" };
32
38
  });
33
39
  }, []);
40
+
34
41
  const alert = useCallback(
35
42
  (message: string, color: PopupColor = "primary"): Promise<void> =>
36
43
  new Promise((resolve) =>
@@ -44,6 +51,7 @@ export default function usePopup() {
44
51
  ),
45
52
  [open],
46
53
  );
54
+
47
55
  const modal = useCallback(
48
56
  (
49
57
  message: ReactNode,
@@ -64,6 +72,7 @@ export default function usePopup() {
64
72
  ),
65
73
  [open],
66
74
  );
75
+
67
76
  const confirm = useCallback(
68
77
  (message: string, color: PopupColor = "primary"): Promise<boolean> =>
69
78
  new Promise((resolve) =>
@@ -77,6 +86,7 @@ export default function usePopup() {
77
86
  ),
78
87
  [open],
79
88
  );
89
+
80
90
  const prompt = useCallback(
81
91
  (message: string, color: PopupColor = "primary"): Promise<string | null> =>
82
92
  new Promise((resolve) =>
@@ -90,6 +100,7 @@ export default function usePopup() {
90
100
  ),
91
101
  [open],
92
102
  );
103
+
93
104
  // ✅ Actualiza la ref en cada render cuando el modal está abierto
94
105
  // Esto permite que cambios en el children del padre se reflejen
95
106
  const updateMessage = useCallback((message: ReactNode) => {
@@ -97,16 +108,15 @@ export default function usePopup() {
97
108
  // Fuerza re-render del PopupComponent
98
109
  setPopup((prev) => ({ ...prev }));
99
110
  }, []);
100
- const PopupComponent = useCallback(() => {
101
- if (!popup.visible) return null;
102
- return (
103
- <PopupOverlay
104
- popup={{ ...popup, message: messageRef.current }}
105
- onClose={close}
106
- onInputChange={(v) => setPopup((prev) => ({ ...prev, inputValue: v }))}
107
- />
108
- );
109
- }, [popup, close]); // messageRef no necesita estar aquí, es mutable
111
+
112
+ const PopupComponent = popup.visible ? (
113
+ <PopupOverlay
114
+ popup={{ ...popup, message: messageRef.current }}
115
+ onClose={close}
116
+ onInputChange={(v) => setPopup((prev) => ({ ...prev, inputValue: v }))}
117
+ />
118
+ ) : null;
119
+
110
120
  return {
111
121
  alert,
112
122
  confirm,