@coorpacademy/components 11.11.7 → 11.11.9-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/input-switch/style.css +11 -11
- package/es/atom/select/style.css +1 -0
- package/es/molecule/errors-table/index.d.ts +16 -0
- package/es/molecule/errors-table/index.d.ts.map +1 -0
- package/es/molecule/errors-table/index.js +58 -0
- package/es/molecule/errors-table/index.js.map +1 -0
- package/es/molecule/errors-table/style.css +64 -0
- package/es/molecule/errors-table/types.d.ts +24 -0
- package/es/molecule/errors-table/types.d.ts.map +1 -0
- package/es/molecule/errors-table/types.js +13 -0
- package/es/molecule/errors-table/types.js.map +1 -0
- package/es/molecule/filters/filters-wapper.css +0 -1
- package/es/organism/mooc-header/index.js +5 -4
- package/es/organism/mooc-header/index.js.map +1 -1
- package/es/organism/mooc-header/style.css +13 -1
- package/es/template/activity/engine-stars.d.ts.map +1 -1
- package/es/template/activity/engine-stars.js +3 -1
- package/es/template/activity/engine-stars.js.map +1 -1
- package/es/variables/colors.css +1 -0
- package/lib/atom/input-switch/style.css +11 -11
- package/lib/atom/select/style.css +1 -0
- package/lib/molecule/errors-table/index.d.ts +16 -0
- package/lib/molecule/errors-table/index.d.ts.map +1 -0
- package/lib/molecule/errors-table/index.js +68 -0
- package/lib/molecule/errors-table/index.js.map +1 -0
- package/lib/molecule/errors-table/style.css +64 -0
- package/lib/molecule/errors-table/types.d.ts +24 -0
- package/lib/molecule/errors-table/types.d.ts.map +1 -0
- package/lib/molecule/errors-table/types.js +24 -0
- package/lib/molecule/errors-table/types.js.map +1 -0
- package/lib/molecule/filters/filters-wapper.css +0 -1
- package/lib/organism/mooc-header/index.js +5 -4
- package/lib/organism/mooc-header/index.js.map +1 -1
- package/lib/organism/mooc-header/style.css +13 -1
- package/lib/template/activity/engine-stars.d.ts.map +1 -1
- package/lib/template/activity/engine-stars.js +3 -1
- package/lib/template/activity/engine-stars.js.map +1 -1
- package/lib/variables/colors.css +1 -0
- package/package.json +2 -2
- package/locales/.mtslconfig.json +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine-stars.js","names":["classnames","React","useCallback","useMemo","useState","useRef","PropTypes","v5","uuidV5","NovaCompositionCoorpacademyStar","StarIcon","NovaCompositionCoorpacademyTimer","TimerIcon","NovaCompositionCoorpacademyBolt","BoltIcon","NovaSolidSchoolScienceGraduationHat","CertificationIcon","NovaSolidContentContentBook1","LearnerIcon","NovaSolidVoteRewardsRewardsBadge1","BonusIcon","NovaCompositionCoorpacademyScorm","ScormIcon","NovaCompositionCoorpacademyArticle","ArticleIcon","NovaCompositionCoorpacademyVideo","VideoIcon","NovaCompositionCoorpacademyMicrophone","PodcastIcon","NovaCompositionCoorpacademyRevision","RevisionIcon","Provider","GetSkinFromContext","GetTranslateFromContext","ToolTip","toggleStateOnKeyPress","Link","style","ICONS","microlearning","learner","battle","certifications","bonus","article","scorm","video","podcast","review","ToolTipContent","preMessage","linkMessage","endMessage","onClick","color","handleContentMouseOver","toolTipContent","propTypes","string","func","EngineStars","props","legacyContext","skin","translate","toolTip","disabled","type","stars","title","active","className","handleClick","e","stopPropagation","preventDefault","dark","light","IconType","primary","engineStarsContentId","URL","undefined","toolTipIsVisible","setToolTipIsVisible","mouseLeaveTimer","setMouseLeaveTimer","buttonRef","handleKeyPress","event","handleMouseOver","clearTimeout","handleMouseLeave","setTimeout","toolTipContentProps","toolTipProps","closeToolTipInformationTextAriaLabel","TooltipContent","_props","engineStars","clickable","engineIcon","backgroundColor","iconHeader","score","iconStar","scoreTitle","isRequired","number","bool","shape","contextTypes","childContextTypes"],"sources":["../../../src/template/activity/engine-stars.js"],"sourcesContent":["import classnames from 'classnames';\nimport React, {useCallback, useMemo, useState, useRef} from 'react';\nimport PropTypes from 'prop-types';\nimport {get, noop} from 'lodash/fp';\nimport {v5 as uuidV5} from 'uuid';\nimport {\n NovaCompositionCoorpacademyStar as StarIcon,\n NovaCompositionCoorpacademyTimer as TimerIcon,\n NovaCompositionCoorpacademyBolt as BoltIcon,\n NovaSolidSchoolScienceGraduationHat as CertificationIcon,\n NovaSolidContentContentBook1 as LearnerIcon,\n NovaSolidVoteRewardsRewardsBadge1 as BonusIcon,\n NovaCompositionCoorpacademyScorm as ScormIcon,\n NovaCompositionCoorpacademyArticle as ArticleIcon,\n NovaCompositionCoorpacademyVideo as VideoIcon,\n NovaCompositionCoorpacademyMicrophone as PodcastIcon,\n NovaCompositionCoorpacademyRevision as RevisionIcon\n} from '@coorpacademy/nova-icons';\nimport Provider, {GetSkinFromContext, GetTranslateFromContext} from '../../atom/provider';\nimport ToolTip, {toggleStateOnKeyPress} from '../../atom/tooltip';\nimport Link from '../../atom/link';\nimport style from './engine-stars.css';\n\nconst ICONS = {\n microlearning: TimerIcon,\n learner: LearnerIcon,\n battle: BoltIcon,\n certifications: CertificationIcon,\n bonus: BonusIcon,\n article: ArticleIcon,\n scorm: ScormIcon,\n video: VideoIcon,\n podcast: PodcastIcon,\n review: RevisionIcon\n};\n\nconst ToolTipContent = ({\n preMessage,\n linkMessage,\n endMessage,\n onClick,\n color,\n handleContentMouseOver\n}) => (\n <p\n className={style.toolTipContent}\n onMouseOver={handleContentMouseOver}\n data-testid=\"react-tooltip-content\"\n >\n <span>{preMessage}</span>\n <Link\n onClick={onClick}\n style={{\n color\n }}\n >\n {linkMessage}\n </Link>\n <span>{endMessage}</span>\n </p>\n);\n\nToolTipContent.propTypes = {\n preMessage: PropTypes.string,\n linkMessage: PropTypes.string,\n endMessage: PropTypes.string,\n color: PropTypes.string,\n onClick: PropTypes.func,\n handleContentMouseOver: PropTypes.func\n};\n\nconst EngineStars = (props, legacyContext) => {\n const skin = GetSkinFromContext(legacyContext);\n const translate = GetTranslateFromContext(legacyContext);\n const {\n toolTip = null,\n disabled,\n type,\n stars,\n title,\n active = false,\n onClick = noop,\n className\n } = props;\n\n const handleClick = e => {\n e.stopPropagation();\n e.preventDefault();\n onClick(e);\n };\n const dark = get('common.dark', skin);\n const light = get('common.light', skin);\n const IconType = ICONS[type];\n\n const primary = get('common.primary', skin);\n\n // to replace by useId when React17 is bumped to React18\n const [engineStarsContentId] = useState(\n disabled ? uuidV5('engine-stars', uuidV5.URL) : undefined\n );\n const [toolTipIsVisible, setToolTipIsVisible] = useState(false);\n const [mouseLeaveTimer, setMouseLeaveTimer] = useState(undefined);\n const buttonRef = useRef(null);\n\n const handleKeyPress = useCallback(\n event => {\n toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible, buttonRef)(event);\n },\n [toolTipIsVisible]\n );\n\n const handleMouseOver = useCallback(() => {\n mouseLeaveTimer && clearTimeout(mouseLeaveTimer);\n setToolTipIsVisible(true);\n }, [mouseLeaveTimer]);\n\n const handleContentMouseOver = useCallback(() => {\n mouseLeaveTimer && /* istanbul ignore next */ clearTimeout(mouseLeaveTimer);\n }, [mouseLeaveTimer]);\n\n const handleMouseLeave = useCallback(() => {\n setMouseLeaveTimer(setTimeout(() => setToolTipIsVisible(false), 500));\n }, []);\n\n const toolTipContentProps = useMemo(\n () =>\n toolTip\n ? {\n preMessage: toolTip.preMessage,\n linkMessage: toolTip.linkMessage,\n endMessage: toolTip.endMessage,\n color: primary,\n onClick: toolTip.onClick\n }\n : null,\n [primary, toolTip]\n );\n\n const toolTipProps = {\n closeToolTipInformationTextAriaLabel: translate(\n 'Press the escape key to close the information text'\n )\n };\n\n const TooltipContent = useCallback(\n _props => (\n <ToolTipContent\n {...{...toolTipContentProps, ..._props}}\n handleContentMouseOver={handleContentMouseOver}\n />\n ),\n [handleContentMouseOver, toolTipContentProps]\n );\n\n return (\n <button\n ref={buttonRef}\n data-tip={disabled}\n data-engine={type}\n data-testid={`engine-stars-${type}`}\n // eslint-disable-next-line no-nested-ternary\n onClick={disabled ? handleKeyPress : active ? noop : handleClick}\n data-for={engineStarsContentId}\n className={classnames([\n style.engineStars,\n disabled ? style.disabled : '',\n active ? style.active : '',\n onClick !== noop ? style.clickable : null,\n className\n ])}\n type=\"button\"\n data-tooltip-place=\"left\"\n onKeyDown={handleKeyPress}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n >\n {disabled ? (\n <ToolTip\n {...toolTipProps}\n anchorId={engineStarsContentId}\n toolTipIsVisible={toolTipIsVisible}\n TooltipContent={TooltipContent}\n mouseLeaveTimer={mouseLeaveTimer}\n />\n ) : null}\n <span\n className={style.engineIcon}\n style={{\n backgroundColor: onClick === noop ? light : primary\n }}\n >\n <IconType className={style.iconHeader} width=\"30\" />\n </span>\n <div\n className={style.score}\n style={{\n color: active ? primary : dark\n }}\n >\n <p data-name=\"star-counter\">{stars}</p>\n <span>\n <StarIcon className={style.iconStar} color={active ? primary : dark} />\n </span>\n </div>\n <div className={style.scoreTitle}>{title}</div>\n </button>\n );\n};\n\nEngineStars.propTypes = {\n type: PropTypes.string.isRequired,\n stars: PropTypes.number.isRequired,\n title: PropTypes.string.isRequired,\n active: PropTypes.bool,\n disabled: PropTypes.bool,\n onClick: PropTypes.func,\n className: PropTypes.string,\n toolTip: PropTypes.shape({\n preMessage: PropTypes.string,\n linkMessage: PropTypes.string,\n endMessage: PropTypes.string,\n onClick: PropTypes.func\n })\n};\n\nEngineStars.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nexport default EngineStars;\n"],"mappings":";;;;;AAAA,OAAOA,UAAP,MAAuB,YAAvB;AACA,OAAOC,KAAP,IAAeC,WAAf,EAA4BC,OAA5B,EAAqCC,QAArC,EAA+CC,MAA/C,QAA4D,OAA5D;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,SAAQC,EAAE,IAAIC,MAAd,QAA2B,MAA3B;AACA,SACEC,+BAA+B,IAAIC,QADrC,EAEEC,gCAAgC,IAAIC,SAFtC,EAGEC,+BAA+B,IAAIC,QAHrC,EAIEC,mCAAmC,IAAIC,iBAJzC,EAKEC,4BAA4B,IAAIC,WALlC,EAMEC,iCAAiC,IAAIC,SANvC,EAOEC,gC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K,EAAEnC,MAAM,GAAGS,OAAH,GAAaH;EAA/D,EADF,CAPF,CAtCF,eAiDE;IAAK,SAAS,EAAEvC,KAAK,CAACqE;EAAtB,GAAmCrC,KAAnC,CAjDF,CADF;AAqDD,CAxID;;AA0IAT,WAAW,CAACH,SAAZ,2CAAwB;EACtBU,IAAI,EAAE7D,SAAS,CAACoD,MAAV,CAAiBiD,UADD;EAEtBvC,KAAK,EAAE9D,SAAS,CAACsG,MAAV,CAAiBD,UAFF;EAGtBtC,KAAK,EAAE/D,SAAS,CAACoD,MAAV,CAAiBiD,UAHF;EAItBrC,MAAM,EAAEhE,SAAS,CAACuG,IAJI;EAKtB3C,QAAQ,EAAE5D,SAAS,CAACuG,IALE;EAMtBxD,OAAO,EAAE/C,SAAS,CAACqD,IANG;EAOtBY,SAAS,EAAEjE,SAAS,CAACoD,MAPC;EAQtBO,OAAO,EAAE3D,SAAS,CAACwG,KAAV,CAAgB;IACvB5D,UAAU,EAAE5C,SAAS,CAACoD,MADC;IAEvBP,WAAW,EAAE7C,SAAS,CAACoD,MAFA;IAGvBN,UAAU,EAAE9C,SAAS,CAACoD,MAHC;IAIvBL,OAAO,EAAE/C,SAAS,CAACqD;EAJI,CAAhB;AARa,CAAxB;AAgBAC,WAAW,CAACmD,YAAZ,GAA2B;EACzBhD,IAAI,EAAEhC,QAAQ,CAACiF,iBAAT,CAA2BjD,IADR;EAEzBC,SAAS,EAAEjC,QAAQ,CAACiF,iBAAT,CAA2BhD;AAFb,CAA3B;AAKA,eAAeJ,WAAf"}
|
|
1
|
+
{"version":3,"file":"engine-stars.js","names":["classnames","React","useCallback","useMemo","useState","useRef","PropTypes","v5","uuidV5","NovaCompositionCoorpacademyStar","StarIcon","NovaCompositionCoorpacademyTimer","TimerIcon","NovaCompositionCoorpacademyBolt","BoltIcon","NovaSolidSchoolScienceGraduationHat","CertificationIcon","NovaSolidContentContentBook1","LearnerIcon","NovaSolidVoteRewardsRewardsBadge1","BonusIcon","NovaCompositionCoorpacademyScorm","ScormIcon","NovaCompositionCoorpacademyArticle","ArticleIcon","NovaCompositionCoorpacademyVideo","VideoIcon","NovaCompositionCoorpacademyMicrophone","PodcastIcon","NovaCompositionCoorpacademyRevision","RevisionIcon","Provider","GetSkinFromContext","GetTranslateFromContext","ToolTip","toggleStateOnKeyPress","Link","style","ICONS","microlearning","learner","battle","certifications","bonus","article","scorm","video","podcast","review","ToolTipContent","preMessage","linkMessage","endMessage","onClick","color","handleContentMouseOver","toolTipContent","propTypes","string","func","EngineStars","props","legacyContext","skin","translate","toolTip","disabled","type","stars","title","active","className","handleClick","e","stopPropagation","preventDefault","dark","light","IconType","primary","engineStarsContentId","URL","undefined","toolTipIsVisible","setToolTipIsVisible","mouseLeaveTimer","setMouseLeaveTimer","buttonRef","handleKeyPress","event","handleMouseOver","clearTimeout","handleMouseLeave","setTimeout","toolTipContentProps","toolTipProps","closeToolTipInformationTextAriaLabel","TooltipContent","_props","engineStars","clickable","engineIcon","backgroundColor","iconHeader","score","iconStar","scoreTitle","isRequired","number","bool","shape","contextTypes","childContextTypes"],"sources":["../../../src/template/activity/engine-stars.js"],"sourcesContent":["import classnames from 'classnames';\nimport React, {useCallback, useMemo, useState, useRef} from 'react';\nimport PropTypes from 'prop-types';\nimport {get, noop} from 'lodash/fp';\nimport {v5 as uuidV5} from 'uuid';\nimport {\n NovaCompositionCoorpacademyStar as StarIcon,\n NovaCompositionCoorpacademyTimer as TimerIcon,\n NovaCompositionCoorpacademyBolt as BoltIcon,\n NovaSolidSchoolScienceGraduationHat as CertificationIcon,\n NovaSolidContentContentBook1 as LearnerIcon,\n NovaSolidVoteRewardsRewardsBadge1 as BonusIcon,\n NovaCompositionCoorpacademyScorm as ScormIcon,\n NovaCompositionCoorpacademyArticle as ArticleIcon,\n NovaCompositionCoorpacademyVideo as VideoIcon,\n NovaCompositionCoorpacademyMicrophone as PodcastIcon,\n NovaCompositionCoorpacademyRevision as RevisionIcon\n} from '@coorpacademy/nova-icons';\nimport Provider, {GetSkinFromContext, GetTranslateFromContext} from '../../atom/provider';\nimport ToolTip, {toggleStateOnKeyPress} from '../../atom/tooltip';\nimport Link from '../../atom/link';\nimport style from './engine-stars.css';\n\nconst ICONS = {\n microlearning: TimerIcon,\n learner: LearnerIcon,\n battle: BoltIcon,\n certifications: CertificationIcon,\n bonus: BonusIcon,\n article: ArticleIcon,\n scorm: ScormIcon,\n video: VideoIcon,\n podcast: PodcastIcon,\n review: RevisionIcon\n};\n\nconst ToolTipContent = ({\n preMessage,\n linkMessage,\n endMessage,\n onClick,\n color,\n handleContentMouseOver\n}) => (\n <p\n className={style.toolTipContent}\n onMouseOver={handleContentMouseOver}\n data-testid=\"react-tooltip-content\"\n >\n <span>{preMessage}</span>\n <Link\n onClick={onClick}\n style={{\n color\n }}\n >\n {linkMessage}\n </Link>\n <span>{endMessage}</span>\n </p>\n);\n\nToolTipContent.propTypes = {\n preMessage: PropTypes.string,\n linkMessage: PropTypes.string,\n endMessage: PropTypes.string,\n color: PropTypes.string,\n onClick: PropTypes.func,\n handleContentMouseOver: PropTypes.func\n};\n\nconst EngineStars = (props, legacyContext) => {\n const skin = GetSkinFromContext(legacyContext);\n const translate = GetTranslateFromContext(legacyContext);\n const {\n toolTip = null,\n disabled,\n type,\n stars,\n title,\n active = false,\n onClick = noop,\n className\n } = props;\n\n const handleClick = e => {\n e.stopPropagation();\n e.preventDefault();\n onClick(e);\n };\n const dark = get('common.dark', skin);\n const light = get('common.light', skin);\n const IconType = ICONS[type];\n\n const primary = get('common.primary', skin);\n\n // to replace by useId when React17 is bumped to React18\n const [engineStarsContentId] = useState(\n disabled ? uuidV5('engine-stars', uuidV5.URL) : undefined\n );\n const [toolTipIsVisible, setToolTipIsVisible] = useState(false);\n const [mouseLeaveTimer, setMouseLeaveTimer] = useState(undefined);\n const buttonRef = useRef(null);\n\n const handleKeyPress = useCallback(\n event => {\n toggleStateOnKeyPress(toolTipIsVisible, setToolTipIsVisible, buttonRef)(event);\n },\n [toolTipIsVisible]\n );\n\n const handleMouseOver = useCallback(() => {\n mouseLeaveTimer && clearTimeout(mouseLeaveTimer);\n setToolTipIsVisible(true);\n }, [mouseLeaveTimer]);\n\n const handleContentMouseOver = useCallback(() => {\n mouseLeaveTimer && /* istanbul ignore next */ clearTimeout(mouseLeaveTimer);\n }, [mouseLeaveTimer]);\n\n const handleMouseLeave = useCallback(() => {\n setMouseLeaveTimer(setTimeout(() => setToolTipIsVisible(false), 500));\n }, []);\n\n const toolTipContentProps = useMemo(\n () =>\n toolTip\n ? {\n preMessage: toolTip.preMessage,\n linkMessage: toolTip.linkMessage,\n endMessage: toolTip.endMessage,\n color: primary,\n onClick: toolTip.onClick\n }\n : null,\n [primary, toolTip]\n );\n\n const toolTipProps = {\n closeToolTipInformationTextAriaLabel: translate(\n 'Press the escape key to close the information text'\n )\n };\n\n const TooltipContent = useCallback(\n _props => (\n <ToolTipContent\n {...{...toolTipContentProps, ..._props}}\n handleContentMouseOver={handleContentMouseOver}\n />\n ),\n [handleContentMouseOver, toolTipContentProps]\n );\n\n return (\n <button\n ref={buttonRef}\n data-tip={disabled}\n data-engine={type}\n data-testid={`engine-stars-${type}`}\n // eslint-disable-next-line no-nested-ternary\n onClick={disabled ? handleKeyPress : active ? noop : handleClick}\n data-for={engineStarsContentId}\n className={classnames([\n style.engineStars,\n disabled ? style.disabled : '',\n active ? style.active : '',\n onClick !== noop ? style.clickable : null,\n className\n ])}\n type=\"button\"\n data-tooltip-place=\"left\"\n onKeyDown={handleKeyPress}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n >\n {disabled ? (\n <ToolTip\n {...toolTipProps}\n anchorId={engineStarsContentId}\n toolTipIsVisible={toolTipIsVisible}\n TooltipContent={TooltipContent}\n mouseLeaveTimer={mouseLeaveTimer}\n />\n ) : null}\n <span\n className={style.engineIcon}\n style={{\n backgroundColor: onClick === noop ? light : primary\n }}\n >\n <IconType className={style.iconHeader} width=\"30\" />\n </span>\n <div\n className={style.score}\n style={{\n color: active ? primary : dark\n }}\n >\n <p data-name=\"star-counter\">{stars}</p>\n <span>\n <StarIcon\n className={style.iconStar}\n style={{\n color: active ? primary : dark\n }}\n />\n </span>\n </div>\n <div className={style.scoreTitle}>{title}</div>\n </button>\n );\n};\n\nEngineStars.propTypes = {\n type: PropTypes.string.isRequired,\n stars: PropTypes.number.isRequired,\n title: PropTypes.string.isRequired,\n active: PropTypes.bool,\n disabled: PropTypes.bool,\n onClick: PropTypes.func,\n className: PropTypes.string,\n toolTip: PropTypes.shape({\n preMessage: PropTypes.string,\n linkMessage: PropTypes.string,\n endMessage: PropTypes.string,\n onClick: PropTypes.func\n })\n};\n\nEngineStars.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nexport default EngineStars;\n"],"mappings":";;;;;AAAA,OAAOA,UAAP,MAAuB,YAAvB;AACA,OAAOC,KAAP,IAAeC,WAAf,EAA4BC,OAA5B,EAAqCC,QAArC,EAA+CC,MAA/C,QAA4D,OAA5D;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,SAAQC,EAAE,IAAIC,MAAd,QAA2B,MAA3B;AACA,SACEC,+BAA+B,IAAIC,QADrC,EAEEC,gCAAgC,IAAIC,SAFtC,EAGEC,+BAA+B,IAAIC,QAHrC,EAIEC,mCAAmC,IAAIC,iBAJzC,EAKEC,4BAA4B,IAAIC,WALlC,EAMEC,iCAAiC,IAAIC,SANvC,EAOEC,gCAAgC,IAAIC,SAPtC,EAQEC,kCAAkC,IAAIC,WARxC,EASEC,gCAAgC,IAAIC,SATtC,EAUEC,qCAAqC,IAAIC,WAV3C,EAWEC,mCAAmC,IAAIC,YAXzC,QAYO,0BAZP;AAaA,OAAOC,QAAP,IAAkBC,kBAAlB,EAAsCC,uBAAtC,QAAoE,qBAApE;AACA,OAAOC,OAAP,IAAiBC,qBAAjB,QAA6C,oBAA7C;AACA,OAAOC,IAAP,MAAiB,iBAAjB;AACA,OAAOC,KAAP,MAAkB,oBAAlB;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AAK,EAAE/D,SAAS,CAACoD,MAAV,CAAiBiD,UAHF;EAItBrC,MAAM,EAAEhE,SAAS,CAACuG,IAJI;EAKtB3C,QAAQ,EAAE5D,SAAS,CAACuG,IALE;EAMtBxD,OAAO,EAAE/C,SAAS,CAACqD,IANG;EAOtBY,SAAS,EAAEjE,SAAS,CAACoD,MAPC;EAQtBO,OAAO,EAAE3D,SAAS,CAACwG,KAAV,CAAgB;IACvB5D,UAAU,EAAE5C,SAAS,CAACoD,MADC;IAEvBP,WAAW,EAAE7C,SAAS,CAACoD,MAFA;IAGvBN,UAAU,EAAE9C,SAAS,CAACoD,MAHC;IAIvBL,OAAO,EAAE/C,SAAS,CAACqD;EAJI,CAAhB;AARa,CAAxB;AAgBAC,WAAW,CAACmD,YAAZ,GAA2B;EACzBhD,IAAI,EAAEhC,QAAQ,CAACiF,iBAAT,CAA2BjD,IADR;EAEzBC,SAAS,EAAEjC,QAAQ,CAACiF,iBAAT,CAA2BhD;AAFb,CAA3B;AAKA,eAAeJ,WAAf"}
|
package/es/variables/colors.css
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
@value orange from colors;
|
|
3
3
|
@value medium from colors;
|
|
4
4
|
@value white from colors;
|
|
5
|
-
@value positive from colors;
|
|
6
5
|
@value light from colors;
|
|
7
6
|
@value dark from colors;
|
|
7
|
+
@value positive from colors;
|
|
8
8
|
@value cm_grey_200 from colors;
|
|
9
9
|
@value black from colors;
|
|
10
10
|
@value cm_primary_blue from colors;
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
.default label {
|
|
34
|
-
height:
|
|
34
|
+
height: 24px;
|
|
35
35
|
position: relative;
|
|
36
36
|
flex-grow: 0;
|
|
37
37
|
display: block;
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
|
|
45
45
|
.default label::after {
|
|
46
46
|
position: absolute;
|
|
47
|
-
left:
|
|
48
|
-
top:
|
|
47
|
+
left: 2px;
|
|
48
|
+
top: 2px;
|
|
49
49
|
display: block;
|
|
50
|
-
width:
|
|
51
|
-
height:
|
|
50
|
+
width: 20px;
|
|
51
|
+
height: 20px;
|
|
52
52
|
border-radius: 100px;
|
|
53
53
|
background: white;
|
|
54
54
|
box-shadow: 0 3px 3px rgba(0, 0, 0, 0.05);
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
|
|
59
59
|
.modified label::after {
|
|
60
60
|
position: absolute;
|
|
61
|
-
left:
|
|
62
|
-
top:
|
|
61
|
+
left: 2px;
|
|
62
|
+
top: 2px;
|
|
63
63
|
display: block;
|
|
64
|
-
width:
|
|
65
|
-
height:
|
|
64
|
+
width: 20px;
|
|
65
|
+
height: 20px;
|
|
66
66
|
border-radius: 100px;
|
|
67
67
|
background: orange;
|
|
68
68
|
box-shadow: 0 3px 3px rgba(0, 0, 0, 0.05);
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
.default input:checked ~ label::after {
|
|
86
|
-
left:
|
|
86
|
+
left: 30px;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
.checkbox:disabled ~ label {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Props } from './types';
|
|
3
|
+
declare const ErrorsTable: {
|
|
4
|
+
(props: Props): JSX.Element;
|
|
5
|
+
propTypes: {
|
|
6
|
+
columns: import("prop-types").Requireable<(import("prop-types").InferProps<{
|
|
7
|
+
title: import("prop-types").Validator<string>;
|
|
8
|
+
}> | null | undefined)[]>;
|
|
9
|
+
rows: import("prop-types").Requireable<(import("prop-types").InferProps<{
|
|
10
|
+
fields: import("prop-types").Requireable<(string | null | undefined)[]>;
|
|
11
|
+
}> | null | undefined)[]>;
|
|
12
|
+
ariaDescribedby: import("prop-types").Requireable<string>;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export default ErrorsTable;
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/errors-table/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAC,KAAK,EAAY,MAAM,SAAS,CAAC;AAEzC,QAAA,MAAM,WAAW;YAAW,KAAK;;;;;;;;;;CAuDhC,CAAC;AAIF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
|
|
6
|
+
var _react = _interopRequireDefault(require("react"));
|
|
7
|
+
|
|
8
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
+
|
|
10
|
+
var _style = _interopRequireDefault(require("./style.css"));
|
|
11
|
+
|
|
12
|
+
var _types = require("./types");
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
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); }
|
|
17
|
+
|
|
18
|
+
const ErrorsTable = props => {
|
|
19
|
+
const {
|
|
20
|
+
columns = [],
|
|
21
|
+
rows = [],
|
|
22
|
+
ariaDescribedby
|
|
23
|
+
} = props;
|
|
24
|
+
const headerRow = columns.map((column, cIndex) => {
|
|
25
|
+
const {
|
|
26
|
+
title
|
|
27
|
+
} = column;
|
|
28
|
+
return /*#__PURE__*/_react.default.createElement("th", {
|
|
29
|
+
className: (0, _classnames.default)(_style.default[`header-${cIndex + 1}`]),
|
|
30
|
+
key: `${title}-${cIndex + 1}`,
|
|
31
|
+
role: "columnheader"
|
|
32
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, title));
|
|
33
|
+
});
|
|
34
|
+
const headerView = [/*#__PURE__*/_react.default.createElement("th", {
|
|
35
|
+
className: (0, _classnames.default)(_style.default[`header-0`]),
|
|
36
|
+
key: "header"
|
|
37
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, " ", ''))].concat(headerRow);
|
|
38
|
+
const bodyView = rows.map((row, index) => {
|
|
39
|
+
const {
|
|
40
|
+
fields = []
|
|
41
|
+
} = row;
|
|
42
|
+
const bodyRow = fields.map((field, fIndex) => {
|
|
43
|
+
return /*#__PURE__*/_react.default.createElement("td", {
|
|
44
|
+
className: (0, _classnames.default)(_style.default.col, _style.default[`col-${fIndex + 1}`]),
|
|
45
|
+
key: `${field}-${fIndex}`
|
|
46
|
+
}, field || '');
|
|
47
|
+
});
|
|
48
|
+
bodyRow.unshift( /*#__PURE__*/_react.default.createElement("td", {
|
|
49
|
+
className: (0, _classnames.default)(_style.default.col, _style.default[`col-0`]),
|
|
50
|
+
key: "header"
|
|
51
|
+
}, index + 1));
|
|
52
|
+
return /*#__PURE__*/_react.default.createElement("tr", {
|
|
53
|
+
key: `line-${index}`
|
|
54
|
+
}, bodyRow);
|
|
55
|
+
});
|
|
56
|
+
return /*#__PURE__*/_react.default.createElement("table", _extends({}, ariaDescribedby ? {
|
|
57
|
+
'aria-describedby': ariaDescribedby
|
|
58
|
+
} : {}, {
|
|
59
|
+
className: _style.default.table
|
|
60
|
+
}), /*#__PURE__*/_react.default.createElement("thead", {
|
|
61
|
+
className: _style.default.thead
|
|
62
|
+
}, /*#__PURE__*/_react.default.createElement("tr", null, headerView)), /*#__PURE__*/_react.default.createElement("tbody", null, bodyView));
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
ErrorsTable.propTypes = process.env.NODE_ENV !== "production" ? _types.propTypes : {};
|
|
66
|
+
var _default = ErrorsTable;
|
|
67
|
+
exports.default = _default;
|
|
68
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["ErrorsTable","props","columns","rows","ariaDescribedby","headerRow","map","column","cIndex","title","classnames","style","headerView","concat","bodyView","row","index","fields","bodyRow","field","fIndex","col","unshift","table","thead","propTypes"],"sources":["../../../src/molecule/errors-table/index.tsx"],"sourcesContent":["/* eslint-disable css-modules/no-unused-class */\nimport React from 'react';\nimport classnames from 'classnames';\nimport style from './style.css';\nimport {Props, propTypes} from './types';\n\nconst ErrorsTable = (props: Props) => {\n const {columns = [], rows = [], ariaDescribedby} = props;\n\n const headerRow = columns.map((column, cIndex) => {\n const {title} = column;\n return (\n <th\n className={classnames(style[`header-${cIndex + 1}`])}\n key={`${title}-${cIndex + 1}`}\n role=\"columnheader\"\n >\n <div>{title}</div>\n </th>\n );\n });\n\n const headerView = [\n <th className={classnames(style[`header-0`])} key=\"header\">\n <div> {''}</div>\n </th>\n ].concat(headerRow);\n\n const bodyView = rows.map((row, index) => {\n const {fields = []} = row;\n\n const bodyRow = fields.map((field: string, fIndex: number) => {\n return (\n <td\n className={classnames(style.col, style[`col-${fIndex + 1}`])}\n key={`${field}-${fIndex}`}\n >\n {field || ''}\n </td>\n );\n });\n bodyRow.unshift(\n <td className={classnames(style.col, style[`col-0`])} key=\"header\">\n {index + 1}\n </td>\n );\n\n return <tr key={`line-${index}`}>{bodyRow}</tr>;\n });\n\n return (\n <table\n {...(ariaDescribedby ? {'aria-describedby': ariaDescribedby} : {})}\n className={style.table}\n >\n <thead className={style.thead}>\n <tr>{headerView}</tr>\n </thead>\n <tbody>{bodyView}</tbody>\n </table>\n );\n};\n\nErrorsTable.propTypes = propTypes;\n\nexport default ErrorsTable;\n"],"mappings":";;;;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,MAAMA,WAAW,GAAIC,KAAD,IAAkB;EACpC,MAAM;IAACC,OAAO,GAAG,EAAX;IAAeC,IAAI,GAAG,EAAtB;IAA0BC;EAA1B,IAA6CH,KAAnD;EAEA,MAAMI,SAAS,GAAGH,OAAO,CAACI,GAAR,CAAY,CAACC,MAAD,EAASC,MAA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,mDACOd,eAAe,GAAG;IAAC,oBAAoBA;EAArB,CAAH,GAA2C,EADjE;IAEE,SAAS,EAAEO,cAAA,CAAMY;EAFnB,iBAIE;IAAO,SAAS,EAAEZ,cAAA,CAAMa;EAAxB,gBACE,yCAAKZ,UAAL,CADF,CAJF,eAOE,4CAAQE,QAAR,CAPF,CADF;AAWD,CAvDD;;AAyDAd,WAAW,CAACyB,SAAZ,2CAAwBA,gBAAxB;eAEezB,W"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
@value colors: "../../variables/colors.css";
|
|
2
|
+
@value xtraLightGrey from colors;
|
|
3
|
+
@value cm_grey_400 from colors;
|
|
4
|
+
@value cm_grey_700 from colors;
|
|
5
|
+
@value cm_negative_red_200 from colors;
|
|
6
|
+
@value light from colors;
|
|
7
|
+
|
|
8
|
+
.table {
|
|
9
|
+
border: 1px solid light;
|
|
10
|
+
font-family: 'Gilroy';
|
|
11
|
+
font-style: normal;
|
|
12
|
+
border-spacing: 0;
|
|
13
|
+
border-radius: 8px;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
width: 100%;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.table .thead {
|
|
19
|
+
background-color: xtraLightGrey;
|
|
20
|
+
font-weight: 600;
|
|
21
|
+
font-size: 14px;
|
|
22
|
+
line-height: 24px;
|
|
23
|
+
color: cm_grey_400;
|
|
24
|
+
height: 40px;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
text-align: left;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.table .col {
|
|
30
|
+
text-align: left;
|
|
31
|
+
padding-top: 8px;
|
|
32
|
+
padding-bottom: 8px;
|
|
33
|
+
position: relative;
|
|
34
|
+
font-weight: 500;
|
|
35
|
+
font-size: 12px;
|
|
36
|
+
line-height: 16px;
|
|
37
|
+
color: cm_grey_700;
|
|
38
|
+
border-top: 1px solid light;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.table .header-0 {
|
|
42
|
+
width: 57px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.table .header-1 {
|
|
46
|
+
width: 182px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.table .col-2 {
|
|
50
|
+
color: cm_negative_red_200;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.table .col-1 {
|
|
54
|
+
width: 182px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.table .col-0 {
|
|
58
|
+
text-align: center;
|
|
59
|
+
font-weight: 600;
|
|
60
|
+
font-size: 12px;
|
|
61
|
+
line-height: 16px;
|
|
62
|
+
width: 57px;
|
|
63
|
+
color: cm_grey_400;
|
|
64
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
export declare const propTypes: {
|
|
3
|
+
columns: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
4
|
+
title: PropTypes.Validator<string>;
|
|
5
|
+
}> | null | undefined)[]>;
|
|
6
|
+
rows: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
7
|
+
fields: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
8
|
+
}> | null | undefined)[]>;
|
|
9
|
+
ariaDescribedby: PropTypes.Requireable<string>;
|
|
10
|
+
};
|
|
11
|
+
export declare type Column = {
|
|
12
|
+
title: string;
|
|
13
|
+
};
|
|
14
|
+
export declare type Row = {
|
|
15
|
+
fields: string[];
|
|
16
|
+
};
|
|
17
|
+
export declare type Columns = [Column, Column];
|
|
18
|
+
export declare type Rows = Row[];
|
|
19
|
+
export declare type Props = {
|
|
20
|
+
columns: Columns;
|
|
21
|
+
rows: Rows;
|
|
22
|
+
ariaDescribedby?: string;
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/molecule/errors-table/types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAUnC,eAAO,MAAM,SAAS;;;;;;;;CAIrB,CAAC;AAEF,oBAAY,MAAM,GAAG;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,CAAC;AACrC,oBAAY,GAAG,GAAG;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAC,CAAC;AACrC,oBAAY,OAAO,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACvC,oBAAY,IAAI,GAAG,GAAG,EAAE,CAAC;AAEzB,oBAAY,KAAK,GAAG;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,IAAI,CAAC;IACX,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.propTypes = void 0;
|
|
5
|
+
|
|
6
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
7
|
+
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
|
|
10
|
+
const columnProptypes = _propTypes.default.shape({
|
|
11
|
+
title: _propTypes.default.string.isRequired
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const rowProptypes = _propTypes.default.shape({
|
|
15
|
+
fields: _propTypes.default.arrayOf(_propTypes.default.string)
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const propTypes = {
|
|
19
|
+
columns: _propTypes.default.arrayOf(columnProptypes),
|
|
20
|
+
rows: _propTypes.default.arrayOf(rowProptypes),
|
|
21
|
+
ariaDescribedby: _propTypes.default.string
|
|
22
|
+
};
|
|
23
|
+
exports.propTypes = propTypes;
|
|
24
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":["columnProptypes","PropTypes","shape","title","string","isRequired","rowProptypes","fields","arrayOf","propTypes","columns","rows","ariaDescribedby"],"sources":["../../../src/molecule/errors-table/types.ts"],"sourcesContent":["import PropTypes from 'prop-types';\n\nconst columnProptypes = PropTypes.shape({\n title: PropTypes.string.isRequired\n});\n\nconst rowProptypes = PropTypes.shape({\n fields: PropTypes.arrayOf(PropTypes.string)\n});\n\nexport const propTypes = {\n columns: PropTypes.arrayOf(columnProptypes),\n rows: PropTypes.arrayOf(rowProptypes),\n ariaDescribedby: PropTypes.string\n};\n\nexport type Column = {title: string};\nexport type Row = {fields: string[]};\nexport type Columns = [Column, Column];\nexport type Rows = Row[];\n\nexport type Props = {\n columns: Columns;\n rows: Rows;\n ariaDescribedby?: string;\n};\n"],"mappings":";;;;;AAAA;;;;AAEA,MAAMA,eAAe,GAAGC,kBAAA,CAAUC,KAAV,CAAgB;EACtCC,KAAK,EAAEF,kBAAA,CAAUG,MAAV,CAAiBC;AADc,CAAhB,CAAxB;;AAIA,MAAMC,YAAY,GAAGL,kBAAA,CAAUC,KAAV,CAAgB;EACnCK,MAAM,EAAEN,kBAAA,CAAUO,OAAV,CAAkBP,kBAAA,CAAUG,MAA5B;AAD2B,CAAhB,CAArB;;AAIO,MAAMK,SAAS,GAAG;EACvBC,OAAO,EAAET,kBAAA,CAAUO,OAAV,CAAkBR,eAAlB,CADc;EAEvBW,IAAI,EAAEV,kBAAA,CAAUO,OAAV,CAAkBF,YAAlB,CAFiB;EAGvBM,eAAe,EAAEX,kBAAA,CAAUG;AAHJ,CAAlB"}
|
|
@@ -501,6 +501,7 @@ class MoocHeader extends _react.default.Component {
|
|
|
501
501
|
selectProps.title = '';
|
|
502
502
|
selectProps.theme = 'header';
|
|
503
503
|
selectProps.onChange = options.onChange;
|
|
504
|
+
selectProps.className = _style.default.languageSelect;
|
|
504
505
|
settingView = /*#__PURE__*/_react.default.createElement("div", {
|
|
505
506
|
"data-name": `setting-${settingName}`,
|
|
506
507
|
className: _style.default.setting,
|
|
@@ -524,12 +525,12 @@ class MoocHeader extends _react.default.Component {
|
|
|
524
525
|
className: _style.default.setting,
|
|
525
526
|
key: settingName,
|
|
526
527
|
"aria-label": ariaLabel || title
|
|
527
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
528
|
+
}, /*#__PURE__*/_react.default.createElement(_inputSwitch.default, _extends({}, switchProps, {
|
|
529
|
+
"aria-labelledby": `title-id-${settingName}`
|
|
530
|
+
})), /*#__PURE__*/_react.default.createElement("span", {
|
|
528
531
|
id: `title-id-${settingName}`,
|
|
529
532
|
className: _style.default.label
|
|
530
|
-
}, title)
|
|
531
|
-
"aria-labelledby": `title-id-${settingName}`
|
|
532
|
-
})));
|
|
533
|
+
}, title));
|
|
533
534
|
break;
|
|
534
535
|
}
|
|
535
536
|
}
|