contentoh-components-library 21.2.91 → 21.2.92

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 (57) hide show
  1. package/.storybook/main.js +5 -8
  2. package/.storybook/preview.js +1 -1
  3. package/dist/_utils/helper.js +40 -0
  4. package/dist/assets/fonts/Roboto/LICENSE.txt +202 -0
  5. package/dist/assets/fonts/Roboto/Roboto-Black.ttf +0 -0
  6. package/dist/assets/fonts/Roboto/Roboto-BlackItalic.ttf +0 -0
  7. package/dist/assets/fonts/Roboto/Roboto-Bold.ttf +0 -0
  8. package/dist/assets/fonts/Roboto/Roboto-BoldItalic.ttf +0 -0
  9. package/dist/assets/fonts/Roboto/Roboto-Italic.ttf +0 -0
  10. package/dist/assets/fonts/Roboto/Roboto-Light.ttf +0 -0
  11. package/dist/assets/fonts/Roboto/Roboto-LightItalic.ttf +0 -0
  12. package/dist/assets/fonts/Roboto/Roboto-MediumItalic.ttf +0 -0
  13. package/dist/assets/fonts/Roboto/Roboto-Thin.ttf +0 -0
  14. package/dist/assets/fonts/Roboto/Roboto-ThinItalic.ttf +0 -0
  15. package/dist/components/atoms/Button/index.js +22 -0
  16. package/dist/components/atoms/Button/styles.js +56 -0
  17. package/dist/components/atoms/ChatPopUp/ChatPopUp.stories.js +28 -0
  18. package/dist/components/atoms/ChatPopUp/index.js +841 -0
  19. package/dist/components/atoms/ChatPopUp/styles.js +27 -0
  20. package/dist/components/atoms/ChatPopUp/utils/handlersChat.js +182 -0
  21. package/dist/components/atoms/ProgressBar/styles.js +1 -1
  22. package/dist/components/organisms/OrderDetail/OrderDetail.stories.js +189 -0
  23. package/dist/components/organisms/OrderDetail/index.js +249 -0
  24. package/dist/components/organisms/OrderDetail/styles.js +40 -0
  25. package/dist/components/organisms/OrderDetail/utils/ImageGroup/index.js +55 -0
  26. package/dist/components/organisms/OrderDetail/utils/ImageGroup/styles.js +39 -0
  27. package/dist/components/organisms/OrderDetail/utils/Table/index.js +207 -0
  28. package/dist/components/organisms/OrderDetail/utils/Table/styles.js +38 -0
  29. package/dist/components/organisms/OrderDetail/utils/Table/utils.js +32 -0
  30. package/dist/global-files/fonts.css +6 -0
  31. package/dist/global-files/variables.js +2 -1
  32. package/package.json +2 -1
  33. package/src/_utils/helper.js +36 -0
  34. package/src/assets/fonts/Roboto/LICENSE.txt +202 -0
  35. package/src/assets/fonts/Roboto/Roboto-Black.ttf +0 -0
  36. package/src/assets/fonts/Roboto/Roboto-BlackItalic.ttf +0 -0
  37. package/src/assets/fonts/Roboto/Roboto-Bold.ttf +0 -0
  38. package/src/assets/fonts/Roboto/Roboto-BoldItalic.ttf +0 -0
  39. package/src/assets/fonts/Roboto/Roboto-Italic.ttf +0 -0
  40. package/src/assets/fonts/Roboto/Roboto-Light.ttf +0 -0
  41. package/src/assets/fonts/Roboto/Roboto-LightItalic.ttf +0 -0
  42. package/src/assets/fonts/Roboto/Roboto-MediumItalic.ttf +0 -0
  43. package/src/assets/fonts/Roboto/Roboto-Thin.ttf +0 -0
  44. package/src/assets/fonts/Roboto/Roboto-ThinItalic.ttf +0 -0
  45. package/src/components/atoms/Button/index.js +16 -0
  46. package/src/components/atoms/Button/styles.js +37 -0
  47. package/src/components/atoms/ProgressBar/styles.js +4 -3
  48. package/src/components/organisms/OrderDetail/OrderDetail.stories.js +72 -0
  49. package/src/components/organisms/OrderDetail/index.js +189 -0
  50. package/src/components/organisms/OrderDetail/styles.js +120 -0
  51. package/src/components/organisms/OrderDetail/utils/ImageGroup/index.js +34 -0
  52. package/src/components/organisms/OrderDetail/utils/ImageGroup/styles.js +46 -0
  53. package/src/components/organisms/OrderDetail/utils/Table/index.js +132 -0
  54. package/src/components/organisms/OrderDetail/utils/Table/styles.js +49 -0
  55. package/src/components/organisms/OrderDetail/utils/Table/utils.js +27 -0
  56. package/src/global-files/fonts.css +6 -0
  57. package/src/global-files/variables.js +1 -0
@@ -0,0 +1,34 @@
1
+ import React, { useState } from "react";
2
+ import ReactImageFallback from "react-image-fallback";
3
+ import { MainContainer, Image, NameHover, CounterExtra } from "./styles";
4
+ import DefaultImage from "../../../../../assets/images/defaultImages/defaultProfileImage.svg";
5
+
6
+ export default function Table({ images }) {
7
+ const [indexHover, setIndexHover] = useState();
8
+
9
+ return (
10
+ <MainContainer>
11
+ {images.map((image, i) => (
12
+ <Image
13
+ onMouseEnter={() => setIndexHover(i)}
14
+ onMouseLeave={() => setIndexHover()}
15
+ key={image.id}
16
+ index={i}
17
+ >
18
+ {image.id !== -1 ? (
19
+ <ReactImageFallback
20
+ src={image.src}
21
+ fallbackImage={DefaultImage}
22
+ className="img"
23
+ />
24
+ ) : (
25
+ <CounterExtra>{image.src}</CounterExtra>
26
+ )}
27
+ {indexHover === i && image.name && (
28
+ <NameHover index={i}>{image.name}</NameHover>
29
+ )}
30
+ </Image>
31
+ ))}
32
+ </MainContainer>
33
+ );
34
+ }
@@ -0,0 +1,46 @@
1
+ import styled from "styled-components";
2
+
3
+ export const MainContainer = styled.div`
4
+ display: flex;
5
+ position: relative;
6
+ width: 100%;
7
+ height: 100%;
8
+ `;
9
+
10
+ export const Image = styled.div`
11
+ position: absolute;
12
+ z-index: ${({ index }) => 5 - index};
13
+ left: ${({ index }) => `${11 * index}px`};
14
+ .img {
15
+ width: 18px;
16
+ height: 18px;
17
+ object-fit: fill;
18
+ border-radius: 100%;
19
+ }
20
+ `;
21
+
22
+ export const NameHover = styled.div`
23
+ white-space: nowrap;
24
+ z-index: 20;
25
+ position: absolute;
26
+ left: ${({ index }) => 9}px;
27
+ top: -7px;
28
+ font-family: Roboto;
29
+ font-size: 10px;
30
+ background: #ffffff;
31
+ border-radius: 3px;
32
+ box-shadow: 0px 2px 4px #00000029;
33
+ padding: 2px 5px;
34
+ `;
35
+
36
+ export const CounterExtra = styled.div`
37
+ background: #8a6caaaa;
38
+ color: #ffffff;
39
+ border-radius: 50%;
40
+ width: 18px;
41
+ height: 18px;
42
+ display: flex;
43
+ justify-content: center;
44
+ align-items: center;
45
+ margin-left: 5px;
46
+ `;
@@ -0,0 +1,132 @@
1
+ import React, { useState, useEffect } from "react";
2
+ import { Status } from "../../../../atoms/Status";
3
+ import { CheckBox } from "../../../../atoms/CheckBox";
4
+ import ImageGroup from "../ImageGroup";
5
+ import { getRetailerPicture } from "../../../../../_utils/helper";
6
+ import { Header, Column, Rows } from "./styles";
7
+ import { servicesCodeIcon } from "./utils";
8
+
9
+ export default function Table(props) {
10
+ const [headers, setHeaders] = useState([]);
11
+ const [values, setValues] = useState([]);
12
+ const [config, setConfig] = useState({ wides: [], types: [], extends: [] });
13
+ const [showExtends, setShowExtends] = useState(-1);
14
+
15
+ useEffect(() => {
16
+ const tempConfig = { wides: [], types: [], extends: [] };
17
+ const headersName = [];
18
+ const values = [];
19
+ props.headers.forEach(({ width, name, type }) => {
20
+ tempConfig.wides.push(width);
21
+ tempConfig.types.push(type);
22
+ headersName.push(name);
23
+ });
24
+ Object.entries(props.data).forEach(([key, columns]) => {
25
+ const copy = columns.extends
26
+ ? Object.entries(columns.extends).map(([keyExt, columnsExt]) => ({
27
+ key: keyExt,
28
+ columns: columnsExt,
29
+ }))
30
+ : undefined;
31
+ tempConfig.extends.push(copy);
32
+ values.push({ key, columns });
33
+ });
34
+ setValues(values);
35
+ setHeaders(headersName);
36
+ setConfig(tempConfig);
37
+ }, [props.data, props.headers]);
38
+
39
+ const getTypeColumn = (index, key, value, id, isDetail) => {
40
+ switch (config.types[index]) {
41
+ case "groupImages":
42
+ let images = [];
43
+ if (value.length > 4) {
44
+ const remaining = value.length - 3;
45
+ value.forEach((e, i) => {
46
+ if (i >= 3) return;
47
+ images.push({ ...e, src: getRetailerPicture(e.id) });
48
+ });
49
+ images.push({
50
+ id: -1,
51
+ src: `+${remaining}`,
52
+ name: `+${remaining} Cadenas`,
53
+ });
54
+ } else {
55
+ images = value.map((e) => ({ ...e, src: getRetailerPicture(e.id) }));
56
+ }
57
+ return <ImageGroup images={images} />;
58
+ case "services":
59
+ return (
60
+ <div className="flex">{value.map((e) => servicesCodeIcon[e])}</div>
61
+ );
62
+ case "status":
63
+ return (
64
+ <div className="center">{value && <Status statusType={value} />}</div>
65
+ );
66
+ case "checkout":
67
+ return (
68
+ !isDetail && (
69
+ <div className="center CheckBoxTable">
70
+ <CheckBox
71
+ id={`${key}-${id}`}
72
+ onChange={(e) => {
73
+ e.stopPropagation();
74
+ value && value.onChange(id, e.target.checked);
75
+ }}
76
+ defaultChecked={value.value}
77
+ />
78
+ </div>
79
+ )
80
+ );
81
+ default:
82
+ return value;
83
+ }
84
+ };
85
+
86
+ return (
87
+ <>
88
+ <Header>
89
+ {headers.map((headers, i) => (
90
+ <Column key={`header-${i}`} width={config.wides[i]} isHeader>
91
+ {headers}
92
+ </Column>
93
+ ))}
94
+ </Header>
95
+ {values.map((v, index) => (
96
+ <>
97
+ <Rows
98
+ key={`row-${v.key}`}
99
+ index={index}
100
+ onClick={() => setShowExtends(showExtends === index ? -1 : index)}
101
+ >
102
+ {Object.entries(v.columns).map(
103
+ ([key, c], i) =>
104
+ key !== "extends" && (
105
+ <Column key={`${v.key}-${i}`} width={config.wides[i]}>
106
+ {getTypeColumn(i, key, c, v.key)}
107
+ </Column>
108
+ )
109
+ )}
110
+ </Rows>
111
+ {showExtends === index &&
112
+ config.extends[index] &&
113
+ Object.values(config.extends[index]).map((v, idx) => (
114
+ <Rows key={`extends-${v.key}`} index={idx}>
115
+ {Object.entries(v.columns).map(
116
+ ([key, c], i) =>
117
+ key !== "extends" && (
118
+ <Column
119
+ key={`extends-${v.key}-${i}`}
120
+ width={config.wides[i]}
121
+ >
122
+ {getTypeColumn(i, key, c, v.key, true)}
123
+ </Column>
124
+ )
125
+ )}
126
+ </Rows>
127
+ ))}
128
+ </>
129
+ ))}
130
+ </>
131
+ );
132
+ }
@@ -0,0 +1,49 @@
1
+ import styled from "styled-components";
2
+
3
+ export const Header = styled.div`
4
+ display: flex;
5
+ height: 35px;
6
+ width: 100%;
7
+ border-radius: 5px 5px 0px 0px;
8
+ background: #f0f0f0;
9
+ position: sticky;
10
+ top: 0;
11
+ z-index: 10;
12
+ `;
13
+
14
+ export const Column = styled.div`
15
+ display: flex;
16
+ align-items: center;
17
+ height: 35px;
18
+ width: ${({ width }) => `${width}px`};
19
+ padding: 10px 15px;
20
+ font-family: Roboto;
21
+ font-size: 12px;
22
+ color: ${({ isHeader }) => (isHeader ? "#262626" : "#707070")};
23
+ font-weight: ${({ isHeader }) => (isHeader ? "600" : "500")};
24
+ white-space: nowrap;
25
+ text-overflow: ellipsis;
26
+ .flex {
27
+ display: flex;
28
+ }
29
+ .material-icons.small {
30
+ font-size: 18px;
31
+ color: #b3b3b3;
32
+ }
33
+ .center {
34
+ margin: auto;
35
+ }
36
+ &:nth-child(2) {
37
+ overflow: hidden;
38
+ }
39
+ `;
40
+
41
+ export const Rows = styled.div`
42
+ display: flex;
43
+ background: ${({ index }) => (index % 2 === 0 ? "#FFFFFF" : "#FAFAFA")};
44
+ overflow-y: auto;
45
+ &:hover {
46
+ cursor: pointer;
47
+ background: #d4d1d7;
48
+ }
49
+ `;
@@ -0,0 +1,27 @@
1
+ export const servicesCodeIcon = {
2
+ datasheet: (
3
+ <span key="datasheet" className="material-icons small">
4
+ &#xf8ee;
5
+ </span>
6
+ ),
7
+ description: (
8
+ <span key="description" className="material-icons small">
9
+ &#xe873;
10
+ </span>
11
+ ),
12
+ image: (
13
+ <span key="image" className="material-icons small">
14
+ &#xe3f4;
15
+ </span>
16
+ ),
17
+ translate: (
18
+ <span key="translate" className="material-icons small">
19
+ &#xe8e2;
20
+ </span>
21
+ ),
22
+ build: (
23
+ <span key="build" className="material-icons small">
24
+ &#xe1bd;
25
+ </span>
26
+ ),
27
+ };
@@ -56,6 +56,12 @@
56
56
  font-weight: 400;
57
57
  }
58
58
 
59
+ @font-face {
60
+ font-family: "Roboto";
61
+ src: url("../assets/fonts/Roboto/Roboto-Regular.ttf");
62
+ font-weight: 400;
63
+ }
64
+
59
65
  .prueba {
60
66
  color: #9e3e26;
61
67
  color: #b42983;
@@ -28,6 +28,7 @@ export const FontFamily = {
28
28
  Raleway_900: "Raleway-900",
29
29
  RobotoMedium: "RobotoMedium",
30
30
  RobotoRegular: "RobotoRegular",
31
+ Roboto: "Roboto",
31
32
  };
32
33
 
33
34
  export const GlobalStatus = [