@fountain-ui/core 2.0.0-beta.9 → 2.0.0-beta.91
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/CHANGELOG.md +32 -0
- package/build/commonjs/Accordion/Accordion.js +110 -27
- package/build/commonjs/Accordion/Accordion.js.map +1 -1
- package/build/commonjs/Accordion/AccordionProps.js.map +1 -1
- package/build/commonjs/Badge/Badge.js +5 -14
- package/build/commonjs/Badge/Badge.js.map +1 -1
- package/build/commonjs/Badge/BadgeProps.js.map +1 -1
- package/build/commonjs/Button/Button.js +6 -3
- package/build/commonjs/Button/Button.js.map +1 -1
- package/build/commonjs/ButtonBase/ButtonBase.js +65 -51
- package/build/commonjs/ButtonBase/ButtonBase.js.map +1 -1
- package/build/commonjs/ButtonBase/ButtonBaseProps.js.map +1 -1
- package/build/commonjs/Checkbox/CheckboxProps.js.map +1 -1
- package/build/commonjs/Chip/Chip.js +11 -9
- package/build/commonjs/Chip/Chip.js.map +1 -1
- package/build/commonjs/Chip/ChipProps.js.map +1 -1
- package/build/commonjs/CircularProgress/CircularProgress.js +27 -28
- package/build/commonjs/CircularProgress/CircularProgress.js.map +1 -1
- package/build/commonjs/Dialog/Dialog.js +118 -10
- package/build/commonjs/Dialog/Dialog.js.map +1 -1
- package/build/commonjs/Dialog/DialogProps.js.map +1 -1
- package/build/commonjs/Divider/Divider.js +26 -18
- package/build/commonjs/Divider/Divider.js.map +1 -1
- package/build/commonjs/Divider/DividerProps.js.map +1 -1
- package/build/commonjs/Image/Image.js +58 -14
- package/build/commonjs/Image/Image.js.map +1 -1
- package/build/commonjs/Image/ImageProps.js.map +1 -1
- package/build/commonjs/Image/index.js.map +1 -1
- package/build/commonjs/ImageCore/ImageCoreNative.js +36 -26
- package/build/commonjs/ImageCore/ImageCoreNative.js.map +1 -1
- package/build/commonjs/ImageCore/ImageCoreProps.js.map +1 -1
- package/build/commonjs/ImageCore/ImageCoreWeb.js +19 -1
- package/build/commonjs/ImageCore/ImageCoreWeb.js.map +1 -1
- package/build/commonjs/ImageCore/ImageFileExtensionContext.js +14 -0
- package/build/commonjs/ImageCore/ImageFileExtensionContext.js.map +1 -0
- package/build/commonjs/ImageCore/ImageFileExtensionProvider.js +42 -0
- package/build/commonjs/ImageCore/ImageFileExtensionProvider.js.map +1 -0
- package/build/commonjs/ImageCore/index.js +17 -5
- package/build/commonjs/ImageCore/index.js.map +1 -1
- package/build/commonjs/ImageCore/index.native.js +27 -0
- package/build/commonjs/ImageCore/index.native.js.map +1 -1
- package/build/commonjs/Modal/AnimatedContainer/index.js +167 -0
- package/build/commonjs/Modal/AnimatedContainer/index.js.map +1 -0
- package/build/commonjs/Modal/Modal.js +43 -9
- package/build/commonjs/Modal/Modal.js.map +1 -1
- package/build/commonjs/Modal/ModalProps.js +12 -0
- package/build/commonjs/Modal/ModalProps.js.map +1 -1
- package/build/commonjs/Modal/index.js +18 -0
- package/build/commonjs/Modal/index.js.map +1 -1
- package/build/commonjs/Paper/Paper.js +1 -1
- package/build/commonjs/Paper/Paper.js.map +1 -1
- package/build/commonjs/Radio/Radio.js +11 -4
- package/build/commonjs/Radio/Radio.js.map +1 -1
- package/build/commonjs/Radio/RadioProps.js.map +1 -1
- package/build/commonjs/Slide/Slide.js +41 -27
- package/build/commonjs/Slide/Slide.js.map +1 -1
- package/build/commonjs/Slide/SlideProps.js.map +1 -1
- package/build/commonjs/Snackbar/Snackbar.js +34 -7
- package/build/commonjs/Snackbar/Snackbar.js.map +1 -1
- package/build/commonjs/Snackbar/SnackbarProps.js.map +1 -1
- package/build/commonjs/SnackbarContent/SnackbarContent.js +32 -14
- package/build/commonjs/SnackbarContent/SnackbarContent.js.map +1 -1
- package/build/commonjs/SnackbarContent/SnackbarContentProps.js.map +1 -1
- package/build/commonjs/SvgIcon/SvgIcon.js +1 -1
- package/build/commonjs/SvgIcon/SvgIcon.js.map +1 -1
- package/build/commonjs/Tab/Tab.js +66 -20
- package/build/commonjs/Tab/Tab.js.map +1 -1
- package/build/commonjs/Tab/TabIndicator.js +11 -7
- package/build/commonjs/Tab/TabIndicator.js.map +1 -1
- package/build/commonjs/Tab/TabProps.js.map +1 -1
- package/build/commonjs/Tab/index.js.map +1 -1
- package/build/commonjs/Tabs/IndexAwareTab.js +35 -0
- package/build/commonjs/Tabs/IndexAwareTab.js.map +1 -0
- package/build/commonjs/Tabs/InternalContext.js +17 -0
- package/build/commonjs/Tabs/InternalContext.js.map +1 -0
- package/build/commonjs/Tabs/ScrollableTabsView.js +35 -0
- package/build/commonjs/Tabs/ScrollableTabsView.js.map +1 -0
- package/build/commonjs/Tabs/TabIndicator.js +73 -28
- package/build/commonjs/Tabs/TabIndicator.js.map +1 -1
- package/build/commonjs/Tabs/TabIndicatorProps.js.map +1 -1
- package/build/commonjs/Tabs/Tabs.js +119 -83
- package/build/commonjs/Tabs/Tabs.js.map +1 -1
- package/build/commonjs/Tabs/TabsProps.js.map +1 -1
- package/build/commonjs/Tabs/index.js.map +1 -1
- package/build/commonjs/Tabs/types.js +2 -0
- package/build/commonjs/Tabs/types.js.map +1 -0
- package/build/commonjs/Tabs/useIndexStore.js +35 -0
- package/build/commonjs/Tabs/useIndexStore.js.map +1 -0
- package/build/commonjs/Tabs/useScrollViewReaction.js +69 -0
- package/build/commonjs/Tabs/useScrollViewReaction.js.map +1 -0
- package/build/commonjs/Tabs/useTabCoordinates.js +30 -0
- package/build/commonjs/Tabs/useTabCoordinates.js.map +1 -0
- package/build/commonjs/Tabs/useTabInnerContentsWidth.js +30 -0
- package/build/commonjs/Tabs/useTabInnerContentsWidth.js.map +1 -0
- package/build/commonjs/Tabs/utils.js +19 -0
- package/build/commonjs/Tabs/utils.js.map +1 -0
- package/build/commonjs/TextField/InputLabel.js +6 -3
- package/build/commonjs/TextField/InputLabel.js.map +1 -1
- package/build/commonjs/TextField/OutlinedTextField.js +6 -2
- package/build/commonjs/TextField/OutlinedTextField.js.map +1 -1
- package/build/commonjs/TextField/TextField.js +15 -8
- package/build/commonjs/TextField/TextField.js.map +1 -1
- package/build/commonjs/TextField/TextFieldProps.js.map +1 -1
- package/build/commonjs/Tooltip/Tooltip.js +50 -31
- package/build/commonjs/Tooltip/Tooltip.js.map +1 -1
- package/build/commonjs/Tooltip/TooltipProps.js.map +1 -1
- package/build/commonjs/Typography/Typography.js +14 -5
- package/build/commonjs/Typography/Typography.js.map +1 -1
- package/build/commonjs/Typography/TypographyProps.js.map +1 -1
- package/build/commonjs/animated/AnimatedPressable.js +2 -3
- package/build/commonjs/animated/AnimatedPressable.js.map +1 -1
- package/build/commonjs/hooks/index.js +32 -0
- package/build/commonjs/hooks/index.js.map +1 -1
- package/build/commonjs/hooks/useAnimatedValue.js +31 -0
- package/build/commonjs/hooks/useAnimatedValue.js.map +1 -0
- package/build/commonjs/hooks/useCollapsibleAppBar.js +41 -54
- package/build/commonjs/hooks/useCollapsibleAppBar.js.map +1 -1
- package/build/commonjs/hooks/useDebounce.js +33 -0
- package/build/commonjs/hooks/useDebounce.js.map +1 -0
- package/build/commonjs/hooks/useFadeInAppBar.js +21 -23
- package/build/commonjs/hooks/useFadeInAppBar.js.map +1 -1
- package/build/commonjs/hooks/useImperativeState.js +26 -0
- package/build/commonjs/hooks/useImperativeState.js.map +1 -0
- package/build/commonjs/hooks/useSyncAnimatedValue.js +40 -0
- package/build/commonjs/hooks/useSyncAnimatedValue.js.map +1 -0
- package/build/commonjs/hooks/useThrottle.js +3 -7
- package/build/commonjs/hooks/useThrottle.js.map +1 -1
- package/build/commonjs/hooks/useValidWindowDimensions/index.ios.js +14 -7
- package/build/commonjs/hooks/useValidWindowDimensions/index.ios.js.map +1 -1
- package/build/commonjs/index.js +35 -0
- package/build/commonjs/index.js.map +1 -1
- package/build/commonjs/internal/hooks/index.js +0 -8
- package/build/commonjs/internal/hooks/index.js.map +1 -1
- package/build/commonjs/internal/hooks/useHeight.js +3 -9
- package/build/commonjs/internal/hooks/useHeight.js.map +1 -1
- package/build/commonjs/internal/icons/Checkbox.js +1 -1
- package/build/commonjs/internal/icons/Checkbox.js.map +1 -1
- package/build/commonjs/internal/icons/CheckboxChecked.js +1 -1
- package/build/commonjs/internal/icons/CheckboxChecked.js.map +1 -1
- package/build/commonjs/internal/icons/ChevronDown.js +1 -1
- package/build/commonjs/internal/icons/ChevronDown.js.map +1 -1
- package/build/commonjs/internal/icons/ChevronLeft.js +1 -1
- package/build/commonjs/internal/icons/ChevronLeft.js.map +1 -1
- package/build/commonjs/internal/icons/ChevronRight.js +1 -1
- package/build/commonjs/internal/icons/ChevronRight.js.map +1 -1
- package/build/commonjs/internal/icons/Close.js +1 -1
- package/build/commonjs/internal/icons/Close.js.map +1 -1
- package/build/commonjs/internal/icons/Radio.js +1 -1
- package/build/commonjs/internal/icons/Radio.js.map +1 -1
- package/build/commonjs/internal/icons/RadioChecked.js +1 -1
- package/build/commonjs/internal/icons/RadioChecked.js.map +1 -1
- package/build/commonjs/store/MockStore.js +27 -0
- package/build/commonjs/store/MockStore.js.map +1 -0
- package/build/commonjs/store/SimpleStore.js +59 -0
- package/build/commonjs/store/SimpleStore.js.map +1 -0
- package/build/commonjs/store/index.js +24 -0
- package/build/commonjs/store/index.js.map +1 -0
- package/build/commonjs/store/types.js +2 -0
- package/build/commonjs/store/types.js.map +1 -0
- package/build/commonjs/types/index.js.map +1 -1
- package/build/commonjs/utils/index.js +8 -0
- package/build/commonjs/utils/index.js.map +1 -1
- package/build/commonjs/utils/isNotAndroid12.js +20 -0
- package/build/commonjs/utils/isNotAndroid12.js.map +1 -0
- package/build/module/Accordion/Accordion.js +111 -29
- package/build/module/Accordion/Accordion.js.map +1 -1
- package/build/module/Accordion/AccordionProps.js.map +1 -1
- package/build/module/Badge/Badge.js +5 -14
- package/build/module/Badge/Badge.js.map +1 -1
- package/build/module/Badge/BadgeProps.js.map +1 -1
- package/build/module/Button/Button.js +6 -3
- package/build/module/Button/Button.js.map +1 -1
- package/build/module/ButtonBase/ButtonBase.js +64 -49
- package/build/module/ButtonBase/ButtonBase.js.map +1 -1
- package/build/module/ButtonBase/ButtonBaseProps.js.map +1 -1
- package/build/module/Checkbox/CheckboxProps.js.map +1 -1
- package/build/module/Chip/Chip.js +11 -9
- package/build/module/Chip/Chip.js.map +1 -1
- package/build/module/Chip/ChipProps.js.map +1 -1
- package/build/module/CircularProgress/CircularProgress.js +25 -23
- package/build/module/CircularProgress/CircularProgress.js.map +1 -1
- package/build/module/Dialog/Dialog.js +109 -8
- package/build/module/Dialog/Dialog.js.map +1 -1
- package/build/module/Dialog/DialogProps.js.map +1 -1
- package/build/module/Divider/Divider.js +26 -18
- package/build/module/Divider/Divider.js.map +1 -1
- package/build/module/Divider/DividerProps.js.map +1 -1
- package/build/module/Image/Image.js +54 -12
- package/build/module/Image/Image.js.map +1 -1
- package/build/module/Image/ImageProps.js.map +1 -1
- package/build/module/Image/index.js.map +1 -1
- package/build/module/ImageCore/ImageCoreNative.js +31 -25
- package/build/module/ImageCore/ImageCoreNative.js.map +1 -1
- package/build/module/ImageCore/ImageCoreProps.js.map +1 -1
- package/build/module/ImageCore/ImageCoreWeb.js +19 -1
- package/build/module/ImageCore/ImageCoreWeb.js.map +1 -1
- package/build/module/ImageCore/ImageFileExtensionContext.js +5 -0
- package/build/module/ImageCore/ImageFileExtensionContext.js.map +1 -0
- package/build/module/ImageCore/ImageFileExtensionProvider.js +24 -0
- package/build/module/ImageCore/ImageFileExtensionProvider.js.map +1 -0
- package/build/module/ImageCore/index.js +2 -1
- package/build/module/ImageCore/index.js.map +1 -1
- package/build/module/ImageCore/index.native.js +2 -0
- package/build/module/ImageCore/index.native.js.map +1 -1
- package/build/module/Modal/AnimatedContainer/index.js +144 -0
- package/build/module/Modal/AnimatedContainer/index.js.map +1 -0
- package/build/module/Modal/Modal.js +43 -9
- package/build/module/Modal/Modal.js.map +1 -1
- package/build/module/Modal/ModalProps.js +5 -0
- package/build/module/Modal/ModalProps.js.map +1 -1
- package/build/module/Modal/index.js +2 -0
- package/build/module/Modal/index.js.map +1 -1
- package/build/module/Paper/Paper.js +1 -1
- package/build/module/Paper/Paper.js.map +1 -1
- package/build/module/Radio/Radio.js +9 -5
- package/build/module/Radio/Radio.js.map +1 -1
- package/build/module/Radio/RadioProps.js.map +1 -1
- package/build/module/Slide/Slide.js +39 -23
- package/build/module/Slide/Slide.js.map +1 -1
- package/build/module/Slide/SlideProps.js.map +1 -1
- package/build/module/Snackbar/Snackbar.js +25 -5
- package/build/module/Snackbar/Snackbar.js.map +1 -1
- package/build/module/Snackbar/SnackbarProps.js.map +1 -1
- package/build/module/SnackbarContent/SnackbarContent.js +21 -6
- package/build/module/SnackbarContent/SnackbarContent.js.map +1 -1
- package/build/module/SnackbarContent/SnackbarContentProps.js.map +1 -1
- package/build/module/SvgIcon/SvgIcon.js +1 -1
- package/build/module/SvgIcon/SvgIcon.js.map +1 -1
- package/build/module/Tab/Tab.js +63 -21
- package/build/module/Tab/Tab.js.map +1 -1
- package/build/module/Tab/TabIndicator.js +11 -7
- package/build/module/Tab/TabIndicator.js.map +1 -1
- package/build/module/Tab/TabProps.js.map +1 -1
- package/build/module/Tab/index.js.map +1 -1
- package/build/module/Tabs/IndexAwareTab.js +23 -0
- package/build/module/Tabs/IndexAwareTab.js.map +1 -0
- package/build/module/Tabs/InternalContext.js +7 -0
- package/build/module/Tabs/InternalContext.js.map +1 -0
- package/build/module/Tabs/ScrollableTabsView.js +22 -0
- package/build/module/Tabs/ScrollableTabsView.js.map +1 -0
- package/build/module/Tabs/TabIndicator.js +66 -25
- package/build/module/Tabs/TabIndicator.js.map +1 -1
- package/build/module/Tabs/TabIndicatorProps.js.map +1 -1
- package/build/module/Tabs/Tabs.js +109 -72
- package/build/module/Tabs/Tabs.js.map +1 -1
- package/build/module/Tabs/TabsProps.js.map +1 -1
- package/build/module/Tabs/index.js.map +1 -1
- package/build/module/Tabs/types.js +2 -0
- package/build/module/Tabs/types.js.map +1 -0
- package/build/module/Tabs/useIndexStore.js +25 -0
- package/build/module/Tabs/useIndexStore.js.map +1 -0
- package/build/module/Tabs/useScrollViewReaction.js +57 -0
- package/build/module/Tabs/useScrollViewReaction.js.map +1 -0
- package/build/module/Tabs/useTabCoordinates.js +21 -0
- package/build/module/Tabs/useTabCoordinates.js.map +1 -0
- package/build/module/Tabs/useTabInnerContentsWidth.js +21 -0
- package/build/module/Tabs/useTabInnerContentsWidth.js.map +1 -0
- package/build/module/Tabs/utils.js +9 -0
- package/build/module/Tabs/utils.js.map +1 -0
- package/build/module/TextField/InputLabel.js +7 -4
- package/build/module/TextField/InputLabel.js.map +1 -1
- package/build/module/TextField/OutlinedTextField.js +7 -3
- package/build/module/TextField/OutlinedTextField.js.map +1 -1
- package/build/module/TextField/TextField.js +13 -5
- package/build/module/TextField/TextField.js.map +1 -1
- package/build/module/TextField/TextFieldProps.js.map +1 -1
- package/build/module/Tooltip/Tooltip.js +48 -25
- package/build/module/Tooltip/Tooltip.js.map +1 -1
- package/build/module/Tooltip/TooltipProps.js.map +1 -1
- package/build/module/Typography/Typography.js +14 -5
- package/build/module/Typography/Typography.js.map +1 -1
- package/build/module/Typography/TypographyProps.js.map +1 -1
- package/build/module/animated/AnimatedPressable.js +2 -3
- package/build/module/animated/AnimatedPressable.js.map +1 -1
- package/build/module/hooks/index.js +4 -0
- package/build/module/hooks/index.js.map +1 -1
- package/build/module/hooks/useAnimatedValue.js +22 -0
- package/build/module/hooks/useAnimatedValue.js.map +1 -0
- package/build/module/hooks/useCollapsibleAppBar.js +42 -52
- package/build/module/hooks/useCollapsibleAppBar.js.map +1 -1
- package/build/module/hooks/useDebounce.js +25 -0
- package/build/module/hooks/useDebounce.js.map +1 -0
- package/build/module/hooks/useFadeInAppBar.js +23 -20
- package/build/module/hooks/useFadeInAppBar.js.map +1 -1
- package/build/module/hooks/useImperativeState.js +17 -0
- package/build/module/hooks/useImperativeState.js.map +1 -0
- package/build/module/hooks/useSyncAnimatedValue.js +28 -0
- package/build/module/hooks/useSyncAnimatedValue.js.map +1 -0
- package/build/module/hooks/useThrottle.js +3 -3
- package/build/module/hooks/useThrottle.js.map +1 -1
- package/build/module/hooks/useValidWindowDimensions/index.ios.js +15 -9
- package/build/module/hooks/useValidWindowDimensions/index.ios.js.map +1 -1
- package/build/module/index.js +3 -1
- package/build/module/index.js.map +1 -1
- package/build/module/internal/hooks/index.js +0 -1
- package/build/module/internal/hooks/index.js.map +1 -1
- package/build/module/internal/hooks/useHeight.js +3 -4
- package/build/module/internal/hooks/useHeight.js.map +1 -1
- package/build/module/internal/icons/Checkbox.js +1 -1
- package/build/module/internal/icons/Checkbox.js.map +1 -1
- package/build/module/internal/icons/CheckboxChecked.js +1 -1
- package/build/module/internal/icons/CheckboxChecked.js.map +1 -1
- package/build/module/internal/icons/ChevronDown.js +1 -1
- package/build/module/internal/icons/ChevronDown.js.map +1 -1
- package/build/module/internal/icons/ChevronLeft.js +1 -1
- package/build/module/internal/icons/ChevronLeft.js.map +1 -1
- package/build/module/internal/icons/ChevronRight.js +1 -1
- package/build/module/internal/icons/ChevronRight.js.map +1 -1
- package/build/module/internal/icons/Close.js +1 -1
- package/build/module/internal/icons/Close.js.map +1 -1
- package/build/module/internal/icons/Radio.js +1 -1
- package/build/module/internal/icons/Radio.js.map +1 -1
- package/build/module/internal/icons/RadioChecked.js +1 -1
- package/build/module/internal/icons/RadioChecked.js.map +1 -1
- package/build/module/store/MockStore.js +18 -0
- package/build/module/store/MockStore.js.map +1 -0
- package/build/module/store/SimpleStore.js +50 -0
- package/build/module/store/SimpleStore.js.map +1 -0
- package/build/module/store/index.js +3 -0
- package/build/module/store/index.js.map +1 -0
- package/build/module/store/types.js +2 -0
- package/build/module/store/types.js.map +1 -0
- package/build/module/types/index.js.map +1 -1
- package/build/module/utils/index.js +1 -0
- package/build/module/utils/index.js.map +1 -1
- package/build/module/utils/isNotAndroid12.js +6 -0
- package/build/module/utils/isNotAndroid12.js.map +1 -0
- package/build/typescript/Accordion/Accordion.d.ts +1 -0
- package/build/typescript/Accordion/AccordionProps.d.ts +14 -11
- package/build/typescript/AspectRatio/AspectRatioNative.d.ts +1 -0
- package/build/typescript/AspectRatio/AspectRatioWeb.d.ts +1 -0
- package/build/typescript/Avatar/Avatar.d.ts +1 -0
- package/build/typescript/Badge/Badge.d.ts +1 -0
- package/build/typescript/Badge/BadgeProps.d.ts +5 -0
- package/build/typescript/Button/Button.d.ts +1 -0
- package/build/typescript/ButtonBase/ButtonBase.d.ts +1 -0
- package/build/typescript/ButtonBase/ButtonBaseProps.d.ts +8 -0
- package/build/typescript/Card/Card.d.ts +1 -0
- package/build/typescript/CardActions/CardActions.d.ts +1 -0
- package/build/typescript/CardContent/CardContent.d.ts +1 -0
- package/build/typescript/CardMedia/CardMedia.d.ts +1 -0
- package/build/typescript/Checkbox/Checkbox.d.ts +1 -0
- package/build/typescript/Checkbox/CheckboxProps.d.ts +1 -1
- package/build/typescript/Chip/Chip.d.ts +1 -0
- package/build/typescript/Chip/ChipProps.d.ts +4 -0
- package/build/typescript/CircularProgress/CircularProgress.d.ts +3 -2
- package/build/typescript/Column/Column.d.ts +1 -0
- package/build/typescript/Dialog/Dialog.d.ts +1 -0
- package/build/typescript/Dialog/DialogProps.d.ts +10 -0
- package/build/typescript/DialogActions/DialogActions.d.ts +1 -0
- package/build/typescript/DialogContent/DialogContent.d.ts +1 -0
- package/build/typescript/DialogMedia/DialogMedia.d.ts +1 -0
- package/build/typescript/DialogTitle/DialogTitle.d.ts +1 -0
- package/build/typescript/Divider/Divider.d.ts +1 -0
- package/build/typescript/Divider/DividerProps.d.ts +22 -1
- package/build/typescript/Fab/Fab.d.ts +1 -0
- package/build/typescript/Flexbox/Flexbox.d.ts +1 -0
- package/build/typescript/IconButton/IconButton.d.ts +1 -0
- package/build/typescript/Image/Image.d.ts +1 -0
- package/build/typescript/Image/ImageProps.d.ts +30 -2
- package/build/typescript/Image/index.d.ts +1 -1
- package/build/typescript/ImageCore/ImageCoreNative.d.ts +1 -0
- package/build/typescript/ImageCore/ImageCoreProps.d.ts +5 -1
- package/build/typescript/ImageCore/ImageCoreWeb.d.ts +1 -0
- package/build/typescript/ImageCore/ImageFileExtensionContext.d.ts +3 -0
- package/build/typescript/ImageCore/ImageFileExtensionProvider.d.ts +13 -0
- package/build/typescript/ImageCore/index.d.ts +3 -1
- package/build/typescript/ImageCore/index.native.d.ts +2 -0
- package/build/typescript/Link/Link.d.ts +1 -0
- package/build/typescript/List/List.d.ts +1 -0
- package/build/typescript/ListItem/ListItem.d.ts +1 -0
- package/build/typescript/ListItemIcon/ListItemIcon.d.ts +1 -0
- package/build/typescript/ListItemSecondaryAction/ListItemSecondaryAction.d.ts +1 -0
- package/build/typescript/ListItemText/ListItemText.d.ts +1 -0
- package/build/typescript/ListSubheader/ListSubheader.d.ts +1 -0
- package/build/typescript/Menu/Menu.d.ts +1 -0
- package/build/typescript/MenuItem/MenuItem.d.ts +1 -0
- package/build/typescript/Modal/AnimatedContainer/index.d.ts +5 -0
- package/build/typescript/Modal/Modal.d.ts +1 -0
- package/build/typescript/Modal/ModalProps.d.ts +47 -0
- package/build/typescript/Modal/index.d.ts +4 -1
- package/build/typescript/Pagination/Pagination.d.ts +1 -0
- package/build/typescript/Portal/Portal.d.ts +1 -0
- package/build/typescript/Radio/Radio.d.ts +1 -0
- package/build/typescript/Radio/RadioProps.d.ts +13 -0
- package/build/typescript/RadioGroup/RadioGroup.d.ts +1 -0
- package/build/typescript/Row/Row.d.ts +1 -0
- package/build/typescript/Slide/Slide.d.ts +1 -0
- package/build/typescript/Slide/SlideProps.d.ts +2 -3
- package/build/typescript/Slider/Slider.d.ts +1 -1
- package/build/typescript/Snackbar/Snackbar.d.ts +1 -0
- package/build/typescript/Snackbar/SnackbarProps.d.ts +10 -3
- package/build/typescript/SnackbarContent/SnackbarContent.d.ts +1 -0
- package/build/typescript/SnackbarContent/SnackbarContentProps.d.ts +9 -0
- package/build/typescript/Spacer/Spacer.d.ts +1 -0
- package/build/typescript/SvgIcon/SvgIcon.d.ts +1 -0
- package/build/typescript/Switch/Switch.d.ts +1 -0
- package/build/typescript/Tab/Tab.d.ts +1 -0
- package/build/typescript/Tab/TabIndicator.d.ts +5 -1
- package/build/typescript/Tab/TabProps.d.ts +21 -2
- package/build/typescript/Tab/index.d.ts +1 -1
- package/build/typescript/TabBase/TabBase.d.ts +1 -0
- package/build/typescript/Tabs/IndexAwareTab.d.ts +8 -0
- package/build/typescript/Tabs/InternalContext.d.ts +7 -0
- package/build/typescript/Tabs/ScrollableTabsView.d.ts +8 -0
- package/build/typescript/Tabs/TabIndicator.d.ts +1 -0
- package/build/typescript/Tabs/TabIndicatorProps.d.ts +10 -5
- package/build/typescript/Tabs/Tabs.d.ts +4 -1
- package/build/typescript/Tabs/TabsProps.d.ts +37 -13
- package/build/typescript/Tabs/index.d.ts +1 -0
- package/build/typescript/Tabs/types.d.ts +9 -0
- package/build/typescript/Tabs/useIndexStore.d.ts +3 -0
- package/build/typescript/Tabs/useScrollViewReaction.d.ts +8 -0
- package/build/typescript/Tabs/useTabCoordinates.d.ts +6 -0
- package/build/typescript/Tabs/useTabInnerContentsWidth.d.ts +6 -0
- package/build/typescript/Tabs/utils.d.ts +3 -0
- package/build/typescript/TextField/InputLabel.d.ts +1 -0
- package/build/typescript/TextField/TextFieldProps.d.ts +3 -0
- package/build/typescript/Toolbar/Toolbar.d.ts +1 -0
- package/build/typescript/Tooltip/Tooltip.d.ts +1 -0
- package/build/typescript/Tooltip/TooltipProps.d.ts +26 -1
- package/build/typescript/Typography/TypographyProps.d.ts +22 -1
- package/build/typescript/animated/AnimatedPressable.d.ts +2 -2
- package/build/typescript/hooks/index.d.ts +5 -0
- package/build/typescript/hooks/useAnimatedValue.d.ts +2 -0
- package/build/typescript/hooks/useCollapsibleAppBar.d.ts +2 -0
- package/build/typescript/hooks/useDebounce.d.ts +1 -0
- package/build/typescript/hooks/useFadeInAppBar.d.ts +1 -0
- package/build/typescript/hooks/useImperativeState.d.ts +6 -0
- package/build/typescript/hooks/useSyncAnimatedValue.d.ts +6 -0
- package/build/typescript/hooks/useValidWindowDimensions/index.ios.d.ts +2 -1
- package/build/typescript/index.d.ts +4 -2
- package/build/typescript/internal/hooks/index.d.ts +0 -1
- package/build/typescript/internal/icons/Checkbox.d.ts +9 -7
- package/build/typescript/internal/icons/CheckboxChecked.d.ts +9 -7
- package/build/typescript/internal/icons/ChevronDown.d.ts +9 -7
- package/build/typescript/internal/icons/ChevronLeft.d.ts +9 -7
- package/build/typescript/internal/icons/ChevronRight.d.ts +9 -7
- package/build/typescript/internal/icons/CircularProgress.d.ts +1 -0
- package/build/typescript/internal/icons/Close.d.ts +9 -7
- package/build/typescript/internal/icons/Radio.d.ts +9 -7
- package/build/typescript/internal/icons/RadioChecked.d.ts +9 -7
- package/build/typescript/store/MockStore.d.ts +7 -0
- package/build/typescript/store/SimpleStore.d.ts +10 -0
- package/build/typescript/store/index.d.ts +3 -0
- package/build/typescript/store/types.d.ts +10 -0
- package/build/typescript/types/index.d.ts +6 -0
- package/build/typescript/utils/index.d.ts +1 -0
- package/build/typescript/utils/isNotAndroid12.d.ts +2 -0
- package/package.json +9 -9
- package/src/Accordion/Accordion.tsx +147 -51
- package/src/Accordion/AccordionProps.ts +15 -11
- package/src/Badge/Badge.tsx +6 -16
- package/src/Badge/BadgeProps.ts +6 -0
- package/src/Button/Button.tsx +8 -2
- package/src/ButtonBase/ButtonBase.tsx +79 -44
- package/src/ButtonBase/ButtonBaseProps.ts +10 -0
- package/src/Checkbox/CheckboxProps.ts +1 -1
- package/src/Chip/Chip.tsx +13 -9
- package/src/Chip/ChipProps.ts +5 -0
- package/src/CircularProgress/CircularProgress.tsx +41 -33
- package/src/Dialog/Dialog.tsx +136 -14
- package/src/Dialog/DialogProps.ts +12 -0
- package/src/Divider/Divider.tsx +23 -14
- package/src/Divider/DividerProps.ts +27 -1
- package/src/Image/Image.tsx +78 -16
- package/src/Image/ImageProps.ts +36 -2
- package/src/Image/index.ts +1 -1
- package/src/ImageCore/ImageCoreNative.tsx +29 -19
- package/src/ImageCore/ImageCoreProps.ts +6 -1
- package/src/ImageCore/ImageCoreWeb.tsx +22 -2
- package/src/ImageCore/ImageFileExtensionContext.ts +7 -0
- package/src/ImageCore/ImageFileExtensionProvider.tsx +33 -0
- package/src/ImageCore/index.native.ts +3 -1
- package/src/ImageCore/index.ts +4 -1
- package/src/Modal/AnimatedContainer/index.tsx +172 -0
- package/src/Modal/Modal.tsx +44 -12
- package/src/Modal/ModalProps.ts +59 -1
- package/src/Modal/index.ts +4 -1
- package/src/Paper/Paper.tsx +1 -1
- package/src/Radio/Radio.tsx +10 -7
- package/src/Radio/RadioProps.ts +16 -0
- package/src/Slide/Slide.tsx +33 -27
- package/src/Slide/SlideProps.ts +2 -3
- package/src/Snackbar/Snackbar.tsx +33 -7
- package/src/Snackbar/SnackbarProps.ts +19 -9
- package/src/SnackbarContent/SnackbarContent.tsx +42 -10
- package/src/SnackbarContent/SnackbarContentProps.ts +14 -3
- package/src/SvgIcon/SvgIcon.tsx +1 -1
- package/src/Tab/Tab.tsx +85 -28
- package/src/Tab/TabIndicator.tsx +17 -15
- package/src/Tab/TabProps.ts +24 -2
- package/src/Tab/index.ts +1 -1
- package/src/Tabs/IndexAwareTab.tsx +29 -0
- package/src/Tabs/InternalContext.ts +13 -0
- package/src/Tabs/ScrollableTabsView.tsx +28 -0
- package/src/Tabs/TabIndicator.tsx +74 -37
- package/src/Tabs/TabIndicatorProps.ts +12 -5
- package/src/Tabs/Tabs.tsx +139 -93
- package/src/Tabs/TabsProps.ts +43 -23
- package/src/Tabs/index.ts +2 -1
- package/src/Tabs/types.ts +18 -0
- package/src/Tabs/useIndexStore.ts +31 -0
- package/src/Tabs/useScrollViewReaction.ts +62 -0
- package/src/Tabs/useTabCoordinates.ts +25 -0
- package/src/Tabs/useTabInnerContentsWidth.ts +26 -0
- package/src/Tabs/utils.ts +14 -0
- package/src/TextField/InputLabel.tsx +6 -1
- package/src/TextField/OutlinedTextField.tsx +8 -2
- package/src/TextField/TextField.tsx +10 -4
- package/src/TextField/TextFieldProps.ts +4 -0
- package/src/Tooltip/Tooltip.tsx +57 -26
- package/src/Tooltip/TooltipProps.ts +26 -1
- package/src/Typography/Typography.tsx +12 -3
- package/src/Typography/TypographyProps.ts +30 -1
- package/src/animated/AnimatedPressable.tsx +1 -2
- package/src/hooks/index.ts +6 -0
- package/src/hooks/useAnimatedValue.ts +21 -0
- package/src/hooks/useCollapsibleAppBar.ts +64 -47
- package/src/hooks/useDebounce.ts +23 -0
- package/src/hooks/useFadeInAppBar.ts +23 -17
- package/src/hooks/useImperativeState.ts +24 -0
- package/src/hooks/useSyncAnimatedValue.ts +38 -0
- package/src/hooks/useThrottle.ts +3 -3
- package/src/hooks/useValidWindowDimensions/index.ios.ts +16 -10
- package/src/index.ts +6 -2
- package/src/internal/hooks/index.ts +0 -1
- package/src/internal/hooks/useHeight.ts +4 -5
- package/src/internal/icons/Checkbox.tsx +1 -1
- package/src/internal/icons/CheckboxChecked.tsx +1 -1
- package/src/internal/icons/ChevronDown.tsx +1 -1
- package/src/internal/icons/ChevronLeft.tsx +1 -1
- package/src/internal/icons/ChevronRight.tsx +1 -1
- package/src/internal/icons/Close.tsx +1 -1
- package/src/internal/icons/Radio.tsx +1 -1
- package/src/internal/icons/RadioChecked.tsx +1 -1
- package/src/store/MockStore.ts +21 -0
- package/src/store/SimpleStore.ts +50 -0
- package/src/store/index.ts +3 -0
- package/src/store/types.ts +12 -0
- package/src/types/index.ts +7 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/isNotAndroid12.ts +7 -0
- package/build/commonjs/ButtonBase/ButtonBase.ios.js +0 -101
- package/build/commonjs/ButtonBase/ButtonBase.ios.js.map +0 -1
- package/build/commonjs/ButtonBase/useDisabledReaction/index.js +0 -21
- package/build/commonjs/ButtonBase/useDisabledReaction/index.js.map +0 -1
- package/build/commonjs/ButtonBase/useDisabledReaction/index.native.js +0 -9
- package/build/commonjs/ButtonBase/useDisabledReaction/index.native.js.map +0 -1
- package/build/commonjs/ImageCore/ImageCoreNative.ios.js +0 -60
- package/build/commonjs/ImageCore/ImageCoreNative.ios.js.map +0 -1
- package/build/commonjs/internal/hooks/useWidth.js +0 -29
- package/build/commonjs/internal/hooks/useWidth.js.map +0 -1
- package/build/module/ButtonBase/ButtonBase.ios.js +0 -82
- package/build/module/ButtonBase/ButtonBase.ios.js.map +0 -1
- package/build/module/ButtonBase/useDisabledReaction/index.js +0 -12
- package/build/module/ButtonBase/useDisabledReaction/index.js.map +0 -1
- package/build/module/ButtonBase/useDisabledReaction/index.native.js +0 -2
- package/build/module/ButtonBase/useDisabledReaction/index.native.js.map +0 -1
- package/build/module/ImageCore/ImageCoreNative.ios.js +0 -45
- package/build/module/ImageCore/ImageCoreNative.ios.js.map +0 -1
- package/build/module/internal/hooks/useWidth.js +0 -15
- package/build/module/internal/hooks/useWidth.js.map +0 -1
- package/build/typescript/ButtonBase/ButtonBase.ios.d.ts +0 -2
- package/build/typescript/ButtonBase/useDisabledReaction/index.d.ts +0 -2
- package/build/typescript/ButtonBase/useDisabledReaction/index.native.d.ts +0 -2
- package/build/typescript/ImageCore/ImageCoreNative.ios.d.ts +0 -2
- package/build/typescript/internal/hooks/useWidth.d.ts +0 -2
- package/src/ButtonBase/ButtonBase.ios.tsx +0 -95
- package/src/ButtonBase/useDisabledReaction/index.native.ts +0 -4
- package/src/ButtonBase/useDisabledReaction/index.ts +0 -16
- package/src/ImageCore/ImageCoreNative.ios.tsx +0 -46
- package/src/internal/hooks/useWidth.ts +0 -17
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,38 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [2.0.0-beta.28](https://github.com/tappytoon/tappytoon/compare/@fountain-ui/core@1.11.0...@fountain-ui/core@2.0.0-beta.28) (2022-11-15)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* 3.23.0 issues ([#4681](https://github.com/tappytoon/tappytoon/issues/4681)) ([9337d88](https://github.com/tappytoon/tappytoon/commit/9337d88280066ba353297520c1abd6910159f8f9))
|
|
12
|
+
* Fix qa issues 2 ([#4629](https://github.com/tappytoon/tappytoon/issues/4629)) ([d1a2c4e](https://github.com/tappytoon/tappytoon/commit/d1a2c4e28353b950ac4abc7d4440f4f053fbe10a))
|
|
13
|
+
* front dev qa part 1 ([#4333](https://github.com/tappytoon/tappytoon/issues/4333)) ([98fb40c](https://github.com/tappytoon/tappytoon/commit/98fb40c8b9df489d2f6a5fa70e4d8eae6058fe42))
|
|
14
|
+
* fui carousel smooth scroll on fast swipe ([#4580](https://github.com/tappytoon/tappytoon/issues/4580)) ([ecddc30](https://github.com/tappytoon/tappytoon/commit/ecddc30bea41c43073f304f7acc0fcc6b4451810))
|
|
15
|
+
* fui several problems ([#4567](https://github.com/tappytoon/tappytoon/issues/4567)) ([6f8f30d](https://github.com/tappytoon/tappytoon/commit/6f8f30d43f906c93a356c3d640d85af1280a48ac))
|
|
16
|
+
* prevent infinite loop ([#4578](https://github.com/tappytoon/tappytoon/issues/4578)) ([826c164](https://github.com/tappytoon/tappytoon/commit/826c164ec0eca4a6abde0a9efa8ac418ee66e343))
|
|
17
|
+
* Qa web issues ([#4799](https://github.com/tappytoon/tappytoon/issues/4799)) ([0243146](https://github.com/tappytoon/tappytoon/commit/02431466df5043744ce0125023a491112e7af264))
|
|
18
|
+
* several problems ([#4611](https://github.com/tappytoon/tappytoon/issues/4611)) ([293c855](https://github.com/tappytoon/tappytoon/commit/293c85526da34409a1c5c988434c0841e35bedcd))
|
|
19
|
+
* several problems ([#4645](https://github.com/tappytoon/tappytoon/issues/4645)) ([e018bb2](https://github.com/tappytoon/tappytoon/commit/e018bb20b3ce334827d12c11a16435b101974f61))
|
|
20
|
+
* Web qa 6 ([#4819](https://github.com/tappytoon/tappytoon/issues/4819)) ([b553310](https://github.com/tappytoon/tappytoon/commit/b5533106a3bf8ada5bae97b999b6e4f333393433))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Features
|
|
24
|
+
|
|
25
|
+
* Add Accept header fountain-ui ImageCore ([#5012](https://github.com/tappytoon/tappytoon/issues/5012)) ([6801b51](https://github.com/tappytoon/tappytoon/commit/6801b513b7be30ef4330ac382ec58b7ad9f5ba5b))
|
|
26
|
+
* Add Chip component numberOfLines ([#4607](https://github.com/tappytoon/tappytoon/issues/4607)) ([3414b91](https://github.com/tappytoon/tappytoon/commit/3414b91f580a5242fd6a035d1faed06a1c827645))
|
|
27
|
+
* dark theme ([#4309](https://github.com/tappytoon/tappytoon/issues/4309)) ([bec43d0](https://github.com/tappytoon/tappytoon/commit/bec43d09e599e3ae0991d124602795260ff152d6))
|
|
28
|
+
* dark theme part 2 ([#4318](https://github.com/tappytoon/tappytoon/issues/4318)) ([00f5377](https://github.com/tappytoon/tappytoon/commit/00f53774f5220d63f446d3287eb397e54a790c87))
|
|
29
|
+
* dark theme part 3 ([#4328](https://github.com/tappytoon/tappytoon/issues/4328)) ([f91d9e1](https://github.com/tappytoon/tappytoon/commit/f91d9e1e10070cc92e95258b1344d42ca3f4fbd8))
|
|
30
|
+
* Fix dark theme qa part 2 ([#4394](https://github.com/tappytoon/tappytoon/issues/4394)) ([a5c7b75](https://github.com/tappytoon/tappytoon/commit/a5c7b7514ba7e7b58268d48d99945b397f981003))
|
|
31
|
+
* Fix several problems ([#4562](https://github.com/tappytoon/tappytoon/issues/4562)) ([bf6542d](https://github.com/tappytoon/tappytoon/commit/bf6542d9c72d0bc319dc1f1a6545c393fcda4cbb))
|
|
32
|
+
* Fui next ([#4520](https://github.com/tappytoon/tappytoon/issues/4520)) ([8c8c9ed](https://github.com/tappytoon/tappytoon/commit/8c8c9ed35e8d21113ccbe9b690fea6c48656bde9))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
6
38
|
## [1.19.1](https://github.com/tappytoon/tappytoon/compare/@fountain-ui/core@1.11.0...@fountain-ui/core@1.19.1) (2022-05-19)
|
|
7
39
|
|
|
8
40
|
**Note:** Version bump only for package @fountain-ui/core
|
|
@@ -7,82 +7,165 @@ exports.default = Accordion;
|
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
|
+
var _reactNative = require("react-native");
|
|
11
|
+
|
|
10
12
|
var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
|
|
11
13
|
|
|
14
|
+
var _styles = require("../styles");
|
|
15
|
+
|
|
12
16
|
var _icons = require("../internal/icons");
|
|
13
17
|
|
|
14
18
|
var _ButtonBase = _interopRequireDefault(require("../ButtonBase"));
|
|
15
19
|
|
|
16
20
|
var _Column = _interopRequireDefault(require("../Column"));
|
|
17
21
|
|
|
18
|
-
var
|
|
22
|
+
var _Row = _interopRequireDefault(require("../Row"));
|
|
19
23
|
|
|
20
24
|
var _Spacer = _interopRequireDefault(require("../Spacer"));
|
|
21
25
|
|
|
22
26
|
var _Typography = _interopRequireDefault(require("../Typography"));
|
|
23
27
|
|
|
24
|
-
var _styles = require("../styles");
|
|
25
|
-
|
|
26
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
29
|
|
|
28
30
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
31
|
|
|
30
32
|
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
33
|
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
+
const ROTATE_HIDE_DEGREE = 0;
|
|
35
|
+
const ROTATE_SHOW_DEGREE = 180;
|
|
36
|
+
const ANIMATION_CONFIG = {
|
|
37
|
+
duration: 200
|
|
34
38
|
};
|
|
39
|
+
const INITIAL_EXPANDED_DELAY_MILLIS = 100;
|
|
40
|
+
const CONTENT_OPACITY_DELAY_MILLIS = 200;
|
|
35
41
|
|
|
36
42
|
const useStyles = function () {
|
|
37
43
|
const theme = (0, _styles.useTheme)();
|
|
38
44
|
return {
|
|
39
45
|
root: {
|
|
40
|
-
|
|
41
|
-
|
|
46
|
+
marginBottom: theme.spacing(3)
|
|
47
|
+
},
|
|
48
|
+
title: {
|
|
49
|
+
borderRadius: theme.spacing(4),
|
|
50
|
+
backgroundColor: theme.palette.paper.grey,
|
|
51
|
+
paddingHorizontal: theme.spacing(4),
|
|
52
|
+
paddingVertical: theme.spacing(3.5),
|
|
53
|
+
alignItems: 'center',
|
|
54
|
+
height: 64
|
|
55
|
+
},
|
|
56
|
+
titleColumn: {
|
|
57
|
+
flexShrink: 1
|
|
58
|
+
},
|
|
59
|
+
subtitle: {
|
|
60
|
+
fontSize: 11,
|
|
61
|
+
lineHeight: 12,
|
|
62
|
+
fontFamily: 'Inter-Regular'
|
|
63
|
+
},
|
|
64
|
+
contentView: {
|
|
65
|
+
position: 'absolute',
|
|
66
|
+
width: '100%',
|
|
67
|
+
borderRadius: theme.spacing(4),
|
|
68
|
+
backgroundColor: theme.palette.paper.grey,
|
|
69
|
+
paddingHorizontal: theme.spacing(4),
|
|
70
|
+
paddingVertical: theme.spacing(6),
|
|
71
|
+
marginTop: theme.spacing(1)
|
|
42
72
|
}
|
|
43
73
|
};
|
|
44
74
|
};
|
|
45
75
|
|
|
46
76
|
function Accordion(props) {
|
|
47
77
|
const {
|
|
78
|
+
title,
|
|
79
|
+
subTitle,
|
|
48
80
|
content,
|
|
49
|
-
LeftIcon,
|
|
50
81
|
RightIcon,
|
|
51
|
-
|
|
52
|
-
|
|
82
|
+
LeftComponent,
|
|
83
|
+
isInitialExpanded = false
|
|
53
84
|
} = props;
|
|
54
85
|
const styles = useStyles();
|
|
86
|
+
const theme = (0, _styles.useTheme)();
|
|
87
|
+
const CONTENT_MARGIN_HEIGHT = theme.spacing(2);
|
|
55
88
|
const [isExpanded, setIsExpanded] = (0, _react.useState)(false);
|
|
56
|
-
const
|
|
89
|
+
const shouldInitialExpandedRef = (0, _react.useRef)(isInitialExpanded);
|
|
90
|
+
const rotate = (0, _reactNativeReanimated.useSharedValue)(ROTATE_HIDE_DEGREE);
|
|
91
|
+
const animatedOpacity = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
92
|
+
const animatedHeight = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
93
|
+
const [contentHeight, setContentHeight] = (0, _react.useState)(0);
|
|
57
94
|
const animatedChevronDownStyles = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
|
|
58
95
|
transform: [{
|
|
59
96
|
rotate: `${rotate.value}deg`
|
|
60
97
|
}]
|
|
61
|
-
}));
|
|
98
|
+
}), []);
|
|
99
|
+
const animatedContentBackgroundStyles = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
|
|
100
|
+
height: animatedHeight.value,
|
|
101
|
+
overflow: 'hidden'
|
|
102
|
+
}), []);
|
|
103
|
+
const animatedContentStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
|
|
104
|
+
opacity: animatedOpacity.value
|
|
105
|
+
}), []);
|
|
62
106
|
|
|
63
107
|
const onPress = () => {
|
|
64
108
|
setIsExpanded(prev => !prev);
|
|
65
|
-
rotate.value = (0, _reactNativeReanimated.withTiming)(!isExpanded ? 180 : 0, ANIMATION_OPTION);
|
|
66
109
|
};
|
|
67
110
|
|
|
68
|
-
|
|
69
|
-
|
|
111
|
+
const onLayout = event => {
|
|
112
|
+
const height = event.nativeEvent.layout.height + CONTENT_MARGIN_HEIGHT;
|
|
113
|
+
setContentHeight(height);
|
|
114
|
+
|
|
115
|
+
if (shouldInitialExpandedRef.current) {
|
|
116
|
+
shouldInitialExpandedRef.current = false;
|
|
117
|
+
setTimeout(() => setIsExpanded(true), INITIAL_EXPANDED_DELAY_MILLIS);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
(0, _react.useEffect)(() => {
|
|
122
|
+
rotate.value = (0, _reactNativeReanimated.withTiming)(isExpanded ? ROTATE_SHOW_DEGREE : ROTATE_HIDE_DEGREE, ANIMATION_CONFIG);
|
|
123
|
+
animatedHeight.value = (0, _reactNativeReanimated.withTiming)(isExpanded ? contentHeight : 0, ANIMATION_CONFIG);
|
|
124
|
+
animatedOpacity.value = isExpanded ? (0, _reactNativeReanimated.withDelay)(CONTENT_OPACITY_DELAY_MILLIS, (0, _reactNativeReanimated.withTiming)(1, ANIMATION_CONFIG)) : (0, _reactNativeReanimated.withTiming)(0, ANIMATION_CONFIG);
|
|
125
|
+
}, [isExpanded, contentHeight]);
|
|
126
|
+
return /*#__PURE__*/_react.default.createElement(_Column.default, {
|
|
70
127
|
style: styles.root
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
}
|
|
128
|
+
}, /*#__PURE__*/_react.default.createElement(_ButtonBase.default, {
|
|
129
|
+
onPress: onPress
|
|
130
|
+
}, /*#__PURE__*/_react.default.createElement(_Row.default, {
|
|
131
|
+
style: styles.title
|
|
132
|
+
}, LeftComponent ? LeftComponent : null, /*#__PURE__*/_react.default.createElement(_Column.default, {
|
|
133
|
+
style: styles.titleColumn
|
|
134
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
135
|
+
variant: 'subtitle2',
|
|
74
136
|
children: title,
|
|
75
|
-
|
|
76
|
-
|
|
137
|
+
color: 'textPrimary',
|
|
138
|
+
numberOfLines: 1,
|
|
139
|
+
disableFontScaling: true
|
|
140
|
+
}), subTitle ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Spacer.default, {
|
|
141
|
+
size: 0.5
|
|
142
|
+
}), /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
143
|
+
style: styles.subtitle,
|
|
144
|
+
color: 'tertiary',
|
|
145
|
+
children: subTitle,
|
|
146
|
+
numberOfLines: 1,
|
|
147
|
+
disableFontScaling: true
|
|
148
|
+
})) : null), /*#__PURE__*/_react.default.createElement(_Spacer.default, {
|
|
77
149
|
flex: 1
|
|
78
150
|
}), /*#__PURE__*/_react.default.createElement(_Spacer.default, {
|
|
79
|
-
size:
|
|
80
|
-
}), /*#__PURE__*/_react.default.createElement(
|
|
151
|
+
size: 3
|
|
152
|
+
}), /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
|
|
81
153
|
style: animatedChevronDownStyles
|
|
82
|
-
}, RightIcon ? RightIcon : /*#__PURE__*/_react.default.createElement(_icons.ChevronDown,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
})
|
|
154
|
+
}, RightIcon ? RightIcon : /*#__PURE__*/_react.default.createElement(_icons.ChevronDown, {
|
|
155
|
+
width: 20,
|
|
156
|
+
height: 20,
|
|
157
|
+
color: 'tertiary'
|
|
158
|
+
})))), /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
|
|
159
|
+
style: animatedContentBackgroundStyles
|
|
160
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
161
|
+
onLayout: onLayout,
|
|
162
|
+
style: styles.contentView
|
|
163
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
|
|
164
|
+
style: animatedContentStyle
|
|
165
|
+
}, typeof content === 'string' ? /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
166
|
+
variant: 'subtitle2',
|
|
167
|
+
color: 'tertiary',
|
|
168
|
+
children: content
|
|
169
|
+
}) : content))));
|
|
87
170
|
}
|
|
88
171
|
//# sourceMappingURL=Accordion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ANIMATION_OPTION","duration","useStyles","theme","useTheme","root","flexDirection","paddingVertical","spacing","Accordion","props","content","LeftIcon","RightIcon","title","titleVariant","styles","isExpanded","setIsExpanded","useState","rotate","useSharedValue","animatedChevronDownStyles","useAnimatedStyle","transform","value","onPress","prev","withTiming","React","isValidElement"],"sources":["Accordion.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport Animated, { useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { ChevronDown as ChevronDownIcon } from '../internal/icons';\nimport ButtonBase from '../ButtonBase';\nimport Column from '../Column';\nimport Divider from '../Divider';\nimport Spacer from '../Spacer';\nimport Typography from '../Typography';\nimport { useTheme } from '../styles';\n\nimport AccordionProps from './AccordionProps';\n\ntype AccordionStyles = NamedStylesStringUnion<'root'>;\n\nconst ANIMATION_OPTION = { duration: 250 };\n\nconst useStyles: UseStyles<AccordionStyles> = function (): AccordionStyles {\n const theme = useTheme();\n\n return {\n root: {\n flexDirection: 'row',\n paddingVertical: theme.spacing(3),\n },\n };\n};\n\nexport default function Accordion(props: AccordionProps) {\n const {\n content,\n LeftIcon,\n RightIcon,\n title,\n titleVariant = 'subtitle2',\n } = props;\n\n const styles = useStyles();\n\n const [isExpanded, setIsExpanded] = useState(false);\n const rotate = useSharedValue(0);\n\n const animatedChevronDownStyles = useAnimatedStyle(() => ({\n transform: [{ rotate: `${rotate.value}deg` }],\n }));\n\n const onPress = () => {\n setIsExpanded(prev => !prev);\n rotate.value = withTiming(!isExpanded ? 180 : 0, ANIMATION_OPTION);\n };\n\n return (\n <Column>\n <ButtonBase\n onPress={onPress}\n style={styles.root}\n >\n {LeftIcon ? (\n <React.Fragment>\n {LeftIcon}\n <Spacer size={2}/>\n </React.Fragment>\n ) : null}\n\n <Typography\n children={title}\n variant={titleVariant}\n />\n\n <Spacer flex={1}/>\n\n <Spacer size={2}/>\n\n <Column>\n <Animated.View style={animatedChevronDownStyles}>\n {RightIcon ? RightIcon : <ChevronDownIcon/>}\n </Animated.View>\n </Column>\n </ButtonBase>\n\n {isExpanded ? (\n React.isValidElement(content) ? (content) : (\n <Typography\n children={content}\n color={'textSecondary'}\n variant={'body2'}\n />\n )\n ) : null}\n\n <Divider/>\n </Column>\n );\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAMA,MAAMA,gBAAgB,GAAG;EAAEC,QAAQ,EAAE;AAAZ,CAAzB;;AAEA,MAAMC,SAAqC,GAAG,YAA6B;EACvE,MAAMC,KAAK,GAAG,IAAAC,gBAAA,GAAd;EAEA,OAAO;IACHC,IAAI,EAAE;MACFC,aAAa,EAAE,KADb;MAEFC,eAAe,EAAEJ,KAAK,CAACK,OAAN,CAAc,CAAd;IAFf;EADH,CAAP;AAMH,CATD;;AAWe,SAASC,SAAT,CAAmBC,KAAnB,EAA0C;EACrD,MAAM;IACFC,OADE;IAEFC,QAFE;IAGFC,SAHE;IAIFC,KAJE;IAKFC,YAAY,GAAG;EALb,IAMFL,KANJ;EAQA,MAAMM,MAAM,GAAGd,SAAS,EAAxB;EAEA,MAAM,CAACe,UAAD,EAAaC,aAAb,IAA8B,IAAAC,eAAA,EAAS,KAAT,CAApC;EACA,MAAMC,MAAM,GAAG,IAAAC,qCAAA,EAAe,CAAf,CAAf;EAEA,MAAMC,yBAAyB,GAAG,IAAAC,uCAAA,EAAiB,OAAO;IACtDC,SAAS,EAAE,CAAC;MAAEJ,MAAM,EAAG,GAAEA,MAAM,CAACK,KAAM;IAA1B,CAAD;EAD2C,CAAP,CAAjB,CAAlC;;EAIA,MAAMC,OAAO,GAAG,MAAM;IAClBR,aAAa,CAACS,IAAI,IAAI,CAACA,IAAV,CAAb;IACAP,MAAM,CAACK,KAAP,GAAe,IAAAG,iCAAA,EAAW,CAACX,UAAD,GAAc,GAAd,GAAoB,CAA/B,EAAkCjB,gBAAlC,CAAf;EACH,CAHD;;EAKA,oBACI,6BAAC,eAAD,qBACI,6BAAC,mBAAD;IACI,OAAO,EAAE0B,OADb;IAEI,KAAK,EAAEV,MAAM,CAACX;EAFlB,GAIKO,QAAQ,gBACL,6BAAC,cAAD,CAAO,QAAP,QACKA,QADL,eAEI,6BAAC,eAAD;IAAQ,IAAI,EAAE;EAAd,EAFJ,CADK,GAKL,IATR,eAWI,6BAAC,mBAAD;IACI,QAAQ,EAAEE,KADd;IAEI,OAAO,EAAEC;EAFb,EAXJ,eAgBI,6BAAC,eAAD;IAAQ,IAAI,EAAE;EAAd,EAhBJ,eAkBI,6BAAC,eAAD;IAAQ,IAAI,EAAE;EAAd,EAlBJ,eAoBI,6BAAC,eAAD,qBACI,6BAAC,8BAAD,CAAU,IAAV;IAAe,KAAK,EAAEO;EAAtB,GACKT,SAAS,GAAGA,SAAH,gBAAe,6BAAC,kBAAD,OAD7B,CADJ,CApBJ,CADJ,EA4BKI,UAAU,GACP,aAAAY,cAAA,CAAMC,cAAN,CAAqBnB,OAArB,IAAiCA,OAAjC,gBACI,6BAAC,mBAAD;IACI,QAAQ,EAAEA,OADd;IAEI,KAAK,EAAE,eAFX;IAGI,OAAO,EAAE;EAHb,EAFG,GAQP,IApCR,eAsCI,6BAAC,gBAAD,OAtCJ,CADJ;AA0CH"}
|
|
1
|
+
{"version":3,"names":["ROTATE_HIDE_DEGREE","ROTATE_SHOW_DEGREE","ANIMATION_CONFIG","duration","INITIAL_EXPANDED_DELAY_MILLIS","CONTENT_OPACITY_DELAY_MILLIS","useStyles","theme","useTheme","root","marginBottom","spacing","title","borderRadius","backgroundColor","palette","paper","grey","paddingHorizontal","paddingVertical","alignItems","height","titleColumn","flexShrink","subtitle","fontSize","lineHeight","fontFamily","contentView","position","width","marginTop","Accordion","props","subTitle","content","RightIcon","LeftComponent","isInitialExpanded","styles","CONTENT_MARGIN_HEIGHT","isExpanded","setIsExpanded","useState","shouldInitialExpandedRef","useRef","rotate","useSharedValue","animatedOpacity","animatedHeight","contentHeight","setContentHeight","animatedChevronDownStyles","useAnimatedStyle","transform","value","animatedContentBackgroundStyles","overflow","animatedContentStyle","opacity","onPress","prev","onLayout","event","nativeEvent","layout","current","setTimeout","useEffect","withTiming","withDelay"],"sources":["Accordion.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\nimport { LayoutChangeEvent, View } from 'react-native';\nimport Animated, {\n useAnimatedStyle,\n useSharedValue,\n withDelay,\n withTiming,\n WithTimingConfig,\n} from 'react-native-reanimated';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { useTheme } from '../styles';\nimport { ChevronDown } from '../internal/icons';\nimport ButtonBase from '../ButtonBase';\nimport Column from '../Column';\nimport Row from '../Row';\nimport Spacer from '../Spacer';\nimport Typography from '../Typography';\n\nimport AccordionProps from './AccordionProps';\n\ntype AccordionStyles = NamedStylesStringUnion<\n 'root'\n | 'title'\n | 'titleColumn'\n | 'subtitle'\n | 'contentView'\n>;\n\nconst ROTATE_HIDE_DEGREE = 0;\nconst ROTATE_SHOW_DEGREE = 180;\nconst ANIMATION_CONFIG: Readonly<WithTimingConfig> = { duration: 200 };\nconst INITIAL_EXPANDED_DELAY_MILLIS = 100;\nconst CONTENT_OPACITY_DELAY_MILLIS = 200;\n\nconst useStyles: UseStyles<AccordionStyles> = function (): AccordionStyles {\n const theme = useTheme();\n\n return {\n root: { marginBottom: theme.spacing(3) },\n title: {\n borderRadius: theme.spacing(4),\n backgroundColor: theme.palette.paper.grey,\n paddingHorizontal: theme.spacing(4),\n paddingVertical: theme.spacing(3.5),\n alignItems: 'center',\n height: 64,\n },\n titleColumn: { flexShrink: 1 },\n subtitle: {\n fontSize: 11,\n lineHeight: 12,\n fontFamily: 'Inter-Regular',\n },\n contentView: {\n position: 'absolute',\n width: '100%',\n borderRadius: theme.spacing(4),\n backgroundColor: theme.palette.paper.grey,\n paddingHorizontal: theme.spacing(4),\n paddingVertical: theme.spacing(6),\n marginTop: theme.spacing(1),\n },\n };\n};\n\nexport default function Accordion(props: AccordionProps) {\n const {\n title,\n subTitle,\n content,\n RightIcon,\n LeftComponent,\n isInitialExpanded = false,\n } = props;\n\n const styles = useStyles();\n const theme = useTheme();\n const CONTENT_MARGIN_HEIGHT = theme.spacing(2);\n\n const [isExpanded, setIsExpanded] = useState(false);\n const shouldInitialExpandedRef = useRef<boolean>(isInitialExpanded);\n\n const rotate = useSharedValue(ROTATE_HIDE_DEGREE);\n const animatedOpacity = useSharedValue(0);\n\n const animatedHeight = useSharedValue(0);\n const [contentHeight, setContentHeight] = useState(0);\n\n const animatedChevronDownStyles = useAnimatedStyle(() => ({\n transform: [{ rotate: `${rotate.value}deg` }],\n }), []);\n\n const animatedContentBackgroundStyles = useAnimatedStyle(() => ({\n height: animatedHeight.value,\n overflow: 'hidden',\n }), []);\n\n const animatedContentStyle = useAnimatedStyle(() => ({\n opacity: animatedOpacity.value,\n }), []);\n\n const onPress = () => {\n setIsExpanded(prev => !prev);\n };\n\n const onLayout = (event: LayoutChangeEvent) => {\n const height = event.nativeEvent.layout.height + CONTENT_MARGIN_HEIGHT;\n setContentHeight(height);\n\n if (shouldInitialExpandedRef.current) {\n shouldInitialExpandedRef.current = false;\n setTimeout(() => setIsExpanded(true), INITIAL_EXPANDED_DELAY_MILLIS);\n }\n };\n\n useEffect(() => {\n rotate.value = withTiming(isExpanded ? ROTATE_SHOW_DEGREE : ROTATE_HIDE_DEGREE, ANIMATION_CONFIG);\n\n animatedHeight.value = withTiming(isExpanded ? contentHeight : 0, ANIMATION_CONFIG);\n\n animatedOpacity.value = isExpanded\n ? withDelay(CONTENT_OPACITY_DELAY_MILLIS, withTiming(1, ANIMATION_CONFIG))\n : withTiming(0, ANIMATION_CONFIG);\n }, [isExpanded, contentHeight]);\n\n return (\n <Column style={styles.root}>\n <ButtonBase onPress={onPress}>\n <Row style={styles.title}>\n {LeftComponent ? LeftComponent : null}\n\n <Column style={styles.titleColumn}>\n <Typography\n variant={'subtitle2'}\n children={title}\n color={'textPrimary'}\n numberOfLines={1}\n disableFontScaling={true}\n />\n\n {subTitle ? (\n <React.Fragment>\n <Spacer size={0.5}/>\n\n <Typography\n style={styles.subtitle}\n color={'tertiary'}\n children={subTitle}\n numberOfLines={1}\n disableFontScaling={true}\n />\n </React.Fragment>\n ) : null}\n </Column>\n\n <Spacer flex={1}/>\n\n <Spacer size={3}/>\n\n <Animated.View style={animatedChevronDownStyles}>\n {RightIcon ? RightIcon : (\n <ChevronDown\n width={20}\n height={20}\n color={'tertiary'}\n />\n )}\n </Animated.View>\n </Row>\n </ButtonBase>\n\n <Animated.View style={animatedContentBackgroundStyles}>\n <View\n onLayout={onLayout}\n style={styles.contentView}\n >\n <Animated.View style={animatedContentStyle}>\n {typeof content === 'string' ? (\n <Typography\n variant={'subtitle2'}\n color={'tertiary'}\n children={content}\n />\n ) : (content)}\n </Animated.View>\n </View>\n </Animated.View>\n </Column>\n );\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAQA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAYA,MAAMA,kBAAkB,GAAG,CAA3B;AACA,MAAMC,kBAAkB,GAAG,GAA3B;AACA,MAAMC,gBAA4C,GAAG;EAAEC,QAAQ,EAAE;AAAZ,CAArD;AACA,MAAMC,6BAA6B,GAAG,GAAtC;AACA,MAAMC,4BAA4B,GAAG,GAArC;;AAEA,MAAMC,SAAqC,GAAG,YAA6B;EACvE,MAAMC,KAAK,GAAG,IAAAC,gBAAA,GAAd;EAEA,OAAO;IACHC,IAAI,EAAE;MAAEC,YAAY,EAAEH,KAAK,CAACI,OAAN,CAAc,CAAd;IAAhB,CADH;IAEHC,KAAK,EAA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IArBR,CAHJ,eA2BI,6BAAC,eAAD;IAAQ,IAAI,EAAE;EAAd,EA3BJ,eA6BI,6BAAC,eAAD;IAAQ,IAAI,EAAE;EAAd,EA7BJ,eA+BI,6BAAC,8BAAD,CAAU,IAAV;IAAe,KAAK,EAAEkB;EAAtB,GACKhB,SAAS,GAAGA,SAAH,gBACN,6BAAC,kBAAD;IACI,KAAK,EAAE,EADX;IAEI,MAAM,EAAE,EAFZ;IAGI,KAAK,EAAE;EAHX,EAFR,CA/BJ,CADJ,CADJ,eA6CI,6BAAC,8BAAD,CAAU,IAAV;IAAe,KAAK,EAAEoB;EAAtB,gBACI,6BAAC,iBAAD;IACI,QAAQ,EAAEM,QADd;IAEI,KAAK,EAAEvB,MAAM,CAACX;EAFlB,gBAII,6BAAC,8BAAD,CAAU,IAAV;IAAe,KAAK,EAAE8B;EAAtB,GACK,OAAOvB,OAAP,KAAmB,QAAnB,gBACG,6BAAC,mBAAD;IACI,OAAO,EAAE,WADb;IAEI,KAAK,EAAE,UAFX;IAGI,QAAQ,EAAEA;EAHd,EADH,GAMIA,OAPT,CAJJ,CADJ,CA7CJ,CADJ;AAgEH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["AccordionProps.ts"],"sourcesContent":["import React from 'react';\
|
|
1
|
+
{"version":3,"names":[],"sources":["AccordionProps.ts"],"sourcesContent":["import React from 'react';\n\nexport default interface AccordionProps {\n /**\n * The title of the component.\n */\n title: string | React.ReactNode;\n\n /**\n * The subtitle of the component.\n */\n subTitle?: string | React.ReactNode;\n\n /**\n * The component to the left of the title.\n */\n LeftComponent?: React.ReactNode;\n\n /**\n * The icon to the right of the title.\n */\n RightIcon?: React.ReactElement;\n\n /**\n * The content of the component.\n */\n content: string | React.ReactNode;\n\n /**\n * The initial state of expanding\n * @default false\n */\n isInitialExpanded?: boolean;\n}"],"mappings":""}
|
|
@@ -23,7 +23,6 @@ const defaultPosition = {
|
|
|
23
23
|
const useStyles = function () {
|
|
24
24
|
const theme = (0, _styles.useTheme)();
|
|
25
25
|
const dotSize = 4;
|
|
26
|
-
const offset = 0;
|
|
27
26
|
return {
|
|
28
27
|
root: {},
|
|
29
28
|
badge: {
|
|
@@ -32,18 +31,6 @@ const useStyles = function () {
|
|
|
32
31
|
height: dotSize,
|
|
33
32
|
position: 'absolute',
|
|
34
33
|
width: dotSize
|
|
35
|
-
},
|
|
36
|
-
top: {
|
|
37
|
-
top: offset
|
|
38
|
-
},
|
|
39
|
-
bottom: {
|
|
40
|
-
bottom: offset
|
|
41
|
-
},
|
|
42
|
-
left: {
|
|
43
|
-
left: offset
|
|
44
|
-
},
|
|
45
|
-
right: {
|
|
46
|
-
right: offset
|
|
47
34
|
}
|
|
48
35
|
};
|
|
49
36
|
};
|
|
@@ -54,11 +41,15 @@ function Badge(props) {
|
|
|
54
41
|
invisible = false,
|
|
55
42
|
position = defaultPosition,
|
|
56
43
|
style,
|
|
44
|
+
offset = 0,
|
|
57
45
|
...otherProps
|
|
58
46
|
} = props;
|
|
59
47
|
const styles = useStyles();
|
|
60
48
|
const rootStyle = (0, _styles.css)([styles.root, style]);
|
|
61
|
-
const badgeStyle = (0, _styles.css)([styles.badge,
|
|
49
|
+
const badgeStyle = (0, _styles.css)([styles.badge, {
|
|
50
|
+
[position.vertical]: offset,
|
|
51
|
+
[position.horizontal]: offset
|
|
52
|
+
}]);
|
|
62
53
|
return /*#__PURE__*/_react.default.createElement(_reactNative.View, _extends({
|
|
63
54
|
style: rootStyle
|
|
64
55
|
}, otherProps), children, !invisible ? /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["defaultPosition","vertical","horizontal","useStyles","theme","useTheme","dotSize","
|
|
1
|
+
{"version":3,"names":["defaultPosition","vertical","horizontal","useStyles","theme","useTheme","dotSize","root","badge","backgroundColor","palette","secondary","main","borderRadius","height","position","width","Badge","props","children","invisible","style","offset","otherProps","styles","rootStyle","css","badgeStyle"],"sources":["Badge.tsx"],"sourcesContent":["import React from 'react';\nimport { View } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { css, useTheme } from '../styles';\nimport BadgeProps, { BadgePosition } from './BadgeProps';\n\nconst defaultPosition: BadgePosition = {\n vertical: 'top',\n horizontal: 'right',\n};\n\ntype BadgeStyles = NamedStylesStringUnion<'root' | 'badge'>;\n\nconst useStyles: UseStyles<BadgeStyles> = function (): BadgeStyles {\n const theme = useTheme();\n\n const dotSize = 4;\n\n return {\n root: {},\n badge: {\n backgroundColor: theme.palette.secondary.main,\n borderRadius: dotSize * 0.5,\n height: dotSize,\n position: 'absolute',\n width: dotSize,\n },\n };\n};\n\nexport default function Badge(props: BadgeProps) {\n const {\n children,\n invisible = false,\n position = defaultPosition,\n style,\n offset = 0,\n ...otherProps\n } = props;\n\n const styles = useStyles();\n\n const rootStyle = css([\n styles.root,\n style,\n ]);\n\n const badgeStyle = css([\n styles.badge,\n {\n [position.vertical]: offset,\n [position.horizontal]: offset,\n },\n ]);\n\n return (\n <View\n style={rootStyle}\n {...otherProps}\n >\n {children}\n\n {!invisible ? <View style={badgeStyle}/> : null}\n </View>\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;;;;;AAGA,MAAMA,eAA8B,GAAG;EACnCC,QAAQ,EAAE,KADyB;EAEnCC,UAAU,EAAE;AAFuB,CAAvC;;AAOA,MAAMC,SAAiC,GAAG,YAAyB;EAC/D,MAAMC,KAAK,GAAG,IAAAC,gBAAA,GAAd;EAEA,MAAMC,OAAO,GAAG,CAAhB;EAEA,OAAO;IACHC,IAAI,EAAE,EADH;IAEHC,KAAK,EAAE;MACHC,eAAe,EAAEL,KAAK,CAACM,OAAN,CAAcC,SAAd,CAAwBC,IADtC;MAEHC,YAAY,EAAEP,OAAO,GAAG,GAFrB;MAGHQ,MAAM,EAAER,OAHL;MAIHS,QAAQ,EAAE,UAJP;MAKHC,KAAK,EAAEV;IALJ;EAFJ,CAAP;AAUH,CAfD;;AAiBe,SAASW,KAAT,CAAeC,KAAf,EAAkC;EAC7C,MAAM;IACFC,QADE;IAEFC,SAAS,GAAG,KAFV;IAGFL,QAAQ,GAAGf,eAHT;IAIFqB,KAJE;IAKFC,MAAM,GAAG,CALP;IAMF,GAAGC;EAND,IAOFL,KAPJ;EASA,MAAMM,MAAM,GAAGrB,SAAS,EAAxB;EAEA,MAAMsB,SAAS,GAAG,IAAAC,WAAA,EAAI,CAClBF,MAAM,CAACjB,IADW,EAElBc,KAFkB,CAAJ,CAAlB;EAKA,MAAMM,UAAU,GAAG,IAAAD,WAAA,EAAI,CACnBF,MAAM,CAAChB,KADY,EAEnB;IACI,CAACO,QAAQ,CAACd,QAAV,GAAqBqB,MADzB;IAEI,CAACP,QAAQ,CAACb,UAAV,GAAuBoB;EAF3B,CAFmB,CAAJ,CAAnB;EAQA,oBACI,6BAAC,iBAAD;IACI,KAAK,EAAEG;EADX,GAEQF,UAFR,GAIKJ,QAJL,EAMK,CAACC,SAAD,gBAAa,6BAAC,iBAAD;IAAM,KAAK,EAAEO;EAAb,EAAb,GAA0C,IAN/C,CADJ;AAUH;;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["BadgeProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ViewProps } from 'react-native';\nimport type { OverridableComponentProps } from '../types';\n\nexport type BadgeHorizontalPosition = 'right' | 'left';\n\nexport type BadgeVerticalPosition = 'top' | 'bottom';\n\nexport interface BadgePosition {\n vertical: BadgeVerticalPosition;\n horizontal: BadgeHorizontalPosition;\n}\n\nexport default interface BadgeProps extends OverridableComponentProps<ViewProps, {\n /**\n * The badge will be added relative to this node.\n */\n children?: React.ReactNode;\n\n /**\n * If `true`, the badge is invisible.\n * @default false\n */\n invisible?: boolean;\n\n /**\n * The position of the badge.\n * @default {\n * vertical: 'top',\n * horizontal: 'right',\n * }\n */\n position?: BadgePosition;\n}> {}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["BadgeProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ViewProps } from 'react-native';\nimport type { OverridableComponentProps } from '../types';\n\nexport type BadgeHorizontalPosition = 'right' | 'left';\n\nexport type BadgeVerticalPosition = 'top' | 'bottom';\n\nexport interface BadgePosition {\n vertical: BadgeVerticalPosition;\n horizontal: BadgeHorizontalPosition;\n}\n\nexport default interface BadgeProps extends OverridableComponentProps<ViewProps, {\n /**\n * The badge will be added relative to this node.\n */\n children?: React.ReactNode;\n\n /**\n * If `true`, the badge is invisible.\n * @default false\n */\n invisible?: boolean;\n\n /**\n * The position of the badge.\n * @default {\n * vertical: 'top',\n * horizontal: 'right',\n * }\n */\n position?: BadgePosition;\n\n /**\n * The offset of the badge.\n * @default 0\n */\n offset?: number;\n}> {}\n"],"mappings":""}
|
|
@@ -53,6 +53,7 @@ function Button(props) {
|
|
|
53
53
|
fullWidth = false,
|
|
54
54
|
href,
|
|
55
55
|
onPress,
|
|
56
|
+
pressEffect,
|
|
56
57
|
size = 'medium',
|
|
57
58
|
startIcon: startIconProp,
|
|
58
59
|
style: styleProp,
|
|
@@ -83,10 +84,10 @@ function Button(props) {
|
|
|
83
84
|
};
|
|
84
85
|
const startIcon = (0, _utils.cloneElementSafely)(startIconProp, iconProps);
|
|
85
86
|
const endIcon = (0, _utils.cloneElementSafely)(endIconProp, iconProps);
|
|
86
|
-
const paddingSize = size === 'small' ? theme.spacing(
|
|
87
|
+
const paddingSize = size === 'small' ? theme.spacing(3) : theme.spacing(4);
|
|
87
88
|
const paddingLeft = startIcon ? paddingSize - theme.spacing(1) : paddingSize;
|
|
88
89
|
const paddingRight = endIcon ? paddingSize - theme.spacing(1) : paddingSize;
|
|
89
|
-
const borderRadius = theme.shape.
|
|
90
|
+
const borderRadius = theme.shape.roundnessLarge;
|
|
90
91
|
const buttonBaseStyle = (0, _styles.css)([styles.root, variantStyleMap[variant], size === 'medium' ? styles.medium : styles.small, fullWidth ? styles.fullWidth : undefined, {
|
|
91
92
|
borderRadius,
|
|
92
93
|
color: fontColor
|
|
@@ -109,6 +110,7 @@ function Button(props) {
|
|
|
109
110
|
const textStyle = (0, _styles.css)([fontStyle, textMarginStyle, {
|
|
110
111
|
textAlign: 'center'
|
|
111
112
|
}]);
|
|
113
|
+
const modifiedPressEffect = variant !== 'text' && !pressEffect ? 'scale' : pressEffect;
|
|
112
114
|
|
|
113
115
|
const handlePress = async () => {
|
|
114
116
|
if (disabled) {
|
|
@@ -130,7 +132,8 @@ function Button(props) {
|
|
|
130
132
|
return /*#__PURE__*/_react.default.createElement(_ButtonBase.default, _extends({
|
|
131
133
|
disabled: disabled,
|
|
132
134
|
onPress: handlePress,
|
|
133
|
-
style: buttonBaseStyle
|
|
135
|
+
style: buttonBaseStyle,
|
|
136
|
+
pressEffect: modifiedPressEffect
|
|
134
137
|
}, otherProps), startIcon, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
135
138
|
children: children,
|
|
136
139
|
style: textStyle
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["iconSizes","small","medium","styles","StyleSheet","create","root","flexDirection","justifyContent","alignItems","fullWidth","width","minWidth","height","Button","props","children","clipHorizontalSpacing","color","disabled","endIcon","endIconProp","href","onPress","size","startIcon","startIconProp","style","styleProp","variant","otherProps","theme","useTheme","mainColor","palette","main","fontColor","contrastTextColor","variantStyleMap","contained","backgroundColor","outlined","borderColor","borderStyle","borderWidth","text","iconProps","fill","cloneElementSafely","paddingSize","spacing","paddingLeft","paddingRight","borderRadius","shape","
|
|
1
|
+
{"version":3,"names":["iconSizes","small","medium","styles","StyleSheet","create","root","flexDirection","justifyContent","alignItems","fullWidth","width","minWidth","height","Button","props","children","clipHorizontalSpacing","color","disabled","endIcon","endIconProp","href","onPress","pressEffect","size","startIcon","startIconProp","style","styleProp","variant","otherProps","theme","useTheme","mainColor","palette","main","fontColor","contrastTextColor","variantStyleMap","contained","backgroundColor","outlined","borderColor","borderStyle","borderWidth","text","iconProps","fill","cloneElementSafely","paddingSize","spacing","paddingLeft","paddingRight","borderRadius","shape","roundnessLarge","buttonBaseStyle","css","undefined","fontStyle","createFontStyle","selector","typo","button2","button1","textMarginSize","textMarginStyle","marginLeft","marginRight","textStyle","textAlign","modifiedPressEffect","handlePress","Linking","canOpenURL","openURL"],"sources":["Button.tsx"],"sourcesContent":["import React from 'react';\nimport { Linking, Text } from 'react-native';\nimport ButtonBase from '../ButtonBase';\nimport { createFontStyle, css, StyleSheet, useTheme } from '../styles';\nimport { cloneElementSafely } from '../utils';\nimport type ButtonProps from './ButtonProps';\nimport type { ButtonSize } from './ButtonProps';\n\ntype IconSizes = { [n in ButtonSize]: number };\n\nconst iconSizes: IconSizes = {\n small: 20,\n medium: 24,\n};\n\nconst styles = StyleSheet.create({\n root: {\n flexDirection: 'row',\n justifyContent: 'center',\n alignItems: 'center',\n },\n fullWidth: {\n width: '100%',\n },\n medium: {\n minWidth: 104,\n height: 48,\n },\n small: {\n minWidth: 56,\n height: 32,\n },\n});\n\nexport default function Button(props: ButtonProps) {\n const {\n children,\n clipHorizontalSpacing = false,\n color = 'primary',\n disabled = false,\n endIcon: endIconProp,\n fullWidth = false,\n href,\n onPress,\n pressEffect,\n size = 'medium',\n startIcon: startIconProp,\n style: styleProp,\n variant = 'contained',\n ...otherProps\n } = props;\n\n const theme = useTheme();\n\n const mainColor = theme.palette[color].main;\n\n const fontColor = variant === 'contained'\n ? theme.palette[color].contrastTextColor\n : theme.palette[color].main;\n\n const variantStyleMap = {\n contained: {\n backgroundColor: mainColor,\n },\n outlined: {\n backgroundColor: 'transparent',\n borderColor: mainColor,\n borderStyle: 'solid',\n borderWidth: 1,\n },\n text: {\n backgroundColor: 'transparent',\n },\n };\n\n const iconProps = {\n width: iconSizes[size],\n height: iconSizes[size],\n fill: fontColor,\n };\n\n const startIcon = cloneElementSafely(startIconProp, iconProps);\n const endIcon = cloneElementSafely(endIconProp, iconProps);\n\n const paddingSize = size === 'small' ? theme.spacing(3) : theme.spacing(4);\n const paddingLeft = startIcon ? paddingSize - theme.spacing(1) : paddingSize;\n const paddingRight = endIcon ? paddingSize - theme.spacing(1) : paddingSize;\n\n const borderRadius = theme.shape.roundnessLarge;\n const buttonBaseStyle = css([\n styles.root,\n variantStyleMap[variant],\n size === 'medium' ? styles.medium : styles.small,\n fullWidth ? styles.fullWidth : undefined,\n { borderRadius, color: fontColor },\n (variant === 'text' && clipHorizontalSpacing)\n ? { minWidth: 0 }\n : { paddingLeft, paddingRight },\n styleProp,\n ]);\n\n const fontStyle = createFontStyle(theme, {\n selector: (typo) => size === 'small' ? typo.button2 : typo.button1,\n color: fontColor,\n });\n\n const textMarginSize = size === 'small' ? theme.spacing(1) : theme.spacing(2);\n const textMarginStyle = startIcon\n ? { marginLeft: textMarginSize }\n : endIcon\n ? { marginRight: textMarginSize }\n : undefined;\n\n const textStyle = css([\n fontStyle,\n textMarginStyle,\n { textAlign: 'center' },\n ]);\n\n const modifiedPressEffect = variant !== 'text' && !pressEffect\n ? 'scale'\n : pressEffect;\n\n const handlePress = async () => {\n if (disabled) {\n return;\n }\n if (onPress) {\n onPress();\n return;\n }\n if (href) {\n if (await Linking.canOpenURL(href)) {\n await Linking.openURL(href);\n }\n }\n };\n\n return (\n <ButtonBase\n disabled={disabled}\n onPress={handlePress}\n style={buttonBaseStyle}\n pressEffect={modifiedPressEffect}\n {...otherProps}\n >\n {startIcon}\n\n <Text\n children={children}\n style={textStyle}\n />\n\n {endIcon}\n </ButtonBase>\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;AAMA,MAAMA,SAAoB,GAAG;EACzBC,KAAK,EAAE,EADkB;EAEzBC,MAAM,EAAE;AAFiB,CAA7B;;AAKA,MAAMC,MAAM,GAAGC,kBAAA,CAAWC,MAAX,CAAkB;EAC7BC,IAAI,EAAE;IACFC,aAAa,EAAE,KADb;IAEFC,cAAc,EAAE,QAFd;IAGFC,UAAU,EAAE;EAHV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ABLED_OPACITY = void 0;
|
|
7
7
|
exports.default = ButtonBase;
|
|
8
8
|
|
|
9
|
-
var _react =
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _reactNative = require("react-native");
|
|
12
12
|
|
|
13
13
|
var _hooks = require("../hooks");
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _utils = require("../utils");
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _animated = require("../animated");
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
20
|
|
|
21
|
-
function
|
|
21
|
+
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; }
|
|
22
22
|
|
|
23
23
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
24
24
|
|
|
@@ -28,19 +28,21 @@ const DISABLED_OPACITY = .3;
|
|
|
28
28
|
exports.DISABLED_OPACITY = DISABLED_OPACITY;
|
|
29
29
|
const ACTIVE_OPACITY = .65;
|
|
30
30
|
const ORIGINAL_SCALE = 1;
|
|
31
|
-
const MINIFIED_SCALE = .96;
|
|
32
|
-
const
|
|
33
|
-
|
|
31
|
+
const MINIFIED_SCALE = .96; // at "node_modules/react-native/Libraries/Pressability.js"
|
|
32
|
+
// const DEFAULT_MIN_PRESS_DURATION = 130;
|
|
33
|
+
|
|
34
|
+
const SCALE_EFFECT_PRESS_IN_DELAY = 130;
|
|
35
|
+
const OPACITY_EFFECT_PRESS_IN_DELAY = 0;
|
|
36
|
+
|
|
37
|
+
const startTimingAnimationWithDefaults = (value, toValue) => {
|
|
38
|
+
_reactNative.Animated.timing(value, {
|
|
39
|
+
toValue,
|
|
40
|
+
duration: 150,
|
|
41
|
+
useNativeDriver: _utils.isNotAndroid12
|
|
42
|
+
}).start();
|
|
34
43
|
};
|
|
35
44
|
|
|
36
|
-
const
|
|
37
|
-
disabled: {
|
|
38
|
-
opacity: DISABLED_OPACITY,
|
|
39
|
-
transform: [{
|
|
40
|
-
scale: ORIGINAL_SCALE
|
|
41
|
-
}]
|
|
42
|
-
}
|
|
43
|
-
});
|
|
45
|
+
const getOpacityByDisabled = disabled => disabled ? DISABLED_OPACITY : ORIGINAL_OPACITY;
|
|
44
46
|
|
|
45
47
|
function ButtonBase(props) {
|
|
46
48
|
const {
|
|
@@ -48,8 +50,10 @@ function ButtonBase(props) {
|
|
|
48
50
|
disabled = false,
|
|
49
51
|
disableThrottle = false,
|
|
50
52
|
onPress,
|
|
53
|
+
onPressOut,
|
|
51
54
|
pressEffect = 'opacity',
|
|
52
|
-
|
|
55
|
+
pressDelay: pressDelayOrNil,
|
|
56
|
+
style: styleProp,
|
|
53
57
|
throttleMillis = 650,
|
|
54
58
|
...otherProps
|
|
55
59
|
} = props;
|
|
@@ -57,51 +61,61 @@ function ButtonBase(props) {
|
|
|
57
61
|
periodMillis: disableThrottle ? 0 : throttleMillis,
|
|
58
62
|
callback: onPress
|
|
59
63
|
});
|
|
60
|
-
const opacity = (0,
|
|
61
|
-
const scale = (0,
|
|
62
|
-
|
|
63
|
-
opacity
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
(0, _useDisabledReaction.default)(disabled, opacity);
|
|
69
|
-
|
|
70
|
-
const startAnimation = function (pressIn) {
|
|
71
|
-
let isHovered = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
72
|
-
|
|
73
|
-
if (pressEffect === 'none') {
|
|
74
|
-
return;
|
|
64
|
+
const opacity = (0, _hooks.useAnimatedValue)(getOpacityByDisabled(disabled));
|
|
65
|
+
const scale = (0, _hooks.useAnimatedValue)(ORIGINAL_SCALE);
|
|
66
|
+
(0, _react.useEffect)(() => {
|
|
67
|
+
opacity.setValue(getOpacityByDisabled(disabled));
|
|
68
|
+
}, [disabled, pressEffect]);
|
|
69
|
+
const startScaleAnimation = (0, _react.useCallback)((pressIn, isHover) => {
|
|
70
|
+
if (!isHover) {
|
|
71
|
+
startTimingAnimationWithDefaults(scale, pressIn ? MINIFIED_SCALE : ORIGINAL_SCALE);
|
|
75
72
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
73
|
+
}, []);
|
|
74
|
+
const startOpacityAnimation = (0, _react.useCallback)(pressIn => {
|
|
75
|
+
if (pressIn) {
|
|
76
|
+
opacity.setValue(ACTIVE_OPACITY);
|
|
77
|
+
} else {
|
|
78
|
+
startTimingAnimationWithDefaults(opacity, ORIGINAL_OPACITY);
|
|
79
|
+
}
|
|
80
|
+
}, []);
|
|
81
|
+
const startPressAnimation = (0, _react.useCallback)(function (pressIn) {
|
|
82
|
+
let isHover = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
83
|
+
|
|
84
|
+
if (pressEffect === 'scale') {
|
|
85
|
+
startScaleAnimation(pressIn, isHover);
|
|
86
|
+
} else if (pressEffect === 'opacity') {
|
|
87
|
+
startOpacityAnimation(pressIn, isHover);
|
|
89
88
|
}
|
|
89
|
+
}, [pressEffect]);
|
|
90
|
+
const handlePressIn = (0, _react.useCallback)(() => {
|
|
91
|
+
startPressAnimation(true, false);
|
|
92
|
+
}, [startPressAnimation]);
|
|
93
|
+
const handlePressOut = (0, _react.useCallback)(() => {
|
|
94
|
+
onPressOut && onPressOut();
|
|
95
|
+
startPressAnimation(false, false);
|
|
96
|
+
}, [startPressAnimation, onPressOut]);
|
|
97
|
+
const animatedStyle = {
|
|
98
|
+
opacity,
|
|
99
|
+
transform: [{
|
|
100
|
+
scale
|
|
101
|
+
}]
|
|
90
102
|
};
|
|
91
|
-
|
|
103
|
+
const defaultPressDelay = pressEffect === 'scale' ? SCALE_EFFECT_PRESS_IN_DELAY : OPACITY_EFFECT_PRESS_IN_DELAY;
|
|
104
|
+
const pressDelay = pressDelayOrNil ?? defaultPressDelay;
|
|
92
105
|
return /*#__PURE__*/_react.default.createElement(_animated.AnimatedPressable, _extends({
|
|
93
106
|
disabled: disabled,
|
|
94
107
|
onPress: handlePress,
|
|
95
|
-
onPressIn:
|
|
96
|
-
onPressOut:
|
|
97
|
-
style: [animatedStyle,
|
|
108
|
+
onPressIn: handlePressIn,
|
|
109
|
+
onPressOut: handlePressOut,
|
|
110
|
+
style: [animatedStyle, styleProp],
|
|
111
|
+
unstable_pressDelay: pressDelay
|
|
98
112
|
}, otherProps), typeof children !== 'function' ? _ref => {
|
|
99
113
|
let {
|
|
100
114
|
hovered
|
|
101
115
|
} = _ref;
|
|
102
116
|
|
|
103
117
|
if (hovered !== undefined && !disabled) {
|
|
104
|
-
|
|
118
|
+
startPressAnimation(hovered, true);
|
|
105
119
|
}
|
|
106
120
|
|
|
107
121
|
return children;
|