@zauru-sdk/components 1.0.69 → 1.0.70

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/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.0.70](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.69...v1.0.70) (2024-05-31)
7
+
8
+ **Note:** Version bump only for package @zauru-sdk/components
9
+
10
+
11
+
12
+
13
+
6
14
  ## [1.0.69](https://github.com/intuitiva/zauru-typescript-sdk/compare/v1.0.68...v1.0.69) (2024-05-30)
7
15
 
8
16
  **Note:** Version bump only for package @zauru-sdk/components
@@ -2,7 +2,7 @@ import React from "react";
2
2
  export type ModalOption = "OK" | "CANCEL" | null;
3
3
  type ModalParams = {
4
4
  title: string;
5
- description: React.ReactNode;
5
+ description: React.ReactNode | (() => React.ReactNode);
6
6
  okButtonText?: string;
7
7
  showOptions?: boolean;
8
8
  };
@@ -28,7 +28,8 @@ const createModal = ({ title, description, okButtonText, showOptions = true, })
28
28
  modalOverlay.classList.add("fixed", "inset-0", "bg-black", "opacity-50", "z-40");
29
29
  document.body.appendChild(modalOverlay);
30
30
  document.body.appendChild(modalWrapper);
31
- const ModalContent = () => ((0, jsx_runtime_1.jsx)("div", { className: "relative w-auto my-6 mx-auto max-w-3xl", children: (0, jsx_runtime_1.jsxs)("div", { className: "border-0 rounded-lg shadow-lg relative flex flex-col w-full bg-white outline-none focus:outline-none", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-start justify-between p-5 border-b border-solid border-slate-200 rounded-t", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-3xl font-semibold", children: title }), (0, jsx_runtime_1.jsx)("button", { className: "p-1 ml-auto bg-transparent border-0 text-black float-right text-3xl leading-none font-semibold outline-none focus:outline-none", children: (0, jsx_runtime_1.jsx)("span", { className: "close-button", onClick: handleClose, children: "\u00D7" }) })] }), (0, jsx_runtime_1.jsx)("div", { className: "relative p-6 flex-auto", children: description }), showOptions && ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-end p-6 border-t border-solid border-slate-200 rounded-b", children: [(0, jsx_runtime_1.jsx)("button", { className: "cancel-button text-red-700 background-transparent font-bold uppercase px-6 py-2 text-sm outline-none focus:outline-none mr-1 mb-1 ease-linear transition-all duration-150", type: "button", onClick: handleCancel, children: "Cancelar" }), (0, jsx_runtime_1.jsx)("button", { className: "ok-button bg-emerald-700 text-white active:bg-emerald-600 font-bold uppercase text-sm px-6 py-3 rounded shadow hover:shadow-lg outline-none focus:outline-none mr-1 mb-1 ease-linear transition-all duration-150", type: "button", onClick: handleOk, children: okButtonText ?? "Aceptar" })] }))] }) }));
31
+ const content = typeof description === "function" ? description() : description;
32
+ const ModalContent = () => ((0, jsx_runtime_1.jsx)("div", { className: "relative w-auto my-6 mx-auto max-w-3xl", children: (0, jsx_runtime_1.jsxs)("div", { className: "border-0 rounded-lg shadow-lg relative flex flex-col w-full bg-white outline-none focus:outline-none", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-start justify-between p-5 border-b border-solid border-slate-200 rounded-t", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-3xl font-semibold", children: title }), (0, jsx_runtime_1.jsx)("button", { className: "p-1 ml-auto bg-transparent border-0 text-black float-right text-3xl leading-none font-semibold outline-none focus:outline-none", children: (0, jsx_runtime_1.jsx)("span", { className: "close-button", onClick: handleClose, children: "\u00D7" }) })] }), (0, jsx_runtime_1.jsx)("div", { className: "relative p-6 flex-auto", children: content }), showOptions && ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-end p-6 border-t border-solid border-slate-200 rounded-b", children: [(0, jsx_runtime_1.jsx)("button", { className: "cancel-button text-red-700 background-transparent font-bold uppercase px-6 py-2 text-sm outline-none focus:outline-none mr-1 mb-1 ease-linear transition-all duration-150", type: "button", onClick: handleCancel, children: "Cancelar" }), (0, jsx_runtime_1.jsx)("button", { className: "ok-button bg-emerald-700 text-white active:bg-emerald-600 font-bold uppercase text-sm px-6 py-3 rounded shadow hover:shadow-lg outline-none focus:outline-none mr-1 mb-1 ease-linear transition-all duration-150", type: "button", onClick: handleOk, children: okButtonText ?? "Aceptar" })] }))] }) }));
32
33
  const root = (0, client_1.createRoot)(modalWrapper);
33
34
  root.render((0, jsx_runtime_1.jsx)(ModalContent, {}));
34
35
  });
@@ -25,7 +25,8 @@ export const createModal = ({ title, description, okButtonText, showOptions = tr
25
25
  modalOverlay.classList.add("fixed", "inset-0", "bg-black", "opacity-50", "z-40");
26
26
  document.body.appendChild(modalOverlay);
27
27
  document.body.appendChild(modalWrapper);
28
- const ModalContent = () => (_jsx("div", { className: "relative w-auto my-6 mx-auto max-w-3xl", children: _jsxs("div", { className: "border-0 rounded-lg shadow-lg relative flex flex-col w-full bg-white outline-none focus:outline-none", children: [_jsxs("div", { className: "flex items-start justify-between p-5 border-b border-solid border-slate-200 rounded-t", children: [_jsx("h3", { className: "text-3xl font-semibold", children: title }), _jsx("button", { className: "p-1 ml-auto bg-transparent border-0 text-black float-right text-3xl leading-none font-semibold outline-none focus:outline-none", children: _jsx("span", { className: "close-button", onClick: handleClose, children: "\u00D7" }) })] }), _jsx("div", { className: "relative p-6 flex-auto", children: description }), showOptions && (_jsxs("div", { className: "flex items-center justify-end p-6 border-t border-solid border-slate-200 rounded-b", children: [_jsx("button", { className: "cancel-button text-red-700 background-transparent font-bold uppercase px-6 py-2 text-sm outline-none focus:outline-none mr-1 mb-1 ease-linear transition-all duration-150", type: "button", onClick: handleCancel, children: "Cancelar" }), _jsx("button", { className: "ok-button bg-emerald-700 text-white active:bg-emerald-600 font-bold uppercase text-sm px-6 py-3 rounded shadow hover:shadow-lg outline-none focus:outline-none mr-1 mb-1 ease-linear transition-all duration-150", type: "button", onClick: handleOk, children: okButtonText ?? "Aceptar" })] }))] }) }));
28
+ const content = typeof description === "function" ? description() : description;
29
+ const ModalContent = () => (_jsx("div", { className: "relative w-auto my-6 mx-auto max-w-3xl", children: _jsxs("div", { className: "border-0 rounded-lg shadow-lg relative flex flex-col w-full bg-white outline-none focus:outline-none", children: [_jsxs("div", { className: "flex items-start justify-between p-5 border-b border-solid border-slate-200 rounded-t", children: [_jsx("h3", { className: "text-3xl font-semibold", children: title }), _jsx("button", { className: "p-1 ml-auto bg-transparent border-0 text-black float-right text-3xl leading-none font-semibold outline-none focus:outline-none", children: _jsx("span", { className: "close-button", onClick: handleClose, children: "\u00D7" }) })] }), _jsx("div", { className: "relative p-6 flex-auto", children: content }), showOptions && (_jsxs("div", { className: "flex items-center justify-end p-6 border-t border-solid border-slate-200 rounded-b", children: [_jsx("button", { className: "cancel-button text-red-700 background-transparent font-bold uppercase px-6 py-2 text-sm outline-none focus:outline-none mr-1 mb-1 ease-linear transition-all duration-150", type: "button", onClick: handleCancel, children: "Cancelar" }), _jsx("button", { className: "ok-button bg-emerald-700 text-white active:bg-emerald-600 font-bold uppercase text-sm px-6 py-3 rounded shadow hover:shadow-lg outline-none focus:outline-none mr-1 mb-1 ease-linear transition-all duration-150", type: "button", onClick: handleOk, children: okButtonText ?? "Aceptar" })] }))] }) }));
29
30
  const root = createRoot(modalWrapper);
30
31
  root.render(_jsx(ModalContent, {}));
31
32
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/components",
3
- "version": "1.0.69",
3
+ "version": "1.0.70",
4
4
  "description": "Componentes reutilizables en las WebApps de Zauru.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -47,5 +47,5 @@
47
47
  "react-select": "^5.8.0",
48
48
  "styled-components": "^5.3.5"
49
49
  },
50
- "gitHead": "46dd382e956e8b34c2a65ef078d8fddb2cdd434c"
50
+ "gitHead": "944b8b4a77016ab83335d4a9710c2f083e1e96f2"
51
51
  }
@@ -5,7 +5,7 @@ export type ModalOption = "OK" | "CANCEL" | null;
5
5
 
6
6
  type ModalParams = {
7
7
  title: string;
8
- description: React.ReactNode;
8
+ description: React.ReactNode | (() => React.ReactNode);
9
9
  okButtonText?: string;
10
10
  showOptions?: boolean;
11
11
  };
@@ -64,6 +64,9 @@ export const createModal = ({
64
64
  document.body.appendChild(modalOverlay);
65
65
  document.body.appendChild(modalWrapper);
66
66
 
67
+ const content =
68
+ typeof description === "function" ? description() : description;
69
+
67
70
  const ModalContent = () => (
68
71
  <div className="relative w-auto my-6 mx-auto max-w-3xl">
69
72
  <div className="border-0 rounded-lg shadow-lg relative flex flex-col w-full bg-white outline-none focus:outline-none">
@@ -75,7 +78,7 @@ export const createModal = ({
75
78
  </span>
76
79
  </button>
77
80
  </div>
78
- <div className="relative p-6 flex-auto">{description}</div>
81
+ <div className="relative p-6 flex-auto">{content}</div>
79
82
  {showOptions && (
80
83
  <div className="flex items-center justify-end p-6 border-t border-solid border-slate-200 rounded-b">
81
84
  <button