contentoh-components-library 21.2.65 → 21.2.67

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 (48) hide show
  1. package/dist/assets/images/chatPopup/Spinner.gif +0 -0
  2. package/dist/assets/images/chatPopup/close.svg +3 -0
  3. package/dist/assets/images/chatPopup/defaultImage.png +0 -0
  4. package/dist/assets/images/chatPopup/defaultProfile.png +0 -0
  5. package/dist/assets/images/chatPopup/doc.svg +1 -0
  6. package/dist/assets/images/chatPopup/document.svg +1 -0
  7. package/dist/assets/images/chatPopup/iconChat.svg +19 -0
  8. package/dist/assets/images/chatPopup/iconPlus.svg +3 -0
  9. package/dist/assets/images/chatPopup/pdf.svg +75 -0
  10. package/dist/assets/images/chatPopup/remove.svg +4 -0
  11. package/dist/assets/images/chatPopup/send.svg +3 -0
  12. package/dist/assets/images/chatPopup/svgIcon.svg +109 -0
  13. package/dist/assets/images/chatPopup/upload_file.svg +3 -0
  14. package/dist/assets/images/chatPopup/xls.svg +53 -0
  15. package/dist/components/atoms/ChatPopUp/ChatPopUp.stories.js +28 -0
  16. package/dist/components/atoms/ChatPopUp/index.js +841 -0
  17. package/dist/components/atoms/ChatPopUp/styles.js +27 -0
  18. package/dist/components/atoms/ChatPopUp/utils/handlersChat.js +182 -0
  19. package/dist/components/atoms/CustomSelectItem/CustomSelectItem.stories.js +323 -0
  20. package/dist/components/atoms/CustomSelectItem/index.js +174 -0
  21. package/dist/components/atoms/CustomSelectItem/styles.js +20 -0
  22. package/dist/components/atoms/StatusTag/StatusTag.stories.js +48 -0
  23. package/dist/components/atoms/StatusTag/index.js +58 -0
  24. package/dist/components/atoms/StatusTag/styles.js +20 -0
  25. package/dist/components/atoms/Tooltip/Tooltip.stories.js +36 -0
  26. package/dist/components/atoms/Tooltip/index.js +55 -0
  27. package/dist/components/atoms/Tooltip/styles.js +18 -0
  28. package/dist/components/molecules/CustomSelect/index.js +35 -14
  29. package/dist/components/molecules/CustomSelect/styles.js +1 -1
  30. package/dist/components/organisms/DashboardMetric/dashboardMetricUtils.js +17 -11
  31. package/dist/components/organisms/DashboardMetric/index.js +2 -2
  32. package/dist/components/organisms/DashboardMetric/styles.js +1 -1
  33. package/dist/components/pages/Dashboard/Dashboard.stories.js +26 -26
  34. package/dist/components/pages/Dashboard/dashboardUtils.js +25 -32
  35. package/dist/components/pages/RegistrationLoginFirstStep/RegistrationLoginFirstStep.stories.js +37 -0
  36. package/dist/components/pages/RegistrationLoginFirstStep/index.js +269 -0
  37. package/dist/components/pages/RegistrationLoginFirstStep/styles.js +20 -0
  38. package/package.json +1 -1
  39. package/src/components/atoms/CustomSelectItem/CustomSelectItem.stories.js +410 -0
  40. package/src/components/atoms/CustomSelectItem/index.js +144 -0
  41. package/src/components/atoms/CustomSelectItem/styles.js +32 -0
  42. package/src/components/molecules/CustomSelect/index.js +8 -3
  43. package/src/components/molecules/CustomSelect/styles.js +0 -2
  44. package/src/components/organisms/DashboardMetric/dashboardMetricUtils.js +15 -11
  45. package/src/components/organisms/DashboardMetric/index.js +4 -2
  46. package/src/components/organisms/DashboardMetric/styles.js +1 -1
  47. package/src/components/pages/Dashboard/Dashboard.stories.js +26 -26
  48. package/src/components/pages/Dashboard/dashboardUtils.js +18 -22
@@ -0,0 +1,410 @@
1
+ import { CustomSelectItem } from ".";
2
+
3
+ export default {
4
+ title: "Components/atoms/CustomSelectItem",
5
+ component: CustomSelectItem,
6
+ };
7
+
8
+ const Template = (args) => <CustomSelectItem {...args} />;
9
+ export const CustomSelectItemDefault = Template.bind({});
10
+ CustomSelectItemDefault.args = {
11
+ option: {
12
+ id: 0,
13
+ name: "Abarrotes",
14
+ subOptions: [
15
+ {
16
+ id: 0,
17
+ name: "Abarrotes Secos",
18
+ subOptions: [
19
+ {
20
+ id: 4,
21
+ name: "Alimentos Deshidratados",
22
+ },
23
+ {
24
+ id: 5,
25
+ name: "Avenas y Granolas",
26
+ },
27
+ {
28
+ id: 6,
29
+ name: "Azúcar, Endulzantes y Sustitutos",
30
+ },
31
+ {
32
+ id: 7,
33
+ name: "Café Grano",
34
+ },
35
+ {
36
+ id: 8,
37
+ name: "Café Soluble",
38
+ },
39
+ {
40
+ id: 9,
41
+ name: "Cereales y Barras",
42
+ },
43
+ {
44
+ id: 10,
45
+ name: "Despensas y Canastas",
46
+ },
47
+ {
48
+ id: 11,
49
+ name: "Frutos Secos",
50
+ },
51
+ {
52
+ id: 12,
53
+ name: "Galletas",
54
+ },
55
+ {
56
+ id: 13,
57
+ name: "Harinas y Repostería",
58
+ },
59
+ {
60
+ id: 14,
61
+ name: "Pan de Caja",
62
+ },
63
+ {
64
+ id: 15,
65
+ name: "Postres en Polvo",
66
+ },
67
+ {
68
+ id: 16,
69
+ name: "Saborizantes de Leche",
70
+ },
71
+ {
72
+ id: 17,
73
+ name: "Sopas y Pastas",
74
+ },
75
+ {
76
+ id: 18,
77
+ name: "Tortillas Empacadas",
78
+ },
79
+ ],
80
+ },
81
+ {
82
+ id: 1,
83
+ name: "Aceites y Vinagres",
84
+ subOptions: [
85
+ {
86
+ id: 20,
87
+ name: "Aceite de Oliva",
88
+ },
89
+ {
90
+ id: 21,
91
+ name: "Aceite en Aerosol",
92
+ },
93
+ {
94
+ id: 22,
95
+ name: "Aceites y Manteca",
96
+ },
97
+ ],
98
+ },
99
+ {
100
+ id: 2,
101
+ name: "Aderezos, Especias y Sazonadores",
102
+ subOptions: [
103
+ {
104
+ id: 24,
105
+ name: "Aderezos",
106
+ },
107
+ {
108
+ id: 25,
109
+ name: "Condimentos y Especias",
110
+ },
111
+ {
112
+ id: 26,
113
+ name: "Consomés",
114
+ },
115
+ {
116
+ id: 27,
117
+ name: "Mayonesas",
118
+ },
119
+ {
120
+ id: 28,
121
+ name: "Purés",
122
+ },
123
+ {
124
+ id: 29,
125
+ name: "Salsas",
126
+ },
127
+ ],
128
+ },
129
+ {
130
+ id: 3,
131
+ name: "Agua, Jugos y Bebidas",
132
+ subOptions: [
133
+ {
134
+ id: 31,
135
+ name: "Agua Embotellada",
136
+ },
137
+ {
138
+ id: 32,
139
+ name: "Bebidas Energizantes",
140
+ },
141
+ {
142
+ id: 33,
143
+ name: "Bebidas Isotónicas",
144
+ },
145
+ {
146
+ id: 34,
147
+ name: "Bebidas no Gasificadas",
148
+ },
149
+ {
150
+ id: 35,
151
+ name: "Bebidas y Concentrados en Polvo",
152
+ },
153
+ {
154
+ id: 36,
155
+ name: "Café, Té y Saborizantes",
156
+ },
157
+ {
158
+ id: 37,
159
+ name: "Jarabes para Agua",
160
+ },
161
+ {
162
+ id: 38,
163
+ name: "Jugos y Néctares",
164
+ },
165
+ {
166
+ id: 39,
167
+ name: "Refrescos y Sodas",
168
+ },
169
+ ],
170
+ },
171
+ {
172
+ id: 4,
173
+ name: "Botanas, Golosinas y Chocolates",
174
+ subOptions: [
175
+ {
176
+ id: 41,
177
+ name: "Botanas",
178
+ },
179
+ {
180
+ id: 42,
181
+ name: "Confitería",
182
+ },
183
+ {
184
+ id: 43,
185
+ name: "Dulces y Chocolates",
186
+ },
187
+ {
188
+ id: 44,
189
+ name: "Frituras Empacadas",
190
+ },
191
+ ],
192
+ },
193
+ {
194
+ id: 5,
195
+ name: "Cervezas, Vinos, Licores y Cigarros",
196
+ subOptions: [
197
+ {
198
+ id: 46,
199
+ name: "Accesorios Vinos",
200
+ },
201
+ {
202
+ id: 47,
203
+ name: "Aguardientes",
204
+ },
205
+ {
206
+ id: 48,
207
+ name: "Aperitivos",
208
+ },
209
+ {
210
+ id: 49,
211
+ name: "Brandy y Coñac",
212
+ },
213
+ {
214
+ id: 50,
215
+ name: "Cervezas",
216
+ },
217
+ {
218
+ id: 51,
219
+ name: "Cigarros Y Puros",
220
+ },
221
+ {
222
+ id: 52,
223
+ name: "Cockteles",
224
+ },
225
+ {
226
+ id: 53,
227
+ name: "Coolers y Bebidas Preparadas",
228
+ },
229
+ {
230
+ id: 54,
231
+ name: "Destilados",
232
+ },
233
+ {
234
+ id: 55,
235
+ name: "Digestivos",
236
+ },
237
+ {
238
+ id: 56,
239
+ name: "Mezcladores",
240
+ },
241
+ {
242
+ id: 57,
243
+ name: "Rompopes y Cremas",
244
+ },
245
+ {
246
+ id: 58,
247
+ name: "Ron",
248
+ },
249
+ {
250
+ id: 59,
251
+ name: "Tequila",
252
+ },
253
+ {
254
+ id: 60,
255
+ name: "Vinos Blancos",
256
+ },
257
+ {
258
+ id: 61,
259
+ name: "Vinos Espumosos",
260
+ },
261
+ {
262
+ id: 62,
263
+ name: "Vinos Rosados",
264
+ },
265
+ {
266
+ id: 63,
267
+ name: "Vinos Tintos",
268
+ },
269
+ {
270
+ id: 64,
271
+ name: "Vodka y Ginebra",
272
+ },
273
+ {
274
+ id: 65,
275
+ name: "Whisky",
276
+ },
277
+ ],
278
+ },
279
+ {
280
+ id: 6,
281
+ name: "Enlatados y Conservas",
282
+ subOptions: [
283
+ {
284
+ id: 67,
285
+ name: "Alimentos Preparados",
286
+ },
287
+ {
288
+ id: 68,
289
+ name: "Almíbares",
290
+ },
291
+ {
292
+ id: 69,
293
+ name: "Chiles Enlatados",
294
+ },
295
+ {
296
+ id: 70,
297
+ name: "Conservas Granel",
298
+ },
299
+ {
300
+ id: 71,
301
+ name: "Encurtidos",
302
+ },
303
+ {
304
+ id: 72,
305
+ name: "Frijoles Envasados",
306
+ },
307
+ {
308
+ id: 73,
309
+ name: "Legumbres Enlatados",
310
+ },
311
+ {
312
+ id: 74,
313
+ name: "Pescados y Mariscos Enlatados",
314
+ },
315
+ {
316
+ id: 75,
317
+ name: "Sopas Enlatadas",
318
+ },
319
+ ],
320
+ },
321
+ {
322
+ id: 7,
323
+ name: "Gourmet y Comida de Temporada",
324
+ subOptions: [
325
+ {
326
+ id: 77,
327
+ name: "Gourmet y Comida de Temporada",
328
+ },
329
+ ],
330
+ },
331
+ {
332
+ id: 8,
333
+ name: "Granos y Semillas",
334
+ subOptions: [
335
+ {
336
+ id: 79,
337
+ name: "Arroz",
338
+ },
339
+ {
340
+ id: 80,
341
+ name: "Frijol",
342
+ },
343
+ {
344
+ id: 81,
345
+ name: "Granos",
346
+ },
347
+ {
348
+ id: 82,
349
+ name: "Semillas",
350
+ },
351
+ ],
352
+ },
353
+ {
354
+ id: 9,
355
+ name: "Hielo",
356
+ subOptions: [
357
+ {
358
+ id: 84,
359
+ name: "Hielo",
360
+ },
361
+ ],
362
+ },
363
+ {
364
+ id: 10,
365
+ name: "Lácteos e Infusiones",
366
+ subOptions: [
367
+ {
368
+ id: 86,
369
+ name: "Condensadas y Evaporadas",
370
+ },
371
+ {
372
+ id: 87,
373
+ name: "Leche Líquida",
374
+ },
375
+ {
376
+ id: 88,
377
+ name: "Leche Polvo",
378
+ },
379
+ {
380
+ id: 89,
381
+ name: "Sustitutos de Crema",
382
+ },
383
+ {
384
+ id: 90,
385
+ name: "Té e Infusiones",
386
+ },
387
+ ],
388
+ },
389
+ {
390
+ id: 11,
391
+ name: "Untables y Mermeladas",
392
+ subOptions: [
393
+ {
394
+ id: 92,
395
+ name: "Cajetas y Untables",
396
+ },
397
+ {
398
+ id: 93,
399
+ name: "Mermeladas y Jaleas",
400
+ },
401
+ {
402
+ id: 94,
403
+ name: "Mieles",
404
+ },
405
+ ],
406
+ },
407
+ ],
408
+ },
409
+ className: "main-option",
410
+ };
@@ -0,0 +1,144 @@
1
+ import { Container } from "./styles";
2
+ import { CheckBox } from "../CheckBox";
3
+ import { useState } from "react";
4
+
5
+ export const CustomSelectItem = ({
6
+ option,
7
+ activeFilters = {},
8
+ parameterArray,
9
+ globalFilters,
10
+ setActiveFilters,
11
+ setParameterArray,
12
+ className,
13
+ route = "",
14
+ }) => {
15
+ const [showSubOptions, setShowSubOptions] = useState(false);
16
+ const filterRoute = route;
17
+
18
+ const returnFilterId = (object) => {
19
+ const { subOptions, id } = object;
20
+ if (subOptions) return subOptions.map(returnFilterId);
21
+ else return id;
22
+ };
23
+
24
+ const oneDimensionArray = (arr) => {
25
+ var array = [];
26
+ arr.forEach((element) => {
27
+ if (typeof element == "object") array.push(...oneDimensionArray(element));
28
+ else array.push(element);
29
+ });
30
+ return array;
31
+ };
32
+
33
+ const setFilter = (object, newObject = {}) => {
34
+ const { subOptions } = object;
35
+ if (subOptions) {
36
+ subOptions.forEach((option) => {
37
+ newObject[option.name] = setFilter(option);
38
+ });
39
+ return newObject;
40
+ } else return (newObject[object.name] = 1);
41
+ };
42
+
43
+ const createFilter = (rout, option, filters) => {
44
+ const levelsArray = rout.includes("|") ? rout.split("|").reverse() : [rout];
45
+ if (levelsArray.length === 1) {
46
+ return { [levelsArray[0]]: setFilter(option) };
47
+ } else if (levelsArray.length === 2) {
48
+ const newObject = {};
49
+ newObject[levelsArray[1]] = { ...filters };
50
+ newObject[levelsArray[1]][levelsArray[0]] = {
51
+ ...setFilter(option),
52
+ };
53
+ return { ...newObject };
54
+ } else if (levelsArray.length === 3) {
55
+ let newObject = globalFilters;
56
+ if (newObject[levelsArray[2]]) {
57
+ newObject[levelsArray[2]][levelsArray[1]] = {
58
+ ...newObject[levelsArray[2]][levelsArray[1]],
59
+ ...filters,
60
+ };
61
+ } else {
62
+ newObject = {
63
+ [levelsArray[2]]: { [levelsArray[1]]: { ...filters } },
64
+ };
65
+ }
66
+ newObject[levelsArray[2]][levelsArray[1]][levelsArray[0]] = 1;
67
+ return { ...newObject };
68
+ }
69
+ };
70
+
71
+ const deleteFilter = (rout) => {
72
+ const levelsArray = rout.includes("|") ? rout.split("|").reverse() : [rout];
73
+ const newObject = { ...globalFilters };
74
+ if (levelsArray.length === 1) delete newObject[levelsArray[0]];
75
+ else if (levelsArray.length === 2)
76
+ delete newObject[levelsArray[1]][levelsArray[0]];
77
+ else if (levelsArray.length === 3)
78
+ delete newObject[levelsArray[2]][levelsArray[1]][levelsArray[0]];
79
+ return newObject;
80
+ };
81
+
82
+ const onChangeChk = (e, object) => {
83
+ let idsFilter = returnFilterId(object);
84
+ if (typeof idsFilter === "object") {
85
+ idsFilter = oneDimensionArray(idsFilter);
86
+ } else {
87
+ idsFilter = [idsFilter];
88
+ }
89
+ let tempArray = parameterArray.slice();
90
+ if (e.target.checked) {
91
+ const newFilter = createFilter(route, option, activeFilters);
92
+ tempArray.push(...idsFilter);
93
+ setActiveFilters((current) => {
94
+ return {
95
+ ...current,
96
+ ...newFilter,
97
+ };
98
+ });
99
+ } else {
100
+ tempArray = tempArray.filter((element) => !idsFilter.includes(element));
101
+ const remainFilters = deleteFilter(route, globalFilters);
102
+ setActiveFilters((current) => remainFilters);
103
+ }
104
+ setParameterArray(tempArray);
105
+ };
106
+
107
+ return (
108
+ <Container mainDivClass={className}>
109
+ <div className={className}>
110
+ <CheckBox
111
+ id={"main-item-" + option.name}
112
+ label={option.name}
113
+ defaultChecked={activeFilters[option.name]}
114
+ onChange={(e) => onChangeChk(e, option)}
115
+ />
116
+ {option.subOptions && (
117
+ <div
118
+ onClick={() => setShowSubOptions(!showSubOptions)}
119
+ className="arrow-item"
120
+ >
121
+ &#9664;
122
+ </div>
123
+ )}
124
+ </div>
125
+ {showSubOptions && (
126
+ <div className="sub-options">
127
+ {option.subOptions.map((subOption, index) => (
128
+ <CustomSelectItem
129
+ key={index + "-" + subOption.name}
130
+ option={subOption}
131
+ className={"sub-option"}
132
+ route={`${filterRoute}|${subOption.name}`}
133
+ activeFilters={activeFilters[option.name]}
134
+ parameterArray={parameterArray}
135
+ globalFilters={globalFilters}
136
+ setActiveFilters={setActiveFilters}
137
+ setParameterArray={setParameterArray}
138
+ />
139
+ ))}
140
+ </div>
141
+ )}
142
+ </Container>
143
+ );
144
+ };
@@ -0,0 +1,32 @@
1
+ import styled from "styled-components";
2
+
3
+ export const Container = styled.div`
4
+ & > .${(props) => props.mainDivClass} {
5
+ display: flex;
6
+ justify-content: space-between;
7
+ padding: 5px;
8
+ flex-wrap: nowrap;
9
+ white-space: nowrap;
10
+
11
+ .arrow-item {
12
+ transform: rotate(-90deg);
13
+ cursor: pointer;
14
+ font-size: 10px;
15
+ }
16
+
17
+ &:hover {
18
+ background-color: #f0f0f0;
19
+ }
20
+
21
+ input {
22
+ & + label {
23
+ cursor: pointer;
24
+ }
25
+ }
26
+ }
27
+ .sub-options {
28
+ & > * {
29
+ padding-left: 15px;
30
+ }
31
+ }
32
+ `;
@@ -4,7 +4,7 @@ import searchIcon from "../../../assets/images/customSelect/searchIcon.png";
4
4
  import { useCloseModal } from "../../../global-files/customHooks";
5
5
  import { SelecItem } from "./SelectItem";
6
6
  import { Calendar } from "../../organisms/Calendar";
7
- import { formatDate } from "../../pages/Dashboard/dashboardUtils";
7
+ import { CustomSelectItem } from "../../atoms/CustomSelectItem";
8
8
 
9
9
  export const CustomSelect = ({
10
10
  options,
@@ -13,6 +13,7 @@ export const CustomSelect = ({
13
13
  selectLabel = "",
14
14
  customSelectId = "defaultSelectId",
15
15
  defaultOption,
16
+ parameterArray,
16
17
  setParameterArray,
17
18
  onClickItem,
18
19
  icon,
@@ -84,7 +85,7 @@ export const CustomSelect = ({
84
85
  setFilters(filteredArray);
85
86
  }, [text]);
86
87
 
87
- useEffect(() => {
88
+ useEffect(async () => {
88
89
  let newFiltersString = selectLabel;
89
90
  let counter = 0;
90
91
  const filtersArray = Object.keys(activeFilters);
@@ -164,14 +165,18 @@ export const CustomSelect = ({
164
165
  <p>{option.name}</p>
165
166
  </div>
166
167
  ) : (
167
- <SelecItem
168
+ <CustomSelectItem
169
+ className={"main-option"}
168
170
  key={customSelectId + option.id}
169
171
  option={option}
170
172
  customSelectId={customSelectId}
171
173
  setParameterArray={setParameterArray}
172
174
  activeFilters={activeFilters}
175
+ globalFilters={activeFilters}
176
+ parameterArray={parameterArray}
173
177
  setActiveFilters={setActiveFilters}
174
178
  onClickItem={onClickItem}
179
+ route={option.name}
175
180
  />
176
181
  )
177
182
  )}
@@ -11,8 +11,6 @@ export const Container = styled.div`
11
11
  font-size: 13px;
12
12
  display: flex;
13
13
  padding: ${(props) => (props.selectLabel !== "" ? "10px 15px" : "5px 5px")};
14
- //padding: 10px 15px;
15
- //padding: 5px 5px;
16
14
  justify-content: space-between;
17
15
  border-radius: 50px;
18
16
  background-color: ${({ filterActive }) =>
@@ -1,7 +1,7 @@
1
1
  export const getFullStatus = (status) => {
2
2
  switch (status) {
3
3
  case "PA":
4
- return "Por Asignar";
4
+ return "Por asignar";
5
5
  case "AS":
6
6
  case "Assigned":
7
7
  return "Asignado";
@@ -10,29 +10,31 @@ export const getFullStatus = (status) => {
10
10
  return "Capturando";
11
11
  case "IE":
12
12
  case "QF":
13
- return "Información Enviada";
13
+ return "Información enviada";
14
14
  case "RC":
15
15
  case "RF":
16
- return "Rechazado Coordinador";
16
+ return "Rechazado coordinador";
17
17
  case "AC":
18
18
  case "AF":
19
- return "Aprobado Coordinador";
19
+ return "Aprobado coordinador";
20
20
  case "RA":
21
- return "Rechazado Auditor";
21
+ return "Rechazado auditor";
22
22
  case "AA":
23
- return "Aprobado Auditor";
23
+ return "Aprobado auditor";
24
24
  case "RP":
25
- return "Rechazado Proveedor";
25
+ return "Rechazado proveedor";
26
26
  case "AP":
27
- return "Aprobado Proveedor";
27
+ return "Aprobado proveedor";
28
28
  case "RCA":
29
- return "Rechazado Cadena";
29
+ return "Rechazado cadena";
30
30
  case "ACA":
31
- return "Aprobado Cadena";
31
+ return "Aprobado cadena";
32
32
  case "R":
33
- return "Por Recibir/Recibido";
33
+ return "Por recibir/recibido";
34
34
  case "Ex":
35
35
  return "Exportado";
36
+ case "NS":
37
+ return "No solicitado";
36
38
  }
37
39
  };
38
40
 
@@ -69,6 +71,8 @@ export const getStatusColor = (status) => {
69
71
  return "#839192";
70
72
  case "R":
71
73
  return "#D35400";
74
+ case "NS":
75
+ return "black";
72
76
  case "Ex":
73
77
  return "#09CAD8";
74
78
  default: