contentoh-components-library 21.0.4 → 21.0.7

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 +78 -49
  5. package/dist/components/atoms/GeneralInput/styles.js +4 -1
  6. package/dist/components/atoms/GradientPanel/styles.js +2 -2
  7. package/dist/components/atoms/InputFormatter/index.js +132 -66
  8. package/dist/components/atoms/InputFormatter/styles.js +2 -2
  9. package/dist/components/atoms/ProgressBar/styles.js +1 -1
  10. package/dist/components/atoms/Select/index.js +4 -2
  11. package/dist/components/atoms/Select/style.js +1 -1
  12. package/dist/components/atoms/StatusTag/styles.js +1 -1
  13. package/dist/components/molecules/CarouselImagesLogin/CarouselImagesLogin.stories.js +37 -0
  14. package/dist/components/molecules/CarouselImagesLogin/index.js +94 -0
  15. package/dist/components/molecules/CarouselImagesLogin/styles.js +21 -0
  16. package/dist/components/molecules/LoginPasswordStrength/LoginPasswordStrength.stories.js +28 -0
  17. package/dist/components/molecules/LoginPasswordStrength/index.js +131 -0
  18. package/dist/components/molecules/LoginPasswordStrength/styles.js +78 -0
  19. package/dist/components/molecules/TagAndInput/index.js +4 -2
  20. package/dist/components/organisms/InputGroup/index.js +13 -11
  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 +18 -28
  37. package/dist/components/pages/RetailerProductEdition/index.js +105 -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 +74 -50
  50. package/src/components/atoms/GeneralInput/styles.js +9 -0
  51. package/src/components/atoms/GradientPanel/styles.js +7 -1
  52. package/src/components/atoms/InputFormatter/index.js +109 -46
  53. package/src/components/atoms/InputFormatter/styles.js +6 -0
  54. package/src/components/atoms/ProgressBar/styles.js +2 -1
  55. package/src/components/atoms/Select/index.js +3 -1
  56. package/src/components/atoms/Select/style.js +1 -2
  57. package/src/components/atoms/StatusTag/styles.js +2 -1
  58. package/src/components/molecules/CarouselImagesLogin/CarouselImagesLogin.stories.js +17 -0
  59. package/src/components/molecules/CarouselImagesLogin/index.js +68 -0
  60. package/src/components/molecules/CarouselImagesLogin/styles.js +60 -0
  61. package/src/components/molecules/LoginPasswordStrength/LoginPasswordStrength.stories.js +8 -0
  62. package/src/components/molecules/LoginPasswordStrength/index.js +89 -0
  63. package/src/components/molecules/LoginPasswordStrength/styles.js +87 -0
  64. package/src/components/molecules/TagAndInput/index.js +2 -0
  65. package/src/components/organisms/InputGroup/index.js +25 -8
  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 +18 -29
  82. package/src/components/pages/RetailerProductEdition/index.js +84 -22
  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,141 @@
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
+ try {
43
+ if (h.getLength() - 1 <= maxLength) {
44
+ setInputValue(
45
+ (val) => (val = valueInput.replace(/<\/?span.*?>/gm, ""))
46
+ );
47
+ value = valueInput;
48
+ } else {
49
+ quillState.deleteText(maxLength, quillState.getLength());
50
+ setInputValue((val) => (val = quillState.getText()));
51
+ value = quillState.getText();
52
+ }
53
+ } catch (error) {
54
+ console.log(error);
36
55
  }
37
- setSelection(text.length > 0);
38
- }
56
+ setCharsCounter(h.getLength() - 1);
57
+ value = valueFormater(value);
39
58
 
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,
59
+ let idInput = inputId;
60
+ let dataSave = updatedDescriptions.slice();
61
+ if (dataSave.length > 0) {
62
+ if (dataSave.filter((e) => e.attributeId === idInput).length > 0) {
63
+ dataSave.forEach((e) => {
64
+ if (e.attributeId === idInput) {
65
+ e.value = value;
66
+ }
67
+ });
68
+ } else {
69
+ dataSave.push({
70
+ articleId: articleId,
71
+ attributeId: idInput,
72
+ value: value,
73
+ });
74
+ }
75
+ } else {
76
+ dataSave.push({
77
+ articleId: articleId,
78
+ attributeId: idInput,
79
+ value: value,
48
80
  });
81
+ }
82
+ setUpdatedDescriptions(dataSave);
83
+ };
84
+
85
+ const getSelection = (range, a, b) => {
86
+ //getBounds(index,length)
87
+ const selected = b.getSelection();
88
+ const bounds = b.getBounds(selected?.index || 0, selected?.length || 0);
89
+ if (a === "user") {
90
+ setPosition({ left: bounds.left, top: bounds.top });
91
+ setSelection(selected?.length > 0);
92
+ }
49
93
  };
50
94
 
51
95
  return (
52
96
  <Container
53
- focus={focus}
54
- selection={selection}
55
- position={position}
56
97
  isRequired={
57
- isRequired && convertedText.replace(/<\/?p>/gm, "") === "<br>"
98
+ isRequired &&
99
+ (inputValue.replace(/<.*?>/gm, "").length === 0 || !inputValue)
58
100
  }
59
- onClick={(e) => {
60
- getCursorPosition(e);
61
- }}
101
+ selection={selection}
102
+ position={position}
62
103
  >
63
104
  <ReactQuill
64
- id={id}
65
- value={convertedText}
66
- onChange={onHandleTextAreaChange}
105
+ id={inputId + ""}
106
+ ref={(el) => setQuill(el)}
107
+ value={getValue(inputValue)}
108
+ //disabled={!props.enableInputs}
67
109
  modules={{ toolbar: ["bold"] }}
68
- onFocus={() => setFocus(true)}
69
- onBlur={() => {
70
- setFocus(false);
71
- setSelection(false);
72
- setPosition({ left: 0, top: 0 });
110
+ onKeyPress={(e) => {
111
+ if (charsCounter >= maxLength && e.key !== "Backspace") {
112
+ e.preventDefault();
113
+ }
114
+ }}
115
+ onKeyDown={(e) => {
116
+ let keysArray = [
117
+ "Backspace",
118
+ "Meta",
119
+ "ArrowLeft",
120
+ "ArrowRight",
121
+ "ArrowUp",
122
+ "ArrowDown",
123
+ ];
124
+ if (
125
+ charsCounter >= maxLength &&
126
+ keysArray.every((key) => e.key !== key)
127
+ ) {
128
+ e.preventDefault();
129
+ }
130
+ }}
131
+ onChange={(valueInput, user, range, h) => {
132
+ onChange(valueInput, user, range, h);
73
133
  }}
74
- onChangeSelection={() => getSelectionText()}
134
+ onChangeSelection={getSelection}
75
135
  />
136
+ <p className="description-limit">
137
+ {charsCounter}/{maxLength}
138
+ </p>
76
139
  </Container>
77
140
  );
78
141
  };
@@ -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,8 +65,7 @@ export const SelectCustom = styled.select`
65
65
  &::-ms-expand {
66
66
  display: none;
67
67
  }
68
- &:option {
69
- background-color: blue;
68
+ option {
70
69
  &:disabled {
71
70
  color: #d4d1d7;
72
71
  }
@@ -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,35 +32,52 @@ 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" ? (
42
44
  <TagAndInput
43
- key={index + "-" + dataInputs[input]?.value}
45
+ key={
46
+ index +
47
+ "-" +
48
+ dataInputs[input]?.value +
49
+ "-" +
50
+ dataInputs[input]?.id
51
+ }
44
52
  inputId={dataInputs[input]?.id}
45
53
  version={version}
46
54
  inputType={inputTypeValue(dataInputs[input]?.type)}
47
- label={dataInputs[input]?.name}
55
+ label={
56
+ dataInputs[input]?.name +
57
+ (dataInputs[input]?.required ? "*" : "")
58
+ }
48
59
  value={dataInputs[input]?.value}
49
60
  inputPlaceHolder={input?.placeholder}
50
61
  articleId={articleId}
51
62
  isRequired={dataInputs[input]?.required}
52
63
  updatedDatasheets={updatedDatasheets}
53
64
  setUpdatedDatasheets={setUpdatedDatasheets}
65
+ maxChar={
66
+ dataInputs[input]?.max_chars
67
+ ? dataInputs[input]?.max_chars
68
+ : 999
69
+ }
54
70
  />
55
71
  ) : (
56
72
  <TagAndInput
57
73
  key={index + "-" + input?.value}
58
- inputId={input?.id}
74
+ inputId={input.id}
59
75
  index={index}
60
76
  inputType={"textarea"}
61
- label={input?.name}
77
+ label={input?.name + (input.required ? "*" : "")}
62
78
  value={input?.value}
63
79
  isRequired={input.required}
80
+ maxChar={input.max_chars}
64
81
  inputPlaceHolder={input?.placeholder}
65
82
  updatedDescriptions={updatedDescriptions}
66
83
  setUpdatedDescriptions={setUpdatedDescriptions}
@@ -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
+ };