next-recomponents 1.9.99 → 2.0.1

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
@@ -35785,7 +35785,7 @@ function IHTable({
35785
35785
  }) {
35786
35786
  const [open, setOpen] = (0, import_react4.useState)(false);
35787
35787
  if (modal) {
35788
- buttons = __spreadProps(__spreadValues({}, buttons), { Modal: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(EditIcon, {}) }) });
35788
+ buttons = __spreadProps(__spreadValues({}, buttons), { Modal: "" });
35789
35789
  }
35790
35790
  const handleOpen = () => setOpen(true);
35791
35791
  const handleClose = () => {
@@ -35831,16 +35831,20 @@ function IHTable({
35831
35831
  flex,
35832
35832
  editable: false,
35833
35833
  type: "string",
35834
- renderCell: (params) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
35835
- Button,
35836
- {
35837
- className: "text-xs",
35838
- onClick: () => {
35839
- handleOpen();
35840
- },
35841
- children: "Editar"
35842
- }
35843
- )
35834
+ renderCell: (params) => {
35835
+ var _a;
35836
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
35837
+ Button,
35838
+ {
35839
+ className: "text-xs",
35840
+ onClick: () => {
35841
+ handleOpen();
35842
+ },
35843
+ icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(EditIcon, {}),
35844
+ children: (_a = params == null ? void 0 : params.row) == null ? void 0 : _a["Modal"]
35845
+ }
35846
+ );
35847
+ }
35844
35848
  });
35845
35849
  }
35846
35850
  return arr;
@@ -36912,6 +36916,7 @@ function CalendarIcon() {
36912
36916
  }
36913
36917
 
36914
36918
  // src/calendar/index.tsx
36919
+ var import_material4 = require("@mui/material");
36915
36920
  var import_jsx_runtime16 = require("react/jsx-runtime");
36916
36921
  function MyCalendar(_a) {
36917
36922
  var _b = _a, {
@@ -36929,23 +36934,18 @@ function MyCalendar(_a) {
36929
36934
  "label",
36930
36935
  "value"
36931
36936
  ]);
36932
- const modalRef = (0, import_react10.useRef)(null);
36933
36937
  const [selectedDate, setSelectedDate] = (0, import_react10.useState)(null);
36934
36938
  const [dateStr, setDateStr] = (0, import_react10.useState)(
36935
36939
  defaultValue || value || ""
36936
36940
  );
36937
- const [visible, setVisible] = (0, import_react10.useState)(false);
36938
- (0, import_react10.useEffect)(() => {
36939
- setVisible(typeof window !== "undefined");
36940
- }, []);
36941
+ const [open, setOpen] = (0, import_react10.useState)(false);
36941
36942
  function handleChange(date) {
36942
- var _a2, _b2;
36943
36943
  if (!date) return;
36944
36944
  setSelectedDate(date);
36945
36945
  const formattedDate = date.toISOString().split("T")[0];
36946
36946
  setDateStr(formattedDate);
36947
36947
  onChange == null ? void 0 : onChange({ target: { value: formattedDate } });
36948
- (_b2 = (_a2 = modalRef.current) == null ? void 0 : _a2.close) == null ? void 0 : _b2.call(_a2);
36948
+ setOpen(false);
36949
36949
  }
36950
36950
  const normalizedEnabledDates = enabledDates.map((item) => {
36951
36951
  if (item instanceof Date) return item;
@@ -36965,11 +36965,8 @@ function MyCalendar(_a) {
36965
36965
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
36966
36966
  "div",
36967
36967
  {
36968
- onClick: () => {
36969
- var _a2, _b2;
36970
- return (_b2 = (_a2 = modalRef == null ? void 0 : modalRef.current) == null ? void 0 : _a2.showModal) == null ? void 0 : _b2.call(_a2);
36971
- },
36972
36968
  className: "cursor-pointer flex items-center justify-center",
36969
+ onClick: (e) => setOpen(true),
36973
36970
  children: [
36974
36971
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
36975
36972
  "input",
@@ -36990,29 +36987,25 @@ function MyCalendar(_a) {
36990
36987
  }
36991
36988
  ) })
36992
36989
  ] }),
36993
- visible && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
36994
- "dialog",
36995
- {
36996
- ref: modalRef,
36997
- id: "my-calendar-modal-item",
36998
- onClick: (e) => {
36999
- var _a2;
37000
- const el = e.target;
37001
- if ((el == null ? void 0 : el.id) === "my-calendar-modal-item") {
37002
- (_a2 = modalRef.current) == null ? void 0 : _a2.close();
37003
- }
37004
- },
37005
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: " w-[300px] flex items-start justify-center h-[300px] p-5", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
37006
- import_react_datepicker.default,
37007
- {
37008
- inline: true,
37009
- selected: selectedDate,
37010
- onChange: handleChange,
37011
- includeDates: normalizedEnabledDates
37012
- }
37013
- ) })
37014
- }
37015
- )
36990
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_material4.Dialog, { open, children: [
36991
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex justify-end p-5 font-bold", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
36992
+ "button",
36993
+ {
36994
+ className: " border-lg w-[20px] bg-red-500 text-white shadow rounded",
36995
+ onClick: (e) => setOpen(false),
36996
+ children: "x"
36997
+ }
36998
+ ) }),
36999
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: " w-[300px] flex items-start justify-center h-[300px] p-5", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
37000
+ import_react_datepicker.default,
37001
+ {
37002
+ inline: true,
37003
+ selected: selectedDate,
37004
+ onChange: handleChange,
37005
+ includeDates: normalizedEnabledDates
37006
+ }
37007
+ ) })
37008
+ ] })
37016
37009
  ] });
37017
37010
  }
37018
37011
 
@@ -37816,7 +37809,7 @@ function TableFooter({
37816
37809
  // src/table3/dialog.tsx
37817
37810
  var import_react14 = __toESM(require("react"));
37818
37811
  var import_jsx_runtime26 = require("react/jsx-runtime");
37819
- function Dialog3({
37812
+ function Dialog4({
37820
37813
  modalRef,
37821
37814
  children,
37822
37815
  dialogRow,
@@ -37868,7 +37861,7 @@ function Dialog3({
37868
37861
  }
37869
37862
  );
37870
37863
  }
37871
- var dialog_default = Dialog3;
37864
+ var dialog_default = Dialog4;
37872
37865
 
37873
37866
  // src/table3/index.tsx
37874
37867
  var import_jsx_runtime27 = require("react/jsx-runtime");
package/dist/index.mjs CHANGED
@@ -35766,7 +35766,7 @@ function IHTable({
35766
35766
  }) {
35767
35767
  const [open, setOpen] = useState4(false);
35768
35768
  if (modal) {
35769
- buttons = __spreadProps(__spreadValues({}, buttons), { Modal: /* @__PURE__ */ jsx6(Button, { icon: /* @__PURE__ */ jsx6(EditIcon, {}) }) });
35769
+ buttons = __spreadProps(__spreadValues({}, buttons), { Modal: "" });
35770
35770
  }
35771
35771
  const handleOpen = () => setOpen(true);
35772
35772
  const handleClose = () => {
@@ -35812,16 +35812,20 @@ function IHTable({
35812
35812
  flex,
35813
35813
  editable: false,
35814
35814
  type: "string",
35815
- renderCell: (params) => /* @__PURE__ */ jsx6(
35816
- Button,
35817
- {
35818
- className: "text-xs",
35819
- onClick: () => {
35820
- handleOpen();
35821
- },
35822
- children: "Editar"
35823
- }
35824
- )
35815
+ renderCell: (params) => {
35816
+ var _a;
35817
+ return /* @__PURE__ */ jsx6(
35818
+ Button,
35819
+ {
35820
+ className: "text-xs",
35821
+ onClick: () => {
35822
+ handleOpen();
35823
+ },
35824
+ icon: /* @__PURE__ */ jsx6(EditIcon, {}),
35825
+ children: (_a = params == null ? void 0 : params.row) == null ? void 0 : _a["Modal"]
35826
+ }
35827
+ );
35828
+ }
35825
35829
  });
35826
35830
  }
35827
35831
  return arr;
@@ -36878,8 +36882,6 @@ function useDates() {
36878
36882
 
36879
36883
  // src/calendar/index.tsx
36880
36884
  import {
36881
- useEffect as useEffect6,
36882
- useRef as useRef5,
36883
36885
  useState as useState9
36884
36886
  } from "react";
36885
36887
  import DatePicker from "react-datepicker";
@@ -36903,6 +36905,7 @@ function CalendarIcon() {
36903
36905
  }
36904
36906
 
36905
36907
  // src/calendar/index.tsx
36908
+ import { Dialog as Dialog3 } from "@mui/material";
36906
36909
  import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
36907
36910
  function MyCalendar(_a) {
36908
36911
  var _b = _a, {
@@ -36920,23 +36923,18 @@ function MyCalendar(_a) {
36920
36923
  "label",
36921
36924
  "value"
36922
36925
  ]);
36923
- const modalRef = useRef5(null);
36924
36926
  const [selectedDate, setSelectedDate] = useState9(null);
36925
36927
  const [dateStr, setDateStr] = useState9(
36926
36928
  defaultValue || value || ""
36927
36929
  );
36928
- const [visible, setVisible] = useState9(false);
36929
- useEffect6(() => {
36930
- setVisible(typeof window !== "undefined");
36931
- }, []);
36930
+ const [open, setOpen] = useState9(false);
36932
36931
  function handleChange(date) {
36933
- var _a2, _b2;
36934
36932
  if (!date) return;
36935
36933
  setSelectedDate(date);
36936
36934
  const formattedDate = date.toISOString().split("T")[0];
36937
36935
  setDateStr(formattedDate);
36938
36936
  onChange == null ? void 0 : onChange({ target: { value: formattedDate } });
36939
- (_b2 = (_a2 = modalRef.current) == null ? void 0 : _a2.close) == null ? void 0 : _b2.call(_a2);
36937
+ setOpen(false);
36940
36938
  }
36941
36939
  const normalizedEnabledDates = enabledDates.map((item) => {
36942
36940
  if (item instanceof Date) return item;
@@ -36956,11 +36954,8 @@ function MyCalendar(_a) {
36956
36954
  /* @__PURE__ */ jsx15("div", { children: /* @__PURE__ */ jsxs9(
36957
36955
  "div",
36958
36956
  {
36959
- onClick: () => {
36960
- var _a2, _b2;
36961
- return (_b2 = (_a2 = modalRef == null ? void 0 : modalRef.current) == null ? void 0 : _a2.showModal) == null ? void 0 : _b2.call(_a2);
36962
- },
36963
36957
  className: "cursor-pointer flex items-center justify-center",
36958
+ onClick: (e) => setOpen(true),
36964
36959
  children: [
36965
36960
  /* @__PURE__ */ jsx15(
36966
36961
  "input",
@@ -36981,29 +36976,25 @@ function MyCalendar(_a) {
36981
36976
  }
36982
36977
  ) })
36983
36978
  ] }),
36984
- visible && /* @__PURE__ */ jsx15(
36985
- "dialog",
36986
- {
36987
- ref: modalRef,
36988
- id: "my-calendar-modal-item",
36989
- onClick: (e) => {
36990
- var _a2;
36991
- const el = e.target;
36992
- if ((el == null ? void 0 : el.id) === "my-calendar-modal-item") {
36993
- (_a2 = modalRef.current) == null ? void 0 : _a2.close();
36994
- }
36995
- },
36996
- children: /* @__PURE__ */ jsx15("div", { className: " w-[300px] flex items-start justify-center h-[300px] p-5", children: /* @__PURE__ */ jsx15(
36997
- DatePicker,
36998
- {
36999
- inline: true,
37000
- selected: selectedDate,
37001
- onChange: handleChange,
37002
- includeDates: normalizedEnabledDates
37003
- }
37004
- ) })
37005
- }
37006
- )
36979
+ /* @__PURE__ */ jsxs9(Dialog3, { open, children: [
36980
+ /* @__PURE__ */ jsx15("div", { className: "flex justify-end p-5 font-bold", children: /* @__PURE__ */ jsx15(
36981
+ "button",
36982
+ {
36983
+ className: " border-lg w-[20px] bg-red-500 text-white shadow rounded",
36984
+ onClick: (e) => setOpen(false),
36985
+ children: "x"
36986
+ }
36987
+ ) }),
36988
+ /* @__PURE__ */ jsx15("div", { className: " w-[300px] flex items-start justify-center h-[300px] p-5", children: /* @__PURE__ */ jsx15(
36989
+ DatePicker,
36990
+ {
36991
+ inline: true,
36992
+ selected: selectedDate,
36993
+ onChange: handleChange,
36994
+ includeDates: normalizedEnabledDates
36995
+ }
36996
+ ) })
36997
+ ] })
37007
36998
  ] });
37008
36999
  }
37009
37000
 
@@ -37813,7 +37804,7 @@ function TableFooter({
37813
37804
  // src/table3/dialog.tsx
37814
37805
  import React8, { useMemo as useMemo5 } from "react";
37815
37806
  import { jsx as jsx25, jsxs as jsxs17 } from "react/jsx-runtime";
37816
- function Dialog3({
37807
+ function Dialog4({
37817
37808
  modalRef,
37818
37809
  children,
37819
37810
  dialogRow,
@@ -37865,7 +37856,7 @@ function Dialog3({
37865
37856
  }
37866
37857
  );
37867
37858
  }
37868
- var dialog_default = Dialog3;
37859
+ var dialog_default = Dialog4;
37869
37860
 
37870
37861
  // src/table3/index.tsx
37871
37862
  import { jsx as jsx26, jsxs as jsxs18 } from "react/jsx-runtime";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-recomponents",
3
- "version": "1.9.99",
3
+ "version": "2.0.1",
4
4
  "description": "description nueva",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -9,6 +9,7 @@ import {
9
9
  import DatePicker from "react-datepicker";
10
10
  import "./react-datepicker.css";
11
11
  import CalendarIcon from "./calendar.icon";
12
+ import { Dialog } from "@mui/material";
12
13
 
13
14
  interface CalendarProps extends DetailedHTMLProps<
14
15
  InputHTMLAttributes<HTMLInputElement>,
@@ -29,16 +30,15 @@ export default function MyCalendar({
29
30
  value,
30
31
  ...otherProps
31
32
  }: CalendarProps) {
32
- const modalRef = useRef<HTMLDialogElement>(null);
33
33
  const [selectedDate, setSelectedDate] = useState<Date | null>(null);
34
34
  const [dateStr, setDateStr] = useState<string | number | readonly string[]>(
35
35
  defaultValue || value || "",
36
36
  );
37
- const [visible, setVisible] = useState(false);
37
+ const [open, setOpen] = useState(false);
38
38
 
39
- useEffect(() => {
40
- setVisible(typeof window !== "undefined");
41
- }, []);
39
+ // useEffect(() => {
40
+ // setVisible(typeof window !== "undefined");
41
+ // }, []);
42
42
 
43
43
  function handleChange(date: Date | null) {
44
44
  if (!date) return;
@@ -46,7 +46,7 @@ export default function MyCalendar({
46
46
  const formattedDate = date.toISOString().split("T")[0];
47
47
  setDateStr(formattedDate);
48
48
  onChange?.({ target: { value: formattedDate } });
49
- modalRef.current?.close?.();
49
+ setOpen(false);
50
50
  }
51
51
 
52
52
  // 🔧 Convertir strings a fechas sin zona horaria
@@ -69,8 +69,8 @@ export default function MyCalendar({
69
69
  </div>
70
70
  <div>
71
71
  <div
72
- onClick={() => modalRef?.current?.showModal?.()}
73
72
  className="cursor-pointer flex items-center justify-center"
73
+ onClick={(e) => setOpen(true)}
74
74
  >
75
75
  <input
76
76
  {...otherProps}
@@ -91,27 +91,24 @@ export default function MyCalendar({
91
91
  </div>
92
92
  </label>
93
93
 
94
- {visible && (
95
- <dialog
96
- ref={modalRef}
97
- id="my-calendar-modal-item"
98
- onClick={(e) => {
99
- const el = e.target as HTMLElement;
100
- if (el?.id === "my-calendar-modal-item") {
101
- modalRef.current?.close();
102
- }
103
- }}
104
- >
105
- <div className=" w-[300px] flex items-start justify-center h-[300px] p-5">
106
- <DatePicker
107
- inline
108
- selected={selectedDate}
109
- onChange={handleChange}
110
- includeDates={normalizedEnabledDates}
111
- />
112
- </div>
113
- </dialog>
114
- )}
94
+ <Dialog open={open}>
95
+ <div className="flex justify-end p-5 font-bold">
96
+ <button
97
+ className=" border-lg w-[20px] bg-red-500 text-white shadow rounded"
98
+ onClick={(e) => setOpen(false)}
99
+ >
100
+ x
101
+ </button>
102
+ </div>
103
+ <div className=" w-[300px] flex items-start justify-center h-[300px] p-5">
104
+ <DatePicker
105
+ inline
106
+ selected={selectedDate}
107
+ onChange={handleChange}
108
+ includeDates={normalizedEnabledDates}
109
+ />
110
+ </div>
111
+ </Dialog>
115
112
  </div>
116
113
  );
117
114
  }
@@ -96,7 +96,7 @@ function IHTable({
96
96
  }: TableProps) {
97
97
  const [open, setOpen] = useState(false);
98
98
  if (modal) {
99
- buttons = { ...buttons, Modal: <Button icon={<EditIcon />}></Button> };
99
+ buttons = { ...buttons, Modal: "" };
100
100
  }
101
101
  const handleOpen = () => setOpen(true);
102
102
  const handleClose = () => {
@@ -154,8 +154,9 @@ function IHTable({
154
154
  onClick={() => {
155
155
  handleOpen();
156
156
  }}
157
+ icon={<EditIcon />}
157
158
  >
158
- Editar
159
+ {params?.row?.["Modal"]}
159
160
  </Button>
160
161
  ) as any,
161
162
  });