@chayns-components/core 5.0.0-beta.26 → 5.0.0-beta.262
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 +27 -2
- package/lib/components/accordion/Accordion.js +74 -83
- package/lib/components/accordion/Accordion.js.map +1 -1
- package/lib/components/accordion/Accordion.styles.d.ts +3 -2
- package/lib/components/accordion/Accordion.styles.js +95 -26
- package/lib/components/accordion/Accordion.styles.js.map +1 -1
- package/lib/components/accordion/accordion-body/AccordionBody.d.ts +17 -2
- package/lib/components/accordion/accordion-body/AccordionBody.js +22 -13
- package/lib/components/accordion/accordion-body/AccordionBody.js.map +1 -1
- package/lib/components/accordion/accordion-body/AccordionBody.styles.d.ts +4 -1
- package/lib/components/accordion/accordion-body/AccordionBody.styles.js +15 -10
- package/lib/components/accordion/accordion-body/AccordionBody.styles.js.map +1 -1
- package/lib/components/accordion/accordion-content/AccordionContent.d.ts +16 -2
- package/lib/components/accordion/accordion-content/AccordionContent.js +13 -11
- package/lib/components/accordion/accordion-content/AccordionContent.js.map +1 -1
- package/lib/components/accordion/accordion-content/AccordionContent.styles.d.ts +2 -1
- package/lib/components/accordion/accordion-content/AccordionContent.styles.js +24 -14
- package/lib/components/accordion/accordion-content/AccordionContent.styles.js.map +1 -1
- package/lib/components/accordion/accordion-group/AccordionGroup.d.ts +4 -3
- package/lib/components/accordion/accordion-group/AccordionGroup.js +23 -48
- package/lib/components/accordion/accordion-group/AccordionGroup.js.map +1 -1
- package/lib/components/accordion/accordion-head/AccordionHead.d.ts +1 -1
- package/lib/components/accordion/accordion-head/AccordionHead.js +25 -53
- package/lib/components/accordion/accordion-head/AccordionHead.js.map +1 -1
- package/lib/components/accordion/accordion-head/AccordionHead.styles.js +136 -49
- package/lib/components/accordion/accordion-head/AccordionHead.styles.js.map +1 -1
- package/lib/components/accordion/accordion-intro/AccordionIntro.d.ts +8 -2
- package/lib/components/accordion/accordion-intro/AccordionIntro.js +4 -7
- package/lib/components/accordion/accordion-intro/AccordionIntro.js.map +1 -1
- package/lib/components/accordion/accordion-intro/AccordionIntro.styles.js +3 -9
- package/lib/components/accordion/accordion-intro/AccordionIntro.styles.js.map +1 -1
- package/lib/components/accordion/accordion-item/AccordionItem.d.ts +9 -0
- package/lib/components/accordion/accordion-item/AccordionItem.js +28 -0
- package/lib/components/accordion/accordion-item/AccordionItem.js.map +1 -0
- package/lib/components/accordion/accordion-item/AccordionItem.styles.d.ts +5 -0
- package/lib/components/accordion/accordion-item/AccordionItem.styles.js +34 -0
- package/lib/components/accordion/accordion-item/AccordionItem.styles.js.map +1 -0
- package/lib/components/accordion/utils.js +10 -12
- package/lib/components/accordion/utils.js.map +1 -1
- package/lib/components/amount-control/AmountControl.d.ts +22 -0
- package/lib/components/amount-control/AmountControl.js +186 -0
- package/lib/components/amount-control/AmountControl.js.map +1 -0
- package/lib/components/amount-control/AmountControl.styles.d.ts +14 -0
- package/lib/components/amount-control/AmountControl.styles.js +61 -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 +12 -12
- package/lib/components/badge/Badge.js.map +1 -1
- package/lib/components/badge/Badge.styles.d.ts +4 -1
- package/lib/components/badge/Badge.styles.js +22 -15
- package/lib/components/badge/Badge.styles.js.map +1 -1
- package/lib/components/button/Button.d.ts +6 -2
- package/lib/components/button/Button.js +65 -22
- package/lib/components/button/Button.js.map +1 -1
- package/lib/components/button/Button.styles.d.ts +2 -0
- package/lib/components/button/Button.styles.js +57 -24
- package/lib/components/button/Button.styles.js.map +1 -1
- package/lib/components/checkbox/Checkbox.d.ts +25 -0
- package/lib/components/checkbox/Checkbox.js +44 -0
- package/lib/components/checkbox/Checkbox.js.map +1 -0
- package/lib/components/checkbox/Checkbox.styles.d.ts +6 -0
- package/lib/components/checkbox/Checkbox.styles.js +131 -0
- package/lib/components/checkbox/Checkbox.styles.js.map +1 -0
- package/lib/components/color-scheme-provider/ColorSchemeProvider.d.ts +2 -2
- package/lib/components/color-scheme-provider/ColorSchemeProvider.js +44 -78
- 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 +25 -0
- package/lib/components/combobox/ComboBox.js +144 -0
- package/lib/components/combobox/ComboBox.js.map +1 -0
- package/lib/components/combobox/ComboBox.styles.d.ts +17 -0
- package/lib/components/combobox/ComboBox.styles.js +128 -0
- package/lib/components/combobox/ComboBox.styles.js.map +1 -0
- package/lib/components/combobox/combobox-item/ComboBoxItem.d.ts +18 -0
- package/lib/components/combobox/combobox-item/ComboBoxItem.js +30 -0
- package/lib/components/combobox/combobox-item/ComboBoxItem.js.map +1 -0
- package/lib/components/combobox/combobox-item/ComboBoxItem.styles.d.ts +6 -0
- package/lib/components/combobox/combobox-item/ComboBoxItem.styles.js +30 -0
- package/lib/components/combobox/combobox-item/ComboBoxItem.styles.js.map +1 -0
- package/lib/components/content-card/ContentCard.d.ts +9 -0
- package/lib/components/content-card/ContentCard.js +19 -0
- package/lib/components/content-card/ContentCard.js.map +1 -0
- package/lib/components/content-card/ContentCard.styles.d.ts +1 -0
- package/lib/components/content-card/ContentCard.styles.js +23 -0
- package/lib/components/content-card/ContentCard.styles.js.map +1 -0
- package/lib/components/context-menu/ContextMenu.d.ts +5 -5
- package/lib/components/context-menu/ContextMenu.js +96 -156
- package/lib/components/context-menu/ContextMenu.js.map +1 -1
- package/lib/components/context-menu/ContextMenu.styles.js +3 -9
- package/lib/components/context-menu/ContextMenu.styles.js.map +1 -1
- package/lib/components/context-menu/constants/alignment.js +4 -5
- package/lib/components/context-menu/constants/alignment.js.map +1 -1
- package/lib/components/context-menu/context-menu-content/ContextMenuContent.d.ts +1 -1
- package/lib/components/context-menu/context-menu-content/ContextMenuContent.js +32 -28
- package/lib/components/context-menu/context-menu-content/ContextMenuContent.js.map +1 -1
- package/lib/components/context-menu/context-menu-content/ContextMenuContent.styles.js +92 -41
- package/lib/components/context-menu/context-menu-content/ContextMenuContent.styles.js.map +1 -1
- package/lib/components/date-info/DateInfo.d.ts +40 -0
- package/lib/components/date-info/DateInfo.js +109 -0
- package/lib/components/date-info/DateInfo.js.map +1 -0
- package/lib/components/date-info/utils/format.d.ts +43 -0
- package/lib/components/date-info/utils/format.js +288 -0
- package/lib/components/date-info/utils/format.js.map +1 -0
- package/lib/components/date-info/utils/language.d.ts +1 -0
- package/lib/components/date-info/utils/language.js +34 -0
- package/lib/components/date-info/utils/language.js.map +1 -0
- package/lib/components/filter-button/FilterButton.d.ts +22 -0
- package/lib/components/filter-button/FilterButton.js +89 -0
- package/lib/components/filter-button/FilterButton.js.map +1 -0
- package/lib/components/filter-button/FilterButton.styles.d.ts +1 -0
- package/lib/components/filter-button/FilterButton.styles.js +15 -0
- package/lib/components/filter-button/FilterButton.styles.js.map +1 -0
- package/lib/components/filter-button/filter-button-item/FilterButtonItem.d.ts +14 -0
- package/lib/components/filter-button/filter-button-item/FilterButtonItem.js +48 -0
- package/lib/components/filter-button/filter-button-item/FilterButtonItem.js.map +1 -0
- package/lib/components/filter-button/filter-button-item/FilterButtonItem.styles.d.ts +26 -0
- package/lib/components/filter-button/filter-button-item/FilterButtonItem.styles.js +109 -0
- package/lib/components/filter-button/filter-button-item/FilterButtonItem.styles.js.map +1 -0
- package/lib/components/filter-button/types.d.ts +15 -0
- package/lib/components/filter-button/types.js +19 -0
- package/lib/components/filter-button/types.js.map +1 -0
- package/lib/components/grid-image/GridImage.d.ts +1 -1
- package/lib/components/grid-image/GridImage.js +15 -52
- package/lib/components/grid-image/GridImage.js.map +1 -1
- package/lib/components/grid-image/GridImage.styles.d.ts +3 -3
- package/lib/components/grid-image/GridImage.styles.js +82 -38
- package/lib/components/grid-image/GridImage.styles.js.map +1 -1
- package/lib/components/icon/Icon.d.ts +2 -2
- package/lib/components/icon/Icon.js +22 -34
- package/lib/components/icon/Icon.js.map +1 -1
- package/lib/components/icon/Icon.styles.d.ts +1 -1
- package/lib/components/icon/Icon.styles.js +61 -39
- package/lib/components/icon/Icon.styles.js.map +1 -1
- package/lib/components/icon/utils.js +2 -5
- package/lib/components/icon/utils.js.map +1 -1
- package/lib/components/input/Input.d.ts +56 -0
- package/lib/components/input/Input.js +112 -0
- package/lib/components/input/Input.js.map +1 -0
- package/lib/components/input/Input.styles.d.ts +9 -0
- package/lib/components/input/Input.styles.js +96 -0
- package/lib/components/input/Input.styles.js.map +1 -0
- package/lib/components/list/List.d.ts +1 -1
- package/lib/components/list/List.js +26 -63
- package/lib/components/list/List.js.map +1 -1
- package/lib/components/list/list-item/ListItem.d.ts +10 -1
- package/lib/components/list/list-item/ListItem.js +37 -47
- package/lib/components/list/list-item/ListItem.js.map +1 -1
- package/lib/components/list/list-item/ListItem.styles.js +44 -26
- package/lib/components/list/list-item/ListItem.styles.js.map +1 -1
- package/lib/components/list/list-item/list-item-body/ListItemBody.d.ts +4 -1
- package/lib/components/list/list-item/list-item-body/ListItemBody.js +31 -12
- package/lib/components/list/list-item/list-item-body/ListItemBody.js.map +1 -1
- package/lib/components/list/list-item/list-item-body/ListItemBody.styles.js +3 -9
- package/lib/components/list/list-item/list-item-body/ListItemBody.styles.js.map +1 -1
- package/lib/components/list/list-item/list-item-content/ListItemContent.js +4 -7
- package/lib/components/list/list-item/list-item-content/ListItemContent.js.map +1 -1
- package/lib/components/list/list-item/list-item-content/ListItemContent.styles.js +8 -11
- package/lib/components/list/list-item/list-item-content/ListItemContent.styles.js.map +1 -1
- package/lib/components/list/list-item/list-item-head/ListItemHead.d.ts +2 -1
- package/lib/components/list/list-item/list-item-head/ListItemHead.js +37 -88
- package/lib/components/list/list-item/list-item-head/ListItemHead.js.map +1 -1
- package/lib/components/list/list-item/list-item-head/ListItemHead.styles.d.ts +1 -11
- package/lib/components/list/list-item/list-item-head/ListItemHead.styles.js +88 -81
- package/lib/components/list/list-item/list-item-head/ListItemHead.styles.js.map +1 -1
- 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 +23 -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 +1 -0
- package/lib/components/list/list-item/list-item-head/list-item-icon/ListItemIcon.styles.js +32 -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 +44 -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 +10 -0
- package/lib/components/list/list-item/list-item-head/list-item-image/ListItemImage.styles.js +52 -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 +141 -0
- package/lib/components/mention-finder/MentionFinder.js.map +1 -0
- package/lib/components/mention-finder/MentionFinder.styles.d.ts +5 -0
- package/lib/components/mention-finder/MentionFinder.styles.js +94 -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 +13 -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 +32 -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 +8 -0
- package/lib/components/mention-finder/mention-finder-item/MentionFinderItem.styles.js +100 -0
- package/lib/components/mention-finder/mention-finder-item/MentionFinderItem.styles.js.map +1 -0
- package/lib/components/number-input/NumberInput.d.ts +34 -0
- package/lib/components/number-input/NumberInput.js +113 -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 +15 -0
- package/lib/components/number-input/constants/number.js.map +1 -0
- package/lib/components/number-input/utils/number.d.ts +11 -0
- package/lib/components/number-input/utils/number.js +35 -0
- package/lib/components/number-input/utils/number.js.map +1 -0
- package/lib/components/popup/Popup.d.ts +26 -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 +4 -0
- package/lib/components/popup/Popup.styles.js +27 -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 +64 -0
- package/lib/components/popup/popup-content/PopupContent.js.map +1 -0
- package/lib/components/popup/popup-content/PopupContent.styles.d.ts +6 -0
- package/lib/components/popup/popup-content/PopupContent.styles.js +90 -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 +17 -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 +39 -0
- package/lib/components/progress-bar/ProgressBar.js.map +1 -0
- package/lib/components/progress-bar/ProgressBar.styles.d.ts +7 -0
- package/lib/components/progress-bar/ProgressBar.styles.js +39 -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 +86 -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 +100 -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 +48 -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 +6 -0
- package/lib/components/radio-button/types.js.map +1 -0
- package/lib/components/scroll-view/ScrollView.d.ts +9 -0
- package/lib/components/scroll-view/ScrollView.js +23 -0
- package/lib/components/scroll-view/ScrollView.js.map +1 -0
- package/lib/components/scroll-view/ScrollView.styles.d.ts +6 -0
- package/lib/components/scroll-view/ScrollView.styles.js +27 -0
- package/lib/components/scroll-view/ScrollView.styles.js.map +1 -0
- package/lib/components/search-box/SearchBox.d.ts +26 -0
- package/lib/components/search-box/SearchBox.js +166 -0
- package/lib/components/search-box/SearchBox.js.map +1 -0
- package/lib/components/search-box/SearchBox.styles.d.ts +7 -0
- package/lib/components/search-box/SearchBox.styles.js +58 -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 +6 -0
- package/lib/components/search-box/search-box-item/SearchBoxItem.styles.js +30 -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 +6 -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 +25 -0
- package/lib/components/search-input/SearchInput.js +96 -0
- package/lib/components/search-input/SearchInput.js.map +1 -0
- package/lib/components/search-input/SearchInput.styles.d.ts +4 -0
- package/lib/components/search-input/SearchInput.styles.js +30 -0
- package/lib/components/search-input/SearchInput.styles.js.map +1 -0
- package/lib/components/sharing-bar/SharingBar.d.ts +18 -0
- package/lib/components/sharing-bar/SharingBar.js +114 -0
- package/lib/components/sharing-bar/SharingBar.js.map +1 -0
- package/lib/components/sharing-bar/SharingBar.styles.d.ts +5 -0
- package/lib/components/sharing-bar/SharingBar.styles.js +27 -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 +52 -0
- package/lib/components/slider/Slider.js.map +1 -0
- package/lib/components/slider/Slider.styles.d.ts +8 -0
- package/lib/components/slider/Slider.styles.js +77 -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 +45 -0
- package/lib/components/small-wait-cursor/SmallWaitCursor.js.map +1 -0
- package/lib/components/small-wait-cursor/SmallWaitCursor.styles.d.ts +18 -0
- package/lib/components/small-wait-cursor/SmallWaitCursor.styles.js +105 -0
- package/lib/components/small-wait-cursor/SmallWaitCursor.styles.js.map +1 -0
- package/lib/components/text-area/TextArea.d.ts +25 -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 +8 -0
- package/lib/components/text-area/TextArea.styles.js +46 -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 +33 -0
- package/lib/components/tooltip/Tooltip.js.map +1 -0
- package/lib/components/tooltip/Tooltip.styles.d.ts +1 -0
- package/lib/components/tooltip/Tooltip.styles.js +11 -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 +6 -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 +21 -0
- package/lib/components/tooltip/tooltip-item/TooltipItem.js.map +1 -0
- package/lib/components/tooltip/tooltip-item/TooltipItem.styles.d.ts +7 -0
- package/lib/components/tooltip/tooltip-item/TooltipItem.styles.js +32 -0
- package/lib/components/tooltip/tooltip-item/TooltipItem.styles.js.map +1 -0
- package/lib/hooks/uuid.js +2 -21
- package/lib/hooks/uuid.js.map +1 -1
- package/lib/index.d.ts +33 -0
- package/lib/index.js +215 -27
- package/lib/index.js.map +1 -1
- package/lib/types/chayns.d.ts +56 -0
- package/lib/types/chayns.js +4 -5
- package/lib/types/chayns.js.map +1 -1
- package/lib/types/file.d.ts +42 -0
- package/lib/types/file.js +6 -0
- package/lib/types/file.js.map +1 -0
- package/lib/utils/calculate.d.ts +2 -0
- package/lib/utils/calculate.js +40 -0
- package/lib/utils/calculate.js.map +1 -0
- package/lib/utils/fileDialog.d.ts +7 -0
- package/lib/utils/fileDialog.js +74 -0
- package/lib/utils/fileDialog.js.map +1 -0
- package/lib/utils/isTobitEmployee.d.ts +1 -0
- package/lib/utils/isTobitEmployee.js +29 -0
- package/lib/utils/isTobitEmployee.js.map +1 -0
- package/lib/utils/uploadFile.d.ts +9 -0
- package/lib/utils/uploadFile.js +48 -0
- package/lib/utils/uploadFile.js.map +1 -0
- package/package.json +23 -19
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
export type NumberInputProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Whether the user can add decimal places. Enables the user to input a zero as first number
|
|
5
|
+
*/
|
|
6
|
+
isDecimalInput?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Applies rules for money input.
|
|
9
|
+
* Rules: only two decimal places, one leading zero
|
|
10
|
+
*/
|
|
11
|
+
isMoneyInput?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Limits the number to this value
|
|
14
|
+
*/
|
|
15
|
+
maxNumber?: number;
|
|
16
|
+
/**
|
|
17
|
+
* The number that should be displayed formatted in the input field. NOTE: A zero as number is not allowed
|
|
18
|
+
*/
|
|
19
|
+
number: number | null;
|
|
20
|
+
/**
|
|
21
|
+
* The placeholder that should be in the input
|
|
22
|
+
*/
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Callback function that is called when the input gets out of focus
|
|
26
|
+
*/
|
|
27
|
+
onNumberChange: (newNumber: number | null) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Whether the input is disabled
|
|
30
|
+
*/
|
|
31
|
+
isDisabled?: boolean;
|
|
32
|
+
};
|
|
33
|
+
declare const NumberInput: FC<NumberInputProps>;
|
|
34
|
+
export default NumberInput;
|
|
@@ -0,0 +1,113 @@
|
|
|
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 _Input = _interopRequireDefault(require("../input/Input"));
|
|
9
|
+
var _number = require("./constants/number");
|
|
10
|
+
var _number2 = require("./utils/number");
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
+
const NumberInput = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
isDecimalInput,
|
|
17
|
+
isMoneyInput,
|
|
18
|
+
maxNumber = Infinity,
|
|
19
|
+
number,
|
|
20
|
+
placeholder,
|
|
21
|
+
onNumberChange,
|
|
22
|
+
isDisabled
|
|
23
|
+
} = _ref;
|
|
24
|
+
const [stringValue, setStringValue] = (0, _react.useState)('');
|
|
25
|
+
const handleChange = (0, _react.useCallback)(function () {
|
|
26
|
+
let newValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
27
|
+
if (typeof newValue !== 'number') {
|
|
28
|
+
setStringValue('');
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const parsedValue = (0, _number2.parseFloatAndRound)({
|
|
32
|
+
stringValue: newValue === null || newValue === void 0 ? void 0 : newValue.toString()
|
|
33
|
+
});
|
|
34
|
+
setStringValue((0, _number2.formateNumber)({
|
|
35
|
+
number: parsedValue,
|
|
36
|
+
isMoneyInput
|
|
37
|
+
}));
|
|
38
|
+
}, [isMoneyInput]);
|
|
39
|
+
const onChange = event => {
|
|
40
|
+
const newValue = event.target.value;
|
|
41
|
+
const sanitizedValue = newValue
|
|
42
|
+
// Removes everything except numbers and commas (decimals should be indicated with a comma)
|
|
43
|
+
.replace(_number.NUMBER_CLEAR_REGEX, '')
|
|
44
|
+
// Calculations need points for decimal indication
|
|
45
|
+
.replace(',', '.');
|
|
46
|
+
if (sanitizedValue.trim().length > 0) {
|
|
47
|
+
// Allows numbers, a comma and any number of decimal places
|
|
48
|
+
if (isDecimalInput && _number.DECIMAL_TEST.test(sanitizedValue)) {
|
|
49
|
+
const parsedNumber = (0, _number2.parseFloatAndRound)({
|
|
50
|
+
stringValue: sanitizedValue
|
|
51
|
+
});
|
|
52
|
+
if (parsedNumber > maxNumber) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
setStringValue(sanitizedValue.replace('.', ','));
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Allows numbers, a comma and 2 numbers of decimal places
|
|
60
|
+
if (isMoneyInput && _number.MONEY_TEST.test(sanitizedValue)) {
|
|
61
|
+
const parsedNumber = (0, _number2.parseFloatAndRound)({
|
|
62
|
+
stringValue: sanitizedValue,
|
|
63
|
+
decimals: 2
|
|
64
|
+
});
|
|
65
|
+
if (parsedNumber > maxNumber) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
setStringValue(sanitizedValue.replace('.', ','));
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Allows numbers but excludes numbers with leading 0
|
|
73
|
+
if (_number.INTEGER_TEST.test(sanitizedValue)) {
|
|
74
|
+
const parsedNumber = Number(sanitizedValue);
|
|
75
|
+
if (parsedNumber > maxNumber) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
setStringValue(sanitizedValue);
|
|
79
|
+
}
|
|
80
|
+
} else {
|
|
81
|
+
setStringValue('');
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const onBlur = () => {
|
|
85
|
+
const sanitizedValue = stringValue.length === 0 ? '0' : stringValue;
|
|
86
|
+
const parsedValue = (0, _number2.parseFloatAndRound)({
|
|
87
|
+
stringValue: sanitizedValue
|
|
88
|
+
});
|
|
89
|
+
setStringValue(stringValue.length === 0 ? '' : (0, _number2.formateNumber)({
|
|
90
|
+
number: parsedValue,
|
|
91
|
+
isMoneyInput
|
|
92
|
+
}));
|
|
93
|
+
onNumberChange(parsedValue === 0 ? null : parsedValue);
|
|
94
|
+
};
|
|
95
|
+
const onFocus = () => {
|
|
96
|
+
setStringValue(stringValue.replaceAll('.', ''));
|
|
97
|
+
};
|
|
98
|
+
(0, _react.useEffect)(() => {
|
|
99
|
+
handleChange(number);
|
|
100
|
+
}, [handleChange, number]);
|
|
101
|
+
return /*#__PURE__*/_react.default.createElement(_Input.default, {
|
|
102
|
+
onChange: onChange,
|
|
103
|
+
value: stringValue,
|
|
104
|
+
placeholder: placeholder,
|
|
105
|
+
onBlur: onBlur,
|
|
106
|
+
onFocus: onFocus,
|
|
107
|
+
isDisabled: isDisabled
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
NumberInput.displayName = 'NumberInput';
|
|
111
|
+
var _default = NumberInput;
|
|
112
|
+
exports.default = _default;
|
|
113
|
+
//# sourceMappingURL=NumberInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NumberInput.js","names":["_react","_interopRequireWildcard","require","_Input","_interopRequireDefault","_number","_number2","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","NumberInput","_ref","isDecimalInput","isMoneyInput","maxNumber","Infinity","number","placeholder","onNumberChange","isDisabled","stringValue","setStringValue","useState","handleChange","useCallback","newValue","arguments","length","undefined","parsedValue","parseFloatAndRound","toString","formateNumber","onChange","event","target","value","sanitizedValue","replace","NUMBER_CLEAR_REGEX","trim","DECIMAL_TEST","test","parsedNumber","MONEY_TEST","decimals","INTEGER_TEST","Number","onBlur","onFocus","replaceAll","useEffect","createElement","displayName","_default","exports"],"sources":["../../../src/components/number-input/NumberInput.tsx"],"sourcesContent":["import React, { ChangeEvent, FC, useCallback, useEffect, useState } from 'react';\nimport Input from '../input/Input';\nimport { DECIMAL_TEST, INTEGER_TEST, MONEY_TEST, NUMBER_CLEAR_REGEX } from './constants/number';\nimport { formateNumber, parseFloatAndRound } from './utils/number';\n\nexport type NumberInputProps = {\n /**\n * Whether the user can add decimal places. Enables the user to input a zero as first number\n */\n isDecimalInput?: boolean;\n /**\n * Applies rules for money input.\n * Rules: only two decimal places, one leading zero\n */\n isMoneyInput?: boolean;\n /**\n * Limits the number to this value\n */\n maxNumber?: number;\n /**\n * The number that should be displayed formatted in the input field. NOTE: A zero as number is not allowed\n */\n number: number | null;\n /**\n * The placeholder that should be in the input\n */\n placeholder?: string;\n /**\n * Callback function that is called when the input gets out of focus\n */\n onNumberChange: (newNumber: number | null) => void;\n /**\n * Whether the input is disabled\n */\n isDisabled?: boolean;\n};\n\nconst NumberInput: FC<NumberInputProps> = (\n {\n isDecimalInput,\n isMoneyInput,\n maxNumber = Infinity,\n number,\n placeholder,\n onNumberChange,\n isDisabled\n }) => {\n const [stringValue, setStringValue] = useState<string>('');\n\n const handleChange = useCallback((newValue: number | null = null) => {\n if (typeof newValue !== 'number') {\n setStringValue('');\n\n return;\n }\n\n const parsedValue = parseFloatAndRound({ stringValue: newValue?.toString() });\n\n setStringValue(formateNumber({ number: parsedValue, isMoneyInput }));\n }, [isMoneyInput]);\n\n const onChange = (event: ChangeEvent<HTMLInputElement>) => {\n const newValue = event.target.value;\n\n const sanitizedValue = newValue\n // Removes everything except numbers and commas (decimals should be indicated with a comma)\n .replace(NUMBER_CLEAR_REGEX, '')\n // Calculations need points for decimal indication\n .replace(',', '.');\n\n if (sanitizedValue.trim().length > 0) {\n\n // Allows numbers, a comma and any number of decimal places\n if (isDecimalInput && DECIMAL_TEST.test(sanitizedValue)) {\n const parsedNumber = parseFloatAndRound({ stringValue: sanitizedValue });\n\n if (parsedNumber > maxNumber) {\n return;\n }\n\n setStringValue(sanitizedValue.replace('.', ','));\n\n return;\n }\n\n // Allows numbers, a comma and 2 numbers of decimal places\n if (isMoneyInput && MONEY_TEST.test(sanitizedValue)) {\n const parsedNumber = parseFloatAndRound({\n stringValue: sanitizedValue,\n decimals: 2,\n });\n\n if (parsedNumber > maxNumber) {\n return;\n }\n\n setStringValue(sanitizedValue.replace('.', ','));\n\n return;\n }\n\n // Allows numbers but excludes numbers with leading 0\n if (INTEGER_TEST.test(sanitizedValue)) {\n const parsedNumber = Number(sanitizedValue);\n\n if (parsedNumber > maxNumber) {\n return;\n }\n\n setStringValue(sanitizedValue);\n }\n } else {\n setStringValue('');\n }\n };\n\n const onBlur = () => {\n const sanitizedValue = stringValue.length === 0 ? '0' : stringValue;\n const parsedValue = parseFloatAndRound({ stringValue: sanitizedValue });\n\n setStringValue(\n stringValue.length === 0\n ? ''\n : formateNumber({\n number: parsedValue,\n isMoneyInput\n })\n );\n\n onNumberChange(parsedValue === 0 ? null : parsedValue);\n };\n\n const onFocus = () => {\n setStringValue(stringValue.replaceAll('.', ''));\n };\n\n useEffect(() => {\n handleChange(number);\n }, [handleChange, number]);\n\n return (\n <Input\n onChange={onChange}\n value={stringValue}\n placeholder={placeholder}\n onBlur={onBlur}\n onFocus={onFocus}\n isDisabled={isDisabled}\n />\n );\n};\n\nNumberInput.displayName = 'NumberInput';\n\nexport default NumberInput;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAAmE,SAAAE,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA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BAAS,EAAC,MAAM;IACZ5B,YAAY,CAACP,MAAM,CAAC;EACxB,CAAC,EAAE,CAACO,YAAY,EAAEP,MAAM,CAAC,CAAC;EAE1B,oBACInC,MAAA,CAAAS,OAAA,CAAA8D,aAAA,CAACpE,MAAA,CAAAM,OAAK;IACF2C,QAAQ,EAAEA,QAAS;IACnBG,KAAK,EAAEhB,WAAY;IACnBH,WAAW,EAAEA,WAAY;IACzB+B,MAAM,EAAEA,MAAO;IACfC,OAAO,EAAEA,OAAQ;IACjB9B,UAAU,EAAEA;EAAW,CAC1B,CAAC;AAEV,CAAC;AAEDT,WAAW,CAAC2C,WAAW,GAAG,aAAa;AAAC,IAAAC,QAAA,GAEzB5C,WAAW;AAAA6C,OAAA,CAAAjE,OAAA,GAAAgE,QAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.NUMBER_CLEAR_REGEX = exports.MONEY_TEST = exports.INTEGER_TEST = exports.DECIMAL_TEST = void 0;
|
|
7
|
+
const NUMBER_CLEAR_REGEX = /[^\d,]/gi;
|
|
8
|
+
exports.NUMBER_CLEAR_REGEX = NUMBER_CLEAR_REGEX;
|
|
9
|
+
const INTEGER_TEST = /^[1-9][0-9]*$/;
|
|
10
|
+
exports.INTEGER_TEST = INTEGER_TEST;
|
|
11
|
+
const DECIMAL_TEST = /^(0|[1-9][0-9]*)?(\.[0-9]*)?$/;
|
|
12
|
+
exports.DECIMAL_TEST = DECIMAL_TEST;
|
|
13
|
+
const MONEY_TEST = /^(0|[1-9][0-9]*)?(\.[0-9]{0,2})?$/;
|
|
14
|
+
exports.MONEY_TEST = MONEY_TEST;
|
|
15
|
+
//# sourceMappingURL=number.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.js","names":["NUMBER_CLEAR_REGEX","exports","INTEGER_TEST","DECIMAL_TEST","MONEY_TEST"],"sources":["../../../../src/components/number-input/constants/number.ts"],"sourcesContent":["export const NUMBER_CLEAR_REGEX = /[^\\d,]/gi;\nexport const INTEGER_TEST = /^[1-9][0-9]*$/;\nexport const DECIMAL_TEST = /^(0|[1-9][0-9]*)?(\\.[0-9]*)?$/;\nexport const MONEY_TEST = /^(0|[1-9][0-9]*)?(\\.[0-9]{0,2})?$/;\n"],"mappings":";;;;;;AAAO,MAAMA,kBAAkB,GAAG,UAAU;AAACC,OAAA,CAAAD,kBAAA,GAAAA,kBAAA;AACtC,MAAME,YAAY,GAAG,eAAe;AAACD,OAAA,CAAAC,YAAA,GAAAA,YAAA;AACrC,MAAMC,YAAY,GAAG,+BAA+B;AAACF,OAAA,CAAAE,YAAA,GAAAA,YAAA;AACrD,MAAMC,UAAU,GAAG,mCAAmC;AAACH,OAAA,CAAAG,UAAA,GAAAA,UAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface ParseFloatAndRoundOptions {
|
|
2
|
+
stringValue: string;
|
|
3
|
+
decimals?: number;
|
|
4
|
+
}
|
|
5
|
+
export declare const parseFloatAndRound: ({ stringValue, decimals }: ParseFloatAndRoundOptions) => number;
|
|
6
|
+
interface FormateNumberOptions {
|
|
7
|
+
number: number | null;
|
|
8
|
+
isMoneyInput?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const formateNumber: ({ number, isMoneyInput }: FormateNumberOptions) => string;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.parseFloatAndRound = exports.formateNumber = void 0;
|
|
7
|
+
const parseFloatAndRound = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
stringValue,
|
|
10
|
+
decimals
|
|
11
|
+
} = _ref;
|
|
12
|
+
const parsed = parseFloat(stringValue.replace(',', '.'));
|
|
13
|
+
if (decimals) {
|
|
14
|
+
return parseFloat(parsed.toFixed(decimals));
|
|
15
|
+
}
|
|
16
|
+
return parsed;
|
|
17
|
+
};
|
|
18
|
+
exports.parseFloatAndRound = parseFloatAndRound;
|
|
19
|
+
const formateNumber = _ref2 => {
|
|
20
|
+
let {
|
|
21
|
+
number,
|
|
22
|
+
isMoneyInput
|
|
23
|
+
} = _ref2;
|
|
24
|
+
if (typeof number !== 'number') {
|
|
25
|
+
return '';
|
|
26
|
+
}
|
|
27
|
+
return number.toLocaleString('de-DE', {
|
|
28
|
+
useGrouping: true,
|
|
29
|
+
minimumFractionDigits: isMoneyInput ? 2 : undefined,
|
|
30
|
+
maximumFractionDigits: isMoneyInput ? 2 : undefined,
|
|
31
|
+
maximumSignificantDigits: !isMoneyInput ? 20 : undefined
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
exports.formateNumber = formateNumber;
|
|
35
|
+
//# sourceMappingURL=number.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.js","names":["parseFloatAndRound","_ref","stringValue","decimals","parsed","parseFloat","replace","toFixed","exports","formateNumber","_ref2","number","isMoneyInput","toLocaleString","useGrouping","minimumFractionDigits","undefined","maximumFractionDigits","maximumSignificantDigits"],"sources":["../../../../src/components/number-input/utils/number.ts"],"sourcesContent":["interface ParseFloatAndRoundOptions {\n stringValue: string;\n decimals?: number;\n}\n\nexport const parseFloatAndRound = ({ stringValue, decimals }: ParseFloatAndRoundOptions) => {\n const parsed = parseFloat(stringValue.replace(',', '.'));\n\n if (decimals) {\n return parseFloat(parsed.toFixed(decimals));\n }\n\n return parsed;\n};\n\ninterface FormateNumberOptions {\n number: number | null;\n isMoneyInput?: boolean;\n}\n\nexport const formateNumber = ({ number, isMoneyInput }: FormateNumberOptions) => {\n if (typeof number !== 'number') {\n return '';\n }\n\n return number.toLocaleString('de-DE', {\n useGrouping: true,\n minimumFractionDigits: isMoneyInput ? 2 : undefined,\n maximumFractionDigits: isMoneyInput ? 2 : undefined,\n maximumSignificantDigits: !isMoneyInput ? 20 : undefined,\n });\n};\n"],"mappings":";;;;;;AAKO,MAAMA,kBAAkB,GAAGC,IAAA,IAA0D;EAAA,IAAzD;IAAEC,WAAW;IAAEC;EAAoC,CAAC,GAAAF,IAAA;EACnF,MAAMG,MAAM,GAAGC,UAAU,CAACH,WAAW,CAACI,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;EAExD,IAAIH,QAAQ,EAAE;IACV,OAAOE,UAAU,CAACD,MAAM,CAACG,OAAO,CAACJ,QAAQ,CAAC,CAAC;EAC/C;EAEA,OAAOC,MAAM;AACjB,CAAC;AAACI,OAAA,CAAAR,kBAAA,GAAAA,kBAAA;AAOK,MAAMS,aAAa,GAAGC,KAAA,IAAoD;EAAA,IAAnD;IAAEC,MAAM;IAAEC;EAAmC,CAAC,GAAAF,KAAA;EACxE,IAAI,OAAOC,MAAM,KAAK,QAAQ,EAAE;IAC5B,OAAO,EAAE;EACb;EAEA,OAAOA,MAAM,CAACE,cAAc,CAAC,OAAO,EAAE;IAClCC,WAAW,EAAE,IAAI;IACjBC,qBAAqB,EAAEH,YAAY,GAAG,CAAC,GAAGI,SAAS;IACnDC,qBAAqB,EAAEL,YAAY,GAAG,CAAC,GAAGI,SAAS;IACnDE,wBAAwB,EAAE,CAACN,YAAY,GAAG,EAAE,GAAGI;EACnD,CAAC,CAAC;AACN,CAAC;AAACR,OAAA,CAAAC,aAAA,GAAAA,aAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { PopupRef } from './types';
|
|
3
|
+
export type PopupProps = {
|
|
4
|
+
/**
|
|
5
|
+
* The element over which the content of the `ContextMenu` should be displayed.
|
|
6
|
+
*/
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* The content that should be displayed inside the popup.
|
|
10
|
+
*/
|
|
11
|
+
content: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Function to be executed when the content of the Context menu has been hidden.
|
|
14
|
+
*/
|
|
15
|
+
onHide?: VoidFunction;
|
|
16
|
+
/**
|
|
17
|
+
* Function to be executed when the content of the Context menu has been shown.
|
|
18
|
+
*/
|
|
19
|
+
onShow?: VoidFunction;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the popup should be opened on hover. If not, the popup will be opened on click.
|
|
22
|
+
*/
|
|
23
|
+
shouldShowOnHover?: boolean;
|
|
24
|
+
};
|
|
25
|
+
declare const Popup: React.ForwardRefExoticComponent<PopupProps & React.RefAttributes<PopupRef>>;
|
|
26
|
+
export default Popup;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _framerMotion = require("framer-motion");
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _reactDom = require("react-dom");
|
|
10
|
+
var _uuid = require("../../hooks/uuid");
|
|
11
|
+
var _PopupContent = _interopRequireDefault(require("./popup-content/PopupContent"));
|
|
12
|
+
var _Popup = require("./Popup.styles");
|
|
13
|
+
var _types = require("./types");
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
+
const Popup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
18
|
+
let {
|
|
19
|
+
content,
|
|
20
|
+
onShow,
|
|
21
|
+
onHide,
|
|
22
|
+
children,
|
|
23
|
+
shouldShowOnHover = false
|
|
24
|
+
} = _ref;
|
|
25
|
+
const [coordinates, setCoordinates] = (0, _react.useState)({
|
|
26
|
+
x: 0,
|
|
27
|
+
y: 0
|
|
28
|
+
});
|
|
29
|
+
const container = document.querySelector('.tapp') || document.body;
|
|
30
|
+
const [alignment, setAlignment] = (0, _react.useState)(_types.PopupAlignment.TopLeft);
|
|
31
|
+
const [isOpen, setIsOpen] = (0, _react.useState)(false);
|
|
32
|
+
const [portal, setPortal] = (0, _react.useState)();
|
|
33
|
+
const [menuHeight, setMenuHeight] = (0, _react.useState)(0);
|
|
34
|
+
const uuid = (0, _uuid.useUuid)();
|
|
35
|
+
|
|
36
|
+
// ToDo: Replace with hook if new chayns api is ready
|
|
37
|
+
const popupContentRef = (0, _react.useRef)(null);
|
|
38
|
+
const popupPseudoContentRef = (0, _react.useRef)(null);
|
|
39
|
+
const popupRef = (0, _react.useRef)(null);
|
|
40
|
+
const handleShow = (0, _react.useCallback)(() => {
|
|
41
|
+
if (popupRef.current && popupPseudoContentRef.current) {
|
|
42
|
+
const {
|
|
43
|
+
height: pseudoHeight,
|
|
44
|
+
width: pseudoWidth
|
|
45
|
+
} = popupPseudoContentRef.current.getBoundingClientRect();
|
|
46
|
+
const {
|
|
47
|
+
height: childrenHeight,
|
|
48
|
+
left: childrenLeft,
|
|
49
|
+
top: childrenTop,
|
|
50
|
+
width: childrenWidth
|
|
51
|
+
} = popupRef.current.getBoundingClientRect();
|
|
52
|
+
if (pseudoHeight > childrenTop - 25) {
|
|
53
|
+
if (pseudoWidth > childrenLeft + childrenWidth / 2 - 25) {
|
|
54
|
+
setAlignment(_types.PopupAlignment.BottomRight);
|
|
55
|
+
} else {
|
|
56
|
+
setAlignment(_types.PopupAlignment.BottomLeft);
|
|
57
|
+
}
|
|
58
|
+
setCoordinates({
|
|
59
|
+
x: childrenLeft + childrenWidth / 2,
|
|
60
|
+
y: childrenTop + childrenHeight + 4
|
|
61
|
+
});
|
|
62
|
+
} else {
|
|
63
|
+
if (pseudoWidth > childrenLeft + childrenWidth / 2 - 25) {
|
|
64
|
+
setAlignment(_types.PopupAlignment.TopRight);
|
|
65
|
+
} else {
|
|
66
|
+
setAlignment(_types.PopupAlignment.TopLeft);
|
|
67
|
+
}
|
|
68
|
+
setCoordinates({
|
|
69
|
+
x: childrenLeft + childrenWidth / 2,
|
|
70
|
+
y: childrenTop - 4
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
setIsOpen(true);
|
|
74
|
+
}
|
|
75
|
+
}, []);
|
|
76
|
+
const handleChildrenClick = () => {
|
|
77
|
+
if (!shouldShowOnHover) {
|
|
78
|
+
handleShow();
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const handleHide = (0, _react.useCallback)(() => {
|
|
82
|
+
setIsOpen(false);
|
|
83
|
+
}, []);
|
|
84
|
+
const handleMouseEnter = () => {
|
|
85
|
+
if (shouldShowOnHover) {
|
|
86
|
+
handleShow();
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
const handleMouseLeave = () => {
|
|
90
|
+
if (shouldShowOnHover) {
|
|
91
|
+
handleHide();
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
const handleDocumentClick = (0, _react.useCallback)(event => {
|
|
95
|
+
var _popupContentRef$curr;
|
|
96
|
+
if (!((_popupContentRef$curr = popupContentRef.current) !== null && _popupContentRef$curr !== void 0 && _popupContentRef$curr.contains(event.target))) {
|
|
97
|
+
event.preventDefault();
|
|
98
|
+
event.stopPropagation();
|
|
99
|
+
if (!shouldShowOnHover) {
|
|
100
|
+
handleHide();
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}, [handleHide, shouldShowOnHover]);
|
|
104
|
+
(0, _react.useImperativeHandle)(ref, () => ({
|
|
105
|
+
hide: handleHide,
|
|
106
|
+
show: handleShow
|
|
107
|
+
}), [handleHide, handleShow]);
|
|
108
|
+
(0, _react.useEffect)(() => {
|
|
109
|
+
void chayns.getWindowMetrics().then(result => {
|
|
110
|
+
if (result.menuHeight) {
|
|
111
|
+
setMenuHeight(result.menuHeight);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}, []);
|
|
115
|
+
(0, _react.useEffect)(() => {
|
|
116
|
+
if (isOpen) {
|
|
117
|
+
document.addEventListener('click', handleDocumentClick, true);
|
|
118
|
+
window.addEventListener('blur', handleHide);
|
|
119
|
+
if (typeof onShow === 'function') {
|
|
120
|
+
onShow();
|
|
121
|
+
}
|
|
122
|
+
} else if (typeof onHide === 'function') {
|
|
123
|
+
onHide();
|
|
124
|
+
}
|
|
125
|
+
return () => {
|
|
126
|
+
document.removeEventListener('click', handleDocumentClick, true);
|
|
127
|
+
window.removeEventListener('blur', handleHide);
|
|
128
|
+
};
|
|
129
|
+
}, [handleDocumentClick, handleHide, isOpen, onHide, onShow]);
|
|
130
|
+
(0, _react.useEffect)(() => {
|
|
131
|
+
setPortal(() => /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/_react.default.createElement(_framerMotion.AnimatePresence, {
|
|
132
|
+
initial: false
|
|
133
|
+
}, isOpen && /*#__PURE__*/_react.default.createElement(_PopupContent.default, {
|
|
134
|
+
coordinates: coordinates,
|
|
135
|
+
content: content,
|
|
136
|
+
key: `tooltip_${uuid}`,
|
|
137
|
+
alignment: alignment,
|
|
138
|
+
ref: popupContentRef
|
|
139
|
+
})), container));
|
|
140
|
+
}, [alignment, container, content, coordinates, isOpen, uuid]);
|
|
141
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Popup.StyledPopupPseudo, {
|
|
142
|
+
ref: popupPseudoContentRef,
|
|
143
|
+
menuHeight: menuHeight
|
|
144
|
+
}, content), /*#__PURE__*/_react.default.createElement(_Popup.StyledPopup, {
|
|
145
|
+
ref: popupRef,
|
|
146
|
+
onClick: handleChildrenClick,
|
|
147
|
+
onMouseLeave: handleMouseLeave,
|
|
148
|
+
onMouseEnter: handleMouseEnter
|
|
149
|
+
}, children), portal);
|
|
150
|
+
});
|
|
151
|
+
Popup.displayName = 'Popup';
|
|
152
|
+
var _default = Popup;
|
|
153
|
+
exports.default = _default;
|
|
154
|
+
//# sourceMappingURL=Popup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Popup.js","names":["_framerMotion","require","_react","_interopRequireWildcard","_reactDom","_uuid","_PopupContent","_interopRequireDefault","_Popup","_types","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","Popup","forwardRef","_ref","ref","content","onShow","onHide","children","shouldShowOnHover","coordinates","setCoordinates","useState","x","y","container","document","querySelector","body","alignment","setAlignment","PopupAlignment","TopLeft","isOpen","setIsOpen","portal","setPortal","menuHeight","setMenuHeight","uuid","useUuid","popupContentRef","useRef","popupPseudoContentRef","popupRef","handleShow","useCallback","current","height","pseudoHeight","width","pseudoWidth","getBoundingClientRect","childrenHeight","left","childrenLeft","top","childrenTop","childrenWidth","BottomRight","BottomLeft","TopRight","handleChildrenClick","handleHide","handleMouseEnter","handleMouseLeave","handleDocumentClick","event","_popupContentRef$curr","contains","target","preventDefault","stopPropagation","useImperativeHandle","hide","show","useEffect","chayns","getWindowMetrics","then","result","addEventListener","window","removeEventListener","createPortal","createElement","AnimatePresence","initial","Fragment","StyledPopupPseudo","StyledPopup","onClick","onMouseLeave","onMouseEnter","displayName","_default","exports"],"sources":["../../../src/components/popup/Popup.tsx"],"sourcesContent":["import { AnimatePresence } from 'framer-motion';\nimport React, {\n forwardRef,\n ReactNode,\n ReactPortal,\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { useUuid } from '../../hooks/uuid';\nimport PopupContent from './popup-content/PopupContent';\nimport { StyledPopup, StyledPopupPseudo } from './Popup.styles';\nimport { PopupAlignment, PopupCoordinates, PopupRef } from './types';\n\nexport type PopupProps = {\n /**\n * The element over which the content of the `ContextMenu` should be displayed.\n */\n children?: ReactNode;\n /**\n * The content that should be displayed inside the popup.\n */\n content: ReactNode;\n /**\n * Function to be executed when the content of the Context menu has been hidden.\n */\n onHide?: VoidFunction;\n /**\n * Function to be executed when the content of the Context menu has been shown.\n */\n onShow?: VoidFunction;\n /**\n * Whether the popup should be opened on hover. If not, the popup will be opened on click.\n */\n shouldShowOnHover?: boolean;\n};\n\nconst Popup = forwardRef<PopupRef, PopupProps>(\n ({ content, onShow, onHide, children, shouldShowOnHover = false }, ref) => {\n const [coordinates, setCoordinates] = useState<PopupCoordinates>({\n x: 0,\n y: 0,\n });\n const container = document.querySelector('.tapp') || document.body;\n\n const [alignment, setAlignment] = useState<PopupAlignment>(PopupAlignment.TopLeft);\n const [isOpen, setIsOpen] = useState(false);\n const [portal, setPortal] = useState<ReactPortal>();\n const [menuHeight, setMenuHeight] = useState(0);\n\n const uuid = useUuid();\n\n // ToDo: Replace with hook if new chayns api is ready\n const popupContentRef = useRef<HTMLDivElement>(null);\n const popupPseudoContentRef = useRef<HTMLDivElement>(null);\n const popupRef = useRef<HTMLDivElement>(null);\n\n const handleShow = useCallback(() => {\n if (popupRef.current && popupPseudoContentRef.current) {\n const { height: pseudoHeight, width: pseudoWidth } =\n popupPseudoContentRef.current.getBoundingClientRect();\n\n const {\n height: childrenHeight,\n left: childrenLeft,\n top: childrenTop,\n width: childrenWidth,\n } = popupRef.current.getBoundingClientRect();\n\n if (pseudoHeight > childrenTop - 25) {\n if (pseudoWidth > childrenLeft + childrenWidth / 2 - 25) {\n setAlignment(PopupAlignment.BottomRight);\n } else {\n setAlignment(PopupAlignment.BottomLeft);\n }\n\n setCoordinates({\n x: childrenLeft + childrenWidth / 2,\n y: childrenTop + childrenHeight + 4,\n });\n } else {\n if (pseudoWidth > childrenLeft + childrenWidth / 2 - 25) {\n setAlignment(PopupAlignment.TopRight);\n } else {\n setAlignment(PopupAlignment.TopLeft);\n }\n\n setCoordinates({\n x: childrenLeft + childrenWidth / 2,\n y: childrenTop - 4,\n });\n }\n\n setIsOpen(true);\n }\n }, []);\n\n const handleChildrenClick = () => {\n if (!shouldShowOnHover) {\n handleShow();\n }\n };\n\n const handleHide = useCallback(() => {\n setIsOpen(false);\n }, []);\n\n const handleMouseEnter = () => {\n if (shouldShowOnHover) {\n handleShow();\n }\n };\n\n const handleMouseLeave = () => {\n if (shouldShowOnHover) {\n handleHide();\n }\n };\n\n const handleDocumentClick = useCallback<EventListener>(\n (event) => {\n if (!popupContentRef.current?.contains(event.target as Node)) {\n event.preventDefault();\n event.stopPropagation();\n\n if (!shouldShowOnHover) {\n handleHide();\n }\n }\n },\n [handleHide, shouldShowOnHover]\n );\n\n useImperativeHandle(\n ref,\n () => ({\n hide: handleHide,\n show: handleShow,\n }),\n [handleHide, handleShow]\n );\n\n useEffect(() => {\n void chayns.getWindowMetrics().then((result) => {\n if (result.menuHeight) {\n setMenuHeight(result.menuHeight);\n }\n });\n }, []);\n\n useEffect(() => {\n if (isOpen) {\n document.addEventListener('click', handleDocumentClick, true);\n window.addEventListener('blur', handleHide);\n\n if (typeof onShow === 'function') {\n onShow();\n }\n } else if (typeof onHide === 'function') {\n onHide();\n }\n\n return () => {\n document.removeEventListener('click', handleDocumentClick, true);\n window.removeEventListener('blur', handleHide);\n };\n }, [handleDocumentClick, handleHide, isOpen, onHide, onShow]);\n\n useEffect(() => {\n setPortal(() =>\n createPortal(\n <AnimatePresence initial={false}>\n {isOpen && (\n <PopupContent\n coordinates={coordinates}\n content={content}\n key={`tooltip_${uuid}`}\n alignment={alignment}\n ref={popupContentRef}\n />\n )}\n </AnimatePresence>,\n container\n )\n );\n }, [alignment, container, content, coordinates, isOpen, uuid]);\n\n return (\n <>\n <StyledPopupPseudo ref={popupPseudoContentRef} menuHeight={menuHeight}>\n {content}\n </StyledPopupPseudo>\n <StyledPopup\n ref={popupRef}\n onClick={handleChildrenClick}\n onMouseLeave={handleMouseLeave}\n onMouseEnter={handleMouseEnter}\n >\n {children}\n </StyledPopup>\n {portal}\n </>\n );\n }\n);\n\nPopup.displayName = 'Popup';\n\nexport default Popup;\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AAUA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAAqE,SAAAM,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAX,wBAAAO,GAAA,EAAAI,WAAA,SAAAA,WAAA,IAAAJ,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,w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perty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledPopupPseudo = exports.StyledPopup = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
const StyledPopup = _styledComponents.default.span`
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
position: relative;
|
|
12
|
+
`;
|
|
13
|
+
exports.StyledPopup = StyledPopup;
|
|
14
|
+
const StyledPopupPseudo = _styledComponents.default.div`
|
|
15
|
+
top: ${_ref => {
|
|
16
|
+
let {
|
|
17
|
+
menuHeight
|
|
18
|
+
} = _ref;
|
|
19
|
+
return `${menuHeight - 0}px`;
|
|
20
|
+
}};
|
|
21
|
+
left: 0;
|
|
22
|
+
pointer-events: none;
|
|
23
|
+
visibility: hidden;
|
|
24
|
+
position: absolute;
|
|
25
|
+
`;
|
|
26
|
+
exports.StyledPopupPseudo = StyledPopupPseudo;
|
|
27
|
+
//# sourceMappingURL=Popup.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Popup.styles.js","names":["_styledComponents","_interopRequireDefault","require","obj","__esModule","default","StyledPopup","styled","span","exports","StyledPopupPseudo","div","_ref","menuHeight"],"sources":["../../../src/components/popup/Popup.styles.ts"],"sourcesContent":["import styled from 'styled-components';\n\nexport const StyledPopup = styled.span`\n cursor: pointer;\n position: relative;\n`;\n\nexport const StyledPopupPseudo = styled.div<{\n menuHeight: number;\n}>`\n top: ${({ menuHeight }) => `${menuHeight - 0}px`};\n left: 0;\n pointer-events: none;\n visibility: hidden;\n position: absolute;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEhC,MAAMG,WAAW,GAAGC,yBAAM,CAACC,IAAK;AACvC;AACA;AACA,CAAC;AAACC,OAAA,CAAAH,WAAA,GAAAA,WAAA;AAEK,MAAMI,iBAAiB,GAAGH,yBAAM,CAACI,GAErC;AACH,WAAWC,IAAA;EAAA,IAAC;IAAEC;EAAW,CAAC,GAAAD,IAAA;EAAA,OAAM,GAAEC,UAAU,GAAG,CAAE,IAAG;AAAA,CAAC;AACrD;AACA;AACA;AACA;AACA,CAAC;AAACJ,OAAA,CAAAC,iBAAA,GAAAA,iBAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { PopupAlignment, PopupCoordinates } from '../types';
|
|
3
|
+
type PopupContentProps = {
|
|
4
|
+
alignment: PopupAlignment;
|
|
5
|
+
coordinates: PopupCoordinates;
|
|
6
|
+
content: ReactNode;
|
|
7
|
+
};
|
|
8
|
+
declare const PopupContent: React.ForwardRefExoticComponent<PopupContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export default PopupContent;
|
|
@@ -0,0 +1,64 @@
|
|
|
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 _types = require("../types");
|
|
9
|
+
var _PopupContent = require("./PopupContent.styles");
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
const PopupContent = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
12
|
+
let {
|
|
13
|
+
alignment,
|
|
14
|
+
coordinates,
|
|
15
|
+
content
|
|
16
|
+
} = _ref;
|
|
17
|
+
const isBottomLeftAlignment = alignment === _types.PopupAlignment.BottomLeft;
|
|
18
|
+
const isTopLeftAlignment = alignment === _types.PopupAlignment.TopLeft;
|
|
19
|
+
const isTopRightAlignment = alignment === _types.PopupAlignment.TopRight;
|
|
20
|
+
const percentageOffsetX = isBottomLeftAlignment || isTopLeftAlignment ? -100 : 0;
|
|
21
|
+
const percentageOffsetY = isTopRightAlignment || isTopLeftAlignment ? -100 : 0;
|
|
22
|
+
const anchorOffsetX = isBottomLeftAlignment || isTopLeftAlignment ? 21 : -21;
|
|
23
|
+
const anchorOffsetY = isTopRightAlignment || isTopLeftAlignment ? -21 : 21;
|
|
24
|
+
const exitAndInitialY = isTopLeftAlignment || isTopRightAlignment ? -16 : 16;
|
|
25
|
+
return /*#__PURE__*/_react.default.createElement(_PopupContent.StyledMotionPopupContent, {
|
|
26
|
+
animate: {
|
|
27
|
+
opacity: 1,
|
|
28
|
+
y: 0
|
|
29
|
+
},
|
|
30
|
+
exit: {
|
|
31
|
+
opacity: 0,
|
|
32
|
+
y: exitAndInitialY
|
|
33
|
+
},
|
|
34
|
+
initial: {
|
|
35
|
+
opacity: 0,
|
|
36
|
+
y: exitAndInitialY
|
|
37
|
+
},
|
|
38
|
+
position: alignment,
|
|
39
|
+
ref: ref,
|
|
40
|
+
style: {
|
|
41
|
+
left: coordinates.x,
|
|
42
|
+
top: coordinates.y
|
|
43
|
+
},
|
|
44
|
+
transition: {
|
|
45
|
+
type: 'tween'
|
|
46
|
+
},
|
|
47
|
+
transformTemplate: _ref2 => {
|
|
48
|
+
let {
|
|
49
|
+
y = '0px'
|
|
50
|
+
} = _ref2;
|
|
51
|
+
return `
|
|
52
|
+
translateX(${percentageOffsetX}%)
|
|
53
|
+
translateY(${percentageOffsetY}%)
|
|
54
|
+
translateX(${anchorOffsetX}px)
|
|
55
|
+
translateY(${anchorOffsetY}px)
|
|
56
|
+
translateY(${y})
|
|
57
|
+
`;
|
|
58
|
+
}
|
|
59
|
+
}, content);
|
|
60
|
+
});
|
|
61
|
+
PopupContent.displayName = 'PopupContent';
|
|
62
|
+
var _default = PopupContent;
|
|
63
|
+
exports.default = _default;
|
|
64
|
+
//# sourceMappingURL=PopupContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PopupContent.js","names":["_react","_interopRequireDefault","require","_types","_PopupContent","obj","__esModule","default","PopupContent","React","forwardRef","_ref","ref","alignment","coordinates","content","isBottomLeftAlignment","PopupAlignment","BottomLeft","isTopLeftAlignment","TopLeft","isTopRightAlignment","TopRight","percentageOffsetX","percentageOffsetY","anchorOffsetX","anchorOffsetY","exitAndInitialY","createElement","StyledMotionPopupContent","animate","opacity","y","exit","initial","position","style","left","x","top","transition","type","transformTemplate","_ref2","displayName","_default","exports"],"sources":["../../../../src/components/popup/popup-content/PopupContent.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\nimport { PopupAlignment, PopupCoordinates } from '../types';\nimport { StyledMotionPopupContent } from './PopupContent.styles';\n\ntype PopupContentProps = {\n alignment: PopupAlignment;\n coordinates: PopupCoordinates;\n content: ReactNode;\n};\n\nconst PopupContent = React.forwardRef<HTMLDivElement, PopupContentProps>(\n ({ alignment, coordinates, content }, ref) => {\n const isBottomLeftAlignment = alignment === PopupAlignment.BottomLeft;\n const isTopLeftAlignment = alignment === PopupAlignment.TopLeft;\n const isTopRightAlignment = alignment === PopupAlignment.TopRight;\n\n const percentageOffsetX = isBottomLeftAlignment || isTopLeftAlignment ? -100 : 0;\n const percentageOffsetY = isTopRightAlignment || isTopLeftAlignment ? -100 : 0;\n\n const anchorOffsetX = isBottomLeftAlignment || isTopLeftAlignment ? 21 : -21;\n const anchorOffsetY = isTopRightAlignment || isTopLeftAlignment ? -21 : 21;\n\n const exitAndInitialY = isTopLeftAlignment || isTopRightAlignment ? -16 : 16;\n\n return (\n <StyledMotionPopupContent\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: exitAndInitialY }}\n initial={{ opacity: 0, y: exitAndInitialY }}\n position={alignment}\n ref={ref}\n style={{ left: coordinates.x, top: coordinates.y }}\n transition={{ type: 'tween' }}\n transformTemplate={({ y = '0px' }) => `\n translateX(${percentageOffsetX}%)\n translateY(${percentageOffsetY}%)\n translateX(${anchorOffsetX}px)\n translateY(${anchorOffsetY}px)\n translateY(${y})\n `}\n >\n {content}\n </StyledMotionPopupContent>\n );\n }\n);\n\nPopupContent.displayName = 'PopupContent';\n\nexport default PopupContent;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AAAiE,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAQjE,MAAMG,YAAY,gBAAGC,cAAK,CAACC,UAAU,CACjC,CAAAC,IAAA,EAAsCC,GAAG,KAAK;EAAA,IAA7C;IAAEC,SAAS;IAAEC,WAAW;IAAEC;EAAQ,CAAC,GAAAJ,IAAA;EAChC,MAAMK,qBAAqB,GAAGH,SAAS,KAAKI,qBAAc,CAACC,UAAU;EACrE,MAAMC,kBAAkB,GAAGN,SAAS,KAAKI,qBAAc,CAACG,OAAO;EAC/D,MAAMC,mBAAmB,GAAGR,SAAS,KAAKI,qBAAc,CAACK,QAAQ;EAEjE,MAAMC,iBAAiB,GAAGP,qBAAqB,IAAIG,kBAAkB,GAAG,CAAC,GAAG,GAAG,CAAC;EAChF,MAAMK,iBAAiB,GAAGH,mBAAmB,IAAIF,kBAAkB,GAAG,CAAC,GAAG,GAAG,CAAC;EAE9E,MAAMM,aAAa,GAAGT,qBAAqB,IAAIG,kBAAkB,GAAG,EAAE,GAAG,CAAC,EAAE;EAC5E,MAAMO,aAAa,GAAGL,mBAAmB,IAAIF,kBAAkB,GAAG,CAAC,EAAE,GAAG,EAAE;EAE1E,MAAMQ,eAAe,GAAGR,kBAAkB,IAAIE,mBAAmB,GAAG,CAAC,EAAE,GAAG,EAAE;EAE5E,oBACIrB,MAAA,CAAAO,OAAA,CAAAqB,aAAA,CAACxB,aAAA,CAAAyB,wBAAwB;IACrBC,OAAO,EAAE;MAAEC,OAAO,EAAE,CAAC;MAAEC,CAAC,EAAE;IAAE,CAAE;IAC9BC,IAAI,EAAE;MAAEF,OAAO,EAAE,CAAC;MAAEC,CAAC,EAAEL;IAAgB,CAAE;IACzCO,OAAO,EAAE;MAAEH,OAAO,EAAE,CAAC;MAAEC,CAAC,EAAEL;IAAgB,CAAE;IAC5CQ,QAAQ,EAAEtB,SAAU;IACpBD,GAAG,EAAEA,GAAI;IACTwB,KAAK,EAAE;MAAEC,IAAI,EAAEvB,WAAW,CAACwB,CAAC;MAAEC,GAAG,EAAEzB,WAAW,CAACkB;IAAE,CAAE;IACnDQ,UAAU,EAAE;MAAEC,IAAI,EAAE;IAAQ,CAAE;IAC9BC,iBAAiB,EAAEC,KAAA;MAAA,IAAC;QAAEX,CAAC,GAAG;MAAM,CAAC,GAAAW,KAAA;MAAA,OAAM;AACvD,iCAAiCpB,iBAAkB;AACnD,iCAAiCC,iBAAkB;AACnD,iCAAiCC,aAAc;AAC/C,iCAAiCC,aAAc;AAC/C,iCAAiCM,CAAE;AACnC,iBAAiB;IAAA;EAAC,GAEDjB,OACqB,CAAC;AAEnC,CACJ,CAAC;AAEDP,YAAY,CAACoC,WAAW,GAAG,cAAc;AAAC,IAAAC,QAAA,GAE3BrC,YAAY;AAAAsC,OAAA,CAAAvC,OAAA,GAAAsC,QAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PopupAlignment } from '../types';
|
|
2
|
+
export declare const StyledMotionPopupContent: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLDivElement, import("framer-motion").HTMLMotionProps<"div">>, any, {
|
|
3
|
+
position: PopupAlignment;
|
|
4
|
+
} & {
|
|
5
|
+
theme: import("../../color-scheme-provider/ColorSchemeProvider").Theme;
|
|
6
|
+
}, never>;
|