techsbcn-storybook 0.1.7 → 0.2.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 (32) hide show
  1. package/dist/components/fields/ButtonComponent/ButtonComponent.d.ts +14 -0
  2. package/dist/components/fields/TextFieldComponent/TextFieldComponent.d.ts +32 -0
  3. package/dist/components/forms/ChangePasswordForm.d.ts +20 -0
  4. package/dist/components/forms/LoginForm.d.ts +20 -0
  5. package/dist/components/forms/ResetPasswordForm.d.ts +17 -0
  6. package/dist/components/wrappers/PublicFormWrapper/PublicFormWrapper.d.ts +7 -0
  7. package/dist/index.d.ts +6 -2
  8. package/dist/stories/button/Button.stories.d.ts +4 -4
  9. package/dist/techsbcn-storybook.cjs.development.js +27 -18
  10. package/dist/techsbcn-storybook.cjs.development.js.map +1 -1
  11. package/dist/techsbcn-storybook.cjs.production.min.js +1 -1
  12. package/dist/techsbcn-storybook.cjs.production.min.js.map +1 -1
  13. package/dist/techsbcn-storybook.esm.js +25 -16
  14. package/dist/techsbcn-storybook.esm.js.map +1 -1
  15. package/package.json +82 -27
  16. package/src/components/fields/ButtonComponent/ButtonComponent.scss +31 -0
  17. package/src/components/fields/ButtonComponent/ButtonComponent.tsx +32 -0
  18. package/src/components/fields/TextFieldComponent/TextFieldComponent.scss +37 -0
  19. package/src/components/fields/TextFieldComponent/TextFieldComponent.tsx +94 -0
  20. package/src/components/forms/ChangePasswordForm.tsx +128 -0
  21. package/src/components/forms/LoginForm.tsx +103 -0
  22. package/src/components/forms/ResetPasswordForm.tsx +67 -0
  23. package/src/components/wrappers/PublicFormWrapper/PublicFormWrapper.scss +7 -0
  24. package/src/components/wrappers/PublicFormWrapper/PublicFormWrapper.tsx +26 -0
  25. package/src/index.tsx +6 -2
  26. package/src/stories/button/Button.stories.tsx +20 -19
  27. package/src/stories/thing/Thing.stories.tsx +1 -1
  28. package/src/stories/thing/Thing.tsx +1 -1
  29. package/src/styles/Globals.scss +46 -0
  30. package/dist/stories/button/Button.d.ts +0 -7
  31. package/src/stories/button/Button.scss +0 -11
  32. package/src/stories/button/Button.tsx +0 -12
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import './ButtonComponent.scss';
3
+ export interface ButtonComponentProps {
4
+ className?: string;
5
+ label?: string;
6
+ startIcon?: React.ReactNode;
7
+ endIcon?: React.ReactNode;
8
+ onClick?: () => void;
9
+ loading?: boolean;
10
+ form?: string;
11
+ type?: 'button' | 'submit' | 'reset';
12
+ disabled?: boolean;
13
+ }
14
+ export declare const ButtonComponent: React.FC<ButtonComponentProps>;
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import './TextFieldComponent.scss';
3
+ export declare type InputType = 'text' | 'radio' | 'checkbox' | 'textarea' | 'submit' | 'date' | 'hidden' | 'number' | 'range' | 'password' | 'time' | 'file';
4
+ interface TextFieldComponentProps {
5
+ id?: string;
6
+ label?: string;
7
+ name?: string;
8
+ value?: string | number;
9
+ className?: string;
10
+ type?: InputType;
11
+ placeholder?: string;
12
+ required?: boolean;
13
+ disabled?: boolean;
14
+ minNumber?: number;
15
+ maxNumber?: number;
16
+ error?: boolean;
17
+ startIcon?: React.ReactNode;
18
+ endIcon?: React.ReactNode;
19
+ fullWidth?: boolean;
20
+ helperText?: string;
21
+ textFieldRef?: any;
22
+ inputRef?: React.Ref<any>;
23
+ autoComplete?: string;
24
+ multiline?: boolean;
25
+ rows?: number;
26
+ maxLength?: number;
27
+ onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
28
+ onKeyUp?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
29
+ step?: number | string;
30
+ }
31
+ declare const TextFieldComponent: React.FC<TextFieldComponentProps>;
32
+ export default TextFieldComponent;
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ interface ChangePasswordFormProps {
3
+ onClick: (data: any) => void;
4
+ loading: boolean;
5
+ topComponent?: React.ReactNode;
6
+ bottomComponent?: React.ReactNode;
7
+ requiredText: {
8
+ requiredTextPassword: string;
9
+ requiredTextSamePassword: string;
10
+ };
11
+ valuesText: {
12
+ buttonText: string;
13
+ text1: string;
14
+ placeholder1?: string;
15
+ text2: string;
16
+ placeholder2?: string;
17
+ };
18
+ }
19
+ declare const ChangePasswordForm: React.FC<ChangePasswordFormProps>;
20
+ export default ChangePasswordForm;
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ interface LoginFormProps {
3
+ onClick: (data: any) => void;
4
+ topComponent?: React.ReactNode;
5
+ bottomComponent?: React.ReactNode;
6
+ loading: boolean;
7
+ requiredText: {
8
+ requiredTextMail: string;
9
+ requiredTextPassword: string;
10
+ };
11
+ valuesText: {
12
+ buttonText: string;
13
+ text1: string;
14
+ placeholder1?: string;
15
+ text2: string;
16
+ placeholder2?: string;
17
+ };
18
+ }
19
+ declare const LoginForm: React.FC<LoginFormProps>;
20
+ export default LoginForm;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ interface resetPasswordFormProps {
3
+ onClick: (data: any) => void;
4
+ loading: boolean;
5
+ topComponent?: React.ReactNode;
6
+ bottomComponent?: React.ReactNode;
7
+ requiredText: {
8
+ requiredTextMail: string;
9
+ };
10
+ valuesText: {
11
+ buttonText: string;
12
+ text: string;
13
+ placeholder?: string;
14
+ };
15
+ }
16
+ declare const ResetPasswordForm: React.FC<resetPasswordFormProps>;
17
+ export default ResetPasswordForm;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import './PublicFormWrapper.scss';
3
+ interface PublicFormWrapperProps {
4
+ className?: string;
5
+ }
6
+ declare const PublicFormWrapper: React.FC<PublicFormWrapperProps>;
7
+ export default PublicFormWrapper;
package/dist/index.d.ts CHANGED
@@ -1,2 +1,6 @@
1
- export * from './stories/button/Button';
2
- export * from './stories/thing/Thing';
1
+ export * from './components/wrappers/PublicFormWrapper/PublicFormWrapper';
2
+ export * from './components/fields/ButtonComponent/ButtonComponent';
3
+ export * from './components/fields/TextFieldComponent/TextFieldComponent';
4
+ export * from './components/forms/LoginForm';
5
+ export * from './components/forms/ChangePasswordForm';
6
+ export * from './components/forms/ResetPasswordForm';
@@ -1,7 +1,7 @@
1
1
  import { Meta, Story } from '@storybook/react';
2
- import { ButtonProps } from './Button';
3
2
  declare const meta: Meta;
4
3
  export default meta;
5
- export declare const Default: Story<ButtonProps>;
6
- export declare const Primary: Story<ButtonProps>;
7
- export declare const Secondary: Story<ButtonProps>;
4
+ export declare const Default: Story<import("@storybook/react").Args>;
5
+ export declare const LoginButton: Story<import("@storybook/react").Args>;
6
+ export declare const ModalCancel: Story<import("@storybook/react").Args>;
7
+ export declare const Loading: Story<import("@storybook/react").Args>;
@@ -4,7 +4,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
6
 
7
- var React = _interopDefault(require('react'));
7
+ var React = require('react');
8
+ var React__default = _interopDefault(React);
9
+ require('@mui/material');
10
+ var _ = require('@mui/material/');
11
+ require('yup');
12
+ require('react-hook-form');
13
+ require('@hookform/resolvers/yup');
14
+ require('@mui/icons-material');
8
15
 
9
16
  function styleInject(css, ref) {
10
17
  if ( ref === void 0 ) ref = {};
@@ -33,27 +40,29 @@ function styleInject(css, ref) {
33
40
  }
34
41
  }
35
42
 
36
- var css_248z = ".btn.primary {\n background-color: blue;\n color: white;\n}\n.btn.secondary {\n background-color: red;\n color: black;\n}";
43
+ var css_248z = ".public-form-wrapper .wrapper-box {\n background: white;\n border-radius: 5px;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px;\n}";
37
44
  styleInject(css_248z);
38
45
 
39
- var Button = function Button(_ref) {
40
- var label = _ref.label,
41
- primary = _ref.primary;
42
- return React.createElement("button", {
43
- className: "btn " + (primary ? 'primary' : 'secondary')
44
- }, label);
45
- };
46
-
47
- var css_248z$1 = ".thing {\n background-color: black;\n color: white;\n}";
46
+ var css_248z$1 = ".MuiButton-root {\n width: auto;\n padding: 0.8rem 1rem !important;\n text-transform: inherit !important;\n line-height: inherit !important;\n font-size: calc(12pt + (14 - 12) * calc(100vw - 300px)/1300) !important;\n box-shadow: none !important;\n}\n.MuiButton-root.btn-login {\n width: 100%;\n}\n.MuiButton-root.btn-modal-cancel {\n background-color: #666666 !important;\n}\n.MuiButton-root:hover {\n box-shadow: 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12) !important;\n}\n.MuiButton-root .MuiCircularProgress-root {\n color: white !important;\n}\n.MuiButton-root .MuiButton-label {\n font-size: calc(12pt + (14 - 12) * calc(100vw - 300px)/1300) !important;\n}\n.MuiButton-root .MuiButton-label .MuiCircularProgress-root {\n color: white !important;\n}";
48
47
  styleInject(css_248z$1);
49
48
 
50
- var Thing = function Thing(_ref) {
51
- var children = _ref.children;
52
- return React.createElement("div", {
53
- className: "thing"
54
- }, children || "the snozzberries taste like snozzberries");
49
+ var ButtonComponent = function ButtonComponent(props) {
50
+ return React__default.createElement(_.Button, {
51
+ type: props.type && props.type,
52
+ variant: "contained",
53
+ form: props.form && props.form,
54
+ className: "main-background-color " + (props.className ? props.className : ''),
55
+ startIcon: !props.loading && props.startIcon,
56
+ endIcon: !props.loading && props.endIcon,
57
+ onClick: props.onClick,
58
+ disabled: !props.loading && props.disabled
59
+ }, props.loading ? React__default.createElement(_.CircularProgress, {
60
+ size: 25
61
+ }) : props.label);
55
62
  };
56
63
 
57
- exports.Button = Button;
58
- exports.Thing = Thing;
64
+ var css_248z$2 = ".text-field-component .MuiFormLabel-root + .MuiInputBase-formControl {\n margin-top: 22px !important;\n}\n.text-field-component .MuiInputBase-root {\n color: grey !important;\n border: 1px solid grey;\n padding: 0.43rem 0.87rem;\n background-color: white !important;\n border-radius: 3px !important;\n}\n.text-field-component .MuiInputBase-root.Mui-error {\n border: 1px solid #F24726 !important;\n}\n.text-field-component .MuiInputBase-root:not(.Mui-disabled):hover {\n border: 1px solid grey;\n}\n.text-field-component .MuiInputBase-root.Mui-focused {\n border: 1px solid grey;\n}\n.text-field-component .MuiInputBase-root .MuiInputBase-input {\n color: #666666 !important;\n background-color: white !important;\n}\n.text-field-component .MuiInputBase-root .MuiInputBase-input::placeholder {\n text-overflow: ellipsis !important;\n color: #666666 !important;\n opacity: 1;\n}\n.text-field-component .MuiInputBase-root .Mui-disabled {\n -webkit-text-fill-color: #666666 !important;\n}\n.text-field-component .MuiFormHelperText-root {\n padding: 0 !important;\n font-size: 0.85rem !important;\n}";
65
+ styleInject(css_248z$2);
66
+
67
+ exports.ButtonComponent = ButtonComponent;
59
68
  //# sourceMappingURL=techsbcn-storybook.cjs.development.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"techsbcn-storybook.cjs.development.js","sources":["../node_modules/style-inject/dist/style-inject.es.js","../src/stories/button/Button.tsx","../src/stories/thing/Thing.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","import React, { FC, HTMLAttributes } from 'react';\r\n\r\nimport './Button.scss'\r\n\r\nexport interface ButtonProps extends HTMLAttributes<HTMLDivElement> { \r\n label?: string;\r\n primary?: boolean;\r\n}\r\n\r\nexport const Button: FC<ButtonProps> = ({ label, primary }) => {\r\n return <button className={`btn ${primary ? 'primary' : 'secondary'}`}>{label}</button>\r\n};\r\n","import React, { FC, HTMLAttributes, ReactChild } from 'react';\r\n\r\nimport './Thing.scss'\r\n\r\nexport interface ThingProps extends HTMLAttributes<HTMLDivElement> {\r\n children?: ReactChild;\r\n}\r\n\r\nexport const Thing: FC<ThingProps> = ({ children }) => {\r\n return <div className=\"thing\">{children || `the snozzberries taste like snozzberries`}</div>;\r\n};\r\n"],"names":["Button","label","primary","React","className","Thing","children"],"mappings":";;;;;;;;AAAA,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE;AAC/B,EAAE,KAAK,GAAG,KAAK,KAAK,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC;AACjC,EAAE,IAAI,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;AAC9B;AACA,EAAE,IAAI,CAAC,GAAG,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,EAAE,OAAO,EAAE;AAC1D;AACA,EAAE,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,EAAE,IAAI,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AAC9C,EAAE,KAAK,CAAC,IAAI,GAAG,UAAU,CAAC;AAC1B;AACA,EAAE,IAAI,QAAQ,KAAK,KAAK,EAAE;AAC1B,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE;AACzB,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;AAChD,KAAK,MAAM;AACX,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC9B,KAAK;AACL,GAAG,MAAM;AACT,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5B,GAAG;AACH;AACA,EAAE,IAAI,KAAK,CAAC,UAAU,EAAE;AACxB,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,GAAG,GAAG,CAAC;AACnC,GAAG,MAAM;AACT,IAAI,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;AACpD,GAAG;AACH;;;;;IChBaA,MAAM,GAAoB,SAA1BA,MAA0B;MAAGC,aAAAA;MAAOC,eAAAA;AAC/C,SAAOC,mBAAA,SAAA;AAAQC,IAAAA,SAAS,YAASF,OAAO,GAAG,SAAH,GAAe,WAA/B;GAAjB,EAAgED,KAAhE,CAAP;AACD,CAFM;;;;;ICDMI,KAAK,GAAmB,SAAxBA,KAAwB;MAAGC,gBAAAA;AACtC,SAAOH,mBAAA,MAAA;AAAKC,IAAAA,SAAS,EAAC;GAAf,EAAwBE,QAAQ,8CAAhC,CAAP;AACD,CAFM;;;;;"}
1
+ {"version":3,"file":"techsbcn-storybook.cjs.development.js","sources":["../node_modules/style-inject/dist/style-inject.es.js","../src/components/fields/ButtonComponent/ButtonComponent.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","import React from 'react';\r\nimport { Button, CircularProgress } from '@mui/material/';\r\nimport './ButtonComponent.scss';\r\n\r\nexport interface ButtonComponentProps {\r\n className?: string;\r\n label?: string;\r\n startIcon?: React.ReactNode;\r\n endIcon?: React.ReactNode;\r\n onClick?: () => void;\r\n loading?: boolean;\r\n form?: string;\r\n type?: 'button' | 'submit' | 'reset';\r\n disabled?: boolean;\r\n}\r\n\r\nexport const ButtonComponent: React.FC<ButtonComponentProps> = (props) => {\r\n return (\r\n <Button\r\n type={props.type && props.type}\r\n variant=\"contained\"\r\n form={props.form && props.form}\r\n className={`main-background-color ${props.className ? props.className : ''}`}\r\n startIcon={!props.loading && props.startIcon}\r\n endIcon={!props.loading && props.endIcon}\r\n onClick={props.onClick}\r\n disabled={!props.loading && props.disabled}\r\n >\r\n {props.loading ? <CircularProgress size={25} /> : props.label}\r\n </Button>\r\n );\r\n};\r\n"],"names":["ButtonComponent","props","React","Button","type","variant","form","className","startIcon","loading","endIcon","onClick","disabled","CircularProgress","size","label"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE;AAC/B,EAAE,KAAK,GAAG,KAAK,KAAK,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC;AACjC,EAAE,IAAI,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;AAC9B;AACA,EAAE,IAAI,CAAC,GAAG,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,EAAE,OAAO,EAAE;AAC1D;AACA,EAAE,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,EAAE,IAAI,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AAC9C,EAAE,KAAK,CAAC,IAAI,GAAG,UAAU,CAAC;AAC1B;AACA,EAAE,IAAI,QAAQ,KAAK,KAAK,EAAE;AAC1B,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE;AACzB,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;AAChD,KAAK,MAAM;AACX,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC9B,KAAK;AACL,GAAG,MAAM;AACT,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5B,GAAG;AACH;AACA,EAAE,IAAI,KAAK,CAAC,UAAU,EAAE;AACxB,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,GAAG,GAAG,CAAC;AACnC,GAAG,MAAM;AACT,IAAI,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;AACpD,GAAG;AACH;;;;;;;;ICTaA,eAAe,GAAmC,SAAlDA,eAAkD,CAACC,KAAD;AAC7D,SACEC,4BAAA,CAACC,QAAD;AACEC,IAAAA,IAAI,EAAEH,KAAK,CAACG,IAAN,IAAcH,KAAK,CAACG;AAC1BC,IAAAA,OAAO,EAAC;AACRC,IAAAA,IAAI,EAAEL,KAAK,CAACK,IAAN,IAAcL,KAAK,CAACK;AAC1BC,IAAAA,SAAS,8BAA2BN,KAAK,CAACM,SAAN,GAAkBN,KAAK,CAACM,SAAxB,GAAoC,EAA/D;AACTC,IAAAA,SAAS,EAAE,CAACP,KAAK,CAACQ,OAAP,IAAkBR,KAAK,CAACO;AACnCE,IAAAA,OAAO,EAAE,CAACT,KAAK,CAACQ,OAAP,IAAkBR,KAAK,CAACS;AACjCC,IAAAA,OAAO,EAAEV,KAAK,CAACU;AACfC,IAAAA,QAAQ,EAAE,CAACX,KAAK,CAACQ,OAAP,IAAkBR,KAAK,CAACW;GARpC,EAUGX,KAAK,CAACQ,OAAN,GAAgBP,4BAAA,CAACW,kBAAD;AAAkBC,IAAAA,IAAI,EAAE;GAAxB,CAAhB,GAAiDb,KAAK,CAACc,KAV1D,CADF;AAcD,CAfM;;;;;;;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=(e=require("react"))&&"object"==typeof e&&"default"in e?e.default:e;function n(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}n(".btn.primary {\n background-color: blue;\n color: white;\n}\n.btn.secondary {\n background-color: red;\n color: black;\n}"),n(".thing {\n background-color: black;\n color: white;\n}"),exports.Button=function(e){return t.createElement("button",{className:"btn "+(e.primary?"primary":"secondary")},e.label)},exports.Thing=function(e){return t.createElement("div",{className:"thing"},e.children||"the snozzberries taste like snozzberries")};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,o=(t=require("react"))&&"object"==typeof t&&"default"in t?t.default:t;require("@mui/material");var n=require("@mui/material/");function e(t,o){void 0===o&&(o={});var n=o.insertAt;if(t&&"undefined"!=typeof document){var e=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===n&&e.firstChild?e.insertBefore(r,e.firstChild):e.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}}require("yup"),require("react-hook-form"),require("@hookform/resolvers/yup"),require("@mui/icons-material"),e(".public-form-wrapper .wrapper-box {\n background: white;\n border-radius: 5px;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px;\n}"),e(".MuiButton-root {\n width: auto;\n padding: 0.8rem 1rem !important;\n text-transform: inherit !important;\n line-height: inherit !important;\n font-size: calc(12pt + (14 - 12) * calc(100vw - 300px)/1300) !important;\n box-shadow: none !important;\n}\n.MuiButton-root.btn-login {\n width: 100%;\n}\n.MuiButton-root.btn-modal-cancel {\n background-color: #666666 !important;\n}\n.MuiButton-root:hover {\n box-shadow: 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12) !important;\n}\n.MuiButton-root .MuiCircularProgress-root {\n color: white !important;\n}\n.MuiButton-root .MuiButton-label {\n font-size: calc(12pt + (14 - 12) * calc(100vw - 300px)/1300) !important;\n}\n.MuiButton-root .MuiButton-label .MuiCircularProgress-root {\n color: white !important;\n}"),e(".text-field-component .MuiFormLabel-root + .MuiInputBase-formControl {\n margin-top: 22px !important;\n}\n.text-field-component .MuiInputBase-root {\n color: grey !important;\n border: 1px solid grey;\n padding: 0.43rem 0.87rem;\n background-color: white !important;\n border-radius: 3px !important;\n}\n.text-field-component .MuiInputBase-root.Mui-error {\n border: 1px solid #F24726 !important;\n}\n.text-field-component .MuiInputBase-root:not(.Mui-disabled):hover {\n border: 1px solid grey;\n}\n.text-field-component .MuiInputBase-root.Mui-focused {\n border: 1px solid grey;\n}\n.text-field-component .MuiInputBase-root .MuiInputBase-input {\n color: #666666 !important;\n background-color: white !important;\n}\n.text-field-component .MuiInputBase-root .MuiInputBase-input::placeholder {\n text-overflow: ellipsis !important;\n color: #666666 !important;\n opacity: 1;\n}\n.text-field-component .MuiInputBase-root .Mui-disabled {\n -webkit-text-fill-color: #666666 !important;\n}\n.text-field-component .MuiFormHelperText-root {\n padding: 0 !important;\n font-size: 0.85rem !important;\n}"),exports.ButtonComponent=function(t){return o.createElement(n.Button,{type:t.type&&t.type,variant:"contained",form:t.form&&t.form,className:"main-background-color "+(t.className?t.className:""),startIcon:!t.loading&&t.startIcon,endIcon:!t.loading&&t.endIcon,onClick:t.onClick,disabled:!t.loading&&t.disabled},t.loading?o.createElement(n.CircularProgress,{size:25}):t.label)};
2
2
  //# sourceMappingURL=techsbcn-storybook.cjs.production.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"techsbcn-storybook.cjs.production.min.js","sources":["../node_modules/style-inject/dist/style-inject.es.js","../src/stories/button/Button.tsx","../src/stories/thing/Thing.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","import React, { FC, HTMLAttributes } from 'react';\r\n\r\nimport './Button.scss'\r\n\r\nexport interface ButtonProps extends HTMLAttributes<HTMLDivElement> { \r\n label?: string;\r\n primary?: boolean;\r\n}\r\n\r\nexport const Button: FC<ButtonProps> = ({ label, primary }) => {\r\n return <button className={`btn ${primary ? 'primary' : 'secondary'}`}>{label}</button>\r\n};\r\n","import React, { FC, HTMLAttributes, ReactChild } from 'react';\r\n\r\nimport './Thing.scss'\r\n\r\nexport interface ThingProps extends HTMLAttributes<HTMLDivElement> {\r\n children?: ReactChild;\r\n}\r\n\r\nexport const Thing: FC<ThingProps> = ({ children }) => {\r\n return <div className=\"thing\">{children || `the snozzberries taste like snozzberries`}</div>;\r\n};\r\n"],"names":["styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","React","className","primary","label","children"],"mappings":"gJAAA,SAASA,EAAYC,EAAKC,QACX,IAARA,IAAiBA,EAAM,IAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAKF,GAA2B,oBAAbG,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,qNCdP,mBAC9Be,0BAAQC,oBADgCC,QACJ,UAAY,gBADfC,sBCDL,mBAC5BH,uBAAKC,UAAU,WADgBG"}
1
+ {"version":3,"file":"techsbcn-storybook.cjs.production.min.js","sources":["../node_modules/style-inject/dist/style-inject.es.js","../src/components/fields/ButtonComponent/ButtonComponent.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","import React from 'react';\r\nimport { Button, CircularProgress } from '@mui/material/';\r\nimport './ButtonComponent.scss';\r\n\r\nexport interface ButtonComponentProps {\r\n className?: string;\r\n label?: string;\r\n startIcon?: React.ReactNode;\r\n endIcon?: React.ReactNode;\r\n onClick?: () => void;\r\n loading?: boolean;\r\n form?: string;\r\n type?: 'button' | 'submit' | 'reset';\r\n disabled?: boolean;\r\n}\r\n\r\nexport const ButtonComponent: React.FC<ButtonComponentProps> = (props) => {\r\n return (\r\n <Button\r\n type={props.type && props.type}\r\n variant=\"contained\"\r\n form={props.form && props.form}\r\n className={`main-background-color ${props.className ? props.className : ''}`}\r\n startIcon={!props.loading && props.startIcon}\r\n endIcon={!props.loading && props.endIcon}\r\n onClick={props.onClick}\r\n disabled={!props.loading && props.disabled}\r\n >\r\n {props.loading ? <CircularProgress size={25} /> : props.label}\r\n </Button>\r\n );\r\n};\r\n"],"names":["styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","props","React","Button","variant","form","className","startIcon","loading","endIcon","onClick","disabled","CircularProgress","size","label"],"mappings":"yMAAA,SAASA,EAAYC,EAAKC,QACX,IAARA,IAAiBA,EAAM,IAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAKF,GAA2B,oBAAbG,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,0wECPiB,SAACe,UAE5DC,gBAACC,UACCT,KAAMO,EAAMP,MAAQO,EAAMP,KAC1BU,QAAQ,YACRC,KAAMJ,EAAMI,MAAQJ,EAAMI,KAC1BC,oCAAoCL,EAAMK,UAAYL,EAAMK,UAAY,IACxEC,WAAYN,EAAMO,SAAWP,EAAMM,UACnCE,SAAUR,EAAMO,SAAWP,EAAMQ,QACjCC,QAAST,EAAMS,QACfC,UAAWV,EAAMO,SAAWP,EAAMU,UAEjCV,EAAMO,QAAUN,gBAACU,oBAAiBC,KAAM,KAASZ,EAAMa"}
@@ -1,4 +1,10 @@
1
1
  import React from 'react';
2
+ import '@mui/material';
3
+ import { Button, CircularProgress } from '@mui/material/';
4
+ import 'yup';
5
+ import 'react-hook-form';
6
+ import '@hookform/resolvers/yup';
7
+ import '@mui/icons-material';
2
8
 
3
9
  function styleInject(css, ref) {
4
10
  if ( ref === void 0 ) ref = {};
@@ -27,26 +33,29 @@ function styleInject(css, ref) {
27
33
  }
28
34
  }
29
35
 
30
- var css_248z = ".btn.primary {\n background-color: blue;\n color: white;\n}\n.btn.secondary {\n background-color: red;\n color: black;\n}";
36
+ var css_248z = ".public-form-wrapper .wrapper-box {\n background: white;\n border-radius: 5px;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px;\n}";
31
37
  styleInject(css_248z);
32
38
 
33
- var Button = function Button(_ref) {
34
- var label = _ref.label,
35
- primary = _ref.primary;
36
- return React.createElement("button", {
37
- className: "btn " + (primary ? 'primary' : 'secondary')
38
- }, label);
39
- };
40
-
41
- var css_248z$1 = ".thing {\n background-color: black;\n color: white;\n}";
39
+ var css_248z$1 = ".MuiButton-root {\n width: auto;\n padding: 0.8rem 1rem !important;\n text-transform: inherit !important;\n line-height: inherit !important;\n font-size: calc(12pt + (14 - 12) * calc(100vw - 300px)/1300) !important;\n box-shadow: none !important;\n}\n.MuiButton-root.btn-login {\n width: 100%;\n}\n.MuiButton-root.btn-modal-cancel {\n background-color: #666666 !important;\n}\n.MuiButton-root:hover {\n box-shadow: 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12) !important;\n}\n.MuiButton-root .MuiCircularProgress-root {\n color: white !important;\n}\n.MuiButton-root .MuiButton-label {\n font-size: calc(12pt + (14 - 12) * calc(100vw - 300px)/1300) !important;\n}\n.MuiButton-root .MuiButton-label .MuiCircularProgress-root {\n color: white !important;\n}";
42
40
  styleInject(css_248z$1);
43
41
 
44
- var Thing = function Thing(_ref) {
45
- var children = _ref.children;
46
- return React.createElement("div", {
47
- className: "thing"
48
- }, children || "the snozzberries taste like snozzberries");
42
+ var ButtonComponent = function ButtonComponent(props) {
43
+ return React.createElement(Button, {
44
+ type: props.type && props.type,
45
+ variant: "contained",
46
+ form: props.form && props.form,
47
+ className: "main-background-color " + (props.className ? props.className : ''),
48
+ startIcon: !props.loading && props.startIcon,
49
+ endIcon: !props.loading && props.endIcon,
50
+ onClick: props.onClick,
51
+ disabled: !props.loading && props.disabled
52
+ }, props.loading ? React.createElement(CircularProgress, {
53
+ size: 25
54
+ }) : props.label);
49
55
  };
50
56
 
51
- export { Button, Thing };
57
+ var css_248z$2 = ".text-field-component .MuiFormLabel-root + .MuiInputBase-formControl {\n margin-top: 22px !important;\n}\n.text-field-component .MuiInputBase-root {\n color: grey !important;\n border: 1px solid grey;\n padding: 0.43rem 0.87rem;\n background-color: white !important;\n border-radius: 3px !important;\n}\n.text-field-component .MuiInputBase-root.Mui-error {\n border: 1px solid #F24726 !important;\n}\n.text-field-component .MuiInputBase-root:not(.Mui-disabled):hover {\n border: 1px solid grey;\n}\n.text-field-component .MuiInputBase-root.Mui-focused {\n border: 1px solid grey;\n}\n.text-field-component .MuiInputBase-root .MuiInputBase-input {\n color: #666666 !important;\n background-color: white !important;\n}\n.text-field-component .MuiInputBase-root .MuiInputBase-input::placeholder {\n text-overflow: ellipsis !important;\n color: #666666 !important;\n opacity: 1;\n}\n.text-field-component .MuiInputBase-root .Mui-disabled {\n -webkit-text-fill-color: #666666 !important;\n}\n.text-field-component .MuiFormHelperText-root {\n padding: 0 !important;\n font-size: 0.85rem !important;\n}";
58
+ styleInject(css_248z$2);
59
+
60
+ export { ButtonComponent };
52
61
  //# sourceMappingURL=techsbcn-storybook.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"techsbcn-storybook.esm.js","sources":["../node_modules/style-inject/dist/style-inject.es.js","../src/stories/button/Button.tsx","../src/stories/thing/Thing.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","import React, { FC, HTMLAttributes } from 'react';\r\n\r\nimport './Button.scss'\r\n\r\nexport interface ButtonProps extends HTMLAttributes<HTMLDivElement> { \r\n label?: string;\r\n primary?: boolean;\r\n}\r\n\r\nexport const Button: FC<ButtonProps> = ({ label, primary }) => {\r\n return <button className={`btn ${primary ? 'primary' : 'secondary'}`}>{label}</button>\r\n};\r\n","import React, { FC, HTMLAttributes, ReactChild } from 'react';\r\n\r\nimport './Thing.scss'\r\n\r\nexport interface ThingProps extends HTMLAttributes<HTMLDivElement> {\r\n children?: ReactChild;\r\n}\r\n\r\nexport const Thing: FC<ThingProps> = ({ children }) => {\r\n return <div className=\"thing\">{children || `the snozzberries taste like snozzberries`}</div>;\r\n};\r\n"],"names":["Button","label","primary","React","className","Thing","children"],"mappings":";;AAAA,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE;AAC/B,EAAE,KAAK,GAAG,KAAK,KAAK,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC;AACjC,EAAE,IAAI,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;AAC9B;AACA,EAAE,IAAI,CAAC,GAAG,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,EAAE,OAAO,EAAE;AAC1D;AACA,EAAE,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,EAAE,IAAI,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AAC9C,EAAE,KAAK,CAAC,IAAI,GAAG,UAAU,CAAC;AAC1B;AACA,EAAE,IAAI,QAAQ,KAAK,KAAK,EAAE;AAC1B,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE;AACzB,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;AAChD,KAAK,MAAM;AACX,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC9B,KAAK;AACL,GAAG,MAAM;AACT,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5B,GAAG;AACH;AACA,EAAE,IAAI,KAAK,CAAC,UAAU,EAAE;AACxB,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,GAAG,GAAG,CAAC;AACnC,GAAG,MAAM;AACT,IAAI,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;AACpD,GAAG;AACH;;;;;IChBaA,MAAM,GAAoB,SAA1BA,MAA0B;MAAGC,aAAAA;MAAOC,eAAAA;AAC/C,SAAOC,mBAAA,SAAA;AAAQC,IAAAA,SAAS,YAASF,OAAO,GAAG,SAAH,GAAe,WAA/B;GAAjB,EAAgED,KAAhE,CAAP;AACD,CAFM;;;;;ICDMI,KAAK,GAAmB,SAAxBA,KAAwB;MAAGC,gBAAAA;AACtC,SAAOH,mBAAA,MAAA;AAAKC,IAAAA,SAAS,EAAC;GAAf,EAAwBE,QAAQ,8CAAhC,CAAP;AACD,CAFM;;;;"}
1
+ {"version":3,"file":"techsbcn-storybook.esm.js","sources":["../node_modules/style-inject/dist/style-inject.es.js","../src/components/fields/ButtonComponent/ButtonComponent.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","import React from 'react';\r\nimport { Button, CircularProgress } from '@mui/material/';\r\nimport './ButtonComponent.scss';\r\n\r\nexport interface ButtonComponentProps {\r\n className?: string;\r\n label?: string;\r\n startIcon?: React.ReactNode;\r\n endIcon?: React.ReactNode;\r\n onClick?: () => void;\r\n loading?: boolean;\r\n form?: string;\r\n type?: 'button' | 'submit' | 'reset';\r\n disabled?: boolean;\r\n}\r\n\r\nexport const ButtonComponent: React.FC<ButtonComponentProps> = (props) => {\r\n return (\r\n <Button\r\n type={props.type && props.type}\r\n variant=\"contained\"\r\n form={props.form && props.form}\r\n className={`main-background-color ${props.className ? props.className : ''}`}\r\n startIcon={!props.loading && props.startIcon}\r\n endIcon={!props.loading && props.endIcon}\r\n onClick={props.onClick}\r\n disabled={!props.loading && props.disabled}\r\n >\r\n {props.loading ? <CircularProgress size={25} /> : props.label}\r\n </Button>\r\n );\r\n};\r\n"],"names":["ButtonComponent","props","React","Button","type","variant","form","className","startIcon","loading","endIcon","onClick","disabled","CircularProgress","size","label"],"mappings":";;;;;;;;AAAA,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE;AAC/B,EAAE,KAAK,GAAG,KAAK,KAAK,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC;AACjC,EAAE,IAAI,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;AAC9B;AACA,EAAE,IAAI,CAAC,GAAG,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,EAAE,OAAO,EAAE;AAC1D;AACA,EAAE,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,EAAE,IAAI,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AAC9C,EAAE,KAAK,CAAC,IAAI,GAAG,UAAU,CAAC;AAC1B;AACA,EAAE,IAAI,QAAQ,KAAK,KAAK,EAAE;AAC1B,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE;AACzB,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;AAChD,KAAK,MAAM;AACX,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC9B,KAAK;AACL,GAAG,MAAM;AACT,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5B,GAAG;AACH;AACA,EAAE,IAAI,KAAK,CAAC,UAAU,EAAE;AACxB,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,GAAG,GAAG,CAAC;AACnC,GAAG,MAAM;AACT,IAAI,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;AACpD,GAAG;AACH;;;;;;;;ICTaA,eAAe,GAAmC,SAAlDA,eAAkD,CAACC,KAAD;AAC7D,SACEC,mBAAA,CAACC,MAAD;AACEC,IAAAA,IAAI,EAAEH,KAAK,CAACG,IAAN,IAAcH,KAAK,CAACG;AAC1BC,IAAAA,OAAO,EAAC;AACRC,IAAAA,IAAI,EAAEL,KAAK,CAACK,IAAN,IAAcL,KAAK,CAACK;AAC1BC,IAAAA,SAAS,8BAA2BN,KAAK,CAACM,SAAN,GAAkBN,KAAK,CAACM,SAAxB,GAAoC,EAA/D;AACTC,IAAAA,SAAS,EAAE,CAACP,KAAK,CAACQ,OAAP,IAAkBR,KAAK,CAACO;AACnCE,IAAAA,OAAO,EAAE,CAACT,KAAK,CAACQ,OAAP,IAAkBR,KAAK,CAACS;AACjCC,IAAAA,OAAO,EAAEV,KAAK,CAACU;AACfC,IAAAA,QAAQ,EAAE,CAACX,KAAK,CAACQ,OAAP,IAAkBR,KAAK,CAACW;GARpC,EAUGX,KAAK,CAACQ,OAAN,GAAgBP,mBAAA,CAACW,gBAAD;AAAkBC,IAAAA,IAAI,EAAE;GAAxB,CAAhB,GAAiDb,KAAK,CAACc,KAV1D,CADF;AAcD,CAfM;;;;;;;"}
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.7",
2
+ "version": "0.2.0",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -14,26 +14,31 @@
14
14
  "start": "tsdx watch",
15
15
  "build": "tsdx build",
16
16
  "test": "tsdx test --passWithNoTests",
17
- "lint": "tsdx lint",
17
+ "lint": "eslint . src/**/*.{ts,tsx} --fix",
18
18
  "prepare": "tsdx build",
19
19
  "size": "size-limit",
20
20
  "analyze": "size-limit --why",
21
21
  "storybook": "start-storybook -p 6006",
22
22
  "build-storybook": "build-storybook"
23
23
  },
24
- "peerDependencies": {
25
- "react": ">=16"
26
- },
27
24
  "husky": {
28
25
  "hooks": {
29
- "pre-commit": "tsdx lint"
26
+ "pre-commit": "export CI=true && yarn build && lint-staged && yarn test",
27
+ "pre-push": "export CI=true && yarn build && lint-staged && yarn test"
30
28
  }
31
29
  },
32
- "prettier": {
33
- "printWidth": 80,
34
- "semi": true,
35
- "singleQuote": true,
36
- "trailingComma": "es5"
30
+ "lint-staged": {
31
+ "*.{ts,tsx}": [
32
+ "eslint . src/**/*.{ts,tsx} --fix"
33
+ ],
34
+ "*.{js,jsx}": [
35
+ "eslint --fix"
36
+ ]
37
+ },
38
+ "settings": {
39
+ "import/resolver": {
40
+ "typescript": {}
41
+ }
37
42
  },
38
43
  "name": "techsbcn-storybook",
39
44
  "author": "techsbcn",
@@ -48,29 +53,79 @@
48
53
  "limit": "10 KB"
49
54
  }
50
55
  ],
56
+ "eslintConfig": {
57
+ "extends": [
58
+ "react-app",
59
+ "react-app/jest"
60
+ ],
61
+ "overrides": [
62
+ {
63
+ "files": [
64
+ "**/*.stories.*"
65
+ ],
66
+ "rules": {
67
+ "import/no-anonymous-default-export": "off"
68
+ }
69
+ }
70
+ ]
71
+ },
51
72
  "devDependencies": {
52
- "@babel/core": "^7.14.8",
53
- "@size-limit/preset-small-lib": "^5.0.2",
54
- "@storybook/addon-essentials": "^6.3.6",
73
+ "@babel/core": "^7.16.0",
74
+ "@emotion/react": "^11.7.0",
75
+ "@emotion/styled": "^11.6.0",
76
+ "@fortawesome/fontawesome-svg-core": "^1.2.36",
77
+ "@fortawesome/free-solid-svg-icons": "^5.15.4",
78
+ "@fortawesome/react-fontawesome": "^0.1.16",
79
+ "@hookform/resolvers": "^2.8.3",
80
+ "@mui/icons-material": "^5.2.0",
81
+ "@mui/material": "^5.2.1",
82
+ "@size-limit/preset-small-lib": "^7.0.3",
83
+ "@storybook/addon-essentials": "^6.3.12",
55
84
  "@storybook/addon-info": "^5.3.21",
56
- "@storybook/addon-links": "^6.3.6",
57
- "@storybook/addons": "^6.3.6",
85
+ "@storybook/addon-links": "^6.3.12",
86
+ "@storybook/addons": "^6.3.12",
58
87
  "@storybook/preset-create-react-app": "^3.2.0",
59
- "@storybook/react": "^6.3.6",
60
- "@types/react": "^17.0.15",
61
- "@types/react-dom": "^17.0.9",
62
- "babel-loader": "^8.2.2",
63
- "husky": "^7.0.1",
64
- "postcss": "^8.3.6",
88
+ "@storybook/react": "^6.3.12",
89
+ "@types/jest": "^27.0.3",
90
+ "@types/react": "^17.0.36",
91
+ "@types/react-dom": "^17.0.11",
92
+ "@types/yup": "^0.29.13",
93
+ "@typescript-eslint/eslint-plugin": "^5.4.0",
94
+ "@typescript-eslint/parser": "^5.4.0",
95
+ "babel-eslint": "^10.1.0",
96
+ "babel-loader": "^8.2.3",
97
+ "eslint": "^8.3.0",
98
+ "eslint-config-prettier": "^8.3.0",
99
+ "eslint-import-resolver-typescript": "^2.5.0",
100
+ "eslint-plugin-import": "^2.25.3",
101
+ "eslint-plugin-jest": "^25.3.0",
102
+ "eslint-plugin-jsx-a11y": "^6.5.1",
103
+ "eslint-plugin-prettier": "^4.0.0",
104
+ "eslint-plugin-react": "^7.27.1",
105
+ "eslint-plugin-react-hooks": "^4.3.0",
106
+ "husky": "^7.0.4",
107
+ "i18next": "^21.5.3",
108
+ "i18next-browser-languagedetector": "^6.1.2",
109
+ "lint-staged": "^12.1.2",
110
+ "postcss": "^8.3.11",
111
+ "prettier": "^2.4.1",
112
+ "prettier-eslint": "^13.0.0",
65
113
  "react": "^17.0.2",
66
114
  "react-dom": "^17.0.2",
115
+ "react-hook-form": "^7.20.4",
116
+ "react-i18next": "^11.14.3",
67
117
  "react-is": "^17.0.2",
68
118
  "react-scripts": "^4.0.3",
69
- "rollup-plugin-postcss": "^4.0.0",
70
- "sass": "^1.37.0",
71
- "size-limit": "^5.0.2",
119
+ "rollup-plugin-postcss": "^4.0.2",
120
+ "sass": "^1.43.4",
121
+ "size-limit": "^7.0.3",
72
122
  "tsdx": "^0.14.1",
73
- "tslib": "^2.3.0",
74
- "typescript": "^4.3.5"
123
+ "tslib": "^2.3.1",
124
+ "typescript": "^4.5.2",
125
+ "yarn-upgrade-all": "^0.5.4",
126
+ "yup": "^0.32.11"
127
+ },
128
+ "peerDependencies": {
129
+ "react": "*"
75
130
  }
76
131
  }
@@ -0,0 +1,31 @@
1
+ $size-form: (calc(100vw - 300px) / (1600 - 300));
2
+ $body-size: calc(12pt + (14 - 12) * #{$size-form});
3
+
4
+ .MuiButton-root {
5
+ width: auto;
6
+ padding: 0.8rem 1rem!important;
7
+ text-transform: inherit !important;
8
+ line-height: inherit !important;
9
+ font-size: $body-size !important;
10
+ box-shadow: none !important;
11
+ &.btn-login{
12
+ width: 100%;
13
+ }
14
+ &.btn-modal-cancel{
15
+ background-color: #666666 !important;
16
+ }
17
+ &:hover{
18
+ box-shadow: 0px 2px 4px -1px rgb(0 0 0 / 20%), 0px 4px 5px 0px rgb(0 0 0 / 14%), 0px 1px 10px 0px rgb(0 0 0 / 12%) !important;
19
+ }
20
+ .MuiCircularProgress-root{
21
+ color:white !important;
22
+ }
23
+ .MuiButton-label{
24
+ font-size: $body-size !important;
25
+ .MuiCircularProgress-root{
26
+ color:white !important;
27
+ }
28
+ }
29
+
30
+ }
31
+
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import { Button, CircularProgress } from '@mui/material/';
3
+ import './ButtonComponent.scss';
4
+
5
+ export interface ButtonComponentProps {
6
+ className?: string;
7
+ label?: string;
8
+ startIcon?: React.ReactNode;
9
+ endIcon?: React.ReactNode;
10
+ onClick?: () => void;
11
+ loading?: boolean;
12
+ form?: string;
13
+ type?: 'button' | 'submit' | 'reset';
14
+ disabled?: boolean;
15
+ }
16
+
17
+ export const ButtonComponent: React.FC<ButtonComponentProps> = (props) => {
18
+ return (
19
+ <Button
20
+ type={props.type && props.type}
21
+ variant="contained"
22
+ form={props.form && props.form}
23
+ className={`main-background-color ${props.className ? props.className : ''}`}
24
+ startIcon={!props.loading && props.startIcon}
25
+ endIcon={!props.loading && props.endIcon}
26
+ onClick={props.onClick}
27
+ disabled={!props.loading && props.disabled}
28
+ >
29
+ {props.loading ? <CircularProgress size={25} /> : props.label}
30
+ </Button>
31
+ );
32
+ };
@@ -0,0 +1,37 @@
1
+ .text-field-component{
2
+ .MuiFormLabel-root + .MuiInputBase-formControl{
3
+ margin-top: 22px !important;
4
+ }
5
+ .MuiInputBase-root{
6
+ color: grey !important;
7
+ border: 1px solid grey;
8
+ padding: 0.43rem 0.87rem;
9
+ background-color: white !important;
10
+ border-radius: 3px!important;
11
+ &.Mui-error{
12
+ border: 1px solid #F24726!important;
13
+ }
14
+ &:not(.Mui-disabled):hover {
15
+ border:1px solid grey;
16
+ }
17
+ &.Mui-focused{
18
+ border:1px solid grey;
19
+ }
20
+ .MuiInputBase-input{
21
+ color: #666666 !important;
22
+ background-color: white !important;
23
+ &::placeholder{
24
+ text-overflow: ellipsis !important;
25
+ color: #666666 !important;
26
+ opacity: 1;
27
+ }
28
+ }
29
+ .Mui-disabled{
30
+ -webkit-text-fill-color: #666666 !important;
31
+ }
32
+ }
33
+ .MuiFormHelperText-root{
34
+ padding: 0 !important;
35
+ font-size: 0.85rem!important;
36
+ }
37
+ }
@@ -0,0 +1,94 @@
1
+ import React from 'react';
2
+ import { TextField, Box } from '@mui/material/';
3
+ import './TextFieldComponent.scss';
4
+
5
+ export type InputType =
6
+ | 'text'
7
+ | 'radio'
8
+ | 'checkbox'
9
+ | 'textarea'
10
+ | 'submit'
11
+ | 'date'
12
+ | 'hidden'
13
+ | 'number'
14
+ | 'range'
15
+ | 'password'
16
+ | 'time'
17
+ | 'file';
18
+
19
+ interface TextFieldComponentProps {
20
+ id?: string;
21
+ label?: string;
22
+ name?: string;
23
+ value?: string | number;
24
+ className?: string;
25
+ type?: InputType;
26
+ placeholder?: string;
27
+ required?: boolean;
28
+ disabled?: boolean;
29
+ minNumber?: number;
30
+ maxNumber?: number;
31
+ error?: boolean;
32
+ startIcon?: React.ReactNode;
33
+ endIcon?: React.ReactNode;
34
+ fullWidth?: boolean;
35
+ helperText?: string;
36
+ textFieldRef?: any;
37
+ inputRef?: React.Ref<any>;
38
+ autoComplete?: string;
39
+ multiline?: boolean;
40
+ rows?: number;
41
+ maxLength?: number;
42
+ onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
43
+ onKeyUp?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
44
+ step?: number | string;
45
+ }
46
+
47
+ const TextFieldComponent: React.FC<TextFieldComponentProps> = (props) => {
48
+ return (
49
+ <Box className="text-field-component" width="100%">
50
+ <TextField
51
+ error={props.error}
52
+ id={props.id}
53
+ label={props.label}
54
+ defaultValue={props.value}
55
+ className={props.className}
56
+ required={props.required}
57
+ disabled={props.disabled}
58
+ type={props.type}
59
+ placeholder={props.placeholder}
60
+ autoComplete={props.autoComplete}
61
+ variant="standard"
62
+ ref={props.inputRef}
63
+ InputProps={{
64
+ disableUnderline: true,
65
+ startAdornment: props.startIcon,
66
+ endAdornment: props.endIcon,
67
+ inputProps: {
68
+ max: props.maxNumber,
69
+ min: props.minNumber,
70
+ step: props.step,
71
+ },
72
+ }}
73
+ InputLabelProps={{ shrink: true }}
74
+ helperText={props.helperText}
75
+ fullWidth={props.fullWidth}
76
+ multiline={props.multiline}
77
+ rows={props.rows}
78
+ onChange={props.onChange}
79
+ onKeyUp={props.onKeyUp}
80
+ inputProps={{
81
+ maxLength: props.maxLength,
82
+ step: props.step,
83
+ max: props.maxNumber,
84
+ min: props.minNumber,
85
+ }}
86
+ />
87
+ </Box>
88
+ );
89
+ };
90
+ TextFieldComponent.defaultProps = {
91
+ fullWidth: true,
92
+ type: 'text',
93
+ };
94
+ export default TextFieldComponent;
@@ -0,0 +1,128 @@
1
+ import React, { useState } from 'react';
2
+ import { Box, Grid, IconButton } from '@mui/material/';
3
+ import { Visibility, VisibilityOff } from '@mui/icons-material';
4
+ import { useForm, Controller } from 'react-hook-form';
5
+ import * as yup from 'yup';
6
+ import { yupResolver } from '@hookform/resolvers/yup';
7
+ import TextFieldComponent from '../fields/TextFieldComponent/TextFieldComponent';
8
+ import { ButtonComponent } from '../fields/ButtonComponent/ButtonComponent';
9
+
10
+ interface ChangePasswordFormProps {
11
+ onClick: (data: any) => void;
12
+ loading: boolean;
13
+ topComponent?: React.ReactNode;
14
+ bottomComponent?: React.ReactNode;
15
+ requiredText: { requiredTextPassword: string; requiredTextSamePassword: string };
16
+ valuesText: { buttonText: string; text1: string; placeholder1?: string; text2: string; placeholder2?: string };
17
+ }
18
+
19
+ const ChangePasswordForm: React.FC<ChangePasswordFormProps> = (props) => {
20
+ const validationSchema = yup.object().shape({
21
+ password: yup.string().required(props.requiredText.requiredTextPassword),
22
+ passwordConfirmation: yup
23
+ .string()
24
+ .when('password', (password: any, schema: any) => {
25
+ if (password) return schema.required(props.requiredText.requiredTextPassword);
26
+ })
27
+ .oneOf([yup.ref('password'), null], props.requiredText.requiredTextSamePassword),
28
+ });
29
+
30
+ const {
31
+ handleSubmit,
32
+ control,
33
+ formState: { errors },
34
+ } = useForm({
35
+ resolver: yupResolver(validationSchema),
36
+ });
37
+
38
+ const [showPassword, setShownPassword] = useState(false);
39
+
40
+ const handleClickShowPassword = () => {
41
+ setShownPassword(!showPassword);
42
+ };
43
+
44
+ const handleMouseDownPassword = (event: React.MouseEvent<HTMLButtonElement>) => {
45
+ event.preventDefault();
46
+ };
47
+
48
+ return (
49
+ <Box>
50
+ {props.topComponent && <Box m={2}>{props.topComponent}</Box>}
51
+ <Box m={2}>
52
+ <Grid container direction="column" spacing={1}>
53
+ <Grid item>
54
+ <Controller
55
+ control={control}
56
+ name={'password'}
57
+ render={({ field: { onChange, name, ref } }) => (
58
+ <TextFieldComponent
59
+ label={props.valuesText.text1}
60
+ type={showPassword ? 'text' : 'password'}
61
+ error={!!errors.password}
62
+ placeholder={props.valuesText.placeholder1}
63
+ helperText={errors.password?.message}
64
+ name={name}
65
+ inputRef={ref}
66
+ onChange={(e) => {
67
+ onChange(e);
68
+ }}
69
+ endIcon={
70
+ <IconButton
71
+ aria-label="toggle password visibility"
72
+ onClick={handleClickShowPassword}
73
+ onMouseDown={handleMouseDownPassword}
74
+ size="small"
75
+ >
76
+ {showPassword ? <Visibility /> : <VisibilityOff />}
77
+ </IconButton>
78
+ }
79
+ />
80
+ )}
81
+ />
82
+ </Grid>
83
+ <Grid item>
84
+ <Controller
85
+ control={control}
86
+ name={'passwordConfirmation'}
87
+ render={({ field: { onChange, name, ref } }) => (
88
+ <TextFieldComponent
89
+ label={props.valuesText.text2}
90
+ placeholder={props.valuesText.placeholder2}
91
+ type={showPassword ? 'text' : 'password'}
92
+ error={!!errors.passwordConfirmation}
93
+ helperText={errors.passwordConfirmation?.message}
94
+ name={name}
95
+ inputRef={ref}
96
+ onChange={(e) => {
97
+ onChange(e);
98
+ }}
99
+ endIcon={
100
+ <IconButton
101
+ aria-label="toggle password visibility"
102
+ onClick={handleClickShowPassword}
103
+ onMouseDown={handleMouseDownPassword}
104
+ size="small"
105
+ >
106
+ {showPassword ? <Visibility /> : <VisibilityOff />}
107
+ </IconButton>
108
+ }
109
+ />
110
+ )}
111
+ />
112
+ </Grid>
113
+ </Grid>
114
+ </Box>
115
+ <Box m={2}>
116
+ <ButtonComponent
117
+ label={props.valuesText.buttonText}
118
+ className="btn-login"
119
+ onClick={handleSubmit(props.onClick)}
120
+ loading={props.loading}
121
+ />
122
+ </Box>
123
+ {props.bottomComponent && <Box m={2}>{props.bottomComponent}</Box>}
124
+ </Box>
125
+ );
126
+ };
127
+
128
+ export default ChangePasswordForm;
@@ -0,0 +1,103 @@
1
+ import React, { useState } from 'react';
2
+ import { Box, Grid, IconButton } from '@mui/material';
3
+ import * as yup from 'yup';
4
+ import { useForm, Controller } from 'react-hook-form';
5
+ import { yupResolver } from '@hookform/resolvers/yup';
6
+ import { Visibility, VisibilityOff } from '@mui/icons-material';
7
+ import TextFieldComponent from '../fields/TextFieldComponent/TextFieldComponent';
8
+ import { ButtonComponent } from '../fields/ButtonComponent/ButtonComponent';
9
+
10
+ interface LoginFormProps {
11
+ onClick: (data: any) => void;
12
+ topComponent?: React.ReactNode;
13
+ bottomComponent?: React.ReactNode;
14
+ loading: boolean;
15
+ requiredText: { requiredTextMail: string; requiredTextPassword: string };
16
+ valuesText: { buttonText: string; text1: string; placeholder1?: string; text2: string; placeholder2?: string };
17
+ }
18
+
19
+ const LoginForm: React.FC<LoginFormProps> = (props) => {
20
+ const LoginSchema = yup.object().shape({
21
+ email: yup.string().required(props.requiredText.requiredTextMail),
22
+ password: yup.string().required(props.requiredText.requiredTextPassword),
23
+ });
24
+
25
+ const [showPassword, setShownPassword] = useState(false);
26
+ const handleClickShowPassword = () => {
27
+ setShownPassword(!showPassword);
28
+ };
29
+
30
+ const {
31
+ control,
32
+ handleSubmit,
33
+ formState: { errors },
34
+ } = useForm({
35
+ resolver: yupResolver(LoginSchema),
36
+ });
37
+
38
+ return (
39
+ <Box m={2}>
40
+ {props.topComponent && <Box m={2}>{props.topComponent}</Box>}
41
+ <Box my={2}>
42
+ <Grid container direction="column" spacing={1}>
43
+ <Grid item>
44
+ <Controller
45
+ control={control}
46
+ name={'email'}
47
+ render={({ field: { onChange, name, ref } }) => (
48
+ <TextFieldComponent
49
+ label={props.valuesText.text1}
50
+ placeholder={props.valuesText.placeholder1}
51
+ autoComplete="email"
52
+ error={!!errors.email}
53
+ helperText={errors.email?.message}
54
+ name={name}
55
+ inputRef={ref}
56
+ onChange={(e) => {
57
+ onChange(e);
58
+ }}
59
+ />
60
+ )}
61
+ />
62
+ </Grid>
63
+ <Grid item>
64
+ <Controller
65
+ control={control}
66
+ name={'password'}
67
+ render={({ field: { onChange, name, ref } }) => (
68
+ <TextFieldComponent
69
+ label={props.valuesText.text2}
70
+ placeholder={props.valuesText.placeholder2}
71
+ type={showPassword ? 'text' : 'password'}
72
+ error={!!errors.password}
73
+ helperText={errors.password?.message}
74
+ name={name}
75
+ inputRef={ref}
76
+ onChange={(e) => {
77
+ onChange(e);
78
+ }}
79
+ endIcon={
80
+ <IconButton aria-label="toggle password visibility" onClick={handleClickShowPassword} size="small">
81
+ {showPassword ? <Visibility /> : <VisibilityOff />}
82
+ </IconButton>
83
+ }
84
+ />
85
+ )}
86
+ />
87
+ </Grid>
88
+ </Grid>
89
+ </Box>
90
+ <Box mb={5}>
91
+ <ButtonComponent
92
+ label={props.valuesText.buttonText}
93
+ loading={props.loading}
94
+ className="btn-login"
95
+ onClick={handleSubmit(props.onClick)}
96
+ />
97
+ </Box>
98
+ {props.bottomComponent && <Box m={2}>{props.bottomComponent}</Box>}
99
+ </Box>
100
+ );
101
+ };
102
+
103
+ export default LoginForm;
@@ -0,0 +1,67 @@
1
+ import React from 'react';
2
+ import { Box } from '@mui/material';
3
+ import * as yup from 'yup';
4
+ import { useForm, Controller } from 'react-hook-form';
5
+ import { yupResolver } from '@hookform/resolvers/yup';
6
+ import TextFieldComponent from '../fields/TextFieldComponent/TextFieldComponent';
7
+ import { ButtonComponent } from '../fields/ButtonComponent/ButtonComponent';
8
+
9
+ interface resetPasswordFormProps {
10
+ onClick: (data: any) => void;
11
+ loading: boolean;
12
+ topComponent?: React.ReactNode;
13
+ bottomComponent?: React.ReactNode;
14
+ requiredText: { requiredTextMail: string };
15
+ valuesText: { buttonText: string; text: string; placeholder?: string };
16
+ }
17
+
18
+ const ResetPasswordForm: React.FC<resetPasswordFormProps> = (props) => {
19
+ const ResetSchema = yup.object().shape({
20
+ email: yup.string().required(props.requiredText.requiredTextMail),
21
+ });
22
+
23
+ const {
24
+ control,
25
+ handleSubmit,
26
+ formState: { errors },
27
+ } = useForm({
28
+ resolver: yupResolver(ResetSchema),
29
+ });
30
+
31
+ return (
32
+ <Box m={2}>
33
+ {props.topComponent && <Box m={2}>{props.topComponent}</Box>}
34
+ <Box mx={2} my={2}>
35
+ <Controller
36
+ control={control}
37
+ name={'email'}
38
+ render={({ field: { onChange, name, ref } }) => (
39
+ <TextFieldComponent
40
+ label={props.valuesText.text}
41
+ placeholder={props.valuesText.placeholder}
42
+ autoComplete="email"
43
+ error={!!errors.email}
44
+ helperText={errors.email?.message}
45
+ name={name}
46
+ inputRef={ref}
47
+ onChange={(e) => {
48
+ onChange(e);
49
+ }}
50
+ />
51
+ )}
52
+ />
53
+ </Box>
54
+ <Box mx={2} mb={5}>
55
+ <ButtonComponent
56
+ label={props.valuesText.buttonText}
57
+ className="btn-login"
58
+ onClick={handleSubmit(props.onClick)}
59
+ loading={props.loading}
60
+ />
61
+ </Box>
62
+ {props.bottomComponent && <Box m={2}>{props.bottomComponent}</Box>}
63
+ </Box>
64
+ );
65
+ };
66
+
67
+ export default ResetPasswordForm;
@@ -0,0 +1,7 @@
1
+ .public-form-wrapper{
2
+ .wrapper-box{
3
+ background: white;
4
+ border-radius: 5px;
5
+ box-shadow: rgb(0 0 0 / 20%) 0px 11px 15px -7px, rgb(0 0 0 / 14%) 0px 24px 38px 3px, rgb(0 0 0 / 12%) 0px 9px 46px 8px;
6
+ }
7
+ }
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import { Box, Container } from '@mui/material';
3
+ import './PublicFormWrapper.scss';
4
+
5
+ interface PublicFormWrapperProps {
6
+ className?: string;
7
+ }
8
+ const PublicFormWrapper: React.FC<PublicFormWrapperProps> = (props) => {
9
+ return (
10
+ <Box
11
+ height="100%"
12
+ className={`public-form-wrapper ${props.className ? props.className : ''}`}
13
+ display="flex"
14
+ justifyContent="center"
15
+ alignItems="center"
16
+ >
17
+ <Container maxWidth="xs">
18
+ <Box className="wrapper-box" p={1}>
19
+ {props.children}
20
+ </Box>
21
+ </Container>
22
+ </Box>
23
+ );
24
+ };
25
+
26
+ export default PublicFormWrapper;
package/src/index.tsx CHANGED
@@ -1,2 +1,6 @@
1
- export * from './stories/button/Button';
2
- export * from './stories/thing/Thing';
1
+ export * from './components/wrappers/PublicFormWrapper/PublicFormWrapper';
2
+ export * from './components/fields/ButtonComponent/ButtonComponent';
3
+ export * from './components/fields/TextFieldComponent/TextFieldComponent';
4
+ export * from './components/forms/LoginForm';
5
+ export * from './components/forms/ChangePasswordForm';
6
+ export * from './components/forms/ResetPasswordForm';
@@ -1,17 +1,11 @@
1
1
  import React from 'react';
2
2
  import { Meta, Story } from '@storybook/react';
3
- import { Button, ButtonProps } from './Button';
3
+ import { ButtonComponent } from '../../components/fields/ButtonComponent/ButtonComponent';
4
4
 
5
5
  const meta: Meta = {
6
6
  title: 'Button',
7
- component: Button,
8
- argTypes: {
9
- children: {
10
- control: {
11
- type: 'text',
12
- },
13
- },
14
- },
7
+ component: ButtonComponent,
8
+ argTypes: {},
15
9
  parameters: {
16
10
  controls: { expanded: true },
17
11
  },
@@ -19,24 +13,31 @@ const meta: Meta = {
19
13
 
20
14
  export default meta;
21
15
 
22
- const Template: Story<ButtonProps> = args => <Button {...args} />;
16
+ const Template: Story = (args) => <ButtonComponent {...args} />;
23
17
 
24
18
  export const Default = Template.bind({});
25
19
 
26
20
  Default.args = {
27
- label: 'Default'
21
+ label: 'Default',
22
+ onClick: () => console.log('Clicked !'),
23
+ };
24
+
25
+ export const LoginButton = Template.bind({});
26
+
27
+ LoginButton.args = {
28
+ label: 'Login',
29
+ className: 'btn-login',
28
30
  };
29
31
 
30
- export const Primary = Template.bind({});
32
+ export const ModalCancel = Template.bind({});
31
33
 
32
- Primary.args = {
33
- label: 'Primary',
34
- primary: true
34
+ ModalCancel.args = {
35
+ label: 'Cancelar',
36
+ className: 'btn-modal-cancel',
35
37
  };
36
38
 
37
- export const Secondary = Template.bind({});
39
+ export const Loading = Template.bind({});
38
40
 
39
- Secondary.args = {
40
- label: 'Secondary',
41
- primary: false
41
+ Loading.args = {
42
+ loading: true,
42
43
  };
@@ -19,7 +19,7 @@ const meta: Meta = {
19
19
 
20
20
  export default meta;
21
21
 
22
- const Template: Story<ThingProps> = args => <Thing {...args} />;
22
+ const Template: Story<ThingProps> = (args) => <Thing {...args} />;
23
23
 
24
24
  export const Default = Template.bind({});
25
25
 
@@ -1,6 +1,6 @@
1
1
  import React, { FC, HTMLAttributes, ReactChild } from 'react';
2
2
 
3
- import './Thing.scss'
3
+ import './Thing.scss';
4
4
 
5
5
  export interface ThingProps extends HTMLAttributes<HTMLDivElement> {
6
6
  children?: ReactChild;
@@ -0,0 +1,46 @@
1
+ $color-grey-background-primary: #515151;
2
+ $color-grey-background-secundary: #5c5c5c;
3
+ $color-red: #F24726;
4
+
5
+
6
+ $screen-xxs-min: 320px;
7
+ $screen-xxs-max: 375px;
8
+ $screen-xs-between: 420px;
9
+ $screen-xs-max: 575px;
10
+ $screen-sm-min: 576px;
11
+ $screen-sm-max: 767px;
12
+ $screen-md-min: 768px;
13
+ $screen-md-max: 991px;
14
+ $screen-lg-min: 992px;
15
+ $screen-lg-between: 1100px;
16
+ $screen-lg-max: 1199px;
17
+ $screen-xl-min: 1200px;
18
+ $screen-xl-min-between: 1366px;
19
+ $screen-xl-max: 1440px;
20
+
21
+
22
+ $size-form: (calc(100vw - 300px) / (1600 - 300));
23
+
24
+ $body-size: calc(12pt + (14 - 12) * #{$size-form});
25
+
26
+ $extra-large-size: calc(30px + (32 - 30) * #{$size-form});
27
+ $large-size: calc(21px + (23 - 21) * #{$size-form});
28
+ $medium-size: calc(14pt + (16 - 14) * #{$size-form});
29
+ $small-size: calc(10pt + (12 - 10) * #{$size-form});
30
+
31
+
32
+ ::-webkit-scrollbar {
33
+ display: none;
34
+ }
35
+ body{
36
+ margin: 0;
37
+ font-size: $body-size;
38
+ height: 100vh;
39
+ a{
40
+ text-decoration: none;
41
+ color: inherit;
42
+ }
43
+ .cursor-pointer {
44
+ cursor: pointer;
45
+ }
46
+ }
@@ -1,7 +0,0 @@
1
- import { FC, HTMLAttributes } from 'react';
2
- import './Button.scss';
3
- export interface ButtonProps extends HTMLAttributes<HTMLDivElement> {
4
- label?: string;
5
- primary?: boolean;
6
- }
7
- export declare const Button: FC<ButtonProps>;
@@ -1,11 +0,0 @@
1
- .btn {
2
- &.primary {
3
- background-color: blue;
4
- color: white;
5
- }
6
-
7
- &.secondary {
8
- background-color: red;
9
- color: black;
10
- }
11
- }
@@ -1,12 +0,0 @@
1
- import React, { FC, HTMLAttributes } from 'react';
2
-
3
- import './Button.scss'
4
-
5
- export interface ButtonProps extends HTMLAttributes<HTMLDivElement> {
6
- label?: string;
7
- primary?: boolean;
8
- }
9
-
10
- export const Button: FC<ButtonProps> = ({ label, primary }) => {
11
- return <button className={`btn ${primary ? 'primary' : 'secondary'}`}>{label}</button>
12
- };