@chayns-components/core 5.0.0-beta.4 → 5.0.0-beta.400
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/README.md +3 -9
- package/lib/api/image/post.d.ts +16 -0
- package/lib/api/image/post.js +34 -0
- package/lib/api/image/post.js.map +1 -0
- package/lib/api/video/post.d.ts +16 -0
- package/lib/api/video/post.js +31 -0
- package/lib/api/video/post.js.map +1 -0
- package/lib/components/accordion/Accordion.d.ts +72 -6
- package/lib/components/accordion/Accordion.js +122 -166
- package/lib/components/accordion/Accordion.js.map +1 -1
- package/lib/components/accordion/Accordion.styles.d.ts +9 -0
- package/lib/components/accordion/Accordion.styles.js +95 -0
- package/lib/components/accordion/Accordion.styles.js.map +1 -0
- package/lib/components/accordion/accordion-body/AccordionBody.d.ts +20 -2
- package/lib/components/accordion/accordion-body/AccordionBody.js +25 -25
- package/lib/components/accordion/accordion-body/AccordionBody.js.map +1 -1
- package/lib/components/accordion/accordion-body/AccordionBody.styles.d.ts +268 -0
- package/lib/components/accordion/accordion-body/AccordionBody.styles.js +24 -0
- package/lib/components/accordion/accordion-body/AccordionBody.styles.js.map +1 -0
- package/lib/components/accordion/accordion-content/AccordionContent.d.ts +14 -3
- package/lib/components/accordion/accordion-content/AccordionContent.js +20 -24
- package/lib/components/accordion/accordion-content/AccordionContent.js.map +1 -1
- package/lib/components/accordion/accordion-content/AccordionContent.styles.d.ts +8 -0
- package/lib/components/accordion/accordion-content/AccordionContent.styles.js +34 -0
- package/lib/components/accordion/accordion-content/AccordionContent.styles.js.map +1 -0
- package/lib/components/accordion/accordion-group/AccordionGroup.d.ts +27 -0
- package/lib/components/accordion/accordion-group/AccordionGroup.js +57 -0
- package/lib/components/accordion/accordion-group/AccordionGroup.js.map +1 -0
- package/lib/components/accordion/accordion-head/AccordionHead.d.ts +10 -4
- package/lib/components/accordion/accordion-head/AccordionHead.js +95 -129
- package/lib/components/accordion/accordion-head/AccordionHead.js.map +1 -1
- package/lib/components/accordion/accordion-head/AccordionHead.styles.d.ts +2424 -0
- package/lib/components/accordion/accordion-head/AccordionHead.styles.js +154 -0
- package/lib/components/accordion/accordion-head/AccordionHead.styles.js.map +1 -0
- package/lib/components/accordion/accordion-intro/AccordionIntro.d.ts +9 -0
- package/lib/components/accordion/accordion-intro/AccordionIntro.js +20 -0
- package/lib/components/accordion/accordion-intro/AccordionIntro.js.map +1 -0
- package/lib/components/accordion/accordion-intro/AccordionIntro.styles.d.ts +2 -0
- package/lib/components/accordion/accordion-intro/AccordionIntro.styles.js +12 -0
- package/lib/components/accordion/accordion-intro/AccordionIntro.styles.js.map +1 -0
- package/lib/components/accordion/accordion-item/AccordionItem.d.ts +9 -0
- package/lib/components/accordion/accordion-item/AccordionItem.js +27 -0
- package/lib/components/accordion/accordion-item/AccordionItem.js.map +1 -0
- package/lib/components/accordion/accordion-item/AccordionItem.styles.d.ts +7 -0
- package/lib/components/accordion/accordion-item/AccordionItem.styles.js +33 -0
- package/lib/components/accordion/accordion-item/AccordionItem.styles.js.map +1 -0
- package/lib/components/accordion/utils.d.ts +11 -0
- package/lib/components/accordion/utils.js +36 -0
- package/lib/components/accordion/utils.js.map +1 -0
- package/lib/components/amount-control/AmountControl.d.ts +22 -0
- package/lib/components/amount-control/AmountControl.js +185 -0
- package/lib/components/amount-control/AmountControl.js.map +1 -0
- package/lib/components/amount-control/AmountControl.styles.d.ts +288 -0
- package/lib/components/amount-control/AmountControl.styles.js +58 -0
- package/lib/components/amount-control/AmountControl.styles.js.map +1 -0
- package/lib/components/amount-control/utils.d.ts +7 -0
- package/lib/components/amount-control/utils.js +22 -0
- package/lib/components/amount-control/utils.js.map +1 -0
- package/lib/components/badge/Badge.d.ts +9 -1
- package/lib/components/badge/Badge.js +15 -28
- package/lib/components/badge/Badge.js.map +1 -1
- package/lib/components/badge/Badge.styles.d.ts +6 -0
- package/lib/components/badge/Badge.styles.js +31 -0
- package/lib/components/badge/Badge.styles.js.map +1 -0
- package/lib/components/button/Button.d.ts +7 -3
- package/lib/components/button/Button.js +69 -47
- package/lib/components/button/Button.js.map +1 -1
- package/lib/components/button/Button.styles.d.ts +541 -0
- package/lib/components/button/Button.styles.js +81 -0
- package/lib/components/button/Button.styles.js.map +1 -0
- package/lib/components/checkbox/Checkbox.d.ts +33 -0
- package/lib/components/checkbox/Checkbox.js +49 -0
- package/lib/components/checkbox/Checkbox.js.map +1 -0
- package/lib/components/checkbox/Checkbox.styles.d.ts +13 -0
- package/lib/components/checkbox/Checkbox.styles.js +140 -0
- package/lib/components/checkbox/Checkbox.styles.js.map +1 -0
- package/lib/components/code-highlighter/CodeHighlighter.d.ts +36 -0
- package/lib/components/code-highlighter/CodeHighlighter.js +85 -0
- package/lib/components/code-highlighter/CodeHighlighter.js.map +1 -0
- package/lib/components/code-highlighter/CodeHighlighter.styles.d.ts +16 -0
- package/lib/components/code-highlighter/CodeHighlighter.styles.js +88 -0
- package/lib/components/code-highlighter/CodeHighlighter.styles.js.map +1 -0
- package/lib/components/code-highlighter/copy-to-clipboard/CopyToClipboard.d.ts +9 -0
- package/lib/components/code-highlighter/copy-to-clipboard/CopyToClipboard.js +41 -0
- package/lib/components/code-highlighter/copy-to-clipboard/CopyToClipboard.js.map +1 -0
- package/lib/components/code-highlighter/copy-to-clipboard/CopyToClipboard.styles.d.ts +9 -0
- package/lib/components/code-highlighter/copy-to-clipboard/CopyToClipboard.styles.js +24 -0
- package/lib/components/code-highlighter/copy-to-clipboard/CopyToClipboard.styles.js.map +1 -0
- package/lib/components/color-scheme-provider/ColorSchemeProvider.d.ts +8 -1
- package/lib/components/color-scheme-provider/ColorSchemeProvider.js +45 -83
- package/lib/components/color-scheme-provider/ColorSchemeProvider.js.map +1 -1
- package/lib/components/color-scheme-provider/font.d.ts +6 -0
- package/lib/components/color-scheme-provider/font.js +59 -0
- package/lib/components/color-scheme-provider/font.js.map +1 -0
- package/lib/components/combobox/ComboBox.d.ts +43 -0
- package/lib/components/combobox/ComboBox.js +187 -0
- package/lib/components/combobox/ComboBox.js.map +1 -0
- package/lib/components/combobox/ComboBox.styles.d.ts +289 -0
- package/lib/components/combobox/ComboBox.styles.js +184 -0
- package/lib/components/combobox/ComboBox.styles.js.map +1 -0
- package/lib/components/combobox/combobox-item/ComboBoxItem.d.ts +12 -0
- package/lib/components/combobox/combobox-item/ComboBoxItem.js +40 -0
- package/lib/components/combobox/combobox-item/ComboBoxItem.js.map +1 -0
- package/lib/components/combobox/combobox-item/ComboBoxItem.styles.d.ts +11 -0
- package/lib/components/combobox/combobox-item/ComboBoxItem.styles.js +62 -0
- package/lib/components/combobox/combobox-item/ComboBoxItem.styles.js.map +1 -0
- package/lib/components/content-card/ContentCard.d.ts +13 -0
- package/lib/components/content-card/ContentCard.js +21 -0
- package/lib/components/content-card/ContentCard.js.map +1 -0
- package/lib/components/content-card/ContentCard.styles.d.ts +2 -0
- package/lib/components/content-card/ContentCard.styles.js +22 -0
- package/lib/components/content-card/ContentCard.styles.js.map +1 -0
- package/lib/components/context-menu/ContextMenu.d.ts +51 -0
- package/lib/components/context-menu/ContextMenu.js +153 -0
- package/lib/components/context-menu/ContextMenu.js.map +1 -0
- package/lib/components/context-menu/ContextMenu.styles.d.ts +2 -0
- package/lib/components/context-menu/ContextMenu.styles.js +12 -0
- package/lib/components/context-menu/ContextMenu.styles.js.map +1 -0
- package/lib/components/context-menu/constants/alignment.d.ts +8 -0
- package/lib/components/context-menu/constants/alignment.js +16 -0
- package/lib/components/context-menu/constants/alignment.js.map +1 -0
- package/lib/components/context-menu/context-menu-content/ContextMenuContent.d.ts +10 -0
- package/lib/components/context-menu/context-menu-content/ContextMenuContent.js +79 -0
- package/lib/components/context-menu/context-menu-content/ContextMenuContent.js.map +1 -0
- package/lib/components/context-menu/context-menu-content/ContextMenuContent.styles.d.ts +276 -0
- package/lib/components/context-menu/context-menu-content/ContextMenuContent.styles.js +112 -0
- package/lib/components/context-menu/context-menu-content/ContextMenuContent.styles.js.map +1 -0
- package/lib/components/date-info/DateInfo.d.ts +37 -0
- package/lib/components/date-info/DateInfo.js +111 -0
- package/lib/components/date-info/DateInfo.js.map +1 -0
- package/lib/components/date-info/constants/language.d.ts +22 -0
- package/lib/components/date-info/constants/language.js +629 -0
- package/lib/components/date-info/constants/language.js.map +1 -0
- package/lib/components/date-info/utils/format.d.ts +49 -0
- package/lib/components/date-info/utils/format.js +315 -0
- package/lib/components/date-info/utils/format.js.map +1 -0
- package/lib/components/date-info/utils/language.d.ts +7 -0
- package/lib/components/date-info/utils/language.js +57 -0
- package/lib/components/date-info/utils/language.js.map +1 -0
- package/lib/components/file-input/FileInput.d.ts +29 -0
- package/lib/components/file-input/FileInput.js +121 -0
- package/lib/components/file-input/FileInput.js.map +1 -0
- package/lib/components/file-input/FileInput.styles.d.ts +277 -0
- package/lib/components/file-input/FileInput.styles.js +46 -0
- package/lib/components/file-input/FileInput.styles.js.map +1 -0
- package/lib/components/file-input/file-list/FileListItem.d.ts +9 -0
- package/lib/components/file-input/file-list/FileListItem.js +36 -0
- package/lib/components/file-input/file-list/FileListItem.js.map +1 -0
- package/lib/components/file-input/file-list/FileListItem.styles.d.ts +2 -0
- package/lib/components/file-input/file-list/FileListItem.styles.js +10 -0
- package/lib/components/file-input/file-list/FileListItem.styles.js.map +1 -0
- package/lib/components/filter-buttons/FilterButtons.d.ts +22 -0
- package/lib/components/filter-buttons/FilterButtons.js +88 -0
- package/lib/components/filter-buttons/FilterButtons.js.map +1 -0
- package/lib/components/filter-buttons/FilterButtons.styles.d.ts +2 -0
- package/lib/components/filter-buttons/FilterButtons.styles.js +14 -0
- package/lib/components/filter-buttons/FilterButtons.styles.js.map +1 -0
- package/lib/components/filter-buttons/filter-button/FilterButton.d.ts +14 -0
- package/lib/components/filter-buttons/filter-button/FilterButton.js +47 -0
- package/lib/components/filter-buttons/filter-button/FilterButton.js.map +1 -0
- package/lib/components/filter-buttons/filter-button/FilterButton.styles.d.ts +287 -0
- package/lib/components/filter-buttons/filter-button/FilterButton.styles.js +104 -0
- package/lib/components/filter-buttons/filter-button/FilterButton.styles.js.map +1 -0
- package/lib/components/filter-buttons/types.d.ts +15 -0
- package/lib/components/filter-buttons/types.js +17 -0
- package/lib/components/filter-buttons/types.js.map +1 -0
- package/lib/components/grid-image/GridImage.d.ts +19 -0
- package/lib/components/grid-image/GridImage.js +45 -0
- package/lib/components/grid-image/GridImage.js.map +1 -0
- package/lib/components/grid-image/GridImage.styles.d.ts +22 -0
- package/lib/components/grid-image/GridImage.styles.js +101 -0
- package/lib/components/grid-image/GridImage.styles.js.map +1 -0
- package/lib/components/icon/Icon.d.ts +11 -3
- package/lib/components/icon/Icon.js +37 -82
- package/lib/components/icon/Icon.js.map +1 -1
- package/lib/components/icon/Icon.styles.d.ts +15 -0
- package/lib/components/icon/Icon.styles.js +74 -0
- package/lib/components/icon/Icon.styles.js.map +1 -0
- package/lib/components/icon/utils.d.ts +1 -0
- package/lib/components/icon/utils.js +12 -0
- package/lib/components/icon/utils.js.map +1 -0
- package/lib/components/input/Input.d.ts +65 -0
- package/lib/components/input/Input.js +118 -0
- package/lib/components/input/Input.js.map +1 -0
- package/lib/components/input/Input.styles.d.ts +541 -0
- package/lib/components/input/Input.styles.js +98 -0
- package/lib/components/input/Input.styles.js.map +1 -0
- package/lib/components/list/List.d.ts +18 -0
- package/lib/components/list/List.js +52 -0
- package/lib/components/list/List.js.map +1 -0
- package/lib/components/list/list-item/ListItem.d.ts +67 -0
- package/lib/components/list/list-item/ListItem.js +91 -0
- package/lib/components/list/list-item/ListItem.js.map +1 -0
- package/lib/components/list/list-item/ListItem.styles.d.ts +8 -0
- package/lib/components/list/list-item/ListItem.styles.js +44 -0
- package/lib/components/list/list-item/ListItem.styles.js.map +1 -0
- package/lib/components/list/list-item/list-item-body/ListItemBody.d.ts +7 -0
- package/lib/components/list/list-item/list-item-body/ListItemBody.js +57 -0
- package/lib/components/list/list-item/list-item-body/ListItemBody.js.map +1 -0
- package/lib/components/list/list-item/list-item-body/ListItemBody.styles.d.ts +267 -0
- package/lib/components/list/list-item/list-item-body/ListItemBody.styles.js +13 -0
- package/lib/components/list/list-item/list-item-body/ListItemBody.styles.js.map +1 -0
- package/lib/components/list/list-item/list-item-content/ListItemContent.d.ts +9 -0
- package/lib/components/list/list-item/list-item-content/ListItemContent.js +20 -0
- package/lib/components/list/list-item/list-item-content/ListItemContent.js.map +1 -0
- package/lib/components/list/list-item/list-item-content/ListItemContent.styles.d.ts +2 -0
- package/lib/components/list/list-item/list-item-content/ListItemContent.styles.js +18 -0
- package/lib/components/list/list-item/list-item-content/ListItemContent.styles.js.map +1 -0
- package/lib/components/list/list-item/list-item-head/ListItemHead.d.ts +18 -0
- package/lib/components/list/list-item/list-item-head/ListItemHead.js +99 -0
- package/lib/components/list/list-item/list-item-head/ListItemHead.js.map +1 -0
- package/lib/components/list/list-item/list-item-head/ListItemHead.styles.d.ts +550 -0
- package/lib/components/list/list-item/list-item-head/ListItemHead.styles.js +99 -0
- package/lib/components/list/list-item/list-item-head/ListItemHead.styles.js.map +1 -0
- package/lib/components/list/list-item/list-item-head/list-item-icon/ListItemIcon.d.ts +6 -0
- package/lib/components/list/list-item/list-item-head/list-item-icon/ListItemIcon.js +22 -0
- package/lib/components/list/list-item/list-item-head/list-item-icon/ListItemIcon.js.map +1 -0
- package/lib/components/list/list-item/list-item-head/list-item-icon/ListItemIcon.styles.d.ts +2 -0
- package/lib/components/list/list-item/list-item-head/list-item-icon/ListItemIcon.styles.js +31 -0
- package/lib/components/list/list-item/list-item-head/list-item-icon/ListItemIcon.styles.js.map +1 -0
- package/lib/components/list/list-item/list-item-head/list-item-image/ListItemImage.d.ts +7 -0
- package/lib/components/list/list-item/list-item-head/list-item-image/ListItemImage.js +43 -0
- package/lib/components/list/list-item/list-item-head/list-item-image/ListItemImage.js.map +1 -0
- package/lib/components/list/list-item/list-item-head/list-item-image/ListItemImage.styles.d.ts +11 -0
- package/lib/components/list/list-item/list-item-head/list-item-image/ListItemImage.styles.js +50 -0
- package/lib/components/list/list-item/list-item-head/list-item-image/ListItemImage.styles.js.map +1 -0
- package/lib/components/mention-finder/MentionFinder.d.ts +31 -0
- package/lib/components/mention-finder/MentionFinder.js +139 -0
- package/lib/components/mention-finder/MentionFinder.js.map +1 -0
- package/lib/components/mention-finder/MentionFinder.styles.d.ts +270 -0
- package/lib/components/mention-finder/MentionFinder.styles.js +92 -0
- package/lib/components/mention-finder/MentionFinder.styles.js.map +1 -0
- package/lib/components/mention-finder/constants/alignment.d.ts +4 -0
- package/lib/components/mention-finder/constants/alignment.js +12 -0
- package/lib/components/mention-finder/constants/alignment.js.map +1 -0
- package/lib/components/mention-finder/mention-finder-item/MentionFinderItem.d.ts +10 -0
- package/lib/components/mention-finder/mention-finder-item/MentionFinderItem.js +31 -0
- package/lib/components/mention-finder/mention-finder-item/MentionFinderItem.js.map +1 -0
- package/lib/components/mention-finder/mention-finder-item/MentionFinderItem.styles.d.ts +10 -0
- package/lib/components/mention-finder/mention-finder-item/MentionFinderItem.styles.js +91 -0
- package/lib/components/mention-finder/mention-finder-item/MentionFinderItem.styles.js.map +1 -0
- package/lib/components/number-input/NumberInput.d.ts +46 -0
- package/lib/components/number-input/NumberInput.js +123 -0
- package/lib/components/number-input/NumberInput.js.map +1 -0
- package/lib/components/number-input/constants/number.d.ts +4 -0
- package/lib/components/number-input/constants/number.js +11 -0
- package/lib/components/number-input/constants/number.js.map +1 -0
- package/lib/components/number-input/utils/number.d.ts +21 -0
- package/lib/components/number-input/utils/number.js +64 -0
- package/lib/components/number-input/utils/number.js.map +1 -0
- package/lib/components/popup/Popup.d.ts +30 -0
- package/lib/components/popup/Popup.js +154 -0
- package/lib/components/popup/Popup.js.map +1 -0
- package/lib/components/popup/Popup.styles.d.ts +5 -0
- package/lib/components/popup/Popup.styles.js +26 -0
- package/lib/components/popup/Popup.styles.js.map +1 -0
- package/lib/components/popup/popup-content/PopupContent.d.ts +9 -0
- package/lib/components/popup/popup-content/PopupContent.js +66 -0
- package/lib/components/popup/popup-content/PopupContent.js.map +1 -0
- package/lib/components/popup/popup-content/PopupContent.styles.d.ts +274 -0
- package/lib/components/popup/popup-content/PopupContent.styles.js +92 -0
- package/lib/components/popup/popup-content/PopupContent.styles.js.map +1 -0
- package/lib/components/popup/types.d.ts +16 -0
- package/lib/components/popup/types.js +16 -0
- package/lib/components/popup/types.js.map +1 -0
- package/lib/components/progress-bar/ProgressBar.d.ts +9 -0
- package/lib/components/progress-bar/ProgressBar.js +38 -0
- package/lib/components/progress-bar/ProgressBar.js.map +1 -0
- package/lib/components/progress-bar/ProgressBar.styles.d.ts +271 -0
- package/lib/components/progress-bar/ProgressBar.styles.js +36 -0
- package/lib/components/progress-bar/ProgressBar.styles.js.map +1 -0
- package/lib/components/radio-button/RadioButton.d.ts +26 -0
- package/lib/components/radio-button/RadioButton.js +85 -0
- package/lib/components/radio-button/RadioButton.js.map +1 -0
- package/lib/components/radio-button/RadioButton.styles.d.ts +22 -0
- package/lib/components/radio-button/RadioButton.styles.js +95 -0
- package/lib/components/radio-button/RadioButton.styles.js.map +1 -0
- package/lib/components/radio-button/radio-button-group/RadioButtonGroup.d.ts +17 -0
- package/lib/components/radio-button/radio-button-group/RadioButtonGroup.js +46 -0
- package/lib/components/radio-button/radio-button-group/RadioButtonGroup.js.map +1 -0
- package/lib/components/radio-button/types.d.ts +4 -0
- package/lib/components/radio-button/types.js +2 -0
- package/lib/components/radio-button/types.js.map +1 -0
- package/lib/components/scroll-view/ScrollView.d.ts +13 -0
- package/lib/components/scroll-view/ScrollView.js +22 -0
- package/lib/components/scroll-view/ScrollView.js.map +1 -0
- package/lib/components/scroll-view/ScrollView.styles.d.ts +7 -0
- package/lib/components/scroll-view/ScrollView.styles.js +26 -0
- package/lib/components/scroll-view/ScrollView.styles.js.map +1 -0
- package/lib/components/search-box/SearchBox.d.ts +34 -0
- package/lib/components/search-box/SearchBox.js +246 -0
- package/lib/components/search-box/SearchBox.js.map +1 -0
- package/lib/components/search-box/SearchBox.styles.d.ts +272 -0
- package/lib/components/search-box/SearchBox.styles.js +56 -0
- package/lib/components/search-box/SearchBox.styles.js.map +1 -0
- package/lib/components/search-box/search-box-item/SearchBoxItem.d.ts +9 -0
- package/lib/components/search-box/search-box-item/SearchBoxItem.js +30 -0
- package/lib/components/search-box/search-box-item/SearchBoxItem.js.map +1 -0
- package/lib/components/search-box/search-box-item/SearchBoxItem.styles.d.ts +7 -0
- package/lib/components/search-box/search-box-item/SearchBoxItem.styles.js +37 -0
- package/lib/components/search-box/search-box-item/SearchBoxItem.styles.js.map +1 -0
- package/lib/components/search-box/types.d.ts +4 -0
- package/lib/components/search-box/types.js +2 -0
- package/lib/components/search-box/types.js.map +1 -0
- package/lib/components/search-box/utils.d.ts +7 -0
- package/lib/components/search-box/utils.js +23 -0
- package/lib/components/search-box/utils.js.map +1 -0
- package/lib/components/search-input/SearchInput.d.ts +33 -0
- package/lib/components/search-input/SearchInput.js +102 -0
- package/lib/components/search-input/SearchInput.js.map +1 -0
- package/lib/components/search-input/SearchInput.styles.d.ts +534 -0
- package/lib/components/search-input/SearchInput.styles.js +26 -0
- package/lib/components/search-input/SearchInput.styles.js.map +1 -0
- package/lib/components/setup-wizard/SetupWizard.d.ts +23 -0
- package/lib/components/setup-wizard/SetupWizard.js +79 -0
- package/lib/components/setup-wizard/SetupWizard.js.map +1 -0
- package/lib/components/setup-wizard/SetupWizard.styles.d.ts +2 -0
- package/lib/components/setup-wizard/SetupWizard.styles.js +10 -0
- package/lib/components/setup-wizard/SetupWizard.styles.js.map +1 -0
- package/lib/components/setup-wizard/setup-wizard-item/SetupWizardItem.d.ts +25 -0
- package/lib/components/setup-wizard/setup-wizard-item/SetupWizardItem.js +60 -0
- package/lib/components/setup-wizard/setup-wizard-item/SetupWizardItem.js.map +1 -0
- package/lib/components/setup-wizard/setup-wizard-item/SetupWizardItem.styles.d.ts +3 -0
- package/lib/components/setup-wizard/setup-wizard-item/SetupWizardItem.styles.js +14 -0
- package/lib/components/setup-wizard/setup-wizard-item/SetupWizardItem.styles.js.map +1 -0
- package/lib/components/sharing-bar/SharingBar.d.ts +18 -0
- package/lib/components/sharing-bar/SharingBar.js +110 -0
- package/lib/components/sharing-bar/SharingBar.js.map +1 -0
- package/lib/components/sharing-bar/SharingBar.styles.d.ts +6 -0
- package/lib/components/sharing-bar/SharingBar.styles.js +24 -0
- package/lib/components/sharing-bar/SharingBar.styles.js.map +1 -0
- package/lib/components/slider/Slider.d.ts +21 -0
- package/lib/components/slider/Slider.js +51 -0
- package/lib/components/slider/Slider.js.map +1 -0
- package/lib/components/slider/Slider.styles.d.ts +10 -0
- package/lib/components/slider/Slider.styles.js +74 -0
- package/lib/components/slider/Slider.styles.js.map +1 -0
- package/lib/components/small-wait-cursor/SmallWaitCursor.d.ts +31 -0
- package/lib/components/small-wait-cursor/SmallWaitCursor.js +42 -0
- package/lib/components/small-wait-cursor/SmallWaitCursor.js.map +1 -0
- package/lib/components/small-wait-cursor/SmallWaitCursor.styles.d.ts +19 -0
- package/lib/components/small-wait-cursor/SmallWaitCursor.styles.js +101 -0
- package/lib/components/small-wait-cursor/SmallWaitCursor.styles.js.map +1 -0
- package/lib/components/text-area/TextArea.d.ts +29 -0
- package/lib/components/text-area/TextArea.js +72 -0
- package/lib/components/text-area/TextArea.js.map +1 -0
- package/lib/components/text-area/TextArea.styles.d.ts +13 -0
- package/lib/components/text-area/TextArea.styles.js +79 -0
- package/lib/components/text-area/TextArea.styles.js.map +1 -0
- package/lib/components/tooltip/Tooltip.d.ts +18 -0
- package/lib/components/tooltip/Tooltip.js +32 -0
- package/lib/components/tooltip/Tooltip.js.map +1 -0
- package/lib/components/tooltip/Tooltip.styles.d.ts +2 -0
- package/lib/components/tooltip/Tooltip.styles.js +10 -0
- package/lib/components/tooltip/Tooltip.styles.js.map +1 -0
- package/lib/components/tooltip/interface.d.ts +4 -0
- package/lib/components/tooltip/interface.js +2 -0
- package/lib/components/tooltip/interface.js.map +1 -0
- package/lib/components/tooltip/tooltip-item/TooltipItem.d.ts +7 -0
- package/lib/components/tooltip/tooltip-item/TooltipItem.js +20 -0
- package/lib/components/tooltip/tooltip-item/TooltipItem.js.map +1 -0
- package/lib/components/tooltip/tooltip-item/TooltipItem.styles.d.ts +8 -0
- package/lib/components/tooltip/tooltip-item/TooltipItem.styles.js +29 -0
- package/lib/components/tooltip/tooltip-item/TooltipItem.styles.js.map +1 -0
- package/lib/components/truncation/Truncation.d.ts +25 -0
- package/lib/components/truncation/Truncation.js +86 -0
- package/lib/components/truncation/Truncation.js.map +1 -0
- package/lib/components/truncation/Truncation.styles.d.ts +270 -0
- package/lib/components/truncation/Truncation.styles.js +27 -0
- package/lib/components/truncation/Truncation.styles.js.map +1 -0
- package/lib/constants/codeHighlighter.d.ts +7 -0
- package/lib/constants/codeHighlighter.js +13 -0
- package/lib/constants/codeHighlighter.js.map +1 -0
- package/lib/hooks/colorMode.d.ts +2 -0
- package/lib/hooks/colorMode.js +22 -0
- package/lib/hooks/colorMode.js.map +1 -0
- package/lib/hooks/uuid.d.ts +1 -0
- package/lib/hooks/uuid.js +14 -0
- package/lib/hooks/uuid.js.map +1 -0
- package/lib/index.d.ts +50 -0
- package/lib/index.js +312 -11
- package/lib/index.js.map +1 -1
- package/lib/types/chayns.d.ts +115 -0
- package/lib/types/chayns.js +13 -0
- package/lib/types/chayns.js.map +1 -0
- package/lib/types/codeHighlighter.d.ts +10 -0
- package/lib/types/codeHighlighter.js +12 -0
- package/lib/types/codeHighlighter.js.map +1 -0
- package/lib/types/comboBox.d.ts +4 -0
- package/lib/types/comboBox.js +12 -0
- package/lib/types/comboBox.js.map +1 -0
- package/lib/types/file.d.ts +42 -0
- package/lib/types/file.js +2 -0
- package/lib/types/file.js.map +1 -0
- package/lib/types/parser/prettier-parser-babel.d.js +2 -0
- package/lib/types/parser/prettier-parser-babel.d.js.map +1 -0
- package/lib/types/parser/prettier-parser-graphql.d.js +2 -0
- package/lib/types/parser/prettier-parser-graphql.d.js.map +1 -0
- package/lib/types/parser/prettier-parser-html.d.js +2 -0
- package/lib/types/parser/prettier-parser-html.d.js.map +1 -0
- package/lib/types/parser/prettier-parser-markdown.d.js +2 -0
- package/lib/types/parser/prettier-parser-markdown.d.js.map +1 -0
- package/lib/types/parser/prettier-parser-postcss.d.js +2 -0
- package/lib/types/parser/prettier-parser-postcss.d.js.map +1 -0
- package/lib/types/parser/prettier-parser-yaml.d.js +2 -0
- package/lib/types/parser/prettier-parser-yaml.d.js.map +1 -0
- package/lib/utils/calculate.d.ts +3 -0
- package/lib/utils/calculate.js +49 -0
- package/lib/utils/calculate.js.map +1 -0
- package/lib/utils/codeHighlighter.d.ts +4 -0
- package/lib/utils/codeHighlighter.js +361 -0
- package/lib/utils/codeHighlighter.js.map +1 -0
- package/lib/utils/file.d.ts +363 -0
- package/lib/utils/file.js +402 -0
- package/lib/utils/file.js.map +1 -0
- package/lib/utils/fileDialog.d.ts +7 -0
- package/lib/utils/fileDialog.js +73 -0
- package/lib/utils/fileDialog.js.map +1 -0
- package/lib/utils/isTobitEmployee.d.ts +1 -0
- package/lib/utils/isTobitEmployee.js +28 -0
- package/lib/utils/isTobitEmployee.js.map +1 -0
- package/lib/utils/truncation.d.ts +1 -0
- package/lib/utils/truncation.js +34 -0
- package/lib/utils/truncation.js.map +1 -0
- package/lib/utils/uploadFile.d.ts +9 -0
- package/lib/utils/uploadFile.js +47 -0
- package/lib/utils/uploadFile.js.map +1 -0
- package/package.json +72 -62
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.styles.js","names":["_framerMotion","require","_styledComponents","_interopRequireWildcard","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","StyledButton","exports","styled","button","_ref","isSecondary","theme","_ref2","text","_ref3","disabled","_ref4","hasIcon","hasChildren","css","StyledIconWrapper","span","StyledMotionChildrenWrapper","motion","div","StyledMotionWaitCursorWrapper"],"sources":["../../../src/components/button/Button.styles.ts"],"sourcesContent":["import { motion } from 'framer-motion';\nimport styled, { css } from 'styled-components';\nimport type { FramerMotionBugFix, WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\nimport type { ButtonProps } from './Button';\n\ntype StyledButtonProps = ButtonProps &\n WithTheme<{\n hasIcon: boolean;\n hasChildren: boolean;\n }>;\n\nexport const StyledButton = styled.button<StyledButtonProps>`\n align-items: center;\n background-color: ${({ isSecondary, theme }: StyledButtonProps) =>\n isSecondary ? theme['202'] : theme['408']};\n border-radius: 3px;\n box-shadow: 1px 2px 3px rgba(0, 0, 0, 0.2);\n border: none;\n color: ${({ isSecondary, theme }: StyledButtonProps) => (isSecondary ? theme.text : 'white')};\n cursor: pointer;\n display: inline-flex;\n line-height: 1.15;\n min-height: 32px;\n opacity: ${({ disabled }) => (disabled ? 0.5 : 1)};\n position: relative;\n user-select: none;\n transition: opacity 0.3s ease;\n\n ${({ hasIcon, hasChildren }) => {\n if (hasIcon) {\n if (hasChildren) {\n return css`\n padding: 7px 12px 7px 42px;\n `;\n }\n return css`\n padding: 7px 12px 7px 18px;\n `;\n }\n return css`\n padding: 7px 12px 7px 12px;\n `;\n }}\n`;\n\nexport const StyledIconWrapper = styled.span`\n align-items: center;\n background-color: rgba(255, 255, 255, 0.2);\n bottom: 0;\n display: flex;\n justify-content: center;\n left: 0;\n position: absolute;\n top: 0;\n width: 30px;\n`;\n\nexport const StyledMotionChildrenWrapper = styled(motion.div)<FramerMotionBugFix>``;\n\nexport const StyledMotionWaitCursorWrapper = styled(motion.div)<FramerMotionBugFix>`\n align-items: center;\n display: flex;\n justify-content: center;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,uBAAA,CAAAF,OAAA;AAAgD,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,G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,aAAaC,KAAA;EAAA,IAAC;IAAEF,WAAW;IAAEC;EAAyB,CAAC,GAAAC,KAAA;EAAA,OAAMF,WAAW,GAAGC,KAAK,CAACE,IAAI,GAAG,OAAO;AAAA,CAAE;AACjG;AACA;AACA;AACA;AACA,eAAeC,KAAA;EAAA,IAAC;IAAEC;EAAS,CAAC,GAAAD,KAAA;EAAA,OAAMC,QAAQ,GAAG,GAAG,GAAG,CAAC;AAAA,CAAE;AACtD;AACA;AACA;AACA;AACA,MAAMC,KAAA,IAA8B;EAAA,IAA7B;IAAEC,OAAO;IAAEC;EAAY,CAAC,GAAAF,KAAA;EACvB,IAAIC,OAAO,EAAE;IACT,IAAIC,WAAW,EAAE;MACb,OAAO,IAAAC,qBAAG,CAAC;AAC3B;AACA,iBAAiB;IACL;IACA,OAAO,IAAAA,qBAAG,CAAC;AACvB;AACA,aAAa;EACL;EACA,OAAO,IAAAA,qBAAG,CAAC;AACnB;AACA,SAAS;AACL,CAAE;AACN,CAAC;AAEM,MAAMC,iBAAiB,GAAAd,OAAA,CAAAc,iBAAA,GAAGb,yBAAM,CAACc,IAAK;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAEM,MAAMC,2BAA2B,GAAAhB,OAAA,CAAAgB,2BAAA,GAAG,IAAAf,yBAAM,EAACgB,oBAAM,CAACC,GAAG,CAAsB,EAAC;AAE5E,MAAMC,6BAA6B,GAAAnB,OAAA,CAAAmB,6BAAA,GAAG,IAAAlB,yBAAM,EAACgB,oBAAM,CAACC,GAAG,CAAsB;AACpF;AACA;AACA;AACA,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ChangeEventHandler, FC, ReactElement } from 'react';
|
|
2
|
+
export type CheckboxProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Text for checkbox or switch
|
|
5
|
+
*/
|
|
6
|
+
children?: ReactElement;
|
|
7
|
+
/**
|
|
8
|
+
* Indicates whether the checkbox or switch is selected
|
|
9
|
+
*/
|
|
10
|
+
isChecked?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Disables the checkbox or switch so it cannot be toggled
|
|
13
|
+
*/
|
|
14
|
+
isDisabled?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Classname for the label
|
|
17
|
+
*/
|
|
18
|
+
labelClassName?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Function to be executed if the checked value changes
|
|
21
|
+
*/
|
|
22
|
+
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
23
|
+
/**
|
|
24
|
+
* Changes the design to use switch instead of checkbox
|
|
25
|
+
*/
|
|
26
|
+
shouldShowAsSwitch?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Whether the Checkbox should be displayed centered to the label or at the top
|
|
29
|
+
*/
|
|
30
|
+
shouldShowCentered?: boolean;
|
|
31
|
+
};
|
|
32
|
+
declare const Checkbox: FC<CheckboxProps>;
|
|
33
|
+
export default Checkbox;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _uuid = require("../../hooks/uuid");
|
|
9
|
+
var _calculate = require("../../utils/calculate");
|
|
10
|
+
var _Checkbox = require("./Checkbox.styles");
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
+
const Checkbox = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
children,
|
|
16
|
+
isChecked,
|
|
17
|
+
isDisabled,
|
|
18
|
+
labelClassName,
|
|
19
|
+
onChange,
|
|
20
|
+
shouldShowAsSwitch,
|
|
21
|
+
shouldShowCentered = false
|
|
22
|
+
} = _ref;
|
|
23
|
+
const [isActive, setIsActive] = (0, _react.useState)(isChecked ?? false);
|
|
24
|
+
const handleChange = (0, _react.useCallback)(event => {
|
|
25
|
+
setIsActive(event.target.checked);
|
|
26
|
+
if (typeof onChange === 'function') {
|
|
27
|
+
onChange(event);
|
|
28
|
+
}
|
|
29
|
+
}, [onChange]);
|
|
30
|
+
const uuid = (0, _uuid.useUuid)();
|
|
31
|
+
const lineHeight = (0, _react.useMemo)(() => shouldShowCentered ? undefined : (0, _calculate.getHeightOfSingleTextLine)(), [shouldShowCentered]);
|
|
32
|
+
return /*#__PURE__*/_react.default.createElement(_Checkbox.StyledCheckbox, null, /*#__PURE__*/_react.default.createElement(_Checkbox.StyledCheckboxInput, {
|
|
33
|
+
checked: isChecked,
|
|
34
|
+
disabled: isDisabled,
|
|
35
|
+
id: uuid,
|
|
36
|
+
onChange: handleChange,
|
|
37
|
+
type: "checkbox"
|
|
38
|
+
}), /*#__PURE__*/_react.default.createElement(_Checkbox.StyledCheckboxLabel, {
|
|
39
|
+
className: labelClassName,
|
|
40
|
+
htmlFor: uuid,
|
|
41
|
+
isChecked: isChecked ?? isActive,
|
|
42
|
+
isDisabled: isDisabled,
|
|
43
|
+
shouldShowAsSwitch: shouldShowAsSwitch,
|
|
44
|
+
lineHeight: lineHeight
|
|
45
|
+
}, children));
|
|
46
|
+
};
|
|
47
|
+
Checkbox.displayName = 'Checkbox';
|
|
48
|
+
var _default = exports.default = Checkbox;
|
|
49
|
+
//# sourceMappingURL=Checkbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Checkbox.js","names":["_react","_interopRequireWildcard","require","_uuid","_calculate","_Checkbox","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","Checkbox","_ref","children","isChecked","isDisabled","labelClassName","onChange","shouldShowAsSwitch","shouldShowCentered","isActive","setIsActive","useState","handleChange","useCallback","event","target","checked","uuid","useUuid","lineHeight","useMemo","undefined","getHeightOfSingleTextLine","createElement","StyledCheckbox","StyledCheckboxInput","disabled","id","type","StyledCheckboxLabel","className","htmlFor","displayName","_default","exports"],"sources":["../../../src/components/checkbox/Checkbox.tsx"],"sourcesContent":["import React, {\n ChangeEvent,\n ChangeEventHandler,\n FC,\n ReactElement,\n useCallback,\n useMemo,\n useState,\n} from 'react';\nimport { useUuid } from '../../hooks/uuid';\nimport { getHeightOfSingleTextLine } from '../../utils/calculate';\nimport { StyledCheckbox, StyledCheckboxInput, StyledCheckboxLabel } from './Checkbox.styles';\n\nexport type CheckboxProps = {\n /**\n * Text for checkbox or switch\n */\n children?: ReactElement;\n /**\n * Indicates whether the checkbox or switch is selected\n */\n isChecked?: boolean;\n /**\n * Disables the checkbox or switch so it cannot be toggled\n */\n isDisabled?: boolean;\n /**\n * Classname for the label\n */\n labelClassName?: string;\n /**\n * Function to be executed if the checked value changes\n */\n onChange?: ChangeEventHandler<HTMLInputElement>;\n /**\n * Changes the design to use switch instead of checkbox\n */\n shouldShowAsSwitch?: boolean;\n /**\n * Whether the Checkbox should be displayed centered to the label or at the top\n */\n shouldShowCentered?: boolean;\n};\n\nconst Checkbox: FC<CheckboxProps> = ({\n children,\n isChecked,\n isDisabled,\n labelClassName,\n onChange,\n shouldShowAsSwitch,\n shouldShowCentered = false,\n}) => {\n const [isActive, setIsActive] = useState(isChecked ?? false);\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n setIsActive(event.target.checked);\n\n if (typeof onChange === 'function') {\n onChange(event);\n }\n },\n [onChange],\n );\n\n const uuid = useUuid();\n\n const lineHeight = useMemo(\n () => (shouldShowCentered ? undefined : getHeightOfSingleTextLine()),\n [shouldShowCentered],\n );\n\n return (\n <StyledCheckbox>\n <StyledCheckboxInput\n checked={isChecked}\n disabled={isDisabled}\n id={uuid}\n onChange={handleChange}\n type=\"checkbox\"\n />\n <StyledCheckboxLabel\n className={labelClassName}\n htmlFor={uuid}\n isChecked={isChecked ?? isActive}\n isDisabled={isDisabled}\n shouldShowAsSwitch={shouldShowAsSwitch}\n lineHeight={lineHeight}\n >\n {children}\n </StyledCheckboxLabel>\n </StyledCheckbox>\n );\n};\n\nCheckbox.displayName = 'Checkbox';\n\nexport default Checkbox;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AASA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAA6F,SAAAI,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAN,wBAAAM,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,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,kBAAkB,CACvB,CAAC;EAED,oBACInC,MAAA,CAAAY,OAAA,CAAAsC,aAAA,CAAC7C,SAAA,CAAA8C,cAAc,qBACXnD,MAAA,CAAAY,OAAA,CAAAsC,aAAA,CAAC7C,SAAA,CAAA+C,mBAAmB;IAChBT,OAAO,EAAEb,SAAU;IACnBuB,QAAQ,EAAEtB,UAAW;IACrBuB,EAAE,EAAEV,IAAK;IACTX,QAAQ,EAAEM,YAAa;IACvBgB,IAAI,EAAC;EAAU,CAClB,CAAC,eACFvD,MAAA,CAAAY,OAAA,CAAAsC,aAAA,CAAC7C,SAAA,CAAAmD,mBAAmB;IAChBC,SAAS,EAAEzB,cAAe;IAC1B0B,OAAO,EAAEd,IAAK;IACdd,SAAS,EAAEA,SAAS,IAAIM,QAAS;IACjCL,UAAU,EAAEA,UAAW;IACvBG,kBAAkB,EAAEA,kBAAmB;IACvCY,UAAU,EAAEA;EAAW,GAEtBjB,QACgB,CACT,CAAC;AAEzB,CAAC;AAEDF,QAAQ,CAACgC,WAAW,GAAG,UAAU;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAjD,OAAA,GAEnBe,QAAQ"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';
|
|
3
|
+
import type { CheckboxProps } from './Checkbox';
|
|
4
|
+
export declare const StyledCheckbox: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
|
|
5
|
+
export declare const StyledCheckboxInput: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, never>>;
|
|
6
|
+
type StyledCheckboxLabelProps = WithTheme<{
|
|
7
|
+
shouldShowAsSwitch?: CheckboxProps['shouldShowAsSwitch'];
|
|
8
|
+
isDisabled?: CheckboxProps['isDisabled'];
|
|
9
|
+
isChecked?: CheckboxProps['isChecked'];
|
|
10
|
+
lineHeight?: number;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const StyledCheckboxLabel: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, StyledCheckboxLabelProps>>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledCheckboxLabel = exports.StyledCheckboxInput = exports.StyledCheckbox = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
8
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
9
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
10
|
+
const StyledCheckbox = exports.StyledCheckbox = _styledComponents.default.div`
|
|
11
|
+
align-items: center;
|
|
12
|
+
display: flex;
|
|
13
|
+
position: relative;
|
|
14
|
+
`;
|
|
15
|
+
const StyledCheckboxInput = exports.StyledCheckboxInput = _styledComponents.default.input`
|
|
16
|
+
display: none;
|
|
17
|
+
`;
|
|
18
|
+
const StyledCheckboxLabel = exports.StyledCheckboxLabel = _styledComponents.default.label`
|
|
19
|
+
color: ${_ref => {
|
|
20
|
+
let {
|
|
21
|
+
theme
|
|
22
|
+
} = _ref;
|
|
23
|
+
return theme.text;
|
|
24
|
+
}};
|
|
25
|
+
cursor: ${_ref2 => {
|
|
26
|
+
let {
|
|
27
|
+
isDisabled
|
|
28
|
+
} = _ref2;
|
|
29
|
+
return isDisabled ? 'default' : 'pointer';
|
|
30
|
+
}};
|
|
31
|
+
opacity: ${_ref3 => {
|
|
32
|
+
let {
|
|
33
|
+
isDisabled
|
|
34
|
+
} = _ref3;
|
|
35
|
+
return isDisabled ? 0.5 : 1;
|
|
36
|
+
}};
|
|
37
|
+
padding-left: ${_ref4 => {
|
|
38
|
+
let {
|
|
39
|
+
shouldShowAsSwitch
|
|
40
|
+
} = _ref4;
|
|
41
|
+
return shouldShowAsSwitch ? '48px' : '20px';
|
|
42
|
+
}};
|
|
43
|
+
transition: opacity 0.2s ease;
|
|
44
|
+
user-select: none;
|
|
45
|
+
|
|
46
|
+
&:after {
|
|
47
|
+
${_ref5 => {
|
|
48
|
+
let {
|
|
49
|
+
isChecked,
|
|
50
|
+
shouldShowAsSwitch,
|
|
51
|
+
lineHeight
|
|
52
|
+
} = _ref5;
|
|
53
|
+
return shouldShowAsSwitch ? (0, _styledComponents.css)`
|
|
54
|
+
background-color: white;
|
|
55
|
+
border-radius: 50%;
|
|
56
|
+
box-shadow: 0 1px 4px rgb(0 0 0 / 35%);
|
|
57
|
+
height: 16px;
|
|
58
|
+
left: 7px;
|
|
59
|
+
top: ${lineHeight ? `${lineHeight / 1.5}px` : '50%'};
|
|
60
|
+
transform: translateX(${isChecked ? '18px' : 0}) translateY(-50%);
|
|
61
|
+
transition: transform 0.2s ease;
|
|
62
|
+
width: 16px;
|
|
63
|
+
` : (0, _styledComponents.css)`
|
|
64
|
+
border-right: 2px solid #fff;
|
|
65
|
+
border-bottom: 2px solid #fff;
|
|
66
|
+
height: 10px;
|
|
67
|
+
left: 2px;
|
|
68
|
+
opacity: ${isChecked ? 1 : 0};
|
|
69
|
+
top: ${lineHeight ? `calc(${lineHeight / 1.5}px - 2px)` : 'calc(50% - 2px)'};
|
|
70
|
+
transform: rotateZ(37deg) translateY(-50%);
|
|
71
|
+
transition: opacity 0.2s ease;
|
|
72
|
+
width: 5.5px;
|
|
73
|
+
`;
|
|
74
|
+
}}
|
|
75
|
+
|
|
76
|
+
content: ' ';
|
|
77
|
+
position: absolute;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&:before {
|
|
81
|
+
background-color: ${_ref6 => {
|
|
82
|
+
let {
|
|
83
|
+
isChecked,
|
|
84
|
+
shouldShowAsSwitch,
|
|
85
|
+
theme
|
|
86
|
+
} = _ref6;
|
|
87
|
+
if (shouldShowAsSwitch) {
|
|
88
|
+
return isChecked ? theme.green : theme.red;
|
|
89
|
+
}
|
|
90
|
+
return isChecked ? theme['408'] : theme['403'];
|
|
91
|
+
}};
|
|
92
|
+
border: 1px solid rgba(${_ref7 => {
|
|
93
|
+
let {
|
|
94
|
+
theme
|
|
95
|
+
} = _ref7;
|
|
96
|
+
return theme['409-rgb'];
|
|
97
|
+
}}, 0.5);
|
|
98
|
+
border-radius: ${_ref8 => {
|
|
99
|
+
let {
|
|
100
|
+
shouldShowAsSwitch
|
|
101
|
+
} = _ref8;
|
|
102
|
+
return shouldShowAsSwitch ? '100px' : 0;
|
|
103
|
+
}};
|
|
104
|
+
content: ' ';
|
|
105
|
+
height: ${_ref9 => {
|
|
106
|
+
let {
|
|
107
|
+
shouldShowAsSwitch
|
|
108
|
+
} = _ref9;
|
|
109
|
+
return shouldShowAsSwitch ? '13px' : '15px';
|
|
110
|
+
}};
|
|
111
|
+
left: ${_ref10 => {
|
|
112
|
+
let {
|
|
113
|
+
shouldShowAsSwitch
|
|
114
|
+
} = _ref10;
|
|
115
|
+
return shouldShowAsSwitch ? '10px' : 0;
|
|
116
|
+
}};
|
|
117
|
+
position: absolute;
|
|
118
|
+
transition: background-color 0.2s ease;
|
|
119
|
+
width: ${_ref11 => {
|
|
120
|
+
let {
|
|
121
|
+
shouldShowAsSwitch
|
|
122
|
+
} = _ref11;
|
|
123
|
+
return shouldShowAsSwitch ? '28px' : '15px';
|
|
124
|
+
}};
|
|
125
|
+
${_ref12 => {
|
|
126
|
+
let {
|
|
127
|
+
lineHeight
|
|
128
|
+
} = _ref12;
|
|
129
|
+
return lineHeight ? (0, _styledComponents.css)`
|
|
130
|
+
top: ${lineHeight / 1.5}px;
|
|
131
|
+
transform: translateY(-50%);
|
|
132
|
+
` : (0, _styledComponents.css)`
|
|
133
|
+
top: 50%;
|
|
134
|
+
transform: translateY(-50%);
|
|
135
|
+
`;
|
|
136
|
+
}}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
`;
|
|
140
|
+
//# sourceMappingURL=Checkbox.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Checkbox.styles.js","names":["_styledComponents","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","StyledCheckbox","exports","styled","div","StyledCheckboxInput","input","StyledCheckboxLabel","label","_ref","theme","text","_ref2","isDisabled","_ref3","_ref4","shouldShowAsSwitch","_ref5","isChecked","lineHeight","css","_ref6","green","red","_ref7","_ref8","_ref9","_ref10","_ref11","_ref12"],"sources":["../../../src/components/checkbox/Checkbox.styles.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\nimport type { CheckboxProps } from './Checkbox';\n\nexport const StyledCheckbox = styled.div`\n align-items: center;\n display: flex;\n position: relative;\n`;\n\nexport const StyledCheckboxInput = styled.input`\n display: none;\n`;\n\ntype StyledCheckboxLabelProps = WithTheme<{\n shouldShowAsSwitch?: CheckboxProps['shouldShowAsSwitch'];\n isDisabled?: CheckboxProps['isDisabled'];\n isChecked?: CheckboxProps['isChecked'];\n lineHeight?: number;\n}>;\n\nexport const StyledCheckboxLabel = styled.label<StyledCheckboxLabelProps>`\n color: ${({ theme }: StyledCheckboxLabelProps) => theme.text};\n cursor: ${({ isDisabled }) => (isDisabled ? 'default' : 'pointer')};\n opacity: ${({ isDisabled }) => (isDisabled ? 0.5 : 1)};\n padding-left: ${({ shouldShowAsSwitch }) => (shouldShowAsSwitch ? '48px' : '20px')};\n transition: opacity 0.2s ease;\n user-select: none;\n\n &:after {\n ${({ isChecked, shouldShowAsSwitch, lineHeight }) =>\n shouldShowAsSwitch\n ? css`\n background-color: white;\n border-radius: 50%;\n box-shadow: 0 1px 4px rgb(0 0 0 / 35%);\n height: 16px;\n left: 7px;\n top: ${lineHeight ? `${lineHeight / 1.5}px` : '50%'};\n transform: translateX(${isChecked ? '18px' : 0}) translateY(-50%);\n transition: transform 0.2s ease;\n width: 16px;\n `\n : css`\n border-right: 2px solid #fff;\n border-bottom: 2px solid #fff;\n height: 10px;\n left: 2px;\n opacity: ${isChecked ? 1 : 0};\n top: ${lineHeight ? `calc(${lineHeight / 1.5}px - 2px)` : 'calc(50% - 2px)'};\n transform: rotateZ(37deg) translateY(-50%);\n transition: opacity 0.2s ease;\n width: 5.5px;\n `}\n\n content: ' ';\n position: absolute;\n }\n\n &:before {\n background-color: ${({\n isChecked,\n shouldShowAsSwitch,\n theme,\n }: StyledCheckboxLabelProps) => {\n if (shouldShowAsSwitch) {\n return isChecked ? theme.green : theme.red;\n }\n\n return isChecked ? theme['408'] : theme['403'];\n }};\n border: 1px solid rgba(${({ theme }: StyledCheckboxLabelProps) => theme['409-rgb']}, 0.5);\n border-radius: ${({ shouldShowAsSwitch }) => (shouldShowAsSwitch ? '100px' : 0)};\n content: ' ';\n height: ${({ shouldShowAsSwitch }) => (shouldShowAsSwitch ? '13px' : '15px')};\n left: ${({ shouldShowAsSwitch }) => (shouldShowAsSwitch ? '10px' : 0)};\n position: absolute;\n transition: background-color 0.2s ease;\n width: ${({ shouldShowAsSwitch }) => (shouldShowAsSwitch ? '28px' : '15px')};\n ${({ lineHeight }) =>\n lineHeight\n ? css`\n top: ${lineHeight / 1.5}px;\n transform: translateY(-50%);\n `\n : css`\n top: 50%;\n transform: translateY(-50%);\n `}\n }\n }\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAgD,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,GAAA,IAAAW,CAAA,CAAAC,GAAA,IAAAR,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAI,CAAA,IAAAV,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CA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6BAA6BD,UAAU,GAAG,GAAI;AAC9C;AACA,mBAAmB,GACD,IAAAC,qBAAG,CAAC;AACtB;AACA;AACA,mBAAmB;AAAA,CAAC;AACpB;AACA;AACA,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { CodeHighlighterLanguage, CodeHighlighterTheme, HighlightedLines } from '../../types/codeHighlighter';
|
|
3
|
+
export type CodeHighlighterProps = {
|
|
4
|
+
/**
|
|
5
|
+
* The code that should be displayed.
|
|
6
|
+
*/
|
|
7
|
+
code: string;
|
|
8
|
+
/**
|
|
9
|
+
* The text that should be displayed after the copy button.
|
|
10
|
+
* If not set, just the button is displayed without text.
|
|
11
|
+
*/
|
|
12
|
+
copyButtonText?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The lines of code that should be highlighted.
|
|
15
|
+
* Following lines can be highlighted: added, removed and just marked.
|
|
16
|
+
*/
|
|
17
|
+
highlightedLines?: HighlightedLines;
|
|
18
|
+
/**
|
|
19
|
+
* The language of the displayed code.
|
|
20
|
+
*/
|
|
21
|
+
language: CodeHighlighterLanguage;
|
|
22
|
+
/**
|
|
23
|
+
* Whether the code should be formatted with prettier.
|
|
24
|
+
*/
|
|
25
|
+
shouldFormatCode?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Whether the line numbers should be displayed.
|
|
28
|
+
*/
|
|
29
|
+
shouldShowLineNumbers?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* The theme of the code block. Decide between dark and light.
|
|
32
|
+
*/
|
|
33
|
+
theme?: CodeHighlighterTheme;
|
|
34
|
+
};
|
|
35
|
+
declare const CodeHighlighter: FC<CodeHighlighterProps>;
|
|
36
|
+
export default CodeHighlighter;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _standalone = require("prettier/standalone");
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _reactSyntaxHighlighter = require("react-syntax-highlighter");
|
|
10
|
+
var _prism = require("react-syntax-highlighter/dist/esm/styles/prism");
|
|
11
|
+
var _codeHighlighter = require("../../types/codeHighlighter");
|
|
12
|
+
var _codeHighlighter2 = require("../../utils/codeHighlighter");
|
|
13
|
+
var _CodeHighlighter = require("./CodeHighlighter.styles");
|
|
14
|
+
var _CopyToClipboard = _interopRequireDefault(require("./copy-to-clipboard/CopyToClipboard"));
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
17
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
|
+
const CodeHighlighter = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
theme = _codeHighlighter.CodeHighlighterTheme.Dark,
|
|
21
|
+
code,
|
|
22
|
+
copyButtonText,
|
|
23
|
+
language,
|
|
24
|
+
highlightedLines,
|
|
25
|
+
shouldFormatCode = false,
|
|
26
|
+
shouldShowLineNumbers = false
|
|
27
|
+
} = _ref;
|
|
28
|
+
// function to style highlighted code
|
|
29
|
+
const lineWrapper = (0, _react.useCallback)(lineNumber => {
|
|
30
|
+
let style = {
|
|
31
|
+
backgroundColor: 'none',
|
|
32
|
+
display: 'block',
|
|
33
|
+
borderRadius: '2px'
|
|
34
|
+
};
|
|
35
|
+
if (highlightedLines?.added && highlightedLines.added.includes(lineNumber)) {
|
|
36
|
+
style = {
|
|
37
|
+
...style,
|
|
38
|
+
backgroundColor: '#2EF29930'
|
|
39
|
+
};
|
|
40
|
+
} else if (highlightedLines?.removed && highlightedLines.removed.includes(lineNumber)) {
|
|
41
|
+
style = {
|
|
42
|
+
...style,
|
|
43
|
+
backgroundColor: '#F22E5B30'
|
|
44
|
+
};
|
|
45
|
+
} else if (highlightedLines?.marked && highlightedLines.marked.includes(lineNumber)) {
|
|
46
|
+
style = {
|
|
47
|
+
...style,
|
|
48
|
+
backgroundColor: '#cccccc40'
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
style
|
|
53
|
+
};
|
|
54
|
+
}, [highlightedLines]);
|
|
55
|
+
const formattedCode = (0, _react.useMemo)(() => {
|
|
56
|
+
if (language) {
|
|
57
|
+
const config = (0, _codeHighlighter2.getParserForLanguage)(language);
|
|
58
|
+
if (shouldFormatCode && config) {
|
|
59
|
+
return (0, _standalone.format)(code, config);
|
|
60
|
+
}
|
|
61
|
+
return code;
|
|
62
|
+
}
|
|
63
|
+
return code;
|
|
64
|
+
}, [code, language, shouldFormatCode]);
|
|
65
|
+
return (0, _react.useMemo)(() => /*#__PURE__*/_react.default.createElement(_CodeHighlighter.StyledCodeHighlighter, {
|
|
66
|
+
codeTheme: theme
|
|
67
|
+
}, /*#__PURE__*/_react.default.createElement(_CodeHighlighter.StyledCodeHighlighterHeader, {
|
|
68
|
+
codeTheme: theme
|
|
69
|
+
}, /*#__PURE__*/_react.default.createElement(_CodeHighlighter.StyledCodeHighlighterFileName, {
|
|
70
|
+
codeTheme: theme
|
|
71
|
+
}, (0, _codeHighlighter2.formatLanguage)(language)), /*#__PURE__*/_react.default.createElement(_CopyToClipboard.default, {
|
|
72
|
+
text: code,
|
|
73
|
+
theme: theme,
|
|
74
|
+
copyButtonText: copyButtonText
|
|
75
|
+
})), /*#__PURE__*/_react.default.createElement(_reactSyntaxHighlighter.PrismAsyncLight, {
|
|
76
|
+
language: language ?? '',
|
|
77
|
+
showLineNumbers: shouldShowLineNumbers,
|
|
78
|
+
style: theme === _codeHighlighter.CodeHighlighterTheme.Dark ? _prism.oneDark : _prism.oneLight,
|
|
79
|
+
wrapLines: true,
|
|
80
|
+
lineProps: lineWrapper
|
|
81
|
+
}, formattedCode)), [theme, language, code, copyButtonText, shouldShowLineNumbers, lineWrapper, formattedCode]);
|
|
82
|
+
};
|
|
83
|
+
CodeHighlighter.displayName = 'CodeHighlighter';
|
|
84
|
+
var _default = exports.default = CodeHighlighter;
|
|
85
|
+
//# sourceMappingURL=CodeHighlighter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeHighlighter.js","names":["_standalone","require","_react","_interopRequireWildcard","_reactSyntaxHighlighter","_prism","_codeHighlighter","_codeHighlighter2","_CodeHighlighter","_CopyToClipboard","_interopRequireDefault","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","CodeHighlighter","_ref","theme","CodeHighlighterTheme","Dark","code","copyButtonText","language","highlightedLines","shouldFormatCode","shouldShowLineNumbers","lineWrapper","useCallback","lineNumber","style","backgroundColor","display","borderRadius","added","includes","removed","marked","formattedCode","useMemo","config","getParserForLanguage","format","createElement","StyledCodeHighlighter","codeTheme","StyledCodeHighlighterHeader","StyledCodeHighlighterFileName","formatLanguage","text","PrismAsyncLight","showLineNumbers","oneDark","oneLight","wrapLines","lineProps","displayName","_default","exports"],"sources":["../../../src/components/code-highlighter/CodeHighlighter.tsx"],"sourcesContent":["import { format } from 'prettier/standalone';\nimport React, { FC, useCallback, useMemo } from 'react';\nimport { PrismAsyncLight as SyntaxHighlighter } from 'react-syntax-highlighter';\nimport { oneDark, oneLight } from 'react-syntax-highlighter/dist/esm/styles/prism';\nimport {\n CodeHighlighterLanguage,\n CodeHighlighterTheme,\n HighlightedLines,\n} from '../../types/codeHighlighter';\nimport { formatLanguage, getParserForLanguage } from '../../utils/codeHighlighter';\nimport {\n StyledCodeHighlighter,\n StyledCodeHighlighterFileName,\n StyledCodeHighlighterHeader,\n} from './CodeHighlighter.styles';\nimport CopyToClipboard from './copy-to-clipboard/CopyToClipboard';\n\nexport type CodeHighlighterProps = {\n /**\n * The code that should be displayed.\n */\n code: string;\n /**\n * The text that should be displayed after the copy button.\n * If not set, just the button is displayed without text.\n */\n copyButtonText?: string;\n /**\n * The lines of code that should be highlighted.\n * Following lines can be highlighted: added, removed and just marked.\n */\n highlightedLines?: HighlightedLines;\n /**\n * The language of the displayed code.\n */\n language: CodeHighlighterLanguage;\n /**\n * Whether the code should be formatted with prettier.\n */\n shouldFormatCode?: boolean;\n /**\n * Whether the line numbers should be displayed.\n */\n shouldShowLineNumbers?: boolean;\n /**\n * The theme of the code block. Decide between dark and light.\n */\n theme?: CodeHighlighterTheme;\n};\n\nconst CodeHighlighter: FC<CodeHighlighterProps> = ({\n theme = CodeHighlighterTheme.Dark,\n code,\n copyButtonText,\n language,\n highlightedLines,\n shouldFormatCode = false,\n shouldShowLineNumbers = false,\n}) => {\n // function to style highlighted code\n const lineWrapper = useCallback(\n (lineNumber: number) => {\n let style = {\n backgroundColor: 'none',\n display: 'block',\n borderRadius: '2px',\n };\n\n if (highlightedLines?.added && highlightedLines.added.includes(lineNumber)) {\n style = { ...style, backgroundColor: '#2EF29930' };\n } else if (highlightedLines?.removed && highlightedLines.removed.includes(lineNumber)) {\n style = { ...style, backgroundColor: '#F22E5B30' };\n } else if (highlightedLines?.marked && highlightedLines.marked.includes(lineNumber)) {\n style = { ...style, backgroundColor: '#cccccc40' };\n }\n\n return { style };\n },\n [highlightedLines],\n );\n\n const formattedCode = useMemo(() => {\n if (language) {\n const config = getParserForLanguage(language);\n\n if (shouldFormatCode && config) {\n return format(code, config) as unknown as string;\n }\n\n return code;\n }\n\n return code;\n }, [code, language, shouldFormatCode]);\n\n return useMemo(\n () => (\n <StyledCodeHighlighter codeTheme={theme}>\n <StyledCodeHighlighterHeader codeTheme={theme}>\n <StyledCodeHighlighterFileName codeTheme={theme}>\n {formatLanguage(language)}\n </StyledCodeHighlighterFileName>\n <CopyToClipboard text={code} theme={theme} copyButtonText={copyButtonText} />\n </StyledCodeHighlighterHeader>\n <SyntaxHighlighter\n language={language ?? ''}\n showLineNumbers={shouldShowLineNumbers}\n style={theme === CodeHighlighterTheme.Dark ? oneDark : oneLight}\n wrapLines\n lineProps={lineWrapper}\n >\n {formattedCode}\n </SyntaxHighlighter>\n </StyledCodeHighlighter>\n ),\n [theme, language, code, copyButtonText, shouldShowLineNumbers, lineWrapper, formattedCode],\n );\n};\n\nCodeHighlighter.displayName = 'CodeHighlighter';\n\nexport default CodeHighlighter;\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,uBAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AAKA,IAAAM,iBAAA,GAAAN,OAAA;AACA,IAAAO,gBAAA,GAAAP,OAAA;AAKA,IAAAQ,gBAAA,GAAAC,sBAAA,CAAAT,OAAA;AAAkE,SAAAS,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAZ,wBAAAY,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAA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jC,MAAA,CAAAW,OAAA,CAAA+C,aAAA,CAACpD,gBAAA,CAAAwD,6BAA6B;IAACF,SAAS,EAAE3B;EAAM,GAC3C,IAAA8B,gCAAc,EAACzB,QAAQ,CACG,CAAC,eAChCtC,MAAA,CAAAW,OAAA,CAAA+C,aAAA,CAACnD,gBAAA,CAAAI,OAAe;IAACqD,IAAI,EAAE5B,IAAK;IAACH,KAAK,EAAEA,KAAM;IAACI,cAAc,EAAEA;EAAe,CAAE,CACnD,CAAC,eAC9BrC,MAAA,CAAAW,OAAA,CAAA+C,aAAA,CAACxD,uBAAA,CAAA+D,eAAiB;IACd3B,QAAQ,EAAEA,QAAQ,IAAI,EAAG;IACzB4B,eAAe,EAAEzB,qBAAsB;IACvCI,KAAK,EAAEZ,KAAK,KAAKC,qCAAoB,CAACC,IAAI,GAAGgC,cAAO,GAAGC,eAAS;IAChEC,SAAS;IACTC,SAAS,EAAE5B;EAAY,GAEtBW,aACc,CACA,CAC1B,EACD,CAACpB,KAAK,EAAEK,QAAQ,EAAEF,IAAI,EAAEC,cAAc,EAAEI,qBAAqB,EAAEC,WAAW,EAAEW,aAAa,CAC7F,CAAC;AACL,CAAC;AAEDtB,eAAe,CAACwC,WAAW,GAAG,iBAAiB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA9D,OAAA,GAEjCoB,eAAe"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CodeHighlighterTheme } from '../../types/codeHighlighter';
|
|
3
|
+
import type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';
|
|
4
|
+
type StyledCodeHighlighterProps = WithTheme<{
|
|
5
|
+
codeTheme: CodeHighlighterTheme;
|
|
6
|
+
}>;
|
|
7
|
+
export declare const StyledCodeHighlighter: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledCodeHighlighterProps>>;
|
|
8
|
+
type StyledCodeHighlighterHeaderProps = WithTheme<{
|
|
9
|
+
codeTheme: CodeHighlighterTheme;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const StyledCodeHighlighterHeader: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledCodeHighlighterHeaderProps>>;
|
|
12
|
+
type StyledCodeHighlighterFileNameProps = WithTheme<{
|
|
13
|
+
codeTheme: CodeHighlighterTheme;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const StyledCodeHighlighterFileName: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, StyledCodeHighlighterFileNameProps>>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledCodeHighlighterHeader = exports.StyledCodeHighlighterFileName = exports.StyledCodeHighlighter = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
var _codeHighlighter = require("../../types/codeHighlighter");
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
const StyledCodeHighlighter = exports.StyledCodeHighlighter = _styledComponents.default.div`
|
|
11
|
+
margin: 4px 0;
|
|
12
|
+
background-color: ${_ref => {
|
|
13
|
+
let {
|
|
14
|
+
codeTheme
|
|
15
|
+
} = _ref;
|
|
16
|
+
return codeTheme === _codeHighlighter.CodeHighlighterTheme.Dark ? '#282c34' : '#fafafa';
|
|
17
|
+
}};
|
|
18
|
+
border-radius: 8px;
|
|
19
|
+
padding-bottom: 6px;
|
|
20
|
+
|
|
21
|
+
pre {
|
|
22
|
+
margin: 0 !important;
|
|
23
|
+
overflow: auto;
|
|
24
|
+
padding: 1em;
|
|
25
|
+
line-height: 1.5;
|
|
26
|
+
|
|
27
|
+
// Styles for custom scrollbar
|
|
28
|
+
&::-webkit-scrollbar {
|
|
29
|
+
height: 5px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&::-webkit-scrollbar-track {
|
|
33
|
+
background-color: transparent;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&::-webkit-scrollbar-button {
|
|
37
|
+
background-color: transparent;
|
|
38
|
+
height: 2px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&::-webkit-scrollbar-thumb {
|
|
42
|
+
|
|
43
|
+
background-color: rgba(${_ref2 => {
|
|
44
|
+
let {
|
|
45
|
+
codeTheme
|
|
46
|
+
} = _ref2;
|
|
47
|
+
return codeTheme === _codeHighlighter.CodeHighlighterTheme.Dark ? '229, 229, 229' : '153, 153, 153';
|
|
48
|
+
}},
|
|
49
|
+
1);
|
|
50
|
+
border-radius: 20px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Scrollbar styles for Firefox. The above styles are not supported in Firefox, these styles are
|
|
54
|
+
// only supported in Firefox:
|
|
55
|
+
* {
|
|
56
|
+
scrollbar-color: rgba(${_ref3 => {
|
|
57
|
+
let {
|
|
58
|
+
codeTheme
|
|
59
|
+
} = _ref3;
|
|
60
|
+
return codeTheme === _codeHighlighter.CodeHighlighterTheme.Dark ? '229, 229, 229' : '153, 153, 153';
|
|
61
|
+
}},
|
|
62
|
+
1);)transparent;
|
|
63
|
+
scrollbar-width: thin;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
67
|
+
const StyledCodeHighlighterHeader = exports.StyledCodeHighlighterHeader = _styledComponents.default.div`
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
justify-content: space-between;
|
|
71
|
+
border-bottom: 1px solid
|
|
72
|
+
${_ref4 => {
|
|
73
|
+
let {
|
|
74
|
+
codeTheme
|
|
75
|
+
} = _ref4;
|
|
76
|
+
return codeTheme === _codeHighlighter.CodeHighlighterTheme.Dark ? '#e5e5e5' : '#999999';
|
|
77
|
+
}};
|
|
78
|
+
padding: 4px 12px;
|
|
79
|
+
`;
|
|
80
|
+
const StyledCodeHighlighterFileName = exports.StyledCodeHighlighterFileName = _styledComponents.default.span`
|
|
81
|
+
color: ${_ref5 => {
|
|
82
|
+
let {
|
|
83
|
+
codeTheme
|
|
84
|
+
} = _ref5;
|
|
85
|
+
return codeTheme === _codeHighlighter.CodeHighlighterTheme.Dark ? '#e5e5e5' : '#999999';
|
|
86
|
+
}};
|
|
87
|
+
`;
|
|
88
|
+
//# sourceMappingURL=CodeHighlighter.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeHighlighter.styles.js","names":["_styledComponents","_interopRequireDefault","require","_codeHighlighter","obj","__esModule","default","StyledCodeHighlighter","exports","styled","div","_ref","codeTheme","CodeHighlighterTheme","Dark","_ref2","_ref3","StyledCodeHighlighterHeader","_ref4","StyledCodeHighlighterFileName","span","_ref5"],"sources":["../../../src/components/code-highlighter/CodeHighlighter.styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { CodeHighlighterTheme } from '../../types/codeHighlighter';\nimport type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\n\ntype StyledCodeHighlighterProps = WithTheme<{\n codeTheme: CodeHighlighterTheme;\n}>;\n\nexport const StyledCodeHighlighter = styled.div<StyledCodeHighlighterProps>`\n margin: 4px 0;\n background-color: ${({ codeTheme }) =>\n codeTheme === CodeHighlighterTheme.Dark ? '#282c34' : '#fafafa'};\n border-radius: 8px;\n padding-bottom: 6px;\n\n pre {\n margin: 0 !important;\n overflow: auto;\n padding: 1em;\n line-height: 1.5;\n\n // Styles for custom scrollbar\n &::-webkit-scrollbar {\n height: 5px;\n }\n\n &::-webkit-scrollbar-track {\n background-color: transparent;\n }\n\n &::-webkit-scrollbar-button {\n background-color: transparent;\n height: 2px;\n }\n\n &::-webkit-scrollbar-thumb {\n\n background-color: rgba(${({ codeTheme }) =>\n codeTheme === CodeHighlighterTheme.Dark ? '229, 229, 229' : '153, 153, 153'},\n 1);\n border-radius: 20px;\n }\n\n // Scrollbar styles for Firefox. The above styles are not supported in Firefox, these styles are\n // only supported in Firefox:\n * {\n scrollbar-color: rgba(${({ codeTheme }) =>\n codeTheme === CodeHighlighterTheme.Dark ? '229, 229, 229' : '153, 153, 153'},\n 1);)transparent;\n scrollbar-width: thin;\n }\n }\n`;\n\ntype StyledCodeHighlighterHeaderProps = WithTheme<{\n codeTheme: CodeHighlighterTheme;\n}>;\n\nexport const StyledCodeHighlighterHeader = styled.div<StyledCodeHighlighterHeaderProps>`\n display: flex;\n align-items: center;\n justify-content: space-between;\n border-bottom: 1px solid\n ${({ codeTheme }) => (codeTheme === CodeHighlighterTheme.Dark ? '#e5e5e5' : '#999999')};\n padding: 4px 12px;\n`;\n\ntype StyledCodeHighlighterFileNameProps = WithTheme<{\n codeTheme: CodeHighlighterTheme;\n}>;\n\nexport const StyledCodeHighlighterFileName = styled.span<StyledCodeHighlighterFileNameProps>`\n color: ${({ codeTheme }) => (codeTheme === CodeHighlighterTheme.Dark ? '#e5e5e5' : '#999999')};\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AAAmE,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAO5D,MAAMG,qBAAqB,GAAAC,OAAA,CAAAD,qBAAA,GAAGE,yBAAM,CAACC,GAAgC;AAC5E;AACA,sBAAsBC,IAAA;EAAA,IAAC;IAAEC;EAAU,CAAC,GAAAD,IAAA;EAAA,OAC9BC,SAAS,KAAKC,qCAAoB,CAACC,IAAI,GAAG,SAAS,GAAG,SAAS;AAAA,CAAC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+BC,KAAA;EAAA,IAAC;IAAEH;EAAU,CAAC,GAAAG,KAAA;EAAA,OACnCH,SAAS,KAAKC,qCAAoB,CAACC,IAAI,GAAG,eAAe,GAAG,eAAe;AAAA,CAAC;AACtF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8BE,KAAA;EAAA,IAAC;IAAEJ;EAAU,CAAC,GAAAI,KAAA;EAAA,OAClCJ,SAAS,KAAKC,qCAAoB,CAACC,IAAI,GAAG,eAAe,GAAG,eAAe;AAAA,CAAC;AACtF;AACA;AACA;AACA;AACA,CAAC;AAMM,MAAMG,2BAA2B,GAAAT,OAAA,CAAAS,2BAAA,GAAGR,yBAAM,CAACC,GAAsC;AACxF;AACA;AACA;AACA;AACA,UAAUQ,KAAA;EAAA,IAAC;IAAEN;EAAU,CAAC,GAAAM,KAAA;EAAA,OAAMN,SAAS,KAAKC,qCAAoB,CAACC,IAAI,GAAG,SAAS,GAAG,SAAS;AAAA,CAAE;AAC/F;AACA,CAAC;AAMM,MAAMK,6BAA6B,GAAAX,OAAA,CAAAW,6BAAA,GAAGV,yBAAM,CAACW,IAAyC;AAC7F,aAAaC,KAAA;EAAA,IAAC;IAAET;EAAU,CAAC,GAAAS,KAAA;EAAA,OAAMT,SAAS,KAAKC,qCAAoB,CAACC,IAAI,GAAG,SAAS,GAAG,SAAS;AAAA,CAAE;AAClG,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { CodeHighlighterTheme } from '../../../types/codeHighlighter';
|
|
3
|
+
export type CopyToClipboardProps = {
|
|
4
|
+
copyButtonText?: string;
|
|
5
|
+
text: string;
|
|
6
|
+
theme: CodeHighlighterTheme;
|
|
7
|
+
};
|
|
8
|
+
declare const CopyToClipboard: FC<CopyToClipboardProps>;
|
|
9
|
+
export default CopyToClipboard;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _codeHighlighter = require("../../../types/codeHighlighter");
|
|
9
|
+
var _Icon = _interopRequireDefault(require("../../icon/Icon"));
|
|
10
|
+
var _Popup = _interopRequireDefault(require("../../popup/Popup"));
|
|
11
|
+
var _CopyToClipboard = require("./CopyToClipboard.styles");
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
const CopyToClipboard = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
copyButtonText,
|
|
16
|
+
text,
|
|
17
|
+
theme
|
|
18
|
+
} = _ref;
|
|
19
|
+
const handleClick = () => {
|
|
20
|
+
void navigator.clipboard.writeText(text);
|
|
21
|
+
};
|
|
22
|
+
const popupContent = /*#__PURE__*/_react.default.createElement("span", {
|
|
23
|
+
style: {
|
|
24
|
+
display: 'block',
|
|
25
|
+
padding: '5px'
|
|
26
|
+
}
|
|
27
|
+
}, /*#__PURE__*/_react.default.createElement("p", null, "Kopiert!"));
|
|
28
|
+
return /*#__PURE__*/_react.default.createElement(_Popup.default, {
|
|
29
|
+
content: popupContent
|
|
30
|
+
}, /*#__PURE__*/_react.default.createElement(_CopyToClipboard.StyledCopyToClipboard, {
|
|
31
|
+
onClick: handleClick
|
|
32
|
+
}, /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
33
|
+
icons: ['fa-light fa-clipboard'],
|
|
34
|
+
color: theme === _codeHighlighter.CodeHighlighterTheme.Dark ? '#e5e5e5' : '#999999'
|
|
35
|
+
}), copyButtonText && /*#__PURE__*/_react.default.createElement(_CopyToClipboard.StyledCopyToClipboardText, {
|
|
36
|
+
codeTheme: theme
|
|
37
|
+
}, copyButtonText)));
|
|
38
|
+
};
|
|
39
|
+
CopyToClipboard.displayName = 'CopyToClipboard';
|
|
40
|
+
var _default = exports.default = CopyToClipboard;
|
|
41
|
+
//# sourceMappingURL=CopyToClipboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopyToClipboard.js","names":["_react","_interopRequireDefault","require","_codeHighlighter","_Icon","_Popup","_CopyToClipboard","obj","__esModule","default","CopyToClipboard","_ref","copyButtonText","text","theme","handleClick","navigator","clipboard","writeText","popupContent","createElement","style","display","padding","content","StyledCopyToClipboard","onClick","icons","color","CodeHighlighterTheme","Dark","StyledCopyToClipboardText","codeTheme","displayName","_default","exports"],"sources":["../../../../src/components/code-highlighter/copy-to-clipboard/CopyToClipboard.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport { CodeHighlighterTheme } from '../../../types/codeHighlighter';\nimport Icon from '../../icon/Icon';\nimport Popup from '../../popup/Popup';\nimport { StyledCopyToClipboard, StyledCopyToClipboardText } from './CopyToClipboard.styles';\n\nexport type CopyToClipboardProps = {\n copyButtonText?: string;\n text: string;\n theme: CodeHighlighterTheme;\n};\n\nconst CopyToClipboard: FC<CopyToClipboardProps> = ({ copyButtonText, text, theme }) => {\n const handleClick = () => {\n void navigator.clipboard.writeText(text);\n };\n\n const popupContent = (\n <span style={{ display: 'block', padding: '5px' }}>\n <p>Kopiert!</p>\n </span>\n );\n\n return (\n <Popup content={popupContent}>\n <StyledCopyToClipboard onClick={handleClick}>\n <Icon\n icons={['fa-light fa-clipboard']}\n color={theme === CodeHighlighterTheme.Dark ? '#e5e5e5' : '#999999'}\n />\n {copyButtonText && (\n <StyledCopyToClipboardText codeTheme={theme}>\n {copyButtonText}\n </StyledCopyToClipboardText>\n )}\n </StyledCopyToClipboard>\n </Popup>\n );\n};\n\nCopyToClipboard.displayName = 'CopyToClipboard';\n\nexport default CopyToClipboard;\n"],"mappings":";;;;;;AAAA,IAA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M,GACvCF,cACsB,CAEZ,CACpB,CAAC;AAEhB,CAAC;AAEDF,eAAe,CAACuB,WAAW,GAAG,iBAAiB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA1B,OAAA,GAEjCC,eAAe"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CodeHighlighterTheme } from '../../../types/codeHighlighter';
|
|
3
|
+
import type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';
|
|
4
|
+
export declare const StyledCopyToClipboard: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
|
|
5
|
+
type StyledCopyToClipboardTextProps = WithTheme<{
|
|
6
|
+
codeTheme: CodeHighlighterTheme;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const StyledCopyToClipboardText: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, StyledCopyToClipboardTextProps>>;
|
|
9
|
+
export {};
|