contentoh-components-library 21.0.24 → 21.0.28

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 (59) hide show
  1. package/dist/components/{molecules/Login/Login.stories.js → atoms/Loading/Loading.stories.js} +7 -7
  2. package/dist/components/atoms/Loading/index.js +27 -0
  3. package/dist/components/atoms/Loading/styles.js +18 -0
  4. package/dist/components/molecules/EmailResetPasswordLogin/EmailResetPasswordLogin.stories.js +28 -0
  5. package/dist/components/molecules/EmailResetPasswordLogin/index.js +159 -0
  6. package/dist/components/molecules/EmailResetPasswordLogin/styles.js +20 -0
  7. package/dist/components/molecules/RegistrationFirstStep/RegistrationFirstStep.stories.js +28 -0
  8. package/dist/components/molecules/RegistrationFirstStep/index.js +371 -0
  9. package/dist/components/molecules/RegistrationFirstStep/styles.js +20 -0
  10. package/dist/components/molecules/RegistrationSecondStep/RegistrationSecondStep.stories.js +28 -0
  11. package/dist/components/molecules/RegistrationSecondStep/index.js +156 -0
  12. package/dist/components/molecules/RegistrationSecondStep/styles.js +20 -0
  13. package/dist/components/molecules/RegistrationThirdStep/RegistrationThirdStep.stories.js +28 -0
  14. package/dist/components/molecules/RegistrationThirdStep/index.js +161 -0
  15. package/dist/components/molecules/RegistrationThirdStep/styles.js +20 -0
  16. package/dist/components/molecules/{SignIn/SignIn.stories.js → SignInLogin/SignInLogin.stories.js} +7 -7
  17. package/dist/components/molecules/SignInLogin/index.js +292 -0
  18. package/dist/components/molecules/SignInLogin/styles.js +20 -0
  19. package/dist/components/molecules/VerificationCodeResetPasswordLogin/VerificationCodeResetPasswordLogin.stories.js +28 -0
  20. package/dist/components/molecules/VerificationCodeResetPasswordLogin/index.js +104 -0
  21. package/dist/components/molecules/VerificationCodeResetPasswordLogin/styles.js +20 -0
  22. package/dist/components/molecules/VerificationCodeResetPasswordLogin/utils.js +69 -0
  23. package/dist/components/organisms/ChangePassword/ChangePassword.stories.js +28 -0
  24. package/dist/components/organisms/ChangePassword/index.js +113 -0
  25. package/dist/components/organisms/ChangePassword/styles.js +18 -0
  26. package/dist/index.js +150 -46
  27. package/package.json +5 -2
  28. package/src/components/atoms/Loading/Loading.stories.js +10 -0
  29. package/src/components/atoms/Loading/index.js +13 -0
  30. package/src/components/atoms/Loading/styles.js +57 -0
  31. package/src/components/molecules/EmailResetPasswordLogin/EmailResetPasswordLogin.stories.js +11 -0
  32. package/src/components/molecules/EmailResetPasswordLogin/index.js +87 -0
  33. package/src/components/molecules/EmailResetPasswordLogin/styles.js +23 -0
  34. package/src/components/molecules/RegistrationFirstStep/RegistrationFirstStep.stories.js +11 -0
  35. package/src/components/molecules/RegistrationFirstStep/index.js +259 -0
  36. package/src/components/molecules/RegistrationFirstStep/styles.js +81 -0
  37. package/src/components/molecules/RegistrationSecondStep/RegistrationSecondStep.stories.js +11 -0
  38. package/src/components/molecules/RegistrationSecondStep/index.js +97 -0
  39. package/src/components/molecules/RegistrationSecondStep/styles.js +59 -0
  40. package/src/components/molecules/RegistrationThirdStep/RegistrationThirdStep.stories.js +11 -0
  41. package/src/components/molecules/RegistrationThirdStep/index.js +109 -0
  42. package/src/components/molecules/RegistrationThirdStep/styles.js +44 -0
  43. package/src/components/molecules/SignInLogin/SignInLogin.stories.js +11 -0
  44. package/src/components/molecules/SignInLogin/index.js +205 -0
  45. package/src/components/molecules/{SignIn → SignInLogin}/styles.js +1 -0
  46. package/src/components/molecules/VerificationCodeResetPasswordLogin/VerificationCodeResetPasswordLogin.stories.js +11 -0
  47. package/src/components/molecules/VerificationCodeResetPasswordLogin/index.js +78 -0
  48. package/src/components/molecules/VerificationCodeResetPasswordLogin/styles.js +49 -0
  49. package/src/components/molecules/VerificationCodeResetPasswordLogin/utils.js +56 -0
  50. package/src/components/organisms/ChangePassword/ChangePassword.stories.js +11 -0
  51. package/src/components/organisms/ChangePassword/index.js +63 -0
  52. package/src/components/organisms/ChangePassword/styles.js +16 -0
  53. package/src/index.js +17 -9
  54. package/dist/components/molecules/Login/index.js +0 -142
  55. package/dist/components/molecules/Login/styles.js +0 -20
  56. package/dist/components/molecules/SignIn/index.js +0 -142
  57. package/dist/components/molecules/SignIn/styles.js +0 -20
  58. package/src/components/molecules/SignIn/SignIn.stories.js +0 -11
  59. package/src/components/molecules/SignIn/index.js +0 -79
@@ -0,0 +1,56 @@
1
+ /**
2
+ *
3
+ * @param {event} e event received triggered by verification code input
4
+ * @param {number} index index position from the verification code(VC) input array (i.e. digit 1,2,3 etc...)
5
+ * @param {array<html nodes>} inputsArray array which contains every VC digit input (used to change focus on input change)
6
+ */
7
+ export const validateInput = (e, index, inputsArray) => {
8
+ let isValid = false;
9
+ const inputNotEmpty = e.target.value.length > 0;
10
+ if (inputNotEmpty) {
11
+ if (validateInputNumber(e) !== null) {
12
+ isValid = true;
13
+ nextInputFocus(inputsArray, index++);
14
+ }
15
+ }
16
+ return isValid ? e.target.value : "";
17
+ };
18
+
19
+ /**
20
+ *
21
+ * @param {event} e event received triggered by verification code input
22
+ * @returns {boolean} if digit is a number
23
+ */
24
+ const validateInputNumber = (e) => {
25
+ return (e.target.value || String.fromCharCode(e.keyCode)).match(/[0-9]{1}/);
26
+ };
27
+
28
+ /**
29
+ *
30
+ * @param {array<html nodes>} inputsArray array which contains every VC digit input (used to change focus on input change)
31
+ * @param {number} index index position from the verification code(VC) input array (i.e. digit 1,2,3 etc...)
32
+ * changes focus to next input if digit typed is a number and there wasn't any before
33
+ */
34
+ const nextInputFocus = (inputsArray, index) => {
35
+ const button = document.getElementsByClassName("general-default-button");
36
+
37
+ inputsArray?.length && index === inputsArray?.length
38
+ ? button[0].focus()
39
+ : inputsArray[index]?.focus();
40
+ };
41
+
42
+ /**
43
+ *
44
+ * @param {array<html nodes>} inputsArray array which contains every VC digit input (used to check if there's any empty)
45
+ * @param {function} setEmptyVerificationCode function to update flag which handles if there's an empty char
46
+ * updates emptyVerificationFlag from father component
47
+ */
48
+ export const validate = (inputsArray, setEmptyVerificationCode) => {
49
+ let contInputEmpty = 0;
50
+ inputsArray.forEach((element) => {
51
+ element.value === "" ? 0 : contInputEmpty++;
52
+ });
53
+ contInputEmpty === inputsArray.length
54
+ ? setEmptyVerificationCode(false)
55
+ : setEmptyVerificationCode(true);
56
+ };
@@ -0,0 +1,11 @@
1
+ import { ChangePassword } from "./index";
2
+
3
+ export default {
4
+ title: "Components/organisms/ChangePassword",
5
+ component: ChangePassword,
6
+ };
7
+ const Template = (args) => <ChangePassword {...args} />;
8
+
9
+ export const ChangePasswordDefault = Template.bind({});
10
+
11
+ ChangePasswordDefault.args = {};
@@ -0,0 +1,63 @@
1
+ import { Container } from "./styles";
2
+ import { LoginPasswordStrength } from "../../molecules/LoginPasswordStrength";
3
+ import { useState } from "react";
4
+ import { Button } from "../../atoms/GeneralButton";
5
+ import { LogoImage } from "../../atoms/LogoImage";
6
+ import { ScreenHeader } from "../../atoms/ScreenHeader";
7
+ import { GlobalColors, FontFamily } from "../../../global-files/variables";
8
+ import { GradientPanel } from "../../atoms/GradientPanel";
9
+
10
+ export const ChangePassword = () => {
11
+ const [emptyPassword, setEmptyPassword] = useState(false);
12
+ const [emptyConfirmPassword, setEmptyConfirmPassword] = useState(false);
13
+ const [matchPasswords, setMatchPasswords] = useState(true);
14
+ const validate = async (e) => {
15
+ e.preventDefault();
16
+ const password = document.querySelector("#newPasswordInput").value;
17
+ password.length < 8 ? setEmptyPassword(true) : setEmptyPassword(false);
18
+ const confirmPassword = document.querySelector(
19
+ "#confirmPasswordInput"
20
+ ).value;
21
+ confirmPassword === ""
22
+ ? setEmptyConfirmPassword(true)
23
+ : setEmptyConfirmPassword(false);
24
+ if (password === confirmPassword) {
25
+ setMatchPasswords(true);
26
+ } else {
27
+ setMatchPasswords(false);
28
+ }
29
+ };
30
+ const loginRight = [
31
+ <LogoImage key="1" />,
32
+ <div className="credenciales" key={"2"}>
33
+ <ScreenHeader
34
+ fontFamily={FontFamily.AvenirNext}
35
+ color={GlobalColors.s5}
36
+ text={"Ingresa tus credenciales"}
37
+ />
38
+ </div>,
39
+ <LoginPasswordStrength
40
+ emptyPassword={emptyPassword}
41
+ emptyConfirmPassword={emptyConfirmPassword}
42
+ matchPasswords={matchPasswords}
43
+ textTittle={"Ingresa tus credenciales"}
44
+ key="3"
45
+ />,
46
+ <div className="button-center" key="4">
47
+ <Button
48
+ buttonType={"general-default-button"}
49
+ label={"Enviar"}
50
+ onClick={(e) => validate(e)}
51
+ />
52
+ </div>,
53
+ ];
54
+ return (
55
+ <Container>
56
+ <GradientPanel
57
+ panelColor={GlobalColors.white}
58
+ componentsArray={loginRight}
59
+ panelType={"home-login"}
60
+ ></GradientPanel>
61
+ </Container>
62
+ );
63
+ };
@@ -0,0 +1,16 @@
1
+ import styled from "styled-components";
2
+
3
+ export const Container = styled.div`
4
+ display: flex;
5
+ width: 50%;
6
+ height: 100vh;
7
+ .button-center {
8
+ text-align: center;
9
+ position: absolute;
10
+ bottom: 5%;
11
+ left: calc(75% - 80px);
12
+ .general-default-button {
13
+ width: 160px;
14
+ }
15
+ }
16
+ `;
package/src/index.js CHANGED
@@ -11,6 +11,7 @@ export * from "./components/atoms/GeneralButton/index";
11
11
  export * from "./components/atoms/GeneralInput/index";
12
12
  export * from "./components/atoms/GeneralTextBox/index";
13
13
  export * from "./components/atoms/GradientPanel/index";
14
+ export * from "./components/atoms/Loading/index";
14
15
  export * from "./components/atoms/PriorityFlag/index";
15
16
  export * from "./components/atoms/ProductImage/index";
16
17
  export * from "./components/atoms/ProgressBar/index";
@@ -22,22 +23,29 @@ export * from "./components/atoms/ValidationPanel/index";
22
23
 
23
24
  //molecules
24
25
  export * from "./components/molecules/AvatarAndValidation/index";
25
- export * from "./components/molecules/CarouselImagesLogin"
26
+ export * from "./components/molecules/CarouselImagesLogin";
26
27
  export * from "./components/molecules/EditionActiveImage/index";
28
+ export * from "./components/molecules/EmailResetPasswordLogin/index";
27
29
  export * from "./components/molecules/FeaturesBar/index";
28
30
  export * from "./components/molecules/GalleryElement/index";
29
31
  export * from "./components/molecules/HeaderTop/index";
30
32
  export * from "./components/molecules/ImageSelector/index";
31
- export * from "./components/molecules/LoginPasswordStrength"
33
+ export * from "./components/molecules/LoginPasswordStrength";
32
34
  export * from "./components/molecules/PlanSelection/index";
33
35
  export * from "./components/molecules/ProductNameHeader/index";
36
+ export * from "./components/molecules/RegistrationFirstStep/index";
37
+ export * from "./components/molecules/RegistrationSecondStep/index";
38
+ export * from "./components/molecules/RegistrationThirdStep/index";
39
+ export * from "./components/molecules/SignInLogin/index";
34
40
  export * from "./components/molecules/StatusAsignationInfo/index";
35
41
  export * from "./components/molecules/TableHeader/index";
36
42
  export * from "./components/molecules/TableRow/index";
37
43
  export * from "./components/molecules/TabsMenu/index";
38
44
  export * from "./components/molecules/TagAndInput/index";
45
+ export * from "./components/molecules/VerificationCodeResetPasswordLogin/index";
39
46
 
40
47
  //organisms
48
+ export * from "./components/organisms/ChangePassword/index";
41
49
  export * from "./components/organisms/Fullplan/index";
42
50
  export * from "./components/organisms/FullProductNameHeader/index";
43
51
  export * from "./components/organisms/FullTabsMenu/index";
@@ -48,13 +56,13 @@ export * from "./components/organisms/InputGroup/index";
48
56
  export * from "./components/organisms/ProductImageModal/index";
49
57
 
50
58
  //pages
51
- export * from "./components/pages/ChangePasswordLogin"
52
- export * from "./components/pages/CustomerLogin"
59
+ export * from "./components/pages/ChangePasswordLogin";
60
+ export * from "./components/pages/CustomerLogin";
53
61
  export * from "./components/pages/CustomerType";
54
- export * from "./components/pages/EmailResetPassword"
62
+ export * from "./components/pages/EmailResetPassword";
55
63
  export * from "./components/pages/OnboardPlan";
56
- export * from "./components/pages/RegistrationLoginFirstStep"
57
- export * from "./components/pages/RegistrationLoginSecondStep"
58
- export * from "./components/pages/RegistrationLoginThirdStep"
64
+ export * from "./components/pages/RegistrationLoginFirstStep";
65
+ export * from "./components/pages/RegistrationLoginSecondStep";
66
+ export * from "./components/pages/RegistrationLoginThirdStep";
59
67
  export * from "./components/pages/RetailerProductEdition";
60
- export * from "./components/pages/VerificationCodeResetPassword"
68
+ export * from "./components/pages/VerificationCodeResetPassword";
@@ -1,142 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.Login = void 0;
9
-
10
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
-
12
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
13
-
14
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
15
-
16
- var _styles = require("./styles");
17
-
18
- var _index = require("../../atoms/LogoImage/index");
19
-
20
- var _index2 = require("../../atoms/ScreenHeader/index");
21
-
22
- var _index3 = require("../../atoms/GeneralButton/index");
23
-
24
- var _index4 = require("../../atoms/CheckBox/index");
25
-
26
- var _TagAndInput = require("../TagAndInput");
27
-
28
- var _variables = require("../../../global-files/variables");
29
-
30
- var _react = require("react");
31
-
32
- var _jsxRuntime = require("react/jsx-runtime");
33
-
34
- var Login = function Login() {
35
- var _useState = (0, _react.useState)(false),
36
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
37
- emptyEmail = _useState2[0],
38
- setEmptyEmail = _useState2[1];
39
-
40
- var _useState3 = (0, _react.useState)(false),
41
- _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
42
- invalidEmail = _useState4[0],
43
- setInvalidEmail = _useState4[1];
44
-
45
- var _useState5 = (0, _react.useState)(false),
46
- _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
47
- emptyPassword = _useState6[0],
48
- setEmptyPassword = _useState6[1];
49
-
50
- var validate = /*#__PURE__*/function () {
51
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(e) {
52
- var email, password;
53
- return _regenerator.default.wrap(function _callee$(_context) {
54
- while (1) {
55
- switch (_context.prev = _context.next) {
56
- case 0:
57
- e.preventDefault();
58
- email = document.querySelector("#emailInput").value;
59
- password = document.querySelector("#passwordInput").value;
60
- email === "" ? setEmptyEmail(true) : setEmptyEmail(false);
61
- password === "" ? setEmptyPassword(true) : setEmptyPassword(false);
62
- !/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(email) ? setInvalidEmail(true) : setInvalidEmail(false);
63
-
64
- case 6:
65
- case "end":
66
- return _context.stop();
67
- }
68
- }
69
- }, _callee);
70
- }));
71
-
72
- return function validate(_x) {
73
- return _ref.apply(this, arguments);
74
- };
75
- }();
76
-
77
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
78
- className: "home-login",
79
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
80
- className: "main-container",
81
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.LogoImage, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
82
- className: "credenciales",
83
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.ScreenHeader, {
84
- fontFamily: _variables.FontFamily.AvenirNext,
85
- color: _variables.GlobalColors.s5,
86
- text: "Ingresa tus credenciales"
87
- })
88
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
89
- className: "user",
90
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
91
- inputType: "text",
92
- label: "Nombre de usuario",
93
- inputPlaceHolder: "username@contentoh.com",
94
- inputId: "emailInput"
95
- })
96
- }), emptyEmail && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
97
- children: "Ingrese su correo"
98
- }), invalidEmail && !emptyEmail && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
99
- children: "Ingrese un correo v\xE1lido"
100
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
101
- className: "password",
102
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
103
- inputType: "text",
104
- label: "Contraseña",
105
- inputPlaceHolder: "Escribe tu contraseña",
106
- inputId: "passwordInput"
107
- })
108
- }), emptyPassword && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
109
- children: "Ingrese su contrase\xF1a"
110
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
111
- className: "select",
112
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index4.CheckBox, {
113
- label: "Mantener sesión activada",
114
- id: "chk-default",
115
- className: "active-left"
116
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
117
- className: "active-right",
118
- children: "Olvide mi contrase\xF1a"
119
- })]
120
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
121
- className: "button-right",
122
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index3.Button, {
123
- buttonType: "general-default-button",
124
- label: "Iniciar sesión",
125
- onClick: function onClick(e) {
126
- return validate(e);
127
- }
128
- })
129
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
130
- className: "new-login",
131
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
132
- className: "pre-registro",
133
- children: ["\xBFA\xFAn no tienes cuenta?", /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
134
- children: " Reg\xEDstrate"
135
- })]
136
- })
137
- })]
138
- })
139
- });
140
- };
141
-
142
- exports.Login = Login;
@@ -1,20 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.Container = void 0;
9
-
10
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
11
-
12
- var _styledComponents = _interopRequireDefault(require("styled-components"));
13
-
14
- var _variables = require("../../../global-files/variables");
15
-
16
- var _templateObject;
17
-
18
- var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background: \"white\";\n display: flex;\n height: 100%;\n justify-content: center;\n align-items: center;\n label {\n color: red;\n margin-top: 3px;\n margin-left: 15px;\n font-family: ", ";\n font-size: 11px;\n & + * {\n margin-top: 12px;\n }\n }\n\n &.home-login {\n .credenciales {\n & + * {\n margin-top: 30px;\n }\n }\n .user {\n & + * {\n margin-top: 20px;\n }\n }\n .password {\n & + * {\n margin-top: 20px;\n }\n }\n .select {\n display: flex;\n justify-content: space-between;\n .active-right {\n font-family: ", ";\n font-weight: 500;\n font-size: 13px;\n line-height: 24px;\n letter-spacing: -0.015em;\n color: ", ";\n cursor: pointer;\n }\n & + * {\n margin-top: 50px;\n }\n }\n .button-right {\n text-align: right;\n & + * {\n margin-top: 55px;\n }\n }\n .new-login {\n p {\n font-family: ", ";\n text-align: right;\n font-weight: 500;\n font-size: 13px;\n line-height: 24px;\n color: ", ";\n span {\n color: ", ";\n }\n }\n }\n }\n .main-container {\n max-width: 80%;\n max-height: 80%;\n }\n"])), _variables.FontFamily.Raleway_700, _variables.FontFamily.AvenirNext, _variables.GlobalColors.s5, _variables.FontFamily.AvenirNext, _variables.GlobalColors.s5, _variables.GlobalColors.secondary_magenta);
19
-
20
- exports.Container = Container;
@@ -1,142 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.Login = void 0;
9
-
10
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
-
12
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
13
-
14
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
15
-
16
- var _styles = require("./styles");
17
-
18
- var _index = require("../../atoms/LogoImage/index");
19
-
20
- var _index2 = require("../../atoms/ScreenHeader/index");
21
-
22
- var _index3 = require("../../atoms/GeneralButton/index");
23
-
24
- var _index4 = require("../../atoms/CheckBox/index");
25
-
26
- var _TagAndInput = require("../TagAndInput");
27
-
28
- var _variables = require("../../../global-files/variables");
29
-
30
- var _react = require("react");
31
-
32
- var _jsxRuntime = require("react/jsx-runtime");
33
-
34
- var Login = function Login() {
35
- var _useState = (0, _react.useState)(false),
36
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
37
- emptyEmail = _useState2[0],
38
- setEmptyEmail = _useState2[1];
39
-
40
- var _useState3 = (0, _react.useState)(false),
41
- _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
42
- invalidEmail = _useState4[0],
43
- setInvalidEmail = _useState4[1];
44
-
45
- var _useState5 = (0, _react.useState)(false),
46
- _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
47
- emptyPassword = _useState6[0],
48
- setEmptyPassword = _useState6[1];
49
-
50
- var validate = /*#__PURE__*/function () {
51
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(e) {
52
- var email, password;
53
- return _regenerator.default.wrap(function _callee$(_context) {
54
- while (1) {
55
- switch (_context.prev = _context.next) {
56
- case 0:
57
- e.preventDefault();
58
- email = document.querySelector("#emailInput").value;
59
- password = document.querySelector("#passwordInput").value;
60
- email === "" ? setEmptyEmail(true) : setEmptyEmail(false);
61
- password === "" ? setEmptyPassword(true) : setEmptyPassword(false);
62
- !/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(email) ? setInvalidEmail(true) : setInvalidEmail(false);
63
-
64
- case 6:
65
- case "end":
66
- return _context.stop();
67
- }
68
- }
69
- }, _callee);
70
- }));
71
-
72
- return function validate(_x) {
73
- return _ref.apply(this, arguments);
74
- };
75
- }();
76
-
77
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
78
- className: "home-login",
79
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
80
- className: "main-container",
81
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.LogoImage, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
82
- className: "credenciales",
83
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.ScreenHeader, {
84
- fontFamily: _variables.FontFamily.AvenirNext,
85
- color: _variables.GlobalColors.s5,
86
- text: "Ingresa tus credenciales"
87
- })
88
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
89
- className: "user",
90
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
91
- inputType: "text",
92
- label: "Nombre de usuario",
93
- inputPlaceHolder: "username@contentoh.com",
94
- inputId: "emailInput"
95
- })
96
- }), emptyEmail && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
97
- children: "Ingrese su correo"
98
- }), invalidEmail && !emptyEmail && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
99
- children: "Ingrese un correo v\xE1lido"
100
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
101
- className: "password",
102
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
103
- inputType: "text",
104
- label: "Contraseña",
105
- inputPlaceHolder: "Escribe tu contraseña",
106
- inputId: "passwordInput"
107
- })
108
- }), emptyPassword && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
109
- children: "Ingrese su contrase\xF1a"
110
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
111
- className: "select",
112
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index4.CheckBox, {
113
- label: "Mantener sesión activada",
114
- id: "chk-default",
115
- className: "active-left"
116
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
117
- className: "active-right",
118
- children: "Olvide mi contrase\xF1a"
119
- })]
120
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
121
- className: "button-right",
122
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index3.Button, {
123
- buttonType: "general-default-button",
124
- label: "Iniciar sesión",
125
- onClick: function onClick(e) {
126
- return validate(e);
127
- }
128
- })
129
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
130
- className: "new-login",
131
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
132
- className: "pre-registro",
133
- children: ["\xBFA\xFAn no tienes cuenta?", /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
134
- children: " Reg\xEDstrate"
135
- })]
136
- })
137
- })]
138
- })
139
- });
140
- };
141
-
142
- exports.Login = Login;
@@ -1,20 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.Container = void 0;
9
-
10
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
11
-
12
- var _styledComponents = _interopRequireDefault(require("styled-components"));
13
-
14
- var _variables = require("../../../global-files/variables");
15
-
16
- var _templateObject;
17
-
18
- var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background: \"white\";\n display: flex;\n height: 100%;\n justify-content: center;\n align-items: center;\n label {\n color: red;\n margin-top: 3px;\n margin-left: 15px;\n font-family: ", ";\n font-size: 11px;\n & + * {\n margin-top: 12px;\n }\n }\n\n &.home-login {\n .credenciales {\n & + * {\n margin-top: 30px;\n }\n }\n .user {\n & + * {\n margin-top: 20px;\n }\n }\n .password {\n & + * {\n margin-top: 20px;\n }\n }\n .select {\n display: flex;\n justify-content: space-between;\n .active-right {\n font-family: ", ";\n font-weight: 500;\n font-size: 13px;\n line-height: 24px;\n letter-spacing: -0.015em;\n color: ", ";\n cursor: pointer;\n }\n & + * {\n margin-top: 50px;\n }\n }\n .button-right {\n text-align: right;\n & + * {\n margin-top: 55px;\n }\n }\n .new-login {\n p {\n font-family: ", ";\n text-align: right;\n font-weight: 500;\n font-size: 13px;\n line-height: 24px;\n color: ", ";\n span {\n color: ", ";\n }\n }\n }\n }\n .main-container {\n max-width: 80%;\n max-height: 80%;\n }\n"])), _variables.FontFamily.Raleway_700, _variables.FontFamily.AvenirNext, _variables.GlobalColors.s5, _variables.FontFamily.AvenirNext, _variables.GlobalColors.s5, _variables.GlobalColors.secondary_magenta);
19
-
20
- exports.Container = Container;
@@ -1,11 +0,0 @@
1
- import { Login } from "./index";
2
-
3
- export default {
4
- title: "Components/molecules/Login",
5
- component: Login,
6
- };
7
-
8
- const Template = (args) => <Login {...args} />;
9
-
10
- export const LoginDefault = Template.bind({});
11
- LoginDefault.args = {};
@@ -1,79 +0,0 @@
1
- import { Container } from "./styles";
2
- import { LogoImage } from "../../atoms/LogoImage/index";
3
- import { ScreenHeader } from "../../atoms/ScreenHeader/index";
4
- import { Button } from "../../atoms/GeneralButton/index";
5
- import { CheckBox } from "../../atoms/CheckBox/index";
6
- import { TagAndInput } from "../TagAndInput";
7
- import { FontFamily, GlobalColors } from "../../../global-files/variables";
8
- import { useState } from "react";
9
-
10
- export const Login = () => {
11
- const [emptyEmail, setEmptyEmail] = useState(false);
12
- const [invalidEmail, setInvalidEmail] = useState(false);
13
- const [emptyPassword, setEmptyPassword] = useState(false);
14
- const validate = async (e) => {
15
- e.preventDefault();
16
- const email = document.querySelector("#emailInput").value;
17
- const password = document.querySelector("#passwordInput").value;
18
- email === "" ? setEmptyEmail(true) : setEmptyEmail(false);
19
- password === "" ? setEmptyPassword(true) : setEmptyPassword(false);
20
- !/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(
21
- email
22
- )
23
- ? setInvalidEmail(true)
24
- : setInvalidEmail(false);
25
- };
26
- return (
27
- <Container className={"home-login"}>
28
- <div className="main-container">
29
- <LogoImage />
30
- <div className="credenciales">
31
- <ScreenHeader
32
- fontFamily={FontFamily.AvenirNext}
33
- color={GlobalColors.s5}
34
- text={"Ingresa tus credenciales"}
35
- />
36
- </div>
37
- <div className="user">
38
- <TagAndInput
39
- inputType={"text"}
40
- label={"Nombre de usuario"}
41
- inputPlaceHolder={"username@contentoh.com"}
42
- inputId={"emailInput"}
43
- />
44
- </div>
45
- {emptyEmail && <label>Ingrese su correo</label>}
46
- {invalidEmail && !emptyEmail && <label>Ingrese un correo válido</label>}
47
- <div className="password">
48
- <TagAndInput
49
- inputType={"text"}
50
- label={"Contraseña"}
51
- inputPlaceHolder={"Escribe tu contraseña"}
52
- inputId={"passwordInput"}
53
- />
54
- </div>
55
- {emptyPassword && <label>Ingrese su contraseña</label>}
56
- <div className="select">
57
- <CheckBox
58
- label={"Mantener sesión activada"}
59
- id={"chk-default"}
60
- className="active-left"
61
- />
62
- <p className="active-right">Olvide mi contraseña</p>
63
- </div>
64
- <div className="button-right">
65
- <Button
66
- buttonType={"general-default-button"}
67
- label={"Iniciar sesión"}
68
- onClick={(e) => validate(e)}
69
- />
70
- </div>
71
- <div className="new-login">
72
- <p className="pre-registro">
73
- ¿Aún no tienes cuenta?<span> Regístrate</span>
74
- </p>
75
- </div>
76
- </div>
77
- </Container>
78
- );
79
- };