@zauru-sdk/components 1.0.52 → 1.0.53
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 +8 -0
- package/dist/Alerts/ErrorBoundaryAlert/ErrorBoundaryAlert.d.ts +6 -0
- package/dist/Alerts/StaticAlert.d.ts +11 -0
- package/dist/Alerts/index.d.ts +2 -0
- package/dist/BlockUI/BlockUI.d.ts +8 -0
- package/dist/BlockUI/index.d.ts +1 -0
- package/dist/Buttons/Button.d.ts +15 -0
- package/dist/Buttons/index.d.ts +1 -0
- package/dist/Card/Card.d.ts +8 -0
- package/dist/Card/index.d.ts +1 -0
- package/dist/Chat/ChatLayout.d.ts +17 -0
- package/dist/Chat/ChatMessageHistory.d.ts +12 -0
- package/dist/Chat/index.d.ts +2 -0
- package/dist/ConnectionState/ConnectionState.d.ts +1 -0
- package/dist/ConnectionState/index.d.ts +1 -0
- package/dist/Containers/BodyContainer.d.ts +6 -0
- package/dist/Containers/ButtonSectionContainer.d.ts +8 -0
- package/dist/Containers/Container.d.ts +10 -0
- package/dist/Containers/DoubleContainer.d.ts +9 -0
- package/dist/Containers/MainContainer.d.ts +6 -0
- package/dist/Containers/OutletContainer.d.ts +6 -0
- package/dist/Containers/SubContainer.d.ts +10 -0
- package/dist/Containers/index.d.ts +7 -0
- package/dist/DynamicTable/BasicPrintDynamicTable.d.ts +10 -0
- package/dist/DynamicTable/DynamicPrintTable.d.ts +23 -0
- package/dist/DynamicTable/DynamicTable.d.ts +24 -0
- package/dist/DynamicTable/GenericDynamicTable.d.ts +21 -0
- package/dist/DynamicTable/index.d.ts +4 -0
- package/dist/Footer/Footer.d.ts +7 -0
- package/dist/Footer/index.d.ts +1 -0
- package/dist/Form/Checkbox/index.d.ts +17 -0
- package/dist/Form/Checklist/index.d.ts +14 -0
- package/dist/Form/DatePicker/index.d.ts +18 -0
- package/dist/Form/DynamicBaculoForm/index.d.ts +18 -0
- package/dist/Form/FieldContainer/DoubleFieldContainer.d.ts +8 -0
- package/dist/Form/FieldContainer/QuadrupleFieldContainer.d.ts +7 -0
- package/dist/Form/FieldContainer/TripleFieldContainer.d.ts +7 -0
- package/dist/Form/FieldContainer/index.d.ts +3 -0
- package/dist/Form/FileUpload/index.d.ts +21 -0
- package/dist/Form/FormButtons/index.d.ts +16 -0
- package/dist/Form/FormLayout/index.d.ts +11 -0
- package/dist/Form/SelectField/index.d.ts +27 -0
- package/dist/Form/TextArea/index.d.ts +23 -0
- package/dist/Form/TextField/index.d.ts +25 -0
- package/dist/Form/TimePicker/index.d.ts +16 -0
- package/dist/Form/YesNo/index.d.ts +12 -0
- package/dist/Form/index.d.ts +13 -0
- package/dist/Labels/InfoLabel/index.d.ts +7 -0
- package/dist/Labels/index.d.ts +1 -0
- package/dist/Layouts/homeLayout/index.d.ts +6 -0
- package/dist/Layouts/index.d.ts +1 -0
- package/dist/LineSeparator/LineSeparator.d.ts +1 -0
- package/dist/LineSeparator/index.d.ts +1 -0
- package/dist/Modal/Modal.d.ts +10 -0
- package/dist/Modal/index.d.ts +1 -0
- package/dist/NavBar/NavBar.d.ts +2 -0
- package/dist/NavBar/NavBar.types.d.ts +50 -0
- package/dist/NavBar/NavBar.utils.d.ts +58 -0
- package/dist/NavBar/index.d.ts +3 -0
- package/dist/ProgressBar/ProgressBar.d.ts +6 -0
- package/dist/ProgressBar/ProgressCircle.d.ts +6 -0
- package/dist/ProgressBar/index.d.ts +2 -0
- package/dist/Skeletons/LoadingInputSkeleton.d.ts +1 -0
- package/dist/Skeletons/index.d.ts +1 -0
- package/dist/Tab/Tab.d.ts +9 -0
- package/dist/Tab/index.d.ts +1 -0
- package/dist/Table/ZauruTable.d.ts +25 -0
- package/dist/Table/index.d.ts +1 -0
- package/dist/TaskList/TaskList.d.ts +14 -0
- package/dist/TaskList/index.d.ts +1 -0
- package/dist/Titles/LabelArray.d.ts +4 -0
- package/dist/Titles/TableColumnTitle.d.ts +4 -0
- package/dist/Titles/TitleH1.d.ts +1 -0
- package/dist/Titles/TitleH2.d.ts +1 -0
- package/dist/Titles/TitleH3.d.ts +1 -0
- package/dist/Titles/index.d.ts +5 -0
- package/dist/Tooltip/Tooltip.d.ts +7 -0
- package/dist/Tooltip/index.d.ts +1 -0
- package/dist/WithTooltip/WithTooltip.d.ts +7 -0
- package/dist/WithTooltip/index.d.ts +1 -0
- package/dist/Wizards/StepWizard.d.ts +14 -0
- package/dist/Wizards/index.d.ts +1 -0
- package/dist/Zendesk/Chat.d.ts +14 -0
- package/dist/Zendesk/index.d.ts +2 -0
- package/dist/Zendesk/zendesk.config.d.ts +9 -0
- package/dist/cjs/Alerts/ErrorBoundaryAlert/ErrorBoundaryAlert.js +9 -0
- package/dist/cjs/Alerts/StaticAlert.js +32 -0
- package/dist/cjs/Alerts/index.js +18 -0
- package/dist/cjs/BlockUI/BlockUI.js +12 -0
- package/dist/cjs/BlockUI/index.js +17 -0
- package/dist/cjs/Buttons/Button.js +47 -0
- package/dist/cjs/Buttons/index.js +17 -0
- package/dist/cjs/Card/Card.js +9 -0
- package/dist/cjs/Card/index.js +17 -0
- package/dist/cjs/Chat/ChatLayout.js +31 -0
- package/dist/cjs/Chat/ChatMessageHistory.js +57 -0
- package/dist/cjs/Chat/index.js +18 -0
- package/dist/cjs/ConnectionState/ConnectionState.js +25 -0
- package/dist/cjs/ConnectionState/index.js +17 -0
- package/dist/cjs/Containers/BodyContainer.js +9 -0
- package/dist/cjs/Containers/ButtonSectionContainer.js +9 -0
- package/dist/cjs/Containers/Container.js +10 -0
- package/dist/cjs/Containers/DoubleContainer.js +18 -0
- package/dist/cjs/Containers/MainContainer.js +9 -0
- package/dist/cjs/Containers/OutletContainer.js +9 -0
- package/dist/cjs/Containers/SubContainer.js +10 -0
- package/dist/cjs/Containers/index.js +23 -0
- package/dist/cjs/DynamicTable/BasicPrintDynamicTable.js +31 -0
- package/dist/cjs/DynamicTable/DynamicPrintTable.js +158 -0
- package/dist/cjs/DynamicTable/DynamicTable.js +219 -0
- package/dist/cjs/DynamicTable/GenericDynamicTable.js +200 -0
- package/dist/cjs/DynamicTable/index.js +20 -0
- package/dist/cjs/Footer/Footer.js +20 -0
- package/dist/cjs/Footer/index.js +17 -0
- package/dist/cjs/Form/Checkbox/index.js +39 -0
- package/dist/cjs/Form/Checklist/index.js +14 -0
- package/dist/cjs/Form/DatePicker/index.js +36 -0
- package/dist/cjs/Form/DynamicBaculoForm/index.js +144 -0
- package/dist/cjs/Form/FieldContainer/DoubleFieldContainer.js +18 -0
- package/dist/cjs/Form/FieldContainer/QuadrupleFieldContainer.js +18 -0
- package/dist/cjs/Form/FieldContainer/TripleFieldContainer.js +18 -0
- package/dist/cjs/Form/FieldContainer/index.js +19 -0
- package/dist/cjs/Form/FileUpload/index.js +59 -0
- package/dist/cjs/Form/FormButtons/index.js +9 -0
- package/dist/cjs/Form/FormLayout/index.js +11 -0
- package/dist/cjs/Form/SelectField/index.js +102 -0
- package/dist/cjs/Form/TextArea/index.js +41 -0
- package/dist/cjs/Form/TextField/index.js +75 -0
- package/dist/cjs/Form/TimePicker/index.js +36 -0
- package/dist/cjs/Form/YesNo/index.js +22 -0
- package/dist/cjs/Form/index.js +29 -0
- package/dist/cjs/Labels/InfoLabel/index.js +9 -0
- package/dist/cjs/Labels/index.js +17 -0
- package/dist/cjs/Layouts/homeLayout/index.js +14 -0
- package/dist/cjs/Layouts/index.js +17 -0
- package/dist/cjs/LineSeparator/LineSeparator.js +8 -0
- package/dist/cjs/LineSeparator/index.js +17 -0
- package/dist/cjs/Modal/Modal.js +36 -0
- package/dist/cjs/Modal/index.js +17 -0
- package/dist/cjs/NavBar/NavBar.js +36 -0
- package/dist/cjs/NavBar/NavBar.types.js +2 -0
- package/dist/cjs/NavBar/NavBar.utils.js +61 -0
- package/dist/cjs/NavBar/index.js +19 -0
- package/dist/cjs/ProgressBar/ProgressBar.js +9 -0
- package/dist/cjs/ProgressBar/ProgressCircle.js +26 -0
- package/dist/cjs/ProgressBar/index.js +18 -0
- package/dist/cjs/Skeletons/LoadingInputSkeleton.js +12 -0
- package/dist/cjs/Skeletons/index.js +17 -0
- package/dist/cjs/Tab/Tab.js +26 -0
- package/dist/cjs/Tab/index.js +17 -0
- package/dist/cjs/Table/ZauruTable.js +177 -0
- package/dist/cjs/Table/index.js +17 -0
- package/dist/cjs/TaskList/TaskList.js +40 -0
- package/dist/cjs/TaskList/index.js +17 -0
- package/dist/cjs/Titles/LabelArray.js +11 -0
- package/dist/cjs/Titles/TableColumnTitle.js +9 -0
- package/dist/cjs/Titles/TitleH1.js +9 -0
- package/dist/cjs/Titles/TitleH2.js +9 -0
- package/dist/cjs/Titles/TitleH3.js +9 -0
- package/dist/cjs/Titles/index.js +21 -0
- package/dist/cjs/Tooltip/Tooltip.js +18 -0
- package/dist/cjs/Tooltip/index.js +17 -0
- package/dist/cjs/WithTooltip/WithTooltip.js +9 -0
- package/dist/cjs/WithTooltip/index.js +17 -0
- package/dist/cjs/Wizards/StepWizard.js +18 -0
- package/dist/cjs/Wizards/index.js +17 -0
- package/dist/cjs/Zendesk/Chat.js +69 -0
- package/dist/cjs/Zendesk/index.js +18 -0
- package/dist/cjs/Zendesk/zendesk.config.js +31 -0
- package/dist/cjs/index.js +40 -0
- package/dist/cjs/tailwind.config.js +9 -0
- package/dist/esm/Alerts/ErrorBoundaryAlert/ErrorBoundaryAlert.js +5 -0
- package/dist/esm/Alerts/StaticAlert.js +28 -0
- package/dist/esm/Alerts/index.js +2 -0
- package/dist/esm/BlockUI/BlockUI.js +8 -0
- package/dist/esm/BlockUI/index.js +1 -0
- package/dist/esm/Buttons/Button.js +43 -0
- package/dist/esm/Buttons/index.js +1 -0
- package/dist/esm/Card/Card.js +5 -0
- package/dist/esm/Card/index.js +1 -0
- package/dist/esm/Chat/ChatLayout.js +27 -0
- package/dist/esm/Chat/ChatMessageHistory.js +53 -0
- package/dist/esm/Chat/index.js +2 -0
- package/dist/esm/ConnectionState/ConnectionState.js +21 -0
- package/dist/esm/ConnectionState/index.js +1 -0
- package/dist/esm/Containers/BodyContainer.js +5 -0
- package/dist/esm/Containers/ButtonSectionContainer.js +5 -0
- package/dist/esm/Containers/Container.js +6 -0
- package/dist/esm/Containers/DoubleContainer.js +14 -0
- package/dist/esm/Containers/MainContainer.js +5 -0
- package/dist/esm/Containers/OutletContainer.js +5 -0
- package/dist/esm/Containers/SubContainer.js +6 -0
- package/dist/esm/Containers/index.js +7 -0
- package/dist/esm/DynamicTable/BasicPrintDynamicTable.js +27 -0
- package/dist/esm/DynamicTable/DynamicPrintTable.js +131 -0
- package/dist/esm/DynamicTable/DynamicTable.js +192 -0
- package/dist/esm/DynamicTable/GenericDynamicTable.js +196 -0
- package/dist/esm/DynamicTable/index.js +4 -0
- package/dist/esm/Footer/Footer.js +16 -0
- package/dist/esm/Footer/index.js +1 -0
- package/dist/esm/Form/Checkbox/index.js +34 -0
- package/dist/esm/Form/Checklist/index.js +10 -0
- package/dist/esm/Form/DatePicker/index.js +31 -0
- package/dist/esm/Form/DynamicBaculoForm/index.js +140 -0
- package/dist/esm/Form/FieldContainer/DoubleFieldContainer.js +14 -0
- package/dist/esm/Form/FieldContainer/QuadrupleFieldContainer.js +14 -0
- package/dist/esm/Form/FieldContainer/TripleFieldContainer.js +14 -0
- package/dist/esm/Form/FieldContainer/index.js +3 -0
- package/dist/esm/Form/FileUpload/index.js +54 -0
- package/dist/esm/Form/FormButtons/index.js +5 -0
- package/dist/esm/Form/FormLayout/index.js +7 -0
- package/dist/esm/Form/SelectField/index.js +74 -0
- package/dist/esm/Form/TextArea/index.js +36 -0
- package/dist/esm/Form/TextField/index.js +70 -0
- package/dist/esm/Form/TimePicker/index.js +31 -0
- package/dist/esm/Form/YesNo/index.js +18 -0
- package/dist/esm/Form/index.js +13 -0
- package/dist/esm/Labels/InfoLabel/index.js +5 -0
- package/dist/esm/Labels/index.js +1 -0
- package/dist/esm/Layouts/homeLayout/index.js +10 -0
- package/dist/esm/Layouts/index.js +1 -0
- package/dist/esm/LineSeparator/LineSeparator.js +4 -0
- package/dist/esm/LineSeparator/index.js +1 -0
- package/dist/esm/Modal/Modal.js +32 -0
- package/dist/esm/Modal/index.js +1 -0
- package/dist/esm/NavBar/NavBar.js +32 -0
- package/dist/esm/NavBar/NavBar.types.js +1 -0
- package/dist/esm/NavBar/NavBar.utils.js +58 -0
- package/dist/esm/NavBar/index.js +3 -0
- package/dist/esm/ProgressBar/ProgressBar.js +5 -0
- package/dist/esm/ProgressBar/ProgressCircle.js +22 -0
- package/dist/esm/ProgressBar/index.js +2 -0
- package/dist/esm/Skeletons/LoadingInputSkeleton.js +8 -0
- package/dist/esm/Skeletons/index.js +1 -0
- package/dist/esm/Tab/Tab.js +19 -0
- package/dist/esm/Tab/index.js +1 -0
- package/dist/esm/Table/ZauruTable.js +150 -0
- package/dist/esm/Table/index.js +1 -0
- package/dist/esm/TaskList/TaskList.js +35 -0
- package/dist/esm/TaskList/index.js +1 -0
- package/dist/esm/Titles/LabelArray.js +7 -0
- package/dist/esm/Titles/TableColumnTitle.js +5 -0
- package/dist/esm/Titles/TitleH1.js +5 -0
- package/dist/esm/Titles/TitleH2.js +5 -0
- package/dist/esm/Titles/TitleH3.js +5 -0
- package/dist/esm/Titles/index.js +5 -0
- package/dist/esm/Tooltip/Tooltip.js +14 -0
- package/dist/esm/Tooltip/index.js +1 -0
- package/dist/esm/WithTooltip/WithTooltip.js +5 -0
- package/dist/esm/WithTooltip/index.js +1 -0
- package/dist/esm/Wizards/StepWizard.js +14 -0
- package/dist/esm/Wizards/index.js +1 -0
- package/dist/esm/Zendesk/Chat.js +63 -0
- package/dist/esm/Zendesk/index.js +2 -0
- package/dist/esm/Zendesk/zendesk.config.js +24 -0
- package/dist/esm/index.js +24 -0
- package/dist/esm/tailwind.config.js +8 -0
- package/dist/index.d.ts +24 -0
- package/dist/tailwind.config.d.ts +1 -0
- package/package.json +4 -3
- package/src/Table/ZauruTable.tsx +4 -2
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FileUploadField = exports.FileUploadFieldWithoutValidation = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const icons_1 = require("@zauru-sdk/icons");
|
|
6
|
+
const redux_1 = require("@zauru-sdk/redux");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const FileUploadFieldWithoutValidation = (props) => {
|
|
9
|
+
const { id, name, title, helpText, hint, onChange, disabled = false, readOnly = false, error, fileTypes = [], showAvailableTypes = false, className, defaultValue = undefined, download = false, } = props;
|
|
10
|
+
const [showTooltip, setShowTooltip] = (0, react_1.useState)(false);
|
|
11
|
+
if (typeof defaultValue == "string") {
|
|
12
|
+
if (download) {
|
|
13
|
+
return ((0, jsx_runtime_1.jsxs)("div", { role: "button", tabIndex: 0, onClick: () => {
|
|
14
|
+
window.open(defaultValue, "_blank");
|
|
15
|
+
}, onKeyDown: (event) => {
|
|
16
|
+
// Permite que el evento se active con la tecla Enter
|
|
17
|
+
if (event.key === "Enter") {
|
|
18
|
+
window.open(defaultValue, "_blank");
|
|
19
|
+
}
|
|
20
|
+
}, children: [title && ((0, jsx_runtime_1.jsx)("label", { htmlFor: name, className: "block mb-1 text-sm font-medium text-gray-700", children: title })), " ", (0, jsx_runtime_1.jsx)(icons_1.DownloadIconSVG, {})] }));
|
|
21
|
+
}
|
|
22
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: `col-span-6 sm:col-span-3 ${className}`, children: [title && ((0, jsx_runtime_1.jsx)("label", { htmlFor: name, className: `block mb-1 text-sm font-medium text-gray-700`, children: title })), " ", (0, jsx_runtime_1.jsx)("div", { role: "button", tabIndex: 0, onClick: () => {
|
|
23
|
+
window.open(defaultValue, "_blank");
|
|
24
|
+
}, onKeyDown: (event) => {
|
|
25
|
+
// Permite que el evento se active con la tecla Enter
|
|
26
|
+
if (event.key === "Enter") {
|
|
27
|
+
window.open(defaultValue, "_blank");
|
|
28
|
+
}
|
|
29
|
+
}, children: (0, jsx_runtime_1.jsx)("img", { src: defaultValue, alt: name, className: `h-48 w-48 inline mr-1 pb-1`, style: {
|
|
30
|
+
stroke: "currentColor",
|
|
31
|
+
strokeWidth: 2,
|
|
32
|
+
strokeLinecap: "round",
|
|
33
|
+
strokeLinejoin: "round",
|
|
34
|
+
fill: "none",
|
|
35
|
+
backgroundColor: "transparent",
|
|
36
|
+
} }) })] }));
|
|
37
|
+
}
|
|
38
|
+
const handleInputChange = (event) => {
|
|
39
|
+
onChange && onChange(event);
|
|
40
|
+
};
|
|
41
|
+
let hintMessage = hint;
|
|
42
|
+
if (showAvailableTypes && fileTypes.length > 0) {
|
|
43
|
+
hintMessage = `${hint} Archivos permitidos: ${fileTypes.join(", ")}`;
|
|
44
|
+
}
|
|
45
|
+
const color = error ? "red" : "gray";
|
|
46
|
+
const isReadOnly = disabled || readOnly;
|
|
47
|
+
const bgColor = isReadOnly ? "bg-gray-200" : `bg-${color}-50`;
|
|
48
|
+
const textColor = isReadOnly ? "text-gray-500" : `text-${color}-900`;
|
|
49
|
+
const borderColor = isReadOnly ? "border-gray-300" : `border-${color}-500`;
|
|
50
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: `col-span-6 sm:col-span-3 ${className}`, children: [title && ((0, jsx_runtime_1.jsx)("label", { htmlFor: name, className: `block mb-1 text-sm font-medium text-${color}-700`, children: title })), (0, jsx_runtime_1.jsxs)("div", { className: "flex relative items-center", children: [(0, jsx_runtime_1.jsx)("input", { type: "file", name: name, id: id ?? name, disabled: disabled, readOnly: readOnly, accept: fileTypes.map((ft) => `.${ft}`).join(", "), onChange: handleInputChange, className: `block w-full rounded-md ${bgColor} ${borderColor} ${textColor} shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm` }), helpText && ((0, jsx_runtime_1.jsx)("div", { className: "flex items-center relative ml-3", children: (0, jsx_runtime_1.jsxs)("div", { className: "relative cursor-pointer", onMouseEnter: () => setShowTooltip(true), onMouseLeave: () => setShowTooltip(false), children: [(0, jsx_runtime_1.jsx)(icons_1.IdeaIconSVG, {}), showTooltip && ((0, jsx_runtime_1.jsx)("div", { className: "absolute -left-48 top-0 mt-8 p-2 bg-white border rounded shadow text-black z-50", children: helpText }))] }) }))] }), error && ((0, jsx_runtime_1.jsxs)("p", { className: `mt-2 text-sm text-${color}-600`, children: [(0, jsx_runtime_1.jsx)("span", { className: "font-medium", children: "Oops!" }), " ", error] })), !error && hintMessage && ((0, jsx_runtime_1.jsx)("p", { className: `mt-2 italic text-sm text-${color}-500`, children: hintMessage }))] }));
|
|
51
|
+
};
|
|
52
|
+
exports.FileUploadFieldWithoutValidation = FileUploadFieldWithoutValidation;
|
|
53
|
+
const FileUploadField = (props) => {
|
|
54
|
+
const { formValidations } = (0, redux_1.useAppSelector)((state) => state.formValidation);
|
|
55
|
+
const error = formValidations[props.formName ?? "-1"]?.[props.name ?? "-1"];
|
|
56
|
+
props = { ...props, error };
|
|
57
|
+
return (0, jsx_runtime_1.jsx)(exports.FileUploadFieldWithoutValidation, { ...props });
|
|
58
|
+
};
|
|
59
|
+
exports.FileUploadField = FileUploadField;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormButtons = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const FormButtons = (props) => {
|
|
6
|
+
const { saveTitle = "Guardar", saveName = "save", cancelTitle = "Cancelar", cancelName = "cancel", showCancel = true, showClear = false, clearName = "clear", clearTitle = "Limpiar", loading = false, onClickSave, loadingSaveText = "Guardando...", } = props;
|
|
7
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [showClear && ((0, jsx_runtime_1.jsx)("button", { type: "reset", name: "action", disabled: loading, value: clearName, className: `ml-5 ${loading ? " bg-opacity-25 cursor-progress" : ""} rounded-md border border-gray-300 bg-white py-2 px-3 text-sm font-medium leading-4 text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2`, children: clearTitle })), showCancel && ((0, jsx_runtime_1.jsx)("button", { type: "button", name: "action", disabled: loading, value: cancelName, className: `${showClear ? "ml-2" : "ml-5"} ${loading ? " bg-opacity-25 cursor-progress" : ""} rounded-md border border-gray-300 bg-white py-2 px-3 text-sm font-medium leading-4 text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2`, children: cancelTitle })), (0, jsx_runtime_1.jsx)("button", { type: "submit", name: "action", disabled: loading, value: saveName, onClick: onClickSave, className: `ml-2 ${loading ? " bg-opacity-25 cursor-progress" : "hover:bg-indigo-700"} inline-flex justify-center rounded-md border border-transparent bg-indigo-600 py-2 px-4 text-sm font-medium text-white shadow-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2`, children: loading ? loadingSaveText : saveTitle })] }));
|
|
8
|
+
};
|
|
9
|
+
exports.FormButtons = FormButtons;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormLayout = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("@remix-run/react");
|
|
6
|
+
const index_js_1 = require("../../Containers/index.js");
|
|
7
|
+
const FormLayout = (props) => {
|
|
8
|
+
const { title, children, buttons, method, formId } = props;
|
|
9
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.Form, { id: formId, name: formId, method: method ?? "post", children: [title && ((0, jsx_runtime_1.jsx)("label", { className: "block text-sm font-medium text-gray-700 mb-3", children: title })), (0, jsx_runtime_1.jsxs)("div", { className: "shadow sm:overflow-hidden sm:rounded-md", children: [(0, jsx_runtime_1.jsx)("div", { className: "space-y-6 bg-white px-4 py-5 sm:p-6", children: children }), buttons && ((0, jsx_runtime_1.jsx)(index_js_1.ButtonSectionContainer, { children: buttons }))] })] }, formId));
|
|
10
|
+
};
|
|
11
|
+
exports.FormLayout = FormLayout;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.SelectField = exports.SelectFieldWithoutValidation = void 0;
|
|
27
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
|
+
const icons_1 = require("@zauru-sdk/icons");
|
|
29
|
+
const redux_1 = require("@zauru-sdk/redux");
|
|
30
|
+
const react_1 = require("react");
|
|
31
|
+
const react_select_1 = __importStar(require("react-select"));
|
|
32
|
+
const index_js_1 = require("../../Skeletons/index.js");
|
|
33
|
+
const Input = (props) => ((0, jsx_runtime_1.jsx)(react_select_1.components.Input, { ...props, readOnly: props.selectProps.isReadOnly }));
|
|
34
|
+
const SelectFieldWithoutValidation = (props) => {
|
|
35
|
+
const { id, name, title, defaultValue, defaultValueMulti = [], helpText, hint, options, onChange, onChangeMulti, isClearable = false, error = false, disabled = false, readOnly = false, isMulti = false, loading = false, className = "", onInputChange, } = props;
|
|
36
|
+
const [value, setValue] = (0, react_1.useState)(defaultValue || null);
|
|
37
|
+
const [valueMulti, setValueMulti] = (0, react_1.useState)(defaultValueMulti);
|
|
38
|
+
const [inputValue, setInputValue] = (0, react_1.useState)("");
|
|
39
|
+
const [showTooltip, setShowTooltip] = (0, react_1.useState)(false);
|
|
40
|
+
const [isClient, setIsClient] = (0, react_1.useState)(typeof window !== "undefined");
|
|
41
|
+
const menuIsOpen = readOnly ? false : props?.menuIsOpen;
|
|
42
|
+
const color = error ? "red" : "gray";
|
|
43
|
+
let documentRef = null;
|
|
44
|
+
const isReadOnly = disabled || readOnly;
|
|
45
|
+
const bgColor = isReadOnly ? "bg-gray-200" : `bg-${color}-50`;
|
|
46
|
+
const textColor = isReadOnly ? "text-gray-500" : `text-${color}-900`;
|
|
47
|
+
const borderColor = isReadOnly ? "border-gray-300" : `border-${color}-500`;
|
|
48
|
+
if (typeof window !== "undefined") {
|
|
49
|
+
documentRef = document;
|
|
50
|
+
}
|
|
51
|
+
(0, react_1.useEffect)(() => {
|
|
52
|
+
setValue(defaultValue || null);
|
|
53
|
+
}, [defaultValue]);
|
|
54
|
+
(0, react_1.useEffect)(() => {
|
|
55
|
+
setIsClient(true);
|
|
56
|
+
}, []);
|
|
57
|
+
if (!isClient || loading || !documentRef) {
|
|
58
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [title && ((0, jsx_runtime_1.jsx)("label", { htmlFor: error ? `${name}-error` : `${name}-success`, className: `block text-sm font-medium text-${color}-700 dark:text-${color}-500`, children: title })), (0, jsx_runtime_1.jsx)(index_js_1.LoadingInputSkeleton, {}), helpText && ((0, jsx_runtime_1.jsx)("p", { className: `mt-2 italic text-sm text-${color}-500 dark:text-${color}-400`, children: helpText }))] }));
|
|
59
|
+
}
|
|
60
|
+
const handleOnChange = (selection) => {
|
|
61
|
+
// Verificar si el valor de selección es un objeto con propiedades 'value' y 'label'
|
|
62
|
+
if (typeof selection === "object" &&
|
|
63
|
+
selection !== null &&
|
|
64
|
+
"value" in selection &&
|
|
65
|
+
"label" in selection) {
|
|
66
|
+
setValue(selection);
|
|
67
|
+
onChange && onChange(selection);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
setValue(null);
|
|
71
|
+
onChange && onChange(null);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const handleOnChangeMulti = (selection) => {
|
|
75
|
+
if (Array.isArray(selection)) {
|
|
76
|
+
setValueMulti(selection);
|
|
77
|
+
onChangeMulti &&
|
|
78
|
+
onChangeMulti(selection);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
setValueMulti([]);
|
|
82
|
+
onChangeMulti && onChangeMulti([]);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
const selectComponent = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_select_1.default, { className: `block w-full rounded-md ${bgColor} ${borderColor} ${textColor} shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm`, id: isMulti ? undefined : id, instanceId: isMulti ? undefined : id, isDisabled: disabled, name: isMulti ? undefined : name, options: options, onChange: isMulti ? handleOnChangeMulti : handleOnChange, defaultValue: isMulti ? valueMulti : value, onInputChange: (newValue, actionMeta) => {
|
|
86
|
+
setInputValue(newValue);
|
|
87
|
+
onInputChange && onInputChange(newValue, actionMeta);
|
|
88
|
+
}, inputValue: inputValue, onMenuOpen: () => { }, onMenuClose: () => { }, menuPortalTarget: documentRef?.body, styles: { menuPortal: (base) => ({ ...base, zIndex: 9999 }) }, isClearable: isClearable, isSearchable: true, components: { Input }, menuIsOpen: menuIsOpen,
|
|
89
|
+
//windowThreshold={50}
|
|
90
|
+
isMulti: isMulti }), isMulti && ((0, jsx_runtime_1.jsx)("input", { hidden: true, readOnly: true, name: name, value: valueMulti.map((x) => x?.value).join(","), id: id }))] }));
|
|
91
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: `col-span-6 sm:col-span-3 ${className}`, children: [title && ((0, jsx_runtime_1.jsx)("label", { htmlFor: error ? `${name}-error` : `${name}-success`, className: `block text-sm font-medium ${color === "red"
|
|
92
|
+
? "text-red-700 dark:text-red-500"
|
|
93
|
+
: "text-gray-700 dark:text-gray-500"}`, children: title })), (0, jsx_runtime_1.jsxs)("div", { className: "flex relative items-center", children: [selectComponent, helpText && ((0, jsx_runtime_1.jsx)("div", { className: "flex items-center relative ml-3", children: (0, jsx_runtime_1.jsxs)("div", { className: "relative cursor-pointer", onMouseEnter: () => setShowTooltip(true), onMouseLeave: () => setShowTooltip(false), children: [(0, jsx_runtime_1.jsx)(icons_1.IdeaIconSVG, {}), showTooltip && ((0, jsx_runtime_1.jsx)("div", { className: "absolute -left-48 top-0 mt-8 p-2 bg-white border rounded shadow text-black z-50", children: helpText }))] }) }))] }), error && ((0, jsx_runtime_1.jsxs)("p", { className: `mt-2 text-sm text-${color}-600 dark:text-${color}-500`, children: [(0, jsx_runtime_1.jsx)("span", { className: "font-medium", children: "Oops!" }), " ", error] })), !error && hint && ((0, jsx_runtime_1.jsx)("p", { className: `mt-2 italic text-sm text-${color}-500 dark:text-${color}-400`, children: hint }))] }));
|
|
94
|
+
};
|
|
95
|
+
exports.SelectFieldWithoutValidation = SelectFieldWithoutValidation;
|
|
96
|
+
const SelectField = (props) => {
|
|
97
|
+
const { formValidations } = (0, redux_1.useAppSelector)((state) => state.formValidation);
|
|
98
|
+
const error = formValidations[props.formName ?? "-1"]?.[props.name ?? "-1"];
|
|
99
|
+
props = { ...props, error };
|
|
100
|
+
return (0, jsx_runtime_1.jsx)(exports.SelectFieldWithoutValidation, { ...props });
|
|
101
|
+
};
|
|
102
|
+
exports.SelectField = SelectField;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextArea = exports.TextAreaWithoutValidation = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const redux_1 = require("@zauru-sdk/redux");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const TextAreaWithoutValidation = (props) => {
|
|
8
|
+
const { id, name, title, defaultValue = "", hidden, hint, onChange, onKeyDown, disabled = false, error = false, readOnly = false, rows, cols, stopChangeEvents, className = "", } = props;
|
|
9
|
+
const [value, setValue] = (0, react_1.useState)(defaultValue);
|
|
10
|
+
const color = error ? "red" : "gray";
|
|
11
|
+
const isReadOnly = disabled || readOnly;
|
|
12
|
+
const bgColor = isReadOnly ? "bg-gray-200" : `bg-${color}-50`;
|
|
13
|
+
const textColor = isReadOnly ? "text-gray-500" : `text-${color}-900`;
|
|
14
|
+
const borderColor = isReadOnly ? "border-gray-300" : `border-${color}-500`;
|
|
15
|
+
(0, react_1.useEffect)(() => {
|
|
16
|
+
setValue(defaultValue);
|
|
17
|
+
}, [defaultValue]);
|
|
18
|
+
if (hidden) {
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)("textarea", { id: id ?? name, name: name, value: defaultValue, readOnly: true, hidden: true }));
|
|
20
|
+
}
|
|
21
|
+
const handleInputChange = (event) => {
|
|
22
|
+
if (stopChangeEvents) {
|
|
23
|
+
event.stopPropagation();
|
|
24
|
+
event.preventDefault();
|
|
25
|
+
}
|
|
26
|
+
setValue(event.target.value);
|
|
27
|
+
onChange && onChange(event.target.value);
|
|
28
|
+
};
|
|
29
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: `col-span-6 sm:col-span-3 ${className}`, children: [title && ((0, jsx_runtime_1.jsx)("label", { htmlFor: error ? `${name}-error` : `${name}-success`, className: `block text-sm font-medium text-${color}-700 dark:text-${color}-500`, children: title })), (0, jsx_runtime_1.jsx)("textarea", { name: name, readOnly: readOnly, disabled: disabled, id: id ?? name, autoComplete: "given-name", value: value, rows: rows, cols: cols, onChange: handleInputChange, onKeyDown: (event) => {
|
|
30
|
+
onKeyDown && onKeyDown(event);
|
|
31
|
+
}, className: `mt-1 block w-full rounded-md ${bgColor} ${borderColor} ${textColor} shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm` }), error && ((0, jsx_runtime_1.jsxs)("p", { className: `mt-2 text-sm text-${color}-600 dark:text-${color}-500`, children: [(0, jsx_runtime_1.jsx)("span", { className: "font-medium", children: "Oops!" }), " ", error] })), !error && hint && ((0, jsx_runtime_1.jsx)("p", { className: `mt-2 italic text-sm text-${color}-500 dark:text-${color}-400`, children: hint }))] }));
|
|
32
|
+
};
|
|
33
|
+
exports.TextAreaWithoutValidation = TextAreaWithoutValidation;
|
|
34
|
+
//<reference> https://tailwindui.com/components/application-ui/forms/form-layouts
|
|
35
|
+
const TextArea = (props) => {
|
|
36
|
+
const { formValidations } = (0, redux_1.useAppSelector)((state) => state.formValidation);
|
|
37
|
+
const error = formValidations[props.formName ?? "-1"]?.[props.name ?? "-1"];
|
|
38
|
+
props = { ...props, error };
|
|
39
|
+
return (0, jsx_runtime_1.jsx)(exports.TextAreaWithoutValidation, { ...props });
|
|
40
|
+
};
|
|
41
|
+
exports.TextArea = TextArea;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextField = exports.TextFieldWithoutValidation = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const icons_1 = require("@zauru-sdk/icons");
|
|
6
|
+
const redux_1 = require("@zauru-sdk/redux");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const TextFieldWithoutValidation = (props) => {
|
|
9
|
+
const { id, name, defaultValue = "", hidden, type = "text", onChange, onKeyDown, disabled = false, readOnly = false, min, integer = false, stopChangeEvents, style, error, title, helpText, className, hint, } = props;
|
|
10
|
+
const [showTooltip, setShowTooltip] = (0, react_1.useState)(false);
|
|
11
|
+
const [value, setValue] = (0, react_1.useState)(defaultValue);
|
|
12
|
+
const color = error ? "red" : "gray";
|
|
13
|
+
const isReadOnly = disabled || readOnly;
|
|
14
|
+
const bgColor = isReadOnly ? "bg-gray-200" : `bg-${color}-50`;
|
|
15
|
+
const textColor = isReadOnly ? "text-gray-500" : `text-${color}-900`;
|
|
16
|
+
const borderColor = isReadOnly ? "border-gray-300" : `border-${color}-500`;
|
|
17
|
+
(0, react_1.useEffect)(() => {
|
|
18
|
+
setValue(defaultValue);
|
|
19
|
+
}, [defaultValue]);
|
|
20
|
+
if (hidden) {
|
|
21
|
+
return ((0, jsx_runtime_1.jsx)("input", { type: type, id: id ?? name, name: name, value: defaultValue, readOnly: true, hidden: true }));
|
|
22
|
+
}
|
|
23
|
+
const handleInputChange = (event) => {
|
|
24
|
+
if (stopChangeEvents) {
|
|
25
|
+
event.stopPropagation();
|
|
26
|
+
event.preventDefault();
|
|
27
|
+
}
|
|
28
|
+
if (integer && type === "number") {
|
|
29
|
+
const value = event.target.value;
|
|
30
|
+
const isInteger = /^[0-9]*$/.test(value);
|
|
31
|
+
if (isInteger || value === "") {
|
|
32
|
+
setValue(value);
|
|
33
|
+
onChange && onChange(value, event);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
setValue(event.target.value);
|
|
38
|
+
onChange && onChange(event.target.value, event);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const handleKeyDown = (event) => {
|
|
42
|
+
if (integer && type === "number") {
|
|
43
|
+
// Permitir solo números y teclas de control
|
|
44
|
+
const allowedKeys = [
|
|
45
|
+
"Backspace",
|
|
46
|
+
"ArrowLeft",
|
|
47
|
+
"ArrowRight",
|
|
48
|
+
"Delete",
|
|
49
|
+
"Enter",
|
|
50
|
+
"Tab",
|
|
51
|
+
];
|
|
52
|
+
if (!allowedKeys.includes(event.key) && !/^[0-9]$/.test(event.key)) {
|
|
53
|
+
event.preventDefault();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const inputComponent = ((0, jsx_runtime_1.jsx)("input", { type: type, name: name, readOnly: readOnly, disabled: disabled, id: id ?? name, autoComplete: "given-name", value: value, onWheel: (e) => {
|
|
58
|
+
e.currentTarget.blur();
|
|
59
|
+
}, step: type === "number" ? 0.01 : undefined, onChange: handleInputChange, onKeyDown: (event) => {
|
|
60
|
+
handleKeyDown(event);
|
|
61
|
+
onKeyDown && onKeyDown(event);
|
|
62
|
+
}, min: min, style: style, className: `block w-full rounded-md ${bgColor} ${borderColor} ${textColor} shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm` }));
|
|
63
|
+
if (!error && !title) {
|
|
64
|
+
return (0, jsx_runtime_1.jsx)("div", { className: `${className}`, children: inputComponent });
|
|
65
|
+
}
|
|
66
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: `col-span-6 sm:col-span-3 ${className}`, children: [title && ((0, jsx_runtime_1.jsx)("label", { htmlFor: error ? `${name}-error` : `${name}-success`, className: `block mb-1 text-sm font-medium text-${color}-700 dark:text-${color}-500`, children: title })), (0, jsx_runtime_1.jsxs)("div", { className: "flex relative items-center", children: [inputComponent, helpText && ((0, jsx_runtime_1.jsx)("div", { className: "flex items-center relative ml-3", children: (0, jsx_runtime_1.jsxs)("div", { className: "relative cursor-pointer", onMouseEnter: () => setShowTooltip(true), onMouseLeave: () => setShowTooltip(false), children: [(0, jsx_runtime_1.jsx)(icons_1.IdeaIconSVG, {}), showTooltip && ((0, jsx_runtime_1.jsx)("div", { className: "absolute -left-48 top-0 mt-8 p-2 bg-white border rounded shadow text-black z-50", children: helpText }))] }) }))] }), error && ((0, jsx_runtime_1.jsxs)("p", { className: `mt-2 text-sm text-${color}-600 dark:text-${color}-500`, children: [(0, jsx_runtime_1.jsx)("span", { className: "font-medium", children: "Oops!" }), " ", error] })), !error && hint && ((0, jsx_runtime_1.jsx)("p", { className: `mt-2 italic text-sm text-${color}-500 dark:text-${color}-400`, children: hint }))] }));
|
|
67
|
+
};
|
|
68
|
+
exports.TextFieldWithoutValidation = TextFieldWithoutValidation;
|
|
69
|
+
const TextField = (props) => {
|
|
70
|
+
const { formValidations } = (0, redux_1.useAppSelector)((state) => state.formValidation);
|
|
71
|
+
const error = formValidations[props.formName ?? "-1"]?.[props.name ?? "-1"];
|
|
72
|
+
props = { ...props, error };
|
|
73
|
+
return (0, jsx_runtime_1.jsx)(exports.TextFieldWithoutValidation, { ...props });
|
|
74
|
+
};
|
|
75
|
+
exports.TextField = TextField;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormTimePicker = exports.FormTimePickerWithoutValidation = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const icons_1 = require("@zauru-sdk/icons");
|
|
6
|
+
const redux_1 = require("@zauru-sdk/redux");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const FormTimePickerWithoutValidation = (props) => {
|
|
9
|
+
const { id, name, title, defaultValue = "", hint, helpText, onChange, tabIndex, error, disabled = false, } = props;
|
|
10
|
+
const [value, setValue] = (0, react_1.useState)(defaultValue);
|
|
11
|
+
const [showTooltip, setShowTooltip] = (0, react_1.useState)(false);
|
|
12
|
+
const color = error ? "red" : "gray";
|
|
13
|
+
const isReadOnly = disabled;
|
|
14
|
+
const bgColor = isReadOnly ? "bg-gray-200" : `bg-${color}-50`;
|
|
15
|
+
const textColor = isReadOnly ? "text-gray-500" : `text-${color}-500`;
|
|
16
|
+
const borderColor = isReadOnly ? "border-gray-300" : `border-${color}-200`;
|
|
17
|
+
(0, react_1.useEffect)(() => {
|
|
18
|
+
setValue(defaultValue);
|
|
19
|
+
}, [defaultValue]);
|
|
20
|
+
const clearValue = () => {
|
|
21
|
+
setValue("");
|
|
22
|
+
onChange && onChange("");
|
|
23
|
+
};
|
|
24
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [title && ((0, jsx_runtime_1.jsx)("label", { htmlFor: error ? `${name}-error` : `${name}-success`, className: `block text-sm font-medium ${textColor}`, children: title })), (0, jsx_runtime_1.jsxs)("div", { className: "flex relative items-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "absolute left-0 flex items-center pl-3 pointer-events-none", children: (0, jsx_runtime_1.jsx)(icons_1.ClockIconSVG, {}) }), (0, jsx_runtime_1.jsx)("input", { id: id, name: name, tabIndex: tabIndex, type: "time", onChange: (e) => {
|
|
25
|
+
setValue(e.target.value);
|
|
26
|
+
onChange && onChange(e.target.value);
|
|
27
|
+
}, value: value, pattern: "\\d{2}:\\d{2}", className: `${bgColor} ${borderColor} ${textColor} text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full pl-10 p-2.5` }), value && ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: clearValue, className: "absolute right-0 mr-10", children: (0, jsx_runtime_1.jsx)(icons_1.CloseSvgIcon, {}) })), helpText && ((0, jsx_runtime_1.jsx)("div", { className: "flex items-center relative ml-3", children: (0, jsx_runtime_1.jsxs)("div", { className: "relative cursor-pointer", onMouseEnter: () => setShowTooltip(true), onMouseLeave: () => setShowTooltip(false), children: [(0, jsx_runtime_1.jsx)(icons_1.IdeaIconSVG, {}), showTooltip && ((0, jsx_runtime_1.jsx)("div", { className: "absolute -left-48 top-0 mt-8 p-2 bg-white border rounded shadow text-black", children: helpText }))] }) }))] }), error && ((0, jsx_runtime_1.jsxs)("p", { className: `mt-2 text-sm text-${color}-600 dark:text-${color}-500`, children: [(0, jsx_runtime_1.jsx)("span", { className: "font-medium", children: "Oops!" }), " ", error] })), !error && hint && ((0, jsx_runtime_1.jsx)("p", { className: `mt-2 italic text-sm text-${color}-500 dark:text-${color}-400`, children: hint }))] }));
|
|
28
|
+
};
|
|
29
|
+
exports.FormTimePickerWithoutValidation = FormTimePickerWithoutValidation;
|
|
30
|
+
const FormTimePicker = (props) => {
|
|
31
|
+
const { formValidations } = (0, redux_1.useAppSelector)((state) => state.formValidation);
|
|
32
|
+
const error = formValidations[props.formName ?? "-1"]?.[props.name ?? "-1"];
|
|
33
|
+
props = { ...props, error };
|
|
34
|
+
return (0, jsx_runtime_1.jsx)(exports.FormTimePickerWithoutValidation, { ...props });
|
|
35
|
+
};
|
|
36
|
+
exports.FormTimePicker = FormTimePicker;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.YesNo = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const redux_1 = require("@zauru-sdk/redux");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const YesNo = (props) => {
|
|
8
|
+
const { id, name, title, defaultValue = false, helpText, onChange, disabled, } = props;
|
|
9
|
+
const { formValidations } = (0, redux_1.useAppSelector)((state) => state.formValidation);
|
|
10
|
+
const error = formValidations[props.formName ?? "-1"]?.[props.name ?? "-1"];
|
|
11
|
+
const [value, setValue] = (0, react_1.useState)(defaultValue);
|
|
12
|
+
const color = error ? "red" : "gray";
|
|
13
|
+
const handleOnChange = () => {
|
|
14
|
+
if (disabled)
|
|
15
|
+
return; // No hacer nada si está deshabilitado
|
|
16
|
+
const newValue = !value;
|
|
17
|
+
setValue(newValue);
|
|
18
|
+
onChange && onChange(newValue);
|
|
19
|
+
};
|
|
20
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("label", { className: `relative inline-flex items-center cursor-pointer ${disabled ? "opacity-50" : ""}`, children: [(0, jsx_runtime_1.jsx)("input", { type: "checkbox", id: id ?? name, name: name, checked: value, value: value.toString(), className: "sr-only peer", onChange: handleOnChange, disabled: disabled }), value.toString() === "false" && ((0, jsx_runtime_1.jsx)("input", { type: "hidden", name: name, value: "false" })), (0, jsx_runtime_1.jsx)("div", { className: "w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600" }), (0, jsx_runtime_1.jsx)("span", { className: "ml-3 text-sm font-medium text-gray-900", children: title })] }), error && ((0, jsx_runtime_1.jsxs)("p", { className: `mt-2 text-sm text-${color}-600 dark:text-${color}-500`, children: [(0, jsx_runtime_1.jsx)("span", { className: "font-medium", children: "Oops!" }), " ", error] })), !error && helpText && ((0, jsx_runtime_1.jsx)("p", { className: `mt-2 italic text-sm text-${color}-500 dark:text-${color}-400`, children: helpText }))] }));
|
|
21
|
+
};
|
|
22
|
+
exports.YesNo = YesNo;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Checkbox/index.js"), exports);
|
|
18
|
+
__exportStar(require("./Checklist/index.js"), exports);
|
|
19
|
+
__exportStar(require("./DatePicker/index.js"), exports);
|
|
20
|
+
__exportStar(require("./DynamicBaculoForm/index.js"), exports);
|
|
21
|
+
__exportStar(require("./FieldContainer/index.js"), exports);
|
|
22
|
+
__exportStar(require("./FileUpload/index.js"), exports);
|
|
23
|
+
__exportStar(require("./FormButtons/index.js"), exports);
|
|
24
|
+
__exportStar(require("./FormLayout/index.js"), exports);
|
|
25
|
+
__exportStar(require("./SelectField/index.js"), exports);
|
|
26
|
+
__exportStar(require("./TextArea/index.js"), exports);
|
|
27
|
+
__exportStar(require("./TextField/index.js"), exports);
|
|
28
|
+
__exportStar(require("./TimePicker/index.js"), exports);
|
|
29
|
+
__exportStar(require("./YesNo/index.js"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InfoLabel = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const InfoLabel = (props) => {
|
|
6
|
+
const { description, title, className } = props;
|
|
7
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: `block ${className}`, children: [(0, jsx_runtime_1.jsx)("label", { className: "inline text-sm font-medium text-gray-700", children: `${title.toUpperCase()} ` }), (0, jsx_runtime_1.jsx)("label", { className: "inline text-sm font-medium text-gray-500", children: description })] }));
|
|
8
|
+
};
|
|
9
|
+
exports.InfoLabel = InfoLabel;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./InfoLabel/index.js"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HomeLayout = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const HomeLayout = ({ title, description }) => {
|
|
6
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "bg-cover bg-center h-screen", style: { backgroundImage: 'url("/wallpaper.webp")' }, children: (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col h-screen justify-center items-center", children: [(0, jsx_runtime_1.jsx)("h1", { className: "text-6xl md:text-7xl lg:text-8xl text-white font-bold mb-6 text-center", style: {
|
|
7
|
+
textShadow: "0.5px 0.5px 1px #000000",
|
|
8
|
+
WebkitTextStroke: "2px #000000",
|
|
9
|
+
}, children: title ?? (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "Bienvenido, inicie sesi\u00F3n para continuar." }) }), (0, jsx_runtime_1.jsx)("p", { className: "text-xl md:text-2xl lg:text-3xl text-white text-center max-w-md mb-12", style: {
|
|
10
|
+
textShadow: "0.5px 0.5px 1px #000000",
|
|
11
|
+
WebkitTextStroke: "1px #000000",
|
|
12
|
+
}, children: description ?? (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "Web app, realizada en Zauru." }) })] }) }));
|
|
13
|
+
};
|
|
14
|
+
exports.HomeLayout = HomeLayout;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./homeLayout/index.js"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LineSeparator = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const LineSeparator = () => {
|
|
6
|
+
return (0, jsx_runtime_1.jsx)("hr", { className: "h-px my-8 bg-gray-200 border-0 dark:bg-gray-400" });
|
|
7
|
+
};
|
|
8
|
+
exports.LineSeparator = LineSeparator;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./LineSeparator.js"), exports);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createModal = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const client_1 = require("react-dom/client");
|
|
6
|
+
const createModal = ({ title, description, okButtonText, showOptions = true, }) => {
|
|
7
|
+
return new Promise((resolve) => {
|
|
8
|
+
const handleClose = () => {
|
|
9
|
+
resolve(null);
|
|
10
|
+
removeModal();
|
|
11
|
+
};
|
|
12
|
+
const handleOk = () => {
|
|
13
|
+
resolve("OK");
|
|
14
|
+
removeModal();
|
|
15
|
+
};
|
|
16
|
+
const handleCancel = () => {
|
|
17
|
+
resolve("CANCEL");
|
|
18
|
+
removeModal();
|
|
19
|
+
};
|
|
20
|
+
const removeModal = () => {
|
|
21
|
+
document.body.removeChild(modalWrapper);
|
|
22
|
+
document.body.removeChild(modalOverlay);
|
|
23
|
+
};
|
|
24
|
+
const modalWrapper = document.createElement("div");
|
|
25
|
+
modalWrapper.classList.add("justify-center", "items-center", "flex", "overflow-x-hidden", "overflow-y-auto", "fixed", "inset-0", "z-50", "outline-none", "focus:outline-none");
|
|
26
|
+
// Crear capa de fondo detrás del modal
|
|
27
|
+
const modalOverlay = document.createElement("div");
|
|
28
|
+
modalOverlay.classList.add("fixed", "inset-0", "bg-black", "opacity-50", "z-40");
|
|
29
|
+
document.body.appendChild(modalOverlay);
|
|
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" })] }))] }) }));
|
|
32
|
+
const root = (0, client_1.createRoot)(modalWrapper);
|
|
33
|
+
root.render((0, jsx_runtime_1.jsx)(ModalContent, {}));
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
exports.createModal = createModal;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Modal.js"), exports);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NavBar = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const icons_1 = require("@zauru-sdk/icons");
|
|
7
|
+
const NavBar_utils_js_1 = require("./NavBar.utils.js");
|
|
8
|
+
const react_2 = require("@remix-run/react");
|
|
9
|
+
const DropDownLinkButton = ({ text, path, icon, buttonHover, }) => ((0, jsx_runtime_1.jsx)(react_2.Link, { className: `block px-4 py-3 text-sm text-gray-600 capitalize transition-colors duration-200 transform dark:text-gray-300 ${buttonHover ?? ""} dark:hover:bg-gray-700 dark:hover:text-white`, to: path, prefetch: "none", children: (0, jsx_runtime_1.jsxs)("div", { className: "mx-auto pt-2", children: [icon, (0, jsx_runtime_1.jsx)("span", { children: text })] }) }));
|
|
10
|
+
const OptionsDropDownButton = ({ color, options, name }) => {
|
|
11
|
+
const [showOptionsMenu, setShowOptionsMenu] = (0, react_1.useState)(true);
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "nav-item ml-auto", children: (0, jsx_runtime_1.jsx)("div", { className: "flex justify-center", children: (0, jsx_runtime_1.jsxs)("div", { className: "relative inline-block", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => setShowOptionsMenu(!showOptionsMenu), className: `relative flex items-center p-2 text-xs text-white ${color.bg700} active:${color.bg900} border border-transparent rounded-full uppercase focus:ring-opacity-40 focus:outline-none`, children: [name ?? (0, jsx_runtime_1.jsx)(icons_1.OpcionButtonSvgIcon, {}), (0, jsx_runtime_1.jsx)(icons_1.DropDownArrowSvgIcon, {})] }), (0, jsx_runtime_1.jsx)("div", { className: "absolute right-0 z-20 w-56 py-2 mt-2 overflow-hidden bg-white rounded-md shadow-xl dark:bg-gray-800", hidden: showOptionsMenu, onMouseLeave: () => setShowOptionsMenu(true), children: options.map((option) => option) })] }) }) }));
|
|
13
|
+
};
|
|
14
|
+
const NavItem = ({ name, link, icon, color, specialColor, childrens = [], }) => ((0, jsx_runtime_1.jsx)("li", { className: "nav-item", children: childrens.length > 0 ? ((0, jsx_runtime_1.jsx)(OptionsDropDownButton, { name: name, color: color, options: childrens.map((x, index) => ((0, jsx_runtime_1.jsx)(DropDownLinkButton, { text: x.name, path: x.link, buttonHover: "hover:bg-red-100" }, index))) })) : ((0, jsx_runtime_1.jsx)("div", { className: `${specialColor ? specialColor.bg700 : color.bg700} container text-white w-56 sm:w-auto h-10 text-sm py-1 uppercase rounded shadow hover:shadow-lg outline-none rounded-full focus:outline-none my-auto sm:my-0 sm:mr-1 mb-1 ease-linear transition-all duration-150 `, children: (0, jsx_runtime_1.jsx)(react_2.Link, { className: "px-3 flex items-center text-xs leading-snug text-white uppercase hover:opacity-75", to: link, prefetch: "none", children: (0, jsx_runtime_1.jsxs)("div", { className: "mx-auto pt-2", children: [icon, (0, jsx_runtime_1.jsx)("span", { children: name })] }) }) })) }));
|
|
15
|
+
const NavBar = ({ title, loggedIn, items, selectedColor, }) => {
|
|
16
|
+
const color = NavBar_utils_js_1.COLORS[selectedColor];
|
|
17
|
+
const [NavBarOpen, setNavBarOpen] = (0, react_1.useState)(false);
|
|
18
|
+
const options = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("ul", { children: loggedIn && ((0, jsx_runtime_1.jsx)("div", { className: "flex flex-col sm:flex-row ", children: items
|
|
19
|
+
.filter((item) => item.loggedIn)
|
|
20
|
+
.map((item, index) => {
|
|
21
|
+
const specialColor = item.color
|
|
22
|
+
? NavBar_utils_js_1.COLORS[item.color]
|
|
23
|
+
: undefined;
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)(NavItem, { name: item.name, link: item.link, icon: item.icon, specialColor: specialColor, color: color, childrens: item.childrens?.map((x) => {
|
|
25
|
+
return { ...x };
|
|
26
|
+
}) }, index));
|
|
27
|
+
}) })) }), (0, jsx_runtime_1.jsx)("ul", { className: "sm:flex sm:flex-col ml-auto lg:flex-row", children: loggedIn ? ((0, jsx_runtime_1.jsx)(OptionsDropDownButton, { color: color, options: [
|
|
28
|
+
(0, jsx_runtime_1.jsx)(DropDownLinkButton, { text: "Cerrar Sesi\u00F3n", path: "/logout", icon: (0, jsx_runtime_1.jsx)(icons_1.LogoutDropDownSvgIcon, {}), buttonHover: "hover:bg-red-100" }, 0),
|
|
29
|
+
] })) : (items
|
|
30
|
+
.filter((item) => !item.loggedIn)
|
|
31
|
+
.map((item, index) => {
|
|
32
|
+
return ((0, jsx_runtime_1.jsx)(NavItem, { name: item.name, link: item.link, icon: item.icon, color: color }, index));
|
|
33
|
+
})) })] }));
|
|
34
|
+
return ((0, jsx_runtime_1.jsx)("nav", { className: `py-3 ${color.bg600}`, children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between ml-5 mr-5", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between w-full lg:w-auto", children: [(0, jsx_runtime_1.jsx)(react_2.Link, { className: "text-sm font-bold leading-relaxed inline-block mr-4 py-2 whitespace-nowrap uppercase text-white", to: "/home", prefetch: "none", children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "inline-block mr-2 mb-2 align-middle", children: (0, jsx_runtime_1.jsx)("img", { className: "w-auto h-7", src: "/logo.png", alt: "logo-zauru" }) }), title] }) }), (0, jsx_runtime_1.jsx)("button", { className: `rounded lg:hidden focus:outline-none focus:ring focus:${color.ring600} focus:ring-opacity-50`, "aria-label": "Toggle mobile menu", type: "button", onClick: () => setNavBarOpen(!NavBarOpen), children: (0, jsx_runtime_1.jsx)(icons_1.MenuAlt4Svg, { open: NavBarOpen }) })] }), (0, jsx_runtime_1.jsx)("div", { className: `lg:hidden absolute top-0 left-0 z-50 w-64 h-full ${color.bg700} shadow-lg transform ${NavBarOpen ? "translate-x-0" : "-translate-x-full"} transition-transform duration-300 ease-in-out`, children: options }), (0, jsx_runtime_1.jsx)("div", { className: "hidden lg:flex w-full lg:w-auto", children: options })] }) }));
|
|
35
|
+
};
|
|
36
|
+
exports.NavBar = NavBar;
|