@bifrostui/react 2.0.0-alpha.3 → 2.0.0-alpha.30
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/LICENSE +21 -0
- 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/CSSTransition/demo/CSSTransitionDemo.js +3 -0
- package/dist/CSSTransition/demo/index.css +0 -3
- package/dist/Calendar/Calendar.js +5 -1
- 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 -1
- 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.d.ts +1 -1
- 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/Dialog.js +19 -12
- package/dist/Dialog/Dialog.types.d.ts +13 -0
- package/dist/Dialog/FunctionalDialog.js +1 -1
- package/dist/Dialog/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/dist/Dialog/__tests__/fixtures/A11yDemos.js +4 -4
- package/dist/Dialog/index.css +21 -44
- 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 -1
- 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.d.ts +1 -0
- 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/Radio/index.css +1 -0
- 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/Select/selectContext.d.ts +0 -1
- 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/SwipeAction/SwipeActionContext.d.ts +0 -1
- package/dist/Swiper/Swiper.js +2 -0
- 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 +17 -6
- package/dist/Tabs/Tabs.js +101 -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 +18 -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 +250 -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 +11 -1
- package/dist/Tag/Tag.d.ts +1 -1
- package/dist/Tag/Tag.js +6 -6
- package/dist/Tag/Tag.types.d.ts +2 -2
- 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 +11 -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/FunctionalToast.js +3 -5
- package/dist/Toast/Toast.d.ts +1 -1
- package/dist/Toast/Toast.js +8 -8
- package/dist/Toast/Toast.types.d.ts +1 -1
- package/dist/Toast/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/dist/Toast/__tests__/fixtures/A11yDemos.js +2 -2
- package/dist/Toast/index.css +7 -5
- 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/CSSTransition/demo/CSSTransitionDemo.js +3 -0
- package/es/CSSTransition/demo/index.css +0 -3
- package/es/Calendar/Calendar.js +5 -1
- package/es/Calendar/Calendar.types.d.ts +1 -1
- package/es/Calendar/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/es/Calendar/__tests__/fixtures/A11yDemos.js +1 -1
- package/es/Card/Card.d.ts +1 -1
- package/es/Card/Card.js +1 -1
- package/es/Card/Card.types.d.ts +1 -1
- package/es/Card/CardContent.d.ts +1 -1
- package/es/Card/CardContent.js +1 -1
- package/es/Card/CardContent.types.d.ts +1 -1
- package/es/Card/CardFooter.d.ts +1 -1
- package/es/Card/CardFooter.js +1 -1
- package/es/Card/CardFooter.types.d.ts +1 -1
- package/es/Card/CardHeader.d.ts +1 -1
- package/es/Card/CardHeader.js +1 -1
- package/es/Checkbox/CheckboxContext.d.ts +1 -1
- package/es/Checkbox/CheckboxContext.js +1 -1
- package/es/Checkbox/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/es/Checkbox/__tests__/fixtures/A11yDemos.js +1 -1
- package/es/CitySelector/CitySelector.types.d.ts +1 -1
- 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/Dialog.js +19 -12
- package/es/Dialog/Dialog.types.d.ts +13 -0
- package/es/Dialog/FunctionalDialog.js +1 -1
- package/es/Dialog/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/es/Dialog/__tests__/fixtures/A11yDemos.js +1 -1
- package/es/Dialog/index.css +21 -44
- 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 -1
- 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.d.ts +1 -0
- 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/Radio/index.css +1 -0
- 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/Select/selectContext.d.ts +0 -1
- 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/SwipeAction/SwipeActionContext.d.ts +0 -1
- package/es/Swiper/Swiper.js +7 -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 +17 -6
- package/es/Tabs/Tabs.js +102 -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 +18 -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 +228 -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 +11 -1
- package/es/Tag/Tag.d.ts +1 -1
- package/es/Tag/Tag.js +4 -4
- package/es/Tag/Tag.types.d.ts +2 -2
- 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 +11 -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/FunctionalToast.js +4 -6
- package/es/Toast/Toast.d.ts +1 -1
- package/es/Toast/Toast.js +1 -1
- package/es/Toast/Toast.types.d.ts +1 -1
- package/es/Toast/__tests__/fixtures/A11yDemos.d.ts +1 -1
- package/es/Toast/__tests__/fixtures/A11yDemos.js +1 -1
- package/es/Toast/index.css +7 -5
- 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 +17 -26
- package/src/index.ts +0 -58
|
@@ -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
|
package/dist/Tabs/Tabs.css
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
page,
|
|
3
3
|
xhs-page {
|
|
4
4
|
--bui-tabs-height: 39px;
|
|
5
|
+
--bui-tabs-padding: 0;
|
|
5
6
|
--bui-tabs-font-weight: var(--bui-font-weight-medium);
|
|
6
7
|
--bui-tabs-indicator-bg: var(--bui-color-primary);
|
|
7
8
|
--bui-tabs-indicator-height: 3PX;
|
|
@@ -16,10 +17,10 @@ xhs-page {
|
|
|
16
17
|
--bui-tab-height: 100%;
|
|
17
18
|
--bui-tab-padding: var(--bui-spacing-lg) var(--bui-spacing-lg) 10px;
|
|
18
19
|
--bui-tab-active-color: var(--bui-color-fg-default);
|
|
19
|
-
--bui-tab-active-font-family: var(--bui-font-family-accent, inherit);
|
|
20
20
|
}
|
|
21
21
|
.bui-tabs {
|
|
22
22
|
position: relative;
|
|
23
|
+
padding: var(--bui-tabs-padding);
|
|
23
24
|
font-family: var(--bui-font-family);
|
|
24
25
|
font-weight: var(--bui-tabs-font-weight);
|
|
25
26
|
}
|
|
@@ -29,6 +30,7 @@ xhs-page {
|
|
|
29
30
|
flex-wrap: nowrap;
|
|
30
31
|
justify-content: flex-start;
|
|
31
32
|
align-items: center;
|
|
33
|
+
white-space: nowrap;
|
|
32
34
|
position: relative;
|
|
33
35
|
overflow-x: scroll;
|
|
34
36
|
scrollbar-width: none;
|
|
@@ -36,15 +38,28 @@ xhs-page {
|
|
|
36
38
|
.bui-tabs-tabs::-webkit-scrollbar {
|
|
37
39
|
display: none;
|
|
38
40
|
}
|
|
41
|
+
.bui-tabs-scroll-wrapper {
|
|
42
|
+
height: 100%;
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: row;
|
|
45
|
+
flex-wrap: nowrap;
|
|
46
|
+
justify-content: flex-start;
|
|
47
|
+
align-items: center;
|
|
48
|
+
position: relative;
|
|
49
|
+
min-width: 100%;
|
|
50
|
+
}
|
|
39
51
|
.bui-tabs-indicator {
|
|
40
52
|
position: absolute;
|
|
53
|
+
top: unset;
|
|
54
|
+
bottom: var(--bui-tabs-indicator-bottom, 0);
|
|
41
55
|
width: var(--bui-tabs-indicator-width);
|
|
42
|
-
bottom: var(--bui-tabs-indicator-bottom);
|
|
43
56
|
height: var(--bui-tabs-indicator-height);
|
|
44
57
|
color: var(--bui-color-primary);
|
|
45
58
|
background: var(--bui-tabs-indicator-bg);
|
|
46
59
|
border-radius: var(--bui-tabs-indicator-border-radius);
|
|
47
60
|
box-shadow: var(--bui-tabs-indicator-box-shadow);
|
|
61
|
+
pointer-events: none;
|
|
62
|
+
transition: left 0.3s ease-in-out;
|
|
48
63
|
}
|
|
49
64
|
.bui-tabs-content {
|
|
50
65
|
padding: var(--bui-spacing-lg);
|
|
@@ -74,7 +89,3 @@ xhs-page {
|
|
|
74
89
|
var(--bui-color-bg-view),
|
|
75
90
|
rgba(255, 255, 255, 0));
|
|
76
91
|
}
|
|
77
|
-
.bui-indicator-invisible {
|
|
78
|
-
visibility: hidden;
|
|
79
|
-
background-color: transparent;
|
|
80
|
-
}
|
package/dist/Tabs/Tabs.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
7
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
8
|
var __getProtoOf = Object.getPrototypeOf;
|
|
@@ -18,6 +20,7 @@ var __spreadValues = (a, b) => {
|
|
|
18
20
|
}
|
|
19
21
|
return a;
|
|
20
22
|
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
24
|
var __objRest = (source, exclude) => {
|
|
22
25
|
var target = {};
|
|
23
26
|
for (var prop in source)
|
|
@@ -59,187 +62,128 @@ module.exports = __toCommonJS(Tabs_exports);
|
|
|
59
62
|
var import_react = __toESM(require("react"));
|
|
60
63
|
var import_clsx = __toESM(require("clsx"));
|
|
61
64
|
var import_utils = require("@bifrostui/utils");
|
|
62
|
-
var import_scroll = __toESM(require("./utils/scroll"));
|
|
63
65
|
var import_Tab = __toESM(require("./Tab"));
|
|
66
|
+
var import_TabIndicator = __toESM(require("./TabIndicator"));
|
|
67
|
+
var import_TabMask = __toESM(require("./TabMask"));
|
|
64
68
|
var import_TabsContext = require("./TabsContext");
|
|
69
|
+
var import_classes = require("./classes");
|
|
65
70
|
var import_Tabs2 = require("./Tabs.css");
|
|
66
|
-
const prefixCls = "bui-tabs";
|
|
67
|
-
const duration = 300;
|
|
68
71
|
const Tabs = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
|
|
69
|
-
const _a = props, {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
72
|
+
const _a = props, {
|
|
73
|
+
children,
|
|
74
|
+
className,
|
|
75
|
+
defaultValue,
|
|
76
|
+
value,
|
|
77
|
+
tabs = [],
|
|
78
|
+
onChange
|
|
79
|
+
} = _a, others = __objRest(_a, [
|
|
80
|
+
"children",
|
|
81
|
+
"className",
|
|
82
|
+
"defaultValue",
|
|
83
|
+
"value",
|
|
84
|
+
"tabs",
|
|
85
|
+
"onChange"
|
|
86
|
+
]);
|
|
87
|
+
const handleOnChange = (0, import_utils.useEventCallback)(
|
|
88
|
+
(e, data) => {
|
|
89
|
+
onChange == null ? void 0 : onChange(e, { index: data.value });
|
|
87
90
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
});
|
|
97
|
-
};
|
|
98
|
-
const scrollIntoView = () => {
|
|
99
|
-
const tabsEl = tabsRef.current;
|
|
100
|
-
const activeTab = getActiveTabElement();
|
|
101
|
-
if (!tabsEl || !activeTab) {
|
|
102
|
-
return;
|
|
91
|
+
);
|
|
92
|
+
const [currentValue, triggerValueChange] = (0, import_utils.useValue)({
|
|
93
|
+
value,
|
|
94
|
+
defaultValue: defaultValue != null ? defaultValue : "",
|
|
95
|
+
onChange: handleOnChange,
|
|
96
|
+
config: {
|
|
97
|
+
name: "Tabs",
|
|
98
|
+
state: "value"
|
|
103
99
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
if (
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
let activeTabWidth = 0;
|
|
117
|
-
let containerWidth = 0;
|
|
118
|
-
let containerScrollWidth = 0;
|
|
119
|
-
let activeLineWidth = 0;
|
|
120
|
-
let x = 0;
|
|
121
|
-
if (activeTab) {
|
|
122
|
-
activeTabLeft = activeTab.offsetLeft;
|
|
123
|
-
activeTabWidth = activeTab.offsetWidth;
|
|
124
|
-
containerWidth = tabsEl.offsetWidth;
|
|
125
|
-
containerScrollWidth = tabsEl.scrollWidth;
|
|
126
|
-
activeLineWidth = activeLine.offsetWidth;
|
|
127
|
-
x = activeTabLeft + (activeTabWidth - activeLineWidth) / 2;
|
|
100
|
+
});
|
|
101
|
+
const tabsRef = (0, import_react.useRef)(null);
|
|
102
|
+
const registeredTabs = (0, import_react.useRef)(
|
|
103
|
+
{}
|
|
104
|
+
);
|
|
105
|
+
const [registrationVersion, setRegistrationVersion] = (0, import_react.useState)(0);
|
|
106
|
+
const [isScrollable, setIsScrollable] = (0, import_react.useState)(false);
|
|
107
|
+
if (process.env.NODE_ENV !== "production") {
|
|
108
|
+
if (tabs.length > 0 && import_react.default.Children.count(children) > 0) {
|
|
109
|
+
console.warn(
|
|
110
|
+
"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"
|
|
111
|
+
);
|
|
128
112
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
if (!import_utils.isMini) {
|
|
137
|
-
scrollIntoView();
|
|
113
|
+
}
|
|
114
|
+
const onRegister = (0, import_utils.useEventCallback)(
|
|
115
|
+
(data) => {
|
|
116
|
+
if (data.value !== void 0 && data.value !== null) {
|
|
117
|
+
registeredTabs.current[data.value] = data.ref;
|
|
118
|
+
setRegistrationVersion((v) => v + 1);
|
|
119
|
+
}
|
|
138
120
|
}
|
|
121
|
+
);
|
|
122
|
+
const onUnregister = (0, import_utils.useEventCallback)((data) => {
|
|
123
|
+
delete registeredTabs.current[data.value];
|
|
124
|
+
setRegistrationVersion((v) => v + 1);
|
|
139
125
|
});
|
|
140
|
-
const
|
|
141
|
-
() =>
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
const showLeftMask = scrollLeft > 0;
|
|
148
|
-
const rightRange = Math.abs(
|
|
149
|
-
tabsEl.scrollWidth - (scrollLeft + tabsEl.offsetWidth)
|
|
150
|
-
);
|
|
151
|
-
const showRightMask = rightRange > 1;
|
|
152
|
-
setMaskData({
|
|
153
|
-
leftMaskOpacity: showLeftMask ? 1 : 0,
|
|
154
|
-
rightMaskOpacity: showRightMask ? 1 : 0
|
|
155
|
-
});
|
|
156
|
-
},
|
|
157
|
-
100,
|
|
158
|
-
{
|
|
159
|
-
trailing: true,
|
|
160
|
-
leading: true
|
|
126
|
+
const handleClick = (0, import_utils.useEventCallback)(
|
|
127
|
+
(e, item) => {
|
|
128
|
+
const { index, disabled = false } = item;
|
|
129
|
+
if (disabled || [void 0, null].includes(index))
|
|
130
|
+
return;
|
|
131
|
+
if (index !== currentValue) {
|
|
132
|
+
triggerValueChange(e, index);
|
|
161
133
|
}
|
|
162
|
-
|
|
163
|
-
[]
|
|
134
|
+
}
|
|
164
135
|
);
|
|
136
|
+
const contextValue = (0, import_react.useMemo)(
|
|
137
|
+
() => ({
|
|
138
|
+
value: currentValue,
|
|
139
|
+
triggerChange: handleClick,
|
|
140
|
+
onRegister,
|
|
141
|
+
onUnregister
|
|
142
|
+
}),
|
|
143
|
+
[currentValue, handleClick, onRegister, onUnregister]
|
|
144
|
+
);
|
|
145
|
+
const renderedTabs = (0, import_react.useMemo)(() => {
|
|
146
|
+
if (tabs.length > 0) {
|
|
147
|
+
return tabs.map((item) => /* @__PURE__ */ import_react.default.createElement(import_Tab.default, { key: item.index, index: item == null ? void 0 : item.index, disabled: item == null ? void 0 : item.disabled }, item.title));
|
|
148
|
+
}
|
|
149
|
+
return children;
|
|
150
|
+
}, [tabs, children]);
|
|
165
151
|
(0, import_react.useEffect)(() => {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}, 100);
|
|
174
|
-
window.addEventListener("resize", handleResize);
|
|
175
|
-
return () => {
|
|
176
|
-
window.removeEventListener("resize", handleResize);
|
|
152
|
+
const tabsEl = tabsRef.current;
|
|
153
|
+
if (!tabsEl)
|
|
154
|
+
return void 0;
|
|
155
|
+
const checkScrollable = () => {
|
|
156
|
+
const { scrollWidth = 0, offsetWidth = 0 } = tabsEl;
|
|
157
|
+
const isOverflow = scrollWidth - offsetWidth > 1;
|
|
158
|
+
setIsScrollable(isOverflow);
|
|
177
159
|
};
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
if (disabled || [void 0, null].includes(index))
|
|
182
|
-
return;
|
|
183
|
-
if (index !== value) {
|
|
184
|
-
onChange == null ? void 0 : onChange(e, { index });
|
|
160
|
+
checkScrollable();
|
|
161
|
+
if (typeof ResizeObserver === "undefined") {
|
|
162
|
+
return void 0;
|
|
185
163
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
},
|
|
194
|
-
"aria-hidden": "true"
|
|
195
|
-
}
|
|
196
|
-
), /* @__PURE__ */ import_react.default.createElement(
|
|
197
|
-
"div",
|
|
198
|
-
{
|
|
199
|
-
className: (0, import_clsx.default)(`${prefixCls}-mask`, `${prefixCls}-mask-right`),
|
|
200
|
-
style: {
|
|
201
|
-
opacity: maskData.rightMaskOpacity
|
|
202
|
-
},
|
|
203
|
-
"aria-hidden": "true"
|
|
204
|
-
}
|
|
205
|
-
), /* @__PURE__ */ import_react.default.createElement(
|
|
164
|
+
const resizeObserver = new ResizeObserver(checkScrollable);
|
|
165
|
+
resizeObserver.observe(tabsEl);
|
|
166
|
+
return () => {
|
|
167
|
+
resizeObserver.disconnect();
|
|
168
|
+
};
|
|
169
|
+
}, [registrationVersion]);
|
|
170
|
+
return /* @__PURE__ */ import_react.default.createElement("div", __spreadProps(__spreadValues({ className: (0, import_clsx.default)(import_classes.tabsRootClass, className) }, others), { ref }), isScrollable && /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_TabMask.default, { position: "left" }), /* @__PURE__ */ import_react.default.createElement(import_TabMask.default, { position: "right" })), /* @__PURE__ */ import_react.default.createElement(
|
|
206
171
|
"div",
|
|
207
172
|
{
|
|
208
|
-
className:
|
|
173
|
+
className: import_classes.tabsScrollClass,
|
|
209
174
|
ref: tabsRef,
|
|
210
|
-
onScroll: updateMask,
|
|
211
175
|
role: "tablist",
|
|
212
176
|
"aria-orientation": "horizontal"
|
|
213
177
|
},
|
|
214
178
|
/* @__PURE__ */ import_react.default.createElement(
|
|
215
|
-
|
|
179
|
+
import_TabIndicator.default,
|
|
216
180
|
{
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
}),
|
|
221
|
-
style: {
|
|
222
|
-
transition: "transform 0.3s ease-in-out",
|
|
223
|
-
transform: `translate(${indicatorData.x}px, 0px)`
|
|
224
|
-
},
|
|
225
|
-
"aria-hidden": "true"
|
|
181
|
+
currentValue,
|
|
182
|
+
registeredTabs,
|
|
183
|
+
tabsContainerRef: tabsRef
|
|
226
184
|
}
|
|
227
185
|
),
|
|
228
|
-
/* @__PURE__ */ import_react.default.createElement(import_TabsContext.TabsContextProvider, { value:
|
|
229
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
230
|
-
import_Tab.default,
|
|
231
|
-
{
|
|
232
|
-
key: item.index,
|
|
233
|
-
index: item == null ? void 0 : item.index,
|
|
234
|
-
disabled: item == null ? void 0 : item.disabled,
|
|
235
|
-
role: "tab",
|
|
236
|
-
"aria-selected": value === item.index,
|
|
237
|
-
"aria-disabled": item == null ? void 0 : item.disabled,
|
|
238
|
-
tabIndex: (item == null ? void 0 : item.disabled) ? -1 : 0
|
|
239
|
-
},
|
|
240
|
-
item.title
|
|
241
|
-
);
|
|
242
|
-
}), children)
|
|
186
|
+
/* @__PURE__ */ import_react.default.createElement(import_TabsContext.TabsContextProvider, { value: contextValue }, renderedTabs)
|
|
243
187
|
));
|
|
244
188
|
});
|
|
245
189
|
Tabs.displayName = "BuiTabs";
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import React, { SyntheticEvent } from 'react';
|
|
2
2
|
import { OverrideProps } from '@bifrostui/types';
|
|
3
|
-
export interface TabHeaderItem {
|
|
4
|
-
title: React.ReactNode;
|
|
5
|
-
index: string;
|
|
6
|
-
disabled?: boolean;
|
|
7
|
-
}
|
|
8
3
|
export interface ITabsChangeData {
|
|
9
4
|
/** 切换后的tab索引 */
|
|
10
5
|
index: string;
|
|
@@ -19,9 +14,13 @@ export type ITabAlign = 'start' | 'center';
|
|
|
19
14
|
export type TabsProps<D extends React.ElementType = 'div', P = {}> = OverrideProps<{
|
|
20
15
|
props: P & {
|
|
21
16
|
/**
|
|
22
|
-
* 当前选中面板的索引值,与
|
|
17
|
+
* 当前选中面板的索引值,与 ITabItem.index 对应
|
|
23
18
|
*/
|
|
24
19
|
value?: string;
|
|
20
|
+
/**
|
|
21
|
+
* 默认选中面板的索引值(非受控模式)
|
|
22
|
+
*/
|
|
23
|
+
defaultValue?: string;
|
|
25
24
|
/**
|
|
26
25
|
* 切换面板的数据
|
|
27
26
|
*/
|