@coorpacademy/components 11.13.7-alpha.14 → 11.13.7-alpha.8

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 (37) hide show
  1. package/es/atom/form-text-input/index.d.ts +26 -0
  2. package/es/atom/form-text-input/index.d.ts.map +1 -0
  3. package/es/atom/form-text-input/index.js +103 -0
  4. package/es/atom/form-text-input/index.js.map +1 -0
  5. package/es/atom/form-text-input/prop-types.d.ts +54 -0
  6. package/es/atom/form-text-input/prop-types.d.ts.map +1 -0
  7. package/es/atom/form-text-input/prop-types.js +34 -0
  8. package/es/atom/form-text-input/prop-types.js.map +1 -0
  9. package/es/atom/form-text-input/style.css +53 -0
  10. package/es/molecule/cm-popin/index.d.ts.map +1 -1
  11. package/es/molecule/cm-popin/index.js +2 -3
  12. package/es/molecule/cm-popin/index.js.map +1 -1
  13. package/es/molecule/cm-popin/style.css +38 -50
  14. package/es/template/external-course/index.d.ts +21 -69
  15. package/es/template/external-course/index.d.ts.map +1 -1
  16. package/es/template/external-course/index.js +53 -70
  17. package/es/template/external-course/index.js.map +1 -1
  18. package/es/template/external-course/style.css +1 -1
  19. package/lib/atom/form-text-input/index.d.ts +26 -0
  20. package/lib/atom/form-text-input/index.d.ts.map +1 -0
  21. package/lib/atom/form-text-input/index.js +121 -0
  22. package/lib/atom/form-text-input/index.js.map +1 -0
  23. package/lib/atom/form-text-input/prop-types.d.ts +54 -0
  24. package/lib/atom/form-text-input/prop-types.d.ts.map +1 -0
  25. package/lib/atom/form-text-input/prop-types.js +45 -0
  26. package/lib/atom/form-text-input/prop-types.js.map +1 -0
  27. package/lib/atom/form-text-input/style.css +53 -0
  28. package/lib/molecule/cm-popin/index.d.ts.map +1 -1
  29. package/lib/molecule/cm-popin/index.js +1 -2
  30. package/lib/molecule/cm-popin/index.js.map +1 -1
  31. package/lib/molecule/cm-popin/style.css +38 -50
  32. package/lib/template/external-course/index.d.ts +21 -69
  33. package/lib/template/external-course/index.d.ts.map +1 -1
  34. package/lib/template/external-course/index.js +50 -73
  35. package/lib/template/external-course/index.js.map +1 -1
  36. package/lib/template/external-course/style.css +1 -1
  37. package/package.json +2 -2
@@ -0,0 +1,26 @@
1
+ /// <reference types="react" />
2
+ import { FormTextInputProps } from './prop-types';
3
+ declare const FormTextInput: {
4
+ ({ "aria-label": ariaLabel, autocomplete, "data-testid": dataTestid, disabled, hint, inputClassName, isRequired, label, maxlength, name, onChange, passwordValidator, placeholder, type, value, equals, wrapperClassName }: FormTextInputProps): JSX.Element;
5
+ propTypes: {
6
+ 'aria-label': import("prop-types").Requireable<string>;
7
+ autocomplete: import("prop-types").Requireable<string>;
8
+ 'data-testid': import("prop-types").Requireable<string>;
9
+ disabled: import("prop-types").Requireable<boolean>;
10
+ equals: import("prop-types").Requireable<NonNullable<string | number | null | undefined>>;
11
+ hint: import("prop-types").Requireable<string>;
12
+ inputClassName: import("prop-types").Requireable<string>;
13
+ isRequired: import("prop-types").Requireable<boolean>;
14
+ label: import("prop-types").Requireable<string>;
15
+ maxlength: import("prop-types").Requireable<number>;
16
+ name: import("prop-types").Requireable<string>;
17
+ onChange: import("prop-types").Requireable<(...args: any[]) => any>;
18
+ passwordValidator: import("prop-types").Requireable<(...args: any[]) => any>;
19
+ placeholder: import("prop-types").Requireable<string>;
20
+ type: import("prop-types").Requireable<string>;
21
+ value: import("prop-types").Requireable<NonNullable<string | number | null | undefined>>;
22
+ wrapperClassName: import("prop-types").Requireable<string>;
23
+ };
24
+ };
25
+ export default FormTextInput;
26
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/form-text-input/index.tsx"],"names":[],"mappings":";AAKA,OAAkB,EAAa,kBAAkB,EAAY,MAAM,cAAc,CAAC;AAkBlF,QAAA,MAAM,aAAa;gOAkBhB,kBAAkB;;;;;;;;;;;;;;;;;;;;CAuEpB,CAAC;AAIF,eAAe,aAAa,CAAC"}
@@ -0,0 +1,103 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
3
+ import React, { useCallback, useMemo, useState, useEffect } from 'react';
4
+ import classnames from 'classnames';
5
+ import isEmpty from 'lodash/fp/isEmpty';
6
+ import isEqual from 'lodash/fp/isEqual';
7
+ import noop from 'lodash/fp/noop';
8
+ import propTypes, { TextInput } from './prop-types';
9
+ import style from './style.css';
10
+
11
+ const validate = (fieldValue, fieldEqualsValue) => {
12
+ return isEqual(fieldValue, fieldEqualsValue);
13
+ };
14
+
15
+ const VALID_EMAIL_PATTERN = /[a-z0-9!#$%&'*+=?^_`{|}~-]+(?:.[a-z0-9!#$%&'*+=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/;
16
+
17
+ const validatePattern = (fieldValue, pattern) => {
18
+ return pattern.test(fieldValue);
19
+ };
20
+
21
+ const DEFAULT_MAX_LENGTH = 150;
22
+
23
+ const isEqualsDefined = equals => !isEmpty(equals);
24
+
25
+ const FormTextInput = ({
26
+ 'aria-label': ariaLabel,
27
+ autocomplete,
28
+ 'data-testid': dataTestid = 'form-text-input',
29
+ disabled,
30
+ hint,
31
+ inputClassName,
32
+ isRequired,
33
+ label,
34
+ maxlength = DEFAULT_MAX_LENGTH,
35
+ name,
36
+ onChange = noop,
37
+ passwordValidator = () => false,
38
+ placeholder,
39
+ type = 'default',
40
+ value,
41
+ equals,
42
+ wrapperClassName
43
+ }) => {
44
+ const [newValue, setNewValue] = useState(value);
45
+ const [isValid, setIsValid] = useState(true);
46
+ const isDefaultType = useMemo(() => !type || type === TextInput.default, [type]);
47
+ const isPasswordInput = useMemo(() => type === TextInput.password || type === TextInput.passwordConfirmation, [type]);
48
+ const isEmailInput = useMemo(() => type === TextInput.email, [type]);
49
+ const handleInputChange = useCallback(event => {
50
+ const newInput = event.target.value;
51
+ setNewValue(() => {
52
+ const isNewValueValid = !isEqualsDefined(equals) || validate(newInput, equals);
53
+ const validPattern = !isEmailInput || validatePattern(newInput, VALID_EMAIL_PATTERN);
54
+ const isPasswordCompliant = !isPasswordInput || passwordValidator(newInput);
55
+ setIsValid(isPasswordCompliant && isNewValueValid && validPattern);
56
+ return newInput;
57
+ });
58
+ }, [equals, isEmailInput, isPasswordInput, passwordValidator]);
59
+ useEffect(() => {
60
+ onChange(newValue, isValid);
61
+ return;
62
+ }, [isValid, newValue, onChange]);
63
+ const fieldLabel = useMemo(() => `${label} ${isRequired ? '*' : ''}`, [isRequired, label]);
64
+ const errorStyle = useMemo(() => isValid ? undefined : {
65
+ border: '2px solid rgb(247, 63, 82)'
66
+ }, [isValid]);
67
+ return /*#__PURE__*/React.createElement("div", {
68
+ className: classnames(style.wrapper, wrapperClassName)
69
+ }, /*#__PURE__*/React.createElement("label", {
70
+ className: style.formLabel,
71
+ htmlFor: name
72
+ }, fieldLabel), /*#__PURE__*/React.createElement("input", _extends({}, !isPasswordInput && !isEmailInput && {
73
+ maxLength: maxlength
74
+ }, isEmailInput && {
75
+ autoCapitalize: 'none'
76
+ }, isRequired && {
77
+ required: true
78
+ }, !isValid && {
79
+ 'aria-invalid': true
80
+ }, {
81
+ type: isDefaultType ? 'text' : type,
82
+ "aria-label": ariaLabel,
83
+ autoComplete: isDefaultType ? 'on' : autocomplete,
84
+ autoCorrect: 'off',
85
+ className: classnames(style.textInput, inputClassName),
86
+ "data-testid": dataTestid,
87
+ disabled: disabled,
88
+ id: name,
89
+ name: name,
90
+ onInput: handleInputChange,
91
+ placeholder: placeholder,
92
+ value: value,
93
+ style: errorStyle
94
+ })), /*#__PURE__*/React.createElement("div", {
95
+ className: style.hintWrapper
96
+ }, /*#__PURE__*/React.createElement("span", {
97
+ className: style.hint
98
+ }, hint)));
99
+ };
100
+
101
+ FormTextInput.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
102
+ export default FormTextInput;
103
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["React","useCallback","useMemo","useState","useEffect","classnames","isEmpty","isEqual","noop","propTypes","TextInput","style","validate","fieldValue","fieldEqualsValue","VALID_EMAIL_PATTERN","validatePattern","pattern","test","DEFAULT_MAX_LENGTH","isEqualsDefined","equals","FormTextInput","ariaLabel","autocomplete","dataTestid","disabled","hint","inputClassName","isRequired","label","maxlength","name","onChange","passwordValidator","placeholder","type","value","wrapperClassName","newValue","setNewValue","isValid","setIsValid","isDefaultType","default","isPasswordInput","password","passwordConfirmation","isEmailInput","email","handleInputChange","event","newInput","target","isNewValueValid","validPattern","isPasswordCompliant","fieldLabel","errorStyle","undefined","border","wrapper","formLabel","maxLength","autoCapitalize","required","textInput","hintWrapper"],"sources":["../../../src/atom/form-text-input/index.tsx"],"sourcesContent":["import React, {useCallback, useMemo, useState, useEffect, FormEvent} from 'react';\nimport classnames from 'classnames';\nimport isEmpty from 'lodash/fp/isEmpty';\nimport isEqual from 'lodash/fp/isEqual';\nimport noop from 'lodash/fp/noop';\nimport propTypes, {FieldValue, FormTextInputProps, TextInput} from './prop-types';\nimport style from './style.css';\n\nconst validate = (fieldValue: FieldValue, fieldEqualsValue: FieldValue) => {\n return isEqual(fieldValue, fieldEqualsValue);\n};\n\nconst VALID_EMAIL_PATTERN =\n /[a-z0-9!#$%&'*+=?^_`{|}~-]+(?:.[a-z0-9!#$%&'*+=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/;\n\nconst validatePattern = (fieldValue: string, pattern: RegExp) => {\n return pattern.test(fieldValue);\n};\n\nconst DEFAULT_MAX_LENGTH = 150;\n\nconst isEqualsDefined = (equals: FieldValue | undefined): equals is FieldValue => !isEmpty(equals);\n\nconst FormTextInput = ({\n 'aria-label': ariaLabel,\n autocomplete,\n 'data-testid': dataTestid = 'form-text-input',\n disabled,\n hint,\n inputClassName,\n isRequired,\n label,\n maxlength = DEFAULT_MAX_LENGTH,\n name,\n onChange = noop,\n passwordValidator = () => false,\n placeholder,\n type = 'default',\n value,\n equals,\n wrapperClassName\n}: FormTextInputProps) => {\n const [newValue, setNewValue] = useState<FieldValue>(value);\n\n const [isValid, setIsValid] = useState<boolean>(true);\n\n const isDefaultType = useMemo(() => !type || type === TextInput.default, [type]);\n\n const isPasswordInput = useMemo(\n () => type === TextInput.password || type === TextInput.passwordConfirmation,\n [type]\n );\n\n const isEmailInput = useMemo(() => type === TextInput.email, [type]);\n\n const handleInputChange = useCallback(\n (event: FormEvent<HTMLInputElement>) => {\n const newInput: FieldValue = (event.target as HTMLInputElement).value;\n setNewValue(() => {\n const isNewValueValid = !isEqualsDefined(equals) || validate(newInput, equals);\n const validPattern = !isEmailInput || validatePattern(newInput, VALID_EMAIL_PATTERN);\n const isPasswordCompliant = !isPasswordInput || passwordValidator(newInput);\n\n setIsValid(isPasswordCompliant && isNewValueValid && validPattern);\n\n return newInput;\n });\n },\n [equals, isEmailInput, isPasswordInput, passwordValidator]\n );\n\n useEffect(() => {\n onChange(newValue, isValid);\n return;\n }, [isValid, newValue, onChange]);\n\n const fieldLabel = useMemo(() => `${label} ${isRequired ? '*' : ''}`, [isRequired, label]);\n\n const errorStyle = useMemo(\n () => (isValid ? undefined : {border: '2px solid rgb(247, 63, 82)'}),\n [isValid]\n );\n\n return (\n <div className={classnames(style.wrapper, wrapperClassName)}>\n <label className={style.formLabel} htmlFor={name}>\n {fieldLabel}\n </label>\n <input\n {...(!isPasswordInput && !isEmailInput && {maxLength: maxlength})}\n {...(isEmailInput && {autoCapitalize: 'none'})}\n {...(isRequired && {required: true})}\n {...(!isValid && {'aria-invalid': true})}\n type={isDefaultType ? 'text' : type}\n aria-label={ariaLabel}\n autoComplete={isDefaultType ? 'on' : autocomplete}\n autoCorrect={'off'}\n className={classnames(style.textInput, inputClassName)}\n data-testid={dataTestid}\n disabled={disabled}\n id={name}\n name={name}\n onInput={handleInputChange}\n placeholder={placeholder}\n value={value}\n style={errorStyle}\n />\n <div className={style.hintWrapper}>\n <span className={style.hint}>{hint}</span>\n </div>\n </div>\n );\n};\n\nFormTextInput.propTypes = propTypes;\n\nexport default FormTextInput;\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,WAAf,EAA4BC,OAA5B,EAAqCC,QAArC,EAA+CC,SAA/C,QAA0E,OAA1E;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,OAAP,MAAoB,mBAApB;AACA,OAAOC,OAAP,MAAoB,mBAApB;AACA,OAAOC,IAAP,MAAiB,gBAAjB;AACA,OAAOC,SAAP,IAAmDC,SAAnD,QAAmE,cAAnE;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,QAAQ,GAAG,CAACC,UAAD,EAAyBC,gBAAzB,KAA0D;EACzE,OAAOP,OAAO,CAACM,UAAD,EAAaC,gBAAb,CAAd;AACD,CAFD;;AAIA,MAAMC,mBAAmB,GACvB,mIADF;;AAGA,MAAMC,eAAe,GAAG,CAACH,UAAD,EAAqBI,OAArB,KAAyC;EAC/D,OAAOA,OAAO,CAACC,IAAR,CAAaL,UAAb,CAAP;AACD,CAFD;;AAIA,MAAMM,kBAAkB,GAAG,GAA3B;;AAEA,MAAMC,eAAe,GAAIC,MAAD,IAA0D,CAACf,OAAO,CAACe,MAAD,CAA1F;;AAEA,MAAMC,aAAa,GAAG,CAAC;EACrB,cAAcC,SADO;EAErBC,YAFqB;EAGrB,eAAeC,UAAU,GAAG,iBAHP;EAIrBC,QAJqB;EAKrBC,IALqB;EAMrBC,cANqB;EAOrBC,UAPqB;EAQrBC,KARqB;EASrBC,SAAS,GAAGZ,kBATS;EAUrBa,IAVqB;EAWrBC,QAAQ,GAAGzB,IAXU;EAYrB0B,iBAAiB,GAAG,MAAM,KAZL;EAarBC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O,EAAEkB,iBAdX;IAeE,WAAW,EAAEf,WAff;IAgBE,KAAK,EAAEE,KAhBT;IAiBE,KAAK,EAAEqB;EAjBT,GAJF,eAuBE;IAAK,SAAS,EAAE/C,KAAK,CAACwD;EAAtB,gBACE;IAAM,SAAS,EAAExD,KAAK,CAACgB;EAAvB,GAA8BA,IAA9B,CADF,CAvBF,CADF;AA6BD,CAzFD;;AA2FAL,aAAa,CAACb,SAAd,2CAA0BA,SAA1B;AAEA,eAAea,aAAf"}
@@ -0,0 +1,54 @@
1
+ import PropTypes from 'prop-types';
2
+ export declare const TextInput: {
3
+ readonly country: "country";
4
+ readonly email: "email";
5
+ readonly firstName: "firstName";
6
+ readonly lastName: "lastName";
7
+ readonly language: "language";
8
+ readonly login: "login";
9
+ readonly password: "password";
10
+ readonly passwordConfirmation: "passwordConfirmation";
11
+ readonly default: "default";
12
+ };
13
+ declare const propTypes: {
14
+ 'aria-label': PropTypes.Requireable<string>;
15
+ autocomplete: PropTypes.Requireable<string>;
16
+ 'data-testid': PropTypes.Requireable<string>;
17
+ disabled: PropTypes.Requireable<boolean>;
18
+ equals: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
19
+ hint: PropTypes.Requireable<string>;
20
+ inputClassName: PropTypes.Requireable<string>;
21
+ isRequired: PropTypes.Requireable<boolean>;
22
+ label: PropTypes.Requireable<string>;
23
+ maxlength: PropTypes.Requireable<number>;
24
+ name: PropTypes.Requireable<string>;
25
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
26
+ passwordValidator: PropTypes.Requireable<(...args: any[]) => any>;
27
+ placeholder: PropTypes.Requireable<string>;
28
+ type: PropTypes.Requireable<string>;
29
+ value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
30
+ wrapperClassName: PropTypes.Requireable<string>;
31
+ };
32
+ declare type TextInputType = keyof typeof TextInput;
33
+ export declare type FieldValue = string | number;
34
+ export declare type FormTextInputProps = {
35
+ 'aria-label'?: string;
36
+ autocomplete?: string;
37
+ 'data-testid'?: string;
38
+ disabled?: boolean;
39
+ equals?: FieldValue;
40
+ hint?: string;
41
+ inputClassName?: string | null;
42
+ isRequired?: boolean;
43
+ label: string;
44
+ maxlength?: number;
45
+ name: string;
46
+ onChange?: (value: FieldValue, isValid?: boolean) => void;
47
+ passwordValidator?: (password: string) => boolean;
48
+ placeholder?: string;
49
+ type?: TextInputType;
50
+ value: FieldValue;
51
+ wrapperClassName?: string | null;
52
+ };
53
+ export default propTypes;
54
+ //# sourceMappingURL=prop-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prop-types.d.ts","sourceRoot":"","sources":["../../../src/atom/form-text-input/prop-types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAGnC,eAAO,MAAM,SAAS;;;;;;;;;;CAUZ,CAAC;AAEX,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;CAkBd,CAAC;AAEF,aAAK,aAAa,GAAG,MAAM,OAAO,SAAS,CAAC;AAE5C,oBAAY,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;AAEzC,oBAAY,kBAAkB,GAAG;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC1D,iBAAiB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,KAAK,EAAE,UAAU,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -0,0 +1,34 @@
1
+ import PropTypes from 'prop-types';
2
+ import keys from 'lodash/fp/keys';
3
+ export const TextInput = {
4
+ country: 'country',
5
+ email: 'email',
6
+ firstName: 'firstName',
7
+ lastName: 'lastName',
8
+ language: 'language',
9
+ login: 'login',
10
+ password: 'password',
11
+ passwordConfirmation: 'passwordConfirmation',
12
+ default: 'default'
13
+ };
14
+ const propTypes = {
15
+ 'aria-label': PropTypes.string,
16
+ autocomplete: PropTypes.string,
17
+ 'data-testid': PropTypes.string,
18
+ disabled: PropTypes.bool,
19
+ equals: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
20
+ hint: PropTypes.string,
21
+ inputClassName: PropTypes.string,
22
+ isRequired: PropTypes.bool,
23
+ label: PropTypes.string,
24
+ maxlength: PropTypes.number,
25
+ name: PropTypes.string,
26
+ onChange: PropTypes.func,
27
+ passwordValidator: PropTypes.func,
28
+ placeholder: PropTypes.string,
29
+ type: PropTypes.oneOf(keys(TextInput)),
30
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
31
+ wrapperClassName: PropTypes.string
32
+ };
33
+ export default propTypes;
34
+ //# sourceMappingURL=prop-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prop-types.js","names":["PropTypes","keys","TextInput","country","email","firstName","lastName","language","login","password","passwordConfirmation","default","propTypes","string","autocomplete","disabled","bool","equals","oneOfType","number","hint","inputClassName","isRequired","label","maxlength","name","onChange","func","passwordValidator","placeholder","type","oneOf","value","wrapperClassName"],"sources":["../../../src/atom/form-text-input/prop-types.ts"],"sourcesContent":["import PropTypes from 'prop-types';\nimport keys from 'lodash/fp/keys';\n\nexport const TextInput = {\n country: 'country',\n email: 'email',\n firstName: 'firstName',\n lastName: 'lastName',\n language: 'language',\n login: 'login',\n password: 'password',\n passwordConfirmation: 'passwordConfirmation',\n default: 'default'\n} as const;\n\nconst propTypes = {\n 'aria-label': PropTypes.string,\n autocomplete: PropTypes.string,\n 'data-testid': PropTypes.string,\n disabled: PropTypes.bool,\n equals: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n hint: PropTypes.string,\n inputClassName: PropTypes.string,\n isRequired: PropTypes.bool,\n label: PropTypes.string,\n maxlength: PropTypes.number,\n name: PropTypes.string,\n onChange: PropTypes.func,\n passwordValidator: PropTypes.func,\n placeholder: PropTypes.string,\n type: PropTypes.oneOf(keys(TextInput)),\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n wrapperClassName: PropTypes.string\n};\n\ntype TextInputType = keyof typeof TextInput;\n\nexport type FieldValue = string | number;\n\nexport type FormTextInputProps = {\n 'aria-label'?: string;\n autocomplete?: string;\n 'data-testid'?: string;\n disabled?: boolean;\n equals?: FieldValue;\n hint?: string;\n inputClassName?: string | null;\n isRequired?: boolean;\n label: string;\n maxlength?: number;\n name: string;\n onChange?: (value: FieldValue, isValid?: boolean) => void;\n passwordValidator?: (password: string) => boolean;\n placeholder?: string;\n type?: TextInputType;\n value: FieldValue;\n wrapperClassName?: string | null;\n};\n\nexport default propTypes;\n"],"mappings":"AAAA,OAAOA,SAAP,MAAsB,YAAtB;AACA,OAAOC,IAAP,MAAiB,gBAAjB;AAEA,OAAO,MAAMC,SAAS,GAAG;EACvBC,OAAO,EAAE,SADc;EAEvBC,KAAK,EAAE,OAFgB;EAGvBC,SAAS,EAAE,WAHY;EAIvBC,QAAQ,EAAE,UAJa;EAKvBC,QAAQ,EAAE,UALa;EAMvBC,KAAK,EAAE,OANgB;EAOvBC,QAAQ,EAAE,UAPa;EAQvBC,oBAAoB,EAAE,sBARC;EASvBC,OAAO,EAAE;AATc,CAAlB;AAYP,MAAMC,SAAS,GAAG;EAChB,cAAcZ,SAAS,CAACa,MADR;EAEhBC,YAAY,EAAEd,SAAS,CAACa,MAFR;EAGhB,eAAeb,SAAS,CAACa,MAHT;EAIhBE,QAAQ,EAAEf,SAAS,CAACgB,IAJJ;EAKhBC,MAAM,EAAEjB,SAAS,CAACkB,SAAV,CAAoB,CAAClB,SAAS,CAACa,MAAX,EAAmBb,SAAS,CAACmB,MAA7B,CAApB,CALQ;EAMhBC,IAAI,EAAEpB,SAAS,CAACa,MANA;EAOhBQ,cAAc,EAAErB,SAAS,CAACa,MAPV;EAQhBS,UAAU,EAAEtB,SAAS,CAACgB,IARN;EAShBO,KAAK,EAAEvB,SAAS,CAACa,MATD;EAUhBW,SAAS,EAAExB,SAAS,CAACmB,MAVL;EAWhBM,IAAI,EAAEzB,SAAS,CAACa,MAXA;EAYhBa,QAAQ,EAAE1B,SAAS,CAAC2B,IAZJ;EAahBC,iBAAiB,EAAE5B,SAAS,CAAC2B,IAbb;EAchBE,WAAW,EAAE7B,SAAS,CAACa,MAdP;EAehBiB,IAAI,EAAE9B,SAAS,CAAC+B,KAAV,CAAgB9B,IAAI,CAACC,SAAD,CAApB,CAfU;EAgBhB8B,KAAK,EAAEhC,SAAS,CAACkB,SAAV,CAAoB,CAAClB,SAAS,CAACa,MAAX,EAAmBb,SAAS,CAACmB,MAA7B,CAApB,CAhBS;EAiBhBc,gBAAgB,EAAEjC,SAAS,CAACa;AAjBZ,CAAlB;AA4CA,eAAeD,SAAf"}
@@ -0,0 +1,53 @@
1
+ @value colors: "../../variables/colors.css";
2
+ @value dark from colors;
3
+ @value cm_grey_400 from colors;
4
+ @value cm_grey_450 from colors;
5
+ @value white from colors;
6
+
7
+ .wrapper {
8
+ margin: 10px 0;
9
+ position: relative;
10
+ font-family: 'Gilroy';
11
+ }
12
+
13
+ .formLabel {
14
+ font-size: 13px;
15
+ text-align: left;
16
+ /* temporal */
17
+ color: dark;
18
+ display: block;
19
+ margin-bottom: 7px;
20
+ width: 100%;
21
+ }
22
+
23
+ .textInput {
24
+ width: 100%;
25
+ height: 59px;
26
+ background-color: white;
27
+ border: solid 1px cm_grey_450;
28
+ text-align: left;
29
+ margin-bottom: 26px;
30
+
31
+ appearance: none;
32
+ padding: 0 8px 0 15px;
33
+ border-radius: 0;
34
+
35
+ box-sizing: border-box;
36
+ cursor: text;
37
+
38
+ color: inherit;
39
+ font: inherit;
40
+ overflow: visible;
41
+ }
42
+
43
+ .hintWrapper {
44
+ font-size: 12px;
45
+ margin-top: -20px;
46
+ margin-bottom: 20px;
47
+ }
48
+
49
+ .hint {
50
+ color: cm_grey_400;
51
+ text-align: left;
52
+ font-style: italic;
53
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/cm-popin/index.js"],"names":[],"mappings":";AAeA,kDAkLC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/cm-popin/index.js"],"names":[],"mappings":";AAcA,kDAiLC"}
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { NovaSolidInterfaceFeedbackInterfaceAlertDiamond as AlertDiamond, NovaSolidApplicationsWindowUpload3 as WindowUpload, NovaLineSettingsCookie as Cookie, NovaSolidSpaceMoonRocket as MoonRocket, NovaLineStatusCheckCircle1 as CheckCircle1 } from '@coorpacademy/nova-icons';
2
+ import { NovaSolidInterfaceFeedbackInterfaceAlertDiamond as AlertDiamond, NovaSolidApplicationsWindowUpload3 as WindowUpload, NovaLineSettingsCookie as Cookie, NovaSolidSpaceMoonRocket as MoonRocket } from '@coorpacademy/nova-icons';
3
3
  import map from 'lodash/fp/map';
4
4
  import Cta from '../../atom/button-link';
5
5
  import ButtonLinkIconOnly from '../../atom/button-link-icon-only';
@@ -26,8 +26,7 @@ const CMPopin = props => {
26
26
  const logo = {
27
27
  AlertDiamond,
28
28
  WindowUpload,
29
- MoonRocket,
30
- CheckCircle1
29
+ MoonRocket
31
30
  };
32
31
  const LogoComponent = logo[icon];
33
32
  const backgroundImageStyle = backgroundImageUrl ? {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","NovaSolidInterfaceFeedbackInterfaceAlertDiamond","AlertDiamond","NovaSolidApplicationsWindowUpload3","WindowUpload","NovaLineSettingsCookie","Cookie","NovaSolidSpaceMoonRocket","MoonRocket","NovaLineStatusCheckCircle1","CheckCircle1","map","Cta","ButtonLinkIconOnly","InputSwitch","style","propTypes","CMPopin","props","content","mode","firstButton","secondButton","onClose","header","icon","backgroundImageUrl","descriptionText","thirdButton","cookieTitle","descriptionBtnTxt","listBtnSwicth","logo","LogoComponent","backgroundImageStyle","backgroundImage","backgroundSize","renderHeader","headerBackground","cookieHeader","cookieIconContainer","cookieIcon","getClassBtnSwitch","index","btnList","firstBtnSwitchContainer","length","lastBtnSwitchContainer","singleSwitchContainer","renderBtnSwitch","convert","cap","el","type","title","value","onChange","titlePosition","theme","details","requiredSelection","disabled","id","dataName","background","popinCookie","popin","popinHeader","cookieTitleContainer","titleContainer","contentSection","message","__html","descriptionBtn","buttonContainer","largeButton","button","label","handleOnclick","customStyle"],"sources":["../../../src/molecule/cm-popin/index.js"],"sourcesContent":["import React from 'react';\nimport {\n NovaSolidInterfaceFeedbackInterfaceAlertDiamond as AlertDiamond,\n NovaSolidApplicationsWindowUpload3 as WindowUpload,\n NovaLineSettingsCookie as Cookie,\n NovaSolidSpaceMoonRocket as MoonRocket,\n NovaLineStatusCheckCircle1 as CheckCircle1\n} from '@coorpacademy/nova-icons';\nimport map from 'lodash/fp/map';\nimport Cta from '../../atom/button-link';\nimport ButtonLinkIconOnly from '../../atom/button-link-icon-only';\nimport InputSwitch from '../../atom/input-switch';\nimport style from './style.css';\nimport propTypes from './types';\n\nconst CMPopin = props => {\n const {\n content,\n mode = 'alert',\n firstButton,\n secondButton,\n onClose,\n header,\n icon,\n backgroundImageUrl,\n descriptionText,\n thirdButton,\n cookieTitle,\n descriptionBtnTxt,\n listBtnSwicth\n } = props;\n\n const logo = {\n AlertDiamond,\n WindowUpload,\n MoonRocket,\n CheckCircle1\n };\n const LogoComponent = logo[icon];\n\n const backgroundImageStyle = backgroundImageUrl\n ? {\n backgroundImage: `url(${backgroundImageUrl})`,\n backgroundSize: 'cover'\n }\n : null;\n const renderHeader = () => {\n if (header) return <img className={style.headerBackground} src={header} />;\n if (mode === 'cookie')\n return (\n <div className={style.cookieHeader}>\n <div className={style.cookieIconContainer}>\n <Cookie className={style.cookieIcon} />\n </div>\n <div className={style.cookieTitle}>{cookieTitle}</div>\n </div>\n );\n return null;\n };\n const getClassBtnSwitch = (index, btnList) => {\n switch (index) {\n case 0:\n return style.firstBtnSwitchContainer;\n case btnList.length - 1:\n return style.lastBtnSwitchContainer;\n default:\n return style.singleSwitchContainer;\n }\n };\n const renderBtnSwitch = () => {\n return map.convert({cap: false})((el, index) => {\n const {\n type,\n title,\n value,\n onChange,\n titlePosition,\n theme,\n details,\n requiredSelection,\n disabled,\n id,\n 'data-name': dataName\n } = el;\n return (\n <div key={index} className={getClassBtnSwitch(index, listBtnSwicth)}>\n <InputSwitch\n {...{\n type,\n title,\n value,\n onChange,\n titlePosition,\n theme,\n details,\n requiredSelection,\n disabled,\n id,\n 'data-name': dataName\n }}\n />\n </div>\n );\n })(listBtnSwicth);\n };\n return (\n <div\n className={mode !== 'cookie' ? style.background : null}\n style={backgroundImageStyle}\n data-name={'cm-popin-container'}\n >\n <div className={mode === 'cookie' ? style.popinCookie : style.popin}>\n <header className={style.popinHeader}>\n {renderHeader()}\n {onClose ? (\n <ButtonLinkIconOnly\n onClick={onClose}\n data-name={'close-icon'}\n aria-label={'close-icon'}\n size=\"small\"\n icon=\"close\"\n />\n ) : null}\n </header>\n <div\n className={\n mode === 'cookie' || mode === 'information'\n ? style.cookieTitleContainer\n : style.titleContainer\n }\n >\n <div className={style.contentSection}>\n {LogoComponent ? <LogoComponent className={style.icon} /> : null}\n {content ? (\n <p\n className={mode === 'alert' ? style.content : style.message}\n data-name={'cm-popin-content'}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: content}}\n />\n ) : null}\n </div>\n {descriptionText ? (\n <p\n className={style.descriptionText}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: descriptionText}}\n />\n ) : null}\n </div>\n {descriptionBtnTxt ? <div className={style.descriptionBtn}>{descriptionBtnTxt}</div> : null}\n {renderBtnSwitch()}\n <div className={style.buttonContainer}>\n {firstButton ? (\n <div className={firstButton.largeButton ? style.largeButton : style.button}>\n <Cta\n label={firstButton.label}\n onClick={firstButton.handleOnclick}\n data-name={'cm-popin-cta'}\n aria-label={firstButton['aria-label']}\n type={firstButton.type}\n customStyle={firstButton.customStyle}\n />\n </div>\n ) : null}\n {secondButton ? (\n <div className={secondButton.largeButton ? style.largeButton : style.button}>\n <Cta\n label={secondButton.label}\n onClick={secondButton.handleOnclick}\n data-name={`cm-popin-cta-${secondButton.type}`}\n aria-label={secondButton['aria-label']}\n type={secondButton.type}\n customStyle={secondButton.customStyle}\n />\n </div>\n ) : null}\n {thirdButton ? (\n <div className={thirdButton.largeButton ? style.largeButton : style.button}>\n <Cta\n label={thirdButton.label}\n onClick={thirdButton.handleOnclick}\n data-name={`cm-popin-cta-${thirdButton.type}`}\n aria-label={thirdButton['aria-label']}\n type={thirdButton.type}\n customStyle={thirdButton.customStyle}\n />\n </div>\n ) : null}\n </div>\n </div>\n </div>\n );\n};\n\nCMPopin.propTypes = propTypes;\n\nexport default CMPopin;\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SACEC,+CAA+C,IAAIC,YADrD,EAEEC,kCAAkC,IAAIC,YAFxC,EAGEC,sBAAsB,IAAIC,MAH5B,EAIEC,wBAAwB,IAAIC,UAJ9B,EAKEC,0BAA0B,IAAIC,YALhC,QAMO,0BANP;AAOA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,GAAP,MAAgB,wBAAhB;AACA,OAAOC,kBAAP,MAA+B,kCAA/B;AACA,O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,KAAK,CAAC4D,WAAjC,GAA+C5D,KAAK,CAAC6D;EAArE,gBACE,oBAAC,GAAD;IACE,KAAK,EAAEtD,YAAY,CAACuD,KADtB;IAEE,OAAO,EAAEvD,YAAY,CAACwD,aAFxB;IAGE,aAAY,gBAAexD,YAAY,CAAC+B,IAAK,EAH/C;IAIE,cAAY/B,YAAY,CAAC,YAAD,CAJ1B;IAKE,IAAI,EAAEA,YAAY,CAAC+B,IALrB;IAME,WAAW,EAAE/B,YAAY,CAACyD;EAN5B,EADF,CADW,GAWT,IAxBN,EAyBGnD,WAAW,gBACV;IAAK,SAAS,EAAEA,WAAW,CAAC+C,WAAZ,GAA0B5D,KAAK,CAAC4D,WAAhC,GAA8C5D,KAAK,CAAC6D;EAApE,gBACE,oBAAC,GAAD;IACE,KAAK,EAAEhD,WAAW,CAACiD,KADrB;IAEE,OAAO,EAAEjD,WAAW,CAACkD,aAFvB;IAGE,aAAY,gBAAelD,WAAW,CAACyB,IAAK,EAH9C;IAIE,cAAYzB,WAAW,CAAC,YAAD,CAJzB;IAKE,IAAI,EAAEA,WAAW,CAACyB,IALpB;IAME,WAAW,EAAEzB,WAAW,CAACmD;EAN3B,EADF,CADU,GAWR,IApCN,CAzCF,CALF,CADF;AAwFD,CAlLD;;AAoLA9D,OAAO,CAACD,SAAR,2CAAoBA,SAApB;AAEA,eAAeC,OAAf"}
1
+ {"version":3,"file":"index.js","names":["React","NovaSolidInterfaceFeedbackInterfaceAlertDiamond","AlertDiamond","NovaSolidApplicationsWindowUpload3","WindowUpload","NovaLineSettingsCookie","Cookie","NovaSolidSpaceMoonRocket","MoonRocket","map","Cta","ButtonLinkIconOnly","InputSwitch","style","propTypes","CMPopin","props","content","mode","firstButton","secondButton","onClose","header","icon","backgroundImageUrl","descriptionText","thirdButton","cookieTitle","descriptionBtnTxt","listBtnSwicth","logo","LogoComponent","backgroundImageStyle","backgroundImage","backgroundSize","renderHeader","headerBackground","cookieHeader","cookieIconContainer","cookieIcon","getClassBtnSwitch","index","btnList","firstBtnSwitchContainer","length","lastBtnSwitchContainer","singleSwitchContainer","renderBtnSwitch","convert","cap","el","type","title","value","onChange","titlePosition","theme","details","requiredSelection","disabled","id","dataName","background","popinCookie","popin","popinHeader","cookieTitleContainer","titleContainer","contentSection","message","__html","descriptionBtn","buttonContainer","largeButton","button","label","handleOnclick","customStyle"],"sources":["../../../src/molecule/cm-popin/index.js"],"sourcesContent":["import React from 'react';\nimport {\n NovaSolidInterfaceFeedbackInterfaceAlertDiamond as AlertDiamond,\n NovaSolidApplicationsWindowUpload3 as WindowUpload,\n NovaLineSettingsCookie as Cookie,\n NovaSolidSpaceMoonRocket as MoonRocket\n} from '@coorpacademy/nova-icons';\nimport map from 'lodash/fp/map';\nimport Cta from '../../atom/button-link';\nimport ButtonLinkIconOnly from '../../atom/button-link-icon-only';\nimport InputSwitch from '../../atom/input-switch';\nimport style from './style.css';\nimport propTypes from './types';\n\nconst CMPopin = props => {\n const {\n content,\n mode = 'alert',\n firstButton,\n secondButton,\n onClose,\n header,\n icon,\n backgroundImageUrl,\n descriptionText,\n thirdButton,\n cookieTitle,\n descriptionBtnTxt,\n listBtnSwicth\n } = props;\n\n const logo = {\n AlertDiamond,\n WindowUpload,\n MoonRocket\n };\n const LogoComponent = logo[icon];\n\n const backgroundImageStyle = backgroundImageUrl\n ? {\n backgroundImage: `url(${backgroundImageUrl})`,\n backgroundSize: 'cover'\n }\n : null;\n const renderHeader = () => {\n if (header) return <img className={style.headerBackground} src={header} />;\n if (mode === 'cookie')\n return (\n <div className={style.cookieHeader}>\n <div className={style.cookieIconContainer}>\n <Cookie className={style.cookieIcon} />\n </div>\n <div className={style.cookieTitle}>{cookieTitle}</div>\n </div>\n );\n return null;\n };\n const getClassBtnSwitch = (index, btnList) => {\n switch (index) {\n case 0:\n return style.firstBtnSwitchContainer;\n case btnList.length - 1:\n return style.lastBtnSwitchContainer;\n default:\n return style.singleSwitchContainer;\n }\n };\n const renderBtnSwitch = () => {\n return map.convert({cap: false})((el, index) => {\n const {\n type,\n title,\n value,\n onChange,\n titlePosition,\n theme,\n details,\n requiredSelection,\n disabled,\n id,\n 'data-name': dataName\n } = el;\n return (\n <div key={index} className={getClassBtnSwitch(index, listBtnSwicth)}>\n <InputSwitch\n {...{\n type,\n title,\n value,\n onChange,\n titlePosition,\n theme,\n details,\n requiredSelection,\n disabled,\n id,\n 'data-name': dataName\n }}\n />\n </div>\n );\n })(listBtnSwicth);\n };\n return (\n <div\n className={mode !== 'cookie' ? style.background : null}\n style={backgroundImageStyle}\n data-name={'cm-popin-container'}\n >\n <div className={mode === 'cookie' ? style.popinCookie : style.popin}>\n <header className={style.popinHeader}>\n {renderHeader()}\n {onClose ? (\n <ButtonLinkIconOnly\n onClick={onClose}\n data-name={'close-icon'}\n aria-label={'close-icon'}\n size=\"small\"\n icon=\"close\"\n />\n ) : null}\n </header>\n <div\n className={\n mode === 'cookie' || mode === 'information'\n ? style.cookieTitleContainer\n : style.titleContainer\n }\n >\n <div className={style.contentSection}>\n {LogoComponent ? <LogoComponent className={style.icon} /> : null}\n {content ? (\n <p\n className={mode === 'alert' ? style.content : style.message}\n data-name={'cm-popin-content'}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: content}}\n />\n ) : null}\n </div>\n {descriptionText ? (\n <p\n className={style.descriptionText}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: descriptionText}}\n />\n ) : null}\n </div>\n {descriptionBtnTxt ? <div className={style.descriptionBtn}>{descriptionBtnTxt}</div> : null}\n {renderBtnSwitch()}\n <div className={style.buttonContainer}>\n {firstButton ? (\n <div className={firstButton.largeButton ? style.largeButton : style.button}>\n <Cta\n label={firstButton.label}\n onClick={firstButton.handleOnclick}\n data-name={'cm-popin-cta'}\n aria-label={firstButton['aria-label']}\n type={firstButton.type}\n customStyle={firstButton.customStyle}\n />\n </div>\n ) : null}\n {secondButton ? (\n <div className={secondButton.largeButton ? style.largeButton : style.button}>\n <Cta\n label={secondButton.label}\n onClick={secondButton.handleOnclick}\n data-name={`cm-popin-cta-${secondButton.type}`}\n aria-label={secondButton['aria-label']}\n type={secondButton.type}\n customStyle={secondButton.customStyle}\n />\n </div>\n ) : null}\n {thirdButton ? (\n <div className={thirdButton.largeButton ? style.largeButton : style.button}>\n <Cta\n label={thirdButton.label}\n onClick={thirdButton.handleOnclick}\n data-name={`cm-popin-cta-${thirdButton.type}`}\n aria-label={thirdButton['aria-label']}\n type={thirdButton.type}\n customStyle={thirdButton.customStyle}\n />\n </div>\n ) : null}\n </div>\n </div>\n </div>\n );\n};\n\nCMPopin.propTypes = propTypes;\n\nexport default CMPopin;\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SACEC,+CAA+C,IAAIC,YADrD,EAEEC,kCAAkC,IAAIC,YAFxC,EAGEC,sBAAsB,IAAIC,MAH5B,EAIEC,wBAAwB,IAAIC,UAJ9B,QAKO,0BALP;AAMA,OAAOC,GAAP,MAAgB,eAAhB;AACA,OAAOC,GAAP,MAAgB,wBAAhB;AACA,OAAOC,kBAAP,MAA+B,kCAA/B;AACA,OAAOC,WAAP,MAAwB,yBAAxB;AACA,OAAOC,KAAP,MAAkB,aAAlB;AACA,OAAOC,SAAP,MAAsB,SAAtB;;AAEA,MAAMC,OAAO,GAAGC,KAAK,IAAI;EACvB,MAAM;IACJC,OADI;IAEJC,IAAI,GAAG,OAFH;IAGJC,WAHI;IAIJC,YAJI;IAKJC,OALI;IAMJC,MANI;IAOJC,IAPI;IAQJC,kBARI;IASJC,eATI;IAUJC,WAVI;IAWJC,WAXI;IAYJC,iBAZI;IAaJC;EAbI,IAcFb,KAdJ;EAgBA,MAAMc,IAAI,GAAG;IACX5B,YADW;IAEXE,YAFW;IAGXI;EAHW,CAAb;EAKA,MAAMuB,aAAa,GAAGD,IAAI,CAACP,IAAD,CAA1B;EAEA,MAAMS,oBAAoB,GAAGR,kBAAkB,GAC3C;IACES,eAAe,EAAG,OAAMT,kBAAmB,GAD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kD,aAFvB;IAGE,aAAY,gBAAelD,WAAW,CAACyB,IAAK,EAH9C;IAIE,cAAYzB,WAAW,CAAC,YAAD,CAJzB;IAKE,IAAI,EAAEA,WAAW,CAACyB,IALpB;IAME,WAAW,EAAEzB,WAAW,CAACmD;EAN3B,EADF,CADU,GAWR,IApCN,CAzCF,CALF,CADF;AAwFD,CAjLD;;AAmLA9D,OAAO,CAACD,SAAR,2CAAoBA,SAApB;AAEA,eAAeC,OAAf"}
@@ -47,7 +47,7 @@
47
47
 
48
48
  .popin {
49
49
  overflow: auto;
50
- width: 434px;
50
+ width: 500px;
51
51
  flex-grow: 0;
52
52
  margin: 16px;
53
53
  padding: 16px 16px 20px 16px;
@@ -114,12 +114,12 @@
114
114
 
115
115
  .button {
116
116
  min-width: max-content;
117
- width: 161px;
117
+ width: 160px;
118
118
  padding: 8px;
119
119
  }
120
120
 
121
121
  .largeButton {
122
- width: 75%;
122
+ width: 100%;
123
123
  padding: 8px;
124
124
  }
125
125
 
@@ -150,11 +150,6 @@
150
150
  margin-top: 0px;
151
151
  }
152
152
 
153
- .descriptionText, .content, .message {
154
- margin-left: 32px;
155
- margin-right: 32px;
156
- }
157
-
158
153
  .cookieTitleContainer {
159
154
  align-items: center;
160
155
  display: flex;
@@ -283,21 +278,29 @@ a {
283
278
  }
284
279
 
285
280
  @media tablet {
281
+ .popin {
282
+ position: fixed;
283
+ }
284
+
286
285
  .popin {
287
286
  width: 80%;
288
- overflow: hidden;
289
287
  }
290
288
 
291
289
  .buttonContainer {
292
290
  display: flex;
293
291
  flex-wrap: wrap-reverse;
294
- margin: 12px 24px 32px 24px;
292
+ margin: 48px 24px 32px 24px;
293
+ width: 85%;
295
294
  }
296
295
 
297
- .largeButton, .button , .titleContainer {
296
+ .button {
298
297
  width: 100%;
299
298
  }
300
299
 
300
+ .titleContainer {
301
+ width: 85%;
302
+ }
303
+
301
304
  .popinCookie {
302
305
  position: fixed;
303
306
  bottom: 10px;
@@ -313,50 +316,34 @@ a {
313
316
  }
314
317
 
315
318
  .popinCookie .largeButton {
316
- padding: 8px 0px 0px 0px;
319
+ padding: 8px 0px 0px 0px
317
320
  }
318
321
  .popinCookie .message {
319
322
  padding: 24px 24px 0px 24px
320
323
  }
321
324
 
322
- .descriptionText, .content, .message {
323
- margin-left: 16px;
324
- margin-right: 16px;
325
- }
326
- }
327
-
328
- @media mobile {
329
- .background {
330
- padding: 0;
331
- }
332
-
333
- .popin {
334
- width: 80%;
335
- overflow: hidden;
336
- }
337
-
338
- .buttonContainer {
339
- display: flex;
340
- margin: 12px 16px 32px 16px;
341
- }
342
-
343
- .button {
344
- width: 100%;
345
- }
346
-
347
- .titleContainer {
348
- width: 100%;
349
- margin-left: 16px;
350
- margin-right: 16px;
351
- }
352
-
353
- .content, .message, .descriptionText {
354
- margin-left: 16px;
355
- margin-right: 16px;
356
- }
357
- .largeButton {
358
- margin-left: 32px;
359
- margin-right: 32px;
325
+ @media mobile {
326
+ .popin {
327
+ position: fixed;
328
+ }
329
+
330
+ .popin {
331
+ width: 80%;
332
+ }
333
+
334
+ .buttonContainer {
335
+ display: flex;
336
+ margin: 48px 24px 32px 24px;
337
+ width: 85%;
338
+ }
339
+
340
+ .button {
341
+ width: 100%;
342
+ }
343
+
344
+ .titleContainer {
345
+ width: 85%;
346
+ }
360
347
  }
361
348
  }
362
349
 
@@ -368,6 +355,7 @@ button {
368
355
  }
369
356
 
370
357
  _:-ms-fullscreen,
358
+ .descriptionText,
371
359
  .buttonContainer {
372
360
  width: 85%;
373
361
  }