@coorpacademy/components 11.13.7-alpha.3 → 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 (35) 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/discipline-header/index.d.ts +0 -2
  11. package/es/molecule/discipline-header/index.d.ts.map +1 -1
  12. package/es/molecule/discipline-header/index.js +9 -28
  13. package/es/molecule/discipline-header/index.js.map +1 -1
  14. package/es/molecule/discipline-header/style.css +7 -40
  15. package/es/template/common/discipline/index.d.ts.map +1 -1
  16. package/es/template/common/discipline/index.js +2 -6
  17. package/es/template/common/discipline/index.js.map +1 -1
  18. package/lib/atom/form-text-input/index.d.ts +26 -0
  19. package/lib/atom/form-text-input/index.d.ts.map +1 -0
  20. package/lib/atom/form-text-input/index.js +121 -0
  21. package/lib/atom/form-text-input/index.js.map +1 -0
  22. package/lib/atom/form-text-input/prop-types.d.ts +54 -0
  23. package/lib/atom/form-text-input/prop-types.d.ts.map +1 -0
  24. package/lib/atom/form-text-input/prop-types.js +45 -0
  25. package/lib/atom/form-text-input/prop-types.js.map +1 -0
  26. package/lib/atom/form-text-input/style.css +53 -0
  27. package/lib/molecule/discipline-header/index.d.ts +0 -2
  28. package/lib/molecule/discipline-header/index.d.ts.map +1 -1
  29. package/lib/molecule/discipline-header/index.js +9 -29
  30. package/lib/molecule/discipline-header/index.js.map +1 -1
  31. package/lib/molecule/discipline-header/style.css +7 -40
  32. package/lib/template/common/discipline/index.d.ts.map +1 -1
  33. package/lib/template/common/discipline/index.js +2 -6
  34. package/lib/template/common/discipline/index.js.map +1 -1
  35. package/package.json +3 -3
@@ -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,121 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = void 0;
5
+
6
+ var _react = _interopRequireWildcard(require("react"));
7
+
8
+ var _classnames = _interopRequireDefault(require("classnames"));
9
+
10
+ var _isEmpty = _interopRequireDefault(require("lodash/fp/isEmpty"));
11
+
12
+ var _isEqual = _interopRequireDefault(require("lodash/fp/isEqual"));
13
+
14
+ var _noop = _interopRequireDefault(require("lodash/fp/noop"));
15
+
16
+ var _propTypes = _interopRequireWildcard(require("./prop-types"));
17
+
18
+ var _style = _interopRequireDefault(require("./style.css"));
19
+
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+
22
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
+
24
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
+
26
+ 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); }
27
+
28
+ const validate = (fieldValue, fieldEqualsValue) => {
29
+ return (0, _isEqual.default)(fieldValue, fieldEqualsValue);
30
+ };
31
+
32
+ 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])?/;
33
+
34
+ const validatePattern = (fieldValue, pattern) => {
35
+ return pattern.test(fieldValue);
36
+ };
37
+
38
+ const DEFAULT_MAX_LENGTH = 150;
39
+
40
+ const isEqualsDefined = equals => !(0, _isEmpty.default)(equals);
41
+
42
+ const FormTextInput = ({
43
+ 'aria-label': ariaLabel,
44
+ autocomplete,
45
+ 'data-testid': dataTestid = 'form-text-input',
46
+ disabled,
47
+ hint,
48
+ inputClassName,
49
+ isRequired,
50
+ label,
51
+ maxlength = DEFAULT_MAX_LENGTH,
52
+ name,
53
+ onChange = _noop.default,
54
+ passwordValidator = () => false,
55
+ placeholder,
56
+ type = 'default',
57
+ value,
58
+ equals,
59
+ wrapperClassName
60
+ }) => {
61
+ const [newValue, setNewValue] = (0, _react.useState)(value);
62
+ const [isValid, setIsValid] = (0, _react.useState)(true);
63
+ const isDefaultType = (0, _react.useMemo)(() => !type || type === _propTypes.TextInput.default, [type]);
64
+ const isPasswordInput = (0, _react.useMemo)(() => type === _propTypes.TextInput.password || type === _propTypes.TextInput.passwordConfirmation, [type]);
65
+ const isEmailInput = (0, _react.useMemo)(() => type === _propTypes.TextInput.email, [type]);
66
+ const handleInputChange = (0, _react.useCallback)(event => {
67
+ const newInput = event.target.value;
68
+ setNewValue(() => {
69
+ const isNewValueValid = !isEqualsDefined(equals) || validate(newInput, equals);
70
+ const validPattern = !isEmailInput || validatePattern(newInput, VALID_EMAIL_PATTERN);
71
+ const isPasswordCompliant = !isPasswordInput || passwordValidator(newInput);
72
+ setIsValid(isPasswordCompliant && isNewValueValid && validPattern);
73
+ return newInput;
74
+ });
75
+ }, [equals, isEmailInput, isPasswordInput, passwordValidator]);
76
+ (0, _react.useEffect)(() => {
77
+ onChange(newValue, isValid);
78
+ return;
79
+ }, [isValid, newValue, onChange]);
80
+ const fieldLabel = (0, _react.useMemo)(() => `${label} ${isRequired ? '*' : ''}`, [isRequired, label]);
81
+ const errorStyle = (0, _react.useMemo)(() => isValid ? undefined : {
82
+ border: '2px solid rgb(247, 63, 82)'
83
+ }, [isValid]);
84
+ return /*#__PURE__*/_react.default.createElement("div", {
85
+ className: (0, _classnames.default)(_style.default.wrapper, wrapperClassName)
86
+ }, /*#__PURE__*/_react.default.createElement("label", {
87
+ className: _style.default.formLabel,
88
+ htmlFor: name
89
+ }, fieldLabel), /*#__PURE__*/_react.default.createElement("input", _extends({}, !isPasswordInput && !isEmailInput && {
90
+ maxLength: maxlength
91
+ }, isEmailInput && {
92
+ autoCapitalize: 'none'
93
+ }, isRequired && {
94
+ required: true
95
+ }, !isValid && {
96
+ 'aria-invalid': true
97
+ }, {
98
+ type: isDefaultType ? 'text' : type,
99
+ "aria-label": ariaLabel,
100
+ autoComplete: isDefaultType ? 'on' : autocomplete,
101
+ autoCorrect: 'off',
102
+ className: (0, _classnames.default)(_style.default.textInput, inputClassName),
103
+ "data-testid": dataTestid,
104
+ disabled: disabled,
105
+ id: name,
106
+ name: name,
107
+ onInput: handleInputChange,
108
+ placeholder: placeholder,
109
+ value: value,
110
+ style: errorStyle
111
+ })), /*#__PURE__*/_react.default.createElement("div", {
112
+ className: _style.default.hintWrapper
113
+ }, /*#__PURE__*/_react.default.createElement("span", {
114
+ className: _style.default.hint
115
+ }, hint)));
116
+ };
117
+
118
+ FormTextInput.propTypes = process.env.NODE_ENV !== "production" ? _propTypes.default : {};
119
+ var _default = FormTextInput;
120
+ exports.default = _default;
121
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["validate","fieldValue","fieldEqualsValue","isEqual","VALID_EMAIL_PATTERN","validatePattern","pattern","test","DEFAULT_MAX_LENGTH","isEqualsDefined","equals","isEmpty","FormTextInput","ariaLabel","autocomplete","dataTestid","disabled","hint","inputClassName","isRequired","label","maxlength","name","onChange","noop","passwordValidator","placeholder","type","value","wrapperClassName","newValue","setNewValue","useState","isValid","setIsValid","isDefaultType","useMemo","TextInput","default","isPasswordInput","password","passwordConfirmation","isEmailInput","email","handleInputChange","useCallback","event","newInput","target","isNewValueValid","validPattern","isPasswordCompliant","useEffect","fieldLabel","errorStyle","undefined","border","classnames","style","wrapper","formLabel","maxLength","autoCapitalize","required","textInput","hintWrapper","propTypes"],"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 F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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,45 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = exports.TextInput = void 0;
5
+
6
+ var _propTypes = _interopRequireDefault(require("prop-types"));
7
+
8
+ var _keys = _interopRequireDefault(require("lodash/fp/keys"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ const TextInput = {
13
+ country: 'country',
14
+ email: 'email',
15
+ firstName: 'firstName',
16
+ lastName: 'lastName',
17
+ language: 'language',
18
+ login: 'login',
19
+ password: 'password',
20
+ passwordConfirmation: 'passwordConfirmation',
21
+ default: 'default'
22
+ };
23
+ exports.TextInput = TextInput;
24
+ const propTypes = {
25
+ 'aria-label': _propTypes.default.string,
26
+ autocomplete: _propTypes.default.string,
27
+ 'data-testid': _propTypes.default.string,
28
+ disabled: _propTypes.default.bool,
29
+ equals: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
30
+ hint: _propTypes.default.string,
31
+ inputClassName: _propTypes.default.string,
32
+ isRequired: _propTypes.default.bool,
33
+ label: _propTypes.default.string,
34
+ maxlength: _propTypes.default.number,
35
+ name: _propTypes.default.string,
36
+ onChange: _propTypes.default.func,
37
+ passwordValidator: _propTypes.default.func,
38
+ placeholder: _propTypes.default.string,
39
+ type: _propTypes.default.oneOf((0, _keys.default)(TextInput)),
40
+ value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
41
+ wrapperClassName: _propTypes.default.string
42
+ };
43
+ var _default = propTypes;
44
+ exports.default = _default;
45
+ //# sourceMappingURL=prop-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prop-types.js","names":["TextInput","country","email","firstName","lastName","language","login","password","passwordConfirmation","default","propTypes","PropTypes","string","autocomplete","disabled","bool","equals","oneOfType","number","hint","inputClassName","isRequired","label","maxlength","name","onChange","func","passwordValidator","placeholder","type","oneOf","keys","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;;AACA;;;;AAEO,MAAMA,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,cAAcC,kBAAA,CAAUC,MADR;EAEhBC,YAAY,EAAEF,kBAAA,CAAUC,MAFR;EAGhB,eAAeD,kBAAA,CAAUC,MAHT;EAIhBE,QAAQ,EAAEH,kBAAA,CAAUI,IAJJ;EAKhBC,MAAM,EAAEL,kBAAA,CAAUM,SAAV,CAAoB,CAACN,kBAAA,CAAUC,MAAX,EAAmBD,kBAAA,CAAUO,MAA7B,CAApB,CALQ;EAMhBC,IAAI,EAAER,kBAAA,CAAUC,MANA;EAOhBQ,cAAc,EAAET,kBAAA,CAAUC,MAPV;EAQhBS,UAAU,EAAEV,kBAAA,CAAUI,IARN;EAShBO,KAAK,EAAEX,kBAAA,CAAUC,MATD;EAUhBW,SAAS,EAAEZ,kBAAA,CAAUO,MAVL;EAWhBM,IAAI,EAAEb,kBAAA,CAAUC,MAXA;EAYhBa,QAAQ,EAAEd,kBAAA,CAAUe,IAZJ;EAahBC,iBAAiB,EAAEhB,kBAAA,CAAUe,IAbb;EAchBE,WAAW,EAAEjB,kBAAA,CAAUC,MAdP;EAehBiB,IAAI,EAAElB,kBAAA,CAAUmB,KAAV,CAAgB,IAAAC,aAAA,EAAK/B,SAAL,CAAhB,CAfU;EAgBhBgC,KAAK,EAAErB,kBAAA,CAAUM,SAAV,CAAoB,CAACN,kBAAA,CAAUC,MAAX,EAAmBD,kBAAA,CAAUO,MAA7B,CAApB,CAhBS;EAiBhBe,gBAAgB,EAAEtB,kBAAA,CAAUC;AAjBZ,CAAlB;eA4CeF,S"}
@@ -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
+ }
@@ -39,8 +39,6 @@ declare class DisciplineHeader extends React.Component<any, any, any> {
39
39
  }>>;
40
40
  mimeType: PropTypes.Validator<string>;
41
41
  }>>;
42
- lastUpdated: PropTypes.Requireable<string>;
43
- invertedLanguage: PropTypes.Requireable<boolean>;
44
42
  };
45
43
  static contextTypes: {
46
44
  translate: PropTypes.Requireable<(...args: any[]) => any>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/discipline-header/index.js"],"names":[],"mappings":";AA4BA;IACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAOE;IAEF;;MAEE;IAEF,wBAQC;IANC;;;MAGC;IAKH,4BAIC;IAED,yBAEC;IAED,sBAuDC;CACF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/discipline-header/index.js"],"names":[],"mappings":";AA2BA;IACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAKE;IAEF;;MAEE;IAEF,wBAQC;IANC;;;MAGC;IAKH,4BAIC;IAED,yBAEC;IAED,sBAsCC;CACF"}
@@ -13,8 +13,6 @@ var _getOr = _interopRequireDefault(require("lodash/fp/getOr"));
13
13
 
14
14
  var _classnames = _interopRequireDefault(require("classnames"));
15
15
 
16
- var _novaIcons = require("@coorpacademy/nova-icons");
17
-
18
16
  var _videoPlayer = _interopRequireDefault(require("../video-player"));
19
17
 
20
18
  var _picture = _interopRequireDefault(require("../../atom/picture"));
@@ -81,9 +79,7 @@ class DisciplineHeader extends _react.default.Component {
81
79
  image,
82
80
  title,
83
81
  description,
84
- video,
85
- lastUpdated,
86
- invertedLanguage
82
+ video
87
83
  } = this.props;
88
84
  const {
89
85
  fullDisplay,
@@ -92,23 +88,19 @@ class DisciplineHeader extends _react.default.Component {
92
88
  const {
93
89
  translate
94
90
  } = this.context;
95
- const maxHeightCourseInfos = 209;
96
- const hasMediaContent = image || video;
91
+ const maxHeightDescription = 219;
97
92
  const toggleLabel = fullDisplay ? translate('See less') : translate('Show more');
98
- const shortCourseText = offsetHeightShowMore <= maxHeightCourseInfos;
99
- const courseSeeMoreButtonStyle = shortCourseText ? _style.default.showMoreHidden : _style.default.showMore;
93
+ const descritpionViewStyle = offsetHeightShowMore <= maxHeightDescription ? _style.default.showMoreHidden : _style.default.showMore;
100
94
  return /*#__PURE__*/_react.default.createElement("div", {
101
95
  "data-name": "disciplineHeader",
102
96
  className: _style.default.wrapper
103
- }, hasMediaContent ? /*#__PURE__*/_react.default.createElement("div", {
97
+ }, image || video ? /*#__PURE__*/_react.default.createElement("div", {
104
98
  className: _style.default.imgWrapper
105
99
  }, /*#__PURE__*/_react.default.createElement(Preview, {
106
100
  image: image,
107
101
  video: video
108
102
  })) : null, /*#__PURE__*/_react.default.createElement("div", {
109
103
  className: _style.default.courseWrapper
110
- }, /*#__PURE__*/_react.default.createElement("div", {
111
- className: fullDisplay ? _style.default.courseTextWrapperFull : _style.default.courseTextWrapperShort
112
104
  }, /*#__PURE__*/_react.default.createElement("div", {
113
105
  "data-name": "title",
114
106
  className: (0, _classnames.default)(_style.default.title, _style.default.innerHTML) // eslint-disable-next-line react/no-danger
@@ -117,6 +109,8 @@ class DisciplineHeader extends _react.default.Component {
117
109
  __html: title
118
110
  }
119
111
  }), /*#__PURE__*/_react.default.createElement("div", {
112
+ className: fullDisplay ? _style.default.desc : _style.default.shortDesc
113
+ }, /*#__PURE__*/_react.default.createElement("div", {
120
114
  className: _style.default.innerHTML // eslint-disable-next-line react/no-danger
121
115
  ,
122
116
  dangerouslySetInnerHTML: {
@@ -124,21 +118,9 @@ class DisciplineHeader extends _react.default.Component {
124
118
  },
125
119
  ref: this.setHandle
126
120
  })), /*#__PURE__*/_react.default.createElement("div", {
127
- className: invertedLanguage ? _style.default.invertedLanguage : null
128
- }, /*#__PURE__*/_react.default.createElement("div", {
129
- className: courseSeeMoreButtonStyle,
121
+ className: descritpionViewStyle,
130
122
  onClick: this.handleToggleDisplay
131
- }, toggleLabel), lastUpdated ? /*#__PURE__*/_react.default.createElement("div", {
132
- className: (0, _classnames.default)(_style.default.lastUpdatedWrapper, shortCourseText ? _style.default.lastUpdatedWrapperShort : null)
133
- }, /*#__PURE__*/_react.default.createElement(_novaIcons.NovaSolidSynchronizeSynchronize3, {
134
- className: _style.default.syncIcon
135
- }), /*#__PURE__*/_react.default.createElement("div", {
136
- className: (0, _classnames.default)(_style.default.lastUpdatedText, _style.default.innerHTML) // eslint-disable-next-line react/no-danger
137
- ,
138
- dangerouslySetInnerHTML: {
139
- __html: lastUpdated
140
- }
141
- })) : null)));
123
+ }, toggleLabel)));
142
124
  }
143
125
 
144
126
  }
@@ -150,9 +132,7 @@ DisciplineHeader.propTypes = process.env.NODE_ENV !== "production" ? {
150
132
  title: _propTypes.default.string,
151
133
  description: _propTypes.default.string,
152
134
  image: Preview.propTypes.image,
153
- video: Preview.propTypes.video,
154
- lastUpdated: _propTypes.default.string,
155
- invertedLanguage: _propTypes.default.bool
135
+ video: Preview.propTypes.video
156
136
  } : {};
157
137
  var _default = DisciplineHeader;
158
138
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Preview","image","video","mimeType","get","id","jwpOptions","style","propTypes","Picture","src","PropTypes","shape","VideoPlayer","DisciplineHeader","React","Component","constructor","props","state","fullDisplay","offsetHeightShowMore","handleToggleDisplay","bind","setHandle","setState","prevState","el","getOr","render","title","description","lastUpdated","invertedLanguage","translate","context","maxHeightCourseInfos","hasMediaContent","toggleLabel","shortCourseText","courseSeeMoreButtonStyle","showMoreHidden","showMore","wrapper","imgWrapper","courseWrapper","courseTextWrapperFull","courseTextWrapperShort","classnames","innerHTML","__html","lastUpdatedWrapper","lastUpdatedWrapperShort","syncIcon","lastUpdatedText","contextTypes","func","string","bool"],"sources":["../../../src/molecule/discipline-header/index.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport classnames from 'classnames';\nimport {NovaSolidSynchronizeSynchronize3 as SyncIcon} from '@coorpacademy/nova-icons';\nimport VideoPlayer from '../video-player';\nimport Picture from '../../atom/picture';\nimport style from './style.css';\n\nconst Preview = ({image, video}) => {\n const mimeType = get('mimeType', video);\n const id = get('id', video);\n const jwpOptions = get('jwpOptions', video);\n if (id) {\n return <VideoPlayer mimeType={mimeType} id={id} width=\"380px\" height=\"250px\" />;\n } else if (jwpOptions) {\n return <VideoPlayer {...video} />;\n } else {\n return <Picture className={style.image} src={image} />;\n }\n};\n\nPreview.propTypes = {\n image: Picture.propTypes.src,\n video: PropTypes.shape(VideoPlayer.propTypes)\n};\n\nclass DisciplineHeader extends React.Component {\n static propTypes = {\n title: PropTypes.string,\n description: PropTypes.string,\n image: Preview.propTypes.image,\n video: Preview.propTypes.video,\n lastUpdated: PropTypes.string,\n invertedLanguage: PropTypes.bool\n };\n\n static contextTypes = {\n translate: PropTypes.func\n };\n\n constructor(props) {\n super(props);\n this.state = {\n fullDisplay: false,\n offsetHeightShowMore: 0\n };\n this.handleToggleDisplay = this.handleToggleDisplay.bind(this);\n this.setHandle = this.setHandle.bind(this);\n }\n\n handleToggleDisplay() {\n this.setState(prevState => ({\n fullDisplay: !prevState.fullDisplay\n }));\n }\n\n setHandle(el) {\n this.setState({offsetHeightShowMore: getOr(0, 'offsetHeight', el)});\n }\n\n render() {\n const {image, title, description, video, lastUpdated, invertedLanguage} = this.props;\n const {fullDisplay, offsetHeightShowMore} = this.state;\n const {translate} = this.context;\n const maxHeightCourseInfos = 209;\n const hasMediaContent = image || video;\n const toggleLabel = fullDisplay ? translate('See less') : translate('Show more');\n const shortCourseText = offsetHeightShowMore <= maxHeightCourseInfos;\n const courseSeeMoreButtonStyle = shortCourseText ? style.showMoreHidden : style.showMore;\n\n return (\n <div data-name=\"disciplineHeader\" className={style.wrapper}>\n {hasMediaContent ? (\n <div className={style.imgWrapper}>\n <Preview image={image} video={video} />\n </div>\n ) : null}\n <div className={style.courseWrapper}>\n <div className={fullDisplay ? style.courseTextWrapperFull : style.courseTextWrapperShort}>\n <div\n data-name=\"title\"\n className={classnames(style.title, style.innerHTML)}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: title}}\n />\n <div\n className={style.innerHTML}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: description}}\n ref={this.setHandle}\n />\n </div>\n <div className={invertedLanguage ? style.invertedLanguage : null}>\n <div className={courseSeeMoreButtonStyle} onClick={this.handleToggleDisplay}>\n {toggleLabel}\n </div>\n {lastUpdated ? (\n <div\n className={classnames(\n style.lastUpdatedWrapper,\n shortCourseText ? style.lastUpdatedWrapperShort : null\n )}\n >\n <SyncIcon className={style.syncIcon} />\n <div\n className={classnames(style.lastUpdatedText, style.innerHTML)}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: lastUpdated}}\n />\n </div>\n ) : null}\n </div>\n </div>\n </div>\n );\n }\n}\n\nexport default DisciplineHeader;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEA,MAAMA,OAAO,GAAG,CAAC;EAACC,KAAD;EAAQC;AAAR,CAAD,KAAoB;EAClC,MAAMC,QAAQ,GAAG,IAAAC,YAAA,EAAI,UAAJ,EAAgBF,KAAhB,CAAjB;EACA,MAAMG,EAAE,GAAG,IAAAD,YAAA,EAAI,IAAJ,EAAUF,KAAV,CAAX;EACA,MAAMI,UAAU,GAAG,IAAAF,YAAA,EAAI,YAAJ,EAAkBF,KAAlB,CAAnB;;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PF,CADF,eAeE;MAAK,SAAS,EAAES,gBAAgB,GAAG1B,cAAA,CAAM0B,gBAAT,GAA4B;IAA5D,gBACE;MAAK,SAAS,EAAEO,wBAAhB;MAA0C,OAAO,EAAE,KAAKlB;IAAxD,GACGgB,WADH,CADF,EAIGN,WAAW,gBACV;MACE,SAAS,EAAE,IAAAgB,mBAAA,EACTzC,cAAA,CAAM4C,kBADG,EAETZ,eAAe,GAAGhC,cAAA,CAAM6C,uBAAT,GAAmC,IAFzC;IADb,gBAME,6BAAC,2CAAD;MAAU,SAAS,EAAE7C,cAAA,CAAM8C;IAA3B,EANF,eAOE;MACE,SAAS,EAAE,IAAAL,mBAAA,EAAWzC,cAAA,CAAM+C,eAAjB,EAAkC/C,cAAA,CAAM0C,SAAxC,CADb,CAEE;MAFF;MAGE,uBAAuB,EAAE;QAACC,MAAM,EAAElB;MAAT;IAH3B,EAPF,CADU,GAcR,IAlBN,CAfF,CANF,CADF;EA6CD;;AAzF4C;;AAAzClB,gB,CAUGyC,Y,GAAe;EACpBrB,SAAS,EAAEvB,kBAAA,CAAU6C;AADD,C;AAVlB1C,gB,CACGN,S,2CAAY;EACjBsB,KAAK,EAAEnB,kBAAA,CAAU8C,MADA;EAEjB1B,WAAW,EAAEpB,kBAAA,CAAU8C,MAFN;EAGjBxD,KAAK,EAAED,OAAO,CAACQ,SAAR,CAAkBP,KAHR;EAIjBC,KAAK,EAAEF,OAAO,CAACQ,SAAR,CAAkBN,KAJR;EAKjB8B,WAAW,EAAErB,kBAAA,CAAU8C,MALN;EAMjBxB,gBAAgB,EAAEtB,kBAAA,CAAU+C;AANX,C;eA2FN5C,gB"}
1
+ {"version":3,"file":"index.js","names":["Preview","image","video","mimeType","get","id","jwpOptions","style","propTypes","Picture","src","PropTypes","shape","VideoPlayer","DisciplineHeader","React","Component","constructor","props","state","fullDisplay","offsetHeightShowMore","handleToggleDisplay","bind","setHandle","setState","prevState","el","getOr","render","title","description","translate","context","maxHeightDescription","toggleLabel","descritpionViewStyle","showMoreHidden","showMore","wrapper","imgWrapper","courseWrapper","classnames","innerHTML","__html","desc","shortDesc","contextTypes","func","string"],"sources":["../../../src/molecule/discipline-header/index.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport classnames from 'classnames';\nimport VideoPlayer from '../video-player';\nimport Picture from '../../atom/picture';\nimport style from './style.css';\n\nconst Preview = ({image, video}) => {\n const mimeType = get('mimeType', video);\n const id = get('id', video);\n const jwpOptions = get('jwpOptions', video);\n if (id) {\n return <VideoPlayer mimeType={mimeType} id={id} width=\"380px\" height=\"250px\" />;\n } else if (jwpOptions) {\n return <VideoPlayer {...video} />;\n } else {\n return <Picture className={style.image} src={image} />;\n }\n};\n\nPreview.propTypes = {\n image: Picture.propTypes.src,\n video: PropTypes.shape(VideoPlayer.propTypes)\n};\n\nclass DisciplineHeader extends React.Component {\n static propTypes = {\n title: PropTypes.string,\n description: PropTypes.string,\n image: Preview.propTypes.image,\n video: Preview.propTypes.video\n };\n\n static contextTypes = {\n translate: PropTypes.func\n };\n\n constructor(props) {\n super(props);\n this.state = {\n fullDisplay: false,\n offsetHeightShowMore: 0\n };\n this.handleToggleDisplay = this.handleToggleDisplay.bind(this);\n this.setHandle = this.setHandle.bind(this);\n }\n\n handleToggleDisplay() {\n this.setState(prevState => ({\n fullDisplay: !prevState.fullDisplay\n }));\n }\n\n setHandle(el) {\n this.setState({offsetHeightShowMore: getOr(0, 'offsetHeight', el)});\n }\n\n render() {\n const {image, title, description, video} = this.props;\n const {fullDisplay, offsetHeightShowMore} = this.state;\n const {translate} = this.context;\n const maxHeightDescription = 219;\n\n const toggleLabel = fullDisplay ? translate('See less') : translate('Show more');\n const descritpionViewStyle =\n offsetHeightShowMore <= maxHeightDescription ? style.showMoreHidden : style.showMore;\n\n return (\n <div data-name=\"disciplineHeader\" className={style.wrapper}>\n {image || video ? (\n <div className={style.imgWrapper}>\n <Preview image={image} video={video} />\n </div>\n ) : null}\n <div className={style.courseWrapper}>\n <div\n data-name=\"title\"\n className={classnames(style.title, style.innerHTML)}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: title}}\n />\n <div className={fullDisplay ? style.desc : style.shortDesc}>\n <div\n className={style.innerHTML}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: description}}\n ref={this.setHandle}\n />\n </div>\n <div className={descritpionViewStyle} onClick={this.handleToggleDisplay}>\n {toggleLabel}\n </div>\n </div>\n </div>\n );\n }\n}\n\nexport default DisciplineHeader;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEA,MAAMA,OAAO,GAAG,CAAC;EAACC,KAAD;EAAQC;AAAR,CAAD,KAAoB;EAClC,MAAMC,QAAQ,GAAG,IAAAC,YAAA,EAAI,UAAJ,EAAgBF,KAAhB,CAAjB;EACA,MAAMG,EAAE,GAAG,IAAAD,YAAA,EAAI,IAAJ,EAAUF,KAAV,CAAX;EACA,MAAMI,UAAU,GAAG,IAAAF,YAAA,EAAI,YAAJ,EAAkBF,KAAlB,CAAnB;;EACA,IAAIG,EAAJ,EAAQ;IACN,oBAAO,6BAAC,oBAAD;MAAa,QAAQ,EAAEF,QAAvB;MAAiC,EAAE,EAAEE,EAArC;MAAyC,KAAK,EAAC,OAA/C;MAAuD,MAAM,EAAC;IAA9D,EAAP;EACD,CAFD,MAEO,IAAIC,UAAJ,EAAgB;IACrB,oBAAO,6BAAC,oBAAD,EAAiBJ,KAAjB,CAAP;EACD,CAFM,MAEA;IACL,oBAAO,6BAAC,gBAAD;MAAS,SAAS,EAAEK,cAAA,CAAMN,KAA1B;MAAiC,GAAG,EAAEA;IAAtC,EAAP;EACD;AACF,CAXD;;AAaAD,OAAO,CAACQ,SAAR,2CAAoB;EAClBP,KAAK,EAAEQ,gBAAA,CAAQD,SAAR,CAAkBE,GADP;EAElBR,KAAK,EAAES,kBAAA,CA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AT,gBACC;MAAK,SAAS,EAAEK,cAAA,CAAMiC;IAAtB,gBACE,6BAAC,OAAD;MAAS,KAAK,EAAEvC,KAAhB;MAAuB,KAAK,EAAEC;IAA9B,EADF,CADD,GAIG,IALN,eAME;MAAK,SAAS,EAAEK,cAAA,CAAMkC;IAAtB,gBACE;MACE,aAAU,OADZ;MAEE,SAAS,EAAE,IAAAC,mBAAA,EAAWnC,cAAA,CAAMuB,KAAjB,EAAwBvB,cAAA,CAAMoC,SAA9B,CAFb,CAGE;MAHF;MAIE,uBAAuB,EAAE;QAACC,MAAM,EAAEd;MAAT;IAJ3B,EADF,eAOE;MAAK,SAAS,EAAEV,WAAW,GAAGb,cAAA,CAAMsC,IAAT,GAAgBtC,cAAA,CAAMuC;IAAjD,gBACE;MACE,SAAS,EAAEvC,cAAA,CAAMoC,SADnB,CAEE;MAFF;MAGE,uBAAuB,EAAE;QAACC,MAAM,EAAEb;MAAT,CAH3B;MAIE,GAAG,EAAE,KAAKP;IAJZ,EADF,CAPF,eAeE;MAAK,SAAS,EAAEY,oBAAhB;MAAsC,OAAO,EAAE,KAAKd;IAApD,GACGa,WADH,CAfF,CANF,CADF;EA4BD;;AAtE4C;;AAAzCrB,gB,CAQGiC,Y,GAAe;EACpBf,SAAS,EAAErB,kBAAA,CAAUqC;AADD,C;AARlBlC,gB,CACGN,S,2CAAY;EACjBsB,KAAK,EAAEnB,kBAAA,CAAUsC,MADA;EAEjBlB,WAAW,EAAEpB,kBAAA,CAAUsC,MAFN;EAGjBhD,KAAK,EAAED,OAAO,CAACQ,SAAR,CAAkBP,KAHR;EAIjBC,KAAK,EAAEF,OAAO,CAACQ,SAAR,CAAkBN;AAJR,C;eAwENY,gB"}
@@ -45,7 +45,7 @@
45
45
  color: dark;
46
46
  }
47
47
 
48
- .courseTextWrapperFull {
48
+ .desc {
49
49
  font-family: "Gilroy";
50
50
  font-size: 15px;
51
51
  color: black;
@@ -53,14 +53,14 @@
53
53
  line-height: 22px;
54
54
  }
55
55
 
56
- .courseTextWrapperFull a {
56
+ .desc a {
57
57
  font-family: Gilroy;
58
58
  font-weight: 600;
59
59
  color: brand;
60
60
  text-decoration: none;
61
61
  }
62
62
 
63
- .courseTextWrapperFull a:hover {
63
+ .desc a:hover {
64
64
  text-decoration: underline;
65
65
  }
66
66
 
@@ -68,42 +68,10 @@
68
68
  display: none;
69
69
  }
70
70
 
71
- .lastUpdatedWrapperShort {
72
- /* This is required in case that the text is short to make sure that it
73
- is stuck to the bottom at the same level to the media */
74
- height: 28px;
75
- align-items: flex-end;
76
- }
77
-
78
- .lastUpdatedWrapper {
79
- display: flex;
80
- margin-top: 8px;
81
- }
82
-
83
- .lastUpdatedText {
84
- font-family: 'Gilroy';
85
- font-style: normal;
86
- font-weight: 600;
87
- font-size: 12px;
88
- line-height: 14px;
89
- color: #536E7A;
90
- }
91
-
92
- .invertedLanguage {
93
- float: right;
94
- text-align: right;
95
- align-items: right;
96
- }
97
-
98
- .syncIcon {
99
- height: 13px;
100
- color: #536E7A;
101
- margin-right: 3px;
102
- }
103
-
104
71
  .showMore {
105
72
  display: block;
106
73
  font-size: 14px;
74
+ margin: 0 14px 0 0;
107
75
  transition: all time ease-in-out;
108
76
  cursor: pointer;
109
77
  order: 1;
@@ -117,9 +85,9 @@
117
85
  opacity: 0.8;
118
86
  }
119
87
 
120
- .courseTextWrapperShort {
121
- composes: courseTextWrapperFull;
122
- height: 213px;
88
+ .shortDesc {
89
+ composes: desc;
90
+ height: 200px;
123
91
  overflow: hidden;
124
92
  }
125
93
 
@@ -138,7 +106,6 @@
138
106
  margin-top: 20px;
139
107
  padding-left: 0;
140
108
  }
141
-
142
109
  }
143
110
 
144
111
  .innerHTML {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/template/common/discipline/index.js"],"names":[],"mappings":";AAcA,mEAiKC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/template/common/discipline/index.js"],"names":[],"mappings":";AAcA,mEAwJC"}
@@ -54,9 +54,7 @@ const Discipline = (props, context) => {
54
54
  addToMyListText,
55
55
  removeFromMyListText,
56
56
  disableShare = false,
57
- disableAddToMyList = false,
58
- lastUpdated,
59
- invertedLanguage = false
57
+ disableAddToMyList = false
60
58
  } = props;
61
59
  const authorSection = (0, _isEmpty.default)(authors) ? null : /*#__PURE__*/_react.default.createElement("div", {
62
60
  className: _style.default.partners
@@ -87,9 +85,7 @@ const Discipline = (props, context) => {
87
85
  image: image,
88
86
  video: video,
89
87
  title: title,
90
- description: description,
91
- lastUpdated: lastUpdated,
92
- invertedLanguage: invertedLanguage
88
+ description: description
93
89
  }));
94
90
 
95
91
  const discipline = /*#__PURE__*/_react.default.createElement("div", {