next-recomponents 1.9.95 → 1.9.97

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
@@ -36781,16 +36781,15 @@ function CloseIcon2() {
36781
36781
  }
36782
36782
 
36783
36783
  // src/modal/index.tsx
36784
+ var import_material3 = require("@mui/material");
36784
36785
  var import_jsx_runtime13 = require("react/jsx-runtime");
36785
36786
  function Modal({ button, children, ref, title = "" }) {
36786
- const modalRef = ref || (0, import_react9.useRef)(null);
36787
+ const [open, setOpen] = (0, import_react9.useState)(false);
36787
36788
  function show() {
36788
- var _a;
36789
- typeof modalRef == "object" && ((_a = modalRef.current) == null ? void 0 : _a.showModal());
36789
+ setOpen(true);
36790
36790
  }
36791
36791
  function hide() {
36792
- var _a;
36793
- typeof modalRef == "object" && ((_a = modalRef.current) == null ? void 0 : _a.close());
36792
+ setOpen(false);
36794
36793
  }
36795
36794
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
36796
36795
  import_react9.default.Children.map(button, (child) => {
@@ -36806,12 +36805,12 @@ function Modal({ button, children, ref, title = "" }) {
36806
36805
  }
36807
36806
  return child;
36808
36807
  }),
36809
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("dialog", { ref: modalRef, className: "p-5 border shadow rounded", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "relative", children: [
36808
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_material3.Dialog, { open, onClose: hide, fullWidth: true, maxWidth: "xl", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "m-auto p-5", children: [
36810
36809
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
36811
36810
  "button",
36812
36811
  {
36813
36812
  onClick: hide,
36814
- className: "absolute top-0 right-0 text-red-500 ",
36813
+ className: "absolute top-0 right-0 text-red-500 ",
36815
36814
  children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CloseIcon2, {})
36816
36815
  }
36817
36816
  ),
@@ -37802,7 +37801,7 @@ function TableFooter({
37802
37801
  // src/table3/dialog.tsx
37803
37802
  var import_react14 = __toESM(require("react"));
37804
37803
  var import_jsx_runtime26 = require("react/jsx-runtime");
37805
- function Dialog2({
37804
+ function Dialog3({
37806
37805
  modalRef,
37807
37806
  children,
37808
37807
  dialogRow,
@@ -37854,7 +37853,7 @@ function Dialog2({
37854
37853
  }
37855
37854
  );
37856
37855
  }
37857
- var dialog_default = Dialog2;
37856
+ var dialog_default = Dialog3;
37858
37857
 
37859
37858
  // src/table3/index.tsx
37860
37859
  var import_jsx_runtime27 = require("react/jsx-runtime");
package/dist/index.mjs CHANGED
@@ -36747,7 +36747,7 @@ function Select(_a) {
36747
36747
  }
36748
36748
 
36749
36749
  // src/modal/index.tsx
36750
- import React6, { useRef as useRef4 } from "react";
36750
+ import React6, { useState as useState8 } from "react";
36751
36751
 
36752
36752
  // src/modal/close.tsx
36753
36753
  import { jsx as jsx11 } from "react/jsx-runtime";
@@ -36768,16 +36768,15 @@ function CloseIcon2() {
36768
36768
  }
36769
36769
 
36770
36770
  // src/modal/index.tsx
36771
+ import { Dialog as Dialog2 } from "@mui/material";
36771
36772
  import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
36772
36773
  function Modal({ button, children, ref, title = "" }) {
36773
- const modalRef = ref || useRef4(null);
36774
+ const [open, setOpen] = useState8(false);
36774
36775
  function show() {
36775
- var _a;
36776
- typeof modalRef == "object" && ((_a = modalRef.current) == null ? void 0 : _a.showModal());
36776
+ setOpen(true);
36777
36777
  }
36778
36778
  function hide() {
36779
- var _a;
36780
- typeof modalRef == "object" && ((_a = modalRef.current) == null ? void 0 : _a.close());
36779
+ setOpen(false);
36781
36780
  }
36782
36781
  return /* @__PURE__ */ jsxs8(Fragment2, { children: [
36783
36782
  React6.Children.map(button, (child) => {
@@ -36793,12 +36792,12 @@ function Modal({ button, children, ref, title = "" }) {
36793
36792
  }
36794
36793
  return child;
36795
36794
  }),
36796
- /* @__PURE__ */ jsx12("dialog", { ref: modalRef, className: "p-5 border shadow rounded", children: /* @__PURE__ */ jsxs8("div", { className: "relative", children: [
36795
+ /* @__PURE__ */ jsx12(Dialog2, { open, onClose: hide, fullWidth: true, maxWidth: "xl", children: /* @__PURE__ */ jsxs8("div", { className: "m-auto p-5", children: [
36797
36796
  /* @__PURE__ */ jsx12(
36798
36797
  "button",
36799
36798
  {
36800
36799
  onClick: hide,
36801
- className: "absolute top-0 right-0 text-red-500 ",
36800
+ className: "absolute top-0 right-0 text-red-500 ",
36802
36801
  children: /* @__PURE__ */ jsx12(CloseIcon2, {})
36803
36802
  }
36804
36803
  ),
@@ -36866,7 +36865,7 @@ function useDates() {
36866
36865
  import {
36867
36866
  useEffect as useEffect6,
36868
36867
  useRef as useRef5,
36869
- useState as useState8
36868
+ useState as useState9
36870
36869
  } from "react";
36871
36870
  import DatePicker from "react-datepicker";
36872
36871
 
@@ -36907,11 +36906,11 @@ function MyCalendar(_a) {
36907
36906
  "value"
36908
36907
  ]);
36909
36908
  const modalRef = useRef5(null);
36910
- const [selectedDate, setSelectedDate] = useState8(null);
36911
- const [dateStr, setDateStr] = useState8(
36909
+ const [selectedDate, setSelectedDate] = useState9(null);
36910
+ const [dateStr, setDateStr] = useState9(
36912
36911
  defaultValue || value || ""
36913
36912
  );
36914
- const [visible, setVisible] = useState8(false);
36913
+ const [visible, setVisible] = useState9(false);
36915
36914
  useEffect6(() => {
36916
36915
  setVisible(typeof window !== "undefined");
36917
36916
  }, []);
@@ -37079,11 +37078,11 @@ import React9, {
37079
37078
  useMemo as useMemo6,
37080
37079
  useReducer as useReducer2,
37081
37080
  useRef as useRef6,
37082
- useState as useState11
37081
+ useState as useState12
37083
37082
  } from "react";
37084
37083
 
37085
37084
  // src/table3/filter.tsx
37086
- import { useEffect as useEffect7, useMemo as useMemo4, useState as useState9 } from "react";
37085
+ import { useEffect as useEffect7, useMemo as useMemo4, useState as useState10 } from "react";
37087
37086
 
37088
37087
  // src/table3/filters.tsx
37089
37088
  import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
@@ -37193,13 +37192,13 @@ function Filter({
37193
37192
  sort,
37194
37193
  setSort
37195
37194
  }) {
37196
- const [visible, setVisible] = useState9(false);
37197
- const [text, setText] = useState9("");
37195
+ const [visible, setVisible] = useState10(false);
37196
+ const [text, setText] = useState10("");
37198
37197
  const items = useMemo4(
37199
37198
  () => [...new Set(Object.values(objectData).map((o) => o[h]))],
37200
37199
  [objectData]
37201
37200
  );
37202
- const [selected, setSelected] = useState9(items);
37201
+ const [selected, setSelected] = useState10(items);
37203
37202
  const itemsFiltered = useMemo4(
37204
37203
  () => items.sort((a, b) => `${a}`.localeCompare(b)).filter((item) => {
37205
37204
  if (!text) return true;
@@ -37486,7 +37485,7 @@ function TableHead({
37486
37485
  }
37487
37486
 
37488
37487
  // src/table3/body.tsx
37489
- import { useState as useState10 } from "react";
37488
+ import { useState as useState11 } from "react";
37490
37489
 
37491
37490
  // src/table3/tr.tsx
37492
37491
  import React7 from "react";
@@ -37623,7 +37622,7 @@ function TableBody({
37623
37622
  symbols,
37624
37623
  sort
37625
37624
  }) {
37626
- const [selected, setSelected] = useState10(-1);
37625
+ const [selected, setSelected] = useState11(-1);
37627
37626
  const sorted = Object.entries(objectData).sort(([, a], [, b]) => {
37628
37627
  for (const [key, order] of Object.entries(
37629
37628
  sort || { id: "desc", _id: "desc" }
@@ -37799,7 +37798,7 @@ function TableFooter({
37799
37798
  // src/table3/dialog.tsx
37800
37799
  import React8, { useMemo as useMemo5 } from "react";
37801
37800
  import { jsx as jsx25, jsxs as jsxs17 } from "react/jsx-runtime";
37802
- function Dialog2({
37801
+ function Dialog3({
37803
37802
  modalRef,
37804
37803
  children,
37805
37804
  dialogRow,
@@ -37851,7 +37850,7 @@ function Dialog2({
37851
37850
  }
37852
37851
  );
37853
37852
  }
37854
- var dialog_default = Dialog2;
37853
+ var dialog_default = Dialog3;
37855
37854
 
37856
37855
  // src/table3/index.tsx
37857
37856
  import { jsx as jsx26, jsxs as jsxs18 } from "react/jsx-runtime";
@@ -37883,8 +37882,8 @@ function Table3(_a) {
37883
37882
  "symbols",
37884
37883
  "sortBy"
37885
37884
  ]);
37886
- const [handlers, setHandlers] = useState11({});
37887
- const [page, setPage] = useState11(1);
37885
+ const [handlers, setHandlers] = useState12({});
37886
+ const [page, setPage] = useState12(1);
37888
37887
  function dataReducer(a, b) {
37889
37888
  if (b == null) return {};
37890
37889
  if (Array.isArray(b)) {
@@ -37938,9 +37937,9 @@ function Table3(_a) {
37938
37937
  if (!objectData) return 0;
37939
37938
  return maxItems ? Math.ceil(Object.keys(objectData).length / maxItems) : 1;
37940
37939
  }, [objectData, maxItems]);
37941
- const [sort, setSort] = useState11(sortBy);
37940
+ const [sort, setSort] = useState12(sortBy);
37942
37941
  const modalRef = useRef6(null);
37943
- const [dialogRow, setDialogRow] = useState11({});
37942
+ const [dialogRow, setDialogRow] = useState12({});
37944
37943
  const context = __spreadValues({
37945
37944
  objectData,
37946
37945
  headers,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-recomponents",
3
- "version": "1.9.95",
3
+ "version": "1.9.97",
4
4
  "description": "description nueva",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,21 +1,21 @@
1
- import React, { useRef } from "react";
1
+ import React, { useRef, useState } from "react";
2
2
  import CloseIcon from "./close";
3
+ import { Dialog } from "@mui/material";
3
4
 
4
- interface Props
5
- extends React.DetailedHTMLProps<
6
- React.DialogHTMLAttributes<HTMLDialogElement>,
7
- HTMLDialogElement
8
- > {
5
+ interface Props extends React.DetailedHTMLProps<
6
+ React.DialogHTMLAttributes<HTMLDialogElement>,
7
+ HTMLDialogElement
8
+ > {
9
9
  button: React.ReactElement<{ onClick: (e: React.MouseEvent) => void }>;
10
10
  children: React.ReactElement<{ hide: () => void }>;
11
11
  }
12
12
  export default function Modal({ button, children, ref, title = "" }: Props) {
13
- const modalRef = ref || useRef<HTMLDialogElement>(null);
13
+ const [open, setOpen] = useState(false);
14
14
  function show() {
15
- typeof modalRef == "object" && modalRef.current?.showModal();
15
+ setOpen(true);
16
16
  }
17
17
  function hide() {
18
- typeof modalRef == "object" && modalRef.current?.close();
18
+ setOpen(false);
19
19
  }
20
20
 
21
21
  return (
@@ -33,12 +33,12 @@ export default function Modal({ button, children, ref, title = "" }: Props) {
33
33
  }
34
34
  return child;
35
35
  })}
36
- <dialog ref={modalRef} className="p-5 border shadow rounded">
37
- <div className="relative">
36
+ <Dialog open={open} onClose={hide} fullWidth maxWidth="xl">
37
+ <div className="m-auto p-5">
38
38
  {/* Botón de cerrar en la esquina superior derecha */}
39
39
  <button
40
40
  onClick={hide}
41
- className="absolute top-0 right-0 text-red-500 "
41
+ className="absolute top-0 right-0 text-red-500 "
42
42
  >
43
43
  <CloseIcon />
44
44
  </button>
@@ -53,7 +53,7 @@ export default function Modal({ button, children, ref, title = "" }: Props) {
53
53
  })}
54
54
  </div>
55
55
  </div>
56
- </dialog>
56
+ </Dialog>
57
57
  </>
58
58
  );
59
59
  }