@bifrostui/react 2.0.0-alpha.2 → 2.0.0-alpha.20
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 +15 -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 +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 +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 +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.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 +15 -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 +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 +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
|
@@ -114,7 +114,7 @@ const SwipeAction = /* @__PURE__ */ import_react.default.forwardRef(
|
|
|
114
114
|
const startingX = (0, import_react.useRef)(0);
|
|
115
115
|
const currentX = (0, import_react.useRef)(0);
|
|
116
116
|
const isDragging = (0, import_react.useRef)(false);
|
|
117
|
-
let
|
|
117
|
+
let preTranslateX = 0;
|
|
118
118
|
let dragPhase = import_constants.DragPhaseEnum.START;
|
|
119
119
|
const dragThreshold = 5;
|
|
120
120
|
const leftWidthCache = (0, import_react.useRef)(0);
|
|
@@ -181,11 +181,11 @@ const SwipeAction = /* @__PURE__ */ import_react.default.forwardRef(
|
|
|
181
181
|
100
|
|
182
182
|
);
|
|
183
183
|
const emitActionsReveal = (targetX, stop = false) => {
|
|
184
|
-
const isSpecial = targetX ===
|
|
185
|
-
if (targetX ===
|
|
184
|
+
const isSpecial = targetX === preTranslateX && targetX !== 0;
|
|
185
|
+
if (targetX === preTranslateX && !isSpecial || stop)
|
|
186
186
|
return;
|
|
187
187
|
let resStr = null;
|
|
188
|
-
const shouldOpen = targetX > 0 &&
|
|
188
|
+
const shouldOpen = targetX > 0 && preTranslateX <= 0 || targetX < 0 && preTranslateX >= 0 || isSpecial;
|
|
189
189
|
if (shouldOpen) {
|
|
190
190
|
if (targetX > 0) {
|
|
191
191
|
resStr = import_constants.SideTypeEnum.LEFT;
|
|
@@ -220,15 +220,14 @@ const SwipeAction = /* @__PURE__ */ import_react.default.forwardRef(
|
|
|
220
220
|
}
|
|
221
221
|
if (dragPhase === import_constants.DragPhaseEnum.END || import_utils.isMini) {
|
|
222
222
|
emitActionsReveal(targetX);
|
|
223
|
-
console.log("handleTouchEnd\uFF1A", targetX, e);
|
|
224
223
|
setTranslateX(targetX);
|
|
225
|
-
|
|
224
|
+
preTranslateX = targetX;
|
|
226
225
|
}
|
|
227
226
|
currentX.current = 0;
|
|
228
227
|
});
|
|
229
228
|
const close = () => {
|
|
230
229
|
setTranslateX(0);
|
|
231
|
-
|
|
230
|
+
preTranslateX = 0;
|
|
232
231
|
setIsOpen(false);
|
|
233
232
|
};
|
|
234
233
|
(0, import_react.useEffect)(() => {
|
|
@@ -272,7 +271,7 @@ const SwipeAction = /* @__PURE__ */ import_react.default.forwardRef(
|
|
|
272
271
|
targetX = yield getLefRefWidth();
|
|
273
272
|
}
|
|
274
273
|
setTranslateX(targetX);
|
|
275
|
-
|
|
274
|
+
preTranslateX = targetX;
|
|
276
275
|
emitActionsReveal(targetX);
|
|
277
276
|
}),
|
|
278
277
|
close,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OverrideProps, ThemeColor } from '@bifrostui/types';
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
import { SideTypeEnum } from './constants';
|
|
4
4
|
export type SwipeActionProps<D extends React.ElementType = 'div', P = {}> = OverrideProps<{
|
|
5
5
|
props: P & {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OverrideProps } from '@bifrostui/types';
|
|
2
2
|
import { SwiperProps as SwiperPropsH5 } from 'swiper/react';
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import * as React from 'react';
|
|
4
4
|
export type SwiperProps<D extends React.ElementType = 'div', P = {}> = OverrideProps<{
|
|
5
5
|
props: P & SwiperPropsH5 & {
|
|
6
6
|
/** 是否显示面板指示点
|
|
@@ -58,11 +58,11 @@ __export(SwiperItem_exports, {
|
|
|
58
58
|
module.exports = __toCommonJS(SwiperItem_exports);
|
|
59
59
|
var import_react = require("swiper/react");
|
|
60
60
|
var import_clsx = __toESM(require("clsx"));
|
|
61
|
-
var
|
|
61
|
+
var React = __toESM(require("react"));
|
|
62
62
|
const SwiperItem = (props) => {
|
|
63
63
|
const _a = props, { className, style, children } = _a, restProps = __objRest(_a, ["className", "style", "children"]);
|
|
64
64
|
const cls = (0, import_clsx.default)("swiper-slide", className);
|
|
65
|
-
return /* @__PURE__ */
|
|
65
|
+
return /* @__PURE__ */ React.createElement(import_react.SwiperSlide, __spreadValues({ className: cls, style }, restProps), children);
|
|
66
66
|
};
|
|
67
67
|
SwiperItem.displayName = "BuiSwiperItem-SwiperSlide";
|
|
68
68
|
var SwiperItem_default = SwiperItem;
|
|
@@ -33,16 +33,16 @@ __export(A11yDemos_exports, {
|
|
|
33
33
|
disabledSwitchDemo: () => disabledSwitchDemo
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(A11yDemos_exports);
|
|
36
|
-
var
|
|
36
|
+
var React = __toESM(require("react"));
|
|
37
37
|
var import_Switch = __toESM(require("../../Switch"));
|
|
38
38
|
const basicSwitchDemo = () => {
|
|
39
|
-
return /* @__PURE__ */
|
|
39
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("label", null, /* @__PURE__ */ React.createElement(import_Switch.default, null), "Switch"));
|
|
40
40
|
};
|
|
41
41
|
const disabledSwitchDemo = () => {
|
|
42
|
-
return /* @__PURE__ */
|
|
42
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("label", null, /* @__PURE__ */ React.createElement(import_Switch.default, { disabled: true }), "Switch"));
|
|
43
43
|
};
|
|
44
44
|
const ariaLabelSwitchDemo = () => {
|
|
45
|
-
return /* @__PURE__ */
|
|
45
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(import_Switch.default, { inputProps: { "aria-label": "\u5F00\u5173" } }, "Switch"));
|
|
46
46
|
};
|
|
47
47
|
var A11yDemos_default = {
|
|
48
48
|
basicSwitchDemo,
|
package/dist/TabBar/TabBar.d.ts
CHANGED
package/dist/TabBar/TabBar.js
CHANGED
|
@@ -56,12 +56,12 @@ __export(TabBar_exports, {
|
|
|
56
56
|
default: () => TabBar_default
|
|
57
57
|
});
|
|
58
58
|
module.exports = __toCommonJS(TabBar_exports);
|
|
59
|
-
var
|
|
59
|
+
var React = __toESM(require("react"));
|
|
60
60
|
var import_clsx = __toESM(require("clsx"));
|
|
61
61
|
var import_TabBarContext = __toESM(require("./TabBarContext"));
|
|
62
62
|
var import_TabBar = require("./TabBar.css");
|
|
63
63
|
const prefixCls = "bui-tab-bar";
|
|
64
|
-
const TabBar = /* @__PURE__ */
|
|
64
|
+
const TabBar = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
65
65
|
const _a = props || {}, {
|
|
66
66
|
current = 0,
|
|
67
67
|
activeColor = "primary",
|
|
@@ -77,7 +77,7 @@ const TabBar = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
|
|
|
77
77
|
"className",
|
|
78
78
|
"onChange"
|
|
79
79
|
]);
|
|
80
|
-
return /* @__PURE__ */
|
|
80
|
+
return /* @__PURE__ */ React.createElement(
|
|
81
81
|
import_TabBarContext.default.Provider,
|
|
82
82
|
{
|
|
83
83
|
value: {
|
|
@@ -87,9 +87,9 @@ const TabBar = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
|
|
|
87
87
|
onChange
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
|
-
/* @__PURE__ */
|
|
90
|
+
/* @__PURE__ */ React.createElement("div", __spreadValues({ ref, className: (0, import_clsx.default)(`${prefixCls}`, className) }, others), React.Children.toArray(children).map(
|
|
91
91
|
(item, index) => {
|
|
92
|
-
return
|
|
92
|
+
return React.cloneElement(item, {
|
|
93
93
|
index
|
|
94
94
|
});
|
|
95
95
|
}
|
package/dist/Tabs/Tab.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.bui-tab {
|
|
2
|
-
display: flex;
|
|
2
|
+
display: inline-flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: center;
|
|
5
5
|
white-space: nowrap;
|
|
@@ -17,30 +17,8 @@
|
|
|
17
17
|
.bui-tab-active {
|
|
18
18
|
color: var(--bui-tab-active-color);
|
|
19
19
|
font-weight: var(--bui-font-weight-bold);
|
|
20
|
-
font-family: var(--bui-tab-active-font-family);
|
|
21
|
-
}
|
|
22
|
-
.bui-tab-miniapp-active {
|
|
23
|
-
color: var(--bui-tab-active-color);
|
|
24
|
-
line-height: 1.5;
|
|
25
|
-
font-weight: var(--bui-font-weight-bold);
|
|
26
|
-
position: relative;
|
|
27
|
-
}
|
|
28
|
-
.bui-tab-miniapp-active-line {
|
|
29
|
-
position: absolute;
|
|
30
|
-
bottom: 0;
|
|
31
|
-
left: -12px;
|
|
32
|
-
right: -12px;
|
|
33
|
-
margin: 0 auto !important;
|
|
34
|
-
width: 18px;
|
|
35
|
-
height: 2px;
|
|
36
|
-
transition: all 100ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
|
37
|
-
background-color: var(--bui-color-primary);
|
|
38
20
|
}
|
|
39
21
|
.bui-tab-disabled {
|
|
40
22
|
opacity: 0.5;
|
|
41
23
|
pointer-events: none;
|
|
42
24
|
}
|
|
43
|
-
.bui-indicator-invisible {
|
|
44
|
-
visibility: hidden;
|
|
45
|
-
background-color: transparent;
|
|
46
|
-
}
|
package/dist/Tabs/Tab.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TabProps } from './Tab.types';
|
|
3
3
|
import './Tab.less';
|
|
4
|
-
declare const
|
|
5
|
-
export default
|
|
4
|
+
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<TabProps<"div", {}>, "ref"> & React.RefAttributes<HTMLDivElement>>>;
|
|
5
|
+
export default _default;
|
package/dist/Tabs/Tab.js
CHANGED
|
@@ -63,39 +63,52 @@ var import_react = __toESM(require("react"));
|
|
|
63
63
|
var import_clsx = __toESM(require("clsx"));
|
|
64
64
|
var import_utils = require("@bifrostui/utils");
|
|
65
65
|
var import_TabsContext = __toESM(require("./TabsContext"));
|
|
66
|
+
var import_classes = require("./classes");
|
|
66
67
|
var import_Tab2 = require("./Tab.css");
|
|
67
|
-
const prefixCls = "bui-tab";
|
|
68
68
|
const Tab = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
|
|
69
69
|
const _a = props, {
|
|
70
70
|
className,
|
|
71
71
|
children,
|
|
72
72
|
index,
|
|
73
73
|
disabled = false,
|
|
74
|
-
onClick
|
|
75
|
-
role = "tab",
|
|
76
|
-
tabIndex,
|
|
77
|
-
"aria-selected": ariaSelected,
|
|
78
|
-
"aria-disabled": ariaDisabled
|
|
74
|
+
onClick
|
|
79
75
|
} = _a, others = __objRest(_a, [
|
|
80
76
|
"className",
|
|
81
77
|
"children",
|
|
82
78
|
"index",
|
|
83
79
|
"disabled",
|
|
84
|
-
"onClick"
|
|
85
|
-
"role",
|
|
86
|
-
"tabIndex",
|
|
87
|
-
"aria-selected",
|
|
88
|
-
"aria-disabled"
|
|
80
|
+
"onClick"
|
|
89
81
|
]);
|
|
90
|
-
const
|
|
91
|
-
const
|
|
92
|
-
const isActive =
|
|
82
|
+
const innerRef = (0, import_react.useRef)(null);
|
|
83
|
+
const handleRef = (0, import_utils.useForkRef)(ref, innerRef);
|
|
84
|
+
const isActive = (0, import_utils.useContextSelector)(
|
|
85
|
+
import_TabsContext.default,
|
|
86
|
+
(ctx) => ctx.value === index
|
|
87
|
+
);
|
|
88
|
+
const triggerChange = (0, import_utils.useContextSelector)(
|
|
89
|
+
import_TabsContext.default,
|
|
90
|
+
(ctx) => ctx.triggerChange
|
|
91
|
+
);
|
|
92
|
+
const onRegister = (0, import_utils.useContextSelector)(import_TabsContext.default, (ctx) => ctx.onRegister);
|
|
93
|
+
const onUnregister = (0, import_utils.useContextSelector)(
|
|
94
|
+
import_TabsContext.default,
|
|
95
|
+
(ctx) => ctx.onUnregister
|
|
96
|
+
);
|
|
97
|
+
(0, import_react.useEffect)(() => {
|
|
98
|
+
if (index !== void 0 && index !== null) {
|
|
99
|
+
onRegister == null ? void 0 : onRegister({ value: index, ref: innerRef });
|
|
100
|
+
}
|
|
101
|
+
return () => {
|
|
102
|
+
if (index !== void 0 && index !== null) {
|
|
103
|
+
onUnregister == null ? void 0 : onUnregister({ value: index });
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
}, [onRegister, onUnregister, index]);
|
|
93
107
|
const rootCls = (0, import_clsx.default)(
|
|
94
|
-
|
|
108
|
+
import_classes.tabRootClass,
|
|
95
109
|
{
|
|
96
|
-
[
|
|
97
|
-
[
|
|
98
|
-
[`${prefixCls}-disabled`]: disabled
|
|
110
|
+
[import_classes.tabActiveClass]: !import_utils.isMini && isActive,
|
|
111
|
+
[import_classes.tabDisabledClass]: disabled
|
|
99
112
|
},
|
|
100
113
|
className
|
|
101
114
|
);
|
|
@@ -103,31 +116,26 @@ const Tab = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
|
|
|
103
116
|
if (disabled)
|
|
104
117
|
return;
|
|
105
118
|
e.preventDefault();
|
|
106
|
-
triggerChange(e, { index });
|
|
119
|
+
triggerChange == null ? void 0 : triggerChange(e, { index });
|
|
107
120
|
onClick == null ? void 0 : onClick(e, { index });
|
|
108
121
|
};
|
|
122
|
+
if (process.env.NODE_ENV !== "production") {
|
|
123
|
+
console.count("Tab render");
|
|
124
|
+
}
|
|
109
125
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
110
126
|
"div",
|
|
111
127
|
__spreadProps(__spreadValues({
|
|
112
|
-
role,
|
|
113
|
-
"aria-selected":
|
|
114
|
-
"aria-disabled":
|
|
115
|
-
tabIndex:
|
|
116
|
-
ref,
|
|
128
|
+
role: "tab",
|
|
129
|
+
"aria-selected": isActive,
|
|
130
|
+
"aria-disabled": disabled,
|
|
131
|
+
tabIndex: disabled ? -1 : 0,
|
|
132
|
+
ref: handleRef,
|
|
117
133
|
className: rootCls
|
|
118
134
|
}, others), {
|
|
119
135
|
onClick: handleClick
|
|
120
136
|
}),
|
|
121
|
-
children
|
|
122
|
-
import_utils.isMini && /* @__PURE__ */ import_react.default.createElement(
|
|
123
|
-
"div",
|
|
124
|
-
{
|
|
125
|
-
className: (0, import_clsx.default)(`${prefixCls}-miniapp-active-line`, {
|
|
126
|
-
"bui-indicator-invisible": !isActive
|
|
127
|
-
})
|
|
128
|
-
}
|
|
129
|
-
)
|
|
137
|
+
children
|
|
130
138
|
);
|
|
131
139
|
});
|
|
132
140
|
Tab.displayName = "BuiTab";
|
|
133
|
-
var Tab_default = Tab;
|
|
141
|
+
var Tab_default = /* @__PURE__ */ import_react.default.memo(Tab);
|
package/dist/Tabs/Tab.types.d.ts
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface TabIndicatorProps {
|
|
3
|
+
/** 当前选中的 tab 值 */
|
|
4
|
+
currentValue: string;
|
|
5
|
+
/** 已注册的 tabs 引用映射表 */
|
|
6
|
+
registeredTabs: React.MutableRefObject<Record<string, React.RefObject<HTMLElement>>>;
|
|
7
|
+
/** tabs 容器的引用 */
|
|
8
|
+
tabsContainerRef: React.RefObject<HTMLDivElement>;
|
|
9
|
+
}
|
|
10
|
+
declare const TabIndicator: React.FC<TabIndicatorProps>;
|
|
11
|
+
export default TabIndicator;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var TabIndicator_exports = {};
|
|
29
|
+
__export(TabIndicator_exports, {
|
|
30
|
+
default: () => TabIndicator_default
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(TabIndicator_exports);
|
|
33
|
+
var import_react = __toESM(require("react"));
|
|
34
|
+
var import_clsx = __toESM(require("clsx"));
|
|
35
|
+
var import_utils = require("@bifrostui/utils");
|
|
36
|
+
var import_scroll = __toESM(require("./utils/scroll"));
|
|
37
|
+
var import_classes = require("./classes");
|
|
38
|
+
const duration = 300;
|
|
39
|
+
const DEFAULT_INDICATOR_WIDTH = 24;
|
|
40
|
+
const TabIndicator = ({
|
|
41
|
+
currentValue,
|
|
42
|
+
registeredTabs,
|
|
43
|
+
tabsContainerRef
|
|
44
|
+
}) => {
|
|
45
|
+
const indicatorRef = (0, import_react.useRef)(null);
|
|
46
|
+
const hasRenderedOnce = (0, import_react.useRef)(false);
|
|
47
|
+
const [indicatorStyle, setIndicatorStyle] = (0, import_react.useState)(
|
|
48
|
+
null
|
|
49
|
+
);
|
|
50
|
+
const getActiveTabElement = (0, import_utils.useEventCallback)(
|
|
51
|
+
(activeValue) => {
|
|
52
|
+
const tabRef = registeredTabs.current[activeValue];
|
|
53
|
+
return tabRef == null ? void 0 : tabRef.current;
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
const scrollIntoView = (0, import_utils.useEventCallback)(
|
|
57
|
+
(activeTab, animate = true) => {
|
|
58
|
+
const tabsEl = tabsContainerRef.current;
|
|
59
|
+
if (!tabsEl || !activeTab) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
(0, import_scroll.default)(
|
|
63
|
+
tabsEl,
|
|
64
|
+
activeTab.offsetLeft - (tabsEl.offsetWidth - activeTab.offsetWidth) / 2,
|
|
65
|
+
animate ? duration : 0
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
const getIndicatorWidth = (0, import_utils.useEventCallback)(() => {
|
|
70
|
+
const indicator = indicatorRef.current;
|
|
71
|
+
if (!indicator)
|
|
72
|
+
return DEFAULT_INDICATOR_WIDTH;
|
|
73
|
+
const rect = indicator.getBoundingClientRect();
|
|
74
|
+
return rect.width > 0 ? rect.width : DEFAULT_INDICATOR_WIDTH;
|
|
75
|
+
});
|
|
76
|
+
const getTabsMeta = (0, import_utils.useEventCallback)(() => {
|
|
77
|
+
const tabsNode = tabsContainerRef.current;
|
|
78
|
+
let tabsMeta = null;
|
|
79
|
+
if (tabsNode) {
|
|
80
|
+
const rect = tabsNode.getBoundingClientRect();
|
|
81
|
+
tabsMeta = {
|
|
82
|
+
clientWidth: tabsNode.clientWidth,
|
|
83
|
+
scrollLeft: tabsNode.scrollLeft,
|
|
84
|
+
scrollWidth: tabsNode.scrollWidth,
|
|
85
|
+
left: rect.left
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
let tabMeta = null;
|
|
89
|
+
const activeTab = getActiveTabElement(currentValue);
|
|
90
|
+
if (activeTab) {
|
|
91
|
+
tabMeta = activeTab.getBoundingClientRect();
|
|
92
|
+
}
|
|
93
|
+
return { tabsMeta, tabMeta };
|
|
94
|
+
});
|
|
95
|
+
const updateIndicatorState = (0, import_utils.useEventCallback)(() => {
|
|
96
|
+
const { tabsMeta, tabMeta } = getTabsMeta();
|
|
97
|
+
if (!tabMeta || !tabsMeta) {
|
|
98
|
+
setIndicatorStyle(null);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const tabLeft = tabMeta.left - tabsMeta.left + tabsMeta.scrollLeft;
|
|
102
|
+
const tabWidth = tabMeta.width;
|
|
103
|
+
const indicatorWidth = getIndicatorWidth();
|
|
104
|
+
const leftPosition = tabLeft + (tabWidth - indicatorWidth) / 2;
|
|
105
|
+
const newIndicatorStyle = {
|
|
106
|
+
left: leftPosition
|
|
107
|
+
};
|
|
108
|
+
if (indicatorStyle === null) {
|
|
109
|
+
setIndicatorStyle(newIndicatorStyle);
|
|
110
|
+
} else {
|
|
111
|
+
const dLeft = Math.abs(indicatorStyle.left - newIndicatorStyle.left);
|
|
112
|
+
if (dLeft >= 1) {
|
|
113
|
+
setIndicatorStyle(newIndicatorStyle);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
const activeTab = getActiveTabElement(currentValue);
|
|
117
|
+
if (activeTab) {
|
|
118
|
+
const maxScrollDistance = tabsMeta.scrollWidth - tabsMeta.clientWidth;
|
|
119
|
+
if (maxScrollDistance > 0 && !import_utils.isMini) {
|
|
120
|
+
scrollIntoView(activeTab, hasRenderedOnce.current);
|
|
121
|
+
}
|
|
122
|
+
hasRenderedOnce.current = true;
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
(0, import_react.useEffect)(() => {
|
|
126
|
+
updateIndicatorState();
|
|
127
|
+
});
|
|
128
|
+
(0, import_react.useEffect)(() => {
|
|
129
|
+
const tabsContainer = tabsContainerRef.current;
|
|
130
|
+
if (!tabsContainer)
|
|
131
|
+
return void 0;
|
|
132
|
+
const handleResize = (0, import_utils.debounce)(() => {
|
|
133
|
+
if (tabsContainerRef.current) {
|
|
134
|
+
updateIndicatorState();
|
|
135
|
+
}
|
|
136
|
+
}, 100);
|
|
137
|
+
window.addEventListener("resize", handleResize);
|
|
138
|
+
let resizeObserver;
|
|
139
|
+
let mutationObserver;
|
|
140
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
141
|
+
resizeObserver = new ResizeObserver(handleResize);
|
|
142
|
+
Array.from(tabsContainer.children).forEach((child) => {
|
|
143
|
+
resizeObserver == null ? void 0 : resizeObserver.observe(child);
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
if (typeof MutationObserver !== "undefined") {
|
|
147
|
+
const handleMutation = (records) => {
|
|
148
|
+
records.forEach((record) => {
|
|
149
|
+
record.removedNodes.forEach((item) => {
|
|
150
|
+
if (item instanceof Element) {
|
|
151
|
+
resizeObserver == null ? void 0 : resizeObserver.unobserve(item);
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
record.addedNodes.forEach((item) => {
|
|
155
|
+
if (item instanceof Element) {
|
|
156
|
+
resizeObserver == null ? void 0 : resizeObserver.observe(item);
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
handleResize();
|
|
161
|
+
};
|
|
162
|
+
mutationObserver = new MutationObserver(handleMutation);
|
|
163
|
+
mutationObserver.observe(tabsContainer, { childList: true });
|
|
164
|
+
}
|
|
165
|
+
return () => {
|
|
166
|
+
window.removeEventListener("resize", handleResize);
|
|
167
|
+
mutationObserver == null ? void 0 : mutationObserver.disconnect();
|
|
168
|
+
resizeObserver == null ? void 0 : resizeObserver.disconnect();
|
|
169
|
+
};
|
|
170
|
+
}, [updateIndicatorState, tabsContainerRef]);
|
|
171
|
+
if (!indicatorStyle) {
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
175
|
+
"div",
|
|
176
|
+
{
|
|
177
|
+
ref: indicatorRef,
|
|
178
|
+
className: (0, import_clsx.default)(import_classes.tabIndicatorClass),
|
|
179
|
+
style: indicatorStyle,
|
|
180
|
+
"aria-hidden": "true"
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
};
|
|
184
|
+
TabIndicator.displayName = "BuiTabsIndicator";
|
|
185
|
+
var TabIndicator_default = TabIndicator;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var TabMask_exports = {};
|
|
29
|
+
__export(TabMask_exports, {
|
|
30
|
+
default: () => TabMask_default
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(TabMask_exports);
|
|
33
|
+
var import_react = __toESM(require("react"));
|
|
34
|
+
var import_clsx = __toESM(require("clsx"));
|
|
35
|
+
var import_classes = require("./classes");
|
|
36
|
+
const TabMask = ({ position }) => /* @__PURE__ */ import_react.default.createElement(
|
|
37
|
+
"div",
|
|
38
|
+
{
|
|
39
|
+
className: (0, import_clsx.default)(
|
|
40
|
+
import_classes.tabMaskClass,
|
|
41
|
+
position === "left" ? import_classes.tabMaskLeftClass : import_classes.tabMaskRightClass
|
|
42
|
+
),
|
|
43
|
+
"aria-hidden": "true"
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
TabMask.displayName = "BuiTabsMask";
|
|
47
|
+
var TabMask_default = /* @__PURE__ */ import_react.default.memo(TabMask);
|
package/dist/Tabs/TabPanel.js
CHANGED
|
@@ -58,8 +58,8 @@ __export(TabPanel_exports, {
|
|
|
58
58
|
module.exports = __toCommonJS(TabPanel_exports);
|
|
59
59
|
var import_react = __toESM(require("react"));
|
|
60
60
|
var import_clsx = __toESM(require("clsx"));
|
|
61
|
+
var import_classes = require("./classes");
|
|
61
62
|
var import_TabPanel2 = require("./TabPanel.css");
|
|
62
|
-
const prefixCls = "bui-tabpanel";
|
|
63
63
|
const TabPanel = (0, import_react.forwardRef)((props, ref) => {
|
|
64
64
|
const _a = props, {
|
|
65
65
|
className,
|
|
@@ -83,9 +83,9 @@ const TabPanel = (0, import_react.forwardRef)((props, ref) => {
|
|
|
83
83
|
"aria-hidden": !isActive,
|
|
84
84
|
tabIndex: 0,
|
|
85
85
|
ref,
|
|
86
|
-
className: (0, import_clsx.default)(
|
|
87
|
-
[
|
|
88
|
-
[
|
|
86
|
+
className: (0, import_clsx.default)(import_classes.tabPanelRootClass, className, {
|
|
87
|
+
[import_classes.tabPanelActiveClass]: isActive,
|
|
88
|
+
[import_classes.tabPanelInactiveClass]: !isActive
|
|
89
89
|
})
|
|
90
90
|
}, others),
|
|
91
91
|
isActive ? children : keepActiveDom
|