@zauru-sdk/components 1.0.54 → 1.0.60

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.
Files changed (94) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/LICENCE.md +11 -11
  3. package/package.json +7 -7
  4. package/src/Alerts/ErrorBoundaryAlert/ErrorBoundaryAlert.tsx +66 -66
  5. package/src/Alerts/StaticAlert.tsx +121 -121
  6. package/src/Alerts/index.ts +2 -2
  7. package/src/BlockUI/BlockUI.tsx +50 -50
  8. package/src/BlockUI/index.tsx +1 -1
  9. package/src/Buttons/Button.tsx +90 -90
  10. package/src/Buttons/index.ts +1 -1
  11. package/src/Card/Card.tsx +24 -24
  12. package/src/Card/index.ts +1 -1
  13. package/src/Chat/ChatLayout.tsx +131 -131
  14. package/src/Chat/ChatMessageHistory.tsx +142 -142
  15. package/src/Chat/index.ts +2 -2
  16. package/src/ConnectionState/ConnectionState.tsx +27 -27
  17. package/src/ConnectionState/index.tsx +1 -1
  18. package/src/Containers/BodyContainer.tsx +14 -14
  19. package/src/Containers/ButtonSectionContainer.tsx +21 -21
  20. package/src/Containers/Container.tsx +39 -39
  21. package/src/Containers/DoubleContainer.tsx +48 -48
  22. package/src/Containers/MainContainer.tsx +17 -17
  23. package/src/Containers/OutletContainer.tsx +14 -14
  24. package/src/Containers/SubContainer.tsx +37 -37
  25. package/src/Containers/index.ts +7 -7
  26. package/src/DynamicTable/BasicPrintDynamicTable.tsx +73 -73
  27. package/src/DynamicTable/DynamicPrintTable.tsx +288 -288
  28. package/src/DynamicTable/DynamicTable.tsx +405 -405
  29. package/src/DynamicTable/GenericDynamicTable.tsx +456 -456
  30. package/src/DynamicTable/index.tsx +4 -4
  31. package/src/Footer/Footer.tsx +50 -50
  32. package/src/Footer/index.tsx +1 -1
  33. package/src/Form/Checkbox/index.tsx +96 -96
  34. package/src/Form/Checklist/index.tsx +35 -35
  35. package/src/Form/DatePicker/index.tsx +132 -132
  36. package/src/Form/DynamicBaculoForm/index.tsx +361 -361
  37. package/src/Form/FieldContainer/DoubleFieldContainer.tsx +35 -35
  38. package/src/Form/FieldContainer/QuadrupleFieldContainer.tsx +36 -36
  39. package/src/Form/FieldContainer/TripleFieldContainer.tsx +35 -35
  40. package/src/Form/FieldContainer/index.ts +3 -3
  41. package/src/Form/FileUpload/index.tsx +184 -184
  42. package/src/Form/FormButtons/index.tsx +78 -78
  43. package/src/Form/FormLayout/index.tsx +37 -37
  44. package/src/Form/SelectField/index.tsx +237 -237
  45. package/src/Form/TextArea/index.tsx +125 -125
  46. package/src/Form/TextField/index.tsx +194 -194
  47. package/src/Form/TimePicker/index.tsx +127 -127
  48. package/src/Form/YesNo/index.tsx +77 -77
  49. package/src/Form/index.ts +13 -13
  50. package/src/Labels/InfoLabel/index.tsx +21 -21
  51. package/src/Labels/index.tsx +1 -1
  52. package/src/Layouts/homeLayout/index.tsx +34 -34
  53. package/src/Layouts/index.ts +1 -1
  54. package/src/LineSeparator/LineSeparator.tsx +3 -3
  55. package/src/LineSeparator/index.tsx +1 -1
  56. package/src/Modal/Modal.tsx +104 -104
  57. package/src/Modal/index.tsx +1 -1
  58. package/src/NavBar/NavBar.tsx +223 -223
  59. package/src/NavBar/NavBar.types.ts +64 -64
  60. package/src/NavBar/NavBar.utils.ts +58 -58
  61. package/src/NavBar/index.tsx +5 -5
  62. package/src/ProgressBar/ProgressBar.tsx +25 -25
  63. package/src/ProgressBar/ProgressCircle.tsx +75 -75
  64. package/src/ProgressBar/index.tsx +2 -2
  65. package/src/Skeletons/LoadingInputSkeleton.tsx +12 -12
  66. package/src/Skeletons/index.ts +1 -1
  67. package/src/Tab/Tab.tsx +63 -63
  68. package/src/Tab/index.ts +1 -1
  69. package/src/Table/ZauruTable.tsx +265 -265
  70. package/src/Table/index.tsx +1 -1
  71. package/src/TaskList/TaskList.tsx +88 -88
  72. package/src/TaskList/index.ts +1 -1
  73. package/src/Titles/LabelArray.tsx +17 -17
  74. package/src/Titles/TableColumnTitle.tsx +9 -9
  75. package/src/Titles/TitleH1.tsx +10 -10
  76. package/src/Titles/TitleH2.tsx +10 -10
  77. package/src/Titles/TitleH3.tsx +10 -10
  78. package/src/Titles/index.ts +5 -5
  79. package/src/Tooltip/Tooltip.tsx +42 -42
  80. package/src/Tooltip/index.ts +1 -1
  81. package/src/WithTooltip/WithTooltip.tsx +21 -21
  82. package/src/WithTooltip/index.tsx +1 -1
  83. package/src/Wizards/StepWizard.tsx +88 -88
  84. package/src/Wizards/index.ts +1 -1
  85. package/src/Zendesk/Chat.tsx +83 -83
  86. package/src/Zendesk/index.ts +2 -2
  87. package/src/Zendesk/zendesk.config.ts +40 -40
  88. package/src/index.ts +24 -24
  89. package/src/postcss.config.mjs +5 -5
  90. package/src/tailwind.config.ts +10 -10
  91. package/src/tailwind.css +3 -3
  92. package/tsconfig.cjs.json +8 -8
  93. package/tsconfig.esm.json +11 -11
  94. package/tsconfig.json +17 -17
@@ -1,265 +1,265 @@
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 { createTheme } from "react-data-table-component";
9
- import { SearchSVG } from "@zauru-sdk/icons";
10
- import * as ReactDataTableComponent from "react-data-table-component";
11
- const DataTable = ReactDataTableComponent.default as any;
12
- import { ExpandableRowsComponent } from "react-data-table-component/dist/DataTable/types.js";
13
-
14
- const customStyles: TableStyles = {
15
- headCells: {
16
- style: {
17
- color: "#202124",
18
- fontSize: "14px",
19
- justifyContent: "left", // Alinea el texto a la izquierda
20
- whiteSpace: "normal", // Permite el ajuste de texto
21
- wordBreak: "break-word", // Asegura que las palabras se rompan correctamente para evitar desbordamientos
22
- maxWidth: "150px", // Establece un ancho máximo para las celdas del encabezado
23
- },
24
- },
25
- rows: {
26
- highlightOnHoverStyle: {
27
- backgroundColor: "rgb(230, 244, 244)",
28
- borderBottomColor: "#FFFFFF",
29
- borderRadius: "25px",
30
- outline: "1px solid #FFFFFF",
31
- },
32
- },
33
- pagination: {
34
- style: {
35
- border: "none",
36
- },
37
- },
38
- };
39
-
40
- createTheme("solarized", {
41
- text: {
42
- primary: "#002b36",
43
- secondary: "#002b36",
44
- },
45
- background: {
46
- default: "#f9f9f9",
47
- },
48
- context: {
49
- background: "#cb4b16",
50
- text: "#555555",
51
- },
52
- divider: {
53
- default: "#e2e4ff",
54
- },
55
- action: {
56
- button: "rgba(0,0,0,.54)",
57
- hover: "rgba(0,0,0,.08)",
58
- disabled: "rgba(0,0,0,.12)",
59
- },
60
- headRow: {
61
- background: "black",
62
- },
63
- });
64
-
65
- createTheme("subTable", {
66
- text: {
67
- primary: "#002b36",
68
- secondary: "#002b36",
69
- },
70
- background: {
71
- default: "#e9e9e9",
72
- },
73
- context: {
74
- background: "#cb4b16",
75
- text: "#555555",
76
- },
77
- divider: {
78
- default: "#e2e4ff",
79
- },
80
- action: {
81
- button: "rgba(0,0,0,.54)",
82
- hover: "rgba(0,0,0,.08)",
83
- disabled: "rgba(0,0,0,.12)",
84
- },
85
- headRow: {
86
- background: "black",
87
- },
88
- });
89
-
90
- type Props = TableProps<any> & {
91
- columns: any;
92
- conditionalRowStyles?: any;
93
- data: any[];
94
- loading?: boolean;
95
- pagination?: {
96
- totalRows: number;
97
- rowsPerPageOptions: number[];
98
- };
99
- whitOutPagination?: boolean;
100
- offlineSearch?: string[];
101
- search?: {
102
- placeholderSearch?: string;
103
- };
104
- expandable?: {
105
- expandableRowExpanded?: (row: any) => boolean;
106
- expandableRowsComponent?: ExpandableRowsComponent<any>;
107
- };
108
- theme?: "solarized" | "subTable";
109
- className?: string;
110
- };
111
-
112
- //Documentación de la tabla https://react-data-table-component.netlify.app/?path=/docs/getting-started-intro--docs
113
- export const ZauruTable = (props: Props) => {
114
- const {
115
- columns,
116
- conditionalRowStyles,
117
- data,
118
- loading = false,
119
- pagination,
120
- search,
121
- expandable,
122
- theme,
123
- className,
124
- offlineSearch = [],
125
- whitOutPagination = false,
126
- ...others
127
- } = props;
128
-
129
- const [, setSearchParams] = useSearchParams({
130
- page: "1",
131
- perPage: "10",
132
- search: "",
133
- });
134
- const [filteredData, setFilteredData] = useState(data);
135
-
136
- const [showTable, setShowTable] = useState<boolean>(false);
137
-
138
- useEffect(() => {
139
- setShowTable(true);
140
- }, []);
141
-
142
- useEffect(() => {
143
- setFilteredData(data);
144
- }, [data]);
145
-
146
- const subHeaderComponentMemo = (
147
- <>
148
- <input
149
- name="search"
150
- type="text"
151
- placeholder={search?.placeholderSearch ?? "Filtrar"}
152
- aria-label="Search Input"
153
- className="bg-gray-50 border border-gray-300 text-gray-900 rounded-lg px-2"
154
- onChange={(event) => {
155
- const searchTerm = event.target.value;
156
- if (offlineSearch.length > 0) {
157
- filterData(searchTerm);
158
- }
159
- }}
160
- onBlur={(event) => {
161
- const searchTerm = event.target.value;
162
- if (offlineSearch.length <= 0 && search) {
163
- setSearchParams((prevState: URLSearchParams) => ({
164
- ...Object.fromEntries(prevState),
165
- search: searchTerm,
166
- }));
167
- }
168
- }}
169
- />
170
- <button type="button" name="search" className="px-2 font-bold">
171
- <SearchSVG />
172
- </button>
173
- </>
174
- );
175
-
176
- const filterData = (searchTerm: string) => {
177
- if (!searchTerm || !offlineSearch || offlineSearch.length === 0) {
178
- setFilteredData(data);
179
- return;
180
- }
181
-
182
- const filtered = data.filter((item) =>
183
- offlineSearch.some(
184
- (field) =>
185
- item[field] &&
186
- item[field]
187
- .toString()
188
- .toLowerCase()
189
- .includes(searchTerm.toLowerCase())
190
- )
191
- );
192
-
193
- setFilteredData(filtered);
194
- };
195
-
196
- const handlePageChange = (page: number) => {
197
- //hacer el fetch de más datos
198
- setSearchParams((prevState: URLSearchParams) => ({
199
- ...Object.fromEntries(prevState),
200
- page: page.toString(),
201
- }));
202
- };
203
-
204
- const handlePerRowsChange = async (newPerPage: number, page: number) => {
205
- //hacer el fetch de más datos
206
- setSearchParams((prevState: URLSearchParams) => ({
207
- ...Object.fromEntries(prevState),
208
- perPage: newPerPage.toString(),
209
- }));
210
- };
211
-
212
- if (!showTable) {
213
- return <>Loading...</>;
214
- }
215
-
216
- //Textos en español de la tabla
217
- const paginationComponentOptions = {
218
- rowsPerPageText: "Filas por página",
219
- rangeSeparatorText: "de",
220
- selectAllRowsItem: true,
221
- selectAllRowsItemText: "Todos",
222
- } as PaginationOptions;
223
-
224
- const loadSubHeader = !!(search || offlineSearch.length > 0);
225
- const subHeaderComponent = loadSubHeader ? subHeaderComponentMemo : undefined;
226
-
227
- return (
228
- <DataTable
229
- className={className}
230
- subHeaderWrap
231
- theme={theme ?? "solarized"}
232
- columns={columns}
233
- conditionalRowStyles={conditionalRowStyles}
234
- data={filteredData}
235
- customStyles={customStyles}
236
- progressPending={loading}
237
- highlightOnHover
238
- pointerOnHover
239
- dense
240
- striped
241
- pagination={!whitOutPagination}
242
- persistTableHead
243
- responsive
244
- noHeader
245
- expandableRows={!!expandable}
246
- expandableRowExpanded={
247
- expandable ? expandable.expandableRowExpanded : undefined
248
- }
249
- expandableRowsComponent={
250
- expandable ? expandable.expandableRowsComponent : undefined
251
- }
252
- subHeader={loadSubHeader}
253
- subHeaderComponent={subHeaderComponent}
254
- paginationServer={!!pagination}
255
- paginationTotalRows={pagination ? pagination.totalRows : undefined}
256
- onChangeRowsPerPage={pagination ? handlePerRowsChange : undefined}
257
- onChangePage={pagination ? handlePageChange : undefined}
258
- paginationComponentOptions={paginationComponentOptions}
259
- paginationRowsPerPageOptions={
260
- pagination?.rowsPerPageOptions ? pagination.rowsPerPageOptions : [10]
261
- }
262
- {...others}
263
- />
264
- );
265
- };
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 { createTheme } from "react-data-table-component";
9
+ import { SearchSVG } from "@zauru-sdk/icons";
10
+ import * as ReactDataTableComponent from "react-data-table-component";
11
+ const DataTable = ReactDataTableComponent.default as any;
12
+ import { ExpandableRowsComponent } from "react-data-table-component/dist/DataTable/types.js";
13
+
14
+ const customStyles: TableStyles = {
15
+ headCells: {
16
+ style: {
17
+ color: "#202124",
18
+ fontSize: "14px",
19
+ justifyContent: "left", // Alinea el texto a la izquierda
20
+ whiteSpace: "normal", // Permite el ajuste de texto
21
+ wordBreak: "break-word", // Asegura que las palabras se rompan correctamente para evitar desbordamientos
22
+ maxWidth: "150px", // Establece un ancho máximo para las celdas del encabezado
23
+ },
24
+ },
25
+ rows: {
26
+ highlightOnHoverStyle: {
27
+ backgroundColor: "rgb(230, 244, 244)",
28
+ borderBottomColor: "#FFFFFF",
29
+ borderRadius: "25px",
30
+ outline: "1px solid #FFFFFF",
31
+ },
32
+ },
33
+ pagination: {
34
+ style: {
35
+ border: "none",
36
+ },
37
+ },
38
+ };
39
+
40
+ createTheme("solarized", {
41
+ text: {
42
+ primary: "#002b36",
43
+ secondary: "#002b36",
44
+ },
45
+ background: {
46
+ default: "#f9f9f9",
47
+ },
48
+ context: {
49
+ background: "#cb4b16",
50
+ text: "#555555",
51
+ },
52
+ divider: {
53
+ default: "#e2e4ff",
54
+ },
55
+ action: {
56
+ button: "rgba(0,0,0,.54)",
57
+ hover: "rgba(0,0,0,.08)",
58
+ disabled: "rgba(0,0,0,.12)",
59
+ },
60
+ headRow: {
61
+ background: "black",
62
+ },
63
+ });
64
+
65
+ createTheme("subTable", {
66
+ text: {
67
+ primary: "#002b36",
68
+ secondary: "#002b36",
69
+ },
70
+ background: {
71
+ default: "#e9e9e9",
72
+ },
73
+ context: {
74
+ background: "#cb4b16",
75
+ text: "#555555",
76
+ },
77
+ divider: {
78
+ default: "#e2e4ff",
79
+ },
80
+ action: {
81
+ button: "rgba(0,0,0,.54)",
82
+ hover: "rgba(0,0,0,.08)",
83
+ disabled: "rgba(0,0,0,.12)",
84
+ },
85
+ headRow: {
86
+ background: "black",
87
+ },
88
+ });
89
+
90
+ type Props = TableProps<any> & {
91
+ columns: any;
92
+ conditionalRowStyles?: any;
93
+ data: any[];
94
+ loading?: boolean;
95
+ pagination?: {
96
+ totalRows: number;
97
+ rowsPerPageOptions: number[];
98
+ };
99
+ whitOutPagination?: boolean;
100
+ offlineSearch?: string[];
101
+ search?: {
102
+ placeholderSearch?: string;
103
+ };
104
+ expandable?: {
105
+ expandableRowExpanded?: (row: any) => boolean;
106
+ expandableRowsComponent?: ExpandableRowsComponent<any>;
107
+ };
108
+ theme?: "solarized" | "subTable";
109
+ className?: string;
110
+ };
111
+
112
+ //Documentación de la tabla https://react-data-table-component.netlify.app/?path=/docs/getting-started-intro--docs
113
+ export const ZauruTable = (props: Props) => {
114
+ const {
115
+ columns,
116
+ conditionalRowStyles,
117
+ data,
118
+ loading = false,
119
+ pagination,
120
+ search,
121
+ expandable,
122
+ theme,
123
+ className,
124
+ offlineSearch = [],
125
+ whitOutPagination = false,
126
+ ...others
127
+ } = props;
128
+
129
+ const [, setSearchParams] = useSearchParams({
130
+ page: "1",
131
+ perPage: "10",
132
+ search: "",
133
+ });
134
+ const [filteredData, setFilteredData] = useState(data);
135
+
136
+ const [showTable, setShowTable] = useState<boolean>(false);
137
+
138
+ useEffect(() => {
139
+ setShowTable(true);
140
+ }, []);
141
+
142
+ useEffect(() => {
143
+ setFilteredData(data);
144
+ }, [data]);
145
+
146
+ const subHeaderComponentMemo = (
147
+ <>
148
+ <input
149
+ name="search"
150
+ type="text"
151
+ placeholder={search?.placeholderSearch ?? "Filtrar"}
152
+ aria-label="Search Input"
153
+ className="bg-gray-50 border border-gray-300 text-gray-900 rounded-lg px-2"
154
+ onChange={(event) => {
155
+ const searchTerm = event.target.value;
156
+ if (offlineSearch.length > 0) {
157
+ filterData(searchTerm);
158
+ }
159
+ }}
160
+ onBlur={(event) => {
161
+ const searchTerm = event.target.value;
162
+ if (offlineSearch.length <= 0 && search) {
163
+ setSearchParams((prevState: URLSearchParams) => ({
164
+ ...Object.fromEntries(prevState),
165
+ search: searchTerm,
166
+ }));
167
+ }
168
+ }}
169
+ />
170
+ <button type="button" name="search" className="px-2 font-bold">
171
+ <SearchSVG />
172
+ </button>
173
+ </>
174
+ );
175
+
176
+ const filterData = (searchTerm: string) => {
177
+ if (!searchTerm || !offlineSearch || offlineSearch.length === 0) {
178
+ setFilteredData(data);
179
+ return;
180
+ }
181
+
182
+ const filtered = data.filter((item) =>
183
+ offlineSearch.some(
184
+ (field) =>
185
+ item[field] &&
186
+ item[field]
187
+ .toString()
188
+ .toLowerCase()
189
+ .includes(searchTerm.toLowerCase())
190
+ )
191
+ );
192
+
193
+ setFilteredData(filtered);
194
+ };
195
+
196
+ const handlePageChange = (page: number) => {
197
+ //hacer el fetch de más datos
198
+ setSearchParams((prevState: URLSearchParams) => ({
199
+ ...Object.fromEntries(prevState),
200
+ page: page.toString(),
201
+ }));
202
+ };
203
+
204
+ const handlePerRowsChange = async (newPerPage: number, page: number) => {
205
+ //hacer el fetch de más datos
206
+ setSearchParams((prevState: URLSearchParams) => ({
207
+ ...Object.fromEntries(prevState),
208
+ perPage: newPerPage.toString(),
209
+ }));
210
+ };
211
+
212
+ if (!showTable) {
213
+ return <>Loading...</>;
214
+ }
215
+
216
+ //Textos en español de la tabla
217
+ const paginationComponentOptions = {
218
+ rowsPerPageText: "Filas por página",
219
+ rangeSeparatorText: "de",
220
+ selectAllRowsItem: true,
221
+ selectAllRowsItemText: "Todos",
222
+ } as PaginationOptions;
223
+
224
+ const loadSubHeader = !!(search || offlineSearch.length > 0);
225
+ const subHeaderComponent = loadSubHeader ? subHeaderComponentMemo : undefined;
226
+
227
+ return (
228
+ <DataTable
229
+ className={className}
230
+ subHeaderWrap
231
+ theme={theme ?? "solarized"}
232
+ columns={columns}
233
+ conditionalRowStyles={conditionalRowStyles}
234
+ data={filteredData}
235
+ customStyles={customStyles}
236
+ progressPending={loading}
237
+ highlightOnHover
238
+ pointerOnHover
239
+ dense
240
+ striped
241
+ pagination={!whitOutPagination}
242
+ persistTableHead
243
+ responsive
244
+ noHeader
245
+ expandableRows={!!expandable}
246
+ expandableRowExpanded={
247
+ expandable ? expandable.expandableRowExpanded : undefined
248
+ }
249
+ expandableRowsComponent={
250
+ expandable ? expandable.expandableRowsComponent : undefined
251
+ }
252
+ subHeader={loadSubHeader}
253
+ subHeaderComponent={subHeaderComponent}
254
+ paginationServer={!!pagination}
255
+ paginationTotalRows={pagination ? pagination.totalRows : undefined}
256
+ onChangeRowsPerPage={pagination ? handlePerRowsChange : undefined}
257
+ onChangePage={pagination ? handlePageChange : undefined}
258
+ paginationComponentOptions={paginationComponentOptions}
259
+ paginationRowsPerPageOptions={
260
+ pagination?.rowsPerPageOptions ? pagination.rowsPerPageOptions : [10]
261
+ }
262
+ {...others}
263
+ />
264
+ );
265
+ };
@@ -1 +1 @@
1
- export * from "./ZauruTable.js";
1
+ export * from "./ZauruTable.js";