@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":["fadeIn","keyframes","fadeOut","visibleStyles","p","visible","css","theme","transitionDelay","invisibleStyles","Container","styled","PageHeaderContainer","omitEmotionProps","CloseButton","Button","pageHeaderAddonPaddingHorizontal","PageHeaderInputSearch","forwardRef","ref","locale","defaultLocale","onClose","rest","useState","setVisible","useTheme","mounted","useClosable","useContext","LayoutContext","hasNavigation","searchLabel","t","buttonPaddingHorizontal","pageHeaderButtonPaddingHorizontal","closeLabel","displayName"],"sources":["../../../src/PageHeaderInputSearch/index.tsx"],"sourcesContent":["import React, { forwardRef, useContext, useState } from 'react';\nimport { Close, Search } from '@os-design/icons';\nimport styled from '@emotion/styled';\nimport { useClosable, omitEmotionProps } from '@os-design/utils';\nimport { ThemeOverrider, useTheme } from '@os-design/theming';\nimport { css, keyframes } from '@emotion/react';\nimport InputSearch, { InputSearchProps } from '../InputSearch';\nimport Button from '../Button';\nimport { PageHeaderContainer } from '../PageHeader';\nimport LayoutContext from '../Layout/LayoutContext';\nimport defaultLocale, {\n PageHeaderInputSearchLocale,\n} from './utils/defaultLocale';\n\nexport interface PageHeaderInputSearchProps\n extends Omit<InputSearchProps, 'size' | 'locale'> {\n /**\n * The locale.\n * @default undefined\n */\n locale?: PageHeaderInputSearchLocale;\n /**\n * The close event handler.\n * @default undefined\n */\n onClose?: () => void;\n}\n\nconst fadeIn = keyframes`\n from { transform: translateY(-100%); }\n to { transform: translateY(0); }\n`;\n\nconst fadeOut = keyframes`\n from { transform: translateY(0); }\n to { transform: translateY(-100%); }\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 ContainerProps {\n visible: boolean;\n}\nconst Container = styled(\n PageHeaderContainer,\n omitEmotionProps('visible')\n)<ContainerProps>`\n z-index: 102; // After PageHeaderContainer\n ${visibleStyles};\n ${invisibleStyles};\n`;\n\nconst CloseButton = styled(Button)`\n margin-left: ${(p) => p.theme.pageHeaderAddonPaddingHorizontal}em;\n`;\n\n/**\n * The search input for the page header.\n */\nconst PageHeaderInputSearch = forwardRef<\n HTMLInputElement,\n PageHeaderInputSearchProps\n>(({ locale = defaultLocale, onClose = () => {}, ...rest }, ref) => {\n const [visible, setVisible] = useState(false);\n const { theme } = useTheme();\n const mounted = useClosable(visible, theme.transitionDelay);\n const { hasNavigation } = useContext(LayoutContext);\n\n return (\n <>\n <Button\n type='ghost'\n wide='never'\n onClick={() => setVisible(true)}\n aria-label={locale.searchLabel}\n >\n <Search />\n </Button>\n\n {mounted && (\n <ThemeOverrider\n overrides={(t) => ({\n buttonPaddingHorizontal: t.pageHeaderButtonPaddingHorizontal,\n })}\n >\n <Container\n visible={visible}\n rightIsGhostButton\n hasNavigationIndent={hasNavigation}\n >\n <InputSearch autoFocus locale={locale} {...rest} ref={ref} />\n <CloseButton\n type='ghost'\n wide='never'\n onClick={() => {\n setVisible(false);\n onClose();\n }}\n aria-label={locale.closeLabel}\n >\n <Close />\n </CloseButton>\n </Container>\n </ThemeOverrider>\n )}\n </>\n );\n});\n\nPageHeaderInputSearch.displayName = 'PageHeaderInputSearch';\n\nexport default PageHeaderInputSearch;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["fadeIn","keyframes","fadeOut","visibleStyles","p","visible","css","theme","transitionDelay","invisibleStyles","Container","styled","PageHeaderContainer","omitEmotionProps","CloseButton","Button","pageHeaderAddonPaddingHorizontal","PageHeaderInputSearch","forwardRef","ref","locale","defaultLocale","onClose","rest","useState","setVisible","useTheme","mounted","useClosable","useContext","LayoutContext","hasNavigation","searchLabel","t","buttonPaddingHorizontal","pageHeaderButtonPaddingHorizontal","closeLabel","displayName"],"sources":["../../../src/PageHeaderInputSearch/index.tsx"],"sourcesContent":["import React, { forwardRef, useContext, useState } from 'react';\nimport { Close, Search } from '@os-design/icons';\nimport styled from '@emotion/styled';\nimport { useClosable, omitEmotionProps } from '@os-design/utils';\nimport { ThemeOverrider, useTheme } from '@os-design/theming';\nimport { css, keyframes } from '@emotion/react';\nimport InputSearch, { InputSearchProps } from '../InputSearch';\nimport Button from '../Button';\nimport { PageHeaderContainer } from '../PageHeader';\nimport LayoutContext from '../Layout/LayoutContext';\nimport defaultLocale, {\n PageHeaderInputSearchLocale,\n} from './utils/defaultLocale';\n\nexport interface PageHeaderInputSearchProps\n extends Omit<InputSearchProps, 'size' | 'locale'> {\n /**\n * The locale.\n * @default undefined\n */\n locale?: PageHeaderInputSearchLocale;\n /**\n * The close event handler.\n * @default undefined\n */\n onClose?: () => void;\n}\n\nconst fadeIn = keyframes`\n from { transform: translateY(-100%); }\n to { transform: translateY(0); }\n`;\n\nconst fadeOut = keyframes`\n from { transform: translateY(0); }\n to { transform: translateY(-100%); }\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 ContainerProps {\n visible: boolean;\n}\nconst Container = styled(\n PageHeaderContainer,\n omitEmotionProps('visible')\n)<ContainerProps>`\n z-index: 102; // After PageHeaderContainer\n ${visibleStyles};\n ${invisibleStyles};\n`;\n\nconst CloseButton = styled(Button)`\n margin-left: ${(p) => p.theme.pageHeaderAddonPaddingHorizontal}em;\n`;\n\n/**\n * The search input for the page header.\n */\nconst PageHeaderInputSearch = forwardRef<\n HTMLInputElement,\n PageHeaderInputSearchProps\n>(({ locale = defaultLocale, onClose = () => {}, ...rest }, ref) => {\n const [visible, setVisible] = useState(false);\n const { theme } = useTheme();\n const mounted = useClosable(visible, theme.transitionDelay);\n const { hasNavigation } = useContext(LayoutContext);\n\n return (\n <>\n <Button\n type='ghost'\n wide='never'\n onClick={() => setVisible(true)}\n aria-label={locale.searchLabel}\n >\n <Search />\n </Button>\n\n {mounted && (\n <ThemeOverrider\n overrides={(t) => ({\n buttonPaddingHorizontal: t.pageHeaderButtonPaddingHorizontal,\n })}\n >\n <Container\n visible={visible}\n rightIsGhostButton\n hasNavigationIndent={hasNavigation}\n >\n <InputSearch autoFocus locale={locale} {...rest} ref={ref} />\n <CloseButton\n type='ghost'\n wide='never'\n onClick={() => {\n setVisible(false);\n onClose();\n }}\n aria-label={locale.closeLabel}\n >\n <Close />\n </CloseButton>\n </Container>\n </ThemeOverrider>\n )}\n </>\n );\n});\n\nPageHeaderInputSearch.displayName = 'PageHeaderInputSearch';\n\nexport default PageHeaderInputSearch;\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAE+B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgB/B,IAAMA,MAAM,OAAGC,iBAAS,sJAGvB;AAED,IAAMC,OAAO,OAAGD,iBAAS,wJAGxB;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,eAA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;MAC7B,CAAC;IAAA;EAAE,gBAEH,gCAAC,SAAS;IACR,OAAO,EAAE9B,OAAQ;IACjB,kBAAkB;IAClB,mBAAmB,EAAE0B;EAAc,gBAEnC,gCAAC,uBAAW;IAAC,SAAS;IAAC,MAAM,EAAEX;EAAO,GAAKG,IAAI;IAAE,GAAG,EAAEJ;EAAI,GAAG,eAC7D,gCAAC,WAAW;IACV,IAAI,EAAC,OAAO;IACZ,IAAI,EAAC,OAAO;IACZ,OAAO,EAAE,mBAAM;MACbM,UAAU,CAAC,KAAK,CAAC;MACjBH,OAAO,EAAE;IACX,CAAE;IACF,cAAYF,MAAM,CAACgB;EAAW,gBAE9B,gCAAC,YAAK,OAAG,CACG,CACJ,CAEf,CACA;AAEP,CAAC,CAAC;AAEFnB,qBAAqB,CAACoB,WAAW,GAAG,uBAAuB;AAAC,eAE7CpB,qBAAqB;AAAA"}
|
|
@@ -4,22 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
var _defaultLocale = _interopRequireDefault(require("../../InputSearch/utils/defaultLocale"));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
9
|
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; }
|
|
13
|
-
|
|
14
10
|
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; }
|
|
15
|
-
|
|
16
11
|
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; }
|
|
17
|
-
|
|
18
12
|
var defaultLocale = _objectSpread(_objectSpread({}, _defaultLocale["default"]), {}, {
|
|
19
13
|
searchLabel: 'Search',
|
|
20
14
|
closeLabel: 'Close search'
|
|
21
15
|
});
|
|
22
|
-
|
|
23
16
|
var _default = defaultLocale;
|
|
24
17
|
exports["default"] = _default;
|
|
25
18
|
//# sourceMappingURL=defaultLocale.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultLocale.js","names":["defaultLocale","inputSearchDefaultLocale","searchLabel","closeLabel"],"sources":["../../../../src/PageHeaderInputSearch/utils/defaultLocale.ts"],"sourcesContent":["import inputSearchDefaultLocale, {\n InputSearchLocale,\n} from '../../InputSearch/utils/defaultLocale';\n\nexport interface PageHeaderInputSearchLocale extends InputSearchLocale {\n searchLabel: string;\n closeLabel: string;\n}\n\nconst defaultLocale: PageHeaderInputSearchLocale = {\n ...inputSearchDefaultLocale,\n searchLabel: 'Search',\n closeLabel: 'Close search',\n};\n\nexport default defaultLocale;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"defaultLocale.js","names":["defaultLocale","inputSearchDefaultLocale","searchLabel","closeLabel"],"sources":["../../../../src/PageHeaderInputSearch/utils/defaultLocale.ts"],"sourcesContent":["import inputSearchDefaultLocale, {\n InputSearchLocale,\n} from '../../InputSearch/utils/defaultLocale';\n\nexport interface PageHeaderInputSearchLocale extends InputSearchLocale {\n searchLabel: string;\n closeLabel: string;\n}\n\nconst defaultLocale: PageHeaderInputSearchLocale = {\n ...inputSearchDefaultLocale,\n searchLabel: 'Search',\n closeLabel: 'Close search',\n};\n\nexport default defaultLocale;\n"],"mappings":";;;;;;AAAA;AAE+C;AAAA;AAAA;AAAA;AAO/C,IAAMA,aAA0C,mCAC3CC,yBAAwB;EAC3BC,WAAW,EAAE,QAAQ;EACrBC,UAAU,EAAE;AAAc,EAC3B;AAAC,eAEaH,aAAa;AAAA"}
|
|
@@ -1,46 +1,31 @@
|
|
|
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 _Skeleton = _interopRequireDefault(require("../Skeleton"));
|
|
13
|
-
|
|
14
10
|
var _PageHeader = require("../PageHeader");
|
|
15
|
-
|
|
16
11
|
var _LayoutContext = _interopRequireDefault(require("../Layout/LayoutContext"));
|
|
17
|
-
|
|
18
12
|
var _excluded = ["width"];
|
|
19
|
-
|
|
20
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
-
|
|
22
14
|
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); }
|
|
23
|
-
|
|
24
15
|
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; }
|
|
25
|
-
|
|
26
16
|
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); }
|
|
27
|
-
|
|
28
17
|
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; }
|
|
29
|
-
|
|
30
18
|
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; }
|
|
31
|
-
|
|
32
19
|
/**
|
|
33
20
|
* Provides a page header placeholder while a user waits for
|
|
34
21
|
* the content to load.
|
|
35
22
|
*/
|
|
36
23
|
var PageHeaderSkeleton = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
37
24
|
var _ref$width = _ref.width,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
25
|
+
width = _ref$width === void 0 ? '30%' : _ref$width,
|
|
26
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
41
27
|
var _useContext = (0, _react.useContext)(_LayoutContext["default"]),
|
|
42
|
-
|
|
43
|
-
|
|
28
|
+
hasNavigation = _useContext.hasNavigation;
|
|
44
29
|
return /*#__PURE__*/_react["default"].createElement(_PageHeader.PageHeaderContainer, _extends({
|
|
45
30
|
hasNavigationIndent: hasNavigation
|
|
46
31
|
}, rest, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["PageHeaderSkeleton","forwardRef","ref","width","rest","useContext","LayoutContext","hasNavigation","displayName"],"sources":["../../../src/PageHeaderSkeleton/index.tsx"],"sourcesContent":["import React, { forwardRef, useContext } from 'react';\nimport { WithSize } from '@os-design/styles';\nimport Skeleton, { SkeletonProps } from '../Skeleton';\nimport { PageHeaderContainer } from '../PageHeader';\nimport LayoutContext from '../Layout/LayoutContext';\n\nexport type PageHeaderSkeletonProps = SkeletonProps & WithSize;\n\n/**\n * Provides a page header placeholder while a user waits for\n * the content to load.\n */\nconst PageHeaderSkeleton = forwardRef<HTMLDivElement, PageHeaderSkeletonProps>(\n ({ width = '30%', ...rest }, ref) => {\n const { hasNavigation } = useContext(LayoutContext);\n\n return (\n <PageHeaderContainer\n hasNavigationIndent={hasNavigation}\n {...rest}\n ref={ref}\n >\n <Skeleton width={width} />\n </PageHeaderContainer>\n );\n }\n);\n\nPageHeaderSkeleton.displayName = 'PageHeaderSkeleton';\n\nexport default PageHeaderSkeleton;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["PageHeaderSkeleton","forwardRef","ref","width","rest","useContext","LayoutContext","hasNavigation","displayName"],"sources":["../../../src/PageHeaderSkeleton/index.tsx"],"sourcesContent":["import React, { forwardRef, useContext } from 'react';\nimport { WithSize } from '@os-design/styles';\nimport Skeleton, { SkeletonProps } from '../Skeleton';\nimport { PageHeaderContainer } from '../PageHeader';\nimport LayoutContext from '../Layout/LayoutContext';\n\nexport type PageHeaderSkeletonProps = SkeletonProps & WithSize;\n\n/**\n * Provides a page header placeholder while a user waits for\n * the content to load.\n */\nconst PageHeaderSkeleton = forwardRef<HTMLDivElement, PageHeaderSkeletonProps>(\n ({ width = '30%', ...rest }, ref) => {\n const { hasNavigation } = useContext(LayoutContext);\n\n return (\n <PageHeaderContainer\n hasNavigationIndent={hasNavigation}\n {...rest}\n ref={ref}\n >\n <Skeleton width={width} />\n </PageHeaderContainer>\n );\n }\n);\n\nPageHeaderSkeleton.displayName = 'PageHeaderSkeleton';\n\nexport default PageHeaderSkeleton;\n"],"mappings":";;;;;;;AAAA;AAEA;AACA;AACA;AAAoD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIpD;AACA;AACA;AACA;AACA,IAAMA,kBAAkB,gBAAG,IAAAC,iBAAU,EACnC,gBAA6BC,GAAG,EAAK;EAAA,sBAAlCC,KAAK;IAALA,KAAK,2BAAG,KAAK;IAAKC,IAAI;EACvB,kBAA0B,IAAAC,iBAAU,EAACC,yBAAa,CAAC;IAA3CC,aAAa,eAAbA,aAAa;EAErB,oBACE,gCAAC,+BAAmB;IAClB,mBAAmB,EAAEA;EAAc,GAC/BH,IAAI;IACR,GAAG,EAAEF;EAAI,iBAET,gCAAC,oBAAQ;IAAC,KAAK,EAAEC;EAAM,EAAG,CACN;AAE1B,CAAC,CACF;AAEDH,kBAAkB,CAACQ,WAAW,GAAG,oBAAoB;AAAC,eAEvCR,kBAAkB;AAAA"}
|
|
@@ -1,61 +1,43 @@
|
|
|
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 _utils = require("@os-design/utils");
|
|
15
|
-
|
|
16
11
|
var _react2 = require("@emotion/react");
|
|
17
|
-
|
|
18
12
|
var _Skeleton = _interopRequireDefault(require("../Skeleton"));
|
|
19
|
-
|
|
20
13
|
var _excluded = ["rows", "width", "hasMargin"];
|
|
21
|
-
|
|
22
14
|
var _templateObject, _templateObject2;
|
|
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 hasMarginStyles = function hasMarginStyles(p) {
|
|
39
23
|
return p.hasMargin && (0, _react2.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin-bottom: ", "em;\n "])), p.theme.paragraphMarginBottom + (p.theme.lineHeight - 1));
|
|
40
24
|
};
|
|
41
|
-
|
|
42
25
|
var Container = (0, _styled["default"])('div', (0, _utils.omitEmotionProps)('hasMargin'))(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n & > *:not(:last-of-type) {\n margin-bottom: ", "em;\n }\n ", ";\n"])), function (p) {
|
|
43
26
|
return p.theme.lineHeight - 1;
|
|
44
27
|
}, hasMarginStyles);
|
|
45
28
|
var key = 0;
|
|
29
|
+
|
|
46
30
|
/**
|
|
47
31
|
* Provides a paragraph placeholder while a user waits for the content to load.
|
|
48
32
|
*/
|
|
49
|
-
|
|
50
33
|
var ParagraphSkeleton = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
51
34
|
var _ref$rows = _ref.rows,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
35
|
+
rows = _ref$rows === void 0 ? 4 : _ref$rows,
|
|
36
|
+
_ref$width = _ref.width,
|
|
37
|
+
width = _ref$width === void 0 ? '70%' : _ref$width,
|
|
38
|
+
_ref$hasMargin = _ref.hasMargin,
|
|
39
|
+
hasMargin = _ref$hasMargin === void 0 ? false : _ref$hasMargin,
|
|
40
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
59
41
|
return /*#__PURE__*/_react["default"].createElement(Container, _extends({
|
|
60
42
|
hasMargin: hasMargin
|
|
61
43
|
}, rest, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["hasMarginStyles","p","hasMargin","css","theme","paragraphMarginBottom","lineHeight","Container","styled","omitEmotionProps","key","ParagraphSkeleton","forwardRef","ref","rows","width","rest","Array","fill","map","_","index","displayName"],"sources":["../../../src/ParagraphSkeleton/index.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport React, { forwardRef } from 'react';\nimport { omitEmotionProps } from '@os-design/utils';\nimport { css } from '@emotion/react';\nimport Skeleton, { SkeletonProps } from '../Skeleton';\n\nexport interface ParagraphSkeletonProps extends SkeletonProps {\n /**\n * The number of rows.\n * @default 4\n */\n rows?: number;\n /**\n * The width of the last row.\n * @default 70%\n */\n width?: string;\n /**\n * Whether the paragraph has a bottom margin.\n * @default false\n */\n hasMargin?: boolean;\n}\n\nconst hasMarginStyles = (p) =>\n p.hasMargin &&\n css`\n margin-bottom: ${p.theme.paragraphMarginBottom +\n (p.theme.lineHeight - 1)}em;\n `;\n\ntype ContainerProps = Pick<ParagraphSkeletonProps, 'hasMargin'>;\nconst Container = styled('div', omitEmotionProps('hasMargin'))<ContainerProps>`\n & > *:not(:last-of-type) {\n margin-bottom: ${(p) => p.theme.lineHeight - 1}em;\n }\n ${hasMarginStyles};\n`;\n\nlet key = 0;\n\n/**\n * Provides a paragraph placeholder while a user waits for the content to load.\n */\nconst ParagraphSkeleton = forwardRef<HTMLDivElement, ParagraphSkeletonProps>(\n ({ rows = 4, width = '70%', hasMargin = false, ...rest }, ref) => (\n <Container hasMargin={hasMargin} {...rest} ref={ref}>\n {Array(rows)\n .fill({})\n .map((_, index) => {\n key += 1;\n return (\n <Skeleton key={key} width={index < rows - 1 ? '100%' : width} />\n );\n })}\n </Container>\n )\n);\n\nParagraphSkeleton.displayName = 'ParagraphSkeleton';\n\nexport default ParagraphSkeleton;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["hasMarginStyles","p","hasMargin","css","theme","paragraphMarginBottom","lineHeight","Container","styled","omitEmotionProps","key","ParagraphSkeleton","forwardRef","ref","rows","width","rest","Array","fill","map","_","index","displayName"],"sources":["../../../src/ParagraphSkeleton/index.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport React, { forwardRef } from 'react';\nimport { omitEmotionProps } from '@os-design/utils';\nimport { css } from '@emotion/react';\nimport Skeleton, { SkeletonProps } from '../Skeleton';\n\nexport interface ParagraphSkeletonProps extends SkeletonProps {\n /**\n * The number of rows.\n * @default 4\n */\n rows?: number;\n /**\n * The width of the last row.\n * @default 70%\n */\n width?: string;\n /**\n * Whether the paragraph has a bottom margin.\n * @default false\n */\n hasMargin?: boolean;\n}\n\nconst hasMarginStyles = (p) =>\n p.hasMargin &&\n css`\n margin-bottom: ${p.theme.paragraphMarginBottom +\n (p.theme.lineHeight - 1)}em;\n `;\n\ntype ContainerProps = Pick<ParagraphSkeletonProps, 'hasMargin'>;\nconst Container = styled('div', omitEmotionProps('hasMargin'))<ContainerProps>`\n & > *:not(:last-of-type) {\n margin-bottom: ${(p) => p.theme.lineHeight - 1}em;\n }\n ${hasMarginStyles};\n`;\n\nlet key = 0;\n\n/**\n * Provides a paragraph placeholder while a user waits for the content to load.\n */\nconst ParagraphSkeleton = forwardRef<HTMLDivElement, ParagraphSkeletonProps>(\n ({ rows = 4, width = '70%', hasMargin = false, ...rest }, ref) => (\n <Container hasMargin={hasMargin} {...rest} ref={ref}>\n {Array(rows)\n .fill({})\n .map((_, index) => {\n key += 1;\n return (\n <Skeleton key={key} width={index < rows - 1 ? '100%' : width} />\n );\n })}\n </Container>\n )\n);\n\nParagraphSkeleton.displayName = 'ParagraphSkeleton';\n\nexport default ParagraphSkeleton;\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AAAsD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBtD,IAAMA,eAAe,GAAG,SAAlBA,eAAe,CAAIC,CAAC;EAAA,OACxBA,CAAC,CAACC,SAAS,QACXC,WAAG,uGACgBF,CAAC,CAACG,KAAK,CAACC,qBAAqB,IAC7CJ,CAAC,CAACG,KAAK,CAACE,UAAU,GAAG,CAAC,CAAC,CACzB;AAAA;AAGH,IAAMC,SAAS,GAAG,IAAAC,kBAAM,EAAC,KAAK,EAAE,IAAAC,uBAAgB,EAAC,WAAW,CAAC,CAAC,kJAEzC,UAACR,CAAC;EAAA,OAAKA,CAAC,CAACG,KAAK,CAACE,UAAU,GAAG,CAAC;AAAA,GAE9CN,eAAe,CAClB;AAED,IAAIU,GAAG,GAAG,CAAC;;AAEX;AACA;AACA;AACA,IAAMC,iBAAiB,gBAAG,IAAAC,iBAAU,EAClC,gBAA0DC,GAAG;EAAA,qBAA1DC,IAAI;IAAJA,IAAI,0BAAG,CAAC;IAAA,kBAAEC,KAAK;IAALA,KAAK,2BAAG,KAAK;IAAA,sBAAEb,SAAS;IAATA,SAAS,+BAAG,KAAK;IAAKc,IAAI;EAAA,oBACpD,gCAAC,SAAS;IAAC,SAAS,EAAEd;EAAU,GAAKc,IAAI;IAAE,GAAG,EAAEH;EAAI,IACjDI,KAAK,CAACH,IAAI,CAAC,CACTI,IAAI,CAAC,CAAC,CAAC,CAAC,CACRC,GAAG,CAAC,UAACC,CAAC,EAAEC,KAAK,EAAK;IACjBX,GAAG,IAAI,CAAC;IACR,oBACE,gCAAC,oBAAQ;MAAC,GAAG,EAAEA,GAAI;MAAC,KAAK,EAAEW,KAAK,GAAGP,IAAI,GAAG,CAAC,GAAG,MAAM,GAAGC;IAAM,EAAG;EAEpE,CAAC,CAAC,CACM;AAAA,CACb,CACF;AAEDJ,iBAAiB,CAACW,WAAW,GAAG,mBAAmB;AAAC,eAErCX,iBAAiB;AAAA"}
|
|
@@ -1,69 +1,41 @@
|
|
|
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 _styles = require("@os-design/styles");
|
|
13
|
-
|
|
14
10
|
var _utils = require("@os-design/utils");
|
|
15
|
-
|
|
16
11
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
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 _usePopoverPosition2 = _interopRequireDefault(require("./utils/usePopoverPosition"));
|
|
25
|
-
|
|
26
16
|
var _excluded = ["trigger", "placement", "gap", "flip", "visible", "onClose", "id", "children"];
|
|
27
|
-
|
|
28
17
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
29
|
-
|
|
30
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
31
|
-
|
|
32
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); }
|
|
33
|
-
|
|
34
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; }
|
|
35
|
-
|
|
36
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); }
|
|
37
|
-
|
|
38
22
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
39
|
-
|
|
40
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."); }
|
|
41
|
-
|
|
42
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); }
|
|
43
|
-
|
|
44
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; }
|
|
45
|
-
|
|
46
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; }
|
|
47
|
-
|
|
48
27
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
49
|
-
|
|
50
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; }
|
|
51
|
-
|
|
52
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; }
|
|
53
|
-
|
|
54
30
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
55
|
-
|
|
56
31
|
var fadeIn = (0, _react2.keyframes)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n from { opacity: 0; }\n to { opacity: 1; }\n"])));
|
|
57
32
|
var fadeOut = (0, _react2.keyframes)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n from { opacity: 1; }\n to { opacity: 0; }\n"])));
|
|
58
|
-
|
|
59
33
|
var visibleStyles = function visibleStyles(p) {
|
|
60
34
|
return p.visible && (0, _react2.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n animation: ", " ", "ms forwards;\n "])), fadeIn, p.theme.transitionDelay);
|
|
61
35
|
};
|
|
62
|
-
|
|
63
36
|
var invisibleStyles = function invisibleStyles(p) {
|
|
64
37
|
return !p.visible && (0, _react2.css)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n animation: ", " ", "ms forwards;\n "])), fadeOut, p.theme.transitionDelay);
|
|
65
38
|
};
|
|
66
|
-
|
|
67
39
|
var Container = (0, _styled["default"])('div', (0, _utils.omitEmotionProps)('top', 'left', 'visible', 'size'))(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n position: absolute;\n top: ", "px;\n left: ", "px;\n\n border-radius: ", "em;\n background-color: ", ";\n color: ", ";\n border: 1px solid ", ";\n box-shadow: 0 0.15em 0.8em ", ";\n z-index: 1000; // Greater than the z-index of the Drawer\n\n ", ";\n ", ";\n ", ";\n"])), function (p) {
|
|
68
40
|
return p.top;
|
|
69
41
|
}, function (p) {
|
|
@@ -85,46 +57,42 @@ var emptyRect = {
|
|
|
85
57
|
width: 0,
|
|
86
58
|
height: 0
|
|
87
59
|
};
|
|
60
|
+
|
|
88
61
|
/**
|
|
89
62
|
* The pop-up window located next to the element.
|
|
90
63
|
*/
|
|
91
|
-
|
|
92
64
|
var Popover = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
93
65
|
var trigger = _ref.trigger,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
66
|
+
_ref$placement = _ref.placement,
|
|
67
|
+
placement = _ref$placement === void 0 ? 'top' : _ref$placement,
|
|
68
|
+
_ref$gap = _ref.gap,
|
|
69
|
+
gap = _ref$gap === void 0 ? 0.2 : _ref$gap,
|
|
70
|
+
_ref$flip = _ref.flip,
|
|
71
|
+
flip = _ref$flip === void 0 ? true : _ref$flip,
|
|
72
|
+
_ref$visible = _ref.visible,
|
|
73
|
+
visible = _ref$visible === void 0 ? false : _ref$visible,
|
|
74
|
+
_ref$onClose = _ref.onClose,
|
|
75
|
+
onClose = _ref$onClose === void 0 ? function () {} : _ref$onClose,
|
|
76
|
+
id = _ref.id,
|
|
77
|
+
children = _ref.children,
|
|
78
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
108
79
|
var _useForwardedRef = (0, _utils.useForwardedRef)(ref),
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
80
|
+
_useForwardedRef2 = _slicedToArray(_useForwardedRef, 2),
|
|
81
|
+
popoverRef = _useForwardedRef2[0],
|
|
82
|
+
mergedPopoverRef = _useForwardedRef2[1];
|
|
113
83
|
var _useState = (0, _react.useState)(emptyRect),
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
84
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
85
|
+
popoverRect = _useState2[0],
|
|
86
|
+
setPopoverRect = _useState2[1];
|
|
118
87
|
var _useState3 = (0, _react.useState)(emptyRect),
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
88
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
89
|
+
triggerRect = _useState4[0],
|
|
90
|
+
setTriggerRect = _useState4[1];
|
|
123
91
|
var _useTheme = (0, _theming.useTheme)(),
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
var mounted = (0, _utils.useClosable)(visible, theme.transitionDelay); // Init the rect of the popover and update it when the popover size changes
|
|
92
|
+
theme = _useTheme.theme;
|
|
93
|
+
var mounted = (0, _utils.useClosable)(visible, theme.transitionDelay);
|
|
127
94
|
|
|
95
|
+
// Init the rect of the popover and update it when the popover size changes
|
|
128
96
|
var popoverResizeListener = (0, _react.useCallback)(function () {
|
|
129
97
|
if (!popoverRef.current) return;
|
|
130
98
|
setPopoverRect(popoverRef.current.getBoundingClientRect());
|
|
@@ -134,14 +102,15 @@ var Popover = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
134
102
|
if (node === null) return;
|
|
135
103
|
setPopoverRect(node.getBoundingClientRect());
|
|
136
104
|
mergedPopoverRef(node);
|
|
137
|
-
}, [mergedPopoverRef]);
|
|
138
|
-
// or scrolled
|
|
105
|
+
}, [mergedPopoverRef]);
|
|
139
106
|
|
|
107
|
+
// Init the rect of the trigger and update it when the window was resized
|
|
108
|
+
// or scrolled
|
|
140
109
|
var triggerResizeListener = (0, _react.useCallback)(function () {
|
|
141
110
|
window.requestAnimationFrame(function () {
|
|
142
111
|
if (!trigger) return;
|
|
143
112
|
var _ref2 = trigger,
|
|
144
|
-
|
|
113
|
+
current = _ref2.current;
|
|
145
114
|
if (!current) return;
|
|
146
115
|
setTriggerRect(current.getBoundingClientRect());
|
|
147
116
|
});
|
|
@@ -159,39 +128,39 @@ var Popover = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
159
128
|
}, [trigger]);
|
|
160
129
|
var popoverId = (0, _react.useMemo)(function () {
|
|
161
130
|
return id || "popover-".concat(Math.random().toString(36).slice(2, 11));
|
|
162
|
-
}, [id]);
|
|
131
|
+
}, [id]);
|
|
163
132
|
|
|
133
|
+
// Set the aria tags to support accessibility features
|
|
164
134
|
(0, _utils.useBrowserLayoutEffect)(function () {
|
|
165
135
|
if (!trigger) return;
|
|
166
136
|
var _ref3 = trigger,
|
|
167
|
-
|
|
137
|
+
current = _ref3.current;
|
|
168
138
|
if (!current) return;
|
|
169
|
-
|
|
170
139
|
if (current.getAttribute('aria-haspopup') === null) {
|
|
171
140
|
current.setAttribute('aria-haspopup', 'dialog');
|
|
172
141
|
}
|
|
173
|
-
|
|
174
142
|
current.setAttribute('aria-controls', popoverId);
|
|
175
143
|
}, []);
|
|
176
144
|
(0, _utils.useBrowserLayoutEffect)(function () {
|
|
177
145
|
if (!trigger) return;
|
|
178
146
|
var _ref4 = trigger,
|
|
179
|
-
|
|
147
|
+
current = _ref4.current;
|
|
180
148
|
if (!current) return;
|
|
181
149
|
current.setAttribute('aria-expanded', visible.toString());
|
|
182
|
-
}, [visible]);
|
|
150
|
+
}, [visible]);
|
|
183
151
|
|
|
152
|
+
// Get the popover coordinates
|
|
184
153
|
var _usePopoverPosition = (0, _usePopoverPosition2["default"])({
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
154
|
+
elementRect: triggerRect,
|
|
155
|
+
popoverRect: popoverRect,
|
|
156
|
+
placement: placement,
|
|
157
|
+
gap: gap,
|
|
158
|
+
flip: flip
|
|
159
|
+
}),
|
|
160
|
+
top = _usePopoverPosition.top,
|
|
161
|
+
left = _usePopoverPosition.left;
|
|
162
|
+
|
|
163
|
+
// Close the popover when the user clicks outside of it
|
|
195
164
|
(0, _utils.useClickOutside)(popoverRef, onClose);
|
|
196
165
|
if (!mounted) return null;
|
|
197
166
|
return /*#__PURE__*/_react["default"].createElement(_portal["default"], null, /*#__PURE__*/_react["default"].createElement(Container, _extends({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["fadeIn","keyframes","fadeOut","visibleStyles","p","visible","css","theme","transitionDelay","invisibleStyles","Container","styled","omitEmotionProps","top","left","borderRadius","clr","popoverColorBg","popoverColorText","popoverColorBorder","popoverColorBoxShadow","sizeStyles","emptyRect","width","height","Popover","forwardRef","ref","trigger","placement","gap","flip","onClose","id","children","rest","useForwardedRef","popoverRef","mergedPopoverRef","useState","popoverRect","setPopoverRect","triggerRect","setTriggerRect","useTheme","mounted","useClosable","popoverResizeListener","useCallback","current","getBoundingClientRect","useResizeObserver","measuredPopoverRef","node","triggerResizeListener","window","requestAnimationFrame","useBrowserLayoutEffect","useEvent","document","useEffect","undefined","popoverId","useMemo","Math","random","toString","slice","getAttribute","setAttribute","usePopoverPosition","elementRect","useClickOutside","displayName"],"sources":["../../../src/Popover/index.tsx"],"sourcesContent":["import React, {\n forwardRef,\n RefCallback,\n RefObject,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport { sizeStyles, WithSize } from '@os-design/styles';\nimport {\n omitEmotionProps,\n useClickOutside,\n useClosable,\n useEvent,\n useForwardedRef,\n useResizeObserver,\n useBrowserLayoutEffect,\n} from '@os-design/utils';\nimport styled from '@emotion/styled';\nimport { clr, useTheme } from '@os-design/theming';\nimport { css, keyframes } from '@emotion/react';\nimport Portal from '@os-design/portal';\nimport usePopoverPosition, {\n Placement,\n Rect,\n} from './utils/usePopoverPosition';\n\ntype JsxDivProps = Omit<JSX.IntrinsicElements['div'], 'ref'>;\nexport interface PopoverProps extends JsxDivProps, WithSize {\n /**\n * The element next to which the popover appears.\n * @default undefined\n */\n trigger?: RefObject<Element> | 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.2\n */\n gap?: number;\n /**\n * Whether the popover to flip if it does not fit in the window.\n * @default true\n */\n flip?: boolean;\n /**\n * Whether the popover is visible.\n * @default false\n */\n visible?: boolean;\n /**\n * The close event handler.\n * @default undefined\n */\n onClose?: () => void;\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 ContainerProps extends Pick<PopoverProps, 'visible' | 'size'> {\n top: number;\n left: number;\n}\nconst Container = styled(\n 'div',\n omitEmotionProps('top', 'left', 'visible', 'size')\n)<ContainerProps>`\n position: absolute;\n top: ${(p) => p.top}px;\n left: ${(p) => p.left}px;\n\n border-radius: ${(p) => p.theme.borderRadius}em;\n background-color: ${(p) => clr(p.theme.popoverColorBg)};\n color: ${(p) => clr(p.theme.popoverColorText)};\n border: 1px solid ${(p) => clr(p.theme.popoverColorBorder)};\n box-shadow: 0 0.15em 0.8em ${(p) => clr(p.theme.popoverColorBoxShadow)};\n z-index: 1000; // Greater than the z-index of the Drawer\n\n ${visibleStyles};\n ${invisibleStyles};\n ${sizeStyles};\n`;\n\nconst emptyRect: Rect = {\n top: 0,\n left: 0,\n width: 0,\n height: 0,\n};\n\n/**\n * The pop-up window located next to the element.\n */\nconst Popover = forwardRef<HTMLDivElement, PopoverProps>(\n (\n {\n trigger,\n placement = 'top',\n gap = 0.2,\n flip = true,\n visible = false,\n onClose = () => {},\n id,\n children,\n ...rest\n },\n ref\n ) => {\n const [popoverRef, mergedPopoverRef] = useForwardedRef(ref);\n const [popoverRect, setPopoverRect] = useState(emptyRect);\n const [triggerRect, setTriggerRect] = useState(emptyRect);\n const { theme } = useTheme();\n const mounted = useClosable(visible, theme.transitionDelay);\n\n // Init the rect of the popover and update it when the popover size changes\n const popoverResizeListener = useCallback(() => {\n if (!popoverRef.current) return;\n setPopoverRect(popoverRef.current.getBoundingClientRect());\n }, [popoverRef]);\n useResizeObserver(\n popoverRef.current as HTMLDivElement,\n popoverResizeListener\n );\n\n const measuredPopoverRef = useCallback<RefCallback<HTMLDivElement>>(\n (node) => {\n if (node === null) return;\n setPopoverRect(node.getBoundingClientRect());\n mergedPopoverRef(node);\n },\n [mergedPopoverRef]\n );\n\n // Init the rect of the trigger and update it when the window was resized\n // or scrolled\n const triggerResizeListener = useCallback(() => {\n window.requestAnimationFrame(() => {\n if (!trigger) return;\n const { current } = trigger as RefObject<Element>;\n if (!current) return;\n setTriggerRect(current.getBoundingClientRect());\n });\n }, [trigger]);\n useBrowserLayoutEffect(() => {\n if (!visible) return;\n triggerResizeListener();\n }, [triggerResizeListener, visible]);\n useResizeObserver(trigger as never, triggerResizeListener);\n useEvent(\n (typeof window === 'undefined' ? null : window) as never,\n 'resize',\n triggerResizeListener\n );\n useEvent(document, 'scroll', triggerResizeListener);\n\n useEffect(() => {\n if (!trigger || (trigger as RefObject<Element>).current !== undefined)\n return;\n setTriggerRect(trigger as Rect);\n }, [trigger]);\n\n const popoverId = useMemo(\n () => id || `popover-${Math.random().toString(36).slice(2, 11)}`,\n [id]\n );\n\n // Set the aria tags to support accessibility features\n useBrowserLayoutEffect(() => {\n if (!trigger) return;\n const { current } = trigger as RefObject<Element>;\n if (!current) return;\n if (current.getAttribute('aria-haspopup') === null) {\n current.setAttribute('aria-haspopup', 'dialog');\n }\n current.setAttribute('aria-controls', popoverId);\n }, []);\n useBrowserLayoutEffect(() => {\n if (!trigger) return;\n const { current } = trigger as RefObject<Element>;\n if (!current) return;\n current.setAttribute('aria-expanded', visible.toString());\n }, [visible]);\n\n // Get the popover coordinates\n const { top, left } = usePopoverPosition({\n elementRect: triggerRect,\n popoverRect,\n placement,\n gap,\n flip,\n });\n\n // Close the popover when the user clicks outside of it\n useClickOutside(popoverRef, onClose);\n\n if (!mounted) return null;\n\n return (\n <Portal>\n <Container\n top={top}\n left={left}\n visible={visible}\n id={popoverId}\n role='dialog'\n {...rest}\n ref={measuredPopoverRef}\n >\n {children}\n </Container>\n </Portal>\n );\n }\n);\n\nPopover.displayName = 'Popover';\n\nexport default Popover;\n"],"mappings":";;;;;;;;;AAAA;;AASA;;AACA;;AASA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L,OAA5B;EAEA,IAAI,CAACa,OAAL,EAAc,OAAO,IAAP;EAEd,oBACE,gCAAC,kBAAD,qBACE,gCAAC,SAAD;IACE,GAAG,EAAEhC,GADP;IAEE,IAAI,EAAEC,IAFR;IAGE,OAAO,EAAET,OAHX;IAIE,EAAE,EAAEyD,SAJN;IAKE,IAAI,EAAC;EALP,GAMM3B,IANN;IAOE,GAAG,EAAEiB;EAPP,IASGlB,QATH,CADF,CADF;AAeD,CAvHa,CAAhB;AA0HAT,OAAO,CAACgD,WAAR,GAAsB,SAAtB;eAEehD,O"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["fadeIn","keyframes","fadeOut","visibleStyles","p","visible","css","theme","transitionDelay","invisibleStyles","Container","styled","omitEmotionProps","top","left","borderRadius","clr","popoverColorBg","popoverColorText","popoverColorBorder","popoverColorBoxShadow","sizeStyles","emptyRect","width","height","Popover","forwardRef","ref","trigger","placement","gap","flip","onClose","id","children","rest","useForwardedRef","popoverRef","mergedPopoverRef","useState","popoverRect","setPopoverRect","triggerRect","setTriggerRect","useTheme","mounted","useClosable","popoverResizeListener","useCallback","current","getBoundingClientRect","useResizeObserver","measuredPopoverRef","node","triggerResizeListener","window","requestAnimationFrame","useBrowserLayoutEffect","useEvent","document","useEffect","undefined","popoverId","useMemo","Math","random","toString","slice","getAttribute","setAttribute","usePopoverPosition","elementRect","useClickOutside","displayName"],"sources":["../../../src/Popover/index.tsx"],"sourcesContent":["import React, {\n forwardRef,\n RefCallback,\n RefObject,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport { sizeStyles, WithSize } from '@os-design/styles';\nimport {\n omitEmotionProps,\n useClickOutside,\n useClosable,\n useEvent,\n useForwardedRef,\n useResizeObserver,\n useBrowserLayoutEffect,\n} from '@os-design/utils';\nimport styled from '@emotion/styled';\nimport { clr, useTheme } from '@os-design/theming';\nimport { css, keyframes } from '@emotion/react';\nimport Portal from '@os-design/portal';\nimport usePopoverPosition, {\n Placement,\n Rect,\n} from './utils/usePopoverPosition';\n\ntype JsxDivProps = Omit<JSX.IntrinsicElements['div'], 'ref'>;\nexport interface PopoverProps extends JsxDivProps, WithSize {\n /**\n * The element next to which the popover appears.\n * @default undefined\n */\n trigger?: RefObject<Element> | 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.2\n */\n gap?: number;\n /**\n * Whether the popover to flip if it does not fit in the window.\n * @default true\n */\n flip?: boolean;\n /**\n * Whether the popover is visible.\n * @default false\n */\n visible?: boolean;\n /**\n * The close event handler.\n * @default undefined\n */\n onClose?: () => void;\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 ContainerProps extends Pick<PopoverProps, 'visible' | 'size'> {\n top: number;\n left: number;\n}\nconst Container = styled(\n 'div',\n omitEmotionProps('top', 'left', 'visible', 'size')\n)<ContainerProps>`\n position: absolute;\n top: ${(p) => p.top}px;\n left: ${(p) => p.left}px;\n\n border-radius: ${(p) => p.theme.borderRadius}em;\n background-color: ${(p) => clr(p.theme.popoverColorBg)};\n color: ${(p) => clr(p.theme.popoverColorText)};\n border: 1px solid ${(p) => clr(p.theme.popoverColorBorder)};\n box-shadow: 0 0.15em 0.8em ${(p) => clr(p.theme.popoverColorBoxShadow)};\n z-index: 1000; // Greater than the z-index of the Drawer\n\n ${visibleStyles};\n ${invisibleStyles};\n ${sizeStyles};\n`;\n\nconst emptyRect: Rect = {\n top: 0,\n left: 0,\n width: 0,\n height: 0,\n};\n\n/**\n * The pop-up window located next to the element.\n */\nconst Popover = forwardRef<HTMLDivElement, PopoverProps>(\n (\n {\n trigger,\n placement = 'top',\n gap = 0.2,\n flip = true,\n visible = false,\n onClose = () => {},\n id,\n children,\n ...rest\n },\n ref\n ) => {\n const [popoverRef, mergedPopoverRef] = useForwardedRef(ref);\n const [popoverRect, setPopoverRect] = useState(emptyRect);\n const [triggerRect, setTriggerRect] = useState(emptyRect);\n const { theme } = useTheme();\n const mounted = useClosable(visible, theme.transitionDelay);\n\n // Init the rect of the popover and update it when the popover size changes\n const popoverResizeListener = useCallback(() => {\n if (!popoverRef.current) return;\n setPopoverRect(popoverRef.current.getBoundingClientRect());\n }, [popoverRef]);\n useResizeObserver(\n popoverRef.current as HTMLDivElement,\n popoverResizeListener\n );\n\n const measuredPopoverRef = useCallback<RefCallback<HTMLDivElement>>(\n (node) => {\n if (node === null) return;\n setPopoverRect(node.getBoundingClientRect());\n mergedPopoverRef(node);\n },\n [mergedPopoverRef]\n );\n\n // Init the rect of the trigger and update it when the window was resized\n // or scrolled\n const triggerResizeListener = useCallback(() => {\n window.requestAnimationFrame(() => {\n if (!trigger) return;\n const { current } = trigger as RefObject<Element>;\n if (!current) return;\n setTriggerRect(current.getBoundingClientRect());\n });\n }, [trigger]);\n useBrowserLayoutEffect(() => {\n if (!visible) return;\n triggerResizeListener();\n }, [triggerResizeListener, visible]);\n useResizeObserver(trigger as never, triggerResizeListener);\n useEvent(\n (typeof window === 'undefined' ? null : window) as never,\n 'resize',\n triggerResizeListener\n );\n useEvent(document, 'scroll', triggerResizeListener);\n\n useEffect(() => {\n if (!trigger || (trigger as RefObject<Element>).current !== undefined)\n return;\n setTriggerRect(trigger as Rect);\n }, [trigger]);\n\n const popoverId = useMemo(\n () => id || `popover-${Math.random().toString(36).slice(2, 11)}`,\n [id]\n );\n\n // Set the aria tags to support accessibility features\n useBrowserLayoutEffect(() => {\n if (!trigger) return;\n const { current } = trigger as RefObject<Element>;\n if (!current) return;\n if (current.getAttribute('aria-haspopup') === null) {\n current.setAttribute('aria-haspopup', 'dialog');\n }\n current.setAttribute('aria-controls', popoverId);\n }, []);\n useBrowserLayoutEffect(() => {\n if (!trigger) return;\n const { current } = trigger as RefObject<Element>;\n if (!current) return;\n current.setAttribute('aria-expanded', visible.toString());\n }, [visible]);\n\n // Get the popover coordinates\n const { top, left } = usePopoverPosition({\n elementRect: triggerRect,\n popoverRect,\n placement,\n gap,\n flip,\n });\n\n // Close the popover when the user clicks outside of it\n useClickOutside(popoverRef, onClose);\n\n if (!mounted) return null;\n\n return (\n <Portal>\n <Container\n top={top}\n left={left}\n visible={visible}\n id={popoverId}\n role='dialog'\n {...rest}\n ref={measuredPopoverRef}\n >\n {children}\n </Container>\n </Portal>\n );\n }\n);\n\nPopover.displayName = 'Popover';\n\nexport default Popover;\n"],"mappings":";;;;;;;AAAA;AASA;AACA;AASA;AACA;AACA;AACA;AACA;AAGoC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoCpC,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,SAAS,GAAG,IAAAC,kBAAM,EACtB,KAAK,EACL,IAAAC,uBAAgB,EAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CACnD,iWAEQ,UAACR,CAAC;EAAA,OAAKA,CAAC,CAACS,GAAG;AAAA,GACX,UAACT,CAAC;EAAA,OAAKA,C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