@bifrostui/react 2.0.0-alpha.12 → 2.0.0-alpha.13
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/ActionSheet/ActionSheet.d.ts +1 -1
- package/dist/ActionSheet/ActionSheet.js +8 -8
- package/dist/ActionSheet/ActionSheet.types.d.ts +1 -1
- package/dist/ActionSheet/ActionSheetContext.d.ts +1 -1
- package/dist/ActionSheet/ActionSheetContext.js +2 -2
- package/dist/ActionSheet/ActionSheetItem.types.d.ts +1 -1
- package/dist/Alert/Alert.d.ts +1 -1
- package/dist/Alert/Alert.js +16 -16
- package/dist/Alert/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/dist/Alert/__tests__/fixtures/A11yDemos.js +12 -12
- package/dist/Avatar/Avatar.d.ts +1 -1
- package/dist/Avatar/Avatar.js +5 -5
- package/dist/Avatar/Avatar.types.d.ts +1 -1
- package/dist/Avatar/AvatarGroup.types.d.ts +1 -1
- package/dist/Backdrop/Backdrop.d.ts +1 -1
- package/dist/Backdrop/Backdrop.js +3 -3
- package/dist/Backdrop/Backdrop.types.d.ts +1 -1
- package/dist/Backdrop/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/dist/Backdrop/__tests__/fixtures/A11yDemos.js +3 -3
- package/dist/Badge/Badge.d.ts +1 -1
- package/dist/Badge/Badge.js +4 -4
- package/dist/Badge/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/dist/Badge/__tests__/fixtures/A11yDemos.js +13 -13
- package/dist/Breadcrumb/Breadcrumb.d.ts +1 -1
- package/dist/Breadcrumb/Breadcrumb.js +9 -9
- package/dist/Breadcrumb/Breadcrumb.types.d.ts +1 -1
- package/dist/Breadcrumb/BreadcrumbItem.d.ts +1 -1
- package/dist/Breadcrumb/BreadcrumbItem.js +4 -4
- package/dist/Button/Button.d.ts +1 -1
- package/dist/Button/Button.js +6 -6
- package/dist/Button/Button.types.d.ts +1 -1
- package/dist/Button/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/dist/Button/__tests__/fixtures/A11yDemos.js +8 -8
- package/dist/Calendar/Calendar.types.d.ts +1 -1
- package/dist/Calendar/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/dist/Calendar/__tests__/fixtures/A11yDemos.js +2 -2
- package/dist/Card/Card.d.ts +1 -1
- package/dist/Card/Card.js +3 -3
- package/dist/Card/Card.types.d.ts +1 -1
- package/dist/Card/CardContent.d.ts +1 -1
- package/dist/Card/CardContent.js +3 -3
- package/dist/Card/CardContent.types.d.ts +1 -1
- package/dist/Card/CardFooter.d.ts +1 -1
- package/dist/Card/CardFooter.js +3 -3
- package/dist/Card/CardFooter.types.d.ts +1 -1
- package/dist/Card/CardHeader.d.ts +1 -1
- package/dist/Card/CardHeader.js +10 -10
- package/dist/Checkbox/CheckboxContext.d.ts +1 -1
- package/dist/Checkbox/CheckboxContext.js +2 -2
- package/dist/Checkbox/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/dist/Checkbox/__tests__/fixtures/A11yDemos.js +4 -4
- package/dist/CitySelector/CitySelector.types.d.ts +1 -0
- package/dist/CitySelector/Selector/index.d.ts +1 -1
- package/dist/CitySelector/Selector/index.js +2 -2
- package/dist/Collapse/Collapse.types.d.ts +1 -1
- package/dist/CollapsePanel/CollapsePanel.d.ts +1 -1
- package/dist/CollapsePanel/CollapsePanel.js +9 -9
- package/dist/CollapsePanel/CollapsePanel.types.d.ts +1 -1
- package/dist/CollapsePanel/CollapsePanelItem.d.ts +1 -1
- package/dist/CollapsePanel/CollapsePanelItem.js +5 -5
- package/dist/Countdown/Countdown.types.d.ts +2 -2
- package/dist/Countdown/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/dist/Countdown/__tests__/fixtures/A11yDemos.js +10 -10
- package/dist/Countdown/utils.d.ts +2 -2
- package/dist/Countdown/utils.js +4 -4
- package/dist/DatePicker/DatePicker.types.d.ts +1 -1
- package/dist/DesktopPicker/DesktopPicker.types.d.ts +1 -1
- package/dist/DesktopTimePicker/DesktopTimePicker.types.d.ts +11 -11
- package/dist/DesktopTimePicker/useGetTimePickerContent.js +2 -2
- package/dist/DesktopTimePicker/utils/utils.d.ts +1 -1
- package/dist/DesktopTimePicker/utils/utils.js +3 -3
- package/dist/Dialog/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/dist/Dialog/__tests__/fixtures/A11yDemos.js +4 -4
- package/dist/Divider/Divider.types.d.ts +1 -1
- package/dist/Drawer/Drawer.d.ts +1 -1
- package/dist/Drawer/Drawer.js +5 -5
- package/dist/Drawer/Drawer.types.d.ts +1 -1
- package/dist/Fade/Fade.d.ts +1 -1
- package/dist/Fade/Fade.js +4 -4
- package/dist/Fade/Fade.types.d.ts +1 -1
- package/dist/IconButton/IconButton.d.ts +1 -1
- package/dist/IconButton/IconButton.js +6 -6
- package/dist/IconButton/IconButton.types.d.ts +1 -1
- package/dist/Input/Input.types.d.ts +1 -1
- package/dist/Input/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/dist/Input/__tests__/fixtures/A11yDemos.js +7 -7
- package/dist/ItemSelector/ItemSelector.miniapp.js +7 -5
- package/dist/ItemSelector/ItemSelector.types.d.ts +1 -0
- package/dist/ItemSelector/Selector/index.d.ts +1 -1
- package/dist/ItemSelector/Selector/index.js +2 -2
- package/dist/List/List.d.ts +1 -1
- package/dist/List/List.js +4 -4
- package/dist/List/ListContext.d.ts +1 -1
- package/dist/List/ListContext.js +2 -2
- package/dist/List/ListItem.d.ts +1 -1
- package/dist/List/ListItem.js +8 -8
- package/dist/List/ListItem.types.d.ts +1 -1
- package/dist/List/ListItemContent.d.ts +1 -1
- package/dist/List/ListItemContent.js +3 -3
- package/dist/List/ListItemContent.types.d.ts +1 -1
- package/dist/List/ListItemExtra.d.ts +1 -1
- package/dist/List/ListItemExtra.js +3 -3
- package/dist/List/ListItemExtra.types.d.ts +1 -1
- package/dist/List/ListItemFooter.d.ts +1 -1
- package/dist/List/ListItemFooter.js +3 -3
- package/dist/List/ListItemFooter.types.d.ts +1 -1
- package/dist/List/ListItemHeader.d.ts +1 -1
- package/dist/List/ListItemHeader.js +3 -3
- package/dist/List/ListItemHeader.types.d.ts +1 -1
- package/dist/Loading/Loading.d.ts +1 -1
- package/dist/Loading/Loading.js +5 -5
- package/dist/Loading/Loading.types.d.ts +1 -1
- package/dist/Modal/Modal.d.ts +1 -1
- package/dist/Modal/Modal.js +6 -6
- package/dist/Modal/Modal.miniapp.d.ts +1 -1
- package/dist/Modal/Modal.miniapp.js +7 -7
- package/dist/Modal/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/dist/Modal/__tests__/fixtures/A11yDemos.js +3 -3
- package/dist/Modal/useModal.js +26 -29
- package/dist/NavBar/NavBar.d.ts +1 -1
- package/dist/NavBar/NavBar.js +10 -10
- package/dist/Picker/Picker.js +0 -1
- package/dist/Picker/Picker.types.d.ts +1 -1
- package/dist/Picker/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/dist/Picker/__tests__/fixtures/A11yDemos.js +2 -2
- package/dist/Popover/Popover.d.ts +1 -1
- package/dist/Popover/Popover.js +8 -8
- package/dist/Popover/Popover.types.d.ts +1 -1
- package/dist/Popover/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/dist/Popover/__tests__/fixtures/A11yDemos.js +21 -21
- package/dist/Portal/Portal.d.ts +1 -1
- package/dist/Portal/Portal.js +3 -3
- package/dist/Portal/Portal.types.d.ts +1 -1
- package/dist/Progress/Progress.d.ts +1 -1
- package/dist/Progress/Progress.js +4 -4
- package/dist/Progress/Progress.types.d.ts +1 -1
- package/dist/Progress/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/dist/Progress/__tests__/fixtures/A11yDemos.js +9 -9
- package/dist/Radio/RadioButtonIcon.d.ts +1 -1
- package/dist/Radio/RadioButtonIcon.js +4 -4
- package/dist/Radio/RadioContext.d.ts +1 -1
- package/dist/Radio/RadioContext.js +2 -2
- package/dist/Radio/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/dist/Radio/__tests__/fixtures/A11yDemos.js +4 -4
- package/dist/Rating/Rating.types.d.ts +1 -1
- package/dist/ScrollView/ScrollView.types.d.ts +1 -1
- package/dist/ScrollView/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/dist/ScrollView/__tests__/fixtures/A11yDemos.js +30 -30
- package/dist/ScrollView/useScrollView.js +16 -4
- package/dist/Skeleton/Skeleton.d.ts +1 -1
- package/dist/Skeleton/Skeleton.js +3 -3
- package/dist/Skeleton/Skeleton.types.d.ts +1 -1
- package/dist/Slide/Slide.d.ts +1 -1
- package/dist/Slide/Slide.js +4 -4
- package/dist/Slider/Slider.types.d.ts +1 -1
- package/dist/Steps/Step.types.d.ts +1 -1
- package/dist/Steps/StepsContext.d.ts +1 -1
- package/dist/Steps/StepsContext.js +2 -2
- package/dist/SwipeAction/SwipeAction.js +7 -8
- package/dist/SwipeAction/SwipeAction.types.d.ts +1 -1
- package/dist/Swiper/Swiper.types.d.ts +1 -1
- package/dist/Swiper/SwiperItem.d.ts +1 -1
- package/dist/Swiper/SwiperItem.js +2 -2
- package/dist/Switch/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/dist/Switch/__tests__/fixtures/A11yDemos.js +4 -4
- package/dist/TabBar/TabBar.d.ts +1 -1
- package/dist/TabBar/TabBar.js +5 -5
- package/dist/Tabs/Tab.css +1 -24
- package/dist/Tabs/Tab.d.ts +2 -2
- package/dist/Tabs/Tab.js +42 -34
- package/dist/Tabs/Tab.types.d.ts +1 -1
- package/dist/Tabs/TabIndicator.d.ts +13 -0
- package/dist/Tabs/TabIndicator.js +115 -0
- package/dist/Tabs/TabMask.d.ts +9 -0
- package/dist/Tabs/TabMask.js +88 -0
- package/dist/Tabs/TabPanel.types.d.ts +1 -1
- package/dist/Tabs/Tabs.css +15 -5
- package/dist/Tabs/Tabs.js +84 -159
- package/dist/Tabs/Tabs.types.d.ts +5 -6
- package/dist/Tabs/TabsContext.d.ts +15 -6
- package/dist/Tabs/TabsContext.js +6 -14
- package/dist/Tabs/classes.d.ts +10 -0
- package/dist/Tabs/classes.js +54 -0
- package/dist/Tabs/index.css +16 -29
- package/dist/Tabs/index.d.ts +2 -2
- package/dist/Tabs/index.js +4 -4
- package/dist/Tabs/index.miniapp.d.ts +5 -0
- package/dist/Tabs/index.miniapp.js +50 -0
- package/dist/Tabs/miniapp/Tab.d.ts +5 -0
- package/dist/Tabs/miniapp/Tab.js +104 -0
- package/dist/Tabs/miniapp/TabIndicator.d.ts +15 -0
- package/dist/Tabs/miniapp/TabIndicator.js +207 -0
- package/dist/Tabs/miniapp/TabMask.d.ts +13 -0
- package/dist/Tabs/miniapp/TabMask.js +67 -0
- package/dist/Tabs/miniapp/Tabs.d.ts +5 -0
- package/dist/Tabs/miniapp/Tabs.js +261 -0
- package/dist/Tabs/miniapp/TabsContext.d.ts +17 -0
- package/dist/Tabs/miniapp/TabsContext.js +39 -0
- package/dist/Tabs/miniapp/index.d.ts +2 -0
- package/dist/Tabs/miniapp/index.js +41 -0
- package/dist/Tabs/miniapp/scroll.d.ts +21 -0
- package/dist/Tabs/miniapp/scroll.js +52 -0
- package/dist/Tabs/miniapp/utils/queryBatch.d.ts +68 -0
- package/dist/Tabs/miniapp/utils/queryBatch.js +100 -0
- package/dist/Tabs/utils/scroll.js +10 -4
- package/dist/Tag/Tag.d.ts +1 -1
- package/dist/Tag/Tag.js +6 -6
- package/dist/Tag/Tag.types.d.ts +1 -1
- package/dist/Tag/TagGroup.d.ts +1 -1
- package/dist/Tag/TagGroup.js +3 -3
- package/dist/Tag/TagGroup.types.d.ts +1 -1
- package/dist/Tag/__tests__/fixtures/A11yDemos.js +3 -3
- package/dist/TextArea/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/dist/TextArea/__tests__/fixtures/A11yDemos.js +6 -6
- package/dist/ThemeProvider/hooks/ThemeContext.d.ts +1 -1
- package/dist/ThemeProvider/hooks/ThemeContext.js +2 -2
- package/dist/ThemeProvider/hooks/useTheme.js +2 -2
- package/dist/ThemeProvider/utils/mountTokens.js +2 -2
- package/dist/Toast/Toast.d.ts +1 -1
- package/dist/Toast/Toast.js +8 -8
- package/dist/Toast/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/dist/Toast/__tests__/fixtures/A11yDemos.js +2 -2
- package/dist/Tooltip/Tooltip.d.ts +1 -1
- package/dist/Tooltip/Tooltip.js +5 -5
- package/dist/Tooltip/Tooltip.types.d.ts +1 -1
- package/dist/Tooltip/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/dist/Tooltip/__tests__/fixtures/A11yDemos.js +14 -14
- package/dist/Transition/Transition.d.ts +1 -1
- package/dist/Transition/Transition.js +3 -3
- package/dist/Transition/Transition.miniapp.d.ts +1 -1
- package/dist/Transition/Transition.miniapp.js +3 -3
- package/dist/Transition/TransitionCore.js +8 -2
- package/dist/_.._/benchmarks/components/Button.d.js +15 -0
- package/dist/_.._/benchmarks/components/Button.js +2 -2
- package/dist/_.._/benchmarks/components/Input.d.js +15 -0
- package/dist/_.._/benchmarks/components/Tabs.d.js +15 -0
- package/es/ActionSheet/ActionSheet.d.ts +1 -1
- package/es/ActionSheet/ActionSheet.js +1 -1
- package/es/ActionSheet/ActionSheet.types.d.ts +1 -1
- package/es/ActionSheet/ActionSheetContext.d.ts +1 -1
- package/es/ActionSheet/ActionSheetContext.js +1 -1
- package/es/ActionSheet/ActionSheetItem.types.d.ts +1 -1
- package/es/Alert/Alert.d.ts +1 -1
- package/es/Alert/Alert.js +1 -1
- package/es/Alert/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/es/Alert/__tests__/fixtures/A11yDemos.js +1 -1
- package/es/Avatar/Avatar.d.ts +1 -1
- package/es/Avatar/Avatar.js +1 -1
- package/es/Avatar/Avatar.types.d.ts +1 -1
- package/es/Avatar/AvatarGroup.types.d.ts +1 -1
- package/es/Backdrop/Backdrop.d.ts +1 -1
- package/es/Backdrop/Backdrop.js +1 -1
- package/es/Backdrop/Backdrop.types.d.ts +1 -1
- package/es/Backdrop/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/es/Backdrop/__tests__/fixtures/A11yDemos.js +1 -1
- package/es/Badge/Badge.d.ts +1 -1
- package/es/Badge/Badge.js +1 -1
- package/es/Badge/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/es/Badge/__tests__/fixtures/A11yDemos.js +1 -1
- package/es/Breadcrumb/Breadcrumb.d.ts +1 -1
- package/es/Breadcrumb/Breadcrumb.js +1 -1
- package/es/Breadcrumb/Breadcrumb.types.d.ts +1 -1
- package/es/Breadcrumb/BreadcrumbItem.d.ts +1 -1
- package/es/Breadcrumb/BreadcrumbItem.js +1 -1
- package/es/Button/Button.d.ts +1 -1
- package/es/Button/Button.js +1 -1
- package/es/Button/Button.types.d.ts +1 -1
- package/es/Button/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/es/Button/__tests__/fixtures/A11yDemos.js +1 -1
- package/es/Calendar/Calendar.types.d.ts +1 -1
- package/es/Calendar/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/es/Calendar/__tests__/fixtures/A11yDemos.js +1 -1
- package/es/Card/Card.d.ts +1 -1
- package/es/Card/Card.js +1 -1
- package/es/Card/Card.types.d.ts +1 -1
- package/es/Card/CardContent.d.ts +1 -1
- package/es/Card/CardContent.js +1 -1
- package/es/Card/CardContent.types.d.ts +1 -1
- package/es/Card/CardFooter.d.ts +1 -1
- package/es/Card/CardFooter.js +1 -1
- package/es/Card/CardFooter.types.d.ts +1 -1
- package/es/Card/CardHeader.d.ts +1 -1
- package/es/Card/CardHeader.js +1 -1
- package/es/Checkbox/CheckboxContext.d.ts +1 -1
- package/es/Checkbox/CheckboxContext.js +1 -1
- package/es/Checkbox/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/es/Checkbox/__tests__/fixtures/A11yDemos.js +1 -1
- package/es/CitySelector/CitySelector.types.d.ts +1 -0
- package/es/CitySelector/Selector/index.d.ts +1 -1
- package/es/CitySelector/Selector/index.js +1 -1
- package/es/Collapse/Collapse.types.d.ts +1 -1
- package/es/CollapsePanel/CollapsePanel.d.ts +1 -1
- package/es/CollapsePanel/CollapsePanel.js +1 -1
- package/es/CollapsePanel/CollapsePanel.types.d.ts +1 -1
- package/es/CollapsePanel/CollapsePanelItem.d.ts +1 -1
- package/es/CollapsePanel/CollapsePanelItem.js +1 -1
- package/es/Countdown/Countdown.types.d.ts +2 -2
- package/es/Countdown/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/es/Countdown/__tests__/fixtures/A11yDemos.js +1 -1
- package/es/Countdown/utils.d.ts +2 -2
- package/es/Countdown/utils.js +4 -4
- package/es/DatePicker/DatePicker.d.ts +1 -1
- package/es/DatePicker/DatePicker.types.d.ts +1 -1
- package/es/DesktopPicker/DesktopPicker.types.d.ts +1 -1
- package/es/DesktopTimePicker/DesktopTimePicker.types.d.ts +11 -11
- package/es/DesktopTimePicker/useGetTimePickerContent.js +3 -3
- package/es/DesktopTimePicker/utils/utils.d.ts +1 -1
- package/es/DesktopTimePicker/utils/utils.js +2 -2
- package/es/Dialog/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/es/Dialog/__tests__/fixtures/A11yDemos.js +1 -1
- package/es/Divider/Divider.types.d.ts +1 -1
- package/es/Drawer/Drawer.d.ts +1 -1
- package/es/Drawer/Drawer.js +1 -1
- package/es/Drawer/Drawer.types.d.ts +1 -1
- package/es/Fade/Fade.d.ts +1 -1
- package/es/Fade/Fade.js +1 -1
- package/es/Fade/Fade.types.d.ts +1 -1
- package/es/IconButton/IconButton.d.ts +1 -1
- package/es/IconButton/IconButton.js +1 -1
- package/es/IconButton/IconButton.types.d.ts +1 -1
- package/es/Input/Input.types.d.ts +1 -1
- package/es/Input/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/es/Input/__tests__/fixtures/A11yDemos.js +1 -1
- package/es/ItemSelector/ItemSelector.miniapp.js +7 -5
- package/es/ItemSelector/ItemSelector.types.d.ts +1 -0
- package/es/ItemSelector/Selector/index.d.ts +1 -1
- package/es/ItemSelector/Selector/index.js +1 -1
- package/es/List/List.d.ts +1 -1
- package/es/List/List.js +1 -1
- package/es/List/ListContext.d.ts +1 -1
- package/es/List/ListContext.js +1 -1
- package/es/List/ListItem.d.ts +1 -1
- package/es/List/ListItem.js +1 -1
- package/es/List/ListItem.types.d.ts +1 -1
- package/es/List/ListItemContent.d.ts +1 -1
- package/es/List/ListItemContent.js +1 -1
- package/es/List/ListItemContent.types.d.ts +1 -1
- package/es/List/ListItemExtra.d.ts +1 -1
- package/es/List/ListItemExtra.js +1 -1
- package/es/List/ListItemExtra.types.d.ts +1 -1
- package/es/List/ListItemFooter.d.ts +1 -1
- package/es/List/ListItemFooter.js +1 -1
- package/es/List/ListItemFooter.types.d.ts +1 -1
- package/es/List/ListItemHeader.d.ts +1 -1
- package/es/List/ListItemHeader.js +1 -1
- package/es/List/ListItemHeader.types.d.ts +1 -1
- package/es/Loading/Loading.d.ts +1 -1
- package/es/Loading/Loading.js +1 -1
- package/es/Loading/Loading.types.d.ts +1 -1
- package/es/Modal/Modal.d.ts +1 -1
- package/es/Modal/Modal.js +1 -1
- package/es/Modal/Modal.miniapp.d.ts +2 -2
- package/es/Modal/Modal.miniapp.js +1 -1
- package/es/Modal/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/es/Modal/__tests__/fixtures/A11yDemos.js +1 -1
- package/es/Modal/useModal.js +26 -29
- package/es/NavBar/NavBar.d.ts +1 -1
- package/es/NavBar/NavBar.js +1 -1
- package/es/Picker/Picker.js +0 -1
- package/es/Picker/Picker.types.d.ts +1 -1
- package/es/Picker/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/es/Picker/__tests__/fixtures/A11yDemos.js +1 -1
- package/es/Popover/Popover.d.ts +1 -1
- package/es/Popover/Popover.js +1 -1
- package/es/Popover/Popover.types.d.ts +1 -1
- package/es/Popover/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/es/Popover/__tests__/fixtures/A11yDemos.js +1 -1
- package/es/Portal/Portal.d.ts +1 -1
- package/es/Portal/Portal.js +1 -1
- package/es/Portal/Portal.types.d.ts +1 -1
- package/es/Progress/Progress.d.ts +1 -1
- package/es/Progress/Progress.js +1 -1
- package/es/Progress/Progress.types.d.ts +1 -1
- package/es/Progress/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/es/Progress/__tests__/fixtures/A11yDemos.js +1 -1
- package/es/Radio/RadioButtonIcon.d.ts +1 -1
- package/es/Radio/RadioButtonIcon.js +1 -1
- package/es/Radio/RadioContext.d.ts +1 -1
- package/es/Radio/RadioContext.js +1 -1
- package/es/Radio/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/es/Radio/__tests__/fixtures/A11yDemos.js +1 -1
- package/es/Rating/Rating.types.d.ts +1 -1
- package/es/ScrollView/ScrollView.types.d.ts +1 -1
- package/es/ScrollView/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/es/ScrollView/__tests__/fixtures/A11yDemos.js +1 -1
- package/es/ScrollView/useScrollView.js +16 -4
- package/es/Skeleton/Skeleton.d.ts +1 -1
- package/es/Skeleton/Skeleton.js +1 -1
- package/es/Skeleton/Skeleton.types.d.ts +1 -1
- package/es/Slide/Slide.d.ts +1 -1
- package/es/Slide/Slide.js +1 -1
- package/es/Slider/Slider.types.d.ts +1 -1
- package/es/Steps/Step.types.d.ts +1 -1
- package/es/Steps/StepsContext.d.ts +1 -1
- package/es/Steps/StepsContext.js +1 -1
- package/es/SwipeAction/SwipeAction.js +7 -8
- package/es/SwipeAction/SwipeAction.types.d.ts +1 -1
- package/es/Swiper/Swiper.js +5 -1
- package/es/Swiper/Swiper.types.d.ts +1 -1
- package/es/Swiper/SwiperItem.d.ts +1 -1
- package/es/Swiper/SwiperItem.js +1 -1
- package/es/Switch/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/es/Switch/__tests__/fixtures/A11yDemos.js +1 -1
- package/es/TabBar/TabBar.d.ts +1 -1
- package/es/TabBar/TabBar.js +1 -1
- package/es/Tabs/Tab.css +1 -24
- package/es/Tabs/Tab.d.ts +2 -2
- package/es/Tabs/Tab.js +44 -36
- package/es/Tabs/Tab.types.d.ts +1 -1
- package/es/Tabs/TabIndicator.d.ts +13 -0
- package/es/Tabs/TabIndicator.js +86 -0
- package/es/Tabs/TabMask.d.ts +9 -0
- package/es/Tabs/TabMask.js +59 -0
- package/es/Tabs/TabPanel.types.d.ts +1 -1
- package/es/Tabs/Tabs.css +15 -5
- package/es/Tabs/Tabs.js +86 -161
- package/es/Tabs/Tabs.types.d.ts +5 -6
- package/es/Tabs/TabsContext.d.ts +15 -6
- package/es/Tabs/TabsContext.js +6 -4
- package/es/Tabs/classes.d.ts +10 -0
- package/es/Tabs/classes.js +22 -0
- package/es/Tabs/index.css +16 -29
- package/es/Tabs/index.d.ts +2 -2
- package/es/Tabs/index.js +2 -2
- package/es/Tabs/index.miniapp.d.ts +5 -0
- package/es/Tabs/index.miniapp.js +11 -0
- package/es/Tabs/miniapp/Tab.d.ts +5 -0
- package/es/Tabs/miniapp/Tab.js +75 -0
- package/es/Tabs/miniapp/TabIndicator.d.ts +15 -0
- package/es/Tabs/miniapp/TabIndicator.js +178 -0
- package/es/Tabs/miniapp/TabMask.d.ts +13 -0
- package/es/Tabs/miniapp/TabMask.js +38 -0
- package/es/Tabs/miniapp/Tabs.d.ts +5 -0
- package/es/Tabs/miniapp/Tabs.js +239 -0
- package/es/Tabs/miniapp/TabsContext.d.ts +17 -0
- package/es/Tabs/miniapp/TabsContext.js +16 -0
- package/es/Tabs/miniapp/index.d.ts +2 -0
- package/es/Tabs/miniapp/index.js +7 -0
- package/es/Tabs/miniapp/scroll.d.ts +21 -0
- package/es/Tabs/miniapp/scroll.js +29 -0
- package/es/Tabs/miniapp/utils/queryBatch.d.ts +68 -0
- package/es/Tabs/miniapp/utils/queryBatch.js +65 -0
- package/es/Tabs/utils/scroll.js +10 -4
- package/es/Tag/Tag.d.ts +1 -1
- package/es/Tag/Tag.js +4 -4
- package/es/Tag/Tag.types.d.ts +1 -1
- package/es/Tag/TagGroup.d.ts +1 -1
- package/es/Tag/TagGroup.js +1 -1
- package/es/Tag/TagGroup.types.d.ts +1 -1
- package/es/Tag/__tests__/fixtures/A11yDemos.js +3 -3
- package/es/TextArea/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/es/TextArea/__tests__/fixtures/A11yDemos.js +1 -1
- package/es/ThemeProvider/hooks/ThemeContext.d.ts +1 -1
- package/es/ThemeProvider/hooks/ThemeContext.js +1 -1
- package/es/ThemeProvider/hooks/useTheme.js +1 -1
- package/es/ThemeProvider/utils/mountTokens.js +1 -1
- package/es/Toast/Toast.d.ts +1 -1
- package/es/Toast/Toast.js +1 -1
- package/es/Toast/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/es/Toast/__tests__/fixtures/A11yDemos.js +1 -1
- package/es/Tooltip/Tooltip.d.ts +1 -1
- package/es/Tooltip/Tooltip.js +1 -1
- package/es/Tooltip/Tooltip.types.d.ts +1 -1
- package/es/Tooltip/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/es/Tooltip/__tests__/fixtures/A11yDemos.js +1 -1
- package/es/Transition/Transition.d.ts +1 -1
- package/es/Transition/Transition.js +1 -1
- package/es/Transition/Transition.miniapp.d.ts +1 -1
- package/es/Transition/Transition.miniapp.js +1 -1
- package/es/Transition/TransitionCore.js +8 -2
- package/es/_.._/benchmarks/components/Button.d.js +0 -0
- package/es/_.._/benchmarks/components/Button.js +1 -1
- package/es/_.._/benchmarks/components/Input.d.js +0 -0
- package/es/_.._/benchmarks/components/Tabs.d.js +0 -0
- package/package.json +7 -6
package/es/Tabs/TabsContext.d.ts
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TabChangeEvent
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export
|
|
2
|
+
import { TabChangeEvent } from './Tabs.types';
|
|
3
|
+
export interface TabRegisterData {
|
|
4
|
+
value: string;
|
|
5
|
+
ref: React.RefObject<HTMLElement>;
|
|
6
|
+
}
|
|
7
|
+
export interface TabsContextValueType {
|
|
8
|
+
value?: string;
|
|
9
|
+
triggerChange?: TabChangeEvent;
|
|
10
|
+
onRegister?: (data: TabRegisterData) => void;
|
|
11
|
+
onUnregister?: (data: {
|
|
12
|
+
value: string;
|
|
13
|
+
}) => void;
|
|
14
|
+
}
|
|
15
|
+
declare const TabsContext: import("@bifrostui/utils").Context<TabsContextValueType>;
|
|
16
|
+
export declare const TabsContextProvider: React.Provider<TabsContextValueType> & React.FC<React.ProviderProps<TabsContextValueType>>;
|
|
8
17
|
export default TabsContext;
|
package/es/Tabs/TabsContext.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
const TabsContext =
|
|
3
|
-
void 0
|
|
4
|
-
|
|
1
|
+
import { createContext } from "@bifrostui/utils";
|
|
2
|
+
const TabsContext = createContext({
|
|
3
|
+
triggerChange: void 0,
|
|
4
|
+
onRegister: void 0,
|
|
5
|
+
onUnregister: void 0
|
|
6
|
+
});
|
|
5
7
|
if (process.env.NODE_ENV !== "production") {
|
|
6
8
|
TabsContext.displayName = "BuiTabsContext";
|
|
7
9
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const tabsRootClass = "bui-tabs";
|
|
2
|
+
export declare const tabRootClass = "bui-tab";
|
|
3
|
+
export declare const tabsScrollClass: string;
|
|
4
|
+
export declare const tabsScrollWrapperClass: string;
|
|
5
|
+
export declare const tabActiveClass: string;
|
|
6
|
+
export declare const tabDisabledClass: string;
|
|
7
|
+
export declare const tabIndicatorClass: string;
|
|
8
|
+
export declare const tabMaskClass: string;
|
|
9
|
+
export declare const tabMaskLeftClass: string;
|
|
10
|
+
export declare const tabMaskRightClass: string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const tabsRootClass = "bui-tabs";
|
|
2
|
+
const tabRootClass = "bui-tab";
|
|
3
|
+
const tabsScrollClass = `${tabsRootClass}-tabs`;
|
|
4
|
+
const tabsScrollWrapperClass = `${tabsRootClass}-scroll-wrapper`;
|
|
5
|
+
const tabActiveClass = `${tabRootClass}-active`;
|
|
6
|
+
const tabDisabledClass = `${tabRootClass}-disabled`;
|
|
7
|
+
const tabIndicatorClass = `${tabsRootClass}-indicator`;
|
|
8
|
+
const tabMaskClass = `${tabsRootClass}-mask`;
|
|
9
|
+
const tabMaskLeftClass = `${tabMaskClass}-left`;
|
|
10
|
+
const tabMaskRightClass = `${tabMaskClass}-right`;
|
|
11
|
+
export {
|
|
12
|
+
tabActiveClass,
|
|
13
|
+
tabDisabledClass,
|
|
14
|
+
tabIndicatorClass,
|
|
15
|
+
tabMaskClass,
|
|
16
|
+
tabMaskLeftClass,
|
|
17
|
+
tabMaskRightClass,
|
|
18
|
+
tabRootClass,
|
|
19
|
+
tabsRootClass,
|
|
20
|
+
tabsScrollClass,
|
|
21
|
+
tabsScrollWrapperClass
|
|
22
|
+
};
|
package/es/Tabs/index.css
CHANGED
|
@@ -29,6 +29,7 @@ xhs-page {
|
|
|
29
29
|
flex-wrap: nowrap;
|
|
30
30
|
justify-content: flex-start;
|
|
31
31
|
align-items: center;
|
|
32
|
+
white-space: nowrap;
|
|
32
33
|
position: relative;
|
|
33
34
|
overflow-x: scroll;
|
|
34
35
|
scrollbar-width: none;
|
|
@@ -36,15 +37,28 @@ xhs-page {
|
|
|
36
37
|
.bui-tabs-tabs::-webkit-scrollbar {
|
|
37
38
|
display: none;
|
|
38
39
|
}
|
|
40
|
+
.bui-tabs-scroll-wrapper {
|
|
41
|
+
height: 100%;
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-wrap: nowrap;
|
|
44
|
+
justify-content: flex-start;
|
|
45
|
+
align-items: center;
|
|
46
|
+
position: relative;
|
|
47
|
+
min-width: 100%;
|
|
48
|
+
}
|
|
39
49
|
.bui-tabs-indicator {
|
|
40
50
|
position: absolute;
|
|
51
|
+
top: unset;
|
|
52
|
+
bottom: var(--bui-tabs-indicator-bottom, 0);
|
|
53
|
+
left: 0;
|
|
41
54
|
width: var(--bui-tabs-indicator-width);
|
|
42
|
-
bottom: var(--bui-tabs-indicator-bottom);
|
|
43
55
|
height: var(--bui-tabs-indicator-height);
|
|
44
56
|
color: var(--bui-color-primary);
|
|
45
57
|
background: var(--bui-tabs-indicator-bg);
|
|
46
58
|
border-radius: var(--bui-tabs-indicator-border-radius);
|
|
47
59
|
box-shadow: var(--bui-tabs-indicator-box-shadow);
|
|
60
|
+
z-index: 1;
|
|
61
|
+
pointer-events: none;
|
|
48
62
|
}
|
|
49
63
|
.bui-tabs-content {
|
|
50
64
|
padding: var(--bui-spacing-lg);
|
|
@@ -74,12 +88,8 @@ xhs-page {
|
|
|
74
88
|
var(--bui-color-bg-view),
|
|
75
89
|
rgba(255, 255, 255, 0));
|
|
76
90
|
}
|
|
77
|
-
.bui-indicator-invisible {
|
|
78
|
-
visibility: hidden;
|
|
79
|
-
background-color: transparent;
|
|
80
|
-
}
|
|
81
91
|
.bui-tab {
|
|
82
|
-
display: flex;
|
|
92
|
+
display: inline-flex;
|
|
83
93
|
align-items: center;
|
|
84
94
|
justify-content: center;
|
|
85
95
|
white-space: nowrap;
|
|
@@ -99,33 +109,10 @@ xhs-page {
|
|
|
99
109
|
font-weight: var(--bui-font-weight-bold);
|
|
100
110
|
font-family: var(--bui-tab-active-font-family);
|
|
101
111
|
}
|
|
102
|
-
.bui-tab-miniapp-active {
|
|
103
|
-
color: var(--bui-tab-active-color);
|
|
104
|
-
line-height: 1.5;
|
|
105
|
-
font-weight: var(--bui-font-weight-bold);
|
|
106
|
-
position: relative;
|
|
107
|
-
}
|
|
108
|
-
.bui-tab-miniapp-active-line {
|
|
109
|
-
position: absolute;
|
|
110
|
-
bottom: var(--bui-tabs-indicator-bottom);
|
|
111
|
-
left: -12px;
|
|
112
|
-
right: -12px;
|
|
113
|
-
margin: 0 auto !important;
|
|
114
|
-
width: var(--bui-tabs-indicator-width);
|
|
115
|
-
height: var(--bui-tabs-indicator-height);
|
|
116
|
-
transition: all 100ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
|
117
|
-
background: var(--bui-tabs-indicator-bg);
|
|
118
|
-
border-radius: var(--bui-tabs-indicator-border-radius);
|
|
119
|
-
box-shadow: var(--bui-tabs-indicator-box-shadow);
|
|
120
|
-
}
|
|
121
112
|
.bui-tab-disabled {
|
|
122
113
|
opacity: 0.5;
|
|
123
114
|
pointer-events: none;
|
|
124
115
|
}
|
|
125
|
-
.bui-indicator-invisible {
|
|
126
|
-
visibility: hidden;
|
|
127
|
-
background-color: transparent;
|
|
128
|
-
}
|
|
129
116
|
.bui-tabpanel {
|
|
130
117
|
font-family: var(--bui-font-family);
|
|
131
118
|
}
|
package/es/Tabs/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { default as Tab } from './Tab';
|
|
2
|
-
export * from './Tab.types';
|
|
3
2
|
export { default as TabPanel } from './TabPanel';
|
|
4
|
-
export * from './TabPanel.types';
|
|
5
3
|
export { default, default as Tabs } from './Tabs';
|
|
6
4
|
export * from './Tabs.types';
|
|
5
|
+
export * from './Tab.types';
|
|
6
|
+
export * from './TabPanel.types';
|
package/es/Tabs/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { default as default2 } from "./Tab";
|
|
2
|
-
export * from "./Tab.types";
|
|
3
2
|
import { default as default3 } from "./TabPanel";
|
|
4
|
-
export * from "./TabPanel.types";
|
|
5
3
|
import { default as default4, default as default5 } from "./Tabs";
|
|
6
4
|
export * from "./Tabs.types";
|
|
5
|
+
export * from "./Tab.types";
|
|
6
|
+
export * from "./TabPanel.types";
|
|
7
7
|
export {
|
|
8
8
|
default2 as Tab,
|
|
9
9
|
default3 as TabPanel,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as default2, Tab, Tabs } from "./miniapp";
|
|
2
|
+
import { default as default3 } from "./TabPanel";
|
|
3
|
+
export * from "./Tabs.types";
|
|
4
|
+
export * from "./Tab.types";
|
|
5
|
+
export * from "./TabPanel.types";
|
|
6
|
+
export {
|
|
7
|
+
Tab,
|
|
8
|
+
default3 as TabPanel,
|
|
9
|
+
Tabs,
|
|
10
|
+
default2 as default
|
|
11
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import { View } from "@tarojs/components";
|
|
4
|
+
import { useContextSelector } from "@bifrostui/utils";
|
|
5
|
+
import TabsContext from "./TabsContext";
|
|
6
|
+
import { tabRootClass, tabActiveClass, tabDisabledClass } from "../classes";
|
|
7
|
+
import "../Tab.css";
|
|
8
|
+
const Tab = (props) => {
|
|
9
|
+
const {
|
|
10
|
+
className,
|
|
11
|
+
children,
|
|
12
|
+
index,
|
|
13
|
+
disabled = false,
|
|
14
|
+
onClick,
|
|
15
|
+
style
|
|
16
|
+
} = props;
|
|
17
|
+
const isActive = useContextSelector(
|
|
18
|
+
TabsContext,
|
|
19
|
+
(ctx) => ctx.value === index
|
|
20
|
+
);
|
|
21
|
+
const triggerChange = useContextSelector(
|
|
22
|
+
TabsContext,
|
|
23
|
+
(ctx) => ctx.triggerChange
|
|
24
|
+
);
|
|
25
|
+
const onRegister = useContextSelector(TabsContext, (ctx) => ctx.onRegister);
|
|
26
|
+
const onUnregister = useContextSelector(
|
|
27
|
+
TabsContext,
|
|
28
|
+
(ctx) => ctx.onUnregister
|
|
29
|
+
);
|
|
30
|
+
const tabsContainerId = useContextSelector(
|
|
31
|
+
TabsContext,
|
|
32
|
+
(ctx) => ctx.tabsContainerId
|
|
33
|
+
);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (index !== void 0 && index !== null) {
|
|
36
|
+
onRegister == null ? void 0 : onRegister({ value: index });
|
|
37
|
+
}
|
|
38
|
+
return () => {
|
|
39
|
+
if (index !== void 0 && index !== null) {
|
|
40
|
+
onUnregister == null ? void 0 : onUnregister({ value: index });
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}, [onRegister, onUnregister, index]);
|
|
44
|
+
const rootCls = clsx(
|
|
45
|
+
tabRootClass,
|
|
46
|
+
{
|
|
47
|
+
[tabActiveClass]: isActive,
|
|
48
|
+
[tabDisabledClass]: disabled
|
|
49
|
+
},
|
|
50
|
+
className
|
|
51
|
+
);
|
|
52
|
+
const tabId = tabsContainerId ? `${tabsContainerId}-tab-${index}` : void 0;
|
|
53
|
+
return /* @__PURE__ */ React.createElement(
|
|
54
|
+
View,
|
|
55
|
+
{
|
|
56
|
+
id: tabId,
|
|
57
|
+
className: rootCls,
|
|
58
|
+
style,
|
|
59
|
+
onClick: (e) => {
|
|
60
|
+
if (disabled)
|
|
61
|
+
return;
|
|
62
|
+
triggerChange == null ? void 0 : triggerChange(e, { index });
|
|
63
|
+
onClick == null ? void 0 : onClick(e, { index });
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
children
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
Tab.displayName = "BuiTab";
|
|
70
|
+
var Tab_default = /* @__PURE__ */ React.memo(Tab, (prevProps, nextProps) => {
|
|
71
|
+
return prevProps.index === nextProps.index && prevProps.disabled === nextProps.disabled && prevProps.className === nextProps.className && prevProps.children === nextProps.children;
|
|
72
|
+
});
|
|
73
|
+
export {
|
|
74
|
+
Tab_default as default
|
|
75
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface TabIndicatorProps {
|
|
3
|
+
/** 当前选中的 tab 值 */
|
|
4
|
+
currentValue: string;
|
|
5
|
+
/** 已注册的 tabs 值数组(用于生成ID) */
|
|
6
|
+
registeredTabValues: string[];
|
|
7
|
+
/** wrapper 容器的 ID(Tab的父容器) */
|
|
8
|
+
wrapperId: string;
|
|
9
|
+
/** ScrollView 的 ID */
|
|
10
|
+
scrollViewId: string;
|
|
11
|
+
/** 注册版本号,每次 tab 注册/取消注册时递增 */
|
|
12
|
+
registrationVersion: number;
|
|
13
|
+
}
|
|
14
|
+
declare const TabIndicator: React.FC<TabIndicatorProps>;
|
|
15
|
+
export default TabIndicator;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
var __async = (__this, __arguments, generator) => {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
var fulfilled = (value) => {
|
|
4
|
+
try {
|
|
5
|
+
step(generator.next(value));
|
|
6
|
+
} catch (e) {
|
|
7
|
+
reject(e);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var rejected = (value) => {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.throw(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
22
|
+
import clsx from "clsx";
|
|
23
|
+
import Taro from "@tarojs/taro";
|
|
24
|
+
import { View } from "@tarojs/components";
|
|
25
|
+
import { useEventCallback } from "@bifrostui/utils";
|
|
26
|
+
import { tabIndicatorClass } from "../classes";
|
|
27
|
+
import { batchQueryTabs } from "./utils/queryBatch";
|
|
28
|
+
const TabIndicator = ({
|
|
29
|
+
currentValue,
|
|
30
|
+
registeredTabValues,
|
|
31
|
+
wrapperId,
|
|
32
|
+
scrollViewId,
|
|
33
|
+
registrationVersion
|
|
34
|
+
}) => {
|
|
35
|
+
const [transform, setTransform] = useState("translate(0px, 0px)");
|
|
36
|
+
const [visibility, setVisibility] = useState("hidden");
|
|
37
|
+
const animationTimerRef = useRef(null);
|
|
38
|
+
const positionCacheRef = useRef(/* @__PURE__ */ new Map());
|
|
39
|
+
const containerInfoRef = useRef(null);
|
|
40
|
+
const indicatorWidthRef = useRef(24);
|
|
41
|
+
const isInitializedRef = useRef(false);
|
|
42
|
+
const initRetryCountRef = useRef(0);
|
|
43
|
+
const maxInitRetries = 5;
|
|
44
|
+
const updateIndicatorPosition = useEventCallback(() => {
|
|
45
|
+
if (!currentValue || !registeredTabValues.includes(currentValue)) {
|
|
46
|
+
setVisibility("hidden");
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const cachedPosition = positionCacheRef.current.get(currentValue);
|
|
50
|
+
const containerInfo = containerInfoRef.current;
|
|
51
|
+
if (!cachedPosition || !containerInfo) {
|
|
52
|
+
if (!isInitializedRef.current) {
|
|
53
|
+
initializePositions();
|
|
54
|
+
}
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const activeTabLeft = cachedPosition.left;
|
|
58
|
+
const activeTabWidth = cachedPosition.width;
|
|
59
|
+
const indicatorWidth = indicatorWidthRef.current;
|
|
60
|
+
const x = activeTabLeft + (activeTabWidth - indicatorWidth) / 2;
|
|
61
|
+
setTransform(`translate(${x}px, 0px)`);
|
|
62
|
+
setVisibility("visible");
|
|
63
|
+
});
|
|
64
|
+
const initializePositions = useEventCallback(() => __async(void 0, null, function* () {
|
|
65
|
+
try {
|
|
66
|
+
const result = yield batchQueryTabs({
|
|
67
|
+
scrollViewId,
|
|
68
|
+
wrapperId,
|
|
69
|
+
tabValues: registeredTabValues
|
|
70
|
+
});
|
|
71
|
+
const { scrollView, scrollFields, wrapper, indicator, tabs } = result;
|
|
72
|
+
if (!scrollView || !wrapper || !indicator || !scrollFields) {
|
|
73
|
+
if (initRetryCountRef.current < maxInitRetries) {
|
|
74
|
+
initRetryCountRef.current += 1;
|
|
75
|
+
if (animationTimerRef.current) {
|
|
76
|
+
clearTimeout(animationTimerRef.current);
|
|
77
|
+
}
|
|
78
|
+
animationTimerRef.current = setTimeout(() => {
|
|
79
|
+
initializePositions();
|
|
80
|
+
}, 100);
|
|
81
|
+
}
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
containerInfoRef.current = {
|
|
85
|
+
width: scrollView.width,
|
|
86
|
+
scrollWidth: scrollFields.scrollWidth || scrollView.width
|
|
87
|
+
};
|
|
88
|
+
indicatorWidthRef.current = indicator.width;
|
|
89
|
+
const newCache = /* @__PURE__ */ new Map();
|
|
90
|
+
registeredTabValues.forEach((value, index) => {
|
|
91
|
+
const tabRect = tabs[index];
|
|
92
|
+
if (tabRect && tabRect.width > 0) {
|
|
93
|
+
const relativeLeft = tabRect.left - wrapper.left;
|
|
94
|
+
newCache.set(value, {
|
|
95
|
+
left: relativeLeft,
|
|
96
|
+
width: tabRect.width
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
if (newCache.size < registeredTabValues.length) {
|
|
101
|
+
if (initRetryCountRef.current < maxInitRetries) {
|
|
102
|
+
initRetryCountRef.current += 1;
|
|
103
|
+
if (animationTimerRef.current) {
|
|
104
|
+
clearTimeout(animationTimerRef.current);
|
|
105
|
+
}
|
|
106
|
+
animationTimerRef.current = setTimeout(() => {
|
|
107
|
+
initializePositions();
|
|
108
|
+
}, 100);
|
|
109
|
+
}
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
initRetryCountRef.current = 0;
|
|
113
|
+
positionCacheRef.current = newCache;
|
|
114
|
+
isInitializedRef.current = true;
|
|
115
|
+
updateIndicatorPosition();
|
|
116
|
+
} catch (error) {
|
|
117
|
+
console.error("[TabIndicator] \u6279\u91CF\u67E5\u8BE2\u5931\u8D25:", error);
|
|
118
|
+
}
|
|
119
|
+
}));
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
if (registeredTabValues.length === 0) {
|
|
122
|
+
return void 0;
|
|
123
|
+
}
|
|
124
|
+
if (animationTimerRef.current) {
|
|
125
|
+
clearTimeout(animationTimerRef.current);
|
|
126
|
+
}
|
|
127
|
+
isInitializedRef.current = false;
|
|
128
|
+
initRetryCountRef.current = 0;
|
|
129
|
+
Taro.nextTick(() => {
|
|
130
|
+
initializePositions();
|
|
131
|
+
});
|
|
132
|
+
return () => {
|
|
133
|
+
if (animationTimerRef.current) {
|
|
134
|
+
clearTimeout(animationTimerRef.current);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
}, [registrationVersion, initializePositions]);
|
|
138
|
+
useEffect(() => {
|
|
139
|
+
if (!currentValue) {
|
|
140
|
+
setVisibility("hidden");
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
updateIndicatorPosition();
|
|
144
|
+
}, [currentValue, updateIndicatorPosition]);
|
|
145
|
+
useEffect(() => {
|
|
146
|
+
var _a, _b;
|
|
147
|
+
const handleResize = () => {
|
|
148
|
+
isInitializedRef.current = false;
|
|
149
|
+
initRetryCountRef.current = 0;
|
|
150
|
+
positionCacheRef.current.clear();
|
|
151
|
+
Taro.nextTick(() => {
|
|
152
|
+
initializePositions();
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
(_b = (_a = Taro).onWindowResize) == null ? void 0 : _b.call(_a, handleResize);
|
|
156
|
+
return () => {
|
|
157
|
+
var _a2, _b2;
|
|
158
|
+
(_b2 = (_a2 = Taro).offWindowResize) == null ? void 0 : _b2.call(_a2, handleResize);
|
|
159
|
+
};
|
|
160
|
+
}, [initializePositions]);
|
|
161
|
+
return /* @__PURE__ */ React.createElement(
|
|
162
|
+
View,
|
|
163
|
+
{
|
|
164
|
+
id: `${wrapperId}-indicator`,
|
|
165
|
+
className: clsx(tabIndicatorClass),
|
|
166
|
+
style: {
|
|
167
|
+
transition: "transform 0.3s ease-in-out",
|
|
168
|
+
transform,
|
|
169
|
+
visibility
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
);
|
|
173
|
+
};
|
|
174
|
+
TabIndicator.displayName = "BuiTabsIndicator";
|
|
175
|
+
var TabIndicator_default = TabIndicator;
|
|
176
|
+
export {
|
|
177
|
+
TabIndicator_default as default
|
|
178
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface TabMaskProps {
|
|
3
|
+
/** 位置:左侧或右侧 */
|
|
4
|
+
position: 'left' | 'right';
|
|
5
|
+
/** 当前滚动位置 */
|
|
6
|
+
scrollLeft: number;
|
|
7
|
+
/** 容器宽度 */
|
|
8
|
+
containerWidth: number;
|
|
9
|
+
/** 滚动区域总宽度 */
|
|
10
|
+
scrollWidth: number;
|
|
11
|
+
}
|
|
12
|
+
declare const _default: React.NamedExoticComponent<TabMaskProps>;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import { View } from "@tarojs/components";
|
|
4
|
+
import { tabMaskClass, tabMaskLeftClass, tabMaskRightClass } from "../classes";
|
|
5
|
+
const TabMask = ({
|
|
6
|
+
position,
|
|
7
|
+
scrollLeft,
|
|
8
|
+
containerWidth,
|
|
9
|
+
scrollWidth
|
|
10
|
+
}) => {
|
|
11
|
+
const shouldShow = React.useMemo(() => {
|
|
12
|
+
if (position === "left") {
|
|
13
|
+
return scrollLeft > 0;
|
|
14
|
+
}
|
|
15
|
+
const rightRange = Math.abs(scrollWidth - (scrollLeft + containerWidth));
|
|
16
|
+
return rightRange > 1;
|
|
17
|
+
}, [position, scrollLeft, containerWidth, scrollWidth]);
|
|
18
|
+
return /* @__PURE__ */ React.createElement(
|
|
19
|
+
View,
|
|
20
|
+
{
|
|
21
|
+
className: clsx(
|
|
22
|
+
tabMaskClass,
|
|
23
|
+
position === "left" ? tabMaskLeftClass : tabMaskRightClass
|
|
24
|
+
),
|
|
25
|
+
style: {
|
|
26
|
+
opacity: shouldShow ? 1 : 0,
|
|
27
|
+
transition: "opacity 0.1s ease-in-out"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
TabMask.displayName = "BuiTabsMask";
|
|
33
|
+
var TabMask_default = /* @__PURE__ */ React.memo(TabMask, (prevProps, nextProps) => {
|
|
34
|
+
return prevProps.position === nextProps.position && prevProps.scrollLeft === nextProps.scrollLeft && prevProps.containerWidth === nextProps.containerWidth && prevProps.scrollWidth === nextProps.scrollWidth;
|
|
35
|
+
});
|
|
36
|
+
export {
|
|
37
|
+
TabMask_default as default
|
|
38
|
+
};
|