@coorpacademy/components 11.42.1 → 11.42.3
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/checkbox-with-title/index.d.ts +1 -0
- package/es/atom/checkbox-with-title/index.d.ts.map +1 -1
- package/es/atom/checkbox-with-title/index.js +6 -3
- package/es/atom/checkbox-with-title/index.js.map +1 -1
- package/es/atom/radio-with-title/index.d.ts +3 -0
- package/es/atom/radio-with-title/index.d.ts.map +1 -1
- package/es/atom/radio-with-title/index.js +23 -5
- package/es/atom/radio-with-title/index.js.map +1 -1
- package/es/atom/radio-with-title/style.css +27 -0
- package/es/atom/radio-with-title/types.d.ts +6 -0
- package/es/atom/radio-with-title/types.d.ts.map +1 -1
- package/es/atom/radio-with-title/types.js +3 -0
- package/es/atom/radio-with-title/types.js.map +1 -1
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/index.js.map +1 -1
- package/es/molecule/cm-popin/index.d.ts.map +1 -1
- package/es/molecule/cm-popin/index.js +20 -3
- package/es/molecule/cm-popin/index.js.map +1 -1
- package/es/molecule/cm-popin/style.css +17 -0
- package/es/molecule/cm-popin/types.d.ts +36 -0
- package/es/molecule/cm-popin/types.d.ts.map +1 -1
- package/es/molecule/cm-popin/types.js +3 -0
- package/es/molecule/cm-popin/types.js.map +1 -1
- package/es/molecule/draggable-list/index.d.ts +6 -0
- package/es/molecule/progress-bar/index.d.ts +16 -7
- package/es/molecule/progress-bar/index.d.ts.map +1 -1
- package/es/molecule/progress-bar/index.js +61 -4
- package/es/molecule/progress-bar/index.js.map +1 -1
- package/es/molecule/progress-bar/style.css +56 -0
- package/es/molecule/table/index.d.ts +8 -0
- package/es/molecule/table/index.d.ts.map +1 -1
- package/es/molecule/table/index.js +43 -5
- package/es/molecule/table/index.js.map +1 -1
- package/es/molecule/table/style.css +24 -0
- package/es/molecule/title-and-checkbox-wrapper/index.d.ts +1 -0
- package/es/molecule/title-radio-wrapper/index.d.ts +3 -0
- package/es/molecule/title-radio-wrapper/index.d.ts.map +1 -1
- package/es/molecule/title-radio-wrapper/types.d.ts +3 -0
- package/es/molecule/title-radio-wrapper/types.d.ts.map +1 -1
- package/es/molecule/wizard-summary/index.d.ts +3 -0
- package/es/molecule/wizard-summary/index.d.ts.map +1 -1
- package/es/molecule/wizard-summary/index.js +35 -3
- package/es/molecule/wizard-summary/index.js.map +1 -1
- package/es/molecule/wizard-summary/style.css +54 -1
- package/es/organism/brand-learning-priorities/index.d.ts +6 -0
- package/es/organism/brand-table/index.d.ts +8 -0
- package/es/organism/content-selection-list/index.d.ts +95 -0
- package/es/organism/content-selection-list/index.d.ts.map +1 -0
- package/es/organism/content-selection-list/index.js +175 -0
- package/es/organism/content-selection-list/index.js.map +1 -0
- package/es/organism/content-selection-list/style.css +8 -0
- package/es/organism/content-selection-list/types.d.ts +113 -0
- package/es/organism/content-selection-list/types.d.ts.map +1 -0
- package/es/organism/content-selection-list/types.js +58 -0
- package/es/organism/content-selection-list/types.js.map +1 -0
- package/es/organism/content-skill-modal/index.d.ts +7 -0
- package/es/organism/content-skill-modal/index.d.ts.map +1 -1
- package/es/organism/content-skill-modal/types.d.ts +7 -0
- package/es/organism/content-skill-modal/types.d.ts.map +1 -1
- package/es/organism/list-item/index.d.ts +9 -1
- package/es/organism/list-item/index.d.ts.map +1 -1
- package/es/organism/list-item/index.js +16 -3
- package/es/organism/list-item/index.js.map +1 -1
- package/es/organism/list-item/style.css +15 -0
- package/es/organism/list-items/index.d.ts +7 -0
- package/es/organism/rewards-form/index.d.ts +1 -0
- package/es/organism/select-opponents/index.d.ts +1 -0
- package/es/organism/select-opponents/index.d.ts.map +1 -1
- package/es/organism/select-opponents/types.d.ts +1 -0
- package/es/organism/select-opponents/types.d.ts.map +1 -1
- package/es/organism/skill-edition/index.d.ts +8 -3
- package/es/organism/skill-edition/index.d.ts.map +1 -1
- package/es/organism/skill-edition/index.js +3 -168
- package/es/organism/skill-edition/index.js.map +1 -1
- package/es/organism/skill-edition/styles.d.ts +10 -0
- package/es/organism/skill-edition/styles.d.ts.map +1 -0
- package/es/organism/skill-edition/styles.js +10 -0
- package/es/organism/skill-edition/styles.js.map +1 -0
- package/es/organism/skill-edition/types.d.ts +10 -54
- package/es/organism/skill-edition/types.d.ts.map +1 -1
- package/es/organism/skill-edition/types.js +3 -52
- package/es/organism/skill-edition/types.js.map +1 -1
- package/es/organism/title-and-input/index.d.ts +1 -0
- package/es/organism/title-and-input/index.d.ts.map +1 -1
- package/es/organism/title-and-input/types.d.ts +1 -0
- package/es/organism/title-and-input/types.d.ts.map +1 -1
- package/es/organism/wizard-contents/index.d.ts +4 -0
- package/es/template/app-player/loading/index.d.ts +33 -0
- package/es/template/app-player/player/index.d.ts +66 -0
- package/es/template/app-player/player/slides/index.d.ts +33 -0
- package/es/template/app-player/player/slides/index.d.ts.map +1 -1
- package/es/template/app-player/popin-correction/index.d.ts +33 -0
- package/es/template/app-player/popin-correction/index.d.ts.map +1 -1
- package/es/template/app-player/popin-end/index.d.ts +33 -0
- package/es/template/app-review/index.d.ts +33 -0
- package/es/template/app-review/index.d.ts.map +1 -1
- package/es/template/app-review/player/prop-types.d.ts +33 -0
- package/es/template/app-review/player/prop-types.d.ts.map +1 -1
- package/es/template/app-review/prop-types.d.ts +33 -0
- package/es/template/app-review/prop-types.d.ts.map +1 -1
- package/es/template/back-office/brand-update/index.d.ts +80 -3
- package/es/template/certification-detail/index.d.ts +33 -0
- package/es/template/common/dashboard/index.d.ts +66 -0
- package/es/template/common/search-page/index.d.ts +33 -0
- package/es/template/external-course/index.d.ts +33 -0
- package/es/template/playlist-detail/index.d.ts +33 -0
- package/lib/atom/checkbox-with-title/index.d.ts +1 -0
- package/lib/atom/checkbox-with-title/index.d.ts.map +1 -1
- package/lib/atom/checkbox-with-title/index.js +6 -3
- package/lib/atom/checkbox-with-title/index.js.map +1 -1
- package/lib/atom/radio-with-title/index.d.ts +3 -0
- package/lib/atom/radio-with-title/index.d.ts.map +1 -1
- package/lib/atom/radio-with-title/index.js +23 -5
- package/lib/atom/radio-with-title/index.js.map +1 -1
- package/lib/atom/radio-with-title/style.css +27 -0
- package/lib/atom/radio-with-title/types.d.ts +6 -0
- package/lib/atom/radio-with-title/types.d.ts.map +1 -1
- package/lib/atom/radio-with-title/types.js +3 -0
- package/lib/atom/radio-with-title/types.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -0
- package/lib/index.js.map +1 -1
- package/lib/molecule/cm-popin/index.d.ts.map +1 -1
- package/lib/molecule/cm-popin/index.js +20 -3
- package/lib/molecule/cm-popin/index.js.map +1 -1
- package/lib/molecule/cm-popin/style.css +17 -0
- package/lib/molecule/cm-popin/types.d.ts +36 -0
- package/lib/molecule/cm-popin/types.d.ts.map +1 -1
- package/lib/molecule/cm-popin/types.js +3 -0
- package/lib/molecule/cm-popin/types.js.map +1 -1
- package/lib/molecule/draggable-list/index.d.ts +6 -0
- package/lib/molecule/progress-bar/index.d.ts +16 -7
- package/lib/molecule/progress-bar/index.d.ts.map +1 -1
- package/lib/molecule/progress-bar/index.js +61 -4
- package/lib/molecule/progress-bar/index.js.map +1 -1
- package/lib/molecule/progress-bar/style.css +56 -0
- package/lib/molecule/table/index.d.ts +8 -0
- package/lib/molecule/table/index.d.ts.map +1 -1
- package/lib/molecule/table/index.js +43 -5
- package/lib/molecule/table/index.js.map +1 -1
- package/lib/molecule/table/style.css +24 -0
- package/lib/molecule/title-and-checkbox-wrapper/index.d.ts +1 -0
- package/lib/molecule/title-radio-wrapper/index.d.ts +3 -0
- package/lib/molecule/title-radio-wrapper/index.d.ts.map +1 -1
- package/lib/molecule/title-radio-wrapper/types.d.ts +3 -0
- package/lib/molecule/title-radio-wrapper/types.d.ts.map +1 -1
- package/lib/molecule/wizard-summary/index.d.ts +3 -0
- package/lib/molecule/wizard-summary/index.d.ts.map +1 -1
- package/lib/molecule/wizard-summary/index.js +35 -3
- package/lib/molecule/wizard-summary/index.js.map +1 -1
- package/lib/molecule/wizard-summary/style.css +54 -1
- package/lib/organism/brand-learning-priorities/index.d.ts +6 -0
- package/lib/organism/brand-table/index.d.ts +8 -0
- package/lib/organism/content-selection-list/index.d.ts +95 -0
- package/lib/organism/content-selection-list/index.d.ts.map +1 -0
- package/lib/organism/content-selection-list/index.js +181 -0
- package/lib/organism/content-selection-list/index.js.map +1 -0
- package/lib/organism/content-selection-list/style.css +8 -0
- package/lib/organism/content-selection-list/types.d.ts +113 -0
- package/lib/organism/content-selection-list/types.d.ts.map +1 -0
- package/lib/organism/content-selection-list/types.js +63 -0
- package/lib/organism/content-selection-list/types.js.map +1 -0
- package/lib/organism/content-skill-modal/index.d.ts +7 -0
- package/lib/organism/content-skill-modal/index.d.ts.map +1 -1
- package/lib/organism/content-skill-modal/types.d.ts +7 -0
- package/lib/organism/content-skill-modal/types.d.ts.map +1 -1
- package/lib/organism/list-item/index.d.ts +9 -1
- package/lib/organism/list-item/index.d.ts.map +1 -1
- package/lib/organism/list-item/index.js +16 -3
- package/lib/organism/list-item/index.js.map +1 -1
- package/lib/organism/list-item/style.css +15 -0
- package/lib/organism/list-items/index.d.ts +7 -0
- package/lib/organism/rewards-form/index.d.ts +1 -0
- package/lib/organism/select-opponents/index.d.ts +1 -0
- package/lib/organism/select-opponents/index.d.ts.map +1 -1
- package/lib/organism/select-opponents/types.d.ts +1 -0
- package/lib/organism/select-opponents/types.d.ts.map +1 -1
- package/lib/organism/skill-edition/index.d.ts +8 -3
- package/lib/organism/skill-edition/index.d.ts.map +1 -1
- package/lib/organism/skill-edition/index.js +11 -174
- package/lib/organism/skill-edition/index.js.map +1 -1
- package/lib/organism/skill-edition/styles.d.ts +10 -0
- package/lib/organism/skill-edition/styles.d.ts.map +1 -0
- package/lib/organism/skill-edition/styles.js +15 -0
- package/lib/organism/skill-edition/styles.js.map +1 -0
- package/lib/organism/skill-edition/types.d.ts +10 -54
- package/lib/organism/skill-edition/types.d.ts.map +1 -1
- package/lib/organism/skill-edition/types.js +6 -53
- package/lib/organism/skill-edition/types.js.map +1 -1
- package/lib/organism/title-and-input/index.d.ts +1 -0
- package/lib/organism/title-and-input/index.d.ts.map +1 -1
- package/lib/organism/title-and-input/types.d.ts +1 -0
- package/lib/organism/title-and-input/types.d.ts.map +1 -1
- package/lib/organism/wizard-contents/index.d.ts +4 -0
- package/lib/template/app-player/loading/index.d.ts +33 -0
- package/lib/template/app-player/player/index.d.ts +66 -0
- package/lib/template/app-player/player/slides/index.d.ts +33 -0
- package/lib/template/app-player/player/slides/index.d.ts.map +1 -1
- package/lib/template/app-player/popin-correction/index.d.ts +33 -0
- package/lib/template/app-player/popin-correction/index.d.ts.map +1 -1
- package/lib/template/app-player/popin-end/index.d.ts +33 -0
- package/lib/template/app-review/index.d.ts +33 -0
- package/lib/template/app-review/index.d.ts.map +1 -1
- package/lib/template/app-review/player/prop-types.d.ts +33 -0
- package/lib/template/app-review/player/prop-types.d.ts.map +1 -1
- package/lib/template/app-review/prop-types.d.ts +33 -0
- package/lib/template/app-review/prop-types.d.ts.map +1 -1
- package/lib/template/back-office/brand-update/index.d.ts +80 -3
- package/lib/template/certification-detail/index.d.ts +33 -0
- package/lib/template/common/dashboard/index.d.ts +66 -0
- package/lib/template/common/search-page/index.d.ts +33 -0
- package/lib/template/external-course/index.d.ts +33 -0
- package/lib/template/playlist-detail/index.d.ts +33 -0
- package/package.json +2 -2
|
@@ -14,6 +14,14 @@ var _style = _interopRequireDefault(require("./style.css"));
|
|
|
14
14
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
15
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
const DIFF_MARKERS = {
|
|
18
|
+
added: '+',
|
|
19
|
+
removed: '−'
|
|
20
|
+
};
|
|
21
|
+
const DIFF_CLASSES = {
|
|
22
|
+
added: _style.default.added,
|
|
23
|
+
removed: _style.default.removed
|
|
24
|
+
};
|
|
17
25
|
const buildItemsOfSection = items => {
|
|
18
26
|
return items.map((item, index) => {
|
|
19
27
|
const {
|
|
@@ -66,8 +74,23 @@ const buildItemsOfSection = items => {
|
|
|
66
74
|
{
|
|
67
75
|
const {
|
|
68
76
|
text,
|
|
69
|
-
unsaved = false
|
|
77
|
+
unsaved = false,
|
|
78
|
+
diff,
|
|
79
|
+
diffLabel
|
|
70
80
|
} = item;
|
|
81
|
+
if (diff === 'added' || diff === 'removed') return /*#__PURE__*/_react.default.createElement("li", {
|
|
82
|
+
key: `${item.text}-${index}`,
|
|
83
|
+
"data-name": item.title,
|
|
84
|
+
"data-diff": diff,
|
|
85
|
+
className: (0, _classnames.default)(_style.default.diffLine, DIFF_CLASSES[diff])
|
|
86
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
87
|
+
className: _style.default.diffMarker,
|
|
88
|
+
"aria-hidden": "true"
|
|
89
|
+
}, DIFF_MARKERS[diff]), diffLabel ? /*#__PURE__*/_react.default.createElement("span", {
|
|
90
|
+
className: _style.default.visuallyHidden
|
|
91
|
+
}, diffLabel) : null, /*#__PURE__*/_react.default.createElement("span", {
|
|
92
|
+
className: (0, _classnames.default)(_style.default.diffText, unsaved && _style.default.unsaved)
|
|
93
|
+
}, text));
|
|
71
94
|
return /*#__PURE__*/_react.default.createElement("li", {
|
|
72
95
|
key: `${item.text}-${index}`,
|
|
73
96
|
"data-name": item.title
|
|
@@ -147,7 +170,8 @@ const WizardSummary = props => {
|
|
|
147
170
|
title,
|
|
148
171
|
sections,
|
|
149
172
|
action,
|
|
150
|
-
side
|
|
173
|
+
side,
|
|
174
|
+
inline = false
|
|
151
175
|
} = props;
|
|
152
176
|
const sectionsView = buildSections(sections);
|
|
153
177
|
const idSwitch = (0, _uniqueId2.default)('open-summary-wizard');
|
|
@@ -164,6 +188,9 @@ const WizardSummary = props => {
|
|
|
164
188
|
}
|
|
165
189
|
setChecked(!checked);
|
|
166
190
|
}, [checked]);
|
|
191
|
+
if (inline) return /*#__PURE__*/_react.default.createElement("div", {
|
|
192
|
+
className: _style.default.inline
|
|
193
|
+
}, sectionsView);
|
|
167
194
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
168
195
|
className: _style.default.container,
|
|
169
196
|
ref: summaryElement
|
|
@@ -211,6 +238,7 @@ BuildAction.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
211
238
|
side: _propTypes.default.string
|
|
212
239
|
} : {};
|
|
213
240
|
WizardSummary.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
241
|
+
inline: _propTypes.default.bool,
|
|
214
242
|
title: _propTypes.default.string,
|
|
215
243
|
side: _propTypes.default.string,
|
|
216
244
|
sections: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
@@ -222,7 +250,11 @@ WizardSummary.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
222
250
|
}), _propTypes.default.shape({
|
|
223
251
|
type: _propTypes.default.string,
|
|
224
252
|
text: _propTypes.default.string,
|
|
225
|
-
unsaved: _propTypes.default.bool
|
|
253
|
+
unsaved: _propTypes.default.bool,
|
|
254
|
+
// A diff line: green « + » when added, red « − » when removed
|
|
255
|
+
diff: _propTypes.default.oneOf(['added', 'removed']),
|
|
256
|
+
// Read by screen readers in place of the marker, e.g. 'Added' / 'Removed'
|
|
257
|
+
diffLabel: _propTypes.default.string
|
|
226
258
|
}), _propTypes.default.shape({
|
|
227
259
|
type: _propTypes.default.string,
|
|
228
260
|
badgeList: _propTypes.default.arrayOf(_propTypes.default.shape(_contentBadge.default.propTypes)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_classnames","_novaIcons","_listBadges","_buttonLink","_contentBadge","_style","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","buildItemsOfSection","items","map","item","index","type","createElement","key","title","className","style","value","badgeList","badgeAriaLabel","author","unsaved","contentWrapper","contentCounter","contentItem","classnames","contentTitle","dangerouslySetInnerHTML","__html","text","valueSimpleText","buildSectionHeader","section","counterText","sectionHeader","buildSections","sections","itemsView","sectionWrapper","BuildAction","action","side","onClick","disabled","icon","ariaLabel","handleClick","useMemo","buttonProps","label","position","button","checkOnClose","checked","summaryElement","onCloseSummary","clickEvent","current","contains","target","WizardSummary","props","sectionsView","idSwitch","_uniqueId2","useRef","setChecked","useState","handleOnChange","useCallback","document","addEventListener","removeEventListener","container","ref","desktopSummaryTitle","id","name","checkbox","onChange","summary","tabletSummaryHeader","htmlFor","tabletSummaryTitle","NovaCompositionNavigationArrowDown","tabletSummaryIcon","summarySections","actionZone","propTypes","process","env","NODE_ENV","PropTypes","shape","string","bool","func","arrayOf","oneOfType","ContentBadge","_default","exports"],"sources":["../../../src/molecule/wizard-summary/index.js"],"sourcesContent":["import React, {useMemo, useState, useCallback, useRef} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {uniqueId} from 'lodash/fp';\nimport {NovaCompositionNavigationArrowDown as ArrowDownIcon} from '@coorpacademy/nova-icons';\nimport ListBadges from '../list-badges';\nimport ButtonLink from '../../atom/button-link';\nimport ContentBadge 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}`} data-name={item.title}>\n <span className={style.title}>{item.title}</span>\n <span className={style.value}>{item.value}</span>\n </li>\n );\n case 'content': {\n const {badgeList, badgeAriaLabel, title, author, unsaved = false} = item;\n return (\n <li className={style.contentWrapper} key={`${title}-${index}`} data-name={item.title}>\n <span className={style.contentCounter}>{index + 1}</span>\n <div className={style.contentItem}>\n <ListBadges aria-label={badgeAriaLabel} items={badgeList} />\n <div\n className={classnames(style.contentTitle, unsaved && style.unsaved)}\n title={title}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: title}}\n />\n {author ? <span className={style.author}>{author}</span> : null}\n </div>\n </li>\n );\n }\n case 'text':\n default: {\n const {text, unsaved = false} = item;\n return (\n <li key={`${item.text}-${index}`} data-name={item.title}>\n <span className={classnames(style.valueSimpleText, unsaved && style.unsaved)}>\n {text}\n </span>\n </li>\n );\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\n key={`summary-section-${index}`}\n data-step={index}\n data-name={`summary-section-${index}`}\n className={style.sectionWrapper}\n >\n {sectionHeader}\n <ul>{itemsView}</ul>\n </div>\n );\n });\n};\n\nconst BuildAction = ({action, side}) => {\n const {onClick, text, disabled = false, icon, 'aria-label': ariaLabel} = action;\n const handleClick = useMemo(() => () => onClick(), [onClick]);\n\n if (!action) return null;\n\n const buttonProps = {\n type: 'text',\n label: text,\n disabled,\n 'aria-label': ariaLabel,\n 'data-name': `${icon}-button-${side}`,\n onClick: handleClick,\n icon: {\n position: 'left',\n type: icon\n }\n };\n\n return (\n <div className={style.button}>\n <ButtonLink {...buttonProps} />\n </div>\n );\n};\n\nconst checkOnClose = (checked, summaryElement, onCloseSummary, clickEvent) => {\n if (checked) {\n if (\n summaryElement &&\n summaryElement.current &&\n !summaryElement.current.contains(clickEvent.target)\n ) {\n onCloseSummary();\n }\n }\n};\n\nconst WizardSummary = props => {\n const {title, sections, action, side} = props;\n const sectionsView = buildSections(sections);\n const idSwitch = uniqueId('open-summary-wizard');\n const summaryElement = useRef(null);\n const [checked, setChecked] = useState(false);\n\n const onCloseSummary = () => setChecked(false);\n const handleOnChange = useCallback(() => {\n if (!checked) {\n document.addEventListener('click', clickEvent =>\n checkOnClose(!checked, summaryElement, onCloseSummary, clickEvent)\n );\n document.addEventListener('touchstart', clickEvent =>\n checkOnClose(!checked, summaryElement, onCloseSummary, clickEvent)\n );\n } else {\n document.removeEventListener('click', clickEvent =>\n checkOnClose(!checked, summaryElement, onCloseSummary, clickEvent)\n );\n document.removeEventListener('touchstart', clickEvent =>\n checkOnClose(!checked, summaryElement, onCloseSummary, clickEvent)\n );\n }\n setChecked(!checked);\n }, [checked]);\n\n return (\n <div className={style.container} ref={summaryElement}>\n <span className={style.desktopSummaryTitle} data-name={`summary-title-${side}`}>\n {title}\n </span>\n <input\n type=\"checkbox\"\n id={idSwitch}\n name=\"toogle\"\n title={idSwitch}\n className={style.checkbox}\n data-name={`summary-checkbox-${side}`}\n checked={checked}\n onChange={handleOnChange}\n />\n <div className={style.summary}>\n <div className={style.tabletSummaryHeader}>\n <label htmlFor={idSwitch}>\n <span className={style.tabletSummaryTitle}>{title}</span>\n <ArrowDownIcon className={style.tabletSummaryIcon} />\n </label>\n </div>\n <div className={style.summarySections} data-name={`summary-section-${side}`}>\n {sectionsView}\n </div>\n </div>\n <div className={style.actionZone} data-name={`summary-actions-${side}`}>\n <BuildAction action={action} side={side} />\n </div>\n </div>\n );\n};\n\nBuildAction.propTypes = {\n action: PropTypes.shape({\n icon: PropTypes.string,\n disabled: PropTypes.bool,\n text: PropTypes.string,\n onClick: PropTypes.func,\n 'aria-label': PropTypes.string\n }),\n side: PropTypes.string\n};\n\nWizardSummary.propTypes = {\n title: PropTypes.string,\n side: 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 unsaved: PropTypes.bool\n }),\n PropTypes.shape({\n type: PropTypes.string,\n badgeList: PropTypes.arrayOf(PropTypes.shape(ContentBadge.propTypes)),\n badgeAriaLabel: PropTypes.string,\n title: PropTypes.string,\n author: PropTypes.string,\n unsaved: PropTypes.bool\n })\n ])\n ),\n counterText: PropTypes.string\n })\n ),\n action: BuildAction.propTypes.action\n};\n\nexport default WizardSummary;\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAD,sBAAA,CAAAF,OAAA;AAEA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,WAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,aAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,MAAA,GAAAN,sBAAA,CAAAF,OAAA;AAAgC,SAAAS,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAX,wBAAAW,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG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AAS,CAACE,MAAM;MACtBzE,OAAO,EAAEuE,kBAAS,CAACG;IACrB,CAAC,CAAC,EACFH,kBAAS,CAACC,KAAK,CAAC;MACdlF,IAAI,EAAEiF,kBAAS,CAACE,MAAM;MACtB5E,SAAS,EAAE0E,kBAAS,CAACK,OAAO,CAACL,kBAAS,CAACC,KAAK,CAACM,qBAAY,CAACX,SAAS,CAAC,CAAC;MACrErE,cAAc,EAAEyE,kBAAS,CAACE,MAAM;MAChChF,KAAK,EAAE8E,kBAAS,CAACE,MAAM;MACvB1E,MAAM,EAAEwE,kBAAS,CAACE,MAAM;MACxBzE,OAAO,EAAEuE,kBAAS,CAACG;IACrB,CAAC,CAAC,CACH,CACH,CAAC;IACD9D,WAAW,EAAE2D,kBAAS,CAACE;EACzB,CAAC,CACH,CAAC;EACDtD,MAAM,EAAED,WAAW,CAACiD,SAAS,CAAChD;AAChC,CAAC;AAAC,IAAA4D,QAAA,GAAAC,OAAA,CAAA7G,OAAA,GAEaoE,aAAa","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_classnames","_novaIcons","_listBadges","_buttonLink","_contentBadge","_style","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","DIFF_MARKERS","added","removed","DIFF_CLASSES","style","buildItemsOfSection","items","map","item","index","type","createElement","key","title","className","value","badgeList","badgeAriaLabel","author","unsaved","contentWrapper","contentCounter","contentItem","classnames","contentTitle","dangerouslySetInnerHTML","__html","text","diff","diffLabel","diffLine","diffMarker","visuallyHidden","diffText","valueSimpleText","buildSectionHeader","section","counterText","sectionHeader","buildSections","sections","itemsView","sectionWrapper","BuildAction","action","side","onClick","disabled","icon","ariaLabel","handleClick","useMemo","buttonProps","label","position","button","checkOnClose","checked","summaryElement","onCloseSummary","clickEvent","current","contains","target","WizardSummary","props","inline","sectionsView","idSwitch","_uniqueId2","useRef","setChecked","useState","handleOnChange","useCallback","document","addEventListener","removeEventListener","container","ref","desktopSummaryTitle","id","name","checkbox","onChange","summary","tabletSummaryHeader","htmlFor","tabletSummaryTitle","NovaCompositionNavigationArrowDown","tabletSummaryIcon","summarySections","actionZone","propTypes","process","env","NODE_ENV","PropTypes","shape","string","bool","func","arrayOf","oneOfType","oneOf","ContentBadge","_default","exports"],"sources":["../../../src/molecule/wizard-summary/index.js"],"sourcesContent":["import React, {useMemo, useState, useCallback, useRef} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {uniqueId} from 'lodash/fp';\nimport {NovaCompositionNavigationArrowDown as ArrowDownIcon} from '@coorpacademy/nova-icons';\nimport ListBadges from '../list-badges';\nimport ButtonLink from '../../atom/button-link';\nimport ContentBadge from '../../atom/content-badge';\nimport style from './style.css';\n\nconst DIFF_MARKERS = {added: '+', removed: '−'};\nconst DIFF_CLASSES = {added: style.added, removed: style.removed};\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}`} data-name={item.title}>\n <span className={style.title}>{item.title}</span>\n <span className={style.value}>{item.value}</span>\n </li>\n );\n case 'content': {\n const {badgeList, badgeAriaLabel, title, author, unsaved = false} = item;\n return (\n <li className={style.contentWrapper} key={`${title}-${index}`} data-name={item.title}>\n <span className={style.contentCounter}>{index + 1}</span>\n <div className={style.contentItem}>\n <ListBadges aria-label={badgeAriaLabel} items={badgeList} />\n <div\n className={classnames(style.contentTitle, unsaved && style.unsaved)}\n title={title}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: title}}\n />\n {author ? <span className={style.author}>{author}</span> : null}\n </div>\n </li>\n );\n }\n case 'text':\n default: {\n const {text, unsaved = false, diff, diffLabel} = item;\n if (diff === 'added' || diff === 'removed')\n return (\n <li\n key={`${item.text}-${index}`}\n data-name={item.title}\n data-diff={diff}\n className={classnames(style.diffLine, DIFF_CLASSES[diff])}\n >\n <span className={style.diffMarker} aria-hidden=\"true\">\n {DIFF_MARKERS[diff]}\n </span>\n {diffLabel ? <span className={style.visuallyHidden}>{diffLabel}</span> : null}\n <span className={classnames(style.diffText, unsaved && style.unsaved)}>{text}</span>\n </li>\n );\n return (\n <li key={`${item.text}-${index}`} data-name={item.title}>\n <span className={classnames(style.valueSimpleText, unsaved && style.unsaved)}>\n {text}\n </span>\n </li>\n );\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\n key={`summary-section-${index}`}\n data-step={index}\n data-name={`summary-section-${index}`}\n className={style.sectionWrapper}\n >\n {sectionHeader}\n <ul>{itemsView}</ul>\n </div>\n );\n });\n};\n\nconst BuildAction = ({action, side}) => {\n const {onClick, text, disabled = false, icon, 'aria-label': ariaLabel} = action;\n const handleClick = useMemo(() => () => onClick(), [onClick]);\n\n if (!action) return null;\n\n const buttonProps = {\n type: 'text',\n label: text,\n disabled,\n 'aria-label': ariaLabel,\n 'data-name': `${icon}-button-${side}`,\n onClick: handleClick,\n icon: {\n position: 'left',\n type: icon\n }\n };\n\n return (\n <div className={style.button}>\n <ButtonLink {...buttonProps} />\n </div>\n );\n};\n\nconst checkOnClose = (checked, summaryElement, onCloseSummary, clickEvent) => {\n if (checked) {\n if (\n summaryElement &&\n summaryElement.current &&\n !summaryElement.current.contains(clickEvent.target)\n ) {\n onCloseSummary();\n }\n }\n};\n\nconst WizardSummary = props => {\n const {title, sections, action, side, inline = false} = props;\n const sectionsView = buildSections(sections);\n const idSwitch = uniqueId('open-summary-wizard');\n const summaryElement = useRef(null);\n const [checked, setChecked] = useState(false);\n\n const onCloseSummary = () => setChecked(false);\n const handleOnChange = useCallback(() => {\n if (!checked) {\n document.addEventListener('click', clickEvent =>\n checkOnClose(!checked, summaryElement, onCloseSummary, clickEvent)\n );\n document.addEventListener('touchstart', clickEvent =>\n checkOnClose(!checked, summaryElement, onCloseSummary, clickEvent)\n );\n } else {\n document.removeEventListener('click', clickEvent =>\n checkOnClose(!checked, summaryElement, onCloseSummary, clickEvent)\n );\n document.removeEventListener('touchstart', clickEvent =>\n checkOnClose(!checked, summaryElement, onCloseSummary, clickEvent)\n );\n }\n setChecked(!checked);\n }, [checked]);\n\n if (inline) return <div className={style.inline}>{sectionsView}</div>;\n\n return (\n <div className={style.container} ref={summaryElement}>\n <span className={style.desktopSummaryTitle} data-name={`summary-title-${side}`}>\n {title}\n </span>\n <input\n type=\"checkbox\"\n id={idSwitch}\n name=\"toogle\"\n title={idSwitch}\n className={style.checkbox}\n data-name={`summary-checkbox-${side}`}\n checked={checked}\n onChange={handleOnChange}\n />\n <div className={style.summary}>\n <div className={style.tabletSummaryHeader}>\n <label htmlFor={idSwitch}>\n <span className={style.tabletSummaryTitle}>{title}</span>\n <ArrowDownIcon className={style.tabletSummaryIcon} />\n </label>\n </div>\n <div className={style.summarySections} data-name={`summary-section-${side}`}>\n {sectionsView}\n </div>\n </div>\n <div className={style.actionZone} data-name={`summary-actions-${side}`}>\n <BuildAction action={action} side={side} />\n </div>\n </div>\n );\n};\n\nBuildAction.propTypes = {\n action: PropTypes.shape({\n icon: PropTypes.string,\n disabled: PropTypes.bool,\n text: PropTypes.string,\n onClick: PropTypes.func,\n 'aria-label': PropTypes.string\n }),\n side: PropTypes.string\n};\n\nWizardSummary.propTypes = {\n inline: PropTypes.bool,\n title: PropTypes.string,\n side: 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 unsaved: PropTypes.bool,\n // A diff line: green « + » when added, red « − » when removed\n diff: PropTypes.oneOf(['added', 'removed']),\n // Read by screen readers in place of the marker, e.g. 'Added' / 'Removed'\n diffLabel: PropTypes.string\n }),\n PropTypes.shape({\n type: PropTypes.string,\n badgeList: PropTypes.arrayOf(PropTypes.shape(ContentBadge.propTypes)),\n badgeAriaLabel: PropTypes.string,\n title: PropTypes.string,\n author: PropTypes.string,\n unsaved: PropTypes.bool\n })\n ])\n ),\n counterText: PropTypes.string\n })\n ),\n action: BuildAction.propTypes.action\n};\n\nexport default WizardSummary;\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAD,sBAAA,CAAAF,OAAA;AAEA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,WAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,aAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,MAAA,GAAAN,sBAAA,CAAAF,OAAA;AAAgC,SAAAS,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAX,wBAAAW,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,C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KAAK,CAAC,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;MAC3C;MACA3E,SAAS,EAAEoE,kBAAS,CAACE;IACvB,CAAC,CAAC,EACFF,kBAAS,CAACC,KAAK,CAAC;MACdxF,IAAI,EAAEuF,kBAAS,CAACE,MAAM;MACtBnF,SAAS,EAAEiF,kBAAS,CAACK,OAAO,CAACL,kBAAS,CAACC,KAAK,CAACO,qBAAY,CAACZ,SAAS,CAAC,CAAC;MACrE5E,cAAc,EAAEgF,kBAAS,CAACE,MAAM;MAChCtF,KAAK,EAAEoF,kBAAS,CAACE,MAAM;MACvBjF,MAAM,EAAE+E,kBAAS,CAACE,MAAM;MACxBhF,OAAO,EAAE8E,kBAAS,CAACG;IACrB,CAAC,CAAC,CACH,CACH,CAAC;IACD/D,WAAW,EAAE4D,kBAAS,CAACE;EACzB,CAAC,CACH,CAAC;EACDvD,MAAM,EAAED,WAAW,CAACkD,SAAS,CAACjD;AAChC,CAAC;AAAC,IAAA8D,QAAA,GAAAC,OAAA,CAAAzH,OAAA,GAEa8E,aAAa","ignoreList":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
@value colors: "../../variables/colors.css";
|
|
2
2
|
@value breakpoints: "../../variables/breakpoints.css";
|
|
3
|
+
@value cm_positive_100, cm_positive_200, cm_negative_100, cm_negative_200 from colors;
|
|
3
4
|
@value cm_primary_blue from colors;
|
|
4
5
|
@value cm_grey_50 from colors;
|
|
5
6
|
@value cm_grey_300 from colors;
|
|
@@ -32,6 +33,12 @@
|
|
|
32
33
|
height: calc(100% - 90px);
|
|
33
34
|
}
|
|
34
35
|
|
|
36
|
+
.inline {
|
|
37
|
+
font-family: Gilroy;
|
|
38
|
+
width: 100%;
|
|
39
|
+
overflow-wrap: anywhere;
|
|
40
|
+
}
|
|
41
|
+
|
|
35
42
|
.unsaved {
|
|
36
43
|
color: cm_yellow_200;
|
|
37
44
|
}
|
|
@@ -128,7 +135,8 @@
|
|
|
128
135
|
text-align: center;
|
|
129
136
|
}
|
|
130
137
|
|
|
131
|
-
.container ul
|
|
138
|
+
.container ul,
|
|
139
|
+
.inline ul {
|
|
132
140
|
list-style: none;
|
|
133
141
|
padding: 0px;
|
|
134
142
|
margin: 0px;
|
|
@@ -242,3 +250,48 @@
|
|
|
242
250
|
max-height: 500px;
|
|
243
251
|
}
|
|
244
252
|
}
|
|
253
|
+
|
|
254
|
+
.diffLine {
|
|
255
|
+
display: flex;
|
|
256
|
+
align-items: baseline;
|
|
257
|
+
gap: 12px;
|
|
258
|
+
margin: 4px 0 0;
|
|
259
|
+
padding: 4px 8px;
|
|
260
|
+
border-radius: 4px;
|
|
261
|
+
font-size: 14px;
|
|
262
|
+
font-weight: bold;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.added {
|
|
266
|
+
background-color: color(cm_positive_100 a(15%));
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.removed {
|
|
270
|
+
background-color: color(cm_negative_100 a(12%));
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.diffMarker {
|
|
274
|
+
min-width: 10px;
|
|
275
|
+
font-weight: bold;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.added .diffMarker {
|
|
279
|
+
color: cm_positive_200;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.removed .diffMarker {
|
|
283
|
+
color: cm_negative_200;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.diffText {
|
|
287
|
+
min-width: 0;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.visuallyHidden {
|
|
291
|
+
position: absolute;
|
|
292
|
+
width: 1px;
|
|
293
|
+
height: 1px;
|
|
294
|
+
overflow: hidden;
|
|
295
|
+
clip: rect(0 0 0 0);
|
|
296
|
+
white-space: nowrap;
|
|
297
|
+
}
|
|
@@ -85,6 +85,11 @@ declare namespace BrandLearningPriorities {
|
|
|
85
85
|
size: PropTypes.Requireable<number>;
|
|
86
86
|
wrapperSize: PropTypes.Requireable<number>;
|
|
87
87
|
}>>;
|
|
88
|
+
imageOverlay: PropTypes.Requireable<string>;
|
|
89
|
+
contentBadge: PropTypes.Requireable<PropTypes.InferProps<{
|
|
90
|
+
category: PropTypes.Requireable<string>;
|
|
91
|
+
label: PropTypes.Requireable<string>;
|
|
92
|
+
}>>;
|
|
88
93
|
image: PropTypes.Requireable<string>;
|
|
89
94
|
checkbox: PropTypes.Requireable<PropTypes.InferProps<{
|
|
90
95
|
value: PropTypes.Requireable<string>;
|
|
@@ -102,6 +107,7 @@ declare namespace BrandLearningPriorities {
|
|
|
102
107
|
customStyle: PropTypes.Requireable<{
|
|
103
108
|
[x: string]: NonNullable<string | number | null | undefined> | null | undefined;
|
|
104
109
|
}>;
|
|
110
|
+
className: PropTypes.Requireable<string>;
|
|
105
111
|
}>>;
|
|
106
112
|
}> | PropTypes.InferProps<{
|
|
107
113
|
title: PropTypes.Validator<string>;
|
|
@@ -26,6 +26,12 @@ declare namespace BrandTable {
|
|
|
26
26
|
const rows: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
27
27
|
fields: PropTypes.Requireable<(NonNullable<string | PropTypes.InferProps<{
|
|
28
28
|
icon: PropTypes.Requireable<string>;
|
|
29
|
+
title: PropTypes.Requireable<string>;
|
|
30
|
+
text: PropTypes.Requireable<string>;
|
|
31
|
+
tags: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
32
|
+
status: PropTypes.Requireable<string>;
|
|
33
|
+
label: PropTypes.Validator<string>;
|
|
34
|
+
}> | null | undefined)[]>;
|
|
29
35
|
}> | null | undefined> | null | undefined)[]>;
|
|
30
36
|
editHref: PropTypes.Requireable<string>;
|
|
31
37
|
highlighted: PropTypes.Requireable<boolean>;
|
|
@@ -34,6 +40,8 @@ declare namespace BrandTable {
|
|
|
34
40
|
title: PropTypes.Validator<string>;
|
|
35
41
|
info: PropTypes.Requireable<string>;
|
|
36
42
|
filtered: PropTypes.Requireable<boolean>;
|
|
43
|
+
order: PropTypes.Requireable<string>;
|
|
44
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
37
45
|
options: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
38
46
|
title: PropTypes.Validator<string>;
|
|
39
47
|
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ContentPropsType } from './types';
|
|
3
|
+
export declare const buildButtonProps: (button: {
|
|
4
|
+
label: string;
|
|
5
|
+
onClick?: () => void;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}) => {
|
|
8
|
+
type: string;
|
|
9
|
+
'aria-label': string;
|
|
10
|
+
'data-name': string;
|
|
11
|
+
hoverBackgroundColor: "#D6E6FF";
|
|
12
|
+
hoverColor: "#0061FF";
|
|
13
|
+
icon: {
|
|
14
|
+
position: string;
|
|
15
|
+
faIcon: {
|
|
16
|
+
name: string;
|
|
17
|
+
color: "#0061FF";
|
|
18
|
+
size: number;
|
|
19
|
+
customStyle: {
|
|
20
|
+
padding: number;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
customStyle: {
|
|
25
|
+
width: string;
|
|
26
|
+
backgroundColor: "#f1f6fe";
|
|
27
|
+
color: "#0061FF";
|
|
28
|
+
borderRadius: string;
|
|
29
|
+
fontWeight: number;
|
|
30
|
+
};
|
|
31
|
+
label: string;
|
|
32
|
+
onClick?: (() => void) | undefined;
|
|
33
|
+
disabled?: boolean | undefined;
|
|
34
|
+
};
|
|
35
|
+
declare const ContentSelectionList: {
|
|
36
|
+
({ title, subtitle, button, list: { title: listTitle, items, search, emptyResult }, actionButtons, checkboxWithTitle: checkboxWithTitleProps, readOnly, isFetching, error, hiddenLabel }: ContentPropsType): JSX.Element;
|
|
37
|
+
propTypes: {
|
|
38
|
+
title: import("prop-types").Validator<string>;
|
|
39
|
+
subtitle: import("prop-types").Requireable<string>;
|
|
40
|
+
button: import("prop-types").Validator<NonNullable<import("prop-types").InferProps<{
|
|
41
|
+
label: import("prop-types").Validator<string>;
|
|
42
|
+
onClick: import("prop-types").Validator<(...args: any[]) => any>;
|
|
43
|
+
}>>>;
|
|
44
|
+
list: import("prop-types").Validator<NonNullable<import("prop-types").InferProps<{
|
|
45
|
+
title: import("prop-types").Requireable<string>;
|
|
46
|
+
items: import("prop-types").Requireable<NonNullable<import("prop-types").InferProps<{
|
|
47
|
+
hidden: import("prop-types").Requireable<boolean>;
|
|
48
|
+
hint: import("prop-types").Requireable<string>;
|
|
49
|
+
ref: import("prop-types").Validator<string>;
|
|
50
|
+
title: import("prop-types").Validator<string>;
|
|
51
|
+
subtitle: import("prop-types").Validator<string>;
|
|
52
|
+
image: import("prop-types").Validator<string>;
|
|
53
|
+
tags: import("prop-types").Validator<NonNullable<import("prop-types").InferProps<{
|
|
54
|
+
label: import("prop-types").Validator<string>;
|
|
55
|
+
iconName: import("prop-types").Validator<string>;
|
|
56
|
+
}>>>;
|
|
57
|
+
checkbox: import("prop-types").Validator<NonNullable<import("prop-types").InferProps<{
|
|
58
|
+
checked: import("prop-types").Validator<boolean>;
|
|
59
|
+
onChange: import("prop-types").Validator<(...args: any[]) => any>;
|
|
60
|
+
}>>>;
|
|
61
|
+
deleteButton: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
62
|
+
label: import("prop-types").Requireable<string>;
|
|
63
|
+
'aria-label': import("prop-types").Requireable<string>;
|
|
64
|
+
onClick: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
65
|
+
}>>;
|
|
66
|
+
}>>[]>;
|
|
67
|
+
search: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
68
|
+
value: import("prop-types").Validator<string>;
|
|
69
|
+
placeholder: import("prop-types").Validator<string>;
|
|
70
|
+
onChange: import("prop-types").Validator<(...args: any[]) => any>;
|
|
71
|
+
}>>;
|
|
72
|
+
emptyResult: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
73
|
+
title: import("prop-types").Validator<string>;
|
|
74
|
+
description: import("prop-types").Validator<string>;
|
|
75
|
+
}>>;
|
|
76
|
+
checkbox: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
77
|
+
title: import("prop-types").Validator<string>;
|
|
78
|
+
checked: import("prop-types").Validator<boolean>;
|
|
79
|
+
onChange: import("prop-types").Validator<(...args: any[]) => any>;
|
|
80
|
+
}>>;
|
|
81
|
+
}>>>;
|
|
82
|
+
error: import("prop-types").Requireable<string>;
|
|
83
|
+
hiddenLabel: import("prop-types").Requireable<string>;
|
|
84
|
+
isFetching: import("prop-types").Requireable<boolean>;
|
|
85
|
+
actionButtons: import("prop-types").Requireable<(object | null | undefined)[]>;
|
|
86
|
+
checkboxWithTitle: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
87
|
+
title: import("prop-types").Requireable<string>;
|
|
88
|
+
checked: import("prop-types").Requireable<boolean>;
|
|
89
|
+
onChange: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
90
|
+
}>>;
|
|
91
|
+
readOnly: import("prop-types").Requireable<boolean>;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
export default ContentSelectionList;
|
|
95
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/organism/content-selection-list/index.tsx"],"names":[],"mappings":";AASA,OAAO,EAAC,gBAAgB,EAAqD,MAAM,SAAS,CAAC;AAE7F,eAAO,MAAM,gBAAgB,WAAY;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;;;;;;;;;;;;;;;;;;;;;;;;WAHQ,MAAM;qBACG,IAAI;;CAyBpB,CAAC;AA+DH,QAAA,MAAM,oBAAoB;8LAWvB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiElB,CAAC;AAIF,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = exports.buildButtonProps = void 0;
|
|
5
|
+
var _map2 = _interopRequireDefault(require("lodash/fp/map"));
|
|
6
|
+
var _isEmpty2 = _interopRequireDefault(require("lodash/fp/isEmpty"));
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
+
var _listItems = _interopRequireDefault(require("../list-items"));
|
|
10
|
+
var _title = _interopRequireDefault(require("../../atom/title"));
|
|
11
|
+
var _notification = _interopRequireDefault(require("../../atom/notification"));
|
|
12
|
+
var _colors = require("../../variables/colors");
|
|
13
|
+
var _styles = require("../skill-edition/styles");
|
|
14
|
+
var _style = _interopRequireDefault(require("./style.css"));
|
|
15
|
+
var _types = require("./types");
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
const buildButtonProps = button => ({
|
|
18
|
+
...button,
|
|
19
|
+
type: 'primary',
|
|
20
|
+
'aria-label': button.label,
|
|
21
|
+
'data-name': `button-${button.label}`,
|
|
22
|
+
hoverBackgroundColor: _colors.COLORS.primary_100,
|
|
23
|
+
hoverColor: _colors.COLORS.cm_primary_blue,
|
|
24
|
+
icon: {
|
|
25
|
+
position: 'left',
|
|
26
|
+
faIcon: {
|
|
27
|
+
name: 'plus',
|
|
28
|
+
color: _colors.COLORS.cm_primary_blue,
|
|
29
|
+
size: 14,
|
|
30
|
+
customStyle: {
|
|
31
|
+
padding: 0
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
customStyle: {
|
|
36
|
+
width: 'fit-content',
|
|
37
|
+
backgroundColor: _colors.COLORS.cm_blue_50,
|
|
38
|
+
color: _colors.COLORS.cm_primary_blue,
|
|
39
|
+
borderRadius: '12px',
|
|
40
|
+
fontWeight: 600
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
exports.buildButtonProps = buildButtonProps;
|
|
44
|
+
const buildContentItem = (readOnly, hiddenLabel) => ({
|
|
45
|
+
ref,
|
|
46
|
+
title,
|
|
47
|
+
subtitle,
|
|
48
|
+
image,
|
|
49
|
+
tags: {
|
|
50
|
+
label,
|
|
51
|
+
iconName
|
|
52
|
+
},
|
|
53
|
+
checkbox,
|
|
54
|
+
deleteButton,
|
|
55
|
+
hidden,
|
|
56
|
+
hint
|
|
57
|
+
}) => {
|
|
58
|
+
return {
|
|
59
|
+
...(readOnly ? {} : {
|
|
60
|
+
secondButtonLink: {
|
|
61
|
+
...deleteButton,
|
|
62
|
+
'data-name': `button-${deleteButton?.label}`,
|
|
63
|
+
type: 'primary',
|
|
64
|
+
customStyle: {
|
|
65
|
+
width: 'fit-content',
|
|
66
|
+
backgroundColor: 'transparent'
|
|
67
|
+
},
|
|
68
|
+
hoverBackgroundColor: _colors.COLORS.cm_grey_100,
|
|
69
|
+
icon: {
|
|
70
|
+
position: 'left',
|
|
71
|
+
faIcon: {
|
|
72
|
+
name: 'trash',
|
|
73
|
+
color: _colors.COLORS.neutral_500,
|
|
74
|
+
size: 16
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}),
|
|
79
|
+
imageOverlay: hidden ? 'hidden' : undefined,
|
|
80
|
+
contentBadge: hidden ? {
|
|
81
|
+
category: 'hidden',
|
|
82
|
+
label: hiddenLabel
|
|
83
|
+
} : undefined,
|
|
84
|
+
details: hint,
|
|
85
|
+
id: ref,
|
|
86
|
+
title,
|
|
87
|
+
subtitle,
|
|
88
|
+
image,
|
|
89
|
+
tags: [{
|
|
90
|
+
label,
|
|
91
|
+
type: 'default',
|
|
92
|
+
icon: {
|
|
93
|
+
iconName,
|
|
94
|
+
preset: 's',
|
|
95
|
+
customStyle: {
|
|
96
|
+
padding: 0
|
|
97
|
+
},
|
|
98
|
+
position: 'left'
|
|
99
|
+
}
|
|
100
|
+
}],
|
|
101
|
+
checkbox: readOnly ? undefined : checkbox
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
const ContentSelectionList = ({
|
|
105
|
+
title,
|
|
106
|
+
subtitle,
|
|
107
|
+
button,
|
|
108
|
+
list: {
|
|
109
|
+
title: listTitle,
|
|
110
|
+
items,
|
|
111
|
+
search,
|
|
112
|
+
emptyResult
|
|
113
|
+
},
|
|
114
|
+
actionButtons,
|
|
115
|
+
checkboxWithTitle: checkboxWithTitleProps,
|
|
116
|
+
readOnly = false,
|
|
117
|
+
isFetching = false,
|
|
118
|
+
error,
|
|
119
|
+
hiddenLabel
|
|
120
|
+
}) => {
|
|
121
|
+
const buttonProps = buildButtonProps(button);
|
|
122
|
+
const titleProps = {
|
|
123
|
+
type: 'form-group',
|
|
124
|
+
title,
|
|
125
|
+
subtitle,
|
|
126
|
+
button: !readOnly ? buttonProps : undefined,
|
|
127
|
+
required: true
|
|
128
|
+
};
|
|
129
|
+
const listProps = {
|
|
130
|
+
title: listTitle,
|
|
131
|
+
'aria-label': 'content list items',
|
|
132
|
+
content: {
|
|
133
|
+
...(!(0, _isEmpty2.default)(emptyResult) && {
|
|
134
|
+
emptyResult: {
|
|
135
|
+
...emptyResult,
|
|
136
|
+
button: buttonProps
|
|
137
|
+
}
|
|
138
|
+
}),
|
|
139
|
+
items: (0, _map2.default)(buildContentItem(readOnly, hiddenLabel), items),
|
|
140
|
+
type: 'list'
|
|
141
|
+
},
|
|
142
|
+
search: search ? {
|
|
143
|
+
...search,
|
|
144
|
+
theme: 'coorpmanager',
|
|
145
|
+
// Keep search interactive even in readOnly mode
|
|
146
|
+
disabled: false
|
|
147
|
+
} : undefined,
|
|
148
|
+
actionButtons: readOnly ? [] : (0, _map2.default)(actionButton => ({
|
|
149
|
+
...actionButton,
|
|
150
|
+
customStyle: {
|
|
151
|
+
fontWeight: '600',
|
|
152
|
+
borderRadius: '12px',
|
|
153
|
+
width: 'auto'
|
|
154
|
+
}
|
|
155
|
+
}), actionButtons),
|
|
156
|
+
checkboxWithTitle: readOnly ? undefined : {
|
|
157
|
+
...checkboxWithTitleProps,
|
|
158
|
+
name: checkboxWithTitleProps?.title,
|
|
159
|
+
'aria-label': checkboxWithTitleProps?.title,
|
|
160
|
+
'data-name': checkboxWithTitleProps?.title,
|
|
161
|
+
className: _style.default.checkboxWithTitle,
|
|
162
|
+
icon: {
|
|
163
|
+
iconName: 'minus',
|
|
164
|
+
iconColor: 'white',
|
|
165
|
+
preset: 's'
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
isFetching
|
|
169
|
+
};
|
|
170
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
171
|
+
className: (0, _classnames.default)(_styles.contentContainer, _style.default.list)
|
|
172
|
+
}, /*#__PURE__*/_react.default.createElement(_title.default, titleProps), error ? /*#__PURE__*/_react.default.createElement("div", {
|
|
173
|
+
role: "alert"
|
|
174
|
+
}, /*#__PURE__*/_react.default.createElement(_notification.default, {
|
|
175
|
+
type: "error",
|
|
176
|
+
message: error
|
|
177
|
+
})) : null, /*#__PURE__*/_react.default.createElement(_listItems.default, listProps));
|
|
178
|
+
};
|
|
179
|
+
ContentSelectionList.propTypes = process.env.NODE_ENV !== "production" ? _types.ContentSelectionListPropTypes : {};
|
|
180
|
+
var _default = exports.default = ContentSelectionList;
|
|
181
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_react","_interopRequireDefault","require","_classnames","_listItems","_title","_notification","_colors","_styles","_style","_types","e","__esModule","default","buildButtonProps","button","type","label","hoverBackgroundColor","COLORS","primary_100","hoverColor","cm_primary_blue","icon","position","faIcon","name","color","size","customStyle","padding","width","backgroundColor","cm_blue_50","borderRadius","fontWeight","exports","buildContentItem","readOnly","hiddenLabel","ref","title","subtitle","image","tags","iconName","checkbox","deleteButton","hidden","hint","secondButtonLink","cm_grey_100","neutral_500","imageOverlay","undefined","contentBadge","category","details","id","preset","ContentSelectionList","list","listTitle","items","search","emptyResult","actionButtons","checkboxWithTitle","checkboxWithTitleProps","isFetching","error","buttonProps","titleProps","required","listProps","content","_isEmpty2","_map2","theme","disabled","actionButton","className","style","iconColor","createElement","classnames","contentContainer","role","message","propTypes","process","env","NODE_ENV","ContentSelectionListPropTypes","_default"],"sources":["../../../src/organism/content-selection-list/index.tsx"],"sourcesContent":["import React from 'react';\nimport classnames from 'classnames';\nimport {isEmpty, map} from 'lodash/fp';\nimport ListItems from '../list-items';\nimport Title from '../../atom/title';\nimport Notification from '../../atom/notification';\nimport {COLORS} from '../../variables/colors';\nimport {contentContainer} from '../skill-edition/styles';\nimport style from './style.css';\nimport {ContentPropsType, ContentListItemType, ContentSelectionListPropTypes} from './types';\n\nexport const buildButtonProps = (button: {\n label: string;\n onClick?: () => void;\n disabled?: boolean;\n}) => ({\n ...button,\n type: 'primary',\n 'aria-label': button.label,\n 'data-name': `button-${button.label}`,\n hoverBackgroundColor: COLORS.primary_100,\n hoverColor: COLORS.cm_primary_blue,\n icon: {\n position: 'left',\n faIcon: {\n name: 'plus',\n color: COLORS.cm_primary_blue,\n size: 14,\n customStyle: {padding: 0}\n }\n },\n customStyle: {\n width: 'fit-content',\n backgroundColor: COLORS.cm_blue_50,\n color: COLORS.cm_primary_blue,\n borderRadius: '12px',\n fontWeight: 600\n }\n});\n\nconst buildContentItem =\n (readOnly: boolean, hiddenLabel?: string) =>\n ({\n ref,\n title,\n subtitle,\n image,\n tags: {label, iconName},\n checkbox,\n deleteButton,\n hidden,\n hint\n }: ContentListItemType) => {\n return {\n ...(readOnly\n ? {}\n : {\n secondButtonLink: {\n ...deleteButton,\n 'data-name': `button-${deleteButton?.label}`,\n type: 'primary',\n customStyle: {\n width: 'fit-content',\n backgroundColor: 'transparent'\n },\n hoverBackgroundColor: COLORS.cm_grey_100,\n icon: {\n position: 'left',\n faIcon: {\n name: 'trash',\n color: COLORS.neutral_500,\n size: 16\n }\n }\n }\n }),\n imageOverlay: hidden ? 'hidden' : undefined,\n contentBadge: hidden ? {category: 'hidden', label: hiddenLabel} : undefined,\n details: hint,\n id: ref,\n title,\n subtitle,\n image,\n tags: [\n {\n label,\n type: 'default',\n icon: {\n iconName,\n preset: 's',\n customStyle: {\n padding: 0\n },\n position: 'left'\n }\n }\n ],\n checkbox: readOnly ? undefined : checkbox\n };\n };\n\nconst ContentSelectionList = ({\n title,\n subtitle,\n button,\n list: {title: listTitle, items, search, emptyResult},\n actionButtons,\n checkboxWithTitle: checkboxWithTitleProps,\n readOnly = false,\n isFetching = false,\n error,\n hiddenLabel\n}: ContentPropsType) => {\n const buttonProps = buildButtonProps(button);\n\n const titleProps = {\n type: 'form-group',\n title,\n subtitle,\n button: !readOnly ? buttonProps : undefined,\n required: true\n };\n\n const listProps = {\n title: listTitle,\n 'aria-label': 'content list items',\n content: {\n ...(!isEmpty(emptyResult) && {emptyResult: {...emptyResult, button: buttonProps}}),\n items: map(buildContentItem(readOnly, hiddenLabel), items),\n type: 'list'\n },\n search: search\n ? {\n ...search,\n theme: 'coorpmanager',\n // Keep search interactive even in readOnly mode\n disabled: false\n }\n : undefined,\n actionButtons: readOnly\n ? []\n : map(\n actionButton => ({\n ...actionButton,\n customStyle: {\n fontWeight: '600',\n borderRadius: '12px',\n width: 'auto'\n }\n }),\n actionButtons\n ),\n\n checkboxWithTitle: readOnly\n ? undefined\n : {\n ...checkboxWithTitleProps,\n name: checkboxWithTitleProps?.title,\n 'aria-label': checkboxWithTitleProps?.title,\n 'data-name': checkboxWithTitleProps?.title,\n className: style.checkboxWithTitle,\n icon: {iconName: 'minus', iconColor: 'white', preset: 's'}\n },\n isFetching\n };\n\n return (\n <div className={classnames(contentContainer, style.list)}>\n <Title {...titleProps} />\n {error ? (\n <div role=\"alert\">\n <Notification type=\"error\" message={error} />\n </div>\n ) : null}\n <ListItems {...listProps} />\n </div>\n );\n};\n\nContentSelectionList.propTypes = ContentSelectionListPropTypes;\n\nexport default ContentSelectionList;\n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