@os-design/core 1.0.155 → 1.0.157
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 +119 -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 +90 -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 +10 -0
- package/dist/types/TimePicker/index.d.ts.map +1 -0
- package/package.json +7 -6
|
@@ -4,67 +4,52 @@ 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 _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
13
|
-
|
|
14
10
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread 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 _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
19
|
-
|
|
20
13
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
21
|
-
|
|
22
14
|
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; }
|
|
23
|
-
|
|
24
15
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
25
|
-
|
|
26
16
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
27
|
-
|
|
28
17
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
29
|
-
|
|
30
18
|
var popoverPositionGetters = function popoverPositionGetters(rectKey) {
|
|
31
19
|
var sizeKey = rectKey === 'top' ? 'height' : 'width';
|
|
32
20
|
var windowSizeKey = rectKey === 'top' ? 'innerHeight' : 'innerWidth';
|
|
33
21
|
var windowOffsetKey = rectKey === 'top' ? 'pageYOffset' : 'pageXOffset';
|
|
34
|
-
|
|
35
22
|
var fitToWindow = function fitToWindow(start, _ref) {
|
|
36
23
|
var elementRect = _ref.elementRect,
|
|
37
|
-
|
|
24
|
+
popoverRect = _ref.popoverRect;
|
|
38
25
|
var popoverStart = start;
|
|
39
26
|
var windowStart = window[windowOffsetKey];
|
|
40
27
|
var windowEnd = windowStart + window[windowSizeKey];
|
|
41
28
|
var elementStart = windowStart + elementRect[rectKey];
|
|
42
29
|
var elementEnd = elementStart + elementRect[sizeKey];
|
|
43
|
-
var popoverEnd = popoverStart + popoverRect[sizeKey];
|
|
30
|
+
var popoverEnd = popoverStart + popoverRect[sizeKey];
|
|
44
31
|
|
|
32
|
+
// Fit the popover to the end of the window
|
|
45
33
|
if (popoverEnd > windowEnd) {
|
|
46
34
|
if (elementEnd < windowEnd) popoverStart = windowEnd - popoverRect[sizeKey];else if (popoverRect[sizeKey] > elementRect[sizeKey]) popoverStart = elementEnd - popoverRect[sizeKey];else if (windowEnd - elementStart > popoverRect[sizeKey]) popoverStart = windowEnd - popoverRect[sizeKey];else popoverStart = elementStart;
|
|
47
|
-
}
|
|
48
|
-
|
|
35
|
+
}
|
|
49
36
|
|
|
37
|
+
// Fit the popover to the beginning of the window
|
|
50
38
|
if (popoverStart < windowStart) {
|
|
51
39
|
if (elementStart > windowStart) popoverStart = windowStart;else if (popoverRect[sizeKey] > elementRect[sizeKey]) popoverStart = elementStart;else if (elementEnd - windowStart > popoverRect[sizeKey]) popoverStart = windowStart;else popoverStart = elementEnd - popoverRect[sizeKey];
|
|
52
40
|
}
|
|
53
|
-
|
|
54
41
|
return popoverStart;
|
|
55
42
|
};
|
|
56
|
-
|
|
57
43
|
return {
|
|
58
44
|
before: function before(options) {
|
|
59
45
|
var elementRect = options.elementRect,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
46
|
+
popoverRect = options.popoverRect,
|
|
47
|
+
gap = options.gap,
|
|
48
|
+
flip = options.flip;
|
|
63
49
|
var windowStart = window[windowOffsetKey];
|
|
64
50
|
var windowEnd = windowStart + window[windowSizeKey];
|
|
65
51
|
var elementStart = windowStart + elementRect[rectKey];
|
|
66
52
|
var popoverStart = elementStart - popoverRect[sizeKey] - gap;
|
|
67
|
-
|
|
68
53
|
if (flip && popoverStart < windowStart) {
|
|
69
54
|
var afterPopoverStart = this.after(_objectSpread(_objectSpread({}, options), {}, {
|
|
70
55
|
flip: false
|
|
@@ -74,21 +59,19 @@ var popoverPositionGetters = function popoverPositionGetters(rectKey) {
|
|
|
74
59
|
var diffEnd = afterPopoverEnd - windowEnd;
|
|
75
60
|
if (afterPopoverEnd <= windowEnd || diffStart > diffEnd) return afterPopoverStart;
|
|
76
61
|
}
|
|
77
|
-
|
|
78
62
|
return popoverStart;
|
|
79
63
|
},
|
|
80
64
|
after: function after(options) {
|
|
81
65
|
var elementRect = options.elementRect,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
66
|
+
popoverRect = options.popoverRect,
|
|
67
|
+
gap = options.gap,
|
|
68
|
+
flip = options.flip;
|
|
85
69
|
var windowStart = window[windowOffsetKey];
|
|
86
70
|
var windowEnd = windowStart + window[windowSizeKey];
|
|
87
71
|
var elementStart = windowStart + elementRect[rectKey];
|
|
88
72
|
var elementEnd = elementStart + elementRect[sizeKey];
|
|
89
73
|
var popoverStart = elementEnd + gap;
|
|
90
74
|
var popoverEnd = popoverStart + popoverRect[sizeKey];
|
|
91
|
-
|
|
92
75
|
if (flip && popoverEnd > windowEnd) {
|
|
93
76
|
var beforePopoverStart = this.before(_objectSpread(_objectSpread({}, options), {}, {
|
|
94
77
|
flip: false
|
|
@@ -97,12 +80,11 @@ var popoverPositionGetters = function popoverPositionGetters(rectKey) {
|
|
|
97
80
|
var diffEnd = popoverEnd - windowEnd;
|
|
98
81
|
if (beforePopoverStart >= windowStart || diffEnd > diffStart) return beforePopoverStart;
|
|
99
82
|
}
|
|
100
|
-
|
|
101
83
|
return popoverStart;
|
|
102
84
|
},
|
|
103
85
|
start: function start(_ref2) {
|
|
104
86
|
var elementRect = _ref2.elementRect,
|
|
105
|
-
|
|
87
|
+
popoverRect = _ref2.popoverRect;
|
|
106
88
|
var windowStart = window[windowOffsetKey];
|
|
107
89
|
var elementStart = windowStart + elementRect[rectKey];
|
|
108
90
|
return fitToWindow(elementStart, {
|
|
@@ -112,7 +94,7 @@ var popoverPositionGetters = function popoverPositionGetters(rectKey) {
|
|
|
112
94
|
},
|
|
113
95
|
end: function end(_ref3) {
|
|
114
96
|
var elementRect = _ref3.elementRect,
|
|
115
|
-
|
|
97
|
+
popoverRect = _ref3.popoverRect;
|
|
116
98
|
var windowStart = window[windowOffsetKey];
|
|
117
99
|
var elementStart = windowStart + elementRect[rectKey];
|
|
118
100
|
var elementEnd = elementStart + elementRect[sizeKey];
|
|
@@ -124,7 +106,7 @@ var popoverPositionGetters = function popoverPositionGetters(rectKey) {
|
|
|
124
106
|
},
|
|
125
107
|
center: function center(_ref4) {
|
|
126
108
|
var elementRect = _ref4.elementRect,
|
|
127
|
-
|
|
109
|
+
popoverRect = _ref4.popoverRect;
|
|
128
110
|
var windowStart = window[windowOffsetKey];
|
|
129
111
|
var elementStart = windowStart + elementRect[rectKey];
|
|
130
112
|
var popoverStart = elementStart + (elementRect[sizeKey] - popoverRect[sizeKey]) / 2;
|
|
@@ -135,14 +117,12 @@ var popoverPositionGetters = function popoverPositionGetters(rectKey) {
|
|
|
135
117
|
}
|
|
136
118
|
};
|
|
137
119
|
};
|
|
138
|
-
|
|
139
120
|
var getPopoverPosition = function getPopoverPosition(top, left, options) {
|
|
140
121
|
return {
|
|
141
122
|
top: popoverPositionGetters('top')[top](options),
|
|
142
123
|
left: popoverPositionGetters('left')[left](options)
|
|
143
124
|
};
|
|
144
125
|
};
|
|
145
|
-
|
|
146
126
|
var placementPositionKeysMap = {
|
|
147
127
|
top: ['before', 'center'],
|
|
148
128
|
bottom: ['after', 'center'],
|
|
@@ -157,7 +137,6 @@ var placementPositionKeysMap = {
|
|
|
157
137
|
'right-start': ['start', 'after'],
|
|
158
138
|
'right-end': ['end', 'after']
|
|
159
139
|
};
|
|
160
|
-
|
|
161
140
|
/**
|
|
162
141
|
* Computes the position of the popover.
|
|
163
142
|
* Note that you must change the elementRect when the scroll and resize events of the parent scrollable container occur.
|
|
@@ -165,13 +144,13 @@ var placementPositionKeysMap = {
|
|
|
165
144
|
*/
|
|
166
145
|
var usePopoverPosition = function usePopoverPosition(_ref5) {
|
|
167
146
|
var elementRect = _ref5.elementRect,
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
147
|
+
popoverRect = _ref5.popoverRect,
|
|
148
|
+
_ref5$placement = _ref5.placement,
|
|
149
|
+
placement = _ref5$placement === void 0 ? 'top' : _ref5$placement,
|
|
150
|
+
_ref5$gap = _ref5.gap,
|
|
151
|
+
gap = _ref5$gap === void 0 ? 0.5 : _ref5$gap,
|
|
152
|
+
_ref5$flip = _ref5.flip,
|
|
153
|
+
flip = _ref5$flip === void 0 ? true : _ref5$flip;
|
|
175
154
|
var bodyFontSize = (0, _utils.useFontSize)(document.body);
|
|
176
155
|
var gapPx = (0, _react.useMemo)(function () {
|
|
177
156
|
return gap * bodyFontSize;
|
|
@@ -187,7 +166,6 @@ var usePopoverPosition = function usePopoverPosition(_ref5) {
|
|
|
187
166
|
flip: flip
|
|
188
167
|
}]));
|
|
189
168
|
};
|
|
190
|
-
|
|
191
169
|
var _default = usePopoverPosition;
|
|
192
170
|
exports["default"] = _default;
|
|
193
171
|
//# sourceMappingURL=usePopoverPosition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePopoverPosition.js","names":["popoverPositionGetters","rectKey","sizeKey","windowSizeKey","windowOffsetKey","fitToWindow","start","elementRect","popoverRect","popoverStart","windowStart","window","windowEnd","elementStart","elementEnd","popoverEnd","before","options","gap","flip","afterPopoverStart","after","afterPopoverEnd","diffStart","diffEnd","beforePopoverStart","end","center","getPopoverPosition","top","left","placementPositionKeysMap","bottom","right","usePopoverPosition","placement","bodyFontSize","useFontSize","document","body","gapPx","useMemo","positionKeys"],"sources":["../../../../src/Popover/utils/usePopoverPosition.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { useFontSize } from '@os-design/utils';\n\nexport type Placement =\n | 'top'\n | 'bottom'\n | 'left'\n | 'right'\n | 'top-start'\n | 'top-end'\n | 'bottom-start'\n | 'bottom-end'\n | 'left-start'\n | 'left-end'\n | 'right-start'\n | 'right-end';\n\nexport interface Rect {\n top: number;\n left: number;\n width: number;\n height: number;\n}\n\ninterface UsePopoverPositionProps {\n /**\n * The rect of the element.\n */\n elementRect: Rect;\n /**\n * The rect of the popover.\n */\n popoverRect: Rect;\n /**\n * On which side of the element the popover will appear.\n * @default top\n */\n placement?: Placement;\n /**\n * The gap between the element and the popover in em.\n * @default 0.5\n */\n gap?: number;\n /**\n * Whether to flip the popover if it does not fit in the window.\n * @default true\n */\n flip?: boolean;\n}\n\ninterface PopoverPositionGetterOptions {\n elementRect: Rect;\n popoverRect: Rect;\n gap: number;\n flip: boolean;\n}\ntype PositionKeys = 'before' | 'after' | 'start' | 'end' | 'center';\ntype PopoverPositionGetterFn = (\n options: PopoverPositionGetterOptions\n) => number;\ntype PopoverPositionGetters = Record<PositionKeys, PopoverPositionGetterFn>;\ntype FitToWindow = Pick<\n PopoverPositionGetterOptions,\n 'elementRect' | 'popoverRect'\n>;\n\nconst popoverPositionGetters = (\n rectKey: 'top' | 'left'\n): PopoverPositionGetters => {\n const sizeKey = rectKey === 'top' ? 'height' : 'width';\n const windowSizeKey = rectKey === 'top' ? 'innerHeight' : 'innerWidth';\n const windowOffsetKey = rectKey === 'top' ? 'pageYOffset' : 'pageXOffset';\n\n const fitToWindow = (\n start: number,\n { elementRect, popoverRect }: FitToWindow\n ): number => {\n let popoverStart = start;\n const windowStart = window[windowOffsetKey];\n const windowEnd = windowStart + window[windowSizeKey];\n const elementStart = windowStart + elementRect[rectKey];\n const elementEnd = elementStart + elementRect[sizeKey];\n const popoverEnd = popoverStart + popoverRect[sizeKey];\n\n // Fit the popover to the end of the window\n if (popoverEnd > windowEnd) {\n if (elementEnd < windowEnd)\n popoverStart = windowEnd - popoverRect[sizeKey];\n else if (popoverRect[sizeKey] > elementRect[sizeKey])\n popoverStart = elementEnd - popoverRect[sizeKey];\n else if (windowEnd - elementStart > popoverRect[sizeKey])\n popoverStart = windowEnd - popoverRect[sizeKey];\n else popoverStart = elementStart;\n }\n\n // Fit the popover to the beginning of the window\n if (popoverStart < windowStart) {\n if (elementStart > windowStart) popoverStart = windowStart;\n else if (popoverRect[sizeKey] > elementRect[sizeKey])\n popoverStart = elementStart;\n else if (elementEnd - windowStart > popoverRect[sizeKey])\n popoverStart = windowStart;\n else popoverStart = elementEnd - popoverRect[sizeKey];\n }\n\n return popoverStart;\n };\n\n return {\n before(options) {\n const { elementRect, popoverRect, gap, flip } = options;\n const windowStart = window[windowOffsetKey];\n const windowEnd = windowStart + window[windowSizeKey];\n const elementStart = windowStart + elementRect[rectKey];\n const popoverStart = elementStart - popoverRect[sizeKey] - gap;\n if (flip && popoverStart < windowStart) {\n const afterPopoverStart = this.after({ ...options, flip: false });\n const afterPopoverEnd = afterPopoverStart + popoverRect[sizeKey];\n const diffStart = windowStart - popoverStart;\n const diffEnd = afterPopoverEnd - windowEnd;\n if (afterPopoverEnd <= windowEnd || diffStart > diffEnd)\n return afterPopoverStart;\n }\n return popoverStart;\n },\n after(options) {\n const { elementRect, popoverRect, gap, flip } = options;\n const windowStart = window[windowOffsetKey];\n const windowEnd = windowStart + window[windowSizeKey];\n const elementStart = windowStart + elementRect[rectKey];\n const elementEnd = elementStart + elementRect[sizeKey];\n const popoverStart = elementEnd + gap;\n const popoverEnd = popoverStart + popoverRect[sizeKey];\n if (flip && popoverEnd > windowEnd) {\n const beforePopoverStart = this.before({ ...options, flip: false });\n const diffStart = windowStart - beforePopoverStart;\n const diffEnd = popoverEnd - windowEnd;\n if (beforePopoverStart >= windowStart || diffEnd > diffStart)\n return beforePopoverStart;\n }\n return popoverStart;\n },\n start: ({ elementRect, popoverRect }) => {\n const windowStart = window[windowOffsetKey];\n const elementStart = windowStart + elementRect[rectKey];\n return fitToWindow(elementStart, { elementRect, popoverRect });\n },\n end: ({ elementRect, popoverRect }) => {\n const windowStart = window[windowOffsetKey];\n const elementStart = windowStart + elementRect[rectKey];\n const elementEnd = elementStart + elementRect[sizeKey];\n const popoverStart = elementEnd - popoverRect[sizeKey];\n return fitToWindow(popoverStart, { elementRect, popoverRect });\n },\n center: ({ elementRect, popoverRect }) => {\n const windowStart = window[windowOffsetKey];\n const elementStart = windowStart + elementRect[rectKey];\n const popoverStart =\n elementStart + (elementRect[sizeKey] - popoverRect[sizeKey]) / 2;\n return fitToWindow(popoverStart, { elementRect, popoverRect });\n },\n };\n};\n\nconst getPopoverPosition = (\n top: PositionKeys,\n left: PositionKeys,\n options: PopoverPositionGetterOptions\n) => ({\n top: popoverPositionGetters('top')[top](options),\n left: popoverPositionGetters('left')[left](options),\n});\n\ntype PlacementPositionKeysMap = Record<Placement, [PositionKeys, PositionKeys]>;\nconst placementPositionKeysMap: PlacementPositionKeysMap = {\n top: ['before', 'center'],\n bottom: ['after', 'center'],\n left: ['center', 'before'],\n right: ['center', 'after'],\n 'top-start': ['before', 'start'],\n 'top-end': ['before', 'end'],\n 'bottom-start': ['after', 'start'],\n 'bottom-end': ['after', 'end'],\n 'left-start': ['start', 'before'],\n 'left-end': ['end', 'before'],\n 'right-start': ['start', 'after'],\n 'right-end': ['end', 'after'],\n};\n\ninterface PopoverPosition {\n top: number;\n left: number;\n}\n\n/**\n * Computes the position of the popover.\n * Note that you must change the elementRect when the scroll and resize events of the parent scrollable container occur.\n * In most cases, it will be the window.\n */\nconst usePopoverPosition = ({\n elementRect,\n popoverRect,\n placement = 'top',\n gap = 0.5,\n flip = true,\n}: UsePopoverPositionProps): PopoverPosition => {\n const bodyFontSize = useFontSize(document.body);\n const gapPx = useMemo(() => gap * bodyFontSize, [gap, bodyFontSize]);\n\n const positionKeys = useMemo(() => {\n if (typeof placement === 'string' && !!placementPositionKeysMap[placement])\n return placementPositionKeysMap[placement];\n return placementPositionKeysMap.top;\n }, [placement]);\n\n return getPopoverPosition(...positionKeys, {\n elementRect,\n popoverRect,\n gap: gapPx,\n flip,\n });\n};\n\nexport default usePopoverPosition;\n"],"mappings":";;;;;;;AAAA;;AACA;;;;;;;;;;;;;;;;;;;;A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CAAR,EAAkC,CAAClB,GAAD,EAAMkB,YAAN,CAAlC,CAAd;EAEA,IAAMM,YAAY,GAAG,IAAAD,cAAA,EAAQ,YAAM;IACjC,IAAI,OAAON,SAAP,KAAqB,QAArB,IAAiC,CAAC,CAACJ,wBAAwB,CAACI,SAAD,CAA/D,EACE,OAAOJ,wBAAwB,CAACI,SAAD,CAA/B;IACF,OAAOJ,wBAAwB,CAACF,GAAhC;EACD,CAJoB,EAIlB,CAACM,SAAD,CAJkB,CAArB;EAMA,OAAOP,kBAAkB,MAAlB,4BAAsBc,YAAtB,UAAoC;IACzCnC,WAAW,EAAXA,WADyC;IAEzCC,WAAW,EAAXA,WAFyC;IAGzCU,GAAG,EAAEsB,KAHoC;IAIzCrB,IAAI,EAAJA;EAJyC,CAApC,GAAP;AAMD,CAtBD;;eAwBee,kB"}
|
|
1
|
+
{"version":3,"file":"usePopoverPosition.js","names":["popoverPositionGetters","rectKey","sizeKey","windowSizeKey","windowOffsetKey","fitToWindow","start","elementRect","popoverRect","popoverStart","windowStart","window","windowEnd","elementStart","elementEnd","popoverEnd","before","options","gap","flip","afterPopoverStart","after","afterPopoverEnd","diffStart","diffEnd","beforePopoverStart","end","center","getPopoverPosition","top","left","placementPositionKeysMap","bottom","right","usePopoverPosition","placement","bodyFontSize","useFontSize","document","body","gapPx","useMemo","positionKeys"],"sources":["../../../../src/Popover/utils/usePopoverPosition.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { useFontSize } from '@os-design/utils';\n\nexport type Placement =\n | 'top'\n | 'bottom'\n | 'left'\n | 'right'\n | 'top-start'\n | 'top-end'\n | 'bottom-start'\n | 'bottom-end'\n | 'left-start'\n | 'left-end'\n | 'right-start'\n | 'right-end';\n\nexport interface Rect {\n top: number;\n left: number;\n width: number;\n height: number;\n}\n\ninterface UsePopoverPositionProps {\n /**\n * The rect of the element.\n */\n elementRect: Rect;\n /**\n * The rect of the popover.\n */\n popoverRect: Rect;\n /**\n * On which side of the element the popover will appear.\n * @default top\n */\n placement?: Placement;\n /**\n * The gap between the element and the popover in em.\n * @default 0.5\n */\n gap?: number;\n /**\n * Whether to flip the popover if it does not fit in the window.\n * @default true\n */\n flip?: boolean;\n}\n\ninterface PopoverPositionGetterOptions {\n elementRect: Rect;\n popoverRect: Rect;\n gap: number;\n flip: boolean;\n}\ntype PositionKeys = 'before' | 'after' | 'start' | 'end' | 'center';\ntype PopoverPositionGetterFn = (\n options: PopoverPositionGetterOptions\n) => number;\ntype PopoverPositionGetters = Record<PositionKeys, PopoverPositionGetterFn>;\ntype FitToWindow = Pick<\n PopoverPositionGetterOptions,\n 'elementRect' | 'popoverRect'\n>;\n\nconst popoverPositionGetters = (\n rectKey: 'top' | 'left'\n): PopoverPositionGetters => {\n const sizeKey = rectKey === 'top' ? 'height' : 'width';\n const windowSizeKey = rectKey === 'top' ? 'innerHeight' : 'innerWidth';\n const windowOffsetKey = rectKey === 'top' ? 'pageYOffset' : 'pageXOffset';\n\n const fitToWindow = (\n start: number,\n { elementRect, popoverRect }: FitToWindow\n ): number => {\n let popoverStart = start;\n const windowStart = window[windowOffsetKey];\n const windowEnd = windowStart + window[windowSizeKey];\n const elementStart = windowStart + elementRect[rectKey];\n const elementEnd = elementStart + elementRect[sizeKey];\n const popoverEnd = popoverStart + popoverRect[sizeKey];\n\n // Fit the popover to the end of the window\n if (popoverEnd > windowEnd) {\n if (elementEnd < windowEnd)\n popoverStart = windowEnd - popoverRect[sizeKey];\n else if (popoverRect[sizeKey] > elementRect[sizeKey])\n popoverStart = elementEnd - popoverRect[sizeKey];\n else if (windowEnd - elementStart > popoverRect[sizeKey])\n popoverStart = windowEnd - popoverRect[sizeKey];\n else popoverStart = elementStart;\n }\n\n // Fit the popover to the beginning of the window\n if (popoverStart < windowStart) {\n if (elementStart > windowStart) popoverStart = windowStart;\n else if (popoverRect[sizeKey] > elementRect[sizeKey])\n popoverStart = elementStart;\n else if (elementEnd - windowStart > popoverRect[sizeKey])\n popoverStart = windowStart;\n else popoverStart = elementEnd - popoverRect[sizeKey];\n }\n\n return popoverStart;\n };\n\n return {\n before(options) {\n const { elementRect, popoverRect, gap, flip } = options;\n const windowStart = window[windowOffsetKey];\n const windowEnd = windowStart + window[windowSizeKey];\n const elementStart = windowStart + elementRect[rectKey];\n const popoverStart = elementStart - popoverRect[sizeKey] - gap;\n if (flip && popoverStart < windowStart) {\n const afterPopoverStart = this.after({ ...options, flip: false });\n const afterPopoverEnd = afterPopoverStart + popoverRect[sizeKey];\n const diffStart = windowStart - popoverStart;\n const diffEnd = afterPopoverEnd - windowEnd;\n if (afterPopoverEnd <= windowEnd || diffStart > diffEnd)\n return afterPopoverStart;\n }\n return popoverStart;\n },\n after(options) {\n const { elementRect, popoverRect, gap, flip } = options;\n const windowStart = window[windowOffsetKey];\n const windowEnd = windowStart + window[windowSizeKey];\n const elementStart = windowStart + elementRect[rectKey];\n const elementEnd = elementStart + elementRect[sizeKey];\n const popoverStart = elementEnd + gap;\n const popoverEnd = popoverStart + popoverRect[sizeKey];\n if (flip && popoverEnd > windowEnd) {\n const beforePopoverStart = this.before({ ...options, flip: false });\n const diffStart = windowStart - beforePopoverStart;\n const diffEnd = popoverEnd - windowEnd;\n if (beforePopoverStart >= windowStart || diffEnd > diffStart)\n return beforePopoverStart;\n }\n return popoverStart;\n },\n start: ({ elementRect, popoverRect }) => {\n const windowStart = window[windowOffsetKey];\n const elementStart = windowStart + elementRect[rectKey];\n return fitToWindow(elementStart, { elementRect, popoverRect });\n },\n end: ({ elementRect, popoverRect }) => {\n const windowStart = window[windowOffsetKey];\n const elementStart = windowStart + elementRect[rectKey];\n const elementEnd = elementStart + elementRect[sizeKey];\n const popoverStart = elementEnd - popoverRect[sizeKey];\n return fitToWindow(popoverStart, { elementRect, popoverRect });\n },\n center: ({ elementRect, popoverRect }) => {\n const windowStart = window[windowOffsetKey];\n const elementStart = windowStart + elementRect[rectKey];\n const popoverStart =\n elementStart + (elementRect[sizeKey] - popoverRect[sizeKey]) / 2;\n return fitToWindow(popoverStart, { elementRect, popoverRect });\n },\n };\n};\n\nconst getPopoverPosition = (\n top: PositionKeys,\n left: PositionKeys,\n options: PopoverPositionGetterOptions\n) => ({\n top: popoverPositionGetters('top')[top](options),\n left: popoverPositionGetters('left')[left](options),\n});\n\ntype PlacementPositionKeysMap = Record<Placement, [PositionKeys, PositionKeys]>;\nconst placementPositionKeysMap: PlacementPositionKeysMap = {\n top: ['before', 'center'],\n bottom: ['after', 'center'],\n left: ['center', 'before'],\n right: ['center', 'after'],\n 'top-start': ['before', 'start'],\n 'top-end': ['before', 'end'],\n 'bottom-start': ['after', 'start'],\n 'bottom-end': ['after', 'end'],\n 'left-start': ['start', 'before'],\n 'left-end': ['end', 'before'],\n 'right-start': ['start', 'after'],\n 'right-end': ['end', 'after'],\n};\n\ninterface PopoverPosition {\n top: number;\n left: number;\n}\n\n/**\n * Computes the position of the popover.\n * Note that you must change the elementRect when the scroll and resize events of the parent scrollable container occur.\n * In most cases, it will be the window.\n */\nconst usePopoverPosition = ({\n elementRect,\n popoverRect,\n placement = 'top',\n gap = 0.5,\n flip = true,\n}: UsePopoverPositionProps): PopoverPosition => {\n const bodyFontSize = useFontSize(document.body);\n const gapPx = useMemo(() => gap * bodyFontSize, [gap, bodyFontSize]);\n\n const positionKeys = useMemo(() => {\n if (typeof placement === 'string' && !!placementPositionKeysMap[placement])\n return placementPositionKeysMap[placement];\n return placementPositionKeysMap.top;\n }, [placement]);\n\n return getPopoverPosition(...positionKeys, {\n elementRect,\n popoverRect,\n gap: gapPx,\n flip,\n });\n};\n\nexport default usePopoverPosition;\n"],"mappings":";;;;;;AAAA;AACA;AAA+C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiE/C,IAAMA,sBAAsB,GAAG,SAAzBA,sBAAsB,CAC1BC,OAAuB,EACI;EAC3B,IAAMC,OAAO,GAAGD,OAAO,KAAK,KAAK,GAAG,QAAQ,GAAG,OAAO;EACtD,IAAME,aAAa,GAAGF,OAAO,KAA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;IACXC,WAAW,EAAXA,WAAW;IACXU,GAAG,EAAEsB,KAAK;IACVrB,IAAI,EAAJA;EACF,CAAC,GAAC;AACJ,CAAC;AAAC,eAEae,kBAAkB;AAAA"}
|
|
@@ -1,40 +1,24 @@
|
|
|
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 _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
11
|
-
|
|
12
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
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 _excluded = ["percent", "text", "height"];
|
|
21
|
-
|
|
22
14
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
23
|
-
|
|
24
15
|
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); }
|
|
25
|
-
|
|
26
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
|
-
|
|
28
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
29
|
-
|
|
30
18
|
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); }
|
|
31
|
-
|
|
32
19
|
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; }
|
|
33
|
-
|
|
34
20
|
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; }
|
|
35
|
-
|
|
36
21
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
37
|
-
|
|
38
22
|
var Container = (0, _styled["default"])('div', (0, _utils.omitEmotionProps)('size'))(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n ", ";\n"])), _styles.sizeStyles);
|
|
39
23
|
var Trail = (0, _styled["default"])('div', (0, _utils.omitEmotionProps)('height'))(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: 100%;\n background-color: ", ";\n border-radius: ", ";\n overflow: hidden; // To hide the border of the progress bar\n"])), function (p) {
|
|
40
24
|
return (0, _theming.clr)(p.theme.progressColorTrail);
|
|
@@ -52,23 +36,20 @@ var Stroke = (0, _styled["default"])('div', (0, _utils.omitEmotionProps)('percen
|
|
|
52
36
|
}, function (p) {
|
|
53
37
|
return p.percent < 100 ? (0, _theming.clr)(p.theme.progressColorStroke) : (0, _theming.clr)(p.theme.progressColorStrokeSuccess);
|
|
54
38
|
}, (0, _styles.transitionStyles)('width', 'background-color'));
|
|
55
|
-
|
|
56
39
|
var Text = _styled["default"].div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n margin-left: 0.5em;\n color: ", ";\n line-height: 1;\n"])), function (p) {
|
|
57
40
|
return (0, _theming.clr)(p.theme.progressColorPercentage);
|
|
58
41
|
});
|
|
42
|
+
|
|
59
43
|
/**
|
|
60
44
|
* The progress bar.
|
|
61
45
|
*/
|
|
62
|
-
|
|
63
|
-
|
|
64
46
|
var Progress = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
65
47
|
var _ref$percent = _ref.percent,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
48
|
+
percent = _ref$percent === void 0 ? 0 : _ref$percent,
|
|
49
|
+
text = _ref.text,
|
|
50
|
+
_ref$height = _ref.height,
|
|
51
|
+
height = _ref$height === void 0 ? '0.5em' : _ref$height,
|
|
52
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
72
53
|
var validPercent = (0, _react.useMemo)(function () {
|
|
73
54
|
if (percent < 0) return 0;
|
|
74
55
|
if (percent > 100) return 100;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Container","styled","omitEmotionProps","sizeStyles","Trail","p","clr","theme","progressColorTrail","height","Stroke","percent","progressColorStroke","progressColorStrokeSuccess","transitionStyles","Text","div","progressColorPercentage","Progress","forwardRef","ref","text","rest","validPercent","useMemo","textId","Math","random","toString","slice","displayName"],"sources":["../../../src/Progress/index.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport React, { forwardRef, useMemo } from 'react';\nimport { sizeStyles, transitionStyles, WithSize } from '@os-design/styles';\nimport { omitEmotionProps } from '@os-design/utils';\nimport { clr } from '@os-design/theming';\n\ntype JsxDivProps = Omit<JSX.IntrinsicElements['div'], 'ref'>;\nexport interface ProgressProps extends JsxDivProps, WithSize {\n /**\n * The percentage of completion.\n * @default 0\n */\n percent?: number;\n /**\n * The text that is displayed to the right of the progress bar.\n * @default undefined\n */\n text?: string;\n /**\n * The height of the progress bar.\n * @default 0.5em\n */\n height?: string;\n}\n\nconst Container = styled('div', omitEmotionProps('size'))<WithSize>`\n display: flex;\n align-items: center;\n ${sizeStyles};\n`;\n\ntype TrailProps = Required<Pick<ProgressProps, 'height'>>;\nconst Trail = styled('div', omitEmotionProps('height'))<TrailProps>`\n width: 100%;\n background-color: ${(p) => clr(p.theme.progressColorTrail)};\n border-radius: ${(p) => `calc(${p.height} / 2)`};\n overflow: hidden; // To hide the border of the progress bar\n`;\n\ntype StrokeProps = Required<Pick<ProgressProps, 'percent' | 'height'>>;\nconst Stroke = styled(\n 'div',\n omitEmotionProps('percent', 'height')\n)<StrokeProps>`\n width: ${(p) => p.percent}%;\n height: ${(p) => p.height};\n border-radius: 0 ${(p) => `calc(${p.height} / 2)`}\n ${(p) => `calc(${p.height} / 2)`} 0;\n background-color: ${(p) =>\n p.percent < 100\n ? clr(p.theme.progressColorStroke)\n : clr(p.theme.progressColorStrokeSuccess)};\n ${transitionStyles('width', 'background-color')};\n`;\n\nconst Text = styled.div`\n margin-left: 0.5em;\n color: ${(p) => clr(p.theme.progressColorPercentage)};\n line-height: 1;\n`;\n\n/**\n * The progress bar.\n */\nconst Progress = forwardRef<HTMLDivElement, ProgressProps>(\n ({ percent = 0, text, height = '0.5em', ...rest }, ref) => {\n const validPercent = useMemo(() => {\n if (percent < 0) return 0;\n if (percent > 100) return 100;\n return percent;\n }, [percent]);\n\n const textId = useMemo(\n () => `progress-bar-text-${Math.random().toString(36).slice(2, 11)}`,\n []\n );\n\n return (\n <Container\n role='progressbar'\n aria-valuenow={validPercent}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-describedby={textId}\n {...rest}\n ref={ref}\n >\n <Trail height={height}>\n <Stroke percent={validPercent} height={height} />\n </Trail>\n {text && <Text id={textId}>{text}</Text>}\n </Container>\n );\n }\n);\n\nProgress.displayName = 'Progress';\n\nexport default Progress;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["Container","styled","omitEmotionProps","sizeStyles","Trail","p","clr","theme","progressColorTrail","height","Stroke","percent","progressColorStroke","progressColorStrokeSuccess","transitionStyles","Text","div","progressColorPercentage","Progress","forwardRef","ref","text","rest","validPercent","useMemo","textId","Math","random","toString","slice","displayName"],"sources":["../../../src/Progress/index.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport React, { forwardRef, useMemo } from 'react';\nimport { sizeStyles, transitionStyles, WithSize } from '@os-design/styles';\nimport { omitEmotionProps } from '@os-design/utils';\nimport { clr } from '@os-design/theming';\n\ntype JsxDivProps = Omit<JSX.IntrinsicElements['div'], 'ref'>;\nexport interface ProgressProps extends JsxDivProps, WithSize {\n /**\n * The percentage of completion.\n * @default 0\n */\n percent?: number;\n /**\n * The text that is displayed to the right of the progress bar.\n * @default undefined\n */\n text?: string;\n /**\n * The height of the progress bar.\n * @default 0.5em\n */\n height?: string;\n}\n\nconst Container = styled('div', omitEmotionProps('size'))<WithSize>`\n display: flex;\n align-items: center;\n ${sizeStyles};\n`;\n\ntype TrailProps = Required<Pick<ProgressProps, 'height'>>;\nconst Trail = styled('div', omitEmotionProps('height'))<TrailProps>`\n width: 100%;\n background-color: ${(p) => clr(p.theme.progressColorTrail)};\n border-radius: ${(p) => `calc(${p.height} / 2)`};\n overflow: hidden; // To hide the border of the progress bar\n`;\n\ntype StrokeProps = Required<Pick<ProgressProps, 'percent' | 'height'>>;\nconst Stroke = styled(\n 'div',\n omitEmotionProps('percent', 'height')\n)<StrokeProps>`\n width: ${(p) => p.percent}%;\n height: ${(p) => p.height};\n border-radius: 0 ${(p) => `calc(${p.height} / 2)`}\n ${(p) => `calc(${p.height} / 2)`} 0;\n background-color: ${(p) =>\n p.percent < 100\n ? clr(p.theme.progressColorStroke)\n : clr(p.theme.progressColorStrokeSuccess)};\n ${transitionStyles('width', 'background-color')};\n`;\n\nconst Text = styled.div`\n margin-left: 0.5em;\n color: ${(p) => clr(p.theme.progressColorPercentage)};\n line-height: 1;\n`;\n\n/**\n * The progress bar.\n */\nconst Progress = forwardRef<HTMLDivElement, ProgressProps>(\n ({ percent = 0, text, height = '0.5em', ...rest }, ref) => {\n const validPercent = useMemo(() => {\n if (percent < 0) return 0;\n if (percent > 100) return 100;\n return percent;\n }, [percent]);\n\n const textId = useMemo(\n () => `progress-bar-text-${Math.random().toString(36).slice(2, 11)}`,\n []\n );\n\n return (\n <Container\n role='progressbar'\n aria-valuenow={validPercent}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-describedby={textId}\n {...rest}\n ref={ref}\n >\n <Trail height={height}>\n <Stroke percent={validPercent} height={height} />\n </Trail>\n {text && <Text id={textId}>{text}</Text>}\n </Container>\n );\n }\n);\n\nProgress.displayName = 'Progress';\n\nexport default Progress;\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AAAyC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAqBzC,IAAMA,SAAS,GAAG,IAAAC,kBAAM,EAAC,KAAK,EAAE,IAAAC,uBAAgB,EAAC,MAAM,CAAC,CAAC,2HAGrDC,kBAAU,CACb;AAGD,IAAMC,KAAK,GAAG,IAAAH,kBAAM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,EAAC,YAAM;IACjC,IAAIb,OAAO,GAAG,CAAC,EAAE,OAAO,CAAC;IACzB,IAAIA,OAAO,GAAG,GAAG,EAAE,OAAO,GAAG;IAC7B,OAAOA,OAAO;EAChB,CAAC,EAAE,CAACA,OAAO,CAAC,CAAC;EAEb,IAAMc,MAAM,GAAG,IAAAD,cAAO,EACpB;IAAA,mCAA2BE,IAAI,CAACC,MAAM,EAAE,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;EAAA,CAAE,EACpE,EAAE,CACH;EAED,oBACE,gCAAC,SAAS;IACR,IAAI,EAAC,aAAa;IAClB,iBAAeN,YAAa;IAC5B,iBAAe,CAAE;IACjB,iBAAe,GAAI;IACnB,oBAAkBE;EAAO,GACrBH,IAAI;IACR,GAAG,EAAEF;EAAI,iBAET,gCAAC,KAAK;IAAC,MAAM,EAAEX;EAAO,gBACpB,gCAAC,MAAM;IAAC,OAAO,EAAEc,YAAa;IAAC,MAAM,EAAEd;EAAO,EAAG,CAC3C,EACPY,IAAI,iBAAI,gCAAC,IAAI;IAAC,EAAE,EAAEI;EAAO,GAAEJ,IAAI,CAAQ,CAC9B;AAEhB,CAAC,CACF;AAEDH,QAAQ,CAACY,WAAW,GAAG,UAAU;AAAC,eAEnBZ,QAAQ;AAAA"}
|
|
@@ -1,98 +1,70 @@
|
|
|
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 _utils = require("@os-design/utils");
|
|
13
|
-
|
|
14
10
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
15
|
-
|
|
16
11
|
var _media = require("@os-design/media");
|
|
17
|
-
|
|
18
12
|
var _theming = require("@os-design/theming");
|
|
19
|
-
|
|
20
13
|
var _react2 = require("@emotion/react");
|
|
21
|
-
|
|
22
14
|
var _Button = _interopRequireDefault(require("../Button"));
|
|
23
|
-
|
|
24
15
|
var _excluded = ["options", "wide", "disabled", "value", "defaultValue", "onChange", "size"],
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
_excluded2 = ["title", "value", "disabled", "onClick"];
|
|
27
17
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
28
|
-
|
|
29
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
30
|
-
|
|
31
19
|
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); }
|
|
32
|
-
|
|
33
20
|
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; }
|
|
34
|
-
|
|
35
21
|
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); }
|
|
36
|
-
|
|
37
22
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
38
|
-
|
|
39
23
|
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."); }
|
|
40
|
-
|
|
41
24
|
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); }
|
|
42
|
-
|
|
43
25
|
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; }
|
|
44
|
-
|
|
45
26
|
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; }
|
|
46
|
-
|
|
47
27
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
48
|
-
|
|
49
28
|
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; }
|
|
50
|
-
|
|
51
29
|
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; }
|
|
52
|
-
|
|
53
30
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
54
|
-
|
|
55
31
|
var wideDefaultStyles = function wideDefaultStyles(p) {
|
|
56
32
|
return p.wide === 'default' && (0, _react2.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", " {\n width: 100%;\n & > button {\n flex: 1;\n }\n }\n "])), _media.m.max.xxs);
|
|
57
33
|
};
|
|
58
|
-
|
|
59
34
|
var wideAlwaysStyles = function wideAlwaysStyles(p) {
|
|
60
35
|
return p.wide === 'always' && (0, _react2.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: 100%;\n & > button {\n flex: 1;\n }\n "])));
|
|
61
36
|
};
|
|
62
|
-
|
|
63
37
|
var Container = (0, _styled["default"])('div', (0, _utils.omitEmotionProps)('wide', 'disabled'))(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: inline-flex;\n flex-wrap: wrap;\n\n border-radius: ", "em;\n overflow: hidden;\n border: 1px solid\n ", ";\n\n ", ";\n ", ";\n"])), function (p) {
|
|
64
38
|
return p.theme.borderRadius;
|
|
65
39
|
}, function (p) {
|
|
66
40
|
return p.disabled ? (0, _theming.clr)(p.theme.buttonDisabledGhostColorText) : (0, _theming.clr)(p.theme.colorPrimary);
|
|
67
41
|
}, wideDefaultStyles, wideAlwaysStyles);
|
|
68
42
|
var StyledButton = (0, _styled["default"])(_Button["default"])(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n border-radius: 0;\n"])));
|
|
43
|
+
|
|
69
44
|
/**
|
|
70
45
|
* The radio buttons that allow a user to select only one of a limited number of options.
|
|
71
46
|
*/
|
|
72
|
-
|
|
73
47
|
var RadioGroup = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
74
48
|
var _ref$options = _ref.options,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
49
|
+
options = _ref$options === void 0 ? [] : _ref$options,
|
|
50
|
+
_ref$wide = _ref.wide,
|
|
51
|
+
wide = _ref$wide === void 0 ? 'default' : _ref$wide,
|
|
52
|
+
_ref$disabled = _ref.disabled,
|
|
53
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
54
|
+
value = _ref.value,
|
|
55
|
+
defaultValue = _ref.defaultValue,
|
|
56
|
+
_ref$onChange = _ref.onChange,
|
|
57
|
+
onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
|
|
58
|
+
size = _ref.size,
|
|
59
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
87
60
|
var _useForwardedState = (0, _utils.useForwardedState)({
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
61
|
+
value: value,
|
|
62
|
+
defaultValue: defaultValue,
|
|
63
|
+
onChange: onChange
|
|
64
|
+
}),
|
|
65
|
+
_useForwardedState2 = _slicedToArray(_useForwardedState, 2),
|
|
66
|
+
forwardedValue = _useForwardedState2[0],
|
|
67
|
+
setForwardedValue = _useForwardedState2[1];
|
|
96
68
|
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(Container, _extends({
|
|
97
69
|
wide: wide,
|
|
98
70
|
disabled: disabled
|
|
@@ -100,12 +72,11 @@ var RadioGroup = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
100
72
|
ref: ref
|
|
101
73
|
}), options === null || options === void 0 ? void 0 : options.map(function (_ref2) {
|
|
102
74
|
var title = _ref2.title,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
75
|
+
valueOption = _ref2.value,
|
|
76
|
+
disabledOption = _ref2.disabled,
|
|
77
|
+
_ref2$onClick = _ref2.onClick,
|
|
78
|
+
_onClick = _ref2$onClick === void 0 ? function () {} : _ref2$onClick,
|
|
79
|
+
buttonRest = _objectWithoutProperties(_ref2, _excluded2);
|
|
109
80
|
return /*#__PURE__*/_react["default"].createElement(StyledButton, _extends({
|
|
110
81
|
key: valueOption,
|
|
111
82
|
type: forwardedValue === valueOption ? 'primary' : 'ghost',
|
|
@@ -114,7 +85,6 @@ var RadioGroup = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
114
85
|
size: size,
|
|
115
86
|
onClick: function onClick(e) {
|
|
116
87
|
setForwardedValue(valueOption);
|
|
117
|
-
|
|
118
88
|
_onClick(e);
|
|
119
89
|
}
|
|
120
90
|
}, buttonRest), title);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["wideDefaultStyles","p","wide","css","m","max","xxs","wideAlwaysStyles","Container","styled","omitEmotionProps","theme","borderRadius","disabled","clr","buttonDisabledGhostColorText","colorPrimary","StyledButton","Button","RadioGroup","forwardRef","ref","options","value","defaultValue","onChange","size","rest","useForwardedState","forwardedValue","setForwardedValue","map","title","valueOption","disabledOption","onClick","buttonRest","e","displayName"],"sources":["../../../src/RadioGroup/index.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { WithSize } from '@os-design/styles';\nimport { omitEmotionProps, useForwardedState } from '@os-design/utils';\nimport styled from '@emotion/styled';\nimport { m } from '@os-design/media';\nimport { clr } from '@os-design/theming';\nimport { css } from '@emotion/react';\nimport Button, { ButtonProps } from '../Button';\n\nexport interface RadioGroupOption\n extends Omit<ButtonProps, 'type' | 'wide' | 'size'> {\n /**\n * The title of the option.\n */\n title: string;\n /**\n * The value of the option.\n */\n value: string;\n}\n\ntype JsxDivProps = Omit<\n JSX.IntrinsicElements['div'],\n 'value' | 'defaultValue' | 'onChange' | 'ref'\n>;\nexport interface RadioGroupProps extends JsxDivProps, WithSize {\n /**\n * Options of the radio group.\n * @default undefined\n */\n options?: RadioGroupOption[];\n /**\n * Whether the radio group has full width.\n * Possible values:\n * `default` – the radio group has full width if the screen width is less than xs;\n * `always` – the radio group always has full width;\n * `never` – the radio group never has full width.\n * @default default\n */\n wide?: 'default' | 'always' | 'never';\n /**\n * Whether the radio group is disabled.\n * @default false\n */\n disabled?: boolean;\n /**\n * Selected option.\n * @default false\n */\n value?: string;\n /**\n * The default value.\n * @default undefined\n */\n defaultValue?: string;\n /**\n * The change event handler.\n * @default undefined\n */\n onChange?: (value: string) => void;\n}\n\nconst wideDefaultStyles = (p) =>\n p.wide === 'default' &&\n css`\n ${m.max.xxs} {\n width: 100%;\n & > button {\n flex: 1;\n }\n }\n `;\n\nconst wideAlwaysStyles = (p) =>\n p.wide === 'always' &&\n css`\n width: 100%;\n & > button {\n flex: 1;\n }\n `;\n\ntype ContainerProps = Required<Pick<RadioGroupProps, 'wide' | 'disabled'>>;\nconst Container = styled(\n 'div',\n omitEmotionProps('wide', 'disabled')\n)<ContainerProps>`\n display: inline-flex;\n flex-wrap: wrap;\n\n border-radius: ${(p) => p.theme.borderRadius}em;\n overflow: hidden;\n border: 1px solid\n ${(p) =>\n p.disabled\n ? clr(p.theme.buttonDisabledGhostColorText)\n : clr(p.theme.colorPrimary)};\n\n ${wideDefaultStyles};\n ${wideAlwaysStyles};\n`;\n\nconst StyledButton = styled(Button)`\n border-radius: 0;\n`;\n\n/**\n * The radio buttons that allow a user to select only one of a limited number of options.\n */\nconst RadioGroup = forwardRef<HTMLDivElement, RadioGroupProps>(\n (\n {\n options = [],\n wide = 'default',\n disabled = false,\n value,\n defaultValue,\n onChange = () => {},\n size,\n ...rest\n },\n ref\n ) => {\n const [forwardedValue, setForwardedValue] = useForwardedState({\n value,\n defaultValue,\n onChange,\n });\n\n return (\n <div>\n <Container wide={wide} disabled={disabled} {...rest} ref={ref}>\n {options?.map(\n ({\n title,\n value: valueOption,\n disabled: disabledOption,\n onClick = () => {},\n ...buttonRest\n }) => (\n <StyledButton\n key={valueOption}\n type={forwardedValue === valueOption ? 'primary' : 'ghost'}\n wide='never'\n disabled={disabled || disabledOption}\n size={size}\n onClick={(e) => {\n setForwardedValue(valueOption);\n onClick(e);\n }}\n {...buttonRest}\n >\n {title}\n </StyledButton>\n )\n )}\n </Container>\n </div>\n );\n }\n);\n\nRadioGroup.displayName = 'RadioGroup';\n\nexport default RadioGroup;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["wideDefaultStyles","p","wide","css","m","max","xxs","wideAlwaysStyles","Container","styled","omitEmotionProps","theme","borderRadius","disabled","clr","buttonDisabledGhostColorText","colorPrimary","StyledButton","Button","RadioGroup","forwardRef","ref","options","value","defaultValue","onChange","size","rest","useForwardedState","forwardedValue","setForwardedValue","map","title","valueOption","disabledOption","onClick","buttonRest","e","displayName"],"sources":["../../../src/RadioGroup/index.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { WithSize } from '@os-design/styles';\nimport { omitEmotionProps, useForwardedState } from '@os-design/utils';\nimport styled from '@emotion/styled';\nimport { m } from '@os-design/media';\nimport { clr } from '@os-design/theming';\nimport { css } from '@emotion/react';\nimport Button, { ButtonProps } from '../Button';\n\nexport interface RadioGroupOption\n extends Omit<ButtonProps, 'type' | 'wide' | 'size'> {\n /**\n * The title of the option.\n */\n title: string;\n /**\n * The value of the option.\n */\n value: string;\n}\n\ntype JsxDivProps = Omit<\n JSX.IntrinsicElements['div'],\n 'value' | 'defaultValue' | 'onChange' | 'ref'\n>;\nexport interface RadioGroupProps extends JsxDivProps, WithSize {\n /**\n * Options of the radio group.\n * @default undefined\n */\n options?: RadioGroupOption[];\n /**\n * Whether the radio group has full width.\n * Possible values:\n * `default` – the radio group has full width if the screen width is less than xs;\n * `always` – the radio group always has full width;\n * `never` – the radio group never has full width.\n * @default default\n */\n wide?: 'default' | 'always' | 'never';\n /**\n * Whether the radio group is disabled.\n * @default false\n */\n disabled?: boolean;\n /**\n * Selected option.\n * @default false\n */\n value?: string;\n /**\n * The default value.\n * @default undefined\n */\n defaultValue?: string;\n /**\n * The change event handler.\n * @default undefined\n */\n onChange?: (value: string) => void;\n}\n\nconst wideDefaultStyles = (p) =>\n p.wide === 'default' &&\n css`\n ${m.max.xxs} {\n width: 100%;\n & > button {\n flex: 1;\n }\n }\n `;\n\nconst wideAlwaysStyles = (p) =>\n p.wide === 'always' &&\n css`\n width: 100%;\n & > button {\n flex: 1;\n }\n `;\n\ntype ContainerProps = Required<Pick<RadioGroupProps, 'wide' | 'disabled'>>;\nconst Container = styled(\n 'div',\n omitEmotionProps('wide', 'disabled')\n)<ContainerProps>`\n display: inline-flex;\n flex-wrap: wrap;\n\n border-radius: ${(p) => p.theme.borderRadius}em;\n overflow: hidden;\n border: 1px solid\n ${(p) =>\n p.disabled\n ? clr(p.theme.buttonDisabledGhostColorText)\n : clr(p.theme.colorPrimary)};\n\n ${wideDefaultStyles};\n ${wideAlwaysStyles};\n`;\n\nconst StyledButton = styled(Button)`\n border-radius: 0;\n`;\n\n/**\n * The radio buttons that allow a user to select only one of a limited number of options.\n */\nconst RadioGroup = forwardRef<HTMLDivElement, RadioGroupProps>(\n (\n {\n options = [],\n wide = 'default',\n disabled = false,\n value,\n defaultValue,\n onChange = () => {},\n size,\n ...rest\n },\n ref\n ) => {\n const [forwardedValue, setForwardedValue] = useForwardedState({\n value,\n defaultValue,\n onChange,\n });\n\n return (\n <div>\n <Container wide={wide} disabled={disabled} {...rest} ref={ref}>\n {options?.map(\n ({\n title,\n value: valueOption,\n disabled: disabledOption,\n onClick = () => {},\n ...buttonRest\n }) => (\n <StyledButton\n key={valueOption}\n type={forwardedValue === valueOption ? 'primary' : 'ghost'}\n wide='never'\n disabled={disabled || disabledOption}\n size={size}\n onClick={(e) => {\n setForwardedValue(valueOption);\n onClick(e);\n }}\n {...buttonRest}\n >\n {title}\n </StyledButton>\n )\n )}\n </Container>\n </div>\n );\n }\n);\n\nRadioGroup.displayName = 'RadioGroup';\n\nexport default RadioGroup;\n"],"mappings":";;;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AAAgD;EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAuDhD,IAAMA,iBAAiB,GAAG,SAApBA,iBAAiB,CAAIC,CAAC;EAAA,OAC1BA,CAAC,CAACC,IAAI,KAAK,SAAS,QACpBC,WAAG,iKACCC,QAAC,CAACC,GAAG,CAACC,GAAG,CAMZ;AAAA;AAEH,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgB,CAAIN,CAAC;EAAA,OACzBA,CAAC,CAACC,IAAI,KAAK,QAAQ,QACnBC,WAAG,uIAKF;AAAA;AAGH,IAAMK,SAAS,GAAG,IAAAC,kBAAM,EACtB,KAAK,EACL,IAAAC,uBAAgB,EAAC,MAAM,EAAE,UAAU,CAAC,CACrC,4NAIkB,UAACT,CAAC;EAAA,OAAKA,CAAC,CAACU,KAAK,CAACC,YAAY;AAAA,GAGxC,UAACX,CAAC;EAAA,OACFA,CAAC,CAACY,QAAQ,GACN,IAAAC,YAAG,EAACb,CAAC,CAACU,KAAK,CAACI,4BAA4B,CAAC,GACzC,IAAAD,YAAG,EAACb,CAAC,CAACU,KAAK,CAACK,YAAY,CAAC;AAAA,GAE/B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,WAAW,CAAC;QAC9BE,QAAO,CAACE,CAAC,CAAC;MACZ;IAAE,GACED,UAAU,GAEbJ,KAAK,CACO;EAAA,CAChB,CACF,CACS,CACR;AAEV,CAAC,CACF;AAEDb,UAAU,CAACmB,WAAW,GAAG,YAAY;AAAC,eAEvBnB,UAAU;AAAA"}
|
|
@@ -1,52 +1,35 @@
|
|
|
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 _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
11
|
-
|
|
12
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
-
|
|
14
10
|
var _styles = require("@os-design/styles");
|
|
15
|
-
|
|
16
11
|
var _utils = require("@os-design/utils");
|
|
17
|
-
|
|
18
12
|
var _Skeleton = _interopRequireDefault(require("../Skeleton"));
|
|
19
|
-
|
|
20
13
|
var _excluded = ["width"];
|
|
21
|
-
|
|
22
14
|
var _templateObject;
|
|
23
|
-
|
|
24
15
|
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); }
|
|
25
|
-
|
|
26
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
|
-
|
|
28
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
29
|
-
|
|
30
18
|
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); }
|
|
31
|
-
|
|
32
19
|
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; }
|
|
33
|
-
|
|
34
20
|
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; }
|
|
35
|
-
|
|
36
21
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
37
|
-
|
|
38
22
|
var StyledRadioGroupSkeleton = (0, _styled["default"])(_Skeleton["default"], (0, _utils.omitEmotionProps)('size'))(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: calc(", "em + 2px);\n ", ";\n"])), function (p) {
|
|
39
23
|
return p.theme.baseHeight;
|
|
40
24
|
}, _styles.sizeStyles);
|
|
25
|
+
|
|
41
26
|
/**
|
|
42
27
|
* Provides a radio group placeholder while a user waits for the content to load.
|
|
43
28
|
*/
|
|
44
|
-
|
|
45
29
|
var RadioGroupSkeleton = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
46
30
|
var _ref$width = _ref.width,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
31
|
+
width = _ref$width === void 0 ? '10em' : _ref$width,
|
|
32
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
50
33
|
return /*#__PURE__*/_react["default"].createElement(StyledRadioGroupSkeleton, _extends({
|
|
51
34
|
width: width
|
|
52
35
|
}, rest, {
|