@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
package/src/Tab/Tab.tsx
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { redirect } from "@remix-run/node";
|
|
2
|
+
import { Outlet } from "@remix-run/react";
|
|
3
|
+
import React from "react";
|
|
4
|
+
|
|
5
|
+
export type TabItem = { title: string; link: string };
|
|
6
|
+
|
|
7
|
+
type Props = {
|
|
8
|
+
items: Array<TabItem>;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
//<reference> https://www.creative-tim.com/learning-lab/tailwind-starter-kit/documentation/react/tabs/text
|
|
12
|
+
export const Tabs = (props: Props) => {
|
|
13
|
+
const { items } = props;
|
|
14
|
+
const [openTab, setOpenTab] = React.useState(1);
|
|
15
|
+
return (
|
|
16
|
+
<>
|
|
17
|
+
<div className="flex flex-wrap">
|
|
18
|
+
<div className="w-full">
|
|
19
|
+
<ul
|
|
20
|
+
className="flex mb-0 list-none flex-wrap pt-3 pb-4 flex-row"
|
|
21
|
+
role="tablist"
|
|
22
|
+
>
|
|
23
|
+
{items?.map((item: TabItem, index: number) => {
|
|
24
|
+
return (
|
|
25
|
+
<li
|
|
26
|
+
key={index}
|
|
27
|
+
className="mb-px mr-2 last:mr-0 flex-auto text-center"
|
|
28
|
+
>
|
|
29
|
+
<a
|
|
30
|
+
key={index}
|
|
31
|
+
className={
|
|
32
|
+
"text-xs font-bold uppercase px-5 py-3 shadow-lg rounded block leading-normal " +
|
|
33
|
+
(openTab === index
|
|
34
|
+
? "text-white bg-red-600"
|
|
35
|
+
: "text-red-600 bg-white")
|
|
36
|
+
}
|
|
37
|
+
onClick={(e) => {
|
|
38
|
+
e.preventDefault();
|
|
39
|
+
setOpenTab(index);
|
|
40
|
+
redirect(item.link);
|
|
41
|
+
}}
|
|
42
|
+
data-toggle="tab"
|
|
43
|
+
href={item.link}
|
|
44
|
+
role="tablist"
|
|
45
|
+
>
|
|
46
|
+
{item.title}
|
|
47
|
+
</a>
|
|
48
|
+
</li>
|
|
49
|
+
);
|
|
50
|
+
})}
|
|
51
|
+
</ul>
|
|
52
|
+
<div className="relative flex flex-col min-w-0 break-words bg-white w-full mb-6 shadow-lg rounded">
|
|
53
|
+
<div className="px-4 py-5 flex-auto">
|
|
54
|
+
<div className="tab-content tab-space">
|
|
55
|
+
<Outlet />
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</>
|
|
62
|
+
);
|
|
63
|
+
};
|
package/src/Tab/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Tab";
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { useSearchParams } from "@remix-run/react";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import type {
|
|
4
|
+
PaginationOptions,
|
|
5
|
+
TableProps,
|
|
6
|
+
TableStyles,
|
|
7
|
+
} from "react-data-table-component";
|
|
8
|
+
import DataTable, { createTheme } from "react-data-table-component";
|
|
9
|
+
import { SearchSVG } from "@zauru-sdk/icons";
|
|
10
|
+
import { ExpandableRowsComponent } from "react-data-table-component/dist/DataTable/types";
|
|
11
|
+
|
|
12
|
+
const customStyles: TableStyles = {
|
|
13
|
+
headCells: {
|
|
14
|
+
style: {
|
|
15
|
+
color: "#202124",
|
|
16
|
+
fontSize: "14px",
|
|
17
|
+
justifyContent: "left", // Alinea el texto a la izquierda
|
|
18
|
+
whiteSpace: "normal", // Permite el ajuste de texto
|
|
19
|
+
wordBreak: "break-word", // Asegura que las palabras se rompan correctamente para evitar desbordamientos
|
|
20
|
+
maxWidth: "150px", // Establece un ancho máximo para las celdas del encabezado
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
rows: {
|
|
24
|
+
highlightOnHoverStyle: {
|
|
25
|
+
backgroundColor: "rgb(230, 244, 244)",
|
|
26
|
+
borderBottomColor: "#FFFFFF",
|
|
27
|
+
borderRadius: "25px",
|
|
28
|
+
outline: "1px solid #FFFFFF",
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
pagination: {
|
|
32
|
+
style: {
|
|
33
|
+
border: "none",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
createTheme("solarized", {
|
|
39
|
+
text: {
|
|
40
|
+
primary: "#002b36",
|
|
41
|
+
secondary: "#002b36",
|
|
42
|
+
},
|
|
43
|
+
background: {
|
|
44
|
+
default: "#f9f9f9",
|
|
45
|
+
},
|
|
46
|
+
context: {
|
|
47
|
+
background: "#cb4b16",
|
|
48
|
+
text: "#555555",
|
|
49
|
+
},
|
|
50
|
+
divider: {
|
|
51
|
+
default: "#e2e4ff",
|
|
52
|
+
},
|
|
53
|
+
action: {
|
|
54
|
+
button: "rgba(0,0,0,.54)",
|
|
55
|
+
hover: "rgba(0,0,0,.08)",
|
|
56
|
+
disabled: "rgba(0,0,0,.12)",
|
|
57
|
+
},
|
|
58
|
+
headRow: {
|
|
59
|
+
background: "black",
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
createTheme("subTable", {
|
|
64
|
+
text: {
|
|
65
|
+
primary: "#002b36",
|
|
66
|
+
secondary: "#002b36",
|
|
67
|
+
},
|
|
68
|
+
background: {
|
|
69
|
+
default: "#e9e9e9",
|
|
70
|
+
},
|
|
71
|
+
context: {
|
|
72
|
+
background: "#cb4b16",
|
|
73
|
+
text: "#555555",
|
|
74
|
+
},
|
|
75
|
+
divider: {
|
|
76
|
+
default: "#e2e4ff",
|
|
77
|
+
},
|
|
78
|
+
action: {
|
|
79
|
+
button: "rgba(0,0,0,.54)",
|
|
80
|
+
hover: "rgba(0,0,0,.08)",
|
|
81
|
+
disabled: "rgba(0,0,0,.12)",
|
|
82
|
+
},
|
|
83
|
+
headRow: {
|
|
84
|
+
background: "black",
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
type Props = TableProps<any> & {
|
|
89
|
+
columns: any;
|
|
90
|
+
conditionalRowStyles?: any;
|
|
91
|
+
data: any[];
|
|
92
|
+
loading?: boolean;
|
|
93
|
+
pagination?: {
|
|
94
|
+
totalRows: number;
|
|
95
|
+
rowsPerPageOptions: number[];
|
|
96
|
+
};
|
|
97
|
+
whitOutPagination?: boolean;
|
|
98
|
+
offlineSearch?: string[];
|
|
99
|
+
search?: {
|
|
100
|
+
placeholderSearch?: string;
|
|
101
|
+
};
|
|
102
|
+
expandable?: {
|
|
103
|
+
expandableRowExpanded?: (row: any) => boolean;
|
|
104
|
+
expandableRowsComponent?: ExpandableRowsComponent<any>;
|
|
105
|
+
};
|
|
106
|
+
theme?: "solarized" | "subTable";
|
|
107
|
+
className?: string;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
//Documentación de la tabla https://react-data-table-component.netlify.app/?path=/docs/getting-started-intro--docs
|
|
111
|
+
export const ZauruTable = (props: Props) => {
|
|
112
|
+
const {
|
|
113
|
+
columns,
|
|
114
|
+
conditionalRowStyles,
|
|
115
|
+
data,
|
|
116
|
+
loading = false,
|
|
117
|
+
pagination,
|
|
118
|
+
search,
|
|
119
|
+
expandable,
|
|
120
|
+
theme,
|
|
121
|
+
className,
|
|
122
|
+
offlineSearch = [],
|
|
123
|
+
whitOutPagination = false,
|
|
124
|
+
...others
|
|
125
|
+
} = props;
|
|
126
|
+
|
|
127
|
+
const [, setSearchParams] = useSearchParams({
|
|
128
|
+
page: "1",
|
|
129
|
+
perPage: "10",
|
|
130
|
+
search: "",
|
|
131
|
+
});
|
|
132
|
+
const [filteredData, setFilteredData] = useState(data);
|
|
133
|
+
|
|
134
|
+
const [showTable, setShowTable] = useState<boolean>(false);
|
|
135
|
+
|
|
136
|
+
useEffect(() => {
|
|
137
|
+
setShowTable(true);
|
|
138
|
+
}, []);
|
|
139
|
+
|
|
140
|
+
useEffect(() => {
|
|
141
|
+
setFilteredData(data);
|
|
142
|
+
}, [data]);
|
|
143
|
+
|
|
144
|
+
const subHeaderComponentMemo = (
|
|
145
|
+
<>
|
|
146
|
+
<input
|
|
147
|
+
name="search"
|
|
148
|
+
type="text"
|
|
149
|
+
placeholder={search?.placeholderSearch ?? "Filtrar"}
|
|
150
|
+
aria-label="Search Input"
|
|
151
|
+
className="bg-gray-50 border border-gray-300 text-gray-900 rounded-lg px-2"
|
|
152
|
+
onChange={(event) => {
|
|
153
|
+
const searchTerm = event.target.value;
|
|
154
|
+
if (offlineSearch.length > 0) {
|
|
155
|
+
filterData(searchTerm);
|
|
156
|
+
}
|
|
157
|
+
}}
|
|
158
|
+
onBlur={(event) => {
|
|
159
|
+
const searchTerm = event.target.value;
|
|
160
|
+
if (offlineSearch.length <= 0 && search) {
|
|
161
|
+
setSearchParams((prevState: URLSearchParams) => ({
|
|
162
|
+
...Object.fromEntries(prevState),
|
|
163
|
+
search: searchTerm,
|
|
164
|
+
}));
|
|
165
|
+
}
|
|
166
|
+
}}
|
|
167
|
+
/>
|
|
168
|
+
<button type="button" name="search" className="px-2 font-bold">
|
|
169
|
+
<SearchSVG />
|
|
170
|
+
</button>
|
|
171
|
+
</>
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
const filterData = (searchTerm: string) => {
|
|
175
|
+
if (!searchTerm || !offlineSearch || offlineSearch.length === 0) {
|
|
176
|
+
setFilteredData(data);
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const filtered = data.filter((item) =>
|
|
181
|
+
offlineSearch.some(
|
|
182
|
+
(field) =>
|
|
183
|
+
item[field] &&
|
|
184
|
+
item[field]
|
|
185
|
+
.toString()
|
|
186
|
+
.toLowerCase()
|
|
187
|
+
.includes(searchTerm.toLowerCase())
|
|
188
|
+
)
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
setFilteredData(filtered);
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
const handlePageChange = (page: number) => {
|
|
195
|
+
//hacer el fetch de más datos
|
|
196
|
+
setSearchParams((prevState: URLSearchParams) => ({
|
|
197
|
+
...Object.fromEntries(prevState),
|
|
198
|
+
page: page.toString(),
|
|
199
|
+
}));
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
const handlePerRowsChange = async (newPerPage: number, page: number) => {
|
|
203
|
+
//hacer el fetch de más datos
|
|
204
|
+
setSearchParams((prevState: URLSearchParams) => ({
|
|
205
|
+
...Object.fromEntries(prevState),
|
|
206
|
+
perPage: newPerPage.toString(),
|
|
207
|
+
}));
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
if (!showTable) {
|
|
211
|
+
return <>Loading...</>;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
//Textos en español de la tabla
|
|
215
|
+
const paginationComponentOptions = {
|
|
216
|
+
rowsPerPageText: "Filas por página",
|
|
217
|
+
rangeSeparatorText: "de",
|
|
218
|
+
selectAllRowsItem: true,
|
|
219
|
+
selectAllRowsItemText: "Todos",
|
|
220
|
+
} as PaginationOptions;
|
|
221
|
+
|
|
222
|
+
const loadSubHeader = !!(search || offlineSearch.length > 0);
|
|
223
|
+
const subHeaderComponent = loadSubHeader ? subHeaderComponentMemo : undefined;
|
|
224
|
+
|
|
225
|
+
return (
|
|
226
|
+
<DataTable
|
|
227
|
+
className={className}
|
|
228
|
+
subHeaderWrap
|
|
229
|
+
theme={theme ?? "solarized"}
|
|
230
|
+
columns={columns}
|
|
231
|
+
conditionalRowStyles={conditionalRowStyles}
|
|
232
|
+
data={filteredData}
|
|
233
|
+
customStyles={customStyles}
|
|
234
|
+
progressPending={loading}
|
|
235
|
+
highlightOnHover
|
|
236
|
+
pointerOnHover
|
|
237
|
+
dense
|
|
238
|
+
striped
|
|
239
|
+
pagination={!whitOutPagination}
|
|
240
|
+
persistTableHead
|
|
241
|
+
responsive
|
|
242
|
+
noHeader
|
|
243
|
+
expandableRows={!!expandable}
|
|
244
|
+
expandableRowExpanded={
|
|
245
|
+
expandable ? expandable.expandableRowExpanded : undefined
|
|
246
|
+
}
|
|
247
|
+
expandableRowsComponent={
|
|
248
|
+
expandable ? expandable.expandableRowsComponent : undefined
|
|
249
|
+
}
|
|
250
|
+
subHeader={loadSubHeader}
|
|
251
|
+
subHeaderComponent={subHeaderComponent}
|
|
252
|
+
paginationServer={!!pagination}
|
|
253
|
+
paginationTotalRows={pagination ? pagination.totalRows : undefined}
|
|
254
|
+
onChangeRowsPerPage={pagination ? handlePerRowsChange : undefined}
|
|
255
|
+
onChangePage={pagination ? handlePageChange : undefined}
|
|
256
|
+
paginationComponentOptions={paginationComponentOptions}
|
|
257
|
+
paginationRowsPerPageOptions={
|
|
258
|
+
pagination?.rowsPerPageOptions ? pagination.rowsPerPageOptions : [10]
|
|
259
|
+
}
|
|
260
|
+
{...others}
|
|
261
|
+
/>
|
|
262
|
+
);
|
|
263
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ZauruTable";
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
|
|
3
|
+
export type TaskType = {
|
|
4
|
+
title: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
status: "waiting" | "processing" | "done" | "error";
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
type TaskProps = {
|
|
10
|
+
task: TaskType;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const Task = ({ task }: TaskProps) => {
|
|
14
|
+
const [isDescriptionOpen, setIsDescriptionOpen] = useState(false);
|
|
15
|
+
let statusIcon;
|
|
16
|
+
let taskStyle = {};
|
|
17
|
+
let bgColor;
|
|
18
|
+
|
|
19
|
+
switch (task.status) {
|
|
20
|
+
case "waiting":
|
|
21
|
+
statusIcon = "🕗"; // Icono de reloj (como un ejemplo, puedes reemplazarlo con un ícono o SVG real)
|
|
22
|
+
taskStyle = { opacity: 0.5 }; // estilo disabled
|
|
23
|
+
bgColor = "bg-gray-200"; // Color de fondo gris
|
|
24
|
+
break;
|
|
25
|
+
case "processing":
|
|
26
|
+
statusIcon = "⏳"; // Icono de reloj de arena
|
|
27
|
+
taskStyle = { fontWeight: "bold" }; // estilo negrita
|
|
28
|
+
bgColor = "bg-blue-200"; // Color de fondo azul
|
|
29
|
+
break;
|
|
30
|
+
case "done":
|
|
31
|
+
statusIcon = "✅"; // Icono de check
|
|
32
|
+
bgColor = "bg-green-200"; // Color de fondo verde
|
|
33
|
+
break;
|
|
34
|
+
case "error":
|
|
35
|
+
statusIcon = "❌"; // Icono de cruz
|
|
36
|
+
taskStyle = { color: "red" }; // estilo color rojo
|
|
37
|
+
bgColor = "bg-red-200"; // Color de fondo rojo
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<div
|
|
43
|
+
style={taskStyle}
|
|
44
|
+
className={`${bgColor} rounded-lg p-3 mb-3 ${
|
|
45
|
+
task.description ? "cursor-pointer" : ""
|
|
46
|
+
}`}
|
|
47
|
+
onClick={() =>
|
|
48
|
+
task.description && setIsDescriptionOpen(!isDescriptionOpen)
|
|
49
|
+
}
|
|
50
|
+
>
|
|
51
|
+
<div className="flex justify-between">
|
|
52
|
+
<div>
|
|
53
|
+
{statusIcon} {task.title}{" "}
|
|
54
|
+
{`${task.status === "processing" ? "..." : ""}`}
|
|
55
|
+
</div>
|
|
56
|
+
{task.description && <div>▼</div>}
|
|
57
|
+
</div>
|
|
58
|
+
{task.description && isDescriptionOpen && (
|
|
59
|
+
<div className="mt-2">{task.description}</div>
|
|
60
|
+
)}
|
|
61
|
+
</div>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
type TaskModalProps = {
|
|
66
|
+
tasks: TaskType[];
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const TaskList = ({ tasks }: TaskModalProps) => {
|
|
70
|
+
const completedTasks = tasks.filter(
|
|
71
|
+
(task) => task.status === "done" || task.status === "error"
|
|
72
|
+
).length;
|
|
73
|
+
const progressPercentage = (completedTasks / tasks.length) * 100;
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<div>
|
|
77
|
+
{tasks.map((task, index) => (
|
|
78
|
+
<Task key={index} task={task} />
|
|
79
|
+
))}
|
|
80
|
+
<div className="h-2 bg-gray-200 rounded-lg mt-3">
|
|
81
|
+
<div
|
|
82
|
+
className="bg-green-500 h-full rounded-lg"
|
|
83
|
+
style={{ width: `${progressPercentage}%`, transition: "width 0.5s" }}
|
|
84
|
+
></div>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
);
|
|
88
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./TaskList";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SelectFieldOption } from "@zauru-sdk/types";
|
|
2
|
+
|
|
3
|
+
//Component to show all information in an array
|
|
4
|
+
export const LabelArray = ({ info }: { info: SelectFieldOption[] }) => {
|
|
5
|
+
return (
|
|
6
|
+
<div className="divide-y divide-gray-100">
|
|
7
|
+
{info?.map((x: any) => {
|
|
8
|
+
return (
|
|
9
|
+
<div key={x?.label} className="my-1 pt-2">
|
|
10
|
+
<p className="inline font-bold text-lg">{x?.label}: </p>
|
|
11
|
+
<p className="inline text-lg">{x?.value}</p>
|
|
12
|
+
</div>
|
|
13
|
+
);
|
|
14
|
+
})}
|
|
15
|
+
</div>
|
|
16
|
+
);
|
|
17
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type tableColumnTitleProps = {
|
|
2
|
+
textContent: String;
|
|
3
|
+
};
|
|
4
|
+
//column title for datatables
|
|
5
|
+
export const TableColumnTitle = ({ textContent }: tableColumnTitleProps) => {
|
|
6
|
+
return (
|
|
7
|
+
<p className="font-bold text-sm line-clamp-3 text-center">{textContent}</p>
|
|
8
|
+
);
|
|
9
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React, { useState } from "react";
|
|
4
|
+
|
|
5
|
+
type Props = {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
text: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const Tooltip = ({ children, text }: Props) => {
|
|
11
|
+
const [show, setShow] = useState(false);
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<div className="relative inline-block">
|
|
15
|
+
<div
|
|
16
|
+
onMouseEnter={() => setShow(true)}
|
|
17
|
+
onMouseLeave={() => setShow(false)}
|
|
18
|
+
>
|
|
19
|
+
{children}
|
|
20
|
+
</div>
|
|
21
|
+
{show && (
|
|
22
|
+
<div
|
|
23
|
+
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"
|
|
24
|
+
style={{ whiteSpace: "nowrap", height: "2rem" }}
|
|
25
|
+
>
|
|
26
|
+
{text}
|
|
27
|
+
<div
|
|
28
|
+
className="absolute top-full left-1/2 transform -translate-x-1/2"
|
|
29
|
+
style={{
|
|
30
|
+
width: "0",
|
|
31
|
+
height: "0",
|
|
32
|
+
borderTop: "6px solid transparent",
|
|
33
|
+
borderLeft: "6px solid transparent",
|
|
34
|
+
borderRight: "6px solid transparent",
|
|
35
|
+
borderBottom: "6px solid gray",
|
|
36
|
+
}}
|
|
37
|
+
></div>
|
|
38
|
+
</div>
|
|
39
|
+
)}
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Tooltip";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
type Props = {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
text: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const WithTooltip = (props: Props) => {
|
|
9
|
+
const { children, text } = props;
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<>
|
|
13
|
+
<span className="group relative">
|
|
14
|
+
{children}
|
|
15
|
+
<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">
|
|
16
|
+
{text}
|
|
17
|
+
</span>
|
|
18
|
+
</span>
|
|
19
|
+
</>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./WithTooltip";
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
import { LoadingInputSkeleton } from "src";
|
|
4
|
+
|
|
5
|
+
export type StepWizard = {
|
|
6
|
+
index: number;
|
|
7
|
+
stepName: string;
|
|
8
|
+
component: ReactNode;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
interface StepWizardProps {
|
|
12
|
+
steps: StepWizard[];
|
|
13
|
+
showStepName?: boolean;
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const StepWizardComponent: React.FC<StepWizardProps> = ({
|
|
18
|
+
steps,
|
|
19
|
+
showStepName = false,
|
|
20
|
+
loading = false,
|
|
21
|
+
}) => {
|
|
22
|
+
const [currentStep, setCurrentStep] = useState(0);
|
|
23
|
+
|
|
24
|
+
if (loading) {
|
|
25
|
+
return (
|
|
26
|
+
<div className="lg:grid lg:grid-cols-10 gap-4">
|
|
27
|
+
<div className="lg:col-span-2">
|
|
28
|
+
<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">
|
|
29
|
+
<option></option>
|
|
30
|
+
</select>
|
|
31
|
+
<div className="hidden lg:block">
|
|
32
|
+
<LoadingInputSkeleton />
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
<div className="lg:col-span-8">
|
|
36
|
+
<LoadingInputSkeleton />
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div className="lg:grid lg:grid-cols-10 gap-4">
|
|
44
|
+
<div className="lg:col-span-2">
|
|
45
|
+
<select
|
|
46
|
+
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"
|
|
47
|
+
onChange={(e) => setCurrentStep(parseInt(e.target.value))}
|
|
48
|
+
value={currentStep}
|
|
49
|
+
>
|
|
50
|
+
{steps.map((step, index) => (
|
|
51
|
+
<option key={index} value={index}>
|
|
52
|
+
{showStepName ? step.stepName : `Step ${index + 1}`}
|
|
53
|
+
</option>
|
|
54
|
+
))}
|
|
55
|
+
</select>
|
|
56
|
+
<div className="scroll-hidden hidden lg:block">
|
|
57
|
+
{steps.map((step, index) => (
|
|
58
|
+
<div
|
|
59
|
+
key={index}
|
|
60
|
+
onClick={() => setCurrentStep(index)}
|
|
61
|
+
className={`py-2 px-4 mt-5 cursor-pointer rounded ${
|
|
62
|
+
currentStep === index
|
|
63
|
+
? "bg-blue-500 text-white"
|
|
64
|
+
: "text-blue-500 hover:bg-gray-100 border border-gray-300"
|
|
65
|
+
} ${
|
|
66
|
+
showStepName
|
|
67
|
+
? "text-wrap break-words"
|
|
68
|
+
: "rounded-full w-8 h-8 flex items-center justify-center"
|
|
69
|
+
}`}
|
|
70
|
+
>
|
|
71
|
+
{showStepName ? step.stepName : index + 1}
|
|
72
|
+
</div>
|
|
73
|
+
))}
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
<div className="lg:col-span-8">
|
|
77
|
+
{steps.map((step, index) => (
|
|
78
|
+
<div
|
|
79
|
+
key={index}
|
|
80
|
+
className={currentStep === index ? "block" : "hidden"}
|
|
81
|
+
>
|
|
82
|
+
{step.component}
|
|
83
|
+
</div>
|
|
84
|
+
))}
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
);
|
|
88
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./StepWizard";
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
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/dist/Alerts/Alert.d.ts
DELETED