@coorpacademy/components 11.33.13 → 11.33.14
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-icon/index.js +4 -4
- package/es/atom/button-link-icon/index.js.map +1 -1
- package/es/atom/button-menu/index.d.ts +1 -0
- package/es/atom/button-menu/index.d.ts.map +1 -1
- package/es/atom/button-menu/index.js +37 -22
- package/es/atom/button-menu/index.js.map +1 -1
- package/es/atom/button-menu/style.css +0 -10
- package/es/atom/button-menu/types.d.ts +7 -7
- package/es/atom/button-menu/types.d.ts.map +1 -1
- package/es/atom/button-menu/types.js +4 -1
- package/es/atom/button-menu/types.js.map +1 -1
- package/es/atom/button-menu/utils.d.ts +23 -0
- package/es/atom/button-menu/utils.d.ts.map +1 -0
- package/es/atom/button-menu/utils.js +24 -0
- package/es/atom/button-menu/utils.js.map +1 -0
- package/es/atom/icon/index.d.ts +16 -0
- package/es/atom/icon/index.d.ts.map +1 -1
- package/es/atom/icon/index.js +3 -2
- package/es/atom/icon/index.js.map +1 -1
- package/es/molecule/bullet-point-menu-button/index.d.ts +2 -0
- package/es/molecule/bullet-point-menu-button/index.d.ts.map +1 -1
- package/es/molecule/bullet-point-menu-button/index.js +5 -3
- package/es/molecule/bullet-point-menu-button/index.js.map +1 -1
- package/es/molecule/bullet-point-menu-button/types.d.ts +3 -0
- package/es/molecule/bullet-point-menu-button/types.d.ts.map +1 -1
- package/es/molecule/bullet-point-menu-button/types.js +1 -0
- package/es/molecule/bullet-point-menu-button/types.js.map +1 -1
- package/es/molecule/button-menu-action/index.d.ts +1 -0
- package/es/molecule/button-menu-action/index.d.ts.map +1 -1
- package/es/molecule/button-menu-action/types.d.ts +1 -0
- package/es/molecule/button-menu-action/types.d.ts.map +1 -1
- package/es/molecule/cm-popin/index.d.ts.map +1 -1
- package/es/molecule/cm-popin/index.js +94 -76
- package/es/molecule/cm-popin/index.js.map +1 -1
- package/es/molecule/cm-popin/style.css +18 -23
- package/es/molecule/cm-popin/types.d.ts +24 -2
- package/es/molecule/cm-popin/types.d.ts.map +1 -1
- package/es/molecule/cm-popin/types.js +6 -5
- package/es/molecule/cm-popin/types.js.map +1 -1
- package/es/molecule/draggable-list/index.d.ts +1 -0
- package/es/molecule/expandible-actionable-table/index.d.ts +4 -0
- package/es/molecule/expandible-actionable-table/index.d.ts.map +1 -1
- package/es/molecule/expandible-actionable-table/types.d.ts +4 -0
- package/es/molecule/expandible-actionable-table/types.d.ts.map +1 -1
- package/es/organism/brand-learning-priorities/index.d.ts +1 -0
- package/es/organism/header-with-actions/index.d.ts +2 -0
- package/es/organism/header-with-actions/index.d.ts.map +1 -1
- package/es/organism/header-with-actions/types.d.ts +2 -0
- package/es/organism/header-with-actions/types.d.ts.map +1 -1
- package/es/organism/list-item/index.d.ts +3 -1
- package/es/organism/list-item/index.d.ts.map +1 -1
- package/es/organism/list-item/index.js +11 -3
- package/es/organism/list-item/index.js.map +1 -1
- package/es/organism/list-items/index.d.ts +7 -0
- package/es/organism/list-items/index.d.ts.map +1 -1
- package/es/organism/list-items/index.js +2 -1
- package/es/organism/list-items/index.js.map +1 -1
- package/es/organism/wizard-contents/index.d.ts +4 -0
- package/es/template/app-player/loading/index.d.ts +22 -1
- package/es/template/app-player/player/index.d.ts +44 -2
- package/es/template/app-player/player/slides/index.d.ts +22 -1
- package/es/template/app-player/player/slides/index.d.ts.map +1 -1
- package/es/template/app-player/popin-correction/index.d.ts +22 -1
- package/es/template/app-player/popin-correction/index.d.ts.map +1 -1
- package/es/template/app-player/popin-end/index.d.ts +22 -1
- package/es/template/app-review/index.d.ts +22 -1
- package/es/template/app-review/index.d.ts.map +1 -1
- package/es/template/app-review/player/prop-types.d.ts +22 -1
- package/es/template/app-review/player/prop-types.d.ts.map +1 -1
- package/es/template/app-review/prop-types.d.ts +22 -1
- package/es/template/app-review/prop-types.d.ts.map +1 -1
- package/es/template/back-office/brand-update/index.d.ts +35 -1
- package/es/template/back-office/brand-update/index.d.ts.map +1 -1
- package/es/template/back-office/brand-update/index.js +22 -3
- package/es/template/back-office/brand-update/index.js.map +1 -1
- package/es/template/back-office/brand-update/style.css +1 -0
- package/es/template/back-office/brand-update/utils.d.ts +79 -0
- package/es/template/back-office/brand-update/utils.d.ts.map +1 -0
- package/es/template/back-office/brand-update/utils.js +60 -0
- package/es/template/back-office/brand-update/utils.js.map +1 -0
- package/es/template/common/dashboard/index.d.ts +44 -2
- package/es/template/common/search-page/index.d.ts +22 -1
- package/es/template/external-course/index.d.ts +22 -1
- package/es/variables/colors.css +5 -0
- package/es/variables/colors.d.ts +4 -0
- package/es/variables/colors.d.ts.map +1 -1
- package/es/variables/colors.js +5 -1
- package/es/variables/colors.js.map +1 -1
- package/lib/atom/button-link-icon/index.js +4 -4
- package/lib/atom/button-link-icon/index.js.map +1 -1
- package/lib/atom/button-menu/index.d.ts +1 -0
- package/lib/atom/button-menu/index.d.ts.map +1 -1
- package/lib/atom/button-menu/index.js +38 -23
- package/lib/atom/button-menu/index.js.map +1 -1
- package/lib/atom/button-menu/style.css +0 -10
- package/lib/atom/button-menu/types.d.ts +7 -7
- package/lib/atom/button-menu/types.d.ts.map +1 -1
- package/lib/atom/button-menu/types.js +4 -1
- package/lib/atom/button-menu/types.js.map +1 -1
- package/lib/atom/button-menu/utils.d.ts +23 -0
- package/lib/atom/button-menu/utils.d.ts.map +1 -0
- package/lib/atom/button-menu/utils.js +28 -0
- package/lib/atom/button-menu/utils.js.map +1 -0
- package/lib/atom/icon/index.d.ts +16 -0
- package/lib/atom/icon/index.d.ts.map +1 -1
- package/lib/atom/icon/index.js +4 -3
- package/lib/atom/icon/index.js.map +1 -1
- package/lib/molecule/bullet-point-menu-button/index.d.ts +2 -0
- package/lib/molecule/bullet-point-menu-button/index.d.ts.map +1 -1
- package/lib/molecule/bullet-point-menu-button/index.js +5 -3
- package/lib/molecule/bullet-point-menu-button/index.js.map +1 -1
- package/lib/molecule/bullet-point-menu-button/types.d.ts +3 -0
- package/lib/molecule/bullet-point-menu-button/types.d.ts.map +1 -1
- package/lib/molecule/bullet-point-menu-button/types.js +1 -0
- package/lib/molecule/bullet-point-menu-button/types.js.map +1 -1
- package/lib/molecule/button-menu-action/index.d.ts +1 -0
- package/lib/molecule/button-menu-action/index.d.ts.map +1 -1
- package/lib/molecule/button-menu-action/types.d.ts +1 -0
- package/lib/molecule/button-menu-action/types.d.ts.map +1 -1
- package/lib/molecule/cm-popin/index.d.ts.map +1 -1
- package/lib/molecule/cm-popin/index.js +92 -75
- package/lib/molecule/cm-popin/index.js.map +1 -1
- package/lib/molecule/cm-popin/style.css +18 -23
- package/lib/molecule/cm-popin/types.d.ts +24 -2
- package/lib/molecule/cm-popin/types.d.ts.map +1 -1
- package/lib/molecule/cm-popin/types.js +2 -1
- package/lib/molecule/cm-popin/types.js.map +1 -1
- package/lib/molecule/draggable-list/index.d.ts +1 -0
- package/lib/molecule/expandible-actionable-table/index.d.ts +4 -0
- package/lib/molecule/expandible-actionable-table/index.d.ts.map +1 -1
- package/lib/molecule/expandible-actionable-table/types.d.ts +4 -0
- package/lib/molecule/expandible-actionable-table/types.d.ts.map +1 -1
- package/lib/organism/brand-learning-priorities/index.d.ts +1 -0
- package/lib/organism/header-with-actions/index.d.ts +2 -0
- package/lib/organism/header-with-actions/index.d.ts.map +1 -1
- package/lib/organism/header-with-actions/types.d.ts +2 -0
- package/lib/organism/header-with-actions/types.d.ts.map +1 -1
- package/lib/organism/list-item/index.d.ts +3 -1
- package/lib/organism/list-item/index.d.ts.map +1 -1
- package/lib/organism/list-item/index.js +11 -3
- package/lib/organism/list-item/index.js.map +1 -1
- package/lib/organism/list-items/index.d.ts +7 -0
- package/lib/organism/list-items/index.d.ts.map +1 -1
- package/lib/organism/list-items/index.js +2 -1
- package/lib/organism/list-items/index.js.map +1 -1
- package/lib/organism/wizard-contents/index.d.ts +4 -0
- package/lib/template/app-player/loading/index.d.ts +22 -1
- package/lib/template/app-player/player/index.d.ts +44 -2
- package/lib/template/app-player/player/slides/index.d.ts +22 -1
- package/lib/template/app-player/player/slides/index.d.ts.map +1 -1
- package/lib/template/app-player/popin-correction/index.d.ts +22 -1
- package/lib/template/app-player/popin-correction/index.d.ts.map +1 -1
- package/lib/template/app-player/popin-end/index.d.ts +22 -1
- package/lib/template/app-review/index.d.ts +22 -1
- package/lib/template/app-review/index.d.ts.map +1 -1
- package/lib/template/app-review/player/prop-types.d.ts +22 -1
- package/lib/template/app-review/player/prop-types.d.ts.map +1 -1
- package/lib/template/app-review/prop-types.d.ts +22 -1
- package/lib/template/app-review/prop-types.d.ts.map +1 -1
- package/lib/template/back-office/brand-update/index.d.ts +35 -1
- package/lib/template/back-office/brand-update/index.d.ts.map +1 -1
- package/lib/template/back-office/brand-update/index.js +22 -3
- package/lib/template/back-office/brand-update/index.js.map +1 -1
- package/lib/template/back-office/brand-update/style.css +1 -0
- package/lib/template/back-office/brand-update/utils.d.ts +79 -0
- package/lib/template/back-office/brand-update/utils.d.ts.map +1 -0
- package/lib/template/back-office/brand-update/utils.js +64 -0
- package/lib/template/back-office/brand-update/utils.js.map +1 -0
- package/lib/template/common/dashboard/index.d.ts +44 -2
- package/lib/template/common/search-page/index.d.ts +22 -1
- package/lib/template/external-course/index.d.ts +22 -1
- package/lib/variables/colors.css +5 -0
- package/lib/variables/colors.d.ts +4 -0
- package/lib/variables/colors.d.ts.map +1 -1
- package/lib/variables/colors.js +5 -1
- package/lib/variables/colors.js.map +1 -1
- package/package.json +2 -2
|
@@ -41,7 +41,7 @@ const ButtonLinkIcon = props => {
|
|
|
41
41
|
disabled,
|
|
42
42
|
icon,
|
|
43
43
|
faIcon,
|
|
44
|
-
'data-name': dataName,
|
|
44
|
+
'data-name': dataName = 'button-icon',
|
|
45
45
|
'aria-label': ariaLabel,
|
|
46
46
|
link,
|
|
47
47
|
onClick,
|
|
@@ -68,7 +68,7 @@ const ButtonLinkIcon = props => {
|
|
|
68
68
|
className: style.tooltipContentWrapper
|
|
69
69
|
}, ariaLabel), [ariaLabel]);
|
|
70
70
|
const Button = useCallback(() => link ? /*#__PURE__*/React.createElement(Link, _extends({}, link, ariaLabel ? {
|
|
71
|
-
'data-for':
|
|
71
|
+
'data-for': dataName,
|
|
72
72
|
'data-tip': toolTipIsVisible
|
|
73
73
|
} : {}, {
|
|
74
74
|
className: styleButton,
|
|
@@ -77,7 +77,7 @@ const ButtonLinkIcon = props => {
|
|
|
77
77
|
onMouseEnter: handleMouseOver,
|
|
78
78
|
onMouseLeave: handleMouseLeave
|
|
79
79
|
}), contentView) : /*#__PURE__*/React.createElement("button", _extends({}, ariaLabel ? {
|
|
80
|
-
'data-for':
|
|
80
|
+
'data-for': dataName,
|
|
81
81
|
'data-tip': toolTipIsVisible
|
|
82
82
|
} : {}, {
|
|
83
83
|
type: "button",
|
|
@@ -92,7 +92,7 @@ const ButtonLinkIcon = props => {
|
|
|
92
92
|
}), contentView), [link, ariaLabel, className, contentView, dataName, disabled, handleMouseLeave, handleMouseOver, handleOnClick, styleButton, toolTipIsVisible]);
|
|
93
93
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, null), ariaLabel ? /*#__PURE__*/React.createElement(ToolTip, {
|
|
94
94
|
fontSize: 12,
|
|
95
|
-
anchorId:
|
|
95
|
+
anchorId: dataName,
|
|
96
96
|
toolTipIsVisible: toolTipIsVisible,
|
|
97
97
|
placement: tooltipPlacement,
|
|
98
98
|
TooltipContent: TooltipContent,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useState","useCallback","useRef","PropTypes","classnames","ICONS","FaIcon","Link","ToolTip","style","getButtonContent","icon","faIcon","Icon","_getOr","createElement","className","buttonContent","iconName","getSizeStyle","size","small","responsive","defaultStyle","ButtonLinkIcon","props","disabled","dataName","ariaLabel","link","onClick","tooltipPlacement","toolTipIsVisible","setToolTipIsVisible","timer","contentView","styleButton","handleOnClick","handleMouseOver","current","clearTimeout","setTimeout","undefined","handleMouseLeave","TooltipContent","tooltipContentWrapper","Button","_extends","onMouseEnter","onMouseLeave","type","onMouseOver","Fragment","fontSize","anchorId","placement","closeToolTipInformationTextAriaLabel","propTypes","process","env","NODE_ENV","oneOf","string","_keys","func","shape","href","download","bool","target"],"sources":["../../../src/atom/button-link-icon/index.js"],"sourcesContent":["import React, {useState, useCallback, useRef} from 'react';\nimport PropTypes from 'prop-types';\nimport {getOr, keys} from 'lodash/fp';\nimport classnames from 'classnames';\nimport {ICONS} from '../../util/button-icons';\nimport FaIcon from '../icon';\nimport Link from '../link';\nimport ToolTip from '../tooltip';\n// eslint-disable-next-line css-modules/no-unused-class\nimport style from './style.css';\n\nconst getButtonContent = (icon, faIcon) => {\n const Icon = getOr(null, icon, ICONS);\n\n if (!Icon && !faIcon) {\n return <div className={style.buttonContent} />;\n }\n\n return (\n <div className={style.buttonContent}>\n {faIcon ? <FaIcon iconName={faIcon} /> : <Icon className={style.icon} />}\n </div>\n );\n};\n\nconst getSizeStyle = size => {\n switch (size) {\n case 'small':\n return style.small;\n case 'responsive':\n return style.responsive;\n default:\n return style.defaultStyle;\n }\n};\n\nconst ButtonLinkIcon = props => {\n const {\n size = 'default',\n disabled,\n icon,\n faIcon,\n 'data-name': dataName,\n 'aria-label': ariaLabel,\n link,\n onClick,\n className,\n tooltipPlacement = 'left'\n } = props;\n const [toolTipIsVisible, setToolTipIsVisible] = useState(false);\n const timer = useRef();\n\n const contentView = getButtonContent(icon, faIcon);\n const styleButton = classnames(\n getSizeStyle(size),\n link && style.link,\n disabled && style.disabled,\n className\n );\n\n const handleOnClick = useCallback(() => onClick(), [onClick]);\n\n const handleMouseOver = useCallback(() => {\n timer.current && clearTimeout(timer.current);\n timer.current = setTimeout(() => {\n setToolTipIsVisible(true);\n timer.current = undefined;\n }, 300);\n }, [timer, setToolTipIsVisible]);\n\n const handleMouseLeave = useCallback(() => {\n timer.current && clearTimeout(timer.current);\n setToolTipIsVisible(false);\n }, [timer, setToolTipIsVisible]);\n\n const TooltipContent = useCallback(\n () => <span className={style.tooltipContentWrapper}>{ariaLabel}</span>,\n [ariaLabel]\n );\n\n const Button = useCallback(\n () =>\n link ? (\n <Link\n {...link}\n {...(ariaLabel\n ? {\n 'data-for':
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useState","useCallback","useRef","PropTypes","classnames","ICONS","FaIcon","Link","ToolTip","style","getButtonContent","icon","faIcon","Icon","_getOr","createElement","className","buttonContent","iconName","getSizeStyle","size","small","responsive","defaultStyle","ButtonLinkIcon","props","disabled","dataName","ariaLabel","link","onClick","tooltipPlacement","toolTipIsVisible","setToolTipIsVisible","timer","contentView","styleButton","handleOnClick","handleMouseOver","current","clearTimeout","setTimeout","undefined","handleMouseLeave","TooltipContent","tooltipContentWrapper","Button","_extends","onMouseEnter","onMouseLeave","type","onMouseOver","Fragment","fontSize","anchorId","placement","closeToolTipInformationTextAriaLabel","propTypes","process","env","NODE_ENV","oneOf","string","_keys","func","shape","href","download","bool","target"],"sources":["../../../src/atom/button-link-icon/index.js"],"sourcesContent":["import React, {useState, useCallback, useRef} from 'react';\nimport PropTypes from 'prop-types';\nimport {getOr, keys} from 'lodash/fp';\nimport classnames from 'classnames';\nimport {ICONS} from '../../util/button-icons';\nimport FaIcon from '../icon';\nimport Link from '../link';\nimport ToolTip from '../tooltip';\n// eslint-disable-next-line css-modules/no-unused-class\nimport style from './style.css';\n\nconst getButtonContent = (icon, faIcon) => {\n const Icon = getOr(null, icon, ICONS);\n\n if (!Icon && !faIcon) {\n return <div className={style.buttonContent} />;\n }\n\n return (\n <div className={style.buttonContent}>\n {faIcon ? <FaIcon iconName={faIcon} /> : <Icon className={style.icon} />}\n </div>\n );\n};\n\nconst getSizeStyle = size => {\n switch (size) {\n case 'small':\n return style.small;\n case 'responsive':\n return style.responsive;\n default:\n return style.defaultStyle;\n }\n};\n\nconst ButtonLinkIcon = props => {\n const {\n size = 'default',\n disabled,\n icon,\n faIcon,\n 'data-name': dataName = 'button-icon',\n 'aria-label': ariaLabel,\n link,\n onClick,\n className,\n tooltipPlacement = 'left'\n } = props;\n const [toolTipIsVisible, setToolTipIsVisible] = useState(false);\n const timer = useRef();\n\n const contentView = getButtonContent(icon, faIcon);\n const styleButton = classnames(\n getSizeStyle(size),\n link && style.link,\n disabled && style.disabled,\n className\n );\n\n const handleOnClick = useCallback(() => onClick(), [onClick]);\n\n const handleMouseOver = useCallback(() => {\n timer.current && clearTimeout(timer.current);\n timer.current = setTimeout(() => {\n setToolTipIsVisible(true);\n timer.current = undefined;\n }, 300);\n }, [timer, setToolTipIsVisible]);\n\n const handleMouseLeave = useCallback(() => {\n timer.current && clearTimeout(timer.current);\n setToolTipIsVisible(false);\n }, [timer, setToolTipIsVisible]);\n\n const TooltipContent = useCallback(\n () => <span className={style.tooltipContentWrapper}>{ariaLabel}</span>,\n [ariaLabel]\n );\n\n const Button = useCallback(\n () =>\n link ? (\n <Link\n {...link}\n {...(ariaLabel\n ? {\n 'data-for': dataName,\n 'data-tip': toolTipIsVisible\n }\n : {})}\n className={styleButton}\n data-name={dataName}\n aria-label={ariaLabel}\n onMouseEnter={handleMouseOver}\n onMouseLeave={handleMouseLeave}\n >\n {contentView}\n </Link>\n ) : (\n <button\n {...(ariaLabel\n ? {\n 'data-for': dataName,\n 'data-tip': toolTipIsVisible\n }\n : {})}\n type=\"button\"\n aria-label={ariaLabel}\n data-name={dataName}\n data-testid={`button-${dataName}-${className}`}\n className={styleButton}\n onClick={handleOnClick}\n onMouseLeave={handleMouseLeave}\n onMouseOver={handleMouseOver}\n disabled={disabled}\n >\n {contentView}\n </button>\n ),\n [\n link,\n ariaLabel,\n className,\n contentView,\n dataName,\n disabled,\n handleMouseLeave,\n handleMouseOver,\n handleOnClick,\n styleButton,\n toolTipIsVisible\n ]\n );\n\n return (\n <>\n <Button />\n {ariaLabel ? (\n <ToolTip\n fontSize={12}\n anchorId={dataName}\n toolTipIsVisible={toolTipIsVisible}\n placement={tooltipPlacement}\n TooltipContent={TooltipContent}\n closeToolTipInformationTextAriaLabel={ariaLabel}\n />\n ) : null}\n </>\n );\n};\n\nButtonLinkIcon.propTypes = {\n size: PropTypes.oneOf(['default', 'small', 'responsive']),\n 'aria-label': PropTypes.string,\n 'data-name': PropTypes.string,\n icon: PropTypes.oneOf(keys(ICONS)),\n faIcon: PropTypes.string,\n onClick: PropTypes.func,\n link: PropTypes.shape({\n href: PropTypes.string,\n download: PropTypes.bool,\n target: PropTypes.oneOf(['_self', '_blank', '_parent', '_top'])\n }),\n disabled: PropTypes.bool,\n className: PropTypes.string,\n tooltipPlacement: PropTypes.oneOf(['left', 'right', 'top', 'bottom'])\n};\n\nexport default ButtonLinkIcon;\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAGC,QAAQ,EAAEC,WAAW,EAAEC,MAAM,QAAO,OAAO;AAC1D,OAAOC,SAAS,MAAM,YAAY;AAElC,OAAOC,UAAU,MAAM,YAAY;AACnC,SAAQC,KAAK,QAAO,yBAAyB;AAC7C,OAAOC,MAAM,MAAM,SAAS;AAC5B,OAAOC,IAAI,MAAM,SAAS;AAC1B,OAAOC,OAAO,MAAM,YAAY;AAChC;AACA,OAAOC,KAAK,MAAM,aAAa;AAE/B,MAAMC,gBAAgB,GAAGA,CAACC,IAAI,EAAEC,MAAM,KAAK;EACzC,MAAMC,IAAI,GAAGC,MAAA,CAAM,IAAI,EAAEH,IAAI,EAAEN,KAAK,CAAC;EAErC,IAAI,CAACQ,IAAI,IAAI,CAACD,MAAM,EAAE;IACpB,oBAAOb,KAAA,CAAAgB,aAAA;MAAKC,SAAS,EAAEP,KAAK,CAACQ;IAAc,CAAE,CAAC;EAChD;EAEA,oBACElB,KAAA,CAAAgB,aAAA;IAAKC,SAAS,EAAEP,KAAK,CAACQ;EAAc,GACjCL,MAAM,gBAAGb,KAAA,CAAAgB,aAAA,CAACT,MAAM;IAACY,QAAQ,EAAEN;EAAO,CAAE,CAAC,gBAAGb,KAAA,CAAAgB,aAAA,CAACF,IAAI;IAACG,SAAS,EAAEP,KAAK,CAACE;EAAK,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D,SAAS,EAAEb,SAAS,CAAC2D,MAAM;EAC3B/B,gBAAgB,EAAE5B,SAAS,CAAC0D,KAAK,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC;AACtE,CAAC;AAED,eAAerC,cAAc","ignoreList":[]}
|
|
@@ -11,6 +11,7 @@ declare const ButtonMenu: {
|
|
|
11
11
|
type: import("prop-types").Requireable<string>;
|
|
12
12
|
buttonLinkType: import("prop-types").Requireable<string>;
|
|
13
13
|
icon: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
14
|
+
theme: import("prop-types").Requireable<string>;
|
|
14
15
|
position: import("prop-types").Requireable<string>;
|
|
15
16
|
type: import("prop-types").Requireable<string>;
|
|
16
17
|
faIcon: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/button-menu/index.tsx"],"names":[],"mappings":";
|
|
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;AAgEjF,QAAA,MAAM,UAAU;YAAW,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiBzC,CAAC;AAIF,eAAe,UAAU,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _noop from "lodash/fp/noop";
|
|
1
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
3
|
import React, { useMemo, useCallback } from 'react';
|
|
3
4
|
import map from 'lodash/fp/map';
|
|
@@ -5,44 +6,58 @@ import classnames from 'classnames';
|
|
|
5
6
|
import ButtonLink from '../button-link';
|
|
6
7
|
import style from './style.css';
|
|
7
8
|
import propTypes, { buttonPropTypes } from './types';
|
|
9
|
+
import { DEFAULT_ICON_STYLE, THEMES } from './utils';
|
|
10
|
+
const buildCustomIconByTheme = icon => {
|
|
11
|
+
if (!icon) return;
|
|
12
|
+
const {
|
|
13
|
+
theme,
|
|
14
|
+
...iconProps
|
|
15
|
+
} = icon;
|
|
16
|
+
const custom = theme && THEMES[theme];
|
|
17
|
+
if (!custom) return iconProps;
|
|
18
|
+
const customProps = custom ? {
|
|
19
|
+
...DEFAULT_ICON_STYLE,
|
|
20
|
+
faIcon: {
|
|
21
|
+
...DEFAULT_ICON_STYLE.faIcon,
|
|
22
|
+
...custom
|
|
23
|
+
}
|
|
24
|
+
} : null;
|
|
25
|
+
return {
|
|
26
|
+
...iconProps,
|
|
27
|
+
...customProps
|
|
28
|
+
};
|
|
29
|
+
};
|
|
8
30
|
const Button = props => {
|
|
9
31
|
const {
|
|
10
32
|
'data-name': dataName,
|
|
11
33
|
disabled,
|
|
12
34
|
label,
|
|
13
|
-
onClick,
|
|
35
|
+
onClick = _noop,
|
|
14
36
|
type = 'default',
|
|
15
37
|
buttonLinkType,
|
|
16
38
|
icon,
|
|
17
|
-
customStyle = {}
|
|
39
|
+
customStyle = {},
|
|
40
|
+
...rest
|
|
18
41
|
} = props;
|
|
19
42
|
const styleButton = classnames(style.button, type === 'default' && style.defaultStyle, type === 'defaultLeft' && style.defaultLeft, type === 'dangerous' && style.dangerous, type === 'dangerousLeft' && style.dangerousLeft, disabled && style.disabled);
|
|
20
43
|
const handleOnClick = useCallback(() => onClick(), [onClick]);
|
|
21
|
-
|
|
22
|
-
|
|
44
|
+
const buttonLinkProps = {
|
|
45
|
+
...rest,
|
|
46
|
+
'aria-label': label,
|
|
47
|
+
disabled,
|
|
48
|
+
label,
|
|
23
49
|
type: buttonLinkType,
|
|
24
|
-
disabled: disabled,
|
|
25
50
|
onClick: handleOnClick,
|
|
26
|
-
|
|
51
|
+
'data-name': dataName,
|
|
27
52
|
className: styleButton,
|
|
28
53
|
customStyle: {
|
|
29
54
|
...customStyle
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"data-name": dataName,
|
|
37
|
-
className: styleButton,
|
|
38
|
-
onClick: handleOnClick,
|
|
39
|
-
disabled: disabled,
|
|
40
|
-
style: customStyle
|
|
41
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
42
|
-
className: style.buttonContent
|
|
43
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
44
|
-
className: style.label
|
|
45
|
-
}, label)));
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const iconProps = buildCustomIconByTheme(icon);
|
|
58
|
+
return /*#__PURE__*/React.createElement(ButtonLink, _extends({}, buttonLinkProps, {
|
|
59
|
+
icon: iconProps
|
|
60
|
+
}));
|
|
46
61
|
};
|
|
47
62
|
Button.propTypes = process.env.NODE_ENV !== "production" ? buttonPropTypes : {};
|
|
48
63
|
const ButtonMenu = props => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useMemo","useCallback","map","classnames","ButtonLink","style","propTypes","buttonPropTypes","Button","props","dataName","disabled","label","onClick","type","buttonLinkType","
|
|
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","rest","styleButton","button","defaultStyle","defaultLeft","dangerous","dangerousLeft","handleOnClick","buttonLinkProps","className","createElement","_extends","process","env","NODE_ENV","ButtonMenu","buttons","buildButton","index","key","buttonList","convert","cap","buttonMenuContainer"],"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 ...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 };\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} = 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 return (\n <div data-name={dataName} className={style.buttonMenuContainer}>\n {buttonList}\n </div>\n );\n};\n\nButtonMenu.propTypes = propTypes;\n\nexport default ButtonMenu;\n"],"mappings":";;AAAA,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AC;EAED,oBACE7C,KAAA,CAAAsC,aAAA;IAAK,aAAWlB,QAAS;IAACiB,SAAS,EAAE/B,KAAK,CAAC6C;EAAoB,GAC5DH,UACE,CAAC;AAEV,CAAC;AAEDL,UAAU,CAACpC,SAAS,GAAAiC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAGnC,SAAS;AAEhC,eAAeoC,UAAU","ignoreList":[]}
|
|
@@ -32,16 +32,6 @@
|
|
|
32
32
|
pointer-events: none;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
.buttonContent {
|
|
36
|
-
display: flex;
|
|
37
|
-
justify-content: center;
|
|
38
|
-
align-items: center;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.label {
|
|
42
|
-
margin: 0 8px 0 8px;
|
|
43
|
-
display: block;
|
|
44
|
-
}
|
|
45
35
|
|
|
46
36
|
.defaultStyle {
|
|
47
37
|
background-color: transparent;
|
|
@@ -8,6 +8,7 @@ export declare const buttonPropTypes: {
|
|
|
8
8
|
type: PropTypes.Requireable<string>;
|
|
9
9
|
buttonLinkType: PropTypes.Requireable<string>;
|
|
10
10
|
icon: PropTypes.Requireable<PropTypes.InferProps<{
|
|
11
|
+
theme: PropTypes.Requireable<string>;
|
|
11
12
|
position: PropTypes.Requireable<string>;
|
|
12
13
|
type: PropTypes.Requireable<string>;
|
|
13
14
|
faIcon: PropTypes.Requireable<PropTypes.InferProps<{
|
|
@@ -33,6 +34,7 @@ declare const propTypes: {
|
|
|
33
34
|
type: PropTypes.Requireable<string>;
|
|
34
35
|
buttonLinkType: PropTypes.Requireable<string>;
|
|
35
36
|
icon: PropTypes.Requireable<PropTypes.InferProps<{
|
|
37
|
+
theme: PropTypes.Requireable<string>;
|
|
36
38
|
position: PropTypes.Requireable<string>;
|
|
37
39
|
type: PropTypes.Requireable<string>;
|
|
38
40
|
faIcon: PropTypes.Requireable<PropTypes.InferProps<{
|
|
@@ -53,15 +55,13 @@ declare const propTypes: {
|
|
|
53
55
|
'aria-label': PropTypes.Requireable<string>;
|
|
54
56
|
};
|
|
55
57
|
export default propTypes;
|
|
56
|
-
export declare type
|
|
57
|
-
|
|
58
|
-
disabled?: boolean;
|
|
59
|
-
label: string;
|
|
60
|
-
onClick: () => void;
|
|
58
|
+
export declare type Theme = 'archived' | 'published' | 'deleted';
|
|
59
|
+
export declare type ButtonProps = Omit<ButtonLinkProps, 'type' | 'icon'> & {
|
|
61
60
|
type?: 'default' | 'defaultLeft' | 'dangerous' | 'dangerousLeft';
|
|
62
61
|
buttonLinkType?: ButtonLinkProps['type'];
|
|
63
|
-
icon?: IconType
|
|
64
|
-
|
|
62
|
+
icon?: IconType & {
|
|
63
|
+
theme?: Theme;
|
|
64
|
+
};
|
|
65
65
|
};
|
|
66
66
|
export declare type ButtonMenuProps = {
|
|
67
67
|
buttons: ButtonProps[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/atom/button-menu/types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAC,eAAe,EAAE,QAAQ,EAAgB,MAAM,sBAAsB,CAAC;AAE9E,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/atom/button-menu/types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAC,eAAe,EAAE,QAAQ,EAAgB,MAAM,sBAAsB,CAAC;AAE9E,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;CAY3B,CAAC;AAEF,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAId,CAAC;AAEF,eAAe,SAAS,CAAC;AAEzB,oBAAY,KAAK,GAAG,UAAU,GAAG,WAAW,GAAG,SAAS,CAAC;AAEzD,oBAAY,WAAW,GAAG,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG;IACjE,IAAI,CAAC,EAAE,SAAS,GAAG,aAAa,GAAG,WAAW,GAAG,eAAe,CAAC;IACjE,cAAc,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IACzC,IAAI,CAAC,EAAE,QAAQ,GAAG;QAAC,KAAK,CAAC,EAAE,KAAK,CAAA;KAAC,CAAC;CACnC,CAAC;AAEF,oBAAY,eAAe,GAAG;IAC5B,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,oBAAY,sBAAsB,GAAG;IAAC,KAAK,EAAE,eAAe,CAAA;CAAC,CAAC"}
|
|
@@ -7,7 +7,10 @@ export const buttonPropTypes = {
|
|
|
7
7
|
onClick: PropTypes.func.isRequired,
|
|
8
8
|
type: PropTypes.oneOf(['default', 'defaultLeft', 'dangerous', 'dangerousLeft']),
|
|
9
9
|
buttonLinkType: PropTypes.oneOf(['primary', 'secondary', 'tertiary', 'text', 'dangerous']),
|
|
10
|
-
icon: PropTypes.shape(
|
|
10
|
+
icon: PropTypes.shape({
|
|
11
|
+
...iconPropTypes,
|
|
12
|
+
theme: PropTypes.oneOf(['archived', 'published', 'deleted'])
|
|
13
|
+
}),
|
|
11
14
|
customStyle: PropTypes.objectOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]))
|
|
12
15
|
};
|
|
13
16
|
const propTypes = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["PropTypes","iconPropTypes","buttonPropTypes","string","disabled","bool","label","isRequired","onClick","func","type","oneOf","buttonLinkType","icon","shape","customStyle","objectOf","oneOfType","number","propTypes","buttons","arrayOf"],"sources":["../../../src/atom/button-menu/types.ts"],"sourcesContent":["import PropTypes from 'prop-types';\nimport {ButtonLinkProps, IconType, iconPropTypes} from '../button-link/types';\n\nexport const buttonPropTypes = {\n 'data-name': PropTypes.string,\n disabled: PropTypes.bool,\n label: PropTypes.string.isRequired,\n onClick: PropTypes.func.isRequired,\n type: PropTypes.oneOf(['default', 'defaultLeft', 'dangerous', 'dangerousLeft']),\n buttonLinkType: PropTypes.oneOf(['primary', 'secondary', 'tertiary', 'text', 'dangerous']),\n icon: PropTypes.shape(iconPropTypes),\n customStyle: PropTypes.objectOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]))\n};\n\nconst propTypes = {\n buttons: PropTypes.arrayOf(PropTypes.shape(buttonPropTypes)).isRequired,\n 'data-name': PropTypes.string,\n 'aria-label': PropTypes.string\n};\n\nexport default propTypes;\n\nexport type
|
|
1
|
+
{"version":3,"file":"types.js","names":["PropTypes","iconPropTypes","buttonPropTypes","string","disabled","bool","label","isRequired","onClick","func","type","oneOf","buttonLinkType","icon","shape","theme","customStyle","objectOf","oneOfType","number","propTypes","buttons","arrayOf"],"sources":["../../../src/atom/button-menu/types.ts"],"sourcesContent":["import PropTypes from 'prop-types';\nimport {ButtonLinkProps, IconType, iconPropTypes} from '../button-link/types';\n\nexport const buttonPropTypes = {\n 'data-name': PropTypes.string,\n disabled: PropTypes.bool,\n label: PropTypes.string.isRequired,\n onClick: PropTypes.func.isRequired,\n type: PropTypes.oneOf(['default', 'defaultLeft', 'dangerous', 'dangerousLeft']),\n buttonLinkType: PropTypes.oneOf(['primary', 'secondary', 'tertiary', 'text', 'dangerous']),\n icon: PropTypes.shape({\n ...iconPropTypes,\n theme: PropTypes.oneOf(['archived', 'published', 'deleted'])\n }),\n customStyle: PropTypes.objectOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]))\n};\n\nconst propTypes = {\n buttons: PropTypes.arrayOf(PropTypes.shape(buttonPropTypes)).isRequired,\n 'data-name': PropTypes.string,\n 'aria-label': PropTypes.string\n};\n\nexport default propTypes;\n\nexport type Theme = 'archived' | 'published' | 'deleted';\n\nexport type ButtonProps = Omit<ButtonLinkProps, 'type' | 'icon'> & {\n type?: 'default' | 'defaultLeft' | 'dangerous' | 'dangerousLeft';\n buttonLinkType?: ButtonLinkProps['type'];\n icon?: IconType & {theme?: Theme};\n};\n\nexport type ButtonMenuProps = {\n buttons: ButtonProps[];\n 'data-name'?: string;\n 'aria-label'?: string;\n};\n\nexport type ButtonMenuPropsFixture = {props: ButtonMenuProps};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,YAAY;AAClC,SAAmCC,aAAa,QAAO,sBAAsB;AAE7E,OAAO,MAAMC,eAAe,GAAG;EAC7B,WAAW,EAAEF,SAAS,CAACG,MAAM;EAC7BC,QAAQ,EAAEJ,SAAS,CAACK,IAAI;EACxBC,KAAK,EAAEN,SAAS,CAACG,MAAM,CAACI,UAAU;EAClCC,OAAO,EAAER,SAAS,CAACS,IAAI,CAACF,UAAU;EAClCG,IAAI,EAAEV,SAAS,CAACW,KAAK,CAAC,CAAC,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,eAAe,CAAC,CAAC;EAC/EC,cAAc,EAAEZ,SAAS,CAACW,KAAK,CAAC,CAAC,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;EAC1FE,IAAI,EAAEb,SAAS,CAACc,KAAK,CAAC;IACpB,GAAGb,aAAa;IAChBc,KAAK,EAAEf,SAAS,CAACW,KAAK,CAAC,CAAC,UAAU,EAAE,WAAW,EAAE,SAAS,CAAC;EAC7D,CAAC,CAAC;EACFK,WAAW,EAAEhB,SAAS,CAACiB,QAAQ,CAACjB,SAAS,CAACkB,SAAS,CAAC,CAAClB,SAAS,CAACG,MAAM,EAAEH,SAAS,CAACmB,MAAM,CAAC,CAAC;AAC3F,CAAC;AAED,MAAMC,SAAS,GAAG;EAChBC,OAAO,EAAErB,SAAS,CAACsB,OAAO,CAACtB,SAAS,CAACc,KAAK,CAACZ,eAAe,CAAC,CAAC,CAACK,UAAU;EACvE,WAAW,EAAEP,SAAS,CAACG,MAAM;EAC7B,YAAY,EAAEH,SAAS,CAACG;AAC1B,CAAC;AAED,eAAeiB,SAAS","ignoreList":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const DEFAULT_ICON_STYLE: {
|
|
2
|
+
position: "left";
|
|
3
|
+
faIcon: {
|
|
4
|
+
size: number;
|
|
5
|
+
color: "#515161";
|
|
6
|
+
customStyle: {
|
|
7
|
+
padding: number;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare const THEMES: {
|
|
12
|
+
published: {
|
|
13
|
+
name: string;
|
|
14
|
+
};
|
|
15
|
+
archived: {
|
|
16
|
+
name: string;
|
|
17
|
+
};
|
|
18
|
+
deleted: {
|
|
19
|
+
name: string;
|
|
20
|
+
color: "#B81400";
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/atom/button-menu/utils.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB;;;;;;;;;CAO9B,CAAC;AAEF,eAAO,MAAM,MAAM;;;;;;;;;;;CAIlB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { COLORS } from '../../variables/colors';
|
|
2
|
+
export const DEFAULT_ICON_STYLE = {
|
|
3
|
+
position: 'left',
|
|
4
|
+
faIcon: {
|
|
5
|
+
size: 14,
|
|
6
|
+
color: COLORS.cm_grey_500,
|
|
7
|
+
customStyle: {
|
|
8
|
+
padding: 0
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
export const THEMES = {
|
|
13
|
+
published: {
|
|
14
|
+
name: 'cloud-arrow-up'
|
|
15
|
+
},
|
|
16
|
+
archived: {
|
|
17
|
+
name: 'folder-open'
|
|
18
|
+
},
|
|
19
|
+
deleted: {
|
|
20
|
+
name: 'trash',
|
|
21
|
+
color: COLORS.cm_negative_200
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","names":["COLORS","DEFAULT_ICON_STYLE","position","faIcon","size","color","cm_grey_500","customStyle","padding","THEMES","published","name","archived","deleted","cm_negative_200"],"sources":["../../../src/atom/button-menu/utils.ts"],"sourcesContent":["import {COLORS} from '../../variables/colors';\n\nexport const DEFAULT_ICON_STYLE = {\n position: 'left' as const,\n faIcon: {\n size: 14,\n color: COLORS.cm_grey_500,\n customStyle: {padding: 0}\n }\n};\n\nexport const THEMES = {\n published: {name: 'cloud-arrow-up'},\n archived: {name: 'folder-open'},\n deleted: {name: 'trash', color: COLORS.cm_negative_200}\n};\n"],"mappings":"AAAA,SAAQA,MAAM,QAAO,wBAAwB;AAE7C,OAAO,MAAMC,kBAAkB,GAAG;EAChCC,QAAQ,EAAE,MAAe;EACzBC,MAAM,EAAE;IACNC,IAAI,EAAE,EAAE;IACRC,KAAK,EAAEL,MAAM,CAACM,WAAW;IACzBC,WAAW,EAAE;MAACC,OAAO,EAAE;IAAC;EAC1B;AACF,CAAC;AAED,OAAO,MAAMC,MAAM,GAAG;EACpBC,SAAS,EAAE;IAACC,IAAI,EAAE;EAAgB,CAAC;EACnCC,QAAQ,EAAE;IAACD,IAAI,EAAE;EAAa,CAAC;EAC/BE,OAAO,EAAE;IAACF,IAAI,EAAE,OAAO;IAAEN,KAAK,EAAEL,MAAM,CAACc;EAAe;AACxD,CAAC","ignoreList":[]}
|
package/es/atom/icon/index.d.ts
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
export const DEFAULT_ICON_COLOR: "hsl(0, 0%, 32%)";
|
|
2
2
|
export function getForegroundColor(backgroundColor: any): any;
|
|
3
|
+
export namespace iconPropTypes {
|
|
4
|
+
const iconName: PropTypes.Validator<string>;
|
|
5
|
+
const iconColor: PropTypes.Requireable<string>;
|
|
6
|
+
const backgroundColor: PropTypes.Requireable<string>;
|
|
7
|
+
const gradientBackground: PropTypes.Requireable<boolean>;
|
|
8
|
+
const borderRadius: PropTypes.Requireable<string>;
|
|
9
|
+
const preset: PropTypes.Requireable<string>;
|
|
10
|
+
const size: PropTypes.Requireable<PropTypes.InferProps<{
|
|
11
|
+
faSize: PropTypes.Requireable<number>;
|
|
12
|
+
wrapperSize: PropTypes.Requireable<number>;
|
|
13
|
+
}>>;
|
|
14
|
+
const customStyle: PropTypes.Requireable<{
|
|
15
|
+
[x: string]: NonNullable<string | number | null | undefined> | null | undefined;
|
|
16
|
+
}>;
|
|
17
|
+
}
|
|
3
18
|
export default Icon;
|
|
19
|
+
import PropTypes from "prop-types";
|
|
4
20
|
declare const Icon: React.NamedExoticComponent<object>;
|
|
5
21
|
import React from "react";
|
|
6
22
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/icon/index.js"],"names":[],"mappings":"AAkBA,mDAAoD;AAiB7C,8DAC8D
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/icon/index.js"],"names":[],"mappings":"AAkBA,mDAAoD;AAiB7C,8DAC8D;;;;;;;;;;;;;;;;;;AAGrE,uDAsCG"}
|
package/es/atom/icon/index.js
CHANGED
|
@@ -64,7 +64,7 @@ const Icon = /*#__PURE__*/React.memo(function Icon({
|
|
|
64
64
|
fontSize: effectiveSize.faSize
|
|
65
65
|
}));
|
|
66
66
|
});
|
|
67
|
-
|
|
67
|
+
export const iconPropTypes = {
|
|
68
68
|
iconName: PropTypes.string.isRequired,
|
|
69
69
|
iconColor: PropTypes.string,
|
|
70
70
|
backgroundColor: PropTypes.string,
|
|
@@ -76,6 +76,7 @@ Icon.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
76
76
|
wrapperSize: PropTypes.number
|
|
77
77
|
}),
|
|
78
78
|
customStyle: PropTypes.objectOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]))
|
|
79
|
-
}
|
|
79
|
+
};
|
|
80
|
+
Icon.propTypes = process.env.NODE_ENV !== "production" ? iconPropTypes : {};
|
|
80
81
|
export default Icon;
|
|
81
82
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","PropTypes","number","FontAwesomeIcon","fas","library","toLower","merge","getOr","convert","createGradientBackground","style","add","DEFAULT_PRESET","ICON_LUMINOSITY","DEFAULT_WRAPPER_SIZE","ICON_PADDING","DEFAULT_ICON_COLOR","SIZE_CONFIGS","s","faSize","wrapperSize","m","xl","getForegroundColor","backgroundColor","Icon","memo","iconName","iconColor","gradientBackground","borderRadius","preset","size","customStyle","effectiveIconColor","effectiveSize","iconWrapperStyle","background","width","height","padding","createElement","className","iconWrapper","icon","color","fontSize","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","PropTypes","number","FontAwesomeIcon","fas","library","toLower","merge","getOr","convert","createGradientBackground","style","add","DEFAULT_PRESET","ICON_LUMINOSITY","DEFAULT_WRAPPER_SIZE","ICON_PADDING","DEFAULT_ICON_COLOR","SIZE_CONFIGS","s","faSize","wrapperSize","m","xl","getForegroundColor","backgroundColor","Icon","memo","iconName","iconColor","gradientBackground","borderRadius","preset","size","customStyle","effectiveIconColor","effectiveSize","iconWrapperStyle","background","width","height","padding","createElement","className","iconWrapper","icon","color","fontSize","iconPropTypes","string","isRequired","bool","oneOf","shape","objectOf","oneOfType","propTypes","process","env","NODE_ENV"],"sources":["../../../src/atom/icon/index.js"],"sourcesContent":["import React from 'react';\nimport PropTypes, {number} from 'prop-types';\nimport {FontAwesomeIcon} from '@fortawesome/react-fontawesome';\nimport {fas} from '@fortawesome/pro-solid-svg-icons';\nimport {library} from '@fortawesome/fontawesome-svg-core';\nimport toLower from 'lodash/fp/toLower';\nimport merge from 'lodash/fp/merge';\nimport getOr from 'lodash/fp/getOr';\nimport {convert} from 'css-color-function';\nimport {createGradientBackground} from '../../util/get-background-gradient-color';\nimport style from './style.css';\n\nlibrary.add(fas);\n\nconst DEFAULT_PRESET = 'm';\nconst ICON_LUMINOSITY = 32;\nconst DEFAULT_WRAPPER_SIZE = 40;\nconst ICON_PADDING = 8;\nexport const DEFAULT_ICON_COLOR = 'hsl(0, 0%, 32%)';\n\nconst SIZE_CONFIGS = {\n s: {\n faSize: 12,\n wrapperSize: 32\n },\n m: {\n faSize: 16,\n wrapperSize: DEFAULT_WRAPPER_SIZE\n },\n xl: {\n faSize: 20,\n wrapperSize: 48\n }\n};\n\nexport const getForegroundColor = backgroundColor =>\n convert(`color(${backgroundColor} lightness(${ICON_LUMINOSITY}%))`);\n// set lightness to 32%\n\nconst Icon = React.memo(function Icon({\n iconName,\n iconColor,\n backgroundColor,\n gradientBackground,\n borderRadius,\n preset = DEFAULT_PRESET,\n size,\n customStyle\n}) {\n const effectiveIconColor =\n iconColor || (backgroundColor ? getForegroundColor(backgroundColor) : DEFAULT_ICON_COLOR);\n\n const effectiveSize = size\n ? merge(SIZE_CONFIGS[DEFAULT_PRESET], size)\n : getOr(SIZE_CONFIGS[DEFAULT_PRESET], toLower(preset), SIZE_CONFIGS);\n\n const wrapperSize = effectiveSize.wrapperSize - ICON_PADDING * 2;\n\n const iconWrapperStyle = {\n background: gradientBackground\n ? createGradientBackground(effectiveIconColor, '81%', '91%')\n : backgroundColor,\n borderRadius,\n width: wrapperSize,\n height: wrapperSize,\n padding: ICON_PADDING\n };\n\n return (\n <div className={style.iconWrapper} style={{...iconWrapperStyle, ...customStyle}}>\n <FontAwesomeIcon\n icon={`fa-${iconName}`}\n color={effectiveIconColor}\n fontSize={effectiveSize.faSize}\n />\n </div>\n );\n});\n\nexport const iconPropTypes = {\n iconName: PropTypes.string.isRequired,\n iconColor: PropTypes.string,\n backgroundColor: PropTypes.string,\n gradientBackground: PropTypes.bool,\n borderRadius: PropTypes.string,\n preset: PropTypes.oneOf(['s', 'm', 'xl']),\n size: PropTypes.shape({\n faSize: number,\n wrapperSize: PropTypes.number\n }),\n customStyle: PropTypes.objectOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]))\n};\n\nIcon.propTypes = iconPropTypes;\n\nexport default Icon;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,IAAGC,MAAM,QAAO,YAAY;AAC5C,SAAQC,eAAe,QAAO,gCAAgC;AAC9D,SAAQC,GAAG,QAAO,kCAAkC;AACpD,SAAQC,OAAO,QAAO,mCAAmC;AACzD,OAAOC,OAAO,MAAM,mBAAmB;AACvC,OAAOC,KAAK,MAAM,iBAAiB;AACnC,OAAOC,KAAK,MAAM,iBAAiB;AACnC,SAAQC,OAAO,QAAO,oBAAoB;AAC1C,SAAQC,wBAAwB,QAAO,0CAA0C;AACjF,OAAOC,KAAK,MAAM,aAAa;AAE/BN,OAAO,CAACO,GAAG,CAACR,GAAG,CAAC;AAEhB,MAAMS,cAAc,GAAG,GAAG;AAC1B,MAAMC,eAAe,GAAG,EAAE;AAC1B,MAAMC,oBAAoB,GAAG,EAAE;AAC/B,MAAMC,YAAY,GAAG,CAAC;AACtB,OAAO,MAAMC,kBAAkB,GAAG,iBAAiB;AAEnD,MAAMC,YAAY,GAAG;EACnBC,CAAC,EAAE;IACDC,MAAM,EAAE,EAAE;IACVC,WAAW,EAAE;EACf,CAAC;EACDC,CAAC,EAAE;IACDF,MAAM,EAAE,EAAE;IACVC,WAAW,EAAEN;EACf,CAAC;EACDQ,EAAE,EAAE;IACFH,MAAM,EAAE,EAAE;IACVC,WAAW,EAAE;EACf;AACF,CAAC;AAED,OAAO,MAAMG,kBAAkB,GAAGC,eAAe,IAC/ChB,OAAO,CAAC,SAASgB,eAAe,cAAcX,eAAe,KAAK,CAAC;AACrE;;AAEA,MAAMY,IAAI,gBAAG1B,KAAK,CAAC2B,IAAI,CAAC,SAASD,IAAIA,CAAC;EACpCE,QAAQ;EACRC,SAAS;EACTJ,eAAe;EACfK,kBAAkB;EAClBC,YAAY;EACZC,MAAM,GAAGnB,cAAc;EAC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,MAAM;EAC9BjB,MAAM,EAAE/B,SAAS,CAACmD,KAAK,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;EACzCnB,IAAI,EAAEhC,SAAS,CAACoD,KAAK,CAAC;IACpBjC,MAAM,EAAElB,MAAM;IACdmB,WAAW,EAAEpB,SAAS,CAACC;EACzB,CAAC,CAAC;EACFgC,WAAW,EAAEjC,SAAS,CAACqD,QAAQ,CAACrD,SAAS,CAACsD,SAAS,CAAC,CAACtD,SAAS,CAACgD,MAAM,EAAEhD,SAAS,CAACC,MAAM,CAAC,CAAC;AAC3F,CAAC;AAEDwB,IAAI,CAAC8B,SAAS,GAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAGX,aAAa;AAE9B,eAAetB,IAAI","ignoreList":[]}
|
|
@@ -3,6 +3,7 @@ import { BulletPointMenuButtonProps } from './types';
|
|
|
3
3
|
declare const BulletPointMenuButton: {
|
|
4
4
|
(props: BulletPointMenuButtonProps): JSX.Element;
|
|
5
5
|
propTypes: {
|
|
6
|
+
'data-name': import("prop-types").Requireable<string>;
|
|
6
7
|
disabled: import("prop-types").Requireable<boolean>;
|
|
7
8
|
buttonAriaLabel: import("prop-types").Requireable<string>;
|
|
8
9
|
menuAriaLabel: import("prop-types").Requireable<string>;
|
|
@@ -14,6 +15,7 @@ declare const BulletPointMenuButton: {
|
|
|
14
15
|
type: import("prop-types").Requireable<string>;
|
|
15
16
|
buttonLinkType: import("prop-types").Requireable<string>;
|
|
16
17
|
icon: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
18
|
+
theme: import("prop-types").Requireable<string>;
|
|
17
19
|
position: import("prop-types").Requireable<string>;
|
|
18
20
|
type: import("prop-types").Requireable<string>;
|
|
19
21
|
faIcon: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/bullet-point-menu-button/index.tsx"],"names":[],"mappings":";AAKA,OAAkB,EAAC,0BAA0B,EAAC,MAAM,SAAS,CAAC;AAG9D,QAAA,MAAM,qBAAqB;YAAW,0BAA0B
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/bullet-point-menu-button/index.tsx"],"names":[],"mappings":";AAKA,OAAkB,EAAC,0BAA0B,EAAC,MAAM,SAAS,CAAC;AAG9D,QAAA,MAAM,qBAAqB;YAAW,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2D/D,CAAC;AAIF,eAAe,qBAAqB,CAAC"}
|
|
@@ -13,7 +13,8 @@ const BulletPointMenuButton = props => {
|
|
|
13
13
|
onClick = _noop,
|
|
14
14
|
buttons,
|
|
15
15
|
menuButtonClassName,
|
|
16
|
-
isBulkMenu
|
|
16
|
+
isBulkMenu,
|
|
17
|
+
'data-name': dataName = 'bullet-point-button'
|
|
17
18
|
} = props;
|
|
18
19
|
const [visible, setVisible] = useState(false);
|
|
19
20
|
const handleOnClick = useCallback(() => {
|
|
@@ -31,15 +32,16 @@ const BulletPointMenuButton = props => {
|
|
|
31
32
|
'data-name': 'button-menu',
|
|
32
33
|
buttons
|
|
33
34
|
};
|
|
35
|
+
const menuStyle = classnames(style.bulletPointMenu, isBulkMenu && style.bulkBulletPointMenu, visible && style.visible);
|
|
34
36
|
const menu = /*#__PURE__*/React.createElement("div", {
|
|
35
|
-
className:
|
|
37
|
+
className: menuStyle,
|
|
36
38
|
"data-name": "menu-wrapper",
|
|
37
39
|
"aria-label": menuAriaLabel
|
|
38
40
|
}, /*#__PURE__*/React.createElement(ButtonMenu, menuProps));
|
|
39
41
|
const bulletPointButtonProps = {
|
|
40
42
|
size: 'default',
|
|
41
43
|
'aria-label': buttonAriaLabel,
|
|
42
|
-
'data-name':
|
|
44
|
+
'data-name': dataName,
|
|
43
45
|
icon: 'bullet-point',
|
|
44
46
|
onClick: handleOnClick,
|
|
45
47
|
disabled,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useCallback","useState","useEffect","classnames","ButtonLinkIcon","ButtonMenu","propTypes","style","BulletPointMenuButton","props","disabled","buttonAriaLabel","menuAriaLabel","onClick","_noop","buttons","menuButtonClassName","isBulkMenu","visible","setVisible","handleOnClick","handleMouseDown","document","addEventListener","removeEventListener","menuProps","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useCallback","useState","useEffect","classnames","ButtonLinkIcon","ButtonMenu","propTypes","style","BulletPointMenuButton","props","disabled","buttonAriaLabel","menuAriaLabel","onClick","_noop","buttons","menuButtonClassName","isBulkMenu","dataName","visible","setVisible","handleOnClick","handleMouseDown","document","addEventListener","removeEventListener","menuProps","menuStyle","bulletPointMenu","bulkBulletPointMenu","menu","createElement","className","bulletPointButtonProps","size","icon","bulletPointWrapper","process","env","NODE_ENV"],"sources":["../../../src/molecule/bullet-point-menu-button/index.tsx"],"sourcesContent":["import React, {useCallback, useState, useEffect} from 'react';\nimport classnames from 'classnames';\nimport {noop} from 'lodash/fp';\nimport ButtonLinkIcon from '../../atom/button-link-icon';\nimport ButtonMenu from '../../atom/button-menu';\nimport propTypes, {BulletPointMenuButtonProps} from './types';\nimport style from './style.css';\n\nconst BulletPointMenuButton = (props: BulletPointMenuButtonProps) => {\n const {\n disabled = false,\n buttonAriaLabel,\n menuAriaLabel,\n onClick = noop,\n buttons,\n menuButtonClassName,\n isBulkMenu,\n 'data-name': dataName = 'bullet-point-button'\n } = props;\n const [visible, setVisible] = useState(false);\n\n const handleOnClick = useCallback(() => {\n onClick();\n setVisible(true);\n }, [onClick]);\n\n useEffect(() => {\n const handleMouseDown = () => setVisible(false);\n document.addEventListener('mousedown', handleMouseDown);\n return () => {\n document.removeEventListener('mousedown', handleMouseDown);\n };\n }, []);\n\n const menuProps = {\n 'data-name': 'button-menu',\n buttons\n };\n\n const menuStyle = classnames(\n style.bulletPointMenu,\n isBulkMenu && style.bulkBulletPointMenu,\n visible && style.visible\n );\n\n const menu = (\n <div className={menuStyle} data-name=\"menu-wrapper\" aria-label={menuAriaLabel}>\n <ButtonMenu {...menuProps} />\n </div>\n );\n\n const bulletPointButtonProps = {\n size: 'default',\n 'aria-label': buttonAriaLabel,\n 'data-name': dataName,\n icon: 'bullet-point',\n onClick: handleOnClick,\n disabled,\n className: menuButtonClassName\n };\n\n return (\n <div className={style.bulletPointWrapper} data-name=\"bullet-point-wrapper\">\n <ButtonLinkIcon {...bulletPointButtonProps} />\n {menu}\n </div>\n );\n};\n\nBulletPointMenuButton.propTypes = propTypes;\n\nexport default BulletPointMenuButton;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAGC,WAAW,EAAEC,QAAQ,EAAEC,SAAS,QAAO,OAAO;AAC7D,OAAOC,UAAU,MAAM,YAAY;AAEnC,OAAOC,cAAc,MAAM,6BAA6B;AACxD,OAAOC,UAAU,MAAM,wBAAwB;AAC/C,OAAOC,SAAS,MAAoC,SAAS;AAC7D,OAAOC,KAAK,MAAM,aAAa;AAE/B,MAAMC,qBAAqB,GAAIC,KAAiC,IAAK;EACnE,MAAM;IACJC,QAAQ,GAAG,KAAK;IAChBC,eAAe;IACfC,aAAa;IACbC,OAAO,GAAAC,KAAO;IACdC,OAAO;IACPC,mBAAmB;IACnBC,UAAU;IACV,WAAW,EAAEC,QAAQ,GAAG;EAC1B,CAAC,GAAGT,KAAK;EACT,MAAM,CAACU,OAAO,EAAEC,UAAU,CAAC,GAAGnB,QAAQ,CAAC,KAAK,CAAC;EAE7C,MAAMoB,aAAa,GAAGrB,WAAW,CAAC,MAAM;IACtCa,OAAO,CAAC,CAAC;IACTO,UAAU,CAAC,IAAI,CAAC;EAClB,CAAC,EAAE,CAACP,OAAO,CAAC,CAAC;EAEbX,SAAS,CAAC,MAAM;IACd,MAAMoB,eAAe,GAAGA,CAAA,KAAMF,UAAU,CAAC,KAAK,CAAC;IAC/CG,QAAQ,CAACC,gBAAgB,CAAC,WAAW,EAAEF,eAAe,CAAC;IACvD,OAAO,MAAM;MACXC,QAAQ,CAACE,mBAAmB,CAAC,WAAW,EAAEH,eAAe,CAAC;IAC5D,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,MAAMI,SAAS,GAAG;IAChB,WAAW,EAAE,aAAa;IAC1BX;EACF,CAAC;EAED,MAAMY,SAAS,GAAGxB,UAAU,CAC1BI,KAAK,CAACqB,eAAe,EACrBX,UAAU,IAAIV,KAAK,CAACsB,mBAAmB,EACvCV,OAAO,IAAIZ,KAAK,CAACY,OACnB,CAAC;EAED,MAAMW,IAAI,gBACR/B,KAAA,CAAAgC,aAAA;IAAKC,SAAS,EAAEL,SAAU;IAAC,aAAU,cAAc;IAAC,cAAYf;EAAc,gBAC5Eb,KAAA,CAAAgC,aAAA,CAAC1B,UAAU,EAAKqB,SAAY,CACzB,CACN;EAED,MAAMO,sBAAsB,GAAG;IAC7BC,IAAI,EAAE,SAAS;IACf,YAAY,EAAEvB,eAAe;IAC7B,WAAW,EAAEO,QAAQ;IACrBiB,IAAI,EAAE,cAAc;IACpBtB,OAAO,EAAEQ,aAAa;IACtBX,QAAQ;IACRsB,SAAS,EAAEhB;EACb,CAAC;EAED,oBACEjB,KAAA,CAAAgC,aAAA;IAAKC,SAAS,EAAEzB,KAAK,CAAC6B,kBAAmB;IAAC,aAAU;EAAsB,gBACxErC,KAAA,CAAAgC,aAAA,CAAC3B,cAAc,EAAK6B,sBAAyB,CAAC,EAC7CH,IACE,CAAC;AAEV,CAAC;AAEDtB,qBAAqB,CAACF,SAAS,GAAA+B,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAGjC,SAAS;AAE3C,eAAeE,qBAAqB","ignoreList":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import { ButtonProps } from '../../atom/button-menu/types';
|
|
3
3
|
declare const propTypes: {
|
|
4
|
+
'data-name': PropTypes.Requireable<string>;
|
|
4
5
|
disabled: PropTypes.Requireable<boolean>;
|
|
5
6
|
buttonAriaLabel: PropTypes.Requireable<string>;
|
|
6
7
|
menuAriaLabel: PropTypes.Requireable<string>;
|
|
@@ -12,6 +13,7 @@ declare const propTypes: {
|
|
|
12
13
|
type: PropTypes.Requireable<string>;
|
|
13
14
|
buttonLinkType: PropTypes.Requireable<string>;
|
|
14
15
|
icon: PropTypes.Requireable<PropTypes.InferProps<{
|
|
16
|
+
theme: PropTypes.Requireable<string>;
|
|
15
17
|
position: PropTypes.Requireable<string>;
|
|
16
18
|
type: PropTypes.Requireable<string>;
|
|
17
19
|
faIcon: PropTypes.Requireable<PropTypes.InferProps<{
|
|
@@ -34,6 +36,7 @@ declare const propTypes: {
|
|
|
34
36
|
};
|
|
35
37
|
export default propTypes;
|
|
36
38
|
export declare type BulletPointMenuButtonProps = {
|
|
39
|
+
'data-name'?: string;
|
|
37
40
|
disabled?: boolean;
|
|
38
41
|
buttonAriaLabel?: string;
|
|
39
42
|
menuAriaLabel?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/molecule/bullet-point-menu-button/types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAEzD,QAAA,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/molecule/bullet-point-menu-button/types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAEzD,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CASd,CAAC;AAEF,eAAe,SAAS,CAAC;AAEzB,oBAAY,0BAA0B,GAAG;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,oBAAY,iCAAiC,GAAG;IAAC,KAAK,EAAE,0BAA0B,CAAA;CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["PropTypes","ButtonMenu","propTypes","disabled","bool","buttonAriaLabel","
|
|
1
|
+
{"version":3,"file":"types.js","names":["PropTypes","ButtonMenu","propTypes","string","disabled","bool","buttonAriaLabel","menuAriaLabel","buttons","onClick","func","menuButtonClassName","isBulkMenu"],"sources":["../../../src/molecule/bullet-point-menu-button/types.ts"],"sourcesContent":["import PropTypes from 'prop-types';\nimport ButtonMenu from '../../atom/button-menu';\nimport {ButtonProps} from '../../atom/button-menu/types';\n\nconst propTypes = {\n 'data-name': PropTypes.string,\n disabled: PropTypes.bool,\n buttonAriaLabel: PropTypes.string,\n menuAriaLabel: PropTypes.string,\n buttons: ButtonMenu.propTypes.buttons,\n onClick: PropTypes.func,\n menuButtonClassName: PropTypes.string,\n isBulkMenu: PropTypes.bool\n};\n\nexport default propTypes;\n\nexport type BulletPointMenuButtonProps = {\n 'data-name'?: string;\n disabled?: boolean;\n buttonAriaLabel?: string;\n menuAriaLabel?: string;\n buttons: ButtonProps[];\n onClick: () => void;\n menuButtonClassName?: string;\n isBulkMenu?: boolean;\n};\n\nexport type BulletPointMenuButtonPropsFixture = {props: BulletPointMenuButtonProps};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,wBAAwB;AAG/C,MAAMC,SAAS,GAAG;EAChB,WAAW,EAAEF,SAAS,CAACG,MAAM;EAC7BC,QAAQ,EAAEJ,SAAS,CAACK,IAAI;EACxBC,eAAe,EAAEN,SAAS,CAACG,MAAM;EACjCI,aAAa,EAAEP,SAAS,CAACG,MAAM;EAC/BK,OAAO,EAAEP,UAAU,CAACC,SAAS,CAACM,OAAO;EACrCC,OAAO,EAAET,SAAS,CAACU,IAAI;EACvBC,mBAAmB,EAAEX,SAAS,CAACG,MAAM;EACrCS,UAAU,EAAEZ,SAAS,CAACK;AACxB,CAAC;AAED,eAAeH,SAAS","ignoreList":[]}
|
|
@@ -49,6 +49,7 @@ declare const ButtonMenuAction: {
|
|
|
49
49
|
type: import("prop-types").Requireable<string>;
|
|
50
50
|
buttonLinkType: import("prop-types").Requireable<string>;
|
|
51
51
|
icon: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
52
|
+
theme: import("prop-types").Requireable<string>;
|
|
52
53
|
position: import("prop-types").Requireable<string>;
|
|
53
54
|
type: import("prop-types").Requireable<string>;
|
|
54
55
|
faIcon: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/button-menu-action/index.tsx"],"names":[],"mappings":";AAKA,OAAkB,EAAC,qBAAqB,EAAC,MAAM,SAAS,CAAC;AAGzD,QAAA,MAAM,gBAAgB;YAAW,qBAAqB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/button-menu-action/index.tsx"],"names":[],"mappings":";AAKA,OAAkB,EAAC,qBAAqB,EAAC,MAAM,SAAS,CAAC;AAGzD,QAAA,MAAM,gBAAgB;YAAW,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmCrD,CAAC;AAIF,eAAe,gBAAgB,CAAC"}
|