@coorpacademy/components 11.11.1-alpha.0 → 11.11.1-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/atom/input-search/index.d.ts.map +1 -1
- package/es/atom/input-search/index.js +1 -0
- package/es/atom/input-search/index.js.map +1 -1
- package/es/atom/input-switch/index.d.ts +2 -0
- package/es/atom/input-switch/index.d.ts.map +1 -1
- package/es/atom/input-switch/index.js +23 -11
- package/es/atom/input-switch/index.js.map +1 -1
- package/es/atom/select/index.d.ts +1 -0
- package/es/atom/select/index.d.ts.map +1 -1
- package/es/atom/select/index.js +13 -8
- package/es/atom/select/index.js.map +1 -1
- package/{lib/atom/review-header-step-item → es/atom/status-item}/index.d.ts +4 -4
- package/es/atom/status-item/index.d.ts.map +1 -0
- package/es/atom/status-item/index.js +104 -0
- package/es/atom/status-item/index.js.map +1 -0
- package/es/atom/status-item/index.native.d.ts +5 -0
- package/es/atom/status-item/index.native.d.ts.map +1 -0
- package/es/atom/{review-header-step-item → status-item}/index.native.js +2 -2
- package/es/atom/status-item/index.native.js.map +1 -0
- package/es/atom/{review-header-step-item → status-item}/style.css +47 -0
- package/es/atom/{review-header-step-item → status-item}/types.d.ts +5 -5
- package/es/atom/status-item/types.d.ts.map +1 -0
- package/es/atom/{review-header-step-item → status-item}/types.js +1 -1
- package/es/atom/status-item/types.js.map +1 -0
- package/es/atom/tooltip/index.d.ts +1 -3
- package/es/atom/tooltip/index.d.ts.map +1 -1
- package/es/atom/tooltip/index.js +7 -17
- package/es/atom/tooltip/index.js.map +1 -1
- package/es/atom/tooltip/style.css +2 -10
- package/es/globals.d.js.map +1 -1
- package/es/molecule/brand-form-group/index.d.ts +8 -0
- package/es/molecule/cm-popin/types.d.ts +2 -0
- package/es/molecule/cm-popin/types.d.ts.map +1 -1
- package/es/molecule/draggable-list/index.d.ts +2 -0
- package/es/molecule/filters/filters-wrapper.d.ts.map +1 -1
- package/es/molecule/filters/filters-wrapper.js +4 -1
- package/es/molecule/filters/filters-wrapper.js.map +1 -1
- package/es/molecule/filters/index.d.ts +2 -0
- package/es/molecule/filters/index.d.ts.map +1 -1
- package/es/molecule/filters/index.js +10 -3
- package/es/molecule/filters/index.js.map +1 -1
- package/es/molecule/review-header-steps/index.js +2 -2
- package/es/molecule/review-header-steps/index.js.map +1 -1
- package/es/molecule/review-header-steps/prop-types.d.ts +2 -2
- package/es/molecule/review-header-steps/prop-types.d.ts.map +1 -1
- package/es/molecule/review-header-steps/prop-types.js +1 -1
- package/es/molecule/review-header-steps/prop-types.js.map +1 -1
- package/es/molecule/setup-section/index.d.ts +2 -0
- package/es/molecule/setup-section/index.d.ts.map +1 -1
- package/es/molecule/setup-sections/index.d.ts +2 -0
- package/es/molecule/setup-slide/index.d.ts +3 -0
- package/es/molecule/setup-slider/index.d.ts +3 -0
- package/es/organism/brand-form/index.d.ts +8 -0
- package/es/organism/mooc-header/index.d.ts.map +1 -1
- package/es/organism/mooc-header/index.js +4 -1
- package/es/organism/mooc-header/index.js.map +1 -1
- package/es/organism/review-header/index.native.js +1 -1
- package/es/organism/review-header/index.native.js.map +1 -1
- package/es/organism/review-header/types.d.ts +2 -2
- package/es/organism/review-header/types.d.ts.map +1 -1
- package/es/organism/review-header/types.js.map +1 -1
- package/es/organism/user-preferences/index.d.ts +2 -0
- package/es/organism/wizard-contents/index.d.ts +8 -0
- package/es/template/activity/index.d.ts +12 -11
- package/es/template/activity/index.d.ts.map +1 -1
- package/es/template/activity/index.js +6 -3
- package/es/template/activity/index.js.map +1 -1
- package/es/template/app-player/loading/index.d.ts +2 -0
- package/es/template/app-player/player/index.d.ts +4 -0
- package/es/template/app-player/player/slides/index.d.ts +2 -0
- package/es/template/app-player/player/slides/index.d.ts.map +1 -1
- package/es/template/app-player/popin-correction/index.d.ts +2 -0
- package/es/template/app-player/popin-correction/index.d.ts.map +1 -1
- package/es/template/app-player/popin-end/index.d.ts +2 -0
- package/es/template/app-review/index.d.ts +2 -0
- package/es/template/app-review/index.d.ts.map +1 -1
- package/es/template/app-review/player/prop-types.d.ts +2 -0
- package/es/template/app-review/player/prop-types.d.ts.map +1 -1
- package/es/template/app-review/prop-types.d.ts +2 -0
- package/es/template/app-review/prop-types.d.ts.map +1 -1
- package/es/template/back-office/brand-update/index.d.ts +18 -0
- package/es/template/common/dashboard/index.d.ts +2 -0
- package/es/template/common/search-page/index.d.ts +3 -0
- package/es/template/common/search-page/index.d.ts.map +1 -1
- package/es/template/common/search-page/index.js +6 -3
- package/es/template/common/search-page/index.js.map +1 -1
- package/lib/atom/input-search/index.d.ts.map +1 -1
- package/lib/atom/input-search/index.js +1 -0
- package/lib/atom/input-search/index.js.map +1 -1
- package/lib/atom/input-switch/index.d.ts +2 -0
- package/lib/atom/input-switch/index.d.ts.map +1 -1
- package/lib/atom/input-switch/index.js +22 -11
- package/lib/atom/input-switch/index.js.map +1 -1
- package/lib/atom/select/index.d.ts +1 -0
- package/lib/atom/select/index.d.ts.map +1 -1
- package/lib/atom/select/index.js +13 -8
- package/lib/atom/select/index.js.map +1 -1
- package/{es/atom/review-header-step-item → lib/atom/status-item}/index.d.ts +4 -4
- package/lib/atom/status-item/index.d.ts.map +1 -0
- package/lib/atom/{review-header-step-item → status-item}/index.js +50 -23
- package/lib/atom/status-item/index.js.map +1 -0
- package/lib/atom/status-item/index.native.d.ts +5 -0
- package/lib/atom/status-item/index.native.d.ts.map +1 -0
- package/lib/atom/{review-header-step-item → status-item}/index.native.js +2 -2
- package/lib/atom/status-item/index.native.js.map +1 -0
- package/lib/atom/{review-header-step-item → status-item}/style.css +47 -0
- package/lib/atom/{review-header-step-item → status-item}/types.d.ts +5 -5
- package/lib/atom/status-item/types.d.ts.map +1 -0
- package/lib/atom/{review-header-step-item → status-item}/types.js +1 -1
- package/lib/atom/status-item/types.js.map +1 -0
- package/lib/atom/tooltip/index.d.ts +1 -3
- package/lib/atom/tooltip/index.d.ts.map +1 -1
- package/lib/atom/tooltip/index.js +7 -18
- package/lib/atom/tooltip/index.js.map +1 -1
- package/lib/atom/tooltip/style.css +2 -10
- package/lib/globals.d.js.map +1 -1
- package/lib/molecule/brand-form-group/index.d.ts +8 -0
- package/lib/molecule/cm-popin/types.d.ts +2 -0
- package/lib/molecule/cm-popin/types.d.ts.map +1 -1
- package/lib/molecule/draggable-list/index.d.ts +2 -0
- package/lib/molecule/filters/filters-wrapper.d.ts.map +1 -1
- package/lib/molecule/filters/filters-wrapper.js +4 -1
- package/lib/molecule/filters/filters-wrapper.js.map +1 -1
- package/lib/molecule/filters/index.d.ts +2 -0
- package/lib/molecule/filters/index.d.ts.map +1 -1
- package/lib/molecule/filters/index.js +9 -3
- package/lib/molecule/filters/index.js.map +1 -1
- package/lib/molecule/review-header-steps/index.js +2 -2
- package/lib/molecule/review-header-steps/index.js.map +1 -1
- package/lib/molecule/review-header-steps/prop-types.d.ts +2 -2
- package/lib/molecule/review-header-steps/prop-types.d.ts.map +1 -1
- package/lib/molecule/review-header-steps/prop-types.js +1 -1
- package/lib/molecule/review-header-steps/prop-types.js.map +1 -1
- package/lib/molecule/setup-section/index.d.ts +2 -0
- package/lib/molecule/setup-section/index.d.ts.map +1 -1
- package/lib/molecule/setup-sections/index.d.ts +2 -0
- package/lib/molecule/setup-slide/index.d.ts +3 -0
- package/lib/molecule/setup-slider/index.d.ts +3 -0
- package/lib/organism/brand-form/index.d.ts +8 -0
- package/lib/organism/mooc-header/index.d.ts.map +1 -1
- package/lib/organism/mooc-header/index.js +4 -1
- package/lib/organism/mooc-header/index.js.map +1 -1
- package/lib/organism/review-header/index.native.js +1 -1
- package/lib/organism/review-header/index.native.js.map +1 -1
- package/lib/organism/review-header/types.d.ts +2 -2
- package/lib/organism/review-header/types.d.ts.map +1 -1
- package/lib/organism/review-header/types.js.map +1 -1
- package/lib/organism/user-preferences/index.d.ts +2 -0
- package/lib/organism/wizard-contents/index.d.ts +8 -0
- package/lib/template/activity/index.d.ts +12 -11
- package/lib/template/activity/index.d.ts.map +1 -1
- package/lib/template/activity/index.js +6 -3
- package/lib/template/activity/index.js.map +1 -1
- package/lib/template/app-player/loading/index.d.ts +2 -0
- package/lib/template/app-player/player/index.d.ts +4 -0
- package/lib/template/app-player/player/slides/index.d.ts +2 -0
- package/lib/template/app-player/player/slides/index.d.ts.map +1 -1
- package/lib/template/app-player/popin-correction/index.d.ts +2 -0
- package/lib/template/app-player/popin-correction/index.d.ts.map +1 -1
- package/lib/template/app-player/popin-end/index.d.ts +2 -0
- package/lib/template/app-review/index.d.ts +2 -0
- package/lib/template/app-review/index.d.ts.map +1 -1
- package/lib/template/app-review/player/prop-types.d.ts +2 -0
- package/lib/template/app-review/player/prop-types.d.ts.map +1 -1
- package/lib/template/app-review/prop-types.d.ts +2 -0
- package/lib/template/app-review/prop-types.d.ts.map +1 -1
- package/lib/template/back-office/brand-update/index.d.ts +18 -0
- package/lib/template/common/dashboard/index.d.ts +2 -0
- package/lib/template/common/search-page/index.d.ts +3 -0
- package/lib/template/common/search-page/index.d.ts.map +1 -1
- package/lib/template/common/search-page/index.js +6 -3
- package/lib/template/common/search-page/index.js.map +1 -1
- package/locales/bs/global.json +0 -2
- package/locales/cs/global.json +0 -2
- package/locales/de/global.json +0 -2
- package/locales/en/global.json +8 -5
- package/locales/es/global.json +0 -2
- package/locales/et/global.json +0 -2
- package/locales/fr/global.json +0 -2
- package/locales/hr/global.json +0 -2
- package/locales/hu/global.json +0 -2
- package/locales/hy/global.json +0 -2
- package/locales/it/global.json +0 -2
- package/locales/ja/global.json +0 -2
- package/locales/ko/global.json +0 -2
- package/locales/nl/global.json +0 -2
- package/locales/pl/global.json +0 -2
- package/locales/pt/global.json +0 -2
- package/locales/ro/global.json +0 -2
- package/locales/ru/global.json +0 -2
- package/locales/sk/global.json +0 -2
- package/locales/th/global.json +0 -2
- package/locales/tl/global.json +0 -2
- package/locales/tr/global.json +0 -2
- package/locales/uk/global.json +0 -2
- package/locales/vi/global.json +0 -2
- package/locales/zh/global.json +0 -2
- package/locales/zh_TW/global.json +0 -2
- package/package.json +3 -3
- package/es/atom/battle-opponent/index.d.ts +0 -19
- package/es/atom/battle-opponent/index.d.ts.map +0 -1
- package/es/atom/battle-opponent/index.js +0 -52
- package/es/atom/battle-opponent/index.js.map +0 -1
- package/es/atom/battle-opponent/prop-types.d.ts +0 -19
- package/es/atom/battle-opponent/prop-types.d.ts.map +0 -1
- package/es/atom/battle-opponent/prop-types.js +0 -11
- package/es/atom/battle-opponent/prop-types.js.map +0 -1
- package/es/atom/battle-opponent/style.css +0 -126
- package/es/atom/review-header-step-item/index.d.ts.map +0 -1
- package/es/atom/review-header-step-item/index.js +0 -77
- package/es/atom/review-header-step-item/index.js.map +0 -1
- package/es/atom/review-header-step-item/index.native.d.ts +0 -5
- package/es/atom/review-header-step-item/index.native.d.ts.map +0 -1
- package/es/atom/review-header-step-item/index.native.js.map +0 -1
- package/es/atom/review-header-step-item/types.d.ts.map +0 -1
- package/es/atom/review-header-step-item/types.js.map +0 -1
- package/lib/atom/battle-opponent/index.d.ts +0 -19
- package/lib/atom/battle-opponent/index.d.ts.map +0 -1
- package/lib/atom/battle-opponent/index.js +0 -70
- package/lib/atom/battle-opponent/index.js.map +0 -1
- package/lib/atom/battle-opponent/prop-types.d.ts +0 -19
- package/lib/atom/battle-opponent/prop-types.d.ts.map +0 -1
- package/lib/atom/battle-opponent/prop-types.js +0 -20
- package/lib/atom/battle-opponent/prop-types.js.map +0 -1
- package/lib/atom/battle-opponent/style.css +0 -126
- package/lib/atom/review-header-step-item/index.d.ts.map +0 -1
- package/lib/atom/review-header-step-item/index.js.map +0 -1
- package/lib/atom/review-header-step-item/index.native.d.ts +0 -5
- package/lib/atom/review-header-step-item/index.native.d.ts.map +0 -1
- package/lib/atom/review-header-step-item/index.native.js.map +0 -1
- package/lib/atom/review-header-step-item/types.d.ts.map +0 -1
- package/lib/atom/review-header-step-item/types.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["themeStyle","filter","style","invalid","header","mooc","question","sort","thematiques","player","template","coorpmanager","ArrowView","shouldRender","isArrowUp","ariaLabel","arrowClass","arrowColor","props","useMemo","color","className","Select","legacyContext","name","options","optgroups","borderClassName","onChange","multiple","disabled","required","description","theme","modified","error","title","propTitle","skin","GetSkinFromContext","setIsArrowUp","useState","handleSelectOnFocus","useCallback","handleSelectOnBlur","selectOption","option","index","value","optionList","isEmpty","map","optgroup","label","i","titleView","selected","get","find","concat","flatMapDeep","selectedLabel","isSelectedInValidOption","getOr","validOption","handleChange","e","target","selectedOptions","black","isThemeOneOfQuestionTemplateOrPlayer","includes","shouldUseSkinFontColor","undefined","behaviorClassName","getClassState","default","composedClassName","classnames","unselected","labelSize","size","isLongLabel","selectWrapper","selectSpan","noLabelCommon","longLabel","selectedArrow","arrow","selectBox","SelectOptionPropTypes","PropTypes","string","isRequired","oneOfType","number","bool","SelectOptionGroupPropTypes","arrayOf","shape","contextTypes","Provider","childContextTypes","propTypes","func","oneOf","keys"],"sources":["../../../src/atom/select/index.js"],"sourcesContent":["import React, {useCallback, useMemo, useState} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport concat from 'lodash/fp/concat';\nimport filter from 'lodash/fp/filter';\nimport find from 'lodash/fp/find';\nimport flatMapDeep from 'lodash/fp/flatMapDeep';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport includes from 'lodash/fp/includes';\nimport isEmpty from 'lodash/fp/isEmpty';\nimport keys from 'lodash/fp/keys';\nimport map from 'lodash/fp/map';\nimport size from 'lodash/fp/size';\nimport {\n NovaCompositionNavigationArrowDown as ArrowDown,\n NovaCompositionNavigationArrowTop as ArrowUp\n} from '@coorpacademy/nova-icons';\nimport Provider, {GetSkinFromContext} from '../provider';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst themeStyle = {\n filter: style.filter,\n invalid: style.invalid,\n header: style.header,\n mooc: style.mooc,\n question: style.question,\n sort: style.sort,\n thematiques: style.thematiques,\n player: style.player,\n template: style.template,\n coorpmanager: null\n};\n\nconst ArrowView = ({shouldRender, isArrowUp, ariaLabel, arrowClass, arrowColor}) => {\n const props = useMemo(\n () => ({\n ...(ariaLabel &\n {\n 'aria-label': ariaLabel\n }),\n ...(arrowColor &\n {\n color: arrowColor\n }),\n className: arrowClass\n }),\n [ariaLabel, arrowClass, arrowColor]\n );\n if (shouldRender) {\n return isArrowUp ? (\n <ArrowUp {...props} data-testid=\"select-arrow-up-icon\" />\n ) : (\n <ArrowDown {...props} data-testid=\"select-arrow-down-icon\" />\n );\n } else return null;\n};\n\nconst Select = (props, legacyContext) => {\n const {\n name,\n options = [],\n optgroups = [],\n className,\n borderClassName,\n onChange,\n multiple = false,\n disabled,\n required,\n description,\n theme,\n modified = false,\n error = false,\n title: propTitle,\n 'aria-label': ariaLabel\n } = props;\n\n const skin = GetSkinFromContext(legacyContext);\n const title = useMemo(\n () => (propTitle ? `${propTitle}${required ? '*' : ''}` : null),\n [propTitle, required]\n );\n\n const [isArrowUp, setIsArrowUp] = useState(false);\n\n const handleSelectOnFocus = useCallback(() => setIsArrowUp(true), []);\n const handleSelectOnBlur = useCallback(() => setIsArrowUp(false), []);\n\n const selectOption = (option, index) => {\n return (\n <option key={index} value={option.value} className={style.selectOption}>\n {option.name}\n </option>\n );\n };\n\n const optionList = !isEmpty(options)\n ? options.map((option, index) => selectOption(option, index))\n : optgroups.map((optgroup, index) => {\n return (\n <optgroup key={index} label={optgroup.label}>\n {optgroup.options && optgroup.options.map((option, i) => selectOption(option, i))}\n </optgroup>\n );\n });\n\n const titleView = title ? <span className={style.title}>{title} </span> : null;\n\n const selected = useMemo(\n () =>\n multiple\n ? map(get('value'), filter({selected: true}, options))\n : get('value', find({selected: true}, concat(options, flatMapDeep('options', optgroups)))),\n [multiple, options, optgroups]\n );\n const selectedLabel = useMemo(\n () =>\n multiple\n ? map(get('name'), filter({selected: true}, options))\n : get('name', find({selected: true}, concat(options, flatMapDeep('options', optgroups)))),\n [multiple, options, optgroups]\n );\n\n const isSelectedInValidOption = useMemo(\n () =>\n theme === 'player' &&\n getOr(false, 'name', find({validOption: false, selected: true}, options)),\n [options, theme]\n );\n\n const handleChange = useMemo(\n () =>\n multiple\n ? e => {\n setIsArrowUp(false);\n onChange(map(get('value'), e.target.selectedOptions));\n }\n : e => {\n setIsArrowUp(false);\n onChange(e.target.value);\n },\n [onChange, multiple]\n );\n\n const black = useMemo(() => getOr('#14171A', 'common.black', skin), [skin]);\n const color = useMemo(() => getOr('#00B0FF', 'common.primary', skin), [skin]);\n const isThemeOneOfQuestionTemplateOrPlayer = useMemo(\n () => includes(theme, ['question', 'template', 'player']),\n [theme]\n );\n const shouldUseSkinFontColor = useMemo(\n () => !isSelectedInValidOption && selected && isThemeOneOfQuestionTemplateOrPlayer,\n [isSelectedInValidOption, selected, isThemeOneOfQuestionTemplateOrPlayer]\n );\n const arrowColor = selected ? color : undefined;\n\n const behaviorClassName = useMemo(\n () => getClassState(style.default, style.modified, style.error, modified, error),\n [error, modified]\n );\n const composedClassName = useMemo(\n () =>\n classnames(\n theme && theme !== 'coorpmanager' ? themeStyle[theme] : behaviorClassName,\n selected ? style.selected : style.unselected,\n className\n ),\n [behaviorClassName, className, selected, theme]\n );\n\n const labelSize = useMemo(() => size(selectedLabel), [selectedLabel]);\n\n const isLongLabel = useMemo(() => labelSize >= 65, [labelSize]);\n\n return (\n <div\n className={classnames(\n composedClassName,\n theme === 'coorpmanager' ? style.coorpmanager : null\n )}\n >\n <label\n data-name=\"select-wrapper\"\n style={{\n ...(shouldUseSkinFontColor && {\n color\n })\n }}\n className={style.selectWrapper}\n >\n {titleView}\n <span\n data-name=\"select-span\"\n className={classnames(\n style.selectSpan,\n includes(theme, ['player', 'invalid', 'question', 'thematiques', 'template'])\n ? style.noLabelCommon\n : null,\n borderClassName,\n isLongLabel ? style.longLabel : null\n )}\n style={{\n ...(shouldUseSkinFontColor && {\n color\n })\n }}\n >\n {selectedLabel}\n </span>\n <ArrowView\n shouldRender={!multiple}\n isArrowUp={isArrowUp}\n ariaLabel={ariaLabel}\n arrowClass={shouldUseSkinFontColor ? style.selectedArrow : style.arrow}\n arrowColor={isThemeOneOfQuestionTemplateOrPlayer ? arrowColor : black}\n />\n <select\n data-name=\"native-select\"\n className={style.selectBox}\n title={selectedLabel}\n name={name}\n onChange={handleChange}\n value={selected}\n multiple={multiple}\n disabled={disabled}\n onClick={handleSelectOnFocus}\n onBlur={handleSelectOnBlur}\n // onBlur does not handle completely an out of bounds click\n // ex: select is Opened and a click is done outside, cancelling the select\n // that doesn't count as a Blur, so an onMouseLeave is needed\n onMouseLeave={handleSelectOnBlur}\n data-testid=\"native-select\"\n >\n {optionList}\n </select>\n </label>\n <div className={style.description}>{description}</div>\n </div>\n );\n};\n\nexport const SelectOptionPropTypes = {\n name: PropTypes.string.isRequired,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n selected: PropTypes.bool,\n validOption: PropTypes.bool\n};\n\nexport const SelectOptionGroupPropTypes = {\n label: PropTypes.string.isRequired,\n options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes))\n};\n\nSelect.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nSelect.propTypes = {\n title: PropTypes.string,\n name: PropTypes.string,\n className: PropTypes.string,\n borderClassName: PropTypes.string,\n disabled: PropTypes.bool,\n multiple: PropTypes.bool,\n description: PropTypes.string,\n required: PropTypes.bool,\n onChange: PropTypes.func,\n theme: PropTypes.oneOf(keys(themeStyle)),\n options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes)),\n optgroups: PropTypes.arrayOf(PropTypes.shape(SelectOptionGroupPropTypes)),\n modified: PropTypes.bool,\n error: PropTypes.bool,\n 'aria-label': PropTypes.string\n};\n\nexport default Select;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AACA;;;;;;;;;;AA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AEyD,kBAAA,CAAUK,IAbH;EAcjB7D,KAAK,EAAEwD,kBAAA,CAAUK,IAdA;EAejB,cAAcL,kBAAA,CAAUC;AAfP,CAAnB;eAkBetE,M"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["themeStyle","filter","style","invalid","header","mooc","question","sort","thematiques","player","template","coorpmanager","ArrowView","shouldRender","isArrowUp","ariaLabel","arrowClass","arrowColor","props","useMemo","color","className","Select","legacyContext","name","options","optgroups","borderClassName","onChange","multiple","disabled","required","description","theme","modified","error","title","propTitle","ariaLabelledBy","skin","GetSkinFromContext","setIsArrowUp","useState","handleSelectOnFocus","useCallback","handleSelectOnBlur","selectOption","option","index","value","optionList","isEmpty","map","optgroup","label","i","titleView","selected","get","find","concat","flatMapDeep","selectedLabel","isSelectedInValidOption","getOr","validOption","handleChange","e","target","selectedOptions","black","isThemeOneOfQuestionTemplateOrPlayer","includes","shouldUseSkinFontColor","undefined","behaviorClassName","getClassState","default","composedClassName","classnames","unselected","labelSize","size","isLongLabel","selectWrapper","selectSpan","noLabelCommon","longLabel","selectedArrow","arrow","selectBox","SelectOptionPropTypes","PropTypes","string","isRequired","oneOfType","number","bool","SelectOptionGroupPropTypes","arrayOf","shape","contextTypes","Provider","childContextTypes","propTypes","func","oneOf","keys"],"sources":["../../../src/atom/select/index.js"],"sourcesContent":["import React, {useCallback, useMemo, useState} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport concat from 'lodash/fp/concat';\nimport filter from 'lodash/fp/filter';\nimport find from 'lodash/fp/find';\nimport flatMapDeep from 'lodash/fp/flatMapDeep';\nimport get from 'lodash/fp/get';\nimport getOr from 'lodash/fp/getOr';\nimport includes from 'lodash/fp/includes';\nimport isEmpty from 'lodash/fp/isEmpty';\nimport keys from 'lodash/fp/keys';\nimport map from 'lodash/fp/map';\nimport size from 'lodash/fp/size';\nimport {\n NovaCompositionNavigationArrowDown as ArrowDown,\n NovaCompositionNavigationArrowTop as ArrowUp\n} from '@coorpacademy/nova-icons';\nimport Provider, {GetSkinFromContext} from '../provider';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst themeStyle = {\n filter: style.filter,\n invalid: style.invalid,\n header: style.header,\n mooc: style.mooc,\n question: style.question,\n sort: style.sort,\n thematiques: style.thematiques,\n player: style.player,\n template: style.template,\n coorpmanager: null\n};\n\nconst ArrowView = ({shouldRender, isArrowUp, ariaLabel, arrowClass, arrowColor}) => {\n const props = useMemo(\n () => ({\n ...(arrowColor &\n {\n color: arrowColor\n }),\n className: arrowClass\n }),\n [ariaLabel, arrowClass, arrowColor]\n );\n if (shouldRender) {\n return isArrowUp ? (\n <ArrowUp {...props} data-testid=\"select-arrow-up-icon\" />\n ) : (\n <ArrowDown {...props} data-testid=\"select-arrow-down-icon\" />\n );\n } else return null;\n};\n\nconst Select = (props, legacyContext) => {\n const {\n name,\n options = [],\n optgroups = [],\n className,\n borderClassName,\n onChange,\n multiple = false,\n disabled,\n required,\n description,\n theme,\n modified = false,\n error = false,\n title: propTitle,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy\n } = props;\n\n const skin = GetSkinFromContext(legacyContext);\n const title = useMemo(\n () => (propTitle ? `${propTitle}${required ? '*' : ''}` : null),\n [propTitle, required]\n );\n\n const [isArrowUp, setIsArrowUp] = useState(false);\n\n const handleSelectOnFocus = useCallback(() => setIsArrowUp(true), []);\n const handleSelectOnBlur = useCallback(() => setIsArrowUp(false), []);\n\n const selectOption = (option, index) => {\n return (\n <option key={index} value={option.value} className={style.selectOption}>\n {option.name}\n </option>\n );\n };\n\n const optionList = !isEmpty(options)\n ? options.map((option, index) => selectOption(option, index))\n : optgroups.map((optgroup, index) => {\n return (\n <optgroup key={index} label={optgroup.label}>\n {optgroup.options && optgroup.options.map((option, i) => selectOption(option, i))}\n </optgroup>\n );\n });\n\n const titleView = title ? <span className={style.title}>{title} </span> : null;\n\n const selected = useMemo(\n () =>\n multiple\n ? map(get('value'), filter({selected: true}, options))\n : get('value', find({selected: true}, concat(options, flatMapDeep('options', optgroups)))),\n [multiple, options, optgroups]\n );\n const selectedLabel = useMemo(\n () =>\n multiple\n ? map(get('name'), filter({selected: true}, options))\n : get('name', find({selected: true}, concat(options, flatMapDeep('options', optgroups)))),\n [multiple, options, optgroups]\n );\n\n const isSelectedInValidOption = useMemo(\n () =>\n theme === 'player' &&\n getOr(false, 'name', find({validOption: false, selected: true}, options)),\n [options, theme]\n );\n\n const handleChange = useMemo(\n () =>\n multiple\n ? e => {\n setIsArrowUp(false);\n onChange(map(get('value'), e.target.selectedOptions));\n }\n : e => {\n setIsArrowUp(false);\n onChange(e.target.value);\n },\n [onChange, multiple]\n );\n\n const black = useMemo(() => getOr('#14171A', 'common.black', skin), [skin]);\n const color = useMemo(() => getOr('#00B0FF', 'common.primary', skin), [skin]);\n const isThemeOneOfQuestionTemplateOrPlayer = useMemo(\n () => includes(theme, ['question', 'template', 'player']),\n [theme]\n );\n const shouldUseSkinFontColor = useMemo(\n () => !isSelectedInValidOption && selected && isThemeOneOfQuestionTemplateOrPlayer,\n [isSelectedInValidOption, selected, isThemeOneOfQuestionTemplateOrPlayer]\n );\n const arrowColor = selected ? color : undefined;\n\n const behaviorClassName = useMemo(\n () => getClassState(style.default, style.modified, style.error, modified, error),\n [error, modified]\n );\n const composedClassName = useMemo(\n () =>\n classnames(\n theme && theme !== 'coorpmanager' ? themeStyle[theme] : behaviorClassName,\n selected ? style.selected : style.unselected,\n className\n ),\n [behaviorClassName, className, selected, theme]\n );\n\n const labelSize = useMemo(() => size(selectedLabel), [selectedLabel]);\n\n const isLongLabel = useMemo(() => labelSize >= 65, [labelSize]);\n\n return (\n <div\n className={classnames(\n composedClassName,\n theme === 'coorpmanager' ? style.coorpmanager : null\n )}\n >\n <label\n data-name=\"select-wrapper\"\n style={{\n ...(shouldUseSkinFontColor && {\n color\n })\n }}\n className={style.selectWrapper}\n >\n {titleView}\n <span\n data-name=\"select-span\"\n className={classnames(\n style.selectSpan,\n includes(theme, ['player', 'invalid', 'question', 'thematiques', 'template'])\n ? style.noLabelCommon\n : null,\n borderClassName,\n isLongLabel ? style.longLabel : null\n )}\n style={{\n ...(shouldUseSkinFontColor && {\n color\n })\n }}\n >\n {selectedLabel}\n </span>\n <ArrowView\n shouldRender={!multiple}\n isArrowUp={isArrowUp}\n ariaLabel={ariaLabel}\n arrowClass={shouldUseSkinFontColor ? style.selectedArrow : style.arrow}\n arrowColor={isThemeOneOfQuestionTemplateOrPlayer ? arrowColor : black}\n />\n <select\n {...(ariaLabelledBy ? {'aria-labelledby': ariaLabelledBy} : {})}\n {...(ariaLabel && !ariaLabelledBy ? {'aria-label': ariaLabel} : {})}\n {...(ariaLabel ? {title: ariaLabel} : {})}\n data-name=\"native-select\"\n className={style.selectBox}\n name={name}\n onChange={handleChange}\n value={selected}\n multiple={multiple}\n disabled={disabled}\n onClick={handleSelectOnFocus}\n onBlur={handleSelectOnBlur}\n // onBlur does not handle completely an out of bounds click\n // ex: select is Opened and a click is done outside, cancelling the select\n // that doesn't count as a Blur, so an onMouseLeave is needed\n onMouseLeave={handleSelectOnBlur}\n data-testid=\"native-select\"\n >\n {optionList}\n </select>\n </label>\n <div className={style.description}>{description}</div>\n </div>\n );\n};\n\nexport const SelectOptionPropTypes = {\n name: PropTypes.string.isRequired,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n selected: PropTypes.bool,\n validOption: PropTypes.bool\n};\n\nexport const SelectOptionGroupPropTypes = {\n label: PropTypes.string.isRequired,\n options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes))\n};\n\nSelect.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nSelect.propTypes = {\n title: PropTypes.string,\n name: PropTypes.string,\n className: PropTypes.string,\n borderClassName: PropTypes.string,\n disabled: PropTypes.bool,\n multiple: PropTypes.bool,\n description: PropTypes.string,\n required: PropTypes.bool,\n onChange: PropTypes.func,\n theme: PropTypes.oneOf(keys(themeStyle)),\n options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes)),\n optgroups: PropTypes.arrayOf(PropTypes.shape(SelectOptionGroupPropTypes)),\n modified: PropTypes.bool,\n error: PropTypes.bool,\n 'aria-label': PropTypes.string,\n 'aria-labelledby': PropTypes.string\n};\n\nexport default Select;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,UAAU,GAAG;EACjBC,MAAM,EAAEC,cAAA,CAAMD,MADG;EAEjBE,OAAO,EAAED,cAAA,CAAMC,OAFE;EAGjBC,MAAM,EAAEF,cAAA,CAAME,MAHG;EAIjBC,IAAI,EAAEH,cAAA,CAAMG,IAJK;EAKjBC,QAAQ,EAAEJ,cAAA,CAAMI,QALC;EAMjBC,IAAI,EAAEL,cAAA,CAAMK,IANK;EAOjBC,WAAW,EAAEN,cAAA,CAAMM,WAPF;EAQjBC,MAAM,EAAEP,cAAA,CAAMO,MARG;EASjBC,QAAQ,EAAER,cAAA,CAAMQ,QATC;EAUjBC,YAAY,EAAE;AAVG,CAAnB;;AAaA,MAAMC,SAAS,GAAG,CAAC;EAACC,YAAD;EAAeC,SAAf;EAA0BC,SAA1B;EAAqCC,UAArC;EAAiDC;AAAjD,CAAD,KAAkE;EAClF,MAAMC,KAAK,GAAG,IAAAC,cAAA,EACZ,mBACMF,UAAU,GACZ;IACEG,KAAK,EAAEH;EADT,CAFJ;IAKEI,SAAS,EAAEL;EALb,EADY,EAQZ,CAACD,SAAD,EAAYC,UAAZ,EAAwBC,UAAxB,CARY,CAAd;;EAUA,IAAIJ,YAAJ,EAAkB;IAChB,OAAOC,SAAS,gBACd,6BAAC,4CAAD,eAAaI,KAAb;MAAoB,eAAY;IAAhC,GADc,gBAGd,6BAAC,6CAAD,eAAeA,KAAf;MAAsB,eAAY;IAAlC,GAHF;EAKD,CAND,MAMO,OAAO,IAAP;A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BpE,QAAQ,EAAE+D,kBAAA,CAAUK,IANH;EAOjBjE,WAAW,EAAE4D,kBAAA,CAAUC,MAPN;EAQjB9D,QAAQ,EAAE6D,kBAAA,CAAUK,IARH;EASjBrE,QAAQ,EAAEgE,kBAAA,CAAUa,IATH;EAUjBxE,KAAK,EAAE2D,kBAAA,CAAUc,KAAV,CAAgB,IAAAC,aAAA,EAAK3G,UAAL,CAAhB,CAVU;EAWjByB,OAAO,EAAEmE,kBAAA,CAAUO,OAAV,CAAkBP,kBAAA,CAAUQ,KAAV,CAAgBT,qBAAhB,CAAlB,CAXQ;EAYjBjE,SAAS,EAAEkE,kBAAA,CAAUO,OAAV,CAAkBP,kBAAA,CAAUQ,KAAV,CAAgBF,0BAAhB,CAAlB,CAZM;EAajBhE,QAAQ,EAAE0D,kBAAA,CAAUK,IAbH;EAcjB9D,KAAK,EAAEyD,kBAAA,CAAUK,IAdA;EAejB,cAAcL,kBAAA,CAAUC,MAfP;EAgBjB,mBAAmBD,kBAAA,CAAUC;AAhBZ,CAAnB;eAmBevE,M"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
declare const
|
|
4
|
-
(props:
|
|
2
|
+
import { StatusItemProps } from './types';
|
|
3
|
+
declare const StatusItem: {
|
|
4
|
+
(props: StatusItemProps): JSX.Element;
|
|
5
5
|
propTypes: {
|
|
6
6
|
current: import("prop-types").Requireable<boolean>;
|
|
7
7
|
icon: import("prop-types").Requireable<string>;
|
|
8
8
|
value: import("prop-types").Requireable<string>;
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
|
-
export default
|
|
11
|
+
export default StatusItem;
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/status-item/index.tsx"],"names":[],"mappings":";AASA,OAAkB,EAAC,eAAe,EAAC,MAAM,SAAS,CAAC;AAqFnD,QAAA,MAAM,UAAU;YAAW,eAAe;;;;;;CAkBzC,CAAC;AAWF,eAAe,UAAU,CAAC"}
|
|
@@ -21,6 +21,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
21
21
|
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
23
|
|
|
24
|
+
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); }
|
|
25
|
+
|
|
24
26
|
const Content = (props, legacyContext) => {
|
|
25
27
|
const {
|
|
26
28
|
icon,
|
|
@@ -29,33 +31,59 @@ const Content = (props, legacyContext) => {
|
|
|
29
31
|
} = props;
|
|
30
32
|
const translate = (0, _provider.GetTranslateFromContext)(legacyContext);
|
|
31
33
|
let child;
|
|
32
|
-
let
|
|
34
|
+
let contentAriaLabel;
|
|
33
35
|
|
|
34
36
|
switch (icon) {
|
|
35
37
|
case 'no-answer':
|
|
36
38
|
child = value;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}) : translate('review_header_step_item.not_answered_question', {
|
|
39
|
+
contentAriaLabel = translate('review_header_step_item.not_answered_question', {
|
|
40
|
+
current: current ? 'current ' : '',
|
|
40
41
|
headerStepValue: value
|
|
41
42
|
});
|
|
42
43
|
break;
|
|
43
44
|
|
|
44
45
|
case 'right':
|
|
45
46
|
child = /*#__PURE__*/_react.default.createElement(_novaIcons.NovaCompositionCoorpacademyCheck, {
|
|
46
|
-
className: (0, _classnames.default)(_style.default.rightIcon, current && _style.default.currentRightIcon)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
className: (0, _classnames.default)(_style.default.rightIcon, current && _style.default.currentRightIcon),
|
|
48
|
+
role: "status",
|
|
49
|
+
"aria-label": translate('review_header_step_item.correct_question', {
|
|
50
|
+
current: current ? 'current ' : '',
|
|
51
|
+
headerStepValue: value
|
|
52
|
+
})
|
|
50
53
|
});
|
|
51
54
|
break;
|
|
52
55
|
|
|
53
56
|
case 'wrong':
|
|
54
57
|
child = /*#__PURE__*/_react.default.createElement(_novaIcons.NovaSolidStatusClose, {
|
|
55
|
-
className: (0, _classnames.default)(_style.default.wrongIcon, current && _style.default.currentWrongIcon)
|
|
58
|
+
className: (0, _classnames.default)(_style.default.wrongIcon, current && _style.default.currentWrongIcon),
|
|
59
|
+
role: "alert",
|
|
60
|
+
"aria-label": translate('review_header_step_item.incorrect_question', {
|
|
61
|
+
current: current ? 'current ' : '',
|
|
62
|
+
headerStepValue: value
|
|
63
|
+
})
|
|
56
64
|
});
|
|
57
|
-
|
|
58
|
-
|
|
65
|
+
break;
|
|
66
|
+
|
|
67
|
+
case 'errors-number':
|
|
68
|
+
child = value;
|
|
69
|
+
contentAriaLabel = translate('bulk_import.errors_number', {
|
|
70
|
+
bulkImportErrorsNumber: value
|
|
71
|
+
});
|
|
72
|
+
break;
|
|
73
|
+
|
|
74
|
+
case 'valid':
|
|
75
|
+
child = /*#__PURE__*/_react.default.createElement(_novaIcons.NovaCompositionCoorpacademyCheck, {
|
|
76
|
+
className: (0, _classnames.default)(_style.default.validIcon),
|
|
77
|
+
role: "status",
|
|
78
|
+
"aria-label": translate('bulk_import.valid_scorm')
|
|
79
|
+
});
|
|
80
|
+
break;
|
|
81
|
+
|
|
82
|
+
case 'invalid':
|
|
83
|
+
child = /*#__PURE__*/_react.default.createElement(_novaIcons.NovaSolidStatusClose, {
|
|
84
|
+
className: (0, _classnames.default)(_style.default.invalidIcon),
|
|
85
|
+
role: "alert",
|
|
86
|
+
"aria-label": translate('bulk_import.invalid_scorm')
|
|
59
87
|
});
|
|
60
88
|
break;
|
|
61
89
|
|
|
@@ -63,23 +91,22 @@ const Content = (props, legacyContext) => {
|
|
|
63
91
|
return null;
|
|
64
92
|
}
|
|
65
93
|
|
|
66
|
-
return /*#__PURE__*/_react.default.createElement("span", {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}, child);
|
|
94
|
+
return /*#__PURE__*/_react.default.createElement("span", _extends({}, icon === 'no-answer' || icon === 'errors-number' ? {
|
|
95
|
+
'aria-label': contentAriaLabel,
|
|
96
|
+
role: 'status'
|
|
97
|
+
} : {}, {
|
|
98
|
+
className: _style.default.value
|
|
99
|
+
}), child);
|
|
73
100
|
};
|
|
74
101
|
|
|
75
|
-
const
|
|
102
|
+
const StatusItem = props => {
|
|
76
103
|
const {
|
|
77
104
|
icon,
|
|
78
105
|
current
|
|
79
106
|
} = props;
|
|
80
107
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
81
|
-
className: (0, _classnames.default)(_style.default.default, icon === 'right' && _style.default.right, icon === 'wrong' && _style.default.wrong, current && _style.default.current),
|
|
82
|
-
"data-name": "
|
|
108
|
+
className: (0, _classnames.default)(_style.default.default, icon === 'right' && _style.default.right, icon === 'wrong' && _style.default.wrong, current && _style.default.current, icon === 'valid' && _style.default.valid, icon === 'invalid' && _style.default.invalid, icon === 'errors-number' && _style.default.errorsNumber),
|
|
109
|
+
"data-name": "status-item"
|
|
83
110
|
}, /*#__PURE__*/_react.default.createElement(Content, props));
|
|
84
111
|
};
|
|
85
112
|
|
|
@@ -88,7 +115,7 @@ Content.contextTypes = {
|
|
|
88
115
|
skin: _provider.default.childContextTypes.skin,
|
|
89
116
|
translate: _provider.default.childContextTypes.translate
|
|
90
117
|
};
|
|
91
|
-
|
|
92
|
-
var _default =
|
|
118
|
+
StatusItem.propTypes = process.env.NODE_ENV !== "production" ? _types.default : {};
|
|
119
|
+
var _default = StatusItem;
|
|
93
120
|
exports.default = _default;
|
|
94
121
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["Content","props","legacyContext","icon","current","value","translate","GetTranslateFromContext","child","contentAriaLabel","headerStepValue","classnames","style","rightIcon","currentRightIcon","wrongIcon","currentWrongIcon","bulkImportErrorsNumber","validIcon","invalidIcon","role","StatusItem","default","right","wrong","valid","invalid","errorsNumber","propTypes","contextTypes","skin","Provider","childContextTypes"],"sources":["../../../src/atom/status-item/index.tsx"],"sourcesContent":["import React from 'react';\nimport classnames from 'classnames';\nimport {\n NovaCompositionCoorpacademyCheck as RightIcon,\n NovaSolidStatusClose as WrongIcon\n} from '@coorpacademy/nova-icons';\nimport Provider, {GetTranslateFromContext} from '../provider';\nimport {WebContextValues} from '../provider/web-context';\nimport style from './style.css';\nimport propTypes, {StatusItemProps} from './types';\n\nconst Content = (props: StatusItemProps, legacyContext: WebContextValues) => {\n const {icon, current, value} = props;\n const translate = GetTranslateFromContext(legacyContext);\n let child;\n let contentAriaLabel;\n switch (icon) {\n case 'no-answer':\n child = value;\n contentAriaLabel = translate('review_header_step_item.not_answered_question', {\n current: current ? 'current ' : '',\n headerStepValue: value\n });\n break;\n\n case 'right':\n child = (\n <RightIcon\n className={classnames(style.rightIcon, current && style.currentRightIcon)}\n role=\"status\"\n aria-label={translate('review_header_step_item.correct_question', {\n current: current ? 'current ' : '',\n headerStepValue: value\n })}\n />\n );\n break;\n\n case 'wrong':\n child = (\n <WrongIcon\n className={classnames(style.wrongIcon, current && style.currentWrongIcon)}\n role=\"alert\"\n aria-label={translate('review_header_step_item.incorrect_question', {\n current: current ? 'current ' : '',\n headerStepValue: value\n })}\n />\n );\n break;\n\n case 'errors-number':\n child = value;\n contentAriaLabel = translate('bulk_import.errors_number', {\n bulkImportErrorsNumber: value\n });\n break;\n\n case 'valid':\n child = (\n <RightIcon\n className={classnames(style.validIcon)}\n role=\"status\"\n aria-label={translate('bulk_import.valid_scorm')}\n />\n );\n break;\n\n case 'invalid':\n child = (\n <WrongIcon\n className={classnames(style.invalidIcon)}\n role=\"alert\"\n aria-label={translate('bulk_import.invalid_scorm')}\n />\n );\n break;\n\n default:\n return null;\n }\n\n return (\n <span\n {...(icon === 'no-answer' || icon === 'errors-number'\n ? {'aria-label': contentAriaLabel, role: 'status'}\n : {})}\n className={style.value}\n >\n {child}\n </span>\n );\n};\n\nconst StatusItem = (props: StatusItemProps) => {\n const {icon, current} = props;\n return (\n <div\n className={classnames(\n style.default,\n icon === 'right' && style.right,\n icon === 'wrong' && style.wrong,\n current && style.current,\n icon === 'valid' && style.valid,\n icon === 'invalid' && style.invalid,\n icon === 'errors-number' && style.errorsNumber\n )}\n data-name=\"status-item\"\n >\n <Content {...props} />\n </div>\n );\n};\n\nContent.propTypes = propTypes;\n\nContent.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nStatusItem.propTypes = propTypes;\n\nexport default StatusItem;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AAIA;;AAEA;;AACA;;;;;;;;;;AAEA,MAAMA,OAAO,GAAG,CAACC,KAAD,EAAyBC,aAAzB,KAA6D;EAC3E,MAAM;IAACC,IAAD;IAAOC,OAAP;IAAgBC;EAAhB,IAAyBJ,KAA/B;EACA,MAAMK,SAAS,GAAG,IAAAC,iCAAA,EAAwBL,aAAxB,CAAlB;EACA,IAAIM,KAAJ;EACA,IAAIC,gBAAJ;;EACA,QAAQN,IAAR;IACE,KAAK,WAAL;MACEK,KAAK,GAAGH,KAAR;MACAI,gBAAgB,GAAGH,SAAS,CAAC,+CAAD,EAAkD;QAC5EF,OAAO,EAAEA,OAAO,GAAG,UAAH,GAAgB,EAD4C;QAE5EM,eAAe,EAAEL;MAF2D,CAAlD,CAA5B;MAIA;;IAEF,KAAK,OAAL;MACEG,KAAK,gBACH,6BAAC,2CAAD;QACE,SAAS,EAAE,IAAAG,mBAAA,EAAWC,cAAA,CAAMC,SAAjB,EAA4BT,OAAO,IAAIQ,cAAA,CAAME,gBAA7C,CADb;QAEE,IAAI,EAAC,QAFP;QAGE,cAAYR,SAAS,CAAC,0CAAD,EAA6C;UAChEF,OAAO,EAAEA,OAAO,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IAAD;IAAOC;EAAP,IAAkBH,KAAxB;EACA,oBACE;IACE,SAAS,EAAE,IAAAU,mBAAA,EACTC,cAAA,CAAMU,OADG,EAETnB,IAAI,KAAK,OAAT,IAAoBS,cAAA,CAAMW,KAFjB,EAGTpB,IAAI,KAAK,OAAT,IAAoBS,cAAA,CAAMY,KAHjB,EAITpB,OAAO,IAAIQ,cAAA,CAAMR,OAJR,EAKTD,IAAI,KAAK,OAAT,IAAoBS,cAAA,CAAMa,KALjB,EAMTtB,IAAI,KAAK,SAAT,IAAsBS,cAAA,CAAMc,OANnB,EAOTvB,IAAI,KAAK,eAAT,IAA4BS,cAAA,CAAMe,YAPzB,CADb;IAUE,aAAU;EAVZ,gBAYE,6BAAC,OAAD,EAAa1B,KAAb,CAZF,CADF;AAgBD,CAlBD;;AAoBAD,OAAO,CAAC4B,SAAR,2CAAoBA,cAApB;AAEA5B,OAAO,CAAC6B,YAAR,GAAuB;EACrBC,IAAI,EAAEC,iBAAA,CAASC,iBAAT,CAA2BF,IADZ;EAErBxB,SAAS,EAAEyB,iBAAA,CAASC,iBAAT,CAA2B1B;AAFjB,CAAvB;AAKAe,UAAU,CAACO,SAAX,2CAAuBA,cAAvB;eAEeP,U"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../src/atom/status-item/index.native.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAC,eAAe,EAAC,MAAM,SAAS,CAAC;AA6CxC,QAAA,MAAM,IAAI,6BAA4B,eAAe,uBA2BpD,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -15,7 +15,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
17
|
|
|
18
|
-
const createStyle = (
|
|
18
|
+
const createStyle = (icon, current) => {
|
|
19
19
|
let backgroundColor;
|
|
20
20
|
|
|
21
21
|
switch (icon) {
|
|
@@ -61,7 +61,7 @@ const Step = ({
|
|
|
61
61
|
}) => {
|
|
62
62
|
const [style, setStyle] = (0, _react.useState)(null);
|
|
63
63
|
(0, _react.useEffect)(() => {
|
|
64
|
-
const _style = createStyle(
|
|
64
|
+
const _style = createStyle(icon, current);
|
|
65
65
|
|
|
66
66
|
setStyle(_style);
|
|
67
67
|
}, [current, icon]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.native.js","names":["createStyle","icon","current","backgroundColor","COLORS","positive","negative","gray","StyleSheet","create","step","width","height","opacity","marginHorizontal","alignItems","justifyContent","borderRadius","stepText","fontWeight","fontSize","Step","value","style","setStyle","useState","useEffect","_style","child"],"sources":["../../../src/atom/status-item/index.native.tsx"],"sourcesContent":["import React, {useEffect, useState} from 'react';\nimport {StyleSheet, Text, TextStyle, View, ViewStyle} from 'react-native';\nimport {\n NovaCompositionCoorpacademyCheck as RightIcon,\n NovaSolidStatusClose as WrongIcon\n} from '@coorpacademy/nova-icons';\nimport {COLORS} from '../../variables/colors';\nimport {StatusItemProps} from './types';\n\ntype StyleSheetType = {\n step: ViewStyle;\n stepText: TextStyle;\n icon: ViewStyle;\n};\n\nconst createStyle = (icon: StatusItemProps['icon'], current?: boolean): StyleSheetType => {\n let backgroundColor;\n\n switch (icon) {\n case 'right':\n backgroundColor = COLORS.positive;\n break;\n case 'wrong':\n backgroundColor = COLORS.negative;\n break;\n case 'no-answer':\n default:\n backgroundColor = COLORS.gray;\n }\n\n return StyleSheet.create({\n step: {\n width: current ? 40 : 32,\n height: current ? 40 : 32,\n opacity: current ? 1 : 0.5,\n marginHorizontal: 8,\n backgroundColor,\n alignItems: 'center',\n justifyContent: 'center',\n borderRadius: 50\n },\n stepText: {\n fontWeight: '600',\n fontSize: current ? 16 : 12\n },\n icon: {\n width: current ? 14 : 12,\n height: current ? 14 : 12\n }\n });\n};\n\nconst Step = ({value, icon, current}: StatusItemProps) => {\n const [style, setStyle] = useState<StyleSheetType | null>(null);\n\n useEffect(() => {\n const _style = createStyle(icon, current);\n setStyle(_style);\n }, [current, icon]);\n\n if (!style) {\n return null;\n }\n\n let child;\n\n switch (icon) {\n case 'right':\n child = <RightIcon style={style.icon} color=\"#fff\" />;\n break;\n case 'wrong':\n child = <WrongIcon style={style.icon} color=\"#fff\" />;\n break;\n case 'no-answer':\n default:\n child = <Text style={style.stepText}>{value}</Text>;\n }\n\n return <View style={style.step}>{child}</View>;\n};\n\nexport default Step;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AAIA;;;;;;AASA,MAAMA,WAAW,GAAG,CAACC,IAAD,EAAgCC,OAAhC,KAAsE;EACxF,IAAIC,eAAJ;;EAEA,QAAQF,IAAR;IACE,KAAK,OAAL;MACEE,eAAe,GAAGC,cAAA,CAAOC,QAAzB;MACA;;IACF,KAAK,OAAL;MACEF,eAAe,GAAGC,cAAA,CAAOE,QAAzB;MACA;;IACF,KAAK,WAAL;IACA;MACEH,eAAe,GAAGC,cAAA,CAAOG,IAAzB;EATJ;;EAYA,OAAOC,uBAAA,CAAWC,MAAX,CAAkB;IACvBC,IAAI,EAAE;MACJC,KAAK,EAAET,OAAO,GAAG,EAAH,GAAQ,EADlB;MAEJU,MAAM,EAAEV,OAAO,GAAG,EAAH,GAAQ,EAFnB;MAGJW,OAAO,EAAEX,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;EATJ;;EAYA,oBAAO,6BAAC,iBAAD;IAAM,KAAK,EAAEC,KAAK,CAACb;EAAnB,GAA0BkB,KAA1B,CAAP;AACD,CA3BD;;eA6BeP,I"}
|
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
@value cm_positive_100 from colors;
|
|
4
4
|
@value cm_negative_100 from colors;
|
|
5
5
|
@value white from colors;
|
|
6
|
+
@value positive from colors;
|
|
7
|
+
@value negative from colors;
|
|
8
|
+
@value cm_negative_50 from colors;
|
|
9
|
+
@value cm_green_secondary_200 from colors;
|
|
10
|
+
@value cm_green_secondary_100 from colors;
|
|
11
|
+
@value cm_pink_50 from colors;
|
|
6
12
|
|
|
7
13
|
.default {
|
|
8
14
|
width: 32px;
|
|
@@ -62,4 +68,45 @@
|
|
|
62
68
|
transform: scale(1.5);
|
|
63
69
|
}
|
|
64
70
|
|
|
71
|
+
/* ----------------- CM bulk theme ------------------------- */
|
|
65
72
|
|
|
73
|
+
|
|
74
|
+
.valid {
|
|
75
|
+
opacity: 1;
|
|
76
|
+
width: 24px;
|
|
77
|
+
height: 24px;
|
|
78
|
+
background-color: cm_green_secondary_100;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.validIcon {
|
|
82
|
+
color: cm_green_secondary_200;
|
|
83
|
+
width: 12px;
|
|
84
|
+
height: 10px;
|
|
85
|
+
transition: transform 0.25s ease;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.invalid {
|
|
89
|
+
opacity: 1;
|
|
90
|
+
width: 24px;
|
|
91
|
+
height: 24px;
|
|
92
|
+
background-color: cm_negative_50;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.invalidIcon {
|
|
96
|
+
color: cm_negative_100;
|
|
97
|
+
width: 10px;
|
|
98
|
+
height: 10px;
|
|
99
|
+
transition: color 0.25s ease;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.errorsNumber {
|
|
103
|
+
opacity: 1;
|
|
104
|
+
width: 24px;
|
|
105
|
+
height: 24px;
|
|
106
|
+
background-color: cm_pink_50;
|
|
107
|
+
color: cm_negative_100;
|
|
108
|
+
font-family: 'Gilroy';
|
|
109
|
+
font-style: normal;
|
|
110
|
+
font-weight: 600;
|
|
111
|
+
font-size: 14px;
|
|
112
|
+
}
|
|
@@ -5,12 +5,12 @@ declare const propTypes: {
|
|
|
5
5
|
value: PropTypes.Requireable<string>;
|
|
6
6
|
};
|
|
7
7
|
export default propTypes;
|
|
8
|
-
export declare type
|
|
9
|
-
current
|
|
10
|
-
icon: 'no-answer' | 'right' | 'wrong';
|
|
11
|
-
value
|
|
8
|
+
export declare type StatusItemProps = {
|
|
9
|
+
current?: boolean;
|
|
10
|
+
icon: 'no-answer' | 'right' | 'wrong' | 'valid' | 'invalid' | 'errors-number';
|
|
11
|
+
value?: string;
|
|
12
12
|
};
|
|
13
13
|
export declare type Fixture = {
|
|
14
|
-
props:
|
|
14
|
+
props: StatusItemProps;
|
|
15
15
|
};
|
|
16
16
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/atom/status-item/types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,QAAA,MAAM,SAAS;;;;CAId,CAAC;AAEF,eAAe,SAAS,CAAC;AAEzB,oBAAY,eAAe,GAAG;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,WAAW,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,eAAe,CAAC;IAC9E,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,oBAAY,OAAO,GAAG;IACpB,KAAK,EAAE,eAAe,CAAC;CACxB,CAAC"}
|
|
@@ -9,7 +9,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
9
9
|
|
|
10
10
|
const propTypes = {
|
|
11
11
|
current: _propTypes.default.bool,
|
|
12
|
-
icon: _propTypes.default.oneOf(['no-answer', 'right', 'wrong']),
|
|
12
|
+
icon: _propTypes.default.oneOf(['no-answer', 'right', 'wrong', 'valid', 'invalid', 'errors-number']),
|
|
13
13
|
value: _propTypes.default.string
|
|
14
14
|
};
|
|
15
15
|
var _default = propTypes;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":["propTypes","current","PropTypes","bool","icon","oneOf","value","string"],"sources":["../../../src/atom/status-item/types.ts"],"sourcesContent":["import PropTypes from 'prop-types';\n\nconst propTypes = {\n current: PropTypes.bool,\n icon: PropTypes.oneOf(['no-answer', 'right', 'wrong', 'valid', 'invalid', 'errors-number']),\n value: PropTypes.string\n};\n\nexport default propTypes;\n\nexport type StatusItemProps = {\n current?: boolean;\n icon: 'no-answer' | 'right' | 'wrong' | 'valid' | 'invalid' | 'errors-number';\n value?: string;\n};\n\nexport type Fixture = {\n props: StatusItemProps;\n};\n"],"mappings":";;;;;AAAA;;;;AAEA,MAAMA,SAAS,GAAG;EAChBC,OAAO,EAAEC,kBAAA,CAAUC,IADH;EAEhBC,IAAI,EAAEF,kBAAA,CAAUG,KAAV,CAAgB,CAAC,WAAD,EAAc,OAAd,EAAuB,OAAvB,EAAgC,OAAhC,EAAyC,SAAzC,EAAoD,eAApD,CAAhB,CAFU;EAGhBC,KAAK,EAAEJ,kBAAA,CAAUK;AAHD,CAAlB;eAMeP,S"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export function toggleStateOnKeyPress(state: any, setState: any, ref: any): (event: any) => void;
|
|
2
2
|
export default ToolTip;
|
|
3
|
-
declare function ToolTip({ anchorId, TooltipContent, "aria-label": ariaLabel, "data-testid": dataTestId, closeToolTipInformationTextAriaLabel, toolTipIsVisible: _toolTipIsVisible, iconContainerClassName, delayHide, fontSize
|
|
3
|
+
declare function ToolTip({ anchorId, TooltipContent, "aria-label": ariaLabel, "data-testid": dataTestId, closeToolTipInformationTextAriaLabel, toolTipIsVisible: _toolTipIsVisible, iconContainerClassName, delayHide, fontSize }: {
|
|
4
4
|
anchorId: any;
|
|
5
5
|
TooltipContent: any;
|
|
6
6
|
"aria-label": any;
|
|
@@ -10,7 +10,6 @@ declare function ToolTip({ anchorId, TooltipContent, "aria-label": ariaLabel, "d
|
|
|
10
10
|
iconContainerClassName: any;
|
|
11
11
|
delayHide?: number | undefined;
|
|
12
12
|
fontSize?: number | undefined;
|
|
13
|
-
iconSize?: string | undefined;
|
|
14
13
|
}): JSX.Element;
|
|
15
14
|
declare namespace ToolTip {
|
|
16
15
|
const propTypes: {
|
|
@@ -21,7 +20,6 @@ declare namespace ToolTip {
|
|
|
21
20
|
iconContainerClassName: PropTypes.Requireable<string>;
|
|
22
21
|
delayHide: PropTypes.Requireable<number>;
|
|
23
22
|
fontSize: PropTypes.Requireable<number>;
|
|
24
|
-
iconSize: PropTypes.Requireable<string>;
|
|
25
23
|
anchorId: PropTypes.Requireable<string>;
|
|
26
24
|
toolTipIsVisible: PropTypes.Requireable<boolean>;
|
|
27
25
|
};
|
|
@@ -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":"AAwDO,iGASN;;AAED;;;;;;;;;;gBAwFC"}
|
|
@@ -13,8 +13,6 @@ var _reactTooltip = _interopRequireDefault(require("react-tooltip"));
|
|
|
13
13
|
|
|
14
14
|
var _isString = _interopRequireDefault(require("lodash/fp/isString"));
|
|
15
15
|
|
|
16
|
-
var _keys = _interopRequireDefault(require("lodash/fp/keys"));
|
|
17
|
-
|
|
18
16
|
var _novaIcons = require("@coorpacademy/nova-icons");
|
|
19
17
|
|
|
20
18
|
var _style = _interopRequireDefault(require("./style.css"));
|
|
@@ -29,18 +27,13 @@ const FontSizes = {
|
|
|
29
27
|
12: _style.default.tooltipContentFontSize12,
|
|
30
28
|
14: _style.default.tooltipContentFontSize14
|
|
31
29
|
};
|
|
32
|
-
const IconSizes = {
|
|
33
|
-
small: 12,
|
|
34
|
-
big: 20
|
|
35
|
-
};
|
|
36
30
|
|
|
37
31
|
const ToolTipWrapper = ({
|
|
38
32
|
toolTipIsVisible,
|
|
39
33
|
anchorId,
|
|
40
34
|
closeToolTipInformationTextAriaLabel,
|
|
41
35
|
content,
|
|
42
|
-
handleContentMouseOver
|
|
43
|
-
iconSize
|
|
36
|
+
handleContentMouseOver
|
|
44
37
|
}) => {
|
|
45
38
|
if (!toolTipIsVisible) return null;
|
|
46
39
|
|
|
@@ -55,7 +48,7 @@ const ToolTipWrapper = ({
|
|
|
55
48
|
}, content);
|
|
56
49
|
} else {
|
|
57
50
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
58
|
-
className:
|
|
51
|
+
className: _style.default.toolTip,
|
|
59
52
|
"data-testid": "tooltip",
|
|
60
53
|
"aria-label": closeToolTipInformationTextAriaLabel,
|
|
61
54
|
onMouseOver: handleContentMouseOver
|
|
@@ -68,8 +61,7 @@ ToolTipWrapper.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
68
61
|
anchorId: _propTypes.default.string,
|
|
69
62
|
closeToolTipInformationTextAriaLabel: _propTypes.default.string.isRequired,
|
|
70
63
|
content: _propTypes.default.node,
|
|
71
|
-
handleContentMouseOver: _propTypes.default.func
|
|
72
|
-
iconSize: _propTypes.default.oneOf((0, _keys.default)(IconSizes))
|
|
64
|
+
handleContentMouseOver: _propTypes.default.func
|
|
73
65
|
} : {};
|
|
74
66
|
|
|
75
67
|
const toggleStateOnKeyPress = (state, setState, ref) => event => {
|
|
@@ -94,8 +86,7 @@ const ToolTip = ({
|
|
|
94
86
|
toolTipIsVisible: _toolTipIsVisible,
|
|
95
87
|
iconContainerClassName,
|
|
96
88
|
delayHide = 250,
|
|
97
|
-
fontSize = 14
|
|
98
|
-
iconSize = 'small'
|
|
89
|
+
fontSize = 14
|
|
99
90
|
}) => {
|
|
100
91
|
const isComponent = (0, _react.useMemo)(() => !(0, _isString.default)(TooltipContent) && /*#__PURE__*/(0, _react.isValidElement)(TooltipContent()), [TooltipContent]);
|
|
101
92
|
const [toolTipIsVisible, setToolTipIsVisible] = (0, _react.useState)(false);
|
|
@@ -140,8 +131,8 @@ const ToolTip = ({
|
|
|
140
131
|
tabIndex: 0
|
|
141
132
|
}, /*#__PURE__*/_react.default.createElement(_novaIcons.NovaCompositionCoorpacademyInformationIcon, {
|
|
142
133
|
className: _style.default.informationIcon,
|
|
143
|
-
width:
|
|
144
|
-
height:
|
|
134
|
+
width: 12,
|
|
135
|
+
height: 12,
|
|
145
136
|
"aria-label": ariaLabel
|
|
146
137
|
})), /*#__PURE__*/_react.default.createElement(ToolTipWrapper, {
|
|
147
138
|
toolTipIsVisible: toolTipIsVisible,
|
|
@@ -149,8 +140,7 @@ const ToolTip = ({
|
|
|
149
140
|
closeToolTipInformationTextAriaLabel: closeToolTipInformationTextAriaLabel,
|
|
150
141
|
content: content,
|
|
151
142
|
handleContentMouseOver: handleContentMouseOver,
|
|
152
|
-
fontSize: fontSize
|
|
153
|
-
iconSize: iconSize
|
|
143
|
+
fontSize: fontSize
|
|
154
144
|
}));
|
|
155
145
|
};
|
|
156
146
|
|
|
@@ -163,7 +153,6 @@ ToolTip.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
163
153
|
iconContainerClassName: _propTypes.default.string,
|
|
164
154
|
delayHide: _propTypes.default.number,
|
|
165
155
|
fontSize: _propTypes.default.oneOf([12, 14]),
|
|
166
|
-
iconSize: _propTypes.default.oneOf((0, _keys.default)(IconSizes)),
|
|
167
156
|
// ---------- React Tooltip exclusive --------------
|
|
168
157
|
// externalHandling: if passed down, React Tooltip is used instead, due to limitations on
|
|
169
158
|
// parents overflow hidden controls
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["FontSizes","style","tooltipContentFontSize12","tooltipContentFontSize14","IconSizes","small","big","ToolTipWrapper","toolTipIsVisible","anchorId","closeToolTipInformationTextAriaLabel","content","handleContentMouseOver","iconSize","toolTipReact","classnames","toolTip","bigIconToolTip","smallIconToolTip","propTypes","PropTypes","bool","string","isRequired","node","func","oneOf","keys","toggleStateOnKeyPress","state","setState","ref","event","key","current","focus","stopPropagation","preventDefault","ToolTip","TooltipContent","ariaLabel","dataTestId","_toolTipIsVisible","iconContainerClassName","delayHide","fontSize","isComponent","useMemo","isString","isValidElement","setToolTipIsVisible","useState","mouseLeaveTimer","setMouseLeaveTimer","undefined","handleKeyPress","useCallback","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 anchorId: PropTypes.string,\n toolTipIsVisible: PropTypes.bool\n};\n\nexport default ToolTip;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAEA,MAAMA,SAAS,GAAG;EAChB,IAAIC,cAAA,CAAMC,wBADM;EAEhB,IAAID,cAAA,CAAME;AAFM,CAAlB;A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ipWrapper","toolTipIsVisible","anchorId","closeToolTipInformationTextAriaLabel","content","handleContentMouseOver","toolTipReact","toolTip","propTypes","PropTypes","bool","string","isRequired","node","func","toggleStateOnKeyPress","state","setState","ref","event","key","current","focus","stopPropagation","preventDefault","ToolTip","TooltipContent","ariaLabel","dataTestId","_toolTipIsVisible","iconContainerClassName","delayHide","fontSize","isComponent","useMemo","isString","isValidElement","setToolTipIsVisible","useState","mouseLeaveTimer","setMouseLeaveTimer","undefined","handleKeyPress","useCallback","clearTimeout","handleMouseOver","handleMouseLeave","setTimeout","classnames","tooltipContent","tooltipContainer","tooltipIconContainer","informationIcon","oneOfType","number","oneOf"],"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 {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 ToolTipWrapper = ({\n toolTipIsVisible,\n anchorId,\n closeToolTipInformationTextAriaLabel,\n content,\n handleContentMouseOver\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={style.toolTip}\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};\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}) => {\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={12}\n height={12}\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 />\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 // ---------- React Tooltip exclusive --------------\n // externalHandling: if passed down, React Tooltip is used instead, due to limitations on\n // parents overflow hidden controls\n anchorId: PropTypes.string,\n toolTipIsVisible: PropTypes.bool\n};\n\nexport default ToolTip;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAEA,MAAMA,SAAS,GAAG;EAChB,IAAIC,cAAA,CAAMC,wBADM;EAEhB,IAAID,cAAA,CAAME;AAFM,CAAlB;;AAKA,MAAMC,cAAc,GAAG,CAAC;EACtBC,gBADsB;EAEtBC,QAFsB;EAGtBC,oCAHsB;EAItBC,OAJsB;EAKtBC;AALsB,CAAD,KAMjB;EACJ,IAAI,CAACJ,gBAAL,EAAuB,OAAO,IAAP;;EACvB,IAAIC,QAAJ,EAAc;IACZ,oBACE,6BAAC,qBAAD;MACE,EAAE,EAAEA,QADN;MAEE,SAAS,EAAEL,cAAA,CAAMS,YAFnB;MAGE,kBAAe,OAHjB;M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R,oCAAoC,EAAEM,kBAAA,CAAUE,MAAV,CAAiBC,UAJrC;EAKlB;EACAkB,sBAAsB,EAAErB,kBAAA,CAAUE,MANhB;EAOlBoB,SAAS,EAAEtB,kBAAA,CAAU6C,MAPH;EAQlBtB,QAAQ,EAAEvB,kBAAA,CAAU8C,KAAV,CAAgB,CAAC,EAAD,EAAK,EAAL,CAAhB,CARQ;EASlB;EACA;EACA;EACArD,QAAQ,EAAEO,kBAAA,CAAUE,MAZF;EAalBV,gBAAgB,EAAEQ,kBAAA,CAAUC;AAbV,CAApB;eAgBee,O"}
|
|
@@ -34,18 +34,10 @@
|
|
|
34
34
|
position: absolute;
|
|
35
35
|
border-radius: 7px;
|
|
36
36
|
background-color: cm_grey_700;
|
|
37
|
-
height: auto;
|
|
38
|
-
width: 200px;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.bigIconToolTip {
|
|
42
|
-
right: -71px;
|
|
43
|
-
bottom: 31px;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.smallIconToolTip {
|
|
47
37
|
right: -75px;
|
|
48
38
|
bottom: 32px;
|
|
39
|
+
height: auto;
|
|
40
|
+
width: 200px;
|
|
49
41
|
}
|
|
50
42
|
|
|
51
43
|
.toolTip::before {
|
package/lib/globals.d.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globals.d.js","names":[],"sources":["../src/globals.d.ts"],"sourcesContent":["declare module '@coorpacademy/nova-icons';\ndeclare module '@coorpacademy/react-native-slider';\ndeclare module '@react-native-community/blur';\ndeclare module '@coorpacademy/translate';\ndeclare module '
|
|
1
|
+
{"version":3,"file":"globals.d.js","names":[],"sources":["../src/globals.d.ts"],"sourcesContent":["declare module '@coorpacademy/nova-icons';\ndeclare module '@coorpacademy/react-native-slider';\ndeclare module '@react-native-community/blur';\ndeclare module '@coorpacademy/translate';\ndeclare module 'react-native/*';\ndeclare module 'color';\ndeclare module 'classnames';\ndeclare module '*.css';\n"],"mappings":""}
|