@os-design/core 1.0.156 → 1.0.158
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/dist/cjs/Alert/index.js +4 -30
- package/dist/cjs/Alert/index.js.map +1 -1
- package/dist/cjs/Avatar/index.js +15 -39
- package/dist/cjs/Avatar/index.js.map +1 -1
- package/dist/cjs/Avatar/utils/nameToInitials.js +1 -3
- package/dist/cjs/Avatar/utils/nameToInitials.js.map +1 -1
- package/dist/cjs/Avatar/utils/strToHue.js +0 -4
- package/dist/cjs/Avatar/utils/strToHue.js.map +1 -1
- package/dist/cjs/AvatarSkeleton/index.js +3 -20
- package/dist/cjs/AvatarSkeleton/index.js.map +1 -1
- package/dist/cjs/Breadcrumb/index.js +4 -30
- package/dist/cjs/Breadcrumb/index.js.map +1 -1
- package/dist/cjs/BreadcrumbItem/index.js +8 -28
- package/dist/cjs/BreadcrumbItem/index.js.map +1 -1
- package/dist/cjs/Button/ButtonContent.js +7 -20
- package/dist/cjs/Button/ButtonContent.js.map +1 -1
- package/dist/cjs/Button/index.js +23 -53
- package/dist/cjs/Button/index.js.map +1 -1
- package/dist/cjs/Button/utils/useButtonColors.js +3 -12
- package/dist/cjs/Button/utils/useButtonColors.js.map +1 -1
- package/dist/cjs/Checkbox/index.js +20 -59
- package/dist/cjs/Checkbox/index.js.map +1 -1
- package/dist/cjs/CheckboxSkeleton/index.js +2 -22
- package/dist/cjs/CheckboxSkeleton/index.js.map +1 -1
- package/dist/cjs/DatePicker/DatePickerCalendar.js +11 -48
- package/dist/cjs/DatePicker/DatePickerCalendar.js.map +1 -1
- package/dist/cjs/DatePicker/index.js +32 -68
- package/dist/cjs/DatePicker/index.js.map +1 -1
- package/dist/cjs/Drawer/index.js +14 -44
- package/dist/cjs/Drawer/index.js.map +1 -1
- package/dist/cjs/Form/FormConfigContext.js +0 -4
- package/dist/cjs/Form/FormConfigContext.js.map +1 -1
- package/dist/cjs/Form/index.js +3 -20
- package/dist/cjs/Form/index.js.map +1 -1
- package/dist/cjs/FormDivider/index.js +3 -24
- package/dist/cjs/FormDivider/index.js.map +1 -1
- package/dist/cjs/FormItem/index.js +12 -42
- package/dist/cjs/FormItem/index.js.map +1 -1
- package/dist/cjs/FormItem/utils/firstChildHasType.js +0 -5
- package/dist/cjs/FormItem/utils/firstChildHasType.js.map +1 -1
- package/dist/cjs/Gallery/Status.js +2 -12
- package/dist/cjs/Gallery/Status.js.map +1 -1
- package/dist/cjs/Gallery/index.js +27 -61
- package/dist/cjs/Gallery/index.js.map +1 -1
- package/dist/cjs/GlobalStyles/index.js +0 -8
- package/dist/cjs/GlobalStyles/index.js.map +1 -1
- package/dist/cjs/GlobalStyles/resetStyles.js +0 -5
- package/dist/cjs/GlobalStyles/resetStyles.js.map +1 -1
- package/dist/cjs/GlobalStyles/typographyStyles.js +0 -11
- package/dist/cjs/GlobalStyles/typographyStyles.js.map +1 -1
- package/dist/cjs/HeaderSkeleton/index.js +7 -26
- package/dist/cjs/HeaderSkeleton/index.js.map +1 -1
- package/dist/cjs/Image/index.js +11 -31
- package/dist/cjs/Image/index.js.map +1 -1
- package/dist/cjs/ImageSkeleton/index.js +1 -12
- package/dist/cjs/ImageSkeleton/index.js.map +1 -1
- package/dist/cjs/Input/index.js +23 -57
- package/dist/cjs/Input/index.js.map +1 -1
- package/dist/cjs/Input/utils/getFocusableElements.js +0 -8
- package/dist/cjs/Input/utils/getFocusableElements.js.map +1 -1
- package/dist/cjs/InputNumber/index.js +49 -72
- package/dist/cjs/InputNumber/index.js.map +1 -1
- package/dist/cjs/InputNumber/utils/defaultLocale.js.map +1 -1
- package/dist/cjs/InputPassword/index.js +39 -77
- package/dist/cjs/InputPassword/index.js.map +1 -1
- package/dist/cjs/InputPassword/utils/defaultLocale.js.map +1 -1
- package/dist/cjs/InputSearch/index.js +22 -51
- package/dist/cjs/InputSearch/index.js.map +1 -1
- package/dist/cjs/InputSearch/utils/defaultLocale.js.map +1 -1
- package/dist/cjs/InputSkeleton/index.js +1 -14
- package/dist/cjs/InputSkeleton/index.js.map +1 -1
- package/dist/cjs/Layout/LayoutContext.js +0 -4
- package/dist/cjs/Layout/LayoutContext.js.map +1 -1
- package/dist/cjs/Layout/index.js +4 -12
- package/dist/cjs/Layout/index.js.map +1 -1
- package/dist/cjs/Link/index.js +8 -30
- package/dist/cjs/Link/index.js.map +1 -1
- package/dist/cjs/LinkButton/index.js +26 -49
- package/dist/cjs/LinkButton/index.js.map +1 -1
- package/dist/cjs/List/WindowScroller.js +4 -12
- package/dist/cjs/List/WindowScroller.js.map +1 -1
- package/dist/cjs/List/index.js +35 -68
- package/dist/cjs/List/index.js.map +1 -1
- package/dist/cjs/List/utils/bodyPointerEvents.js +0 -9
- package/dist/cjs/List/utils/bodyPointerEvents.js.map +1 -1
- package/dist/cjs/List/utils/frameTimeout.js +1 -8
- package/dist/cjs/List/utils/frameTimeout.js.map +1 -1
- package/dist/cjs/List/utils/useRWLoadNext.js +6 -9
- package/dist/cjs/List/utils/useRWLoadNext.js.map +1 -1
- package/dist/cjs/ListItem/ListItemContent.js +12 -44
- package/dist/cjs/ListItem/ListItemContent.js.map +1 -1
- package/dist/cjs/ListItem/index.js +15 -39
- package/dist/cjs/ListItem/index.js.map +1 -1
- package/dist/cjs/ListItemLink/index.js +18 -51
- package/dist/cjs/ListItemLink/index.js.map +1 -1
- package/dist/cjs/ListSkeleton/index.js +11 -32
- package/dist/cjs/ListSkeleton/index.js.map +1 -1
- package/dist/cjs/LogoLink/index.js +6 -27
- package/dist/cjs/LogoLink/index.js.map +1 -1
- package/dist/cjs/Menu/index.js +20 -47
- package/dist/cjs/Menu/index.js.map +1 -1
- package/dist/cjs/Menu/utils/useFocusWithArrows.js +1 -13
- package/dist/cjs/Menu/utils/useFocusWithArrows.js.map +1 -1
- package/dist/cjs/MenuDivider/index.js +1 -13
- package/dist/cjs/MenuDivider/index.js.map +1 -1
- package/dist/cjs/MenuGroup/index.js +19 -52
- package/dist/cjs/MenuGroup/index.js.map +1 -1
- package/dist/cjs/MenuItem/index.js +9 -32
- package/dist/cjs/MenuItem/index.js.map +1 -1
- package/dist/cjs/Modal/index.js +25 -65
- package/dist/cjs/Modal/index.js.map +1 -1
- package/dist/cjs/Modal/utils/defaultLocale.js.map +1 -1
- package/dist/cjs/Navigation/index.js +6 -35
- package/dist/cjs/Navigation/index.js.map +1 -1
- package/dist/cjs/Navigation/utils/useScrollFlags.js +6 -19
- package/dist/cjs/Navigation/utils/useScrollFlags.js.map +1 -1
- package/dist/cjs/NavigationItem/index.js +8 -32
- package/dist/cjs/NavigationItem/index.js.map +1 -1
- package/dist/cjs/PageContent/index.js +6 -30
- package/dist/cjs/PageContent/index.js.map +1 -1
- package/dist/cjs/PageHeader/index.js +13 -46
- package/dist/cjs/PageHeader/index.js.map +1 -1
- package/dist/cjs/PageHeader/utils/defaultLocale.js.map +1 -1
- package/dist/cjs/PageHeaderInputSearch/index.js +10 -46
- package/dist/cjs/PageHeaderInputSearch/index.js.map +1 -1
- package/dist/cjs/PageHeaderInputSearch/utils/defaultLocale.js +0 -7
- package/dist/cjs/PageHeaderInputSearch/utils/defaultLocale.js.map +1 -1
- package/dist/cjs/PageHeaderSkeleton/index.js +3 -18
- package/dist/cjs/PageHeaderSkeleton/index.js.map +1 -1
- package/dist/cjs/ParagraphSkeleton/index.js +7 -25
- package/dist/cjs/ParagraphSkeleton/index.js.map +1 -1
- package/dist/cjs/Popover/index.js +46 -77
- package/dist/cjs/Popover/index.js.map +1 -1
- package/dist/cjs/Popover/utils/usePopoverPosition.js +21 -43
- package/dist/cjs/Popover/utils/usePopoverPosition.js.map +1 -1
- package/dist/cjs/Progress/index.js +6 -25
- package/dist/cjs/Progress/index.js.map +1 -1
- package/dist/cjs/RadioGroup/index.js +25 -55
- package/dist/cjs/RadioGroup/index.js.map +1 -1
- package/dist/cjs/RadioGroupSkeleton/index.js +3 -20
- package/dist/cjs/RadioGroupSkeleton/index.js.map +1 -1
- package/dist/cjs/Result/index.js +6 -30
- package/dist/cjs/Result/index.js.map +1 -1
- package/dist/cjs/ScrollButton/index.js +15 -40
- package/dist/cjs/ScrollButton/index.js.map +1 -1
- package/dist/cjs/ScrollButton/utils/useContainerPosition.js +10 -23
- package/dist/cjs/ScrollButton/utils/useContainerPosition.js.map +1 -1
- package/dist/cjs/ScrollButton/utils/useVisibility.js +6 -19
- package/dist/cjs/ScrollButton/utils/useVisibility.js.map +1 -1
- package/dist/cjs/Select/SelectList.js +27 -53
- package/dist/cjs/Select/SelectList.js.map +1 -1
- package/dist/cjs/Select/SelectToggle.js +17 -52
- package/dist/cjs/Select/SelectToggle.js.map +1 -1
- package/dist/cjs/Select/index.js +60 -103
- package/dist/cjs/Select/index.js.map +1 -1
- package/dist/cjs/Select/utils/defaultLocale.js.map +1 -1
- package/dist/cjs/Skeleton/index.js +3 -20
- package/dist/cjs/Skeleton/index.js.map +1 -1
- package/dist/cjs/Switch/index.js +17 -52
- package/dist/cjs/Switch/index.js.map +1 -1
- package/dist/cjs/SwitchSkeleton/index.js +1 -14
- package/dist/cjs/SwitchSkeleton/index.js.map +1 -1
- package/dist/cjs/Tag/index.js +4 -26
- package/dist/cjs/Tag/index.js.map +1 -1
- package/dist/cjs/TagLink/index.js +7 -25
- package/dist/cjs/TagLink/index.js.map +1 -1
- package/dist/cjs/TagList/index.js +8 -38
- package/dist/cjs/TagList/index.js.map +1 -1
- package/dist/cjs/TagListSkeleton/index.js +4 -17
- package/dist/cjs/TagListSkeleton/index.js.map +1 -1
- package/dist/cjs/TagSkeleton/index.js +3 -20
- package/dist/cjs/TagSkeleton/index.js.map +1 -1
- package/dist/cjs/TextArea/index.js +6 -21
- package/dist/cjs/TextArea/index.js.map +1 -1
- package/dist/cjs/TextAreaSkeleton/index.js +1 -12
- package/dist/cjs/TextAreaSkeleton/index.js.map +1 -1
- package/dist/cjs/ThemeSwitcher/index.js +4 -20
- package/dist/cjs/ThemeSwitcher/index.js.map +1 -1
- package/dist/cjs/TimePicker/index.js +140 -0
- package/dist/cjs/TimePicker/index.js.map +1 -0
- package/dist/cjs/Video/index.js +2 -18
- package/dist/cjs/Video/index.js.map +1 -1
- package/dist/cjs/index.js +0 -126
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/message/AlertIcon.js +15 -26
- package/dist/cjs/message/AlertIcon.js.map +1 -1
- package/dist/cjs/message/Message.js +1 -17
- package/dist/cjs/message/Message.js.map +1 -1
- package/dist/cjs/message/index.js +7 -21
- package/dist/cjs/message/index.js.map +1 -1
- package/dist/cjs/message/styles.js +2 -12
- package/dist/cjs/message/styles.js.map +1 -1
- package/dist/esm/Alert/index.js +1 -10
- package/dist/esm/Alert/index.js.map +1 -1
- package/dist/esm/Avatar/index.js +5 -4
- package/dist/esm/Avatar/index.js.map +1 -1
- package/dist/esm/Avatar/utils/nameToInitials.js +0 -1
- package/dist/esm/Avatar/utils/nameToInitials.js.map +1 -1
- package/dist/esm/Avatar/utils/strToHue.js +0 -3
- package/dist/esm/Avatar/utils/strToHue.js.map +1 -1
- package/dist/esm/AvatarSkeleton/index.js +1 -2
- package/dist/esm/AvatarSkeleton/index.js.map +1 -1
- package/dist/esm/Breadcrumb/index.js +3 -5
- package/dist/esm/Breadcrumb/index.js.map +1 -1
- package/dist/esm/BreadcrumbItem/index.js +1 -2
- package/dist/esm/BreadcrumbItem/index.js.map +1 -1
- package/dist/esm/Button/ButtonContent.js +2 -2
- package/dist/esm/Button/ButtonContent.js.map +1 -1
- package/dist/esm/Button/index.js +1 -10
- package/dist/esm/Button/index.js.map +1 -1
- package/dist/esm/Button/utils/useButtonColors.js +0 -5
- package/dist/esm/Button/utils/useButtonColors.js.map +1 -1
- package/dist/esm/Checkbox/index.js +1 -15
- package/dist/esm/Checkbox/index.js.map +1 -1
- package/dist/esm/CheckboxSkeleton/index.js +1 -2
- package/dist/esm/CheckboxSkeleton/index.js.map +1 -1
- package/dist/esm/DatePicker/DatePickerCalendar.js +0 -7
- package/dist/esm/DatePicker/DatePickerCalendar.js.map +1 -1
- package/dist/esm/DatePicker/index.js +0 -5
- package/dist/esm/DatePicker/index.js.map +1 -1
- package/dist/esm/Drawer/index.js +1 -7
- package/dist/esm/Drawer/index.js.map +1 -1
- package/dist/esm/Form/FormConfigContext.js.map +1 -1
- package/dist/esm/Form/index.js +1 -2
- package/dist/esm/Form/index.js.map +1 -1
- package/dist/esm/FormDivider/index.js +1 -2
- package/dist/esm/FormDivider/index.js.map +1 -1
- package/dist/esm/FormItem/index.js +1 -4
- package/dist/esm/FormItem/index.js.map +1 -1
- package/dist/esm/FormItem/utils/firstChildHasType.js +0 -2
- package/dist/esm/FormItem/utils/firstChildHasType.js.map +1 -1
- package/dist/esm/Gallery/Status.js +0 -2
- package/dist/esm/Gallery/Status.js.map +1 -1
- package/dist/esm/Gallery/index.js +3 -7
- package/dist/esm/Gallery/index.js.map +1 -1
- package/dist/esm/GlobalStyles/index.js +0 -2
- package/dist/esm/GlobalStyles/index.js.map +1 -1
- package/dist/esm/GlobalStyles/resetStyles.js +0 -2
- package/dist/esm/GlobalStyles/resetStyles.js.map +1 -1
- package/dist/esm/GlobalStyles/typographyStyles.js +0 -4
- package/dist/esm/GlobalStyles/typographyStyles.js.map +1 -1
- package/dist/esm/HeaderSkeleton/index.js +1 -4
- package/dist/esm/HeaderSkeleton/index.js.map +1 -1
- package/dist/esm/Image/index.js +1 -6
- package/dist/esm/Image/index.js.map +1 -1
- package/dist/esm/ImageSkeleton/index.js +1 -2
- package/dist/esm/ImageSkeleton/index.js.map +1 -1
- package/dist/esm/Input/index.js +1 -10
- package/dist/esm/Input/index.js.map +1 -1
- package/dist/esm/Input/utils/getFocusableElements.js +0 -1
- package/dist/esm/Input/utils/getFocusableElements.js.map +1 -1
- package/dist/esm/InputNumber/index.js +10 -7
- package/dist/esm/InputNumber/index.js.map +1 -1
- package/dist/esm/InputNumber/utils/defaultLocale.js.map +1 -1
- package/dist/esm/InputPassword/index.js +3 -8
- package/dist/esm/InputPassword/index.js.map +1 -1
- package/dist/esm/InputPassword/utils/defaultLocale.js.map +1 -1
- package/dist/esm/InputSearch/index.js +1 -2
- package/dist/esm/InputSearch/index.js.map +1 -1
- package/dist/esm/InputSearch/utils/defaultLocale.js.map +1 -1
- package/dist/esm/InputSkeleton/index.js +1 -2
- package/dist/esm/InputSkeleton/index.js.map +1 -1
- package/dist/esm/Layout/LayoutContext.js.map +1 -1
- package/dist/esm/Layout/index.js +0 -2
- package/dist/esm/Layout/index.js.map +1 -1
- package/dist/esm/Link/index.js +3 -8
- package/dist/esm/Link/index.js.map +1 -1
- package/dist/esm/LinkButton/index.js +1 -4
- package/dist/esm/LinkButton/index.js.map +1 -1
- package/dist/esm/List/WindowScroller.js +2 -4
- package/dist/esm/List/WindowScroller.js.map +1 -1
- package/dist/esm/List/index.js +10 -9
- package/dist/esm/List/index.js.map +1 -1
- package/dist/esm/List/utils/bodyPointerEvents.js +0 -1
- package/dist/esm/List/utils/bodyPointerEvents.js.map +1 -1
- package/dist/esm/List/utils/frameTimeout.js +1 -4
- package/dist/esm/List/utils/frameTimeout.js.map +1 -1
- package/dist/esm/List/utils/useRWLoadNext.js +0 -2
- package/dist/esm/List/utils/useRWLoadNext.js.map +1 -1
- package/dist/esm/ListItem/ListItemContent.js +2 -6
- package/dist/esm/ListItem/ListItemContent.js.map +1 -1
- package/dist/esm/ListItem/index.js +1 -2
- package/dist/esm/ListItem/index.js.map +1 -1
- package/dist/esm/ListItemLink/index.js +1 -4
- package/dist/esm/ListItemLink/index.js.map +1 -1
- package/dist/esm/ListSkeleton/index.js +1 -2
- package/dist/esm/ListSkeleton/index.js.map +1 -1
- package/dist/esm/LogoLink/index.js +1 -4
- package/dist/esm/LogoLink/index.js.map +1 -1
- package/dist/esm/Menu/index.js +3 -3
- package/dist/esm/Menu/index.js.map +1 -1
- package/dist/esm/Menu/utils/useFocusWithArrows.js +0 -4
- package/dist/esm/Menu/utils/useFocusWithArrows.js.map +1 -1
- package/dist/esm/MenuDivider/index.js +1 -2
- package/dist/esm/MenuDivider/index.js.map +1 -1
- package/dist/esm/MenuGroup/index.js +1 -2
- package/dist/esm/MenuGroup/index.js.map +1 -1
- package/dist/esm/MenuItem/index.js +1 -4
- package/dist/esm/MenuItem/index.js.map +1 -1
- package/dist/esm/Modal/index.js +1 -8
- package/dist/esm/Modal/index.js.map +1 -1
- package/dist/esm/Modal/utils/defaultLocale.js.map +1 -1
- package/dist/esm/Navigation/index.js +1 -7
- package/dist/esm/Navigation/index.js.map +1 -1
- package/dist/esm/Navigation/utils/useScrollFlags.js +0 -2
- package/dist/esm/Navigation/utils/useScrollFlags.js.map +1 -1
- package/dist/esm/NavigationItem/index.js +1 -4
- package/dist/esm/NavigationItem/index.js.map +1 -1
- package/dist/esm/PageContent/index.js +1 -7
- package/dist/esm/PageContent/index.js.map +1 -1
- package/dist/esm/PageHeader/index.js +1 -8
- package/dist/esm/PageHeader/index.js.map +1 -1
- package/dist/esm/PageHeader/utils/defaultLocale.js.map +1 -1
- package/dist/esm/PageHeaderInputSearch/index.js +1 -5
- package/dist/esm/PageHeaderInputSearch/index.js.map +1 -1
- package/dist/esm/PageHeaderInputSearch/utils/defaultLocale.js +2 -1
- package/dist/esm/PageHeaderInputSearch/utils/defaultLocale.js.map +1 -1
- package/dist/esm/PageHeaderSkeleton/index.js +0 -2
- package/dist/esm/PageHeaderSkeleton/index.js.map +1 -1
- package/dist/esm/ParagraphSkeleton/index.js +1 -4
- package/dist/esm/ParagraphSkeleton/index.js.map +1 -1
- package/dist/esm/Popover/index.js +12 -13
- package/dist/esm/Popover/index.js.map +1 -1
- package/dist/esm/Popover/utils/usePopoverPosition.js +8 -19
- package/dist/esm/Popover/utils/usePopoverPosition.js.map +1 -1
- package/dist/esm/Progress/index.js +1 -2
- package/dist/esm/Progress/index.js.map +1 -1
- package/dist/esm/RadioGroup/index.js +1 -5
- package/dist/esm/RadioGroup/index.js.map +1 -1
- package/dist/esm/RadioGroupSkeleton/index.js +1 -2
- package/dist/esm/RadioGroupSkeleton/index.js.map +1 -1
- package/dist/esm/Result/index.js +1 -2
- package/dist/esm/Result/index.js.map +1 -1
- package/dist/esm/ScrollButton/index.js +7 -9
- package/dist/esm/ScrollButton/index.js.map +1 -1
- package/dist/esm/ScrollButton/utils/useContainerPosition.js +0 -2
- package/dist/esm/ScrollButton/utils/useContainerPosition.js.map +1 -1
- package/dist/esm/ScrollButton/utils/useVisibility.js +2 -5
- package/dist/esm/ScrollButton/utils/useVisibility.js.map +1 -1
- package/dist/esm/Select/SelectList.js +11 -12
- package/dist/esm/Select/SelectList.js.map +1 -1
- package/dist/esm/Select/SelectToggle.js +0 -14
- package/dist/esm/Select/SelectToggle.js.map +1 -1
- package/dist/esm/Select/index.js +4 -10
- package/dist/esm/Select/index.js.map +1 -1
- package/dist/esm/Select/utils/defaultLocale.js.map +1 -1
- package/dist/esm/Skeleton/index.js +1 -2
- package/dist/esm/Skeleton/index.js.map +1 -1
- package/dist/esm/Switch/index.js +1 -11
- package/dist/esm/Switch/index.js.map +1 -1
- package/dist/esm/SwitchSkeleton/index.js +1 -2
- package/dist/esm/SwitchSkeleton/index.js.map +1 -1
- package/dist/esm/Tag/index.js +1 -2
- package/dist/esm/Tag/index.js.map +1 -1
- package/dist/esm/TagLink/index.js +1 -2
- package/dist/esm/TagLink/index.js.map +1 -1
- package/dist/esm/TagList/index.js +1 -4
- package/dist/esm/TagList/index.js.map +1 -1
- package/dist/esm/TagListSkeleton/index.js +1 -2
- package/dist/esm/TagListSkeleton/index.js.map +1 -1
- package/dist/esm/TagSkeleton/index.js +1 -2
- package/dist/esm/TagSkeleton/index.js.map +1 -1
- package/dist/esm/TextArea/index.js +1 -2
- package/dist/esm/TextArea/index.js.map +1 -1
- package/dist/esm/TextAreaSkeleton/index.js +1 -2
- package/dist/esm/TextAreaSkeleton/index.js.map +1 -1
- package/dist/esm/ThemeSwitcher/index.js +0 -2
- package/dist/esm/ThemeSwitcher/index.js.map +1 -1
- package/dist/esm/TimePicker/index.js +105 -0
- package/dist/esm/TimePicker/index.js.map +1 -0
- package/dist/esm/Video/index.js +1 -2
- package/dist/esm/Video/index.js.map +1 -1
- package/dist/esm/emotion.d.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/message/AlertIcon.js +0 -2
- package/dist/esm/message/AlertIcon.js.map +1 -1
- package/dist/esm/message/Message.js.map +1 -1
- package/dist/esm/message/index.js +7 -9
- package/dist/esm/message/index.js.map +1 -1
- package/dist/esm/message/styles.js.map +1 -1
- package/dist/types/TimePicker/index.d.ts +11 -0
- package/dist/types/TimePicker/index.d.ts.map +1 -0
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["StyledRadioGroupSkeleton","styled","Skeleton","omitEmotionProps","p","theme","baseHeight","sizeStyles","RadioGroupSkeleton","forwardRef","ref","width","rest","displayName"],"sources":["../../../src/RadioGroupSkeleton/index.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport React, { forwardRef } from 'react';\nimport { sizeStyles, WithSize } from '@os-design/styles';\nimport { omitEmotionProps } from '@os-design/utils';\nimport Skeleton, { SkeletonProps } from '../Skeleton';\n\nexport interface RadioGroupSkeletonProps extends SkeletonProps, WithSize {\n /**\n * The width of the skeleton.\n * @default 10em\n */\n width?: string;\n}\n\nconst StyledRadioGroupSkeleton = styled(\n Skeleton,\n omitEmotionProps('size')\n)<WithSize>`\n height: calc(${(p) => p.theme.baseHeight}em + 2px);\n ${sizeStyles};\n`;\n\n/**\n * Provides a radio group placeholder while a user waits for the content to load.\n */\nconst RadioGroupSkeleton = forwardRef<HTMLDivElement, RadioGroupSkeletonProps>(\n ({ width = '10em', ...rest }, ref) => (\n <StyledRadioGroupSkeleton width={width} {...rest} ref={ref} />\n )\n);\n\nRadioGroupSkeleton.displayName = 'RadioGroupSkeleton';\n\nexport default RadioGroupSkeleton;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["StyledRadioGroupSkeleton","styled","Skeleton","omitEmotionProps","p","theme","baseHeight","sizeStyles","RadioGroupSkeleton","forwardRef","ref","width","rest","displayName"],"sources":["../../../src/RadioGroupSkeleton/index.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport React, { forwardRef } from 'react';\nimport { sizeStyles, WithSize } from '@os-design/styles';\nimport { omitEmotionProps } from '@os-design/utils';\nimport Skeleton, { SkeletonProps } from '../Skeleton';\n\nexport interface RadioGroupSkeletonProps extends SkeletonProps, WithSize {\n /**\n * The width of the skeleton.\n * @default 10em\n */\n width?: string;\n}\n\nconst StyledRadioGroupSkeleton = styled(\n Skeleton,\n omitEmotionProps('size')\n)<WithSize>`\n height: calc(${(p) => p.theme.baseHeight}em + 2px);\n ${sizeStyles};\n`;\n\n/**\n * Provides a radio group placeholder while a user waits for the content to load.\n */\nconst RadioGroupSkeleton = forwardRef<HTMLDivElement, RadioGroupSkeletonProps>(\n ({ width = '10em', ...rest }, ref) => (\n <StyledRadioGroupSkeleton width={width} {...rest} ref={ref} />\n )\n);\n\nRadioGroupSkeleton.displayName = 'RadioGroupSkeleton';\n\nexport default RadioGroupSkeleton;\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AAAsD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUtD,IAAMA,wBAAwB,GAAG,IAAAC,kBAAM,EACrCC,oBAAQ,EACR,IAAAC,uBAAgB,EAAC,MAAM,CAAC,CACzB,gHACgB,UAACC,CAAC;EAAA,OAAKA,CAAC,CAACC,KAAK,CAACC,UAAU;AAAA,GACtCC,kBAAU,CACb;;AAED;AACA;AACA;AACA,IAAMC,kBAAkB,gBAAG,IAAAC,iBAAU,EACnC,gBAA8BC,GAAG;EAAA,sBAA9BC,KAAK;IAALA,KAAK,2BAAG,MAAM;IAAKC,IAAI;EAAA,oBACxB,gCAAC,wBAAwB;IAAC,KAAK,EAAED;EAAM,GAAKC,IAAI;IAAE,GAAG,EAAEF;EAAI,GAAG;AAAA,CAC/D,CACF;AAEDF,kBAAkB,CAACK,WAAW,GAAG,oBAAoB;AAAC,eAEvCL,kBAAkB;AAAA"}
|
package/dist/cjs/Result/index.js
CHANGED
|
@@ -1,52 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
13
|
-
|
|
14
10
|
var _styles = require("@os-design/styles");
|
|
15
|
-
|
|
16
11
|
var _utils = require("@os-design/utils");
|
|
17
|
-
|
|
18
12
|
var _theming = require("@os-design/theming");
|
|
19
|
-
|
|
20
13
|
var _media = require("@os-design/media");
|
|
21
|
-
|
|
22
14
|
var _excluded = ["title", "description", "icon", "actions", "children"];
|
|
23
|
-
|
|
24
15
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
25
|
-
|
|
26
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
27
|
-
|
|
28
17
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
|
-
|
|
30
18
|
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; }
|
|
31
|
-
|
|
32
19
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
33
|
-
|
|
34
20
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
35
|
-
|
|
36
21
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
37
|
-
|
|
38
22
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
39
|
-
|
|
40
23
|
var Container = (0, _styled["default"])('div', (0, _utils.omitEmotionProps)('size'))(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n align-items: center;\n\n color: ", ";\n padding: 2.6em 0;\n\n ", ";\n"])), function (p) {
|
|
41
24
|
return (0, _theming.clr)(p.theme.colorText);
|
|
42
25
|
}, _styles.sizeStyles);
|
|
43
|
-
|
|
44
26
|
var IconContainer = _styled["default"].div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n font-size: 6em;\n line-height: 1;\n color: ", ";\n margin-bottom: 0.1em;\n"])), function (p) {
|
|
45
27
|
return (0, _theming.clr)(p.theme.resultColorIcon);
|
|
46
28
|
});
|
|
47
|
-
|
|
48
29
|
var Text = _styled["default"].div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n text-align: center;\n max-width: 28em;\n"])));
|
|
49
|
-
|
|
50
30
|
var Title = (0, _styled["default"])(Text)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n font-size: ", "em;\n font-weight: 500;\n"])), function (p) {
|
|
51
31
|
return p.theme.sizes.large;
|
|
52
32
|
});
|
|
@@ -55,24 +35,20 @@ var Description = (0, _styled["default"])(Text)(_templateObject5 || (_templateOb
|
|
|
55
35
|
}, function (p) {
|
|
56
36
|
return (0, _theming.clr)(p.theme.resultColorDescription);
|
|
57
37
|
});
|
|
58
|
-
|
|
59
38
|
var ActiveElements = _styled["default"].div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n margin-top: 2em;\n\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n\n & > *:not(:first-of-type) {\n margin-top: 0.5em;\n }\n\n ", " {\n flex-direction: row;\n\n & > *:not(:first-of-type) {\n margin-top: 0;\n margin-left: 0.5em;\n }\n }\n"])), _media.m.min.sm);
|
|
60
|
-
|
|
61
39
|
var ChildrenContainer = _styled["default"].div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n margin-top: 2em;\n"])));
|
|
40
|
+
|
|
62
41
|
/**
|
|
63
42
|
* Used to give the user feedback instead of results.
|
|
64
43
|
* For example, error happened, results not found, no results yet.
|
|
65
44
|
*/
|
|
66
|
-
|
|
67
|
-
|
|
68
45
|
var Result = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
69
46
|
var title = _ref.title,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
47
|
+
description = _ref.description,
|
|
48
|
+
icon = _ref.icon,
|
|
49
|
+
actions = _ref.actions,
|
|
50
|
+
children = _ref.children,
|
|
51
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
76
52
|
return /*#__PURE__*/_react["default"].createElement(Container, _extends({}, rest, {
|
|
77
53
|
ref: ref
|
|
78
54
|
}), icon && /*#__PURE__*/_react["default"].createElement(IconContainer, null, icon), /*#__PURE__*/_react["default"].createElement(Title, null, title), description && /*#__PURE__*/_react["default"].createElement(Description, null, description), actions && /*#__PURE__*/_react["default"].createElement(ActiveElements, null, actions), children && /*#__PURE__*/_react["default"].createElement(ChildrenContainer, null, children));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Container","styled","omitEmotionProps","p","clr","theme","colorText","sizeStyles","IconContainer","div","resultColorIcon","Text","Title","sizes","large","Description","small","resultColorDescription","ActiveElements","m","min","sm","ChildrenContainer","Result","forwardRef","ref","title","description","icon","actions","children","rest","displayName"],"sources":["../../../src/Result/index.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport styled from '@emotion/styled';\nimport { sizeStyles, WithSize } from '@os-design/styles';\nimport { omitEmotionProps } from '@os-design/utils';\nimport { clr } from '@os-design/theming';\nimport { m } from '@os-design/media';\n\ntype JsxDivProps = Omit<JSX.IntrinsicElements['div'], 'ref'>;\nexport interface ResultProps extends JsxDivProps, WithSize {\n /**\n * The title of the result.\n */\n title: string;\n /**\n * The description that is under the title.\n * @default undefined\n */\n description?: string;\n /**\n * The icon that is located above the title.\n * @default undefined\n */\n icon?: React.ReactElement;\n /**\n * Active elements.\n * @default undefined\n */\n actions?: React.ReactNode;\n}\n\nconst Container = styled('div', omitEmotionProps('size'))<WithSize>`\n display: flex;\n flex-direction: column;\n align-items: center;\n\n color: ${(p) => clr(p.theme.colorText)};\n padding: 2.6em 0;\n\n ${sizeStyles};\n`;\n\nconst IconContainer = styled.div`\n font-size: 6em;\n line-height: 1;\n color: ${(p) => clr(p.theme.resultColorIcon)};\n margin-bottom: 0.1em;\n`;\n\nconst Text = styled.div`\n text-align: center;\n max-width: 28em;\n`;\n\nconst Title = styled(Text)`\n font-size: ${(p) => p.theme.sizes.large}em;\n font-weight: 500;\n`;\n\nconst Description = styled(Text)`\n font-size: ${(p) => p.theme.sizes.small}em;\n color: ${(p) => clr(p.theme.resultColorDescription)};\n margin-top: 0.5em;\n`;\n\nconst ActiveElements = styled.div`\n margin-top: 2em;\n\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n\n & > *:not(:first-of-type) {\n margin-top: 0.5em;\n }\n\n ${m.min.sm} {\n flex-direction: row;\n\n & > *:not(:first-of-type) {\n margin-top: 0;\n margin-left: 0.5em;\n }\n }\n`;\n\nconst ChildrenContainer = styled.div`\n margin-top: 2em;\n`;\n\n/**\n * Used to give the user feedback instead of results.\n * For example, error happened, results not found, no results yet.\n */\nconst Result = forwardRef<HTMLDivElement, ResultProps>(\n ({ title, description, icon, actions, children, ...rest }, ref) => (\n <Container {...rest} ref={ref}>\n {icon && <IconContainer>{icon}</IconContainer>}\n <Title>{title}</Title>\n {description && <Description>{description}</Description>}\n {actions && <ActiveElements>{actions}</ActiveElements>}\n {children && <ChildrenContainer>{children}</ChildrenContainer>}\n </Container>\n )\n);\n\nResult.displayName = 'Result';\n\nexport default Result;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["Container","styled","omitEmotionProps","p","clr","theme","colorText","sizeStyles","IconContainer","div","resultColorIcon","Text","Title","sizes","large","Description","small","resultColorDescription","ActiveElements","m","min","sm","ChildrenContainer","Result","forwardRef","ref","title","description","icon","actions","children","rest","displayName"],"sources":["../../../src/Result/index.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport styled from '@emotion/styled';\nimport { sizeStyles, WithSize } from '@os-design/styles';\nimport { omitEmotionProps } from '@os-design/utils';\nimport { clr } from '@os-design/theming';\nimport { m } from '@os-design/media';\n\ntype JsxDivProps = Omit<JSX.IntrinsicElements['div'], 'ref'>;\nexport interface ResultProps extends JsxDivProps, WithSize {\n /**\n * The title of the result.\n */\n title: string;\n /**\n * The description that is under the title.\n * @default undefined\n */\n description?: string;\n /**\n * The icon that is located above the title.\n * @default undefined\n */\n icon?: React.ReactElement;\n /**\n * Active elements.\n * @default undefined\n */\n actions?: React.ReactNode;\n}\n\nconst Container = styled('div', omitEmotionProps('size'))<WithSize>`\n display: flex;\n flex-direction: column;\n align-items: center;\n\n color: ${(p) => clr(p.theme.colorText)};\n padding: 2.6em 0;\n\n ${sizeStyles};\n`;\n\nconst IconContainer = styled.div`\n font-size: 6em;\n line-height: 1;\n color: ${(p) => clr(p.theme.resultColorIcon)};\n margin-bottom: 0.1em;\n`;\n\nconst Text = styled.div`\n text-align: center;\n max-width: 28em;\n`;\n\nconst Title = styled(Text)`\n font-size: ${(p) => p.theme.sizes.large}em;\n font-weight: 500;\n`;\n\nconst Description = styled(Text)`\n font-size: ${(p) => p.theme.sizes.small}em;\n color: ${(p) => clr(p.theme.resultColorDescription)};\n margin-top: 0.5em;\n`;\n\nconst ActiveElements = styled.div`\n margin-top: 2em;\n\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n\n & > *:not(:first-of-type) {\n margin-top: 0.5em;\n }\n\n ${m.min.sm} {\n flex-direction: row;\n\n & > *:not(:first-of-type) {\n margin-top: 0;\n margin-left: 0.5em;\n }\n }\n`;\n\nconst ChildrenContainer = styled.div`\n margin-top: 2em;\n`;\n\n/**\n * Used to give the user feedback instead of results.\n * For example, error happened, results not found, no results yet.\n */\nconst Result = forwardRef<HTMLDivElement, ResultProps>(\n ({ title, description, icon, actions, children, ...rest }, ref) => (\n <Container {...rest} ref={ref}>\n {icon && <IconContainer>{icon}</IconContainer>}\n <Title>{title}</Title>\n {description && <Description>{description}</Description>}\n {actions && <ActiveElements>{actions}</ActiveElements>}\n {children && <ChildrenContainer>{children}</ChildrenContainer>}\n </Container>\n )\n);\n\nResult.displayName = 'Result';\n\nexport default Result;\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AAAqC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAyBrC,IAAMA,SAAS,GAAG,IAAAC,kBAAM,EAAC,KAAK,EAAE,IAAAC,uBAAgB,EAAC,MAAM,CAAC,CAAC,+LAK9C,UAACC,CAAC;EAAA,OAAK,IAAAC,YAAG,EAACD,CAAC,CAACE,KAAK,CAACC,SAAS,CAAC;AAAA,GAGpCC,kBAAU,CACb;AAED,IAAMC,aAAa,GAAGP,kBAAM,CAACQ,GAAG,yJAGrB,UAACN,CAAC;EAAA,OAAK,IAAAC,YAAG,EAACD,CAAC,CAACE,KAAK,CAACK,eAAe,CAAC;AAAA,EAE7C;AAED,IAAMC,IAAI,GAAGV,kBAAM,CAACQ,GAAG,oHAGtB;AAED,IAAMG,KAAK,GAAG,IAAAX,kBAAM,EAACU,IAAI,CAAC,qHACX,UAACR,CAAC;EAAA,OAAKA,CAAC,CAACE,KAAK,CAACQ,KAAK,CAACC,KAAK;AAAA,EAExC;AAED,IAAMC,WAAW,GAAG,IAAAd,kBAAM,EAACU,IAAI,CAAC,sIACjB,UAACR,CAAC;EAAA,OAAKA,CAAC,CAACE,KAAK,CAACQ,KAAK,CAACG,KAAK;AAAA,GAC9B,UAACb,CAAC;EAAA,OAAK,IAAAC,YAAG,EAACD,CAAC,CAACE,KAAK,CAACY,sBAAsB,CAAC;AAAA,EAEpD;AAED,IAAMC,cAAc,GAAGjB,kBAAM,CAACQ,GAAG,qYAY7BU,QAAC,CAACC,GAAG,CAACC,EAAE,CAQX;AAED,IAAMC,iBAAiB,GAAGrB,kBAAM,CAACQ,GAAG,6FAEnC;;AAED;AACA;AACA;AACA;AACA,IAAMc,MAAM,gBAAG,IAAAC,iBAAU,EACvB,gBAA2DC,GAAG;EAAA,IAA3DC,KAAK,QAALA,KAAK;IAAEC,WAAW,QAAXA,WAAW;IAAEC,IAAI,QAAJA,IAAI;IAAEC,OAAO,QAAPA,OAAO;IAAEC,QAAQ,QAARA,QAAQ;IAAKC,IAAI;EAAA,oBACrD,gCAAC,SAAS,eAAKA,IAAI;IAAE,GAAG,EAAEN;EAAI,IAC3BG,IAAI,iBAAI,gCAAC,aAAa,QAAEA,IAAI,CAAiB,eAC9C,gCAAC,KAAK,QAAEF,KAAK,CAAS,EACrBC,WAAW,iBAAI,gCAAC,WAAW,QAAEA,WAAW,CAAe,EACvDE,OAAO,iBAAI,gCAAC,cAAc,QAAEA,OAAO,CAAkB,EACrDC,QAAQ,iBAAI,gCAAC,iBAAiB,QAAEA,QAAQ,CAAqB,CACpD;AAAA,CACb,CACF;AAEDP,MAAM,CAACS,WAAW,GAAG,QAAQ;AAAC,eAEfT,MAAM;AAAA"}
|
|
@@ -1,61 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _icons = require("@os-design/icons");
|
|
13
|
-
|
|
14
10
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
15
|
-
|
|
16
11
|
var _utils = require("@os-design/utils");
|
|
17
|
-
|
|
18
12
|
var _theming = require("@os-design/theming");
|
|
19
|
-
|
|
20
13
|
var _react2 = require("@emotion/react");
|
|
21
|
-
|
|
22
14
|
var _portal = _interopRequireDefault(require("@os-design/portal"));
|
|
23
|
-
|
|
24
15
|
var _Button = _interopRequireDefault(require("../Button"));
|
|
25
|
-
|
|
26
16
|
var _useContainerPosition = _interopRequireDefault(require("./utils/useContainerPosition"));
|
|
27
|
-
|
|
28
17
|
var _useVisibility = _interopRequireDefault(require("./utils/useVisibility"));
|
|
29
|
-
|
|
30
18
|
var _excluded = ["container", "scrollTo", "minOffset", "onClick"];
|
|
31
|
-
|
|
32
19
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
33
|
-
|
|
34
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
35
|
-
|
|
36
21
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
37
|
-
|
|
38
22
|
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; }
|
|
39
|
-
|
|
40
23
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
41
|
-
|
|
42
24
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
43
|
-
|
|
44
25
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
45
|
-
|
|
46
26
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
47
|
-
|
|
48
27
|
var fadeIn = (0, _react2.keyframes)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n from { opacity: 0; }\n to { opacity: 1; }\n"])));
|
|
49
28
|
var fadeOut = (0, _react2.keyframes)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n from { opacity: 1; }\n to { opacity: 0; }\n"])));
|
|
50
|
-
|
|
51
29
|
var visibleStyles = function visibleStyles(p) {
|
|
52
30
|
return p.visible && (0, _react2.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n animation: ", " ", "ms forwards;\n "])), fadeIn, p.theme.transitionDelay);
|
|
53
31
|
};
|
|
54
|
-
|
|
55
32
|
var invisibleStyles = function invisibleStyles(p) {
|
|
56
33
|
return !p.visible && (0, _react2.css)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n animation: ", " ", "ms forwards;\n "])), fadeOut, p.theme.transitionDelay);
|
|
57
34
|
};
|
|
58
|
-
|
|
59
35
|
var StyledButton = (0, _styled["default"])(_Button["default"], (0, _utils.omitEmotionProps)('visible', 'containerPosition'))(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n position: fixed;\n right: ", ";\n bottom: ", ";\n box-shadow: 0 0.15em 0.8em ", ";\n\n ", ";\n ", ";\n"])), function (p) {
|
|
60
36
|
return p.containerPosition.right > 0 ? "calc(".concat(p.containerPosition.right, "px + ").concat(p.theme.scrollButtonMargin, "em)") : "".concat(p.theme.scrollButtonMargin, "em");
|
|
61
37
|
}, function (p) {
|
|
@@ -63,32 +39,30 @@ var StyledButton = (0, _styled["default"])(_Button["default"], (0, _utils.omitEm
|
|
|
63
39
|
}, function (p) {
|
|
64
40
|
return (0, _theming.clr)(p.theme.scrollButtonColorBoxShadow);
|
|
65
41
|
}, visibleStyles, invisibleStyles);
|
|
42
|
+
|
|
66
43
|
/**
|
|
67
44
|
* The button to scroll to either the top or bottom of the container.
|
|
68
45
|
*/
|
|
69
|
-
|
|
70
46
|
var ScrollButton = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
71
47
|
var container = _ref.container,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
48
|
+
_ref$scrollTo = _ref.scrollTo,
|
|
49
|
+
scrollTo = _ref$scrollTo === void 0 ? 'top' : _ref$scrollTo,
|
|
50
|
+
_ref$minOffset = _ref.minOffset,
|
|
51
|
+
minOffset = _ref$minOffset === void 0 ? 500 : _ref$minOffset,
|
|
52
|
+
_ref$onClick = _ref.onClick,
|
|
53
|
+
onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
|
|
54
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
80
55
|
var visible = (0, _useVisibility["default"])({
|
|
81
56
|
container: container,
|
|
82
57
|
scrollTo: scrollTo,
|
|
83
58
|
minOffset: minOffset
|
|
84
59
|
});
|
|
85
60
|
var containerPosition = (0, _useContainerPosition["default"])(container);
|
|
86
|
-
|
|
87
61
|
var _useTheme = (0, _theming.useTheme)(),
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
var mounted = (0, _utils.useClosable)(visible, theme.transitionDelay); // Scroll through the container when the user clicks the button
|
|
62
|
+
theme = _useTheme.theme;
|
|
63
|
+
var mounted = (0, _utils.useClosable)(visible, theme.transitionDelay);
|
|
91
64
|
|
|
65
|
+
// Scroll through the container when the user clicks the button
|
|
92
66
|
var clickHandler = (0, _react.useCallback)(function (e) {
|
|
93
67
|
// Scroll the window if the container is not defined
|
|
94
68
|
if (!container) {
|
|
@@ -96,15 +70,16 @@ var ScrollButton = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
96
70
|
top: scrollTo === 'top' ? 0 : document.body.scrollHeight
|
|
97
71
|
});
|
|
98
72
|
return;
|
|
99
|
-
}
|
|
100
|
-
|
|
73
|
+
}
|
|
101
74
|
|
|
75
|
+
// Otherwise scroll the container
|
|
102
76
|
var containerElement = container instanceof Element ? container : container.current;
|
|
103
77
|
if (!containerElement) return;
|
|
104
78
|
containerElement.scrollTo({
|
|
105
79
|
top: scrollTo === 'top' ? 0 : containerElement.scrollHeight
|
|
106
|
-
});
|
|
80
|
+
});
|
|
107
81
|
|
|
82
|
+
// Call the passed onClick handler
|
|
108
83
|
onClick(e);
|
|
109
84
|
}, [container, scrollTo, onClick]);
|
|
110
85
|
if (!mounted) return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["fadeIn","keyframes","fadeOut","visibleStyles","p","visible","css","theme","transitionDelay","invisibleStyles","StyledButton","styled","Button","omitEmotionProps","containerPosition","right","scrollButtonMargin","bottom","clr","scrollButtonColorBoxShadow","ScrollButton","forwardRef","ref","container","scrollTo","minOffset","onClick","rest","useVisibility","useContainerPosition","useTheme","mounted","useClosable","clickHandler","useCallback","e","window","top","document","body","scrollHeight","containerElement","Element","current","t","buttonPrimaryColorBg","scrollButtonColorBg","buttonPrimaryColorText","scrollButtonColorText","buttonPrimaryColorBgHover","scrollButtonColorBgHover","displayName"],"sources":["../../../src/ScrollButton/index.tsx"],"sourcesContent":["import React, {\n forwardRef,\n MouseEventHandler,\n RefObject,\n useCallback,\n} from 'react';\nimport { Up, Down } from '@os-design/icons';\nimport styled from '@emotion/styled';\nimport { useClosable, omitEmotionProps } from '@os-design/utils';\nimport { clr, ThemeOverrider, useTheme } from '@os-design/theming';\nimport { css, keyframes } from '@emotion/react';\nimport Portal from '@os-design/portal';\nimport Button, { ButtonProps } from '../Button';\nimport useContainerPosition, {\n ContainerPosition,\n} from './utils/useContainerPosition';\nimport useVisibility from './utils/useVisibility';\n\nexport interface ScrollButtonProps extends Omit<ButtonProps, 'type' | 'wide'> {\n /**\n * The container that needs to be scrolled.\n * @default undefined\n */\n container?: Element | RefObject<Element>;\n /**\n * Where the container should be scrolled.\n * @default top\n */\n scrollTo?: 'top' | 'bottom';\n /**\n * The min scroll offset when the button is visible.\n * @default 500\n */\n minOffset?: number;\n}\n\nconst fadeIn = keyframes`\n from { opacity: 0; }\n to { opacity: 1; }\n`;\n\nconst fadeOut = keyframes`\n from { opacity: 1; }\n to { opacity: 0; }\n`;\n\nconst visibleStyles = (p) =>\n p.visible &&\n css`\n animation: ${fadeIn} ${p.theme.transitionDelay}ms forwards;\n `;\n\nconst invisibleStyles = (p) =>\n !p.visible &&\n css`\n animation: ${fadeOut} ${p.theme.transitionDelay}ms forwards;\n `;\n\ninterface StyledButtonProps {\n visible: boolean;\n containerPosition: ContainerPosition;\n}\nconst StyledButton = styled(\n Button,\n omitEmotionProps('visible', 'containerPosition')\n)<StyledButtonProps>`\n position: fixed;\n right: ${(p) =>\n p.containerPosition.right > 0\n ? `calc(${p.containerPosition.right}px + ${p.theme.scrollButtonMargin}em)`\n : `${p.theme.scrollButtonMargin}em`};\n bottom: ${(p) =>\n `calc(${\n p.containerPosition.bottom > 0 ? `${p.containerPosition.bottom}px + ` : ''\n }${p.theme.scrollButtonMargin}em + env(safe-area-inset-bottom))`};\n box-shadow: 0 0.15em 0.8em ${(p) => clr(p.theme.scrollButtonColorBoxShadow)};\n\n ${visibleStyles};\n ${invisibleStyles};\n`;\n\n/**\n * The button to scroll to either the top or bottom of the container.\n */\nconst ScrollButton = forwardRef<HTMLButtonElement, ScrollButtonProps>(\n (\n {\n container,\n scrollTo = 'top',\n minOffset = 500,\n onClick = () => {},\n ...rest\n },\n ref\n ) => {\n const visible = useVisibility({ container, scrollTo, minOffset });\n const containerPosition = useContainerPosition(container);\n const { theme } = useTheme();\n const mounted = useClosable(visible, theme.transitionDelay);\n\n // Scroll through the container when the user clicks the button\n const clickHandler = useCallback<MouseEventHandler<HTMLButtonElement>>(\n (e) => {\n // Scroll the window if the container is not defined\n if (!container) {\n window.scrollTo({\n top: scrollTo === 'top' ? 0 : document.body.scrollHeight,\n });\n return;\n }\n\n // Otherwise scroll the container\n const containerElement =\n container instanceof Element ? container : container.current;\n if (!containerElement) return;\n\n containerElement.scrollTo({\n top: scrollTo === 'top' ? 0 : containerElement.scrollHeight,\n });\n\n // Call the passed onClick handler\n onClick(e);\n },\n [container, scrollTo, onClick]\n );\n\n if (!mounted) return null;\n\n return (\n <Portal container={container}>\n <ThemeOverrider\n overrides={(t) => ({\n buttonPrimaryColorBg: t.scrollButtonColorBg,\n buttonPrimaryColorText: t.scrollButtonColorText,\n buttonPrimaryColorBgHover: t.scrollButtonColorBgHover,\n })}\n >\n <StyledButton\n visible={visible}\n containerPosition={containerPosition}\n wide='never'\n size='small'\n onClick={clickHandler}\n aria-label={`Scroll to ${scrollTo}`}\n {...rest}\n ref={ref}\n >\n {scrollTo === 'top' ? <Up /> : <Down />}\n </StyledButton>\n </ThemeOverrider>\n </Portal>\n );\n }\n);\n\nScrollButton.displayName = 'ScrollButton';\n\nexport default ScrollButton;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["fadeIn","keyframes","fadeOut","visibleStyles","p","visible","css","theme","transitionDelay","invisibleStyles","StyledButton","styled","Button","omitEmotionProps","containerPosition","right","scrollButtonMargin","bottom","clr","scrollButtonColorBoxShadow","ScrollButton","forwardRef","ref","container","scrollTo","minOffset","onClick","rest","useVisibility","useContainerPosition","useTheme","mounted","useClosable","clickHandler","useCallback","e","window","top","document","body","scrollHeight","containerElement","Element","current","t","buttonPrimaryColorBg","scrollButtonColorBg","buttonPrimaryColorText","scrollButtonColorText","buttonPrimaryColorBgHover","scrollButtonColorBgHover","displayName"],"sources":["../../../src/ScrollButton/index.tsx"],"sourcesContent":["import React, {\n forwardRef,\n MouseEventHandler,\n RefObject,\n useCallback,\n} from 'react';\nimport { Up, Down } from '@os-design/icons';\nimport styled from '@emotion/styled';\nimport { useClosable, omitEmotionProps } from '@os-design/utils';\nimport { clr, ThemeOverrider, useTheme } from '@os-design/theming';\nimport { css, keyframes } from '@emotion/react';\nimport Portal from '@os-design/portal';\nimport Button, { ButtonProps } from '../Button';\nimport useContainerPosition, {\n ContainerPosition,\n} from './utils/useContainerPosition';\nimport useVisibility from './utils/useVisibility';\n\nexport interface ScrollButtonProps extends Omit<ButtonProps, 'type' | 'wide'> {\n /**\n * The container that needs to be scrolled.\n * @default undefined\n */\n container?: Element | RefObject<Element>;\n /**\n * Where the container should be scrolled.\n * @default top\n */\n scrollTo?: 'top' | 'bottom';\n /**\n * The min scroll offset when the button is visible.\n * @default 500\n */\n minOffset?: number;\n}\n\nconst fadeIn = keyframes`\n from { opacity: 0; }\n to { opacity: 1; }\n`;\n\nconst fadeOut = keyframes`\n from { opacity: 1; }\n to { opacity: 0; }\n`;\n\nconst visibleStyles = (p) =>\n p.visible &&\n css`\n animation: ${fadeIn} ${p.theme.transitionDelay}ms forwards;\n `;\n\nconst invisibleStyles = (p) =>\n !p.visible &&\n css`\n animation: ${fadeOut} ${p.theme.transitionDelay}ms forwards;\n `;\n\ninterface StyledButtonProps {\n visible: boolean;\n containerPosition: ContainerPosition;\n}\nconst StyledButton = styled(\n Button,\n omitEmotionProps('visible', 'containerPosition')\n)<StyledButtonProps>`\n position: fixed;\n right: ${(p) =>\n p.containerPosition.right > 0\n ? `calc(${p.containerPosition.right}px + ${p.theme.scrollButtonMargin}em)`\n : `${p.theme.scrollButtonMargin}em`};\n bottom: ${(p) =>\n `calc(${\n p.containerPosition.bottom > 0 ? `${p.containerPosition.bottom}px + ` : ''\n }${p.theme.scrollButtonMargin}em + env(safe-area-inset-bottom))`};\n box-shadow: 0 0.15em 0.8em ${(p) => clr(p.theme.scrollButtonColorBoxShadow)};\n\n ${visibleStyles};\n ${invisibleStyles};\n`;\n\n/**\n * The button to scroll to either the top or bottom of the container.\n */\nconst ScrollButton = forwardRef<HTMLButtonElement, ScrollButtonProps>(\n (\n {\n container,\n scrollTo = 'top',\n minOffset = 500,\n onClick = () => {},\n ...rest\n },\n ref\n ) => {\n const visible = useVisibility({ container, scrollTo, minOffset });\n const containerPosition = useContainerPosition(container);\n const { theme } = useTheme();\n const mounted = useClosable(visible, theme.transitionDelay);\n\n // Scroll through the container when the user clicks the button\n const clickHandler = useCallback<MouseEventHandler<HTMLButtonElement>>(\n (e) => {\n // Scroll the window if the container is not defined\n if (!container) {\n window.scrollTo({\n top: scrollTo === 'top' ? 0 : document.body.scrollHeight,\n });\n return;\n }\n\n // Otherwise scroll the container\n const containerElement =\n container instanceof Element ? container : container.current;\n if (!containerElement) return;\n\n containerElement.scrollTo({\n top: scrollTo === 'top' ? 0 : containerElement.scrollHeight,\n });\n\n // Call the passed onClick handler\n onClick(e);\n },\n [container, scrollTo, onClick]\n );\n\n if (!mounted) return null;\n\n return (\n <Portal container={container}>\n <ThemeOverrider\n overrides={(t) => ({\n buttonPrimaryColorBg: t.scrollButtonColorBg,\n buttonPrimaryColorText: t.scrollButtonColorText,\n buttonPrimaryColorBgHover: t.scrollButtonColorBgHover,\n })}\n >\n <StyledButton\n visible={visible}\n containerPosition={containerPosition}\n wide='never'\n size='small'\n onClick={clickHandler}\n aria-label={`Scroll to ${scrollTo}`}\n {...rest}\n ref={ref}\n >\n {scrollTo === 'top' ? <Up /> : <Down />}\n </StyledButton>\n </ThemeOverrider>\n </Portal>\n );\n }\n);\n\nScrollButton.displayName = 'ScrollButton';\n\nexport default ScrollButton;\n"],"mappings":";;;;;;;AAAA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AAAkD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBlD,IAAMA,MAAM,OAAGC,iBAAS,sHAGvB;AAED,IAAMC,OAAO,OAAGD,iBAAS,wHAGxB;AAED,IAAME,aAAa,GAAG,SAAhBA,aAAa,CAAIC,CAAC;EAAA,OACtBA,CAAC,CAACC,OAAO,QACTC,WAAG,mHACYN,MAAM,EAAII,CAAC,CAACG,KAAK,CAACC,eAAe,CAC/C;AAAA;AAEH,IAAMC,eAAe,GAAG,SAAlBA,eAAe,CAAIL,CAAC;EAAA,OACxB,CAACA,CAAC,CAACC,OAAO,QACVC,WAAG,mHACYJ,OAAO,EAAIE,CAAC,CAACG,KAAK,CAACC,eAAe,CAChD;AAAA;AAMH,IAAME,YAAY,GAAG,IAAAC,kBAAM,EACzBC,kBAAM,EACN,IAAAC,uBAAgB,EAAC,SAAS,EAAE,mBAAmB,CAAC,CACjD,uLAEU,UAACT,CAAC;EAAA,OACTA,CAAC,CAACU,iBAAiB,CAACC,KAAK,GAAG,CAAC,kBACjBX,CAAC,CAACU,iBAAiB,CAACC,KAAK,kBAAQX,CAAC,CAACG,KAAK,CAACS,kBAAkB,qBAChEZ,CAAC,CAACG,KAAK,CAACS,kBAAkB,OAAI;AAAA,GAC7B,UAACZ,CAAC;EAAA,sBAERA,CAAC,CAACU,iBAAiB,CAACG,MAAM,GAAG,CAAC,aAAMb,CAAC,CAACU,iBAAiB,CAACG,MAAM,aAAU,EAAE,SACzEb,CAAC,CAACG,KAAK,CAACS,kBAAkB;AAAA,CAAmC,EACrC,UAACZ,CAAC;EAAA,OAAK,IAAAc,YAAG,EAACd,CAAC,CAACG,KAAK,CAACY,0BAA0B,CAAC;AAAA,GAEzEhB,aAAa,EACbM,eAAe,CAClB;;AAED;AACA;AACA;AACA,IAAMW,YAAY,gBAAG,IAAAC,iBAAU,EAC7B,gBAQEC,GAAG,EACA;EAAA,IAPDC,SAAS,QAATA,SAAS;IAAA,qBACTC,QAAQ;IAARA,QAAQ,8BAAG,KAAK;IAAA,sBAChBC,SAAS;IAATA,SAAS,+BAAG,GAAG;IAAA,oBACfC,OAAO;IAAPA,OAAO,6BAAG,YAAM,CAAC,CAAC;IACfC,IAAI;EAIT,IAAMtB,OAAO,GAAG,IAAAuB,yBAAa,EAAC;IAAEL,SAAS,EAATA,SAAS;IAAEC,QAAQ,EAARA,QAAQ;IAAEC,SAAS,EAATA;EAAU,CAAC,CAAC;EACjE,IAAMX,iBAAiB,GAAG,IAAAe,gCAAoB,EAACN,SAAS,CAAC;EACzD,gBAAkB,IAAAO,iBAAQ,GAAE;IAApBvB,KAAK,aAALA,KAAK;EACb,IAAMwB,OAAO,GAAG,IAAAC,kBAAW,EAAC3B,OAAO,EAAEE,KAAK,CAACC,eAAe,CAAC;;EAE3D;EACA,IAAMyB,YAAY,GAAG,IAAAC,kBAAW,EAC9B,UAACC,CAAC,EAAK;IACL;IACA,IAAI,CAACZ,SAAS,EAAE;MACda,MAAM,CAACZ,QAAQ,CAAC;QACda,GAAG,EAAEb,QAAQ,KAAK,KAAK,GAAG,CAAC,GAAGc,QAAQ,CAACC,IAAI,CAACC;MAC9C,CAAC,CAAC;MACF;IACF;;IAEA;IACA,IAAMC,gBAAgB,GACpBlB,SAAS,YAAYmB,OAAO,GAAGnB,SAAS,GAAGA,SAAS,CAACoB,OAAO;IAC9D,IAAI,CAACF,gBAAgB,EAAE;IAEvBA,gBAAgB,CAACjB,QAAQ,CAAC;MACxBa,GAAG,EAAEb,QAAQ,KAAK,KAAK,GAAG,CAAC,GAAGiB,gBAAgB,CAACD;IACjD,CAAC,CAAC;;IAEF;IACAd,OAAO,CAACS,CAAC,CAAC;EACZ,CAAC,EACD,CAACZ,SAAS,EAAEC,QAAQ,EAAEE,OAAO,CAAC,CAC/B;EAED,IAAI,CAACK,OAAO,EAAE,OAAO,IAAI;EAEzB,oBACE,gCAAC,kBAAM;IAAC,SAAS,EAAER;EAAU,gBAC3B,gCAAC,uBAAc;IACb,SAAS,EAAE,mBAACqB,CAAC;MAAA,OAAM;QACjBC,oBAAoB,EAAED,CAAC,CAACE,mBAAmB;QAC3CC,sBAAsB,EAAEH,CAAC,CAACI,qBAAqB;QAC/CC,yBAAyB,EAAEL,CAAC,CAACM;MAC/B,CAAC;IAAA;EAAE,gBAEH,gCAAC,YAAY;IACX,OAAO,EAAE7C,OAAQ;IACjB,iBAAiB,EAAES,iBAAkB;IACrC,IAAI,EAAC,OAAO;IACZ,IAAI,EAAC,OAAO;IACZ,OAAO,EAAEmB,YAAa;IACtB,kCAAyBT,QAAQ;EAAG,GAChCG,IAAI;IACR,GAAG,EAAEL;EAAI,IAERE,QAAQ,KAAK,KAAK,gBAAG,gCAAC,SAAE,OAAG,gBAAG,gCAAC,WAAI,OAAG,CAC1B,CACA,CACV;AAEb,CAAC,CACF;AAEDJ,YAAY,CAAC+B,WAAW,GAAG,cAAc;AAAC,eAE3B/B,YAAY;AAAA"}
|
|
@@ -4,47 +4,35 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = require("react");
|
|
9
|
-
|
|
10
8
|
var _utils = require("@os-design/utils");
|
|
11
|
-
|
|
12
9
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
13
|
-
|
|
14
10
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
15
|
-
|
|
16
11
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
17
|
-
|
|
18
12
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
19
|
-
|
|
20
13
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
21
|
-
|
|
22
14
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
23
|
-
|
|
24
15
|
/**
|
|
25
16
|
* Calculates the position of the container.
|
|
26
17
|
*/
|
|
27
18
|
var useContainerPosition = function useContainerPosition(container) {
|
|
28
19
|
var _useState = (0, _react.useState)({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
20
|
+
right: 0,
|
|
21
|
+
bottom: 0
|
|
22
|
+
}),
|
|
23
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
24
|
+
position = _useState2[0],
|
|
25
|
+
setPosition = _useState2[1];
|
|
36
26
|
var updatePosition = (0, _react.useCallback)(function () {
|
|
37
27
|
if (!container) return;
|
|
38
28
|
var element = container instanceof Element ? container : container.current;
|
|
39
29
|
if (!element) return;
|
|
40
|
-
|
|
41
30
|
var _element$getBoundingC = element.getBoundingClientRect(),
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
31
|
+
right = _element$getBoundingC.right,
|
|
32
|
+
bottom = _element$getBoundingC.bottom;
|
|
45
33
|
var _window = window,
|
|
46
|
-
|
|
47
|
-
|
|
34
|
+
innerWidth = _window.innerWidth,
|
|
35
|
+
innerHeight = _window.innerHeight;
|
|
48
36
|
setPosition({
|
|
49
37
|
right: innerWidth - right,
|
|
50
38
|
bottom: innerHeight - bottom
|
|
@@ -56,7 +44,6 @@ var useContainerPosition = function useContainerPosition(container) {
|
|
|
56
44
|
(0, _utils.useResizeObserver)(container, updatePosition);
|
|
57
45
|
return position;
|
|
58
46
|
};
|
|
59
|
-
|
|
60
47
|
var _default = useContainerPosition;
|
|
61
48
|
exports["default"] = _default;
|
|
62
49
|
//# sourceMappingURL=useContainerPosition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useContainerPosition.js","names":["useContainerPosition","container","useState","right","bottom","position","setPosition","updatePosition","useCallback","element","Element","current","getBoundingClientRect","window","innerWidth","innerHeight","useBrowserLayoutEffect","useResizeObserver"],"sources":["../../../../src/ScrollButton/utils/useContainerPosition.ts"],"sourcesContent":["import { RefObject, useCallback, useState } from 'react';\nimport { useResizeObserver, useBrowserLayoutEffect } from '@os-design/utils';\n\nexport interface ContainerPosition {\n right: number;\n bottom: number;\n}\n\n/**\n * Calculates the position of the container.\n */\nconst useContainerPosition = (\n container?: Element | RefObject<Element>\n): ContainerPosition => {\n const [position, setPosition] = useState<ContainerPosition>({\n right: 0,\n bottom: 0,\n });\n\n const updatePosition = useCallback(() => {\n if (!container) return;\n const element =\n container instanceof Element ? container : container.current;\n if (!element) return;\n\n const { right, bottom } = element.getBoundingClientRect();\n const { innerWidth, innerHeight } = window;\n\n setPosition({\n right: innerWidth - right,\n bottom: innerHeight - bottom,\n });\n }, [container]);\n\n useBrowserLayoutEffect(() => updatePosition(), [updatePosition]);\n useResizeObserver(container as never, updatePosition);\n\n return position;\n};\n\nexport default useContainerPosition;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useContainerPosition.js","names":["useContainerPosition","container","useState","right","bottom","position","setPosition","updatePosition","useCallback","element","Element","current","getBoundingClientRect","window","innerWidth","innerHeight","useBrowserLayoutEffect","useResizeObserver"],"sources":["../../../../src/ScrollButton/utils/useContainerPosition.ts"],"sourcesContent":["import { RefObject, useCallback, useState } from 'react';\nimport { useResizeObserver, useBrowserLayoutEffect } from '@os-design/utils';\n\nexport interface ContainerPosition {\n right: number;\n bottom: number;\n}\n\n/**\n * Calculates the position of the container.\n */\nconst useContainerPosition = (\n container?: Element | RefObject<Element>\n): ContainerPosition => {\n const [position, setPosition] = useState<ContainerPosition>({\n right: 0,\n bottom: 0,\n });\n\n const updatePosition = useCallback(() => {\n if (!container) return;\n const element =\n container instanceof Element ? container : container.current;\n if (!element) return;\n\n const { right, bottom } = element.getBoundingClientRect();\n const { innerWidth, innerHeight } = window;\n\n setPosition({\n right: innerWidth - right,\n bottom: innerHeight - bottom,\n });\n }, [container]);\n\n useBrowserLayoutEffect(() => updatePosition(), [updatePosition]);\n useResizeObserver(container as never, updatePosition);\n\n return position;\n};\n\nexport default useContainerPosition;\n"],"mappings":";;;;;;AAAA;AACA;AAA6E;AAAA;AAAA;AAAA;AAAA;AAAA;AAO7E;AACA;AACA;AACA,IAAMA,oBAAoB,GAAG,SAAvBA,oBAAoB,CACxBC,SAAwC,EAClB;EACtB,gBAAgC,IAAAC,eAAQ,EAAoB;MAC1DC,KAAK,EAAE,CAAC;MACRC,MAAM,EAAE;IACV,CAAC,CAAC;IAAA;IAHKC,QAAQ;IAAEC,WAAW;EAK5B,IAAMC,cAAc,GAAG,IAAAC,kBAAW,EAAC,YAAM;IACvC,IAAI,CAACP,SAAS,EAAE;IAChB,IAAMQ,OAAO,GACXR,SAAS,YAAYS,OAAO,GAAGT,SAAS,GAAGA,SAAS,CAACU,OAAO;IAC9D,IAAI,CAACF,OAAO,EAAE;IAEd,4BAA0BA,OAAO,CAACG,qBAAqB,EAAE;MAAjDT,KAAK,yBAALA,KAAK;MAAEC,MAAM,yBAANA,MAAM;IACrB,cAAoCS,MAAM;MAAlCC,UAAU,WAAVA,UAAU;MAAEC,WAAW,WAAXA,WAAW;IAE/BT,WAAW,CAAC;MACVH,KAAK,EAAEW,UAAU,GAAGX,KAAK;MACzBC,MAAM,EAAEW,WAAW,GAAGX;IACxB,CAAC,CAAC;EACJ,CAAC,EAAE,CAACH,SAAS,CAAC,CAAC;EAEf,IAAAe,6BAAsB,EAAC;IAAA,OAAMT,cAAc,EAAE;EAAA,GAAE,CAACA,cAAc,CAAC,CAAC;EAChE,IAAAU,wBAAiB,EAAChB,SAAS,EAAWM,cAAc,CAAC;EAErD,OAAOF,QAAQ;AACjB,CAAC;AAAC,eAEaL,oBAAoB;AAAA"}
|
|
@@ -4,40 +4,29 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = require("react");
|
|
9
|
-
|
|
10
8
|
var _utils = require("@os-design/utils");
|
|
11
|
-
|
|
12
9
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
13
|
-
|
|
14
10
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
15
|
-
|
|
16
11
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
17
|
-
|
|
18
12
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
19
|
-
|
|
20
13
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
21
|
-
|
|
22
14
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
23
|
-
|
|
24
15
|
/**
|
|
25
16
|
* Controls the visibility of the button.
|
|
26
17
|
*/
|
|
27
18
|
var useVisibility = function useVisibility(_ref) {
|
|
28
19
|
var container = _ref.container,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
scrollTo = _ref.scrollTo,
|
|
21
|
+
minOffset = _ref.minOffset;
|
|
32
22
|
var _useState = (0, _react.useState)(false),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
23
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
24
|
+
visible = _useState2[0],
|
|
25
|
+
setVisible = _useState2[1];
|
|
37
26
|
|
|
27
|
+
// Update the visibility of the button when the user scrolls the container
|
|
38
28
|
var updateVisibility = (0, _react.useCallback)(function () {
|
|
39
29
|
var offset = 0;
|
|
40
|
-
|
|
41
30
|
if (!container) {
|
|
42
31
|
offset = scrollTo === 'top' ? window.scrollY : document.body.scrollHeight - window.scrollY - window.innerHeight;
|
|
43
32
|
} else {
|
|
@@ -45,7 +34,6 @@ var useVisibility = function useVisibility(_ref) {
|
|
|
45
34
|
if (containerElement === null) return;
|
|
46
35
|
offset = scrollTo === 'top' ? containerElement.scrollTop : containerElement.scrollHeight - containerElement.scrollTop - containerElement.clientHeight;
|
|
47
36
|
}
|
|
48
|
-
|
|
49
37
|
setVisible(offset >= minOffset);
|
|
50
38
|
}, [container, scrollTo, minOffset]);
|
|
51
39
|
(0, _utils.useBrowserLayoutEffect)(function () {
|
|
@@ -54,7 +42,6 @@ var useVisibility = function useVisibility(_ref) {
|
|
|
54
42
|
(0, _utils.useEvent)(container || (typeof window !== 'undefined' ? window : undefined), 'scroll', updateVisibility);
|
|
55
43
|
return visible;
|
|
56
44
|
};
|
|
57
|
-
|
|
58
45
|
var _default = useVisibility;
|
|
59
46
|
exports["default"] = _default;
|
|
60
47
|
//# sourceMappingURL=useVisibility.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useVisibility.js","names":["useVisibility","container","scrollTo","minOffset","useState","visible","setVisible","updateVisibility","useCallback","offset","window","scrollY","document","body","scrollHeight","innerHeight","containerElement","Element","current","scrollTop","clientHeight","useBrowserLayoutEffect","useEvent","undefined"],"sources":["../../../../src/ScrollButton/utils/useVisibility.ts"],"sourcesContent":["import { RefObject, useCallback, useState } from 'react';\nimport { useEvent, useBrowserLayoutEffect } from '@os-design/utils';\n\ninterface UseVisibilityProps {\n container?: Element | RefObject<Element>;\n scrollTo: 'top' | 'bottom';\n minOffset: number;\n}\n\n/**\n * Controls the visibility of the button.\n */\nconst useVisibility = ({\n container,\n scrollTo,\n minOffset,\n}: UseVisibilityProps): boolean => {\n const [visible, setVisible] = useState(false);\n\n // Update the visibility of the button when the user scrolls the container\n const updateVisibility = useCallback(() => {\n let offset = 0;\n\n if (!container) {\n offset =\n scrollTo === 'top'\n ? window.scrollY\n : document.body.scrollHeight - window.scrollY - window.innerHeight;\n } else {\n const containerElement =\n container instanceof Element ? container : container.current;\n if (containerElement === null) return;\n\n offset =\n scrollTo === 'top'\n ? containerElement.scrollTop\n : containerElement.scrollHeight -\n containerElement.scrollTop -\n containerElement.clientHeight;\n }\n\n setVisible(offset >= minOffset);\n }, [container, scrollTo, minOffset]);\n\n useBrowserLayoutEffect(() => updateVisibility(), [updateVisibility]);\n useEvent(\n container ||\n ((typeof window !== 'undefined' ? window : undefined) as EventTarget),\n 'scroll',\n updateVisibility\n );\n\n return visible;\n};\n\nexport default useVisibility;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useVisibility.js","names":["useVisibility","container","scrollTo","minOffset","useState","visible","setVisible","updateVisibility","useCallback","offset","window","scrollY","document","body","scrollHeight","innerHeight","containerElement","Element","current","scrollTop","clientHeight","useBrowserLayoutEffect","useEvent","undefined"],"sources":["../../../../src/ScrollButton/utils/useVisibility.ts"],"sourcesContent":["import { RefObject, useCallback, useState } from 'react';\nimport { useEvent, useBrowserLayoutEffect } from '@os-design/utils';\n\ninterface UseVisibilityProps {\n container?: Element | RefObject<Element>;\n scrollTo: 'top' | 'bottom';\n minOffset: number;\n}\n\n/**\n * Controls the visibility of the button.\n */\nconst useVisibility = ({\n container,\n scrollTo,\n minOffset,\n}: UseVisibilityProps): boolean => {\n const [visible, setVisible] = useState(false);\n\n // Update the visibility of the button when the user scrolls the container\n const updateVisibility = useCallback(() => {\n let offset = 0;\n\n if (!container) {\n offset =\n scrollTo === 'top'\n ? window.scrollY\n : document.body.scrollHeight - window.scrollY - window.innerHeight;\n } else {\n const containerElement =\n container instanceof Element ? container : container.current;\n if (containerElement === null) return;\n\n offset =\n scrollTo === 'top'\n ? containerElement.scrollTop\n : containerElement.scrollHeight -\n containerElement.scrollTop -\n containerElement.clientHeight;\n }\n\n setVisible(offset >= minOffset);\n }, [container, scrollTo, minOffset]);\n\n useBrowserLayoutEffect(() => updateVisibility(), [updateVisibility]);\n useEvent(\n container ||\n ((typeof window !== 'undefined' ? window : undefined) as EventTarget),\n 'scroll',\n updateVisibility\n );\n\n return visible;\n};\n\nexport default useVisibility;\n"],"mappings":";;;;;;AAAA;AACA;AAAoE;AAAA;AAAA;AAAA;AAAA;AAAA;AAQpE;AACA;AACA;AACA,IAAMA,aAAa,GAAG,SAAhBA,aAAa,OAIgB;EAAA,IAHjCC,SAAS,QAATA,SAAS;IACTC,QAAQ,QAARA,QAAQ;IACRC,SAAS,QAATA,SAAS;EAET,gBAA8B,IAAAC,eAAQ,EAAC,KAAK,CAAC;IAAA;IAAtCC,OAAO;IAAEC,UAAU;;EAE1B;EACA,IAAMC,gBAAgB,GAAG,IAAAC,kBAAW,EAAC,YAAM;IACzC,IAAIC,MAAM,GAAG,CAAC;IAEd,IAAI,CAACR,SAAS,EAAE;MACdQ,MAAM,GACJP,QAAQ,KAAK,KAAK,GACdQ,MAAM,CAACC,OAAO,GACdC,QAAQ,CAACC,IAAI,CAACC,YAAY,GAAGJ,MAAM,CAACC,OAAO,GAAGD,MAAM,CAACK,WAAW;IACxE,CAAC,MAAM;MACL,IAAMC,gBAAgB,GACpBf,SAAS,YAAYgB,OAAO,GAAGhB,SAAS,GAAGA,SAAS,CAACiB,OAAO;MAC9D,IAAIF,gBAAgB,KAAK,IAAI,EAAE;MAE/BP,MAAM,GACJP,QAAQ,KAAK,KAAK,GACdc,gBAAgB,CAACG,SAAS,GAC1BH,gBAAgB,CAACF,YAAY,GAC7BE,gBAAgB,CAACG,SAAS,GAC1BH,gBAAgB,CAACI,YAAY;IACrC;IAEAd,UAAU,CAACG,MAAM,IAAIN,SAAS,CAAC;EACjC,CAAC,EAAE,CAACF,SAAS,EAAEC,QAAQ,EAAEC,SAAS,CAAC,CAAC;EAEpC,IAAAkB,6BAAsB,EAAC;IAAA,OAAMd,gBAAgB,EAAE;EAAA,GAAE,CAACA,gBAAgB,CAAC,CAAC;EACpE,IAAAe,eAAQ,EACNrB,SAAS,KACL,OAAOS,MAAM,KAAK,WAAW,GAAGA,MAAM,GAAGa,SAAS,CAAiB,EACvE,QAAQ,EACRhB,gBAAgB,CACjB;EAED,OAAOF,OAAO;AAChB,CAAC;AAAC,eAEaL,aAAa;AAAA"}
|