@chayns-components/core 5.5.12 → 5.5.20
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/AGENTS.md +21 -0
- package/lib/cjs/components/copyable-content/CopyableContent.js +27 -12
- package/lib/cjs/components/copyable-content/CopyableContent.js.map +1 -1
- package/lib/cjs/components/copyable-content/CopyableContent.styles.js +14 -8
- package/lib/cjs/components/copyable-content/CopyableContent.styles.js.map +1 -1
- package/lib/cjs/components/copyable-content/CopyableContent.test.js +26 -17
- package/lib/cjs/components/copyable-content/CopyableContent.test.js.map +1 -1
- package/lib/cjs/components/copyable-content/CopyableContent.types.js +15 -0
- package/lib/cjs/components/copyable-content/CopyableContent.types.js.map +1 -0
- package/lib/cjs/components/copyable-content/copyableContentClipboard.js +45 -28
- package/lib/cjs/components/copyable-content/copyableContentClipboard.js.map +1 -1
- package/lib/cjs/components/copyable-content/copyableContentClipboard.test.js +13 -11
- package/lib/cjs/components/copyable-content/copyableContentClipboard.test.js.map +1 -1
- package/lib/cjs/components/sharing-context-menu/SharingContextMenu.js +11 -12
- package/lib/cjs/components/sharing-context-menu/SharingContextMenu.js.map +1 -1
- package/lib/cjs/components/sharing-context-menu/SharingContextMenu.test.js +48 -0
- package/lib/cjs/components/sharing-context-menu/SharingContextMenu.test.js.map +1 -0
- package/lib/cjs/constants/textStrings.js +0 -4
- package/lib/cjs/constants/textStrings.js.map +1 -1
- package/lib/cjs/index.js +7 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/utils/sharingBar.js +14 -17
- package/lib/cjs/utils/sharingBar.js.map +1 -1
- package/lib/esm/components/copyable-content/CopyableContent.js +23 -13
- package/lib/esm/components/copyable-content/CopyableContent.js.map +1 -1
- package/lib/esm/components/copyable-content/CopyableContent.styles.js +14 -8
- package/lib/esm/components/copyable-content/CopyableContent.styles.js.map +1 -1
- package/lib/esm/components/copyable-content/CopyableContent.test.js +24 -16
- package/lib/esm/components/copyable-content/CopyableContent.test.js.map +1 -1
- package/lib/esm/components/copyable-content/CopyableContent.types.js +9 -0
- package/lib/esm/components/copyable-content/CopyableContent.types.js.map +1 -0
- package/lib/esm/components/copyable-content/copyableContentClipboard.js +41 -28
- package/lib/esm/components/copyable-content/copyableContentClipboard.js.map +1 -1
- package/lib/esm/components/copyable-content/copyableContentClipboard.test.js +13 -11
- package/lib/esm/components/copyable-content/copyableContentClipboard.test.js.map +1 -1
- package/lib/esm/components/sharing-context-menu/SharingContextMenu.js +11 -12
- package/lib/esm/components/sharing-context-menu/SharingContextMenu.js.map +1 -1
- package/lib/esm/components/sharing-context-menu/SharingContextMenu.test.js +45 -0
- package/lib/esm/components/sharing-context-menu/SharingContextMenu.test.js.map +1 -0
- package/lib/esm/constants/textStrings.js +0 -4
- package/lib/esm/constants/textStrings.js.map +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/utils/sharingBar.js +15 -18
- package/lib/esm/utils/sharingBar.js.map +1 -1
- package/lib/types/components/copyable-content/CopyableContent.d.ts +6 -1
- package/lib/types/components/copyable-content/CopyableContent.styles.d.ts +7 -2
- package/lib/types/components/copyable-content/CopyableContent.types.d.ts +7 -0
- package/lib/types/components/sharing-context-menu/SharingContextMenu.d.ts +16 -0
- package/lib/types/constants/textStrings.d.ts +0 -4
- package/lib/types/index.d.ts +1 -1
- package/package.json +5 -7
- package/LICENSE +0 -21
|
@@ -17,6 +17,8 @@ const SharingContextMenu = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
17
17
|
link,
|
|
18
18
|
children,
|
|
19
19
|
shouldEnableKeyboardHighlighting,
|
|
20
|
+
shouldShowCallingCodeAction = true,
|
|
21
|
+
shouldShowCopyAction = true,
|
|
20
22
|
...contextMenuProps
|
|
21
23
|
}, ref) => {
|
|
22
24
|
const isTouch = (0, _environment.useIsTouch)();
|
|
@@ -63,12 +65,12 @@ const SharingContextMenu = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
63
65
|
break;
|
|
64
66
|
}
|
|
65
67
|
}, [link, isTouch]);
|
|
66
|
-
const contextMenuItems = [{
|
|
68
|
+
const contextMenuItems = [...(shouldShowCopyAction ? [{
|
|
67
69
|
icons: ['fa fa-copy'],
|
|
68
70
|
key: 'copy',
|
|
69
71
|
onClick: () => handleShare('copy'),
|
|
70
72
|
text: 'Zwischenablage'
|
|
71
|
-
}, {
|
|
73
|
+
}] : []), {
|
|
72
74
|
icons: ['fa-solid fa-brands fa-whatsapp'],
|
|
73
75
|
key: 'whatsapp',
|
|
74
76
|
onClick: () => handleShare('whatsapp'),
|
|
@@ -88,21 +90,18 @@ const SharingContextMenu = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
88
90
|
key: 'mail',
|
|
89
91
|
onClick: () => handleShare('mail'),
|
|
90
92
|
text: 'Mail'
|
|
91
|
-
}, {
|
|
93
|
+
}, ...(shouldShowCallingCodeAction ? [{
|
|
92
94
|
icons: ['fa fa-qrcode'],
|
|
93
95
|
key: 'callingCode',
|
|
94
96
|
onClick: handleImageDownload,
|
|
95
97
|
text: 'Calling Code herunterladen'
|
|
96
|
-
}];
|
|
97
|
-
return (
|
|
98
|
-
|
|
98
|
+
}] : [])];
|
|
99
|
+
return /*#__PURE__*/_react.default.createElement(_ContextMenu.default, _extends({
|
|
100
|
+
items: contextMenuItems,
|
|
101
|
+
ref: ref,
|
|
102
|
+
shouldEnableKeyboardHighlighting: shouldEnableKeyboardHighlighting
|
|
99
103
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
100
|
-
|
|
101
|
-
items: contextMenuItems,
|
|
102
|
-
ref: ref,
|
|
103
|
-
shouldEnableKeyboardHighlighting: shouldEnableKeyboardHighlighting
|
|
104
|
-
}, contextMenuProps), children)
|
|
105
|
-
);
|
|
104
|
+
}, contextMenuProps), children);
|
|
106
105
|
});
|
|
107
106
|
SharingContextMenu.displayName = 'SharingContextMenu';
|
|
108
107
|
var _default = exports.default = SharingContextMenu;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharingContextMenu.js","names":["_chaynsApi","require","_react","_interopRequireWildcard","_sharingBar","_environment","_sharingBar2","_ContextMenu","_interopRequireDefault","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","SharingContextMenu","forwardRef","link","children","shouldEnableKeyboardHighlighting","contextMenuProps","ref","isTouch","useIsTouch","handleImageDownload","useCallback","shareWithUrl","SHAREPROVIDER","url","replace","encodeURIComponent","getSite","color","handleShare","key","trim","shareWithApp","copyToClipboard","contextMenuItems","icons","onClick","text","createElement","items","displayName","_default","exports"],"sources":["../../../../src/components/sharing-context-menu/SharingContextMenu.tsx"],"sourcesContent":["import { getSite } from 'chayns-api';\nimport React, { forwardRef, useCallback } from 'react';\nimport { SHAREPROVIDER } from '../../constants/sharingBar';\nimport { useIsTouch } from '../../utils/environment';\nimport { copyToClipboard, shareWithApp, shareWithUrl } from '../../utils/sharingBar';\nimport ContextMenu from '../context-menu/ContextMenu';\nimport { ContextMenuProps, ContextMenuRef } from '../context-menu/ContextMenu.types';\n\nexport type SharingContextMenuProps = {\n /**\n * The link that should be shared.\n */\n link: string;\n /**\n * Enables keyboard-only focus highlighting for the context menu trigger.\n */\n shouldEnableKeyboardHighlighting?: boolean;\n} & Omit<ContextMenuProps, 'items' | 'shouldEnableKeyboardHighlighting'>;\n\nconst SharingContextMenu = forwardRef<ContextMenuRef, SharingContextMenuProps>(\n ({ link, children, shouldEnableKeyboardHighlighting, ...contextMenuProps }, ref) => {\n const isTouch = useIsTouch();\n\n const handleImageDownload = useCallback(() => {\n shareWithUrl(\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n SHAREPROVIDER[5].url\n .replace('{url}', encodeURIComponent(link))\n .replace('{linkText}', 'Teilen')\n .replace('{color}', getSite().color.replace('#', '')),\n );\n }, [link]);\n\n const handleShare = useCallback(\n (key: string) => {\n switch (key) {\n case 'whatsapp':\n shareWithUrl(\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n SHAREPROVIDER[0].url.replace(\n '{url}',\n encodeURIComponent(`${link}`.trim()),\n ),\n );\n break;\n case 'facebook':\n shareWithUrl(\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n SHAREPROVIDER[3].url.replace('{url}', encodeURIComponent(link)),\n );\n break;\n case 'twitter':\n shareWithUrl(\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n SHAREPROVIDER[4].url\n .replace('{url}', encodeURIComponent(link))\n .replace('{linkText}', ''),\n );\n break;\n case 'mail':\n if (isTouch) {\n shareWithApp(`${link}`.trim());\n } else {\n shareWithUrl(\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n SHAREPROVIDER[2].url.replace(\n '{url}',\n encodeURIComponent(`${link}`.trim()),\n ),\n );\n }\n break;\n case 'copy':\n copyToClipboard(link);\n break;\n default:\n break;\n }\n },\n [link, isTouch],\n );\n\n const contextMenuItems = [\n {\n icons: ['fa fa-copy'],\n key: 'copy',\n onClick: () => handleShare('copy'),\n text: 'Zwischenablage',\n },\n {\n icons: ['fa-solid fa-brands fa-whatsapp'],\n key: 'whatsapp',\n onClick: () => handleShare('whatsapp'),\n text: 'Whatsapp',\n },\n {\n icons: ['fa-solid fa-brands fa-facebook-f'],\n key: 'facebook',\n onClick: () => handleShare('facebook'),\n text: 'Facebook',\n },\n {\n icons: ['fa-solid fa-brands fa-x-twitter'],\n key: 'twitter',\n onClick: () => handleShare('twitter'),\n text: 'X',\n },\n {\n icons: ['fa fa-envelope'],\n key: 'mail',\n onClick: () => handleShare('mail'),\n text: 'Mail',\n },\n {\n icons: ['fa fa-qrcode'],\n key: 'callingCode',\n onClick: handleImageDownload,\n text: 'Calling Code herunterladen',\n },\n ];\n\n return (\n // eslint-disable-next-line react/jsx-props-no-spreading\n <ContextMenu\n items={contextMenuItems}\n ref={ref}\n shouldEnableKeyboardHighlighting={shouldEnableKeyboardHighlighting}\n {...contextMenuProps}\n >\n {children}\n </ContextMenu>\n );\n },\n);\n\nSharingContextMenu.displayName = 'SharingContextMenu';\n\nexport default SharingContextMenu;\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAC,sBAAA,CAAAP,OAAA;AAAsD,SAAAO,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAN,wBAAAM,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAV,uBAAA,YAAAA,CAAAM,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAAAJ,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAE,CAAA,CAAAI,GAAA,CAAAX,CAAA,UAAAO,CAAA,CAAAK,GAAA,CAAAZ,CAAA,GAAAO,CAAA,CAAAM,GAAA,CAAAb,CAAA,EAAAS,CAAA,gBAAAN,CAAA,IAAAH,CAAA,gBAAAG,CAAA,OAAAW,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAG,CAAA,OAAAK,CAAA,IAAAD,CAAA,GAAAS,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBA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enu.js","names":["_chaynsApi","require","_react","_interopRequireWildcard","_sharingBar","_environment","_sharingBar2","_ContextMenu","_interopRequireDefault","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","SharingContextMenu","forwardRef","link","children","shouldEnableKeyboardHighlighting","shouldShowCallingCodeAction","shouldShowCopyAction","contextMenuProps","ref","isTouch","useIsTouch","handleImageDownload","useCallback","shareWithUrl","SHAREPROVIDER","url","replace","encodeURIComponent","getSite","color","handleShare","key","trim","shareWithApp","copyToClipboard","contextMenuItems","icons","onClick","text","createElement","items","displayName","_default","exports"],"sources":["../../../../src/components/sharing-context-menu/SharingContextMenu.tsx"],"sourcesContent":["import { getSite } from 'chayns-api';\nimport React, { forwardRef, useCallback } from 'react';\nimport { SHAREPROVIDER } from '../../constants/sharingBar';\nimport { useIsTouch } from '../../utils/environment';\nimport { copyToClipboard, shareWithApp, shareWithUrl } from '../../utils/sharingBar';\nimport ContextMenu from '../context-menu/ContextMenu';\nimport { ContextMenuProps, ContextMenuRef } from '../context-menu/ContextMenu.types';\n\nexport type SharingContextMenuProps = {\n /**\n * The link that should be shared.\n */\n link: string;\n /**\n * Shows the action that copies the shared link to the clipboard.\n */\n shouldShowCopyAction?: boolean;\n /**\n * Shows the action that downloads a calling-code image.\n */\n shouldShowCallingCodeAction?: boolean;\n /**\n * Enables keyboard-only focus highlighting for the context menu trigger.\n */\n shouldEnableKeyboardHighlighting?: boolean;\n} & Omit<ContextMenuProps, 'items' | 'shouldEnableKeyboardHighlighting'>;\n\nconst SharingContextMenu = forwardRef<ContextMenuRef, SharingContextMenuProps>(\n (\n {\n link,\n children,\n shouldEnableKeyboardHighlighting,\n shouldShowCallingCodeAction = true,\n shouldShowCopyAction = true,\n ...contextMenuProps\n },\n ref,\n ) => {\n const isTouch = useIsTouch();\n\n const handleImageDownload = useCallback(() => {\n shareWithUrl(\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n SHAREPROVIDER[5].url\n .replace('{url}', encodeURIComponent(link))\n .replace('{linkText}', 'Teilen')\n .replace('{color}', getSite().color.replace('#', '')),\n );\n }, [link]);\n\n const handleShare = useCallback(\n (key: string) => {\n switch (key) {\n case 'whatsapp':\n shareWithUrl(\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n SHAREPROVIDER[0].url.replace(\n '{url}',\n encodeURIComponent(`${link}`.trim()),\n ),\n );\n break;\n case 'facebook':\n shareWithUrl(\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n SHAREPROVIDER[3].url.replace('{url}', encodeURIComponent(link)),\n );\n break;\n case 'twitter':\n shareWithUrl(\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n SHAREPROVIDER[4].url\n .replace('{url}', encodeURIComponent(link))\n .replace('{linkText}', ''),\n );\n break;\n case 'mail':\n if (isTouch) {\n shareWithApp(`${link}`.trim());\n } else {\n shareWithUrl(\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n SHAREPROVIDER[2].url.replace(\n '{url}',\n encodeURIComponent(`${link}`.trim()),\n ),\n );\n }\n break;\n case 'copy':\n copyToClipboard(link);\n break;\n default:\n break;\n }\n },\n [link, isTouch],\n );\n\n const contextMenuItems = [\n ...(shouldShowCopyAction\n ? [\n {\n icons: ['fa fa-copy'],\n key: 'copy',\n onClick: () => handleShare('copy'),\n text: 'Zwischenablage',\n },\n ]\n : []),\n {\n icons: ['fa-solid fa-brands fa-whatsapp'],\n key: 'whatsapp',\n onClick: () => handleShare('whatsapp'),\n text: 'Whatsapp',\n },\n {\n icons: ['fa-solid fa-brands fa-facebook-f'],\n key: 'facebook',\n onClick: () => handleShare('facebook'),\n text: 'Facebook',\n },\n {\n icons: ['fa-solid fa-brands fa-x-twitter'],\n key: 'twitter',\n onClick: () => handleShare('twitter'),\n text: 'X',\n },\n {\n icons: ['fa fa-envelope'],\n key: 'mail',\n onClick: () => handleShare('mail'),\n text: 'Mail',\n },\n ...(shouldShowCallingCodeAction\n ? [\n {\n icons: ['fa fa-qrcode'],\n key: 'callingCode',\n onClick: handleImageDownload,\n text: 'Calling Code herunterladen',\n },\n ]\n : []),\n ];\n\n return (\n <ContextMenu\n items={contextMenuItems}\n ref={ref}\n shouldEnableKeyboardHighlighting={shouldEnableKeyboardHighlighting}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...contextMenuProps}\n >\n {children}\n </ContextMenu>\n );\n },\n);\n\nSharingContextMenu.displayName = 'SharingContextMenu';\n\nexport default SharingContextMenu;\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAC,sBAAA,CAAAP,OAAA;AAAsD,SAAAO,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAN,wBAAAM,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAV,uBAAA,YAAAA,CAAAM,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAAAJ,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAE,CAAA,CAAAI,GAAA,CAAAX,CAAA,UAAAO,CAAA,CAAAK,GAAA,CAA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,oBACI5D,MAAA,CAAAS,OAAA,CAAAoD,aAAA,CAACxD,YAAA,CAAAI,OAAW,EAAAiB,QAAA;IACRoC,KAAK,EAAEL,gBAAiB;IACxBjB,GAAG,EAAEA,GAAI;IACTJ,gCAAgC,EAAEA;IAClC;EAAA,GACIG,gBAAgB,GAEnBJ,QACQ,CAAC;AAEtB,CACJ,CAAC;AAEDH,kBAAkB,CAAC+B,WAAW,GAAG,oBAAoB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAxD,OAAA,GAEvCuB,kBAAkB","ignoreList":[]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _react = require("@testing-library/react");
|
|
4
|
+
var _react2 = _interopRequireDefault(require("react"));
|
|
5
|
+
var _vitest = require("vitest");
|
|
6
|
+
var _SharingContextMenu = _interopRequireDefault(require("./SharingContextMenu"));
|
|
7
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
+
_vitest.vi.mock('chayns-api', () => ({
|
|
9
|
+
getSite: () => ({
|
|
10
|
+
color: '#000000'
|
|
11
|
+
})
|
|
12
|
+
}));
|
|
13
|
+
_vitest.vi.mock('../../utils/environment', () => ({
|
|
14
|
+
useIsTouch: () => false
|
|
15
|
+
}));
|
|
16
|
+
_vitest.vi.mock('../context-menu/ContextMenu', () => ({
|
|
17
|
+
default: ({
|
|
18
|
+
children,
|
|
19
|
+
items
|
|
20
|
+
}) => /*#__PURE__*/_react2.default.createElement("div", {
|
|
21
|
+
"data-item-keys": items.map(item => item.key).join(',')
|
|
22
|
+
}, children)
|
|
23
|
+
}));
|
|
24
|
+
(0, _vitest.describe)('SharingContextMenu', () => {
|
|
25
|
+
(0, _vitest.it)('keeps copy and calling-code actions enabled by default', () => {
|
|
26
|
+
const {
|
|
27
|
+
container
|
|
28
|
+
} = (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_SharingContextMenu.default, {
|
|
29
|
+
link: "https://example.com"
|
|
30
|
+
}, /*#__PURE__*/_react2.default.createElement("button", {
|
|
31
|
+
type: "button"
|
|
32
|
+
}, "Share")));
|
|
33
|
+
(0, _vitest.expect)(container.firstChild.getAttribute('data-item-keys')).toBe('copy,whatsapp,facebook,twitter,mail,callingCode');
|
|
34
|
+
});
|
|
35
|
+
(0, _vitest.it)('can hide copy and calling-code actions for dedicated content actions', () => {
|
|
36
|
+
const {
|
|
37
|
+
container
|
|
38
|
+
} = (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_SharingContextMenu.default, {
|
|
39
|
+
link: "https://example.com",
|
|
40
|
+
shouldShowCallingCodeAction: false,
|
|
41
|
+
shouldShowCopyAction: false
|
|
42
|
+
}, /*#__PURE__*/_react2.default.createElement("button", {
|
|
43
|
+
type: "button"
|
|
44
|
+
}, "Share")));
|
|
45
|
+
(0, _vitest.expect)(container.firstChild.getAttribute('data-item-keys')).toBe('whatsapp,facebook,twitter,mail');
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=SharingContextMenu.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SharingContextMenu.test.js","names":["_react","require","_react2","_interopRequireDefault","_vitest","_SharingContextMenu","e","__esModule","default","vi","mock","getSite","color","useIsTouch","children","items","createElement","map","item","key","join","describe","it","container","render","link","type","expect","firstChild","getAttribute","toBe","shouldShowCallingCodeAction","shouldShowCopyAction"],"sources":["../../../../src/components/sharing-context-menu/SharingContextMenu.test.tsx"],"sourcesContent":["import { render } from '@testing-library/react';\nimport React, { ReactNode } from 'react';\nimport { describe, expect, it, vi } from 'vitest';\nimport SharingContextMenu from './SharingContextMenu';\n\nvi.mock('chayns-api', () => ({\n getSite: () => ({ color: '#000000' }),\n}));\n\nvi.mock('../../utils/environment', () => ({\n useIsTouch: () => false,\n}));\n\nvi.mock('../context-menu/ContextMenu', () => ({\n default: ({ children, items }: { children: ReactNode; items: Array<{ key: string }> }) => (\n <div data-item-keys={items.map((item) => item.key).join(',')}>{children}</div>\n ),\n}));\n\ndescribe('SharingContextMenu', () => {\n it('keeps copy and calling-code actions enabled by default', () => {\n const { container } = render(\n <SharingContextMenu link=\"https://example.com\">\n <button type=\"button\">Share</button>\n </SharingContextMenu>,\n );\n\n expect((container.firstChild as HTMLElement).getAttribute('data-item-keys')).toBe(\n 'copy,whatsapp,facebook,twitter,mail,callingCode',\n );\n });\n\n it('can hide copy and calling-code actions for dedicated content actions', () => {\n const { container } = render(\n <SharingContextMenu\n link=\"https://example.com\"\n shouldShowCallingCodeAction={false}\n shouldShowCopyAction={false}\n >\n <button type=\"button\">Share</button>\n </SharingContextMenu>,\n );\n\n expect((container.firstChild as HTMLElement).getAttribute('data-item-keys')).toBe(\n 'whatsapp,facebook,twitter,mail',\n );\n });\n});\n"],"mappings":";;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,mBAAA,GAAAF,sBAAA,CAAAF,OAAA;AAAsD,SAAAE,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEtDG,UAAE,CAACC,IAAI,CAAC,YAAY,EAAE,OAAO;EACzBC,OAAO,EAAEA,CAAA,MAAO;IAAEC,KAAK,EAAE;EAAU,CAAC;AACxC,CAAC,CAAC,CAAC;AAEHH,UAAE,CAACC,IAAI,CAAC,yBAAyB,EAAE,OAAO;EACtCG,UAAU,EAAEA,CAAA,KAAM;AACtB,CAAC,CAAC,CAAC;AAEHJ,UAAE,CAACC,IAAI,CAAC,6BAA6B,EAAE,OAAO;EAC1CF,OAAO,EAAEA,CAAC;IAAEM,QAAQ;IAAEC;EAA8D,CAAC,kBACjFb,OAAA,CAAAM,OAAA,CAAAQ,aAAA;IAAK,kBAAgBD,KAAK,CAACE,GAAG,CAAEC,IAAI,IAAKA,IAAI,CAACC,GAAG,CAAC,CAACC,IAAI,CAAC,GAAG;EAAE,GAAEN,QAAc;AAErF,CAAC,CAAC,CAAC;AAEH,IAAAO,gBAAQ,EAAC,oBAAoB,EAAE,MAAM;EACjC,IAAAC,UAAE,EAAC,wDAAwD,EAAE,MAAM;IAC/D,MAAM;MAAEC;IAAU,CAAC,GAAG,IAAAC,aAAM,eACxBtB,OAAA,CAAAM,OAAA,CAAAQ,aAAA,CAACX,mBAAA,CAAAG,OAAkB;MAACiB,IAAI,EAAC;IAAqB,gBAC1CvB,OAAA,CAAAM,OAAA,CAAAQ,aAAA;MAAQU,IAAI,EAAC;IAAQ,GAAC,OAAa,CACnB,CACxB,CAAC;IAED,IAAAC,cAAM,EAAEJ,SAAS,CAACK,UAAU,CAAiBC,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAACC,IAAI,CAC7E,iDACJ,CAAC;EACL,CAAC,CAAC;EAEF,IAAAR,UAAE,EAAC,sEAAsE,EAAE,MAAM;IAC7E,MAAM;MAAEC;IAAU,CAAC,GAAG,IAAAC,aAAM,eACxBtB,OAAA,CAAAM,OAAA,CAAAQ,aAAA,CAACX,mBAAA,CAAAG,OAAkB;MACfiB,IAAI,EAAC,qBAAqB;MAC1BM,2BAA2B,EAAE,KAAM;MACnCC,oBAAoB,EAAE;IAAM,gBAE5B9B,OAAA,CAAAM,OAAA,CAAAQ,aAAA;MAAQU,IAAI,EAAC;IAAQ,GAAC,OAAa,CACnB,CACxB,CAAC;IAED,IAAAC,cAAM,EAAEJ,SAAS,CAACK,UAAU,CAAiBC,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAACC,IAAI,CAC7E,gCACJ,CAAC;EACL,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
|
|
@@ -55,10 +55,6 @@ var _default = exports.default = {
|
|
|
55
55
|
stringName: 'txt_chayns_components_core_components_copyableContent_share',
|
|
56
56
|
fallback: 'Teilen'
|
|
57
57
|
},
|
|
58
|
-
copied: {
|
|
59
|
-
stringName: 'txt_chayns_components_core_components_copyableContent_copied',
|
|
60
|
-
fallback: 'Kopiert'
|
|
61
|
-
},
|
|
62
58
|
copyFailed: {
|
|
63
59
|
stringName: 'txt_chayns_components_core_components_copyableContent_copyFailed',
|
|
64
60
|
fallback: 'Kopieren fehlgeschlagen'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textStrings.js","names":["components","filter","filterContent","input","placeholder","stringName","fallback","sort","filterButtons","all","truncation","less","more","fileItem","download","remove","copyableContent","copy","share","
|
|
1
|
+
{"version":3,"file":"textStrings.js","names":["components","filter","filterContent","input","placeholder","stringName","fallback","sort","filterButtons","all","truncation","less","more","fileItem","download","remove","copyableContent","copy","share","copyFailed"],"sources":["../../../src/constants/textStrings.ts"],"sourcesContent":["export default {\n components: {\n filter: {\n filterContent: {\n input: {\n placeholder: {\n stringName:\n 'txt_chayns_components_core_components_filter_filterContent_input_placeholder',\n fallback: 'Suche',\n },\n },\n sort: {\n stringName: 'txt_chayns_components_core_components_filter_filterContent_sort',\n fallback: 'Sortierung',\n },\n },\n },\n filterButtons: {\n all: {\n stringName: 'txt_chayns_components_core_components_filterButtons_all',\n fallback: 'Alle',\n },\n },\n truncation: {\n less: {\n stringName: 'txt_chayns_components_core_components_truncation_less',\n fallback: 'Weniger',\n },\n more: {\n stringName: 'txt_chayns_components_core_components_truncation_more',\n fallback: 'Mehr',\n },\n },\n fileItem: {\n download: {\n stringName: 'txt_chayns_components_core_components_fileItem_download',\n fallback: 'Download',\n },\n remove: {\n stringName: 'txt_chayns_components_core_components_fileItem_remove',\n fallback: 'Entfernen',\n },\n },\n copyableContent: {\n copy: {\n stringName: 'txt_chayns_components_core_components_copyableContent_copy',\n fallback: 'Kopieren',\n },\n share: {\n stringName: 'txt_chayns_components_core_components_copyableContent_share',\n fallback: 'Teilen',\n },\n copyFailed: {\n stringName: 'txt_chayns_components_core_components_copyableContent_copyFailed',\n fallback: 'Kopieren fehlgeschlagen',\n },\n },\n },\n} as const;\n"],"mappings":";;;;;;iCAAe;EACXA,UAAU,EAAE;IACRC,MAAM,EAAE;MACJC,aAAa,EAAE;QACXC,KAAK,EAAE;UACHC,WAAW,EAAE;YACTC,UAAU,EACN,8EAA8E;YAClFC,QAAQ,EAAE;UACd;QACJ,CAAC;QACDC,IAAI,EAAE;UACFF,UAAU,EAAE,iEAAiE;UAC7EC,QAAQ,EAAE;QACd;MACJ;IACJ,CAAC;IACDE,aAAa,EAAE;MACXC,GAAG,EAAE;QACDJ,UAAU,EAAE,yDAAyD;QACrEC,QAAQ,EAAE;MACd;IACJ,CAAC;IACDI,UAAU,EAAE;MACRC,IAAI,EAAE;QACFN,UAAU,EAAE,uDAAuD;QACnEC,QAAQ,EAAE;MACd,CAAC;MACDM,IAAI,EAAE;QACFP,UAAU,EAAE,uDAAuD;QACnEC,QAAQ,EAAE;MACd;IACJ,CAAC;IACDO,QAAQ,EAAE;MACNC,QAAQ,EAAE;QACNT,UAAU,EAAE,yDAAyD;QACrEC,QAAQ,EAAE;MACd,CAAC;MACDS,MAAM,EAAE;QACJV,UAAU,EAAE,uDAAuD;QACnEC,QAAQ,EAAE;MACd;IACJ,CAAC;IACDU,eAAe,EAAE;MACbC,IAAI,EAAE;QACFZ,UAAU,EAAE,4DAA4D;QACxEC,QAAQ,EAAE;MACd,CAAC;MACDY,KAAK,EAAE;QACHb,UAAU,EAAE,6DAA6D;QACzEC,QAAQ,EAAE;MACd,CAAC;MACDa,UAAU,EAAE;QACRd,UAAU,EAAE,kEAAkE;QAC9EC,QAAQ,EAAE;MACd;IACJ;EACJ;AACJ,CAAC","ignoreList":[]}
|
package/lib/cjs/index.js
CHANGED
|
@@ -147,6 +147,12 @@ Object.defineProperty(exports, "CopyableContent", {
|
|
|
147
147
|
return _CopyableContent.default;
|
|
148
148
|
}
|
|
149
149
|
});
|
|
150
|
+
Object.defineProperty(exports, "CopyableContentAppearance", {
|
|
151
|
+
enumerable: true,
|
|
152
|
+
get: function () {
|
|
153
|
+
return _CopyableContent.CopyableContentAppearance;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
150
156
|
Object.defineProperty(exports, "DropdownBodyWrapper", {
|
|
151
157
|
enumerable: true,
|
|
152
158
|
get: function () {
|
|
@@ -621,7 +627,7 @@ var _FileSelect = _interopRequireDefault(require("./components/file-select/FileS
|
|
|
621
627
|
var _DropdownBodyWrapper = _interopRequireDefault(require("./components/dropdown-body-wrapper/DropdownBodyWrapper"));
|
|
622
628
|
var _ComboBox = _interopRequireDefault(require("./components/combobox/ComboBox"));
|
|
623
629
|
var _ContentCard = _interopRequireDefault(require("./components/content-card/ContentCard"));
|
|
624
|
-
var _CopyableContent =
|
|
630
|
+
var _CopyableContent = _interopRequireWildcard(require("./components/copyable-content/CopyableContent"));
|
|
625
631
|
var _HighlightSlider = _interopRequireDefault(require("./components/highlight-slider/HighlightSlider"));
|
|
626
632
|
var _ContextMenu = _interopRequireDefault(require("./components/context-menu/ContextMenu"));
|
|
627
633
|
var _ContextMenu2 = require("./components/context-menu/ContextMenu.types");
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_Accordion","_interopRequireDefault","require","_AccordionContent","_AccordionGroup","_AccordionIntro","_AccordionItem","_AmountControl","_VerificationBadge","_AreaContextProvider","_interopRequireWildcard","_Badge","_Button","_Checkbox","_ColorSchemeProvider","_Badge2","_container","_dropdown","_element","_ref","_Filter","_AnimatedNumber","_FileList","_FileSelect","_DropdownBodyWrapper","_ComboBox","_ContentCard","_CopyableContent","_HighlightSlider","_ContextMenu","_ContextMenu2","_ExpandableContent","_FileInput","_FilterButton","_FilterButtons","_GridImage","_GroupedImage","_Icon","_Input","_List","_ListItemContent","_ListItem","_ListItem2","_MentionFinder","_MultiActionButton","_NumberInput","_PageProvider","_Popup","_PopupContent","_ProgressBar","_popup","_RadioButtonGroup","_RadioButton","_ScrollView","_SearchBox","_SearchInput","_SelectButton","_SetupWizardItem","_SetupWizard","_SharingContextMenu","_SharingBar","_SharingButton","_Signature","_SliderButton","_Slider","_SmallWaitCursor","_TagInput","_TextArea","_Tooltip","_Truncation","_mentionFinder","_contentCard","_file","_filterButtons","_MultiActionButton2","_truncation","_environment","_fileDialog","_isTobitEmployee","_pageProvider","_uploadFile","_ComboBox2","_skeleton","_types","_Masonry","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor"],"sources":["../../src/index.ts"],"sourcesContent":["// noinspection JSUnusedGlobalSymbols\n\nexport { default as Accordion } from './components/accordion/Accordion';\nexport { default as AccordionContent } from './components/accordion/accordion-content/AccordionContent';\nexport { default as AccordionGroup } from './components/accordion/accordion-group/AccordionGroup';\nexport { default as AccordionIntro } from './components/accordion/accordion-intro/AccordionIntro';\nexport { default as AccordionItem } from './components/accordion/accordion-item/AccordionItem';\nexport { default as AmountControl } from './components/amount-control/AmountControl';\nexport { default as VerificationBadge } from './components/verification-badge/VerificationBadge';\nexport {\n AreaContext,\n default as AreaProvider,\n} from './components/area-provider/AreaContextProvider';\nexport { default as Badge } from './components/badge/Badge';\nexport { default as Button } from './components/button/Button';\nexport { default as Checkbox } from './components/checkbox/Checkbox';\nexport {\n default as ColorSchemeProvider,\n useColorScheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport { BadgeSize, BadgeDesign } from './components/badge/Badge.types';\nexport type {\n ColorSchemeContextProps,\n WithTheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport { useContainer, ContainerAnchor } from './hooks/container';\nexport { DropdownDirection, type DropdownCoordinates } from './types/dropdown';\nexport { useIsMeasuredClone } from './hooks/element';\nexport { useCombinedRefs } from './hooks/ref';\nexport { default as Filter, type FilterRightIcon } from './components/filter/Filter';\nexport {\n type SortItem,\n type SearchConfig,\n type SortConfig,\n type CheckboxConfig,\n type FilterButtonConfig,\n type FilterRef,\n} from './types/filter';\nexport { default as AnimatedNumber } from './components/animated-number/AnimatedNumber';\nexport {\n default as FileList,\n type IFileItem as FileListItem,\n} from './components/file-list/FileList';\nexport { default as FileSelect } from './components/file-select/FileSelect';\nexport { default as DropdownBodyWrapper } from './components/dropdown-body-wrapper/DropdownBodyWrapper';\nexport { default as ComboBox } from './components/combobox/ComboBox';\nexport { default as ContentCard } from './components/content-card/ContentCard';\nexport {\n default as CopyableContent,\n type CopyableContentProps,\n} from './components/copyable-content/CopyableContent';\nexport { default as HighlightSlider } from './components/highlight-slider/HighlightSlider';\nexport type { HighlightSliderItemColors as HighlightSliderColors } from './components/highlight-slider/highlight-slider-item/HighlightSliderItem';\nexport { default as ContextMenu } from './components/context-menu/ContextMenu';\nexport {\n ContextMenuAlignment,\n type ContextMenuCoordinates,\n type ContextMenuItem,\n type ContextMenuProps,\n type ContextMenuRef,\n} from './components/context-menu/ContextMenu.types';\nexport { default as ExpandableContent } from './components/expandable-content/ExpandableContent';\nexport {\n default as FileInput,\n type FileInputRef,\n STREAMINGSERVICE_FILE_TYPES,\n TSIMG_FILE_TYPES,\n} from './components/file-input/FileInput';\nexport { default as FilterButton } from './components/filter-buttons/filter-button/FilterButton';\nexport { default as FilterButtons } from './components/filter-buttons/FilterButtons';\nexport { default as GridImage } from './components/grid-image/GridImage';\nexport { default as GroupedImage } from './components/grouped-image/GroupedImage';\nexport { default as Icon, type IconProps } from './components/icon/Icon';\nexport { default as Input, InputSize } from './components/input/Input';\nexport { default as List } from './components/list/List';\nexport { default as ListItemContent } from './components/list/list-item/list-item-content/ListItemContent';\nexport {\n default as ListItem,\n type ListItemElements,\n type ListItemProps,\n type ListItemRef,\n type ListItemSize,\n} from './components/list/list-item/ListItem';\nexport {\n type ListItemMarkedForwardRefComponent,\n type ListItemMarkedComponent,\n type ListItemMetaProps,\n LIST_ITEM_MARKER,\n withListItemMarker,\n withListItemMarkerForwardRef,\n} from './components/list/list-item/ListItem.utils';\nexport { default as MentionFinder } from './components/mention-finder/MentionFinder';\nexport type { MentionMember } from './components/mention-finder/MentionFinder';\nexport { default as MultiActionButton } from './components/multi-action-button/MultiActionButton';\nexport { default as NumberInput } from './components/number-input/NumberInput';\nexport { default as PageProvider } from './components/page-provider/PageProvider';\nexport { default as Popup } from './components/popup/Popup';\nexport { default as PopupContent } from './components/popup/popup-content/PopupContent';\nexport { default as ProgressBar } from './components/progress-bar/ProgressBar';\nexport { PopupAlignment } from './types/popup';\nexport type { PopupProps } from './components/popup/Popup.types';\nexport {\n default as RadioButtonGroup,\n type RadioButtonGroupRef,\n} from './components/radio-button/radio-button-group/RadioButtonGroup';\nexport { default as RadioButton } from './components/radio-button/RadioButton';\nexport { default as ScrollView } from './components/scroll-view/ScrollView';\nexport { default as SearchBox } from './components/search-box/SearchBox';\nexport { default as SearchInput } from './components/search-input/SearchInput';\nexport { default as SelectButton } from './components/select-button/SelectButton';\nexport { default as SetupWizardItem } from './components/setup-wizard/setup-wizard-item/SetupWizardItem';\nexport { default as SetupWizard } from './components/setup-wizard/SetupWizard';\nexport type { SetupWizardRef } from './components/setup-wizard/SetupWizard';\nexport { default as SharingContextMenu } from './components/sharing-context-menu/SharingContextMenu';\nexport { default as SharingBar } from './components/sharing-bar/SharingBar';\nexport { default as SharingButton } from './components/sharing-button/SharingButton';\nexport { default as Signature } from './components/signature/Signature';\nexport type { SignatureRef } from './components/signature/Signature';\nexport { default as SliderButton } from './components/slider-button/SliderButton';\nexport { default as Slider } from './components/slider/Slider';\nexport {\n default as SmallWaitCursor,\n SmallWaitCursorSize,\n SmallWaitCursorSpeed,\n} from './components/small-wait-cursor/SmallWaitCursor';\nexport type { Tag } from './types/tagInput';\nexport { default as TagInput } from './components/tag-input/TagInput';\nexport type { TagInputRef } from './components/tag-input/TagInput';\nexport { default as TextArea } from './components/text-area/TextArea';\nexport { default as Tooltip } from './components/tooltip/Tooltip';\nexport { default as Truncation } from './components/truncation/Truncation';\nexport { MentionFinderPopupAlignment } from './constants/mentionFinder';\nexport { useElementSize } from './hooks/element';\nexport type { BrowserName } from './types/chayns';\nexport { ContentCardType } from './types/contentCard';\nexport type { FileItem, Image, InternalFileItem, Meta, Video } from './types/file';\nexport { isValidFileType, getHumanSize } from './utils/file';\nexport type { FileInputFileItem } from './types/fileInput';\nexport { FilterButtonItemShape, FilterButtonSize } from './types/filterButtons';\nexport type { IFilterButtonItem as FilterButtonItem } from './types/filterButtons';\nexport type { IListItemRightElements } from './types/list';\nexport type { PopupRef } from './types/popup';\nexport type { RadioButtonItem } from './types/radioButton';\nexport type {\n ISearchBoxItem as SearchBoxItem,\n ISearchBoxItems as SearchBoxItems,\n} from './types/searchBox';\nexport type { SelectButtonItem } from './types/selectButton';\nexport type { SliderButtonItem } from './types/slider-button';\nexport {\n type MultiActionButtonAction,\n type MultiActionButtonActionEvent,\n type MultiActionButtonActionStatus,\n MultiActionButtonHeight,\n type MultiActionButtonProps,\n type MultiActionButtonSecondaryContextMenu,\n MultiActionButtonStatusType,\n} from './components/multi-action-button/MultiActionButton.types';\nexport { ClampPosition } from './types/truncation';\nexport { useIsTouch } from './utils/environment';\nexport { filterFilesByMimeType, getFileAsArrayBuffer, selectFiles } from './utils/fileDialog';\nexport { isTobitEmployee } from './utils/isTobitEmployee';\nexport { getUsableHeight } from './utils/pageProvider';\nexport { uploadFile } from './utils/uploadFile';\nexport type { Theme } from './components/color-scheme-provider/ColorSchemeProvider';\nexport { ComboBoxSize } from './components/combobox/ComboBox.types';\nexport type {\n IComboBoxItem as ComboBoxItem,\n ComboBoxTextStyles,\n IComboBoxItems as ComboBoxItems,\n ComboBoxRef,\n} from './components/combobox/ComboBox.types';\nexport { default as Skeleton } from './components/skeleton';\nexport { SkeletonAnimationType } from './components/skeleton/types';\nexport { default as Masonry } from './components/masonry/Masonry';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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E,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAAA,SAAArF,uBAAAoF,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAK,UAAA,GAAAL,CAAA,KAAAU,OAAA,EAAAV,CAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Accordion","_interopRequireDefault","require","_AccordionContent","_AccordionGroup","_AccordionIntro","_AccordionItem","_AmountControl","_VerificationBadge","_AreaContextProvider","_interopRequireWildcard","_Badge","_Button","_Checkbox","_ColorSchemeProvider","_Badge2","_container","_dropdown","_element","_ref","_Filter","_AnimatedNumber","_FileList","_FileSelect","_DropdownBodyWrapper","_ComboBox","_ContentCard","_CopyableContent","_HighlightSlider","_ContextMenu","_ContextMenu2","_ExpandableContent","_FileInput","_FilterButton","_FilterButtons","_GridImage","_GroupedImage","_Icon","_Input","_List","_ListItemContent","_ListItem","_ListItem2","_MentionFinder","_MultiActionButton","_NumberInput","_PageProvider","_Popup","_PopupContent","_ProgressBar","_popup","_RadioButtonGroup","_RadioButton","_ScrollView","_SearchBox","_SearchInput","_SelectButton","_SetupWizardItem","_SetupWizard","_SharingContextMenu","_SharingBar","_SharingButton","_Signature","_SliderButton","_Slider","_SmallWaitCursor","_TagInput","_TextArea","_Tooltip","_Truncation","_mentionFinder","_contentCard","_file","_filterButtons","_MultiActionButton2","_truncation","_environment","_fileDialog","_isTobitEmployee","_pageProvider","_uploadFile","_ComboBox2","_skeleton","_types","_Masonry","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor"],"sources":["../../src/index.ts"],"sourcesContent":["// noinspection JSUnusedGlobalSymbols\n\nexport { default as Accordion } from './components/accordion/Accordion';\nexport { default as AccordionContent } from './components/accordion/accordion-content/AccordionContent';\nexport { default as AccordionGroup } from './components/accordion/accordion-group/AccordionGroup';\nexport { default as AccordionIntro } from './components/accordion/accordion-intro/AccordionIntro';\nexport { default as AccordionItem } from './components/accordion/accordion-item/AccordionItem';\nexport { default as AmountControl } from './components/amount-control/AmountControl';\nexport { default as VerificationBadge } from './components/verification-badge/VerificationBadge';\nexport {\n AreaContext,\n default as AreaProvider,\n} from './components/area-provider/AreaContextProvider';\nexport { default as Badge } from './components/badge/Badge';\nexport { default as Button } from './components/button/Button';\nexport { default as Checkbox } from './components/checkbox/Checkbox';\nexport {\n default as ColorSchemeProvider,\n useColorScheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport { BadgeSize, BadgeDesign } from './components/badge/Badge.types';\nexport type {\n ColorSchemeContextProps,\n WithTheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport { useContainer, ContainerAnchor } from './hooks/container';\nexport { DropdownDirection, type DropdownCoordinates } from './types/dropdown';\nexport { useIsMeasuredClone } from './hooks/element';\nexport { useCombinedRefs } from './hooks/ref';\nexport { default as Filter, type FilterRightIcon } from './components/filter/Filter';\nexport {\n type SortItem,\n type SearchConfig,\n type SortConfig,\n type CheckboxConfig,\n type FilterButtonConfig,\n type FilterRef,\n} from './types/filter';\nexport { default as AnimatedNumber } from './components/animated-number/AnimatedNumber';\nexport {\n default as FileList,\n type IFileItem as FileListItem,\n} from './components/file-list/FileList';\nexport { default as FileSelect } from './components/file-select/FileSelect';\nexport { default as DropdownBodyWrapper } from './components/dropdown-body-wrapper/DropdownBodyWrapper';\nexport { default as ComboBox } from './components/combobox/ComboBox';\nexport { default as ContentCard } from './components/content-card/ContentCard';\nexport {\n default as CopyableContent,\n CopyableContentAppearance,\n type CopyableContentProps,\n} from './components/copyable-content/CopyableContent';\nexport { default as HighlightSlider } from './components/highlight-slider/HighlightSlider';\nexport type { HighlightSliderItemColors as HighlightSliderColors } from './components/highlight-slider/highlight-slider-item/HighlightSliderItem';\nexport { default as ContextMenu } from './components/context-menu/ContextMenu';\nexport {\n ContextMenuAlignment,\n type ContextMenuCoordinates,\n type ContextMenuItem,\n type ContextMenuProps,\n type ContextMenuRef,\n} from './components/context-menu/ContextMenu.types';\nexport { default as ExpandableContent } from './components/expandable-content/ExpandableContent';\nexport {\n default as FileInput,\n type FileInputRef,\n STREAMINGSERVICE_FILE_TYPES,\n TSIMG_FILE_TYPES,\n} from './components/file-input/FileInput';\nexport { default as FilterButton } from './components/filter-buttons/filter-button/FilterButton';\nexport { default as FilterButtons } from './components/filter-buttons/FilterButtons';\nexport { default as GridImage } from './components/grid-image/GridImage';\nexport { default as GroupedImage } from './components/grouped-image/GroupedImage';\nexport { default as Icon, type IconProps } from './components/icon/Icon';\nexport { default as Input, InputSize } from './components/input/Input';\nexport { default as List } from './components/list/List';\nexport { default as ListItemContent } from './components/list/list-item/list-item-content/ListItemContent';\nexport {\n default as ListItem,\n type ListItemElements,\n type ListItemProps,\n type ListItemRef,\n type ListItemSize,\n} from './components/list/list-item/ListItem';\nexport {\n type ListItemMarkedForwardRefComponent,\n type ListItemMarkedComponent,\n type ListItemMetaProps,\n LIST_ITEM_MARKER,\n withListItemMarker,\n withListItemMarkerForwardRef,\n} from './components/list/list-item/ListItem.utils';\nexport { default as MentionFinder } from './components/mention-finder/MentionFinder';\nexport type { MentionMember } from './components/mention-finder/MentionFinder';\nexport { default as MultiActionButton } from './components/multi-action-button/MultiActionButton';\nexport { default as NumberInput } from './components/number-input/NumberInput';\nexport { default as PageProvider } from './components/page-provider/PageProvider';\nexport { default as Popup } from './components/popup/Popup';\nexport { default as PopupContent } from './components/popup/popup-content/PopupContent';\nexport { default as ProgressBar } from './components/progress-bar/ProgressBar';\nexport { PopupAlignment } from './types/popup';\nexport type { PopupProps } from './components/popup/Popup.types';\nexport {\n default as RadioButtonGroup,\n type RadioButtonGroupRef,\n} from './components/radio-button/radio-button-group/RadioButtonGroup';\nexport { default as RadioButton } from './components/radio-button/RadioButton';\nexport { default as ScrollView } from './components/scroll-view/ScrollView';\nexport { default as SearchBox } from './components/search-box/SearchBox';\nexport { default as SearchInput } from './components/search-input/SearchInput';\nexport { default as SelectButton } from './components/select-button/SelectButton';\nexport { default as SetupWizardItem } from './components/setup-wizard/setup-wizard-item/SetupWizardItem';\nexport { default as SetupWizard } from './components/setup-wizard/SetupWizard';\nexport type { SetupWizardRef } from './components/setup-wizard/SetupWizard';\nexport { default as SharingContextMenu } from './components/sharing-context-menu/SharingContextMenu';\nexport { default as SharingBar } from './components/sharing-bar/SharingBar';\nexport { default as SharingButton } from './components/sharing-button/SharingButton';\nexport { default as Signature } from './components/signature/Signature';\nexport type { SignatureRef } from './components/signature/Signature';\nexport { default as SliderButton } from './components/slider-button/SliderButton';\nexport { default as Slider } from './components/slider/Slider';\nexport {\n default as SmallWaitCursor,\n SmallWaitCursorSize,\n SmallWaitCursorSpeed,\n} from './components/small-wait-cursor/SmallWaitCursor';\nexport type { Tag } from './types/tagInput';\nexport { default as TagInput } from './components/tag-input/TagInput';\nexport type { TagInputRef } from './components/tag-input/TagInput';\nexport { default as TextArea } from './components/text-area/TextArea';\nexport { default as Tooltip } from './components/tooltip/Tooltip';\nexport { default as Truncation } from './components/truncation/Truncation';\nexport { MentionFinderPopupAlignment } from './constants/mentionFinder';\nexport { useElementSize } from './hooks/element';\nexport type { BrowserName } from './types/chayns';\nexport { ContentCardType } from './types/contentCard';\nexport type { FileItem, Image, InternalFileItem, Meta, Video } from './types/file';\nexport { isValidFileType, getHumanSize } from './utils/file';\nexport type { FileInputFileItem } from './types/fileInput';\nexport { FilterButtonItemShape, FilterButtonSize } from './types/filterButtons';\nexport type { IFilterButtonItem as FilterButtonItem } from './types/filterButtons';\nexport type { IListItemRightElements } from './types/list';\nexport type { PopupRef } from './types/popup';\nexport type { RadioButtonItem } from './types/radioButton';\nexport type {\n ISearchBoxItem as SearchBoxItem,\n ISearchBoxItems as SearchBoxItems,\n} from './types/searchBox';\nexport type { SelectButtonItem } from './types/selectButton';\nexport type { SliderButtonItem } from './types/slider-button';\nexport {\n type MultiActionButtonAction,\n type MultiActionButtonActionEvent,\n type MultiActionButtonActionStatus,\n MultiActionButtonHeight,\n type MultiActionButtonProps,\n type MultiActionButtonSecondaryContextMenu,\n MultiActionButtonStatusType,\n} from './components/multi-action-button/MultiActionButton.types';\nexport { ClampPosition } from './types/truncation';\nexport { useIsTouch } from './utils/environment';\nexport { filterFilesByMimeType, getFileAsArrayBuffer, selectFiles } from './utils/fileDialog';\nexport { isTobitEmployee } from './utils/isTobitEmployee';\nexport { getUsableHeight } from './utils/pageProvider';\nexport { uploadFile } from './utils/uploadFile';\nexport type { Theme } from './components/color-scheme-provider/ColorSchemeProvider';\nexport { ComboBoxSize } from './components/combobox/ComboBox.types';\nexport type {\n IComboBoxItem as ComboBoxItem,\n ComboBoxTextStyles,\n IComboBoxItems as ComboBoxItems,\n ComboBoxRef,\n} from './components/combobox/ComboBox.types';\nexport { default as Skeleton } from './components/skeleton';\nexport { SkeletonAnimationType } from './components/skeleton/types';\nexport { default as Masonry } from './components/masonry/Masonry';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAAU,OAAA,EAAAV,CAAA","ignoreList":[]}
|
|
@@ -7,28 +7,25 @@ exports.shareWithUrl = exports.shareWithApp = exports.copyToClipboard = void 0;
|
|
|
7
7
|
var _chaynsApi = require("chayns-api");
|
|
8
8
|
const copyToClipboard = link => {
|
|
9
9
|
const aux = document.createElement('input');
|
|
10
|
-
const range = document.createRange();
|
|
11
10
|
aux.setAttribute('value', link);
|
|
12
11
|
aux.setAttribute('contenteditable', 'true');
|
|
13
12
|
aux.setAttribute('readonly', 'true');
|
|
14
13
|
document.body.appendChild(aux);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
try {
|
|
15
|
+
const selection = window.getSelection();
|
|
16
|
+
if (!selection) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const range = document.createRange();
|
|
20
|
+
aux.select();
|
|
21
|
+
range.selectNodeContents(aux);
|
|
22
|
+
selection.removeAllRanges();
|
|
23
|
+
selection.addRange(range);
|
|
24
|
+
aux.setSelectionRange(0, 999999);
|
|
25
|
+
document.execCommand('copy');
|
|
26
|
+
} finally {
|
|
27
|
+
aux.remove();
|
|
20
28
|
}
|
|
21
|
-
s.removeAllRanges();
|
|
22
|
-
s.addRange(range);
|
|
23
|
-
aux.setSelectionRange(0, 999999);
|
|
24
|
-
document.execCommand('copy');
|
|
25
|
-
document.body.removeChild(aux);
|
|
26
|
-
void (0, _chaynsApi.createDialog)({
|
|
27
|
-
type: _chaynsApi.DialogType.TOAST,
|
|
28
|
-
showCloseIcon: true,
|
|
29
|
-
toastType: 1,
|
|
30
|
-
text: 'kopiert'
|
|
31
|
-
}).open();
|
|
32
29
|
};
|
|
33
30
|
exports.copyToClipboard = copyToClipboard;
|
|
34
31
|
const shareWithApp = link => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharingBar.js","names":["_chaynsApi","require","copyToClipboard","link","aux","document","createElement","
|
|
1
|
+
{"version":3,"file":"sharingBar.js","names":["_chaynsApi","require","copyToClipboard","link","aux","document","createElement","setAttribute","body","appendChild","selection","window","getSelection","range","createRange","select","selectNodeContents","removeAllRanges","addRange","setSelectionRange","execCommand","remove","exports","shareWithApp","location","href","encodeURIComponent","shareWithUrl","startsWith","open","indexOf","openImage","items","url"],"sources":["../../../src/utils/sharingBar.ts"],"sourcesContent":["import { openImage } from 'chayns-api';\n\nexport const copyToClipboard = (link: string) => {\n const aux = document.createElement('input');\n aux.setAttribute('value', link);\n aux.setAttribute('contenteditable', 'true');\n aux.setAttribute('readonly', 'true');\n\n document.body.appendChild(aux);\n\n try {\n const selection = window.getSelection();\n\n if (!selection) {\n return;\n }\n\n const range = document.createRange();\n aux.select();\n range.selectNodeContents(aux);\n selection.removeAllRanges();\n selection.addRange(range);\n aux.setSelectionRange(0, 999999);\n document.execCommand('copy');\n } finally {\n aux.remove();\n }\n};\n\nexport const shareWithApp = (link: string) => {\n window.location.href = `mailto:?subject=&body=${encodeURIComponent(link)}`;\n};\n\nexport const shareWithUrl = (link: string) => {\n if (link.startsWith('mailto')) {\n window.open(link);\n } else if (link.indexOf('chaynsqrcodegenerator') > 0) {\n void openImage({ items: [{ url: link }] });\n } else {\n window.open(link, '_blank');\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEO,MAAMC,eAAe,GAAIC,IAAY,IAAK;EAC7C,MAAMC,GAAG,GAAGC,QAAQ,CAACC,aAAa,CAAC,OAAO,CAAC;EAC3CF,GAAG,CAACG,YAAY,CAAC,OAAO,EAAEJ,IAAI,CAAC;EAC/BC,GAAG,CAACG,YAAY,CAAC,iBAAiB,EAAE,MAAM,CAAC;EAC3CH,GAAG,CAACG,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC;EAEpCF,QAAQ,CAACG,IAAI,CAACC,WAAW,CAACL,GAAG,CAAC;EAE9B,IAAI;IACA,MAAMM,SAAS,GAAGC,MAAM,CAACC,YAAY,CAAC,CAAC;IAEvC,IAA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ttsToITextString, useTextstringValue } from '@chayns-components/textstring';
|
|
3
3
|
import { createDialog, DialogType, ToastType } from 'chayns-api';
|
|
4
|
-
import React, { useCallback, useMemo, useRef } from 'react';
|
|
4
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
5
5
|
import textStrings from '../../constants/textStrings';
|
|
6
6
|
import { useStickyActionState } from '../../hooks/useStickyActionState';
|
|
7
7
|
import SharingContextMenu from '../sharing-context-menu/SharingContextMenu';
|
|
8
8
|
import Icon from '../icon/Icon';
|
|
9
9
|
import { StyledCopyableContent, StyledCopyableContentActionGroup, StyledCopyableContentActions, StyledCopyableContentBody, StyledCopyableContentButton } from './CopyableContent.styles';
|
|
10
|
+
import { CopyableContentAppearance } from './CopyableContent.types';
|
|
10
11
|
import { copyableContentToClipboard } from './copyableContentClipboard';
|
|
12
|
+
const COPY_FEEDBACK_DURATION = 1500;
|
|
11
13
|
const CopyableContent = ({
|
|
14
|
+
appearance = CopyableContentAppearance.Default,
|
|
12
15
|
content,
|
|
13
16
|
children,
|
|
14
|
-
copiedMessage,
|
|
15
17
|
copyFailedMessage
|
|
16
18
|
}) => {
|
|
17
19
|
const rootRef = useRef(null);
|
|
18
20
|
const actionGroupRef = useRef(null);
|
|
21
|
+
const copyFeedbackTimeoutRef = useRef();
|
|
19
22
|
const isActionGroupSticky = useStickyActionState(rootRef, actionGroupRef);
|
|
23
|
+
const [hasCopied, setHasCopied] = useState(false);
|
|
20
24
|
const defaultCopyButtonText = useTextstringValue({
|
|
21
25
|
textstring: ttsToITextString(textStrings.components.copyableContent.copy)
|
|
22
26
|
});
|
|
23
|
-
const defaultCopiedMessage = useTextstringValue({
|
|
24
|
-
textstring: ttsToITextString(textStrings.components.copyableContent.copied)
|
|
25
|
-
});
|
|
26
27
|
const defaultCopyFailedMessage = useTextstringValue({
|
|
27
28
|
textstring: ttsToITextString(textStrings.components.copyableContent.copyFailed)
|
|
28
29
|
});
|
|
@@ -30,15 +31,20 @@ const CopyableContent = ({
|
|
|
30
31
|
textstring: ttsToITextString(textStrings.components.copyableContent.share)
|
|
31
32
|
});
|
|
32
33
|
const html = useMemo(() => formatStringToHtml(content).html, [content]);
|
|
34
|
+
useEffect(() => () => {
|
|
35
|
+
window.clearTimeout(copyFeedbackTimeoutRef.current);
|
|
36
|
+
}, []);
|
|
37
|
+
const showCopyFeedback = useCallback(() => {
|
|
38
|
+
window.clearTimeout(copyFeedbackTimeoutRef.current);
|
|
39
|
+
setHasCopied(true);
|
|
40
|
+
copyFeedbackTimeoutRef.current = window.setTimeout(() => {
|
|
41
|
+
setHasCopied(false);
|
|
42
|
+
}, COPY_FEEDBACK_DURATION);
|
|
43
|
+
}, []);
|
|
33
44
|
const handleCopy = useCallback(async () => {
|
|
34
45
|
try {
|
|
35
46
|
await copyableContentToClipboard(content);
|
|
36
|
-
|
|
37
|
-
showCloseIcon: true,
|
|
38
|
-
text: copiedMessage ?? defaultCopiedMessage,
|
|
39
|
-
toastType: ToastType.SUCCESS,
|
|
40
|
-
type: DialogType.TOAST
|
|
41
|
-
}).open();
|
|
47
|
+
showCopyFeedback();
|
|
42
48
|
} catch {
|
|
43
49
|
void createDialog({
|
|
44
50
|
showCloseIcon: true,
|
|
@@ -47,8 +53,9 @@ const CopyableContent = ({
|
|
|
47
53
|
type: DialogType.TOAST
|
|
48
54
|
}).open();
|
|
49
55
|
}
|
|
50
|
-
}, [content,
|
|
56
|
+
}, [content, defaultCopyFailedMessage, copyFailedMessage, showCopyFeedback]);
|
|
51
57
|
return /*#__PURE__*/React.createElement(StyledCopyableContent, {
|
|
58
|
+
$appearance: appearance,
|
|
52
59
|
className: "copyable-content",
|
|
53
60
|
ref: rootRef
|
|
54
61
|
}, /*#__PURE__*/React.createElement(StyledCopyableContentActions, {
|
|
@@ -61,9 +68,11 @@ const CopyableContent = ({
|
|
|
61
68
|
},
|
|
62
69
|
type: "button"
|
|
63
70
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
64
|
-
icons: ['fa-light fa-copy']
|
|
71
|
+
icons: hasCopied ? ['fa fa-check'] : ['fa-light fa-copy']
|
|
65
72
|
})), /*#__PURE__*/React.createElement(SharingContextMenu, {
|
|
66
73
|
link: content,
|
|
74
|
+
shouldShowCallingCodeAction: false,
|
|
75
|
+
shouldShowCopyAction: false,
|
|
67
76
|
shouldUseDefaultTriggerStyles: false
|
|
68
77
|
}, /*#__PURE__*/React.createElement(StyledCopyableContentButton, {
|
|
69
78
|
$isSticky: isActionGroupSticky,
|
|
@@ -79,4 +88,5 @@ const CopyableContent = ({
|
|
|
79
88
|
};
|
|
80
89
|
CopyableContent.displayName = 'CopyableContent';
|
|
81
90
|
export default CopyableContent;
|
|
91
|
+
export { CopyableContentAppearance } from './CopyableContent.types';
|
|
82
92
|
//# sourceMappingURL=CopyableContent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CopyableContent.js","names":["formatStringToHtml","ttsToITextString","useTextstringValue","createDialog","DialogType","ToastType","React","useCallback","useMemo","useRef","textStrings","useStickyActionState","SharingContextMenu","Icon","StyledCopyableContent","StyledCopyableContentActionGroup","StyledCopyableContentActions","StyledCopyableContentBody","StyledCopyableContentButton","copyableContentToClipboard","CopyableContent","
|
|
1
|
+
{"version":3,"file":"CopyableContent.js","names":["formatStringToHtml","ttsToITextString","useTextstringValue","createDialog","DialogType","ToastType","React","useCallback","useEffect","useMemo","useRef","useState","textStrings","useStickyActionState","SharingContextMenu","Icon","StyledCopyableContent","StyledCopyableContentActionGroup","StyledCopyableContentActions","StyledCopyableContentBody","StyledCopyableContentButton","CopyableContentAppearance","copyableContentToClipboard","COPY_FEEDBACK_DURATION","CopyableContent","appearance","Default","content","children","copyFailedMessage","rootRef","actionGroupRef","copyFeedbackTimeoutRef","isActionGroupSticky","hasCopied","setHasCopied","defaultCopyButtonText","textstring","components","copyableContent","copy","defaultCopyFailedMessage","copyFailed","shareText","share","html","window","clearTimeout","current","showCopyFeedback","setTimeout","handleCopy","showCloseIcon","text","toastType","ERROR","type","TOAST","open","createElement","$appearance","className","ref","$isSticky","onClick","icons","link","shouldShowCallingCodeAction","shouldShowCopyAction","shouldUseDefaultTriggerStyles","dangerouslySetInnerHTML","__html","displayName"],"sources":["../../../../src/components/copyable-content/CopyableContent.tsx"],"sourcesContent":["import { formatStringToHtml } from '@chayns-components/format';\nimport { ttsToITextString, useTextstringValue } from '@chayns-components/textstring';\nimport { createDialog, DialogType, ToastType } from 'chayns-api';\nimport React, { FC, ReactNode, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport textStrings from '../../constants/textStrings';\nimport { useStickyActionState } from '../../hooks/useStickyActionState';\nimport SharingContextMenu from '../sharing-context-menu/SharingContextMenu';\nimport Icon from '../icon/Icon';\nimport {\n StyledCopyableContent,\n StyledCopyableContentActionGroup,\n StyledCopyableContentActions,\n StyledCopyableContentBody,\n StyledCopyableContentButton,\n} from './CopyableContent.styles';\nimport { CopyableContentAppearance } from './CopyableContent.types';\nimport { copyableContentToClipboard } from './copyableContentClipboard';\n\nconst COPY_FEEDBACK_DURATION = 1500;\n\nexport type CopyableContentProps = {\n /**\n * Controls the visual surface of the content block.\n */\n appearance?: CopyableContentAppearance;\n content: string;\n children?: ReactNode;\n copyFailedMessage?: string;\n};\n\nconst CopyableContent: FC<CopyableContentProps> = ({\n appearance = CopyableContentAppearance.Default,\n content,\n children,\n copyFailedMessage,\n}) => {\n const rootRef = useRef<HTMLElement>(null);\n const actionGroupRef = useRef<HTMLDivElement>(null);\n const copyFeedbackTimeoutRef = useRef<number>();\n const isActionGroupSticky = useStickyActionState(rootRef, actionGroupRef);\n const [hasCopied, setHasCopied] = useState(false);\n\n const defaultCopyButtonText = useTextstringValue({\n textstring: ttsToITextString(textStrings.components.copyableContent.copy),\n });\n const defaultCopyFailedMessage = useTextstringValue({\n textstring: ttsToITextString(textStrings.components.copyableContent.copyFailed),\n });\n const shareText = useTextstringValue({\n textstring: ttsToITextString(textStrings.components.copyableContent.share),\n });\n\n const html = useMemo(() => formatStringToHtml(content).html, [content]);\n\n useEffect(\n () => () => {\n window.clearTimeout(copyFeedbackTimeoutRef.current);\n },\n [],\n );\n\n const showCopyFeedback = useCallback(() => {\n window.clearTimeout(copyFeedbackTimeoutRef.current);\n setHasCopied(true);\n\n copyFeedbackTimeoutRef.current = window.setTimeout(() => {\n setHasCopied(false);\n }, COPY_FEEDBACK_DURATION);\n }, []);\n\n const handleCopy = useCallback(async () => {\n try {\n await copyableContentToClipboard(content);\n showCopyFeedback();\n } catch {\n void createDialog({\n showCloseIcon: true,\n text: copyFailedMessage ?? defaultCopyFailedMessage,\n toastType: ToastType.ERROR,\n type: DialogType.TOAST,\n }).open();\n }\n }, [content, defaultCopyFailedMessage, copyFailedMessage, showCopyFeedback]);\n\n return (\n <StyledCopyableContent $appearance={appearance} className=\"copyable-content\" ref={rootRef}>\n <StyledCopyableContentActions ref={actionGroupRef}>\n <StyledCopyableContentActionGroup>\n <StyledCopyableContentButton\n $isSticky={isActionGroupSticky}\n aria-label={defaultCopyButtonText}\n onClick={() => {\n void handleCopy();\n }}\n type=\"button\"\n >\n <Icon icons={hasCopied ? ['fa fa-check'] : ['fa-light fa-copy']} />\n </StyledCopyableContentButton>\n <SharingContextMenu\n link={content}\n shouldShowCallingCodeAction={false}\n shouldShowCopyAction={false}\n shouldUseDefaultTriggerStyles={false}\n >\n <StyledCopyableContentButton\n $isSticky={isActionGroupSticky}\n aria-label={shareText}\n type=\"button\"\n >\n <Icon icons={['fa fa-share-nodes']} />\n </StyledCopyableContentButton>\n </SharingContextMenu>\n </StyledCopyableContentActionGroup>\n </StyledCopyableContentActions>\n <StyledCopyableContentBody>\n {children ?? <div dangerouslySetInnerHTML={{ __html: html }} />}\n </StyledCopyableContentBody>\n </StyledCopyableContent>\n );\n};\n\nCopyableContent.displayName = 'CopyableContent';\n\nexport default CopyableContent;\n\nexport { CopyableContentAppearance } from './CopyableContent.types';\n"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,2BAA2B;AAC9D,SA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yBAAyB","ignoreList":[]}
|
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
|
+
import { CopyableContentAppearance } from './CopyableContent.types';
|
|
3
|
+
const getBackgroundColor = ({
|
|
4
|
+
$appearance,
|
|
5
|
+
theme
|
|
6
|
+
}) => {
|
|
7
|
+
if ($appearance === CopyableContentAppearance.Chat) {
|
|
8
|
+
return 'rgba(0, 0, 0, 0.2)';
|
|
9
|
+
}
|
|
10
|
+
const secondaryColor = theme['secondary-100-rgb'] ?? '255, 255, 255';
|
|
11
|
+
const opacity = theme.cardBackgroundOpacity ?? 1;
|
|
12
|
+
return `rgba(${secondaryColor}, ${opacity})`;
|
|
13
|
+
};
|
|
2
14
|
export const StyledCopyableContent = styled.section`
|
|
3
15
|
--copyable-content-action-size: 32px;
|
|
4
16
|
--copyable-content-action-inset: 8px;
|
|
5
17
|
|
|
18
|
+
margin: 4px 0;
|
|
6
19
|
min-width: 0;
|
|
7
20
|
max-width: 100%;
|
|
8
21
|
overflow-x: clip;
|
|
@@ -13,14 +26,7 @@ export const StyledCopyableContent = styled.section`
|
|
|
13
26
|
border-radius: ${({
|
|
14
27
|
theme
|
|
15
28
|
}) => theme.cardBorderRadius}px;
|
|
16
|
-
background-color:
|
|
17
|
-
${({
|
|
18
|
-
theme
|
|
19
|
-
}) => theme['secondary-100-rgb']},
|
|
20
|
-
${({
|
|
21
|
-
theme
|
|
22
|
-
}) => theme.cardBackgroundOpacity}
|
|
23
|
-
);
|
|
29
|
+
background-color: ${getBackgroundColor};
|
|
24
30
|
color: ${({
|
|
25
31
|
theme
|
|
26
32
|
}) => theme.text};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CopyableContent.styles.js","names":["styled","
|
|
1
|
+
{"version":3,"file":"CopyableContent.styles.js","names":["styled","CopyableContentAppearance","getBackgroundColor","$appearance","theme","Chat","secondaryColor","opacity","cardBackgroundOpacity","StyledCopyableContent","section","cardBorderRadius","text","StyledCopyableContentActions","div","StyledCopyableContentActionGroup","StyledCopyableContentButton","button","$isSticky","buttonBackgroundColor","StyledCopyableContentBody","headline","primary"],"sources":["../../../../src/components/copyable-content/CopyableContent.styles.ts"],"sourcesContent":["import type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\nimport styled from 'styled-components';\nimport { CopyableContentAppearance } from './CopyableContent.types';\n\ntype StyledCopyableContentProps = WithTheme<{\n $appearance: CopyableContentAppearance;\n}>;\n\nconst getBackgroundColor = ({ $appearance, theme }: StyledCopyableContentProps) => {\n if ($appearance === CopyableContentAppearance.Chat) {\n return 'rgba(0, 0, 0, 0.2)';\n }\n\n const secondaryColor = theme['secondary-100-rgb'] ?? '255, 255, 255';\n const opacity = theme.cardBackgroundOpacity ?? 1;\n\n return `rgba(${secondaryColor}, ${opacity})`;\n};\n\nexport const StyledCopyableContent = styled.section<StyledCopyableContentProps>`\n --copyable-content-action-size: 32px;\n --copyable-content-action-inset: 8px;\n\n margin: 4px 0;\n min-width: 0;\n max-width: 100%;\n overflow-x: clip;\n overflow-wrap: anywhere;\n padding-top: calc(\n var(--copyable-content-action-size) + var(--copyable-content-action-inset) * 2\n );\n border-radius: ${({ theme }) => theme.cardBorderRadius}px;\n background-color: ${getBackgroundColor};\n color: ${({ theme }) => theme.text};\n`;\n\ntype StyledCopyableContentButtonProps = WithTheme<{\n $isSticky: boolean;\n}>;\n\nexport const StyledCopyableContentActions = styled.div`\n position: sticky;\n top: var(--copyable-content-action-inset);\n z-index: 1;\n display: flex;\n justify-content: flex-end;\n height: calc(var(--copyable-content-action-size) + var(--copyable-content-action-inset));\n margin-top: calc(\n (var(--copyable-content-action-size) + var(--copyable-content-action-inset)) * -1\n );\n padding-right: var(--copyable-content-action-inset);\n`;\n\nexport const StyledCopyableContentActionGroup = styled.div`\n display: flex;\n gap: 4px;\n height: var(--copyable-content-action-size);\n`;\n\nexport const StyledCopyableContentButton = styled.button<StyledCopyableContentButtonProps>`\n box-sizing: border-box;\n border: 1px solid ${({ $isSticky, theme }) => ($isSticky ? theme['202'] : 'transparent')};\n border-radius: 4px;\n width: var(--copyable-content-action-size);\n height: var(--copyable-content-action-size);\n padding: 0;\n cursor: pointer;\n background-color: ${({ $isSticky, theme }) => ($isSticky ? theme['100'] : 'transparent')};\n color: ${({ theme }) => theme.text};\n box-shadow: ${({ $isSticky }) => ($isSticky ? '0 2px 8px rgba(0, 0, 0, 0.16)' : 'none')};\n transition:\n background-color 0.15s ease,\n border-color 0.15s ease,\n box-shadow 0.15s ease,\n transform 0.15s ease;\n\n &:hover {\n background-color: rgba(${({ theme }) => theme['text-rgb']}, 0.1);\n box-shadow: inset 0 0 0 1px rgba(${({ theme }) => theme['text-rgb']}, 0.06);\n }\n\n &:active {\n transform: scale(0.9);\n }\n\n &:focus-visible {\n outline: 2px solid ${({ theme }) => theme.buttonBackgroundColor};\n outline-offset: 2px;\n }\n`;\n\nexport const StyledCopyableContentBody = styled.div<WithTheme<unknown>>`\n min-width: 0;\n max-width: 100%;\n overflow-wrap: anywhere;\n padding: 0 12px 12px;\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n p,\n ul,\n ol,\n blockquote {\n margin: 0 0 12px;\n }\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n color: ${({ theme }) => theme.headline};\n }\n\n ul,\n ol {\n padding-left: 24px;\n }\n\n blockquote {\n padding-left: 12px;\n border-left: 3px solid ${({ theme }) => theme['202']};\n }\n\n a {\n color: ${({ theme }) => theme.primary};\n overflow-wrap: anywhere;\n }\n\n > :last-child {\n margin-bottom: 0;\n }\n`;\n"],"mappings":"AACA,OAAOA,MAAM,MAAM,mBAAmB;AACtC,SAASC,yBAAyB,QAAQ,yBAAyB;AAMnE,MAAMC,kBAAkB,GAAGA,CAAC;EAAEC,WAAW;EAAEC;AAAkC,CAAC,KAAK;EAC/E,IAAID,WAAW,KAAKF,yBAAyB,CAACI,IAAI,EAAE;IAChD,OAAO,oBAAoB;EAC/B;EAEA,MAAMC,cAA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