next-recomponents 1.4.2 → 1.4.3

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
@@ -141,4 +141,9 @@ interface Props extends React$1.DetailedHTMLProps<React$1.DialogHTMLAttributes<H
141
141
  }
142
142
  declare function Modal({ button, children, ref }: Props): react_jsx_runtime.JSX.Element;
143
143
 
144
- export { Alert, Button, Container, Form, Input, Modal, Select, Table, TextArea, regularExpresions, useResources };
144
+ type PreProps = {
145
+ data: string;
146
+ };
147
+ declare const Pre: React$1.FC<PreProps>;
148
+
149
+ export { Alert, Button, Container, Form, Input, Modal, Pre, Select, Table, TextArea, regularExpresions, useResources };
package/dist/index.d.ts CHANGED
@@ -141,4 +141,9 @@ interface Props extends React$1.DetailedHTMLProps<React$1.DialogHTMLAttributes<H
141
141
  }
142
142
  declare function Modal({ button, children, ref }: Props): react_jsx_runtime.JSX.Element;
143
143
 
144
- export { Alert, Button, Container, Form, Input, Modal, Select, Table, TextArea, regularExpresions, useResources };
144
+ type PreProps = {
145
+ data: string;
146
+ };
147
+ declare const Pre: React$1.FC<PreProps>;
148
+
149
+ export { Alert, Button, Container, Form, Input, Modal, Pre, Select, Table, TextArea, regularExpresions, useResources };
package/dist/index.js CHANGED
@@ -2974,6 +2974,7 @@ __export(index_exports, {
2974
2974
  Form: () => Form,
2975
2975
  Input: () => Input,
2976
2976
  Modal: () => Modal,
2977
+ Pre: () => pre_default,
2977
2978
  Select: () => Select,
2978
2979
  Table: () => Table,
2979
2980
  TextArea: () => TextArea,
@@ -11184,6 +11185,7 @@ function TD(_a) {
11184
11185
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: (item == null ? void 0 : item.handler) ? import_react23.default.Children.map(item.handler, (handler) => {
11185
11186
  if (import_react23.default.isValidElement(handler)) {
11186
11187
  return import_react23.default.cloneElement(handler, {
11188
+ defaultValue: null,
11187
11189
  value: mapedData[index][item.name].content,
11188
11190
  onChange: (e) => {
11189
11191
  var _a3, _b3;
@@ -32803,6 +32805,35 @@ function Modal({ button, children, ref }) {
32803
32805
  ] }) })
32804
32806
  ] });
32805
32807
  }
32808
+
32809
+ // src/pre/index.tsx
32810
+ var import_jsx_runtime19 = require("react/jsx-runtime");
32811
+ var Pre = ({ data }) => {
32812
+ let formatted = data;
32813
+ try {
32814
+ const parsed = JSON.parse(data);
32815
+ formatted = JSON.stringify(parsed, null, 2);
32816
+ } catch (err) {
32817
+ console.error("Invalid JSON string:", err);
32818
+ }
32819
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
32820
+ "pre",
32821
+ {
32822
+ style: {
32823
+ backgroundColor: "#f4f4f4",
32824
+ padding: "1rem",
32825
+ borderRadius: "8px",
32826
+ whiteSpace: "pre-wrap",
32827
+ // Permite saltos de línea
32828
+ wordBreak: "break-word",
32829
+ // Rompe palabras largas si es necesario
32830
+ fontFamily: "monospace"
32831
+ },
32832
+ children: formatted
32833
+ }
32834
+ );
32835
+ };
32836
+ var pre_default = Pre;
32806
32837
  // Annotate the CommonJS export names for ESM import in node:
32807
32838
  0 && (module.exports = {
32808
32839
  Alert,
@@ -32811,6 +32842,7 @@ function Modal({ button, children, ref }) {
32811
32842
  Form,
32812
32843
  Input,
32813
32844
  Modal,
32845
+ Pre,
32814
32846
  Select,
32815
32847
  Table,
32816
32848
  TextArea,
package/dist/index.mjs CHANGED
@@ -11174,6 +11174,7 @@ function TD(_a) {
11174
11174
  /* @__PURE__ */ jsx8("div", { children: (item == null ? void 0 : item.handler) ? React3.Children.map(item.handler, (handler) => {
11175
11175
  if (React3.isValidElement(handler)) {
11176
11176
  return React3.cloneElement(handler, {
11177
+ defaultValue: null,
11177
11178
  value: mapedData[index][item.name].content,
11178
11179
  onChange: (e) => {
11179
11180
  var _a3, _b3;
@@ -32799,6 +32800,35 @@ function Modal({ button, children, ref }) {
32799
32800
  ] }) })
32800
32801
  ] });
32801
32802
  }
32803
+
32804
+ // src/pre/index.tsx
32805
+ import { jsx as jsx18 } from "react/jsx-runtime";
32806
+ var Pre = ({ data }) => {
32807
+ let formatted = data;
32808
+ try {
32809
+ const parsed = JSON.parse(data);
32810
+ formatted = JSON.stringify(parsed, null, 2);
32811
+ } catch (err) {
32812
+ console.error("Invalid JSON string:", err);
32813
+ }
32814
+ return /* @__PURE__ */ jsx18(
32815
+ "pre",
32816
+ {
32817
+ style: {
32818
+ backgroundColor: "#f4f4f4",
32819
+ padding: "1rem",
32820
+ borderRadius: "8px",
32821
+ whiteSpace: "pre-wrap",
32822
+ // Permite saltos de línea
32823
+ wordBreak: "break-word",
32824
+ // Rompe palabras largas si es necesario
32825
+ fontFamily: "monospace"
32826
+ },
32827
+ children: formatted
32828
+ }
32829
+ );
32830
+ };
32831
+ var pre_default = Pre;
32802
32832
  export {
32803
32833
  Alert,
32804
32834
  Button,
@@ -32806,6 +32836,7 @@ export {
32806
32836
  Form,
32807
32837
  Input,
32808
32838
  Modal,
32839
+ pre_default as Pre,
32809
32840
  Select,
32810
32841
  Table,
32811
32842
  TextArea,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-recomponents",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.tsx CHANGED
@@ -9,3 +9,4 @@ export { default as TextArea } from "./text-area";
9
9
  export { default as useResources } from "./use-resources";
10
10
  export { default as Select } from "./select";
11
11
  export { default as Modal } from "./modal";
12
+ export { default as Pre } from "./pre";
@@ -0,0 +1,33 @@
1
+ import React from "react";
2
+
3
+ type PreProps = {
4
+ data: string;
5
+ };
6
+
7
+ const Pre: React.FC<PreProps> = ({ data }) => {
8
+ let formatted = data;
9
+
10
+ try {
11
+ const parsed = JSON.parse(data);
12
+ formatted = JSON.stringify(parsed, null, 2); // Formatea con indentación
13
+ } catch (err) {
14
+ console.error("Invalid JSON string:", err);
15
+ }
16
+
17
+ return (
18
+ <pre
19
+ style={{
20
+ backgroundColor: "#f4f4f4",
21
+ padding: "1rem",
22
+ borderRadius: "8px",
23
+ whiteSpace: "pre-wrap", // Permite saltos de línea
24
+ wordBreak: "break-word", // Rompe palabras largas si es necesario
25
+ fontFamily: "monospace",
26
+ }}
27
+ >
28
+ {formatted}
29
+ </pre>
30
+ );
31
+ };
32
+
33
+ export default Pre;
package/src/table/td.tsx CHANGED
@@ -78,6 +78,7 @@ export default function TD({
78
78
  ? React.Children.map(item.handler, (handler) => {
79
79
  if (React.isValidElement(handler)) {
80
80
  return React.cloneElement(handler as any, {
81
+ defaultValue: null,
81
82
  value: mapedData[index][item.name].content,
82
83
  onChange: (e: any) => {
83
84
  const nmd = [...mapedData];