@zauru-sdk/components 1.0.11 → 1.0.13
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 +16 -0
- package/dist/Alerts/index.d.ts +2 -0
- package/dist/Alerts/index.js +2 -0
- package/dist/BlockUI/BlockUI.d.ts +8 -0
- package/dist/BlockUI/BlockUI.js +8 -0
- package/dist/BlockUI/index.d.ts +1 -0
- package/dist/BlockUI/index.js +1 -0
- package/dist/Buttons/Button.d.ts +15 -0
- package/dist/Buttons/Button.js +43 -0
- package/dist/Buttons/index.d.ts +1 -0
- package/dist/Buttons/index.js +1 -0
- package/dist/Card/Card.d.ts +8 -0
- package/dist/Card/Card.js +5 -0
- package/dist/Card/index.d.ts +1 -0
- package/dist/Card/index.js +1 -0
- package/dist/Containers/BodyContainer.d.ts +6 -0
- package/dist/Containers/BodyContainer.js +5 -0
- package/dist/Containers/ButtonSectionContainer.d.ts +8 -0
- package/dist/Containers/ButtonSectionContainer.js +5 -0
- package/dist/Containers/Container.d.ts +10 -0
- package/dist/Containers/Container.js +6 -0
- package/dist/Containers/DoubleContainer.d.ts +9 -0
- package/dist/Containers/DoubleContainer.js +14 -0
- package/dist/Containers/MainContainer.d.ts +6 -0
- package/dist/Containers/MainContainer.js +5 -0
- package/dist/Containers/OutletContainer.d.ts +6 -0
- package/dist/Containers/OutletContainer.js +5 -0
- package/dist/Containers/SubContainer.d.ts +10 -0
- package/dist/Containers/SubContainer.js +6 -0
- package/dist/Containers/index.d.ts +7 -0
- package/dist/Containers/index.js +7 -0
- package/dist/Footer/Footer.d.ts +7 -0
- package/dist/Footer/Footer.js +25 -0
- package/dist/Footer/index.d.ts +1 -0
- package/dist/Footer/index.js +1 -0
- package/dist/Labels/InfoLabel/index.d.ts +7 -0
- package/dist/Labels/InfoLabel/index.js +5 -0
- package/dist/Labels/index.d.ts +1 -0
- package/dist/Labels/index.js +1 -0
- package/dist/Layouts/homeLayout/index.d.ts +6 -0
- package/dist/Layouts/homeLayout/index.js +10 -0
- package/dist/Layouts/index.d.ts +1 -0
- package/dist/Layouts/index.js +1 -0
- package/dist/LineSeparator/LineSeparator.d.ts +1 -0
- package/dist/LineSeparator/LineSeparator.js +4 -0
- package/dist/LineSeparator/index.d.ts +1 -0
- package/dist/LineSeparator/index.js +1 -0
- package/dist/Modal/Modal.d.ts +10 -0
- package/dist/Modal/Modal.js +32 -0
- package/dist/Modal/index.d.ts +1 -0
- package/dist/Modal/index.js +1 -0
- package/dist/NavBar/NavBar.js +2 -2
- package/dist/NavBar/index.d.ts +3 -0
- package/dist/NavBar/index.js +3 -0
- package/dist/ProgressBar/ProgressBar.d.ts +6 -0
- package/dist/ProgressBar/ProgressBar.js +5 -0
- package/dist/ProgressBar/ProgressCircle.d.ts +6 -0
- package/dist/ProgressBar/ProgressCircle.js +22 -0
- package/dist/ProgressBar/index.d.ts +2 -0
- package/dist/ProgressBar/index.js +2 -0
- package/dist/Skeletons/LoadingInputSkeleton.d.ts +1 -0
- package/dist/Skeletons/LoadingInputSkeleton.js +8 -0
- package/dist/Skeletons/index.d.ts +1 -0
- package/dist/Skeletons/index.js +1 -0
- package/dist/Tab/Tab.d.ts +9 -0
- package/dist/Tab/Tab.js +19 -0
- package/dist/Tab/index.d.ts +1 -0
- package/dist/Tab/index.js +1 -0
- package/dist/Table/ZauruTable.d.ts +25 -0
- package/dist/Table/ZauruTable.js +148 -0
- package/dist/Table/index.d.ts +1 -0
- package/dist/Table/index.js +1 -0
- package/dist/TaskList/TaskList.d.ts +14 -0
- package/dist/TaskList/TaskList.js +35 -0
- package/dist/TaskList/index.d.ts +1 -0
- package/dist/TaskList/index.js +1 -0
- package/dist/Titles/LabelArray.d.ts +4 -0
- package/dist/Titles/LabelArray.js +7 -0
- package/dist/Titles/TableColumnTitle.d.ts +4 -0
- package/dist/Titles/TableColumnTitle.js +5 -0
- package/dist/Titles/TitleH1.d.ts +1 -0
- package/dist/Titles/TitleH1.js +5 -0
- package/dist/Titles/TitleH2.d.ts +1 -0
- package/dist/Titles/TitleH2.js +5 -0
- package/dist/Titles/TitleH3.d.ts +1 -0
- package/dist/Titles/TitleH3.js +5 -0
- package/dist/Titles/index.d.ts +5 -0
- package/dist/Titles/index.js +5 -0
- package/dist/Tooltip/Tooltip.d.ts +7 -0
- package/dist/Tooltip/Tooltip.js +14 -0
- package/dist/Tooltip/index.d.ts +1 -0
- package/dist/Tooltip/index.js +1 -0
- package/dist/WithTooltip/WithTooltip.d.ts +7 -0
- package/dist/WithTooltip/WithTooltip.js +5 -0
- package/dist/WithTooltip/index.d.ts +1 -0
- package/dist/WithTooltip/index.js +1 -0
- package/dist/Wizards/StepWizard.d.ts +14 -0
- package/dist/Wizards/StepWizard.js +14 -0
- package/dist/Wizards/index.d.ts +1 -0
- package/dist/Wizards/index.js +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +21 -1
- package/package.json +8 -5
- package/src/Alerts/index.ts +2 -0
- package/src/BlockUI/BlockUI.tsx +50 -0
- package/src/BlockUI/index.tsx +1 -0
- package/src/Buttons/Button.tsx +90 -0
- package/src/Buttons/index.ts +1 -0
- package/src/Card/Card.tsx +24 -0
- package/src/Card/index.ts +1 -0
- package/src/Containers/BodyContainer.tsx +14 -0
- package/src/Containers/ButtonSectionContainer.tsx +21 -0
- package/src/Containers/Container.tsx +39 -0
- package/src/Containers/DoubleContainer.tsx +48 -0
- package/src/Containers/MainContainer.tsx +17 -0
- package/src/Containers/OutletContainer.tsx +14 -0
- package/src/Containers/SubContainer.tsx +37 -0
- package/src/Containers/index.ts +7 -0
- package/src/Footer/Footer.tsx +61 -0
- package/src/Footer/index.tsx +1 -0
- package/src/Labels/InfoLabel/index.tsx +21 -0
- package/src/Labels/index.tsx +1 -0
- package/src/Layouts/homeLayout/index.tsx +34 -0
- package/src/Layouts/index.ts +1 -0
- package/src/LineSeparator/LineSeparator.tsx +3 -0
- package/src/LineSeparator/index.tsx +1 -0
- package/src/Modal/Modal.tsx +104 -0
- package/src/Modal/index.tsx +1 -0
- package/src/NavBar/NavBar.tsx +2 -2
- package/src/NavBar/index.tsx +5 -0
- package/src/ProgressBar/ProgressBar.tsx +25 -0
- package/src/ProgressBar/ProgressCircle.tsx +75 -0
- package/src/ProgressBar/index.tsx +2 -0
- package/src/Skeletons/LoadingInputSkeleton.tsx +12 -0
- package/src/Skeletons/index.ts +1 -0
- package/src/Tab/Tab.tsx +63 -0
- package/src/Tab/index.ts +1 -0
- package/src/Table/ZauruTable.tsx +263 -0
- package/src/Table/index.tsx +1 -0
- package/src/TaskList/TaskList.tsx +88 -0
- package/src/TaskList/index.ts +1 -0
- package/src/Titles/LabelArray.tsx +17 -0
- package/src/Titles/TableColumnTitle.tsx +9 -0
- package/src/Titles/TitleH1.tsx +11 -0
- package/src/Titles/TitleH2.tsx +10 -0
- package/src/Titles/TitleH3.tsx +10 -0
- package/src/Titles/index.ts +5 -0
- package/src/Tooltip/Tooltip.tsx +42 -0
- package/src/Tooltip/index.ts +1 -0
- package/src/WithTooltip/WithTooltip.tsx +21 -0
- package/src/WithTooltip/index.tsx +1 -0
- package/src/Wizards/StepWizard.tsx +88 -0
- package/src/Wizards/index.ts +1 -0
- package/src/index.ts +21 -0
- package/dist/Alerts/Alert.d.ts +0 -9
- package/dist/Alerts/Alert.js +0 -97
- package/dist/Icons/Icons.d.ts +0 -47
- package/dist/Icons/Icons.js +0 -110
- package/dist/Icons/StylesConstants.d.ts +0 -26
- package/dist/Icons/StylesConstants.js +0 -34
- package/src/Alerts/Alert.tsx +0 -149
- package/src/Icons/Icons.tsx +0 -782
- package/src/Icons/StylesConstants.tsx +0 -66
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { TableProps } from "react-data-table-component";
|
|
2
|
+
import { ExpandableRowsComponent } from "react-data-table-component/dist/DataTable/types";
|
|
3
|
+
type Props = TableProps<any> & {
|
|
4
|
+
columns: any;
|
|
5
|
+
conditionalRowStyles?: any;
|
|
6
|
+
data: any[];
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
pagination?: {
|
|
9
|
+
totalRows: number;
|
|
10
|
+
rowsPerPageOptions: number[];
|
|
11
|
+
};
|
|
12
|
+
whitOutPagination?: boolean;
|
|
13
|
+
offlineSearch?: string[];
|
|
14
|
+
search?: {
|
|
15
|
+
placeholderSearch?: string;
|
|
16
|
+
};
|
|
17
|
+
expandable?: {
|
|
18
|
+
expandableRowExpanded?: (row: any) => boolean;
|
|
19
|
+
expandableRowsComponent?: ExpandableRowsComponent<any>;
|
|
20
|
+
};
|
|
21
|
+
theme?: "solarized" | "subTable";
|
|
22
|
+
className?: string;
|
|
23
|
+
};
|
|
24
|
+
export declare const ZauruTable: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,148 @@
|
|
|
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 DataTable, { createTheme } from "react-data-table-component";
|
|
5
|
+
import { SearchSVG } from "@zauru-sdk/icons";
|
|
6
|
+
const customStyles = {
|
|
7
|
+
headCells: {
|
|
8
|
+
style: {
|
|
9
|
+
color: "#202124",
|
|
10
|
+
fontSize: "14px",
|
|
11
|
+
justifyContent: "left", // Alinea el texto a la izquierda
|
|
12
|
+
whiteSpace: "normal", // Permite el ajuste de texto
|
|
13
|
+
wordBreak: "break-word", // Asegura que las palabras se rompan correctamente para evitar desbordamientos
|
|
14
|
+
maxWidth: "150px", // Establece un ancho máximo para las celdas del encabezado
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
rows: {
|
|
18
|
+
highlightOnHoverStyle: {
|
|
19
|
+
backgroundColor: "rgb(230, 244, 244)",
|
|
20
|
+
borderBottomColor: "#FFFFFF",
|
|
21
|
+
borderRadius: "25px",
|
|
22
|
+
outline: "1px solid #FFFFFF",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
pagination: {
|
|
26
|
+
style: {
|
|
27
|
+
border: "none",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
createTheme("solarized", {
|
|
32
|
+
text: {
|
|
33
|
+
primary: "#002b36",
|
|
34
|
+
secondary: "#002b36",
|
|
35
|
+
},
|
|
36
|
+
background: {
|
|
37
|
+
default: "#f9f9f9",
|
|
38
|
+
},
|
|
39
|
+
context: {
|
|
40
|
+
background: "#cb4b16",
|
|
41
|
+
text: "#555555",
|
|
42
|
+
},
|
|
43
|
+
divider: {
|
|
44
|
+
default: "#e2e4ff",
|
|
45
|
+
},
|
|
46
|
+
action: {
|
|
47
|
+
button: "rgba(0,0,0,.54)",
|
|
48
|
+
hover: "rgba(0,0,0,.08)",
|
|
49
|
+
disabled: "rgba(0,0,0,.12)",
|
|
50
|
+
},
|
|
51
|
+
headRow: {
|
|
52
|
+
background: "black",
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
createTheme("subTable", {
|
|
56
|
+
text: {
|
|
57
|
+
primary: "#002b36",
|
|
58
|
+
secondary: "#002b36",
|
|
59
|
+
},
|
|
60
|
+
background: {
|
|
61
|
+
default: "#e9e9e9",
|
|
62
|
+
},
|
|
63
|
+
context: {
|
|
64
|
+
background: "#cb4b16",
|
|
65
|
+
text: "#555555",
|
|
66
|
+
},
|
|
67
|
+
divider: {
|
|
68
|
+
default: "#e2e4ff",
|
|
69
|
+
},
|
|
70
|
+
action: {
|
|
71
|
+
button: "rgba(0,0,0,.54)",
|
|
72
|
+
hover: "rgba(0,0,0,.08)",
|
|
73
|
+
disabled: "rgba(0,0,0,.12)",
|
|
74
|
+
},
|
|
75
|
+
headRow: {
|
|
76
|
+
background: "black",
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
//Documentación de la tabla https://react-data-table-component.netlify.app/?path=/docs/getting-started-intro--docs
|
|
80
|
+
export const ZauruTable = (props) => {
|
|
81
|
+
const { columns, conditionalRowStyles, data, loading = false, pagination, search, expandable, theme, className, offlineSearch = [], whitOutPagination = false, ...others } = props;
|
|
82
|
+
const [, setSearchParams] = useSearchParams({
|
|
83
|
+
page: "1",
|
|
84
|
+
perPage: "10",
|
|
85
|
+
search: "",
|
|
86
|
+
});
|
|
87
|
+
const [filteredData, setFilteredData] = useState(data);
|
|
88
|
+
const [showTable, setShowTable] = useState(false);
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
setShowTable(true);
|
|
91
|
+
}, []);
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
setFilteredData(data);
|
|
94
|
+
}, [data]);
|
|
95
|
+
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) => {
|
|
96
|
+
const searchTerm = event.target.value;
|
|
97
|
+
if (offlineSearch.length > 0) {
|
|
98
|
+
filterData(searchTerm);
|
|
99
|
+
}
|
|
100
|
+
}, onBlur: (event) => {
|
|
101
|
+
const searchTerm = event.target.value;
|
|
102
|
+
if (offlineSearch.length <= 0 && search) {
|
|
103
|
+
setSearchParams((prevState) => ({
|
|
104
|
+
...Object.fromEntries(prevState),
|
|
105
|
+
search: searchTerm,
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
} }), _jsx("button", { type: "button", name: "search", className: "px-2 font-bold", children: _jsx(SearchSVG, {}) })] }));
|
|
109
|
+
const filterData = (searchTerm) => {
|
|
110
|
+
if (!searchTerm || !offlineSearch || offlineSearch.length === 0) {
|
|
111
|
+
setFilteredData(data);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const filtered = data.filter((item) => offlineSearch.some((field) => item[field] &&
|
|
115
|
+
item[field]
|
|
116
|
+
.toString()
|
|
117
|
+
.toLowerCase()
|
|
118
|
+
.includes(searchTerm.toLowerCase())));
|
|
119
|
+
setFilteredData(filtered);
|
|
120
|
+
};
|
|
121
|
+
const handlePageChange = (page) => {
|
|
122
|
+
//hacer el fetch de más datos
|
|
123
|
+
setSearchParams((prevState) => ({
|
|
124
|
+
...Object.fromEntries(prevState),
|
|
125
|
+
page: page.toString(),
|
|
126
|
+
}));
|
|
127
|
+
};
|
|
128
|
+
const handlePerRowsChange = async (newPerPage, page) => {
|
|
129
|
+
//hacer el fetch de más datos
|
|
130
|
+
setSearchParams((prevState) => ({
|
|
131
|
+
...Object.fromEntries(prevState),
|
|
132
|
+
perPage: newPerPage.toString(),
|
|
133
|
+
}));
|
|
134
|
+
};
|
|
135
|
+
if (!showTable) {
|
|
136
|
+
return _jsx(_Fragment, { children: "Loading..." });
|
|
137
|
+
}
|
|
138
|
+
//Textos en español de la tabla
|
|
139
|
+
const paginationComponentOptions = {
|
|
140
|
+
rowsPerPageText: "Filas por página",
|
|
141
|
+
rangeSeparatorText: "de",
|
|
142
|
+
selectAllRowsItem: true,
|
|
143
|
+
selectAllRowsItemText: "Todos",
|
|
144
|
+
};
|
|
145
|
+
const loadSubHeader = !!(search || offlineSearch.length > 0);
|
|
146
|
+
const subHeaderComponent = loadSubHeader ? subHeaderComponentMemo : undefined;
|
|
147
|
+
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 }));
|
|
148
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ZauruTable";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ZauruTable";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type TaskType = {
|
|
2
|
+
title: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
status: "waiting" | "processing" | "done" | "error";
|
|
5
|
+
};
|
|
6
|
+
type TaskProps = {
|
|
7
|
+
task: TaskType;
|
|
8
|
+
};
|
|
9
|
+
export declare const Task: ({ task }: TaskProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
type TaskModalProps = {
|
|
11
|
+
tasks: TaskType[];
|
|
12
|
+
};
|
|
13
|
+
export declare const TaskList: ({ tasks }: TaskModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -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";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./TaskList";
|
|
@@ -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 @@
|
|
|
1
|
+
export declare const TitleH1: ({ texto }: any) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -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 @@
|
|
|
1
|
+
export declare const TitleH2: ({ texto }: any) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -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 @@
|
|
|
1
|
+
export declare const TitleH3: ({ texto }: any) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -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";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Tooltip";
|
|
@@ -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";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./WithTooltip";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export type StepWizard = {
|
|
4
|
+
index: number;
|
|
5
|
+
stepName: string;
|
|
6
|
+
component: ReactNode;
|
|
7
|
+
};
|
|
8
|
+
interface StepWizardProps {
|
|
9
|
+
steps: StepWizard[];
|
|
10
|
+
showStepName?: boolean;
|
|
11
|
+
loading?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const StepWizardComponent: React.FC<StepWizardProps>;
|
|
14
|
+
export {};
|
|
@@ -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 "src";
|
|
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";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./StepWizard";
|
package/dist/index.d.ts
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export * from "./Alerts";
|
|
2
|
+
export * from "./BlockUI";
|
|
3
|
+
export * from "./Buttons";
|
|
4
|
+
export * from "./Card";
|
|
5
|
+
export * from "./Containers";
|
|
6
|
+
export * from "./Footer";
|
|
7
|
+
export * from "./Labels";
|
|
8
|
+
export * from "./Layouts";
|
|
9
|
+
export * from "./LineSeparator";
|
|
10
|
+
export * from "./Modal";
|
|
11
|
+
export * from "./NavBar";
|
|
12
|
+
export * from "./Skeletons";
|
|
13
|
+
export * from "./Tab";
|
|
14
|
+
export * from "./Table";
|
|
15
|
+
export * from "./TaskList";
|
|
16
|
+
export * from "./Titles";
|
|
17
|
+
export * from "./Tooltip";
|
|
18
|
+
export * from "./WithTooltip";
|
|
19
|
+
export * from "./Wizards";
|
package/dist/index.js
CHANGED
|
@@ -1 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
export * from "./Alerts";
|
|
2
|
+
export * from "./BlockUI";
|
|
3
|
+
export * from "./Buttons";
|
|
4
|
+
export * from "./Card";
|
|
5
|
+
//export * from "./Chat";
|
|
6
|
+
export * from "./Containers";
|
|
7
|
+
export * from "./Footer";
|
|
8
|
+
export * from "./Labels";
|
|
9
|
+
export * from "./Layouts";
|
|
10
|
+
export * from "./LineSeparator";
|
|
11
|
+
export * from "./Modal";
|
|
12
|
+
export * from "./NavBar";
|
|
13
|
+
export * from "./Skeletons";
|
|
14
|
+
export * from "./Tab";
|
|
15
|
+
export * from "./Table";
|
|
16
|
+
export * from "./TaskList";
|
|
17
|
+
export * from "./Titles";
|
|
18
|
+
export * from "./Tooltip";
|
|
19
|
+
export * from "./WithTooltip";
|
|
20
|
+
export * from "./Wizards";
|
|
21
|
+
//export * from "./Zendesk";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zauru-sdk/components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "Componentes reutilizables en las WebApps de Zauru.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -31,11 +31,14 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@reduxjs/toolkit": "^2.2.1",
|
|
33
33
|
"@remix-run/react": "^2.8.1",
|
|
34
|
+
"@zauru-sdk/common": "^1.0.13",
|
|
34
35
|
"@zauru-sdk/graphql": "^1.0.9",
|
|
35
|
-
"@zauru-sdk/
|
|
36
|
-
"@zauru-sdk/
|
|
37
|
-
"@zauru-sdk/
|
|
36
|
+
"@zauru-sdk/icons": "^1.0.13",
|
|
37
|
+
"@zauru-sdk/services": "^1.0.13",
|
|
38
|
+
"@zauru-sdk/types": "^1.0.13",
|
|
39
|
+
"@zauru-sdk/utils": "^1.0.13",
|
|
38
40
|
"framer-motion": "^11.0.8",
|
|
41
|
+
"jsonwebtoken": "9.0.2",
|
|
39
42
|
"react": "^18.2.0",
|
|
40
43
|
"react-dom": "^18.2.0",
|
|
41
44
|
"react-is": "^18.2.0",
|
|
@@ -45,5 +48,5 @@
|
|
|
45
48
|
"engines": {
|
|
46
49
|
"node": ">=18.0.0"
|
|
47
50
|
},
|
|
48
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "9bca61fddd7c538e7f95a489d59436b5557c61cc"
|
|
49
52
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
type Props = {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
active: boolean;
|
|
6
|
+
loadingText?: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const BlockUI = (props: Props) => {
|
|
10
|
+
const { children, active, loadingText } = props;
|
|
11
|
+
|
|
12
|
+
if (!active) {
|
|
13
|
+
return <>{children}</>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<div>
|
|
18
|
+
<div className="relative">
|
|
19
|
+
<div className="absolute bg-gray-100 bg-opacity-20 z-10 h-full w-full flex items-center justify-center">
|
|
20
|
+
<div className="flex items-center">
|
|
21
|
+
<span className="text-3xl mr-4">{loadingText}</span>
|
|
22
|
+
{/* <!-- loading icon --> */}
|
|
23
|
+
<svg
|
|
24
|
+
className="animate-spin h-5 w-5 text-gray-600"
|
|
25
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
26
|
+
fill="none"
|
|
27
|
+
viewBox="0 0 24 24"
|
|
28
|
+
>
|
|
29
|
+
<circle
|
|
30
|
+
className="opacity-25"
|
|
31
|
+
cx="12"
|
|
32
|
+
cy="12"
|
|
33
|
+
r="10"
|
|
34
|
+
stroke="currentColor"
|
|
35
|
+
strokeWidth="4"
|
|
36
|
+
></circle>
|
|
37
|
+
<path
|
|
38
|
+
className="opacity-75"
|
|
39
|
+
fill="currentColor"
|
|
40
|
+
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
41
|
+
></path>
|
|
42
|
+
</svg>
|
|
43
|
+
{/* <!-- end loading icon --> */}
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
{children}
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./BlockUI";
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { ColorInterface } from "../NavBar/NavBar.types";
|
|
2
|
+
|
|
3
|
+
type Props = {
|
|
4
|
+
type?: "reset" | "button" | "submit" | undefined;
|
|
5
|
+
title?: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
onClickSave?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
8
|
+
//Cargando...
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
loadingText?: string;
|
|
11
|
+
selectedColor?: "indigo" | "green" | "red" | "yellow";
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
className?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const Button = (props: Props) => {
|
|
18
|
+
const {
|
|
19
|
+
type = "submit",
|
|
20
|
+
loading = false,
|
|
21
|
+
loadingText = "Guardando...",
|
|
22
|
+
title = "Guardar",
|
|
23
|
+
name = "save",
|
|
24
|
+
onClickSave,
|
|
25
|
+
selectedColor = "indigo",
|
|
26
|
+
children,
|
|
27
|
+
className = "",
|
|
28
|
+
disabled = false,
|
|
29
|
+
} = props;
|
|
30
|
+
|
|
31
|
+
const COLORS = {
|
|
32
|
+
green: {
|
|
33
|
+
bg900: "bg-green-900",
|
|
34
|
+
bg700: "bg-green-700",
|
|
35
|
+
bg600: "bg-green-600",
|
|
36
|
+
bg500: "bg-green-500",
|
|
37
|
+
ring600: "ring-green-600",
|
|
38
|
+
ring500: "ring-green-500",
|
|
39
|
+
},
|
|
40
|
+
indigo: {
|
|
41
|
+
bg900: "bg-indigo-900",
|
|
42
|
+
bg700: "bg-indigo-700",
|
|
43
|
+
bg600: "bg-indigo-600",
|
|
44
|
+
bg500: "bg-indigo-500",
|
|
45
|
+
ring600: "ring-indigo-600",
|
|
46
|
+
ring500: "ring-indigo-500",
|
|
47
|
+
},
|
|
48
|
+
red: {
|
|
49
|
+
bg900: "bg-red-900",
|
|
50
|
+
bg700: "bg-red-700",
|
|
51
|
+
bg600: "bg-red-600",
|
|
52
|
+
bg500: "bg-red-500",
|
|
53
|
+
ring600: "ring-red-600",
|
|
54
|
+
ring500: "ring-red-500",
|
|
55
|
+
},
|
|
56
|
+
yellow: {
|
|
57
|
+
bg900: "bg-yellow-900",
|
|
58
|
+
bg700: "bg-yellow-700",
|
|
59
|
+
bg600: "bg-yellow-600",
|
|
60
|
+
bg500: "bg-yellow-500",
|
|
61
|
+
ring600: "ring-yellow-600",
|
|
62
|
+
ring500: "ring-yellow-500",
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const color: ColorInterface = COLORS[selectedColor];
|
|
67
|
+
|
|
68
|
+
const inside = children ?? title;
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<button
|
|
72
|
+
type={type}
|
|
73
|
+
name="action"
|
|
74
|
+
disabled={loading || disabled}
|
|
75
|
+
value={name}
|
|
76
|
+
onClick={onClickSave}
|
|
77
|
+
className={`ml-2 ${loading || disabled ? " bg-opacity-25 " : ""} ${
|
|
78
|
+
loading
|
|
79
|
+
? " cursor-progress"
|
|
80
|
+
: `${disabled ? "" : `hover:${color.bg700}`}`
|
|
81
|
+
} inline-flex justify-center rounded-md border border-transparent ${
|
|
82
|
+
color.bg600
|
|
83
|
+
} py-2 px-4 text-sm font-medium text-white shadow-sm focus:outline-none focus:ring-2 focus:${
|
|
84
|
+
color.ring500
|
|
85
|
+
} focus:ring-offset-2 ${className}`}
|
|
86
|
+
>
|
|
87
|
+
{loading ? loadingText : inside}
|
|
88
|
+
</button>
|
|
89
|
+
);
|
|
90
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Button";
|