@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,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { DropDownArrowSvgIcon, LogoutDropDownSvgIcon, MenuAlt4Svg, OpcionButtonSvgIcon, } from "@zauru-sdk/icons";
|
|
4
|
+
import { COLORS } from "./NavBar.utils.js";
|
|
5
|
+
import { Link } from "@remix-run/react";
|
|
6
|
+
const DropDownLinkButton = ({ text, path, icon, buttonHover, }) => (_jsx(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: _jsxs("div", { className: "mx-auto pt-2", children: [icon, _jsx("span", { children: text })] }) }));
|
|
7
|
+
const OptionsDropDownButton = ({ color, options, name }) => {
|
|
8
|
+
const [showOptionsMenu, setShowOptionsMenu] = useState(true);
|
|
9
|
+
return (_jsx("div", { className: "nav-item ml-auto", children: _jsx("div", { className: "flex justify-center", children: _jsxs("div", { className: "relative inline-block", children: [_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 ?? _jsx(OpcionButtonSvgIcon, {}), _jsx(DropDownArrowSvgIcon, {})] }), _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) })] }) }) }));
|
|
10
|
+
};
|
|
11
|
+
const NavItem = ({ name, link, icon, color, specialColor, childrens = [], }) => (_jsx("li", { className: "nav-item", children: childrens.length > 0 ? (_jsx(OptionsDropDownButton, { name: name, color: color, options: childrens.map((x, index) => (_jsx(DropDownLinkButton, { text: x.name, path: x.link, buttonHover: "hover:bg-red-100" }, index))) })) : (_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: _jsx(Link, { className: "px-3 flex items-center text-xs leading-snug text-white uppercase hover:opacity-75", to: link, prefetch: "none", children: _jsxs("div", { className: "mx-auto pt-2", children: [icon, _jsx("span", { children: name })] }) }) })) }));
|
|
12
|
+
export const NavBar = ({ title, loggedIn, items, selectedColor, }) => {
|
|
13
|
+
const color = COLORS[selectedColor];
|
|
14
|
+
const [NavBarOpen, setNavBarOpen] = useState(false);
|
|
15
|
+
const options = (_jsxs(_Fragment, { children: [_jsx("ul", { children: loggedIn && (_jsx("div", { className: "flex flex-col sm:flex-row ", children: items
|
|
16
|
+
.filter((item) => item.loggedIn)
|
|
17
|
+
.map((item, index) => {
|
|
18
|
+
const specialColor = item.color
|
|
19
|
+
? COLORS[item.color]
|
|
20
|
+
: undefined;
|
|
21
|
+
return (_jsx(NavItem, { name: item.name, link: item.link, icon: item.icon, specialColor: specialColor, color: color, childrens: item.childrens?.map((x) => {
|
|
22
|
+
return { ...x };
|
|
23
|
+
}) }, index));
|
|
24
|
+
}) })) }), _jsx("ul", { className: "sm:flex sm:flex-col ml-auto lg:flex-row", children: loggedIn ? (_jsx(OptionsDropDownButton, { color: color, options: [
|
|
25
|
+
_jsx(DropDownLinkButton, { text: "Cerrar Sesi\u00F3n", path: "/logout", icon: _jsx(LogoutDropDownSvgIcon, {}), buttonHover: "hover:bg-red-100" }, 0),
|
|
26
|
+
] })) : (items
|
|
27
|
+
.filter((item) => !item.loggedIn)
|
|
28
|
+
.map((item, index) => {
|
|
29
|
+
return (_jsx(NavItem, { name: item.name, link: item.link, icon: item.icon, color: color }, index));
|
|
30
|
+
})) })] }));
|
|
31
|
+
return (_jsx("nav", { className: `py-3 ${color.bg600}`, children: _jsxs("div", { className: "flex items-center justify-between ml-5 mr-5", children: [_jsxs("div", { className: "flex justify-between w-full lg:w-auto", children: [_jsx(Link, { className: "text-sm font-bold leading-relaxed inline-block mr-4 py-2 whitespace-nowrap uppercase text-white", to: "/home", prefetch: "none", children: _jsxs(_Fragment, { children: [_jsx("div", { className: "inline-block mr-2 mb-2 align-middle", children: _jsx("img", { className: "w-auto h-7", src: "/logo.png", alt: "logo-zauru" }) }), title] }) }), _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: _jsx(MenuAlt4Svg, { open: NavBarOpen }) })] }), _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 }), _jsx("div", { className: "hidden lg:flex w-full lg:w-auto", children: options })] }) }));
|
|
32
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export const COLORS = {
|
|
2
|
+
sky: {
|
|
3
|
+
bg900: "bg-sky-900",
|
|
4
|
+
bg700: "bg-sky-700",
|
|
5
|
+
bg600: "bg-sky-600",
|
|
6
|
+
bg500: "bg-sky-500",
|
|
7
|
+
ring600: "ring-sky-600",
|
|
8
|
+
ring500: "ring-sky-500",
|
|
9
|
+
},
|
|
10
|
+
purple: {
|
|
11
|
+
bg900: "bg-purple-900",
|
|
12
|
+
bg700: "bg-purple-700",
|
|
13
|
+
bg600: "bg-purple-600",
|
|
14
|
+
bg500: "bg-purple-500",
|
|
15
|
+
ring600: "ring-purple-600",
|
|
16
|
+
ring500: "ring-purple-500",
|
|
17
|
+
},
|
|
18
|
+
pink: {
|
|
19
|
+
bg900: "bg-pink-900",
|
|
20
|
+
bg700: "bg-pink-700",
|
|
21
|
+
bg600: "bg-pink-600",
|
|
22
|
+
bg500: "bg-pink-500",
|
|
23
|
+
ring600: "ring-pink-600",
|
|
24
|
+
ring500: "ring-pink-500",
|
|
25
|
+
},
|
|
26
|
+
slate: {
|
|
27
|
+
bg900: "bg-slate-900",
|
|
28
|
+
bg700: "bg-slate-700",
|
|
29
|
+
bg600: "bg-slate-600",
|
|
30
|
+
bg500: "bg-slate-500",
|
|
31
|
+
ring600: "ring-slate-600",
|
|
32
|
+
ring500: "ring-slate-500",
|
|
33
|
+
},
|
|
34
|
+
green: {
|
|
35
|
+
bg900: "bg-green-900",
|
|
36
|
+
bg700: "bg-green-700",
|
|
37
|
+
bg600: "bg-green-600",
|
|
38
|
+
bg500: "bg-green-500",
|
|
39
|
+
ring600: "ring-green-600",
|
|
40
|
+
ring500: "ring-green-500",
|
|
41
|
+
},
|
|
42
|
+
yellow: {
|
|
43
|
+
bg900: "bg-yellow-900",
|
|
44
|
+
bg700: "bg-yellow-700",
|
|
45
|
+
bg600: "bg-yellow-600",
|
|
46
|
+
bg500: "bg-yellow-500",
|
|
47
|
+
ring600: "ring-yellow-600",
|
|
48
|
+
ring500: "ring-yellow-500",
|
|
49
|
+
},
|
|
50
|
+
red: {
|
|
51
|
+
bg900: "bg-red-900",
|
|
52
|
+
bg700: "bg-red-700",
|
|
53
|
+
bg600: "bg-red-600",
|
|
54
|
+
bg500: "bg-red-500",
|
|
55
|
+
ring600: "ring-red-600",
|
|
56
|
+
ring500: "ring-red-500",
|
|
57
|
+
},
|
|
58
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export const ProgressBar = (props) => {
|
|
3
|
+
const { title, percent } = props;
|
|
4
|
+
return (_jsx(_Fragment, { children: percent && (_jsxs(_Fragment, { children: [title && _jsx("div", { className: "mb-1 text-lg font-medium", children: title }), _jsx("div", { className: "w-full h-6 bg-gray-200 rounded-full", children: _jsx("div", { className: "h-6 bg-blue-600 rounded-full", style: { width: `${percent}%` } }) })] })) }));
|
|
5
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
export const ProgressCircle = ({ total, completed, description, title, }) => {
|
|
4
|
+
const [percentage, setPercentage] = useState(0);
|
|
5
|
+
const strokeDasharray = 2 * Math.PI * 42; // radio del circulo
|
|
6
|
+
const progressColor = `rgba(${255 - 2.55 * percentage}, ${2.55 * percentage}, 0)`;
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
if (total > 0) {
|
|
9
|
+
setPercentage((completed / total) * 100);
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
setPercentage(100);
|
|
13
|
+
}
|
|
14
|
+
}, [total, completed]);
|
|
15
|
+
return (_jsxs("div", { className: "flex flex-col items-center justify-center", children: [title && (_jsx("h2", { className: "mb-4 text-xl text-center text-gray-700", children: title })), _jsxs("svg", { width: "100", height: "100", className: "relative", children: [_jsx("circle", { r: "42", cx: "50", cy: "50", fill: "transparent", stroke: "#eee", strokeWidth: "8" }), _jsx("circle", { r: "42", cx: "50", cy: "50", fill: "transparent", stroke: progressColor, strokeWidth: "8", strokeDasharray: strokeDasharray, strokeDashoffset: strokeDasharray - strokeDasharray * (percentage / 100), strokeLinecap: "round", style: {
|
|
16
|
+
transform: "rotate(-90deg)",
|
|
17
|
+
transformOrigin: "50% 50%",
|
|
18
|
+
} }), _jsx("text", { x: "50", y: "55", textAnchor: "middle", fill: progressColor, style: {
|
|
19
|
+
fontSize: "16px",
|
|
20
|
+
fontWeight: "bold",
|
|
21
|
+
}, children: `${Math.round(percentage)}%` })] }), _jsx("p", { className: "mt-2 text-center text-gray-500", children: description })] }));
|
|
22
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export const LoadingInputSkeleton = () => {
|
|
3
|
+
return (_jsx("div", { className: "w-full h-full bg-gray-300 animate-pulse rounded", style: {
|
|
4
|
+
maxWidth: "100%",
|
|
5
|
+
height: "40px",
|
|
6
|
+
boxShadow: "0px 0px 0px 1px rgba(0, 0, 0, 0.1)",
|
|
7
|
+
} }));
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./LoadingInputSkeleton.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { redirect } from "@remix-run/node";
|
|
3
|
+
import { Outlet } from "@remix-run/react";
|
|
4
|
+
import React from "react";
|
|
5
|
+
//<reference> https://www.creative-tim.com/learning-lab/tailwind-starter-kit/documentation/react/tabs/text
|
|
6
|
+
export const Tabs = (props) => {
|
|
7
|
+
const { items } = props;
|
|
8
|
+
const [openTab, setOpenTab] = React.useState(1);
|
|
9
|
+
return (_jsx(_Fragment, { children: _jsx("div", { className: "flex flex-wrap", children: _jsxs("div", { className: "w-full", children: [_jsx("ul", { className: "flex mb-0 list-none flex-wrap pt-3 pb-4 flex-row", role: "tablist", children: items?.map((item, index) => {
|
|
10
|
+
return (_jsx("li", { className: "mb-px mr-2 last:mr-0 flex-auto text-center", children: _jsx("a", { className: "text-xs font-bold uppercase px-5 py-3 shadow-lg rounded block leading-normal " +
|
|
11
|
+
(openTab === index
|
|
12
|
+
? "text-white bg-red-600"
|
|
13
|
+
: "text-red-600 bg-white"), onClick: (e) => {
|
|
14
|
+
e.preventDefault();
|
|
15
|
+
setOpenTab(index);
|
|
16
|
+
redirect(item.link);
|
|
17
|
+
}, "data-toggle": "tab", href: item.link, role: "tablist", children: item.title }, index) }, index));
|
|
18
|
+
}) }), _jsx("div", { className: "relative flex flex-col min-w-0 break-words bg-white w-full mb-6 shadow-lg rounded", children: _jsx("div", { className: "px-4 py-5 flex-auto", children: _jsx("div", { className: "tab-content tab-space", children: _jsx(Outlet, {}) }) }) })] }) }) }));
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Tab.js";
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useSearchParams } from "@remix-run/react";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { createTheme } from "react-data-table-component";
|
|
5
|
+
import { SearchSVG } from "@zauru-sdk/icons";
|
|
6
|
+
import * as ReactDataTableComponent from "react-data-table-component";
|
|
7
|
+
const DataTable = ReactDataTableComponent.default;
|
|
8
|
+
const customStyles = {
|
|
9
|
+
headCells: {
|
|
10
|
+
style: {
|
|
11
|
+
color: "#202124",
|
|
12
|
+
fontSize: "14px",
|
|
13
|
+
justifyContent: "left", // Alinea el texto a la izquierda
|
|
14
|
+
whiteSpace: "normal", // Permite el ajuste de texto
|
|
15
|
+
wordBreak: "break-word", // Asegura que las palabras se rompan correctamente para evitar desbordamientos
|
|
16
|
+
maxWidth: "150px", // Establece un ancho máximo para las celdas del encabezado
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
rows: {
|
|
20
|
+
highlightOnHoverStyle: {
|
|
21
|
+
backgroundColor: "rgb(230, 244, 244)",
|
|
22
|
+
borderBottomColor: "#FFFFFF",
|
|
23
|
+
borderRadius: "25px",
|
|
24
|
+
outline: "1px solid #FFFFFF",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
pagination: {
|
|
28
|
+
style: {
|
|
29
|
+
border: "none",
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
createTheme("solarized", {
|
|
34
|
+
text: {
|
|
35
|
+
primary: "#002b36",
|
|
36
|
+
secondary: "#002b36",
|
|
37
|
+
},
|
|
38
|
+
background: {
|
|
39
|
+
default: "#f9f9f9",
|
|
40
|
+
},
|
|
41
|
+
context: {
|
|
42
|
+
background: "#cb4b16",
|
|
43
|
+
text: "#555555",
|
|
44
|
+
},
|
|
45
|
+
divider: {
|
|
46
|
+
default: "#e2e4ff",
|
|
47
|
+
},
|
|
48
|
+
action: {
|
|
49
|
+
button: "rgba(0,0,0,.54)",
|
|
50
|
+
hover: "rgba(0,0,0,.08)",
|
|
51
|
+
disabled: "rgba(0,0,0,.12)",
|
|
52
|
+
},
|
|
53
|
+
headRow: {
|
|
54
|
+
background: "black",
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
createTheme("subTable", {
|
|
58
|
+
text: {
|
|
59
|
+
primary: "#002b36",
|
|
60
|
+
secondary: "#002b36",
|
|
61
|
+
},
|
|
62
|
+
background: {
|
|
63
|
+
default: "#e9e9e9",
|
|
64
|
+
},
|
|
65
|
+
context: {
|
|
66
|
+
background: "#cb4b16",
|
|
67
|
+
text: "#555555",
|
|
68
|
+
},
|
|
69
|
+
divider: {
|
|
70
|
+
default: "#e2e4ff",
|
|
71
|
+
},
|
|
72
|
+
action: {
|
|
73
|
+
button: "rgba(0,0,0,.54)",
|
|
74
|
+
hover: "rgba(0,0,0,.08)",
|
|
75
|
+
disabled: "rgba(0,0,0,.12)",
|
|
76
|
+
},
|
|
77
|
+
headRow: {
|
|
78
|
+
background: "black",
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
//Documentación de la tabla https://react-data-table-component.netlify.app/?path=/docs/getting-started-intro--docs
|
|
82
|
+
export const ZauruTable = (props) => {
|
|
83
|
+
const { columns, conditionalRowStyles, data, loading = false, pagination, search, expandable, theme, className, offlineSearch = [], whitOutPagination = false, ...others } = props;
|
|
84
|
+
const [, setSearchParams] = useSearchParams({
|
|
85
|
+
page: "1",
|
|
86
|
+
perPage: "10",
|
|
87
|
+
search: "",
|
|
88
|
+
});
|
|
89
|
+
const [filteredData, setFilteredData] = useState(data);
|
|
90
|
+
const [showTable, setShowTable] = useState(false);
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
setShowTable(true);
|
|
93
|
+
}, []);
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
setFilteredData(data);
|
|
96
|
+
}, [data]);
|
|
97
|
+
const subHeaderComponentMemo = (_jsxs(_Fragment, { children: [_jsx("input", { name: "search", type: "text", placeholder: search?.placeholderSearch ?? "Filtrar", "aria-label": "Search Input", className: "bg-gray-50 border border-gray-300 text-gray-900 rounded-lg px-2", onChange: (event) => {
|
|
98
|
+
const searchTerm = event.target.value;
|
|
99
|
+
if (offlineSearch.length > 0) {
|
|
100
|
+
filterData(searchTerm);
|
|
101
|
+
}
|
|
102
|
+
}, onBlur: (event) => {
|
|
103
|
+
const searchTerm = event.target.value;
|
|
104
|
+
if (offlineSearch.length <= 0 && search) {
|
|
105
|
+
setSearchParams((prevState) => ({
|
|
106
|
+
...Object.fromEntries(prevState),
|
|
107
|
+
search: searchTerm,
|
|
108
|
+
}));
|
|
109
|
+
}
|
|
110
|
+
} }), _jsx("button", { type: "button", name: "search", className: "px-2 font-bold", children: _jsx(SearchSVG, {}) })] }));
|
|
111
|
+
const filterData = (searchTerm) => {
|
|
112
|
+
if (!searchTerm || !offlineSearch || offlineSearch.length === 0) {
|
|
113
|
+
setFilteredData(data);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const filtered = data.filter((item) => offlineSearch.some((field) => item[field] &&
|
|
117
|
+
item[field]
|
|
118
|
+
.toString()
|
|
119
|
+
.toLowerCase()
|
|
120
|
+
.includes(searchTerm.toLowerCase())));
|
|
121
|
+
setFilteredData(filtered);
|
|
122
|
+
};
|
|
123
|
+
const handlePageChange = (page) => {
|
|
124
|
+
//hacer el fetch de más datos
|
|
125
|
+
setSearchParams((prevState) => ({
|
|
126
|
+
...Object.fromEntries(prevState),
|
|
127
|
+
page: page.toString(),
|
|
128
|
+
}));
|
|
129
|
+
};
|
|
130
|
+
const handlePerRowsChange = async (newPerPage, page) => {
|
|
131
|
+
//hacer el fetch de más datos
|
|
132
|
+
setSearchParams((prevState) => ({
|
|
133
|
+
...Object.fromEntries(prevState),
|
|
134
|
+
perPage: newPerPage.toString(),
|
|
135
|
+
}));
|
|
136
|
+
};
|
|
137
|
+
if (!showTable) {
|
|
138
|
+
return _jsx(_Fragment, { children: "Loading..." });
|
|
139
|
+
}
|
|
140
|
+
//Textos en español de la tabla
|
|
141
|
+
const paginationComponentOptions = {
|
|
142
|
+
rowsPerPageText: "Filas por página",
|
|
143
|
+
rangeSeparatorText: "de",
|
|
144
|
+
selectAllRowsItem: true,
|
|
145
|
+
selectAllRowsItemText: "Todos",
|
|
146
|
+
};
|
|
147
|
+
const loadSubHeader = !!(search || offlineSearch.length > 0);
|
|
148
|
+
const subHeaderComponent = loadSubHeader ? subHeaderComponentMemo : undefined;
|
|
149
|
+
return (_jsx(DataTable, { className: className, subHeaderWrap: true, theme: theme ?? "solarized", columns: columns, conditionalRowStyles: conditionalRowStyles, data: filteredData, customStyles: customStyles, progressPending: loading, highlightOnHover: true, pointerOnHover: true, dense: true, striped: true, pagination: !whitOutPagination, persistTableHead: true, responsive: true, noHeader: true, expandableRows: !!expandable, expandableRowExpanded: expandable ? expandable.expandableRowExpanded : undefined, expandableRowsComponent: expandable ? expandable.expandableRowsComponent : undefined, subHeader: loadSubHeader, subHeaderComponent: subHeaderComponent, paginationServer: !!pagination, paginationTotalRows: pagination ? pagination.totalRows : undefined, onChangeRowsPerPage: pagination ? handlePerRowsChange : undefined, onChangePage: pagination ? handlePageChange : undefined, paginationComponentOptions: paginationComponentOptions, paginationRowsPerPageOptions: pagination?.rowsPerPageOptions ? pagination.rowsPerPageOptions : [10], ...others }));
|
|
150
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ZauruTable.js";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
export const Task = ({ task }) => {
|
|
4
|
+
const [isDescriptionOpen, setIsDescriptionOpen] = useState(false);
|
|
5
|
+
let statusIcon;
|
|
6
|
+
let taskStyle = {};
|
|
7
|
+
let bgColor;
|
|
8
|
+
switch (task.status) {
|
|
9
|
+
case "waiting":
|
|
10
|
+
statusIcon = "🕗"; // Icono de reloj (como un ejemplo, puedes reemplazarlo con un ícono o SVG real)
|
|
11
|
+
taskStyle = { opacity: 0.5 }; // estilo disabled
|
|
12
|
+
bgColor = "bg-gray-200"; // Color de fondo gris
|
|
13
|
+
break;
|
|
14
|
+
case "processing":
|
|
15
|
+
statusIcon = "⏳"; // Icono de reloj de arena
|
|
16
|
+
taskStyle = { fontWeight: "bold" }; // estilo negrita
|
|
17
|
+
bgColor = "bg-blue-200"; // Color de fondo azul
|
|
18
|
+
break;
|
|
19
|
+
case "done":
|
|
20
|
+
statusIcon = "✅"; // Icono de check
|
|
21
|
+
bgColor = "bg-green-200"; // Color de fondo verde
|
|
22
|
+
break;
|
|
23
|
+
case "error":
|
|
24
|
+
statusIcon = "❌"; // Icono de cruz
|
|
25
|
+
taskStyle = { color: "red" }; // estilo color rojo
|
|
26
|
+
bgColor = "bg-red-200"; // Color de fondo rojo
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
return (_jsxs("div", { style: taskStyle, className: `${bgColor} rounded-lg p-3 mb-3 ${task.description ? "cursor-pointer" : ""}`, onClick: () => task.description && setIsDescriptionOpen(!isDescriptionOpen), children: [_jsxs("div", { className: "flex justify-between", children: [_jsxs("div", { children: [statusIcon, " ", task.title, " ", `${task.status === "processing" ? "..." : ""}`] }), task.description && _jsx("div", { children: "\u25BC" })] }), task.description && isDescriptionOpen && (_jsx("div", { className: "mt-2", children: task.description }))] }));
|
|
30
|
+
};
|
|
31
|
+
export const TaskList = ({ tasks }) => {
|
|
32
|
+
const completedTasks = tasks.filter((task) => task.status === "done" || task.status === "error").length;
|
|
33
|
+
const progressPercentage = (completedTasks / tasks.length) * 100;
|
|
34
|
+
return (_jsxs("div", { children: [tasks.map((task, index) => (_jsx(Task, { task: task }, index))), _jsx("div", { className: "h-2 bg-gray-200 rounded-lg mt-3", children: _jsx("div", { className: "bg-green-500 h-full rounded-lg", style: { width: `${progressPercentage}%`, transition: "width 0.5s" } }) })] }));
|
|
35
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./TaskList.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
//Component to show all information in an array
|
|
3
|
+
export const LabelArray = ({ info }) => {
|
|
4
|
+
return (_jsx("div", { className: "divide-y divide-gray-100", children: info?.map((x) => {
|
|
5
|
+
return (_jsxs("div", { className: "my-1 pt-2", children: [_jsxs("p", { className: "inline font-bold text-lg", children: [x?.label, ": "] }), _jsx("p", { className: "inline text-lg", children: x?.value })] }, x?.label));
|
|
6
|
+
}) }));
|
|
7
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
//H1 Title Component
|
|
3
|
+
export const TitleH1 = ({ texto }) => {
|
|
4
|
+
return (_jsx("div", { className: "mb-1", children: _jsx("h1", { className: "text-4xl font-bold leading-normal mt-0 mb-2 text-zinc-800", children: texto }) }));
|
|
5
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
//H2 Title Component
|
|
3
|
+
export const TitleH2 = ({ texto }) => {
|
|
4
|
+
return (_jsx("div", { className: "py-1 ", children: _jsx("h2", { className: "text-2xl font-bold leading-normal mt-0 mb-2 text-zinc-800", children: texto }) }));
|
|
5
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
export const Tooltip = ({ children, text }) => {
|
|
5
|
+
const [show, setShow] = useState(false);
|
|
6
|
+
return (_jsxs("div", { className: "relative inline-block", children: [_jsx("div", { onMouseEnter: () => setShow(true), onMouseLeave: () => setShow(false), children: children }), show && (_jsxs("div", { className: "absolute z-10 bg-gray-700 text-white px-2 py-1 rounded-md bottom-full left-1/2 transform -translate-x-1/2", style: { whiteSpace: "nowrap", height: "2rem" }, children: [text, _jsx("div", { className: "absolute top-full left-1/2 transform -translate-x-1/2", style: {
|
|
7
|
+
width: "0",
|
|
8
|
+
height: "0",
|
|
9
|
+
borderTop: "6px solid transparent",
|
|
10
|
+
borderLeft: "6px solid transparent",
|
|
11
|
+
borderRight: "6px solid transparent",
|
|
12
|
+
borderBottom: "6px solid gray",
|
|
13
|
+
} })] }))] }));
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Tooltip.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
export const WithTooltip = (props) => {
|
|
3
|
+
const { children, text } = props;
|
|
4
|
+
return (_jsx(_Fragment, { children: _jsxs("span", { className: "group relative", children: [children, _jsx("span", { className: "pointer-events-none absolute -top-10 left-1/2 -translate-x-1/2 whitespace-nowrap rounded bg-black px-2 py-1 text-white opacity-0 transition z-50 before:absolute before:left-1/2 before:top-full before:-translate-x-1/2 before:border-4 before:border-transparent before:border-t-black before:content-[''] group-hover:opacity-100 before:z-50", children: text })] }) }));
|
|
5
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./WithTooltip.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { LoadingInputSkeleton } from "../Skeletons/index.js";
|
|
4
|
+
export const StepWizardComponent = ({ steps, showStepName = false, loading = false, }) => {
|
|
5
|
+
const [currentStep, setCurrentStep] = useState(0);
|
|
6
|
+
if (loading) {
|
|
7
|
+
return (_jsxs("div", { className: "lg:grid lg:grid-cols-10 gap-4", children: [_jsxs("div", { className: "lg:col-span-2", children: [_jsx("select", { className: "lg:hidden mb-5 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md", children: _jsx("option", {}) }), _jsx("div", { className: "hidden lg:block", children: _jsx(LoadingInputSkeleton, {}) })] }), _jsx("div", { className: "lg:col-span-8", children: _jsx(LoadingInputSkeleton, {}) })] }));
|
|
8
|
+
}
|
|
9
|
+
return (_jsxs("div", { className: "lg:grid lg:grid-cols-10 gap-4", children: [_jsxs("div", { className: "lg:col-span-2", children: [_jsx("select", { className: "lg:hidden mb-5 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md", onChange: (e) => setCurrentStep(parseInt(e.target.value)), value: currentStep, children: steps.map((step, index) => (_jsx("option", { value: index, children: showStepName ? step.stepName : `Step ${index + 1}` }, index))) }), _jsx("div", { className: "scroll-hidden hidden lg:block", children: steps.map((step, index) => (_jsx("div", { onClick: () => setCurrentStep(index), className: `py-2 px-4 mt-5 cursor-pointer rounded ${currentStep === index
|
|
10
|
+
? "bg-blue-500 text-white"
|
|
11
|
+
: "text-blue-500 hover:bg-gray-100 border border-gray-300"} ${showStepName
|
|
12
|
+
? "text-wrap break-words"
|
|
13
|
+
: "rounded-full w-8 h-8 flex items-center justify-center"}`, children: showStepName ? step.stepName : index + 1 }, index))) })] }), _jsx("div", { className: "lg:col-span-8", children: steps.map((step, index) => (_jsx("div", { className: currentStep === index ? "block" : "hidden", children: step.component }, index))) })] }));
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./StepWizard.js";
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
const canUseDOM = () => {
|
|
3
|
+
if (typeof window === "undefined" ||
|
|
4
|
+
!window.document ||
|
|
5
|
+
!window.document.createElement) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
return true;
|
|
9
|
+
};
|
|
10
|
+
export const logoutFromZendesk = () => {
|
|
11
|
+
if (canUseDOM() && window.zE) {
|
|
12
|
+
window.zE("messenger", "logoutUser");
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
console.warn("Zendesk is not initialized yet");
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export const ZendeskAPI = (...args) => {
|
|
19
|
+
if (canUseDOM() && window.zE) {
|
|
20
|
+
window.zE.apply(null, args);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
console.warn("Zendesk is not initialized yet");
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
export const Zendesk = (props) => {
|
|
27
|
+
const { defer, configuration, token, ...other } = props;
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
const insertScript = () => {
|
|
30
|
+
const zendeskScript = document.createElement("script");
|
|
31
|
+
if (defer) {
|
|
32
|
+
zendeskScript.defer = true;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
zendeskScript.async = true;
|
|
36
|
+
}
|
|
37
|
+
zendeskScript.id = "ze-snippet";
|
|
38
|
+
zendeskScript.src = `https://static.zdassets.com/ekr/snippet.js?key=${configuration.zendeskChatKey}`;
|
|
39
|
+
zendeskScript.addEventListener("load", () => {
|
|
40
|
+
if (props.onLoaded) {
|
|
41
|
+
props.onLoaded();
|
|
42
|
+
}
|
|
43
|
+
window.zE("messenger", "loginUser", function (callback) {
|
|
44
|
+
callback(token);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
document.body.appendChild(zendeskScript);
|
|
48
|
+
return zendeskScript; // Devolvemos la referencia del script
|
|
49
|
+
};
|
|
50
|
+
let script; // Guardamos la referencia del script aquí
|
|
51
|
+
if (canUseDOM() && !window.zE) {
|
|
52
|
+
script = insertScript();
|
|
53
|
+
window.zESettings = other;
|
|
54
|
+
}
|
|
55
|
+
return () => {
|
|
56
|
+
if (script) {
|
|
57
|
+
// Si el script existe, lo eliminamos del DOM
|
|
58
|
+
script.remove();
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}, [props, defer, other, configuration, token]);
|
|
62
|
+
return null;
|
|
63
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import jwt from "jsonwebtoken";
|
|
2
|
+
export function zendeskJwt(current_user, configuration) {
|
|
3
|
+
// get the INFO
|
|
4
|
+
const jwtSecret = configuration.zendeskJWTSecret;
|
|
5
|
+
const jwtKey = configuration.zendeskJWTKey;
|
|
6
|
+
const expiresIn = Math.floor(Date.now() / 1000) + 60 * 60 * 24; // Expires in 1 day
|
|
7
|
+
// create the payload
|
|
8
|
+
const payload = {
|
|
9
|
+
external_id: "z" +
|
|
10
|
+
current_user.selected_entity_id.toString() +
|
|
11
|
+
"-" +
|
|
12
|
+
current_user.id.toString(),
|
|
13
|
+
email: current_user.email,
|
|
14
|
+
name: current_user.name,
|
|
15
|
+
organization_id: current_user.selected_entity_id.toString(),
|
|
16
|
+
scope: "user",
|
|
17
|
+
exp: expiresIn,
|
|
18
|
+
};
|
|
19
|
+
const jwtHeader = { kid: jwtKey, typ: "JWT", alg: "HS256" };
|
|
20
|
+
return jwt.sign(payload, jwtSecret, {
|
|
21
|
+
algorithm: "HS256",
|
|
22
|
+
header: jwtHeader,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export * from "./Alerts/index.js";
|
|
2
|
+
export * from "./BlockUI/index.js";
|
|
3
|
+
export * from "./Buttons/index.js";
|
|
4
|
+
export * from "./Card/index.js";
|
|
5
|
+
export * from "./ConnectionState/index.js";
|
|
6
|
+
export * from "./Chat/index.js";
|
|
7
|
+
export * from "./Containers/index.js";
|
|
8
|
+
export * from "./DynamicTable/index.js";
|
|
9
|
+
export * from "./Footer/index.js";
|
|
10
|
+
export * from "./Form/index.js";
|
|
11
|
+
export * from "./Labels/index.js";
|
|
12
|
+
export * from "./Layouts/index.js";
|
|
13
|
+
export * from "./LineSeparator/index.js";
|
|
14
|
+
export * from "./Modal/index.js";
|
|
15
|
+
export * from "./NavBar/index.js";
|
|
16
|
+
export * from "./Skeletons/index.js";
|
|
17
|
+
export * from "./Tab/index.js";
|
|
18
|
+
export * from "./Table/index.js";
|
|
19
|
+
export * from "./TaskList/index.js";
|
|
20
|
+
export * from "./Titles/index.js";
|
|
21
|
+
export * from "./Tooltip/index.js";
|
|
22
|
+
export * from "./WithTooltip/index.js";
|
|
23
|
+
export * from "./Wizards/index.js";
|
|
24
|
+
export * from "./Zendesk/index.js";
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export * from "./Alerts/index.js";
|
|
2
|
+
export * from "./BlockUI/index.js";
|
|
3
|
+
export * from "./Buttons/index.js";
|
|
4
|
+
export * from "./Card/index.js";
|
|
5
|
+
export * from "./ConnectionState/index.js";
|
|
6
|
+
export * from "./Chat/index.js";
|
|
7
|
+
export * from "./Containers/index.js";
|
|
8
|
+
export * from "./DynamicTable/index.js";
|
|
9
|
+
export * from "./Footer/index.js";
|
|
10
|
+
export * from "./Form/index.js";
|
|
11
|
+
export * from "./Labels/index.js";
|
|
12
|
+
export * from "./Layouts/index.js";
|
|
13
|
+
export * from "./LineSeparator/index.js";
|
|
14
|
+
export * from "./Modal/index.js";
|
|
15
|
+
export * from "./NavBar/index.js";
|
|
16
|
+
export * from "./Skeletons/index.js";
|
|
17
|
+
export * from "./Tab/index.js";
|
|
18
|
+
export * from "./Table/index.js";
|
|
19
|
+
export * from "./TaskList/index.js";
|
|
20
|
+
export * from "./Titles/index.js";
|
|
21
|
+
export * from "./Tooltip/index.js";
|
|
22
|
+
export * from "./WithTooltip/index.js";
|
|
23
|
+
export * from "./Wizards/index.js";
|
|
24
|
+
export * from "./Zendesk/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|