@bifrostui/react 2.0.0-alpha.2 → 2.0.0-alpha.21
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/Button/index.css +2 -3
- 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.miniapp.js +13 -10
- 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.miniapp.js +14 -8
- 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 +210 -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/Slide/Slide.miniapp.js +13 -10
- 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 -23
- 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 +11 -0
- package/dist/Tabs/TabIndicator.js +185 -0
- package/dist/Tabs/TabMask.d.ts +7 -0
- package/dist/Tabs/TabMask.js +47 -0
- package/dist/Tabs/TabPanel.js +4 -4
- package/dist/Tabs/TabPanel.types.d.ts +1 -1
- package/dist/Tabs/Tabs.css +14 -6
- package/dist/Tabs/Tabs.js +99 -157
- 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 +13 -0
- package/dist/Tabs/classes.js +63 -0
- package/dist/Tabs/index.css +15 -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 +106 -0
- package/dist/Tabs/miniapp/TabIndicator.d.ts +15 -0
- package/dist/Tabs/miniapp/TabIndicator.js +301 -0
- package/dist/Tabs/miniapp/Tabs.d.ts +5 -0
- package/dist/Tabs/miniapp/Tabs.js +251 -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.css +0 -1
- 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/Tag/index.css +0 -1
- 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/Button/index.css +2 -3
- 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.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.miniapp.js +14 -11
- 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 +1 -1
- 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.miniapp.js +15 -9
- 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 +210 -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/Slide/Slide.miniapp.js +14 -11
- 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 -23
- 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 +11 -0
- package/es/Tabs/TabIndicator.js +156 -0
- package/es/Tabs/TabMask.d.ts +7 -0
- package/es/Tabs/TabMask.js +18 -0
- package/es/Tabs/TabPanel.js +8 -4
- package/es/Tabs/TabPanel.types.d.ts +1 -1
- package/es/Tabs/Tabs.css +14 -6
- package/es/Tabs/Tabs.js +100 -158
- 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 +13 -0
- package/es/Tabs/classes.js +28 -0
- package/es/Tabs/index.css +15 -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 +77 -0
- package/es/Tabs/miniapp/TabIndicator.d.ts +15 -0
- package/es/Tabs/miniapp/TabIndicator.js +272 -0
- package/es/Tabs/miniapp/Tabs.d.ts +5 -0
- package/es/Tabs/miniapp/Tabs.js +229 -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.css +0 -1
- 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/Tag/index.css +0 -1
- 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
|
@@ -0,0 +1,229 @@
|
|
|
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, { useMemo, useState } from "react";
|
|
22
|
+
import clsx from "clsx";
|
|
23
|
+
import Taro from "@tarojs/taro";
|
|
24
|
+
import { ScrollView } from "@tarojs/components";
|
|
25
|
+
import { useValue, useEventCallback } from "@bifrostui/utils";
|
|
26
|
+
import Tab from "./Tab";
|
|
27
|
+
import TabIndicator from "./TabIndicator";
|
|
28
|
+
import TabMask from "../TabMask";
|
|
29
|
+
import { TabsContextProvider } from "./TabsContext";
|
|
30
|
+
import {
|
|
31
|
+
tabsRootClass,
|
|
32
|
+
tabsScrollClass,
|
|
33
|
+
tabsScrollWrapperClass
|
|
34
|
+
} from "../classes";
|
|
35
|
+
import {
|
|
36
|
+
batchQueryContainerSize,
|
|
37
|
+
batchQueryForScroll
|
|
38
|
+
} from "./utils/queryBatch";
|
|
39
|
+
import "../Tabs.css";
|
|
40
|
+
const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
41
|
+
const {
|
|
42
|
+
children,
|
|
43
|
+
className,
|
|
44
|
+
value,
|
|
45
|
+
defaultValue,
|
|
46
|
+
tabs = [],
|
|
47
|
+
onChange,
|
|
48
|
+
style
|
|
49
|
+
} = props;
|
|
50
|
+
const handleOnChange = useEventCallback(
|
|
51
|
+
(e, data) => {
|
|
52
|
+
onChange == null ? void 0 : onChange(e, { index: data.value });
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
const [currentValue, triggerValueChange] = useValue({
|
|
56
|
+
value,
|
|
57
|
+
defaultValue: defaultValue != null ? defaultValue : "",
|
|
58
|
+
onChange: handleOnChange,
|
|
59
|
+
config: {
|
|
60
|
+
name: "Tabs",
|
|
61
|
+
state: "value"
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
const tabsContainerId = useMemo(
|
|
65
|
+
() => `bui-tabs-${Math.random().toString(36).slice(2, 11)}`,
|
|
66
|
+
[]
|
|
67
|
+
);
|
|
68
|
+
const scrollViewId = `${tabsContainerId}-scroll`;
|
|
69
|
+
const wrapperId = `${tabsContainerId}-wrapper`;
|
|
70
|
+
const [registeredTabValues, setRegisteredTabValues] = useState([]);
|
|
71
|
+
const [registrationVersion, setRegistrationVersion] = useState(0);
|
|
72
|
+
const [scrollLeft, setScrollLeft] = useState(0);
|
|
73
|
+
const [containerWidth, setContainerWidth] = useState(0);
|
|
74
|
+
const [scrollWidth, setScrollWidth] = useState(0);
|
|
75
|
+
const lastScrollLeftRef = React.useRef(0);
|
|
76
|
+
const isFirstScroll = React.useRef(true);
|
|
77
|
+
const [scrollWithAnimation, setScrollWithAnimation] = React.useState(false);
|
|
78
|
+
const isScrollable = scrollWidth > containerWidth;
|
|
79
|
+
if (process.env.NODE_ENV !== "production") {
|
|
80
|
+
if (tabs.length > 0 && React.Children.count(children) > 0) {
|
|
81
|
+
console.warn(
|
|
82
|
+
"BUI Warning: Tabs \u7EC4\u4EF6\u4E0D\u5E94\u8BE5\u540C\u65F6\u4F7F\u7528 tabs \u5C5E\u6027\u548C children\u3002\u8BF7\u53EA\u4F7F\u7528\u5176\u4E2D\u4E00\u79CD\u65B9\u5F0F\u3002\u5F53\u524D\u5C06\u4F18\u5148\u4F7F\u7528 tabs \u5C5E\u6027\uFF0Cchildren \u5C06\u88AB\u5FFD\u7565\u3002"
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const onRegister = useEventCallback((data) => {
|
|
87
|
+
if (data.value !== void 0 && data.value !== null) {
|
|
88
|
+
setRegisteredTabValues((prev) => {
|
|
89
|
+
if (prev.includes(data.value))
|
|
90
|
+
return prev;
|
|
91
|
+
const newValues = [...prev, data.value];
|
|
92
|
+
return newValues;
|
|
93
|
+
});
|
|
94
|
+
setRegistrationVersion((v) => v + 1);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
const onUnregister = useEventCallback((data) => {
|
|
98
|
+
setRegisteredTabValues((prev) => {
|
|
99
|
+
const newValues = prev.filter((v) => v !== data.value);
|
|
100
|
+
return newValues;
|
|
101
|
+
});
|
|
102
|
+
setRegistrationVersion((v) => v + 1);
|
|
103
|
+
});
|
|
104
|
+
const handleClick = useEventCallback(
|
|
105
|
+
(e, item) => {
|
|
106
|
+
const { index, disabled = false } = item;
|
|
107
|
+
if (disabled || [void 0, null].includes(index))
|
|
108
|
+
return;
|
|
109
|
+
if (index !== currentValue) {
|
|
110
|
+
triggerValueChange(e, index);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
const handleScroll = useEventCallback(
|
|
115
|
+
(e) => {
|
|
116
|
+
const { scrollLeft: newScrollLeft, scrollWidth: newScrollWidth } = e.detail;
|
|
117
|
+
lastScrollLeftRef.current = newScrollLeft;
|
|
118
|
+
if (newScrollWidth && newScrollWidth !== scrollWidth) {
|
|
119
|
+
setScrollWidth(newScrollWidth);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
React.useEffect(() => {
|
|
124
|
+
if (!scrollViewId || registeredTabValues.length === 0)
|
|
125
|
+
return;
|
|
126
|
+
Taro.nextTick(() => __async(void 0, null, function* () {
|
|
127
|
+
const { rect, fields } = yield batchQueryContainerSize(scrollViewId);
|
|
128
|
+
if (rect) {
|
|
129
|
+
setContainerWidth(rect.width);
|
|
130
|
+
}
|
|
131
|
+
if (fields) {
|
|
132
|
+
setScrollWidth(fields.scrollWidth || 0);
|
|
133
|
+
}
|
|
134
|
+
}));
|
|
135
|
+
}, [scrollViewId, registrationVersion, registeredTabValues.length]);
|
|
136
|
+
const centerActiveTab = useEventCallback(() => __async(void 0, null, function* () {
|
|
137
|
+
if (!currentValue || registeredTabValues.length === 0) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const { scrollView, scrollFields, wrapper, currentTab } = yield batchQueryForScroll({
|
|
141
|
+
scrollViewId,
|
|
142
|
+
wrapperId,
|
|
143
|
+
currentTabValue: currentValue
|
|
144
|
+
});
|
|
145
|
+
if (!scrollView || !scrollFields || !wrapper || !currentTab || currentTab.width === 0) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const tabLeftRelativeToWrapper = currentTab.left - wrapper.left;
|
|
149
|
+
const tabWidth = currentTab.width;
|
|
150
|
+
const containerViewWidth = scrollView.width;
|
|
151
|
+
const currentScrollWidth = scrollFields.scrollWidth || scrollView.width;
|
|
152
|
+
const targetScrollLeft = tabLeftRelativeToWrapper - (containerViewWidth - tabWidth) / 2;
|
|
153
|
+
const maxScrollDistance = currentScrollWidth - containerViewWidth;
|
|
154
|
+
const finalScrollLeft = Math.max(
|
|
155
|
+
0,
|
|
156
|
+
Math.min(targetScrollLeft, maxScrollDistance)
|
|
157
|
+
);
|
|
158
|
+
setScrollLeft(finalScrollLeft);
|
|
159
|
+
lastScrollLeftRef.current = finalScrollLeft;
|
|
160
|
+
if (isFirstScroll.current) {
|
|
161
|
+
Taro.nextTick(() => {
|
|
162
|
+
setScrollWithAnimation(true);
|
|
163
|
+
});
|
|
164
|
+
isFirstScroll.current = false;
|
|
165
|
+
}
|
|
166
|
+
}));
|
|
167
|
+
React.useEffect(() => {
|
|
168
|
+
if (!currentValue || registeredTabValues.length === 0) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
Taro.nextTick(() => {
|
|
172
|
+
centerActiveTab();
|
|
173
|
+
});
|
|
174
|
+
}, [currentValue, centerActiveTab]);
|
|
175
|
+
React.useEffect(() => {
|
|
176
|
+
if (!currentValue || registeredTabValues.length === 0) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
Taro.nextTick(() => {
|
|
180
|
+
centerActiveTab();
|
|
181
|
+
});
|
|
182
|
+
}, [registrationVersion, centerActiveTab]);
|
|
183
|
+
const contextValue = useMemo(
|
|
184
|
+
() => ({
|
|
185
|
+
value: currentValue,
|
|
186
|
+
triggerChange: handleClick,
|
|
187
|
+
onRegister,
|
|
188
|
+
onUnregister,
|
|
189
|
+
tabsContainerId: wrapperId
|
|
190
|
+
}),
|
|
191
|
+
[currentValue, handleClick, onRegister, onUnregister, wrapperId]
|
|
192
|
+
);
|
|
193
|
+
const renderedTabs = useMemo(() => {
|
|
194
|
+
if (tabs.length > 0) {
|
|
195
|
+
return tabs.map((item) => /* @__PURE__ */ React.createElement(Tab, { key: item.index, index: item == null ? void 0 : item.index, disabled: item == null ? void 0 : item.disabled }, item.title));
|
|
196
|
+
}
|
|
197
|
+
return children;
|
|
198
|
+
}, [tabs, children]);
|
|
199
|
+
return /* @__PURE__ */ React.createElement("div", { className: clsx(tabsRootClass, className), style, ref }, isScrollable && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TabMask, { position: "left" }), /* @__PURE__ */ React.createElement(TabMask, { position: "right" })), /* @__PURE__ */ React.createElement(
|
|
200
|
+
ScrollView,
|
|
201
|
+
{
|
|
202
|
+
id: scrollViewId,
|
|
203
|
+
className: tabsScrollClass,
|
|
204
|
+
scrollX: true,
|
|
205
|
+
scrollWithAnimation,
|
|
206
|
+
scrollLeft,
|
|
207
|
+
onScroll: handleScroll,
|
|
208
|
+
enhanced: true,
|
|
209
|
+
showScrollbar: false,
|
|
210
|
+
enablePassive: true,
|
|
211
|
+
enableFlex: true
|
|
212
|
+
},
|
|
213
|
+
/* @__PURE__ */ React.createElement("div", { id: wrapperId, className: tabsScrollWrapperClass }, /* @__PURE__ */ React.createElement(
|
|
214
|
+
TabIndicator,
|
|
215
|
+
{
|
|
216
|
+
currentValue,
|
|
217
|
+
registeredTabValues,
|
|
218
|
+
wrapperId,
|
|
219
|
+
scrollViewId,
|
|
220
|
+
registrationVersion
|
|
221
|
+
}
|
|
222
|
+
), /* @__PURE__ */ React.createElement(TabsContextProvider, { value: contextValue }, renderedTabs))
|
|
223
|
+
));
|
|
224
|
+
});
|
|
225
|
+
Tabs.displayName = "BuiTabs";
|
|
226
|
+
var Tabs_default = Tabs;
|
|
227
|
+
export {
|
|
228
|
+
Tabs_default as default
|
|
229
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TabChangeEvent } from '../Tabs.types';
|
|
2
|
+
export interface TabRegisterData {
|
|
3
|
+
value: string;
|
|
4
|
+
}
|
|
5
|
+
export interface TabsContextValueType {
|
|
6
|
+
value?: string;
|
|
7
|
+
triggerChange?: TabChangeEvent;
|
|
8
|
+
onRegister?: (data: TabRegisterData) => void;
|
|
9
|
+
onUnregister?: (data: {
|
|
10
|
+
value: string;
|
|
11
|
+
}) => void;
|
|
12
|
+
/** 容器的唯一ID,用于生成子元素ID */
|
|
13
|
+
tabsContainerId?: string;
|
|
14
|
+
}
|
|
15
|
+
declare const TabsContext: import("@bifrostui/utils").Context<TabsContextValueType>;
|
|
16
|
+
export declare const TabsContextProvider: import("react").Provider<TabsContextValueType> & import("react").FC<import("react").ProviderProps<TabsContextValueType>>;
|
|
17
|
+
export default TabsContext;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createContext } from "@bifrostui/utils";
|
|
2
|
+
const TabsContext = createContext({
|
|
3
|
+
triggerChange: void 0,
|
|
4
|
+
onRegister: void 0,
|
|
5
|
+
onUnregister: void 0,
|
|
6
|
+
tabsContainerId: void 0
|
|
7
|
+
});
|
|
8
|
+
if (process.env.NODE_ENV !== "production") {
|
|
9
|
+
TabsContext.displayName = "BuiTabsContext";
|
|
10
|
+
}
|
|
11
|
+
const TabsContextProvider = TabsContext.Provider;
|
|
12
|
+
var TabsContext_default = TabsContext;
|
|
13
|
+
export {
|
|
14
|
+
TabsContextProvider,
|
|
15
|
+
TabsContext_default as default
|
|
16
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 小程序版scroll-view滚动到指定位置
|
|
3
|
+
* 使用scroll-left属性和scroll-with-animation实现平滑滚动
|
|
4
|
+
*/
|
|
5
|
+
interface ScrollToOptions {
|
|
6
|
+
scrollViewId: string;
|
|
7
|
+
scrollLeft: number;
|
|
8
|
+
duration?: number;
|
|
9
|
+
}
|
|
10
|
+
declare const scrollLeftTo: ({ scrollViewId, scrollLeft, duration, }: ScrollToOptions) => Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* 计算将目标元素滚动到视图中心所需的 scrollLeft 值
|
|
13
|
+
*/
|
|
14
|
+
interface CalcCenterScrollOptions {
|
|
15
|
+
containerWidth: number;
|
|
16
|
+
targetLeft: number;
|
|
17
|
+
targetWidth: number;
|
|
18
|
+
currentScrollLeft?: number;
|
|
19
|
+
}
|
|
20
|
+
export declare const calcCenterScroll: ({ containerWidth, targetLeft, targetWidth, currentScrollLeft, }: CalcCenterScrollOptions) => number;
|
|
21
|
+
export default scrollLeftTo;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const scrollLeftTo = ({
|
|
2
|
+
scrollViewId,
|
|
3
|
+
scrollLeft,
|
|
4
|
+
duration = 300
|
|
5
|
+
}) => {
|
|
6
|
+
return new Promise((resolve) => {
|
|
7
|
+
if (duration > 0) {
|
|
8
|
+
setTimeout(resolve, duration);
|
|
9
|
+
} else {
|
|
10
|
+
resolve();
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
const calcCenterScroll = ({
|
|
15
|
+
containerWidth,
|
|
16
|
+
targetLeft,
|
|
17
|
+
targetWidth,
|
|
18
|
+
currentScrollLeft = 0
|
|
19
|
+
}) => {
|
|
20
|
+
const targetCenter = targetLeft + targetWidth / 2;
|
|
21
|
+
const containerCenter = containerWidth / 2;
|
|
22
|
+
const scrollLeft = targetCenter - containerCenter;
|
|
23
|
+
return Math.max(0, scrollLeft);
|
|
24
|
+
};
|
|
25
|
+
var scroll_default = scrollLeftTo;
|
|
26
|
+
export {
|
|
27
|
+
calcCenterScroll,
|
|
28
|
+
scroll_default as default
|
|
29
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import Taro from '@tarojs/taro';
|
|
2
|
+
/**
|
|
3
|
+
* Fields查询结果(包含scrollWidth)
|
|
4
|
+
*/
|
|
5
|
+
export interface ScrollFieldsResult {
|
|
6
|
+
scrollWidth?: number;
|
|
7
|
+
scrollHeight?: number;
|
|
8
|
+
scrollLeft?: number;
|
|
9
|
+
scrollTop?: number;
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* 批量查询结果接口
|
|
14
|
+
*/
|
|
15
|
+
export interface BatchQueryResult {
|
|
16
|
+
scrollView: Taro.NodesRef.BoundingClientRectCallbackResult | null;
|
|
17
|
+
scrollInfo: Taro.NodesRef.ScrollOffsetCallbackResult | null;
|
|
18
|
+
scrollFields: ScrollFieldsResult | null;
|
|
19
|
+
wrapper: Taro.NodesRef.BoundingClientRectCallbackResult | null;
|
|
20
|
+
indicator: Taro.NodesRef.BoundingClientRectCallbackResult | null;
|
|
21
|
+
tabs: (Taro.NodesRef.BoundingClientRectCallbackResult | null)[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 批量查询Tab相关元素
|
|
25
|
+
* 优化:一次性查询所有需要的DOM信息,减少查询次数
|
|
26
|
+
*
|
|
27
|
+
* @param scrollViewId - ScrollView的ID
|
|
28
|
+
* @param wrapperId - Wrapper容器的ID
|
|
29
|
+
* @param tabValues - 需要查询的Tab值数组
|
|
30
|
+
* @returns Promise<BatchQueryResult>
|
|
31
|
+
*/
|
|
32
|
+
export declare const batchQueryTabs: (params: {
|
|
33
|
+
scrollViewId: string;
|
|
34
|
+
wrapperId: string;
|
|
35
|
+
tabValues: string[];
|
|
36
|
+
}) => Promise<BatchQueryResult>;
|
|
37
|
+
/**
|
|
38
|
+
* 简化版批量查询(用于Tabs组件的居中滚动)
|
|
39
|
+
* 只查询必要的元素:ScrollView、Wrapper、当前Tab
|
|
40
|
+
*
|
|
41
|
+
* @param scrollViewId - ScrollView的ID
|
|
42
|
+
* @param wrapperId - Wrapper容器的ID
|
|
43
|
+
* @param currentTabValue - 当前Tab的值
|
|
44
|
+
* @returns Promise
|
|
45
|
+
*/
|
|
46
|
+
export declare const batchQueryForScroll: (params: {
|
|
47
|
+
scrollViewId: string;
|
|
48
|
+
wrapperId: string;
|
|
49
|
+
currentTabValue: string;
|
|
50
|
+
}) => Promise<{
|
|
51
|
+
scrollView: Taro.NodesRef.BoundingClientRectCallbackResult | null;
|
|
52
|
+
scrollInfo: Taro.NodesRef.ScrollOffsetCallbackResult | null;
|
|
53
|
+
scrollFields: ScrollFieldsResult | null;
|
|
54
|
+
wrapper: Taro.NodesRef.BoundingClientRectCallbackResult | null;
|
|
55
|
+
currentTab: Taro.NodesRef.BoundingClientRectCallbackResult | null;
|
|
56
|
+
}>;
|
|
57
|
+
/**
|
|
58
|
+
* 简化版批量查询(用于初始化容器尺寸)
|
|
59
|
+
* 只查询ScrollView的尺寸和滚动信息
|
|
60
|
+
*
|
|
61
|
+
* @param scrollViewId - ScrollView的ID
|
|
62
|
+
* @returns Promise
|
|
63
|
+
*/
|
|
64
|
+
export declare const batchQueryContainerSize: (scrollViewId: string) => Promise<{
|
|
65
|
+
rect: Taro.NodesRef.BoundingClientRectCallbackResult | null;
|
|
66
|
+
scroll: Taro.NodesRef.ScrollOffsetCallbackResult | null;
|
|
67
|
+
fields: ScrollFieldsResult | null;
|
|
68
|
+
}>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import Taro from "@tarojs/taro";
|
|
2
|
+
const batchQueryTabs = (params) => {
|
|
3
|
+
const { scrollViewId, wrapperId, tabValues } = params;
|
|
4
|
+
return new Promise((resolve) => {
|
|
5
|
+
const query = Taro.createSelectorQuery();
|
|
6
|
+
query.select(`#${scrollViewId}`).boundingClientRect();
|
|
7
|
+
query.select(`#${scrollViewId}`).scrollOffset();
|
|
8
|
+
query.select(`#${scrollViewId}`).fields({ scrollOffset: true, size: true }, null);
|
|
9
|
+
query.select(`#${wrapperId}`).boundingClientRect();
|
|
10
|
+
query.select(`#${wrapperId}-indicator`).boundingClientRect();
|
|
11
|
+
tabValues.forEach((value) => {
|
|
12
|
+
query.select(`#${wrapperId}-tab-${value}`).boundingClientRect();
|
|
13
|
+
});
|
|
14
|
+
query.exec((res) => {
|
|
15
|
+
resolve({
|
|
16
|
+
scrollView: res[0] || null,
|
|
17
|
+
scrollInfo: res[1] || null,
|
|
18
|
+
scrollFields: res[2] || null,
|
|
19
|
+
wrapper: res[3] || null,
|
|
20
|
+
indicator: res[4] || null,
|
|
21
|
+
tabs: res.slice(5)
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
const batchQueryForScroll = (params) => {
|
|
27
|
+
const { scrollViewId, wrapperId, currentTabValue } = params;
|
|
28
|
+
return new Promise((resolve) => {
|
|
29
|
+
const query = Taro.createSelectorQuery();
|
|
30
|
+
query.select(`#${scrollViewId}`).boundingClientRect();
|
|
31
|
+
query.select(`#${scrollViewId}`).scrollOffset();
|
|
32
|
+
query.select(`#${scrollViewId}`).fields({ scrollOffset: true, size: true }, null);
|
|
33
|
+
query.select(`#${wrapperId}`).boundingClientRect();
|
|
34
|
+
query.select(`#${wrapperId}-tab-${currentTabValue}`).boundingClientRect();
|
|
35
|
+
query.exec((res) => {
|
|
36
|
+
resolve({
|
|
37
|
+
scrollView: res[0] || null,
|
|
38
|
+
scrollInfo: res[1] || null,
|
|
39
|
+
scrollFields: res[2] || null,
|
|
40
|
+
wrapper: res[3] || null,
|
|
41
|
+
currentTab: res[4] || null
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
const batchQueryContainerSize = (scrollViewId) => {
|
|
47
|
+
return new Promise((resolve) => {
|
|
48
|
+
const query = Taro.createSelectorQuery();
|
|
49
|
+
query.select(`#${scrollViewId}`).boundingClientRect();
|
|
50
|
+
query.select(`#${scrollViewId}`).scrollOffset();
|
|
51
|
+
query.select(`#${scrollViewId}`).fields({ scrollOffset: true, size: true }, null);
|
|
52
|
+
query.exec((res) => {
|
|
53
|
+
resolve({
|
|
54
|
+
rect: res[0] || null,
|
|
55
|
+
scroll: res[1] || null,
|
|
56
|
+
fields: res[2] || null
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
export {
|
|
62
|
+
batchQueryContainerSize,
|
|
63
|
+
batchQueryForScroll,
|
|
64
|
+
batchQueryTabs
|
|
65
|
+
};
|
package/es/Tabs/utils/scroll.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const root = window
|
|
2
|
-
let rafId;
|
|
1
|
+
const root = typeof window !== "undefined" ? window : global;
|
|
3
2
|
let prev = Date.now();
|
|
3
|
+
const rafIdMap = /* @__PURE__ */ new WeakMap();
|
|
4
4
|
const rafPolyfill = (fn) => {
|
|
5
5
|
const curr = Date.now();
|
|
6
6
|
const ms = Math.max(0, 16 - (curr - prev));
|
|
@@ -17,7 +17,10 @@ const raf = (fn) => {
|
|
|
17
17
|
return requestAnimationFrame.call(root, fn);
|
|
18
18
|
};
|
|
19
19
|
const scrollLeftTo = (scroller, to, duration) => {
|
|
20
|
-
|
|
20
|
+
const existingRafId = rafIdMap.get(scroller);
|
|
21
|
+
if (existingRafId !== void 0) {
|
|
22
|
+
cancelRaf(existingRafId);
|
|
23
|
+
}
|
|
21
24
|
let count = 0;
|
|
22
25
|
const from = scroller.scrollLeft;
|
|
23
26
|
const frames = duration === 0 ? 1 : Math.round(duration / 16);
|
|
@@ -25,7 +28,10 @@ const scrollLeftTo = (scroller, to, duration) => {
|
|
|
25
28
|
scroller.scrollLeft += (to - from) / frames;
|
|
26
29
|
count += 1;
|
|
27
30
|
if (count < frames) {
|
|
28
|
-
|
|
31
|
+
const newRafId = raf(animate);
|
|
32
|
+
rafIdMap.set(scroller, newRafId);
|
|
33
|
+
} else {
|
|
34
|
+
rafIdMap.delete(scroller);
|
|
29
35
|
}
|
|
30
36
|
}
|
|
31
37
|
animate();
|
package/es/Tag/Tag.css
CHANGED
package/es/Tag/Tag.d.ts
CHANGED
package/es/Tag/Tag.js
CHANGED
|
@@ -28,7 +28,7 @@ var __objRest = (source, exclude) => {
|
|
|
28
28
|
};
|
|
29
29
|
import { convertHexToRGBA } from "@bifrostui/utils";
|
|
30
30
|
import clsx from "clsx";
|
|
31
|
-
import React from "react";
|
|
31
|
+
import * as React from "react";
|
|
32
32
|
import "./Tag.css";
|
|
33
33
|
const colorHandler = (color, opacity = 1) => {
|
|
34
34
|
if (color.includes("rgba")) {
|
|
@@ -36,9 +36,9 @@ const colorHandler = (color, opacity = 1) => {
|
|
|
36
36
|
return `${color.slice(0, lastCommaIndex)}, ${opacity})`;
|
|
37
37
|
}
|
|
38
38
|
if (color.includes("rgb")) {
|
|
39
|
-
|
|
40
|
-
const len =
|
|
41
|
-
return `${
|
|
39
|
+
const rgbaColor = color.replace("rgb", "rgba");
|
|
40
|
+
const len = rgbaColor.length;
|
|
41
|
+
return `${rgbaColor.slice(0, len - 1)}, ${opacity})`;
|
|
42
42
|
}
|
|
43
43
|
return convertHexToRGBA(color, opacity);
|
|
44
44
|
};
|
package/es/Tag/Tag.types.d.ts
CHANGED
package/es/Tag/TagGroup.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { TagGroupProps } from './TagGroup.types';
|
|
3
3
|
import './TagGroup.less';
|
|
4
4
|
declare const TagGroup: React.ForwardRefExoticComponent<Omit<TagGroupProps<"div", {}>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
package/es/Tag/TagGroup.js
CHANGED
|
@@ -27,7 +27,7 @@ var __objRest = (source, exclude) => {
|
|
|
27
27
|
return target;
|
|
28
28
|
};
|
|
29
29
|
import clsx from "clsx";
|
|
30
|
-
import React from "react";
|
|
30
|
+
import * as React from "react";
|
|
31
31
|
import "./TagGroup.css";
|
|
32
32
|
const prefixCls = "bui-tag-group";
|
|
33
33
|
const TagGroup = /* @__PURE__ */ React.forwardRef(
|
|
@@ -23,7 +23,7 @@ const basicTagDemo = () => {
|
|
|
23
23
|
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Tag, { color: "primary" }, "\u4E3B\u8981\u6807\u7B7E"), /* @__PURE__ */ React.createElement(Tag, { color: "success" }, "\u6210\u529F\u6807\u7B7E"), /* @__PURE__ */ React.createElement(Tag, { color: "warning" }, "\u8B66\u544A\u6807\u7B7E"), /* @__PURE__ */ React.createElement(Tag, { color: "danger" }, "\u5371\u9669\u6807\u7B7E"), /* @__PURE__ */ React.createElement(Tag, { color: "info" }, "\u4FE1\u606F\u6807\u7B7E"), /* @__PURE__ */ React.createElement(Tag, { color: "neutral" }, "\u4E2D\u6027\u6807\u7B7E"));
|
|
24
24
|
};
|
|
25
25
|
const variantTagDemo = () => {
|
|
26
|
-
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Tag, { variant: "
|
|
26
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Tag, { variant: "contained", color: "primary" }, "\u586B\u5145\u6807\u7B7E"), /* @__PURE__ */ React.createElement(Tag, { variant: "outlined", color: "success" }, "\u8FB9\u6846\u6807\u7B7E"), /* @__PURE__ */ React.createElement(Tag, { variant: "subtle", color: "warning" }, "\u8F7B\u91CF\u6807\u7B7E"));
|
|
27
27
|
};
|
|
28
28
|
const ClickableTagDemo = () => {
|
|
29
29
|
const [clicked, setClicked] = useState([]);
|
|
@@ -69,7 +69,7 @@ const ClickableTagDemo = () => {
|
|
|
69
69
|
), clicked.length > 0 && /* @__PURE__ */ React.createElement("p", null, "\u5DF2\u70B9\u51FB\u7684\u6807\u7B7E: ", clicked.join(", ")));
|
|
70
70
|
};
|
|
71
71
|
const customColorTagDemo = () => {
|
|
72
|
-
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Tag, { htmlColor: "#ff6b6b", variant: "
|
|
72
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Tag, { htmlColor: "#ff6b6b", variant: "contained" }, "\u81EA\u5B9A\u4E49\u7EA2\u8272"), /* @__PURE__ */ React.createElement(Tag, { htmlColor: "#4ecdc4", variant: "outlined" }, "\u81EA\u5B9A\u4E49\u9752\u8272"), /* @__PURE__ */ React.createElement(Tag, { htmlColor: "#45b7d1", variant: "subtle" }, "\u81EA\u5B9A\u4E49\u84DD\u8272"), /* @__PURE__ */ React.createElement(Tag, { htmlColor: "rgb(255, 193, 7)", variant: "contained" }, "RGB \u9EC4\u8272"));
|
|
73
73
|
};
|
|
74
74
|
const ariaLabelTagDemo = () => {
|
|
75
75
|
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
|
|
@@ -115,7 +115,7 @@ const ComplexTagListDemo = () => {
|
|
|
115
115
|
{
|
|
116
116
|
key: tag.id,
|
|
117
117
|
color: tag.color,
|
|
118
|
-
variant: tag.active ? "
|
|
118
|
+
variant: tag.active ? "contained" : "outlined",
|
|
119
119
|
onClick: () => toggleTag(tag.id),
|
|
120
120
|
"aria-label": `${tag.active ? "\u53D6\u6D88\u9009\u62E9" : "\u9009\u62E9"} ${tag.name} \u6280\u672F\u6807\u7B7E`,
|
|
121
121
|
style: {
|
package/es/Tag/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import * as React from "react";
|
|
2
2
|
import TextArea from "../../TextArea";
|
|
3
3
|
const basicTextAreaDemo = () => {
|
|
4
4
|
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(TextArea, { placeholder: "\u8BF7\u8F93\u5165\u5185\u5BB9" }));
|
package/es/Toast/Toast.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { ToastProps } from './Toast.types';
|
|
3
3
|
import './index.less';
|
|
4
4
|
declare const ToastComponent: React.ForwardRefExoticComponent<Omit<Omit<Omit<ToastProps, "onClose">, "container">, "ref"> & React.RefAttributes<HTMLDivElement>>;
|