@coorpacademy/components 11.12.3-alpha.3 → 11.12.3-alpha.5
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/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/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 +70 -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/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 -29
- package/es/organism/list-items/index.js.map +1 -1
- package/es/template/back-office/brand-update/index.d.ts +0 -2
- 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/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/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 +71 -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/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 -31
- package/lib/organism/list-items/index.js.map +1 -1
- package/lib/template/back-office/brand-update/index.d.ts +0 -2
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/battle-opponent/index.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AACzD,OAAkB,EAAC,mBAAmB,EAAC,MAAM,cAAc,CAAC;AAG5D,QAAA,MAAM,cAAc;gHASf,mBAAmB,iBACP,gBAAgB;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/battle-opponent/index.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AACzD,OAAkB,EAAC,mBAAmB,EAAC,MAAM,cAAc,CAAC;AAG5D,QAAA,MAAM,cAAc;gHASf,mBAAmB,iBACP,gBAAgB;;;;;;;;;;;;;CA2GhC,CAAC;AAQF,eAAe,cAAc,CAAC"}
|
|
@@ -83,13 +83,15 @@ const BattleOpponent = ({
|
|
|
83
83
|
className: style.informationIcon,
|
|
84
84
|
width: 20,
|
|
85
85
|
height: 20
|
|
86
|
-
})), /*#__PURE__*/React.createElement(
|
|
86
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
87
|
+
className: style.toolTipWrapper
|
|
88
|
+
}, /*#__PURE__*/React.createElement(ToolTip, {
|
|
87
89
|
fontSize: 12,
|
|
88
90
|
anchorId: battleOpponentInfoId,
|
|
89
91
|
toolTipIsVisible: toolTipIsVisible,
|
|
90
92
|
TooltipContent: TooltipContent,
|
|
91
93
|
closeToolTipInformationTextAriaLabel: translate('Press the escape key to close the information text')
|
|
92
|
-
})) : /*#__PURE__*/React.createElement(ArrowRight, {
|
|
94
|
+
}))) : /*#__PURE__*/React.createElement(ArrowRight, {
|
|
93
95
|
className: style.rightArrow,
|
|
94
96
|
width: 16,
|
|
95
97
|
height: 16
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useCallback","useMemo","useState","useRef","classnames","v5","uuidV5","has","NovaCompositionNavigationArrowRight","ArrowRight","NovaCompositionCoorpacademyInformationIcon","InformationIcon","ToolTip","toggleStateOnKeyPress","Provider","GetTranslateFromContext","propTypes","style","BattleOpponent","isAlreadyEngaged","isRandom","userAvatarSrc","onClick","displayName","tooltipText","ariaLabel","legacyContext","translate","wrapperClassnames","card","random","displayNameClassnames","name","alreadyEngaged","mouseLeaveTimer","setMouseLeaveTimer","undefined","toolTipIsVisible","setToolTipIsVisible","battleOpponentInfoId","URL","buttonRef","handleMouseOver","clearTimeout","current","focus","handleMouseLeave","setTimeout","blur","handleKeyPress","event","TooltipContent","_props","avatar","tooltipIconContainer","informationIcon","rightArrow","contextTypes","childContextTypes"],"sources":["../../../src/atom/battle-opponent/index.tsx"],"sourcesContent":["import React, {useCallback, useMemo, useState, useRef} from 'react';\nimport classnames from 'classnames';\nimport {v5 as uuidV5} from 'uuid';\nimport has from 'lodash/fp/has';\nimport {\n NovaCompositionNavigationArrowRight as ArrowRight,\n NovaCompositionCoorpacademyInformationIcon as InformationIcon\n} from '@coorpacademy/nova-icons';\nimport ToolTip, {toggleStateOnKeyPress} from '../tooltip';\nimport Provider, {GetTranslateFromContext} from '../provider';\nimport {WebContextValues} from '../provider/web-context';\nimport propTypes, {BattleOpponentProps} from './prop-types';\nimport style from './style.css';\n\nconst BattleOpponent = (\n {\n isAlreadyEngaged,\n isRandom,\n userAvatarSrc,\n onClick,\n displayName,\n tooltipText,\n 'aria-label': ariaLabel\n }: BattleOpponentProps,\n legacyContext: WebContextValues\n) => {\n const translate: Required<WebContextValues>['translate'] = GetTranslateFromContext(legacyContext);\n const wrapperClassnames = useMemo(\n () => classnames(style.card, style['opponent-card'], isRandom ? style.random : null),\n [isRandom]\n );\n\n const displayNameClassnames = useMemo(\n () => classnames(style.name, isAlreadyEngaged ? style.alreadyEngaged : null),\n [isAlreadyEngaged]\n );\n\n const [mouseLeaveTimer, setMouseLeaveTimer] = useState<number | undefined>(undefined);\n const [toolTipIsVisible, setToolTipIsVisible] = useState(false);\n\n // to be replaced by useId when React17 is bumped to React18\n const [battleOpponentInfoId] = useState(\n isAlreadyEngaged ? uuidV5('engaged-battle-', uuidV5.URL) : undefined\n );\n\n const buttonRef = useRef(null);\n\n const handleMouseOver = useCallback(() => {\n mouseLeaveTimer && clearTimeout(mouseLeaveTimer);\n // @ts-expect-error (error: focus does not exists on type never)\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) as unknown as number\n );\n }, []);\n\n const handleKeyPress = useCallback(\n event => {\n toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible, buttonRef)(event);\n },\n [toolTipIsVisible]\n );\n\n const TooltipContent = useCallback(\n _props => (\n <p\n {..._props}\n onMouseOver={handleMouseOver}\n onMouseLeave={handleMouseLeave}\n data-testid=\"battle-opponent-tooltip-content\"\n >\n {tooltipText}\n </p>\n ),\n [handleMouseLeave, handleMouseOver, tooltipText]\n );\n\n return (\n <li\n {...(!isAlreadyEngaged && {onClick})}\n className={wrapperClassnames}\n data-testid=\"battle-opponent-wrapper\"\n tabIndex={0}\n >\n <div className={style.avatar}>{isRandom ? null : <img src={userAvatarSrc} alt=\"\" />}</div>\n <p className={displayNameClassnames} tabIndex={0}>\n {displayName}\n </p>\n {isAlreadyEngaged ? (\n <>\n <button\n ref={buttonRef}\n tabIndex={0}\n type=\"button\"\n className={style.tooltipIconContainer}\n data-testid=\"battle-engaged-opponent-information-button\"\n onKeyDown={handleKeyPress}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n data-for={battleOpponentInfoId}\n data-tooltip-place=\"left\"\n data-tip={isAlreadyEngaged}\n aria-label={ariaLabel}\n >\n <InformationIcon className={style.informationIcon} width={20} height={20} />\n </button>\n <ToolTip\n
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useCallback","useMemo","useState","useRef","classnames","v5","uuidV5","has","NovaCompositionNavigationArrowRight","ArrowRight","NovaCompositionCoorpacademyInformationIcon","InformationIcon","ToolTip","toggleStateOnKeyPress","Provider","GetTranslateFromContext","propTypes","style","BattleOpponent","isAlreadyEngaged","isRandom","userAvatarSrc","onClick","displayName","tooltipText","ariaLabel","legacyContext","translate","wrapperClassnames","card","random","displayNameClassnames","name","alreadyEngaged","mouseLeaveTimer","setMouseLeaveTimer","undefined","toolTipIsVisible","setToolTipIsVisible","battleOpponentInfoId","URL","buttonRef","handleMouseOver","clearTimeout","current","focus","handleMouseLeave","setTimeout","blur","handleKeyPress","event","TooltipContent","_props","avatar","tooltipIconContainer","informationIcon","toolTipWrapper","rightArrow","contextTypes","childContextTypes"],"sources":["../../../src/atom/battle-opponent/index.tsx"],"sourcesContent":["import React, {useCallback, useMemo, useState, useRef} from 'react';\nimport classnames from 'classnames';\nimport {v5 as uuidV5} from 'uuid';\nimport has from 'lodash/fp/has';\nimport {\n NovaCompositionNavigationArrowRight as ArrowRight,\n NovaCompositionCoorpacademyInformationIcon as InformationIcon\n} from '@coorpacademy/nova-icons';\nimport ToolTip, {toggleStateOnKeyPress} from '../tooltip';\nimport Provider, {GetTranslateFromContext} from '../provider';\nimport {WebContextValues} from '../provider/web-context';\nimport propTypes, {BattleOpponentProps} from './prop-types';\nimport style from './style.css';\n\nconst BattleOpponent = (\n {\n isAlreadyEngaged,\n isRandom,\n userAvatarSrc,\n onClick,\n displayName,\n tooltipText,\n 'aria-label': ariaLabel\n }: BattleOpponentProps,\n legacyContext: WebContextValues\n) => {\n const translate: Required<WebContextValues>['translate'] = GetTranslateFromContext(legacyContext);\n const wrapperClassnames = useMemo(\n () => classnames(style.card, style['opponent-card'], isRandom ? style.random : null),\n [isRandom]\n );\n\n const displayNameClassnames = useMemo(\n () => classnames(style.name, isAlreadyEngaged ? style.alreadyEngaged : null),\n [isAlreadyEngaged]\n );\n\n const [mouseLeaveTimer, setMouseLeaveTimer] = useState<number | undefined>(undefined);\n const [toolTipIsVisible, setToolTipIsVisible] = useState(false);\n\n // to be replaced by useId when React17 is bumped to React18\n const [battleOpponentInfoId] = useState(\n isAlreadyEngaged ? uuidV5('engaged-battle-', uuidV5.URL) : undefined\n );\n\n const buttonRef = useRef(null);\n\n const handleMouseOver = useCallback(() => {\n mouseLeaveTimer && clearTimeout(mouseLeaveTimer);\n // @ts-expect-error (error: focus does not exists on type never)\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) as unknown as number\n );\n }, []);\n\n const handleKeyPress = useCallback(\n event => {\n toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible, buttonRef)(event);\n },\n [toolTipIsVisible]\n );\n\n const TooltipContent = useCallback(\n _props => (\n <p\n {..._props}\n onMouseOver={handleMouseOver}\n onMouseLeave={handleMouseLeave}\n data-testid=\"battle-opponent-tooltip-content\"\n >\n {tooltipText}\n </p>\n ),\n [handleMouseLeave, handleMouseOver, tooltipText]\n );\n\n return (\n <li\n {...(!isAlreadyEngaged && {onClick})}\n className={wrapperClassnames}\n data-testid=\"battle-opponent-wrapper\"\n tabIndex={0}\n >\n <div className={style.avatar}>{isRandom ? null : <img src={userAvatarSrc} alt=\"\" />}</div>\n <p className={displayNameClassnames} tabIndex={0}>\n {displayName}\n </p>\n {isAlreadyEngaged ? (\n <>\n <button\n ref={buttonRef}\n tabIndex={0}\n type=\"button\"\n className={style.tooltipIconContainer}\n data-testid=\"battle-engaged-opponent-information-button\"\n onKeyDown={handleKeyPress}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n data-for={battleOpponentInfoId}\n data-tooltip-place=\"left\"\n data-tip={isAlreadyEngaged}\n aria-label={ariaLabel}\n >\n <InformationIcon className={style.informationIcon} width={20} height={20} />\n </button>\n <span className={style.toolTipWrapper}>\n <ToolTip\n fontSize={12}\n anchorId={battleOpponentInfoId}\n toolTipIsVisible={toolTipIsVisible}\n TooltipContent={TooltipContent}\n closeToolTipInformationTextAriaLabel={translate(\n 'Press the escape key to close the information text'\n )}\n />\n </span>\n </>\n ) : (\n <ArrowRight className={style.rightArrow} width={16} height={16} />\n )}\n </li>\n );\n};\n\nBattleOpponent.propTypes = propTypes;\n\nBattleOpponent.contextTypes = {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;AA8CD,CArHD;;AAuHAvC,cAAc,CAACF,SAAf,2CAA2BA,SAA3B;AAEAE,cAAc,CAACwC,YAAf,GAA8B;EAC5B/B,SAAS,EAAEb,QAAQ,CAAC6C,iBAAT,CAA2BhC;AADV,CAA9B;AAIA,eAAeT,cAAf"}
|
|
@@ -112,6 +112,18 @@
|
|
|
112
112
|
align-items: center;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
.toolTipWrapper {
|
|
116
|
+
position: absolute;
|
|
117
|
+
width: 100%;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.card .tooltipIconContainer + .toolTipWrapper [class*="__react_component_tooltip"]:not([class*="toolTipReact"]) {
|
|
121
|
+
position: sticky;
|
|
122
|
+
top: unset !important;
|
|
123
|
+
left: unset !important;
|
|
124
|
+
max-width: 75%;
|
|
125
|
+
}
|
|
126
|
+
|
|
115
127
|
@media mobile {
|
|
116
128
|
.opponent-card {
|
|
117
129
|
width: 100%;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/tooltip/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/tooltip/index.js"],"names":[],"mappings":"AAoEO,iGASN;;AAED;;;;;;;;;;;gBA0FC"}
|
package/es/atom/tooltip/index.js
CHANGED
|
@@ -23,6 +23,7 @@ const ToolTipWrapper = ({
|
|
|
23
23
|
handleContentMouseOver,
|
|
24
24
|
iconSize
|
|
25
25
|
}) => {
|
|
26
|
+
const coorpToolTipClasses = classnames(style.toolTip, iconSize === 'big' ? style.bigIconToolTip : style.smallIconToolTip);
|
|
26
27
|
if (!toolTipIsVisible) return null;
|
|
27
28
|
|
|
28
29
|
if (anchorId) {
|
|
@@ -36,7 +37,7 @@ const ToolTipWrapper = ({
|
|
|
36
37
|
}, content);
|
|
37
38
|
} else {
|
|
38
39
|
return /*#__PURE__*/React.createElement("div", {
|
|
39
|
-
className:
|
|
40
|
+
className: coorpToolTipClasses,
|
|
40
41
|
"data-testid": "tooltip",
|
|
41
42
|
"aria-label": closeToolTipInformationTextAriaLabel,
|
|
42
43
|
onMouseOver: handleContentMouseOver
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","isValidElement","useState","useCallback","useMemo","classnames","PropTypes","ReactTooltip","isString","keys","NovaCompositionCoorpacademyInformationIcon","InformationIcon","style","FontSizes","tooltipContentFontSize12","tooltipContentFontSize14","IconSizes","small","big","ToolTipWrapper","toolTipIsVisible","anchorId","closeToolTipInformationTextAriaLabel","content","handleContentMouseOver","iconSize","toolTipReact","toolTip","bigIconToolTip","smallIconToolTip","propTypes","bool","string","isRequired","node","func","oneOf","toggleStateOnKeyPress","state","setState","ref","event","key","current","focus","stopPropagation","preventDefault","ToolTip","TooltipContent","ariaLabel","dataTestId","_toolTipIsVisible","iconContainerClassName","delayHide","fontSize","isComponent","setToolTipIsVisible","mouseLeaveTimer","setMouseLeaveTimer","undefined","handleKeyPress","clearTimeout","handleMouseOver","handleMouseLeave","setTimeout","tooltipContent","tooltipContainer","tooltipIconContainer","informationIcon","oneOfType","number"],"sources":["../../../src/atom/tooltip/index.js"],"sourcesContent":["import React, {isValidElement, useState, useCallback, useMemo} from 'react';\nimport classnames from 'classnames';\nimport PropTypes from 'prop-types';\nimport ReactTooltip from 'react-tooltip';\nimport isString from 'lodash/fp/isString';\nimport keys from 'lodash/fp/keys';\nimport {NovaCompositionCoorpacademyInformationIcon as InformationIcon} from '@coorpacademy/nova-icons';\nimport style from './style.css';\n\nconst FontSizes = {\n 12: style.tooltipContentFontSize12,\n 14: style.tooltipContentFontSize14\n};\n\nconst IconSizes = {\n small: 12,\n big: 20\n};\n\nconst ToolTipWrapper = ({\n toolTipIsVisible,\n anchorId,\n closeToolTipInformationTextAriaLabel,\n content,\n handleContentMouseOver,\n iconSize\n}) => {\n if (!toolTipIsVisible) return null;\n if (anchorId) {\n return (\n <ReactTooltip\n id={anchorId}\n className={style.toolTipReact}\n data-event-off=\"click\"\n place=\"left\"\n effect=\"solid\"\n aria-label={closeToolTipInformationTextAriaLabel}\n >\n {content}\n </ReactTooltip>\n );\n } else {\n return (\n <div\n className={classnames(\n style.toolTip,\n iconSize === 'big' ? style.bigIconToolTip : style.smallIconToolTip\n )}\n data-testid=\"tooltip\"\n aria-label={closeToolTipInformationTextAriaLabel}\n onMouseOver={handleContentMouseOver}\n >\n {content}\n </div>\n );\n }\n};\n\nToolTipWrapper.propTypes = {\n toolTipIsVisible: PropTypes.bool,\n anchorId: PropTypes.string,\n closeToolTipInformationTextAriaLabel: PropTypes.string.isRequired,\n content: PropTypes.node,\n handleContentMouseOver: PropTypes.func,\n iconSize: PropTypes.oneOf(keys(IconSizes))\n};\n\nexport const toggleStateOnKeyPress = (state, setState, ref) => event => {\n if (event.key === 'Enter') {\n if (ref) ref.current.focus();\n event.stopPropagation();\n event.preventDefault();\n setState(!state);\n } else if (event.key === 'Tab' || event.key === 'Escape') {\n setState(false);\n }\n};\n\nconst ToolTip = ({\n anchorId,\n TooltipContent,\n 'aria-label': ariaLabel,\n 'data-testid': dataTestId,\n closeToolTipInformationTextAriaLabel,\n toolTipIsVisible: _toolTipIsVisible,\n iconContainerClassName,\n delayHide = 250,\n fontSize = 14,\n iconSize = 'small'\n}) => {\n const isComponent = useMemo(\n () => !isString(TooltipContent) && isValidElement(TooltipContent()),\n [TooltipContent]\n );\n\n const [toolTipIsVisible, setToolTipIsVisible] = useState(false);\n\n const [mouseLeaveTimer, setMouseLeaveTimer] = useState(undefined);\n\n const handleKeyPress = useCallback(\n event => {\n toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible)(event);\n },\n [toolTipIsVisible]\n );\n\n const handleContentMouseOver = useCallback(() => {\n mouseLeaveTimer && /* istanbul ignore next */ clearTimeout(mouseLeaveTimer);\n }, [mouseLeaveTimer]);\n\n const handleMouseOver = useCallback(() => {\n mouseLeaveTimer && clearTimeout(mouseLeaveTimer);\n setToolTipIsVisible(true);\n }, [mouseLeaveTimer]);\n\n const handleMouseLeave = useCallback(() => {\n setMouseLeaveTimer(setTimeout(() => setToolTipIsVisible(false), delayHide));\n }, [delayHide]);\n\n const content = useMemo(() => {\n return isComponent ? (\n <TooltipContent />\n ) : (\n <p className={classnames([style.tooltipContent, FontSizes[fontSize]])}>{TooltipContent}</p>\n );\n }, [TooltipContent, fontSize, isComponent]);\n\n return anchorId ? (\n <ToolTipWrapper\n toolTipIsVisible={_toolTipIsVisible}\n anchorId={anchorId}\n closeToolTipInformationTextAriaLabel={closeToolTipInformationTextAriaLabel}\n content={content}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n fontSize={fontSize}\n />\n ) : (\n <div\n className={style.tooltipContainer}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n >\n <button\n type=\"button\"\n className={classnames([style.tooltipIconContainer, iconContainerClassName])}\n data-testid={dataTestId}\n onKeyDown={handleKeyPress}\n tabIndex={0}\n >\n <InformationIcon\n className={style.informationIcon}\n width={IconSizes[iconSize]}\n height={IconSizes[iconSize]}\n aria-label={ariaLabel}\n />\n </button>\n <ToolTipWrapper\n toolTipIsVisible={toolTipIsVisible}\n anchorId={anchorId}\n closeToolTipInformationTextAriaLabel={closeToolTipInformationTextAriaLabel}\n content={content}\n handleContentMouseOver={handleContentMouseOver}\n fontSize={fontSize}\n iconSize={iconSize}\n />\n </div>\n );\n};\n\nToolTip.propTypes = {\n TooltipContent: PropTypes.oneOfType([PropTypes.func, PropTypes.node, PropTypes.string]),\n 'data-testid': PropTypes.string,\n 'aria-label': PropTypes.string,\n closeToolTipInformationTextAriaLabel: PropTypes.string.isRequired,\n // ---------- Regular Tooltip exclusive --------------\n iconContainerClassName: PropTypes.string,\n delayHide: PropTypes.number,\n fontSize: PropTypes.oneOf([12, 14]),\n iconSize: PropTypes.oneOf(keys(IconSizes)),\n // ---------- React Tooltip exclusive --------------\n // externalHandling: if passed down, React Tooltip is used instead, due to limitations on\n // parents overflow hidden controls\n // data-for={anchorId} && data-tooltip-place=\"left\" are needed on the anchored component\n anchorId: PropTypes.string,\n toolTipIsVisible: PropTypes.bool\n};\n\nexport default ToolTip;\n"],"mappings":"AAAA,OAAOA,KAAP,IAAeC,cAAf,EAA+BC,QAA/B,EAAyCC,WAAzC,EAAsDC,OAAtD,QAAoE,OAApE;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,YAAP,MAAyB,eAAzB;AACA,OAAOC,QAAP,MAAqB,oBAArB;AACA,OAAOC,IAAP,MAAiB,gBAAjB;AACA,SAAQC,0CAA0C,IAAIC,eAAtD,QAA4E,0BAA5E;AACA,OAAOC,KAAP,MAAkB,aAAlB;AAEA,MAAMC,SAAS,GAAG;EAChB,IAAID,KAAK,CAACE,wBADM;EAEhB,IAAIF,KAAK,CAACG;AAFM,CAAlB;AAKA,MAAMC,SAAS,GAAG;EAChBC,KAAK,EAAE,EADS;EAEhBC,GAAG,EAAE;AAFW,CAAlB;;AAKA,MAAMC,cAAc,GAAG,CAAC;EACtBC,gBADsB;EAEtBC,QAFsB;EAGtBC,oCAHsB;EAItBC,OAJsB;EAKtBC,sBALsB;EAMtBC;AANsB,CAAD,KAOjB;EACJ,IAAI,CAACL,gBAAL,EAAuB,OAAO,IAAP;;EACvB,IAAIC,QAAJ,EAAc;IACZ,oBACE,oBAAC,YAAD;MACE,EAAE,EAAEA,QADN;MAEE,SAAS,EAAET,KAAK,CAACc,YAFnB;MAGE,kBAAe,OAHjB;MAIE,KAAK,EAAC,MAJR;MAKE,MAAM,EAAC,OALT;MAME,cAAYJ;IANd,GAQGC,OARH,CADF;EAYD,CAbD,MAaO;IACL,oBACE;MACE,SAAS,EAAElB,UAAU,CACnBO,KAAK,CAACe,OADa,EAEnBF,QAAQ,KAAK,KAAb,GAAqBb,KAAK,CAACgB,cAA3B,GAA4ChB,KAAK,CAACiB,gBAF/B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CAAC0B,MAAV,CAAiBC,UAJrC;EAKlB;EACAmB,sBAAsB,EAAE9C,SAAS,CAAC0B,MANhB;EAOlBqB,SAAS,EAAE/C,SAAS,CAACgE,MAPH;EAQlBhB,QAAQ,EAAEhD,SAAS,CAAC8B,KAAV,CAAgB,CAAC,EAAD,EAAK,EAAL,CAAhB,CARQ;EASlBX,QAAQ,EAAEnB,SAAS,CAAC8B,KAAV,CAAgB3B,IAAI,CAACO,SAAD,CAApB,CATQ;EAUlB;EACA;EACA;EACA;EACAK,QAAQ,EAAEf,SAAS,CAAC0B,MAdF;EAelBZ,gBAAgB,EAAEd,SAAS,CAACyB;AAfV,CAApB;AAkBA,eAAegB,OAAf"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","isValidElement","useState","useCallback","useMemo","classnames","PropTypes","ReactTooltip","isString","keys","NovaCompositionCoorpacademyInformationIcon","InformationIcon","style","FontSizes","tooltipContentFontSize12","tooltipContentFontSize14","IconSizes","small","big","ToolTipWrapper","toolTipIsVisible","anchorId","closeToolTipInformationTextAriaLabel","content","handleContentMouseOver","iconSize","coorpToolTipClasses","toolTip","bigIconToolTip","smallIconToolTip","toolTipReact","propTypes","bool","string","isRequired","node","func","oneOf","toggleStateOnKeyPress","state","setState","ref","event","key","current","focus","stopPropagation","preventDefault","ToolTip","TooltipContent","ariaLabel","dataTestId","_toolTipIsVisible","iconContainerClassName","delayHide","fontSize","isComponent","setToolTipIsVisible","mouseLeaveTimer","setMouseLeaveTimer","undefined","handleKeyPress","clearTimeout","handleMouseOver","handleMouseLeave","setTimeout","tooltipContent","tooltipContainer","tooltipIconContainer","informationIcon","oneOfType","number"],"sources":["../../../src/atom/tooltip/index.js"],"sourcesContent":["import React, {isValidElement, useState, useCallback, useMemo} from 'react';\nimport classnames from 'classnames';\nimport PropTypes from 'prop-types';\nimport ReactTooltip from 'react-tooltip';\nimport isString from 'lodash/fp/isString';\nimport keys from 'lodash/fp/keys';\nimport {NovaCompositionCoorpacademyInformationIcon as InformationIcon} from '@coorpacademy/nova-icons';\nimport style from './style.css';\n\nconst FontSizes = {\n 12: style.tooltipContentFontSize12,\n 14: style.tooltipContentFontSize14\n};\n\nconst IconSizes = {\n small: 12,\n big: 20\n};\n\nconst ToolTipWrapper = ({\n toolTipIsVisible,\n anchorId,\n closeToolTipInformationTextAriaLabel,\n content,\n handleContentMouseOver,\n iconSize\n}) => {\n const coorpToolTipClasses = classnames(\n style.toolTip,\n iconSize === 'big' ? style.bigIconToolTip : style.smallIconToolTip\n );\n if (!toolTipIsVisible) return null;\n if (anchorId) {\n return (\n <ReactTooltip\n id={anchorId}\n className={style.toolTipReact}\n data-event-off=\"click\"\n place=\"left\"\n effect=\"solid\"\n aria-label={closeToolTipInformationTextAriaLabel}\n >\n {content}\n </ReactTooltip>\n );\n } else {\n return (\n <div\n className={coorpToolTipClasses}\n data-testid=\"tooltip\"\n aria-label={closeToolTipInformationTextAriaLabel}\n onMouseOver={handleContentMouseOver}\n >\n {content}\n </div>\n );\n }\n};\n\nToolTipWrapper.propTypes = {\n toolTipIsVisible: PropTypes.bool,\n anchorId: PropTypes.string,\n closeToolTipInformationTextAriaLabel: PropTypes.string.isRequired,\n content: PropTypes.node,\n handleContentMouseOver: PropTypes.func,\n iconSize: PropTypes.oneOf(keys(IconSizes))\n};\n\nexport const toggleStateOnKeyPress = (state, setState, ref) => event => {\n if (event.key === 'Enter') {\n if (ref) ref.current.focus();\n event.stopPropagation();\n event.preventDefault();\n setState(!state);\n } else if (event.key === 'Tab' || event.key === 'Escape') {\n setState(false);\n }\n};\n\nconst ToolTip = ({\n anchorId,\n TooltipContent,\n 'aria-label': ariaLabel,\n 'data-testid': dataTestId,\n closeToolTipInformationTextAriaLabel,\n toolTipIsVisible: _toolTipIsVisible,\n iconContainerClassName,\n delayHide = 250,\n fontSize = 14,\n iconSize = 'small'\n}) => {\n const isComponent = useMemo(\n () => !isString(TooltipContent) && isValidElement(TooltipContent()),\n [TooltipContent]\n );\n\n const [toolTipIsVisible, setToolTipIsVisible] = useState(false);\n\n const [mouseLeaveTimer, setMouseLeaveTimer] = useState(undefined);\n\n const handleKeyPress = useCallback(\n event => {\n toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible)(event);\n },\n [toolTipIsVisible]\n );\n\n const handleContentMouseOver = useCallback(() => {\n mouseLeaveTimer && /* istanbul ignore next */ clearTimeout(mouseLeaveTimer);\n }, [mouseLeaveTimer]);\n\n const handleMouseOver = useCallback(() => {\n mouseLeaveTimer && clearTimeout(mouseLeaveTimer);\n setToolTipIsVisible(true);\n }, [mouseLeaveTimer]);\n\n const handleMouseLeave = useCallback(() => {\n setMouseLeaveTimer(setTimeout(() => setToolTipIsVisible(false), delayHide));\n }, [delayHide]);\n\n const content = useMemo(() => {\n return isComponent ? (\n <TooltipContent />\n ) : (\n <p className={classnames([style.tooltipContent, FontSizes[fontSize]])}>{TooltipContent}</p>\n );\n }, [TooltipContent, fontSize, isComponent]);\n\n return anchorId ? (\n <ToolTipWrapper\n toolTipIsVisible={_toolTipIsVisible}\n anchorId={anchorId}\n closeToolTipInformationTextAriaLabel={closeToolTipInformationTextAriaLabel}\n content={content}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n fontSize={fontSize}\n />\n ) : (\n <div\n className={style.tooltipContainer}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n >\n <button\n type=\"button\"\n className={classnames([style.tooltipIconContainer, iconContainerClassName])}\n data-testid={dataTestId}\n onKeyDown={handleKeyPress}\n tabIndex={0}\n >\n <InformationIcon\n className={style.informationIcon}\n width={IconSizes[iconSize]}\n height={IconSizes[iconSize]}\n aria-label={ariaLabel}\n />\n </button>\n <ToolTipWrapper\n toolTipIsVisible={toolTipIsVisible}\n anchorId={anchorId}\n closeToolTipInformationTextAriaLabel={closeToolTipInformationTextAriaLabel}\n content={content}\n handleContentMouseOver={handleContentMouseOver}\n fontSize={fontSize}\n iconSize={iconSize}\n />\n </div>\n );\n};\n\nToolTip.propTypes = {\n TooltipContent: PropTypes.oneOfType([PropTypes.func, PropTypes.node, PropTypes.string]),\n 'data-testid': PropTypes.string,\n 'aria-label': PropTypes.string,\n closeToolTipInformationTextAriaLabel: PropTypes.string.isRequired,\n // ---------- Regular Tooltip exclusive --------------\n iconContainerClassName: PropTypes.string,\n delayHide: PropTypes.number,\n fontSize: PropTypes.oneOf([12, 14]),\n iconSize: PropTypes.oneOf(keys(IconSizes)),\n // ---------- React Tooltip exclusive --------------\n // externalHandling: if passed down, React Tooltip is used instead, due to limitations on\n // parents overflow hidden controls\n // data-for={anchorId} && data-tooltip-place=\"left\" are needed on the anchored component\n anchorId: PropTypes.string,\n toolTipIsVisible: PropTypes.bool\n};\n\nexport default ToolTip;\n"],"mappings":"AAAA,OAAOA,KAAP,IAAeC,cAAf,EAA+BC,QAA/B,EAAyCC,WAAzC,EAAsDC,OAAtD,QAAoE,OAApE;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,YAAP,MAAyB,eAAzB;AACA,OAAOC,QAAP,MAAqB,oBAArB;AACA,OAAOC,IAAP,MAAiB,gBAAjB;AACA,SAAQC,0CAA0C,IAAIC,eAAtD,QAA4E,0BAA5E;AACA,OAAOC,KAAP,MAAkB,aAAlB;AAEA,MAAMC,SAAS,GAAG;EAChB,IAAID,KAAK,CAACE,wBADM;EAEhB,IAAIF,KAAK,CAACG;AAFM,CAAlB;AAKA,MAAMC,SAAS,GAAG;EAChBC,KAAK,EAAE,EADS;EAEhBC,GAAG,EAAE;AAFW,CAAlB;;AAKA,MAAMC,cAAc,GAAG,CAAC;EACtBC,gBADsB;EAEtBC,QAFsB;EAGtBC,oCAHsB;EAItBC,OAJsB;EAKtBC,sBALsB;EAMtBC;AANsB,CAAD,KAOjB;EACJ,MAAMC,mBAAmB,GAAGrB,UAAU,CACpCO,KAAK,CAACe,OAD8B,EAEpCF,QAAQ,KAAK,KAAb,GAAqBb,KAAK,CAACgB,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+B,QANZ;IAOE,QAAQ,EAAE9B;EAPZ,EAnBF,CAXF;AAyCD,CA1FD;;AA4FAuB,OAAO,CAACjB,SAAR,2CAAoB;EAClBkB,cAAc,EAAE3C,SAAS,CAACgE,SAAV,CAAoB,CAAChE,SAAS,CAAC8B,IAAX,EAAiB9B,SAAS,CAAC6B,IAA3B,EAAiC7B,SAAS,CAAC2B,MAA3C,CAApB,CADE;EAElB,eAAe3B,SAAS,CAAC2B,MAFP;EAGlB,cAAc3B,SAAS,CAAC2B,MAHN;EAIlBX,oCAAoC,EAAEhB,SAAS,CAAC2B,MAAV,CAAiBC,UAJrC;EAKlB;EACAmB,sBAAsB,EAAE/C,SAAS,CAAC2B,MANhB;EAOlBqB,SAAS,EAAEhD,SAAS,CAACiE,MAPH;EAQlBhB,QAAQ,EAAEjD,SAAS,CAAC+B,KAAV,CAAgB,CAAC,EAAD,EAAK,EAAL,CAAhB,CARQ;EASlBZ,QAAQ,EAAEnB,SAAS,CAAC+B,KAAV,CAAgB5B,IAAI,CAACO,SAAD,CAApB,CATQ;EAUlB;EACA;EACA;EACA;EACAK,QAAQ,EAAEf,SAAS,CAAC2B,MAdF;EAelBb,gBAAgB,EAAEd,SAAS,CAAC0B;AAfV,CAApB;AAkBA,eAAegB,OAAf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customer.js","names":["React","PropTypes","classnames","style","THEMES","default","coorpmanager","Customer","props","name","type","coorpOriginal","theme","disabled","ariaLabel","className","customer","chapterCustomer","content","coorp","original","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":["React","PropTypes","classnames","style","THEMES","default","coorpmanager","Customer","props","name","type","coorpOriginal","theme","disabled","ariaLabel","className","customer","chapterCustomer","content","coorp","original","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,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,OAAOC,KAAP,MAAkB,gBAAlB;AAEA,OAAO,MAAMC,MAAM,GAAG;EACpBC,OAAO,EAAE,IADW;EAEpBC,YAAY,EAAEH,KAAK,CAACG;AAFA,CAAf;;AAKP,MAAMC,QAAQ,GAAGC,KAAK,IAAI;EACxB,MAAM;IAACC,IAAD;IAAOC,IAAP;IAAaC,aAAb;IAA4BC,KAA5B;IAAmCC,QAAnC;IAA6C,cAAcC;EAA3D,IAAwEN,KAA9E;EACA,MAAMO,SAAS,GAAGb,UAAU,CAC1BE,MAAM,CAACQ,KAAD,CADoB,EAE1BT,KAAK,CAACa,QAFoB,EAG1BN,IAAI,KAAK,SAAT,GAAqBP,KAAK,CAACc,eAA3B,GAA6C,IAHnB,CAA5B;EAMA,oBACE;IAAK,SAAS,EAAEF,SAAhB;IAA2B,QAAQ,EAAEF,QAArC;IAA+C,cAAYC;EAA3D,gBACE;IAAK,SAAS,EAAEX,KAAK,CAACe;EAAtB,GACGP,aAAa,gBAAG;IAAM,SAAS,EAAER,KAAK,CAACgB;EAAvB,YAAH,GAAiD,IADjE,EAEGR,aAAa,gBAAG;IAAM,SAAS,EAAER,KAAK,CAACiB;EAAvB,eAAH,GAAuD,IAFvE,EAGG,CAACT,aAAD,IAAkBF,IAHrB,CADF,CADF;AASD,CAjBD;;AAmBAF,QAAQ,CAACc,SAAT,2CAAqB;EACnBT,KAAK,EAAEX,SAAS,CAACqB,KAAV,CAAgB,MAAKlB,MAAL,CAAhB,CADY;EAEnBM,IAAI,EAAET,SAAS,CAACsB,MAFG;EAGnBd,IAAI,EAAER,SAAS,CAACsB,MAHG;EAInBZ,aAAa,EAAEV,SAAS,CAACuB,IAAV,CAAeC,UAJX;EAKnBZ,QAAQ,EAAEZ,SAAS,CAACuB,IALD;EAMnB,cAAcvB,SAAS,CAACsB;AANL,CAArB;AASA,eAAehB,QAAf"}
|
|
@@ -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":";AAaA;;;;;;;;oCAwIC"}
|
|
@@ -1,11 +1,14 @@
|
|
|
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';
|
|
9
12
|
import style from './favorite.css';
|
|
10
13
|
|
|
11
14
|
const Favorite = ({
|
|
@@ -18,6 +21,7 @@ const Favorite = ({
|
|
|
18
21
|
disabled
|
|
19
22
|
}, legacyContext) => {
|
|
20
23
|
const skin = GetSkinFromContext(legacyContext);
|
|
24
|
+
const translate = GetTranslateFromContext(legacyContext);
|
|
21
25
|
const handleFavoriteClick = useCallback(e => {
|
|
22
26
|
e.stopPropagation();
|
|
23
27
|
e.preventDefault();
|
|
@@ -30,26 +34,43 @@ const Favorite = ({
|
|
|
30
34
|
|
|
31
35
|
const brandColor = _get('common.brand', skin);
|
|
32
36
|
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
37
|
+
const buttonRef = useRef(null);
|
|
38
|
+
const allowToolTip = useMemo(() => !_isEmpty(removeFavoriteToolTip) && !_isEmpty(addFavoriteToolTip), [addFavoriteToolTip, removeFavoriteToolTip]); // to be replaced by useId when React17 is bumped to React18
|
|
39
|
+
|
|
40
|
+
const [favoriteButtonAnchorId] = useState(allowToolTip ? uuidV5('engaged-battle-', uuidV5.URL) : undefined);
|
|
41
|
+
const toolTipContent = useMemo( // eslint-disable-next-line no-nested-ternary
|
|
42
|
+
() => allowToolTip ? favorite ? removeFavoriteToolTip : addFavoriteToolTip : null, [addFavoriteToolTip, favorite, removeFavoriteToolTip, allowToolTip]);
|
|
43
|
+
const [mouseLeaveTimer, setMouseLeaveTimer] = useState(undefined);
|
|
44
|
+
const [toolTipIsVisible, setToolTipIsVisible] = useState(false);
|
|
45
|
+
const handleMouseOver = useCallback(() => {
|
|
46
|
+
mouseLeaveTimer && clearTimeout(mouseLeaveTimer);
|
|
47
|
+
/* istanbul ignore next */
|
|
48
|
+
|
|
49
|
+
_has(['current', 'focus'], buttonRef) && buttonRef.current.focus();
|
|
50
|
+
setToolTipIsVisible(true);
|
|
51
|
+
}, [mouseLeaveTimer]);
|
|
52
|
+
const handleMouseLeave = useCallback(() => {
|
|
53
|
+
setMouseLeaveTimer(setTimeout(() => {
|
|
54
|
+
setToolTipIsVisible(false); // @ts-expect-error (error: blur does not exists on type never)
|
|
55
|
+
|
|
56
|
+
/* istanbul ignore next */
|
|
57
|
+
|
|
58
|
+
_has(['current', 'blur'], buttonRef) && buttonRef.current.blur();
|
|
59
|
+
}, 500));
|
|
60
|
+
}, []);
|
|
61
|
+
const handleKeyPress = useCallback(event => {
|
|
62
|
+
toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible, buttonRef)(event);
|
|
63
|
+
}, [toolTipIsVisible]);
|
|
64
|
+
const iconWrapperClassName = useMemo(() => classnames(style.favorite, className, favorite && style.selected), [className, favorite]);
|
|
65
|
+
const icon = useMemo(() => favorite ? /*#__PURE__*/React.createElement(CheckIcon // eslint-disable-next-line css-modules/no-undef-class
|
|
66
|
+
, {
|
|
47
67
|
className: style.checkIcon,
|
|
48
68
|
style: {
|
|
49
69
|
color: brandColor
|
|
50
70
|
},
|
|
51
71
|
width: 13,
|
|
52
72
|
height: 13,
|
|
73
|
+
"data-testid": "favorite-check-icon",
|
|
53
74
|
"aria-label": ariaLabel.removeFromFavorite
|
|
54
75
|
}) : /*#__PURE__*/React.createElement(MoreIcon, {
|
|
55
76
|
className: style.moreIcon,
|
|
@@ -58,8 +79,38 @@ const Favorite = ({
|
|
|
58
79
|
},
|
|
59
80
|
width: 13,
|
|
60
81
|
height: 13,
|
|
82
|
+
"data-testid": "favorite-add-icon",
|
|
61
83
|
"aria-label": ariaLabel.addToFavorite
|
|
62
|
-
}))
|
|
84
|
+
}), [ariaLabel.addToFavorite, ariaLabel.removeFromFavorite, brandColor, darkColor, favorite]);
|
|
85
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
86
|
+
className: style.favoriteWrapper,
|
|
87
|
+
"data-testid": "favorite-wrapper"
|
|
88
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
89
|
+
ref: buttonRef,
|
|
90
|
+
type: "button",
|
|
91
|
+
"data-for": favoriteButtonAnchorId,
|
|
92
|
+
"data-tooltip-place": "left",
|
|
93
|
+
"data-tip": allowToolTip,
|
|
94
|
+
"data-name": "favorite",
|
|
95
|
+
"data-testid": "favorite-button",
|
|
96
|
+
"aria-label": ariaLabel.favorite,
|
|
97
|
+
className: iconWrapperClassName,
|
|
98
|
+
onClick: handleFavoriteClick,
|
|
99
|
+
style: {
|
|
100
|
+
color: primaryColor
|
|
101
|
+
},
|
|
102
|
+
onKeyDown: handleKeyPress,
|
|
103
|
+
onMouseLeave: handleMouseLeave,
|
|
104
|
+
onMouseOver: handleMouseOver,
|
|
105
|
+
tabIndex: 0
|
|
106
|
+
}, icon), /*#__PURE__*/React.createElement(ToolTip, {
|
|
107
|
+
fontSize: 12,
|
|
108
|
+
anchorId: favoriteButtonAnchorId,
|
|
109
|
+
toolTipIsVisible: toolTipIsVisible,
|
|
110
|
+
TooltipContent: toolTipContent,
|
|
111
|
+
closeToolTipInformationTextAriaLabel: translate('Press the escape key to close the information text'),
|
|
112
|
+
stickyOnKeyboardNavigation: true
|
|
113
|
+
}));
|
|
63
114
|
};
|
|
64
115
|
|
|
65
116
|
Favorite.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
@@ -76,7 +127,8 @@ Favorite.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
76
127
|
})
|
|
77
128
|
} : {};
|
|
78
129
|
Favorite.contextTypes = {
|
|
79
|
-
skin: Provider.childContextTypes.skin
|
|
130
|
+
skin: Provider.childContextTypes.skin,
|
|
131
|
+
translate: Provider.childContextTypes.translate
|
|
80
132
|
};
|
|
81
133
|
export default Favorite;
|
|
82
134
|
//# 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,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,SACEC,6BAA6B,IAAIC,QADnC,EAEEC,gCAAgC,IAAIC,SAFtC,QAGO,0BAHP;AAIA,OAAOC,QAAP,IAAkBC,kBAAlB,QAA2C,qBAA3C;AACA,OAAOC,KAAP,MAAkB,gBAAlB;;AAEA,MAAMC,QAAQ,GAAG,CACf;EACEC,QADF;EAEEC,kBAFF;EAGEC,qBAHF;EAIEC,SAJF;EAKE,cAAcC,SAAS,GAAG,EAL5B;EAMEC,eAAe,QANjB;EAOEC;AAPF,CADe,EAUfC,aAVe,KAWZ;EACH,MAAMC,IAAI,GAAGX,kBAAkB,CAACU,aAAD,CAA/B;EACA,MAAME,mBAAmB,GAAGrB,WAAW,CACrCsB,CAAC,IAAI;IACHA,CAAC,CAACC,eAAF;IACAD,CAAC,CAACE,cAAF;IACA,IAAI,CAACN,QAAL,EAAeD,eAAe,CAACK,CAAD,CAAf;EAChB,CALoC,EAMrC,CAACJ,QAAD,EAAWD,eAAX,CANqC,CAAvC;;EASA,MAAMQ,YAAY,GAAG,KAAI,gBAAJ,EAAsBL,IAAtB,CAArB;;EACA,MAAMM,SAAS,GAAG,KAAI,aAAJ,EAAmBN,IAAnB,CAAlB;;EACA,MAAMO,UAAU,GAAG,KAAI,cAAJ,EAAoBP,IAApB,CAAnB;;EAEA,MAAMQ,WAAW,GAAG3B,OAAO,CACzB,MACE,CA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EAMnBrB,eAAe,EAAEf,SAAS,CAACsC,IANR;EAOnB,cAActC,SAAS,CAACuC,KAAV,CAAgB;IAC5B7B,QAAQ,EAAEV,SAAS,CAACoC,MADQ;IAE5BF,aAAa,EAAElC,SAAS,CAACoC,MAFG;IAG5BJ,kBAAkB,EAAEhC,SAAS,CAACoC;EAHF,CAAhB;AAPK,CAArB;AAcA3B,QAAQ,CAAC+B,YAAT,GAAwB;EACtBtB,IAAI,EAAEZ,QAAQ,CAACmC,iBAAT,CAA2BvB;AADX,CAAxB;AAIA,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","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 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 ref={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 className={iconWrapperClassName}\n onClick={handleFavoriteClick}\n style={{\n color: primaryColor\n }}\n onKeyDown={handleKeyPress}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n tabIndex={0}\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,EAAE,IAAIC,MAAd,QAA2B,MAA3B;AAEA,SACEC,6BAA6B,IAAIC,QADnC,EAEEC,gCAAgC,IAAIC,SAFtC,QAGO,0BAHP;AAIA,OAAOC,QAAP,IAAkBC,kBAAlB,EAAsCC,uBAAtC,QAAoE,qBAApE;AACA,OAAOC,OAAP,IAAiBC,qBAAjB,QAA6C,oBAA7C;AACA,OAAOC,KAAP,MAAkB,gBAAlB;;AAEA,MAAMC,QAAQ,GAAG,CACf;EACEC,QADF;EAEEC,kBAFF;EAGEC,qBAHF;EAIEC,SAJF;EAKE,cAAcC,SAAS,GAAG,EAL5B;EAMEC,eAAe,QANjB;EAOEC;AAPF,CADe,EAUfC,aAVe,KAWZ;EACH,MAAMC,IAAI,GAAGd,kBAAkB,CAACa,aAAD,CAA/B;EACA,MAAME,SAAS,GAAGd,uBAAuB,CAACY,aAAD,CAAzC;EACA,MAAMG,mBAAmB,GAAG7B,WAAW,CACrC8B,CAAC,IAAI;IACHA,CAAC,CAACC,eAAF;IACAD,CAAC,CAACE,cAAF;IACA,IAAI,CAACP,QAAL,EAAeD,eAAe,CAACM,CAAD,CAAf;EAChB,CALoC,EAMrC,CAACL,QAAD,EAAWD,eAAX,CANqC,CAAvC;;EASA,MAAMS,YAAY,GAAG,KAAI,gBAAJ,EAAsBN,IAAtB,CAArB;;EACA,MAAMO,SAAS,GAAG,KAAI,aAAJ,EAAmBP,IAAnB,CAAlB;;EACA,MAAMQ,UAAU,GAAG,KAAI,cAAJ,EAAoBR,IAApB,CAAnB;;EAEA,MAA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CAA2B1C;AAFhB,CAAxB;AAKA,eAAeV,QAAf"}
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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
|
}
|