contentoh-components-library 0.1.1 → 6.0.0

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 (185) hide show
  1. package/.env.development +16 -3
  2. package/.env.production +14 -1
  3. package/CHANGELOG.md +40 -0
  4. package/package.json +10 -4
  5. package/src/assets/images/arrow/arrowIcon.svg +3 -0
  6. package/src/assets/images/arrow/polygon.svg +3 -0
  7. package/src/assets/images/card/masterCardIcon.svg +5 -0
  8. package/src/assets/images/componentAssigned/assignedImage1.svg +9 -0
  9. package/src/assets/images/componentAssigned/assignedImage2.svg +9 -0
  10. package/src/assets/images/componentAssigned/clock.svg +4 -0
  11. package/src/assets/images/componentAssigned/flag.svg +3 -0
  12. package/src/assets/images/defaultImages/defaultUpdate.png +0 -0
  13. package/src/assets/images/editField/editField.svg +3 -0
  14. package/src/assets/images/generalButton/deleteIcon.svg +13 -0
  15. package/src/assets/images/generalButton/deleteIconHover.svg +13 -0
  16. package/src/assets/images/generalButton/saveIcon.svg +3 -0
  17. package/src/assets/images/generalButton/saveIconHover.svg +3 -0
  18. package/src/assets/images/generalImage/assigned.svg +14 -0
  19. package/src/assets/images/generalImage/bags.svg +25 -0
  20. package/src/assets/images/generalImage/clock.svg +4 -0
  21. package/src/assets/images/generalImage/flag.svg +3 -0
  22. package/src/assets/images/genericModal/genericModalCheck.svg +3 -0
  23. package/src/assets/images/genericModal/genericModalClose.svg +3 -0
  24. package/src/assets/images/genericModal/genericModalDown.svg +3 -0
  25. package/src/assets/images/genericModal/genericModalUp.svg +3 -0
  26. package/src/assets/images/genericModal/genericModalWarning.svg +12 -0
  27. package/src/assets/images/logo/logoLogin.svg +15 -0
  28. package/src/assets/images/menuNotification/menuNotificationComment.svg +3 -0
  29. package/src/assets/images/menuNotification/menuNotificationProduct.svg +3 -0
  30. package/src/assets/images/menuProfile/logOut.svg +3 -0
  31. package/src/assets/images/menuProfile/myAccount.svg +3 -0
  32. package/src/assets/images/menuProfile/settings.svg +3 -0
  33. package/src/assets/images/modalsSVGs/attributesSent.svg +208 -0
  34. package/src/assets/images/modalsSVGs/descriptionSent.svg +237 -0
  35. package/src/assets/images/modalsSVGs/providerSent.svg +445 -0
  36. package/src/assets/images/modalsSVGs/uploadingImages.svg +148 -0
  37. package/src/assets/images/productNotification/productNotification.svg +3 -0
  38. package/src/assets/images/profileHeader/profilePicture.svg +9 -0
  39. package/src/components/atoms/AsignationOption/index.js +6 -4
  40. package/src/components/atoms/AsignationOption/styles.js +3 -1
  41. package/src/components/atoms/AtomList/index.js +4 -2
  42. package/src/components/atoms/AtomList/styles.js +4 -2
  43. package/src/components/atoms/Avatar/index.js +2 -1
  44. package/src/components/atoms/Card/Card.stories.js +12 -0
  45. package/src/components/atoms/Card/index.js +9 -0
  46. package/src/components/atoms/Card/styles.js +8 -0
  47. package/src/components/atoms/CheckBox/index.js +1 -1
  48. package/src/components/atoms/Commentary/Commentary.stories.js +0 -0
  49. package/src/components/atoms/Commentary/index.js +9 -0
  50. package/src/components/atoms/Commentary/styles.js +15 -0
  51. package/src/components/atoms/CustomerTypeImage/index.js +1 -1
  52. package/src/components/atoms/EditField/EditField.stories.js +13 -0
  53. package/src/components/atoms/EditField/index.js +15 -0
  54. package/src/components/atoms/EditField/styles.js +35 -0
  55. package/src/components/atoms/GeneralButton/GeneralButton.stories.js +3 -0
  56. package/src/components/atoms/GeneralButton/index.js +7 -1
  57. package/src/components/atoms/GeneralButton/styles.js +56 -9
  58. package/src/components/atoms/GeneralInput/index.js +62 -9
  59. package/src/components/atoms/GeneralInput/styles.js +3 -1
  60. package/src/components/atoms/GeneralTextBox/index.js +7 -6
  61. package/src/components/atoms/GeneralTextBox/styles.js +1 -1
  62. package/src/components/atoms/GenericModal/GenericModal.stories.js +140 -0
  63. package/src/components/atoms/GenericModal/index.js +12 -0
  64. package/src/components/atoms/GenericModal/styles.js +126 -0
  65. package/src/components/atoms/GradientPanel/GradientPanel.stories.js +110 -3
  66. package/src/components/atoms/GradientPanel/index.js +4 -2
  67. package/src/components/atoms/GradientPanel/styles.js +111 -8
  68. package/src/components/atoms/Graphic/Graphic.stories.js +21 -0
  69. package/src/components/atoms/Graphic/index.js +18 -0
  70. package/src/components/atoms/Graphic/styles.js +4 -0
  71. package/src/components/atoms/Input/index.js +14 -0
  72. package/src/components/atoms/Input/style.js +27 -0
  73. package/src/components/atoms/LabelToInput/index.js +27 -0
  74. package/src/components/atoms/LabelToInput/style.js +30 -0
  75. package/src/components/atoms/LoadImageMenu/LoadImageMenu.stories.js +17 -0
  76. package/src/components/atoms/LoadImageMenu/index.js +58 -0
  77. package/src/components/atoms/LoadImageMenu/styles.js +72 -0
  78. package/src/components/atoms/LogoImage/LogoImage.stories.js +10 -0
  79. package/src/components/atoms/LogoImage/index.js +10 -0
  80. package/src/components/atoms/LogoImage/styles.js +12 -0
  81. package/src/components/atoms/MenuNotification/MenuNotification.stories.js +17 -0
  82. package/src/components/atoms/MenuNotification/index.js +30 -0
  83. package/src/components/atoms/MenuNotification/styles.js +50 -0
  84. package/src/components/atoms/MenuProfile/MenuProfile.stories.js +13 -0
  85. package/src/components/atoms/MenuProfile/index.js +31 -0
  86. package/src/components/atoms/MenuProfile/styles.js +57 -0
  87. package/src/components/atoms/Notification/Notification.stories.js +16 -0
  88. package/src/components/atoms/Notification/index.js +20 -0
  89. package/src/components/atoms/Notification/styles.js +42 -0
  90. package/src/components/atoms/Percent/Percent.stories.js +38 -0
  91. package/src/components/atoms/Percent/index.js +15 -0
  92. package/src/components/atoms/Percent/styles.js +79 -0
  93. package/src/components/atoms/PriorityFlag/index.js +1 -1
  94. package/src/components/atoms/ProductImage/styles.js +1 -1
  95. package/src/components/atoms/ProgressBar/index.js +2 -2
  96. package/src/components/atoms/ProgressBar/styles.js +53 -3
  97. package/src/components/atoms/ScreenHeader/ScreenHeader.stories.js +9 -0
  98. package/src/components/atoms/ScreenHeader/index.js +4 -1
  99. package/src/components/atoms/ScreenHeader/styles.js +17 -6
  100. package/src/components/atoms/Select/index.js +33 -0
  101. package/src/components/atoms/Select/style.js +77 -0
  102. package/src/components/atoms/StatusTag/styles.js +9 -1
  103. package/src/components/atoms/ValidationPanel/index.js +3 -3
  104. package/src/components/molecules/AddProvidersAndProducts/AddProvidersAndProducts.stories.js +16 -0
  105. package/src/components/molecules/AddProvidersAndProducts/index.js +19 -0
  106. package/src/components/molecules/AddProvidersAndProducts/styles.js +23 -0
  107. package/src/components/molecules/AssignedWork/AssignedWork.stories.js +41 -0
  108. package/src/components/molecules/AssignedWork/index.js +40 -0
  109. package/src/components/molecules/AssignedWork/styles.js +111 -0
  110. package/src/components/molecules/AvatarAndValidation/index.js +24 -6
  111. package/src/components/molecules/AvatarAndValidation/styles.js +1 -1
  112. package/src/components/molecules/EditionActiveImage/index.js +5 -2
  113. package/src/components/molecules/FeaturesBar/index.js +21 -8
  114. package/src/components/molecules/FeaturesBar/styles.js +9 -2
  115. package/src/components/molecules/GalleryElement/index.js +59 -37
  116. package/src/components/molecules/GalleryElement/styles.js +38 -11
  117. package/src/components/molecules/GalleryHeader/GalleryHeader.stories.js +10 -0
  118. package/src/components/molecules/GalleryHeader/index.js +19 -0
  119. package/src/components/molecules/GalleryHeader/styles.js +45 -0
  120. package/src/components/molecules/ImageSelector/index.js +14 -11
  121. package/src/components/molecules/ParentComponent/ParentComponent.stories.js +18 -0
  122. package/src/components/molecules/ParentComponent/index.js +66 -0
  123. package/src/components/molecules/ParentComponent/styles.js +7 -0
  124. package/src/components/molecules/PayMethod/PayMethod.stories.js +12 -0
  125. package/src/components/molecules/PayMethod/index.js +46 -0
  126. package/src/components/molecules/PayMethod/styles.js +31 -0
  127. package/src/components/molecules/PlanSelection/PlanSelection.stories.js +1 -3
  128. package/src/components/molecules/PlanSelection/index.js +1 -1
  129. package/src/components/molecules/PlanSelection/styles.js +2 -2
  130. package/src/components/molecules/ProductNameHeader/index.js +1 -2
  131. package/src/components/molecules/ProductNotification/ProductNotification.stories.js +13 -0
  132. package/src/components/molecules/ProductNotification/index.js +53 -0
  133. package/src/components/molecules/ProductNotification/styles.js +37 -0
  134. package/src/components/molecules/ProfileHeader/ProfileHeader.stories.js +16 -0
  135. package/src/components/molecules/ProfileHeader/index.js +54 -0
  136. package/src/components/molecules/ProfileHeader/styles.js +30 -0
  137. package/src/components/molecules/RetailerSelector/RetailerSelector.stories.js +35 -0
  138. package/src/components/molecules/RetailerSelector/index.js +63 -0
  139. package/src/components/molecules/RetailerSelector/styles.js +18 -0
  140. package/src/components/molecules/SidebarNotification/SidebarNotification.stories.js +101 -0
  141. package/src/components/molecules/SidebarNotification/index.js +95 -0
  142. package/src/components/molecules/SidebarNotification/styles.js +63 -0
  143. package/src/components/molecules/StatusAsignationInfo/index.js +55 -19
  144. package/src/components/molecules/StatusAsignationInfo/styles.js +10 -0
  145. package/src/components/molecules/TableHeader/index.js +5 -2
  146. package/src/components/molecules/TabsMenu/index.js +6 -2
  147. package/src/components/molecules/TagAndInput/index.js +35 -2
  148. package/src/components/molecules/TagAndInput/styles.js +1 -1
  149. package/src/components/organisms/FullProductNameHeader/index.js +28 -7
  150. package/src/components/organisms/FullTabsMenu/index.js +13 -2
  151. package/src/components/organisms/FullTabsMenu/styles.js +1 -1
  152. package/src/components/organisms/Fullplan/FullPlan.stories.js +7 -9
  153. package/src/components/organisms/Fullplan/index.js +1 -1
  154. package/src/components/organisms/Fullplan/styles.js +2 -2
  155. package/src/components/organisms/ImageDataTable/index.js +77 -11
  156. package/src/components/organisms/ImageDataTable/styles.js +8 -0
  157. package/src/components/organisms/ImagePreviewer/index.js +5 -10
  158. package/src/components/organisms/InputGroup/index.js +56 -11
  159. package/src/components/organisms/InputGroup/styles.js +3 -0
  160. package/src/components/organisms/ProductImageModal/ProductImageModal.stories.js +77 -74
  161. package/src/components/organisms/ProductImageModal/index.js +29 -12
  162. package/src/components/organisms/ProductImageModal/styles.js +4 -0
  163. package/src/components/pages/CustomerLogin/CustomerLogin.stories.js +76 -0
  164. package/src/components/pages/CustomerLogin/index.js +22 -0
  165. package/src/components/pages/CustomerLogin/styles.js +12 -0
  166. package/src/components/pages/CustomerPayMethod/CustomerPayMethod.stories.js +56 -0
  167. package/src/components/pages/CustomerPayMethod/index.js +23 -0
  168. package/src/components/pages/CustomerPayMethod/styles.js +21 -0
  169. package/src/components/pages/CustomerType/CustomerType.stories.js +8 -8
  170. package/src/components/pages/CustomerType/styles.js +1 -1
  171. package/src/components/pages/OnboardPlan/OnboardPlan.stories.js +36 -21
  172. package/src/components/pages/OnboardPlan/index.js +8 -9
  173. package/src/components/pages/OnboardPlan/styles.js +16 -10
  174. package/src/components/pages/RetailerPlan/RetailerPlan.stories.js +49 -0
  175. package/src/components/pages/RetailerPlan/index.js +24 -0
  176. package/src/components/pages/RetailerPlan/styles.js +27 -0
  177. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +104 -317
  178. package/src/components/pages/RetailerProductEdition/index.js +809 -34
  179. package/src/components/pages/RetailerProductEdition/styles.js +54 -5
  180. package/src/global-files/data.js +152 -0
  181. package/src/global-files/global-styles.css +10 -0
  182. package/src/global-files/variables.js +1 -0
  183. package/src/components/molecules/TextAndGradient/TextAndGradient.stories.js +0 -23
  184. package/src/components/molecules/TextAndGradient/index.js +0 -23
  185. package/src/components/molecules/TextAndGradient/styles.js +0 -37
@@ -0,0 +1,12 @@
1
+ import {Card} from "./index";
2
+
3
+ export default {
4
+ title: "Components/atoms/Card",
5
+ component: Card,
6
+ };
7
+
8
+ const Template = (args) => <Card {...args}/>;
9
+
10
+ export const CardDefault = Template.bind ({});
11
+
12
+ CardDefault.args = {};
@@ -0,0 +1,9 @@
1
+ import { Container } from "./styles";
2
+
3
+ export const Card = ({ cardIcon, altText }) => {
4
+ return (
5
+ <Container>
6
+ <img src={cardIcon} alt={altText} />
7
+ </Container>
8
+ );
9
+ };
@@ -0,0 +1,8 @@
1
+ import styled from "styled-components";
2
+
3
+ export const Container = styled.div`
4
+ img {
5
+ width: 100%;
6
+ margin:auto;
7
+ }
8
+ `;
@@ -2,7 +2,7 @@ import { Container } from "./styles";
2
2
 
3
3
  export const CheckBox = ({ id, label, onChange, isFilter }) => {
4
4
  return (
5
- <Container>
5
+ <Container key={`check-${id}`}>
6
6
  <input type="checkbox" name={id} id={id} onChange={onChange} />
7
7
  <label htmlFor={id}>
8
8
  {label && <p className={isFilter && "filter-text"}>{label}</p>}
@@ -0,0 +1,9 @@
1
+ import { Container } from "./styles";
2
+
3
+ export const Commentary = ({ comment }) => {
4
+ return (
5
+ <Container>
6
+ <p>{comment}</p>
7
+ </Container>
8
+ );
9
+ };
@@ -0,0 +1,15 @@
1
+ import styled from "styled-components";
2
+ import { FontFamily, GlobalColors } from "../../../global-files/variables";
3
+
4
+ export const Container = styled.div`
5
+ width: 500px;
6
+ height: 80px;
7
+ border: 1px solid ${GlobalColors.s2};
8
+ padding: 10px;
9
+ p {
10
+ font-family: ${FontFamily.AvenirNext};
11
+ font-size: 12px;
12
+ line-height: 15px;
13
+ color: ${GlobalColors.s4};
14
+ }
15
+ `;
@@ -4,7 +4,7 @@ import Proveedor from "../../../assets/images/providerAndCadena/Proveedor.svg";
4
4
 
5
5
  export const CustomerTypeImages = ({ imageType = "retailer" }) => {
6
6
  return (
7
- <Container imageType={imageType}>
7
+ <Container imageType={imageType} key={`image-${imageType}`}>
8
8
  <img
9
9
  src={imageType === "retailer" ? Cadena : Proveedor}
10
10
  alt={imageType === "retailer" ? "Cadena" : "Proveedor"}
@@ -0,0 +1,13 @@
1
+ import { EditField } from "./index";
2
+
3
+ export default {
4
+ title: "Components/atoms/EditField",
5
+ component: EditField,
6
+ };
7
+
8
+ const Template = (args) => <EditField {...args} />;
9
+ export const EditFieldDefault = Template.bind({});
10
+
11
+ EditFieldDefault.args = {
12
+ placeHolder: "Text to edit",
13
+ };
@@ -0,0 +1,15 @@
1
+ import { Container } from "./styles";
2
+ import editField from "../../../assets/images/editField/editField.svg";
3
+
4
+ export const EditField = ({ placeHolder, value }) => {
5
+ return (
6
+ <Container>
7
+ <input type="text" placeHolder={placeHolder} value={value} />
8
+ <div className="button-container">
9
+ <button>
10
+ <img src={editField} alt="save changes icon" />
11
+ </button>
12
+ </div>
13
+ </Container>
14
+ );
15
+ };
@@ -0,0 +1,35 @@
1
+ import styled from "styled-components";
2
+ import { GlobalColors, FontFamily } from "../../../global-files/variables";
3
+
4
+ export const Container = styled.div`
5
+ width: 100%;
6
+ input {
7
+ background-color: ${GlobalColors.s2};
8
+ height: 32px;
9
+ width: 100%;
10
+ border: 2px solid ${GlobalColors.s3};
11
+ border-bottom: none;
12
+ font-size: 15px;
13
+ font-family: ${FontFamily.Lato};
14
+ color: ${GlobalColors.s4};
15
+ font-weight: normal;
16
+ line-height: 18px;
17
+ padding-left: 5px;
18
+ color: ${GlobalColors.s4};
19
+ }
20
+ .button-container {
21
+ background-color: ${GlobalColors.magenta_s2};
22
+ display: flex;
23
+ justify-content: end;
24
+ align-items: center;
25
+ padding: 3px;
26
+ button {
27
+ height: 20px;
28
+ width: 20px;
29
+ border: none;
30
+ background-color: ${GlobalColors.white};
31
+ padding: 0%;
32
+ cursor: pointer;
33
+ }
34
+ }
35
+ `;
@@ -13,11 +13,14 @@ export default {
13
13
  "general-white-button",
14
14
  "general-purple-button",
15
15
  "general-transparent-button",
16
+ "general-arrow-button",
16
17
  "open-modal-button",
17
18
  "close-button",
18
19
  "circular-button accept-button",
19
20
  "circular-button reject-button",
20
21
  "circular-button null-button",
22
+ "circular-button save-button",
23
+ "circular-button delete-button",
21
24
  "grid-layout",
22
25
  "row-layout",
23
26
  ],
@@ -9,7 +9,13 @@ export const Button = ({
9
9
  onClick,
10
10
  }) => {
11
11
  return (
12
- <Container className={buttonType} buttonFont={buttonFont} onClick={onClick}>
12
+ <Container
13
+ className={buttonType}
14
+ buttonFont={buttonFont}
15
+ onClick={onClick}
16
+ key={`button-${buttonType}`}
17
+ disabled={buttonType === "general-button-disabled"}
18
+ >
13
19
  {buttonType.includes("general") && label}
14
20
  {image && <img src={image} alt={altText} />}
15
21
  </Container>
@@ -7,6 +7,11 @@ import openModalIcon from "../../../assets/images/generalButton/openModal.svg";
7
7
  import closeIcon from "../../../assets/images/generalButton/closeIcon.svg";
8
8
  import rowsLayout from "../../../assets/images/generalButton/rowLayout.svg";
9
9
  import gridLayout from "../../../assets/images/generalButton/gridLayout.svg";
10
+ import arrowIcon from "../../../assets/images/arrow/arrowIcon.svg";
11
+ import saveIcon from "../../../assets/images/generalButton/saveIcon.svg";
12
+ import saveIconHover from "../../../assets/images/generalButton/saveIconHover.svg";
13
+ import deleteIcon from "../../../assets/images/generalButton/deleteIcon.svg";
14
+ import deleteIconHover from "../../../assets/images/generalButton/deleteIconHover.svg";
10
15
  import { GlobalColors } from "../../../global-files/variables";
11
16
 
12
17
  export const Container = styled.button`
@@ -37,7 +42,7 @@ export const Container = styled.button`
37
42
  }
38
43
  &.general-white-button {
39
44
  background-color: ${GlobalColors.s1};
40
- color: ${GlobalColors.original_purpura}
45
+ color: ${GlobalColors.original_purpura};
41
46
  }
42
47
 
43
48
  &.general-green-button {
@@ -51,18 +56,51 @@ export const Container = styled.button`
51
56
  background-color: transparent;
52
57
  background-repeat: no-repeat;
53
58
  background-position: center;
54
- }
59
+ &.accept-button {
60
+ background-image: url(${acceptIcon});
61
+ }
55
62
 
56
- &.accept-button {
57
- background-image: url(${acceptIcon});
58
- }
63
+ &.reject-button {
64
+ background-image: url(${rejectIcon});
65
+ }
66
+
67
+ &.null-button {
68
+ background-image: url(${nullIcon});
69
+ }
70
+
71
+ &.save-button {
72
+ background-image: url(${saveIcon});
73
+ border: 1px solid ${GlobalColors.s3};
74
+ border-radius: 15px;
75
+
76
+ &:hover {
77
+ background-image: url(${saveIconHover});
78
+ background-color: ${GlobalColors.magenta_s2};
79
+ border: 1px solid ${GlobalColors.magenta_s2};
80
+ }
81
+ }
82
+
83
+ &.delete-button {
84
+ background-image: url(${deleteIcon});
85
+ border: 1px solid ${GlobalColors.s3};
86
+ border-radius: 15px;
87
+ background-size: 15px;
59
88
 
60
- &.reject-button {
61
- background-image: url(${rejectIcon});
89
+ &:hover {
90
+ background-image: url(${deleteIconHover});
91
+ background-color: ${GlobalColors.magenta_s2};
92
+ border: 1px solid ${GlobalColors.magenta_s2};
93
+ }
94
+ }
62
95
  }
63
96
 
64
- &.null-button {
65
- background-image: url(${nullIcon});
97
+ &.general-arrow-button {
98
+ background-image: url(${arrowIcon});
99
+ width: 27px;
100
+ height: 27px;
101
+ background-color: transparent;
102
+ background-repeat: no-repeat;
103
+ background-position: center;
66
104
  }
67
105
 
68
106
  &.close-button {
@@ -107,4 +145,13 @@ export const Container = styled.button`
107
145
  &.row-layout {
108
146
  background-image: url(${gridLayout});
109
147
  }
148
+
149
+ &.general-button-disabled {
150
+ background-color: grey;
151
+ color: ${GlobalColors.white};
152
+
153
+ &:hover {
154
+ opacity: 1;
155
+ }
156
+ }
110
157
  `;
@@ -1,4 +1,7 @@
1
- import { useState } from "react";
1
+ import { isValid } from "js-base64";
2
+ import { number } from "prop-types";
3
+ import { useEffect, useState } from "react";
4
+ import { version } from "styled-components";
2
5
  import { Container } from "./styles";
3
6
 
4
7
  export const GeneralInput = ({
@@ -8,34 +11,84 @@ export const GeneralInput = ({
8
11
  inputRows,
9
12
  inputName,
10
13
  inputValue,
14
+ articleId,
15
+ isRequired,
16
+ version,
11
17
  inputPlaceholder,
18
+ updatedDescriptions,
19
+ setUpdatedDescriptions,
20
+ updatedDatasheets,
21
+ setUpdatedDatasheets,
22
+ index,
23
+ dinamicHeight,
12
24
  }) => {
13
- const [textValue, setTextValue] = useState({ value: inputValue });
25
+ const [textValue, setTextValue] = useState({
26
+ value: inputValue ? inputValue : "",
27
+ });
14
28
 
15
29
  const onHandleChange = (e) => {
16
30
  setTextValue(({ value }) => (value = e.target.value));
31
+ addTextAreaToArray(e.target.value, updatedDatasheets, setUpdatedDatasheets);
32
+ };
33
+
34
+ const onHandleTextAreaChange = (e) => {
35
+ setTextValue(({ value }) => (value = e.target.value));
36
+ addTextAreaToArray(
37
+ e.target.value,
38
+ updatedDescriptions,
39
+ setUpdatedDescriptions
40
+ );
41
+ };
42
+
43
+ useEffect(() => {
44
+ if (dinamicHeight) {
45
+ const input = document.querySelector(
46
+ `textarea#description-${inputId}-${index}`
47
+ );
48
+ if (input) {
49
+ input.style.cssText = "height:" + input.scrollHeight + "px";
50
+ }
51
+ }
52
+ }, [textValue]);
53
+
54
+ const addTextAreaToArray = (textValue, array, setArray) => {
55
+ const tempDescriptions = array;
56
+ const newArticle = {
57
+ articleId: articleId,
58
+ attributeId: inputId,
59
+ value: textValue,
60
+ versionId: version,
61
+ };
62
+ const isOnArray = tempDescriptions.some((desc, index) => {
63
+ if (desc.attributeId === newArticle.attributeId) {
64
+ tempDescriptions[index] = newArticle;
65
+ return true;
66
+ }
67
+ });
68
+ !isOnArray && tempDescriptions.push(newArticle);
69
+ setArray(tempDescriptions);
17
70
  };
18
71
 
19
72
  return (
20
- <Container>
21
- {inputType === "text" ? (
73
+ <Container isRequired={isRequired && !textValue}>
74
+ {inputType !== "textarea" ? (
22
75
  <input
23
- type="text"
24
- id={inputId}
76
+ type={inputType}
77
+ id={"datasheet-" + inputId + "-" + index}
25
78
  className="general-input"
26
79
  placeholder={inputPlaceholder}
27
- value={textValue.value}
80
+ value={textValue?.value}
28
81
  onChange={onHandleChange}
29
82
  />
30
83
  ) : (
31
84
  <textarea
32
85
  name={inputName}
33
- id={inputId}
86
+ id={"description-" + inputId + "-" + index}
34
87
  cols={inputCols}
35
88
  rows={inputRows}
36
89
  placeholder={inputPlaceholder}
37
90
  value={textValue.value}
38
- onChange={onHandleChange}
91
+ onChange={onHandleTextAreaChange}
39
92
  ></textarea>
40
93
  )}
41
94
  </Container>
@@ -7,7 +7,8 @@ export const Container = styled.div`
7
7
  input,
8
8
  textarea {
9
9
  width: 100%;
10
- border: 1px solid ${GlobalColors.s2};
10
+ border: 1px solid
11
+ ${({ isRequired }) => (isRequired ? "red" : `${GlobalColors.s2}`)};
11
12
  font-family: ${FontFamily.AvenirNext};
12
13
  color: ${GlobalColors.s4};
13
14
  font-weight: normal;
@@ -16,6 +17,7 @@ export const Container = styled.div`
16
17
  padding: 10px;
17
18
  outline: none;
18
19
  border-radius: 2px;
20
+ resize: none;
19
21
 
20
22
  &:focus {
21
23
  border: 1px solid ${GlobalColors.magenta_s2};
@@ -1,9 +1,10 @@
1
1
  import { Container } from "./styles";
2
2
 
3
- export const GeneralTextBox = ({ number, name, onClick, className }) => {
4
- return (<Container className={className} onClick={onClick}>
5
- <p className="number-text">{number}</p>
6
- <p className="name-text">{name}</p>
3
+ export const GeneralTextBox = ({ number, name, onClick, className }) => {
4
+ return (
5
+ <Container className={className} onClick={onClick}>
6
+ <p className="number-text">{number}</p>
7
+ <p className="name-text">{name}</p>
7
8
  </Container>
8
- );
9
- };
9
+ );
10
+ };
@@ -8,7 +8,7 @@ export const Container = styled.button`
8
8
  border-radius: 10px;
9
9
  flex-direction: column;
10
10
  align-items: center;
11
- padding: 20px;
11
+ padding: 15px;
12
12
  background-color: transparent;
13
13
  .number-text{
14
14
  color: ${GlobalColors.original_purpura};
@@ -0,0 +1,140 @@
1
+ import { GenericModal } from "./index";
2
+ import { ScreenHeader } from "../ScreenHeader/index";
3
+ import { LoadImageMenu } from "../LoadImageMenu/index";
4
+ import { Button } from "../GeneralButton/index";
5
+ import { FontFamily, GlobalColors } from "../../../global-files/variables";
6
+ import GenericModalWarning from "../../../assets/images/genericModal/genericModalWarning.svg";
7
+ import GenericModalCheck from "../../../assets/images/genericModal/genericModalCheck.svg";
8
+
9
+ export default {
10
+ title: "Components/atoms/GenericModal",
11
+ component: GenericModal,
12
+ };
13
+
14
+ const Template = (args) => <GenericModal {...args} />;
15
+
16
+ export const GenericModalDefault = Template.bind({});
17
+ GenericModalDefault.args = {
18
+ componentsArray: [
19
+ <img key="1" src={GenericModalWarning} alt="Warning icon"></img>,
20
+ <ScreenHeader
21
+ fontFamily={FontFamily.Raleway_500}
22
+ headerType={"with-bold-text"}
23
+ color={GlobalColors.white}
24
+ text={"¿Estás seguro que quieres "}
25
+ boldText={"cerrar sesión?"}
26
+ key="2"
27
+ />,
28
+ <Button key="3" buttonType={"general-white-button"} label={"Cancelar"} />,
29
+ <Button
30
+ buttonType={"general-button-default"}
31
+ label={"Cerrar Sesión"}
32
+ key="4"
33
+ />,
34
+ ],
35
+ buttonType: "log-out",
36
+ };
37
+
38
+ export const DeleteProductDefault = Template.bind({});
39
+ DeleteProductDefault.args = {
40
+ componentsArray: [
41
+ <img key="1" src={GenericModalWarning} alt="Warning icon"></img>,
42
+ <ScreenHeader
43
+ fontFamily={FontFamily.Raleway_500}
44
+ headerType={"product-name-header"}
45
+ color={GlobalColors.white}
46
+ text={"¿Estás seguro de eliminar estos productos?"}
47
+ key="2"
48
+ />,
49
+ <ScreenHeader
50
+ fontFamily={FontFamily.Raleway_500}
51
+ headerType={"retailer-name-header"}
52
+ color={GlobalColors.white}
53
+ text={"No podrás recuperar la información eliminada"}
54
+ key="3"
55
+ />,
56
+ <Button buttonType={"general-white-button"} label={"Cancelar"} key="4" />,
57
+ <Button
58
+ buttonType={"general-button-default"}
59
+ label={"Confirmar"}
60
+ key="5"
61
+ />,
62
+ ],
63
+ buttonType: "delete-product",
64
+ };
65
+
66
+ export const ProductEditionDefault = Template.bind({});
67
+ ProductEditionDefault.args = {
68
+ componentsArray: [
69
+ <ScreenHeader
70
+ fontFamily={FontFamily.Raleway_500}
71
+ headerType={"product-name-header"}
72
+ color={GlobalColors.white}
73
+ text={"¿Deseas salir de edicion de producto múltiple?"}
74
+ key="1"
75
+ />,
76
+ <Button buttonType={"general-white-button"} label={"Salir"} key="2" />,
77
+ <Button buttonType={"general-button-default"} label={"Regresar"} key="3" />,
78
+ ],
79
+ buttonType: "product-edition",
80
+ };
81
+
82
+ export const SendInvitationDefault = Template.bind({});
83
+ SendInvitationDefault.args = {
84
+ componentsArray: [
85
+ <img key="1" src={GenericModalCheck} alt="Check icon"></img>,
86
+ <p key="2">
87
+ <span> Fichas técnicas validadas con éxito</span>, Completa los productos
88
+ para poder exportar.
89
+ </p>,
90
+ ],
91
+ buttonType: "send-invitation",
92
+ };
93
+
94
+ export const UploadImageDefault = Template.bind({});
95
+ UploadImageDefault.args = {
96
+ componentsArray: [
97
+ <img
98
+ key="1"
99
+ className="check"
100
+ src={GenericModalCheck}
101
+ alt="Check icon"
102
+ ></img>,
103
+ <ScreenHeader
104
+ fontFamily={FontFamily.Raleway_500}
105
+ headerType={"product-name-header"}
106
+ color={GlobalColors.white}
107
+ text={"Imagen cargada con éxito,"}
108
+ key="2"
109
+ />,
110
+ <ScreenHeader
111
+ fontFamily={FontFamily.AvenirNext}
112
+ headerType={"input-name-header"}
113
+ color={GlobalColors.white}
114
+ text={"Por favor elige el tipo de empaque e imagen."}
115
+ key="3"
116
+ />,
117
+ <LoadImageMenu
118
+ tipo={"Tipo de empaque "}
119
+ product={"Producto expuesto"}
120
+ content={[
121
+ { label: "Enbalaje adicional - 0" },
122
+ { label: "En paquete - 1" },
123
+ { label: "Producto expuesto - 2" },
124
+ { label: "Embalaje multiforme - 3" },
125
+ { label: "Si no es una imagen / no corresponde - X" },
126
+ ]}
127
+ id={"menu-packaging-type"}
128
+ key="4"
129
+ />,
130
+ <LoadImageMenu
131
+ tipo={"Tipo de imagen "}
132
+ product={"Render"}
133
+ content={[{ label: "fotografía del producto" }]}
134
+ id={"menu-image-type"}
135
+ key="5"
136
+ />,
137
+ <Button key="6" buttonType={"general-button-default"} label={"Guardar"} />,
138
+ ],
139
+ buttonType: "upload-image",
140
+ };
@@ -0,0 +1,12 @@
1
+ import { Container } from "./styles";
2
+
3
+ export const GenericModal = ({ componentsArray = [], buttonType }) => {
4
+ return (
5
+ <Container>
6
+ <div className={"global-styles " + buttonType}>
7
+ <button className="close-button" />
8
+ {componentsArray?.map((component) => component)}
9
+ </div>
10
+ </Container>
11
+ );
12
+ };