@chayns-components/core 5.5.4 → 5.5.7

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.
Files changed (66) hide show
  1. package/AGENTS.md +87 -2
  2. package/lib/cjs/components/copyable-content/CopyableContent.js +102 -0
  3. package/lib/cjs/components/copyable-content/CopyableContent.js.map +1 -0
  4. package/lib/cjs/components/copyable-content/CopyableContent.styles.js +152 -0
  5. package/lib/cjs/components/copyable-content/CopyableContent.styles.js.map +1 -0
  6. package/lib/cjs/components/copyable-content/CopyableContent.test.js +83 -0
  7. package/lib/cjs/components/copyable-content/CopyableContent.test.js.map +1 -0
  8. package/lib/cjs/components/copyable-content/copyableContentClipboard.js +59 -0
  9. package/lib/cjs/components/copyable-content/copyableContentClipboard.js.map +1 -0
  10. package/lib/cjs/components/copyable-content/copyableContentClipboard.test.js +40 -0
  11. package/lib/cjs/components/copyable-content/copyableContentClipboard.test.js.map +1 -0
  12. package/lib/cjs/constants/textStrings.js +18 -0
  13. package/lib/cjs/constants/textStrings.js.map +1 -1
  14. package/lib/cjs/index.js +7 -0
  15. package/lib/cjs/index.js.map +1 -1
  16. package/lib/esm/components/copyable-content/CopyableContent.js +93 -0
  17. package/lib/esm/components/copyable-content/CopyableContent.js.map +1 -0
  18. package/lib/esm/components/copyable-content/CopyableContent.styles.js +145 -0
  19. package/lib/esm/components/copyable-content/CopyableContent.styles.js.map +1 -0
  20. package/lib/esm/components/copyable-content/CopyableContent.test.js +80 -0
  21. package/lib/esm/components/copyable-content/CopyableContent.test.js.map +1 -0
  22. package/lib/esm/components/copyable-content/copyableContentClipboard.js +52 -0
  23. package/lib/esm/components/copyable-content/copyableContentClipboard.js.map +1 -0
  24. package/lib/esm/components/copyable-content/copyableContentClipboard.test.js +38 -0
  25. package/lib/esm/components/copyable-content/copyableContentClipboard.test.js.map +1 -0
  26. package/lib/esm/constants/textStrings.js +18 -0
  27. package/lib/esm/constants/textStrings.js.map +1 -1
  28. package/lib/esm/index.js +1 -0
  29. package/lib/esm/index.js.map +1 -1
  30. package/lib/types/components/accordion/Accordion.styles.d.ts +3 -3
  31. package/lib/types/components/accordion/accordion-body/AccordionBody.styles.d.ts +3 -3
  32. package/lib/types/components/accordion/accordion-head/AccordionHead.styles.d.ts +30 -30
  33. package/lib/types/components/amount-control/AmountControl.styles.d.ts +3 -3
  34. package/lib/types/components/button/Button.styles.d.ts +9 -9
  35. package/lib/types/components/context-menu/context-menu-content/ContextMenuContent.styles.d.ts +3 -3
  36. package/lib/types/components/copyable-content/CopyableContent.d.ts +9 -0
  37. package/lib/types/components/copyable-content/CopyableContent.styles.d.ts +25 -0
  38. package/lib/types/components/copyable-content/copyableContentClipboard.d.ts +1 -0
  39. package/lib/types/components/dropdown-body-wrapper/delayed-dropdown-content/DelayedDropdownContent.styles.d.ts +3 -3
  40. package/lib/types/components/expandable-content/ExpandableContent.styles.d.ts +3 -3
  41. package/lib/types/components/file-input/FileInput.styles.d.ts +3 -3
  42. package/lib/types/components/file-select/FileSelect.styles.d.ts +3 -3
  43. package/lib/types/components/filter/Filter.styles.d.ts +3 -3
  44. package/lib/types/components/filter-buttons/filter-button/FilterButton.styles.d.ts +3 -3
  45. package/lib/types/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.d.ts +6 -6
  46. package/lib/types/components/input/Input.styles.d.ts +9 -9
  47. package/lib/types/components/list/list-item/ListItem.styles.d.ts +4 -4
  48. package/lib/types/components/list/list-item/list-item-body/ListItemBody.styles.d.ts +3 -3
  49. package/lib/types/components/list/list-item/list-item-head/ListItemHead.styles.d.ts +11 -11
  50. package/lib/types/components/masonry/masonry-item/MasonryItem.styles.d.ts +3 -3
  51. package/lib/types/components/mention-finder/MentionFinder.styles.d.ts +6 -6
  52. package/lib/types/components/multi-action-button/MultiActionButton.styles.d.ts +3 -3
  53. package/lib/types/components/multi-action-button/action-button/ActionButton.styles.d.ts +3 -3
  54. package/lib/types/components/popup/popup-content-wrapper/PopupContentWrapper.styles.d.ts +3 -3
  55. package/lib/types/components/progress-bar/ProgressBar.styles.d.ts +3 -3
  56. package/lib/types/components/radio-button/RadioButton.styles.d.ts +3 -3
  57. package/lib/types/components/search-box/SearchBox.styles.d.ts +3 -3
  58. package/lib/types/components/search-input/SearchInput.styles.d.ts +6 -6
  59. package/lib/types/components/skeleton/base-skeleton/BaseSkeleton.styles.d.ts +6 -6
  60. package/lib/types/components/slider/Slider.styles.d.ts +5 -5
  61. package/lib/types/components/slider-button/SliderButton.styles.d.ts +3 -3
  62. package/lib/types/components/text-area/TextArea.styles.d.ts +3 -3
  63. package/lib/types/components/truncation/Truncation.styles.d.ts +3 -3
  64. package/lib/types/constants/textStrings.d.ts +18 -0
  65. package/lib/types/index.d.ts +1 -0
  66. package/package.json +11 -5
@@ -45,6 +45,24 @@ var _default = exports.default = {
45
45
  stringName: 'txt_chayns_components_core_components_fileItem_remove',
46
46
  fallback: 'Entfernen'
47
47
  }
48
+ },
49
+ copyableContent: {
50
+ copy: {
51
+ stringName: 'txt_chayns_components_core_components_copyableContent_copy',
52
+ fallback: 'Kopieren'
53
+ },
54
+ share: {
55
+ stringName: 'txt_chayns_components_core_components_copyableContent_share',
56
+ fallback: 'Teilen'
57
+ },
58
+ copied: {
59
+ stringName: 'txt_chayns_components_core_components_copyableContent_copied',
60
+ fallback: 'Kopiert'
61
+ },
62
+ copyFailed: {
63
+ stringName: 'txt_chayns_components_core_components_copyableContent_copyFailed',
64
+ fallback: 'Kopieren fehlgeschlagen'
65
+ }
48
66
  }
49
67
  }
50
68
  };
@@ -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"],"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 },\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;EACJ;AACJ,CAAC","ignoreList":[]}
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","copied","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 copied: {\n stringName: 'txt_chayns_components_core_components_copyableContent_copied',\n fallback: 'Kopiert',\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,MAAM,EAAE;QACJd,UAAU,EAAE,8DAA8D;QAC1EC,QAAQ,EAAE;MACd,CAAC;MACDc,UAAU,EAAE;QACRf,UAAU,EAAE,kEAAkE;QAC9EC,QAAQ,EAAE;MACd;IACJ;EACJ;AACJ,CAAC","ignoreList":[]}
package/lib/cjs/index.js CHANGED
@@ -141,6 +141,12 @@ Object.defineProperty(exports, "ContextMenuAlignment", {
141
141
  return _ContextMenu2.ContextMenuAlignment;
142
142
  }
143
143
  });
144
+ Object.defineProperty(exports, "CopyableContent", {
145
+ enumerable: true,
146
+ get: function () {
147
+ return _CopyableContent.default;
148
+ }
149
+ });
144
150
  Object.defineProperty(exports, "DropdownBodyWrapper", {
145
151
  enumerable: true,
146
152
  get: function () {
@@ -615,6 +621,7 @@ var _FileSelect = _interopRequireDefault(require("./components/file-select/FileS
615
621
  var _DropdownBodyWrapper = _interopRequireDefault(require("./components/dropdown-body-wrapper/DropdownBodyWrapper"));
616
622
  var _ComboBox = _interopRequireDefault(require("./components/combobox/ComboBox"));
617
623
  var _ContentCard = _interopRequireDefault(require("./components/content-card/ContentCard"));
624
+ var _CopyableContent = _interopRequireDefault(require("./components/copyable-content/CopyableContent"));
618
625
  var _HighlightSlider = _interopRequireDefault(require("./components/highlight-slider/HighlightSlider"));
619
626
  var _ContextMenu = _interopRequireDefault(require("./components/context-menu/ContextMenu"));
620
627
  var _ContextMenu2 = require("./components/context-menu/ContextMenu.types");
@@ -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","_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 { 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,I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,OAAA,YAAA5E,uBAAA,YAAAA,CAAA0E,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,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,SAAApF,uBAAAmF,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 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,eAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,eAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,cAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,cAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,kBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,oBAAA,GAAAC,uBAAA,CAAAR,OAAA;AAIA,IAAAS,MAAA,GAAAV,sBAAA,C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AAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,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":[]}
@@ -0,0 +1,93 @@
1
+ import { formatStringToHtml } from '@chayns-components/format';
2
+ import { ttsToITextString, useTextstringValue } from '@chayns-components/textstring';
3
+ import { createDialog, DialogType, ToastType } from 'chayns-api';
4
+ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
5
+ import textStrings from '../../constants/textStrings';
6
+ import SharingContextMenu from '../sharing-context-menu/SharingContextMenu';
7
+ import Icon from '../icon/Icon';
8
+ import { StyledCopyableContent, StyledCopyableContentActionGroup, StyledCopyableContentActions, StyledCopyableContentBody, StyledCopyableContentButton } from './CopyableContent.styles';
9
+ import { copyableContentToClipboard } from './copyableContentClipboard';
10
+ const STICKY_ACTION_OFFSET = 8;
11
+ const CopyableContent = ({
12
+ content,
13
+ children,
14
+ copiedMessage,
15
+ copyFailedMessage
16
+ }) => {
17
+ const [isActionGroupSticky, setIsActionGroupSticky] = useState(false);
18
+ const actionGroupRef = useRef(null);
19
+ const defaultCopyButtonText = useTextstringValue({
20
+ textstring: ttsToITextString(textStrings.components.copyableContent.copy)
21
+ });
22
+ const defaultCopiedMessage = useTextstringValue({
23
+ textstring: ttsToITextString(textStrings.components.copyableContent.copied)
24
+ });
25
+ const defaultCopyFailedMessage = useTextstringValue({
26
+ textstring: ttsToITextString(textStrings.components.copyableContent.copyFailed)
27
+ });
28
+ const shareText = useTextstringValue({
29
+ textstring: ttsToITextString(textStrings.components.copyableContent.share)
30
+ });
31
+ const html = useMemo(() => formatStringToHtml(content).html, [content]);
32
+ useEffect(() => {
33
+ const updateStickyState = () => {
34
+ const actionGroupTop = actionGroupRef.current?.getBoundingClientRect().top;
35
+ setIsActionGroupSticky(actionGroupTop !== undefined && actionGroupTop <= STICKY_ACTION_OFFSET);
36
+ };
37
+ updateStickyState();
38
+ document.addEventListener('scroll', updateStickyState, true);
39
+ window.addEventListener('resize', updateStickyState);
40
+ return () => {
41
+ document.removeEventListener('scroll', updateStickyState, true);
42
+ window.removeEventListener('resize', updateStickyState);
43
+ };
44
+ }, []);
45
+ const handleCopy = useCallback(async () => {
46
+ try {
47
+ await copyableContentToClipboard(content);
48
+ void createDialog({
49
+ showCloseIcon: true,
50
+ text: copiedMessage ?? defaultCopiedMessage,
51
+ toastType: ToastType.SUCCESS,
52
+ type: DialogType.TOAST
53
+ }).open();
54
+ } catch {
55
+ void createDialog({
56
+ showCloseIcon: true,
57
+ text: copyFailedMessage ?? defaultCopyFailedMessage,
58
+ toastType: ToastType.ERROR,
59
+ type: DialogType.TOAST
60
+ }).open();
61
+ }
62
+ }, [content, copiedMessage, defaultCopiedMessage, defaultCopyFailedMessage, copyFailedMessage]);
63
+ return /*#__PURE__*/React.createElement(StyledCopyableContent, {
64
+ className: "copyable-content"
65
+ }, /*#__PURE__*/React.createElement(StyledCopyableContentActions, {
66
+ ref: actionGroupRef
67
+ }, /*#__PURE__*/React.createElement(StyledCopyableContentActionGroup, null, /*#__PURE__*/React.createElement(StyledCopyableContentButton, {
68
+ $isSticky: isActionGroupSticky,
69
+ "aria-label": defaultCopyButtonText,
70
+ onClick: () => {
71
+ void handleCopy();
72
+ },
73
+ type: "button"
74
+ }, /*#__PURE__*/React.createElement(Icon, {
75
+ icons: ['fa-light fa-copy']
76
+ })), /*#__PURE__*/React.createElement(SharingContextMenu, {
77
+ link: content,
78
+ shouldUseDefaultTriggerStyles: false
79
+ }, /*#__PURE__*/React.createElement(StyledCopyableContentButton, {
80
+ $isSticky: isActionGroupSticky,
81
+ "aria-label": shareText,
82
+ type: "button"
83
+ }, /*#__PURE__*/React.createElement(Icon, {
84
+ icons: ['fa fa-share-nodes']
85
+ }))))), /*#__PURE__*/React.createElement(StyledCopyableContentBody, null, children ?? /*#__PURE__*/React.createElement("div", {
86
+ dangerouslySetInnerHTML: {
87
+ __html: html
88
+ }
89
+ })));
90
+ };
91
+ CopyableContent.displayName = 'CopyableContent';
92
+ export default CopyableContent;
93
+ //# sourceMappingURL=CopyableContent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CopyableContent.js","names":["formatStringToHtml","ttsToITextString","useTextstringValue","createDialog","DialogType","ToastType","React","useCallback","useEffect","useMemo","useRef","useState","textStrings","SharingContextMenu","Icon","StyledCopyableContent","StyledCopyableContentActionGroup","StyledCopyableContentActions","StyledCopyableContentBody","StyledCopyableContentButton","copyableContentToClipboard","STICKY_ACTION_OFFSET","CopyableContent","content","children","copiedMessage","copyFailedMessage","isActionGroupSticky","setIsActionGroupSticky","actionGroupRef","defaultCopyButtonText","textstring","components","copyableContent","copy","defaultCopiedMessage","copied","defaultCopyFailedMessage","copyFailed","shareText","share","html","updateStickyState","actionGroupTop","current","getBoundingClientRect","top","undefined","document","addEventListener","window","removeEventListener","handleCopy","showCloseIcon","text","toastType","SUCCESS","type","TOAST","open","ERROR","createElement","className","ref","$isSticky","onClick","icons","link","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 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 { copyableContentToClipboard } from './copyableContentClipboard';\n\nexport type CopyableContentProps = {\n content: string;\n children?: ReactNode;\n copiedMessage?: string;\n copyFailedMessage?: string;\n};\n\nconst STICKY_ACTION_OFFSET = 8;\n\nconst CopyableContent: FC<CopyableContentProps> = ({\n content,\n children,\n copiedMessage,\n copyFailedMessage,\n}) => {\n const [isActionGroupSticky, setIsActionGroupSticky] = useState(false);\n\n const actionGroupRef = useRef<HTMLDivElement>(null);\n\n const defaultCopyButtonText = useTextstringValue({\n textstring: ttsToITextString(textStrings.components.copyableContent.copy),\n });\n const defaultCopiedMessage = useTextstringValue({\n textstring: ttsToITextString(textStrings.components.copyableContent.copied),\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 const updateStickyState = () => {\n const actionGroupTop = actionGroupRef.current?.getBoundingClientRect().top;\n setIsActionGroupSticky(\n actionGroupTop !== undefined && actionGroupTop <= STICKY_ACTION_OFFSET,\n );\n };\n\n updateStickyState();\n document.addEventListener('scroll', updateStickyState, true);\n window.addEventListener('resize', updateStickyState);\n\n return () => {\n document.removeEventListener('scroll', updateStickyState, true);\n window.removeEventListener('resize', updateStickyState);\n };\n }, []);\n\n const handleCopy = useCallback(async () => {\n try {\n await copyableContentToClipboard(content);\n void createDialog({\n showCloseIcon: true,\n text: copiedMessage ?? defaultCopiedMessage,\n toastType: ToastType.SUCCESS,\n type: DialogType.TOAST,\n }).open();\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, copiedMessage, defaultCopiedMessage, defaultCopyFailedMessage, copyFailedMessage]);\n\n return (\n <StyledCopyableContent className=\"copyable-content\">\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={['fa-light fa-copy']} />\n </StyledCopyableContentButton>\n <SharingContextMenu link={content} shouldUseDefaultTriggerStyles={false}>\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"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,2BAA2B;AAC9D,SAASC,gBAAgB,EAAEC,kBAAkB,QAAQ,+BAA+B;AACpF,SAASC,YAAY,EAAEC,UAAU,EAAEC,SAAS,QAAQ,YAAY;AAChE,OAAOC,KAAK,IAAmBC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAC/F,OAAOC,WAAW,MAAM,6BAA6B;AACrD,OAAOC,kBAAkB,MAAM,4CAA4C;AAC3E,OAAOC,IAAI,MAAM,cAAc;AAC/B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D,aAAA,CAAC5C,4BAA4B;IAAC8C,GAAG,EAAElC;EAAe,gBAC9CvB,KAAA,CAAAuD,aAAA,CAAC7C,gCAAgC,qBAC7BV,KAAA,CAAAuD,aAAA,CAAC1C,2BAA2B;IACxB6C,SAAS,EAAErC,mBAAoB;IAC/B,cAAYG,qBAAsB;IAClCmC,OAAO,EAAEA,CAAA,KAAM;MACX,KAAKb,UAAU,CAAC,CAAC;IACrB,CAAE;IACFK,IAAI,EAAC;EAAQ,gBAEbnD,KAAA,CAAAuD,aAAA,CAAC/C,IAAI;IAACoD,KAAK,EAAE,CAAC,kBAAkB;EAAE,CAAE,CACX,CAAC,eAC9B5D,KAAA,CAAAuD,aAAA,CAAChD,kBAAkB;IAACsD,IAAI,EAAE5C,OAAQ;IAAC6C,6BAA6B,EAAE;EAAM,gBACpE9D,KAAA,CAAAuD,aAAA,CAAC1C,2BAA2B;IACxB6C,SAAS,EAAErC,mBAAoB;IAC/B,cAAYY,SAAU;IACtBkB,IAAI,EAAC;EAAQ,gBAEbnD,KAAA,CAAAuD,aAAA,CAAC/C,IAAI;IAACoD,KAAK,EAAE,CAAC,mBAAmB;EAAE,CAAE,CACZ,CACb,CACU,CACR,CAAC,eAC/B5D,KAAA,CAAAuD,aAAA,CAAC3C,yBAAyB,QACrBM,QAAQ,iBAAIlB,KAAA,CAAAuD,aAAA;IAAKQ,uBAAuB,EAAE;MAAEC,MAAM,EAAE7B;IAAK;EAAE,CAAE,CACvC,CACR,CAAC;AAEhC,CAAC;AAEDnB,eAAe,CAACiD,WAAW,GAAG,iBAAiB;AAE/C,eAAejD,eAAe","ignoreList":[]}
@@ -0,0 +1,145 @@
1
+ import styled from 'styled-components';
2
+ export const StyledCopyableContent = styled.section`
3
+ --copyable-content-action-size: 32px;
4
+ --copyable-content-action-inset: 8px;
5
+
6
+ min-width: 0;
7
+ max-width: 100%;
8
+ overflow-x: clip;
9
+ overflow-wrap: anywhere;
10
+ padding-top: calc(
11
+ var(--copyable-content-action-size) + var(--copyable-content-action-inset) * 2
12
+ );
13
+ border-radius: ${({
14
+ theme
15
+ }) => theme.cardBorderRadius}px;
16
+ background-color: rgba(
17
+ ${({
18
+ theme
19
+ }) => theme['secondary-100-rgb']},
20
+ ${({
21
+ theme
22
+ }) => theme.cardBackgroundOpacity}
23
+ );
24
+ color: ${({
25
+ theme
26
+ }) => theme.text};
27
+ `;
28
+ export const StyledCopyableContentActions = styled.div`
29
+ position: sticky;
30
+ top: var(--copyable-content-action-inset);
31
+ z-index: 1;
32
+ display: flex;
33
+ justify-content: flex-end;
34
+ height: calc(var(--copyable-content-action-size) + var(--copyable-content-action-inset));
35
+ margin-top: calc(
36
+ (var(--copyable-content-action-size) + var(--copyable-content-action-inset)) * -1
37
+ );
38
+ padding-right: var(--copyable-content-action-inset);
39
+ `;
40
+ export const StyledCopyableContentActionGroup = styled.div`
41
+ display: flex;
42
+ gap: 4px;
43
+ height: var(--copyable-content-action-size);
44
+ `;
45
+ export const StyledCopyableContentButton = styled.button`
46
+ box-sizing: border-box;
47
+ border: 1px solid ${({
48
+ $isSticky,
49
+ theme
50
+ }) => $isSticky ? theme['202'] : 'transparent'};
51
+ border-radius: 4px;
52
+ width: var(--copyable-content-action-size);
53
+ height: var(--copyable-content-action-size);
54
+ padding: 0;
55
+ cursor: pointer;
56
+ background-color: ${({
57
+ $isSticky,
58
+ theme
59
+ }) => $isSticky ? theme['100'] : 'transparent'};
60
+ color: ${({
61
+ theme
62
+ }) => theme.text};
63
+ box-shadow: ${({
64
+ $isSticky
65
+ }) => $isSticky ? '0 2px 8px rgba(0, 0, 0, 0.16)' : 'none'};
66
+ transition:
67
+ background-color 0.15s ease,
68
+ border-color 0.15s ease,
69
+ box-shadow 0.15s ease,
70
+ transform 0.15s ease;
71
+
72
+ &:hover {
73
+ background-color: rgba(${({
74
+ theme
75
+ }) => theme['text-rgb']}, 0.1);
76
+ box-shadow: inset 0 0 0 1px rgba(${({
77
+ theme
78
+ }) => theme['text-rgb']}, 0.06);
79
+ }
80
+
81
+ &:active {
82
+ transform: scale(0.9);
83
+ }
84
+
85
+ &:focus-visible {
86
+ outline: 2px solid ${({
87
+ theme
88
+ }) => theme.buttonBackgroundColor};
89
+ outline-offset: 2px;
90
+ }
91
+ `;
92
+ export const StyledCopyableContentBody = styled.div`
93
+ min-width: 0;
94
+ max-width: 100%;
95
+ overflow-wrap: anywhere;
96
+ padding: 0 12px 12px;
97
+
98
+ h1,
99
+ h2,
100
+ h3,
101
+ h4,
102
+ h5,
103
+ h6,
104
+ p,
105
+ ul,
106
+ ol,
107
+ blockquote {
108
+ margin: 0 0 12px;
109
+ }
110
+
111
+ h1,
112
+ h2,
113
+ h3,
114
+ h4,
115
+ h5,
116
+ h6 {
117
+ color: ${({
118
+ theme
119
+ }) => theme.headline};
120
+ }
121
+
122
+ ul,
123
+ ol {
124
+ padding-left: 24px;
125
+ }
126
+
127
+ blockquote {
128
+ padding-left: 12px;
129
+ border-left: 3px solid ${({
130
+ theme
131
+ }) => theme['202']};
132
+ }
133
+
134
+ a {
135
+ color: ${({
136
+ theme
137
+ }) => theme.primary};
138
+ overflow-wrap: anywhere;
139
+ }
140
+
141
+ > :last-child {
142
+ margin-bottom: 0;
143
+ }
144
+ `;
145
+ //# sourceMappingURL=CopyableContent.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CopyableContent.styles.js","names":["styled","StyledCopyableContent","section","theme","cardBorderRadius","cardBackgroundOpacity","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';\n\ntype StyledCopyableContentProps = WithTheme<unknown>;\n\nexport const StyledCopyableContent = styled.section<StyledCopyableContentProps>`\n --copyable-content-action-size: 32px;\n --copyable-content-action-inset: 8px;\n\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: rgba(\n ${({ theme }) => theme['secondary-100-rgb']},\n ${({ theme }) => theme.cardBackgroundOpacity}\n );\n color: ${({ theme }) => theme.text};\n`;\n\ntype StyledCopyableContentButtonProps = WithTheme<{\n $isSticky: boolean;\n}>;\n\nexport const StyledCopyableContentActions = styled.div<StyledCopyableContentProps>`\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<StyledCopyableContentProps>`\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;AAItC,OAAO,MAAMC,qBAAqB,GAAGD,MAAM,CAACE,OAAmC;AAC/E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,CAAC;EAAEC;AAAM,CAAC,KAAKA,KAAK,CAACC,gBAAgB;AAC1D;AACA,UAAU,CAAC;EAAED;AAAM,CAAC,KAAKA,KAAK,CAAC,mBAAmB,CAAC;AACnD,UAAU,CAAC;EAAEA;AAAM,CAAC,KAAKA,KAAK,CAACE,qBAAqB;AACpD;AACA,aAAa,CAAC;EAAEF;AAAM,CAAC,KAAKA,KAAK,CAACG,IAAI;AACtC,CAAC;AAMD,OAAO,MAAMC,4BAA4B,GAAGP,MAAM,CAACQ,GAA+B;AAClF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,gCAAgC,GAAGT,MAAM,CAACQ,GAAG;AAC1D;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAME,2BAA2B,GAAGV,MAAM,CAACW,MAAwC;AAC1F;AACA,wBAAwB,CAAC;EAAEC,SAAS;EAAET;AAAM,CAAC,KAAMS,SAAS,GAAGT,KAAK,CAAC,KAAK,CAAC,GAAG,aAAc;AAC5F;AACA;AACA;AACA;AACA;AACA,wBAAwB,CAAC;EAAES,SAAS;EAAET;AAAM,CAAC,KAAMS,SAAS,GAAGT,KAAK,CAAC,KAAK,CAAC,GAAG,aAAc;AAC5F,aAAa,CAAC;EAAEA;AAAM,CAAC,KAAKA,KAAK,CAACG,IAAI;AACtC,kBAAkB,CAAC;EAAEM;AAAU,CAAC,KAAMA,SAAS,GAAG,+BAA+B,GAAG,MAAO;AAC3F;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,CAAC;EAAET;AAAM,CAAC,KAAKA,KAAK,CAAC,UAAU,CAAC;AACjE,2CAA2C,CAAC;EAAEA;AAAM,CAAC,KAAKA,KAAK,CAAC,UAAU,CAAC;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,CAAC;EAAEA;AAAM,CAAC,KAAKA,KAAK,CAACU,qBAAqB;AACvE;AACA;AACA,CAAC;AAED,OAAO,MAAMC,yBAAyB,GAAGd,MAAM,CAACQ,GAA+B;AAC/E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,CAAC;EAAEL;AAAM,CAAC,KAAKA,KAAK,CAACY,QAAQ;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,CAAC;EAAEZ;AAAM,CAAC,KAAKA,KAAK,CAAC,KAAK,CAAC;AAC5D;AACA;AACA;AACA,iBAAiB,CAAC;EAAEA;AAAM,CAAC,KAAKA,KAAK,CAACa,OAAO;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
@@ -0,0 +1,80 @@
1
+ /* eslint-disable @typescript-eslint/no-unsafe-call */
2
+ import { fireEvent, render, screen, waitFor } from '@testing-library/react';
3
+ import React from 'react';
4
+ import { describe, expect, it, vi } from 'vitest';
5
+ import CopyableContent from './CopyableContent';
6
+ vi.mock('../icon/Icon', () => ({
7
+ default: () => /*#__PURE__*/React.createElement("span", null)
8
+ }));
9
+ vi.mock('../sharing-context-menu/SharingContextMenu', () => ({
10
+ default: ({
11
+ children
12
+ }) => children
13
+ }));
14
+ vi.mock('chayns-api', async importOriginal => ({
15
+ ...(await importOriginal()),
16
+ createDialog: vi.fn(() => ({
17
+ open: vi.fn()
18
+ }))
19
+ }));
20
+ const readBlob = blob => new Promise((resolve, reject) => {
21
+ const reader = new FileReader();
22
+ reader.onerror = () => reject(reader.error);
23
+ reader.onload = () => resolve(reader.result);
24
+ reader.readAsText(blob);
25
+ });
26
+ describe('CopyableContent', () => {
27
+ it('renders formatted markdown without active input HTML', () => {
28
+ render(/*#__PURE__*/React.createElement(CopyableContent, {
29
+ content: '# Heading\n\n- Entry\n\n[Link](https://example.com)\n<script onload="x">bad</script>'
30
+ }));
31
+ expect(screen.getByRole('heading', {
32
+ name: 'Heading'
33
+ })).toBeInTheDocument();
34
+ expect(screen.getByRole('link', {
35
+ name: 'Link'
36
+ })).toHaveAttribute('href', 'https://example.com');
37
+ expect(document.querySelector('script')).not.toBeInTheDocument();
38
+ expect(document.querySelector('[onload]')).not.toBeInTheDocument();
39
+ });
40
+ it('copies content instead of custom children', async () => {
41
+ const write = vi.spyOn(navigator.clipboard, 'write').mockResolvedValue();
42
+ render(/*#__PURE__*/React.createElement(CopyableContent, {
43
+ content: "source markdown"
44
+ }, "Visible replacement"));
45
+ fireEvent.click(screen.getByRole('button', {
46
+ name: 'Kopieren'
47
+ }));
48
+ await waitFor(() => expect(write).toHaveBeenCalled());
49
+ const item = write.mock.calls[0][0][0];
50
+ await expect(readBlob(await item.getType('text/plain'))).resolves.toBe('source markdown');
51
+ });
52
+ it('shows a toast after a successful copy', async () => {
53
+ vi.spyOn(navigator.clipboard, 'write').mockResolvedValue();
54
+ render(/*#__PURE__*/React.createElement(CopyableContent, {
55
+ content: "source",
56
+ copiedMessage: "Done"
57
+ }));
58
+ fireEvent.click(screen.getByRole('button', {
59
+ name: 'Kopieren'
60
+ }));
61
+ await waitFor(async () => {
62
+ const {
63
+ createDialog
64
+ } = await import('chayns-api');
65
+ expect(createDialog).toHaveBeenCalledWith(expect.objectContaining({
66
+ text: 'Done'
67
+ }));
68
+ });
69
+ expect(screen.queryByRole('status')).not.toBeInTheDocument();
70
+ });
71
+ it('offers sharing actions', () => {
72
+ render(/*#__PURE__*/React.createElement(CopyableContent, {
73
+ content: "source"
74
+ }));
75
+ expect(screen.getByRole('button', {
76
+ name: 'Teilen'
77
+ })).toBeInTheDocument();
78
+ });
79
+ });
80
+ //# sourceMappingURL=CopyableContent.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CopyableContent.test.js","names":["fireEvent","render","screen","waitFor","React","describe","expect","it","vi","CopyableContent","mock","default","createElement","children","importOriginal","createDialog","fn","open","readBlob","blob","Promise","resolve","reject","reader","FileReader","onerror","error","onload","result","readAsText","content","getByRole","name","toBeInTheDocument","toHaveAttribute","document","querySelector","not","write","spyOn","navigator","clipboard","mockResolvedValue","click","toHaveBeenCalled","item","calls","getType","resolves","toBe","copiedMessage","toHaveBeenCalledWith","objectContaining","text","queryByRole"],"sources":["../../../../src/components/copyable-content/CopyableContent.test.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-call */\nimport { fireEvent, render, screen, waitFor } from '@testing-library/react';\nimport React from 'react';\nimport { describe, expect, it, vi } from 'vitest';\nimport CopyableContent from './CopyableContent';\n\nvi.mock('../icon/Icon', () => ({\n default: () => <span />,\n}));\n\nvi.mock('../sharing-context-menu/SharingContextMenu', () => ({\n default: ({ children }: { children: React.ReactNode }) => children,\n}));\n\nvi.mock('chayns-api', async (importOriginal) => ({\n ...(await importOriginal<typeof import('chayns-api')>()),\n createDialog: vi.fn(() => ({ open: vi.fn() })),\n}));\n\nconst readBlob = (blob: Blob) =>\n new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n reader.onerror = () => reject(reader.error);\n reader.onload = () => resolve(reader.result as string);\n reader.readAsText(blob);\n });\n\ndescribe('CopyableContent', () => {\n it('renders formatted markdown without active input HTML', () => {\n render(\n <CopyableContent\n content={\n '# Heading\\n\\n- Entry\\n\\n[Link](https://example.com)\\n<script onload=\"x\">bad</script>'\n }\n />,\n );\n\n expect(screen.getByRole('heading', { name: 'Heading' })).toBeInTheDocument();\n expect(screen.getByRole('link', { name: 'Link' })).toHaveAttribute(\n 'href',\n 'https://example.com',\n );\n expect(document.querySelector('script')).not.toBeInTheDocument();\n expect(document.querySelector('[onload]')).not.toBeInTheDocument();\n });\n\n it('copies content instead of custom children', async () => {\n const write = vi.spyOn(navigator.clipboard, 'write').mockResolvedValue();\n render(<CopyableContent content=\"source markdown\">Visible replacement</CopyableContent>);\n\n fireEvent.click(screen.getByRole('button', { name: 'Kopieren' }));\n\n await waitFor(() => expect(write).toHaveBeenCalled());\n const item = write.mock.calls[0][0][0] as unknown as ClipboardItem;\n await expect(readBlob(await item.getType('text/plain'))).resolves.toBe('source markdown');\n });\n\n it('shows a toast after a successful copy', async () => {\n vi.spyOn(navigator.clipboard, 'write').mockResolvedValue();\n render(<CopyableContent content=\"source\" copiedMessage=\"Done\" />);\n\n fireEvent.click(screen.getByRole('button', { name: 'Kopieren' }));\n\n await waitFor(async () => {\n const { createDialog } = await import('chayns-api');\n expect(createDialog).toHaveBeenCalledWith(expect.objectContaining({ text: 'Done' }));\n });\n expect(screen.queryByRole('status')).not.toBeInTheDocument();\n });\n\n it('offers sharing actions', () => {\n render(<CopyableContent content=\"source\" />);\n\n expect(screen.getByRole('button', { name: 'Teilen' })).toBeInTheDocument();\n });\n});\n"],"mappings":"AAAA;AACA,SAASA,SAAS,EAAEC,MAAM,EAAEC,MAAM,EAAEC,OAAO,QAAQ,wBAAwB;AAC3E,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAQ,QAAQ;AACjD,OAAOC,eAAe,MAAM,mBAAmB;AA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AAA,CAAAQ,aAAA,CAACH,eAAe;MAACqB,OAAO,EAAC,QAAQ;MAACoB,aAAa,EAAC;IAAM,CAAE,CAAC,CAAC;IAEjElD,SAAS,CAAC2C,KAAK,CAACzC,MAAM,CAAC6B,SAAS,CAAC,QAAQ,EAAE;MAAEC,IAAI,EAAE;IAAW,CAAC,CAAC,CAAC;IAEjE,MAAM7B,OAAO,CAAC,YAAY;MACtB,MAAM;QAAEY;MAAa,CAAC,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC;MACnDT,MAAM,CAACS,YAAY,CAAC,CAACoC,oBAAoB,CAAC7C,MAAM,CAAC8C,gBAAgB,CAAC;QAAEC,IAAI,EAAE;MAAO,CAAC,CAAC,CAAC;IACxF,CAAC,CAAC;IACF/C,MAAM,CAACJ,MAAM,CAACoD,WAAW,CAAC,QAAQ,CAAC,CAAC,CAACjB,GAAG,CAACJ,iBAAiB,CAAC,CAAC;EAChE,CAAC,CAAC;EAEF1B,EAAE,CAAC,wBAAwB,EAAE,MAAM;IAC/BN,MAAM,cAACG,KAAA,CAAAQ,aAAA,CAACH,eAAe;MAACqB,OAAO,EAAC;IAAQ,CAAE,CAAC,CAAC;IAE5CxB,MAAM,CAACJ,MAAM,CAAC6B,SAAS,CAAC,QAAQ,EAAE;MAAEC,IAAI,EAAE;IAAS,CAAC,CAAC,CAAC,CAACC,iBAAiB,CAAC,CAAC;EAC9E,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,52 @@
1
+ import { formatStringToHtml } from '@chayns-components/format';
2
+ const RICH_MIME_TYPES = ['text/plain', 'text/markdown', 'text/html'];
3
+ const createClipboardItem = data => new ClipboardItem(data);
4
+ const supportsRichMimeTypes = () => {
5
+ if (typeof ClipboardItem === 'undefined' || typeof ClipboardItem.supports !== 'function') {
6
+ return true;
7
+ }
8
+ return RICH_MIME_TYPES.every(mimeType => ClipboardItem.supports(mimeType));
9
+ };
10
+ const copyPlainText = async source => {
11
+ if (typeof ClipboardItem !== 'undefined') {
12
+ try {
13
+ await navigator.clipboard.write([createClipboardItem({
14
+ 'text/plain': new Blob([source], {
15
+ type: 'text/plain'
16
+ })
17
+ })]);
18
+ return;
19
+ } catch {
20
+ // Use writeText as the final browser-compatible fallback.
21
+ }
22
+ }
23
+ await navigator.clipboard.writeText(source);
24
+ };
25
+ export const copyableContentToClipboard = async source => {
26
+ if (!navigator.clipboard) {
27
+ throw new Error('Clipboard API is not available.');
28
+ }
29
+ if (typeof ClipboardItem === 'undefined' || !supportsRichMimeTypes()) {
30
+ await copyPlainText(source);
31
+ return;
32
+ }
33
+ const {
34
+ html
35
+ } = formatStringToHtml(source);
36
+ try {
37
+ await navigator.clipboard.write([createClipboardItem({
38
+ 'text/plain': new Blob([source], {
39
+ type: 'text/plain'
40
+ }),
41
+ 'text/markdown': new Blob([source], {
42
+ type: 'text/markdown'
43
+ }),
44
+ 'text/html': new Blob([html], {
45
+ type: 'text/html'
46
+ })
47
+ })]);
48
+ } catch {
49
+ await copyPlainText(source);
50
+ }
51
+ };
52
+ //# sourceMappingURL=copyableContentClipboard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copyableContentClipboard.js","names":["formatStringToHtml","RICH_MIME_TYPES","createClipboardItem","data","ClipboardItem","supportsRichMimeTypes","supports","every","mimeType","copyPlainText","source","navigator","clipboard","write","Blob","type","writeText","copyableContentToClipboard","Error","html"],"sources":["../../../../src/components/copyable-content/copyableContentClipboard.ts"],"sourcesContent":["import { formatStringToHtml } from '@chayns-components/format';\n\nconst RICH_MIME_TYPES = ['text/plain', 'text/markdown', 'text/html'] as const;\n\nconst createClipboardItem = (data: Record<string, Blob>) => new ClipboardItem(data);\n\nconst supportsRichMimeTypes = () => {\n if (typeof ClipboardItem === 'undefined' || typeof ClipboardItem.supports !== 'function') {\n return true;\n }\n\n return RICH_MIME_TYPES.every((mimeType) => ClipboardItem.supports(mimeType));\n};\n\nconst copyPlainText = async (source: string) => {\n if (typeof ClipboardItem !== 'undefined') {\n try {\n await navigator.clipboard.write([\n createClipboardItem({ 'text/plain': new Blob([source], { type: 'text/plain' }) }),\n ]);\n return;\n } catch {\n // Use writeText as the final browser-compatible fallback.\n }\n }\n\n await navigator.clipboard.writeText(source);\n};\n\nexport const copyableContentToClipboard = async (source: string) => {\n if (!navigator.clipboard) {\n throw new Error('Clipboard API is not available.');\n }\n\n if (typeof ClipboardItem === 'undefined' || !supportsRichMimeTypes()) {\n await copyPlainText(source);\n return;\n }\n\n const { html } = formatStringToHtml(source);\n\n try {\n await navigator.clipboard.write([\n createClipboardItem({\n 'text/plain': new Blob([source], { type: 'text/plain' }),\n 'text/markdown': new Blob([source], { type: 'text/markdown' }),\n 'text/html': new Blob([html], { type: 'text/html' }),\n }),\n ]);\n } catch {\n await copyPlainText(source);\n }\n};\n"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,2BAA2B;AAE9D,MAAMC,eAAe,GAAG,CAAC,YAAY,EAAE,eAAe,EAAE,WAAW,CAAU;AAE7E,MAAMC,mBAAmB,GAAIC,IAA0B,IAAK,IAAIC,aAAa,CAACD,IAAI,CAAC;AAEnF,MAAME,qBAAqB,GAAGA,CAAA,KAAM;EAChC,IAAI,OAAOD,aAAa,KAAK,WAAW,IAAI,OAAOA,aAAa,CAACE,QAAQ,KAAK,UAAU,EAAE;IACtF,OAAO,IAAI;EACf;EAEA,OAAOL,eAAe,CAACM,KAAK,CAAEC,QAAQ,IAAKJ,aAAa,CAACE,QAAQ,CAACE,QAAQ,CAAC,CAAC;AAChF,CAAC;AAED,MAAMC,aAAa,GAAG,MAAOC,MAAc,IAAK;EAC5C,IAAI,OAAON,aAAa,KAAK,WAAW,EAAE;IACtC,IAAI;MACA,MAAMO,SAAS,CAACC,SAAS,CAACC,KAAK,CAAC,CAC5BX,mBAAmB,CAAC;QAAE,YAAY,EAAE,IAAIY,IAAI,CAAC,CAACJ,MAAM,CAAC,EAAE;UAAEK,IAAI,EAAE;QAAa,CAAC;MAAE,CAAC,CAAC,CACpF,CAAC;MACF;IACJ,CAAC,CAAC,MAAM;MACJ;IAAA;EAER;EAEA,MAAMJ,SAAS,CAACC,SAAS,CAACI,SAAS,CAACN,MAAM,CAAC;AAC/C,CAAC;AAED,OAAO,MAAMO,0BAA0B,GAAG,MAAOP,MAAc,IAAK;EAChE,IAAI,CAACC,SAAS,CAACC,SAAS,EAAE;IACtB,MAAM,IAAIM,KAAK,CAAC,iCAAiC,CAAC;EACtD;EAEA,IAAI,OAAOd,aAAa,KAAK,WAAW,IAAI,CAACC,qBAAqB,CAAC,CAAC,EAAE;IAClE,MAAMI,aAAa,CAACC,MAAM,CAAC;IAC3B;EACJ;EAEA,MAAM;IAAES;EAAK,CAAC,GAAGnB,kBAAkB,CAACU,MAAM,CAAC;EAE3C,IAAI;IACA,MAAMC,SAAS,CAACC,SAAS,CAACC,KAAK,CAAC,CAC5BX,mBAAmB,CAAC;MAChB,YAAY,EAAE,IAAIY,IAAI,CAAC,CAACJ,MAAM,CAAC,EAAE;QAAEK,IAAI,EAAE;MAAa,CAAC,CAAC;MACxD,eAAe,EAAE,IAAID,IAAI,CAAC,CAACJ,MAAM,CAAC,EAAE;QAAEK,IAAI,EAAE;MAAgB,CAAC,CAAC;MAC9D,WAAW,EAAE,IAAID,IAAI,CAAC,CAACK,IAAI,CAAC,EAAE;QAAEJ,IAAI,EAAE;MAAY,CAAC;IACvD,CAAC,CAAC,CACL,CAAC;EACN,CAAC,CAAC,MAAM;IACJ,MAAMN,aAAa,CAACC,MAAM,CAAC;EAC/B;AACJ,CAAC","ignoreList":[]}
@@ -0,0 +1,38 @@
1
+ import { formatStringToHtml } from '@chayns-components/format';
2
+ import { afterEach, describe, expect, it, vi } from 'vitest';
3
+ import { copyableContentToClipboard } from './copyableContentClipboard';
4
+ const source = '# Heading\n\n[Link](https://example.com)';
5
+ const readBlob = blob => new Promise((resolve, reject) => {
6
+ const reader = new FileReader();
7
+ reader.onerror = () => reject(reader.error);
8
+ reader.onload = () => resolve(reader.result);
9
+ reader.readAsText(blob);
10
+ });
11
+ describe('copyableContentToClipboard', () => {
12
+ afterEach(() => {
13
+ vi.restoreAllMocks();
14
+ });
15
+ it('writes exact source as plain text and markdown with safe HTML', async () => {
16
+ const write = vi.spyOn(navigator.clipboard, 'write').mockResolvedValue();
17
+ await copyableContentToClipboard(source);
18
+ const item = write.mock.calls[0][0][0];
19
+ await expect(readBlob(await item.getType('text/plain'))).resolves.toBe(source);
20
+ await expect(readBlob(await item.getType('text/markdown'))).resolves.toBe(source);
21
+ await expect(readBlob(await item.getType('text/html'))).resolves.toBe(formatStringToHtml(source).html);
22
+ });
23
+ it('uses a plain ClipboardItem when rich MIME types are unsupported', async () => {
24
+ vi.stubGlobal('ClipboardItem', Object.assign(class {}, {
25
+ supports: () => false
26
+ }));
27
+ const write = vi.spyOn(navigator.clipboard, 'write').mockResolvedValue();
28
+ await copyableContentToClipboard(source);
29
+ expect(write).toHaveBeenCalledTimes(1);
30
+ });
31
+ it('uses writeText after ClipboardItem writes fail', async () => {
32
+ vi.spyOn(navigator.clipboard, 'write').mockRejectedValue(new Error('denied'));
33
+ const writeText = vi.spyOn(navigator.clipboard, 'writeText').mockResolvedValue();
34
+ await copyableContentToClipboard(source);
35
+ expect(writeText).toHaveBeenCalledWith(source);
36
+ });
37
+ });
38
+ //# sourceMappingURL=copyableContentClipboard.test.js.map