@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
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import _noop from "lodash/fp/noop";
|
|
2
2
|
import _isEmpty from "lodash/fp/isEmpty";
|
|
3
|
+
import _has from "lodash/fp/has";
|
|
3
4
|
import _get from "lodash/fp/get";
|
|
4
|
-
import React, { useCallback, useMemo } from 'react';
|
|
5
|
+
import React, { useCallback, useMemo, useRef, useState } from 'react';
|
|
5
6
|
import PropTypes from 'prop-types';
|
|
6
7
|
import classnames from 'classnames';
|
|
8
|
+
import { v5 as uuidV5 } from 'uuid';
|
|
7
9
|
import { NovaCompositionNavigationMore as MoreIcon, NovaCompositionCoorpacademyCheck as CheckIcon } from '@coorpacademy/nova-icons';
|
|
8
|
-
import Provider, { GetSkinFromContext } from '../../atom/provider';
|
|
10
|
+
import Provider, { GetSkinFromContext, GetTranslateFromContext } from '../../atom/provider';
|
|
11
|
+
import ToolTip, { toggleStateOnKeyPress } from '../../atom/tooltip';
|
|
12
|
+
import Button from '../../atom/button';
|
|
9
13
|
import style from './favorite.css';
|
|
10
14
|
|
|
11
15
|
const Favorite = ({
|
|
@@ -18,6 +22,7 @@ const Favorite = ({
|
|
|
18
22
|
disabled
|
|
19
23
|
}, legacyContext) => {
|
|
20
24
|
const skin = GetSkinFromContext(legacyContext);
|
|
25
|
+
const translate = GetTranslateFromContext(legacyContext);
|
|
21
26
|
const handleFavoriteClick = useCallback(e => {
|
|
22
27
|
e.stopPropagation();
|
|
23
28
|
e.preventDefault();
|
|
@@ -30,26 +35,43 @@ const Favorite = ({
|
|
|
30
35
|
|
|
31
36
|
const brandColor = _get('common.brand', skin);
|
|
32
37
|
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
const buttonRef = useRef(null);
|
|
39
|
+
const allowToolTip = useMemo(() => !_isEmpty(removeFavoriteToolTip) && !_isEmpty(addFavoriteToolTip), [addFavoriteToolTip, removeFavoriteToolTip]); // to be replaced by useId when React17 is bumped to React18
|
|
40
|
+
|
|
41
|
+
const [favoriteButtonAnchorId] = useState(allowToolTip ? uuidV5('engaged-battle-', uuidV5.URL) : undefined);
|
|
42
|
+
const toolTipContent = useMemo( // eslint-disable-next-line no-nested-ternary
|
|
43
|
+
() => allowToolTip ? favorite ? removeFavoriteToolTip : addFavoriteToolTip : null, [addFavoriteToolTip, favorite, removeFavoriteToolTip, allowToolTip]);
|
|
44
|
+
const [mouseLeaveTimer, setMouseLeaveTimer] = useState(undefined);
|
|
45
|
+
const [toolTipIsVisible, setToolTipIsVisible] = useState(false);
|
|
46
|
+
const handleMouseOver = useCallback(() => {
|
|
47
|
+
mouseLeaveTimer && clearTimeout(mouseLeaveTimer);
|
|
48
|
+
/* istanbul ignore next */
|
|
49
|
+
|
|
50
|
+
_has(['current', 'focus'], buttonRef) && buttonRef.current.focus();
|
|
51
|
+
setToolTipIsVisible(true);
|
|
52
|
+
}, [mouseLeaveTimer]);
|
|
53
|
+
const handleMouseLeave = useCallback(() => {
|
|
54
|
+
setMouseLeaveTimer(setTimeout(() => {
|
|
55
|
+
setToolTipIsVisible(false); // @ts-expect-error (error: blur does not exists on type never)
|
|
56
|
+
|
|
57
|
+
/* istanbul ignore next */
|
|
58
|
+
|
|
59
|
+
_has(['current', 'blur'], buttonRef) && buttonRef.current.blur();
|
|
60
|
+
}, 500));
|
|
61
|
+
}, []);
|
|
62
|
+
const handleKeyPress = useCallback(event => {
|
|
63
|
+
toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible, buttonRef)(event);
|
|
64
|
+
}, [toolTipIsVisible]);
|
|
65
|
+
const iconWrapperClassName = useMemo(() => classnames(style.favorite, className, favorite && style.selected), [className, favorite]);
|
|
66
|
+
const icon = useMemo(() => favorite ? /*#__PURE__*/React.createElement(CheckIcon // eslint-disable-next-line css-modules/no-undef-class
|
|
67
|
+
, {
|
|
47
68
|
className: style.checkIcon,
|
|
48
69
|
style: {
|
|
49
70
|
color: brandColor
|
|
50
71
|
},
|
|
51
72
|
width: 13,
|
|
52
73
|
height: 13,
|
|
74
|
+
"data-testid": "favorite-check-icon",
|
|
53
75
|
"aria-label": ariaLabel.removeFromFavorite
|
|
54
76
|
}) : /*#__PURE__*/React.createElement(MoreIcon, {
|
|
55
77
|
className: style.moreIcon,
|
|
@@ -58,8 +80,40 @@ const Favorite = ({
|
|
|
58
80
|
},
|
|
59
81
|
width: 13,
|
|
60
82
|
height: 13,
|
|
83
|
+
"data-testid": "favorite-add-icon",
|
|
61
84
|
"aria-label": ariaLabel.addToFavorite
|
|
62
|
-
}))
|
|
85
|
+
}), [ariaLabel.addToFavorite, ariaLabel.removeFromFavorite, brandColor, darkColor, favorite]);
|
|
86
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
87
|
+
className: style.favoriteWrapper,
|
|
88
|
+
"data-testid": "favorite-wrapper"
|
|
89
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
90
|
+
buttonRef: buttonRef,
|
|
91
|
+
type: "button",
|
|
92
|
+
"data-for": favoriteButtonAnchorId,
|
|
93
|
+
"data-tooltip-place": "left",
|
|
94
|
+
"data-tip": allowToolTip,
|
|
95
|
+
"data-name": "favorite",
|
|
96
|
+
"data-testid": "favorite-button",
|
|
97
|
+
"aria-label": ariaLabel.favorite,
|
|
98
|
+
buttonContentClassName: iconWrapperClassName,
|
|
99
|
+
onClick: handleFavoriteClick,
|
|
100
|
+
style: {
|
|
101
|
+
color: primaryColor
|
|
102
|
+
},
|
|
103
|
+
onKeyDown: handleKeyPress,
|
|
104
|
+
onMouseLeave: handleMouseLeave,
|
|
105
|
+
onMouseOver: handleMouseOver,
|
|
106
|
+
tabIndex: 0,
|
|
107
|
+
useButtonTag: true,
|
|
108
|
+
useWrapper: false
|
|
109
|
+
}, icon), /*#__PURE__*/React.createElement(ToolTip, {
|
|
110
|
+
fontSize: 12,
|
|
111
|
+
anchorId: favoriteButtonAnchorId,
|
|
112
|
+
toolTipIsVisible: toolTipIsVisible,
|
|
113
|
+
TooltipContent: toolTipContent,
|
|
114
|
+
closeToolTipInformationTextAriaLabel: translate('Press the escape key to close the information text'),
|
|
115
|
+
stickyOnKeyboardNavigation: true
|
|
116
|
+
}));
|
|
63
117
|
};
|
|
64
118
|
|
|
65
119
|
Favorite.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
@@ -76,7 +130,8 @@ Favorite.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
76
130
|
})
|
|
77
131
|
} : {};
|
|
78
132
|
Favorite.contextTypes = {
|
|
79
|
-
skin: Provider.childContextTypes.skin
|
|
133
|
+
skin: Provider.childContextTypes.skin,
|
|
134
|
+
translate: Provider.childContextTypes.translate
|
|
80
135
|
};
|
|
81
136
|
export default Favorite;
|
|
82
137
|
//# sourceMappingURL=favorite.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"favorite.js","names":["React","useCallback","useMemo","PropTypes","classnames","NovaCompositionNavigationMore","MoreIcon","NovaCompositionCoorpacademyCheck","CheckIcon","Provider","GetSkinFromContext","style","Favorite","favorite","addFavoriteToolTip","removeFavoriteToolTip","className","ariaLabel","onFavoriteClick","disabled","legacyContext","skin","handleFavoriteClick","e","stopPropagation","preventDefault","primaryColor","darkColor","brandColor","toolTipView","showToolTip","blocFavorite","selected","color","checkIcon","removeFromFavorite","moreIcon","addToFavorite","propTypes","string","bool","func","shape","contextTypes","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,OAAOA,KAAP,IAAeC,WAAf,EAA4BC,OAA5B,QAA0C,OAA1C;AACA,OAA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IA,eAAeT,QAAf"}
|
|
1
|
+
{"version":3,"file":"favorite.js","names":["React","useCallback","useMemo","useRef","useState","PropTypes","classnames","v5","uuidV5","NovaCompositionNavigationMore","MoreIcon","NovaCompositionCoorpacademyCheck","CheckIcon","Provider","GetSkinFromContext","GetTranslateFromContext","ToolTip","toggleStateOnKeyPress","Button","style","Favorite","favorite","addFavoriteToolTip","removeFavoriteToolTip","className","ariaLabel","onFavoriteClick","disabled","legacyContext","skin","translate","handleFavoriteClick","e","stopPropagation","preventDefault","primaryColor","darkColor","brandColor","buttonRef","allowToolTip","favoriteButtonAnchorId","URL","undefined","toolTipContent","mouseLeaveTimer","setMouseLeaveTimer","toolTipIsVisible","setToolTipIsVisible","handleMouseOver","clearTimeout","current","focus","handleMouseLeave","setTimeout","blur","handleKeyPress","event","iconWrapperClassName","selected","icon","checkIcon","color","removeFromFavorite","moreIcon","addToFavorite","favoriteWrapper","propTypes","string","bool","func","shape","contextTypes","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,OAAOA,KAAP,IAAeC,WAAf,EAA4BC,OAA5B,EAAqCC,MAArC,EAA6CC,QAA7C,QAA4D,OAA5D;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,SAAQC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ovaLineContentEditionHide","HideIcon","NovaCompositionCoorpacademyEye","ShowIcon","style","Selectable","props","isSelected","hidden","ariaLabel","selectable","selected","circle","iconWrapper","addIcon","select","checkIcon","unSelect","hideIcon","hide","showIcon","show","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":["React","PropTypes","classnames","NovaSolidStatusCheckCircle2","CheckIcon","NovaSolidRemoveAddAddCircle1","AddIcon","NovaLineContentEditionHide","HideIcon","NovaCompositionCoorpacademyEye","ShowIcon","style","Selectable","props","isSelected","hidden","ariaLabel","selectable","selected","circle","iconWrapper","addIcon","select","checkIcon","unSelect","hideIcon","hide","showIcon","show","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 'aria-label': PropTypes.shape({\n select: PropTypes.string,\n unSelect: PropTypes.string\n })\n};\n\nexport default Selectable;\n"],"mappings":";AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,SACEC,2BAA2B,IAAIC,SADjC,EAEEC,4BAA4B,IAAIC,OAFlC,EAGEC,0BAA0B,IAAIC,QAHhC,EAIEC,8BAA8B,IAAIC,QAJpC,QAKO,0BALP;AAMA,OAAOC,KAAP,MAAkB,kBAAlB;;AAEA,MAAMC,UAAU,GAAGC,KAAK,IAAI;EAC1B,MAAM;IAACC,UAAD;IAAaC,MAAb;IAAqB,cAAcC,SAAS,GAAG;EAA/C,IAAqDH,KAA3D;EAEA,IAAI,aAAYC,UAAZ,CAAJ,EAA6B,OAAO,IAAP;EAE7B,oBACE;IACE,SAAS,EAAEZ,UAAU,CAACS,KAAK,CAACM,UAAP,EAAmBH,UAAU,IAAIH,KAAK,CAACO,QAAvC,EAAiDH,MAAM,IAAIJ,KAAK,CAACI,MAAjE;EADvB,gBAGE;IAAK,SAAS,EAAEJ,KAAK,CAACQ;EAAtB,EAHF,eAIE;IAAK,SAAS,EAAER,KAAK,CAACS;EAAtB,gBACE,oBAAC,OAAD;IAAS,SAAS,EAAET,KAAK,CAACU,OAA1B;IAAmC,cAAYL,SAAS,CAACM;EAAzD,EADF,eAEE,oBAAC,SAAD;IAAW,SAAS,EAAEX,KAAK,CAACY,SAA5B;IAAuC,cAAYP,SAAS,CAACQ;EAA7D,EAFF,eAGE,oBAAC,QAAD;IAAU,SAAS,EAAEb,KAAK,CAACc,QAA3B;IAAqC,cAAYT,SAAS,CAACU;EAA3D,EAHF,eAIE,oBAAC,QAAD;IAAU,SAAS,EAAEf,KAAK,CAACgB,QAA3B;IAAqC,cAAYX,SAAS,CAACY;EAA3D,EAJF,CAJF,CADF;AAaD,CAlBD;;AAoBAhB,UAAU,CAACiB,SAAX,2CAAuB;EACrBf,UAAU,EAAEb,SAAS,CAAC6B,IADD;EAErBf,MAAM,EAAEd,SAAS,CAAC6B,IAFG;EAGrB,cAAc7B,SAAS,CAAC8B,KAAV,CAAgB;IAC5BT,MAAM,EAAErB,SAAS,CAAC+B,MADU;IAE5BR,QAAQ,EAAEvB,SAAS,CAAC+B;EAFQ,CAAhB;AAHO,CAAvB;AASA,eAAepB,UAAf"}
|
|
@@ -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"}
|
|
@@ -5,11 +5,9 @@ import PropTypes from 'prop-types';
|
|
|
5
5
|
import Draggable from '../draggable';
|
|
6
6
|
import SetupSection from '../setup-section';
|
|
7
7
|
import CourseSection from '../course-section';
|
|
8
|
-
import ListItem from '../../organism/list-item';
|
|
9
8
|
const ITEMS = {
|
|
10
9
|
'setup-section': SetupSection,
|
|
11
|
-
'course-section': CourseSection
|
|
12
|
-
'list-item': ListItem
|
|
10
|
+
'course-section': CourseSection
|
|
13
11
|
};
|
|
14
12
|
|
|
15
13
|
const DraggableList = ({
|
|
@@ -50,7 +48,7 @@ const DraggableList = ({
|
|
|
50
48
|
};
|
|
51
49
|
|
|
52
50
|
DraggableList.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
53
|
-
items: PropTypes.arrayOf(PropTypes.
|
|
51
|
+
items: PropTypes.arrayOf(PropTypes.shape(SetupSection.propTypes)),
|
|
54
52
|
onDrop: PropTypes.func,
|
|
55
53
|
itemType: PropTypes.string
|
|
56
54
|
} : {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useState","useCallback","PropTypes","Draggable","SetupSection","CourseSection","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useState","useCallback","PropTypes","Draggable","SetupSection","CourseSection","ITEMS","DraggableList","items","onDrop","itemType","dragTo","setDragTo","dragFrom","setDragFrom","dragStartHandler","id","dragOverHandler","dragLeaveHandler","dropHandler","Item","itemsView","map","item","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,OAAOA,KAAP,IAAeC,QAAf,EAAyBC,WAAzB,QAA2C,OAA3C;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,SAAP,MAAsB,cAAtB;A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GAAG,EAAEA,IAAI,CAACP,EADZ;IAEE,EAAE,EAAEO,IAAI,CAACP,EAFX;IAGE,QAAQ,EAAEL,MAAM,KAAKY,IAAI,CAACP,EAH5B;IAIE,WAAW,EAAED,gBAJf;IAKE,UAAU,EAAEE,eALd;IAME,WAAW,EAAEC,gBANf;IAOE,MAAM,EAAEC;EAPV,gBASE,oBAAC,IAAD,eAAUI,IAAV;IAAgB,GAAG,EAAEA,IAAI,CAACP;EAA1B,GATF,CADgB,CAAlB;EAaA,oBAAO,iCAAMK,SAAN,CAAP;AACD,CAnDD;;AAqDAd,aAAa,CAACiB,SAAd,2CAA0B;EACxBhB,KAAK,EAAEN,SAAS,CAACuB,OAAV,CAAkBvB,SAAS,CAACwB,KAAV,CAAgBtB,YAAY,CAACoB,SAA7B,CAAlB,CADiB;EAExBf,MAAM,EAAEP,SAAS,CAACyB,IAFM;EAGxBjB,QAAQ,EAAER,SAAS,CAAC0B;AAHI,CAA1B;AAMA,eAAerB,aAAf"}
|
|
@@ -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>;
|
|
@@ -78,8 +78,7 @@ ListItem.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
78
78
|
title: PropTypes.string.isRequired,
|
|
79
79
|
order: PropTypes.number,
|
|
80
80
|
'aria-label': PropTypes.string,
|
|
81
|
-
contentType: PropTypes.string
|
|
82
|
-
id: PropTypes.string
|
|
81
|
+
contentType: PropTypes.string
|
|
83
82
|
} : {};
|
|
84
83
|
export default ListItem;
|
|
85
84
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","PropTypes","Tag","ButtonLink","BulletPointMenuButton","style","ListItem","props","isPublished","bulletPointMenuButton","buttonLink","tags","title","order","ariaLabel","contentType","tagsView","convert","cap","tag","index","type","wrapper","orderWrapper","settings","edit","propTypes","shape","buttonAriaLabel","string","menuAriaLabel","buttons","arrayOf","label","onClick","func","dataName","icon","position","oneOf","isRequired","number"
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PropTypes","Tag","ButtonLink","BulletPointMenuButton","style","ListItem","props","isPublished","bulletPointMenuButton","buttonLink","tags","title","order","ariaLabel","contentType","tagsView","convert","cap","tag","index","type","wrapper","orderWrapper","settings","edit","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: PropTypes.string\n};\n\nexport default ListItem;\n"],"mappings":";AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,OAAOC,GAAP,MAAgB,gBAAhB;AACA,OAAOC,UAAP,MAAuB,wBAAvB;AACA,OAAOC,qBAAP,MAAkC,yCAAlC;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,QAAQ,GAAGC,KAAK,IAAI;EACxB,IAAIC,WAAW,GAAG,KAAlB;EACA,MAAM;IACJC,qBADI;IAEJC,UAFI;IAGJC,IAHI;IAIJC,KAJI;IAKJC,KALI;IAMJ,cAAcC,SANV;IAOJC;EAPI,IAQFR,KARJ;;EASA,MAAMS,QAAQ,GAAG,KAAIC,OAAJ,CAAY;IAACC,GAAG,EAAE;EAAN,CAAZ,EAA0B,CAACC,GAAD,EAAMC,KAAN,KAAgB;IACzDZ,WAAW,GAAGW,GAAG,CAACE,IAAJ,KAAa,WAA3B;IACA,oBACE;MAAK,GAAG,EAAED,KAAV;MAAiB,SAAS,EAAEf,KAAK,CAACc;IAAlC,gBACE,oBAAC,GAAD,EAASA,GAAT,CADF,CADF;EAKD,CAPgB,EAOdR,IAPc,CAAjB;;EAQA,oBACE;IAAK,SAAS,EAAEN,KAAK,CAACiB;EAAtB,GACGd,WAAW,IAAIO,WAAW,KAAK,eAA/B,gBACC;IAAK,SAAS,EAAEV,KAAK,CAACkB;EAAtB,gBACE;IAAK,SAAS,EAAElB,KAAK,CAACQ,KAAtB;IAA6B,cAAYC;EAAzC,GACGD,KAAK,GAAG,CADX,CADF,eAIE;IAAK,SAAS,EAAER,KAAK,CAACO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EAAEjC,SAAS,CAACkC;EATO,CAAhB,CAdO;EAyBnBxB,IAAI,EAAEV,SAAS,CAAC+B,OAAV,CACJ/B,SAAS,CAAC0B,KAAV,CAAgB;IACdM,KAAK,EAAEhC,SAAS,CAAC4B,MADH;IAEdR,IAAI,EAAEpB,SAAS,CAACsC,KAAV,CAAgB,CAAC,WAAD,EAAc,OAAd,EAAuB,UAAvB,EAAmC,SAAnC,EAA8C,SAA9C,CAAhB;EAFQ,CAAhB,CADI,CAzBa;EA+BnB3B,KAAK,EAAEX,SAAS,CAAC4B,MAAV,CAAiBW,UA/BL;EAgCnB3B,KAAK,EAAEZ,SAAS,CAACwC,MAhCE;EAiCnB,cAAcxC,SAAS,CAAC4B,MAjCL;EAkCnBd,WAAW,EAAEd,SAAS,CAAC4B;AAlCJ,CAArB;AAqCA,eAAevB,QAAf"}
|
|
@@ -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
|
+
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
export default ListItems;
|
|
2
|
-
declare function ListItems({ title, buttonLink, items, "aria-label": ariaLabel, contentType
|
|
2
|
+
declare function ListItems({ title, buttonLink, items, "aria-label": ariaLabel, contentType }: {
|
|
3
3
|
title: any;
|
|
4
4
|
buttonLink: any;
|
|
5
5
|
items: any;
|
|
6
6
|
"aria-label": any;
|
|
7
7
|
contentType: any;
|
|
8
|
-
onDrop: any;
|
|
9
8
|
}): JSX.Element;
|
|
10
9
|
declare namespace ListItems {
|
|
11
10
|
const propTypes: {
|
|
@@ -61,11 +60,9 @@ declare namespace ListItems {
|
|
|
61
60
|
order: PropTypes.Requireable<number>;
|
|
62
61
|
'aria-label': PropTypes.Requireable<string>;
|
|
63
62
|
contentType: PropTypes.Requireable<string>;
|
|
64
|
-
id: PropTypes.Requireable<string>;
|
|
65
63
|
}> | null | undefined)[]>;
|
|
66
64
|
title: PropTypes.Requireable<string>;
|
|
67
65
|
contentType: PropTypes.Requireable<string>;
|
|
68
|
-
onDrop: PropTypes.Requireable<(...args: any[]) => any>;
|
|
69
66
|
};
|
|
70
67
|
}
|
|
71
68
|
import PropTypes from "prop-types";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/organism/list-items/index.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/organism/list-items/index.js"],"names":[],"mappings":";AAOA;;;;;;gBAsBC"}
|
|
@@ -1,25 +1,19 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import findIndex from 'lodash/fp/findIndex';
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
6
5
|
import ListItem from '../list-item';
|
|
7
|
-
import DraggableList from '../../molecule/draggable-list';
|
|
8
6
|
import Title from '../../atom/title';
|
|
9
7
|
import ButtonLink from '../../atom/button-link';
|
|
10
8
|
import style from './style.css';
|
|
11
9
|
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
})),
|
|
20
|
-
itemType: "list-item",
|
|
21
|
-
onDrop: onDrop
|
|
22
|
-
});
|
|
10
|
+
const ListItems = ({
|
|
11
|
+
title,
|
|
12
|
+
buttonLink,
|
|
13
|
+
items,
|
|
14
|
+
'aria-label': ariaLabel,
|
|
15
|
+
contentType
|
|
16
|
+
}) => {
|
|
23
17
|
const itemsView = items.map((item, index) => /*#__PURE__*/React.createElement("li", {
|
|
24
18
|
key: item.id,
|
|
25
19
|
className: style.item,
|
|
@@ -28,21 +22,6 @@ const buildItemsView = (items, contentType, onDrop, ariaLabel) => {
|
|
|
28
22
|
order: index,
|
|
29
23
|
contentType: contentType
|
|
30
24
|
}))));
|
|
31
|
-
return /*#__PURE__*/React.createElement("ul", {
|
|
32
|
-
className: style.list,
|
|
33
|
-
"aria-label": ariaLabel,
|
|
34
|
-
"data-name": 'content-list'
|
|
35
|
-
}, itemsView);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const ListItems = ({
|
|
39
|
-
title,
|
|
40
|
-
buttonLink,
|
|
41
|
-
items,
|
|
42
|
-
'aria-label': ariaLabel,
|
|
43
|
-
contentType,
|
|
44
|
-
onDrop
|
|
45
|
-
}) => {
|
|
46
25
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
47
26
|
className: style.header
|
|
48
27
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -53,7 +32,11 @@ const ListItems = ({
|
|
|
53
32
|
"data-name": 'list-title'
|
|
54
33
|
})), /*#__PURE__*/React.createElement("div", {
|
|
55
34
|
className: style.buttonCreate
|
|
56
|
-
}, /*#__PURE__*/React.createElement(ButtonLink, buttonLink))),
|
|
35
|
+
}, /*#__PURE__*/React.createElement(ButtonLink, buttonLink))), /*#__PURE__*/React.createElement("ul", {
|
|
36
|
+
className: style.list,
|
|
37
|
+
"aria-label": ariaLabel,
|
|
38
|
+
"data-name": 'content-list'
|
|
39
|
+
}, itemsView));
|
|
57
40
|
};
|
|
58
41
|
|
|
59
42
|
ListItems.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
@@ -61,8 +44,7 @@ ListItems.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
61
44
|
buttonLink: PropTypes.shape(ButtonLink.propTypes),
|
|
62
45
|
items: PropTypes.arrayOf(PropTypes.shape(ListItem.propTypes)),
|
|
63
46
|
title: PropTypes.string,
|
|
64
|
-
contentType: PropTypes.string
|
|
65
|
-
onDrop: PropTypes.func
|
|
47
|
+
contentType: PropTypes.string
|
|
66
48
|
} : {};
|
|
67
49
|
export default ListItems;
|
|
68
50
|
//# sourceMappingURL=index.js.map
|