@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,50 +4,39 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
11
|
-
|
|
12
9
|
var _icons = require("@os-design/icons");
|
|
13
|
-
|
|
14
10
|
var _utils = require("@os-design/utils");
|
|
15
|
-
|
|
16
11
|
var _theming = require("@os-design/theming");
|
|
17
|
-
|
|
18
12
|
var _templateObject;
|
|
19
|
-
|
|
20
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
-
|
|
22
14
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
23
|
-
|
|
24
15
|
var Container = (0, _styled["default"])('i', (0, _utils.omitEmotionProps)('iconColor'))(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n align-items: center;\n\n margin-right: 0.3em;\n font-size: 1.4em;\n color: ", ";\n"])), function (p) {
|
|
25
16
|
return (0, _theming.clr)(p.iconColor);
|
|
26
17
|
});
|
|
27
|
-
|
|
28
18
|
var AlertIcon = function AlertIcon(_ref) {
|
|
29
19
|
var type = _ref.type;
|
|
30
20
|
var _info$success$error$t = {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
21
|
+
info: {
|
|
22
|
+
Icon: _icons.InfoCircle,
|
|
23
|
+
iconColor: _theming.light.alertInfoColorIcon
|
|
24
|
+
},
|
|
25
|
+
success: {
|
|
26
|
+
Icon: _icons.CheckCircle,
|
|
27
|
+
iconColor: _theming.light.alertSuccessColorIcon
|
|
28
|
+
},
|
|
29
|
+
error: {
|
|
30
|
+
Icon: _icons.CloseCircle,
|
|
31
|
+
iconColor: _theming.light.alertErrorColorIcon
|
|
32
|
+
}
|
|
33
|
+
}[type],
|
|
34
|
+
Icon = _info$success$error$t.Icon,
|
|
35
|
+
iconColor = _info$success$error$t.iconColor;
|
|
46
36
|
return /*#__PURE__*/_react["default"].createElement(Container, {
|
|
47
37
|
iconColor: iconColor
|
|
48
38
|
}, /*#__PURE__*/_react["default"].createElement(Icon, null));
|
|
49
39
|
};
|
|
50
|
-
|
|
51
40
|
AlertIcon.displayName = 'AlertIcon';
|
|
52
41
|
var _default = AlertIcon;
|
|
53
42
|
exports["default"] = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlertIcon.js","names":["Container","styled","omitEmotionProps","p","clr","iconColor","AlertIcon","type","info","Icon","InfoCircle","light","alertInfoColorIcon","success","CheckCircle","alertSuccessColorIcon","error","CloseCircle","alertErrorColorIcon","displayName"],"sources":["../../../src/message/AlertIcon.tsx"],"sourcesContent":["import React from 'react';\nimport styled from '@emotion/styled';\nimport { CheckCircle, CloseCircle, InfoCircle } from '@os-design/icons';\nimport { omitEmotionProps } from '@os-design/utils';\nimport { clr, Color, light } from '@os-design/theming';\n\ninterface AlertIconProps {\n type: 'info' | 'success' | 'error';\n}\n\ninterface ContainerProps {\n iconColor: Color;\n}\nconst Container = styled('i', omitEmotionProps('iconColor'))<ContainerProps>`\n display: flex;\n flex-direction: row;\n align-items: center;\n\n margin-right: 0.3em;\n font-size: 1.4em;\n color: ${(p) => clr(p.iconColor)};\n`;\n\nconst AlertIcon: React.FC<AlertIconProps> = ({ type }) => {\n const { Icon, iconColor } = {\n info: {\n Icon: InfoCircle,\n iconColor: light.alertInfoColorIcon,\n },\n success: {\n Icon: CheckCircle,\n iconColor: light.alertSuccessColorIcon,\n },\n error: {\n Icon: CloseCircle,\n iconColor: light.alertErrorColorIcon,\n },\n }[type];\n\n return (\n <Container iconColor={iconColor}>\n <Icon />\n </Container>\n );\n};\n\nAlertIcon.displayName = 'AlertIcon';\n\nexport default AlertIcon;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"AlertIcon.js","names":["Container","styled","omitEmotionProps","p","clr","iconColor","AlertIcon","type","info","Icon","InfoCircle","light","alertInfoColorIcon","success","CheckCircle","alertSuccessColorIcon","error","CloseCircle","alertErrorColorIcon","displayName"],"sources":["../../../src/message/AlertIcon.tsx"],"sourcesContent":["import React from 'react';\nimport styled from '@emotion/styled';\nimport { CheckCircle, CloseCircle, InfoCircle } from '@os-design/icons';\nimport { omitEmotionProps } from '@os-design/utils';\nimport { clr, Color, light } from '@os-design/theming';\n\ninterface AlertIconProps {\n type: 'info' | 'success' | 'error';\n}\n\ninterface ContainerProps {\n iconColor: Color;\n}\nconst Container = styled('i', omitEmotionProps('iconColor'))<ContainerProps>`\n display: flex;\n flex-direction: row;\n align-items: center;\n\n margin-right: 0.3em;\n font-size: 1.4em;\n color: ${(p) => clr(p.iconColor)};\n`;\n\nconst AlertIcon: React.FC<AlertIconProps> = ({ type }) => {\n const { Icon, iconColor } = {\n info: {\n Icon: InfoCircle,\n iconColor: light.alertInfoColorIcon,\n },\n success: {\n Icon: CheckCircle,\n iconColor: light.alertSuccessColorIcon,\n },\n error: {\n Icon: CloseCircle,\n iconColor: light.alertErrorColorIcon,\n },\n }[type];\n\n return (\n <Container iconColor={iconColor}>\n <Icon />\n </Container>\n );\n};\n\nAlertIcon.displayName = 'AlertIcon';\n\nexport default AlertIcon;\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AAAuD;AAAA;AAAA;AASvD,IAAMA,SAAS,GAAG,IAAAC,kBAAM,EAAC,GAAG,EAAE,IAAAC,uBAAgB,EAAC,WAAW,CAAC,CAAC,yMAOjD,UAACC,CAAC;EAAA,OAAK,IAAAC,YAAG,EAACD,CAAC,CAACE,SAAS,CAAC;AAAA,EACjC;AAED,IAAMC,SAAmC,GAAG,SAAtCA,SAAmC,OAAiB;EAAA,IAAXC,IAAI,QAAJA,IAAI;EACjD,4BAA4B;MAC1BC,IAAI,EAAE;QACJC,IAAI,EAAEC,iBAAU;QAChBL,SAAS,EAAEM,cAAK,CAACC;MACnB,CAAC;MACDC,OAAO,EAAE;QACPJ,IAAI,EAAEK,kBAAW;QACjBT,SAAS,EAAEM,cAAK,CAACI;MACnB,CAAC;MACDC,KAAK,EAAE;QACLP,IAAI,EAAEQ,kBAAW;QACjBZ,SAAS,EAAEM,cAAK,CAACO;MACnB;IACF,CAAC,CAACX,IAAI,CAAC;IAbCE,IAAI,yBAAJA,IAAI;IAAEJ,SAAS,yBAATA,SAAS;EAevB,oBACE,gCAAC,SAAS;IAAC,SAAS,EAAEA;EAAU,gBAC9B,gCAAC,IAAI,OAAG,CACE;AAEhB,CAAC;AAEDC,SAAS,CAACa,WAAW,GAAG,WAAW;AAAC,eAErBb,SAAS;AAAA"}
|
|
@@ -1,36 +1,22 @@
|
|
|
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"] = exports.MESSAGE_DURATION_MS = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
13
|
-
|
|
14
10
|
var _react2 = require("@emotion/react");
|
|
15
|
-
|
|
16
11
|
var _styles = require("@os-design/styles");
|
|
17
|
-
|
|
18
12
|
var _utils = require("@os-design/utils");
|
|
19
|
-
|
|
20
13
|
var _theming = require("@os-design/theming");
|
|
21
|
-
|
|
22
14
|
var _AlertIcon = _interopRequireDefault(require("./AlertIcon"));
|
|
23
|
-
|
|
24
15
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
25
|
-
|
|
26
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
27
|
-
|
|
28
17
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
|
-
|
|
30
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
|
-
|
|
32
19
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
33
|
-
|
|
34
20
|
var fadeIn = (0, _react2.keyframes)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n from {\n opacity: 0;\n transform: translateY(-100%);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n"])));
|
|
35
21
|
var MESSAGE_HEIGHT_EM = 2.5;
|
|
36
22
|
var MESSAGE_MARGIN_TOP_EM = 0.7;
|
|
@@ -48,12 +34,10 @@ var Container = (0, _styled["default"])('div', (0, _utils.omitEmotionProps)('typ
|
|
|
48
34
|
}, function (p) {
|
|
49
35
|
return MESSAGE_DURATION_MS - p.transitionDelay;
|
|
50
36
|
});
|
|
51
|
-
|
|
52
37
|
var Text = _styled["default"].span(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", ";\n"])), _styles.ellipsisStyles);
|
|
53
|
-
|
|
54
38
|
var Message = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
55
39
|
var type = _ref.type,
|
|
56
|
-
|
|
40
|
+
text = _ref.text;
|
|
57
41
|
var backgroundColor = {
|
|
58
42
|
info: _theming.light.messageInfoColorBg,
|
|
59
43
|
success: _theming.light.messageSuccessColorBg,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Message.js","names":["fadeIn","keyframes","MESSAGE_HEIGHT_EM","MESSAGE_MARGIN_TOP_EM","MESSAGE_DURATION_MS","fadeOut","Container","styled","omitEmotionProps","p","clr","backgroundColor","textColor","transitionDelay","Text","span","ellipsisStyles","Message","forwardRef","ref","type","text","info","light","messageInfoColorBg","success","messageSuccessColorBg","error","messageErrorColorBg","colorText","displayName"],"sources":["../../../src/message/Message.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport styled from '@emotion/styled';\nimport { keyframes } from '@emotion/react';\nimport { ellipsisStyles } from '@os-design/styles';\nimport { omitEmotionProps } from '@os-design/utils';\nimport { clr, Color, light } from '@os-design/theming';\nimport AlertIcon from './AlertIcon';\n\nexport interface MessageProps {\n type: 'info' | 'success' | 'error';\n text: string;\n}\n\nconst fadeIn = keyframes`\n from {\n opacity: 0;\n transform: translateY(-100%);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n`;\n\nconst MESSAGE_HEIGHT_EM = 2.5;\nconst MESSAGE_MARGIN_TOP_EM = 0.7;\nexport const MESSAGE_DURATION_MS = 3000;\n\nconst fadeOut = keyframes`\n from {\n opacity: 1;\n height: ${MESSAGE_HEIGHT_EM}em;\n margin-top: ${MESSAGE_MARGIN_TOP_EM}em;\n transform: translateY(0);\n }\n to {\n opacity: 0;\n height: 0;\n margin-top: 0;\n transform: translateY(-100%);\n }\n`;\n\ninterface ContainerProps extends Pick<MessageProps, 'type'> {\n textColor: Color;\n backgroundColor: Color;\n transitionDelay: number;\n}\nconst Container = styled(\n 'div',\n omitEmotionProps('type', 'textColor', 'backgroundColor', 'transitionDelay')\n)<ContainerProps>`\n display: flex;\n flex-direction: row;\n align-items: center;\n\n height: ${MESSAGE_HEIGHT_EM}em;\n margin-top: ${MESSAGE_MARGIN_TOP_EM}em;\n\n box-sizing: border-box;\n padding: 0 1em;\n max-width: 90%;\n\n border-radius: 0.25em;\n box-shadow: 0 0.15em 0.45em hsla(0, 0%, 0%, 0.1);\n background-color: ${(p) => clr(p.backgroundColor)};\n color: ${(p) => clr(p.textColor)};\n\n pointer-events: auto;\n overflow: hidden;\n\n animation: ${fadeIn} ${(p) => p.transitionDelay}ms,\n ${fadeOut} ${(p) => p.transitionDelay}ms\n ${(p) => MESSAGE_DURATION_MS - p.transitionDelay}ms;\n animation-fill-mode: forwards;\n`;\n\nconst Text = styled.span`\n ${ellipsisStyles};\n`;\n\nconst Message = forwardRef<HTMLDivElement, MessageProps>(\n ({ type, text }, ref) => {\n const backgroundColor = {\n info: light.messageInfoColorBg,\n success: light.messageSuccessColorBg,\n error: light.messageErrorColorBg,\n }[type];\n\n return (\n <Container\n ref={ref}\n type={type}\n textColor={light.colorText}\n backgroundColor={backgroundColor}\n transitionDelay={light.transitionDelay}\n role='alert'\n >\n <AlertIcon type={type} />\n <Text>{text}</Text>\n </Container>\n );\n }\n);\n\nMessage.displayName = 'Message';\n\nexport default Message;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Message.js","names":["fadeIn","keyframes","MESSAGE_HEIGHT_EM","MESSAGE_MARGIN_TOP_EM","MESSAGE_DURATION_MS","fadeOut","Container","styled","omitEmotionProps","p","clr","backgroundColor","textColor","transitionDelay","Text","span","ellipsisStyles","Message","forwardRef","ref","type","text","info","light","messageInfoColorBg","success","messageSuccessColorBg","error","messageErrorColorBg","colorText","displayName"],"sources":["../../../src/message/Message.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport styled from '@emotion/styled';\nimport { keyframes } from '@emotion/react';\nimport { ellipsisStyles } from '@os-design/styles';\nimport { omitEmotionProps } from '@os-design/utils';\nimport { clr, Color, light } from '@os-design/theming';\nimport AlertIcon from './AlertIcon';\n\nexport interface MessageProps {\n type: 'info' | 'success' | 'error';\n text: string;\n}\n\nconst fadeIn = keyframes`\n from {\n opacity: 0;\n transform: translateY(-100%);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n`;\n\nconst MESSAGE_HEIGHT_EM = 2.5;\nconst MESSAGE_MARGIN_TOP_EM = 0.7;\nexport const MESSAGE_DURATION_MS = 3000;\n\nconst fadeOut = keyframes`\n from {\n opacity: 1;\n height: ${MESSAGE_HEIGHT_EM}em;\n margin-top: ${MESSAGE_MARGIN_TOP_EM}em;\n transform: translateY(0);\n }\n to {\n opacity: 0;\n height: 0;\n margin-top: 0;\n transform: translateY(-100%);\n }\n`;\n\ninterface ContainerProps extends Pick<MessageProps, 'type'> {\n textColor: Color;\n backgroundColor: Color;\n transitionDelay: number;\n}\nconst Container = styled(\n 'div',\n omitEmotionProps('type', 'textColor', 'backgroundColor', 'transitionDelay')\n)<ContainerProps>`\n display: flex;\n flex-direction: row;\n align-items: center;\n\n height: ${MESSAGE_HEIGHT_EM}em;\n margin-top: ${MESSAGE_MARGIN_TOP_EM}em;\n\n box-sizing: border-box;\n padding: 0 1em;\n max-width: 90%;\n\n border-radius: 0.25em;\n box-shadow: 0 0.15em 0.45em hsla(0, 0%, 0%, 0.1);\n background-color: ${(p) => clr(p.backgroundColor)};\n color: ${(p) => clr(p.textColor)};\n\n pointer-events: auto;\n overflow: hidden;\n\n animation: ${fadeIn} ${(p) => p.transitionDelay}ms,\n ${fadeOut} ${(p) => p.transitionDelay}ms\n ${(p) => MESSAGE_DURATION_MS - p.transitionDelay}ms;\n animation-fill-mode: forwards;\n`;\n\nconst Text = styled.span`\n ${ellipsisStyles};\n`;\n\nconst Message = forwardRef<HTMLDivElement, MessageProps>(\n ({ type, text }, ref) => {\n const backgroundColor = {\n info: light.messageInfoColorBg,\n success: light.messageSuccessColorBg,\n error: light.messageErrorColorBg,\n }[type];\n\n return (\n <Container\n ref={ref}\n type={type}\n textColor={light.colorText}\n backgroundColor={backgroundColor}\n transitionDelay={light.transitionDelay}\n role='alert'\n >\n <AlertIcon type={type} />\n <Text>{text}</Text>\n </Container>\n );\n }\n);\n\nMessage.displayName = 'Message';\n\nexport default Message;\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAoC;AAAA;AAAA;AAAA;AAAA;AAOpC,IAAMA,MAAM,OAAGC,iBAAS,wMASvB;AAED,IAAMC,iBAAiB,GAAG,GAAG;AAC7B,IAAMC,qBAAqB,GAAG,GAAG;AAC1B,IAAMC,mBAAmB,GAAG,IAAI;AAAC;AAExC,IAAMC,OAAO,OAAGJ,iBAAS,6RAGXC,iBAAiB,EACbC,qBAAqB,CAStC;AAOD,IAAMG,SAAS,GAAG,IAAAC,kBAAM,EACtB,KAAK,EACL,IAAAC,uBAAgB,EAAC,MAAM,EAAE,WAAW,EAAE,iBAAiB,EAAE,iBAAiB,CAAC,CAC5E,sgBAKWN,iBAAiB,EACbC,qBAAqB,EAQf,UAACM,CAAC;EAAA,OAAK,IAAAC,YAAG,EAACD,CAAC,CAACE,eAAe,CAAC;AAAA,GACxC,UAACF,CAAC;EAAA,OAAK,IAAAC,YAAG,EAACD,CAAC,CAACG,SAAS,CAAC;AAAA,GAKnBZ,MAAM,EAAI,UAACS,CAAC;EAAA,OAAKA,CAAC,CAACI,eAAe;AAAA,GAC3CR,OAAO,EAAI,UAACI,CAAC;EAAA,OAAKA,CAAC,CAACI,eAAe;AAAA,GACjC,UAACJ,CAAC;EAAA,OAAKL,mBAAmB,GAAGK,CAAC,CAACI,eAAe;AAAA,EAErD;AAED,IAAMC,IAAI,GAAGP,kBAAM,CAACQ,IAAI,mFACpBC,sBAAc,CACjB;AAED,IAAMC,OAAO,gBAAG,IAAAC,iBAAU,EACxB,gBAAiBC,GAAG,EAAK;EAAA,IAAtBC,IAAI,QAAJA,IAAI;IAAEC,IAAI,QAAJA,IAAI;EACX,IAAMV,eAAe,GAAG;IACtBW,IAAI,EAAEC,cAAK,CAACC,kBAAkB;IAC9BC,OAAO,EAAEF,cAAK,CAACG,qBAAqB;IACpCC,KAAK,EAAEJ,cAAK,CAACK;EACf,CAAC,CAACR,IAAI,CAAC;EAEP,oBACE,gCAAC,SAAS;IACR,GAAG,EAAED,GAAI;IACT,IAAI,EAAEC,IAAK;IACX,SAAS,EAAEG,cAAK,CAACM,SAAU;IAC3B,eAAe,EAAElB,eAAgB;IACjC,eAAe,EAAEY,cAAK,CAACV,eAAgB;IACvC,IAAI,EAAC;EAAO,gBAEZ,gCAAC,qBAAS;IAAC,IAAI,EAAEO;EAAK,EAAG,eACzB,gCAAC,IAAI,QAAEC,IAAI,CAAQ,CACT;AAEhB,CAAC,CACF;AAEDJ,OAAO,CAACa,WAAW,GAAG,SAAS;AAAC,eAEjBb,OAAO;AAAA"}
|
|
@@ -1,78 +1,64 @@
|
|
|
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 = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
9
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
13
|
-
|
|
14
10
|
var _Message = _interopRequireWildcard(require("./Message"));
|
|
15
|
-
|
|
16
11
|
var _styles = require("./styles");
|
|
17
|
-
|
|
18
12
|
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); }
|
|
19
|
-
|
|
20
13
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
-
|
|
22
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
|
-
|
|
24
15
|
var containerElement;
|
|
16
|
+
|
|
25
17
|
/**
|
|
26
18
|
* Creates the container for storing messages.
|
|
27
19
|
*/
|
|
28
|
-
|
|
29
20
|
var getContainer = function getContainer() {
|
|
30
21
|
if (!containerElement) {
|
|
31
22
|
containerElement = document.createElement('div');
|
|
32
23
|
(0, _styles.setStylesToHtmlElement)(containerElement, _styles.containerStyles);
|
|
33
24
|
document.body.appendChild(containerElement);
|
|
34
25
|
}
|
|
35
|
-
|
|
36
26
|
return containerElement;
|
|
37
27
|
};
|
|
28
|
+
|
|
38
29
|
/**
|
|
39
30
|
* Delete the container if there are no more messages in it.
|
|
40
31
|
*/
|
|
41
|
-
|
|
42
|
-
|
|
43
32
|
var deleteContainerIfNoChildNodes = function deleteContainerIfNoChildNodes() {
|
|
44
33
|
if (!containerElement || containerElement.hasChildNodes()) return;
|
|
45
34
|
document.body.removeChild(containerElement);
|
|
46
35
|
containerElement = null;
|
|
47
36
|
};
|
|
37
|
+
|
|
48
38
|
/**
|
|
49
39
|
* Renders a new message.
|
|
50
40
|
*/
|
|
51
|
-
|
|
52
|
-
|
|
53
41
|
var send = function send(type, text) {
|
|
54
42
|
// Create a new container for the message
|
|
55
43
|
var container = getContainer();
|
|
56
44
|
var messageContainer = document.createElement('div');
|
|
57
45
|
(0, _styles.setStylesToHtmlElement)(messageContainer, _styles.messageContainerStyles);
|
|
58
|
-
container.appendChild(messageContainer);
|
|
46
|
+
container.appendChild(messageContainer);
|
|
59
47
|
|
|
48
|
+
// Render the message element
|
|
60
49
|
var messageElement = /*#__PURE__*/_react["default"].createElement(_Message["default"], {
|
|
61
50
|
type: type,
|
|
62
51
|
text: text
|
|
63
52
|
});
|
|
53
|
+
_reactDom["default"].render(messageElement, messageContainer);
|
|
64
54
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
55
|
+
// Delete the message container after N ms
|
|
68
56
|
setTimeout(function () {
|
|
69
57
|
_reactDom["default"].unmountComponentAtNode(messageContainer);
|
|
70
|
-
|
|
71
58
|
container.removeChild(messageContainer);
|
|
72
59
|
deleteContainerIfNoChildNodes();
|
|
73
60
|
}, _Message.MESSAGE_DURATION_MS);
|
|
74
61
|
};
|
|
75
|
-
|
|
76
62
|
var message = {
|
|
77
63
|
info: function info(text) {
|
|
78
64
|
return send('info', text);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["containerElement","getContainer","document","createElement","setStylesToHtmlElement","containerStyles","body","appendChild","deleteContainerIfNoChildNodes","hasChildNodes","removeChild","send","type","text","container","messageContainer","messageContainerStyles","messageElement","ReactDOM","render","setTimeout","unmountComponentAtNode","MESSAGE_DURATION_MS","message","info","success","error"],"sources":["../../../src/message/index.tsx"],"sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport Message, { MESSAGE_DURATION_MS } from './Message';\nimport { AlertProps } from '../Alert';\nimport {\n containerStyles,\n messageContainerStyles,\n setStylesToHtmlElement,\n} from './styles';\n\nlet containerElement: HTMLElement | null;\n\n/**\n * Creates the container for storing messages.\n */\nconst getContainer = () => {\n if (!containerElement) {\n containerElement = document.createElement('div');\n setStylesToHtmlElement(containerElement, containerStyles);\n document.body.appendChild(containerElement);\n }\n return containerElement;\n};\n\n/**\n * Delete the container if there are no more messages in it.\n */\nconst deleteContainerIfNoChildNodes = () => {\n if (!containerElement || containerElement.hasChildNodes()) return;\n document.body.removeChild(containerElement);\n containerElement = null;\n};\n\n/**\n * Renders a new message.\n */\nconst send = (type: AlertProps['type'], text: string) => {\n // Create a new container for the message\n const container = getContainer();\n const messageContainer = document.createElement('div');\n setStylesToHtmlElement(messageContainer, messageContainerStyles);\n container.appendChild(messageContainer);\n\n // Render the message element\n const messageElement = <Message type={type} text={text} />;\n ReactDOM.render(messageElement, messageContainer);\n\n // Delete the message container after N ms\n setTimeout(() => {\n ReactDOM.unmountComponentAtNode(messageContainer);\n container.removeChild(messageContainer);\n deleteContainerIfNoChildNodes();\n }, MESSAGE_DURATION_MS);\n};\n\nconst message: Record<AlertProps['type'], (text: string) => void> = {\n info: (text) => send('info', text),\n success: (text) => send('success', text),\n error: (text) => send('error', text),\n};\n\nexport default message;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["containerElement","getContainer","document","createElement","setStylesToHtmlElement","containerStyles","body","appendChild","deleteContainerIfNoChildNodes","hasChildNodes","removeChild","send","type","text","container","messageContainer","messageContainerStyles","messageElement","ReactDOM","render","setTimeout","unmountComponentAtNode","MESSAGE_DURATION_MS","message","info","success","error"],"sources":["../../../src/message/index.tsx"],"sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport Message, { MESSAGE_DURATION_MS } from './Message';\nimport { AlertProps } from '../Alert';\nimport {\n containerStyles,\n messageContainerStyles,\n setStylesToHtmlElement,\n} from './styles';\n\nlet containerElement: HTMLElement | null;\n\n/**\n * Creates the container for storing messages.\n */\nconst getContainer = () => {\n if (!containerElement) {\n containerElement = document.createElement('div');\n setStylesToHtmlElement(containerElement, containerStyles);\n document.body.appendChild(containerElement);\n }\n return containerElement;\n};\n\n/**\n * Delete the container if there are no more messages in it.\n */\nconst deleteContainerIfNoChildNodes = () => {\n if (!containerElement || containerElement.hasChildNodes()) return;\n document.body.removeChild(containerElement);\n containerElement = null;\n};\n\n/**\n * Renders a new message.\n */\nconst send = (type: AlertProps['type'], text: string) => {\n // Create a new container for the message\n const container = getContainer();\n const messageContainer = document.createElement('div');\n setStylesToHtmlElement(messageContainer, messageContainerStyles);\n container.appendChild(messageContainer);\n\n // Render the message element\n const messageElement = <Message type={type} text={text} />;\n ReactDOM.render(messageElement, messageContainer);\n\n // Delete the message container after N ms\n setTimeout(() => {\n ReactDOM.unmountComponentAtNode(messageContainer);\n container.removeChild(messageContainer);\n deleteContainerIfNoChildNodes();\n }, MESSAGE_DURATION_MS);\n};\n\nconst message: Record<AlertProps['type'], (text: string) => void> = {\n info: (text) => send('info', text),\n success: (text) => send('success', text),\n error: (text) => send('error', text),\n};\n\nexport default message;\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AAEA;AAIkB;AAAA;AAAA;AAElB,IAAIA,gBAAoC;;AAExC;AACA;AACA;AACA,IAAMC,YAAY,GAAG,SAAfA,YAAY,GAAS;EACzB,IAAI,CAACD,gBAAgB,EAAE;IACrBA,gBAAgB,GAAGE,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;IAChD,IAAAC,8BAAsB,EAACJ,gBAAgB,EAAEK,uBAAe,CAAC;IACzDH,QAAQ,CAACI,IAAI,CAACC,WAAW,CAACP,gBAAgB,CAAC;EAC7C;EACA,OAAOA,gBAAgB;AACzB,CAAC;;AAED;AACA;AACA;AACA,IAAMQ,6BAA6B,GAAG,SAAhCA,6BAA6B,GAAS;EAC1C,IAAI,CAACR,gBAAgB,IAAIA,gBAAgB,CAACS,aAAa,EAAE,EAAE;EAC3DP,QAAQ,CAACI,IAAI,CAACI,WAAW,CAACV,gBAAgB,CAAC;EAC3CA,gBAAgB,GAAG,IAAI;AACzB,CAAC;;AAED;AACA;AACA;AACA,IAAMW,IAAI,GAAG,SAAPA,IAAI,CAAIC,IAAwB,EAAEC,IAAY,EAAK;EACvD;EACA,IAAMC,SAAS,GAAGb,YAAY,EAAE;EAChC,IAAMc,gBAAgB,GAAGb,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;EACtD,IAAAC,8BAAsB,EAACW,gBAAgB,EAAEC,8BAAsB,CAAC;EAChEF,SAAS,CAACP,WAAW,CAACQ,gBAAgB,CAAC;;EAEvC;EACA,IAAME,cAAc,gBAAG,gCAAC,mBAAO;IAAC,IAAI,EAAEL,IAAK;IAAC,IAAI,EAAEC;EAAK,EAAG;EAC1DK,oBAAQ,CAACC,MAAM,CAACF,cAAc,EAAEF,gBAAgB,CAAC;;EAEjD;EACAK,UAAU,CAAC,YAAM;IACfF,oBAAQ,CAACG,sBAAsB,CAACN,gBAAgB,CAAC;IACjDD,SAAS,CAACJ,WAAW,CAACK,gBAAgB,CAAC;IACvCP,6BAA6B,EAAE;EACjC,CAAC,EAAEc,4BAAmB,CAAC;AACzB,CAAC;AAED,IAAMC,OAA2D,GAAG;EAClEC,IAAI,EAAE,cAACX,IAAI;IAAA,OAAKF,IAAI,CAAC,MAAM,EAAEE,IAAI,CAAC;EAAA;EAClCY,OAAO,EAAE,iBAACZ,IAAI;IAAA,OAAKF,IAAI,CAAC,SAAS,EAAEE,IAAI,CAAC;EAAA;EACxCa,KAAK,EAAE,eAACb,IAAI;IAAA,OAAKF,IAAI,CAAC,OAAO,EAAEE,IAAI,CAAC;EAAA;AACtC,CAAC;AAAC,eAEaU,OAAO;AAAA"}
|
|
@@ -4,19 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.setStylesToHtmlElement = exports.messageContainerStyles = exports.containerStyles = void 0;
|
|
7
|
-
|
|
8
7
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
|
-
|
|
10
8
|
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."); }
|
|
11
|
-
|
|
12
9
|
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); }
|
|
13
|
-
|
|
14
10
|
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; }
|
|
15
|
-
|
|
16
11
|
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; }
|
|
17
|
-
|
|
18
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
|
-
|
|
20
13
|
var containerStyles = {
|
|
21
14
|
position: 'fixed',
|
|
22
15
|
top: '0',
|
|
@@ -33,17 +26,14 @@ var messageContainerStyles = {
|
|
|
33
26
|
justifyContent: 'center'
|
|
34
27
|
};
|
|
35
28
|
exports.messageContainerStyles = messageContainerStyles;
|
|
36
|
-
|
|
37
29
|
var setStylesToHtmlElement = function setStylesToHtmlElement(element, styles) {
|
|
38
30
|
Object.entries(styles).forEach(function (_ref) {
|
|
39
31
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
key = _ref2[0],
|
|
33
|
+
value = _ref2[1];
|
|
43
34
|
// eslint-disable-next-line no-param-reassign
|
|
44
35
|
element.style[key] = value;
|
|
45
36
|
});
|
|
46
37
|
};
|
|
47
|
-
|
|
48
38
|
exports.setStylesToHtmlElement = setStylesToHtmlElement;
|
|
49
39
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","names":["containerStyles","position","top","left","right","zIndex","pointerEvents","display","flexDirection","messageContainerStyles","justifyContent","setStylesToHtmlElement","element","styles","Object","entries","forEach","key","value","style"],"sources":["../../../src/message/styles.ts"],"sourcesContent":["export const containerStyles: Partial<CSSStyleDeclaration> = {\n position: 'fixed',\n top: '0',\n left: '0',\n right: '0',\n zIndex: '1001',\n pointerEvents: 'none',\n display: 'flex',\n flexDirection: 'column',\n};\n\nexport const messageContainerStyles: Partial<CSSStyleDeclaration> = {\n display: 'flex',\n justifyContent: 'center',\n};\n\nexport const setStylesToHtmlElement = (\n element: HTMLElement,\n styles: Partial<CSSStyleDeclaration>\n): void => {\n Object.entries(styles).forEach(([key, value]) => {\n // eslint-disable-next-line no-param-reassign\n element.style[key] = value;\n });\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"styles.js","names":["containerStyles","position","top","left","right","zIndex","pointerEvents","display","flexDirection","messageContainerStyles","justifyContent","setStylesToHtmlElement","element","styles","Object","entries","forEach","key","value","style"],"sources":["../../../src/message/styles.ts"],"sourcesContent":["export const containerStyles: Partial<CSSStyleDeclaration> = {\n position: 'fixed',\n top: '0',\n left: '0',\n right: '0',\n zIndex: '1001',\n pointerEvents: 'none',\n display: 'flex',\n flexDirection: 'column',\n};\n\nexport const messageContainerStyles: Partial<CSSStyleDeclaration> = {\n display: 'flex',\n justifyContent: 'center',\n};\n\nexport const setStylesToHtmlElement = (\n element: HTMLElement,\n styles: Partial<CSSStyleDeclaration>\n): void => {\n Object.entries(styles).forEach(([key, value]) => {\n // eslint-disable-next-line no-param-reassign\n element.style[key] = value;\n });\n};\n"],"mappings":";;;;;;;;;;;;AAAO,IAAMA,eAA6C,GAAG;EAC3DC,QAAQ,EAAE,OAAO;EACjBC,GAAG,EAAE,GAAG;EACRC,IAAI,EAAE,GAAG;EACTC,KAAK,EAAE,GAAG;EACVC,MAAM,EAAE,MAAM;EACdC,aAAa,EAAE,MAAM;EACrBC,OAAO,EAAE,MAAM;EACfC,aAAa,EAAE;AACjB,CAAC;AAAC;AAEK,IAAMC,sBAAoD,GAAG;EAClEF,OAAO,EAAE,MAAM;EACfG,cAAc,EAAE;AAClB,CAAC;AAAC;AAEK,IAAMC,sBAAsB,GAAG,SAAzBA,sBAAsB,CACjCC,OAAoB,EACpBC,MAAoC,EAC3B;EACTC,MAAM,CAACC,OAAO,CAACF,MAAM,CAAC,CAACG,OAAO,CAAC,gBAAkB;IAAA;MAAhBC,GAAG;MAAEC,KAAK;IACzC;IACAN,OAAO,CAACO,KAAK,CAACF,GAAG,CAAC,GAAGC,KAAK;EAC5B,CAAC,CAAC;AACJ,CAAC;AAAC"}
|
package/dist/esm/Alert/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
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); }
|
|
2
|
-
|
|
3
2
|
import React, { forwardRef, useMemo } from 'react';
|
|
4
3
|
import { sizeStyles } from '@os-design/styles';
|
|
5
4
|
import { omitEmotionProps } from '@os-design/utils';
|
|
@@ -7,19 +6,15 @@ import { clr } from '@os-design/theming';
|
|
|
7
6
|
import { CheckCircle, CloseCircle, InfoCircle } from '@os-design/icons';
|
|
8
7
|
import styled from '@emotion/styled';
|
|
9
8
|
import { css } from '@emotion/react';
|
|
10
|
-
|
|
11
9
|
const infoContainerStyles = p => p.type === 'info' && css`
|
|
12
10
|
background-color: ${clr(p.theme.alertInfoColorBg)};
|
|
13
11
|
`;
|
|
14
|
-
|
|
15
12
|
const successContainerStyles = p => p.type === 'success' && css`
|
|
16
13
|
background-color: ${clr(p.theme.alertSuccessColorBg)};
|
|
17
14
|
`;
|
|
18
|
-
|
|
19
15
|
const errorContainerStyles = p => p.type === 'error' && css`
|
|
20
16
|
background-color: ${clr(p.theme.alertErrorColorBg)};
|
|
21
17
|
`;
|
|
22
|
-
|
|
23
18
|
const Container = styled('div', omitEmotionProps('type', 'size'))`
|
|
24
19
|
display: flex;
|
|
25
20
|
flex-direction: row;
|
|
@@ -34,19 +29,15 @@ const Container = styled('div', omitEmotionProps('type', 'size'))`
|
|
|
34
29
|
${errorContainerStyles};
|
|
35
30
|
${sizeStyles};
|
|
36
31
|
`;
|
|
37
|
-
|
|
38
32
|
const infoIconContainerStyles = p => p.type === 'info' && css`
|
|
39
33
|
color: ${clr(p.theme.alertInfoColorIcon)};
|
|
40
34
|
`;
|
|
41
|
-
|
|
42
35
|
const successIconContainerStyles = p => p.type === 'success' && css`
|
|
43
36
|
color: ${clr(p.theme.alertSuccessColorIcon)};
|
|
44
37
|
`;
|
|
45
|
-
|
|
46
38
|
const errorIconContainerStyles = p => p.type === 'error' && css`
|
|
47
39
|
color: ${clr(p.theme.alertErrorColorIcon)};
|
|
48
40
|
`;
|
|
49
|
-
|
|
50
41
|
const IconContainer = styled('i', omitEmotionProps('type'))`
|
|
51
42
|
display: flex;
|
|
52
43
|
align-items: center;
|
|
@@ -63,10 +54,10 @@ const typeIconMap = {
|
|
|
63
54
|
success: CheckCircle,
|
|
64
55
|
error: CloseCircle
|
|
65
56
|
};
|
|
57
|
+
|
|
66
58
|
/**
|
|
67
59
|
* The component for feedback.
|
|
68
60
|
*/
|
|
69
|
-
|
|
70
61
|
const Alert = /*#__PURE__*/forwardRef(({
|
|
71
62
|
type,
|
|
72
63
|
size,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","forwardRef","useMemo","sizeStyles","omitEmotionProps","clr","CheckCircle","CloseCircle","InfoCircle","styled","css","infoContainerStyles","p","type","theme","alertInfoColorBg","successContainerStyles","alertSuccessColorBg","errorContainerStyles","alertErrorColorBg","Container","borderRadius","colorText","infoIconContainerStyles","alertInfoColorIcon","successIconContainerStyles","alertSuccessColorIcon","errorIconContainerStyles","alertErrorColorIcon","IconContainer","typeIconMap","info","success","error","Alert","size","children","rest","ref","Icon","displayName"],"sources":["../../../src/Alert/index.tsx"],"sourcesContent":["import React, { forwardRef, useMemo } from 'react';\nimport { sizeStyles, WithSize } from '@os-design/styles';\nimport { omitEmotionProps } from '@os-design/utils';\nimport { clr } from '@os-design/theming';\nimport { CheckCircle, CloseCircle, InfoCircle } from '@os-design/icons';\nimport styled from '@emotion/styled';\nimport { css } from '@emotion/react';\n\ntype JsxDivProps = Omit<JSX.IntrinsicElements['div'], 'ref'>;\nexport interface AlertProps extends JsxDivProps, WithSize {\n /**\n * Type of styles.\n */\n type: 'info' | 'success' | 'error';\n}\n\nconst infoContainerStyles = (p) =>\n p.type === 'info' &&\n css`\n background-color: ${clr(p.theme.alertInfoColorBg)};\n `;\n\nconst successContainerStyles = (p) =>\n p.type === 'success' &&\n css`\n background-color: ${clr(p.theme.alertSuccessColorBg)};\n `;\n\nconst errorContainerStyles = (p) =>\n p.type === 'error' &&\n css`\n background-color: ${clr(p.theme.alertErrorColorBg)};\n `;\n\ntype ContainerProps = Pick<AlertProps, 'type' | 'size'>;\nconst Container = styled(\n 'div',\n omitEmotionProps('type', 'size')\n)<ContainerProps>`\n display: flex;\n flex-direction: row;\n align-items: center;\n\n padding: 1em;\n border-radius: ${(p) => p.theme.borderRadius}em;\n color: ${(p) => clr(p.theme.colorText)};\n\n ${infoContainerStyles};\n ${successContainerStyles};\n ${errorContainerStyles};\n ${sizeStyles};\n`;\n\nconst infoIconContainerStyles = (p) =>\n p.type === 'info' &&\n css`\n color: ${clr(p.theme.alertInfoColorIcon)};\n `;\n\nconst successIconContainerStyles = (p) =>\n p.type === 'success' &&\n css`\n color: ${clr(p.theme.alertSuccessColorIcon)};\n `;\n\nconst errorIconContainerStyles = (p) =>\n p.type === 'error' &&\n css`\n color: ${clr(p.theme.alertErrorColorIcon)};\n `;\n\ntype IconContainerProps = Pick<AlertProps, 'type'>;\nconst IconContainer = styled('i', omitEmotionProps('type'))<IconContainerProps>`\n display: flex;\n align-items: center;\n\n margin-right: 0.3em;\n font-size: 1.4em;\n\n ${infoIconContainerStyles};\n ${successIconContainerStyles};\n ${errorIconContainerStyles};\n`;\n\nconst typeIconMap = {\n info: InfoCircle,\n success: CheckCircle,\n error: CloseCircle,\n};\n\n/**\n * The component for feedback.\n */\nconst Alert = forwardRef<HTMLDivElement, AlertProps>(\n ({ type, size, children, ...rest }, ref) => {\n const Icon = useMemo(() => typeIconMap[type], [type]);\n\n return (\n <Container size={size} type={type} role='alert' {...rest} ref={ref}>\n <IconContainer type={type}>\n <Icon />\n </IconContainer>\n <span>{children}</span>\n </Container>\n );\n }\n);\n\nAlert.displayName = 'Alert';\n\nexport default Alert;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","forwardRef","useMemo","sizeStyles","omitEmotionProps","clr","CheckCircle","CloseCircle","InfoCircle","styled","css","infoContainerStyles","p","type","theme","alertInfoColorBg","successContainerStyles","alertSuccessColorBg","errorContainerStyles","alertErrorColorBg","Container","borderRadius","colorText","infoIconContainerStyles","alertInfoColorIcon","successIconContainerStyles","alertSuccessColorIcon","errorIconContainerStyles","alertErrorColorIcon","IconContainer","typeIconMap","info","success","error","Alert","size","children","rest","ref","Icon","displayName"],"sources":["../../../src/Alert/index.tsx"],"sourcesContent":["import React, { forwardRef, useMemo } from 'react';\nimport { sizeStyles, WithSize } from '@os-design/styles';\nimport { omitEmotionProps } from '@os-design/utils';\nimport { clr } from '@os-design/theming';\nimport { CheckCircle, CloseCircle, InfoCircle } from '@os-design/icons';\nimport styled from '@emotion/styled';\nimport { css } from '@emotion/react';\n\ntype JsxDivProps = Omit<JSX.IntrinsicElements['div'], 'ref'>;\nexport interface AlertProps extends JsxDivProps, WithSize {\n /**\n * Type of styles.\n */\n type: 'info' | 'success' | 'error';\n}\n\nconst infoContainerStyles = (p) =>\n p.type === 'info' &&\n css`\n background-color: ${clr(p.theme.alertInfoColorBg)};\n `;\n\nconst successContainerStyles = (p) =>\n p.type === 'success' &&\n css`\n background-color: ${clr(p.theme.alertSuccessColorBg)};\n `;\n\nconst errorContainerStyles = (p) =>\n p.type === 'error' &&\n css`\n background-color: ${clr(p.theme.alertErrorColorBg)};\n `;\n\ntype ContainerProps = Pick<AlertProps, 'type' | 'size'>;\nconst Container = styled(\n 'div',\n omitEmotionProps('type', 'size')\n)<ContainerProps>`\n display: flex;\n flex-direction: row;\n align-items: center;\n\n padding: 1em;\n border-radius: ${(p) => p.theme.borderRadius}em;\n color: ${(p) => clr(p.theme.colorText)};\n\n ${infoContainerStyles};\n ${successContainerStyles};\n ${errorContainerStyles};\n ${sizeStyles};\n`;\n\nconst infoIconContainerStyles = (p) =>\n p.type === 'info' &&\n css`\n color: ${clr(p.theme.alertInfoColorIcon)};\n `;\n\nconst successIconContainerStyles = (p) =>\n p.type === 'success' &&\n css`\n color: ${clr(p.theme.alertSuccessColorIcon)};\n `;\n\nconst errorIconContainerStyles = (p) =>\n p.type === 'error' &&\n css`\n color: ${clr(p.theme.alertErrorColorIcon)};\n `;\n\ntype IconContainerProps = Pick<AlertProps, 'type'>;\nconst IconContainer = styled('i', omitEmotionProps('type'))<IconContainerProps>`\n display: flex;\n align-items: center;\n\n margin-right: 0.3em;\n font-size: 1.4em;\n\n ${infoIconContainerStyles};\n ${successIconContainerStyles};\n ${errorIconContainerStyles};\n`;\n\nconst typeIconMap = {\n info: InfoCircle,\n success: CheckCircle,\n error: CloseCircle,\n};\n\n/**\n * The component for feedback.\n */\nconst Alert = forwardRef<HTMLDivElement, AlertProps>(\n ({ type, size, children, ...rest }, ref) => {\n const Icon = useMemo(() => typeIconMap[type], [type]);\n\n return (\n <Container size={size} type={type} role='alert' {...rest} ref={ref}>\n <IconContainer type={type}>\n <Icon />\n </IconContainer>\n <span>{children}</span>\n </Container>\n );\n }\n);\n\nAlert.displayName = 'Alert';\n\nexport default Alert;\n"],"mappings":"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"}
|
package/dist/esm/Avatar/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
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); }
|
|
2
|
-
|
|
3
2
|
import React, { forwardRef, useCallback, useMemo } from 'react';
|
|
4
3
|
import styled from '@emotion/styled';
|
|
5
4
|
import { User } from '@os-design/icons';
|
|
@@ -65,10 +64,10 @@ const Online = styled.span`
|
|
|
65
64
|
background-color: ${p => clr(p.theme.avatarOnlineColorBg)};
|
|
66
65
|
}
|
|
67
66
|
`;
|
|
67
|
+
|
|
68
68
|
/**
|
|
69
69
|
* Avatar can be used to represent people.
|
|
70
70
|
*/
|
|
71
|
-
|
|
72
71
|
const Avatar = /*#__PURE__*/forwardRef(({
|
|
73
72
|
firstName,
|
|
74
73
|
lastName,
|
|
@@ -94,14 +93,16 @@ const Avatar = /*#__PURE__*/forwardRef(({
|
|
|
94
93
|
if (image) return /*#__PURE__*/React.createElement(Image, _extends({
|
|
95
94
|
url: image,
|
|
96
95
|
cropped: true
|
|
97
|
-
}, imageProps));
|
|
96
|
+
}, imageProps));
|
|
98
97
|
|
|
98
|
+
// Render the initials of the name if either firstName or lastName was specified
|
|
99
99
|
const initials = nameToInitials({
|
|
100
100
|
firstName,
|
|
101
101
|
lastName
|
|
102
102
|
});
|
|
103
|
-
if (initials) return /*#__PURE__*/React.createElement(Initials, null, initials);
|
|
103
|
+
if (initials) return /*#__PURE__*/React.createElement(Initials, null, initials);
|
|
104
104
|
|
|
105
|
+
// Otherwise render the user icon
|
|
105
106
|
return /*#__PURE__*/React.createElement(UserIcon, null);
|
|
106
107
|
}, [image, imageProps, firstName, lastName]);
|
|
107
108
|
return /*#__PURE__*/React.createElement(Container, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","forwardRef","useCallback","useMemo","styled","User","sizeStyles","omitEmotionProps","clr","useTheme","nameToInitials","strToHue","Image","Container","AvatarContainer","p","theme","borderRadius","bgColor","UserIcon","Initials","div","INNER_SIZE","OUTER_SIZE","Online","span","avatarOnlineColorScoop","avatarOnlineColorBg","Avatar","firstName","lastName","image","imageProps","online","size","rest","ref","parts","push","length","join","avatarDefaultColorBg","fullName","filter","i","undefined","renderChildren","initials","displayName"],"sources":["../../../src/Avatar/index.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useMemo } from 'react';\nimport styled from '@emotion/styled';\nimport { User } from '@os-design/icons';\nimport { WithSize, sizeStyles } from '@os-design/styles';\nimport { omitEmotionProps } from '@os-design/utils';\nimport { clr, Color, useTheme } from '@os-design/theming';\nimport nameToInitials from './utils/nameToInitials';\nimport strToHue from './utils/strToHue';\nimport Image, { ImageProps } from '../Image';\n\ntype JsxDivProps = Omit<JSX.IntrinsicElements['div'], 'ref'>;\nexport interface AvatarProps extends JsxDivProps, WithSize {\n /**\n * Used to render the first letter if the image URL is not specified.\n * @default undefined\n */\n firstName?: string;\n /**\n * Used to render the second letter if the image URL is not specified.\n * @default undefined\n */\n lastName?: string;\n /**\n * The URL of the image.\n * @default undefined\n */\n image?: string;\n /**\n * The props of the image.\n * @default undefined\n */\n imageProps?: Omit<ImageProps, 'url'>;\n /**\n * Whether the user is online.\n * @default false\n */\n online?: boolean;\n}\n\nconst Container = styled('div', omitEmotionProps('size'))<WithSize>`\n position: relative;\n width: 1em;\n height: 1em;\n min-width: 1em;\n min-height: 1em;\n ${sizeStyles};\n`;\n\ninterface AvatarContainerProps {\n bgColor: Color;\n}\n\nconst AvatarContainer = styled(\n 'div',\n omitEmotionProps('bgColor')\n)<AvatarContainerProps>`\n width: 100%;\n height: 100%;\n border-radius: ${(p) => p.theme.borderRadius}em;\n\n font-weight: 500;\n line-height: 1;\n\n color: hsl(0, 0%, 100%);\n background-color: ${(p) => clr(p.bgColor)};\n\n display: flex;\n justify-content: center;\n align-items: center;\n\n white-space: nowrap; // To disable multiline text\n overflow: hidden; // To trim the image corners\n\n ${sizeStyles};\n`;\n\nconst UserIcon = styled(User)`\n font-size: 0.6em;\n`;\n\nconst Initials = styled.div`\n font-size: 0.35em;\n`;\n\nconst INNER_SIZE = 0.25;\nconst OUTER_SIZE = INNER_SIZE * 1.2;\n\nconst Online = styled.span`\n position: absolute;\n right: -0.05em;\n bottom: -0.05em;\n width: ${OUTER_SIZE}em;\n height: ${OUTER_SIZE}em;\n border-radius: 50%;\n background-color: ${(p) => clr(p.theme.avatarOnlineColorScoop)};\n\n &::before {\n content: '';\n position: absolute;\n left: ${(OUTER_SIZE - INNER_SIZE) / 2}em;\n bottom: ${(OUTER_SIZE - INNER_SIZE) / 2}em;\n width: ${INNER_SIZE}em;\n height: ${INNER_SIZE}em;\n border-radius: 50%;\n background-color: ${(p) => clr(p.theme.avatarOnlineColorBg)};\n }\n`;\n\n/**\n * Avatar can be used to represent people.\n */\nconst Avatar = forwardRef<HTMLDivElement, AvatarProps>(\n (\n {\n firstName,\n lastName,\n image,\n imageProps = {},\n online = false,\n size = '2em',\n ...rest\n },\n ref\n ) => {\n const { theme } = useTheme();\n\n const bgColor = useMemo<Color>(() => {\n const parts: string[] = [];\n if (firstName) parts.push(firstName);\n if (lastName) parts.push(lastName);\n if (parts.length > 0) return [strToHue(parts.join(' ')), 30, 60];\n return theme.avatarDefaultColorBg;\n }, [firstName, lastName, theme.avatarDefaultColorBg]);\n\n const fullName = useMemo(\n () => [firstName, lastName].filter((i) => i).join(' ') || undefined,\n [firstName, lastName]\n );\n\n const renderChildren = useCallback(() => {\n // Render the image if the image property was specified\n if (image) return <Image url={image} cropped {...imageProps} />;\n\n // Render the initials of the name if either firstName or lastName was specified\n const initials = nameToInitials({ firstName, lastName });\n if (initials) return <Initials>{initials}</Initials>;\n\n // Otherwise render the user icon\n return <UserIcon />;\n }, [image, imageProps, firstName, lastName]);\n\n return (\n <Container size={size}>\n <AvatarContainer\n bgColor={bgColor}\n role='img'\n aria-label={fullName || 'User'}\n {...rest}\n ref={ref}\n >\n {renderChildren()}\n </AvatarContainer>\n {online && <Online />}\n </Container>\n );\n }\n);\n\nAvatar.displayName = 'Avatar';\n\nexport default Avatar;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","forwardRef","useCallback","useMemo","styled","User","sizeStyles","omitEmotionProps","clr","useTheme","nameToInitials","strToHue","Image","Container","AvatarContainer","p","theme","borderRadius","bgColor","UserIcon","Initials","div","INNER_SIZE","OUTER_SIZE","Online","span","avatarOnlineColorScoop","avatarOnlineColorBg","Avatar","firstName","lastName","image","imageProps","online","size","rest","ref","parts","push","length","join","avatarDefaultColorBg","fullName","filter","i","undefined","renderChildren","initials","displayName"],"sources":["../../../src/Avatar/index.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useMemo } from 'react';\nimport styled from '@emotion/styled';\nimport { User } from '@os-design/icons';\nimport { WithSize, sizeStyles } from '@os-design/styles';\nimport { omitEmotionProps } from '@os-design/utils';\nimport { clr, Color, useTheme } from '@os-design/theming';\nimport nameToInitials from './utils/nameToInitials';\nimport strToHue from './utils/strToHue';\nimport Image, { ImageProps } from '../Image';\n\ntype JsxDivProps = Omit<JSX.IntrinsicElements['div'], 'ref'>;\nexport interface AvatarProps extends JsxDivProps, WithSize {\n /**\n * Used to render the first letter if the image URL is not specified.\n * @default undefined\n */\n firstName?: string;\n /**\n * Used to render the second letter if the image URL is not specified.\n * @default undefined\n */\n lastName?: string;\n /**\n * The URL of the image.\n * @default undefined\n */\n image?: string;\n /**\n * The props of the image.\n * @default undefined\n */\n imageProps?: Omit<ImageProps, 'url'>;\n /**\n * Whether the user is online.\n * @default false\n */\n online?: boolean;\n}\n\nconst Container = styled('div', omitEmotionProps('size'))<WithSize>`\n position: relative;\n width: 1em;\n height: 1em;\n min-width: 1em;\n min-height: 1em;\n ${sizeStyles};\n`;\n\ninterface AvatarContainerProps {\n bgColor: Color;\n}\n\nconst AvatarContainer = styled(\n 'div',\n omitEmotionProps('bgColor')\n)<AvatarContainerProps>`\n width: 100%;\n height: 100%;\n border-radius: ${(p) => p.theme.borderRadius}em;\n\n font-weight: 500;\n line-height: 1;\n\n color: hsl(0, 0%, 100%);\n background-color: ${(p) => clr(p.bgColor)};\n\n display: flex;\n justify-content: center;\n align-items: center;\n\n white-space: nowrap; // To disable multiline text\n overflow: hidden; // To trim the image corners\n\n ${sizeStyles};\n`;\n\nconst UserIcon = styled(User)`\n font-size: 0.6em;\n`;\n\nconst Initials = styled.div`\n font-size: 0.35em;\n`;\n\nconst INNER_SIZE = 0.25;\nconst OUTER_SIZE = INNER_SIZE * 1.2;\n\nconst Online = styled.span`\n position: absolute;\n right: -0.05em;\n bottom: -0.05em;\n width: ${OUTER_SIZE}em;\n height: ${OUTER_SIZE}em;\n border-radius: 50%;\n background-color: ${(p) => clr(p.theme.avatarOnlineColorScoop)};\n\n &::before {\n content: '';\n position: absolute;\n left: ${(OUTER_SIZE - INNER_SIZE) / 2}em;\n bottom: ${(OUTER_SIZE - INNER_SIZE) / 2}em;\n width: ${INNER_SIZE}em;\n height: ${INNER_SIZE}em;\n border-radius: 50%;\n background-color: ${(p) => clr(p.theme.avatarOnlineColorBg)};\n }\n`;\n\n/**\n * Avatar can be used to represent people.\n */\nconst Avatar = forwardRef<HTMLDivElement, AvatarProps>(\n (\n {\n firstName,\n lastName,\n image,\n imageProps = {},\n online = false,\n size = '2em',\n ...rest\n },\n ref\n ) => {\n const { theme } = useTheme();\n\n const bgColor = useMemo<Color>(() => {\n const parts: string[] = [];\n if (firstName) parts.push(firstName);\n if (lastName) parts.push(lastName);\n if (parts.length > 0) return [strToHue(parts.join(' ')), 30, 60];\n return theme.avatarDefaultColorBg;\n }, [firstName, lastName, theme.avatarDefaultColorBg]);\n\n const fullName = useMemo(\n () => [firstName, lastName].filter((i) => i).join(' ') || undefined,\n [firstName, lastName]\n );\n\n const renderChildren = useCallback(() => {\n // Render the image if the image property was specified\n if (image) return <Image url={image} cropped {...imageProps} />;\n\n // Render the initials of the name if either firstName or lastName was specified\n const initials = nameToInitials({ firstName, lastName });\n if (initials) return <Initials>{initials}</Initials>;\n\n // Otherwise render the user icon\n return <UserIcon />;\n }, [image, imageProps, firstName, lastName]);\n\n return (\n <Container size={size}>\n <AvatarContainer\n bgColor={bgColor}\n role='img'\n aria-label={fullName || 'User'}\n {...rest}\n ref={ref}\n >\n {renderChildren()}\n </AvatarContainer>\n {online && <Online />}\n </Container>\n );\n }\n);\n\nAvatar.displayName = 'Avatar';\n\nexport default Avatar;\n"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nameToInitials.js","names":["nameToInitials","firstName","lastName","first","charAt","second","toUpperCase"],"sources":["../../../../src/Avatar/utils/nameToInitials.ts"],"sourcesContent":["interface Name {\n firstName?: string;\n lastName?: string;\n}\n\nconst nameToInitials = ({ firstName, lastName }: Name): string => {\n const first = firstName ? firstName.charAt(0) : '';\n const second = lastName ? lastName.charAt(0) : '';\n return `${first}${second}`.toUpperCase();\n};\n\nexport default nameToInitials;\n"],"mappings":"AAKA,MAAMA,cAAc,GAAG,CAAC;EAAEC,
|
|
1
|
+
{"version":3,"file":"nameToInitials.js","names":["nameToInitials","firstName","lastName","first","charAt","second","toUpperCase"],"sources":["../../../../src/Avatar/utils/nameToInitials.ts"],"sourcesContent":["interface Name {\n firstName?: string;\n lastName?: string;\n}\n\nconst nameToInitials = ({ firstName, lastName }: Name): string => {\n const first = firstName ? firstName.charAt(0) : '';\n const second = lastName ? lastName.charAt(0) : '';\n return `${first}${second}`.toUpperCase();\n};\n\nexport default nameToInitials;\n"],"mappings":"AAKA,MAAMA,cAAc,GAAG,CAAC;EAAEC,SAAS;EAAEC;AAAe,CAAC,KAAa;EAChE,MAAMC,KAAK,GAAGF,SAAS,GAAGA,SAAS,CAACG,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE;EAClD,MAAMC,MAAM,GAAGH,QAAQ,GAAGA,QAAQ,CAACE,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE;EACjD,OAAQ,GAAED,KAAM,GAAEE,MAAO,EAAC,CAACC,WAAW,EAAE;AAC1C,CAAC;AAED,eAAeN,cAAc"}
|
|
@@ -3,14 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
const strToHue = str => {
|
|
5
5
|
let hash = 0;
|
|
6
|
-
|
|
7
6
|
for (let i = 0; i < str.length; i += 1) {
|
|
8
7
|
// eslint-disable-next-line no-bitwise
|
|
9
8
|
hash = str.charCodeAt(i) + ((hash << 5) - hash);
|
|
10
9
|
}
|
|
11
|
-
|
|
12
10
|
return hash % 360;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
export default strToHue;
|
|
16
13
|
//# sourceMappingURL=strToHue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strToHue.js","names":["strToHue","str","hash","i","length","charCodeAt"],"sources":["../../../../src/Avatar/utils/strToHue.ts"],"sourcesContent":["/**\n * Return the hue of the color by string.\n */\nconst strToHue = (str: string): number => {\n let hash = 0;\n for (let i = 0; i < str.length; i += 1) {\n // eslint-disable-next-line no-bitwise\n hash = str.charCodeAt(i) + ((hash << 5) - hash);\n }\n return hash % 360;\n};\n\nexport default strToHue;\n"],"mappings":"AAAA;AACA;AACA;AACA,MAAMA,QAAQ,GAAIC,
|
|
1
|
+
{"version":3,"file":"strToHue.js","names":["strToHue","str","hash","i","length","charCodeAt"],"sources":["../../../../src/Avatar/utils/strToHue.ts"],"sourcesContent":["/**\n * Return the hue of the color by string.\n */\nconst strToHue = (str: string): number => {\n let hash = 0;\n for (let i = 0; i < str.length; i += 1) {\n // eslint-disable-next-line no-bitwise\n hash = str.charCodeAt(i) + ((hash << 5) - hash);\n }\n return hash % 360;\n};\n\nexport default strToHue;\n"],"mappings":"AAAA;AACA;AACA;AACA,MAAMA,QAAQ,GAAIC,GAAW,IAAa;EACxC,IAAIC,IAAI,GAAG,CAAC;EACZ,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,GAAG,CAACG,MAAM,EAAED,CAAC,IAAI,CAAC,EAAE;IACtC;IACAD,IAAI,GAAGD,GAAG,CAACI,UAAU,CAACF,CAAC,CAAC,IAAI,CAACD,IAAI,IAAI,CAAC,IAAIA,IAAI,CAAC;EACjD;EACA,OAAOA,IAAI,GAAG,GAAG;AACnB,CAAC;AAED,eAAeF,QAAQ"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
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); }
|
|
2
|
-
|
|
3
2
|
import styled from '@emotion/styled';
|
|
4
3
|
import React, { forwardRef } from 'react';
|
|
5
4
|
import { sizeStyles } from '@os-design/styles';
|
|
@@ -8,10 +7,10 @@ import Skeleton from '../Skeleton';
|
|
|
8
7
|
const Container = styled('div', omitEmotionProps('size'))`
|
|
9
8
|
${sizeStyles};
|
|
10
9
|
`;
|
|
10
|
+
|
|
11
11
|
/**
|
|
12
12
|
* Provides an avatar placeholder while a user waits for the content to load.
|
|
13
13
|
*/
|
|
14
|
-
|
|
15
14
|
const AvatarSkeleton = /*#__PURE__*/forwardRef(({
|
|
16
15
|
size = '2em',
|
|
17
16
|
...rest
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["styled","React","forwardRef","sizeStyles","omitEmotionProps","Skeleton","Container","AvatarSkeleton","size","rest","ref","displayName"],"sources":["../../../src/AvatarSkeleton/index.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport React, { forwardRef } from 'react';\nimport { sizeStyles, WithSize } from '@os-design/styles';\nimport { omitEmotionProps } from '@os-design/utils';\nimport Skeleton from '../Skeleton';\n\ntype JsxDivProps = Omit<JSX.IntrinsicElements['div'], 'ref'>;\nexport type AvatarSkeletonProps = JsxDivProps & WithSize;\n\nconst Container = styled('div', omitEmotionProps('size'))<WithSize>`\n ${sizeStyles};\n`;\n\n/**\n * Provides an avatar placeholder while a user waits for the content to load.\n */\nconst AvatarSkeleton = forwardRef<HTMLDivElement, AvatarSkeletonProps>(\n ({ size = '2em', ...rest }, ref) => (\n <Container size={size} {...rest} ref={ref}>\n <Skeleton width='1em' />\n </Container>\n )\n);\n\nAvatarSkeleton.displayName = 'AvatarSkeleton';\n\nexport default AvatarSkeleton;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["styled","React","forwardRef","sizeStyles","omitEmotionProps","Skeleton","Container","AvatarSkeleton","size","rest","ref","displayName"],"sources":["../../../src/AvatarSkeleton/index.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport React, { forwardRef } from 'react';\nimport { sizeStyles, WithSize } from '@os-design/styles';\nimport { omitEmotionProps } from '@os-design/utils';\nimport Skeleton from '../Skeleton';\n\ntype JsxDivProps = Omit<JSX.IntrinsicElements['div'], 'ref'>;\nexport type AvatarSkeletonProps = JsxDivProps & WithSize;\n\nconst Container = styled('div', omitEmotionProps('size'))<WithSize>`\n ${sizeStyles};\n`;\n\n/**\n * Provides an avatar placeholder while a user waits for the content to load.\n */\nconst AvatarSkeleton = forwardRef<HTMLDivElement, AvatarSkeletonProps>(\n ({ size = '2em', ...rest }, ref) => (\n <Container size={size} {...rest} ref={ref}>\n <Skeleton width='1em' />\n </Container>\n )\n);\n\nAvatarSkeleton.displayName = 'AvatarSkeleton';\n\nexport default AvatarSkeleton;\n"],"mappings":";AAAA,OAAOA,MAAM,MAAM,iBAAiB;AACpC,OAAOC,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SAASC,UAAU,QAAkB,mBAAmB;AACxD,SAASC,gBAAgB,QAAQ,kBAAkB;AACnD,OAAOC,QAAQ,MAAM,aAAa;AAKlC,MAAMC,SAAS,GAAGN,MAAM,CAAC,KAAK,EAAEI,gBAAgB,CAAC,MAAM,CAAC,CAAY;AACpE,IAAID,UAAW;AACf,CAAC;;AAED;AACA;AACA;AACA,MAAMI,cAAc,gBAAGL,UAAU,CAC/B,CAAC;EAAEM,IAAI,GAAG,KAAK;EAAE,GAAGC;AAAK,CAAC,EAAEC,GAAG,kBAC7B,oBAAC,SAAS;EAAC,IAAI,EAAEF;AAAK,GAAKC,IAAI;EAAE,GAAG,EAAEC;AAAI,iBACxC,oBAAC,QAAQ;EAAC,KAAK,EAAC;AAAK,EAAG,CAE3B,CACF;AAEDH,cAAc,CAACI,WAAW,GAAG,gBAAgB;AAE7C,eAAeJ,cAAc"}
|