@chayns-components/core 5.0.0-beta.24 → 5.0.0-beta.240
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 +12 -3
- package/lib/components/accordion/accordion-group/AccordionGroup.js +33 -44
- 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 +6 -6
- package/lib/components/context-menu/ContextMenu.js +82 -98
- 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 +52 -0
- package/lib/components/input/Input.js +110 -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 +111 -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 +10 -0
- package/lib/components/number-input/utils/number.js +32 -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 +145 -0
- package/lib/components/popup/Popup.js.map +1 -0
- package/lib/components/popup/Popup.styles.d.ts +2 -0
- package/lib/components/popup/Popup.styles.js +22 -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 +22 -0
- package/lib/components/radio-button/radio-button-group/RadioButtonGroup.js +56 -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/textstring/TextString.d.ts +22 -0
- package/lib/components/textstring/TextString.js +63 -0
- package/lib/components/textstring/TextString.js.map +1 -0
- package/lib/components/textstring/TextString.styles.d.ts +1 -0
- package/lib/components/textstring/TextString.styles.js +11 -0
- package/lib/components/textstring/TextString.styles.js.map +1 -0
- package/lib/components/textstring/types.d.ts +8 -0
- package/lib/components/textstring/types.js +6 -0
- package/lib/components/textstring/types.js.map +1 -0
- package/lib/components/textstring-provider/TextStringProvider.d.ts +21 -0
- package/lib/components/textstring-provider/TextStringProvider.js +39 -0
- package/lib/components/textstring-provider/TextStringProvider.js.map +1 -0
- package/lib/components/textstring-provider/utils.d.ts +11 -0
- package/lib/components/textstring-provider/utils.js +32 -0
- package/lib/components/textstring-provider/utils.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 +37 -0
- package/lib/index.js +230 -27
- package/lib/index.js.map +1 -1
- package/lib/types/chayns.d.ts +98 -0
- package/lib/types/chayns.js +14 -0
- package/lib/types/chayns.js.map +1 -0
- 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 +70 -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/textstring.d.ts +6 -0
- package/lib/utils/textstring.js +33 -0
- package/lib/utils/textstring.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,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledMotionPopupContent = void 0;
|
|
7
|
+
var _framerMotion = require("framer-motion");
|
|
8
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
|
+
var _types = require("../types");
|
|
10
|
+
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); }
|
|
11
|
+
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; }
|
|
12
|
+
const StyledMotionPopupContent = (0, _styledComponents.default)(_framerMotion.motion.div)`
|
|
13
|
+
background-color: ${_ref => {
|
|
14
|
+
let {
|
|
15
|
+
theme
|
|
16
|
+
} = _ref;
|
|
17
|
+
return theme['001'];
|
|
18
|
+
}};
|
|
19
|
+
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
20
|
+
border-radius: 3px;
|
|
21
|
+
box-shadow: 1px 3px 8px rgb(0 0 0 / 30%);
|
|
22
|
+
color: ${_ref2 => {
|
|
23
|
+
let {
|
|
24
|
+
theme
|
|
25
|
+
} = _ref2;
|
|
26
|
+
return theme.text;
|
|
27
|
+
}};
|
|
28
|
+
position: absolute;
|
|
29
|
+
z-index: 0;
|
|
30
|
+
|
|
31
|
+
::after {
|
|
32
|
+
background-color: inherit;
|
|
33
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
|
34
|
+
border-bottom-right-radius: 3px;
|
|
35
|
+
border-right: 1px solid rgba(0, 0, 0, 0.1);
|
|
36
|
+
box-shadow: 2px 2px 8px rgb(4 3 4 / 10%);
|
|
37
|
+
content: '';
|
|
38
|
+
height: 14px;
|
|
39
|
+
position: absolute;
|
|
40
|
+
width: 14px;
|
|
41
|
+
z-index: -2;
|
|
42
|
+
|
|
43
|
+
${_ref3 => {
|
|
44
|
+
let {
|
|
45
|
+
position
|
|
46
|
+
} = _ref3;
|
|
47
|
+
switch (position) {
|
|
48
|
+
case _types.PopupAlignment.TopLeft:
|
|
49
|
+
return (0, _styledComponents.css)`
|
|
50
|
+
bottom: -8px;
|
|
51
|
+
right: 13px;
|
|
52
|
+
transform: rotate(45deg);
|
|
53
|
+
`;
|
|
54
|
+
case _types.PopupAlignment.BottomLeft:
|
|
55
|
+
return (0, _styledComponents.css)`
|
|
56
|
+
top: -8px;
|
|
57
|
+
right: 13px;
|
|
58
|
+
transform: rotate(225deg);
|
|
59
|
+
`;
|
|
60
|
+
case _types.PopupAlignment.TopRight:
|
|
61
|
+
return (0, _styledComponents.css)`
|
|
62
|
+
transform: rotate(45deg);
|
|
63
|
+
bottom: -8px;
|
|
64
|
+
left: 13px;
|
|
65
|
+
`;
|
|
66
|
+
case _types.PopupAlignment.BottomRight:
|
|
67
|
+
return (0, _styledComponents.css)`
|
|
68
|
+
transform: rotate(225deg);
|
|
69
|
+
top: -8px;
|
|
70
|
+
left: 13px;
|
|
71
|
+
`;
|
|
72
|
+
default:
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
}}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
::before {
|
|
79
|
+
background-color: inherit;
|
|
80
|
+
bottom: 0;
|
|
81
|
+
content: '';
|
|
82
|
+
left: 0;
|
|
83
|
+
position: absolute;
|
|
84
|
+
right: 0;
|
|
85
|
+
top: 0;
|
|
86
|
+
z-index: -1;
|
|
87
|
+
}
|
|
88
|
+
`;
|
|
89
|
+
exports.StyledMotionPopupContent = StyledMotionPopupContent;
|
|
90
|
+
//# sourceMappingURL=PopupContent.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PopupContent.styles.js","names":["_framerMotion","require","_styledComponents","_interopRequireWildcard","_types","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","StyledMotionPopupContent","styled","motion","div","_ref","theme","_ref2","text","_ref3","position","PopupAlignment","TopLeft","css","BottomLeft","TopRight","BottomRight","undefined","exports"],"sources":["../../../../src/components/popup/popup-content/PopupContent.styles.ts"],"sourcesContent":["import { motion } from 'framer-motion';\nimport styled, { css } from 'styled-components';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\nimport { PopupAlignment } from '../types';\n\ntype StyledMotionPopupContentProps = WithTheme<{\n position: PopupAlignment;\n}>;\n\nexport const StyledMotionPopupContent = styled(motion.div)<StyledMotionPopupContentProps>`\n background-color: ${({ theme }: StyledMotionPopupContentProps) => theme['001']};\n border: 1px solid rgba(0, 0, 0, 0.1);\n border-radius: 3px;\n box-shadow: 1px 3px 8px rgb(0 0 0 / 30%);\n color: ${({ theme }: StyledMotionPopupContentProps) => theme.text};\n position: absolute;\n z-index: 0;\n\n ::after {\n background-color: inherit;\n border-bottom: 1px solid rgba(0, 0, 0, 0.1);\n border-bottom-right-radius: 3px;\n border-right: 1px solid rgba(0, 0, 0, 0.1);\n box-shadow: 2px 2px 8px rgb(4 3 4 / 10%);\n content: '';\n height: 14px;\n position: absolute;\n width: 14px;\n z-index: -2;\n\n ${({ position }) => {\n switch (position) {\n case PopupAlignment.TopLeft:\n return css`\n bottom: -8px;\n right: 13px;\n transform: rotate(45deg);\n `;\n case PopupAlignment.BottomLeft:\n return css`\n top: -8px;\n right: 13px;\n transform: rotate(225deg);\n `;\n case PopupAlignment.TopRight:\n return css`\n transform: rotate(45deg);\n bottom: -8px;\n left: 13px;\n `;\n case PopupAlignment.BottomRight:\n return css`\n transform: rotate(225deg);\n top: -8px;\n left: 13px;\n `;\n default:\n return undefined;\n }\n }}\n }\n\n ::before {\n background-color: inherit;\n bottom: 0;\n content: '';\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n z-index: -1;\n }\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,uBAAA,CAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAH,OAAA;AAA0C,SAAAI,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAA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C,GAAAC,KAAA;EAAA,OAAKD,KAAK,CAACE,IAAI;AAAA,CAAC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAUC,KAAA,IAAkB;EAAA,IAAjB;IAAEC;EAAS,CAAC,GAAAD,KAAA;EACX,QAAQC,QAAQ;IACZ,KAAKC,qBAAc,CAACC,OAAO;MACvB,OAAO,IAAAC,qBAAG,CAAC;AAC/B;AACA;AACA;AACA,qBAAqB;IACL,KAAKF,qBAAc,CAACG,UAAU;MAC1B,OAAO,IAAAD,qBAAG,CAAC;AAC/B;AACA;AACA;AACA,qBAAqB;IACL,KAAKF,qBAAc,CAACI,QAAQ;MACxB,OAAO,IAAAF,qBAAG,CAAC;AAC/B;AACA;AACA;AACA,qBAAqB;IACL,KAAKF,qBAAc,CAACK,WAAW;MAC3B,OAAO,IAAAH,qBAAG,CAAC;AAC/B;AACA;AACA;AACA,qBAAqB;IACL;MACI,OAAOI,SAAS;EACxB;AACJ,CAAE;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAACC,OAAA,CAAAjB,wBAAA,GAAAA,wBAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare enum PopupAlignment {
|
|
2
|
+
TopLeft = 0,
|
|
3
|
+
TopCenter = 1,
|
|
4
|
+
TopRight = 2,
|
|
5
|
+
BottomLeft = 3,
|
|
6
|
+
BottomCenter = 4,
|
|
7
|
+
BottomRight = 5
|
|
8
|
+
}
|
|
9
|
+
export type PopupCoordinates = {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
};
|
|
13
|
+
export type PopupRef = {
|
|
14
|
+
hide: VoidFunction;
|
|
15
|
+
show: VoidFunction;
|
|
16
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PopupAlignment = void 0;
|
|
7
|
+
let PopupAlignment = /*#__PURE__*/function (PopupAlignment) {
|
|
8
|
+
PopupAlignment[PopupAlignment["TopLeft"] = 0] = "TopLeft";
|
|
9
|
+
PopupAlignment[PopupAlignment["TopCenter"] = 1] = "TopCenter";
|
|
10
|
+
PopupAlignment[PopupAlignment["TopRight"] = 2] = "TopRight";
|
|
11
|
+
PopupAlignment[PopupAlignment["BottomLeft"] = 3] = "BottomLeft";
|
|
12
|
+
PopupAlignment[PopupAlignment["BottomCenter"] = 4] = "BottomCenter";
|
|
13
|
+
PopupAlignment[PopupAlignment["BottomRight"] = 5] = "BottomRight";
|
|
14
|
+
return PopupAlignment;
|
|
15
|
+
}({});
|
|
16
|
+
exports.PopupAlignment = PopupAlignment;
|
|
17
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":["PopupAlignment","exports"],"sources":["../../../src/components/popup/types.ts"],"sourcesContent":["export enum PopupAlignment {\n TopLeft,\n TopCenter,\n TopRight,\n BottomLeft,\n BottomCenter,\n BottomRight,\n}\n\nexport type PopupCoordinates = {\n x: number;\n y: number;\n};\n\nexport type PopupRef = {\n hide: VoidFunction;\n show: VoidFunction;\n};\n"],"mappings":";;;;;;IAAYA,cAAc,0BAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAAAC,OAAA,CAAAD,cAAA,GAAAA,cAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
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 _ProgressBar = require("./ProgressBar.styles");
|
|
9
|
+
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); }
|
|
10
|
+
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; }
|
|
11
|
+
const ProgressBar = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
percentage
|
|
14
|
+
} = _ref;
|
|
15
|
+
const [internalPercentage, setInternalPercentage] = (0, _react.useState)(0);
|
|
16
|
+
(0, _react.useEffect)(() => {
|
|
17
|
+
if (percentage >= 0 && percentage <= 100) {
|
|
18
|
+
setInternalPercentage(percentage);
|
|
19
|
+
}
|
|
20
|
+
}, [percentage]);
|
|
21
|
+
return (0, _react.useMemo)(() => /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledProgressBar, null, /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledMotionProgressBarProgress, {
|
|
22
|
+
initial: {
|
|
23
|
+
width: '0%'
|
|
24
|
+
},
|
|
25
|
+
animate: {
|
|
26
|
+
width: `${internalPercentage}%`
|
|
27
|
+
},
|
|
28
|
+
exit: {
|
|
29
|
+
width: '0%'
|
|
30
|
+
},
|
|
31
|
+
transition: {
|
|
32
|
+
type: 'tween'
|
|
33
|
+
}
|
|
34
|
+
}), /*#__PURE__*/_react.default.createElement(_ProgressBar.StyledProgressBarBackground, null)), [internalPercentage]);
|
|
35
|
+
};
|
|
36
|
+
ProgressBar.displayName = 'ProgressBar';
|
|
37
|
+
var _default = ProgressBar;
|
|
38
|
+
exports.default = _default;
|
|
39
|
+
//# sourceMappingURL=ProgressBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressBar.js","names":["_react","_interopRequireWildcard","require","_ProgressBar","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","ProgressBar","_ref","percentage","internalPercentage","setInternalPercentage","useState","useEffect","useMemo","createElement","StyledProgressBar","StyledMotionProgressBarProgress","initial","width","animate","exit","transition","type","StyledProgressBarBackground","displayName","_default","exports"],"sources":["../../../src/components/progress-bar/ProgressBar.tsx"],"sourcesContent":["import React, { FC, useEffect, useMemo, useState } from 'react';\nimport {\n StyledMotionProgressBarProgress,\n StyledProgressBar,\n StyledProgressBarBackground,\n} from './ProgressBar.styles';\n\nexport type ProgressBarProps = {\n /**\n * The percentage of the progress. Number between 0 and 100.\n */\n percentage: number;\n};\n\nconst ProgressBar: FC<ProgressBarProps> = ({ percentage }) => {\n const [internalPercentage, setInternalPercentage] = useState(0);\n\n useEffect(() => {\n if (percentage >= 0 && percentage <= 100) {\n setInternalPercentage(percentage);\n }\n }, [percentage]);\n\n return useMemo(\n () => (\n <StyledProgressBar>\n <StyledMotionProgressBarProgress\n initial={{ width: '0%' }}\n animate={{ width: `${internalPercentage}%` }}\n exit={{ width: '0%' }}\n transition={{ type: 'tween' }}\n />\n <StyledProgressBarBackground />\n </StyledProgressBar>\n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AAAM,MAAA,YAAAA,MAAA;AAS9B,MAAMW,WAAiC,GAAGC,IAAA,IAAoB;EAAA,IAAnB;IAAEC;EAAW,CAAC,GAAAD,IAAA;EACrD,MAAM,CAACE,kBAAkB,EAAEC,qBAAqB,CAAC,GAAG,IAAAC,eAAQ,EAAC,CAAC,CAAC;EAE/D,IAAAC,gBAAS,EAAC,MAAM;IACZ,IAAIJ,UAAU,IAAI,CAAC,IAAIA,UAAU,IAAI,GAAG,EAAE;MACtCE,qBAAqB,CAACF,UAAU,CAAC;IACrC;EACJ,CAAC,EAAE,CAACA,UAAU,CAAC,CAAC;EAEhB,OAAO,IAAAK,cAAO,EACV,mBACIjC,MAAA,CAAAW,OAAA,CAAAuB,aAAA,CAAC/B,YAAA,CAAAgC,iBAAiB,qBACdnC,MAAA,CAAAW,OAAA,CAAAuB,aAAA,CAAC/B,YAAA,CAAAiC,+BAA+B;IAC5BC,OAAO,EAAE;MAAEC,KAAK,EAAE;IAAK,CAAE;IACzBC,OAAO,EAAE;MAAED,KAAK,EAAG,GAAET,kBAAmB;IAAG,CAAE;IAC7CW,IAAI,EAAE;MAAEF,KAAK,EAAE;IAAK,CAAE;IACtBG,UAAU,EAAE;MAAEC,IAAI,EAAE;IAAQ;EAAE,CACjC,CAAC,eACF1C,MAAA,CAAAW,OAAA,CAAAuB,aAAA,CAAC/B,YAAA,CAAAwC,2BAA2B,MAAE,CACf,CACtB,EACD,CAACd,kBAAkB,CACvB,CAAC;AACL,CAAC;AAEDH,WAAW,CAACkB,WAAW,GAAG,aAAa;AAAC,IAAAC,QAAA,GAEzBnB,WAAW;AAAAoB,OAAA,CAAAnC,OAAA,GAAAkC,QAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const StyledProgressBar: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
|
+
export declare const StyledProgressBarBackground: import("styled-components").StyledComponent<"div", any, {
|
|
3
|
+
theme: import("../color-scheme-provider/ColorSchemeProvider").Theme;
|
|
4
|
+
}, never>;
|
|
5
|
+
export declare const StyledMotionProgressBarProgress: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLDivElement, import("framer-motion").HTMLMotionProps<"div">>, any, {
|
|
6
|
+
theme: import("../color-scheme-provider/ColorSchemeProvider").Theme;
|
|
7
|
+
}, never>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledProgressBarBackground = exports.StyledProgressBar = exports.StyledMotionProgressBarProgress = void 0;
|
|
7
|
+
var _framerMotion = require("framer-motion");
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
const StyledProgressBar = _styledComponents.default.div`
|
|
11
|
+
position: relative;
|
|
12
|
+
`;
|
|
13
|
+
exports.StyledProgressBar = StyledProgressBar;
|
|
14
|
+
const StyledProgressBarBackground = _styledComponents.default.div`
|
|
15
|
+
height: 10px;
|
|
16
|
+
width: 100%;
|
|
17
|
+
background-color: ${_ref => {
|
|
18
|
+
let {
|
|
19
|
+
theme
|
|
20
|
+
} = _ref;
|
|
21
|
+
return theme['100'];
|
|
22
|
+
}};
|
|
23
|
+
`;
|
|
24
|
+
exports.StyledProgressBarBackground = StyledProgressBarBackground;
|
|
25
|
+
const StyledMotionProgressBarProgress = (0, _styledComponents.default)(_framerMotion.motion.div)`
|
|
26
|
+
height: 10px;
|
|
27
|
+
position: absolute;
|
|
28
|
+
top: 0;
|
|
29
|
+
left: 0;
|
|
30
|
+
z-index: 2;
|
|
31
|
+
background-color: ${_ref2 => {
|
|
32
|
+
let {
|
|
33
|
+
theme
|
|
34
|
+
} = _ref2;
|
|
35
|
+
return theme.headline;
|
|
36
|
+
}};
|
|
37
|
+
`;
|
|
38
|
+
exports.StyledMotionProgressBarProgress = StyledMotionProgressBarProgress;
|
|
39
|
+
//# sourceMappingURL=ProgressBar.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressBar.styles.js","names":["_framerMotion","require","_styledComponents","_interopRequireDefault","obj","__esModule","default","StyledProgressBar","styled","div","exports","StyledProgressBarBackground","_ref","theme","StyledMotionProgressBarProgress","motion","_ref2","headline"],"sources":["../../../src/components/progress-bar/ProgressBar.styles.ts"],"sourcesContent":["import { motion } from 'framer-motion';\nimport styled from 'styled-components';\nimport type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\n\nexport const StyledProgressBar = styled.div`\n position: relative;\n`;\n\ntype StyledProgressBarBackgroundProps = WithTheme<unknown>;\nexport const StyledProgressBarBackground = styled.div<StyledProgressBarBackgroundProps>`\n height: 10px;\n width: 100%;\n background-color: ${({ theme }: StyledProgressBarBackgroundProps) => theme['100']};\n`;\n\ntype StyledProgressBarProgressProps = WithTheme<unknown>;\nexport const StyledMotionProgressBarProgress = styled(motion.div)<StyledProgressBarProgressProps>`\n height: 10px;\n position: absolute;\n top: 0;\n left: 0;\n z-index: 2;\n background-color: ${({ theme }: StyledProgressBarProgressProps) => theme.headline};\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAuC,SAAAE,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAGhC,MAAMG,iBAAiB,GAAGC,yBAAM,CAACC,GAAI;AAC5C;AACA,CAAC;AAACC,OAAA,CAAAH,iBAAA,GAAAA,iBAAA;AAGK,MAAMI,2BAA2B,GAAGH,yBAAM,CAACC,GAAsC;AACxF;AACA;AACA,wBAAwBG,IAAA;EAAA,IAAC;IAAEC;EAAwC,CAAC,GAAAD,IAAA;EAAA,OAAKC,KAAK,CAAC,KAAK,CAAC;AAAA,CAAC;AACtF,CAAC;AAACH,OAAA,CAAAC,2BAAA,GAAAA,2BAAA;AAGK,MAAMG,+BAA+B,GAAG,IAAAN,yBAAM,EAACO,oBAAM,CAACN,GAAG,CAAkC;AAClG;AACA;AACA;AACA;AACA;AACA,wBAAwBO,KAAA;EAAA,IAAC;IAAEH;EAAsC,CAAC,GAAAG,KAAA;EAAA,OAAKH,KAAK,CAACI,QAAQ;AAAA,CAAC;AACtF,CAAC;AAACP,OAAA,CAAAI,+BAAA,GAAAA,+BAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import type { RadioButtonItem } from './types';
|
|
3
|
+
export type RadioButtonProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Whether the radio button should be checked.
|
|
6
|
+
*/
|
|
7
|
+
isChecked?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* whether the RadioButton should be shown.
|
|
10
|
+
*/
|
|
11
|
+
isDisabled?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* The id of the radio button.
|
|
14
|
+
*/
|
|
15
|
+
id: string;
|
|
16
|
+
/**
|
|
17
|
+
* The label that should be displayed next to the radio button.
|
|
18
|
+
*/
|
|
19
|
+
label?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Function to be executed when a button is checked.
|
|
22
|
+
*/
|
|
23
|
+
onChange?: (item: RadioButtonItem) => void;
|
|
24
|
+
};
|
|
25
|
+
declare const RadioButton: FC<RadioButtonProps>;
|
|
26
|
+
export default RadioButton;
|
|
@@ -0,0 +1,86 @@
|
|
|
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 _RadioButtonGroup = require("./radio-button-group/RadioButtonGroup");
|
|
9
|
+
var _RadioButton = require("./RadioButton.styles");
|
|
10
|
+
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); }
|
|
11
|
+
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; }
|
|
12
|
+
const RadioButton = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
isChecked,
|
|
15
|
+
label,
|
|
16
|
+
onChange,
|
|
17
|
+
id,
|
|
18
|
+
isDisabled = false
|
|
19
|
+
} = _ref;
|
|
20
|
+
const {
|
|
21
|
+
selectedRadioButtonId,
|
|
22
|
+
updateSelectedRadioButtonId,
|
|
23
|
+
setSelectedRadioButtonId
|
|
24
|
+
} = (0, _react.useContext)(_RadioButtonGroup.RadioButtonGroupContext);
|
|
25
|
+
const [internalIsChecked, setInternalIsChecked] = (0, _react.useState)(false);
|
|
26
|
+
const [isHovered, setIsHovered] = (0, _react.useState)(false);
|
|
27
|
+
const isInGroup = typeof updateSelectedRadioButtonId === 'function';
|
|
28
|
+
const isMarked = isInGroup ? selectedRadioButtonId === id : internalIsChecked;
|
|
29
|
+
const isInitialRenderRef = (0, _react.useRef)(true);
|
|
30
|
+
(0, _react.useEffect)(() => {
|
|
31
|
+
if (typeof isChecked === 'boolean') {
|
|
32
|
+
if (typeof setSelectedRadioButtonId === 'function') {
|
|
33
|
+
setSelectedRadioButtonId(isChecked ? id : undefined);
|
|
34
|
+
} else {
|
|
35
|
+
setInternalIsChecked(isChecked);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}, [id, isChecked, setSelectedRadioButtonId]);
|
|
39
|
+
(0, _react.useEffect)(() => {
|
|
40
|
+
if (isInitialRenderRef.current) {
|
|
41
|
+
isInitialRenderRef.current = false;
|
|
42
|
+
} else if (typeof onChange === 'function') {
|
|
43
|
+
onChange({
|
|
44
|
+
isChecked: isMarked,
|
|
45
|
+
id
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}, [id, isMarked, onChange]);
|
|
49
|
+
const handleClick = (0, _react.useCallback)(() => {
|
|
50
|
+
if (isDisabled) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (typeof updateSelectedRadioButtonId === 'function') {
|
|
54
|
+
updateSelectedRadioButtonId(id);
|
|
55
|
+
}
|
|
56
|
+
setInternalIsChecked(prevState => !prevState);
|
|
57
|
+
}, [id, isDisabled, updateSelectedRadioButtonId]);
|
|
58
|
+
const handleMouseEnter = (0, _react.useCallback)(() => {
|
|
59
|
+
if (!isDisabled) {
|
|
60
|
+
setIsHovered(true);
|
|
61
|
+
}
|
|
62
|
+
}, [isDisabled]);
|
|
63
|
+
const handleMouseLeave = () => {
|
|
64
|
+
setIsHovered(false);
|
|
65
|
+
};
|
|
66
|
+
return (0, _react.useMemo)(() => /*#__PURE__*/_react.default.createElement(_RadioButton.StyledRadioButton, {
|
|
67
|
+
isDisabled: isDisabled,
|
|
68
|
+
onClick: handleClick,
|
|
69
|
+
onMouseEnter: handleMouseEnter,
|
|
70
|
+
onMouseLeave: handleMouseLeave
|
|
71
|
+
}, /*#__PURE__*/_react.default.createElement(_RadioButton.StyledRadioButtonPseudoCheckBox, {
|
|
72
|
+
isChecked: isMarked
|
|
73
|
+
}, /*#__PURE__*/_react.default.createElement(_RadioButton.StyledRadioButtonCheckBoxMark, {
|
|
74
|
+
isHovered: isHovered,
|
|
75
|
+
isSelected: isMarked
|
|
76
|
+
})), /*#__PURE__*/_react.default.createElement(_RadioButton.StyledRadioButtonCheckBox, {
|
|
77
|
+
disabled: isDisabled,
|
|
78
|
+
type: "radio",
|
|
79
|
+
checked: isMarked,
|
|
80
|
+
onChange: () => {}
|
|
81
|
+
}), label && /*#__PURE__*/_react.default.createElement(_RadioButton.StyledRadioButtonLabel, null, label)), [handleClick, handleMouseEnter, isDisabled, isHovered, isMarked, label]);
|
|
82
|
+
};
|
|
83
|
+
RadioButton.displayName = 'RadioButton';
|
|
84
|
+
var _default = RadioButton;
|
|
85
|
+
exports.default = _default;
|
|
86
|
+
//# sourceMappingURL=RadioButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioButton.js","names":["_react","_interopRequireWildcard","require","_RadioButtonGroup","_RadioButton","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","RadioButton","_ref","isChecked","label","onChange","id","isDisabled","selectedRadioButtonId","updateSelectedRadioButtonId","setSelectedRadioButtonId","useContext","RadioButtonGroupContext","internalIsChecked","setInternalIsChecked","useState","isHovered","setIsHovered","isInGroup","isMarked","isInitialRenderRef","useRef","useEffect","undefined","current","handleClick","useCallback","prevState","handleMouseEnter","handleMouseLeave","useMemo","createElement","StyledRadioButton","onClick","onMouseEnter","onMouseLeave","StyledRadioButtonPseudoCheckBox","StyledRadioButtonCheckBoxMark","isSelected","StyledRadioButtonCheckBox","disabled","type","checked","StyledRadioButtonLabel","displayName","_default","exports"],"sources":["../../../src/components/radio-button/RadioButton.tsx"],"sourcesContent":["import React, { FC, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';\nimport { RadioButtonGroupContext } from './radio-button-group/RadioButtonGroup';\nimport {\n StyledRadioButton,\n StyledRadioButtonCheckBox,\n StyledRadioButtonCheckBoxMark,\n StyledRadioButtonLabel,\n StyledRadioButtonPseudoCheckBox,\n} from './RadioButton.styles';\nimport type { RadioButtonItem } from './types';\n\nexport type RadioButtonProps = {\n /**\n * Whether the radio button should be checked.\n */\n isChecked?: boolean;\n /**\n * whether the RadioButton should be shown.\n */\n isDisabled?: boolean;\n /**\n * The id of the radio button.\n */\n id: string;\n /**\n * The label that should be displayed next to the radio button.\n */\n label?: string;\n /**\n * Function to be executed when a button is checked.\n */\n onChange?: (item: RadioButtonItem) => void;\n};\n\nconst RadioButton: FC<RadioButtonProps> = ({\n isChecked,\n label,\n onChange,\n id,\n isDisabled = false,\n}) => {\n const { selectedRadioButtonId, updateSelectedRadioButtonId, setSelectedRadioButtonId } =\n useContext(RadioButtonGroupContext);\n\n const [internalIsChecked, setInternalIsChecked] = useState(false);\n const [isHovered, setIsHovered] = useState(false);\n\n const isInGroup = typeof updateSelectedRadioButtonId === 'function';\n\n const isMarked = isInGroup ? selectedRadioButtonId === id : internalIsChecked;\n\n const isInitialRenderRef = useRef(true);\n\n useEffect(() => {\n if (typeof isChecked === 'boolean') {\n if (typeof setSelectedRadioButtonId === 'function') {\n setSelectedRadioButtonId(isChecked ? id : undefined);\n } else {\n setInternalIsChecked(isChecked);\n }\n }\n }, [id, isChecked, setSelectedRadioButtonId]);\n\n useEffect(() => {\n if (isInitialRenderRef.current) {\n isInitialRenderRef.current = false;\n } else if (typeof onChange === 'function') {\n onChange({ isChecked: isMarked, id });\n }\n }, [id, isMarked, onChange]);\n\n const handleClick = useCallback(() => {\n if (isDisabled) {\n return;\n }\n\n if (typeof updateSelectedRadioButtonId === 'function') {\n updateSelectedRadioButtonId(id);\n }\n\n setInternalIsChecked((prevState) => !prevState);\n }, [id, isDisabled, updateSelectedRadioButtonId]);\n\n const handleMouseEnter = useCallback(() => {\n if (!isDisabled) {\n setIsHovered(true);\n }\n }, [isDisabled]);\n\n const handleMouseLeave = () => {\n setIsHovered(false);\n };\n\n return useMemo(\n () => (\n <StyledRadioButton\n isDisabled={isDisabled}\n onClick={handleClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n <StyledRadioButtonPseudoCheckBox isChecked={isMarked}>\n <StyledRadioButtonCheckBoxMark isHovered={isHovered} isSelected={isMarked} />\n </StyledRadioButtonPseudoCheckBox>\n <StyledRadioButtonCheckBox\n disabled={isDisabled}\n type=\"radio\"\n checked={isMarked}\n onChange={() => {}}\n />\n {label && <StyledRadioButtonLabel>{label}</StyledRadioButtonLabel>}\n </StyledRadioButton>\n ),\n [handleClick, handleMouseEnter, isDisabled, isHovered, isMarked, label]\n );\n};\n\nRadioButton.displayName = 'RadioButton';\n\nexport default RadioButton;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAM8B,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,SAAAL,wBAAAS,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,I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Y;IACrBS,YAAY,EAAEN,gBAAiB;IAC/BO,YAAY,EAAEN;EAAiB,gBAE/BvD,MAAA,CAAAY,OAAA,CAAA6C,aAAA,CAACrD,YAAA,CAAA0D,+BAA+B;IAACjC,SAAS,EAAEgB;EAAS,gBACjD7C,MAAA,CAAAY,OAAA,CAAA6C,aAAA,CAACrD,YAAA,CAAA2D,6BAA6B;IAACrB,SAAS,EAAEA,SAAU;IAACsB,UAAU,EAAEnB;EAAS,CAAE,CAC/C,CAAC,eAClC7C,MAAA,CAAAY,OAAA,CAAA6C,aAAA,CAACrD,YAAA,CAAA6D,yBAAyB;IACtBC,QAAQ,EAAEjC,UAAW;IACrBkC,IAAI,EAAC,OAAO;IACZC,OAAO,EAAEvB,QAAS;IAClBd,QAAQ,EAAEA,CAAA,KAAM,CAAC;EAAE,CACtB,CAAC,EACDD,KAAK,iBAAI9B,MAAA,CAAAY,OAAA,CAAA6C,aAAA,CAACrD,YAAA,CAAAiE,sBAAsB,QAAEvC,KAA8B,CAClD,CACtB,EACD,CAACqB,WAAW,EAAEG,gBAAgB,EAAErB,UAAU,EAAES,SAAS,EAAEG,QAAQ,EAAEf,KAAK,CAC1E,CAAC;AACL,CAAC;AAEDH,WAAW,CAAC2C,WAAW,GAAG,aAAa;AAAC,IAAAC,QAAA,GAEzB5C,WAAW;AAAA6C,OAAA,CAAA5D,OAAA,GAAA2D,QAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const StyledRadioButton: import("styled-components").StyledComponent<"span", any, {
|
|
2
|
+
isDisabled: boolean;
|
|
3
|
+
} & {
|
|
4
|
+
theme: import("../color-scheme-provider/ColorSchemeProvider").Theme;
|
|
5
|
+
}, never>;
|
|
6
|
+
export declare const StyledRadioButtonCheckBox: import("styled-components").StyledComponent<"input", any, {
|
|
7
|
+
theme: import("../color-scheme-provider/ColorSchemeProvider").Theme;
|
|
8
|
+
}, never>;
|
|
9
|
+
export declare const StyledRadioButtonPseudoCheckBox: import("styled-components").StyledComponent<"div", any, {
|
|
10
|
+
isChecked: boolean;
|
|
11
|
+
} & {
|
|
12
|
+
theme: import("../color-scheme-provider/ColorSchemeProvider").Theme;
|
|
13
|
+
}, never>;
|
|
14
|
+
export declare const StyledRadioButtonCheckBoxMark: import("styled-components").StyledComponent<"span", any, {
|
|
15
|
+
isHovered: boolean;
|
|
16
|
+
isSelected: boolean;
|
|
17
|
+
} & {
|
|
18
|
+
theme: import("../color-scheme-provider/ColorSchemeProvider").Theme;
|
|
19
|
+
}, never>;
|
|
20
|
+
export declare const StyledRadioButtonLabel: import("styled-components").StyledComponent<"p", any, {
|
|
21
|
+
theme: import("../color-scheme-provider/ColorSchemeProvider").Theme;
|
|
22
|
+
}, never>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledRadioButtonPseudoCheckBox = exports.StyledRadioButtonLabel = exports.StyledRadioButtonCheckBoxMark = exports.StyledRadioButtonCheckBox = exports.StyledRadioButton = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
8
|
+
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); }
|
|
9
|
+
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; }
|
|
10
|
+
const StyledRadioButton = _styledComponents.default.span`
|
|
11
|
+
display: flex;
|
|
12
|
+
gap: 5px;
|
|
13
|
+
user-select: none;
|
|
14
|
+
width: fit-content;
|
|
15
|
+
align-items: center;
|
|
16
|
+
position: relative;
|
|
17
|
+
cursor: ${_ref => {
|
|
18
|
+
let {
|
|
19
|
+
isDisabled
|
|
20
|
+
} = _ref;
|
|
21
|
+
return isDisabled ? 'default !important' : 'pointer';
|
|
22
|
+
}};
|
|
23
|
+
opacity: ${_ref2 => {
|
|
24
|
+
let {
|
|
25
|
+
isDisabled
|
|
26
|
+
} = _ref2;
|
|
27
|
+
return isDisabled ? 0.5 : 1;
|
|
28
|
+
}};
|
|
29
|
+
`;
|
|
30
|
+
exports.StyledRadioButton = StyledRadioButton;
|
|
31
|
+
const StyledRadioButtonCheckBox = _styledComponents.default.input`
|
|
32
|
+
opacity: 0;
|
|
33
|
+
`;
|
|
34
|
+
exports.StyledRadioButtonCheckBox = StyledRadioButtonCheckBox;
|
|
35
|
+
const StyledRadioButtonPseudoCheckBox = _styledComponents.default.div`
|
|
36
|
+
background-color: ${_ref3 => {
|
|
37
|
+
let {
|
|
38
|
+
theme,
|
|
39
|
+
isChecked
|
|
40
|
+
} = _ref3;
|
|
41
|
+
return isChecked ? theme.secondary : theme['secondary-103'];
|
|
42
|
+
}};
|
|
43
|
+
opacity: 0.5;
|
|
44
|
+
border: 1px solid rgba(160, 160, 160, 0.3);
|
|
45
|
+
width: 13px;
|
|
46
|
+
height: 13px;
|
|
47
|
+
position: absolute;
|
|
48
|
+
border-radius: 100%;
|
|
49
|
+
top: 22%;
|
|
50
|
+
left: -1%;
|
|
51
|
+
cursor: pointer !important;
|
|
52
|
+
`;
|
|
53
|
+
exports.StyledRadioButtonPseudoCheckBox = StyledRadioButtonPseudoCheckBox;
|
|
54
|
+
const StyledRadioButtonCheckBoxMark = _styledComponents.default.span`
|
|
55
|
+
cursor: pointer;
|
|
56
|
+
background-color: transparent;
|
|
57
|
+
position: absolute;
|
|
58
|
+
top: 0;
|
|
59
|
+
left: 2.925px;
|
|
60
|
+
display: inline-block;
|
|
61
|
+
transform: rotate(35deg);
|
|
62
|
+
height: 9px;
|
|
63
|
+
width: 5px;
|
|
64
|
+
border-bottom: 2px solid white;
|
|
65
|
+
border-right: 2px solid white;
|
|
66
|
+
border-top: transparent;
|
|
67
|
+
border-left: transparent;
|
|
68
|
+
z-index: 2;
|
|
69
|
+
|
|
70
|
+
${_ref4 => {
|
|
71
|
+
let {
|
|
72
|
+
isHovered,
|
|
73
|
+
isSelected
|
|
74
|
+
} = _ref4;
|
|
75
|
+
if (isSelected) {
|
|
76
|
+
return (0, _styledComponents.css)`
|
|
77
|
+
opacity: 1;
|
|
78
|
+
`;
|
|
79
|
+
}
|
|
80
|
+
if (isHovered) {
|
|
81
|
+
return (0, _styledComponents.css)`
|
|
82
|
+
opacity: 0.5;
|
|
83
|
+
`;
|
|
84
|
+
}
|
|
85
|
+
return (0, _styledComponents.css)`
|
|
86
|
+
opacity: 0;
|
|
87
|
+
`;
|
|
88
|
+
}}
|
|
89
|
+
`;
|
|
90
|
+
exports.StyledRadioButtonCheckBoxMark = StyledRadioButtonCheckBoxMark;
|
|
91
|
+
const StyledRadioButtonLabel = _styledComponents.default.p`
|
|
92
|
+
color: ${_ref5 => {
|
|
93
|
+
let {
|
|
94
|
+
theme
|
|
95
|
+
} = _ref5;
|
|
96
|
+
return theme.text;
|
|
97
|
+
}};
|
|
98
|
+
`;
|
|
99
|
+
exports.StyledRadioButtonLabel = StyledRadioButtonLabel;
|
|
100
|
+
//# sourceMappingURL=RadioButton.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioButton.styles.js","names":["_styledComponents","_interopRequireWildcard","require","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","StyledRadioButton","styled","span","_ref","isDisabled","_ref2","exports","StyledRadioButtonCheckBox","input","StyledRadioButtonPseudoCheckBox","div","_ref3","theme","isChecked","secondary","StyledRadioButtonCheckBoxMark","_ref4","isHovered","isSelected","css","StyledRadioButtonLabel","p","_ref5","text"],"sources":["../../../src/components/radio-button/RadioButton.styles.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\n\ntype StyledRadioButtonProps = WithTheme<{ isDisabled: boolean }>;\n\nexport const StyledRadioButton = styled.span<StyledRadioButtonProps>`\n display: flex;\n gap: 5px;\n user-select: none;\n width: fit-content;\n align-items: center;\n position: relative;\n cursor: ${({ isDisabled }: StyledRadioButtonProps) =>\n isDisabled ? 'default !important' : 'pointer'};\n opacity: ${({ isDisabled }: StyledRadioButtonProps) => (isDisabled ? 0.5 : 1)};\n`;\n\ntype StyledRadioButtonCheckBoxProps = WithTheme<unknown>;\n\nexport const StyledRadioButtonCheckBox = styled.input<StyledRadioButtonCheckBoxProps>`\n opacity: 0;\n`;\n\ntype StyledRadioButtonPseudoCheckBoxProps = WithTheme<{ isChecked: boolean }>;\n\nexport const StyledRadioButtonPseudoCheckBox = styled.div<StyledRadioButtonPseudoCheckBoxProps>`\n background-color: ${({ theme, isChecked }: StyledRadioButtonPseudoCheckBoxProps) =>\n isChecked ? theme.secondary : theme['secondary-103']};\n opacity: 0.5;\n border: 1px solid rgba(160, 160, 160, 0.3);\n width: 13px;\n height: 13px;\n position: absolute;\n border-radius: 100%;\n top: 22%;\n left: -1%;\n cursor: pointer !important;\n`;\n\ntype StyledRadioButtonCheckBoxMarkProps = WithTheme<{\n isHovered: boolean;\n isSelected: boolean;\n}>;\n\nexport const StyledRadioButtonCheckBoxMark = styled.span<StyledRadioButtonCheckBoxMarkProps>`\n cursor: pointer;\n background-color: transparent;\n position: absolute;\n top: 0;\n left: 2.925px;\n display: inline-block;\n transform: rotate(35deg);\n height: 9px;\n width: 5px;\n border-bottom: 2px solid white;\n border-right: 2px solid white;\n border-top: transparent;\n border-left: transparent;\n z-index: 2;\n\n ${({ isHovered, isSelected }) => {\n if (isSelected) {\n return css`\n opacity: 1;\n `;\n }\n\n if (isHovered) {\n return css`\n opacity: 0.5;\n `;\n }\n\n return css`\n opacity: 0;\n `;\n }}\n`;\n\ntype StyledRadioButtonLabelProps = WithTheme<unknown>;\n\nexport const StyledRadioButtonLabel = styled.p<StyledRadioButtonLabelProps>`\n color: ${({ theme }: StyledRadioButtonLabelProps) => theme.text};\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAgD,SAAAC,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,SAAAH,wBAAAO,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA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6B,GAAGd,yBAAM,CAACC,IAAyC;AAC7F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMc,KAAA,IAA+B;EAAA,IAA9B;IAAEC,SAAS;IAAEC;EAAW,CAAC,GAAAF,KAAA;EACxB,IAAIE,UAAU,EAAE;IACZ,OAAO,IAAAC,qBAAG,CAAC;AACvB;AACA,aAAa;EACL;EAEA,IAAIF,SAAS,EAAE;IACX,OAAO,IAAAE,qBAAG,CAAC;AACvB;AACA,aAAa;EACL;EAEA,OAAO,IAAAA,qBAAG,CAAC;AACnB;AACA,SAAS;AACL,CAAE;AACN,CAAC;AAACb,OAAA,CAAAS,6BAAA,GAAAA,6BAAA;AAIK,MAAMK,sBAAsB,GAAGnB,yBAAM,CAACoB,CAA+B;AAC5E,aAAaC,KAAA;EAAA,IAAC;IAAEV;EAAmC,CAAC,GAAAU,KAAA;EAAA,OAAKV,KAAK,CAACW,IAAI;AAAA,CAAC;AACpE,CAAC;AAACjB,OAAA,CAAAc,sBAAA,GAAAA,sBAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { Dispatch, FC, ReactNode, SetStateAction } from 'react';
|
|
2
|
+
import type { RadioButtonItem } from '../types';
|
|
3
|
+
type IUpdateSelectedRadioButtonId = (id: string) => void;
|
|
4
|
+
interface IRadioButtonGroupContext {
|
|
5
|
+
selectedRadioButtonId: string | undefined;
|
|
6
|
+
setSelectedRadioButtonId?: Dispatch<SetStateAction<string | undefined>>;
|
|
7
|
+
updateSelectedRadioButtonId?: IUpdateSelectedRadioButtonId;
|
|
8
|
+
}
|
|
9
|
+
export declare const RadioButtonGroupContext: React.Context<IRadioButtonGroupContext>;
|
|
10
|
+
export type RadioButtonGroupProps = {
|
|
11
|
+
/**
|
|
12
|
+
* The RadioButtons that should be grouped. Radio buttons with the same group are
|
|
13
|
+
* automatically unchecked when an `RadioButton` of the group is checked.
|
|
14
|
+
*/
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* Function to be executed when a button is checked.
|
|
18
|
+
*/
|
|
19
|
+
onChange?: (item: RadioButtonItem) => void;
|
|
20
|
+
};
|
|
21
|
+
declare const RadioButtonGroup: FC<RadioButtonGroupProps>;
|
|
22
|
+
export default RadioButtonGroup;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.RadioButtonGroupContext = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
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); }
|
|
9
|
+
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; }
|
|
10
|
+
const RadioButtonGroupContext = /*#__PURE__*/_react.default.createContext({
|
|
11
|
+
selectedRadioButtonId: undefined,
|
|
12
|
+
setSelectedRadioButtonId: undefined,
|
|
13
|
+
updateSelectedRadioButtonId: undefined
|
|
14
|
+
});
|
|
15
|
+
exports.RadioButtonGroupContext = RadioButtonGroupContext;
|
|
16
|
+
RadioButtonGroupContext.displayName = 'RadioButtonGroupContext';
|
|
17
|
+
const RadioButtonGroup = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
children,
|
|
20
|
+
onChange
|
|
21
|
+
} = _ref;
|
|
22
|
+
const [selectedRadioButtonId, setSelectedRadioButtonId] = (0, _react.useState)(undefined);
|
|
23
|
+
const isInitialRenderRef = (0, _react.useRef)(true);
|
|
24
|
+
const updateSelectedRadioButtonId = (0, _react.useCallback)(id => {
|
|
25
|
+
setSelectedRadioButtonId(currentSelectedRadioButtonId => {
|
|
26
|
+
if (currentSelectedRadioButtonId === id) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
return id;
|
|
30
|
+
});
|
|
31
|
+
}, []);
|
|
32
|
+
(0, _react.useEffect)(() => {
|
|
33
|
+
if (isInitialRenderRef.current) {
|
|
34
|
+
isInitialRenderRef.current = false;
|
|
35
|
+
} else if (typeof selectedRadioButtonId === 'string') {
|
|
36
|
+
if (typeof onChange === 'function') {
|
|
37
|
+
onChange({
|
|
38
|
+
id: selectedRadioButtonId !== null && selectedRadioButtonId !== void 0 ? selectedRadioButtonId : '',
|
|
39
|
+
isChecked: true
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}, [onChange, selectedRadioButtonId]);
|
|
44
|
+
const providerValue = (0, _react.useMemo)(() => ({
|
|
45
|
+
selectedRadioButtonId,
|
|
46
|
+
setSelectedRadioButtonId,
|
|
47
|
+
updateSelectedRadioButtonId
|
|
48
|
+
}), [selectedRadioButtonId, updateSelectedRadioButtonId]);
|
|
49
|
+
return /*#__PURE__*/_react.default.createElement(RadioButtonGroupContext.Provider, {
|
|
50
|
+
value: providerValue
|
|
51
|
+
}, children);
|
|
52
|
+
};
|
|
53
|
+
RadioButtonGroup.displayName = 'RadioButtonGroup';
|
|
54
|
+
var _default = RadioButtonGroup;
|
|
55
|
+
exports.default = _default;
|
|
56
|
+
//# sourceMappingURL=RadioButtonGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioButtonGroup.js","names":["_react","_interopRequireWildcard","require","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","RadioButtonGroupContext","React","createContext","selectedRadioButtonId","undefined","setSelectedRadioButtonId","updateSelectedRadioButtonId","exports","displayName","RadioButtonGroup","_ref","children","onChange","useState","isInitialRenderRef","useRef","useCallback","id","currentSelectedRadioButtonId","useEffect","current","isChecked","providerValue","useMemo","createElement","Provider","value","_default"],"sources":["../../../../src/components/radio-button/radio-button-group/RadioButtonGroup.tsx"],"sourcesContent":["import React, {\n Dispatch,\n FC,\n ReactNode,\n SetStateAction,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport type { RadioButtonItem } from '../types';\n\ntype IUpdateSelectedRadioButtonId = (id: string) => void;\n\ninterface IRadioButtonGroupContext {\n selectedRadioButtonId: string | undefined;\n setSelectedRadioButtonId?: Dispatch<SetStateAction<string | undefined>>;\n updateSelectedRadioButtonId?: IUpdateSelectedRadioButtonId;\n}\n\nexport const RadioButtonGroupContext = React.createContext<IRadioButtonGroupContext>({\n selectedRadioButtonId: undefined,\n setSelectedRadioButtonId: undefined,\n updateSelectedRadioButtonId: undefined,\n});\n\nRadioButtonGroupContext.displayName = 'RadioButtonGroupContext';\n\nexport type RadioButtonGroupProps = {\n /**\n * The RadioButtons that should be grouped. Radio buttons with the same group are\n * automatically unchecked when an `RadioButton` of the group is checked.\n */\n children: ReactNode;\n /**\n * Function to be executed when a button is checked.\n */\n onChange?: (item: RadioButtonItem) => void;\n};\n\nconst RadioButtonGroup: FC<RadioButtonGroupProps> = ({ children, onChange }) => {\n const [selectedRadioButtonId, setSelectedRadioButtonId] =\n useState<IRadioButtonGroupContext['selectedRadioButtonId']>(undefined);\n\n const isInitialRenderRef = useRef(true);\n\n const updateSelectedRadioButtonId = useCallback<IUpdateSelectedRadioButtonId>((id) => {\n setSelectedRadioButtonId((currentSelectedRadioButtonId) => {\n if (currentSelectedRadioButtonId === id) {\n return undefined;\n }\n\n return id;\n });\n }, []);\n\n useEffect(() => {\n if (isInitialRenderRef.current) {\n isInitialRenderRef.current = false;\n } else if (typeof selectedRadioButtonId === 'string') {\n if (typeof onChange === 'function') {\n onChange({ id: selectedRadioButtonId ?? '', isChecked: true });\n }\n }\n }, [onChange, selectedRadioButtonId]);\n\n const providerValue = useMemo<IRadioButtonGroupContext>(\n () => ({\n selectedRadioButtonId,\n setSelectedRadioButtonId,\n updateSelectedRadioButtonId,\n }),\n [selectedRadioButtonId, updateSelectedRadioButtonId]\n );\n\n return (\n <RadioButtonGroupContext.Provider value={providerValue}>\n {children}\n </RadioButtonGroupContext.Provider>\n );\n};\n\nRadioButtonGroup.displayName = 'RadioButtonGroup';\n\nexport default RadioButtonGroup;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAUe,SAAAC,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,SAAAH,wBAAAO,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAA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