contentoh-components-library 21.0.3 → 21.0.6

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 (86) hide show
  1. package/dist/components/atoms/CharCounter/CharCounter.stories.js +31 -0
  2. package/dist/components/atoms/CharCounter/index.js +22 -0
  3. package/dist/components/atoms/CharCounter/styles.js +20 -0
  4. package/dist/components/atoms/GeneralInput/index.js +69 -48
  5. package/dist/components/atoms/GradientPanel/styles.js +2 -2
  6. package/dist/components/atoms/InputFormatter/index.js +128 -67
  7. package/dist/components/atoms/InputFormatter/styles.js +2 -2
  8. package/dist/components/atoms/ProgressBar/styles.js +1 -1
  9. package/dist/components/atoms/Select/index.js +4 -2
  10. package/dist/components/atoms/Select/style.js +1 -1
  11. package/dist/components/atoms/StatusTag/styles.js +1 -1
  12. package/dist/components/molecules/CarouselImagesLogin/CarouselImagesLogin.stories.js +37 -0
  13. package/dist/components/molecules/CarouselImagesLogin/index.js +94 -0
  14. package/dist/components/molecules/CarouselImagesLogin/styles.js +21 -0
  15. package/dist/components/molecules/LoginPasswordStrength/LoginPasswordStrength.stories.js +28 -0
  16. package/dist/components/molecules/LoginPasswordStrength/index.js +131 -0
  17. package/dist/components/molecules/LoginPasswordStrength/styles.js +78 -0
  18. package/dist/components/molecules/TagAndInput/index.js +4 -2
  19. package/dist/components/organisms/InputGroup/index.js +10 -8
  20. package/dist/components/organisms/ProductImageModal/index.js +0 -1
  21. package/dist/components/pages/ChangePasswordLogin/ChangePasswordLogin.stories.js +38 -0
  22. package/dist/components/pages/ChangePasswordLogin/index.js +131 -0
  23. package/dist/components/pages/ChangePasswordLogin/styles.js +18 -0
  24. package/dist/components/pages/EmailResetPassword/EmailResetPassword.stories.js +37 -0
  25. package/dist/components/pages/EmailResetPassword/index.js +130 -0
  26. package/dist/components/pages/EmailResetPassword/styles.js +20 -0
  27. package/dist/components/pages/RegistrationLoginFirstStep/RegistrationLoginFirstStep.stories.js +37 -0
  28. package/dist/components/pages/RegistrationLoginFirstStep/index.js +269 -0
  29. package/dist/components/pages/RegistrationLoginFirstStep/styles.js +20 -0
  30. package/dist/components/pages/RegistrationLoginSecondStep/RegistrationLoginSecondStep.stories.js +38 -0
  31. package/dist/components/pages/RegistrationLoginSecondStep/index.js +176 -0
  32. package/dist/components/pages/RegistrationLoginSecondStep/styles.js +20 -0
  33. package/dist/components/pages/RegistrationLoginThirdStep/RegistrationLoginThirdStep.stories.js +37 -0
  34. package/dist/components/pages/RegistrationLoginThirdStep/index.js +178 -0
  35. package/dist/components/pages/RegistrationLoginThirdStep/styles.js +20 -0
  36. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +6 -16
  37. package/dist/components/pages/RetailerProductEdition/index.js +102 -66
  38. package/dist/components/pages/VerificationCodeResetPassword/VerificationCodeResetPassword.stories.js +37 -0
  39. package/dist/components/pages/VerificationCodeResetPassword/index.js +121 -0
  40. package/dist/components/pages/VerificationCodeResetPassword/styles.js +20 -0
  41. package/dist/components/pages/VerificationCodeResetPassword/utils.js +69 -0
  42. package/package.json +2 -2
  43. package/src/assets/images/carouselImagesLogin/login2.svg +117 -0
  44. package/src/assets/images/carouselImagesLogin/login3.svg +147 -0
  45. package/src/assets/images/carouselImagesLogin/loginImage.svg +301 -0
  46. package/src/components/atoms/CharCounter/CharCounter.stories.js +11 -0
  47. package/src/components/atoms/CharCounter/index.js +13 -0
  48. package/src/components/atoms/CharCounter/styles.js +10 -0
  49. package/src/components/atoms/GeneralInput/index.js +58 -49
  50. package/src/components/atoms/GradientPanel/styles.js +7 -1
  51. package/src/components/atoms/InputFormatter/index.js +104 -47
  52. package/src/components/atoms/InputFormatter/styles.js +6 -0
  53. package/src/components/atoms/ProgressBar/styles.js +2 -1
  54. package/src/components/atoms/Select/index.js +3 -1
  55. package/src/components/atoms/Select/style.js +1 -1
  56. package/src/components/atoms/StatusTag/styles.js +2 -1
  57. package/src/components/molecules/CarouselImagesLogin/CarouselImagesLogin.stories.js +17 -0
  58. package/src/components/molecules/CarouselImagesLogin/index.js +68 -0
  59. package/src/components/molecules/CarouselImagesLogin/styles.js +60 -0
  60. package/src/components/molecules/LoginPasswordStrength/LoginPasswordStrength.stories.js +8 -0
  61. package/src/components/molecules/LoginPasswordStrength/index.js +89 -0
  62. package/src/components/molecules/LoginPasswordStrength/styles.js +87 -0
  63. package/src/components/molecules/TagAndInput/index.js +2 -0
  64. package/src/components/organisms/InputGroup/index.js +18 -7
  65. package/src/components/organisms/ProductImageModal/index.js +0 -2
  66. package/src/components/pages/ChangePasswordLogin/ChangePasswordLogin.stories.js +18 -0
  67. package/src/components/pages/ChangePasswordLogin/index.js +78 -0
  68. package/src/components/pages/ChangePasswordLogin/styles.js +20 -0
  69. package/src/components/pages/EmailResetPassword/EmailResetPassword.stories.js +17 -0
  70. package/src/components/pages/EmailResetPassword/index.js +77 -0
  71. package/src/components/pages/EmailResetPassword/styles.js +27 -0
  72. package/src/components/pages/RegistrationLoginFirstStep/RegistrationLoginFirstStep.stories.js +17 -0
  73. package/src/components/pages/RegistrationLoginFirstStep/index.js +160 -0
  74. package/src/components/pages/RegistrationLoginFirstStep/styles.js +85 -0
  75. package/src/components/pages/RegistrationLoginSecondStep/RegistrationLoginSecondStep.stories.js +18 -0
  76. package/src/components/pages/RegistrationLoginSecondStep/index.js +111 -0
  77. package/src/components/pages/RegistrationLoginSecondStep/styles.js +64 -0
  78. package/src/components/pages/RegistrationLoginThirdStep/RegistrationLoginThirdStep.stories.js +17 -0
  79. package/src/components/pages/RegistrationLoginThirdStep/index.js +106 -0
  80. package/src/components/pages/RegistrationLoginThirdStep/styles.js +48 -0
  81. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +6 -16
  82. package/src/components/pages/RetailerProductEdition/index.js +73 -18
  83. package/src/components/pages/VerificationCodeResetPassword/VerificationCodeResetPassword.stories.js +17 -0
  84. package/src/components/pages/VerificationCodeResetPassword/index.js +92 -0
  85. package/src/components/pages/VerificationCodeResetPassword/styles.js +54 -0
  86. package/src/components/pages/VerificationCodeResetPassword/utils.js +56 -0
@@ -1,78 +1,135 @@
1
1
  import ReactQuill from "react-quill";
2
2
  import "react-quill/dist/quill.snow.css";
3
- import { useState } from "react";
3
+ import { useEffect, useState } from "react";
4
4
  import { Container } from "./styles";
5
5
 
6
6
  export const InputFormatter = ({
7
- inputValue = "",
8
- id,
7
+ mainValue = "",
8
+ inputId,
9
+ articleId,
9
10
  updatedDescriptions,
10
11
  setUpdatedDescriptions,
11
12
  addTextAreaToArray,
13
+ name,
12
14
  isRequired,
15
+ maxChar,
13
16
  }) => {
14
- const [convertedText, setConvertedText] = useState(inputValue);
15
- const [focus, setFocus] = useState(false);
17
+ const [inputValue, setInputValue] = useState(mainValue);
16
18
  const [selection, setSelection] = useState(false);
17
19
  const [position, setPosition] = useState({ left: 0, top: 0 });
20
+ const [charsCounter, setCharsCounter] = useState(0);
21
+ const [quillState, setQuillState] = useState({});
22
+ const maxLength = maxChar ? maxChar : 999;
18
23
 
19
- const onHandleTextAreaChange = (value) => {
20
- setConvertedText((current) => (current = value));
21
- !id.includes("commentary") &&
22
- addTextAreaToArray(
23
- value.trim().replace(/<\/?p>/gm, ""),
24
- updatedDescriptions,
25
- setUpdatedDescriptions
26
- );
24
+ const getValue = (value) => {
25
+ let temp = value.replace(/\n/gm, "<br>");
26
+ return temp;
27
27
  };
28
28
 
29
- function getSelectionText() {
30
- setPosition({ left: 0, top: 0 });
31
- var text = "";
32
- if (window.getSelection) {
33
- text = window.getSelection().toString();
34
- } else if (document.selection && document.selection.type != "Control") {
35
- text = document.selection.createRange().text;
29
+ //const quillRef = useRef();
30
+ const setQuill = (ref) => {
31
+ if (!ref || ref === null) return;
32
+ if (typeof ref.getEditor !== "function") return;
33
+ setQuillState(ref.getEditor());
34
+ };
35
+
36
+ const valueFormater = (value) => {
37
+ return value.replace(/<\/p><p>/gm, "\n").replace(/<\/?br>|<\/?p>/gm, "");
38
+ };
39
+
40
+ const onChange = (valueInput, delta, user, h) => {
41
+ let value = "";
42
+ if (h.getLength() - 1 <= maxLength) {
43
+ setInputValue((val) => (val = valueInput.replace(/<\/?span.*?>/gm, "")));
44
+ value = valueInput;
45
+ } else {
46
+ quillState.deleteText(maxLength, quillState.getLength());
47
+ setInputValue((val) => (val = quillState.getText()));
48
+ value = quillState.getText();
36
49
  }
37
- setSelection(text.length > 0);
38
- }
50
+ setCharsCounter(h.getLength() - 1);
51
+ value = valueFormater(value);
39
52
 
40
- const getCursorPosition = (e) => {
41
- const input = document.getElementById(id);
42
- const elementPosition = input.getBoundingClientRect();
43
- position.top === 0 &&
44
- position.left === 0 &&
45
- setPosition({
46
- left: e.clientX - elementPosition.x,
47
- top: e.clientY - elementPosition.y,
53
+ let idInput = inputId;
54
+ let dataSave = updatedDescriptions.slice();
55
+ if (dataSave.length > 0) {
56
+ if (dataSave.filter((e) => e.attributeId === idInput).length > 0) {
57
+ dataSave.forEach((e) => {
58
+ if (e.attributeId === idInput) {
59
+ e.value = value;
60
+ }
61
+ });
62
+ } else {
63
+ dataSave.push({
64
+ articleId: articleId,
65
+ attributeId: idInput,
66
+ value: value,
67
+ });
68
+ }
69
+ } else {
70
+ dataSave.push({
71
+ articleId: articleId,
72
+ attributeId: idInput,
73
+ value: value,
48
74
  });
75
+ }
76
+ setUpdatedDescriptions(dataSave);
77
+ };
78
+
79
+ const getSelection = (range, a, b) => {
80
+ //getBounds(index,length)
81
+ const selected = b.getSelection();
82
+ const bounds = b.getBounds(selected?.index || 0, selected?.length || 0);
83
+ if (a === "user") {
84
+ setPosition({ left: bounds.left, top: bounds.top });
85
+ setSelection(selected?.length > 0);
86
+ }
49
87
  };
50
- console.log(convertedText);
88
+
51
89
  return (
52
90
  <Container
53
- focus={focus}
54
- selection={selection}
55
- position={position}
56
91
  isRequired={
57
- isRequired && convertedText.replace(/<\/?p>/gm, "") === "<br>"
92
+ isRequired &&
93
+ (inputValue.replace(/<.*?>/gm, "").length === 0 || !inputValue)
58
94
  }
59
- onClick={(e) => {
60
- getCursorPosition(e);
61
- }}
95
+ selection={selection}
96
+ position={position}
62
97
  >
63
98
  <ReactQuill
64
- id={id}
65
- value={convertedText}
66
- onChange={onHandleTextAreaChange}
99
+ id={inputId + ""}
100
+ ref={(el) => setQuill(el)}
101
+ value={getValue(inputValue)}
102
+ //disabled={!props.enableInputs}
67
103
  modules={{ toolbar: ["bold"] }}
68
- onFocus={() => setFocus(true)}
69
- onBlur={() => {
70
- setFocus(false);
71
- setSelection(false);
72
- setPosition({ left: 0, top: 0 });
104
+ onKeyPress={(e) => {
105
+ if (charsCounter >= maxLength && e.key !== "Backspace") {
106
+ e.preventDefault();
107
+ }
108
+ }}
109
+ onKeyDown={(e) => {
110
+ let keysArray = [
111
+ "Backspace",
112
+ "Meta",
113
+ "ArrowLeft",
114
+ "ArrowRight",
115
+ "ArrowUp",
116
+ "ArrowDown",
117
+ ];
118
+ if (
119
+ charsCounter >= maxLength &&
120
+ keysArray.every((key) => e.key !== key)
121
+ ) {
122
+ e.preventDefault();
123
+ }
124
+ }}
125
+ onChange={(valueInput, user, range, h) => {
126
+ onChange(valueInput, user, range, h);
73
127
  }}
74
- onChangeSelection={() => getSelectionText()}
128
+ onChangeSelection={getSelection}
75
129
  />
130
+ <p className="description-limit">
131
+ {charsCounter}/{maxLength}
132
+ </p>
76
133
  </Container>
77
134
  );
78
135
  };
@@ -31,4 +31,10 @@ export const Container = styled.div`
31
31
  }
32
32
  }
33
33
  }
34
+ .description-limit {
35
+ font-size: 12px;
36
+ font-family: ${FontFamily.AvenirNext};
37
+ color: ${GlobalColors.s4};
38
+ text-align: right;
39
+ }
34
40
  `;
@@ -28,7 +28,8 @@ export const Container = styled.div`
28
28
 
29
29
  &.status-AA,
30
30
  &.status-AP,
31
- &.status-AC {
31
+ &.status-AC,
32
+ &.status-AF {
32
33
  background-color: ${GlobalColors.finished};
33
34
  }
34
35
 
@@ -15,6 +15,8 @@ export default function Select(props) {
15
15
  {props.options &&
16
16
  props.options.map((item, i) => (
17
17
  <option
18
+ className={item.required ? "option-required" : ""}
19
+ //className={ ? "option-required" : ""}
18
20
  key={"select-" + item.value ? item.value : item + "-" + i}
19
21
  value={item.value ? item.value : item}
20
22
  // selected={
@@ -23,7 +25,7 @@ export default function Select(props) {
23
25
  // : item === props.valueSelected && "selected"
24
26
  // }
25
27
  >
26
- {item.name ? item.name : item}
28
+ {item.name ? item.name : item} {item?.required ? "*" : ""}
27
29
  </option>
28
30
  ))}
29
31
  </SelectCustom>
@@ -65,7 +65,7 @@ export const SelectCustom = styled.select`
65
65
  &::-ms-expand {
66
66
  display: none;
67
67
  }
68
- &:option {
68
+ option {
69
69
  background-color: blue;
70
70
  &:disabled {
71
71
  color: #d4d1d7;
@@ -30,7 +30,8 @@ export const Container = styled.div`
30
30
 
31
31
  &.status-AA,
32
32
  &.status-AP,
33
- &.status-AC {
33
+ &.status-AC,
34
+ &.status-AF {
34
35
  background-color: ${GlobalColors.finished};
35
36
  }
36
37
 
@@ -0,0 +1,17 @@
1
+ import { CarouselImagesLogin } 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/molecules/CarouselImagesLogin",
8
+ component: CarouselImagesLogin,
9
+ };
10
+
11
+ const Template = (args) => <CarouselImagesLogin {...args} />;
12
+
13
+ export const CarouselImagesLoginDefault = Template.bind({});
14
+ CarouselImagesLoginDefault.args = {
15
+ panelImg:[LoginImage, Login2, Login3],
16
+ panelText:"Elige la plataforma que conecta proovedores y retailers",
17
+ };
@@ -0,0 +1,68 @@
1
+ import { Container } from "./styles";
2
+ import { ScreenHeader } from "../../atoms/ScreenHeader";
3
+ import { FontFamily, GlobalColors } from "../../../global-files/variables";
4
+ import { useEffect } from "react";
5
+
6
+ export const CarouselImagesLogin = ({
7
+ panelImg = [],
8
+ panelText,
9
+ panelColor,
10
+ }) => {
11
+ const carouselStart = () => {
12
+ addEventListener("DOMContentLoaded", () => {
13
+ const images = panelImg;
14
+ let i = 1;
15
+ const img1 = document.querySelector("#img1");
16
+ const img2 = document.querySelector("#img2");
17
+ const divIndicadores = document.querySelector("#indicadores");
18
+ for (let index = 0; index < images.length; index++) {
19
+ const div = document.createElement("div");
20
+ div.classList.add("circles");
21
+ div.id = index;
22
+ divIndicadores.appendChild(div);
23
+ }
24
+ img1.src = images[0];
25
+ const circulos = document.querySelectorAll(".circles");
26
+ circulos[0].classList.add("resaltado");
27
+ const slideshow = () => {
28
+ img2.src = images[i];
29
+ const circulo_actual = Array.from(circulos).find((el) => el.id == i);
30
+ Array.from(circulos).forEach((cir) =>
31
+ cir.classList.remove("resaltado")
32
+ );
33
+ circulo_actual.classList.add("resaltado");
34
+ img1.classList.add("right");
35
+ img2.classList.add("active");
36
+ i++;
37
+ if (i == images.length) {
38
+ i = 0;
39
+ }
40
+ setTimeout(() => {
41
+ img1.src = img2.src;
42
+ img2.classList.remove("active");
43
+ img1.classList.remove("right");
44
+ }, 1000);
45
+ };
46
+ setInterval(slideshow, 4000);
47
+ });
48
+ };
49
+ useEffect(()=>{
50
+ carouselStart();
51
+ },[])
52
+
53
+ return (
54
+ <Container panelColor={panelColor}>
55
+ <div id="slideshow">
56
+ <img id="img1" />
57
+ <img id="img2" />
58
+ </div>
59
+ <ScreenHeader
60
+ fontFamily={FontFamily.Raleway}
61
+ color={GlobalColors.white}
62
+ headerType={"product-name-header"}
63
+ text={panelText}
64
+ />
65
+ <div id="indicadores"></div>
66
+ </Container>
67
+ );
68
+ };
@@ -0,0 +1,60 @@
1
+ import styled from "styled-components";
2
+
3
+ export const Container = styled.div`
4
+ background: ${({ panelColor }) =>
5
+ panelColor
6
+ ? panelColor
7
+ : "linear-gradient(180deg,#ffffff 0%,rgba(255, 255, 255, 0.887706) 49.27%,rgba(255, 255, 255, 0) 100%),#d43594"};
8
+ position: relative;
9
+ overflow: hidden;
10
+ width: 100%;
11
+ height: 100%;
12
+ text-align: center;
13
+ #slideshow {
14
+ position: relative;
15
+ height: 65%;
16
+ img {
17
+ position: absolute;
18
+ height: 100%;
19
+ width: 100%;
20
+ top: 8%;
21
+ left: 0;
22
+ }
23
+ #img2 {
24
+ left: 100%;
25
+ }
26
+ .right {
27
+ transform: translate(-100%, 0);
28
+ transition: all 1s;
29
+ }
30
+ .active {
31
+ left: 0 !important;
32
+ transition: all 1s;
33
+ }
34
+ }
35
+ .product-name-header {
36
+ position: absolute;
37
+ bottom: 16%;
38
+ right: 50%;
39
+ transform: translateX(50%);
40
+ }
41
+ #indicadores {
42
+ width: 100%;
43
+ text-align: center;
44
+ position: absolute;
45
+ bottom: 7%;
46
+ .circles {
47
+ background-color: white;
48
+ border: white 2px solid;
49
+ width: 20px;
50
+ height: 20px;
51
+ display: inline-block;
52
+ margin: 0 5px;
53
+ border-radius: 50%;
54
+ &.resaltado {
55
+ background-color: rgba(255, 255, 255, 0);
56
+ transition: background-color 0.8s;
57
+ }
58
+ }
59
+ }
60
+ `;
@@ -0,0 +1,8 @@
1
+ import { LoginPasswordStrength } from "./index";
2
+ export default {
3
+ title: "Components/molecules/LoginPasswordStrength",
4
+ component: LoginPasswordStrength,
5
+ };
6
+ const Template = (args) => <LoginPasswordStrength {...args} />;
7
+ export const LoginPasswordStrengthDefault = Template.bind({});
8
+ LoginPasswordStrengthDefault.args = {};
@@ -0,0 +1,89 @@
1
+ import { Container, ItemPasswordStrength, Password } from "./styles";
2
+ import { useEffect, useState } from "react";
3
+ import { TagAndInput } from "../TagAndInput";
4
+ export const LoginPasswordStrength = ({
5
+ emptyPassword,
6
+ emptyConfirmPassword,
7
+ matchPasswords,
8
+ }) => {
9
+ const [passwordStrength, setPasswordStrength] = useState(0);
10
+ let upperCaseLetters = /[A-Z]/g;
11
+ let numbers = /[0-9]/g;
12
+ let specialChar = /[‘!’,‘@’,‘#’,‘$’,‘%’,‘^’,‘&’,‘*’]/g;
13
+ useEffect(() => {
14
+ const inputValue = document.getElementById("newPasswordInput");
15
+ inputValue.addEventListener(
16
+ "input",
17
+ (e) => {
18
+ updateInfo(e, e.target.value);
19
+ },
20
+ false
21
+ );
22
+ }, []);
23
+ const updateInfo = (e, newValue) => {
24
+ switch (e.target.id) {
25
+ case "newPasswordInput":
26
+ setPasswordStrength(0);
27
+ if (newValue.length >= 8) {
28
+ setPasswordStrength((passwordStrength) => passwordStrength + 1);
29
+ }
30
+ //Verificar si la contraseña contiene mayuscula, numeros y un caracter especial
31
+ newValue.match(upperCaseLetters) &&
32
+ setPasswordStrength((passwordStrength) => passwordStrength + 1);
33
+ newValue.match(numbers) &&
34
+ setPasswordStrength((passwordStrength) => passwordStrength + 1);
35
+ newValue.match(specialChar) &&
36
+ setPasswordStrength((passwordStrength) => passwordStrength + 1);
37
+ break;
38
+ case "confirmPasswordInput":
39
+ break;
40
+ default:
41
+ return;
42
+ }
43
+ };
44
+ return (
45
+ <Container>
46
+ <div className="user" key={"3"}>
47
+ <TagAndInput
48
+ inputType={"password"}
49
+ inputId={"newPasswordInput"}
50
+ label={"Ingrese su nueva contraseña"}
51
+ />
52
+ {emptyPassword && (
53
+ <label>La contraseña debe ser minimo de 8 caracteres</label>
54
+ )}
55
+ </div>
56
+ <div className="divPasswordStrength" key={"4"}>
57
+ <ItemPasswordStrength paso={1}>
58
+ <Password level={1} passwordStrength={passwordStrength} />
59
+ {passwordStrength === 1 && <p>Baja</p>}
60
+ </ItemPasswordStrength>
61
+ <ItemPasswordStrength paso={2}>
62
+ <Password level={2} passwordStrength={passwordStrength} />
63
+ {passwordStrength === 2 && <p>Regular</p>}
64
+ </ItemPasswordStrength>
65
+ <ItemPasswordStrength paso={3}>
66
+ <Password level={3} passwordStrength={passwordStrength} />
67
+ {passwordStrength === 3 && <p>Segura</p>}
68
+ </ItemPasswordStrength>
69
+ <ItemPasswordStrength paso={4}>
70
+ <Password level={4} passwordStrength={passwordStrength} />
71
+ {passwordStrength === 4 && <p>Fuerte</p>}
72
+ </ItemPasswordStrength>
73
+ </div>
74
+ <div className="user" key={"5"}>
75
+ <TagAndInput
76
+ inputType={"password"}
77
+ inputId={"confirmPasswordInput"}
78
+ label={"Confirme la nueva contraseña"}
79
+ />
80
+ {emptyConfirmPassword && !emptyPassword && (
81
+ <label>Confirme la contraseña</label>
82
+ )}
83
+ {!emptyConfirmPassword && !emptyPassword && !matchPasswords && (
84
+ <label>La contraseña no coincide</label>
85
+ )}
86
+ </div>
87
+ </Container>
88
+ );
89
+ };
@@ -0,0 +1,87 @@
1
+ import styled from "styled-components";
2
+ import { FontFamily, GlobalColors } from "../../../global-files/variables";
3
+
4
+ export const Container = styled.div`
5
+ width: 100%;
6
+ .divPasswordStrength {
7
+ width: 100%;
8
+ display: flex;
9
+ align-items: center;
10
+ justify-content: space-between;
11
+ margin-top: 30px;
12
+ & + * {
13
+ margin-top: 40px;
14
+ }
15
+ }
16
+ label {
17
+ color: red;
18
+ margin-top: 3px;
19
+ margin-left: 15px;
20
+ font-family: ${FontFamily.Raleway_700};
21
+ font-size: 11px;
22
+ }
23
+ `;
24
+
25
+ export const Password = styled.div`
26
+ height: 8px;
27
+ width: 100%;
28
+ background-color: ${(props) => {
29
+ switch (props.passwordStrength) {
30
+ case 0:
31
+ return "#F0F0F0";
32
+ case 1:
33
+ if (props.level === 1) {
34
+ return "#E67432";
35
+ } else {
36
+ return "#F0F0F0";
37
+ }
38
+ case 2:
39
+ if (props.level <= 2) {
40
+ return "#EDD34D";
41
+ } else {
42
+ return "#F0F0F0";
43
+ }
44
+ case 3:
45
+ if (props.level <= 3) {
46
+ return "#71DE56";
47
+ } else {
48
+ return "#F0F0F0";
49
+ }
50
+ case 4:
51
+ if (props.level <= 4) {
52
+ return "#71DE56";
53
+ } else {
54
+ return "#F0F0F0";
55
+ }
56
+ default:
57
+ return;
58
+ }
59
+ }};
60
+ `;
61
+
62
+ export const ItemPasswordStrength = styled.div`
63
+ width: 24%;
64
+ position: relative;
65
+ p {
66
+ margin-top: 1.5%;
67
+ font-weight: 700;
68
+ display: flex;
69
+ justify-content: flex-end;
70
+ font-size: 11px;
71
+ position: absolute;
72
+ right: 0;
73
+ top: 100%;
74
+ color: ${(props) => {
75
+ switch (props.paso) {
76
+ case 1:
77
+ return "#E67432";
78
+ case 2:
79
+ return "#EDD34D";
80
+ case 3:
81
+ return "#71DE56";
82
+ case 4:
83
+ return "#71DE56";
84
+ }
85
+ }};
86
+ }
87
+ `;
@@ -19,6 +19,7 @@ export const TagAndInput = ({
19
19
  dinamicHeight,
20
20
  inputCols,
21
21
  inputRows,
22
+ maxChar,
22
23
  }) => {
23
24
  return (
24
25
  <Container
@@ -43,6 +44,7 @@ export const TagAndInput = ({
43
44
  dinamicHeight={dinamicHeight}
44
45
  inputCols={inputCols}
45
46
  inputRows={inputRows}
47
+ maxChar={maxChar}
46
48
  />
47
49
  </Container>
48
50
  );
@@ -32,10 +32,12 @@ export const InputGroup = ({
32
32
  : "descriptions-layout"
33
33
  }
34
34
  >
35
- <ScreenHeader
36
- headerType={"retailer-name-header"}
37
- text={inputGroup?.dataGroup}
38
- />
35
+ {inputGroup?.dataGroup && (
36
+ <ScreenHeader
37
+ headerType={"retailer-name-header"}
38
+ text={inputGroup?.dataGroup}
39
+ />
40
+ )}
39
41
  <div className="inputs-container">
40
42
  {inputGroup?.inputs?.map((input, index) =>
41
43
  activeSection === "Ficha técnica" ? (
@@ -44,23 +46,32 @@ export const InputGroup = ({
44
46
  inputId={dataInputs[input]?.id}
45
47
  version={version}
46
48
  inputType={inputTypeValue(dataInputs[input]?.type)}
47
- label={dataInputs[input]?.name}
49
+ label={
50
+ dataInputs[input]?.name +
51
+ (dataInputs[input]?.required ? "*" : "")
52
+ }
48
53
  value={dataInputs[input]?.value}
49
54
  inputPlaceHolder={input?.placeholder}
50
55
  articleId={articleId}
51
56
  isRequired={dataInputs[input]?.required}
52
57
  updatedDatasheets={updatedDatasheets}
53
58
  setUpdatedDatasheets={setUpdatedDatasheets}
59
+ maxChar={
60
+ dataInputs[input]?.max_chars
61
+ ? dataInputs[input]?.max_chars
62
+ : 999
63
+ }
54
64
  />
55
65
  ) : (
56
66
  <TagAndInput
57
67
  key={index + "-" + input?.value}
58
- inputId={input?.id}
68
+ inputId={input.id}
59
69
  index={index}
60
70
  inputType={"textarea"}
61
- label={input?.name}
71
+ label={input?.name + (input.required ? "*" : "")}
62
72
  value={input?.value}
63
73
  isRequired={input.required}
74
+ maxChar={input.max_chars}
64
75
  inputPlaceHolder={input?.placeholder}
65
76
  updatedDescriptions={updatedDescriptions}
66
77
  setUpdatedDescriptions={setUpdatedDescriptions}
@@ -30,8 +30,6 @@ export const ProductImageModal = ({
30
30
  }
31
31
  };
32
32
 
33
- console.log(images?.values[activeImage]);
34
-
35
33
  useEffect(() => {
36
34
  if (showValidationPanel) {
37
35
  document.addEventListener("click", closeValidationPanel, false);
@@ -0,0 +1,18 @@
1
+ import { ChangePasswordLogin } 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/pages/ChangePasswordLogin",
8
+ component: ChangePasswordLogin,
9
+ };
10
+ const Template = (args) => <ChangePasswordLogin {...args} />;
11
+
12
+ export const ChangePasswordLoginDefault = Template.bind({});
13
+
14
+ ChangePasswordLoginDefault.args = {
15
+ imageArrayCarousel: [LoginImage, Login2, Login3],
16
+ textCarousel: "Elige la plataforma que conecta proovedores y retailers",
17
+ textHeaderRight: "Ingresa tus credenciales",
18
+ };