@coorpacademy/components 11.14.22 → 11.14.24-alpha.10

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 (46) 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/atom/input-switch/index.d.ts.map +1 -1
  7. package/es/atom/input-switch/index.js +3 -1
  8. package/es/atom/input-switch/index.js.map +1 -1
  9. package/es/molecule/brand-form-group/index.d.ts +3 -1
  10. package/es/molecule/select-multiple/index.d.ts +0 -1
  11. package/es/molecule/select-multiple/index.d.ts.map +1 -1
  12. package/es/molecule/select-multiple/index.js +14 -29
  13. package/es/molecule/select-multiple/index.js.map +1 -1
  14. package/es/molecule/select-multiple/style.css +1 -1
  15. package/es/organism/brand-form/index.d.ts +4 -1
  16. package/es/organism/brand-form/index.d.ts.map +1 -1
  17. package/es/organism/brand-form/index.js +17 -7
  18. package/es/organism/brand-form/index.js.map +1 -1
  19. package/es/organism/user-preferences/index.js +3 -1
  20. package/es/organism/user-preferences/index.js.map +1 -1
  21. package/es/organism/wizard-contents/index.d.ts +4 -1
  22. package/es/template/back-office/brand-update/index.d.ts +4 -1
  23. package/lib/atom/autocomplete/index.d.ts +3 -1
  24. package/lib/atom/autocomplete/index.d.ts.map +1 -1
  25. package/lib/atom/autocomplete/index.js +58 -18
  26. package/lib/atom/autocomplete/index.js.map +1 -1
  27. package/lib/atom/autocomplete/style.css +223 -0
  28. package/lib/atom/input-switch/index.d.ts.map +1 -1
  29. package/lib/atom/input-switch/index.js +3 -1
  30. package/lib/atom/input-switch/index.js.map +1 -1
  31. package/lib/molecule/brand-form-group/index.d.ts +3 -1
  32. package/lib/molecule/select-multiple/index.d.ts +0 -1
  33. package/lib/molecule/select-multiple/index.d.ts.map +1 -1
  34. package/lib/molecule/select-multiple/index.js +15 -33
  35. package/lib/molecule/select-multiple/index.js.map +1 -1
  36. package/lib/molecule/select-multiple/style.css +1 -1
  37. package/lib/organism/brand-form/index.d.ts +4 -1
  38. package/lib/organism/brand-form/index.d.ts.map +1 -1
  39. package/lib/organism/brand-form/index.js +18 -7
  40. package/lib/organism/brand-form/index.js.map +1 -1
  41. package/lib/organism/user-preferences/index.js +3 -1
  42. package/lib/organism/user-preferences/index.js.map +1 -1
  43. package/lib/organism/wizard-contents/index.d.ts +4 -1
  44. package/lib/template/back-office/brand-update/index.d.ts +4 -1
  45. package/locales/.mtslconfig.json +1 -0
  46. package/package.json +2 -2
@@ -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
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/input-switch/index.js"],"names":[],"mappings":";AAMA,sDAgFC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/input-switch/index.js"],"names":[],"mappings":";AAMA,sDAsFC"}
@@ -104,7 +104,9 @@ const InputSwitch = props => {
104
104
  })), /*#__PURE__*/_react.default.createElement("label", {
105
105
  htmlFor: idSwitch,
106
106
  "data-name": "input-switch-label",
107
- tabIndex: 0
107
+ tabIndex: 0,
108
+ "aria-label": ariaLabel,
109
+ title: ariaLabel
108
110
  }))), /*#__PURE__*/_react.default.createElement("div", {
109
111
  className: !details ? _style.default.alignedTextContainer : null
110
112
  }, titlePosition === 'right' ? titleView : null, details ? /*#__PURE__*/_react.default.createElement("div", {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["InputSwitch","props","title","name","id","value","disabled","onChange","description","modified","theme","titlePosition","details","requiredSelection","dataName","ariaLabelledBy","ariaLabel","idSwitch","isDisabled","handleChange","useMemo","e","target","checked","titleView","style","descriptionView","getClass","defaultClass","coorpmanager","modifiedClass","coorpmanagerModified","partielUncheck","default","className","getClassState","btnSwitchContainer","checkbox","alignedTextContainer","detailsTxt","propTypes","PropTypes","string","bool","func","oneOf"],"sources":["../../../src/atom/input-switch/index.js"],"sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport {noop, uniqueId} from 'lodash/fp';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst InputSwitch = props => {\n const {\n title,\n name,\n id,\n value,\n disabled,\n onChange = noop,\n description,\n modified = false,\n theme = 'default',\n titlePosition = 'left',\n details = '',\n requiredSelection = false,\n 'data-name': dataName,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-label': ariaLabel\n } = props;\n\n const idSwitch = id || uniqueId('input-switch-');\n const isDisabled = disabled ? 'disabled' : '';\n const handleChange = useMemo(() => e => onChange(e.target.checked), [onChange]);\n\n const titleView = title ? (\n <span id={`title-view-${dataName}`} className={style.title}>\n {`${title} `}{' '}\n </span>\n ) : null;\n\n const descriptionView = description ? (\n <div className={style.description}>{description}</div>\n ) : null;\n\n const getClass = () => {\n switch (theme) {\n case 'coorpmanager':\n return {\n defaultClass: style.coorpmanager,\n modifiedClass: style.coorpmanagerModified\n };\n case 'mooc':\n return {\n defaultClass: style.partielUncheck,\n modifiedClass: style.coorpmanagerModified\n };\n default:\n return {defaultClass: style.default, modifiedClass: style.modified};\n }\n };\n const {defaultClass, modifiedClass} = getClass();\n const className = getClassState(defaultClass, modifiedClass, null, modified);\n\n return (\n <div className={className} data-name={`switch-input-${theme}${dataName}`}>\n {titlePosition === 'left' ? titleView : null}\n <div className={requiredSelection ? style.requiredSelection : null}>\n <div className={style.btnSwitchContainer}>\n <input\n {...(ariaLabelledBy ? {'aria-labelledby': ariaLabelledBy} : {})}\n {...(title ? {'aria-labelledby': `title-view-${dataName}`} : {})}\n {...(ariaLabel && !ariaLabelledBy && !title ? {'aria-label': ariaLabel} : {})}\n type=\"checkbox\"\n id={idSwitch}\n name={name}\n onChange={handleChange}\n checked={value}\n disabled={isDisabled}\n className={style.checkbox}\n aria-labelledby={ariaLabelledBy}\n />\n <label htmlFor={idSwitch} data-name=\"input-switch-label\" tabIndex={0} />\n </div>\n </div>\n <div className={!details ? style.alignedTextContainer : null}>\n {titlePosition === 'right' ? titleView : null}\n {details ? <div className={style.detailsTxt}>{details}</div> : null}\n </div>\n {descriptionView}\n </div>\n );\n};\n\nInputSwitch.propTypes = {\n title: PropTypes.string,\n name: PropTypes.string,\n id: PropTypes.string,\n value: PropTypes.bool,\n disabled: PropTypes.bool,\n onChange: PropTypes.func,\n description: PropTypes.string,\n 'aria-labelledby': PropTypes.string,\n 'aria-label': PropTypes.string,\n modified: PropTypes.bool,\n titlePosition: PropTypes.oneOf(['right', 'left']),\n theme: PropTypes.oneOf(['default', 'coorpmanager', 'mooc']),\n details: PropTypes.string,\n 'data-name': PropTypes.string,\n requiredSelection: PropTypes.bool\n};\nexport default InputSwitch;\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;;;;;;;AAEA,MAAMA,WAAW,GAAGC,KAAK,IAAI;EAC3B,MAAM;IACJC,KADI;IAEJC,IAFI;IAGJC,EAHI;IAIJC,KAJI;IAKJC,QALI;IAMJC,QAAQ,iBANJ;IAOJC,WAPI;IAQJC,QAAQ,GAAG,KARP;IASJC,KAAK,GAAG,SATJ;IAUJC,aAAa,GAAG,MAVZ;IAWJC,OAAO,GAAG,EAXN;IAYJC,iBAAiB,GAAG,KAZhB;IAaJ,aAAaC,QAbT;IAcJ,mBAAmBC,cAdf;IAeJ,cAAcC;EAfV,IAgBFf,KAhBJ;EAkBA,MAAMgB,QAAQ,GAAGb,EAAE,IAAI,wBAAS,eAAT,CAAvB;EACA,MAAMc,UAAU,GAAGZ,QAAQ,GAAG,UAAH,GAAgB,EAA3C;EACA,MAAMa,YAAY,GAAG,IAAAC,cAAA,EAAQ,MAAMC,CAAC,IAAId,QAAQ,CAACc,CAAC,CAACC,MAAF,CAASC,OAAV,CAA3B,EAA+C,CAAChB,QAAD,CAA/C,CAArB;EAEA,MAAMiB,SAAS,GAAGtB,KAAK,gBACrB;IAAM,EAAE,EAAG,cAAaY,QAAS,EAAjC;IAAoC,SAAS,EAAEW,cAAA,CAAMvB;EAArD,GACI,GAAEA,KAAM,GADZ,EACgB,GADhB,CADqB,GAInB,IAJJ;EAMA,MAAMwB,eAAe,GAAGlB,WAAW,gBACjC;IAAK,SAAS,EAAEiB,cAAA,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AetB7B,iBAAiB,EAAE4B,kBAAA,CAAUE;AAfP,CAAxB;eAiBe3C,W"}
1
+ {"version":3,"file":"index.js","names":["InputSwitch","props","title","name","id","value","disabled","onChange","description","modified","theme","titlePosition","details","requiredSelection","dataName","ariaLabelledBy","ariaLabel","idSwitch","isDisabled","handleChange","useMemo","e","target","checked","titleView","style","descriptionView","getClass","defaultClass","coorpmanager","modifiedClass","coorpmanagerModified","partielUncheck","default","className","getClassState","btnSwitchContainer","checkbox","alignedTextContainer","detailsTxt","propTypes","PropTypes","string","bool","func","oneOf"],"sources":["../../../src/atom/input-switch/index.js"],"sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport {noop, uniqueId} from 'lodash/fp';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst InputSwitch = props => {\n const {\n title,\n name,\n id,\n value,\n disabled,\n onChange = noop,\n description,\n modified = false,\n theme = 'default',\n titlePosition = 'left',\n details = '',\n requiredSelection = false,\n 'data-name': dataName,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-label': ariaLabel\n } = props;\n\n const idSwitch = id || uniqueId('input-switch-');\n const isDisabled = disabled ? 'disabled' : '';\n const handleChange = useMemo(() => e => onChange(e.target.checked), [onChange]);\n\n const titleView = title ? (\n <span id={`title-view-${dataName}`} className={style.title}>\n {`${title} `}{' '}\n </span>\n ) : null;\n\n const descriptionView = description ? (\n <div className={style.description}>{description}</div>\n ) : null;\n\n const getClass = () => {\n switch (theme) {\n case 'coorpmanager':\n return {\n defaultClass: style.coorpmanager,\n modifiedClass: style.coorpmanagerModified\n };\n case 'mooc':\n return {\n defaultClass: style.partielUncheck,\n modifiedClass: style.coorpmanagerModified\n };\n default:\n return {defaultClass: style.default, modifiedClass: style.modified};\n }\n };\n const {defaultClass, modifiedClass} = getClass();\n const className = getClassState(defaultClass, modifiedClass, null, modified);\n\n return (\n <div className={className} data-name={`switch-input-${theme}${dataName}`}>\n {titlePosition === 'left' ? titleView : null}\n <div className={requiredSelection ? style.requiredSelection : null}>\n <div className={style.btnSwitchContainer}>\n <input\n {...(ariaLabelledBy ? {'aria-labelledby': ariaLabelledBy} : {})}\n {...(title ? {'aria-labelledby': `title-view-${dataName}`} : {})}\n {...(ariaLabel && !ariaLabelledBy && !title ? {'aria-label': ariaLabel} : {})}\n type=\"checkbox\"\n id={idSwitch}\n name={name}\n onChange={handleChange}\n checked={value}\n disabled={isDisabled}\n className={style.checkbox}\n aria-labelledby={ariaLabelledBy}\n />\n <label\n htmlFor={idSwitch}\n data-name=\"input-switch-label\"\n tabIndex={0}\n aria-label={ariaLabel}\n title={ariaLabel}\n />\n </div>\n </div>\n <div className={!details ? style.alignedTextContainer : null}>\n {titlePosition === 'right' ? titleView : null}\n {details ? <div className={style.detailsTxt}>{details}</div> : null}\n </div>\n {descriptionView}\n </div>\n );\n};\n\nInputSwitch.propTypes = {\n title: PropTypes.string,\n name: PropTypes.string,\n id: PropTypes.string,\n value: PropTypes.bool,\n disabled: PropTypes.bool,\n onChange: PropTypes.func,\n description: PropTypes.string,\n 'aria-labelledby': PropTypes.string,\n 'aria-label': PropTypes.string,\n modified: PropTypes.bool,\n titlePosition: PropTypes.oneOf(['right', 'left']),\n theme: PropTypes.oneOf(['default', 'coorpmanager', 'mooc']),\n details: PropTypes.string,\n 'data-name': PropTypes.string,\n requiredSelection: PropTypes.bool\n};\nexport default InputSwitch;\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;;;;;;;AAEA,MAAMA,WAAW,GAAGC,KAAK,IAAI;EAC3B,MAAM;IACJC,KADI;IAEJC,IAFI;IAGJC,EAHI;IAIJC,KAJI;IAKJC,QALI;IAMJC,QAAQ,iBANJ;IAOJC,WAPI;IAQJC,QAAQ,GAAG,KARP;IASJC,KAAK,GAAG,SATJ;IAUJC,aAAa,GAAG,MAVZ;IAWJC,OAAO,GAAG,EAXN;IAYJC,iBAAiB,GAAG,KAZhB;IAaJ,aAAaC,QAbT;IAcJ,mBA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AGtBtC,EAAE,EAAEqC,kBAAA,CAAUC,MAHQ;EAItBrC,KAAK,EAAEoC,kBAAA,CAAUE,IAJK;EAKtBrC,QAAQ,EAAEmC,kBAAA,CAAUE,IALE;EAMtBpC,QAAQ,EAAEkC,kBAAA,CAAUG,IANE;EAOtBpC,WAAW,EAAEiC,kBAAA,CAAUC,MAPD;EAQtB,mBAAmBD,kBAAA,CAAUC,MARP;EAStB,cAAcD,kBAAA,CAAUC,MATF;EAUtBjC,QAAQ,EAAEgC,kBAAA,CAAUE,IAVE;EAWtBhC,aAAa,EAAE8B,kBAAA,CAAUI,KAAV,CAAgB,CAAC,OAAD,EAAU,MAAV,CAAhB,CAXO;EAYtBnC,KAAK,EAAE+B,kBAAA,CAAUI,KAAV,CAAgB,CAAC,SAAD,EAAY,cAAZ,EAA4B,MAA5B,CAAhB,CAZe;EAatBjC,OAAO,EAAE6B,kBAAA,CAAUC,MAbG;EActB,aAAaD,kBAAA,CAAUC,MAdD;EAetB7B,iBAAiB,EAAE4B,kBAAA,CAAUE;AAfP,CAAxB;eAiBe3C,W"}
@@ -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,4 +1,3 @@
1
- export function useChoices(options: any): ((choice: any) => void)[];
2
1
  export default SelectMultiple;
3
2
  declare function SelectMultiple({ title, options, theme, placeholder, description, hint, multiple, onChange, onError, modified, error, disabled }: {
4
3
  title: 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":";AA+DA;;;;;;;;;;;;;;;gBA8KC"}
@@ -1,14 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.useChoices = exports.default = void 0;
4
+ exports.default = void 0;
5
5
 
6
6
  var _isEmpty2 = _interopRequireDefault(require("lodash/fp/isEmpty"));
7
7
 
8
8
  var _keys2 = _interopRequireDefault(require("lodash/fp/keys"));
9
9
 
10
- var _set2 = _interopRequireDefault(require("lodash/fp/set"));
11
-
12
10
  var _get2 = _interopRequireDefault(require("lodash/fp/get"));
13
11
 
14
12
  var _filter2 = _interopRequireDefault(require("lodash/fp/filter"));
@@ -50,26 +48,17 @@ const themeStyle = {
50
48
  cockpit: _style.default.cockpit,
51
49
  sidebar: _style.default.sidebar,
52
50
  coorpmanager: _style.default.coorpmanager
53
- };
54
-
55
- const useChoices = options => {
56
- const choicesRef = {
57
- current: options
58
- };
59
-
60
- const getChoices = () => {
61
- return choicesRef.current;
62
- };
63
-
64
- const setChoices = choice => {
65
- const choices = (0, _set2.default)(`[${choice.i}].selected`, !choice.selected, getChoices());
66
- choicesRef.current = choices.filter(c => c.selected);
67
- };
68
-
69
- return [getChoices, setChoices];
70
- };
71
-
72
- exports.useChoices = useChoices;
51
+ }; // export const useChoices = options => {
52
+ // const choicesRef = {current: options};
53
+ // const getChoices = () => {
54
+ // return choicesRef.current;
55
+ // };
56
+ // const setChoices = choice => {
57
+ // const choices = set(`[${choice.i}].selected`, !choice.selected, getChoices());
58
+ // choicesRef.current = choices.filter(c => c.selected);
59
+ // };
60
+ // return [getChoices, setChoices];
61
+ // };
73
62
 
74
63
  const CMMultipleView = ({
75
64
  multiple,
@@ -112,8 +101,8 @@ const SelectMultiple = ({
112
101
  }, {
113
102
  skin
114
103
  }) => {
115
- const [isOpened, updateIsOpened] = (0, _react.useState)(false);
116
- const [getChoices, setChoices] = useChoices(options);
104
+ const [isOpened, updateIsOpened] = (0, _react.useState)(false); // const [getChoices, setChoices] = useChoices(options);
105
+
117
106
  const nodeRef = (0, _react.useRef)(null);
118
107
  const defaultColor = (0, _get2.default)('common.primary', skin);
119
108
  const black = (0, _get2.default)('common.black', skin);
@@ -129,16 +118,9 @@ const SelectMultiple = ({
129
118
  }
130
119
  }, []);
131
120
  const handleChange = (0, _react.useCallback)(choice => {
132
- // if multiple prop is turned on
133
- // we return all selected choices
134
- if (multiple) {
135
- setChoices(choice);
136
- return onChange(getChoices());
137
- }
138
-
139
121
  updateIsOpened(false);
140
122
  return onChange(choice);
141
- }, [multiple, onChange, setChoices, getChoices]);
123
+ }, [onChange]);
142
124
  (0, _react.useEffect)(() => {
143
125
  document.addEventListener('click', closeHandle);
144
126
  document.addEventListener('touchstart', closeHandle);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["themeStyle","setup","style","cockpit","sidebar","coorpmanager","useChoices","options","choicesRef","current","getChoices","setChoices","choice","choices","i","selected","filter","c","CMMultipleView","multiple","onChange","handleChange","useCallback","checked","item","name","SelectMultiple","title","theme","placeholder","description","hint","onError","modified","error","disabled","skin","isOpened","updateIsOpened","useState","nodeRef","useRef","defaultColor","black","handleOnClick","e","preventDefault","stopPropagation","prev","closeHandle","contains","target","useEffect","document","addEventListener","removeEventListener","isCMTheme","handleOnClickOnListElement","lines","convert","cap","selection","isActive","titleView","classnames","titleWithSelection","noValue","active","infoIconWrapper","infoIcon","descriptionLabel","hintView","hideHint","__html","mainClass","default","showPlaceholder","behaviourClassName","getClassState","errorIconView","errorIcon","select","noselection","iconsWrapper","flex","clicked","color","arrow","down","activeChoices","list","contextTypes","Provider","childContextTypes","propTypes","PropTypes","bool","TitledCheckbox","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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AxE,cAAc,CAACoE,SAAf,2CAA2B;EACzBnE,KAAK,EAAEoE,kBAAA,CAAUI,MADQ;EAEzBtE,WAAW,EAAEkE,kBAAA,CAAUI,MAFE;EAGzBrE,WAAW,EAAEiE,kBAAA,CAAUI,MAHE;EAIzBpE,IAAI,EAAEgE,kBAAA,CAAUI,MAJS;EAKzB5F,OAAO,EAAEwF,kBAAA,CAAUK,OAAV,CAAkBH,uBAAA,CAAeH,SAAf,CAAyBlF,MAA3C,CALgB;EAMzBQ,QAAQ,EAAE2E,kBAAA,CAAUG,IANK;EAOzBlE,OAAO,EAAE+D,kBAAA,CAAUG,IAPM;EAQzB/E,QAAQ,EAAE4E,kBAAA,CAAUC,IARK;EASzB/D,QAAQ,EAAE8D,kBAAA,CAAUC,IATK;EAUzB7D,QAAQ,EAAE4D,kBAAA,CAAUC,IAVK;EAWzB9D,KAAK,EAAE6D,kBAAA,CAAUI,MAXQ;EAYzBvE,KAAK,EAAEmE,kBAAA,CAAUM,KAAV,CAAgB,oBAAKrG,UAAL,CAAhB;AAZkB,CAA3B;eAee0B,c"}
1
+ {"version":3,"file":"index.js","names":["themeStyle","setup","style","cockpit","sidebar","coorpmanager","CMMultipleView","multiple","choice","onChange","handleChange","useCallback","checked","selected","item","name","SelectMultiple","title","options","theme","placeholder","description","hint","onError","modified","error","disabled","skin","isOpened","updateIsOpened","useState","nodeRef","useRef","defaultColor","black","handleOnClick","e","preventDefault","stopPropagation","prev","closeHandle","current","contains","target","useEffect","document","addEventListener","removeEventListener","isCMTheme","handleOnClickOnListElement","lines","convert","cap","i","selection","isActive","titleView","classnames","titleWithSelection","noValue","active","infoIconWrapper","infoIcon","descriptionLabel","hintView","hideHint","__html","mainClass","default","showPlaceholder","behaviourClassName","getClassState","errorIconView","errorIcon","select","noselection","iconsWrapper","flex","clicked","color","arrow","down","choices","activeChoices","list","contextTypes","Provider","childContextTypes","propTypes","PropTypes","bool","TitledCheckbox","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\n// export 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 updateIsOpened(false);\n return onChange(choice);\n },\n [onChange]\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;;AACA;;AACA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,UAAU,GAAG;EACjBC,KAAK,EAAEC,cAAA,CAAMD,K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AAsE,IA1CzE,EA2CG2C,QA3CH,CADF;AA+CD,CA9KD;;AAgLAhD,cAAc,CAACqE,YAAf,GAA8B;EAC5B1D,IAAI,EAAE2D,iBAAA,CAASC,iBAAT,CAA2B5D;AADL,CAA9B;AAIArB,cAAc,CAACkF,SAAf,2CAA2B;EACzBjF,QAAQ,EAAEkF,kBAAA,CAAUC,IADK;EAEzBlF,MAAM,EAAEmF,uBAAA,CAAeH,SAAf,CAAyBhF,MAFR;EAGzBC,QAAQ,EAAEgF,kBAAA,CAAUG;AAHK,CAA3B;AAMA5E,cAAc,CAACwE,SAAf,2CAA2B;EACzBvE,KAAK,EAAEwE,kBAAA,CAAUI,MADQ;EAEzBzE,WAAW,EAAEqE,kBAAA,CAAUI,MAFE;EAGzBxE,WAAW,EAAEoE,kBAAA,CAAUI,MAHE;EAIzBvE,IAAI,EAAEmE,kBAAA,CAAUI,MAJS;EAKzB3E,OAAO,EAAEuE,kBAAA,CAAUK,OAAV,CAAkBH,uBAAA,CAAeH,SAAf,CAAyBhF,MAA3C,CALgB;EAMzBC,QAAQ,EAAEgF,kBAAA,CAAUG,IANK;EAOzBrE,OAAO,EAAEkE,kBAAA,CAAUG,IAPM;EAQzBrF,QAAQ,EAAEkF,kBAAA,CAAUC,IARK;EASzBlE,QAAQ,EAAEiE,kBAAA,CAAUC,IATK;EAUzBhE,QAAQ,EAAE+D,kBAAA,CAAUC,IAVK;EAWzBjE,KAAK,EAAEgE,kBAAA,CAAUI,MAXQ;EAYzB1E,KAAK,EAAEsE,kBAAA,CAAUM,KAAV,CAAgB,oBAAK/F,UAAL,CAAhB;AAZkB,CAA3B;eAeegB,c"}
@@ -451,7 +451,7 @@
451
451
  .coorpmanager .errorIcon {
452
452
  background-color: cm_negative_100;
453
453
  color: white;
454
- padding: 4px;
454
+ 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"}
@@ -17,6 +17,8 @@ var _provider = _interopRequireDefault(require("../../atom/provider"));
17
17
 
18
18
  var _button = _interopRequireDefault(require("../../atom/button"));
19
19
 
20
+ var _buttonLink = _interopRequireDefault(require("../../atom/button-link"));
21
+
20
22
  var _link = _interopRequireDefault(require("../../atom/link"));
21
23
 
22
24
  var _loader = _interopRequireDefault(require("../../atom/loader"));
@@ -29,7 +31,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
29
31
 
30
32
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
33
 
32
- const buildButtonSection = (onSubmit, submitValue, onReset, resetValue, tooltip, disabled, isModified, isPending, darkColor) => {
34
+ const buildButtonSection = (onSubmit, submitValue, onReset, resetValue, tooltip, disabled, isModified, isPending, darkColor, theme) => {
33
35
  if (!onSubmit && !onReset) {
34
36
  return null;
35
37
  }
@@ -39,7 +41,14 @@ const buildButtonSection = (onSubmit, submitValue, onReset, resetValue, tooltip,
39
41
  "data-tip": tooltip.title,
40
42
  "data-for": "submitButton",
41
43
  className: _style.default.saveButton
42
- }, /*#__PURE__*/_react.default.createElement(_button.default, {
44
+ }, theme === 'coorpmanager' ? /*#__PURE__*/_react.default.createElement(_buttonLink.default, {
45
+ type: "primary",
46
+ label: submitValue,
47
+ disabled: disabledSubmit,
48
+ "data-testid": "submit-button",
49
+ buttonType: "submit",
50
+ onClick: onSubmit
51
+ }) : /*#__PURE__*/_react.default.createElement(_button.default, {
43
52
  type: "submit",
44
53
  disabled: disabledSubmit,
45
54
  submitValue: submitValue
@@ -59,7 +68,7 @@ const buildButtonSection = (onSubmit, submitValue, onReset, resetValue, tooltip,
59
68
  }, submitButton, resetButton);
60
69
  };
61
70
 
62
- function BrandForm(props, context) {
71
+ const BrandForm = (props, context) => {
63
72
  const {
64
73
  groups,
65
74
  disabled,
@@ -71,7 +80,8 @@ function BrandForm(props, context) {
71
80
  resetValue,
72
81
  back,
73
82
  tooltip,
74
- isLoading
83
+ isLoading,
84
+ theme
75
85
  } = props;
76
86
  const {
77
87
  skin
@@ -94,7 +104,7 @@ function BrandForm(props, context) {
94
104
  key: index
95
105
  }, /*#__PURE__*/_react.default.createElement(_brandFormGroup.default, group));
96
106
  });
97
- const buttonSection = buildButtonSection(onSubmit, submitValue, onReset, resetValue, tooltip, disabled, isModified, isPending, darkColor);
107
+ const buttonSection = buildButtonSection(onSubmit, submitValue, onReset, resetValue, tooltip, disabled, isModified, isPending, darkColor, theme);
98
108
  const handleSubmit = (0, _react.useMemo)(() => e => {
99
109
  e.preventDefault();
100
110
  return onSubmit(e);
@@ -113,7 +123,7 @@ function BrandForm(props, context) {
113
123
  onReset: handleReset,
114
124
  className: _style.default.form
115
125
  }, brandGroups, buttonSection));
116
- }
126
+ };
117
127
 
118
128
  BrandForm.contextTypes = {
119
129
  skin: _provider.default.childContextTypes.skin
@@ -141,7 +151,8 @@ BrandForm.propTypes = process.env.NODE_ENV !== "production" ? {
141
151
  title: _propTypes.default.string,
142
152
  place: _propTypes.default.string
143
153
  }),
144
- isLoading: _propTypes.default.bool
154
+ isLoading: _propTypes.default.bool,
155
+ theme: _propTypes.default.string
145
156
  } : {};
146
157
  var _default = BrandForm;
147
158
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["buildButtonSection","onSubmit","submitValue","onReset","resetValue","tooltip","disabled","isModified","isPending","darkColor","disabledSubmit","submitButton","title","style","saveButton","cancelBackground","backgroundColor","resetButton","buttons","BrandForm","props","context","groups","back","isLoading","skin","backView","color","arrowBack","link","backDesc","desc","brandGroups","map","group","index","buttonSection","handleSubmit","useMemo","e","preventDefault","handleReset","loaderContainer","loader","form","contextTypes","Provider","childContextTypes","defaultProps","place","propTypes","PropTypes","arrayOf","shape","BrandFormGroup","isRequired","bool","func","Button","Link","children","href","string"],"sources":["../../../src/organism/brand-form/index.js"],"sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport {get} from 'lodash/fp';\nimport {NovaCompositionNavigationArrowLeft as ArrowLeft} from '@coorpacademy/nova-icons';\nimport BrandFormGroup from '../../molecule/brand-form-group';\nimport Provider from '../../atom/provider';\nimport Button from '../../atom/button';\nimport Link from '../../atom/link';\nimport Loader from '../../atom/loader';\nimport style from './style.css';\n\nconst buildButtonSection = (\n onSubmit,\n submitValue,\n onReset,\n resetValue,\n tooltip,\n disabled,\n isModified,\n isPending,\n darkColor\n) => {\n if (!onSubmit && !onReset) {\n return null;\n }\n\n const disabledSubmit = disabled || isPending || !isModified;\n const submitButton = onSubmit ? (\n <div data-tip={tooltip.title} data-for=\"submitButton\" className={style.saveButton}>\n <Button type=\"submit\" disabled={disabledSubmit} submitValue={submitValue} />\n </div>\n ) : null;\n\n const cancelBackground = {backgroundColor: darkColor};\n\n const resetButton = onReset ? (\n <div className={style.resetButton}>\n <Button type=\"reset\" submitValue={resetValue} style={cancelBackground} />\n </div>\n ) : null;\n\n return (\n <div className={style.buttons}>\n {submitButton}\n {resetButton}\n </div>\n );\n};\n\nfunction BrandForm(props, context) {\n const {\n groups,\n disabled,\n isModified,\n isPending,\n onSubmit,\n submitValue,\n onReset,\n resetValue,\n back,\n tooltip,\n isLoading\n } = props;\n const {skin} = context;\n const darkColor = get('common.dark', skin);\n\n const backView = back ? (\n <p className={style.back}>\n <ArrowLeft style={{color: darkColor}} className={style.arrowBack} />\n <Link href={back.link} className={style.backDesc}>\n {back.desc}\n </Link>\n </p>\n ) : null;\n\n const brandGroups = groups.map((group, index) => {\n return (\n <div className={style.group} key={index}>\n <BrandFormGroup {...group} />\n </div>\n );\n });\n\n const buttonSection = buildButtonSection(\n onSubmit,\n submitValue,\n onReset,\n resetValue,\n tooltip,\n disabled,\n isModified,\n isPending,\n darkColor\n );\n\n const handleSubmit = useMemo(\n () => e => {\n e.preventDefault();\n return onSubmit(e);\n },\n [onSubmit]\n );\n\n const handleReset = useMemo(\n () => e => {\n e.preventDefault();\n return onReset(e);\n },\n [onReset]\n );\n\n return (\n <div>\n {backView}\n {isLoading ? (\n <div className={style.loaderContainer}>\n <Loader className={style.loader} theme=\"coorpmanager\" />\n </div>\n ) : (\n <form onSubmit={handleSubmit} onReset={handleReset} className={style.form}>\n {brandGroups}\n {buttonSection}\n </form>\n )}\n </div>\n );\n}\n\nBrandForm.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nBrandForm.defaultProps = {\n tooltip: {\n title: '',\n place: 'top'\n }\n};\n\nBrandForm.propTypes = {\n groups: PropTypes.arrayOf(PropTypes.shape(BrandFormGroup.propTypes)).isRequired,\n disabled: PropTypes.bool,\n isModified: PropTypes.bool,\n isPending: PropTypes.bool,\n onSubmit: PropTypes.func,\n submitValue: Button.propTypes.submitValue,\n onReset: PropTypes.func,\n resetValue: Button.propTypes.submitValue,\n back: PropTypes.shape({\n desc: Link.propTypes.children,\n link: Link.propTypes.href\n }),\n tooltip: PropTypes.shape({\n title: PropTypes.string,\n place: PropTypes.string\n }),\n isLoading: PropTypes.bool\n};\n\nexport default BrandForm;\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAEA,MAAMA,kBAAkB,GAAG,CACzBC,QADyB,EAEzBC,WAFyB,EAGzBC,OAHyB,EAIzBC,UAJyB,EAKzBC,OALyB,EAMzBC,QANyB,EAOzBC,UAPyB,EAQzBC,SARyB,EASzBC,SATyB,KAUtB;EACH,IAAI,CAACR,QAAD,IAAa,CAACE,OAAlB,EAA2B;IACzB,OAAO,IAAP;EACD;;EAED,MAAMO,cAAc,GAAGJ,QAAQ,IAAIE,SAAZ,IAAyB,CAACD,UAAjD;EACA,MAAMI,YAAY,GAAGV,QAAQ,gBAC3B;IAAK,YAAUI,OAAO,CAACO,KAAvB;IAA8B,YAAS,cAAvC;IAAsD,SAAS,EAAEC,cAAA,CAAMC;EAAvE,gBACE,6BAAC,eAAD;IAAQ,IAAI,EAAC,QAAb;IAAsB,QAAQ,EAAEJ,cAAhC;IAAgD,WAAW,EAAER;EAA7D,EADF,CAD2B,GAIzB,IAJJ;EAMA,MAAMa,gBAAgB,GAAG;IAACC,eAAe,EAAEP;EAAlB,CAAzB;EAEA,MAAMQ,WAAW,GAAGd,OAAO,gBACzB;IAAK,SAAS,EAAEU,cAAA,CAAMI;EAAtB,gBACE,6BAAC,eAAD;IAAQ,IAAI,EAAC,OAAb;IAAqB,WAAW,EAAEb,UAAlC;IAA8C,KAAK,EAAEW;EAArD,EADF,CADyB,GAIvB,IAJJ;EAMA,oBACE;IAAK,SAAS,EAAEF,cAAA,CAAMK;EAAtB,GACGP,YADH,EAEGM,WAFH,CADF;AAMD,CApCD;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AiBhD,WART;EASpBqB,IAAI,EAAE4B,kBAAA,CAAUE,KAAV,CAAgB;IACpBtB,IAAI,EAAE4B,aAAA,CAAKT,SAAL,CAAeU,QADD;IAEpB/B,IAAI,EAAE8B,aAAA,CAAKT,SAAL,CAAeW;EAFD,CAAhB,CATc;EAapBxD,OAAO,EAAE8C,kBAAA,CAAUE,KAAV,CAAgB;IACvBzC,KAAK,EAAEuC,kBAAA,CAAUW,MADM;IAEvBb,KAAK,EAAEE,kBAAA,CAAUW;EAFM,CAAhB,CAbW;EAiBpBtC,SAAS,EAAE2B,kBAAA,CAAUK;AAjBD,CAAtB;eAoBerC,S"}
1
+ {"version":3,"file":"index.js","names":["buildButtonSection","onSubmit","submitValue","onReset","resetValue","tooltip","disabled","isModified","isPending","darkColor","theme","disabledSubmit","submitButton","title","style","saveButton","cancelBackground","backgroundColor","resetButton","buttons","BrandForm","props","context","groups","back","isLoading","skin","backView","color","arrowBack","link","backDesc","desc","brandGroups","map","group","index","buttonSection","handleSubmit","useMemo","e","preventDefault","handleReset","loaderContainer","loader","form","contextTypes","Provider","childContextTypes","defaultProps","place","propTypes","PropTypes","arrayOf","shape","BrandFormGroup","isRequired","bool","func","Button","Link","children","href","string"],"sources":["../../../src/organism/brand-form/index.js"],"sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport {get} from 'lodash/fp';\nimport {NovaCompositionNavigationArrowLeft as ArrowLeft} from '@coorpacademy/nova-icons';\nimport BrandFormGroup from '../../molecule/brand-form-group';\nimport Provider from '../../atom/provider';\nimport Button from '../../atom/button';\nimport ButtonLink from '../../atom/button-link';\nimport Link from '../../atom/link';\nimport Loader from '../../atom/loader';\nimport style from './style.css';\n\nconst buildButtonSection = (\n onSubmit,\n submitValue,\n onReset,\n resetValue,\n tooltip,\n disabled,\n isModified,\n isPending,\n darkColor,\n theme\n) => {\n if (!onSubmit && !onReset) {\n return null;\n }\n\n const disabledSubmit = disabled || isPending || !isModified;\n const submitButton = onSubmit ? (\n <div data-tip={tooltip.title} data-for=\"submitButton\" className={style.saveButton}>\n {theme === 'coorpmanager' ? (\n <ButtonLink\n type=\"primary\"\n label={submitValue}\n disabled={disabledSubmit}\n data-testid=\"submit-button\"\n buttonType=\"submit\"\n onClick={onSubmit}\n />\n ) : (\n <Button type=\"submit\" disabled={disabledSubmit} submitValue={submitValue} />\n )}\n </div>\n ) : null;\n\n const cancelBackground = {backgroundColor: darkColor};\n\n const resetButton = onReset ? (\n <div className={style.resetButton}>\n <Button type=\"reset\" submitValue={resetValue} style={cancelBackground} />\n </div>\n ) : null;\n\n return (\n <div className={style.buttons}>\n {submitButton}\n {resetButton}\n </div>\n );\n};\nconst BrandForm = (props, context) => {\n const {\n groups,\n disabled,\n isModified,\n isPending,\n onSubmit,\n submitValue,\n onReset,\n resetValue,\n back,\n tooltip,\n isLoading,\n theme\n } = props;\n const {skin} = context;\n const darkColor = get('common.dark', skin);\n\n const backView = back ? (\n <p className={style.back}>\n <ArrowLeft style={{color: darkColor}} className={style.arrowBack} />\n <Link href={back.link} className={style.backDesc}>\n {back.desc}\n </Link>\n </p>\n ) : null;\n\n const brandGroups = groups.map((group, index) => {\n return (\n <div className={style.group} key={index}>\n <BrandFormGroup {...group} />\n </div>\n );\n });\n\n const buttonSection = buildButtonSection(\n onSubmit,\n submitValue,\n onReset,\n resetValue,\n tooltip,\n disabled,\n isModified,\n isPending,\n darkColor,\n theme\n );\n\n const handleSubmit = useMemo(\n () => e => {\n e.preventDefault();\n return onSubmit(e);\n },\n [onSubmit]\n );\n\n const handleReset = useMemo(\n () => e => {\n e.preventDefault();\n return onReset(e);\n },\n [onReset]\n );\n\n return (\n <div>\n {backView}\n {isLoading ? (\n <div className={style.loaderContainer}>\n <Loader className={style.loader} theme=\"coorpmanager\" />\n </div>\n ) : (\n <form onSubmit={handleSubmit} onReset={handleReset} className={style.form}>\n {brandGroups}\n {buttonSection}\n </form>\n )}\n </div>\n );\n};\n\nBrandForm.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nBrandForm.defaultProps = {\n tooltip: {\n title: '',\n place: 'top'\n }\n};\n\nBrandForm.propTypes = {\n groups: PropTypes.arrayOf(PropTypes.shape(BrandFormGroup.propTypes)).isRequired,\n disabled: PropTypes.bool,\n isModified: PropTypes.bool,\n isPending: PropTypes.bool,\n onSubmit: PropTypes.func,\n submitValue: Button.propTypes.submitValue,\n onReset: PropTypes.func,\n resetValue: Button.propTypes.submitValue,\n back: PropTypes.shape({\n desc: Link.propTypes.children,\n link: Link.propTypes.href\n }),\n tooltip: PropTypes.shape({\n title: PropTypes.string,\n place: PropTypes.string\n }),\n isLoading: PropTypes.bool,\n theme: PropTypes.string\n};\n\nexport default BrandForm;\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAEA,MAAMA,kBAAkB,GAAG,CACzBC,QADyB,EAEzBC,WAFyB,EAGzBC,OAHyB,EAIzBC,UAJyB,EAKzBC,OALyB,EAMzBC,QANyB,EAOzBC,UAPyB,EAQzBC,SARyB,EASzBC,SATyB,EAUzBC,KAVyB,KAWtB;EACH,IAAI,CAACT,QAAD,IAAa,CAACE,OAAlB,EAA2B;IACzB,OAAO,IAAP;EACD;;EAED,MAAMQ,cAAc,GAAGL,QAAQ,IAAIE,SAAZ,IAAyB,CAACD,UAAjD;EACA,MAAMK,YAAY,GAAGX,QAAQ,gBAC3B;IAAK,YAAUI,OAAO,CAACQ,KAAvB;IAA8B,YAAS,cAAvC;IAAsD,SAAS,EAAEC,cAAA,CAAMC;EAAvE,GACGL,KAAK,KAAK,cAAV,gBACC,6BAAC,mBAAD;IACE,IAAI,EAAC,SADP;IAEE,KAAK,EAAER,WAFT;IAGE,QAAQ,EAAES,cAHZ;IAIE,eAAY,eAJd;IAKE,UAAU,EAAC,QALb;IAME,OAAO,EAAEV;EANX,EADD,gBAUC,6BAAC,eAAD;IAAQ,IAAI,EAAC,QAAb;IAAsB,QA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