contentoh-components-library 21.4.61 → 21.4.62

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 (69) hide show
  1. package/dist/components/molecules/BoxAttribute/styles.js +1 -1
  2. package/dist/components/molecules/BoxButtons/index.js +1 -0
  3. package/dist/components/molecules/TagAndInput/index.js +64 -3
  4. package/dist/components/organisms/InputGroup/index.js +153 -48
  5. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +82 -146
  6. package/dist/components/pages/ProviderProductEdition/index.js +173 -138
  7. package/dist/components/pages/RetailerProductEdition/index.js +2 -2
  8. package/package.json +1 -1
  9. package/src/assets/images/Icons/info.svg +8 -0
  10. package/src/components/atoms/TabSection/styles.js +1 -1
  11. package/src/components/molecules/BoxAttribute/BoxAttribute.stories.js +16 -0
  12. package/src/components/molecules/BoxAttribute/index.js +71 -0
  13. package/src/components/molecules/BoxAttribute/styles.js +38 -0
  14. package/src/components/molecules/BoxButtons/BoxButtons.stories.js +15 -0
  15. package/src/components/molecules/BoxButtons/index.js +28 -0
  16. package/src/components/molecules/BoxButtons/styles.js +43 -0
  17. package/src/components/molecules/TagAndInput/index.js +52 -8
  18. package/src/components/organisms/Box/Box.stories.js +17 -0
  19. package/src/components/organisms/Box/index.js +103 -0
  20. package/src/components/organisms/Box/styles.js +48 -0
  21. package/src/components/organisms/BoxOnboarding/BoxOnboarding.stories.js +17 -0
  22. package/src/components/organisms/BoxOnboarding/index.js +60 -0
  23. package/src/components/organisms/BoxOnboarding/styles.js +44 -0
  24. package/src/components/organisms/InputGroup/index.js +233 -87
  25. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +86 -175
  26. package/src/components/pages/ProviderProductEdition/index.js +43 -16
  27. package/src/components/pages/RetailerProductEdition/index.js +4 -2
  28. package/dist/components/atoms/ImageCarousel/ImgeSlider.stories.js +0 -90
  29. package/dist/components/atoms/ImageCarousel/index.js +0 -120
  30. package/dist/components/atoms/ImageCarousel/styles.js +0 -18
  31. package/dist/components/atoms/PercentTag/PercentTag.stories.js +0 -31
  32. package/dist/components/atoms/PercentTag/index.js +0 -23
  33. package/dist/components/atoms/PercentTag/styles.js +0 -22
  34. package/dist/components/atoms/RatingStars/RatingStars.stories.js +0 -30
  35. package/dist/components/atoms/RatingStars/index.js +0 -53
  36. package/dist/components/atoms/RatingStars/styles.js +0 -18
  37. package/dist/components/atoms/RetailerCatalog/RetailerCatalog.stories.js +0 -48
  38. package/dist/components/atoms/RetailerCatalog/index.js +0 -69
  39. package/dist/components/atoms/RetailerCatalog/styles.js +0 -20
  40. package/dist/components/atoms/RetailerOption/RetailerOption.stories.js +0 -33
  41. package/dist/components/atoms/RetailerOption/index.js +0 -62
  42. package/dist/components/atoms/RetailerOption/styles.js +0 -20
  43. package/dist/components/atoms/RetailersList/RetailersList.stories.js +0 -45
  44. package/dist/components/atoms/RetailersList/index.js +0 -46
  45. package/dist/components/atoms/RetailersList/styles.js +0 -18
  46. package/dist/components/atoms/UserCatalog/UserCatalog.stories.js +0 -73
  47. package/dist/components/atoms/UserCatalog/index.js +0 -101
  48. package/dist/components/atoms/UserCatalog/styles.js +0 -18
  49. package/dist/components/atoms/UserOption/UserOption.stories.js +0 -40
  50. package/dist/components/atoms/UserOption/index.js +0 -130
  51. package/dist/components/atoms/UserOption/styles.js +0 -20
  52. package/dist/components/atoms/UserSelector/UserSelector.stories.js +0 -40
  53. package/dist/components/atoms/UserSelector/index.js +0 -98
  54. package/dist/components/atoms/UserSelector/styles.js +0 -32
  55. package/dist/components/molecules/GridItem/GridItem.stories.js +0 -123
  56. package/dist/components/molecules/GridItem/index.js +0 -152
  57. package/dist/components/molecules/GridItem/styles.js +0 -20
  58. package/dist/components/molecules/HeaderItem/ColumnItem.js +0 -23
  59. package/dist/components/molecules/HeaderItem/HeaderItem.stories.js +0 -70
  60. package/dist/components/molecules/HeaderItem/index.js +0 -42
  61. package/dist/components/molecules/HeaderItem/styles.js +0 -30
  62. package/dist/components/molecules/RowItem/ColumnItem.js +0 -23
  63. package/dist/components/molecules/RowItem/RowItem.stories.js +0 -5242
  64. package/dist/components/molecules/RowItem/index.js +0 -58
  65. package/dist/components/molecules/RowItem/styles.js +0 -30
  66. package/dist/components/organisms/GridProducts/GridProducts.stories.js +0 -5097
  67. package/dist/components/organisms/GridProducts/index.js +0 -63
  68. package/dist/components/organisms/GridProducts/styles.js +0 -18
  69. package/dist/components/organisms/GridProducts/utils.js +0 -149
@@ -0,0 +1,38 @@
1
+ import styled from "styled-components";
2
+ import { FontFamily, GlobalColors } from "../../../global-files/variables";
3
+
4
+ export const Container = styled.div`
5
+ display: flex;
6
+ align-items: center;
7
+ gap:4px;
8
+ #atr-alto {
9
+ display: flex;
10
+ align-items: center;
11
+ justify-content: space-between;
12
+ }
13
+ .caja-borde {
14
+ font-family: ${FontFamily.RobotoMedium}, sans-serif;
15
+ font-size: 12px;
16
+ line-height: 1.2;
17
+ border-radius: ${({ borderType }) => {
18
+ return borderType?.toLowerCase() === "rectangle"
19
+ ? "5px"
20
+ : borderType?.toLowerCase() === "circle"
21
+ ? "50%"
22
+ : "none";
23
+ }};
24
+ }
25
+ span {
26
+ font-family: ${FontFamily.RobotoMedium}, sans-serif;
27
+ font-size: 12px;
28
+ line-height: 1.2;
29
+ font-weight: 600;
30
+ }
31
+ .icon {
32
+ width: 8px;
33
+ height: 8px;
34
+ }
35
+ .required-text {
36
+ color: red;
37
+ }
38
+ `;
@@ -0,0 +1,15 @@
1
+ import { BoxButtons } from "./index";
2
+
3
+ export default {
4
+ title: "Components/molecules/BoxButtons",
5
+ component: BoxButtons,
6
+ };
7
+
8
+ const Template = (args) => <BoxButtons {...args} />;
9
+
10
+ export const BoxButtonsDefault = Template.bind({});
11
+
12
+ BoxButtonsDefault.args = {
13
+ text:"texto prueba",
14
+ showAdd:true,
15
+ };
@@ -0,0 +1,28 @@
1
+ import { Container, ContainerIcon } from "./styles";
2
+ import { Button } from "@mui/material";
3
+
4
+ export const BoxButtons = ({ showAdd, onAdd, onDelete, isTheFirstBox, index }) => {
5
+ console.log("index",index)
6
+ return (
7
+ <Container index={index}>
8
+ {!isTheFirstBox && (
9
+ <Button
10
+ variant="outlined"
11
+ className="button-circle"
12
+ onClick={onDelete}
13
+ >
14
+ <ContainerIcon>
15
+ <span className="iconos-out">delete_forever</span>
16
+ </ContainerIcon>
17
+ </Button>
18
+ )}
19
+ {showAdd && (
20
+ <Button onClick={onAdd} variant="outlined" className="button-circle">
21
+ <ContainerIcon>
22
+ <span className="iconos-out iconos-grises">add</span>
23
+ </ContainerIcon>
24
+ </Button>
25
+ )}
26
+ </Container>
27
+ );
28
+ };
@@ -0,0 +1,43 @@
1
+ import styled from "styled-components";
2
+ import { GlobalColors } from "../../../global-files/variables";
3
+
4
+ export const Container = styled.div`
5
+ display:flex;
6
+ flex-direction:row;
7
+ gap:8px;
8
+ .button-circle{
9
+ width:30px;
10
+ height:30px;
11
+ padding:2px;
12
+ border-radius:100%;
13
+ min-width:30px;
14
+ border: 1px solid #F0F0F0;
15
+ }
16
+ .button-circle:hover {
17
+ border: 1px solid #F0F0F0;
18
+ }
19
+
20
+ `;
21
+ export const ContainerIcon = styled.div`
22
+ cursor: pointer;
23
+ @font-face {
24
+ font-family: "Material Symbols Outlined";
25
+ font-style: normal;
26
+ font-weight: 100 700;
27
+ src: url(https://fonts.gstatic.com/s/materialsymbolsoutlined/v68/kJEhBvYX7BgnkSrUwT8OhrdQw4oELdPIeeII9v6oFsLjBuVY.woff2)
28
+ format("woff2");
29
+ }
30
+ .iconos-out {
31
+ font-family: "Material Symbols Outlined";
32
+ font-size: 20px;
33
+ //line-height: 1;
34
+ margin-top: 10px;
35
+ }
36
+ .iconos-out {
37
+ font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 48;
38
+ color: #B64545;
39
+ }
40
+ .iconos-grises {
41
+ font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 48;
42
+ color: ${GlobalColors.gray};
43
+ }`;
@@ -1,6 +1,7 @@
1
1
  import { Container } from "./styles";
2
2
  import { ScreenHeader } from "../../atoms/ScreenHeader/index";
3
3
  import { GeneralInput } from "../../atoms/GeneralInput/index";
4
+ import { useState, useEffect } from "react";
4
5
 
5
6
  export const TagAndInput = ({
6
7
  inputType,
@@ -29,21 +30,54 @@ export const TagAndInput = ({
29
30
  onKeyDown,
30
31
  showTooltip,
31
32
  auditClass,
33
+ onChange,
34
+ dataInputs,
35
+ inputGroup,
36
+ boxOnboardingData,
32
37
  }) => {
38
+ const [boxOnboardingList, setBoxOnboardingList] = useState(boxOnboardingData || []);
39
+
40
+ useEffect(() => {
41
+ const temp = {};
42
+ let maxBoxId = 0;
43
+ inputGroup?.inputs.forEach((attrId) => {
44
+ if (!dataInputs[attrId].box) return;
45
+ Object.entries(dataInputs[attrId].box).forEach(([boxId, value]) => {
46
+ if (boxId > maxBoxId) maxBoxId = boxId;
47
+ if (!temp[boxId]) temp[boxId] = {};
48
+ temp[boxId][attrId] = value;
49
+ });
50
+ });
51
+ const tempList = Object.values(temp);
52
+ if (tempList.length > 0) {
53
+ setBoxOnboardingList(
54
+ tempList.map((value, index) =>
55
+ index === tempList.length - 1 ? {value } : { value }
56
+ )
57
+ );
58
+ }
59
+ }, []);
60
+
61
+ useEffect(() => {
62
+ onChange && onChange(boxOnboardingList);
63
+ }, [boxOnboardingList]);
64
+
33
65
  return (
34
66
  <Container
35
67
  inputType={inputType}
36
68
  className={"input-container"}
37
69
  key={`generalTagInput-${inputType}`}
38
70
  >
39
- <div className="title-container">
40
- <ScreenHeader
41
- text={label}
42
- headerType={"input-name-header"}
43
- color={color}
44
- />
45
- {showTooltip && <span className="tooltip">{label}</span>}
46
- </div>
71
+ {label?.length && (
72
+ <div className="title-container">
73
+ <ScreenHeader
74
+ text={label}
75
+ headerType={"input-name-header"}
76
+ color={color}
77
+ />
78
+ {showTooltip && <span className="tooltip">{label}</span>}
79
+ </div>
80
+ )}
47
81
  <GeneralInput
48
82
  inputId={inputId}
49
83
  inputType={inputType}
@@ -68,6 +102,16 @@ export const TagAndInput = ({
68
102
  inputOnChange={inputOnChange}
69
103
  onKeyDown={onKeyDown}
70
104
  auditClass={auditClass}
105
+ onChange={(e) => {
106
+ setBoxOnboardingList((prev) => {
107
+ return prev.map((box, i) => {
108
+ if (i != index) {
109
+ return box;
110
+ }
111
+ return { ...box, value: e };
112
+ });
113
+ });
114
+ }}
71
115
  />
72
116
  </Container>
73
117
  );
@@ -0,0 +1,17 @@
1
+ import { Box } from "./index";
2
+ import LoginImage from "../../../assets/images/carouselImagesLogin/loginImage.svg";
3
+ import Login2 from "../../../assets/images/carouselImagesLogin/login2.svg";
4
+ import Login3 from "../../../assets/images/carouselImagesLogin/login3.svg";
5
+
6
+ export default {
7
+ title: "Components/organisms/Box",
8
+ component: Box,
9
+ };
10
+
11
+ const Template = (args) => <Box {...args} />;
12
+
13
+ export const BoxDefault = Template.bind({});
14
+ BoxDefault.args = {
15
+ panelImg:[LoginImage, Login2, Login3],
16
+ panelText:"Elige la plataforma que conecta proovedores y retailers",
17
+ };
@@ -0,0 +1,103 @@
1
+ import React, { useState, useEffect } from "react";
2
+ import { Container } from "./styles";
3
+ import { FontFamily, GlobalColors } from "../../../global-files/variables";
4
+ import { BoxOnboarding } from "../BoxOnboarding";
5
+ import { BoxButtons } from "../../molecules/BoxButtons";
6
+
7
+ export const Box = ({ onChange, dataInputs, inputGroup }) => {
8
+ const [isDeleteDisabled, setIsDeleteDisabled] = useState(true);
9
+ const [boxOnboardingList, setBoxOnboardingList] = useState([
10
+ {
11
+ showAdd: true,
12
+ value: {},
13
+ },
14
+ ]);
15
+
16
+ useEffect(() => {
17
+ const temp = {};
18
+ let maxBoxId = 0;
19
+ inputGroup.inputs.forEach((attrId) => {
20
+ if (!dataInputs[attrId].box) return;
21
+ Object.entries(dataInputs[attrId].box).forEach(([boxId, value]) => {
22
+ if (boxId > maxBoxId) maxBoxId = boxId;
23
+ if (!temp[boxId]) temp[boxId] = {};
24
+ temp[boxId][attrId] = value;
25
+ });
26
+ });
27
+ const tempList = Object.values(temp);
28
+ if (tempList.length > 0) {
29
+ setBoxOnboardingList(
30
+ tempList.map((value, index) =>
31
+ index === tempList.length - 1 ? { showAdd: true, value } : { value }
32
+ )
33
+ );
34
+ }
35
+ }, []);
36
+
37
+ const handleAddBoxOnboarding = () => {
38
+ const newBoxOnboarding = {
39
+ showAdd: false,
40
+ value: {},
41
+ };
42
+
43
+ setBoxOnboardingList([...boxOnboardingList, newBoxOnboarding]);
44
+ };
45
+
46
+ const handleDeleteBoxOnboarding = (index) => {
47
+ if (index !== 0) {
48
+ const updatedBoxOnboardingList = [...boxOnboardingList];
49
+ updatedBoxOnboardingList.splice(index, 1);
50
+ setBoxOnboardingList(updatedBoxOnboardingList);
51
+ } else {
52
+ setIsDeleteDisabled(true);
53
+ }
54
+ };
55
+
56
+ useEffect(() => {
57
+ onChange && onChange(boxOnboardingList);
58
+ }, [boxOnboardingList]);
59
+
60
+ return (
61
+ <Container
62
+ fontFamily={FontFamily.Raleway}
63
+ color={GlobalColors.original_magenta}
64
+ >
65
+ <h1 fontFamily={FontFamily.Raleway}>{inputGroup.dataGroup}</h1>
66
+ <div className="container-box">
67
+ {boxOnboardingList.map((boxOnboarding, index) => (
68
+ <>
69
+
70
+ <div className="container-buttons">
71
+ <BoxOnboarding
72
+ key={index}
73
+ index={index}
74
+ showAdd={boxOnboarding.showAdd}
75
+ data={boxOnboarding.value}
76
+ dataInputs={dataInputs}
77
+ inputs={inputGroup.inputs}
78
+ onChange={(e) => {
79
+ setBoxOnboardingList((prev) => {
80
+ return prev.map((box, i) => {
81
+ if (i != index) {
82
+ return box;
83
+ }
84
+ return { ...box, value: e };
85
+ });
86
+ });
87
+ }}
88
+ />
89
+ <BoxButtons
90
+ key={index}
91
+ index={index}
92
+ showAdd={boxOnboarding.showAdd}
93
+ onAdd={handleAddBoxOnboarding}
94
+ onDelete={() => handleDeleteBoxOnboarding(index)}
95
+ isDeleteDisabled={isDeleteDisabled}
96
+ />
97
+ </div>
98
+ </>
99
+ ))}
100
+ </div>
101
+ </Container>
102
+ );
103
+ };
@@ -0,0 +1,48 @@
1
+ import styled from "styled-components";
2
+ import { FontFamily, GlobalColors } from "../../../global-files/variables";
3
+
4
+ export const Container = styled.div`
5
+ font-family: ${FontFamily.Roboto}, sans-serif;
6
+ font-weight: 400;
7
+ display: flex;
8
+ flex-direction: column;
9
+ gap: 10px;
10
+ font-size: var(--size);
11
+ line-height: 1.2;
12
+ height: auto;
13
+ border-radius: 10px;
14
+ background: white;
15
+ position: relative;
16
+ overflow: hidden;
17
+ width: 100%;
18
+ text-align: center;
19
+ .container-buttons {
20
+ display: flex;
21
+ gap:10px;
22
+ }
23
+ .container-box{
24
+ display: flex;
25
+ flex-direction:column-reverse;
26
+ gap:10px;
27
+ }
28
+ #contenedor-caja {
29
+ display: flex;
30
+ justify-content: space-between;
31
+ color: #262626;
32
+ white-space: nowrap;
33
+ gap: 10px;
34
+ }
35
+ #atr-alto {
36
+ display: flex;
37
+ justify-content: space-between;
38
+ align-items: center;
39
+ gap: 6px;
40
+ }
41
+ h1 {
42
+ font-family: ${FontFamily.RobotoMedium}, sans-serif;
43
+ font-size: 17px;
44
+ line-height: 1.2;
45
+ font-weight: 500;
46
+ text-align: left;
47
+ }
48
+ `;
@@ -0,0 +1,17 @@
1
+ import { BoxOnboarding } from "./index";
2
+ import LoginImage from "../../../assets/images/carouselImagesLogin/loginImage.svg";
3
+ import Login2 from "../../../assets/images/carouselImagesLogin/login2.svg";
4
+ import Login3 from "../../../assets/images/carouselImagesLogin/login3.svg";
5
+
6
+ export default {
7
+ title: "Components/organisms/BoxOnboarding",
8
+ component: BoxOnboarding,
9
+ };
10
+
11
+ const Template = (args) => <BoxOnboarding {...args} />;
12
+
13
+ export const BoxOnboardingDefault = Template.bind({});
14
+ BoxOnboardingDefault.args = {
15
+ panelImg:[LoginImage, Login2, Login3],
16
+ panelText:"Elige la plataforma que conecta proovedores y retailers",
17
+ };
@@ -0,0 +1,60 @@
1
+ import { Container } from "./styles";
2
+ import { FontFamily, GlobalColors } from "../../../global-files/variables";
3
+ import { BoxAttribute } from "../../molecules/BoxAttribute";
4
+ import { useState, useEffect, memo } from "react";
5
+ import { isEqual } from "lodash";
6
+
7
+ export const BoxOnboarding = memo(
8
+ ({
9
+ panelColor,
10
+ index,
11
+ onChange,
12
+ data,
13
+ dataInputs,
14
+ inputs,
15
+ }) => {
16
+ const [atributos, setAtributos] = useState({});
17
+ const [isLoading, setIsLoading] = useState(true);
18
+
19
+ useEffect(() => {
20
+ onChange && onChange(atributos);
21
+ }, [atributos]);
22
+
23
+
24
+ useEffect(() => {
25
+ if (isLoading && Object.keys(data).length > 0) {
26
+ setAtributos(data);
27
+ setIsLoading(false);
28
+ }
29
+ }, [data]);
30
+
31
+ return (
32
+ <Container
33
+ panelColor={panelColor}
34
+ fontFamily={FontFamily.Raleway}
35
+ color={GlobalColors.original_magenta}
36
+ >
37
+ <div id="contenedor-caja">
38
+ <p fontFamily={FontFamily.Raleway}>Caja {index + 1}</p>
39
+ {inputs.map((attrId) => {
40
+ return (
41
+ <BoxAttribute
42
+ id={attrId}
43
+ key={attrId}
44
+ borderType="rectangle"
45
+ className="caja"
46
+ text={dataInputs[attrId]?.name}
47
+ required={dataInputs[attrId]?.required}
48
+ description={dataInputs[attrId]?.description}
49
+ atributos={atributos}
50
+ setAtributos={setAtributos}
51
+ />
52
+ );
53
+ })}
54
+
55
+ </div>
56
+ </Container>
57
+ );
58
+ },
59
+ isEqual
60
+ );
@@ -0,0 +1,44 @@
1
+ import styled from "styled-components";
2
+ import { FontFamily, GlobalColors } from "../../../global-files/variables";
3
+
4
+ export const Container = styled.div`
5
+ font-family: ${FontFamily.Roboto}, sans-serif;
6
+ font-weight: 400;
7
+ font-size: var(--size);
8
+ line-height: 1.2;
9
+ background: white;
10
+ position: relative;
11
+ overflow: hidden;
12
+ width: 80%;
13
+ height: 100%;
14
+ text-align: center;
15
+ #contenedor-caja {
16
+ display: flex;
17
+ justify-content: space-between;
18
+ color: #262626;
19
+ }
20
+ #atr-alto {
21
+ display: flex;
22
+ justify-content: space-between;
23
+ align-items: center;
24
+ }
25
+ p {
26
+ font-family: ${FontFamily.RobotoMedium}, sans-serif;
27
+ font-size: 12px;
28
+ line-height: 1.2;
29
+ font-weight: 600;
30
+ align-self: center;
31
+ }
32
+ }
33
+ .icon-red {
34
+ color: #B64545;
35
+ height:18px;
36
+ }
37
+ .icon-gray {
38
+ color: #707070;
39
+ }
40
+ .icon-gray-l {
41
+ color: #707070;
42
+ height:18px;
43
+ }
44
+ `