@coorpacademy/components 11.14.23 → 11.14.24-alpha.11

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 (34) hide show
  1. package/es/atom/autocomplete/index.d.ts +3 -1
  2. package/es/atom/autocomplete/index.d.ts.map +1 -1
  3. package/es/atom/autocomplete/index.js +55 -19
  4. package/es/atom/autocomplete/index.js.map +1 -1
  5. package/es/atom/autocomplete/style.css +223 -0
  6. package/es/molecule/brand-form-group/index.d.ts +3 -1
  7. package/es/molecule/select-multiple/index.d.ts.map +1 -1
  8. package/es/molecule/select-multiple/index.js +2 -1
  9. package/es/molecule/select-multiple/index.js.map +1 -1
  10. package/es/molecule/select-multiple/style.css +1 -1
  11. package/es/organism/brand-form/index.d.ts +4 -1
  12. package/es/organism/brand-form/index.d.ts.map +1 -1
  13. package/es/organism/brand-form/index.js +17 -7
  14. package/es/organism/brand-form/index.js.map +1 -1
  15. package/es/organism/wizard-contents/index.d.ts +4 -1
  16. package/es/template/back-office/brand-update/index.d.ts +4 -1
  17. package/lib/atom/autocomplete/index.d.ts +3 -1
  18. package/lib/atom/autocomplete/index.d.ts.map +1 -1
  19. package/lib/atom/autocomplete/index.js +58 -18
  20. package/lib/atom/autocomplete/index.js.map +1 -1
  21. package/lib/atom/autocomplete/style.css +223 -0
  22. package/lib/molecule/brand-form-group/index.d.ts +3 -1
  23. package/lib/molecule/select-multiple/index.d.ts.map +1 -1
  24. package/lib/molecule/select-multiple/index.js +2 -1
  25. package/lib/molecule/select-multiple/index.js.map +1 -1
  26. package/lib/molecule/select-multiple/style.css +1 -1
  27. package/lib/organism/brand-form/index.d.ts +4 -1
  28. package/lib/organism/brand-form/index.d.ts.map +1 -1
  29. package/lib/organism/brand-form/index.js +18 -7
  30. package/lib/organism/brand-form/index.js.map +1 -1
  31. package/lib/organism/wizard-contents/index.d.ts +4 -1
  32. package/lib/template/back-office/brand-update/index.d.ts +4 -1
  33. package/locales/.mtslconfig.json +1 -0
  34. package/package.json +2 -2
@@ -9,11 +9,13 @@ declare namespace Autocomplete {
9
9
  const required: PropTypes.Requireable<boolean>;
10
10
  const modified: PropTypes.Requireable<boolean>;
11
11
  const error: PropTypes.Requireable<boolean>;
12
+ const errorMessage: PropTypes.Requireable<string>;
12
13
  const suggestions: PropTypes.Requireable<(PropTypes.InferProps<{
13
14
  name: PropTypes.Requireable<string>;
14
15
  value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
15
16
  }> | null | undefined)[]>;
16
- const onChange: PropTypes.Requireable<(...args: any[]) => any>;
17
+ const theme: PropTypes.Requireable<string>;
18
+ const onInput: PropTypes.Requireable<(...args: any[]) => any>;
17
19
  const onFetch: PropTypes.Requireable<(...args: any[]) => any>;
18
20
  const onClear: PropTypes.Requireable<(...args: any[]) => any>;
19
21
  const onBlur: PropTypes.Requireable<(...args: any[]) => any>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/autocomplete/index.js"],"names":[],"mappings":";AAUA,uDAoEC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/autocomplete/index.js"],"names":[],"mappings":";AAmBA,uDA8GC"}
@@ -1,11 +1,18 @@
1
+ import _keys from "lodash/fp/keys";
2
+ import _isEmpty from "lodash/fp/isEmpty";
1
3
  import _isNil from "lodash/fp/isNil";
2
4
  import _noop from "lodash/fp/noop";
3
- import React, { useMemo } from 'react';
5
+ import React, { useCallback, useMemo } from 'react';
4
6
  import Autosuggest from 'react-autosuggest';
5
7
  import PropTypes from 'prop-types';
6
8
  import classnames from 'classnames';
9
+ import { NovaSolidStatusClose as ErrorIcon, NovaCompositionCoorpacademyInformationIcon as InfoIcon } from '@coorpacademy/nova-icons';
7
10
  import getClassState from '../../util/get-class-state';
8
11
  import style from './style.css';
12
+ const THEME_STYLE = {
13
+ coorpmanager: style.coorpmanager,
14
+ default: style.default
15
+ };
9
16
 
10
17
  const renderSuggestion = suggestion => /*#__PURE__*/React.createElement("span", null, suggestion.name);
11
18
 
@@ -17,32 +24,61 @@ const Autocomplete = props => {
17
24
  required,
18
25
  modified = false,
19
26
  error = false,
27
+ errorMessage,
20
28
  suggestions = [],
21
- onChange = _noop,
29
+ onInput = _noop,
22
30
  onFetch = _noop,
23
31
  onClear = _noop,
24
32
  onBlur = _noop,
25
33
  onSuggestionSelected = _noop,
26
- title: propsTitle
34
+ title: propsTitle,
35
+ theme = 'default'
27
36
  } = props;
28
- const title = `${propsTitle}${required ? ' *' : ''}`;
29
- const className = getClassState(style.default, style.modified, style.error, modified, error);
30
- const handleChange = useMemo(() => e => onChange(e), [onChange]);
31
- const handleBlur = useMemo(() => (e, selectedSuggestion) => onBlur(e, selectedSuggestion), [onBlur]);
32
- const handleSuggestionsFetchRequested = useMemo(() => e => onFetch(e), [onFetch]);
33
- const handleSuggestionsClearRequested = useMemo(() => e => onClear(e), [onClear]);
34
- const handleSuggestionsSelected = useMemo(() => (e, data) => onSuggestionSelected(data), [onSuggestionSelected]);
37
+ const mainClass = THEME_STYLE[theme];
38
+ const title = useMemo(() => `${propsTitle}${required ? '*' : ''}`, [propsTitle, required]);
39
+ const className = useMemo(() => getClassState(style.default, style.modified, style.error, modified, error), [modified, error]);
40
+ const handleInput = useCallback(e => {
41
+ onInput(e);
42
+ }, [onInput]);
43
+ const handleBlur = useCallback((e, selectedSuggestion) => onBlur(e, selectedSuggestion), [onBlur]);
44
+ const handleSuggestionsFetchRequested = useCallback(e => onFetch(e), [onFetch]);
45
+ const handleSuggestionsClearRequested = useCallback(e => onClear(e), [onClear]);
46
+ const handleSuggestionsSelected = useCallback((e, data) => onSuggestionSelected(data), [onSuggestionSelected]);
35
47
  const inputProps = {
36
48
  placeholder,
37
49
  value,
38
- onChange: handleChange,
39
- onBlur: handleBlur
50
+ onChange: _noop,
51
+ onBlur: handleBlur,
52
+ onInput: handleInput,
53
+ 'data-testid': 'autocomplete-input'
40
54
  };
55
+ const descriptionView = description && theme !== 'coorpmanager' ? /*#__PURE__*/React.createElement("div", {
56
+ className: style.description
57
+ }, description) : null;
58
+ const toolTipView = description && theme === 'coorpmanager' ? /*#__PURE__*/React.createElement("div", {
59
+ className: style.infoIconWrapper
60
+ }, /*#__PURE__*/React.createElement(InfoIcon, {
61
+ className: style.infoIcon
62
+ }), /*#__PURE__*/React.createElement("div", {
63
+ className: style.descriptionLabel
64
+ }, description)) : null;
65
+ const errorIconView = theme === 'coorpmanager' && error ? /*#__PURE__*/React.createElement(ErrorIcon, {
66
+ className: style.leftIcon
67
+ }) : null;
68
+ const errorText = theme === 'coorpmanager' && error ? /*#__PURE__*/React.createElement("div", {
69
+ className: style.errorText // eslint-disable-next-line react/no-danger
70
+ ,
71
+ dangerouslySetInnerHTML: {
72
+ __html: errorMessage
73
+ }
74
+ }) : null;
41
75
  return /*#__PURE__*/React.createElement("div", {
42
- className: classnames(className, _isNil(title) && style.isNoTitle)
76
+ className: classnames(mainClass, className, _isNil(propsTitle) && style.isNoTitle)
43
77
  }, /*#__PURE__*/React.createElement("label", null, /*#__PURE__*/React.createElement("span", {
44
- className: style.title
45
- }, title), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Autosuggest, {
78
+ className: classnames(style.title, _isEmpty(value) && style.noValue)
79
+ }, title, toolTipView), /*#__PURE__*/React.createElement("div", {
80
+ className: style.inputContainer
81
+ }, /*#__PURE__*/React.createElement(Autosuggest, {
46
82
  theme: {
47
83
  container: style.container,
48
84
  input: style.input,
@@ -60,9 +96,7 @@ const Autocomplete = props => {
60
96
  inputProps: inputProps,
61
97
  focusInputOnSuggestionClick: false,
62
98
  onSuggestionSelected: handleSuggestionsSelected
63
- }))), /*#__PURE__*/React.createElement("div", {
64
- className: style.description
65
- }, description));
99
+ }), errorIconView, errorText)), descriptionView);
66
100
  };
67
101
 
68
102
  Autocomplete.propTypes = process.env.NODE_ENV !== "production" ? {
@@ -73,11 +107,13 @@ Autocomplete.propTypes = process.env.NODE_ENV !== "production" ? {
73
107
  required: PropTypes.bool,
74
108
  modified: PropTypes.bool,
75
109
  error: PropTypes.bool,
110
+ errorMessage: PropTypes.string,
76
111
  suggestions: PropTypes.arrayOf(PropTypes.shape({
77
112
  name: PropTypes.string,
78
113
  value: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
79
114
  })),
80
- onChange: PropTypes.func,
115
+ theme: PropTypes.oneOf(_keys(THEME_STYLE)),
116
+ onInput: PropTypes.func,
81
117
  onFetch: PropTypes.func,
82
118
  onClear: PropTypes.func,
83
119
  onBlur: PropTypes.func,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","useMemo","Autosuggest","PropTypes","classnames","getClassState","style","renderSuggestion","suggestion","name","Autocomplete","props","placeholder","value","description","required","modified","error","suggestions","onChange","onFetch","onClear","onBlur","onSuggestionSelected","title","propsTitle","className","default","handleChange","e","handleBlur","selectedSuggestion","handleSuggestionsFetchRequested","handleSuggestionsClearRequested","handleSuggestionsSelected","data","inputProps","isNoTitle","container","input","suggestionsContainer","suggestionsContainerOpen","suggestionsList","suggestionHighlighted","propTypes","string","bool","arrayOf","shape","oneOfType","number","func"],"sources":["../../../src/atom/autocomplete/index.js"],"sourcesContent":["import React, {useMemo} from 'react';\nimport Autosuggest from 'react-autosuggest';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {noop, isNil} from 'lodash/fp';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst renderSuggestion = suggestion => <span>{suggestion.name}</span>;\n\nconst Autocomplete = props => {\n const {\n placeholder = '',\n value,\n description,\n required,\n modified = false,\n error = false,\n suggestions = [],\n onChange = noop,\n onFetch = noop,\n onClear = noop,\n onBlur = noop,\n onSuggestionSelected = noop,\n title: propsTitle\n } = props;\n\n const title = `${propsTitle}${required ? ' *' : ''}`;\n const className = getClassState(style.default, style.modified, style.error, modified, error);\n\n const handleChange = useMemo(() => e => onChange(e), [onChange]);\n const handleBlur = useMemo(\n () => (e, selectedSuggestion) => onBlur(e, selectedSuggestion),\n [onBlur]\n );\n const handleSuggestionsFetchRequested = useMemo(() => e => onFetch(e), [onFetch]);\n const handleSuggestionsClearRequested = useMemo(() => e => onClear(e), [onClear]);\n const handleSuggestionsSelected = useMemo(\n () => (e, data) => onSuggestionSelected(data),\n [onSuggestionSelected]\n );\n\n const inputProps = {\n placeholder,\n value,\n onChange: handleChange,\n onBlur: handleBlur\n };\n\n return (\n <div className={classnames(className, isNil(title) && style.isNoTitle)}>\n <label>\n <span className={style.title}>{title}</span>\n <div>\n <Autosuggest\n theme={{\n container: style.container,\n input: style.input,\n suggestionsContainer: style.suggestionsContainer,\n suggestionsContainerOpen: style.suggestionsContainerOpen,\n suggestionsList: style.suggestionsList,\n suggestion: style.suggestion,\n suggestionHighlighted: style.suggestionHighlighted\n }}\n suggestions={suggestions}\n onSuggestionsFetchRequested={handleSuggestionsFetchRequested}\n onSuggestionsClearRequested={handleSuggestionsClearRequested}\n getSuggestionValue={noop}\n renderSuggestion={renderSuggestion}\n inputProps={inputProps}\n focusInputOnSuggestionClick={false}\n onSuggestionSelected={handleSuggestionsSelected}\n />\n </div>\n </label>\n <div className={style.description}>{description}</div>\n </div>\n );\n};\n\nAutocomplete.propTypes = {\n title: PropTypes.string,\n placeholder: PropTypes.string,\n value: PropTypes.string,\n description: PropTypes.string,\n required: PropTypes.bool,\n modified: PropTypes.bool,\n error: PropTypes.bool,\n suggestions: PropTypes.arrayOf(\n PropTypes.shape({\n name: PropTypes.string,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number])\n })\n ),\n onChange: PropTypes.func,\n onFetch: PropTypes.func,\n onClear: PropTypes.func,\n onBlur: PropTypes.func,\n onSuggestionSelected: PropTypes.func\n};\n\nexport default Autocomplete;\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,OAAf,QAA6B,OAA7B;AACA,OAAOC,WAAP,MAAwB,mBAAxB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB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AC0C,MAFA;EAGvBhC,KAAK,EAAEV,SAAS,CAAC0C,MAHM;EAIvB/B,WAAW,EAAEX,SAAS,CAAC0C,MAJA;EAKvB9B,QAAQ,EAAEZ,SAAS,CAAC2C,IALG;EAMvB9B,QAAQ,EAAEb,SAAS,CAAC2C,IANG;EAOvB7B,KAAK,EAAEd,SAAS,CAAC2C,IAPM;EAQvB5B,WAAW,EAAEf,SAAS,CAAC4C,OAAV,CACX5C,SAAS,CAAC6C,KAAV,CAAgB;IACdvC,IAAI,EAAEN,SAAS,CAAC0C,MADF;IAEdhC,KAAK,EAAEV,SAAS,CAAC8C,SAAV,CAAoB,CAAC9C,SAAS,CAAC0C,MAAX,EAAmB1C,SAAS,CAAC+C,MAA7B,CAApB;EAFO,CAAhB,CADW,CARU;EAcvB/B,QAAQ,EAAEhB,SAAS,CAACgD,IAdG;EAevB/B,OAAO,EAAEjB,SAAS,CAACgD,IAfI;EAgBvB9B,OAAO,EAAElB,SAAS,CAACgD,IAhBI;EAiBvB7B,MAAM,EAAEnB,SAAS,CAACgD,IAjBK;EAkBvB5B,oBAAoB,EAAEpB,SAAS,CAACgD;AAlBT,CAAzB;AAqBA,eAAezC,YAAf"}
1
+ {"version":3,"file":"index.js","names":["React","useCallback","useMemo","Autosuggest","PropTypes","classnames","NovaSolidStatusClose","ErrorIcon","NovaCompositionCoorpacademyInformationIcon","InfoIcon","getClassState","style","THEME_STYLE","coorpmanager","default","renderSuggestion","suggestion","name","Autocomplete","props","placeholder","value","description","required","modified","error","errorMessage","suggestions","onInput","onFetch","onClear","onBlur","onSuggestionSelected","title","propsTitle","theme","mainClass","className","handleInput","e","handleBlur","selectedSuggestion","handleSuggestionsFetchRequested","handleSuggestionsClearRequested","handleSuggestionsSelected","data","inputProps","onChange","descriptionView","toolTipView","infoIconWrapper","infoIcon","descriptionLabel","errorIconView","leftIcon","errorText","__html","isNoTitle","noValue","inputContainer","container","input","suggestionsContainer","suggestionsContainerOpen","suggestionsList","suggestionHighlighted","propTypes","string","bool","arrayOf","shape","oneOfType","number","oneOf","func"],"sources":["../../../src/atom/autocomplete/index.js"],"sourcesContent":["import React, {useCallback, useMemo} from 'react';\nimport Autosuggest from 'react-autosuggest';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {noop, isNil, isEmpty, keys} from 'lodash/fp';\nimport {\n NovaSolidStatusClose as ErrorIcon,\n NovaCompositionCoorpacademyInformationIcon as InfoIcon\n} from '@coorpacademy/nova-icons';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst THEME_STYLE = {\n coorpmanager: style.coorpmanager,\n default: style.default\n};\n\nconst renderSuggestion = suggestion => <span>{suggestion.name}</span>;\n\nconst Autocomplete = props => {\n const {\n placeholder = '',\n value,\n description,\n required,\n modified = false,\n error = false,\n errorMessage,\n suggestions = [],\n onInput = noop,\n onFetch = noop,\n onClear = noop,\n onBlur = noop,\n onSuggestionSelected = noop,\n title: propsTitle,\n theme = 'default'\n } = props;\n\n const mainClass = THEME_STYLE[theme];\n const title = useMemo(() => `${propsTitle}${required ? '*' : ''}`, [propsTitle, required]);\n const className = useMemo(\n () => getClassState(style.default, style.modified, style.error, modified, error),\n [modified, error]\n );\n\n const handleInput = useCallback(\n e => {\n onInput(e);\n },\n [onInput]\n );\n const handleBlur = useCallback(\n (e, selectedSuggestion) => onBlur(e, selectedSuggestion),\n [onBlur]\n );\n const handleSuggestionsFetchRequested = useCallback(e => onFetch(e), [onFetch]);\n const handleSuggestionsClearRequested = useCallback(e => onClear(e), [onClear]);\n const handleSuggestionsSelected = useCallback(\n (e, data) => onSuggestionSelected(data),\n [onSuggestionSelected]\n );\n\n const inputProps = {\n placeholder,\n value,\n onChange: noop,\n onBlur: handleBlur,\n onInput: handleInput,\n 'data-testid': 'autocomplete-input'\n };\n\n const descriptionView =\n description && theme !== 'coorpmanager' ? (\n <div className={style.description}>{description}</div>\n ) : null;\n\n const toolTipView =\n description && theme === 'coorpmanager' ? (\n <div className={style.infoIconWrapper}>\n <InfoIcon className={style.infoIcon} />\n <div className={style.descriptionLabel}>{description}</div>\n </div>\n ) : null;\n\n const errorIconView =\n theme === 'coorpmanager' && error ? <ErrorIcon className={style.leftIcon} /> : null;\n\n const errorText =\n theme === 'coorpmanager' && error ? (\n <div\n className={style.errorText}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: errorMessage}}\n />\n ) : null;\n return (\n <div className={classnames(mainClass, className, isNil(propsTitle) && style.isNoTitle)}>\n <label>\n <span className={classnames(style.title, isEmpty(value) && style.noValue)}>\n {title}\n {toolTipView}\n </span>\n <div className={style.inputContainer}>\n <Autosuggest\n theme={{\n container: style.container,\n input: style.input,\n suggestionsContainer: style.suggestionsContainer,\n suggestionsContainerOpen: style.suggestionsContainerOpen,\n suggestionsList: style.suggestionsList,\n suggestion: style.suggestion,\n suggestionHighlighted: style.suggestionHighlighted\n }}\n suggestions={suggestions}\n onSuggestionsFetchRequested={handleSuggestionsFetchRequested}\n onSuggestionsClearRequested={handleSuggestionsClearRequested}\n getSuggestionValue={noop}\n renderSuggestion={renderSuggestion}\n inputProps={inputProps}\n focusInputOnSuggestionClick={false}\n onSuggestionSelected={handleSuggestionsSelected}\n />\n {errorIconView}\n {errorText}\n </div>\n </label>\n {descriptionView}\n </div>\n );\n};\n\nAutocomplete.propTypes = {\n title: PropTypes.string,\n placeholder: PropTypes.string,\n value: PropTypes.string,\n description: PropTypes.string,\n required: PropTypes.bool,\n modified: PropTypes.bool,\n error: PropTypes.bool,\n errorMessage: PropTypes.string,\n suggestions: PropTypes.arrayOf(\n PropTypes.shape({\n name: PropTypes.string,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number])\n })\n ),\n theme: PropTypes.oneOf(keys(THEME_STYLE)),\n onInput: PropTypes.func,\n onFetch: PropTypes.func,\n onClear: PropTypes.func,\n onBlur: PropTypes.func,\n onSuggestionSelected: PropTypes.func\n};\n\nexport default Autocomplete;\n"],"mappings":";;;;AAAA,OAAOA,KAAP,IAA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BH,EAqBGE,SArBH,CALF,CADF,EA8BGP,eA9BH,CADF;AAkCD,CA9GD;;AAgHA9B,YAAY,CAACgD,SAAb,2CAAyB;EACvBjC,KAAK,EAAE7B,SAAS,CAAC+D,MADM;EAEvB/C,WAAW,EAAEhB,SAAS,CAAC+D,MAFA;EAGvB9C,KAAK,EAAEjB,SAAS,CAAC+D,MAHM;EAIvB7C,WAAW,EAAElB,SAAS,CAAC+D,MAJA;EAKvB5C,QAAQ,EAAEnB,SAAS,CAACgE,IALG;EAMvB5C,QAAQ,EAAEpB,SAAS,CAACgE,IANG;EAOvB3C,KAAK,EAAErB,SAAS,CAACgE,IAPM;EAQvB1C,YAAY,EAAEtB,SAAS,CAAC+D,MARD;EASvBxC,WAAW,EAAEvB,SAAS,CAACiE,OAAV,CACXjE,SAAS,CAACkE,KAAV,CAAgB;IACdrD,IAAI,EAAEb,SAAS,CAAC+D,MADF;IAEd9C,KAAK,EAAEjB,SAAS,CAACmE,SAAV,CAAoB,CAACnE,SAAS,CAAC+D,MAAX,EAAmB/D,SAAS,CAACoE,MAA7B,CAApB;EAFO,CAAhB,CADW,CATU;EAevBrC,KAAK,EAAE/B,SAAS,CAACqE,KAAV,CAAgB,MAAK7D,WAAL,CAAhB,CAfgB;EAgBvBgB,OAAO,EAAExB,SAAS,CAACsE,IAhBI;EAiBvB7C,OAAO,EAAEzB,SAAS,CAACsE,IAjBI;EAkBvB5C,OAAO,EAAE1B,SAAS,CAACsE,IAlBI;EAmBvB3C,MAAM,EAAE3B,SAAS,CAACsE,IAnBK;EAoBvB1C,oBAAoB,EAAE5B,SAAS,CAACsE;AApBT,CAAzB;AAuBA,eAAexD,YAAf"}
@@ -5,6 +5,13 @@
5
5
  @value dark from colors;
6
6
  @value medium from colors;
7
7
  @value white from colors;
8
+ @value cm_positive_100 from colors;
9
+ @value cm_negative_100 from colors;
10
+ @value cm_grey_100 from colors;
11
+ @value cm_grey_150 from colors;
12
+ @value cm_grey_400 from colors;
13
+ @value cm_grey_500 from colors;
14
+ @value cm_grey_700 from colors;
8
15
 
9
16
  .default {
10
17
  display: flex;
@@ -127,4 +134,220 @@
127
134
 
128
135
  .suggestionHighlighted {
129
136
  background-color: #ddd;
137
+ }
138
+
139
+ /******************************* coorpmanager theme ***************************************/
140
+
141
+ .coorpmanager {
142
+ width: 100%;
143
+ display: flex;
144
+ align-items: flex-start;
145
+ flex-direction: column;
146
+ flex-wrap: nowrap;
147
+ position: relative;
148
+ }
149
+
150
+ .coorpmanager label {
151
+ width: 100%;
152
+ height: 100%;
153
+ margin-right: 0;
154
+ display: flex;
155
+ align-items: flex-start;
156
+ flex-direction: column;
157
+ position: relative;
158
+ }
159
+
160
+ .coorpmanager .title {
161
+ flex-grow: 0;
162
+ font-family: Gilroy;
163
+ font-size: 10px;
164
+ font-weight: bold;
165
+ font-stretch: normal;
166
+ font-style: normal;
167
+ line-height: 1.2;
168
+ letter-spacing: normal;
169
+ text-align: left;
170
+ z-index: 1;
171
+ color: cm_grey_400;
172
+ width: auto;
173
+ transition: all 0.25s linear;
174
+ pointer-events: none;
175
+ display: flex;
176
+ flex-direction: row;
177
+ flex-wrap: nowrap;
178
+ position: absolute;
179
+ top: 7px;
180
+ left: 16px;
181
+ }
182
+
183
+ .coorpmanager .title.noValue{
184
+ font-size: 14px;
185
+ font-weight: 500;
186
+ color: cm_grey_700;
187
+ top: 14px;
188
+ }
189
+
190
+ .coorpmanager:focus-within .title.noValue {
191
+ font-size: 10px;
192
+ font-weight: bold;
193
+ color: cm_grey_400;
194
+ top: 7px;
195
+ }
196
+
197
+ .coorpmanager .title.noValue .infoIcon {
198
+ height: 10px;
199
+ width: 10px;
200
+ line-height: 12px;
201
+ color: cm_grey_500;
202
+ }
203
+
204
+ .coorpmanager .inputContainer {
205
+ width: 100%
206
+ }
207
+
208
+ .coorpmanager input {
209
+ width: 100%;
210
+ height: 44px;
211
+ margin: 0px;
212
+ display: flex;
213
+ align-items: flex-start;
214
+ flex-direction: column;
215
+ flex-grow: 0;
216
+ justify-content: center;
217
+ background-color: cm_grey_100;
218
+ box-sizing: border-box;
219
+ border: none;
220
+ border-radius: 7px;
221
+ color: cm_grey_700;
222
+ font-family: Gilroy;
223
+ font-size: 14px;
224
+ font-weight: 500;
225
+ font-stretch: normal;
226
+ font-style: normal;
227
+ line-height: 44px;
228
+ letter-spacing: normal;
229
+ outline: none;
230
+ padding: 19px 30px 5px 16px;
231
+ text-align: left;
232
+ transition: all 0.25s linear;
233
+ }
234
+
235
+ .coorpmanager .suggestionsContainerOpen {
236
+ width: 100%;
237
+ margin-left: 0;
238
+ border-radius: 7px;
239
+ }
240
+
241
+ .coorpmanager:focus-within input::placeholder {
242
+ color: cm_grey_400;
243
+ }
244
+
245
+ .coorpmanager .suggestionsList {
246
+ border-radius: 7px;
247
+ }
248
+
249
+ .coorpmanager .suggestionHighlighted {
250
+ border-radius: 5px;
251
+ }
252
+
253
+ .coorpmanager input::placeholder {
254
+ color: transparent;
255
+ transition: color 0.25s linear;
256
+ }
257
+
258
+ .coorpmanager input:hover {
259
+ background-color: cm_grey_150;
260
+ }
261
+
262
+ .coorpmanager.error .leftIcon {
263
+ background-color: cm_negative_100;
264
+ color: white;
265
+ border-radius: 50%;
266
+ padding: 2px;
267
+ width: 10px;
268
+ height: 10px;
269
+ position: absolute;
270
+ right: 17px;
271
+ top: 14px;
272
+ }
273
+
274
+ .coorpmanager .errorText {
275
+ flex-grow: 0;
276
+ opacity: 0.5;
277
+ font-family: Gilroy;
278
+ font-size: 10px;
279
+ font-weight: 500;
280
+ font-stretch: normal;
281
+ font-style: normal;
282
+ line-height: 1.2;
283
+ letter-spacing: normal;
284
+ text-align: left;
285
+ padding-top: 8px;
286
+ color: cm_negative_100;
287
+ }
288
+
289
+ .coorpmanager .infoIconWrapper {
290
+ overflow: visible;
291
+ height: 12px;
292
+ margin: 0px 4px;
293
+ cursor: pointer;
294
+ pointer-events: fill;
295
+ position: relative;
296
+ }
297
+
298
+ .coorpmanager .infoIcon {
299
+ cursor: pointer;
300
+ width: 8px;
301
+ height: 8px;
302
+ line-height: 16px;
303
+ color: cm_grey_400;
304
+ transition: all 0.25s linear;
305
+ }
306
+
307
+ .coorpmanager .infoIconWrapper:hover .descriptionLabel {
308
+ visibility: visible;
309
+ opacity: 1;
310
+ }
311
+
312
+ .coorpmanager .descriptionLabel {
313
+ margin: 0 1px 18px 0;
314
+ padding: 8px 16px;
315
+ border-radius: 7px;
316
+ background-color: cm_grey_700;
317
+ flex-grow: 0;
318
+ font-family: Gilroy;
319
+ font-size: 14px;
320
+ font-weight: 500;
321
+ font-stretch: normal;
322
+ font-style: normal;
323
+ line-height: 1.43;
324
+ letter-spacing: normal;
325
+ text-align: center;
326
+ color: white;
327
+ padding: 8px 16px;
328
+ max-width: 200px;
329
+ position: absolute;
330
+ left: -24px;
331
+ z-index: 3;
332
+ bottom: 5px;
333
+ width: max-content;
334
+ visibility: hidden;
335
+ opacity: 0s
336
+ }
337
+
338
+ .coorpmanager .descriptionLabel::after{
339
+ content:'';
340
+ border-left: 6px solid transparent;
341
+ border-right: 6px solid transparent;
342
+ border-top: 6px solid cm_grey_700;
343
+ position: absolute;
344
+ bottom: -6px;
345
+ left: 21px;
346
+ }
347
+
348
+ .coorpmanager .title.noValue .descriptionLabel::after{
349
+ left: 22px;
350
+ }
351
+ .coorpmanager:focus-within .title.noValue .descriptionLabel::after{
352
+ left: 21px;
130
353
  }
@@ -33,11 +33,13 @@ declare namespace BrandFormGroup {
33
33
  required: PropTypes.Requireable<boolean>;
34
34
  modified: PropTypes.Requireable<boolean>;
35
35
  error: PropTypes.Requireable<boolean>;
36
+ errorMessage: PropTypes.Requireable<string>;
36
37
  suggestions: PropTypes.Requireable<(PropTypes.InferProps<{
37
38
  name: PropTypes.Requireable<string>;
38
39
  value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
39
40
  }> | null | undefined)[]>;
40
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
41
+ theme: PropTypes.Requireable<string>;
42
+ onInput: PropTypes.Requireable<(...args: any[]) => any>;
41
43
  onFetch: PropTypes.Requireable<(...args: any[]) => any>;
42
44
  onClear: PropTypes.Requireable<(...args: any[]) => any>;
43
45
  onBlur: PropTypes.Requireable<(...args: any[]) => any>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/select-multiple/index.js"],"names":[],"mappings":"AAsBO,oEAcN;;AA2BD;;;;;;;;;;;;;;;gBAoLC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/select-multiple/index.js"],"names":[],"mappings":"AAsBO,oEAcN;;AA2BD;;;;;;;;;;;;;;;gBAqLC"}
@@ -103,8 +103,9 @@ const SelectMultiple = ({
103
103
  }
104
104
  }, []);
105
105
  const handleChange = useCallback(choice => {
106
- // if multiple prop is turned on
106
+ console.log('--->', choice); // if multiple prop is turned on
107
107
  // we return all selected choices
108
+
108
109
  if (multiple) {
109
110
  setChoices(choice);
110
111
  return onChange(getChoices());
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","useState","useEffect","useRef","useCallback","PropTypes","classnames","NovaCompositionNavigationArrowDown","ArrowDown","NovaSolidStatusClose","ErrorIcon","NovaCompositionCoorpacademyInformationIcon","InfoIcon","TitledCheckbox","Provider","Checkbox","getClassState","style","themeStyle","setup","cockpit","sidebar","coorpmanager","useChoices","options","choicesRef","current","getChoices","setChoices","choice","choices","i","selected","filter","c","CMMultipleView","multiple","onChange","handleChange","checked","item","name","SelectMultiple","title","theme","placeholder","description","hint","onError","modified","error","disabled","skin","isOpened","updateIsOpened","nodeRef","defaultColor","black","handleOnClick","e","preventDefault","stopPropagation","prev","closeHandle","contains","target","document","addEventListener","removeEventListener","isCMTheme","handleOnClickOnListElement","lines","convert","cap","selection","isActive","titleView","titleWithSelection","noValue","active","infoIconWrapper","infoIcon","descriptionLabel","hintView","hideHint","__html","mainClass","default","showPlaceholder","behaviourClassName","errorIconView","errorIcon","select","noselection","iconsWrapper","flex","clicked","color","arrow","down","activeChoices","list","contextTypes","childContextTypes","propTypes","bool","func","string","arrayOf","oneOf"],"sources":["../../../src/molecule/select-multiple/index.js"],"sourcesContent":["import React, {useState, useEffect, useRef, useCallback} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {map, pipe, join, filter, get, set, keys, isEmpty} from 'lodash/fp';\nimport {\n NovaCompositionNavigationArrowDown as ArrowDown,\n NovaSolidStatusClose as ErrorIcon,\n NovaCompositionCoorpacademyInformationIcon as InfoIcon\n} from '@coorpacademy/nova-icons';\nimport TitledCheckbox from '../titled-checkbox';\nimport Provider from '../../atom/provider';\nimport Checkbox from '../../atom/input-checkbox';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst themeStyle = {\n setup: style.setup,\n cockpit: style.cockpit,\n sidebar: style.sidebar,\n coorpmanager: style.coorpmanager\n};\n\nexport const useChoices = options => {\n const choicesRef = {current: options};\n\n const getChoices = () => {\n return choicesRef.current;\n };\n\n const setChoices = choice => {\n const choices = set(`[${choice.i}].selected`, !choice.selected, getChoices());\n\n choicesRef.current = choices.filter(c => c.selected);\n };\n\n return [getChoices, setChoices];\n};\n\nconst CMMultipleView = ({multiple, choice, onChange}) => {\n const handleChange = useCallback(\n checked => {\n return onChange({...choice, selected: checked});\n },\n [onChange, choice]\n );\n\n return multiple ? (\n <div className={style.item}>\n <Checkbox\n titleStyle=\"inherit\"\n checked={choice.selected}\n onChange={handleChange}\n noLabelMargins\n title={choice.name}\n />\n </div>\n ) : (\n <span className={style.item} title={choice.name} data-name={`${choice.name}-language`}>\n {choice.name}\n </span>\n );\n};\n\nconst SelectMultiple = (\n {\n title,\n options,\n theme,\n placeholder,\n description,\n hint,\n multiple,\n onChange,\n onError,\n modified = false,\n error = '',\n disabled = false\n },\n {skin}\n) => {\n const [isOpened, updateIsOpened] = useState(false);\n const [getChoices, setChoices] = useChoices(options);\n const nodeRef = useRef(null);\n\n const defaultColor = get('common.primary', skin);\n const black = get('common.black', skin);\n\n const handleOnClick = useCallback(\n e => {\n if (disabled) return;\n\n e.preventDefault();\n e.stopPropagation();\n\n updateIsOpened(prev => !prev);\n },\n [disabled]\n );\n\n const closeHandle = useCallback(e => {\n if (nodeRef && nodeRef.current && !nodeRef.current.contains(e.target)) {\n updateIsOpened(false);\n }\n }, []);\n\n const handleChange = useCallback(\n choice => {\n // if multiple prop is turned on\n // we return all selected choices\n if (multiple) {\n setChoices(choice);\n return onChange(getChoices());\n }\n updateIsOpened(false);\n return onChange(choice);\n },\n [multiple, onChange, setChoices, getChoices]\n );\n\n useEffect(() => {\n document.addEventListener('click', closeHandle);\n document.addEventListener('touchstart', closeHandle);\n\n return () => {\n document.removeEventListener('click', closeHandle);\n document.removeEventListener('touchstart', closeHandle);\n };\n }, [closeHandle]);\n\n const isCMTheme = theme === 'coorpmanager';\n\n const handleOnClickOnListElement = choice => () => handleChange(choice);\n\n const lines = map.convert({cap: false})((choice, i) => {\n return (\n <li\n key={i}\n className={style.choice}\n onClick={isCMTheme && !multiple ? handleOnClickOnListElement({...choice, i}) : null}\n >\n {isCMTheme ? (\n <CMMultipleView multiple={multiple} choice={{...choice, i}} onChange={handleChange} />\n ) : (\n <TitledCheckbox\n onToggle={handleChange}\n choice={{...choice, i}}\n background={defaultColor}\n />\n )}\n </li>\n );\n }, options);\n\n const selection = pipe(filter({selected: true}), map('name'), join(', '))(options);\n\n const isActive = isOpened === true;\n\n const titleView = title ? (\n <span\n className={classnames(\n style.title,\n isCMTheme && selection && style.titleWithSelection,\n isCMTheme && isEmpty(selection) && style.noValue,\n isActive && style.active\n )}\n >\n {title}\n {isCMTheme ? (\n <div className={style.infoIconWrapper}>\n <InfoIcon className={style.infoIcon} />\n <div className={style.descriptionLabel}>{description}</div>\n </div>\n ) : null}\n </span>\n ) : null;\n\n const hintView = isCMTheme ? (\n <div\n className={classnames(style.hint, isActive && style.hideHint)}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: error || hint}}\n />\n ) : null;\n\n const mainClass = theme ? themeStyle[theme] : style.default;\n const showPlaceholder = isCMTheme && isActive;\n const behaviourClassName = getClassState(\n style.default,\n style.modified,\n style.error,\n modified,\n error\n );\n\n const errorIconView = error ? <ErrorIcon onClick={onError} className={style.errorIcon} /> : null;\n\n return (\n <div\n className={classnames(mainClass, behaviourClassName, disabled && style.disabled)}\n ref={nodeRef}\n >\n <label>\n {!isCMTheme && titleView}\n <div\n className={style.select}\n title={selection || placeholder}\n data-name={`select-languages`}\n onClick={handleOnClick}\n >\n {isCMTheme && titleView}\n <span\n className={classnames(\n style.selection,\n isCMTheme && isEmpty(selection) && style.noselection\n )}\n >\n {selection || !isCMTheme || (showPlaceholder && placeholder) || null}\n </span>\n {isCMTheme ? (\n <div className={style.iconsWrapper}>\n <div className={style.flex}>{errorIconView}</div>\n <div className={classnames(style.flex, isActive && style.clicked)}>\n <ArrowDown\n style={{color: black}}\n className={classnames(style.arrow, {[style.down]: isActive})}\n />\n </div>\n </div>\n ) : (\n <ArrowDown\n style={{color: black}}\n className={classnames(style.arrow, {[style.down]: isActive})}\n />\n )}\n </div>\n <div className={classnames(style.choices, isActive && style.activeChoices)}>\n <ul className={style.list}>{lines}</ul>\n </div>\n </label>\n {!isCMTheme ? <div className={style.description}>{description}</div> : null}\n {hintView}\n </div>\n );\n};\n\nSelectMultiple.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nCMMultipleView.propTypes = {\n multiple: PropTypes.bool,\n choice: TitledCheckbox.propTypes.choice,\n onChange: PropTypes.func\n};\n\nSelectMultiple.propTypes = {\n title: PropTypes.string,\n placeholder: PropTypes.string,\n description: PropTypes.string,\n hint: PropTypes.string,\n options: PropTypes.arrayOf(TitledCheckbox.propTypes.choice),\n onChange: PropTypes.func,\n onError: PropTypes.func,\n multiple: PropTypes.bool,\n modified: PropTypes.bool,\n disabled: PropTypes.bool,\n error: PropTypes.string,\n theme: PropTypes.oneOf(keys(themeStyle))\n};\n\nexport default SelectMultiple;\n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ACqE,SAAf,2CAA2B;EACzBpE,QAAQ,EAAE/B,SAAS,CAACoG,IADK;EAEzB5E,MAAM,EAAEhB,cAAc,CAAC2F,SAAf,CAAyB3E,MAFR;EAGzBQ,QAAQ,EAAEhC,SAAS,CAACqG;AAHK,CAA3B;AAMAhE,cAAc,CAAC8D,SAAf,2CAA2B;EACzB7D,KAAK,EAAEtC,SAAS,CAACsG,MADQ;EAEzB9D,WAAW,EAAExC,SAAS,CAACsG,MAFE;EAGzB7D,WAAW,EAAEzC,SAAS,CAACsG,MAHE;EAIzB5D,IAAI,EAAE1C,SAAS,CAACsG,MAJS;EAKzBnF,OAAO,EAAEnB,SAAS,CAACuG,OAAV,CAAkB/F,cAAc,CAAC2F,SAAf,CAAyB3E,MAA3C,CALgB;EAMzBQ,QAAQ,EAAEhC,SAAS,CAACqG,IANK;EAOzB1D,OAAO,EAAE3C,SAAS,CAACqG,IAPM;EAQzBtE,QAAQ,EAAE/B,SAAS,CAACoG,IARK;EASzBxD,QAAQ,EAAE5C,SAAS,CAACoG,IATK;EAUzBtD,QAAQ,EAAE9C,SAAS,CAACoG,IAVK;EAWzBvD,KAAK,EAAE7C,SAAS,CAACsG,MAXQ;EAYzB/D,KAAK,EAAEvC,SAAS,CAACwG,KAAV,CAAgB,MAAK3F,UAAL,CAAhB;AAZkB,CAA3B;AAeA,eAAewB,cAAf"}
1
+ {"version":3,"file":"index.js","names":["React","useState","useEffect","useRef","useCallback","PropTypes","classnames","NovaCompositionNavigationArrowDown","ArrowDown","NovaSolidStatusClose","ErrorIcon","NovaCompositionCoorpacademyInformationIcon","InfoIcon","TitledCheckbox","Provider","Checkbox","getClassState","style","themeStyle","setup","cockpit","sidebar","coorpmanager","useChoices","options","choicesRef","current","getChoices","setChoices","choice","choices","i","selected","filter","c","CMMultipleView","multiple","onChange","handleChange","checked","item","name","SelectMultiple","title","theme","placeholder","description","hint","onError","modified","error","disabled","skin","isOpened","updateIsOpened","nodeRef","defaultColor","black","handleOnClick","e","preventDefault","stopPropagation","prev","closeHandle","contains","target","console","log","document","addEventListener","removeEventListener","isCMTheme","handleOnClickOnListElement","lines","convert","cap","selection","isActive","titleView","titleWithSelection","noValue","active","infoIconWrapper","infoIcon","descriptionLabel","hintView","hideHint","__html","mainClass","default","showPlaceholder","behaviourClassName","errorIconView","errorIcon","select","noselection","iconsWrapper","flex","clicked","color","arrow","down","activeChoices","list","contextTypes","childContextTypes","propTypes","bool","func","string","arrayOf","oneOf"],"sources":["../../../src/molecule/select-multiple/index.js"],"sourcesContent":["import React, {useState, useEffect, useRef, useCallback} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {map, pipe, join, filter, get, set, keys, isEmpty} from 'lodash/fp';\nimport {\n NovaCompositionNavigationArrowDown as ArrowDown,\n NovaSolidStatusClose as ErrorIcon,\n NovaCompositionCoorpacademyInformationIcon as InfoIcon\n} from '@coorpacademy/nova-icons';\nimport TitledCheckbox from '../titled-checkbox';\nimport Provider from '../../atom/provider';\nimport Checkbox from '../../atom/input-checkbox';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst themeStyle = {\n setup: style.setup,\n cockpit: style.cockpit,\n sidebar: style.sidebar,\n coorpmanager: style.coorpmanager\n};\n\nexport const useChoices = options => {\n const choicesRef = {current: options};\n\n const getChoices = () => {\n return choicesRef.current;\n };\n\n const setChoices = choice => {\n const choices = set(`[${choice.i}].selected`, !choice.selected, getChoices());\n\n choicesRef.current = choices.filter(c => c.selected);\n };\n\n return [getChoices, setChoices];\n};\n\nconst CMMultipleView = ({multiple, choice, onChange}) => {\n const handleChange = useCallback(\n checked => {\n return onChange({...choice, selected: checked});\n },\n [onChange, choice]\n );\n\n return multiple ? (\n <div className={style.item}>\n <Checkbox\n titleStyle=\"inherit\"\n checked={choice.selected}\n onChange={handleChange}\n noLabelMargins\n title={choice.name}\n />\n </div>\n ) : (\n <span className={style.item} title={choice.name} data-name={`${choice.name}-language`}>\n {choice.name}\n </span>\n );\n};\n\nconst SelectMultiple = (\n {\n title,\n options,\n theme,\n placeholder,\n description,\n hint,\n multiple,\n onChange,\n onError,\n modified = false,\n error = '',\n disabled = false\n },\n {skin}\n) => {\n const [isOpened, updateIsOpened] = useState(false);\n const [getChoices, setChoices] = useChoices(options);\n const nodeRef = useRef(null);\n\n const defaultColor = get('common.primary', skin);\n const black = get('common.black', skin);\n\n const handleOnClick = useCallback(\n e => {\n if (disabled) return;\n\n e.preventDefault();\n e.stopPropagation();\n\n updateIsOpened(prev => !prev);\n },\n [disabled]\n );\n\n const closeHandle = useCallback(e => {\n if (nodeRef && nodeRef.current && !nodeRef.current.contains(e.target)) {\n updateIsOpened(false);\n }\n }, []);\n\n const handleChange = useCallback(\n choice => {\n console.log('--->', choice);\n // if multiple prop is turned on\n // we return all selected choices\n if (multiple) {\n setChoices(choice);\n return onChange(getChoices());\n }\n updateIsOpened(false);\n return onChange(choice);\n },\n [multiple, onChange, setChoices, getChoices]\n );\n\n useEffect(() => {\n document.addEventListener('click', closeHandle);\n document.addEventListener('touchstart', closeHandle);\n\n return () => {\n document.removeEventListener('click', closeHandle);\n document.removeEventListener('touchstart', closeHandle);\n };\n }, [closeHandle]);\n\n const isCMTheme = theme === 'coorpmanager';\n\n const handleOnClickOnListElement = choice => () => handleChange(choice);\n\n const lines = map.convert({cap: false})((choice, i) => {\n return (\n <li\n key={i}\n className={style.choice}\n onClick={isCMTheme && !multiple ? handleOnClickOnListElement({...choice, i}) : null}\n >\n {isCMTheme ? (\n <CMMultipleView multiple={multiple} choice={{...choice, i}} onChange={handleChange} />\n ) : (\n <TitledCheckbox\n onToggle={handleChange}\n choice={{...choice, i}}\n background={defaultColor}\n />\n )}\n </li>\n );\n }, options);\n\n const selection = pipe(filter({selected: true}), map('name'), join(', '))(options);\n\n const isActive = isOpened === true;\n\n const titleView = title ? (\n <span\n className={classnames(\n style.title,\n isCMTheme && selection && style.titleWithSelection,\n isCMTheme && isEmpty(selection) && style.noValue,\n isActive && style.active\n )}\n >\n {title}\n {isCMTheme ? (\n <div className={style.infoIconWrapper}>\n <InfoIcon className={style.infoIcon} />\n <div className={style.descriptionLabel}>{description}</div>\n </div>\n ) : null}\n </span>\n ) : null;\n\n const hintView = isCMTheme ? (\n <div\n className={classnames(style.hint, isActive && style.hideHint)}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: error || hint}}\n />\n ) : null;\n\n const mainClass = theme ? themeStyle[theme] : style.default;\n const showPlaceholder = isCMTheme && isActive;\n const behaviourClassName = getClassState(\n style.default,\n style.modified,\n style.error,\n modified,\n error\n );\n\n const errorIconView = error ? <ErrorIcon onClick={onError} className={style.errorIcon} /> : null;\n\n return (\n <div\n className={classnames(mainClass, behaviourClassName, disabled && style.disabled)}\n ref={nodeRef}\n >\n <label>\n {!isCMTheme && titleView}\n <div\n className={style.select}\n title={selection || placeholder}\n data-name={`select-languages`}\n onClick={handleOnClick}\n >\n {isCMTheme && titleView}\n <span\n className={classnames(\n style.selection,\n isCMTheme && isEmpty(selection) && style.noselection\n )}\n >\n {selection || !isCMTheme || (showPlaceholder && placeholder) || null}\n </span>\n {isCMTheme ? (\n <div className={style.iconsWrapper}>\n <div className={style.flex}>{errorIconView}</div>\n <div className={classnames(style.flex, isActive && style.clicked)}>\n <ArrowDown\n style={{color: black}}\n className={classnames(style.arrow, {[style.down]: isActive})}\n />\n </div>\n </div>\n ) : (\n <ArrowDown\n style={{color: black}}\n className={classnames(style.arrow, {[style.down]: isActive})}\n />\n )}\n </div>\n <div className={classnames(style.choices, isActive && style.activeChoices)}>\n <ul className={style.list}>{lines}</ul>\n </div>\n </label>\n {!isCMTheme ? <div className={style.description}>{description}</div> : null}\n {hintView}\n </div>\n );\n};\n\nSelectMultiple.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nCMMultipleView.propTypes = {\n multiple: PropTypes.bool,\n choice: TitledCheckbox.propTypes.choice,\n onChange: PropTypes.func\n};\n\nSelectMultiple.propTypes = {\n title: PropTypes.string,\n placeholder: PropTypes.string,\n description: PropTypes.string,\n hint: PropTypes.string,\n options: PropTypes.arrayOf(TitledCheckbox.propTypes.choice),\n onChange: PropTypes.func,\n onError: PropTypes.func,\n multiple: PropTypes.bool,\n modified: PropTypes.bool,\n disabled: PropTypes.bool,\n error: PropTypes.string,\n theme: PropTypes.oneOf(keys(themeStyle))\n};\n\nexport default SelectMultiple;\n"],"mappings":";;;;;;;;;;;AAAA,OAAOA,KAAP,IAAeC,QAAf,EAAyBC,SAAzB,EAAoCC,MAApC,EAA4CC,WAA5C,QAA8D,OAA9D;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,SACEC,kCAAkC,IAAIC,SADxC,EAEEC,oBAAoB,IAAIC,SAF1B,EAGEC,0CAA0C,IAAIC,QAHhD,QAIO,0BAJP;AAKA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,QAAP,MAAqB,qBAArB;AACA,OAAOC,QAAP,MAAqB,2BAArB;AACA,OAAOC,aAAP,MAA0B,4BAA1B;AACA,OAAOC,KAAP,MAAkB,aAAlB;AAEA,MAAMC,UAAU,GAAG;EACjBC,KAAK,EAAEF,KAAK,CAACE,KADI;EAEjBC,OAAO,EAAEH,KAAK,CAACG,OAFE;EAGjBC,OAAO,EAAEJ,KAAK,CAACI,OAHE;EAIjBC,YAAY,EAAEL,KAAK,CAACK;AAJH,CAAnB;AAOA,OAAO,MAAMC,UAAU,GAAGC,OAAO,IAAI;EACnC,MAAMC,UAAU,GAAG;IAACC,OAAO,EAAEF;EAAV,CAAnB;;EAEA,MAAMG,UAAU,GAAG,MAAM;IACvB,OAAOF,UAAU,CAACC,OAAlB;EACD,CAFD;;EAIA,MAAME,UAAU,GAAGC,MAAM,IAAI;IAC3B,MAAMC,OAAO,GAAG,KAAK,IAAGD,MAAM,CAACE,CAAE,YAAjB,EAA8B,CAACF,MAAM,CAACG,QAAtC,EAAgDL,UAAU,EAA1D,CAAhB;;IAEAF,UAAU,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 padding: 2px;
455
455
  border-radius: 50%;
456
456
  width: 10px;
457
457
  height: 10px;
@@ -63,11 +63,13 @@ declare namespace BrandForm {
63
63
  required: PropTypes.Requireable<boolean>;
64
64
  modified: PropTypes.Requireable<boolean>;
65
65
  error: PropTypes.Requireable<boolean>;
66
+ errorMessage: PropTypes.Requireable<string>;
66
67
  suggestions: PropTypes.Requireable<(PropTypes.InferProps<{
67
68
  name: PropTypes.Requireable<string>;
68
69
  value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
69
70
  }> | null | undefined)[]>;
70
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
71
+ theme: PropTypes.Requireable<string>;
72
+ onInput: PropTypes.Requireable<(...args: any[]) => any>;
71
73
  onFetch: PropTypes.Requireable<(...args: any[]) => any>;
72
74
  onClear: PropTypes.Requireable<(...args: any[]) => any>;
73
75
  onBlur: PropTypes.Requireable<(...args: any[]) => any>;
@@ -510,6 +512,7 @@ declare namespace BrandForm {
510
512
  }>>;
511
513
  export { tooltip_1 as tooltip };
512
514
  export const isLoading: PropTypes.Requireable<boolean>;
515
+ export const theme: PropTypes.Requireable<string>;
513
516
  }
514
517
  }
515
518
  import PropTypes from "prop-types";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/organism/brand-form/index.js"],"names":[],"mappings":";AAiDA,kEA6EC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/organism/brand-form/index.js"],"names":[],"mappings":";AA6DA,kEA+EC"}
@@ -5,11 +5,12 @@ import { NovaCompositionNavigationArrowLeft as ArrowLeft } from '@coorpacademy/n
5
5
  import BrandFormGroup from '../../molecule/brand-form-group';
6
6
  import Provider from '../../atom/provider';
7
7
  import Button from '../../atom/button';
8
+ import ButtonLink from '../../atom/button-link';
8
9
  import Link from '../../atom/link';
9
10
  import Loader from '../../atom/loader';
10
11
  import style from './style.css';
11
12
 
12
- const buildButtonSection = (onSubmit, submitValue, onReset, resetValue, tooltip, disabled, isModified, isPending, darkColor) => {
13
+ const buildButtonSection = (onSubmit, submitValue, onReset, resetValue, tooltip, disabled, isModified, isPending, darkColor, theme) => {
13
14
  if (!onSubmit && !onReset) {
14
15
  return null;
15
16
  }
@@ -19,7 +20,14 @@ const buildButtonSection = (onSubmit, submitValue, onReset, resetValue, tooltip,
19
20
  "data-tip": tooltip.title,
20
21
  "data-for": "submitButton",
21
22
  className: style.saveButton
22
- }, /*#__PURE__*/React.createElement(Button, {
23
+ }, theme === 'coorpmanager' ? /*#__PURE__*/React.createElement(ButtonLink, {
24
+ type: "primary",
25
+ label: submitValue,
26
+ disabled: disabledSubmit,
27
+ "data-testid": "submit-button",
28
+ buttonType: "submit",
29
+ onClick: onSubmit
30
+ }) : /*#__PURE__*/React.createElement(Button, {
23
31
  type: "submit",
24
32
  disabled: disabledSubmit,
25
33
  submitValue: submitValue
@@ -39,7 +47,7 @@ const buildButtonSection = (onSubmit, submitValue, onReset, resetValue, tooltip,
39
47
  }, submitButton, resetButton);
40
48
  };
41
49
 
42
- function BrandForm(props, context) {
50
+ const BrandForm = (props, context) => {
43
51
  const {
44
52
  groups,
45
53
  disabled,
@@ -51,7 +59,8 @@ function BrandForm(props, context) {
51
59
  resetValue,
52
60
  back,
53
61
  tooltip,
54
- isLoading
62
+ isLoading,
63
+ theme
55
64
  } = props;
56
65
  const {
57
66
  skin
@@ -76,7 +85,7 @@ function BrandForm(props, context) {
76
85
  key: index
77
86
  }, /*#__PURE__*/React.createElement(BrandFormGroup, group));
78
87
  });
79
- const buttonSection = buildButtonSection(onSubmit, submitValue, onReset, resetValue, tooltip, disabled, isModified, isPending, darkColor);
88
+ const buttonSection = buildButtonSection(onSubmit, submitValue, onReset, resetValue, tooltip, disabled, isModified, isPending, darkColor, theme);
80
89
  const handleSubmit = useMemo(() => e => {
81
90
  e.preventDefault();
82
91
  return onSubmit(e);
@@ -95,7 +104,7 @@ function BrandForm(props, context) {
95
104
  onReset: handleReset,
96
105
  className: style.form
97
106
  }, brandGroups, buttonSection));
98
- }
107
+ };
99
108
 
100
109
  BrandForm.contextTypes = {
101
110
  skin: Provider.childContextTypes.skin
@@ -123,7 +132,8 @@ BrandForm.propTypes = process.env.NODE_ENV !== "production" ? {
123
132
  title: PropTypes.string,
124
133
  place: PropTypes.string
125
134
  }),
126
- isLoading: PropTypes.bool
135
+ isLoading: PropTypes.bool,
136
+ theme: PropTypes.string
127
137
  } : {};
128
138
  export default BrandForm;
129
139
  //# sourceMappingURL=index.js.map