@coorpacademy/components 10.1.0 → 10.1.1
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.
- package/es/atom/input-text/index.js +34 -6
- package/es/atom/input-text/index.js.map +1 -1
- package/es/atom/input-text/style.css +224 -1
- package/es/atom/input-text/test/fixtures/cm-default.js +17 -0
- package/es/atom/input-text/test/fixtures/cm-default.js.map +1 -0
- package/es/molecule/wizard-summary/index.js +160 -0
- package/es/molecule/wizard-summary/index.js.map +1 -0
- package/es/molecule/wizard-summary/style.css +150 -0
- package/es/molecule/wizard-summary/test/fixtures/default.js +117 -0
- package/es/molecule/wizard-summary/test/fixtures/default.js.map +1 -0
- package/es/molecule/wizard-summary/test/fixtures/one-section.js +22 -0
- package/es/molecule/wizard-summary/test/fixtures/one-section.js.map +1 -0
- package/es/molecule/wizard-summary/test/fixtures/three-sections.js +41 -0
- package/es/molecule/wizard-summary/test/fixtures/three-sections.js.map +1 -0
- package/es/molecule/wizard-summary/test/fixtures/two-sections.js +34 -0
- package/es/molecule/wizard-summary/test/fixtures/two-sections.js.map +1 -0
- package/es/organism/user-preferences/style.css +1 -0
- package/es/variables/colors.css +4 -0
- package/lib/atom/input-text/index.js +36 -6
- package/lib/atom/input-text/index.js.map +1 -1
- package/lib/atom/input-text/style.css +224 -1
- package/lib/atom/input-text/test/fixtures/cm-default.js +22 -0
- package/lib/atom/input-text/test/fixtures/cm-default.js.map +1 -0
- package/lib/molecule/wizard-summary/index.js +177 -0
- package/lib/molecule/wizard-summary/index.js.map +1 -0
- package/lib/molecule/wizard-summary/style.css +150 -0
- package/lib/molecule/wizard-summary/test/fixtures/default.js +122 -0
- package/lib/molecule/wizard-summary/test/fixtures/default.js.map +1 -0
- package/lib/molecule/wizard-summary/test/fixtures/one-section.js +27 -0
- package/lib/molecule/wizard-summary/test/fixtures/one-section.js.map +1 -0
- package/lib/molecule/wizard-summary/test/fixtures/three-sections.js +46 -0
- package/lib/molecule/wizard-summary/test/fixtures/three-sections.js.map +1 -0
- package/lib/molecule/wizard-summary/test/fixtures/two-sections.js +39 -0
- package/lib/molecule/wizard-summary/test/fixtures/two-sections.js.map +1 -0
- package/lib/organism/user-preferences/style.css +1 -0
- package/lib/variables/colors.css +4 -0
- package/package.json +3 -3
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
import _isEmpty from "lodash/fp/isEmpty";
|
|
1
2
|
import _keys from "lodash/fp/keys";
|
|
2
3
|
import _isNil from "lodash/fp/isNil";
|
|
3
4
|
import _noop from "lodash/fp/noop";
|
|
4
5
|
import React, { useMemo } from 'react';
|
|
5
6
|
import PropTypes from 'prop-types';
|
|
7
|
+
import { NovaSolidStatusCheckCircle2 as CheckIcon, NovaSolidStatusClose as ErrorIcon, NovaCompositionCoorpacademyInformationIcon as InfoIcon } from '@coorpacademy/nova-icons';
|
|
6
8
|
import classnames from 'classnames';
|
|
7
9
|
import getClassState from '../../util/get-class-state';
|
|
8
10
|
import style from './style.css';
|
|
9
11
|
const themeStyle = {
|
|
10
12
|
setup: style.setup,
|
|
13
|
+
coorpmanager: style.coorpmanager,
|
|
11
14
|
cockpit: style.cockpit,
|
|
12
15
|
default: style.default
|
|
13
16
|
};
|
|
@@ -17,9 +20,11 @@ const InputText = props => {
|
|
|
17
20
|
autoFocus = false,
|
|
18
21
|
placeholder = '',
|
|
19
22
|
value,
|
|
23
|
+
hint,
|
|
20
24
|
defaultValue,
|
|
21
25
|
onChange = _noop,
|
|
22
26
|
error,
|
|
27
|
+
valid,
|
|
23
28
|
theme = 'default',
|
|
24
29
|
description,
|
|
25
30
|
disabled,
|
|
@@ -31,25 +36,46 @@ const InputText = props => {
|
|
|
31
36
|
const handleChange = useMemo(() => e => onChange(e.target.value), [onChange]);
|
|
32
37
|
const mainClass = themeStyle[theme];
|
|
33
38
|
const className = getClassState(style.default, style.modified, style.error, modified, error);
|
|
34
|
-
const descriptionView = description ? /*#__PURE__*/React.createElement("div", {
|
|
39
|
+
const descriptionView = description && theme !== 'coorpmanager' ? /*#__PURE__*/React.createElement("div", {
|
|
35
40
|
className: style.description
|
|
36
41
|
}, description) : null;
|
|
42
|
+
const toolTipView = description && theme === 'coorpmanager' ? /*#__PURE__*/React.createElement("div", {
|
|
43
|
+
className: style.infoIconWrapper
|
|
44
|
+
}, /*#__PURE__*/React.createElement(InfoIcon, {
|
|
45
|
+
className: style.infoIcon
|
|
46
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
47
|
+
className: style.descriptionLabel
|
|
48
|
+
}, description)) : null;
|
|
49
|
+
const hintView = error || hint ? /*#__PURE__*/React.createElement("div", {
|
|
50
|
+
className: style.hint // eslint-disable-next-line react/no-danger
|
|
51
|
+
,
|
|
52
|
+
dangerouslySetInnerHTML: {
|
|
53
|
+
__html: error || hint
|
|
54
|
+
}
|
|
55
|
+
}) : null;
|
|
56
|
+
const errorIconView = error ? /*#__PURE__*/React.createElement(ErrorIcon, {
|
|
57
|
+
className: style.leftIcon
|
|
58
|
+
}) : null;
|
|
59
|
+
const validIconView = valid ? /*#__PURE__*/React.createElement(CheckIcon, {
|
|
60
|
+
className: style.leftIcon
|
|
61
|
+
}) : null;
|
|
37
62
|
return /*#__PURE__*/React.createElement("div", {
|
|
38
|
-
className: classnames(mainClass, className, _isNil(propsTitle) && style.isNoTitle)
|
|
63
|
+
className: classnames(mainClass, className, disabled && style.disabled, _isNil(propsTitle) && style.isNoTitle)
|
|
39
64
|
}, /*#__PURE__*/React.createElement("label", null, /*#__PURE__*/React.createElement("span", {
|
|
40
|
-
className: style.title
|
|
41
|
-
}, title), /*#__PURE__*/React.createElement("input", {
|
|
65
|
+
className: classnames(style.title, _isEmpty(value) && style.noValue)
|
|
66
|
+
}, title, toolTipView), /*#__PURE__*/React.createElement("input", {
|
|
42
67
|
autoFocus: autoFocus,
|
|
43
68
|
type: "text",
|
|
44
69
|
name: title,
|
|
45
70
|
className: style.input,
|
|
46
71
|
placeholder: placeholder,
|
|
47
72
|
defaultValue: defaultValue,
|
|
73
|
+
autoComplete: 'off',
|
|
48
74
|
value: value,
|
|
49
75
|
onInput: handleChange,
|
|
50
76
|
disabled: disabled,
|
|
51
77
|
onChange: _noop
|
|
52
|
-
})), descriptionView);
|
|
78
|
+
}), errorIconView, validIconView, hintView), descriptionView);
|
|
53
79
|
};
|
|
54
80
|
|
|
55
81
|
InputText.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
@@ -61,10 +87,12 @@ InputText.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
61
87
|
disabled: PropTypes.bool,
|
|
62
88
|
required: PropTypes.bool,
|
|
63
89
|
value: PropTypes.string,
|
|
90
|
+
hint: PropTypes.string,
|
|
64
91
|
error: PropTypes.string,
|
|
65
92
|
onChange: PropTypes.func,
|
|
66
93
|
description: PropTypes.string,
|
|
67
|
-
modified: PropTypes.bool
|
|
94
|
+
modified: PropTypes.bool,
|
|
95
|
+
valid: PropTypes.bool
|
|
68
96
|
} : {};
|
|
69
97
|
export default InputText;
|
|
70
98
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/atom/input-text/index.js"],"names":["React","useMemo","PropTypes","classnames","getClassState","style","themeStyle","setup","cockpit","default","InputText","props","autoFocus","placeholder","value","defaultValue","onChange","error","theme","description","disabled","required","modified","title","propsTitle","handleChange","e","target","mainClass","className","descriptionView","isNoTitle","input","propTypes","bool","string","oneOf","func"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/atom/input-text/index.js"],"names":["React","useMemo","PropTypes","NovaSolidStatusCheckCircle2","CheckIcon","NovaSolidStatusClose","ErrorIcon","NovaCompositionCoorpacademyInformationIcon","InfoIcon","classnames","getClassState","style","themeStyle","setup","coorpmanager","cockpit","default","InputText","props","autoFocus","placeholder","value","hint","defaultValue","onChange","error","valid","theme","description","disabled","required","modified","title","propsTitle","handleChange","e","target","mainClass","className","descriptionView","toolTipView","infoIconWrapper","infoIcon","descriptionLabel","hintView","__html","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AAW,EAAE1B,SAAS,CAACoD,MAZH;AAapBvB,EAAAA,QAAQ,EAAE7B,SAAS,CAACmD,IAbA;AAcpB3B,EAAAA,KAAK,EAAExB,SAAS,CAACmD;AAdG,CAAtB;AAgBA,eAAepC,SAAf","sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport {noop, isNil, keys, isEmpty} from 'lodash/fp';\nimport {\n NovaSolidStatusCheckCircle2 as CheckIcon,\n NovaSolidStatusClose as ErrorIcon,\n NovaCompositionCoorpacademyInformationIcon as InfoIcon\n} from '@coorpacademy/nova-icons';\nimport classnames from 'classnames';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst themeStyle = {\n setup: style.setup,\n coorpmanager: style.coorpmanager,\n cockpit: style.cockpit,\n default: style.default\n};\nconst InputText = props => {\n const {\n autoFocus = false,\n placeholder = '',\n value,\n hint,\n defaultValue,\n onChange = noop,\n error,\n valid,\n theme = 'default',\n description,\n disabled,\n required,\n modified = false,\n title: propsTitle\n } = props;\n\n const title = `${propsTitle}${required ? '*' : ''}`;\n const handleChange = useMemo(() => e => onChange(e.target.value), [onChange]);\n const mainClass = themeStyle[theme];\n const className = getClassState(style.default, style.modified, style.error, modified, error);\n const descriptionView =\n description && theme !== 'coorpmanager' ? (\n <div className={style.description}>{description}</div>\n ) : null;\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 const hintView =\n error || hint ? (\n <div\n className={style.hint}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: error || hint}}\n />\n ) : null;\n const errorIconView = error ? <ErrorIcon className={style.leftIcon} /> : null;\n const validIconView = valid ? <CheckIcon className={style.leftIcon} /> : null;\n return (\n <div\n className={classnames(\n mainClass,\n className,\n disabled && style.disabled,\n isNil(propsTitle) && style.isNoTitle\n )}\n >\n <label>\n <span className={classnames(style.title, isEmpty(value) && style.noValue)}>\n {title}\n {toolTipView}\n </span>\n\n <input\n autoFocus={autoFocus}\n type=\"text\"\n name={title}\n className={style.input}\n placeholder={placeholder}\n defaultValue={defaultValue}\n autoComplete={'off'}\n value={value}\n onInput={handleChange}\n disabled={disabled}\n onChange={noop}\n />\n {errorIconView}\n {validIconView}\n {hintView}\n </label>\n {descriptionView}\n </div>\n );\n};\n\nInputText.propTypes = {\n autoFocus: PropTypes.bool,\n title: PropTypes.string,\n placeholder: PropTypes.string,\n defaultValue: PropTypes.string,\n theme: PropTypes.oneOf(keys(themeStyle)),\n disabled: PropTypes.bool,\n required: PropTypes.bool,\n value: PropTypes.string,\n hint: PropTypes.string,\n error: PropTypes.string,\n onChange: PropTypes.func,\n description: PropTypes.string,\n modified: PropTypes.bool,\n valid: PropTypes.bool\n};\nexport default InputText;\n"],"file":"index.js"}
|
|
@@ -5,6 +5,15 @@
|
|
|
5
5
|
@value dark from colors;
|
|
6
6
|
@value grey from colors;
|
|
7
7
|
@value medium from colors;
|
|
8
|
+
@value xtraLightGrey from colors;
|
|
9
|
+
@value cm_positive_100 from colors;
|
|
10
|
+
@value cm_negative_100 from colors;
|
|
11
|
+
@value cm_grey_100 from colors;
|
|
12
|
+
@value cm_grey_150 from colors;
|
|
13
|
+
@value cm_grey_200 from colors;
|
|
14
|
+
@value cm_grey_400 from colors;
|
|
15
|
+
@value cm_grey_500 from colors;
|
|
16
|
+
@value cm_grey_700 from colors;
|
|
8
17
|
|
|
9
18
|
.default {
|
|
10
19
|
display: flex;
|
|
@@ -64,7 +73,7 @@
|
|
|
64
73
|
bottom: 65px;
|
|
65
74
|
left: 20px;
|
|
66
75
|
max-width: 380px;
|
|
67
|
-
transition: opacity 0.
|
|
76
|
+
transition: opacity 0.25s ease-in;
|
|
68
77
|
}
|
|
69
78
|
.cockpit .description:after {
|
|
70
79
|
content: "";
|
|
@@ -168,3 +177,217 @@
|
|
|
168
177
|
color: medium;
|
|
169
178
|
font-style: italic;
|
|
170
179
|
}
|
|
180
|
+
/******************************* coorpmanager theme ***************************************/
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
.coorpmanager {
|
|
184
|
+
width: 300px;
|
|
185
|
+
position: relative;
|
|
186
|
+
display: flex;
|
|
187
|
+
flex-direction: column;
|
|
188
|
+
align-items: flex-start;
|
|
189
|
+
flex-wrap: nowrap;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.coorpmanager label {
|
|
193
|
+
display: flex;
|
|
194
|
+
flex-direction: column;
|
|
195
|
+
align-items: flex-start;
|
|
196
|
+
height: 0px;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.coorpmanager .title {
|
|
200
|
+
flex-grow: 0;
|
|
201
|
+
font-family: Gilroy;
|
|
202
|
+
font-size: 10px;
|
|
203
|
+
font-weight: bold;
|
|
204
|
+
font-stretch: normal;
|
|
205
|
+
font-style: normal;
|
|
206
|
+
line-height: 1.2;
|
|
207
|
+
letter-spacing: normal;
|
|
208
|
+
text-align: left;
|
|
209
|
+
margin: 7px 0px -19px 16px;
|
|
210
|
+
z-index: 1;
|
|
211
|
+
color: cm_grey_400;
|
|
212
|
+
width: auto;
|
|
213
|
+
transition: all 0.25s linear;
|
|
214
|
+
pointer-events: none;
|
|
215
|
+
display: flex;
|
|
216
|
+
flex-direction: row;
|
|
217
|
+
flex-wrap: nowrap;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.coorpmanager .title.noValue .infoIcon {
|
|
221
|
+
height: 10px;
|
|
222
|
+
width: 10px;
|
|
223
|
+
line-height: 12px;
|
|
224
|
+
color: cm_grey_500;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.coorpmanager input {
|
|
228
|
+
width: 300px;
|
|
229
|
+
height: 44px;
|
|
230
|
+
margin: 0px;
|
|
231
|
+
flex-grow: 0;
|
|
232
|
+
display: flex;
|
|
233
|
+
box-sizing: border-box;
|
|
234
|
+
flex-direction: column;
|
|
235
|
+
justify-content: center;
|
|
236
|
+
align-items: flex-start;
|
|
237
|
+
padding: 19px 30px 5px 16px;
|
|
238
|
+
border-radius: 7px;
|
|
239
|
+
background-color: cm_grey_100;
|
|
240
|
+
font-family: Gilroy;
|
|
241
|
+
font-size: 14px;
|
|
242
|
+
font-weight: 500;
|
|
243
|
+
font-stretch: normal;
|
|
244
|
+
font-style: normal;
|
|
245
|
+
line-height: 44px;
|
|
246
|
+
letter-spacing: normal;
|
|
247
|
+
text-align: left;
|
|
248
|
+
color: cm_grey_700;
|
|
249
|
+
border: none;
|
|
250
|
+
transition: all 0.25s linear;
|
|
251
|
+
outline: none;
|
|
252
|
+
display: flex;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.coorpmanager .title.noValue{
|
|
256
|
+
font-size: 14px;
|
|
257
|
+
font-weight: 500;
|
|
258
|
+
color: cm_grey_700;
|
|
259
|
+
margin: 14px 0px -30px 16px;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.coorpmanager:focus-within .title.noValue {
|
|
263
|
+
font-size: 10px;
|
|
264
|
+
font-weight: bold;
|
|
265
|
+
color: cm_grey_400;
|
|
266
|
+
margin: 7px 0px -19px 16px;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.coorpmanager:focus-within input::placeholder {
|
|
270
|
+
color: cm_grey_400;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.coorpmanager:focus-within .title.noValue .infoIcon {
|
|
274
|
+
width: 8px;
|
|
275
|
+
height: 8px;
|
|
276
|
+
line-height: 12px;
|
|
277
|
+
color: cm_grey_400;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.coorpmanager input:hover {
|
|
281
|
+
background-color: cm_grey_150;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.coorpmanager input::placeholder {
|
|
285
|
+
color: transparent;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.coorpmanager .hint {
|
|
289
|
+
flex-grow: 0;
|
|
290
|
+
opacity: 0.5;
|
|
291
|
+
font-family: Gilroy;
|
|
292
|
+
font-size: 10px;
|
|
293
|
+
font-weight: 500;
|
|
294
|
+
font-stretch: normal;
|
|
295
|
+
font-style: normal;
|
|
296
|
+
line-height: 1.2;
|
|
297
|
+
letter-spacing: normal;
|
|
298
|
+
text-align: left;
|
|
299
|
+
padding-top: 8px;
|
|
300
|
+
color: cm_grey_700;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.coorpmanager.error .hint {
|
|
304
|
+
color: cm_negative_100;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.coorpmanager.error .leftIcon {
|
|
308
|
+
background-color: cm_negative_100;
|
|
309
|
+
color: white;
|
|
310
|
+
border-radius: 50%;
|
|
311
|
+
padding: 2px;
|
|
312
|
+
width: 8px;
|
|
313
|
+
height: 8px;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.coorpmanager .leftIcon {
|
|
317
|
+
color: cm_positive_100;
|
|
318
|
+
width: 14px;
|
|
319
|
+
height: 14px;
|
|
320
|
+
position: absolute;
|
|
321
|
+
right: 15px;
|
|
322
|
+
top: 16px;
|
|
323
|
+
line-height: 16px;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.coorpmanager.disabled {
|
|
327
|
+
opacity: 0.5;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.coorpmanager .infoIconWrapper {
|
|
331
|
+
overflow: visible;
|
|
332
|
+
height: 12px;
|
|
333
|
+
margin: 0px 4px;
|
|
334
|
+
cursor: pointer;
|
|
335
|
+
pointer-events: fill;
|
|
336
|
+
position: relative;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
.coorpmanager .infoIcon {
|
|
340
|
+
cursor: pointer;
|
|
341
|
+
width: 8px;
|
|
342
|
+
height: 8px;
|
|
343
|
+
line-height: 16px;
|
|
344
|
+
color: cm_grey_400;
|
|
345
|
+
transition: all 0.25s linear;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.coorpmanager .infoIconWrapper:hover .descriptionLabel {
|
|
349
|
+
visibility: visible;
|
|
350
|
+
opacity: 1;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
.coorpmanager .descriptionLabel {
|
|
354
|
+
margin: 0 1px 18px 0;
|
|
355
|
+
padding: 8px 16px;
|
|
356
|
+
border-radius: 7px;
|
|
357
|
+
background-color: cm_grey_700;
|
|
358
|
+
flex-grow: 0;
|
|
359
|
+
font-family: Gilroy;
|
|
360
|
+
font-size: 14px;
|
|
361
|
+
font-weight: 500;
|
|
362
|
+
font-stretch: normal;
|
|
363
|
+
font-style: normal;
|
|
364
|
+
line-height: 1.43;
|
|
365
|
+
letter-spacing: normal;
|
|
366
|
+
text-align: center;
|
|
367
|
+
color: white;
|
|
368
|
+
padding: 8px 16px;
|
|
369
|
+
max-width: 200px;
|
|
370
|
+
position: absolute;
|
|
371
|
+
left: -24px;
|
|
372
|
+
z-index: 3;
|
|
373
|
+
bottom: 5px;
|
|
374
|
+
width: max-content;
|
|
375
|
+
visibility: hidden;
|
|
376
|
+
opacity: 0s
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
.coorpmanager .descriptionLabel::after{
|
|
380
|
+
content:'';
|
|
381
|
+
border-left: 6px solid transparent;
|
|
382
|
+
border-right: 6px solid transparent;
|
|
383
|
+
border-top: 6px solid cm_grey_700;
|
|
384
|
+
position: absolute;
|
|
385
|
+
bottom: -6px;
|
|
386
|
+
left: 21px;
|
|
387
|
+
}
|
|
388
|
+
.coorpmanager .title.noValue .descriptionLabel::after{
|
|
389
|
+
left: 22px;
|
|
390
|
+
}
|
|
391
|
+
.coorpmanager:focus-within .title.noValue .descriptionLabel::after{
|
|
392
|
+
left: 21px;
|
|
393
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props: {
|
|
3
|
+
type: 'text',
|
|
4
|
+
title: 'Input name',
|
|
5
|
+
hint: 'Hint <span style="color:red;">10<span>/40',
|
|
6
|
+
placeholder: 'This is an input',
|
|
7
|
+
theme: 'coorpmanager',
|
|
8
|
+
description: 'This is the tooltip text',
|
|
9
|
+
value: 'This is an input',
|
|
10
|
+
disabled: false,
|
|
11
|
+
valid: false,
|
|
12
|
+
error: '',
|
|
13
|
+
required: true,
|
|
14
|
+
onChange: value => console.log(value)
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=cm-default.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/atom/input-text/test/fixtures/cm-default.js"],"names":["props","type","title","hint","placeholder","theme","description","value","disabled","valid","error","required","onChange","console","log"],"mappings":"AAAA,eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,IAAI,EAAE,MADD;AAELC,IAAAA,KAAK,EAAE,YAFF;AAGLC,IAAAA,IAAI,EAAE,2CAHD;AAILC,IAAAA,WAAW,EAAE,kBAJR;AAKLC,IAAAA,KAAK,EAAE,cALF;AAMLC,IAAAA,WAAW,EAAE,0BANR;AAOLC,IAAAA,KAAK,EAAE,kBAPF;AAQLC,IAAAA,QAAQ,EAAE,KARL;AASLC,IAAAA,KAAK,EAAE,KATF;AAULC,IAAAA,KAAK,EAAE,EAVF;AAWLC,IAAAA,QAAQ,EAAE,IAXL;AAYLC,IAAAA,QAAQ,EAAEL,KAAK,IAAIM,OAAO,CAACC,GAAR,CAAYP,KAAZ;AAZd;AADM,CAAf","sourcesContent":["export default {\n props: {\n type: 'text',\n title: 'Input name',\n hint: 'Hint <span style=\"color:red;\">10<span>/40',\n placeholder: 'This is an input',\n theme: 'coorpmanager',\n description: 'This is the tooltip text',\n value: 'This is an input',\n disabled: false,\n valid: false,\n error: '',\n required: true,\n onChange: value => console.log(value)\n }\n};\n"],"file":"cm-default.js"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { NovaSolidComputersSdCard } from '@coorpacademy/nova-icons';
|
|
4
|
+
import Link from '../../atom/link';
|
|
5
|
+
import ContentBagde from '../../atom/content-badge';
|
|
6
|
+
import style from './style.css';
|
|
7
|
+
|
|
8
|
+
const buildItemsOfSection = items => {
|
|
9
|
+
return items.map((item, index) => {
|
|
10
|
+
const {
|
|
11
|
+
type
|
|
12
|
+
} = item;
|
|
13
|
+
|
|
14
|
+
switch (type) {
|
|
15
|
+
case 'mainElement':
|
|
16
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
17
|
+
key: `${item.title}-${index}`
|
|
18
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
19
|
+
className: style.title
|
|
20
|
+
}, item.title), /*#__PURE__*/React.createElement("span", {
|
|
21
|
+
className: style.value
|
|
22
|
+
}, item.value));
|
|
23
|
+
|
|
24
|
+
case 'content':
|
|
25
|
+
{
|
|
26
|
+
const {
|
|
27
|
+
category,
|
|
28
|
+
label,
|
|
29
|
+
title,
|
|
30
|
+
author
|
|
31
|
+
} = item;
|
|
32
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
33
|
+
className: style.contentWrapper,
|
|
34
|
+
key: `${title}-${index}`
|
|
35
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
36
|
+
className: style.contentCounter
|
|
37
|
+
}, index + 1), /*#__PURE__*/React.createElement("div", {
|
|
38
|
+
className: style.contentItem
|
|
39
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
40
|
+
className: style.content
|
|
41
|
+
}, /*#__PURE__*/React.createElement(ContentBagde, {
|
|
42
|
+
category: category,
|
|
43
|
+
label: label
|
|
44
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
45
|
+
className: style.contentTitle,
|
|
46
|
+
title: title // eslint-disable-next-line react/no-danger
|
|
47
|
+
,
|
|
48
|
+
dangerouslySetInnerHTML: {
|
|
49
|
+
__html: title
|
|
50
|
+
}
|
|
51
|
+
})), author ? /*#__PURE__*/React.createElement("span", {
|
|
52
|
+
className: style.author
|
|
53
|
+
}, author) : null));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
case 'text':
|
|
57
|
+
default:
|
|
58
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
59
|
+
key: `${item.text}-${index}`
|
|
60
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
61
|
+
className: style.valueSimpleText
|
|
62
|
+
}, item.text));
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const buildSectionHeader = section => {
|
|
68
|
+
const {
|
|
69
|
+
title,
|
|
70
|
+
counterText
|
|
71
|
+
} = section;
|
|
72
|
+
|
|
73
|
+
if (!title) {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
78
|
+
className: style.sectionHeader
|
|
79
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
80
|
+
className: style.title
|
|
81
|
+
}, title), counterText ? /*#__PURE__*/React.createElement("span", {
|
|
82
|
+
className: style.counterText
|
|
83
|
+
}, counterText) : null);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const buildSections = sections => {
|
|
87
|
+
return sections.map((section, index) => {
|
|
88
|
+
const sectionHeader = buildSectionHeader(section);
|
|
89
|
+
const itemsView = buildItemsOfSection(section.items);
|
|
90
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
91
|
+
key: `summary-section-${index}`,
|
|
92
|
+
"data-step": index,
|
|
93
|
+
className: style.sectionWrapper
|
|
94
|
+
}, sectionHeader, /*#__PURE__*/React.createElement("ul", null, itemsView));
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const buildAction = action => {
|
|
99
|
+
if (!action) return null;
|
|
100
|
+
const {
|
|
101
|
+
onClick,
|
|
102
|
+
text,
|
|
103
|
+
icon
|
|
104
|
+
} = action;
|
|
105
|
+
const handleClick = useMemo(() => () => onClick(), [onClick]);
|
|
106
|
+
return /*#__PURE__*/React.createElement(Link, {
|
|
107
|
+
className: style.actionLink,
|
|
108
|
+
onClick: handleClick
|
|
109
|
+
}, icon === 'draft' ? /*#__PURE__*/React.createElement(NovaSolidComputersSdCard, {
|
|
110
|
+
className: style.icon
|
|
111
|
+
}) : null, /*#__PURE__*/React.createElement("span", null, text));
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const WizardSummary = props => {
|
|
115
|
+
const {
|
|
116
|
+
title,
|
|
117
|
+
sections,
|
|
118
|
+
action
|
|
119
|
+
} = props;
|
|
120
|
+
const sectionView = buildSections(sections);
|
|
121
|
+
const actionView = buildAction(action);
|
|
122
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
123
|
+
className: style.container
|
|
124
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
125
|
+
className: style.summaryTitle
|
|
126
|
+
}, title), /*#__PURE__*/React.createElement("div", {
|
|
127
|
+
className: style.summary
|
|
128
|
+
}, sectionView), /*#__PURE__*/React.createElement("div", {
|
|
129
|
+
className: style.actionZone
|
|
130
|
+
}, actionView));
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
WizardSummary.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
134
|
+
title: PropTypes.string,
|
|
135
|
+
sections: PropTypes.arrayOf(PropTypes.shape({
|
|
136
|
+
title: PropTypes.string,
|
|
137
|
+
items: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.shape({
|
|
138
|
+
type: PropTypes.string,
|
|
139
|
+
title: PropTypes.string,
|
|
140
|
+
value: PropTypes.string
|
|
141
|
+
}), PropTypes.shape({
|
|
142
|
+
type: PropTypes.string,
|
|
143
|
+
text: PropTypes.string
|
|
144
|
+
}), PropTypes.shape({
|
|
145
|
+
type: PropTypes.string,
|
|
146
|
+
category: PropTypes.oneOf(['base', 'advanced', 'coach', 'chapter', 'scorm', 'video', 'article', 'podcast']),
|
|
147
|
+
title: PropTypes.string,
|
|
148
|
+
label: PropTypes.string,
|
|
149
|
+
author: PropTypes.string
|
|
150
|
+
})])),
|
|
151
|
+
counterText: PropTypes.string
|
|
152
|
+
})),
|
|
153
|
+
action: PropTypes.shape({
|
|
154
|
+
icon: PropTypes.string,
|
|
155
|
+
text: PropTypes.string,
|
|
156
|
+
onClick: PropTypes.func
|
|
157
|
+
})
|
|
158
|
+
} : {};
|
|
159
|
+
export default WizardSummary;
|
|
160
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/molecule/wizard-summary/index.js"],"names":["React","useMemo","PropTypes","NovaSolidComputersSdCard","Link","ContentBagde","style","buildItemsOfSection","items","map","item","index","type","title","value","category","label","author","contentWrapper","contentCounter","contentItem","content","contentTitle","__html","text","valueSimpleText","buildSectionHeader","section","counterText","sectionHeader","buildSections","sections","itemsView","sectionWrapper","buildAction","action","onClick","icon","handleClick","actionLink","WizardSummary","props","sectionView","actionView","container","summaryTitle","summary","actionZone","propTypes","string","arrayOf","shape","oneOfType","oneOf","func"],"mappings":"AAAA,OAAOA,KAAP,IAAeC,OAAf,QAA6B,OAA7B;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAAQC,wBAAR,QAAuC,0BAAvC;AACA,OAAOC,IAAP,MAAiB,iBAAjB;AACA,OAAOC,YAAP,MAAyB,0BAAzB;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,mBAAmB,GAAGC,KAAK,IAAI;AACnC,SAAOA,KAAK,CAACC,GAAN,CAAU,CAACC,IAAD,EAAOC,KAAP,KAAiB;AAChC,UAAM;AAACC,MAAAA;AAAD,QAASF,IAAf;;AACA,YAAQE,IAAR;AACE,WAAK,aAAL;AACE,4BACE;AAAI,UAAA,GAAG,EAAG,GAAEF,IAAI,CAACG,KAAM,IAAGF,KAAM;AAAhC,wBACE;AAAM,UAAA,SAAS,EAAEL,KAAK,CAACO;AAAvB,WAA+BH,IAAI,CAACG,KAApC,CADF,eAEE;AAAM,UAAA,SAAS,EAAEP,KAAK,CAACQ;AA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AACdvC,MAAAA,IAAI,EAAEV,SAAS,CAAC+C,MADF;AAEdlC,MAAAA,QAAQ,EAAEb,SAAS,CAACmD,KAAV,CAAgB,CACxB,MADwB,EAExB,UAFwB,EAGxB,OAHwB,EAIxB,SAJwB,EAKxB,OALwB,EAMxB,OANwB,EAOxB,SAPwB,EAQxB,SARwB,CAAhB,CAFI;AAYdxC,MAAAA,KAAK,EAAEX,SAAS,CAAC+C,MAZH;AAadjC,MAAAA,KAAK,EAAEd,SAAS,CAAC+C,MAbH;AAcdhC,MAAAA,MAAM,EAAEf,SAAS,CAAC+C;AAdJ,KAAhB,CAVkB,CAApB,CADK,CAFO;AA+BdrB,IAAAA,WAAW,EAAE1B,SAAS,CAAC+C;AA/BT,GAAhB,CADQ,CAFc;AAqCxBd,EAAAA,MAAM,EAAEjC,SAAS,CAACiD,KAAV,CAAgB;AACtBd,IAAAA,IAAI,EAAEnC,SAAS,CAAC+C,MADM;AAEtBzB,IAAAA,IAAI,EAAEtB,SAAS,CAAC+C,MAFM;AAGtBb,IAAAA,OAAO,EAAElC,SAAS,CAACoD;AAHG,GAAhB;AArCgB,CAA1B;AA4CA,eAAed,aAAf","sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport {NovaSolidComputersSdCard} from '@coorpacademy/nova-icons';\nimport Link from '../../atom/link';\nimport ContentBagde from '../../atom/content-badge';\nimport style from './style.css';\n\nconst buildItemsOfSection = items => {\n return items.map((item, index) => {\n const {type} = item;\n switch (type) {\n case 'mainElement':\n return (\n <li key={`${item.title}-${index}`}>\n <span className={style.title}>{item.title}</span>\n <span className={style.value}>{item.value}</span>\n </li>\n );\n case 'content': {\n const {category, label, title, author} = item;\n return (\n <li className={style.contentWrapper} key={`${title}-${index}`}>\n <span className={style.contentCounter}>{index + 1}</span>\n <div className={style.contentItem}>\n <div className={style.content}>\n <ContentBagde category={category} label={label} />\n <span\n className={style.contentTitle}\n title={title}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: title}}\n />\n </div>\n {author ? <span className={style.author}>{author}</span> : null}\n </div>\n </li>\n );\n }\n case 'text':\n default:\n return (\n <li key={`${item.text}-${index}`}>\n <span className={style.valueSimpleText}>{item.text}</span>\n </li>\n );\n }\n });\n};\n\nconst buildSectionHeader = section => {\n const {title, counterText} = section;\n if (!title) {\n return null;\n }\n return (\n <div className={style.sectionHeader}>\n <span className={style.title}>{title}</span>\n {counterText ? <span className={style.counterText}>{counterText}</span> : null}\n </div>\n );\n};\n\nconst buildSections = sections => {\n return sections.map((section, index) => {\n const sectionHeader = buildSectionHeader(section);\n const itemsView = buildItemsOfSection(section.items);\n return (\n <div key={`summary-section-${index}`} data-step={index} className={style.sectionWrapper}>\n {sectionHeader}\n <ul>{itemsView}</ul>\n </div>\n );\n });\n};\n\nconst buildAction = action => {\n if (!action) return null;\n\n const {onClick, text, icon} = action;\n const handleClick = useMemo(() => () => onClick(), [onClick]);\n return (\n <Link className={style.actionLink} onClick={handleClick}>\n {icon === 'draft' ? <NovaSolidComputersSdCard className={style.icon} /> : null}\n <span>{text}</span>\n </Link>\n );\n};\n\nconst WizardSummary = props => {\n const {title, sections, action} = props;\n\n const sectionView = buildSections(sections);\n const actionView = buildAction(action);\n\n return (\n <div className={style.container}>\n <span className={style.summaryTitle}>{title}</span>\n <div className={style.summary}>{sectionView}</div>\n <div className={style.actionZone}>{actionView}</div>\n </div>\n );\n};\n\nWizardSummary.propTypes = {\n title: PropTypes.string,\n sections: PropTypes.arrayOf(\n PropTypes.shape({\n title: PropTypes.string,\n items: PropTypes.arrayOf(\n PropTypes.oneOfType([\n PropTypes.shape({\n type: PropTypes.string,\n title: PropTypes.string,\n value: PropTypes.string\n }),\n PropTypes.shape({\n type: PropTypes.string,\n text: PropTypes.string\n }),\n PropTypes.shape({\n type: PropTypes.string,\n category: PropTypes.oneOf([\n 'base',\n 'advanced',\n 'coach',\n 'chapter',\n 'scorm',\n 'video',\n 'article',\n 'podcast'\n ]),\n title: PropTypes.string,\n label: PropTypes.string,\n author: PropTypes.string\n })\n ])\n ),\n counterText: PropTypes.string\n })\n ),\n action: PropTypes.shape({\n icon: PropTypes.string,\n text: PropTypes.string,\n onClick: PropTypes.func\n })\n};\n\nexport default WizardSummary;\n"],"file":"index.js"}
|