contentoh-components-library 21.2.63 → 21.2.66

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 (56) hide show
  1. package/.env.development +4 -1
  2. package/dist/components/atoms/CustomSelectItem/CustomSelectItem.stories.js +323 -0
  3. package/dist/components/atoms/CustomSelectItem/index.js +174 -0
  4. package/dist/components/atoms/CustomSelectItem/styles.js +20 -0
  5. package/dist/components/atoms/GradientPanel/GradientPanel.stories.js +1 -1
  6. package/dist/components/molecules/CustomSelect/CustomSelect.stories.js +21 -22
  7. package/dist/components/molecules/CustomSelect/SelectItem.js +10 -1
  8. package/dist/components/molecules/CustomSelect/index.js +35 -14
  9. package/dist/components/molecules/CustomSelect/styles.js +1 -1
  10. package/dist/components/molecules/GalleryHeader/index.js +1 -1
  11. package/dist/components/molecules/HeaderTop/index.js +10 -5
  12. package/dist/components/molecules/HeaderTop/styles.js +1 -1
  13. package/dist/components/molecules/TagAndInput/styles.js +1 -1
  14. package/dist/components/molecules/VersionItem/index.js +4 -4
  15. package/dist/components/organisms/VersionSelector/index.js +1 -1
  16. package/dist/components/pages/Dashboard/dashboardUtils.js +25 -32
  17. package/dist/components/pages/Dashboard/index.js +6 -6
  18. package/package.json +6 -1
  19. package/src/assets/images/chatPopup/Spinner.gif +0 -0
  20. package/src/assets/images/chatPopup/close.svg +3 -0
  21. package/src/assets/images/chatPopup/defaultImage.png +0 -0
  22. package/src/assets/images/chatPopup/defaultProfile.png +0 -0
  23. package/src/assets/images/chatPopup/doc.svg +1 -0
  24. package/src/assets/images/chatPopup/document.svg +1 -0
  25. package/src/assets/images/chatPopup/iconChat.svg +19 -0
  26. package/src/assets/images/chatPopup/iconPlus.svg +3 -0
  27. package/src/assets/images/chatPopup/pdf.svg +75 -0
  28. package/src/assets/images/chatPopup/remove.svg +4 -0
  29. package/src/assets/images/chatPopup/send.svg +3 -0
  30. package/src/assets/images/chatPopup/svgIcon.svg +109 -0
  31. package/src/assets/images/chatPopup/upload_file.svg +3 -0
  32. package/src/assets/images/chatPopup/xls.svg +53 -0
  33. package/src/assets/images/customSelect/starIcon.svg +14 -0
  34. package/src/components/atoms/ChatPopUp/ChatPopUp.stories.js +11 -0
  35. package/src/components/atoms/ChatPopUp/index.js +541 -0
  36. package/src/components/atoms/ChatPopUp/styles.js +278 -0
  37. package/src/components/atoms/ChatPopUp/utils/handlersChat.js +104 -0
  38. package/src/components/atoms/CustomSelectItem/CustomSelectItem.stories.js +410 -0
  39. package/src/components/atoms/CustomSelectItem/index.js +144 -0
  40. package/src/components/atoms/CustomSelectItem/styles.js +32 -0
  41. package/src/components/atoms/GradientPanel/GradientPanel.stories.js +1 -1
  42. package/src/components/atoms/Tooltip/Tooltip.stories.js +15 -0
  43. package/src/components/atoms/Tooltip/index.js +35 -0
  44. package/src/components/atoms/Tooltip/styles.js +5 -0
  45. package/src/components/molecules/CustomSelect/CustomSelect.stories.js +19 -11
  46. package/src/components/molecules/CustomSelect/SelectItem.js +7 -0
  47. package/src/components/molecules/CustomSelect/index.js +8 -3
  48. package/src/components/molecules/CustomSelect/styles.js +0 -2
  49. package/src/components/molecules/GalleryHeader/index.js +1 -1
  50. package/src/components/molecules/HeaderTop/index.js +10 -6
  51. package/src/components/molecules/HeaderTop/styles.js +4 -0
  52. package/src/components/molecules/TagAndInput/styles.js +1 -2
  53. package/src/components/molecules/VersionItem/index.js +6 -6
  54. package/src/components/organisms/VersionSelector/index.js +1 -1
  55. package/src/components/pages/Dashboard/dashboardUtils.js +18 -22
  56. package/src/components/pages/Dashboard/index.js +6 -6
@@ -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
+ `;
@@ -69,7 +69,7 @@ LoginPanelDefault.args = {
69
69
  id={"chk-default"}
70
70
  className="active-left"
71
71
  />
72
- <p className="active-right">Olvide mi contraseña</p>
72
+ <p className="active-right">Olvidé mi contraseña</p>
73
73
  </div>,
74
74
  <div className="button-right" key="6">
75
75
  <Button buttonType={"general-default-button"} label={"Iniciar sesión"} />
@@ -0,0 +1,15 @@
1
+ import { CustomTooltip } from "./index";
2
+
3
+ export default {
4
+ title: "Components/atoms/CustomTooltip",
5
+ component: CustomTooltip
6
+ };
7
+
8
+ const Template = (args) => <CustomTooltip {...args} />;
9
+
10
+ export const TooltipDefault = Template.bind({});
11
+ TooltipDefault.args = {
12
+ componentTooltip: (<p> hola soy tooltip </p>) ,
13
+ children: (<button> abrir tooltip </button>) ,
14
+ className: "container-tooltip"
15
+ };
@@ -0,0 +1,35 @@
1
+ import { useEffect, useState } from "react";
2
+ import { Tooltip } from "@mui/material";
3
+ import { Container } from "./styles";
4
+ import React from "react";
5
+
6
+ export const CustomTooltip = ({
7
+ componentTooltip ,
8
+ children ,
9
+ className ,
10
+ ...props
11
+ }) => {
12
+
13
+ const MyComponent = React.forwardRef(function MyComponent(props, ref) {
14
+ return (
15
+ <div {...props} ref={ref}>
16
+ Bin
17
+ </div>
18
+ );
19
+ });
20
+
21
+ return (
22
+ <Tooltip
23
+ {...props}
24
+ arrow
25
+ placement="top"
26
+ componentsProps={{
27
+ tooltip: {className: className} ,
28
+ popper: {disablePortal: true}
29
+ }}
30
+ title={ componentTooltip }
31
+ >
32
+ {children}
33
+ </Tooltip>
34
+ )
35
+ };
@@ -0,0 +1,5 @@
1
+ import styled from "styled-components";
2
+
3
+ export const Container = styled.div`
4
+ border: 1px solid red;
5
+ `;
@@ -1,4 +1,5 @@
1
1
  import { CustomSelect } from "./index";
2
+ import iconStar from "../../../assets/images/customSelect/starIcon.svg";
2
3
 
3
4
  export default {
4
5
  title: "Components/molecules/CustomSelect",
@@ -8,20 +9,27 @@ export default {
8
9
  const Template = (args) => <CustomSelect {...args} />;
9
10
  export const CustomSelectDefault = Template.bind({});
10
11
  CustomSelectDefault.args = {
11
- selectLabel: "Todos los departamentos",
12
+ // selectLabel: "Todos los departamentos",
12
13
  defaultOption: "Todos los departamentos",
13
14
  options: [
14
15
  {
15
- id: 1,
16
- value: "Decoración",
17
- subOptions: [
18
- { id: 1, value: "Espejos" },
19
- { id: 2, value: "Persianas" },
20
- ],
16
+ id: 47,
17
+ name: "Enero 2023",
18
+ isSelected: true,
19
+ },
20
+ {
21
+ id: 49,
22
+ name: "Mis Favoritos",
21
23
  },
22
- { id: 2, value: "Eléctrico" },
23
- { id: 3, value: "Ferretería" },
24
- { id: 4, value: "Herramientas" },
25
- { id: 5, value: "Iluminación" },
26
24
  ],
25
+ onClickItem: (v, id) => {
26
+ if (v) {
27
+ console.log("Agregar a la lista", id);
28
+ } else {
29
+ console.log("Eliminar a la lista", id);
30
+ }
31
+ },
32
+ icon: iconStar,
33
+ showSearchBar: true,
34
+ customOptions: <p>Esto es un customOptions</p>
27
35
  };