@coorpacademy/components 11.12.3-alpha.4 → 11.12.3-alpha.6
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/battle-opponent/index.d.ts.map +1 -1
- package/es/atom/battle-opponent/index.js +4 -2
- package/es/atom/battle-opponent/index.js.map +1 -1
- package/es/atom/battle-opponent/style.css +12 -0
- package/es/atom/button/index.d.ts +14 -3
- package/es/atom/button/index.d.ts.map +1 -1
- package/es/atom/button/index.js +60 -27
- package/es/atom/button/index.js.map +1 -1
- package/es/atom/tooltip/index.d.ts.map +1 -1
- package/es/atom/tooltip/index.js +2 -1
- package/es/atom/tooltip/index.js.map +1 -1
- package/es/molecule/brand-form-group/index.d.ts +14 -3
- package/es/molecule/card/customer.js +1 -1
- package/es/molecule/card/customer.js.map +1 -1
- package/es/molecule/card/favorite.css +15 -35
- package/es/molecule/card/favorite.d.ts +1 -0
- package/es/molecule/card/favorite.d.ts.map +1 -1
- package/es/molecule/card/favorite.js +73 -18
- package/es/molecule/card/favorite.js.map +1 -1
- package/es/molecule/card/selectable.js +1 -1
- package/es/molecule/card/selectable.js.map +1 -1
- package/es/molecule/course-section/style.css +6 -4
- package/es/molecule/draggable/style.css +5 -9
- package/es/molecule/draggable-list/index.d.ts +2 -50
- package/es/molecule/draggable-list/index.d.ts.map +1 -1
- package/es/molecule/draggable-list/index.js +2 -4
- package/es/molecule/draggable-list/index.js.map +1 -1
- package/es/organism/brand-form/index.d.ts +14 -3
- package/es/organism/list-item/index.d.ts +0 -1
- package/es/organism/list-item/index.js +1 -2
- package/es/organism/list-item/index.js.map +1 -1
- package/es/organism/list-item/style.css +4 -6
- package/es/organism/list-items/index.d.ts +1 -4
- package/es/organism/list-items/index.d.ts.map +1 -1
- package/es/organism/list-items/index.js +13 -31
- package/es/organism/list-items/index.js.map +1 -1
- package/es/organism/wizard-contents/index.d.ts +14 -3
- package/es/template/back-office/brand-update/index.d.ts +28 -8
- package/es/template/common/search-page/index.d.ts +14 -3
- package/lib/atom/battle-opponent/index.d.ts.map +1 -1
- package/lib/atom/battle-opponent/index.js +4 -2
- package/lib/atom/battle-opponent/index.js.map +1 -1
- package/lib/atom/battle-opponent/style.css +12 -0
- package/lib/atom/button/index.d.ts +14 -3
- package/lib/atom/button/index.d.ts.map +1 -1
- package/lib/atom/button/index.js +65 -27
- package/lib/atom/button/index.js.map +1 -1
- package/lib/atom/tooltip/index.d.ts.map +1 -1
- package/lib/atom/tooltip/index.js +2 -1
- package/lib/atom/tooltip/index.js.map +1 -1
- package/lib/molecule/brand-form-group/index.d.ts +14 -3
- package/lib/molecule/card/customer.js +1 -1
- package/lib/molecule/card/customer.js.map +1 -1
- package/lib/molecule/card/favorite.css +15 -35
- package/lib/molecule/card/favorite.d.ts +1 -0
- package/lib/molecule/card/favorite.d.ts.map +1 -1
- package/lib/molecule/card/favorite.js +75 -16
- package/lib/molecule/card/favorite.js.map +1 -1
- package/lib/molecule/card/selectable.js +1 -1
- package/lib/molecule/card/selectable.js.map +1 -1
- package/lib/molecule/course-section/style.css +6 -4
- package/lib/molecule/draggable/style.css +5 -9
- package/lib/molecule/draggable-list/index.d.ts +2 -50
- package/lib/molecule/draggable-list/index.d.ts.map +1 -1
- package/lib/molecule/draggable-list/index.js +2 -5
- package/lib/molecule/draggable-list/index.js.map +1 -1
- package/lib/organism/brand-form/index.d.ts +14 -3
- package/lib/organism/list-item/index.d.ts +0 -1
- package/lib/organism/list-item/index.js +1 -2
- package/lib/organism/list-item/index.js.map +1 -1
- package/lib/organism/list-item/style.css +4 -6
- package/lib/organism/list-items/index.d.ts +1 -4
- package/lib/organism/list-items/index.d.ts.map +1 -1
- package/lib/organism/list-items/index.js +13 -33
- package/lib/organism/list-items/index.js.map +1 -1
- package/lib/organism/wizard-contents/index.d.ts +14 -3
- package/lib/template/back-office/brand-update/index.d.ts +28 -8
- package/lib/template/common/search-page/index.d.ts +14 -3
- package/package.json +2 -2
|
@@ -27,7 +27,7 @@ const Customer = props => {
|
|
|
27
27
|
type,
|
|
28
28
|
coorpOriginal,
|
|
29
29
|
theme,
|
|
30
|
-
disabled
|
|
30
|
+
disabled,
|
|
31
31
|
'aria-label': ariaLabel
|
|
32
32
|
} = props;
|
|
33
33
|
const className = (0, _classnames.default)(THEMES[theme], _customer.default.customer, type === 'chapter' ? _customer.default.chapterCustomer : null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customer.js","names":["THEMES","default","coorpmanager","style","Customer","props","name","type","coorpOriginal","theme","disabled","ariaLabel","className","classnames","customer","chapterCustomer","content","coorp","original","propTypes","PropTypes","oneOf","string","bool","isRequired"],"sources":["../../../src/molecule/card/customer.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {keys} from 'lodash/fp';\nimport style from './customer.css';\n\nexport const THEMES = {\n default: null,\n coorpmanager: style.coorpmanager\n};\n\nconst Customer = props => {\n const {name, type, coorpOriginal, theme, disabled
|
|
1
|
+
{"version":3,"file":"customer.js","names":["THEMES","default","coorpmanager","style","Customer","props","name","type","coorpOriginal","theme","disabled","ariaLabel","className","classnames","customer","chapterCustomer","content","coorp","original","propTypes","PropTypes","oneOf","string","bool","isRequired"],"sources":["../../../src/molecule/card/customer.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {keys} from 'lodash/fp';\nimport style from './customer.css';\n\nexport const THEMES = {\n default: null,\n coorpmanager: style.coorpmanager\n};\n\nconst Customer = props => {\n const {name, type, coorpOriginal, theme, disabled, 'aria-label': ariaLabel} = props;\n const className = classnames(\n THEMES[theme],\n style.customer,\n type === 'chapter' ? style.chapterCustomer : null\n );\n\n return (\n <div className={className} disabled={disabled} aria-label={ariaLabel}>\n <div className={style.content}>\n {coorpOriginal ? <span className={style.coorp}>Coorp </span> : null}\n {coorpOriginal ? <span className={style.original}>Original </span> : null}\n {!coorpOriginal && name}\n </div>\n </div>\n );\n};\n\nCustomer.propTypes = {\n theme: PropTypes.oneOf(keys(THEMES)),\n type: PropTypes.string,\n name: PropTypes.string,\n coorpOriginal: PropTypes.bool.isRequired,\n disabled: PropTypes.bool,\n 'aria-label': PropTypes.string\n};\n\nexport default Customer;\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAEA;;;;AAEO,MAAMA,MAAM,GAAG;EACpBC,OAAO,EAAE,IADW;EAEpBC,YAAY,EAAEC,iBAAA,CAAMD;AAFA,CAAf;;;AAKP,MAAME,QAAQ,GAAGC,KAAK,IAAI;EACxB,MAAM;IAACC,IAAD;IAAOC,IAAP;IAAaC,aAAb;IAA4BC,KAA5B;IAAmCC,QAAnC;IAA6C,cAAcC;EAA3D,IAAwEN,KAA9E;EACA,MAAMO,SAAS,GAAG,IAAAC,mBAAA,EAChBb,MAAM,CAACS,KAAD,CADU,EAEhBN,iBAAA,CAAMW,QAFU,EAGhBP,IAAI,KAAK,SAAT,GAAqBJ,iBAAA,CAAMY,eAA3B,GAA6C,IAH7B,CAAlB;EAMA,oBACE;IAAK,SAAS,EAAEH,SAAhB;IAA2B,QAAQ,EAAEF,QAArC;IAA+C,cAAYC;EAA3D,gBACE;IAAK,SAAS,EAAER,iBAAA,CAAMa;EAAtB,GACGR,aAAa,gBAAG;IAAM,SAAS,EAAEL,iBAAA,CAAMc;EAAvB,YAAH,GAAiD,IADjE,EAEGT,aAAa,gBAAG;IAAM,SAAS,EAAEL,iBAAA,CAAMe;EAAvB,eAAH,GAAuD,IAFvE,EAGG,CAACV,aAAD,IAAkBF,IAHrB,CADF,CADF;AASD,CAjBD;;AAmBAF,QAAQ,CAACe,SAAT,2CAAqB;EACnBV,KAAK,EAAEW,kBAAA,CAAUC,KAAV,CAAgB,oBAAKrB,MAAL,CAAhB,CADY;EAEnBO,IAAI,EAAEa,kBAAA,CAAUE,MAFG;EAGnBhB,IAAI,EAAEc,kBAAA,CAAUE,MAHG;EAInBd,aAAa,EAAEY,kBAAA,CAAUG,IAAV,CAAeC,UAJX;EAKnBd,QAAQ,EAAEU,kBAAA,CAAUG,IALD;EAMnB,cAAcH,kBAAA,CAAUE;AANL,CAArB;eASelB,Q"}
|
|
@@ -16,10 +16,12 @@
|
|
|
16
16
|
z-index: 1;
|
|
17
17
|
font-size: 30px;
|
|
18
18
|
overflow: hidden;
|
|
19
|
-
line-height:
|
|
19
|
+
line-height: 0px;
|
|
20
20
|
box-shadow: 0 0 13px 0 rgba(0, 0, 0, 0.11);
|
|
21
21
|
background-color: #ffffff;
|
|
22
22
|
border-radius: 100%;
|
|
23
|
+
border: none;
|
|
24
|
+
padding: 0;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
.favorite:hover .moreIcon {
|
|
@@ -29,10 +31,6 @@
|
|
|
29
31
|
.favorite .moreIcon {
|
|
30
32
|
color: color(black a(63%));
|
|
31
33
|
transition: color 0.25s ease-in-out;
|
|
32
|
-
margin: 6px;
|
|
33
|
-
}
|
|
34
|
-
.favorite .checkIcon {
|
|
35
|
-
margin: 6px;
|
|
36
34
|
}
|
|
37
35
|
|
|
38
36
|
.favorite.selected .moreIcon {
|
|
@@ -47,48 +45,30 @@
|
|
|
47
45
|
color: inherit;
|
|
48
46
|
}
|
|
49
47
|
|
|
50
|
-
.
|
|
51
|
-
visibility: hidden;
|
|
52
|
-
background-color: color(black a(80%));
|
|
53
|
-
color: #fff;
|
|
54
|
-
text-align: center;
|
|
55
|
-
border-radius: 3px;
|
|
56
|
-
z-index: 1;
|
|
57
|
-
opacity: 0;
|
|
58
|
-
transition: opacity 0.8s;
|
|
48
|
+
.favoriteWrapper {
|
|
59
49
|
position: absolute;
|
|
60
|
-
|
|
61
|
-
right: 45px;
|
|
62
|
-
top: 8px;
|
|
50
|
+
width: 100%;
|
|
63
51
|
}
|
|
64
52
|
|
|
65
|
-
.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
border: solid 5px ;
|
|
71
|
-
border-color: transparent transparent transparent color(black a(80%));
|
|
53
|
+
.favoriteWrapper .favorite + [class*="__react_component_tooltip"]:not([class*="toolTipReact"]) {
|
|
54
|
+
position: sticky;
|
|
55
|
+
top: unset !important;
|
|
56
|
+
left: unset !important;
|
|
57
|
+
transform: translateX(25%);
|
|
72
58
|
}
|
|
73
59
|
|
|
74
|
-
.
|
|
75
|
-
|
|
76
|
-
opacity: 1;
|
|
60
|
+
.favoriteWrapper .favorite + [class*="__react_component_tooltip"] {
|
|
61
|
+
opacity: 0.95!important;
|
|
77
62
|
}
|
|
78
63
|
|
|
79
|
-
.showToolTip span {
|
|
80
|
-
display: block;
|
|
81
|
-
word-wrap: break-word;
|
|
82
|
-
padding: 3px 10px 5px;
|
|
83
|
-
font-family: "Gilroy";
|
|
84
|
-
font-size: 12px;
|
|
85
|
-
font-weight: bold;
|
|
86
|
-
}
|
|
87
64
|
|
|
88
65
|
@media mobile {
|
|
89
66
|
.favorite {
|
|
90
67
|
font-size: 33px;
|
|
91
68
|
}
|
|
69
|
+
.favoriteWrapper .favorite + [class*="__react_component_tooltip"]:not([class*="toolTipReact"]) {
|
|
70
|
+
transform: translateX(10%);
|
|
71
|
+
}
|
|
92
72
|
}
|
|
93
73
|
|
|
94
74
|
@media (hover: none) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"favorite.d.ts","sourceRoot":"","sources":["../../../src/molecule/card/favorite.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"favorite.d.ts","sourceRoot":"","sources":["../../../src/molecule/card/favorite.js"],"names":[],"mappings":";AAcA;;;;;;;;oCA0IC"}
|
|
@@ -7,6 +7,8 @@ var _noop2 = _interopRequireDefault(require("lodash/fp/noop"));
|
|
|
7
7
|
|
|
8
8
|
var _isEmpty2 = _interopRequireDefault(require("lodash/fp/isEmpty"));
|
|
9
9
|
|
|
10
|
+
var _has2 = _interopRequireDefault(require("lodash/fp/has"));
|
|
11
|
+
|
|
10
12
|
var _get2 = _interopRequireDefault(require("lodash/fp/get"));
|
|
11
13
|
|
|
12
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -15,10 +17,16 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
15
17
|
|
|
16
18
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
19
|
|
|
20
|
+
var _uuid = require("uuid");
|
|
21
|
+
|
|
18
22
|
var _novaIcons = require("@coorpacademy/nova-icons");
|
|
19
23
|
|
|
20
24
|
var _provider = _interopRequireWildcard(require("../../atom/provider"));
|
|
21
25
|
|
|
26
|
+
var _tooltip = _interopRequireWildcard(require("../../atom/tooltip"));
|
|
27
|
+
|
|
28
|
+
var _button = _interopRequireDefault(require("../../atom/button"));
|
|
29
|
+
|
|
22
30
|
var _favorite = _interopRequireDefault(require("./favorite.css"));
|
|
23
31
|
|
|
24
32
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -37,6 +45,7 @@ const Favorite = ({
|
|
|
37
45
|
disabled
|
|
38
46
|
}, legacyContext) => {
|
|
39
47
|
const skin = (0, _provider.GetSkinFromContext)(legacyContext);
|
|
48
|
+
const translate = (0, _provider.GetTranslateFromContext)(legacyContext);
|
|
40
49
|
const handleFavoriteClick = (0, _react.useCallback)(e => {
|
|
41
50
|
e.stopPropagation();
|
|
42
51
|
e.preventDefault();
|
|
@@ -45,26 +54,43 @@ const Favorite = ({
|
|
|
45
54
|
const primaryColor = (0, _get2.default)('common.primary', skin);
|
|
46
55
|
const darkColor = (0, _get2.default)('common.dark', skin);
|
|
47
56
|
const brandColor = (0, _get2.default)('common.brand', skin);
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
const buttonRef = (0, _react.useRef)(null);
|
|
58
|
+
const allowToolTip = (0, _react.useMemo)(() => !(0, _isEmpty2.default)(removeFavoriteToolTip) && !(0, _isEmpty2.default)(addFavoriteToolTip), [addFavoriteToolTip, removeFavoriteToolTip]); // to be replaced by useId when React17 is bumped to React18
|
|
59
|
+
|
|
60
|
+
const [favoriteButtonAnchorId] = (0, _react.useState)(allowToolTip ? (0, _uuid.v5)('engaged-battle-', _uuid.v5.URL) : undefined);
|
|
61
|
+
const toolTipContent = (0, _react.useMemo)( // eslint-disable-next-line no-nested-ternary
|
|
62
|
+
() => allowToolTip ? favorite ? removeFavoriteToolTip : addFavoriteToolTip : null, [addFavoriteToolTip, favorite, removeFavoriteToolTip, allowToolTip]);
|
|
63
|
+
const [mouseLeaveTimer, setMouseLeaveTimer] = (0, _react.useState)(undefined);
|
|
64
|
+
const [toolTipIsVisible, setToolTipIsVisible] = (0, _react.useState)(false);
|
|
65
|
+
const handleMouseOver = (0, _react.useCallback)(() => {
|
|
66
|
+
mouseLeaveTimer && clearTimeout(mouseLeaveTimer);
|
|
67
|
+
/* istanbul ignore next */
|
|
68
|
+
|
|
69
|
+
(0, _has2.default)(['current', 'focus'], buttonRef) && buttonRef.current.focus();
|
|
70
|
+
setToolTipIsVisible(true);
|
|
71
|
+
}, [mouseLeaveTimer]);
|
|
72
|
+
const handleMouseLeave = (0, _react.useCallback)(() => {
|
|
73
|
+
setMouseLeaveTimer(setTimeout(() => {
|
|
74
|
+
setToolTipIsVisible(false); // @ts-expect-error (error: blur does not exists on type never)
|
|
75
|
+
|
|
76
|
+
/* istanbul ignore next */
|
|
77
|
+
|
|
78
|
+
(0, _has2.default)(['current', 'blur'], buttonRef) && buttonRef.current.blur();
|
|
79
|
+
}, 500));
|
|
80
|
+
}, []);
|
|
81
|
+
const handleKeyPress = (0, _react.useCallback)(event => {
|
|
82
|
+
(0, _tooltip.toggleStateOnKeyPress)(toolTipIsVisible, setToolTipIsVisible, buttonRef)(event);
|
|
83
|
+
}, [toolTipIsVisible]);
|
|
84
|
+
const iconWrapperClassName = (0, _react.useMemo)(() => (0, _classnames.default)(_favorite.default.favorite, className, favorite && _favorite.default.selected), [className, favorite]);
|
|
85
|
+
const icon = (0, _react.useMemo)(() => favorite ? /*#__PURE__*/_react.default.createElement(_novaIcons.NovaCompositionCoorpacademyCheck // eslint-disable-next-line css-modules/no-undef-class
|
|
86
|
+
, {
|
|
62
87
|
className: _favorite.default.checkIcon,
|
|
63
88
|
style: {
|
|
64
89
|
color: brandColor
|
|
65
90
|
},
|
|
66
91
|
width: 13,
|
|
67
92
|
height: 13,
|
|
93
|
+
"data-testid": "favorite-check-icon",
|
|
68
94
|
"aria-label": ariaLabel.removeFromFavorite
|
|
69
95
|
}) : /*#__PURE__*/_react.default.createElement(_novaIcons.NovaCompositionNavigationMore, {
|
|
70
96
|
className: _favorite.default.moreIcon,
|
|
@@ -73,8 +99,40 @@ const Favorite = ({
|
|
|
73
99
|
},
|
|
74
100
|
width: 13,
|
|
75
101
|
height: 13,
|
|
102
|
+
"data-testid": "favorite-add-icon",
|
|
76
103
|
"aria-label": ariaLabel.addToFavorite
|
|
77
|
-
}))
|
|
104
|
+
}), [ariaLabel.addToFavorite, ariaLabel.removeFromFavorite, brandColor, darkColor, favorite]);
|
|
105
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
106
|
+
className: _favorite.default.favoriteWrapper,
|
|
107
|
+
"data-testid": "favorite-wrapper"
|
|
108
|
+
}, /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
109
|
+
buttonRef: buttonRef,
|
|
110
|
+
type: "button",
|
|
111
|
+
"data-for": favoriteButtonAnchorId,
|
|
112
|
+
"data-tooltip-place": "left",
|
|
113
|
+
"data-tip": allowToolTip,
|
|
114
|
+
"data-name": "favorite",
|
|
115
|
+
"data-testid": "favorite-button",
|
|
116
|
+
"aria-label": ariaLabel.favorite,
|
|
117
|
+
buttonContentClassName: iconWrapperClassName,
|
|
118
|
+
onClick: handleFavoriteClick,
|
|
119
|
+
style: {
|
|
120
|
+
color: primaryColor
|
|
121
|
+
},
|
|
122
|
+
onKeyDown: handleKeyPress,
|
|
123
|
+
onMouseLeave: handleMouseLeave,
|
|
124
|
+
onMouseOver: handleMouseOver,
|
|
125
|
+
tabIndex: 0,
|
|
126
|
+
useButtonTag: true,
|
|
127
|
+
useWrapper: false
|
|
128
|
+
}, icon), /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
129
|
+
fontSize: 12,
|
|
130
|
+
anchorId: favoriteButtonAnchorId,
|
|
131
|
+
toolTipIsVisible: toolTipIsVisible,
|
|
132
|
+
TooltipContent: toolTipContent,
|
|
133
|
+
closeToolTipInformationTextAriaLabel: translate('Press the escape key to close the information text'),
|
|
134
|
+
stickyOnKeyboardNavigation: true
|
|
135
|
+
}));
|
|
78
136
|
};
|
|
79
137
|
|
|
80
138
|
Favorite.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
@@ -91,7 +149,8 @@ Favorite.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
91
149
|
})
|
|
92
150
|
} : {};
|
|
93
151
|
Favorite.contextTypes = {
|
|
94
|
-
skin: _provider.default.childContextTypes.skin
|
|
152
|
+
skin: _provider.default.childContextTypes.skin,
|
|
153
|
+
translate: _provider.default.childContextTypes.translate
|
|
95
154
|
};
|
|
96
155
|
var _default = Favorite;
|
|
97
156
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"favorite.js","names":["Favorite","favorite","addFavoriteToolTip","removeFavoriteToolTip","className","ariaLabel","onFavoriteClick","disabled","legacyContext","skin","GetSkinFromContext","handleFavoriteClick","useCallback","e","stopPropagation","preventDefault","primaryColor","darkColor","brandColor","toolTipView","useMemo","style","showToolTip","blocFavorite","classnames","selected","color","checkIcon","removeFromFavorite","moreIcon","addToFavorite","propTypes","PropTypes","string","bool","func","shape","contextTypes","Provider","childContextTypes"],"sources":["../../../src/molecule/card/favorite.js"],"sourcesContent":["import React, {useCallback, useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {get, isEmpty, noop} from 'lodash/fp';\nimport {\n NovaCompositionNavigationMore as MoreIcon,\n NovaCompositionCoorpacademyCheck as CheckIcon\n} from '@coorpacademy/nova-icons';\nimport Provider, {GetSkinFromContext} from '../../atom/provider';\nimport style from './favorite.css';\n\nconst Favorite = (\n {\n favorite,\n addFavoriteToolTip,\n removeFavoriteToolTip,\n className,\n 'aria-label': ariaLabel = {},\n onFavoriteClick = noop,\n disabled\n },\n legacyContext\n) => {\n const skin = GetSkinFromContext(legacyContext);\n const handleFavoriteClick = useCallback(\n e => {\n e.stopPropagation();\n e.preventDefault();\n if (!disabled) onFavoriteClick(e);\n },\n [disabled, onFavoriteClick]\n );\n\n const primaryColor = get('common.primary', skin);\n const darkColor = get('common.dark', skin);\n const brandColor = get('common.brand', skin);\n\n const toolTipView = useMemo(\n () =>\n !isEmpty(removeFavoriteToolTip) && !isEmpty(addFavoriteToolTip) ? (\n <div className={style.showToolTip}>\n <span>{favorite ? removeFavoriteToolTip : addFavoriteToolTip}</span>\n </div>\n ) : null,\n [addFavoriteToolTip, favorite, removeFavoriteToolTip]\n );\n\n return (\n <div className={style.blocFavorite}>\n {toolTipView}\n <div\n data-name=\"favorite\"\n aria-label={ariaLabel.favorite}\n className={classnames(style.favorite, className, favorite && style.selected)}\n onClick={handleFavoriteClick}\n style={{\n color: primaryColor\n }}\n >\n {favorite ? (\n <CheckIcon\n className={style.checkIcon}\n style={{color: brandColor}}\n width={13}\n height={13}\n aria-label={ariaLabel.removeFromFavorite}\n />\n ) : (\n <MoreIcon\n className={style.moreIcon}\n style={{color: darkColor}}\n width={13}\n height={13}\n aria-label={ariaLabel.addToFavorite}\n />\n )}\n </div>\n </div>\n );\n};\n\nFavorite.propTypes = {\n className: PropTypes.string,\n favorite: PropTypes.bool,\n disabled: PropTypes.bool,\n addFavoriteToolTip: PropTypes.string,\n removeFavoriteToolTip: PropTypes.string,\n onFavoriteClick: PropTypes.func,\n 'aria-label': PropTypes.shape({\n favorite: PropTypes.string,\n addToFavorite: PropTypes.string,\n removeFromFavorite: PropTypes.string\n })\n};\n\nFavorite.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nexport default Favorite;\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AAIA;;AACA;;;;;;;;AAEA,MAAMA,QAAQ,GAAG,CACf;EACEC,QADF;EAEEC,kBAFF;EAGEC,qBAHF;EAIEC,SAJF;EAKE,cAAcC,SAAS,GAAG,EAL5B;EAMEC,eAAe,iBANjB;EAOEC;AAPF,CADe,EAUfC,aAVe,KAWZ;EACH,MAAMC,IAAI,GAAG,IAAAC,4BAAA,EAAmBF,aAAnB,CAAb;EACA,MAAMG,mBAAmB,GAAG,IAAAC,kBAAA,EAC1BC,CAAC,IAAI;IACHA,CAAC,CAACC,eAAF;IACAD,CAAC,CAACE,cAAF;IACA,IAAI,CAACR,QAAL,EAAeD,eAAe,CAACO,CAAD,CAAf;EAChB,CALyB,EAM1B,CAACN,QAAD,EAAWD,eAAX,CAN0B,CAA5B;EASA,MAAMU,YAAY,GAAG,mBAAI,gBAAJ,EAAsBP,IAAtB,CAArB;EACA,MAAMQ,SAAS,GAAG,mBAAI,aAAJ,EAAmBR,IAAnB,CAAlB;EACA,MAAMS,UAAU,GAAG,mBAAI,cAAJ,EAAoBT,IAApB,CAAnB;EAEA,MAAMU,WAAW,GAAG,IAAAC,cAAA,EAClB,MACE,CAAC,uBAAQjB,qBAAR,CAAD,IAAmC,CAAC,uBAAQD,kBAAR,CAApC,gBACE;IAAK,SAAS,EAAEmB,iBAAA,CAAMC;EAAtB,gBACE,2CAAOrB,QAAQ,GAAGE,qBAAH,GAA2BD,kBAA1C,CADF,CADF,GAII,IANY,EAOlB,CAACA,kBAAD,EAAqBD,QAArB,EAA+BE,qBAA/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,kBAAA,CAAUC;EAHF,CAAhB;AAPK,CAArB;AAcAjC,QAAQ,CAACqC,YAAT,GAAwB;EACtB5B,IAAI,EAAE6B,iBAAA,CAASC,iBAAT,CAA2B9B;AADX,CAAxB;eAIeT,Q"}
|
|
1
|
+
{"version":3,"file":"favorite.js","names":["Favorite","favorite","addFavoriteToolTip","removeFavoriteToolTip","className","ariaLabel","onFavoriteClick","disabled","legacyContext","skin","GetSkinFromContext","translate","GetTranslateFromContext","handleFavoriteClick","useCallback","e","stopPropagation","preventDefault","primaryColor","darkColor","brandColor","buttonRef","useRef","allowToolTip","useMemo","favoriteButtonAnchorId","useState","uuidV5","URL","undefined","toolTipContent","mouseLeaveTimer","setMouseLeaveTimer","toolTipIsVisible","setToolTipIsVisible","handleMouseOver","clearTimeout","current","focus","handleMouseLeave","setTimeout","blur","handleKeyPress","event","toggleStateOnKeyPress","iconWrapperClassName","classnames","style","selected","icon","checkIcon","color","removeFromFavorite","moreIcon","addToFavorite","favoriteWrapper","propTypes","PropTypes","string","bool","func","shape","contextTypes","Provider","childContextTypes"],"sources":["../../../src/molecule/card/favorite.js"],"sourcesContent":["import React, {useCallback, useMemo, useRef, useState} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {v5 as uuidV5} from 'uuid';\nimport {get, has, isEmpty, noop} from 'lodash/fp';\nimport {\n NovaCompositionNavigationMore as MoreIcon,\n NovaCompositionCoorpacademyCheck as CheckIcon\n} from '@coorpacademy/nova-icons';\nimport Provider, {GetSkinFromContext, GetTranslateFromContext} from '../../atom/provider';\nimport ToolTip, {toggleStateOnKeyPress} from '../../atom/tooltip';\nimport Button from '../../atom/button';\nimport style from './favorite.css';\n\nconst Favorite = (\n {\n favorite,\n addFavoriteToolTip,\n removeFavoriteToolTip,\n className,\n 'aria-label': ariaLabel = {},\n onFavoriteClick = noop,\n disabled\n },\n legacyContext\n) => {\n const skin = GetSkinFromContext(legacyContext);\n const translate = GetTranslateFromContext(legacyContext);\n const handleFavoriteClick = useCallback(\n e => {\n e.stopPropagation();\n e.preventDefault();\n if (!disabled) onFavoriteClick(e);\n },\n [disabled, onFavoriteClick]\n );\n\n const primaryColor = get('common.primary', skin);\n const darkColor = get('common.dark', skin);\n const brandColor = get('common.brand', skin);\n\n const buttonRef = useRef(null);\n\n const allowToolTip = useMemo(\n () => !isEmpty(removeFavoriteToolTip) && !isEmpty(addFavoriteToolTip),\n [addFavoriteToolTip, removeFavoriteToolTip]\n );\n\n // to be replaced by useId when React17 is bumped to React18\n const [favoriteButtonAnchorId] = useState(\n allowToolTip ? uuidV5('engaged-battle-', uuidV5.URL) : undefined\n );\n\n const toolTipContent = useMemo(\n // eslint-disable-next-line no-nested-ternary\n () => (allowToolTip ? (favorite ? removeFavoriteToolTip : addFavoriteToolTip) : null),\n [addFavoriteToolTip, favorite, removeFavoriteToolTip, allowToolTip]\n );\n\n const [mouseLeaveTimer, setMouseLeaveTimer] = useState(undefined);\n\n const [toolTipIsVisible, setToolTipIsVisible] = useState(false);\n\n const handleMouseOver = useCallback(() => {\n mouseLeaveTimer && clearTimeout(mouseLeaveTimer);\n /* istanbul ignore next */ has(['current', 'focus'], buttonRef) && buttonRef.current.focus();\n setToolTipIsVisible(true);\n }, [mouseLeaveTimer]);\n\n const handleMouseLeave = useCallback(() => {\n setMouseLeaveTimer(\n setTimeout(() => {\n setToolTipIsVisible(false);\n // @ts-expect-error (error: blur does not exists on type never)\n /* istanbul ignore next */ has(['current', 'blur'], buttonRef) && buttonRef.current.blur();\n }, 500)\n );\n }, []);\n\n const handleKeyPress = useCallback(\n event => {\n toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible, buttonRef)(event);\n },\n [toolTipIsVisible]\n );\n\n const iconWrapperClassName = useMemo(\n () => classnames(style.favorite, className, favorite && style.selected),\n [className, favorite]\n );\n const icon = useMemo(\n () =>\n favorite ? (\n <CheckIcon\n // eslint-disable-next-line css-modules/no-undef-class\n className={style.checkIcon}\n style={{color: brandColor}}\n width={13}\n height={13}\n data-testid=\"favorite-check-icon\"\n aria-label={ariaLabel.removeFromFavorite}\n />\n ) : (\n <MoreIcon\n className={style.moreIcon}\n style={{color: darkColor}}\n width={13}\n height={13}\n data-testid=\"favorite-add-icon\"\n aria-label={ariaLabel.addToFavorite}\n />\n ),\n [ariaLabel.addToFavorite, ariaLabel.removeFromFavorite, brandColor, darkColor, favorite]\n );\n\n return (\n <div className={style.favoriteWrapper} data-testid=\"favorite-wrapper\">\n <Button\n buttonRef={buttonRef}\n type=\"button\"\n data-for={favoriteButtonAnchorId}\n data-tooltip-place=\"left\"\n data-tip={allowToolTip}\n data-name=\"favorite\"\n data-testid=\"favorite-button\"\n aria-label={ariaLabel.favorite}\n buttonContentClassName={iconWrapperClassName}\n onClick={handleFavoriteClick}\n style={{\n color: primaryColor\n }}\n onKeyDown={handleKeyPress}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n tabIndex={0}\n useButtonTag\n useWrapper={false}\n >\n {icon}\n </Button>\n <ToolTip\n fontSize={12}\n anchorId={favoriteButtonAnchorId}\n toolTipIsVisible={toolTipIsVisible}\n TooltipContent={toolTipContent}\n closeToolTipInformationTextAriaLabel={translate(\n 'Press the escape key to close the information text'\n )}\n stickyOnKeyboardNavigation\n />\n </div>\n );\n};\n\nFavorite.propTypes = {\n className: PropTypes.string,\n favorite: PropTypes.bool,\n disabled: PropTypes.bool,\n addFavoriteToolTip: PropTypes.string,\n removeFavoriteToolTip: PropTypes.string,\n onFavoriteClick: PropTypes.func,\n 'aria-label': PropTypes.shape({\n favorite: PropTypes.string,\n addToFavorite: PropTypes.string,\n removeFromFavorite: PropTypes.string\n })\n};\n\nFavorite.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nexport default Favorite;\n"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AAIA;;AACA;;AACA;;AACA;;;;;;;;AAEA,MAAMA,QAAQ,GAAG,CAC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,EAAE,EADZ;IAEE,QAAQ,EAAExB,sBAFZ;IAGE,gBAAgB,EAAEQ,gBAHpB;IAIE,cAAc,EAAEH,cAJlB;IAKE,oCAAoC,EAAEnB,SAAS,CAC7C,oDAD6C,CALjD;IAQE,0BAA0B;EAR5B,EAxBF,CADF;AAqCD,CA1ID;;AA4IAX,QAAQ,CAACwD,SAAT,2CAAqB;EACnBpD,SAAS,EAAEqD,kBAAA,CAAUC,MADF;EAEnBzD,QAAQ,EAAEwD,kBAAA,CAAUE,IAFD;EAGnBpD,QAAQ,EAAEkD,kBAAA,CAAUE,IAHD;EAInBzD,kBAAkB,EAAEuD,kBAAA,CAAUC,MAJX;EAKnBvD,qBAAqB,EAAEsD,kBAAA,CAAUC,MALd;EAMnBpD,eAAe,EAAEmD,kBAAA,CAAUG,IANR;EAOnB,cAAcH,kBAAA,CAAUI,KAAV,CAAgB;IAC5B5D,QAAQ,EAAEwD,kBAAA,CAAUC,MADQ;IAE5BJ,aAAa,EAAEG,kBAAA,CAAUC,MAFG;IAG5BN,kBAAkB,EAAEK,kBAAA,CAAUC;EAHF,CAAhB;AAPK,CAArB;AAcA1D,QAAQ,CAAC8D,YAAT,GAAwB;EACtBrD,IAAI,EAAEsD,iBAAA,CAASC,iBAAT,CAA2BvD,IADX;EAEtBE,SAAS,EAAEoD,iBAAA,CAASC,iBAAT,CAA2BrD;AAFhB,CAAxB;eAKeX,Q"}
|
|
@@ -20,7 +20,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
20
20
|
const Selectable = props => {
|
|
21
21
|
const {
|
|
22
22
|
isSelected,
|
|
23
|
-
hidden
|
|
23
|
+
hidden,
|
|
24
24
|
'aria-label': ariaLabel = {}
|
|
25
25
|
} = props;
|
|
26
26
|
if ((0, _isUndefined2.default)(isSelected)) return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectable.js","names":["Selectable","props","isSelected","hidden","ariaLabel","classnames","style","selectable","selected","circle","iconWrapper","addIcon","select","checkIcon","unSelect","hideIcon","hide","showIcon","show","propTypes","PropTypes","bool","shape","string"],"sources":["../../../src/molecule/card/selectable.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {isUndefined} from 'lodash/fp';\nimport {\n NovaSolidStatusCheckCircle2 as CheckIcon,\n NovaSolidRemoveAddAddCircle1 as AddIcon,\n NovaLineContentEditionHide as HideIcon,\n NovaCompositionCoorpacademyEye as ShowIcon\n} from '@coorpacademy/nova-icons';\nimport style from './selectable.css';\n\nconst Selectable = props => {\n const {isSelected, hidden
|
|
1
|
+
{"version":3,"file":"selectable.js","names":["Selectable","props","isSelected","hidden","ariaLabel","classnames","style","selectable","selected","circle","iconWrapper","addIcon","select","checkIcon","unSelect","hideIcon","hide","showIcon","show","propTypes","PropTypes","bool","shape","string"],"sources":["../../../src/molecule/card/selectable.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {isUndefined} from 'lodash/fp';\nimport {\n NovaSolidStatusCheckCircle2 as CheckIcon,\n NovaSolidRemoveAddAddCircle1 as AddIcon,\n NovaLineContentEditionHide as HideIcon,\n NovaCompositionCoorpacademyEye as ShowIcon\n} from '@coorpacademy/nova-icons';\nimport style from './selectable.css';\n\nconst Selectable = props => {\n const {isSelected, hidden, 'aria-label': ariaLabel = {}} = props;\n\n if (isUndefined(isSelected)) return null;\n\n return (\n <div\n className={classnames(style.selectable, isSelected && style.selected, hidden && style.hidden)}\n >\n <div className={style.circle} />\n <div className={style.iconWrapper}>\n <AddIcon className={style.addIcon} aria-label={ariaLabel.select} />\n <CheckIcon className={style.checkIcon} aria-label={ariaLabel.unSelect} />\n <HideIcon className={style.hideIcon} aria-label={ariaLabel.hide} />\n <ShowIcon className={style.showIcon} aria-label={ariaLabel.show} />\n </div>\n </div>\n );\n};\n\nSelectable.propTypes = {\n isSelected: PropTypes.bool,\n hidden: PropTypes.bool,\n 'a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A,CAAUG;EAFQ,CAAhB;AAHO,CAAvB;eASevB,U"}
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
font-family: Gilroy;
|
|
34
34
|
font-size: 16px;
|
|
35
35
|
font-weight: bold;
|
|
36
|
-
overflow:
|
|
37
|
-
white-space:
|
|
38
|
-
display:
|
|
39
|
-
text-overflow:
|
|
36
|
+
overflow:hidden;
|
|
37
|
+
white-space:nowrap;
|
|
38
|
+
display:inline-block;
|
|
39
|
+
text-overflow:ellipsis;
|
|
40
40
|
width: 100%;
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -59,3 +59,5 @@
|
|
|
59
59
|
min-height: 56px;
|
|
60
60
|
min-width: 56px;
|
|
61
61
|
}
|
|
62
|
+
|
|
63
|
+
|
|
@@ -13,18 +13,15 @@
|
|
|
13
13
|
background: transparent;
|
|
14
14
|
margin: 8px 0;
|
|
15
15
|
border-radius: 7px;
|
|
16
|
-
transform:
|
|
16
|
+
transform:translate(0,0);
|
|
17
17
|
z-index: 0;
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
.draggable:hover {
|
|
19
|
+
.draggable:hover{
|
|
21
20
|
background: rgba(0, 0, 0, 0.3);
|
|
22
21
|
}
|
|
23
|
-
|
|
24
|
-
.draggable:active {
|
|
22
|
+
.draggable:active{
|
|
25
23
|
background: transparent;
|
|
26
24
|
}
|
|
27
|
-
|
|
28
25
|
.draggable:before {
|
|
29
26
|
content: '.';
|
|
30
27
|
position: absolute;
|
|
@@ -35,10 +32,9 @@
|
|
|
35
32
|
font-size: 25px;
|
|
36
33
|
color: medium;
|
|
37
34
|
pointer-events: none;
|
|
38
|
-
text-shadow: 0 0 medium,
|
|
39
|
-
|
|
35
|
+
text-shadow: 0 0 medium, 0 5px medium, 0 10px medium, 0 15px medium,
|
|
36
|
+
5px 0 medium , 5px 5px medium, 5px 10px medium, 5px 15px medium;
|
|
40
37
|
}
|
|
41
|
-
|
|
42
38
|
.dragging {
|
|
43
39
|
background: rgba(0, 0, 0, 0.1);
|
|
44
40
|
}
|
|
@@ -6,7 +6,7 @@ declare function DraggableList({ items, onDrop, itemType }: {
|
|
|
6
6
|
}): JSX.Element;
|
|
7
7
|
declare namespace DraggableList {
|
|
8
8
|
namespace propTypes {
|
|
9
|
-
const items: PropTypes.Requireable<(
|
|
9
|
+
const items: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
10
10
|
title: PropTypes.Validator<string>;
|
|
11
11
|
onUp: PropTypes.Requireable<(...args: any[]) => any>;
|
|
12
12
|
onDown: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -43,55 +43,7 @@ declare namespace DraggableList {
|
|
|
43
43
|
}> | null | undefined)[]>;
|
|
44
44
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
45
45
|
}>>;
|
|
46
|
-
}> |
|
|
47
|
-
'aria-label': PropTypes.Requireable<PropTypes.InferProps<{
|
|
48
|
-
title: PropTypes.Requireable<string>;
|
|
49
|
-
author: PropTypes.Requireable<string>;
|
|
50
|
-
modules: PropTypes.Requireable<string>;
|
|
51
|
-
position: PropTypes.Requireable<string>;
|
|
52
|
-
}>>;
|
|
53
|
-
image: PropTypes.Requireable<string>;
|
|
54
|
-
badgeList: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
55
|
-
category: PropTypes.Requireable<string>;
|
|
56
|
-
label: PropTypes.Requireable<string>;
|
|
57
|
-
}> | null | undefined)[]>;
|
|
58
|
-
title: PropTypes.Requireable<string>;
|
|
59
|
-
author: PropTypes.Requireable<string>;
|
|
60
|
-
position: PropTypes.Requireable<number>;
|
|
61
|
-
id: PropTypes.Requireable<string>;
|
|
62
|
-
}> | PropTypes.InferProps<{
|
|
63
|
-
bulletPointMenuButton: PropTypes.Requireable<PropTypes.InferProps<{
|
|
64
|
-
buttonAriaLabel: PropTypes.Requireable<string>;
|
|
65
|
-
menuAriaLabel: PropTypes.Requireable<string>;
|
|
66
|
-
buttons: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
67
|
-
'data-name': PropTypes.Requireable<string>;
|
|
68
|
-
label: PropTypes.Requireable<string>;
|
|
69
|
-
type: PropTypes.Requireable<string>;
|
|
70
|
-
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
71
|
-
}> | null | undefined)[]>;
|
|
72
|
-
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
73
|
-
}>>;
|
|
74
|
-
buttonLink: PropTypes.Requireable<PropTypes.InferProps<{
|
|
75
|
-
type: PropTypes.Requireable<string>;
|
|
76
|
-
label: PropTypes.Requireable<string>;
|
|
77
|
-
ariaLabel: PropTypes.Requireable<string>;
|
|
78
|
-
dataName: PropTypes.Requireable<string>;
|
|
79
|
-
icon: PropTypes.Requireable<PropTypes.InferProps<{
|
|
80
|
-
position: PropTypes.Requireable<string>;
|
|
81
|
-
type: PropTypes.Requireable<string>;
|
|
82
|
-
}>>;
|
|
83
|
-
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
84
|
-
}>>;
|
|
85
|
-
tags: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
86
|
-
label: PropTypes.Requireable<string>;
|
|
87
|
-
type: PropTypes.Requireable<string>;
|
|
88
|
-
}> | null | undefined)[]>;
|
|
89
|
-
title: PropTypes.Validator<string>;
|
|
90
|
-
order: PropTypes.Requireable<number>;
|
|
91
|
-
'aria-label': PropTypes.Requireable<string>;
|
|
92
|
-
contentType: PropTypes.Requireable<string>;
|
|
93
|
-
id: PropTypes.Requireable<string>;
|
|
94
|
-
}> | null | undefined> | null | undefined)[]>;
|
|
46
|
+
}> | null | undefined)[]>;
|
|
95
47
|
const onDrop: PropTypes.Requireable<(...args: any[]) => any>;
|
|
96
48
|
const itemType: PropTypes.Requireable<string>;
|
|
97
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/draggable-list/index.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/draggable-list/index.js"],"names":[],"mappings":";AAQA;;;;gBAmDC"}
|
|
@@ -13,8 +13,6 @@ var _setupSection = _interopRequireDefault(require("../setup-section"));
|
|
|
13
13
|
|
|
14
14
|
var _courseSection = _interopRequireDefault(require("../course-section"));
|
|
15
15
|
|
|
16
|
-
var _listItem = _interopRequireDefault(require("../../organism/list-item"));
|
|
17
|
-
|
|
18
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
17
|
|
|
20
18
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -25,8 +23,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
25
23
|
|
|
26
24
|
const ITEMS = {
|
|
27
25
|
'setup-section': _setupSection.default,
|
|
28
|
-
'course-section': _courseSection.default
|
|
29
|
-
'list-item': _listItem.default
|
|
26
|
+
'course-section': _courseSection.default
|
|
30
27
|
};
|
|
31
28
|
|
|
32
29
|
const DraggableList = ({
|
|
@@ -67,7 +64,7 @@ const DraggableList = ({
|
|
|
67
64
|
};
|
|
68
65
|
|
|
69
66
|
DraggableList.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
70
|
-
items: _propTypes.default.arrayOf(_propTypes.default.
|
|
67
|
+
items: _propTypes.default.arrayOf(_propTypes.default.shape(_setupSection.default.propTypes)),
|
|
71
68
|
onDrop: _propTypes.default.func,
|
|
72
69
|
itemType: _propTypes.default.string
|
|
73
70
|
} : {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ITEMS","SetupSection","CourseSection","
|
|
1
|
+
{"version":3,"file":"index.js","names":["ITEMS","SetupSection","CourseSection","DraggableList","items","onDrop","itemType","dragTo","setDragTo","useState","dragFrom","setDragFrom","dragStartHandler","useCallback","id","dragOverHandler","dragLeaveHandler","dropHandler","Item","itemsView","map","item","propTypes","PropTypes","arrayOf","shape","func","string"],"sources":["../../../src/molecule/draggable-list/index.js"],"sourcesContent":["import React, {useState, useCallback} from 'react';\nimport PropTypes from 'prop-types';\nimport Draggable from '../draggable';\nimport SetupSection from '../setup-section';\nimport CourseSection from '../course-section';\n\nconst ITEMS = {'setup-section': SetupSection, 'course-section': CourseSection};\n\nconst DraggableList = ({items, onDrop, itemType}) => {\n const [dragTo, setDragTo] = useState(null);\n const [dragFrom, setDragFrom] = useState(null);\n\n const dragStartHandler = useCallback(\n id => {\n setDragFrom(id);\n },\n [setDragFrom]\n );\n\n const dragOverHandler = useCallback(\n id => {\n if (dragTo === id) return;\n setDragTo(id);\n },\n [dragTo, setDragTo]\n );\n\n const dragLeaveHandler = useCallback(\n id => {\n setDragTo(null);\n },\n [setDragTo]\n );\n\n const dropHandler = useCallback(\n id => {\n if (onDrop && dragFrom) onDrop(dragFrom, id);\n\n setDragTo(null);\n setDragFrom(null);\n },\n [onDrop, setDragTo, setDragFrom, dragFrom]\n );\n\n const Item = ITEMS[itemType];\n const itemsView = items.map(item => (\n <Draggable\n key={item.id}\n id={item.id}\n dragging={dragTo === item.id}\n onDragStart={dragStartHandler}\n onDragOver={dragOverHandler}\n onDragLeave={dragLeaveHandler}\n onDrop={dropHandler}\n >\n <Item {...item} key={item.id} />\n </Draggable>\n ));\n return <div>{itemsView}</div>;\n};\n\nDraggableList.propTypes = {\n items: PropTypes.arrayOf(PropTypes.shape(SetupSection.propTypes)),\n onDrop: PropTypes.func,\n itemType: PropTypes.string\n};\n\nexport default DraggableList;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,KAAK,GAAG;EAAC,iBAAiBC,qBAAlB;EAAgC,kBAAkBC;AAAlD,CAAd;;AAEA,MAAMC,aAAa,GAAG,CAAC;EAACC,KAAD;EAAQC,MAA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AEG,eALd;IAME,WAAW,EAAEC,gBANf;IAOE,MAAM,EAAEC;EAPV,gBASE,6BAAC,IAAD,eAAUI,IAAV;IAAgB,GAAG,EAAEA,IAAI,CAACP;EAA1B,GATF,CADgB,CAAlB;EAaA,oBAAO,0CAAMK,SAAN,CAAP;AACD,CAnDD;;AAqDAhB,aAAa,CAACmB,SAAd,2CAA0B;EACxBlB,KAAK,EAAEmB,kBAAA,CAAUC,OAAV,CAAkBD,kBAAA,CAAUE,KAAV,CAAgBxB,qBAAA,CAAaqB,SAA7B,CAAlB,CADiB;EAExBjB,MAAM,EAAEkB,kBAAA,CAAUG,IAFM;EAGxBpB,QAAQ,EAAEiB,kBAAA,CAAUI;AAHI,CAA1B;eAMexB,a"}
|
|
@@ -416,16 +416,27 @@ declare namespace BrandForm {
|
|
|
416
416
|
color: any;
|
|
417
417
|
submitValue: PropTypes.Requireable<string>;
|
|
418
418
|
disabled: PropTypes.Requireable<boolean>;
|
|
419
|
-
isLinkDisabled: PropTypes.Requireable<boolean>;
|
|
420
419
|
href: PropTypes.Requireable<string>;
|
|
421
420
|
download: PropTypes.Requireable<boolean>;
|
|
422
421
|
target: PropTypes.Requireable<string>;
|
|
423
|
-
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
424
422
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
425
423
|
className: PropTypes.Requireable<string>;
|
|
426
|
-
buttonContentClassName: PropTypes.Requireable<string>;
|
|
427
424
|
style: PropTypes.Requireable<PropTypes.InferProps<{}>>;
|
|
428
425
|
'data-name': PropTypes.Requireable<string>;
|
|
426
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
427
|
+
'data-testid': PropTypes.Requireable<string>;
|
|
428
|
+
useButtonTag: PropTypes.Requireable<boolean>;
|
|
429
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
430
|
+
onKeyDown: PropTypes.Requireable<(...args: any[]) => any>;
|
|
431
|
+
onMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
|
|
432
|
+
onMouseOver: PropTypes.Requireable<(...args: any[]) => any>;
|
|
433
|
+
buttonRef: PropTypes.Requireable<string>;
|
|
434
|
+
'data-for': PropTypes.Requireable<string>;
|
|
435
|
+
'data-tooltip-place': PropTypes.Requireable<string>;
|
|
436
|
+
'data-tip': PropTypes.Requireable<boolean>;
|
|
437
|
+
isLinkDisabled: PropTypes.Requireable<boolean>;
|
|
438
|
+
useWrapper: PropTypes.Requireable<boolean>;
|
|
439
|
+
buttonContentClassName: PropTypes.Requireable<string>;
|
|
429
440
|
}> | PropTypes.InferProps<{
|
|
430
441
|
buttonType: PropTypes.Requireable<string>;
|
|
431
442
|
type: PropTypes.Requireable<string>;
|
|
@@ -91,8 +91,7 @@ ListItem.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
91
91
|
title: _propTypes.default.string.isRequired,
|
|
92
92
|
order: _propTypes.default.number,
|
|
93
93
|
'aria-label': _propTypes.default.string,
|
|
94
|
-
contentType: _propTypes.default.string
|
|
95
|
-
id: _propTypes.default.string
|
|
94
|
+
contentType: _propTypes.default.string
|
|
96
95
|
} : {};
|
|
97
96
|
var _default = ListItem;
|
|
98
97
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ListItem","props","isPublished","bulletPointMenuButton","buttonLink","tags","title","order","ariaLabel","contentType","tagsView","convert","cap","tag","index","type","style","wrapper","orderWrapper","settings","edit","propTypes","PropTypes","shape","buttonAriaLabel","string","menuAriaLabel","buttons","arrayOf","label","onClick","func","dataName","icon","position","oneOf","isRequired","number"
|
|
1
|
+
{"version":3,"file":"index.js","names":["ListItem","props","isPublished","bulletPointMenuButton","buttonLink","tags","title","order","ariaLabel","contentType","tagsView","convert","cap","tag","index","type","style","wrapper","orderWrapper","settings","edit","propTypes","PropTypes","shape","buttonAriaLabel","string","menuAriaLabel","buttons","arrayOf","label","onClick","func","dataName","icon","position","oneOf","isRequired","number"],"sources":["../../../src/organism/list-item/index.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {map} from 'lodash/fp';\nimport Tag from '../../atom/tag';\nimport ButtonLink from '../../atom/button-link';\nimport BulletPointMenuButton from '../../molecule/bullet-point-menu-button';\nimport style from './style.css';\n\nconst ListItem = props => {\n let isPublished = false;\n const {\n bulletPointMenuButton,\n buttonLink,\n tags,\n title,\n order,\n 'aria-label': ariaLabel,\n contentType\n } = props;\n const tagsView = map.convert({cap: false})((tag, index) => {\n isPublished = tag.type === 'published';\n return (\n <div key={index} className={style.tag}>\n <Tag {...tag} />\n </div>\n );\n })(tags);\n return (\n <div className={style.wrapper}>\n {isPublished && contentType === 'certification' ? (\n <div className={style.orderWrapper}>\n <div className={style.order} aria-label={ariaLabel}>\n {order + 1}\n </div>\n <div className={style.title} title={title}>\n {title}\n </div>\n </div>\n ) : (\n <div className={style.title} title={title}>\n {title}\n </div>\n )}\n <div className={style.settings}>\n {tagsView}\n <div className={style.edit}>\n <ButtonLink {...buttonLink} />\n </div>\n <BulletPointMenuButton {...bulletPointMenuButton} />\n </div>\n </div>\n );\n};\n\nListItem.propTypes = {\n bulletPointMenuButton: PropTypes.shape({\n buttonAriaLabel: PropTypes.string,\n menuAriaLabel: PropTypes.string,\n buttons: PropTypes.arrayOf(\n PropTypes.shape({\n 'data-name': PropTypes.string,\n label: PropTypes.string,\n type: PropTypes.string,\n onClick: PropTypes.func\n })\n ),\n onClick: PropTypes.func\n }),\n buttonLink: PropTypes.shape({\n type: PropTypes.string,\n label: PropTypes.string,\n ariaLabel: PropTypes.string,\n dataName: PropTypes.string,\n icon: PropTypes.shape({\n position: PropTypes.string,\n type: PropTypes.string\n }),\n onClick: PropTypes.func\n }),\n tags: PropTypes.arrayOf(\n PropTypes.shape({\n label: PropTypes.string,\n type: PropTypes.oneOf(['published', 'draft', 'archived', 'revised', 'default'])\n })\n ),\n title: PropTypes.string.isRequired,\n order: PropTypes.number,\n 'aria-label': PropTypes.string,\n contentType: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gCnB7B,KAAK,EAAEe,kBAAA,CAAUe,MAhCE;EAiCnB,cAAcf,kBAAA,CAAUG,MAjCL;EAkCnBhB,WAAW,EAAEa,kBAAA,CAAUG;AAlCJ,CAArB;eAqCezB,Q"}
|
|
@@ -33,17 +33,17 @@
|
|
|
33
33
|
text-align: left;
|
|
34
34
|
text-overflow: ellipsis;
|
|
35
35
|
white-space: nowrap;
|
|
36
|
-
|
|
36
|
+
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
.settings {
|
|
40
40
|
align-items: center;
|
|
41
41
|
display: flex;
|
|
42
|
-
height: 100%;
|
|
42
|
+
height: 100%;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
.tag {
|
|
46
|
-
margin: 0 16px 0 0;
|
|
46
|
+
margin: 0 16px 0 0;
|
|
47
47
|
text-overflow: ellipsis;
|
|
48
48
|
white-space: nowrap;
|
|
49
49
|
}
|
|
@@ -64,10 +64,8 @@
|
|
|
64
64
|
color: cm_grey_400;
|
|
65
65
|
margin: 0 16px 0 0;
|
|
66
66
|
}
|
|
67
|
-
|
|
68
67
|
.orderWrapper {
|
|
69
68
|
align-items: center;
|
|
70
69
|
display: flex;
|
|
71
70
|
width: 100%;
|
|
72
|
-
|
|
73
|
-
}
|
|
71
|
+
}
|