@coorpacademy/components 11.39.4-alpha.5 → 11.39.4
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/button-link/index.d.ts.map +1 -1
- package/es/atom/button-link/index.js +8 -1
- package/es/atom/button-link/index.js.map +1 -1
- package/es/atom/button-menu/index.d.ts.map +1 -1
- package/es/atom/button-menu/index.js +2 -1
- package/es/atom/button-menu/index.js.map +1 -1
- package/es/atom/chip/index.d.ts.map +1 -1
- package/es/atom/chip/index.js +0 -3
- package/es/atom/chip/index.js.map +1 -1
- package/es/atom/input-text/index.d.ts +0 -1
- package/es/atom/input-text/index.d.ts.map +1 -1
- package/es/atom/input-text/index.js +1 -4
- package/es/atom/input-text/index.js.map +1 -1
- package/es/atom/input-text/style.css +1 -28
- package/es/atom/input-text-with-title/index.d.ts +0 -1
- package/es/atom/input-textarea/index.d.ts +0 -1
- package/es/atom/input-textarea/index.d.ts.map +1 -1
- package/es/atom/input-textarea/index.js +1 -6
- package/es/atom/input-textarea/index.js.map +1 -1
- package/es/atom/input-textarea/style.css +0 -37
- package/es/atom/select/index.d.ts +0 -1
- package/es/atom/select/index.d.ts.map +1 -1
- package/es/atom/select/index.js +11 -26
- package/es/atom/select/index.js.map +1 -1
- package/es/atom/select/style.css +0 -61
- package/es/atom/status-item/index.d.ts.map +1 -1
- package/es/atom/status-item/index.js +15 -15
- package/es/atom/status-item/index.js.map +1 -1
- package/es/molecule/base-modal/index.d.ts.map +1 -1
- package/es/molecule/base-modal/index.js +0 -14
- package/es/molecule/base-modal/index.js.map +1 -1
- package/es/molecule/bullet-point-menu-button/index.d.ts.map +1 -1
- package/es/molecule/bullet-point-menu-button/index.js +2 -42
- package/es/molecule/bullet-point-menu-button/index.js.map +1 -1
- package/es/molecule/card/favorite.d.ts.map +1 -1
- package/es/molecule/card/favorite.js +0 -13
- package/es/molecule/card/favorite.js.map +1 -1
- package/es/molecule/course-sections/index.d.ts +0 -1
- package/es/molecule/drag-and-drop/index.d.ts +0 -1
- package/es/molecule/drag-and-drop/upload-report.d.ts +0 -1
- package/es/molecule/filters/index.d.ts +0 -1
- package/es/molecule/filters/index.d.ts.map +1 -1
- package/es/molecule/skill-picker-modal/index.js +1 -1
- package/es/molecule/skill-picker-modal/index.js.map +1 -1
- package/es/molecule/title-and-checkbox-wrapper/index.d.ts +0 -1
- package/es/molecule/translation-modal/index.d.ts +0 -4
- package/es/molecule/translation-modal/index.d.ts.map +1 -1
- package/es/molecule/translation-modal/index.js +6 -11
- package/es/molecule/translation-modal/index.js.map +1 -1
- package/es/organism/content-translation/index.d.ts +0 -2
- package/es/organism/icon-editor/index.d.ts +0 -1
- package/es/organism/icon-editor/index.d.ts.map +1 -1
- package/es/organism/icon-editor/types.d.ts +0 -1
- package/es/organism/icon-editor/types.d.ts.map +1 -1
- package/es/organism/mooc-header/index.d.ts +2 -0
- package/es/organism/mooc-header/index.d.ts.map +1 -1
- package/es/organism/mooc-header/index.js +3 -0
- package/es/organism/mooc-header/index.js.map +1 -1
- package/es/organism/rewards-form/index.d.ts +0 -1
- package/es/organism/select-opponents/index.d.ts +0 -1
- package/es/organism/select-opponents/index.d.ts.map +1 -1
- package/es/organism/select-opponents/types.d.ts +0 -1
- package/es/organism/select-opponents/types.d.ts.map +1 -1
- package/es/organism/skill-edition/index.d.ts +0 -22
- package/es/organism/skill-edition/index.d.ts.map +1 -1
- package/es/organism/skill-edition/index.js +44 -69
- package/es/organism/skill-edition/index.js.map +1 -1
- package/es/organism/skill-edition/style.css +2 -1
- package/es/organism/skill-edition/types.d.ts +1 -27
- package/es/organism/skill-edition/types.d.ts.map +1 -1
- package/es/organism/skill-edition/types.js +5 -24
- package/es/organism/skill-edition/types.js.map +1 -1
- package/es/organism/title-and-input/index.d.ts +0 -5
- package/es/organism/title-and-input/index.d.ts.map +1 -1
- package/es/organism/title-and-input/types.d.ts +0 -5
- package/es/organism/title-and-input/types.d.ts.map +1 -1
- package/es/organism/wizard-contents/index.d.ts +0 -4
- package/es/template/back-office/brand-update/index.d.ts +0 -22
- package/es/template/back-office/brand-update/index.d.ts.map +1 -1
- package/es/template/back-office/brand-update/index.js +3 -6
- package/es/template/back-office/brand-update/index.js.map +1 -1
- package/es/template/certifications/index.d.ts +0 -1
- package/es/template/common/search-page/index.d.ts +0 -1
- package/es/template/playlist-detail/index.d.ts +0 -1
- package/es/template/skill-detail/style.css +1 -1
- package/es/util/render-with-context.d.ts.map +1 -1
- package/es/util/render-with-context.js +2 -3
- package/es/util/render-with-context.js.map +1 -1
- package/lib/atom/button-link/index.d.ts.map +1 -1
- package/lib/atom/button-link/index.js +8 -1
- package/lib/atom/button-link/index.js.map +1 -1
- package/lib/atom/button-menu/index.d.ts.map +1 -1
- package/lib/atom/button-menu/index.js +2 -1
- package/lib/atom/button-menu/index.js.map +1 -1
- package/lib/atom/chip/index.d.ts.map +1 -1
- package/lib/atom/chip/index.js +0 -3
- package/lib/atom/chip/index.js.map +1 -1
- package/lib/atom/input-text/index.d.ts +0 -1
- package/lib/atom/input-text/index.d.ts.map +1 -1
- package/lib/atom/input-text/index.js +1 -4
- package/lib/atom/input-text/index.js.map +1 -1
- package/lib/atom/input-text/style.css +1 -28
- package/lib/atom/input-text-with-title/index.d.ts +0 -1
- package/lib/atom/input-textarea/index.d.ts +0 -1
- package/lib/atom/input-textarea/index.d.ts.map +1 -1
- package/lib/atom/input-textarea/index.js +1 -6
- package/lib/atom/input-textarea/index.js.map +1 -1
- package/lib/atom/input-textarea/style.css +0 -37
- package/lib/atom/select/index.d.ts +0 -1
- package/lib/atom/select/index.d.ts.map +1 -1
- package/lib/atom/select/index.js +11 -26
- package/lib/atom/select/index.js.map +1 -1
- package/lib/atom/select/style.css +0 -61
- package/lib/atom/status-item/index.d.ts.map +1 -1
- package/lib/atom/status-item/index.js +17 -15
- package/lib/atom/status-item/index.js.map +1 -1
- package/lib/molecule/base-modal/index.d.ts.map +1 -1
- package/lib/molecule/base-modal/index.js +0 -14
- package/lib/molecule/base-modal/index.js.map +1 -1
- package/lib/molecule/bullet-point-menu-button/index.d.ts.map +1 -1
- package/lib/molecule/bullet-point-menu-button/index.js +2 -41
- package/lib/molecule/bullet-point-menu-button/index.js.map +1 -1
- package/lib/molecule/card/favorite.d.ts.map +1 -1
- package/lib/molecule/card/favorite.js +0 -13
- package/lib/molecule/card/favorite.js.map +1 -1
- package/lib/molecule/course-sections/index.d.ts +0 -1
- package/lib/molecule/drag-and-drop/index.d.ts +0 -1
- package/lib/molecule/drag-and-drop/upload-report.d.ts +0 -1
- package/lib/molecule/filters/index.d.ts +0 -1
- package/lib/molecule/filters/index.d.ts.map +1 -1
- package/lib/molecule/skill-picker-modal/index.js +1 -1
- package/lib/molecule/skill-picker-modal/index.js.map +1 -1
- package/lib/molecule/title-and-checkbox-wrapper/index.d.ts +0 -1
- package/lib/molecule/translation-modal/index.d.ts +0 -4
- package/lib/molecule/translation-modal/index.d.ts.map +1 -1
- package/lib/molecule/translation-modal/index.js +6 -11
- package/lib/molecule/translation-modal/index.js.map +1 -1
- package/lib/organism/content-translation/index.d.ts +0 -2
- package/lib/organism/icon-editor/index.d.ts +0 -1
- package/lib/organism/icon-editor/index.d.ts.map +1 -1
- package/lib/organism/icon-editor/types.d.ts +0 -1
- package/lib/organism/icon-editor/types.d.ts.map +1 -1
- package/lib/organism/mooc-header/index.d.ts +2 -0
- package/lib/organism/mooc-header/index.d.ts.map +1 -1
- package/lib/organism/mooc-header/index.js +3 -0
- package/lib/organism/mooc-header/index.js.map +1 -1
- package/lib/organism/rewards-form/index.d.ts +0 -1
- package/lib/organism/select-opponents/index.d.ts +0 -1
- package/lib/organism/select-opponents/index.d.ts.map +1 -1
- package/lib/organism/select-opponents/types.d.ts +0 -1
- package/lib/organism/select-opponents/types.d.ts.map +1 -1
- package/lib/organism/skill-edition/index.d.ts +0 -22
- package/lib/organism/skill-edition/index.d.ts.map +1 -1
- package/lib/organism/skill-edition/index.js +44 -69
- package/lib/organism/skill-edition/index.js.map +1 -1
- package/lib/organism/skill-edition/style.css +2 -1
- package/lib/organism/skill-edition/types.d.ts +1 -27
- package/lib/organism/skill-edition/types.d.ts.map +1 -1
- package/lib/organism/skill-edition/types.js +5 -24
- package/lib/organism/skill-edition/types.js.map +1 -1
- package/lib/organism/title-and-input/index.d.ts +0 -5
- package/lib/organism/title-and-input/index.d.ts.map +1 -1
- package/lib/organism/title-and-input/types.d.ts +0 -5
- package/lib/organism/title-and-input/types.d.ts.map +1 -1
- package/lib/organism/wizard-contents/index.d.ts +0 -4
- package/lib/template/back-office/brand-update/index.d.ts +0 -22
- package/lib/template/back-office/brand-update/index.d.ts.map +1 -1
- package/lib/template/back-office/brand-update/index.js +3 -6
- package/lib/template/back-office/brand-update/index.js.map +1 -1
- package/lib/template/certifications/index.d.ts +0 -1
- package/lib/template/common/search-page/index.d.ts +0 -1
- package/lib/template/playlist-detail/index.d.ts +0 -1
- package/lib/template/skill-detail/style.css +1 -1
- package/lib/util/render-with-context.d.ts.map +1 -1
- package/lib/util/render-with-context.js +2 -3
- package/lib/util/render-with-context.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/button-link/index.tsx"],"names":[],"mappings":";AAOA,OAAkB,EAAC,eAAe,EAAW,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/button-link/index.tsx"],"names":[],"mappings":";AAOA,OAAkB,EAAC,eAAe,EAAW,MAAM,SAAS,CAAC;AA6D7D,QAAA,MAAM,UAAU;YAAW,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4IzC,CAAC;AAIF,eAAe,UAAU,CAAC"}
|
|
@@ -21,7 +21,14 @@ const getButtonContent = (icon, content, hovered, hoverBackgroundColor, hoverCol
|
|
|
21
21
|
if (!Icon && !faIcon) {
|
|
22
22
|
return /*#__PURE__*/React.createElement("div", {
|
|
23
23
|
className: (style.buttonContent, customLabelClassName)
|
|
24
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
24
|
+
}, typeof content === 'string' ? /*#__PURE__*/React.createElement("span", {
|
|
25
|
+
className: (style.label, customLabelClassName)
|
|
26
|
+
// eslint-disable-next-line react/no-danger
|
|
27
|
+
,
|
|
28
|
+
dangerouslySetInnerHTML: {
|
|
29
|
+
__html: content
|
|
30
|
+
}
|
|
31
|
+
}) : /*#__PURE__*/React.createElement("span", {
|
|
25
32
|
className: (style.label, customLabelClassName)
|
|
26
33
|
}, content));
|
|
27
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useCallback","useState","useMemo","classnames","Link","FaIcon","DEFAULT_ICON_COLOR","ICONS","ToolTip","propTypes","style","getButtonContent","icon","content","hovered","hoverBackgroundColor","hoverColor","customLabelClassName","type","faIcon","position","Icon","createElement","className","buttonContent","label","iconComponent","iconName","name","iconColor","color","backgroundColor","size","faSize","wrapperSize","customStyle","theme","ButtonLink","props","usage","disabled","dataName","dataTestId","ariaLabel","tooltipText","tooltipPlacement","link","onClick","_noop","onKeyDown","useTitle","styleButton","button","iconButton","primary","secondary","tertiary","text","dangerous","setHovered","handleOnClick","event","handleOnKeyDown","handleMouseOver","handleMouseLeave","TooltipContent","tooltipContentWrapper","renderToolTip","closeToolTipInformationTextAriaLabel","fontSize","anchorId","toolTipIsVisible","placement","_customStyle","_extends","title","onMouseEnter","onMouseLeave","onMouseOver","tabIndex","process","env","NODE_ENV"],"sources":["../../../src/atom/button-link/index.tsx"],"sourcesContent":["import React, {useCallback, useState, useMemo} from 'react';\nimport {noop} from 'lodash/fp';\nimport classnames from 'classnames';\nimport Link from '../link';\nimport FaIcon, {DEFAULT_ICON_COLOR, IconProps} from '../icon';\nimport {ICONS} from '../../util/button-icons';\nimport ToolTip from '../tooltip';\nimport propTypes, {ButtonLinkProps, IconType} from './types';\nimport style from './style.css';\n\nconst getButtonContent = (\n icon?: IconType,\n content?: string | React.ReactNode,\n hovered?: boolean,\n hoverBackgroundColor?: string,\n hoverColor?: string,\n customLabelClassName?: string\n) => {\n const {type, faIcon, position} = icon || {type: '', position: ''};\n const Icon = type && ICONS[type];\n\n if (!Icon && !faIcon) {\n return (\n <div className={(style.buttonContent, customLabelClassName)}>\n <span className={(style.label, customLabelClassName)}>{content}</span>\n </div>\n );\n }\n\n const iconComponent = faIcon ? (\n <FaIcon\n {...({\n iconName: faIcon.name,\n iconColor: hovered && hoverColor ? hoverColor : faIcon.color ?? DEFAULT_ICON_COLOR,\n // eslint-disable-next-line no-nested-ternary\n backgroundColor: !faIcon?.backgroundColor\n ? null\n : hovered && hoverBackgroundColor\n ? hoverBackgroundColor\n : faIcon.backgroundColor,\n size: {\n faSize: faIcon.size,\n wrapperSize: faIcon.size\n },\n customStyle: faIcon.customStyle\n } as IconProps)}\n />\n ) : (\n <Icon className={style.icon} theme=\"coorpmanager\" />\n );\n\n return (\n <div className={style.buttonContent}>\n {position === 'left' ? iconComponent : null}\n {content ? <span className={style.label}>{content}</span> : null}\n {position === 'right' ? iconComponent : null}\n </div>\n );\n};\n\nconst ButtonLink = (props: ButtonLinkProps) => {\n const {\n type,\n usage = 'button',\n label,\n content,\n hoverBackgroundColor,\n hoverColor,\n disabled = false,\n icon,\n 'data-name': dataName,\n 'data-testid': dataTestId = 'button-link',\n 'aria-label': ariaLabel,\n tooltipText,\n tooltipPlacement = 'left',\n link,\n onClick = noop,\n onKeyDown = noop,\n className,\n customStyle,\n useTitle = true,\n customLabelClassName\n } = props;\n const styleButton = classnames(\n link && style.link,\n className,\n style.button,\n !label && style.iconButton,\n type === 'primary' && style.primary,\n type === 'secondary' && style.secondary,\n type === 'tertiary' && style.tertiary,\n type === 'text' && style.text,\n type === 'dangerous' && style.dangerous,\n disabled && style.disabled\n );\n\n const [hovered, setHovered] = useState(false);\n\n const handleOnClick = useCallback(event => onClick(event), [onClick]);\n\n const handleOnKeyDown = useCallback(event => onKeyDown(event), [onKeyDown]);\n\n const handleMouseOver = useCallback(() => {\n setHovered(true);\n }, [setHovered]);\n\n const handleMouseLeave = useCallback(() => setHovered(false), [setHovered]);\n\n const TooltipContent = useCallback(\n () => <span className={style.tooltipContentWrapper}>{tooltipText || ariaLabel}</span>,\n [tooltipText, ariaLabel]\n );\n\n const renderToolTip = () => {\n const closeToolTipInformationTextAriaLabel = tooltipText || ariaLabel;\n if (!closeToolTipInformationTextAriaLabel) return null;\n return (\n <ToolTip\n fontSize={12}\n anchorId=\"button-icon\"\n toolTipIsVisible={hovered}\n placement={tooltipPlacement}\n TooltipContent={TooltipContent}\n closeToolTipInformationTextAriaLabel={closeToolTipInformationTextAriaLabel}\n />\n );\n };\n\n const _customStyle = useMemo(() => {\n return {\n ...customStyle,\n ...((hoverBackgroundColor || hoverColor) && hovered\n ? {\n backgroundColor: hoverBackgroundColor,\n color: hoverColor\n }\n : null)\n };\n }, [hoverBackgroundColor, hoverColor, hovered, customStyle]);\n\n if (link) {\n return (\n <Link\n {...link}\n {...(useTitle && {\n title: ariaLabel || label\n })}\n className={styleButton}\n style={customStyle}\n data-name={dataName}\n data-testid={dataTestId}\n onClick={handleOnClick}\n aria-label={ariaLabel || label}\n hoverColor={hoverColor}\n hoverBackgroundColor={hoverBackgroundColor}\n onMouseEnter={handleMouseOver}\n onMouseLeave={handleMouseLeave}\n >\n {getButtonContent(\n icon,\n content ?? label,\n hovered,\n hoverBackgroundColor,\n hoverColor,\n customLabelClassName\n )}\n {renderToolTip()}\n </Link>\n );\n }\n\n return (\n <button\n {...(useTitle && {\n title: ariaLabel || label\n })}\n {...(ariaLabel && !label\n ? {\n 'data-for': 'button-icon',\n 'data-tip': hovered\n }\n : {})}\n // eslint-disable-next-line react/button-has-type\n type={usage}\n aria-label={ariaLabel || label}\n data-name={dataName}\n data-testid={dataTestId}\n style={_customStyle}\n className={styleButton}\n onClick={handleOnClick}\n onKeyDown={handleOnKeyDown}\n onMouseOver={handleMouseOver}\n onMouseLeave={handleMouseLeave}\n tabIndex={0}\n disabled={disabled}\n >\n {getButtonContent(icon, content ?? label, hovered, hoverBackgroundColor, hoverColor)}\n {renderToolTip()}\n </button>\n );\n};\n\nButtonLink.propTypes = propTypes;\n\nexport default ButtonLink;\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAGC,WAAW,EAAEC,QAAQ,EAAEC,OAAO,QAAO,OAAO;AAE3D,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,IAAI,MAAM,SAAS;AAC1B,OAAOC,MAAM,IAAGC,kBAAkB,QAAkB,SAAS;AAC7D,SAAQC,KAAK,QAAO,yBAAyB;AAC7C,OAAOC,OAAO,MAAM,YAAY;AAChC,OAAOC,SAAS,MAAmC,SAAS;AAC5D,OAAOC,KAAK,MAAM,aAAa;AAE/B,MAAMC,gBAAgB,GAAGA,CACvBC,IAAe,EACfC,OAAkC,EAClCC,OAAiB,EACjBC,oBAA6B,EAC7BC,UAAmB,EACnBC,oBAA6B,KAC1B;EACH,MAAM;IAACC,IAAI;IAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAGR,IAAI,IAAI;IAACM,IAAI,EAAE,EAAE;IAAEE,QAAQ,EAAE;EAAE,CAAC;EACjE,MAAMC,IAAI,GAAGH,IAAI,IAAIX,KAAK,CAACW,IAAI,CAAC;EAEhC,IAAI,CAACG,IAAI,IAAI,CAACF,MAAM,EAAE;IACpB,oBACEpB,KAAA,CAAAuB,aAAA;MAAKC,SAAS,GAAGb,KAAK,CAACc,aAAa,EAAEP,oBAAoB;IAAE,gBAC1DlB,KAAA,CAAAuB,aAAA;MAAMC,SAAS,GAAGb,KAAK,CAACe,KAAK,EAAER,oBAAoB;IAAE,GAAEJ,OAAc,CAClE,CAAC;EAEV;EAEA,MAAMa,aAAa,GAAGP,MAAM,gBAC1BpB,KAAA,CAAAuB,aAAA,CAACjB,MAAM;IAEHsB,QAAQ,EAAER,MAAM,CAACS,IAAI;IACrBC,SAAS,EAAEf,OAAO,IAAIE,U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,CAAC,CACX,CAAC;EAEX;EAEA,oBACEpE,KAAA,CAAAuB,aAAA,WAAAoD,QAAA,KACOxB,QAAQ,IAAI;IACfyB,KAAK,EAAEhC,SAAS,IAAIlB;EACtB,CAAC,EACIkB,SAAS,IAAI,CAAClB,KAAK,GACpB;IACE,UAAU,EAAE,aAAa;IACzB,UAAU,EAAEX;EACd,CAAC,GACD,CAAC,CAAC;IACN;IACAI,IAAI,EAAEqB,KAAM;IACZ,cAAYI,SAAS,IAAIlB,KAAM;IAC/B,aAAWgB,QAAS;IACpB,eAAaC,UAAW;IACxBhC,KAAK,EAAE+D,YAAa;IACpBlD,SAAS,EAAE4B,WAAY;IACvBJ,OAAO,EAAEa,aAAc;IACvBX,SAAS,EAAEa,eAAgB;IAC3BgB,WAAW,EAAEf,eAAgB;IAC7Bc,YAAY,EAAEb,gBAAiB;IAC/Be,QAAQ,EAAE,CAAE;IACZvC,QAAQ,EAAEA;EAAS,IAElB7B,gBAAgB,CAACC,IAAI,EAAEC,OAAO,IAAIY,KAAK,EAAEX,OAAO,EAAEC,oBAAoB,EAAEC,UAAU,CAAC,EACnFmD,aAAa,CAAC,CACT,CAAC;AAEb,CAAC;AAED9B,UAAU,CAAC5B,SAAS,GAAAuE,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAGzE,SAAS;AAEhC,eAAe4B,UAAU","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useCallback","useState","useMemo","classnames","Link","FaIcon","DEFAULT_ICON_COLOR","ICONS","ToolTip","propTypes","style","getButtonContent","icon","content","hovered","hoverBackgroundColor","hoverColor","customLabelClassName","type","faIcon","position","Icon","createElement","className","buttonContent","label","dangerouslySetInnerHTML","__html","iconComponent","iconName","name","iconColor","color","backgroundColor","size","faSize","wrapperSize","customStyle","theme","ButtonLink","props","usage","disabled","dataName","dataTestId","ariaLabel","tooltipText","tooltipPlacement","link","onClick","_noop","onKeyDown","useTitle","styleButton","button","iconButton","primary","secondary","tertiary","text","dangerous","setHovered","handleOnClick","event","handleOnKeyDown","handleMouseOver","handleMouseLeave","TooltipContent","tooltipContentWrapper","renderToolTip","closeToolTipInformationTextAriaLabel","fontSize","anchorId","toolTipIsVisible","placement","_customStyle","_extends","title","onMouseEnter","onMouseLeave","onMouseOver","tabIndex","process","env","NODE_ENV"],"sources":["../../../src/atom/button-link/index.tsx"],"sourcesContent":["import React, {useCallback, useState, useMemo} from 'react';\nimport {noop} from 'lodash/fp';\nimport classnames from 'classnames';\nimport Link from '../link';\nimport FaIcon, {DEFAULT_ICON_COLOR, IconProps} from '../icon';\nimport {ICONS} from '../../util/button-icons';\nimport ToolTip from '../tooltip';\nimport propTypes, {ButtonLinkProps, IconType} from './types';\nimport style from './style.css';\n\nconst getButtonContent = (\n icon?: IconType,\n content?: string | React.ReactNode,\n hovered?: boolean,\n hoverBackgroundColor?: string,\n hoverColor?: string,\n customLabelClassName?: string\n) => {\n const {type, faIcon, position} = icon || {type: '', position: ''};\n const Icon = type && ICONS[type];\n\n if (!Icon && !faIcon) {\n return (\n <div className={(style.buttonContent, customLabelClassName)}>\n {typeof content === 'string' ? (\n <span\n className={(style.label, customLabelClassName)}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: content}}\n />\n ) : (\n <span className={(style.label, customLabelClassName)}>{content}</span>\n )}\n </div>\n );\n }\n\n const iconComponent = faIcon ? (\n <FaIcon\n {...({\n iconName: faIcon.name,\n iconColor: hovered && hoverColor ? hoverColor : faIcon.color ?? DEFAULT_ICON_COLOR,\n // eslint-disable-next-line no-nested-ternary\n backgroundColor: !faIcon?.backgroundColor\n ? null\n : hovered && hoverBackgroundColor\n ? hoverBackgroundColor\n : faIcon.backgroundColor,\n size: {\n faSize: faIcon.size,\n wrapperSize: faIcon.size\n },\n customStyle: faIcon.customStyle\n } as IconProps)}\n />\n ) : (\n <Icon className={style.icon} theme=\"coorpmanager\" />\n );\n\n return (\n <div className={style.buttonContent}>\n {position === 'left' ? iconComponent : null}\n {content ? <span className={style.label}>{content}</span> : null}\n {position === 'right' ? iconComponent : null}\n </div>\n );\n};\n\nconst ButtonLink = (props: ButtonLinkProps) => {\n const {\n type,\n usage = 'button',\n label,\n content,\n hoverBackgroundColor,\n hoverColor,\n disabled = false,\n icon,\n 'data-name': dataName,\n 'data-testid': dataTestId = 'button-link',\n 'aria-label': ariaLabel,\n tooltipText,\n tooltipPlacement = 'left',\n link,\n onClick = noop,\n onKeyDown = noop,\n className,\n customStyle,\n useTitle = true,\n customLabelClassName\n } = props;\n const styleButton = classnames(\n link && style.link,\n className,\n style.button,\n !label && style.iconButton,\n type === 'primary' && style.primary,\n type === 'secondary' && style.secondary,\n type === 'tertiary' && style.tertiary,\n type === 'text' && style.text,\n type === 'dangerous' && style.dangerous,\n disabled && style.disabled\n );\n\n const [hovered, setHovered] = useState(false);\n\n const handleOnClick = useCallback(event => onClick(event), [onClick]);\n\n const handleOnKeyDown = useCallback(event => onKeyDown(event), [onKeyDown]);\n\n const handleMouseOver = useCallback(() => {\n setHovered(true);\n }, [setHovered]);\n\n const handleMouseLeave = useCallback(() => setHovered(false), [setHovered]);\n\n const TooltipContent = useCallback(\n () => <span className={style.tooltipContentWrapper}>{tooltipText || ariaLabel}</span>,\n [tooltipText, ariaLabel]\n );\n\n const renderToolTip = () => {\n const closeToolTipInformationTextAriaLabel = tooltipText || ariaLabel;\n if (!closeToolTipInformationTextAriaLabel) return null;\n return (\n <ToolTip\n fontSize={12}\n anchorId=\"button-icon\"\n toolTipIsVisible={hovered}\n placement={tooltipPlacement}\n TooltipContent={TooltipContent}\n closeToolTipInformationTextAriaLabel={closeToolTipInformationTextAriaLabel}\n />\n );\n };\n\n const _customStyle = useMemo(() => {\n return {\n ...customStyle,\n ...((hoverBackgroundColor || hoverColor) && hovered\n ? {\n backgroundColor: hoverBackgroundColor,\n color: hoverColor\n }\n : null)\n };\n }, [hoverBackgroundColor, hoverColor, hovered, customStyle]);\n\n if (link) {\n return (\n <Link\n {...link}\n {...(useTitle && {\n title: ariaLabel || label\n })}\n className={styleButton}\n style={customStyle}\n data-name={dataName}\n data-testid={dataTestId}\n onClick={handleOnClick}\n aria-label={ariaLabel || label}\n hoverColor={hoverColor}\n hoverBackgroundColor={hoverBackgroundColor}\n onMouseEnter={handleMouseOver}\n onMouseLeave={handleMouseLeave}\n >\n {getButtonContent(\n icon,\n content ?? label,\n hovered,\n hoverBackgroundColor,\n hoverColor,\n customLabelClassName\n )}\n {renderToolTip()}\n </Link>\n );\n }\n\n return (\n <button\n {...(useTitle && {\n title: ariaLabel || label\n })}\n {...(ariaLabel && !label\n ? {\n 'data-for': 'button-icon',\n 'data-tip': hovered\n }\n : {})}\n // eslint-disable-next-line react/button-has-type\n type={usage}\n aria-label={ariaLabel || label}\n data-name={dataName}\n data-testid={dataTestId}\n style={_customStyle}\n className={styleButton}\n onClick={handleOnClick}\n onKeyDown={handleOnKeyDown}\n onMouseOver={handleMouseOver}\n onMouseLeave={handleMouseLeave}\n tabIndex={0}\n disabled={disabled}\n >\n {getButtonContent(icon, content ?? label, hovered, hoverBackgroundColor, hoverColor)}\n {renderToolTip()}\n </button>\n );\n};\n\nButtonLink.propTypes = propTypes;\n\nexport default ButtonLink;\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAGC,WAAW,EAAEC,QAAQ,EAAEC,OAAO,QAAO,OAAO;AAE3D,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,IAAI,MAAM,SAAS;AAC1B,OAAOC,MAAM,IAAGC,kBAAkB,QAAkB,SAAS;AAC7D,SAAQC,KAAK,QAAO,yBAAyB;AAC7C,OAAOC,OAAO,MAAM,YAAY;AAChC,OAAOC,SAAS,MAAmC,SAAS;AAC5D,OAAOC,KAAK,MAAM,aAAa;AAE/B,MAAMC,gBAAgB,GAAGA,CACvBC,IAAe,EACfC,OAAkC,EAClCC,OAAiB,EACjBC,oBAA6B,EAC7BC,UAAmB,EACnBC,oBAA6B,KAC1B;EACH,MAAM;IAACC,IAAI;IAAEC,MA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SAAS,EAAEa,eAAgB;IAC3BgB,WAAW,EAAEf,eAAgB;IAC7Bc,YAAY,EAAEb,gBAAiB;IAC/Be,QAAQ,EAAE,CAAE;IACZvC,QAAQ,EAAEA;EAAS,IAElB/B,gBAAgB,CAACC,IAAI,EAAEC,OAAO,IAAIY,KAAK,EAAEX,OAAO,EAAEC,oBAAoB,EAAEC,UAAU,CAAC,EACnFqD,aAAa,CAAC,CACT,CAAC;AAEb,CAAC;AAED9B,UAAU,CAAC9B,SAAS,GAAAyE,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAG3E,SAAS;AAEhC,eAAe8B,UAAU","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/button-menu/index.tsx"],"names":[],"mappings":";AAMA,OAAkB,EAAC,eAAe,EAA+B,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/button-menu/index.tsx"],"names":[],"mappings":";AAMA,OAAkB,EAAC,eAAe,EAA+B,MAAM,SAAS,CAAC;AAmEjF,QAAA,MAAM,UAAU;YAAW,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqBzC,CAAC;AAIF,eAAe,UAAU,CAAC"}
|
|
@@ -30,6 +30,7 @@ const buildCustomIconByTheme = icon => {
|
|
|
30
30
|
const Button = props => {
|
|
31
31
|
const {
|
|
32
32
|
'data-name': dataName,
|
|
33
|
+
'aria-label': ariaLabel,
|
|
33
34
|
disabled,
|
|
34
35
|
label,
|
|
35
36
|
onClick = _noop,
|
|
@@ -44,7 +45,7 @@ const Button = props => {
|
|
|
44
45
|
const handleOnClick = useCallback(() => onClick(), [onClick]);
|
|
45
46
|
const buttonLinkProps = {
|
|
46
47
|
...rest,
|
|
47
|
-
'aria-label': label,
|
|
48
|
+
'aria-label': ariaLabel || label,
|
|
48
49
|
disabled,
|
|
49
50
|
label,
|
|
50
51
|
type: buttonLinkType,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useMemo","useCallback","map","classnames","ButtonLink","style","propTypes","buttonPropTypes","DEFAULT_ICON_STYLE","THEMES","buildCustomIconByTheme","icon","theme","iconProps","custom","customProps","faIcon","Button","props","dataName","disabled","label","onClick","_noop","type","buttonLinkType","customStyle","customLabelClassName","rest","styleButton","button","defaultStyle","defaultLeft","dangerous","dangerousLeft","handleOnClick","buttonLinkProps","className","createElement","_extends","process","env","NODE_ENV","ButtonMenu","buttons","enableScroll","buildButton","index","key","buttonList","convert","cap","containerStyle","buttonMenuContainer","scrollable"],"sources":["../../../src/atom/button-menu/index.tsx"],"sourcesContent":["import React, {useMemo, useCallback} from 'react';\nimport map from 'lodash/fp/map';\nimport classnames from 'classnames';\nimport {noop} from 'lodash/fp';\nimport ButtonLink from '../button-link';\nimport style from './style.css';\nimport propTypes, {ButtonMenuProps, ButtonProps, buttonPropTypes} from './types';\nimport {DEFAULT_ICON_STYLE, THEMES} from './utils';\n\nconst buildCustomIconByTheme = (icon: ButtonProps['icon']) => {\n if (!icon) return;\n\n const {theme, ...iconProps} = icon;\n const custom = theme && THEMES[theme];\n if (!custom) return iconProps;\n\n const customProps = custom\n ? {\n ...DEFAULT_ICON_STYLE,\n faIcon: {...DEFAULT_ICON_STYLE.faIcon, ...custom}\n }\n : null;\n\n return {\n ...iconProps,\n ...customProps\n };\n};\n\nconst Button = (props: ButtonProps) => {\n const {\n 'data-name': dataName,\n disabled,\n label,\n onClick = noop,\n type = 'default',\n buttonLinkType,\n icon,\n customStyle = {},\n customLabelClassName,\n ...rest\n } = props;\n const styleButton = classnames(\n style.button,\n type === 'default' && style.defaultStyle,\n type === 'defaultLeft' && style.defaultLeft,\n type === 'dangerous' && style.dangerous,\n type === 'dangerousLeft' && style.dangerousLeft,\n disabled && style.disabled\n );\n const handleOnClick = useCallback(() => onClick(), [onClick]);\n\n const buttonLinkProps = {\n ...rest,\n 'aria-label': label,\n disabled,\n label,\n type: buttonLinkType,\n onClick: handleOnClick,\n 'data-name': dataName,\n className: styleButton,\n customStyle: {...customStyle},\n customLabelClassName\n };\n\n const iconProps = buildCustomIconByTheme(icon);\n\n return <ButtonLink {...buttonLinkProps} icon={iconProps} />;\n};\n\nButton.propTypes = buttonPropTypes;\n\nconst ButtonMenu = (props: ButtonMenuProps) => {\n const {buttons, 'data-name': dataName, enableScroll = false} = props;\n const buildButton = useCallback((button: ButtonProps, index) => {\n return <Button {...button} key={button.label + index} />;\n }, []);\n\n const buttonList = useMemo(\n // @ts-expect-error (to avoid using map as any)\n () => map.convert({cap: false})(buildButton, buttons),\n [buttons, buildButton]\n );\n\n const containerStyle = classnames(style.buttonMenuContainer, {\n [style.scrollable]: enableScroll\n });\n\n return (\n <div data-name={dataName} className={containerStyle}>\n {buttonList}\n </div>\n );\n};\n\nButtonMenu.propTypes = propTypes;\n\nexport default ButtonMenu;\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAGC,OAAO,EAAEC,WAAW,QAAO,OAAO;AACjD,OAAOC,GAAG,MAAM,eAAe;AAC/B,OAAOC,UAAU,MAAM,YAAY;AAEnC,OAAOC,UAAU,MAAM,gBAAgB;AACvC,OAAOC,KAAK,MAAM,aAAa;AAC/B,OAAOC,SAAS,IAAiCC,eAAe,QAAO,SAAS;AAChF,SAAQC,kBAAkB,EAAEC,MAAM,QAAO,SAAS;AAElD,MAAMC,sBAAsB,GAAIC,IAAyB,IAAK;EAC5D,IAAI,CAACA,IAAI,EAAE;EAEX,MAAM;IAACC,KAAK;IAAE,GAAGC;EAAS,CAAC,GAAGF,IAAI;EAClC,MAAMG,MAAM,GAAGF,KAAK,IAAIH,MAAM,CAACG,KAAK,CAAC;EACrC,IAAI,CAACE,MAAM,EAAE,OAAOD,SAAS;EAE7B,MAAME,WAAW,GAAGD,MAAM,GACtB;IACE,GAAGN,kBAAkB;IACrBQ,MAAM,EAAE;MAAC,GAAGR,kBAAkB,CAACQ,MAAM;MAAE,GAAGF;IAAM;EAClD,CAAC,GACD,IAAI;EAER,OAAO;IACL,GAAGD,SAAS;IACZ,GAAGE;EACL,CAAC;AACH,CAAC;AAED,MAAME,MAAM,GAAIC,KAAkB,IAAK;EACrC,MAAM;IACJ,WAAW,EAAEC,QAAQ;
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useMemo","useCallback","map","classnames","ButtonLink","style","propTypes","buttonPropTypes","DEFAULT_ICON_STYLE","THEMES","buildCustomIconByTheme","icon","theme","iconProps","custom","customProps","faIcon","Button","props","dataName","ariaLabel","disabled","label","onClick","_noop","type","buttonLinkType","customStyle","customLabelClassName","rest","styleButton","button","defaultStyle","defaultLeft","dangerous","dangerousLeft","handleOnClick","buttonLinkProps","className","createElement","_extends","process","env","NODE_ENV","ButtonMenu","buttons","enableScroll","buildButton","index","key","buttonList","convert","cap","containerStyle","buttonMenuContainer","scrollable"],"sources":["../../../src/atom/button-menu/index.tsx"],"sourcesContent":["import React, {useMemo, useCallback} from 'react';\nimport map from 'lodash/fp/map';\nimport classnames from 'classnames';\nimport {noop} from 'lodash/fp';\nimport ButtonLink from '../button-link';\nimport style from './style.css';\nimport propTypes, {ButtonMenuProps, ButtonProps, buttonPropTypes} from './types';\nimport {DEFAULT_ICON_STYLE, THEMES} from './utils';\n\nconst buildCustomIconByTheme = (icon: ButtonProps['icon']) => {\n if (!icon) return;\n\n const {theme, ...iconProps} = icon;\n const custom = theme && THEMES[theme];\n if (!custom) return iconProps;\n\n const customProps = custom\n ? {\n ...DEFAULT_ICON_STYLE,\n faIcon: {...DEFAULT_ICON_STYLE.faIcon, ...custom}\n }\n : null;\n\n return {\n ...iconProps,\n ...customProps\n };\n};\n\nconst Button = (props: ButtonProps) => {\n const {\n 'data-name': dataName,\n 'aria-label': ariaLabel,\n disabled,\n label,\n onClick = noop,\n type = 'default',\n buttonLinkType,\n icon,\n customStyle = {},\n customLabelClassName,\n ...rest\n } = props;\n const styleButton = classnames(\n style.button,\n type === 'default' && style.defaultStyle,\n type === 'defaultLeft' && style.defaultLeft,\n type === 'dangerous' && style.dangerous,\n type === 'dangerousLeft' && style.dangerousLeft,\n disabled && style.disabled\n );\n const handleOnClick = useCallback(() => onClick(), [onClick]);\n\n const buttonLinkProps = {\n ...rest,\n 'aria-label': ariaLabel || label,\n disabled,\n label,\n type: buttonLinkType,\n onClick: handleOnClick,\n 'data-name': dataName,\n className: styleButton,\n customStyle: {...customStyle},\n customLabelClassName\n };\n\n const iconProps = buildCustomIconByTheme(icon);\n\n return <ButtonLink {...buttonLinkProps} icon={iconProps} />;\n};\n\nButton.propTypes = buttonPropTypes;\n\nconst ButtonMenu = (props: ButtonMenuProps) => {\n const {buttons, 'data-name': dataName, enableScroll = false} = props;\n const buildButton = useCallback((button: ButtonProps, index) => {\n return <Button {...button} key={button.label + index} />;\n }, []);\n\n const buttonList = useMemo(\n // @ts-expect-error (to avoid using map as any)\n () => map.convert({cap: false})(buildButton, buttons),\n [buttons, buildButton]\n );\n\n const containerStyle = classnames(style.buttonMenuContainer, {\n [style.scrollable]: enableScroll\n });\n\n return (\n <div data-name={dataName} className={containerStyle}>\n {buttonList}\n </div>\n );\n};\n\nButtonMenu.propTypes = propTypes;\n\nexport default ButtonMenu;\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAGC,OAAO,EAAEC,WAAW,QAAO,OAAO;AACjD,OAAOC,GAAG,MAAM,eAAe;AAC/B,OAAOC,UAAU,MAAM,YAAY;AAEnC,OAAOC,UAAU,MAAM,gBAAgB;AACvC,OAAOC,KAAK,MAAM,aAAa;AAC/B,OAAOC,SAAS,IAAiCC,eAAe,QAAO,SAAS;AAChF,SAAQC,kBAAkB,EAAEC,MAAM,QAAO,SAAS;AAElD,MAAMC,sBAAsB,GAAIC,IAAyB,IAAK;EAC5D,IAAI,CAACA,IAAI,EAAE;EAEX,MAAM;IAACC,KAAK;IAAE,GAAGC;EAAS,CAAC,GAAGF,IAAI;EAClC,MAAMG,MAAM,GAAGF,KAAK,IAAIH,M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oreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/chip/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/chip/index.js"],"names":[],"mappings":"AAeO,qGAG0E;;AAGjF,6DAiEC"}
|
package/es/atom/chip/index.js
CHANGED
|
@@ -4,12 +4,9 @@ import classnames from 'classnames';
|
|
|
4
4
|
import get from 'lodash/fp/get';
|
|
5
5
|
import { convert } from 'css-color-function';
|
|
6
6
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
7
|
-
import { fas } from '@fortawesome/pro-solid-svg-icons';
|
|
8
|
-
import { library } from '@fortawesome/fontawesome-svg-core';
|
|
9
7
|
import Provider from '../provider';
|
|
10
8
|
import { COLORS } from '../../variables/colors';
|
|
11
9
|
import style from './style.css';
|
|
12
|
-
library.add(fas);
|
|
13
10
|
const LUMINOSITY_DELTA = 0.08;
|
|
14
11
|
const {
|
|
15
12
|
cm_primary_blue: DEFAULT_BACKGROUND_COLOR
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useMemo","useState","useCallback","PropTypes","classnames","get","convert","FontAwesomeIcon","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useMemo","useState","useCallback","PropTypes","classnames","get","convert","FontAwesomeIcon","Provider","COLORS","style","LUMINOSITY_DELTA","cm_primary_blue","DEFAULT_BACKGROUND_COLOR","ICON_SIZE","calculateHoveredSelectedBgColor","selectedBgColor","luminosityDelta","Chip","props","context","text","subText","selected","customIcon","onClick","leftIcon","backgroundColor","skin","skinColor","hoveredSelectedBgColor","isHovered","setIsHovered","handleClick","handleMouseEnter","handleMouseLeave","hoverStyle","defaultIcon","color","white","cm_grey_400","createElement","className","container","unselected","onMouseEnter","onMouseLeave","left","icon","fontSize","title","contextTypes","childContextTypes","propTypes","process","env","NODE_ENV","string","bool","func"],"sources":["../../../src/atom/chip/index.js"],"sourcesContent":["import React, {useMemo, useState, useCallback} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\n\nimport get from 'lodash/fp/get';\nimport {convert} from 'css-color-function';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport Provider from '../provider';\nimport {COLORS} from '../../variables/colors';\nimport style from './style.css';\n\nconst LUMINOSITY_DELTA = 0.08;\nconst {cm_primary_blue: DEFAULT_BACKGROUND_COLOR} = COLORS;\nconst ICON_SIZE = '12px';\n\nexport const calculateHoveredSelectedBgColor = (\n selectedBgColor,\n luminosityDelta = LUMINOSITY_DELTA\n) => convert(`hsl(from ${selectedBgColor} h s calc(l*(1 - ${luminosityDelta})))`);\n// note: luminosity decrease is relative to the selected color\n\nconst Chip = (props, context) => {\n const {\n text,\n subText,\n selected = false,\n customIcon,\n onClick,\n leftIcon,\n backgroundColor = DEFAULT_BACKGROUND_COLOR\n } = props;\n const {skin} = context;\n const skinColor = get('common.primary', skin);\n const selectedBgColor = backgroundColor === 'skin' && skinColor ? skinColor : backgroundColor;\n const hoveredSelectedBgColor = calculateHoveredSelectedBgColor(selectedBgColor);\n\n const [isHovered, setIsHovered] = useState(false);\n\n const handleClick = useMemo(() => onClick, [onClick]);\n\n const handleMouseEnter = useCallback(() => {\n setIsHovered(true);\n }, []);\n\n const handleMouseLeave = useCallback(() => {\n setIsHovered(false);\n }, []);\n\n const hoverStyle = isHovered ? {backgroundColor: hoveredSelectedBgColor} : {};\n\n const defaultIcon = selected ? 'fa-check' : 'fa-plus';\n const color = selected ? COLORS.white : COLORS.cm_grey_400;\n\n return (\n <div\n className={classnames(style.container, !selected && style.unselected)}\n style={{\n ...(selected && selectedBgColor ? {backgroundColor: selectedBgColor} : {}),\n ...(selected && hoverStyle)\n }}\n onClick={handleClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n aria-label={text}\n data-name={`chip-${text}`}\n >\n <div className={style.left}>\n {leftIcon ? <FontAwesomeIcon style={{color}} icon={leftIcon} fontSize={ICON_SIZE} /> : null}\n <div title={text}>\n <span className={style.text} style={{color}}>\n {text}\n </span>\n {subText ? (\n <span className={style.subText} style={{color}}>\n {subText}\n </span>\n ) : null}\n </div>\n </div>\n <FontAwesomeIcon\n style={{color}}\n icon={customIcon ? `fa-${customIcon}` : defaultIcon}\n fontSize={ICON_SIZE}\n />\n </div>\n );\n};\n\nChip.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nChip.propTypes = {\n text: PropTypes.string,\n subText: PropTypes.string,\n selected: PropTypes.bool,\n customIcon: PropTypes.string,\n backgroundColor: PropTypes.string,\n onClick: PropTypes.func,\n leftIcon: PropTypes.string\n};\n\nexport default Chip;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAGC,OAAO,EAAEC,QAAQ,EAAEC,WAAW,QAAO,OAAO;AAC3D,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AAEnC,OAAOC,GAAG,MAAM,eAAe;AAC/B,SAAQC,OAAO,QAAO,oBAAoB;AAC1C,SAAQC,eAAe,QAAO,gCAAgC;AAC9D,OAAOC,QAAQ,MAAM,aAAa;AAClC,SAAQC,MAAM,QAAO,wBAAwB;AAC7C,OAAOC,KAAK,MAAM,aAAa;AAE/B,MAAMC,gBAAgB,GAAG,IAAI;AAC7B,MAAM;EAACC,eAAe,EAAEC;AAAwB,CAAC,GAAGJ,MAAM;AAC1D,MAAMK,SAAS,GAAG,MAAM;AAExB,OAAO,MAAMC,+BAA+B,GAAGA,CAC7CC,eAAe,EACfC,eAAe,GAAGN,gBAAgB,KAC/BL,OAAO,CAAC,YAAYU,eAAe,oBAAoBC,eAAe,KAAK,CAAC;AACjF;;AAEA,MAAMC,IAAI,GAAGA,CAACC,KAAK,EAAEC,OAAO,KAAK;EAC/B,MAAM;IACJC,IAAI;IACJC,OAAO;IACPC,QAAQ,GAAG,KAAK;IAChBC,UAAU;IACVC,OAAO;IACPC,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ACxBlC,UAAU,EAAErB,SAAS,CAACsD,MAAM;EAC5B9B,eAAe,EAAExB,SAAS,CAACsD,MAAM;EACjChC,OAAO,EAAEtB,SAAS,CAACwD,IAAI;EACvBjC,QAAQ,EAAEvB,SAAS,CAACsD;AACtB,CAAC;AAED,eAAevC,IAAI","ignoreList":[]}
|
|
@@ -8,7 +8,6 @@ declare namespace InputText {
|
|
|
8
8
|
defaultValue: PropTypes.Requireable<string>;
|
|
9
9
|
theme: PropTypes.Requireable<string>;
|
|
10
10
|
disabled: PropTypes.Requireable<boolean>;
|
|
11
|
-
readOnly: PropTypes.Requireable<boolean>;
|
|
12
11
|
value: PropTypes.Requireable<string>;
|
|
13
12
|
hint: PropTypes.Requireable<string>;
|
|
14
13
|
error: PropTypes.Requireable<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/input-text/index.js"],"names":[],"mappings":";AAkBA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/input-text/index.js"],"names":[],"mappings":";AAkBA,oDA4FC"}
|
|
@@ -28,7 +28,6 @@ const InputText = props => {
|
|
|
28
28
|
theme = 'default',
|
|
29
29
|
description,
|
|
30
30
|
disabled,
|
|
31
|
-
readOnly = false,
|
|
32
31
|
modified = false,
|
|
33
32
|
title: propsTitle,
|
|
34
33
|
'data-name': dataName = 'input-text',
|
|
@@ -64,7 +63,7 @@ const InputText = props => {
|
|
|
64
63
|
className: style.leftIcon
|
|
65
64
|
}) : null;
|
|
66
65
|
return /*#__PURE__*/React.createElement("div", {
|
|
67
|
-
className: classnames(mainClass, className, disabled && style.disabled,
|
|
66
|
+
className: classnames(mainClass, className, disabled && style.disabled, _isNil(propsTitle) && style.isNoTitle)
|
|
68
67
|
}, /*#__PURE__*/React.createElement("label", null, /*#__PURE__*/React.createElement("span", {
|
|
69
68
|
className: classnames(style.title, _isEmpty(value) && style.noValue)
|
|
70
69
|
}, propsTitle, toolTipView), /*#__PURE__*/React.createElement("input", {
|
|
@@ -78,7 +77,6 @@ const InputText = props => {
|
|
|
78
77
|
value: value,
|
|
79
78
|
onInput: handleChange,
|
|
80
79
|
disabled: disabled,
|
|
81
|
-
readOnly: readOnly,
|
|
82
80
|
onChange: _noop,
|
|
83
81
|
"data-name": dataName,
|
|
84
82
|
"aria-label": ariaLabel
|
|
@@ -96,7 +94,6 @@ InputText.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
96
94
|
defaultValue: PropTypes.string,
|
|
97
95
|
theme: PropTypes.oneOf(_keys(themeStyle)),
|
|
98
96
|
disabled: PropTypes.bool,
|
|
99
|
-
readOnly: PropTypes.bool,
|
|
100
97
|
value: PropTypes.string,
|
|
101
98
|
hint: PropTypes.string,
|
|
102
99
|
error: PropTypes.string,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useMemo","PropTypes","NovaSolidStatusCheckCircle2","CheckIcon","NovaSolidStatusClose","ErrorIcon","NovaCompositionCoorpacademyInformationIcon","InfoIcon","classnames","getClassState","style","themeStyle","setup","coorpmanager","cockpit","default","defaultStyle","InputText","props","autoFocus","placeholder","value","type","hint","defaultValue","onChange","_noop","error","valid","theme","description","disabled","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useMemo","PropTypes","NovaSolidStatusCheckCircle2","CheckIcon","NovaSolidStatusClose","ErrorIcon","NovaCompositionCoorpacademyInformationIcon","InfoIcon","classnames","getClassState","style","themeStyle","setup","coorpmanager","cockpit","default","defaultStyle","InputText","props","autoFocus","placeholder","value","type","hint","defaultValue","onChange","_noop","error","valid","theme","description","disabled","modified","title","propsTitle","dataName","ariaLabel","inputColor","isCMTheme","handleChange","e","target","mainClass","className","descriptionView","createElement","toolTipView","infoIconWrapper","infoIcon","descriptionLabel","hintView","dangerouslySetInnerHTML","__html","errorIconView","leftIcon","validIconView","_isNil","isNoTitle","_isEmpty","noValue","name","input","autoComplete","onInput","preview","backgroundColor","propTypes","process","env","NODE_ENV","bool","string","oneOf","_keys","func"],"sources":["../../../src/atom/input-text/index.js"],"sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport {noop, isNil, keys, isEmpty} from 'lodash/fp';\nimport {\n NovaSolidStatusCheckCircle2 as CheckIcon,\n NovaSolidStatusClose as ErrorIcon,\n NovaCompositionCoorpacademyInformationIcon as InfoIcon\n} from '@coorpacademy/nova-icons';\nimport classnames from 'classnames';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst themeStyle = {\n setup: style.setup,\n coorpmanager: style.coorpmanager,\n cockpit: style.cockpit,\n default: style.defaultStyle\n};\nconst InputText = props => {\n const {\n autoFocus = false,\n placeholder = '',\n value,\n type = 'text',\n hint,\n defaultValue,\n onChange = noop,\n error,\n valid,\n theme = 'default',\n description,\n disabled,\n modified = false,\n title: propsTitle,\n 'data-name': dataName = 'input-text',\n 'aria-label': ariaLabel = 'Input Text',\n inputColor = false\n } = props;\n\n const isCMTheme = theme === 'coorpmanager';\n const handleChange = useMemo(() => e => onChange(e.target.value), [onChange]);\n const mainClass = themeStyle[theme];\n const className = getClassState(style.defaultStyle, style.modified, style.error, modified, error);\n const descriptionView =\n description && theme !== 'coorpmanager' ? (\n <div className={style.description}>{description}</div>\n ) : null;\n const toolTipView =\n description && theme === 'coorpmanager' ? (\n <div className={style.infoIconWrapper}>\n <InfoIcon className={style.infoIcon} />\n <div className={style.descriptionLabel}>{description}</div>\n </div>\n ) : null;\n const hintView =\n theme === 'coorpmanager' ? (\n <div\n className={style.hint}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: error || hint}}\n />\n ) : null;\n const errorIconView = isCMTheme && error ? <ErrorIcon className={style.leftIcon} /> : null;\n const validIconView = isCMTheme && valid ? <CheckIcon className={style.leftIcon} /> : null;\n\n return (\n <div\n className={classnames(\n mainClass,\n className,\n disabled && style.disabled,\n isNil(propsTitle) && style.isNoTitle\n )}\n >\n <label>\n <span className={classnames(style.title, isEmpty(value) && style.noValue)}>\n {propsTitle}\n {toolTipView}\n </span>\n\n <input\n autoFocus={autoFocus}\n type={type}\n name={propsTitle}\n className={style.input}\n placeholder={placeholder}\n defaultValue={defaultValue}\n autoComplete={'off'}\n value={value}\n onInput={handleChange}\n disabled={disabled}\n onChange={noop}\n data-name={dataName}\n aria-label={ariaLabel}\n />\n {inputColor && !error && value ? (\n <span\n className={style.preview}\n style={{\n backgroundColor: value\n }}\n />\n ) : null}\n {errorIconView}\n {validIconView}\n {hintView}\n </label>\n {descriptionView}\n </div>\n );\n};\n\nInputText.propTypes = {\n autoFocus: PropTypes.bool,\n title: PropTypes.string,\n placeholder: PropTypes.string,\n defaultValue: PropTypes.string,\n theme: PropTypes.oneOf(keys(themeStyle)),\n disabled: PropTypes.bool,\n value: PropTypes.string,\n hint: PropTypes.string,\n error: PropTypes.string,\n onChange: PropTypes.func,\n description: PropTypes.string,\n modified: PropTypes.bool,\n type: PropTypes.string,\n valid: PropTypes.bool,\n 'aria-label': PropTypes.string,\n 'data-name': PropTypes.string,\n inputColor: PropTypes.bool\n};\nexport default InputText;\n"],"mappings":";;;;AAAA,OAAOA,KAAK,IAAGC,OAAO,QAAO,OAAO;AACpC,OAAOC,SAAS,MAAM,YAAY;AAElC,SACEC,2BAA2B,IAAIC,SAAS,EACxCC,oBAAoB,IAAIC,SAAS,EACjCC,0CAA0C,IAAIC,QAAQ,QACjD,0BAA0B;AACjC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,aAAa,MAAM,4BAA4B;AACtD,OAAOC,KAAK,MAAM,aAAa;AAE/B,MAAMC,UAAU,GAAG;EACjBC,KAAK,EAAEF,KAAK,CAACE,KAAK;EAClBC,YAAY,EAAEH,KAAK,CAACG,YAAY;EAChCC,OAAO,EAAEJ,KAAK,CAACI,OAAO;EACtBC,OAAO,EAAEL,KAAK,CAACM;AACjB,CAAC;AACD,MAAMC,SAAS,GAAGC,KAAK,IAAI;EACzB,MA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,CAAC;AACD,eAAerD,SAAS","ignoreList":[]}
|
|
@@ -410,31 +410,4 @@
|
|
|
410
410
|
position: absolute;
|
|
411
411
|
top: 23%;
|
|
412
412
|
box-shadow: 0 0 1px grey;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
.readOnly input {
|
|
416
|
-
caret-color: transparent;
|
|
417
|
-
cursor: default;
|
|
418
|
-
user-select: none;
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
.readOnly.coorpmanager input {
|
|
422
|
-
caret-color: transparent;
|
|
423
|
-
cursor: default;
|
|
424
|
-
user-select: none;
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
.readOnly.coorpmanager:focus-within input::placeholder {
|
|
428
|
-
color: transparent !important;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
.readOnly.coorpmanager:focus-within .title.noValue {
|
|
432
|
-
font-size: 14px !important;
|
|
433
|
-
font-weight: 500 !important;
|
|
434
|
-
color: cm_grey_700 !important;
|
|
435
|
-
top: 14px !important;
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
.readOnly.coorpmanager input:hover {
|
|
439
|
-
background-color: cm_grey_100 !important;
|
|
440
|
-
}
|
|
413
|
+
}
|
|
@@ -10,7 +10,6 @@ declare namespace InputTextWithTitle {
|
|
|
10
10
|
placeholder: PropTypes.Requireable<string>;
|
|
11
11
|
defaultValue: PropTypes.Requireable<string>;
|
|
12
12
|
disabled: PropTypes.Requireable<boolean>;
|
|
13
|
-
readOnly: PropTypes.Requireable<boolean>;
|
|
14
13
|
value: PropTypes.Requireable<string>;
|
|
15
14
|
hint: PropTypes.Requireable<string>;
|
|
16
15
|
error: PropTypes.Requireable<string>;
|
|
@@ -7,7 +7,6 @@ declare namespace InputTextarea {
|
|
|
7
7
|
const name: PropTypes.Requireable<string>;
|
|
8
8
|
const theme: PropTypes.Requireable<string>;
|
|
9
9
|
const disabled: PropTypes.Requireable<boolean>;
|
|
10
|
-
const readOnly: PropTypes.Requireable<boolean>;
|
|
11
10
|
const value: PropTypes.Requireable<string>;
|
|
12
11
|
const hint: PropTypes.Requireable<string>;
|
|
13
12
|
const error: PropTypes.Requireable<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/input-textarea/index.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/input-textarea/index.js"],"names":[],"mappings":";AAkBA,wDAgEC"}
|
|
@@ -7,7 +7,6 @@ import classnames from 'classnames';
|
|
|
7
7
|
import { NovaSolidStatusCheckCircle2 as CheckIcon, NovaSolidStatusClose as ErrorIcon, NovaCompositionCoorpacademyInformationIcon as InfoIcon } from '@coorpacademy/nova-icons';
|
|
8
8
|
import getClassState from '../../util/get-class-state';
|
|
9
9
|
import style from './style.css';
|
|
10
|
-
import { v5 as uuidV5 } from 'uuid';
|
|
11
10
|
const themeStyle = {
|
|
12
11
|
setup: style.setup,
|
|
13
12
|
coorpmanager: style.coorpmanager,
|
|
@@ -27,7 +26,6 @@ const InputTextarea = props => {
|
|
|
27
26
|
valid,
|
|
28
27
|
description,
|
|
29
28
|
disabled,
|
|
30
|
-
readOnly = false,
|
|
31
29
|
modified = false
|
|
32
30
|
} = props;
|
|
33
31
|
const mainClass = themeStyle[theme];
|
|
@@ -58,17 +56,15 @@ const InputTextarea = props => {
|
|
|
58
56
|
className: style.leftIcon
|
|
59
57
|
}) : null;
|
|
60
58
|
return /*#__PURE__*/React.createElement("div", {
|
|
61
|
-
className: classnames(mainClass, className, disabled && style.disabled
|
|
59
|
+
className: classnames(mainClass, className, disabled && style.disabled)
|
|
62
60
|
}, /*#__PURE__*/React.createElement("label", null, /*#__PURE__*/React.createElement("span", {
|
|
63
61
|
className: classnames(style.title, _isEmpty(value) && style.noValue)
|
|
64
62
|
}, propsTitle, toolTipView), /*#__PURE__*/React.createElement("textarea", {
|
|
65
|
-
id: uuidV5('textarea-', uuidV5.URL),
|
|
66
63
|
name: name,
|
|
67
64
|
value: value,
|
|
68
65
|
placeholder: placeholder,
|
|
69
66
|
onChange: handleChange,
|
|
70
67
|
disabled: disabled,
|
|
71
|
-
readOnly: readOnly,
|
|
72
68
|
"data-testid": name
|
|
73
69
|
}), errorIconView, validIconView, hintView), descriptionView);
|
|
74
70
|
};
|
|
@@ -78,7 +74,6 @@ InputTextarea.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
78
74
|
name: PropTypes.string,
|
|
79
75
|
theme: PropTypes.oneOf(_keys(themeStyle)),
|
|
80
76
|
disabled: PropTypes.bool,
|
|
81
|
-
readOnly: PropTypes.bool,
|
|
82
77
|
value: PropTypes.string,
|
|
83
78
|
hint: PropTypes.string,
|
|
84
79
|
error: PropTypes.string,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useMemo","PropTypes","classnames","NovaSolidStatusCheckCircle2","CheckIcon","NovaSolidStatusClose","ErrorIcon","NovaCompositionCoorpacademyInformationIcon","InfoIcon","getClassState","style","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useMemo","PropTypes","classnames","NovaSolidStatusCheckCircle2","CheckIcon","NovaSolidStatusClose","ErrorIcon","NovaCompositionCoorpacademyInformationIcon","InfoIcon","getClassState","style","themeStyle","setup","coorpmanager","cockpit","default","defaultStyle","InputTextarea","props","title","propsTitle","name","placeholder","value","hint","theme","onChange","_noop","error","valid","description","disabled","modified","mainClass","className","handleChange","e","target","descriptionView","createElement","toolTipView","infoIconWrapper","infoIcon","descriptionLabel","hintView","dangerouslySetInnerHTML","__html","errorIconView","leftIcon","validIconView","_isEmpty","noValue","propTypes","process","env","NODE_ENV","string","oneOf","_keys","bool","func"],"sources":["../../../src/atom/input-textarea/index.js"],"sourcesContent":["import React, {useMemo} from 'react';\nimport PropTypes from 'prop-types';\nimport {noop, keys, isEmpty} from 'lodash/fp';\nimport classnames from 'classnames';\nimport {\n NovaSolidStatusCheckCircle2 as CheckIcon,\n NovaSolidStatusClose as ErrorIcon,\n NovaCompositionCoorpacademyInformationIcon as InfoIcon\n} from '@coorpacademy/nova-icons';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst themeStyle = {\n setup: style.setup,\n coorpmanager: style.coorpmanager,\n cockpit: style.cockpit,\n default: style.defaultStyle\n};\nconst InputTextarea = props => {\n const {\n title: propsTitle,\n name,\n placeholder,\n value,\n hint,\n theme = 'default',\n onChange = noop,\n error,\n valid,\n description,\n disabled,\n modified = false\n } = props;\n\n const mainClass = themeStyle[theme];\n const className = getClassState(style.defaultStyle, style.modified, style.error, modified, error);\n const handleChange = useMemo(() => e => onChange(e.target.value), [onChange]);\n\n const descriptionView =\n description && theme !== 'coorpmanager' ? (\n <div className={style.description}>{description}</div>\n ) : null;\n const toolTipView =\n description && theme === 'coorpmanager' ? (\n <div className={style.infoIconWrapper}>\n <InfoIcon className={style.infoIcon} />\n <div className={style.descriptionLabel}>{description}</div>\n </div>\n ) : null;\n const hintView =\n theme === 'coorpmanager' ? (\n <div\n className={style.hint}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: error || hint}}\n />\n ) : null;\n const errorIconView = error ? <ErrorIcon className={style.leftIcon} /> : null;\n const validIconView = valid ? <CheckIcon className={style.leftIcon} /> : null;\n\n return (\n <div className={classnames(mainClass, className, disabled && style.disabled)}>\n <label>\n <span className={classnames(style.title, isEmpty(value) && style.noValue)}>\n {propsTitle}\n {toolTipView}\n </span>\n <textarea\n name={name}\n value={value}\n placeholder={placeholder}\n onChange={handleChange}\n disabled={disabled}\n data-testid={name}\n />\n {errorIconView}\n {validIconView}\n {hintView}\n </label>\n {descriptionView}\n </div>\n );\n};\n\nInputTextarea.propTypes = {\n placeholder: PropTypes.string,\n title: PropTypes.string,\n name: PropTypes.string,\n theme: PropTypes.oneOf(keys(themeStyle)),\n disabled: PropTypes.bool,\n value: PropTypes.string,\n hint: PropTypes.string,\n error: PropTypes.string,\n onChange: PropTypes.func,\n description: PropTypes.string,\n modified: PropTypes.bool,\n valid: PropTypes.bool\n};\nexport default InputTextarea;\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAGC,OAAO,QAAO,OAAO;AACpC,OAAOC,SAAS,MAAM,YAAY;AAElC,OAAOC,UAAU,MAAM,YAAY;AACnC,SACEC,2BAA2B,IAAIC,SAAS,EACxCC,oBAAoB,IAAIC,SAAS,EACjCC,0CAA0C,IAAIC,QAAQ,QACjD,0BAA0B;AACjC,OAAOC,aAAa,MAAM,4BAA4B;AACtD,OAAOC,KAAK,MAAM,aAAa;AAE/B,MAAMC,UAAU,GAAG;EACjBC,KAAK,EAAEF,KAAK,CAACE,KAAK;EAClBC,YAAY,EAAEH,KAAK,CAACG,YAAY;EAChCC,OAAO,EAAEJ,KAAK,CAACI,OAAO;EACtBC,OAAO,EAAEL,KAAK,CAACM;AACjB,CAAC;AACD,MAAMC,aAAa,GAAGC,KAAK,IAAI;EAC7B,MAAM;IACJC,KAAK,EAAEC,UAAU;IACjBC,IAAI;IACJC,WAAW;IACXC,KAAK;IACLC,IAAI;IACJC,KAAK,GAAG,SAAS;IACjBC,QAAQ,GAAAC,KAAO;IACfC,KAAK;IACLC,KAAK;IACLC,WAAW;IACXC,QAAQ;IACRC,QAAQ,GAAG;EACb,CAAC,GAAGd,KAAK;EAET,MAAMe,SAAS,GAAGtB,UAAU,CAACc,KAAK,CAAC;EACnC,MAAMS,SAAS,GAAGzB,aAAa,CAACC,KAAK,CAACM,YAAY,EAAEN,KAAK,CAACsB,QAAQ,EAAEtB,KAAK,CAACkB,KAAK,EAAEI,QAAQ,EAAEJ,KAAK,CAAC;EACjG,MAAMO,YAAY,GAAGnC,OAAO,CAAC,MAAMoC,CAAC,IAAIV,QAAQ,CAACU,CAAC,CAACC,MAAM,CAACd,KAAK,CAAC,EAAE,CAACG,QAAQ,CAAC,CAAC;EAE7E,MAAMY,eAAe,GACnBR,WAAW,IAAIL,KAAK,KAAK,cAAc,gBACrC1B,KA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EAAE,GACvE/B,UAAU,EACVoB,WACG,CAAC,eACPzC,KAAA,CAAAwC,aAAA;IACElB,IAAI,EAAEA,IAAK;IACXE,KAAK,EAAEA,KAAM;IACbD,WAAW,EAAEA,WAAY;IACzBI,QAAQ,EAAES,YAAa;IACvBJ,QAAQ,EAAEA,QAAS;IACnB,eAAaV;EAAK,CACnB,CAAC,EACD0B,aAAa,EACbE,aAAa,EACbL,QACI,CAAC,EACPN,eACE,CAAC;AAEV,CAAC;AAEDrB,aAAa,CAACmC,SAAS,GAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAG;EACxBjC,WAAW,EAAErB,SAAS,CAACuD,MAAM;EAC7BrC,KAAK,EAAElB,SAAS,CAACuD,MAAM;EACvBnC,IAAI,EAAEpB,SAAS,CAACuD,MAAM;EACtB/B,KAAK,EAAExB,SAAS,CAACwD,KAAK,CAACC,KAAA,CAAK/C,UAAU,CAAC,CAAC;EACxCoB,QAAQ,EAAE9B,SAAS,CAAC0D,IAAI;EACxBpC,KAAK,EAAEtB,SAAS,CAACuD,MAAM;EACvBhC,IAAI,EAAEvB,SAAS,CAACuD,MAAM;EACtB5B,KAAK,EAAE3B,SAAS,CAACuD,MAAM;EACvB9B,QAAQ,EAAEzB,SAAS,CAAC2D,IAAI;EACxB9B,WAAW,EAAE7B,SAAS,CAACuD,MAAM;EAC7BxB,QAAQ,EAAE/B,SAAS,CAAC0D,IAAI;EACxB9B,KAAK,EAAE5B,SAAS,CAAC0D;AACnB,CAAC;AACD,eAAe1C,aAAa","ignoreList":[]}
|
|
@@ -25,10 +25,6 @@
|
|
|
25
25
|
composes: defaultStyle;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
.readonly {
|
|
29
|
-
composes: defaultStyle;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
28
|
.defaultStyle label {
|
|
33
29
|
display: flex;
|
|
34
30
|
align-items: center;
|
|
@@ -60,15 +56,6 @@
|
|
|
60
56
|
resize: none;
|
|
61
57
|
}
|
|
62
58
|
|
|
63
|
-
.readonly textarea {
|
|
64
|
-
user-select: none;
|
|
65
|
-
-webkit-user-select: none;
|
|
66
|
-
-moz-user-select: none;
|
|
67
|
-
-ms-user-select: none;
|
|
68
|
-
cursor: default;
|
|
69
|
-
caret-color: transparent;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
59
|
.error textarea {
|
|
73
60
|
border-color: negative;
|
|
74
61
|
}
|
|
@@ -366,30 +353,6 @@
|
|
|
366
353
|
opacity: 0.5;
|
|
367
354
|
}
|
|
368
355
|
|
|
369
|
-
.coorpmanager.readonly textarea {
|
|
370
|
-
user-select: none;
|
|
371
|
-
-webkit-user-select: none;
|
|
372
|
-
-moz-user-select: none;
|
|
373
|
-
-ms-user-select: none;
|
|
374
|
-
cursor: default;
|
|
375
|
-
caret-color: transparent;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
.coorpmanager.readonly:focus-within textarea::placeholder {
|
|
379
|
-
color: transparent !important;
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
.coorpmanager.readonly:focus-within .title.noValue {
|
|
383
|
-
font-size: 14px !important;
|
|
384
|
-
font-weight: 500 !important;
|
|
385
|
-
color: cm_grey_700 !important;
|
|
386
|
-
top: auto !important;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
.coorpmanager.readonly label:hover:before {
|
|
390
|
-
background-color: cm_grey_100 !important;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
356
|
.coorpmanager .infoIconWrapper {
|
|
394
357
|
overflow: visible;
|
|
395
358
|
height: 12px;
|
|
@@ -46,7 +46,6 @@ declare namespace Select {
|
|
|
46
46
|
className: PropTypes.Requireable<string>;
|
|
47
47
|
borderClassName: PropTypes.Requireable<string>;
|
|
48
48
|
disabled: PropTypes.Requireable<boolean>;
|
|
49
|
-
readOnly: PropTypes.Requireable<boolean>;
|
|
50
49
|
multiple: PropTypes.Requireable<boolean>;
|
|
51
50
|
description: PropTypes.Requireable<string>;
|
|
52
51
|
required: PropTypes.Requireable<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/select/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAwDA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/select/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAwDA,qEAkMC"}
|
package/es/atom/select/index.js
CHANGED
|
@@ -61,7 +61,6 @@ const Select = (props, legacyContext) => {
|
|
|
61
61
|
onChange,
|
|
62
62
|
multiple = false,
|
|
63
63
|
disabled,
|
|
64
|
-
readOnly,
|
|
65
64
|
required,
|
|
66
65
|
description,
|
|
67
66
|
theme,
|
|
@@ -74,17 +73,8 @@ const Select = (props, legacyContext) => {
|
|
|
74
73
|
const skin = GetSkinFromContext(legacyContext);
|
|
75
74
|
const title = useMemo(() => propTitle ? `${propTitle}${required ? '*' : ''}` : null, [propTitle, required]);
|
|
76
75
|
const [isArrowUp, setIsArrowUp] = useState(false);
|
|
77
|
-
const
|
|
78
|
-
const
|
|
79
|
-
if (!isNonInteractive) {
|
|
80
|
-
setIsArrowUp(true);
|
|
81
|
-
}
|
|
82
|
-
}, [isNonInteractive]);
|
|
83
|
-
const handleSelectOnBlur = useCallback(() => {
|
|
84
|
-
if (!isNonInteractive) {
|
|
85
|
-
setIsArrowUp(false);
|
|
86
|
-
}
|
|
87
|
-
}, [isNonInteractive]);
|
|
76
|
+
const handleSelectOnFocus = useCallback(() => setIsArrowUp(true), []);
|
|
77
|
+
const handleSelectOnBlur = useCallback(() => setIsArrowUp(false), []);
|
|
88
78
|
const selectOption = (option, index) => {
|
|
89
79
|
return /*#__PURE__*/React.createElement("option", {
|
|
90
80
|
key: index,
|
|
@@ -116,23 +106,19 @@ const Select = (props, legacyContext) => {
|
|
|
116
106
|
selected: true
|
|
117
107
|
}, options)), [options, theme]);
|
|
118
108
|
const handleChange = useMemo(() => multiple ? e => {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
onChange(map(get('value'), e.target.selectedOptions));
|
|
122
|
-
}
|
|
109
|
+
setIsArrowUp(false);
|
|
110
|
+
onChange(map(get('value'), e.target.selectedOptions));
|
|
123
111
|
} : e => {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
}, [onChange, multiple, isNonInteractive]);
|
|
112
|
+
setIsArrowUp(false);
|
|
113
|
+
onChange(e.target.value);
|
|
114
|
+
}, [onChange, multiple]);
|
|
129
115
|
const black = useMemo(() => getOr('#14171A', 'common.black', skin), [skin]);
|
|
130
116
|
const color = useMemo(() => getOr('#00B0FF', 'common.primary', skin), [skin]);
|
|
131
117
|
const isThemeOneOfQuestionTemplateOrPlayer = useMemo(() => includes(theme, ['question', 'template', 'player']), [theme]);
|
|
132
118
|
const shouldUseSkinFontColor = useMemo(() => !isSelectedInValidOption && selected && isThemeOneOfQuestionTemplateOrPlayer, [isSelectedInValidOption, selected, isThemeOneOfQuestionTemplateOrPlayer]);
|
|
133
119
|
const arrowColor = selected ? color : undefined;
|
|
134
120
|
const behaviorClassName = useMemo(() => getClassState(style.defaultStyle, style.modified, style.error, modified, error), [error, modified]);
|
|
135
|
-
const composedClassName = useMemo(() => classnames(theme && theme !== 'coorpmanager' ? themeStyle[theme] : behaviorClassName, selected ? style.selected : style.unselected,
|
|
121
|
+
const composedClassName = useMemo(() => classnames(theme && theme !== 'coorpmanager' ? themeStyle[theme] : behaviorClassName, selected ? style.selected : style.unselected, className), [behaviorClassName, className, selected, theme]);
|
|
136
122
|
const labelSize = useMemo(() => size(selectedLabel), [selectedLabel]);
|
|
137
123
|
const isLongLabel = useMemo(() => labelSize >= 65, [labelSize]);
|
|
138
124
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -176,13 +162,13 @@ const Select = (props, legacyContext) => {
|
|
|
176
162
|
value: selected,
|
|
177
163
|
multiple: multiple,
|
|
178
164
|
disabled: disabled,
|
|
179
|
-
onClick:
|
|
180
|
-
onBlur:
|
|
165
|
+
onClick: handleSelectOnFocus,
|
|
166
|
+
onBlur: handleSelectOnBlur
|
|
181
167
|
// onBlur does not handle completely an out of bounds click
|
|
182
168
|
// ex: select is Opened and a click is done outside, cancelling the select
|
|
183
169
|
// that doesn't count as a Blur, so an onMouseLeave is needed
|
|
184
170
|
,
|
|
185
|
-
onMouseLeave:
|
|
171
|
+
onMouseLeave: handleSelectOnBlur,
|
|
186
172
|
"data-testid": "native-select"
|
|
187
173
|
}), optionList)), /*#__PURE__*/React.createElement("div", {
|
|
188
174
|
className: style.description
|
|
@@ -207,7 +193,6 @@ Select.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
207
193
|
className: PropTypes.string,
|
|
208
194
|
borderClassName: PropTypes.string,
|
|
209
195
|
disabled: PropTypes.bool,
|
|
210
|
-
readOnly: PropTypes.bool,
|
|
211
196
|
multiple: PropTypes.bool,
|
|
212
197
|
description: PropTypes.string,
|
|
213
198
|
required: PropTypes.bool,
|