@bigbinary/neeto-molecules 4.1.6 → 4.1.8
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/dist/CopyToClipboardButton.js +1 -1
- package/dist/CopyToClipboardButton.js.map +1 -1
- package/dist/ShareViaLink.js +2 -0
- package/dist/ShareViaLink.js.map +1 -1
- package/dist/cjs/CopyToClipboardButton.js +1 -1
- package/dist/cjs/CopyToClipboardButton.js.map +1 -1
- package/dist/cjs/ShareViaLink.js +2 -0
- package/dist/cjs/ShareViaLink.js.map +1 -1
- package/package.json +1 -1
- package/src/translations/en.json +1 -1
|
@@ -68,7 +68,7 @@ var CopyToClipboardButton = function CopyToClipboardButton(_ref) {
|
|
|
68
68
|
ref.current.style.minWidth = "".concat(buttonWidth, "px");
|
|
69
69
|
}, [size]);
|
|
70
70
|
var tooltipOptions = label ? null : mergeAll([TOOLTIP_CONFIG, {
|
|
71
|
-
content: isChecked ? successTooltipContent || t("neetoMolecules.common.copied") : tooltipContent || t("neetoMolecules.common.
|
|
71
|
+
content: isChecked ? successTooltipContent || t("neetoMolecules.common.copied") : tooltipContent || t("neetoMolecules.common.copy")
|
|
72
72
|
}, tooltipProps]);
|
|
73
73
|
var buttonLabel = isChecked && label ? successLabel || t("neetoMolecules.common.copied") : label;
|
|
74
74
|
var buttonIcon = isChecked ? Check : icon;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CopyToClipboardButton.js","sources":["../src/components/CopyToClipboardButton/constants.js","../src/components/CopyToClipboardButton/index.jsx"],"sourcesContent":["const TIME_OUT = 2000;\n\nconst TOOLTIP_CONFIG = {\n trigger: \"click mouseenter\",\n hideAfter: TIME_OUT,\n position: \"top\",\n};\n\nconst BUTTON_STYLES = {\n primary: \"primary\",\n secondary: \"secondary\",\n text: \"text\",\n};\n\nconst BUTTON_SIZES = {\n small: \"small\",\n medium: \"medium\",\n large: \"large\",\n};\n\nexport { TOOLTIP_CONFIG, TIME_OUT, BUTTON_STYLES, BUTTON_SIZES };\n","import { useState, useLayoutEffect, useRef } from \"react\";\n\nimport classnames from \"classnames\";\nimport { copyToClipboard } from \"neetocommons/utils/general\";\nimport { Copy, Check } from \"neetoicons\";\nimport { Button } from \"neetoui\";\nimport PropTypes from \"prop-types\";\nimport { mergeAll } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport {\n TOOLTIP_CONFIG,\n TIME_OUT,\n BUTTON_STYLES,\n BUTTON_SIZES,\n} from \"./constants\";\nimport \"./copyToClipboard.scss\";\n\nconst CopyToClipboardButton = ({\n className,\n icon = Copy,\n label = \"\",\n successLabel,\n tooltipContent,\n successTooltipContent,\n value,\n style,\n size = BUTTON_SIZES.medium,\n tooltipProps,\n onClick,\n ...otherProps\n}) => {\n const { t } = useTranslation();\n\n const [isChecked, setIsChecked] = useState(false);\n\n const ref = useRef();\n\n const onHandleClick = event => {\n event.preventDefault();\n event.stopPropagation();\n\n if (onClick) onClick(event);\n else copyToClipboard(value, { showToastr: false });\n\n setIsChecked(true);\n setTimeout(() => {\n setIsChecked(false);\n }, TIME_OUT); // Reset copied state after 2 seconds\n };\n\n useLayoutEffect(() => {\n if (!ref.current) return;\n ref.current.style.minWidth = \"\";\n const buttonWidth = ref.current.clientWidth;\n ref.current.style.minWidth = `${buttonWidth}px`;\n }, [size]);\n\n const tooltipOptions = label\n ? null\n : mergeAll([\n TOOLTIP_CONFIG,\n {\n content: isChecked\n ? successTooltipContent || t(\"neetoMolecules.common.copied\")\n : tooltipContent || t(\"neetoMolecules.common.
|
|
1
|
+
{"version":3,"file":"CopyToClipboardButton.js","sources":["../src/components/CopyToClipboardButton/constants.js","../src/components/CopyToClipboardButton/index.jsx"],"sourcesContent":["const TIME_OUT = 2000;\n\nconst TOOLTIP_CONFIG = {\n trigger: \"click mouseenter\",\n hideAfter: TIME_OUT,\n position: \"top\",\n};\n\nconst BUTTON_STYLES = {\n primary: \"primary\",\n secondary: \"secondary\",\n text: \"text\",\n};\n\nconst BUTTON_SIZES = {\n small: \"small\",\n medium: \"medium\",\n large: \"large\",\n};\n\nexport { TOOLTIP_CONFIG, TIME_OUT, BUTTON_STYLES, BUTTON_SIZES };\n","import { useState, useLayoutEffect, useRef } from \"react\";\n\nimport classnames from \"classnames\";\nimport { copyToClipboard } from \"neetocommons/utils/general\";\nimport { Copy, Check } from \"neetoicons\";\nimport { Button } from \"neetoui\";\nimport PropTypes from \"prop-types\";\nimport { mergeAll } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport {\n TOOLTIP_CONFIG,\n TIME_OUT,\n BUTTON_STYLES,\n BUTTON_SIZES,\n} from \"./constants\";\nimport \"./copyToClipboard.scss\";\n\nconst CopyToClipboardButton = ({\n className,\n icon = Copy,\n label = \"\",\n successLabel,\n tooltipContent,\n successTooltipContent,\n value,\n style,\n size = BUTTON_SIZES.medium,\n tooltipProps,\n onClick,\n ...otherProps\n}) => {\n const { t } = useTranslation();\n\n const [isChecked, setIsChecked] = useState(false);\n\n const ref = useRef();\n\n const onHandleClick = event => {\n event.preventDefault();\n event.stopPropagation();\n\n if (onClick) onClick(event);\n else copyToClipboard(value, { showToastr: false });\n\n setIsChecked(true);\n setTimeout(() => {\n setIsChecked(false);\n }, TIME_OUT); // Reset copied state after 2 seconds\n };\n\n useLayoutEffect(() => {\n if (!ref.current) return;\n ref.current.style.minWidth = \"\";\n const buttonWidth = ref.current.clientWidth;\n ref.current.style.minWidth = `${buttonWidth}px`;\n }, [size]);\n\n const tooltipOptions = label\n ? null\n : mergeAll([\n TOOLTIP_CONFIG,\n {\n content: isChecked\n ? successTooltipContent || t(\"neetoMolecules.common.copied\")\n : tooltipContent || t(\"neetoMolecules.common.copy\"),\n },\n tooltipProps,\n ]);\n\n const buttonLabel =\n isChecked && label\n ? successLabel || t(\"neetoMolecules.common.copied\")\n : label;\n const buttonIcon = isChecked ? Check : icon;\n\n return (\n <Button\n {...{ ref, size, style }}\n data-testid=\"copy-to-clipboard-button\"\n icon={buttonIcon}\n label={buttonLabel}\n tooltipProps={tooltipOptions}\n className={classnames(\"neeto-molecules-copy-button\", {\n [className]: className,\n \"neeto-molecules-copy-button--active\": isChecked,\n [`neeto-molecules-copy-button--${size}`]: size,\n })}\n onClick={onHandleClick}\n {...otherProps}\n />\n );\n};\n\nCopyToClipboardButton.propTypes = {\n /**\n * To provide additional classnames to the button.\n */\n className: PropTypes.string,\n /**\n * To provide the icon to be passed to the button. Defaults to the Copy icon.\n */\n icon: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n /**\n * To provide the label to the button. By default there is no label.\n */\n label: PropTypes.string,\n /**\n * The label of button when the value is copied to clipboard. Defaults to 'Copied'.\n */\n successLabel: PropTypes.string,\n /**\n * The value to be copied to clipboard. (required)\n */\n value: PropTypes.string,\n /**\n * To specify the style of the Button.\n */\n style: PropTypes.oneOf(Object.values(BUTTON_STYLES)),\n /**\n * To specify the size of the Button. Defaults to 'medium'.\n */\n size: PropTypes.oneOf(Object.values(BUTTON_SIZES)),\n /**\n * The content of the tooltip when the value is copied to clipboard. Defaults to 'Copy'.\n */\n tooltipContent: PropTypes.string,\n /**\n * The content of the tooltip when the value is copied to clipboard. Defaults to 'Copied'.\n */\n successTooltipContent: PropTypes.string,\n};\n\nexport default CopyToClipboardButton;\n"],"names":["TIME_OUT","TOOLTIP_CONFIG","trigger","hideAfter","position","BUTTON_SIZES","small","medium","CopyToClipboardButton","_ref","className","_ref$icon","icon","Copy","_ref$label","label","successLabel","tooltipContent","successTooltipContent","value","style","_ref$size","size","tooltipProps","onClick","otherProps","_objectWithoutProperties","_excluded","_useTranslation","useTranslation","t","_useState","useState","_useState2","_slicedToArray","isChecked","setIsChecked","ref","useRef","onHandleClick","event","preventDefault","stopPropagation","copyToClipboard","showToastr","setTimeout","useLayoutEffect","current","minWidth","buttonWidth","clientWidth","concat","tooltipOptions","mergeAll","content","buttonLabel","buttonIcon","Check","_jsx","Button","_objectSpread","classnames","_defineProperty"],"mappings":";;;;;;;;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gC,WAAW,GACfpB,SAAS,IAAIpB,KAAK,GACdC,YAAY,IAAIc,CAAC,CAAC,8BAA8B,CAAC,GACjDf,KAAK;AACX,EAAA,IAAMyC,UAAU,GAAGrB,SAAS,GAAGsB,KAAK,GAAG7C,IAAI;AAE3C,EAAA,oBACE8C,GAAA,CAACC,MAAM,EAAAC,aAAA,CAAA;AACCvB,IAAAA,GAAG,EAAHA,GAAG;AAAEf,IAAAA,IAAI,EAAJA,IAAI;AAAEF,IAAAA,KAAK,EAALA,KAAK;AACtB,IAAA,aAAA,EAAY,0BAA0B;AACtCR,IAAAA,IAAI,EAAE4C,UAAW;AACjBzC,IAAAA,KAAK,EAAEwC,WAAY;AACnBhC,IAAAA,YAAY,EAAE6B,cAAe;IAC7B1C,SAAS,EAAEmD,UAAU,CAAC,6BAA6B,EAAAC,eAAA,CAAAA,eAAA,CAAAA,eAAA,CAAA,EAAA,EAChDpD,SAAS,EAAGA,SAAS,CAAA,EACtB,qCAAqC,EAAEyB,SAAS,CAAA,EAAA,+BAAA,CAAAgB,MAAA,CACf7B,IAAI,CAAA,EAAKA,IAAI,CAC/C,CAAE;AACHE,IAAAA,OAAO,EAAEe;GAAc,EACnBd,UAAU,CACf,CAAC;AAEN;;;;"}
|
package/dist/ShareViaLink.js
CHANGED
|
@@ -578,6 +578,7 @@ var Card = function Card(_ref) {
|
|
|
578
578
|
size: 24
|
|
579
579
|
}), /*#__PURE__*/jsxs(Typography, {
|
|
580
580
|
className: "neeto-molecules-share-landing__card-title min-w-0 flex-grow break-words",
|
|
581
|
+
"data-testid": "share-card-title",
|
|
581
582
|
style: "h4",
|
|
582
583
|
children: [title, helpPopoverProps && /*#__PURE__*/jsxs(Fragment, {
|
|
583
584
|
children: [" ", /*#__PURE__*/jsx(HelpPopover, _objectSpread({}, helpPopoverProps))]
|
|
@@ -585,6 +586,7 @@ var Card = function Card(_ref) {
|
|
|
585
586
|
})]
|
|
586
587
|
}), description && /*#__PURE__*/jsx(Typography, {
|
|
587
588
|
className: "neeto-molecules-share-landing__card-desc break-words",
|
|
589
|
+
"data-testid": "share-card-description",
|
|
588
590
|
lineHeight: "normal",
|
|
589
591
|
style: "body2",
|
|
590
592
|
children: description
|