@bifrostui/react 0.0.5
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/README.md +13 -0
- package/dist/ActionSheet/ActionSheet.css +27 -0
- package/dist/ActionSheet/ActionSheet.d.ts +5 -0
- package/dist/ActionSheet/ActionSheet.js +66 -0
- package/dist/ActionSheet/ActionSheet.types.d.ts +28 -0
- package/dist/ActionSheet/ActionSheet.types.js +5 -0
- package/dist/ActionSheet/ActionSheetContext.d.ts +4 -0
- package/dist/ActionSheet/ActionSheetContext.js +11 -0
- package/dist/ActionSheet/ActionSheetItem.css +51 -0
- package/dist/ActionSheet/ActionSheetItem.d.ts +5 -0
- package/dist/ActionSheet/ActionSheetItem.js +58 -0
- package/dist/ActionSheet/ActionSheetItem.types.d.ts +38 -0
- package/dist/ActionSheet/ActionSheetItem.types.js +5 -0
- package/dist/ActionSheet/index.d.ts +4 -0
- package/dist/ActionSheet/index.js +54 -0
- package/dist/Alert/Alert.d.ts +5 -0
- package/dist/Alert/Alert.js +115 -0
- package/dist/Alert/Alert.types.d.ts +61 -0
- package/dist/Alert/Alert.types.js +5 -0
- package/dist/Alert/index.css +89 -0
- package/dist/Alert/index.d.ts +4 -0
- package/dist/Alert/index.js +34 -0
- package/dist/Avatar/Avatar.css +43 -0
- package/dist/Avatar/Avatar.d.ts +5 -0
- package/dist/Avatar/Avatar.js +59 -0
- package/dist/Avatar/Avatar.types.d.ts +46 -0
- package/dist/Avatar/Avatar.types.js +5 -0
- package/dist/Avatar/AvatarGroup.css +31 -0
- package/dist/Avatar/AvatarGroup.d.ts +5 -0
- package/dist/Avatar/AvatarGroup.js +69 -0
- package/dist/Avatar/AvatarGroup.types.d.ts +27 -0
- package/dist/Avatar/AvatarGroup.types.js +5 -0
- package/dist/Avatar/index.d.ts +6 -0
- package/dist/Avatar/index.js +54 -0
- package/dist/Backdrop/Backdrop.css +14 -0
- package/dist/Backdrop/Backdrop.d.ts +5 -0
- package/dist/Backdrop/Backdrop.js +34 -0
- package/dist/Backdrop/Backdrop.types.d.ts +17 -0
- package/dist/Backdrop/Backdrop.types.js +5 -0
- package/dist/Backdrop/index.d.ts +2 -0
- package/dist/Backdrop/index.js +34 -0
- package/dist/Badge/Badge.css +95 -0
- package/dist/Badge/Badge.d.ts +5 -0
- package/dist/Badge/Badge.js +42 -0
- package/dist/Badge/Badge.types.d.ts +27 -0
- package/dist/Badge/Badge.types.js +5 -0
- package/dist/Badge/index.d.ts +2 -0
- package/dist/Badge/index.js +34 -0
- package/dist/Button/Button.css +200 -0
- package/dist/Button/Button.d.ts +5 -0
- package/dist/Button/Button.js +53 -0
- package/dist/Button/Button.types.d.ts +52 -0
- package/dist/Button/Button.types.js +5 -0
- package/dist/Button/index.d.ts +2 -0
- package/dist/Button/index.js +34 -0
- package/dist/Calendar/Calendar.css +105 -0
- package/dist/Calendar/Calendar.d.ts +5 -0
- package/dist/Calendar/Calendar.js +275 -0
- package/dist/Calendar/Calendar.types.d.ts +76 -0
- package/dist/Calendar/Calendar.types.js +5 -0
- package/dist/Calendar/index.d.ts +2 -0
- package/dist/Calendar/index.js +34 -0
- package/dist/Calendar/utils.d.ts +25 -0
- package/dist/Calendar/utils.js +77 -0
- package/dist/Card/Card.css +9 -0
- package/dist/Card/Card.d.ts +5 -0
- package/dist/Card/Card.js +27 -0
- package/dist/Card/Card.types.d.ts +6 -0
- package/dist/Card/Card.types.js +5 -0
- package/dist/Card/CardContent.css +6 -0
- package/dist/Card/CardContent.d.ts +5 -0
- package/dist/Card/CardContent.js +25 -0
- package/dist/Card/CardContent.types.d.ts +6 -0
- package/dist/Card/CardContent.types.js +5 -0
- package/dist/Card/CardFooter.css +8 -0
- package/dist/Card/CardFooter.d.ts +5 -0
- package/dist/Card/CardFooter.js +25 -0
- package/dist/Card/CardFooter.types.d.ts +6 -0
- package/dist/Card/CardFooter.types.js +5 -0
- package/dist/Card/CardHeader.css +45 -0
- package/dist/Card/CardHeader.d.ts +5 -0
- package/dist/Card/CardHeader.js +59 -0
- package/dist/Card/CardHeader.types.d.ts +23 -0
- package/dist/Card/CardHeader.types.js +5 -0
- package/dist/Card/index.d.ts +10 -0
- package/dist/Card/index.js +94 -0
- package/dist/Checkbox/Checkbox.css +45 -0
- package/dist/Checkbox/Checkbox.d.ts +5 -0
- package/dist/Checkbox/Checkbox.js +101 -0
- package/dist/Checkbox/Checkbox.types.d.ts +84 -0
- package/dist/Checkbox/Checkbox.types.js +5 -0
- package/dist/Checkbox/CheckboxContext.d.ts +5 -0
- package/dist/Checkbox/CheckboxContext.js +11 -0
- package/dist/Checkbox/CheckboxGroup.d.ts +5 -0
- package/dist/Checkbox/CheckboxGroup.js +57 -0
- package/dist/Checkbox/index.d.ts +3 -0
- package/dist/Checkbox/index.js +42 -0
- package/dist/Countdown/Countdown.css +28 -0
- package/dist/Countdown/Countdown.d.ts +5 -0
- package/dist/Countdown/Countdown.js +103 -0
- package/dist/Countdown/Countdown.types.d.ts +123 -0
- package/dist/Countdown/Countdown.types.js +5 -0
- package/dist/Countdown/index.d.ts +3 -0
- package/dist/Countdown/index.js +46 -0
- package/dist/Countdown/useCountdown.d.ts +10 -0
- package/dist/Countdown/useCountdown.js +47 -0
- package/dist/Countdown/utils.d.ts +9 -0
- package/dist/Countdown/utils.js +124 -0
- package/dist/Divider/Divider.css +41 -0
- package/dist/Divider/Divider.d.ts +5 -0
- package/dist/Divider/Divider.js +64 -0
- package/dist/Divider/Divider.types.d.ts +19 -0
- package/dist/Divider/Divider.types.js +5 -0
- package/dist/Divider/index.d.ts +2 -0
- package/dist/Divider/index.js +34 -0
- package/dist/Drawer/Drawer.css +35 -0
- package/dist/Drawer/Drawer.d.ts +5 -0
- package/dist/Drawer/Drawer.js +66 -0
- package/dist/Drawer/Drawer.types.d.ts +51 -0
- package/dist/Drawer/Drawer.types.js +5 -0
- package/dist/Drawer/index.d.ts +2 -0
- package/dist/Drawer/index.js +34 -0
- package/dist/Fade/Fade.d.ts +4 -0
- package/dist/Fade/Fade.js +72 -0
- package/dist/Fade/Fade.types.d.ts +9 -0
- package/dist/Fade/Fade.types.js +5 -0
- package/dist/Fade/index.d.ts +3 -0
- package/dist/Fade/index.js +34 -0
- package/dist/IconButton/IconButton.css +130 -0
- package/dist/IconButton/IconButton.d.ts +5 -0
- package/dist/IconButton/IconButton.js +50 -0
- package/dist/IconButton/IconButton.types.d.ts +41 -0
- package/dist/IconButton/IconButton.types.js +5 -0
- package/dist/IconButton/index.d.ts +2 -0
- package/dist/IconButton/index.js +34 -0
- package/dist/Image/Image.d.ts +5 -0
- package/dist/Image/Image.js +123 -0
- package/dist/Image/Image.types.d.ts +48 -0
- package/dist/Image/Image.types.js +5 -0
- package/dist/Image/index.css +35 -0
- package/dist/Image/index.d.ts +3 -0
- package/dist/Image/index.js +34 -0
- package/dist/Input/Input.css +59 -0
- package/dist/Input/Input.d.ts +5 -0
- package/dist/Input/Input.js +115 -0
- package/dist/Input/Input.types.d.ts +70 -0
- package/dist/Input/Input.types.js +5 -0
- package/dist/Input/index.d.ts +2 -0
- package/dist/Input/index.js +34 -0
- package/dist/List/List.css +9 -0
- package/dist/List/List.d.ts +5 -0
- package/dist/List/List.js +43 -0
- package/dist/List/List.types.d.ts +22 -0
- package/dist/List/List.types.js +5 -0
- package/dist/List/ListContext.d.ts +7 -0
- package/dist/List/ListContext.js +12 -0
- package/dist/List/ListItem.css +23 -0
- package/dist/List/ListItem.d.ts +5 -0
- package/dist/List/ListItem.js +57 -0
- package/dist/List/ListItem.types.d.ts +20 -0
- package/dist/List/ListItem.types.js +5 -0
- package/dist/List/ListItemContent.css +18 -0
- package/dist/List/ListItemContent.d.ts +5 -0
- package/dist/List/ListItemContent.js +37 -0
- package/dist/List/ListItemContent.types.d.ts +16 -0
- package/dist/List/ListItemContent.types.js +5 -0
- package/dist/List/ListItemExtra.css +7 -0
- package/dist/List/ListItemExtra.d.ts +5 -0
- package/dist/List/ListItemExtra.js +29 -0
- package/dist/List/ListItemExtra.types.d.ts +8 -0
- package/dist/List/ListItemExtra.types.js +5 -0
- package/dist/List/ListItemFooter.css +9 -0
- package/dist/List/ListItemFooter.d.ts +5 -0
- package/dist/List/ListItemFooter.js +29 -0
- package/dist/List/ListItemFooter.types.d.ts +8 -0
- package/dist/List/ListItemFooter.types.js +5 -0
- package/dist/List/ListItemHeader.css +7 -0
- package/dist/List/ListItemHeader.d.ts +5 -0
- package/dist/List/ListItemHeader.js +29 -0
- package/dist/List/ListItemHeader.types.d.ts +8 -0
- package/dist/List/ListItemHeader.types.js +5 -0
- package/dist/List/index.d.ts +13 -0
- package/dist/List/index.js +134 -0
- package/dist/Loading/Loading.css +31 -0
- package/dist/Loading/Loading.d.ts +5 -0
- package/dist/Loading/Loading.js +39 -0
- package/dist/Loading/Loading.types.d.ts +20 -0
- package/dist/Loading/Loading.types.js +5 -0
- package/dist/Loading/index.d.ts +2 -0
- package/dist/Loading/index.js +34 -0
- package/dist/Modal/Modal.css +15 -0
- package/dist/Modal/Modal.d.ts +5 -0
- package/dist/Modal/Modal.js +89 -0
- package/dist/Modal/Modal.types.d.ts +20 -0
- package/dist/Modal/Modal.types.js +5 -0
- package/dist/Modal/index.d.ts +3 -0
- package/dist/Modal/index.js +34 -0
- package/dist/NavBar/NavBar.css +57 -0
- package/dist/NavBar/NavBar.d.ts +5 -0
- package/dist/NavBar/NavBar.js +87 -0
- package/dist/NavBar/NavBar.types.d.ts +44 -0
- package/dist/NavBar/NavBar.types.js +5 -0
- package/dist/NavBar/index.d.ts +2 -0
- package/dist/NavBar/index.js +34 -0
- package/dist/Portal/Portal.d.ts +4 -0
- package/dist/Portal/Portal.js +18 -0
- package/dist/Portal/Portal.miniapp.d.ts +4 -0
- package/dist/Portal/Portal.miniapp.js +44 -0
- package/dist/Portal/Portal.types.d.ts +22 -0
- package/dist/Portal/Portal.types.js +5 -0
- package/dist/Portal/PortalCore.d.ts +8 -0
- package/dist/Portal/PortalCore.js +57 -0
- package/dist/Portal/index.d.ts +3 -0
- package/dist/Portal/index.js +34 -0
- package/dist/Progress/Progress.css +22 -0
- package/dist/Progress/Progress.d.ts +8 -0
- package/dist/Progress/Progress.js +89 -0
- package/dist/Progress/Progress.types.d.ts +28 -0
- package/dist/Progress/Progress.types.js +5 -0
- package/dist/Progress/index.d.ts +3 -0
- package/dist/Progress/index.js +34 -0
- package/dist/Radio/Radio.css +65 -0
- package/dist/Radio/Radio.d.ts +5 -0
- package/dist/Radio/Radio.js +120 -0
- package/dist/Radio/Radio.types.d.ts +83 -0
- package/dist/Radio/Radio.types.js +5 -0
- package/dist/Radio/RadioButtonIcon.d.ts +12 -0
- package/dist/Radio/RadioButtonIcon.js +38 -0
- package/dist/Radio/RadioContext.d.ts +5 -0
- package/dist/Radio/RadioContext.js +11 -0
- package/dist/Radio/RadioGroup.d.ts +5 -0
- package/dist/Radio/RadioGroup.js +51 -0
- package/dist/Radio/index.d.ts +3 -0
- package/dist/Radio/index.js +42 -0
- package/dist/Rating/Rating.css +52 -0
- package/dist/Rating/Rating.d.ts +5 -0
- package/dist/Rating/Rating.js +100 -0
- package/dist/Rating/Rating.types.d.ts +66 -0
- package/dist/Rating/Rating.types.js +5 -0
- package/dist/Rating/index.d.ts +2 -0
- package/dist/Rating/index.js +34 -0
- package/dist/ScrollView/ScrollView.css +19 -0
- package/dist/ScrollView/ScrollView.d.ts +5 -0
- package/dist/ScrollView/ScrollView.js +204 -0
- package/dist/ScrollView/ScrollView.types.d.ts +258 -0
- package/dist/ScrollView/ScrollView.types.js +5 -0
- package/dist/ScrollView/index.d.ts +3 -0
- package/dist/ScrollView/index.js +34 -0
- package/dist/ScrollView/index.miniapp.d.ts +3 -0
- package/dist/ScrollView/index.miniapp.js +14 -0
- package/dist/Select/Select.css +89 -0
- package/dist/Select/Select.d.ts +5 -0
- package/dist/Select/Select.js +159 -0
- package/dist/Select/Select.types.d.ts +98 -0
- package/dist/Select/Select.types.js +5 -0
- package/dist/Select/SelectOption.d.ts +5 -0
- package/dist/Select/SelectOption.js +51 -0
- package/dist/Select/index.d.ts +4 -0
- package/dist/Select/index.js +42 -0
- package/dist/Select/selectContext.d.ts +4 -0
- package/dist/Select/selectContext.js +11 -0
- package/dist/Skeleton/Skeleton.css +54 -0
- package/dist/Skeleton/Skeleton.d.ts +5 -0
- package/dist/Skeleton/Skeleton.js +42 -0
- package/dist/Skeleton/Skeleton.types.d.ts +33 -0
- package/dist/Skeleton/Skeleton.types.js +5 -0
- package/dist/Skeleton/index.d.ts +3 -0
- package/dist/Skeleton/index.js +34 -0
- package/dist/Slide/Slide.d.ts +4 -0
- package/dist/Slide/Slide.js +88 -0
- package/dist/Slide/Slide.types.d.ts +14 -0
- package/dist/Slide/Slide.types.js +5 -0
- package/dist/Slide/index.d.ts +3 -0
- package/dist/Slide/index.js +34 -0
- package/dist/Slider/Slider.css +95 -0
- package/dist/Slider/Slider.d.ts +5 -0
- package/dist/Slider/Slider.js +281 -0
- package/dist/Slider/Slider.types.d.ts +62 -0
- package/dist/Slider/Slider.types.js +5 -0
- package/dist/Slider/index.d.ts +2 -0
- package/dist/Slider/index.js +34 -0
- package/dist/Slider/utils.d.ts +14 -0
- package/dist/Slider/utils.js +30 -0
- package/dist/Stack/Stack.css +11 -0
- package/dist/Stack/Stack.d.ts +5 -0
- package/dist/Stack/Stack.js +53 -0
- package/dist/Stack/Stack.types.d.ts +35 -0
- package/dist/Stack/Stack.types.js +5 -0
- package/dist/Stack/demo/StackDemo.d.ts +4 -0
- package/dist/Stack/demo/StackDemo.js +126 -0
- package/dist/Stack/demo/index.css +23 -0
- package/dist/Stack/index.d.ts +3 -0
- package/dist/Stack/index.js +34 -0
- package/dist/Steps/Step.css +174 -0
- package/dist/Steps/Step.d.ts +5 -0
- package/dist/Steps/Step.js +107 -0
- package/dist/Steps/Step.types.d.ts +35 -0
- package/dist/Steps/Step.types.js +5 -0
- package/dist/Steps/Steps.css +14 -0
- package/dist/Steps/Steps.d.ts +5 -0
- package/dist/Steps/Steps.js +65 -0
- package/dist/Steps/Steps.types.d.ts +35 -0
- package/dist/Steps/Steps.types.js +5 -0
- package/dist/Steps/StepsContext.d.ts +5 -0
- package/dist/Steps/StepsContext.js +11 -0
- package/dist/Steps/index.d.ts +4 -0
- package/dist/Steps/index.js +54 -0
- package/dist/Swiper/Swiper.css +20 -0
- package/dist/Swiper/Swiper.d.ts +10 -0
- package/dist/Swiper/Swiper.js +109 -0
- package/dist/Swiper/Swiper.types.d.ts +173 -0
- package/dist/Swiper/Swiper.types.js +5 -0
- package/dist/Swiper/SwiperItem.d.ts +7 -0
- package/dist/Swiper/SwiperItem.js +30 -0
- package/dist/Swiper/index.d.ts +3 -0
- package/dist/Swiper/index.js +42 -0
- package/dist/Swiper/index.miniapp.d.ts +8 -0
- package/dist/Swiper/index.miniapp.js +23 -0
- package/dist/Switch/Switch.css +127 -0
- package/dist/Switch/Switch.d.ts +5 -0
- package/dist/Switch/Switch.js +73 -0
- package/dist/Switch/Switch.types.d.ts +56 -0
- package/dist/Switch/Switch.types.js +5 -0
- package/dist/Switch/index.d.ts +3 -0
- package/dist/Switch/index.js +34 -0
- package/dist/TabBar/TabBar.css +8 -0
- package/dist/TabBar/TabBar.d.ts +5 -0
- package/dist/TabBar/TabBar.js +47 -0
- package/dist/TabBar/TabBarContext.d.ts +27 -0
- package/dist/TabBar/TabBarContext.js +9 -0
- package/dist/TabBar/TabBarItem.css +38 -0
- package/dist/TabBar/TabBarItem.d.ts +5 -0
- package/dist/TabBar/TabBarItem.js +62 -0
- package/dist/TabBar/index.d.ts +4 -0
- package/dist/TabBar/index.js +36 -0
- package/dist/TabBar/index.types.d.ts +54 -0
- package/dist/TabBar/index.types.js +5 -0
- package/dist/Tabs/Tab.css +52 -0
- package/dist/Tabs/Tab.d.ts +5 -0
- package/dist/Tabs/Tab.js +58 -0
- package/dist/Tabs/Tab.types.d.ts +12 -0
- package/dist/Tabs/Tab.types.js +5 -0
- package/dist/Tabs/TabPanel.css +9 -0
- package/dist/Tabs/TabPanel.d.ts +5 -0
- package/dist/Tabs/TabPanel.js +37 -0
- package/dist/Tabs/TabPanel.types.d.ts +19 -0
- package/dist/Tabs/TabPanel.types.js +5 -0
- package/dist/Tabs/Tabs.css +56 -0
- package/dist/Tabs/Tabs.d.ts +5 -0
- package/dist/Tabs/Tabs.js +193 -0
- package/dist/Tabs/Tabs.types.d.ts +45 -0
- package/dist/Tabs/Tabs.types.js +5 -0
- package/dist/Tabs/TabsContext.d.ts +9 -0
- package/dist/Tabs/TabsContext.js +14 -0
- package/dist/Tabs/index.d.ts +6 -0
- package/dist/Tabs/index.js +74 -0
- package/dist/Tabs/utils/bound.d.ts +1 -0
- package/dist/Tabs/utils/bound.js +16 -0
- package/dist/Tag/Tag.css +97 -0
- package/dist/Tag/Tag.d.ts +5 -0
- package/dist/Tag/Tag.js +80 -0
- package/dist/Tag/Tag.types.d.ts +23 -0
- package/dist/Tag/Tag.types.js +5 -0
- package/dist/Tag/TagGroup.css +16 -0
- package/dist/Tag/TagGroup.d.ts +5 -0
- package/dist/Tag/TagGroup.js +27 -0
- package/dist/Tag/TagGroup.types.d.ts +6 -0
- package/dist/Tag/TagGroup.types.js +5 -0
- package/dist/Tag/index.d.ts +5 -0
- package/dist/Tag/index.js +48 -0
- package/dist/TextArea/TextArea.css +43 -0
- package/dist/TextArea/TextArea.d.ts +5 -0
- package/dist/TextArea/TextArea.js +149 -0
- package/dist/TextArea/TextArea.types.d.ts +70 -0
- package/dist/TextArea/TextArea.types.js +5 -0
- package/dist/TextArea/index.d.ts +2 -0
- package/dist/TextArea/index.js +34 -0
- package/dist/Transition/Transition.d.ts +4 -0
- package/dist/Transition/Transition.js +19 -0
- package/dist/Transition/Transition.miniapp.d.ts +4 -0
- package/dist/Transition/Transition.miniapp.js +19 -0
- package/dist/Transition/Transition.types.d.ts +100 -0
- package/dist/Transition/Transition.types.js +5 -0
- package/dist/Transition/TransitionCore.d.ts +4 -0
- package/dist/Transition/TransitionCore.js +180 -0
- package/dist/Transition/index.d.ts +3 -0
- package/dist/Transition/index.js +34 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.js +423 -0
- package/es/ActionSheet/ActionSheet.css +27 -0
- package/es/ActionSheet/ActionSheet.d.ts +5 -0
- package/es/ActionSheet/ActionSheet.js +59 -0
- package/es/ActionSheet/ActionSheet.types.d.ts +28 -0
- package/es/ActionSheet/ActionSheet.types.js +1 -0
- package/es/ActionSheet/ActionSheetContext.d.ts +4 -0
- package/es/ActionSheet/ActionSheetContext.js +4 -0
- package/es/ActionSheet/ActionSheetItem.css +51 -0
- package/es/ActionSheet/ActionSheetItem.d.ts +5 -0
- package/es/ActionSheet/ActionSheetItem.js +51 -0
- package/es/ActionSheet/ActionSheetItem.types.d.ts +38 -0
- package/es/ActionSheet/ActionSheetItem.types.js +1 -0
- package/es/ActionSheet/index.d.ts +4 -0
- package/es/ActionSheet/index.js +4 -0
- package/es/Alert/Alert.d.ts +5 -0
- package/es/Alert/Alert.js +110 -0
- package/es/Alert/Alert.types.d.ts +61 -0
- package/es/Alert/Alert.types.js +1 -0
- package/es/Alert/index.css +89 -0
- package/es/Alert/index.d.ts +4 -0
- package/es/Alert/index.js +4 -0
- package/es/Avatar/Avatar.css +43 -0
- package/es/Avatar/Avatar.d.ts +5 -0
- package/es/Avatar/Avatar.js +55 -0
- package/es/Avatar/Avatar.types.d.ts +46 -0
- package/es/Avatar/Avatar.types.js +1 -0
- package/es/Avatar/AvatarGroup.css +31 -0
- package/es/Avatar/AvatarGroup.d.ts +5 -0
- package/es/Avatar/AvatarGroup.js +65 -0
- package/es/Avatar/AvatarGroup.types.d.ts +27 -0
- package/es/Avatar/AvatarGroup.types.js +1 -0
- package/es/Avatar/index.d.ts +6 -0
- package/es/Avatar/index.js +6 -0
- package/es/Backdrop/Backdrop.css +14 -0
- package/es/Backdrop/Backdrop.d.ts +5 -0
- package/es/Backdrop/Backdrop.js +30 -0
- package/es/Backdrop/Backdrop.types.d.ts +17 -0
- package/es/Backdrop/Backdrop.types.js +1 -0
- package/es/Backdrop/index.d.ts +2 -0
- package/es/Backdrop/index.js +2 -0
- package/es/Badge/Badge.css +95 -0
- package/es/Badge/Badge.d.ts +5 -0
- package/es/Badge/Badge.js +38 -0
- package/es/Badge/Badge.types.d.ts +27 -0
- package/es/Badge/Badge.types.js +1 -0
- package/es/Badge/index.d.ts +2 -0
- package/es/Badge/index.js +2 -0
- package/es/Button/Button.css +200 -0
- package/es/Button/Button.d.ts +5 -0
- package/es/Button/Button.js +47 -0
- package/es/Button/Button.types.d.ts +52 -0
- package/es/Button/Button.types.js +1 -0
- package/es/Button/index.d.ts +2 -0
- package/es/Button/index.js +2 -0
- package/es/Calendar/Calendar.css +105 -0
- package/es/Calendar/Calendar.d.ts +5 -0
- package/es/Calendar/Calendar.js +286 -0
- package/es/Calendar/Calendar.types.d.ts +76 -0
- package/es/Calendar/Calendar.types.js +1 -0
- package/es/Calendar/index.d.ts +2 -0
- package/es/Calendar/index.js +2 -0
- package/es/Calendar/utils.d.ts +25 -0
- package/es/Calendar/utils.js +66 -0
- package/es/Card/Card.css +9 -0
- package/es/Card/Card.d.ts +5 -0
- package/es/Card/Card.js +21 -0
- package/es/Card/Card.types.d.ts +6 -0
- package/es/Card/Card.types.js +1 -0
- package/es/Card/CardContent.css +6 -0
- package/es/Card/CardContent.d.ts +5 -0
- package/es/Card/CardContent.js +19 -0
- package/es/Card/CardContent.types.d.ts +6 -0
- package/es/Card/CardContent.types.js +1 -0
- package/es/Card/CardFooter.css +8 -0
- package/es/Card/CardFooter.d.ts +5 -0
- package/es/Card/CardFooter.js +19 -0
- package/es/Card/CardFooter.types.d.ts +6 -0
- package/es/Card/CardFooter.types.js +1 -0
- package/es/Card/CardHeader.css +45 -0
- package/es/Card/CardHeader.d.ts +5 -0
- package/es/Card/CardHeader.js +53 -0
- package/es/Card/CardHeader.types.d.ts +23 -0
- package/es/Card/CardHeader.types.js +1 -0
- package/es/Card/index.d.ts +10 -0
- package/es/Card/index.js +10 -0
- package/es/Checkbox/Checkbox.css +45 -0
- package/es/Checkbox/Checkbox.d.ts +5 -0
- package/es/Checkbox/Checkbox.js +108 -0
- package/es/Checkbox/Checkbox.types.d.ts +84 -0
- package/es/Checkbox/Checkbox.types.js +1 -0
- package/es/Checkbox/CheckboxContext.d.ts +5 -0
- package/es/Checkbox/CheckboxContext.js +4 -0
- package/es/Checkbox/CheckboxGroup.d.ts +5 -0
- package/es/Checkbox/CheckboxGroup.js +64 -0
- package/es/Checkbox/index.d.ts +3 -0
- package/es/Checkbox/index.js +3 -0
- package/es/Countdown/Countdown.css +28 -0
- package/es/Countdown/Countdown.d.ts +5 -0
- package/es/Countdown/Countdown.js +109 -0
- package/es/Countdown/Countdown.types.d.ts +123 -0
- package/es/Countdown/Countdown.types.js +1 -0
- package/es/Countdown/index.d.ts +3 -0
- package/es/Countdown/index.js +3 -0
- package/es/Countdown/useCountdown.d.ts +10 -0
- package/es/Countdown/useCountdown.js +55 -0
- package/es/Countdown/utils.d.ts +9 -0
- package/es/Countdown/utils.js +126 -0
- package/es/Divider/Divider.css +41 -0
- package/es/Divider/Divider.d.ts +5 -0
- package/es/Divider/Divider.js +52 -0
- package/es/Divider/Divider.types.d.ts +19 -0
- package/es/Divider/Divider.types.js +1 -0
- package/es/Divider/index.d.ts +2 -0
- package/es/Divider/index.js +2 -0
- package/es/Drawer/Drawer.css +35 -0
- package/es/Drawer/Drawer.d.ts +5 -0
- package/es/Drawer/Drawer.js +71 -0
- package/es/Drawer/Drawer.types.d.ts +51 -0
- package/es/Drawer/Drawer.types.js +1 -0
- package/es/Drawer/index.d.ts +2 -0
- package/es/Drawer/index.js +2 -0
- package/es/Fade/Fade.d.ts +4 -0
- package/es/Fade/Fade.js +70 -0
- package/es/Fade/Fade.types.d.ts +9 -0
- package/es/Fade/Fade.types.js +1 -0
- package/es/Fade/index.d.ts +3 -0
- package/es/Fade/index.js +3 -0
- package/es/IconButton/IconButton.css +130 -0
- package/es/IconButton/IconButton.d.ts +5 -0
- package/es/IconButton/IconButton.js +45 -0
- package/es/IconButton/IconButton.types.d.ts +41 -0
- package/es/IconButton/IconButton.types.js +1 -0
- package/es/IconButton/index.d.ts +2 -0
- package/es/IconButton/index.js +2 -0
- package/es/Image/Image.d.ts +5 -0
- package/es/Image/Image.js +131 -0
- package/es/Image/Image.types.d.ts +48 -0
- package/es/Image/Image.types.js +1 -0
- package/es/Image/index.css +35 -0
- package/es/Image/index.d.ts +3 -0
- package/es/Image/index.js +3 -0
- package/es/Input/Input.css +59 -0
- package/es/Input/Input.d.ts +5 -0
- package/es/Input/Input.js +125 -0
- package/es/Input/Input.types.d.ts +70 -0
- package/es/Input/Input.types.js +1 -0
- package/es/Input/index.d.ts +2 -0
- package/es/Input/index.js +2 -0
- package/es/List/List.css +9 -0
- package/es/List/List.d.ts +5 -0
- package/es/List/List.js +37 -0
- package/es/List/List.types.d.ts +22 -0
- package/es/List/List.types.js +1 -0
- package/es/List/ListContext.d.ts +7 -0
- package/es/List/ListContext.js +5 -0
- package/es/List/ListItem.css +23 -0
- package/es/List/ListItem.d.ts +5 -0
- package/es/List/ListItem.js +52 -0
- package/es/List/ListItem.types.d.ts +20 -0
- package/es/List/ListItem.types.js +1 -0
- package/es/List/ListItemContent.css +18 -0
- package/es/List/ListItemContent.d.ts +5 -0
- package/es/List/ListItemContent.js +31 -0
- package/es/List/ListItemContent.types.d.ts +16 -0
- package/es/List/ListItemContent.types.js +1 -0
- package/es/List/ListItemExtra.css +7 -0
- package/es/List/ListItemExtra.d.ts +5 -0
- package/es/List/ListItemExtra.js +23 -0
- package/es/List/ListItemExtra.types.d.ts +8 -0
- package/es/List/ListItemExtra.types.js +1 -0
- package/es/List/ListItemFooter.css +9 -0
- package/es/List/ListItemFooter.d.ts +5 -0
- package/es/List/ListItemFooter.js +23 -0
- package/es/List/ListItemFooter.types.d.ts +8 -0
- package/es/List/ListItemFooter.types.js +1 -0
- package/es/List/ListItemHeader.css +7 -0
- package/es/List/ListItemHeader.d.ts +5 -0
- package/es/List/ListItemHeader.js +23 -0
- package/es/List/ListItemHeader.types.d.ts +8 -0
- package/es/List/ListItemHeader.types.js +1 -0
- package/es/List/index.d.ts +13 -0
- package/es/List/index.js +13 -0
- package/es/Loading/Loading.css +31 -0
- package/es/Loading/Loading.d.ts +5 -0
- package/es/Loading/Loading.js +33 -0
- package/es/Loading/Loading.types.d.ts +20 -0
- package/es/Loading/Loading.types.js +1 -0
- package/es/Loading/index.d.ts +2 -0
- package/es/Loading/index.js +2 -0
- package/es/Modal/Modal.css +15 -0
- package/es/Modal/Modal.d.ts +5 -0
- package/es/Modal/Modal.js +95 -0
- package/es/Modal/Modal.types.d.ts +20 -0
- package/es/Modal/Modal.types.js +1 -0
- package/es/Modal/index.d.ts +3 -0
- package/es/Modal/index.js +3 -0
- package/es/NavBar/NavBar.css +57 -0
- package/es/NavBar/NavBar.d.ts +5 -0
- package/es/NavBar/NavBar.js +82 -0
- package/es/NavBar/NavBar.types.d.ts +44 -0
- package/es/NavBar/NavBar.types.js +1 -0
- package/es/NavBar/index.d.ts +2 -0
- package/es/NavBar/index.js +2 -0
- package/es/Portal/Portal.d.ts +4 -0
- package/es/Portal/Portal.js +11 -0
- package/es/Portal/Portal.miniapp.d.ts +4 -0
- package/es/Portal/Portal.miniapp.js +33 -0
- package/es/Portal/Portal.types.d.ts +22 -0
- package/es/Portal/Portal.types.js +1 -0
- package/es/Portal/PortalCore.d.ts +8 -0
- package/es/Portal/PortalCore.js +57 -0
- package/es/Portal/index.d.ts +3 -0
- package/es/Portal/index.js +3 -0
- package/es/Progress/Progress.css +22 -0
- package/es/Progress/Progress.d.ts +8 -0
- package/es/Progress/Progress.js +90 -0
- package/es/Progress/Progress.types.d.ts +28 -0
- package/es/Progress/Progress.types.js +1 -0
- package/es/Progress/index.d.ts +3 -0
- package/es/Progress/index.js +3 -0
- package/es/Radio/Radio.css +65 -0
- package/es/Radio/Radio.d.ts +5 -0
- package/es/Radio/Radio.js +126 -0
- package/es/Radio/Radio.types.d.ts +83 -0
- package/es/Radio/Radio.types.js +1 -0
- package/es/Radio/RadioButtonIcon.d.ts +12 -0
- package/es/Radio/RadioButtonIcon.js +33 -0
- package/es/Radio/RadioContext.d.ts +5 -0
- package/es/Radio/RadioContext.js +4 -0
- package/es/Radio/RadioGroup.d.ts +5 -0
- package/es/Radio/RadioGroup.js +52 -0
- package/es/Radio/index.d.ts +3 -0
- package/es/Radio/index.js +3 -0
- package/es/Rating/Rating.css +52 -0
- package/es/Rating/Rating.d.ts +5 -0
- package/es/Rating/Rating.js +107 -0
- package/es/Rating/Rating.types.d.ts +66 -0
- package/es/Rating/Rating.types.js +1 -0
- package/es/Rating/index.d.ts +2 -0
- package/es/Rating/index.js +2 -0
- package/es/ScrollView/ScrollView.css +19 -0
- package/es/ScrollView/ScrollView.d.ts +5 -0
- package/es/ScrollView/ScrollView.js +204 -0
- package/es/ScrollView/ScrollView.types.d.ts +258 -0
- package/es/ScrollView/ScrollView.types.js +1 -0
- package/es/ScrollView/index.d.ts +3 -0
- package/es/ScrollView/index.js +3 -0
- package/es/ScrollView/index.miniapp.d.ts +3 -0
- package/es/ScrollView/index.miniapp.js +3 -0
- package/es/Select/Select.css +89 -0
- package/es/Select/Select.d.ts +5 -0
- package/es/Select/Select.js +165 -0
- package/es/Select/Select.types.d.ts +98 -0
- package/es/Select/Select.types.js +1 -0
- package/es/Select/SelectOption.d.ts +5 -0
- package/es/Select/SelectOption.js +43 -0
- package/es/Select/index.d.ts +4 -0
- package/es/Select/index.js +4 -0
- package/es/Select/selectContext.d.ts +4 -0
- package/es/Select/selectContext.js +5 -0
- package/es/Skeleton/Skeleton.css +54 -0
- package/es/Skeleton/Skeleton.d.ts +5 -0
- package/es/Skeleton/Skeleton.js +38 -0
- package/es/Skeleton/Skeleton.types.d.ts +33 -0
- package/es/Skeleton/Skeleton.types.js +1 -0
- package/es/Skeleton/index.d.ts +3 -0
- package/es/Skeleton/index.js +3 -0
- package/es/Slide/Slide.d.ts +4 -0
- package/es/Slide/Slide.js +85 -0
- package/es/Slide/Slide.types.d.ts +14 -0
- package/es/Slide/Slide.types.js +1 -0
- package/es/Slide/index.d.ts +3 -0
- package/es/Slide/index.js +3 -0
- package/es/Slider/Slider.css +95 -0
- package/es/Slider/Slider.d.ts +5 -0
- package/es/Slider/Slider.js +318 -0
- package/es/Slider/Slider.types.d.ts +62 -0
- package/es/Slider/Slider.types.js +1 -0
- package/es/Slider/index.d.ts +2 -0
- package/es/Slider/index.js +2 -0
- package/es/Slider/utils.d.ts +14 -0
- package/es/Slider/utils.js +25 -0
- package/es/Stack/Stack.css +11 -0
- package/es/Stack/Stack.d.ts +5 -0
- package/es/Stack/Stack.js +50 -0
- package/es/Stack/Stack.types.d.ts +35 -0
- package/es/Stack/Stack.types.js +1 -0
- package/es/Stack/demo/StackDemo.d.ts +4 -0
- package/es/Stack/demo/StackDemo.js +128 -0
- package/es/Stack/demo/index.css +23 -0
- package/es/Stack/index.d.ts +3 -0
- package/es/Stack/index.js +3 -0
- package/es/Steps/Step.css +174 -0
- package/es/Steps/Step.d.ts +5 -0
- package/es/Steps/Step.js +88 -0
- package/es/Steps/Step.types.d.ts +35 -0
- package/es/Steps/Step.types.js +1 -0
- package/es/Steps/Steps.css +14 -0
- package/es/Steps/Steps.d.ts +5 -0
- package/es/Steps/Steps.js +60 -0
- package/es/Steps/Steps.types.d.ts +35 -0
- package/es/Steps/Steps.types.js +1 -0
- package/es/Steps/StepsContext.d.ts +5 -0
- package/es/Steps/StepsContext.js +4 -0
- package/es/Steps/index.d.ts +4 -0
- package/es/Steps/index.js +4 -0
- package/es/Swiper/Swiper.css +20 -0
- package/es/Swiper/Swiper.d.ts +10 -0
- package/es/Swiper/Swiper.js +112 -0
- package/es/Swiper/Swiper.types.d.ts +173 -0
- package/es/Swiper/Swiper.types.js +1 -0
- package/es/Swiper/SwiperItem.d.ts +7 -0
- package/es/Swiper/SwiperItem.js +24 -0
- package/es/Swiper/index.d.ts +3 -0
- package/es/Swiper/index.js +3 -0
- package/es/Swiper/index.miniapp.d.ts +8 -0
- package/es/Swiper/index.miniapp.js +6 -0
- package/es/Switch/Switch.css +127 -0
- package/es/Switch/Switch.d.ts +5 -0
- package/es/Switch/Switch.js +76 -0
- package/es/Switch/Switch.types.d.ts +56 -0
- package/es/Switch/Switch.types.js +1 -0
- package/es/Switch/index.d.ts +3 -0
- package/es/Switch/index.js +3 -0
- package/es/TabBar/TabBar.css +8 -0
- package/es/TabBar/TabBar.d.ts +5 -0
- package/es/TabBar/TabBar.js +42 -0
- package/es/TabBar/TabBarContext.d.ts +27 -0
- package/es/TabBar/TabBarContext.js +3 -0
- package/es/TabBar/TabBarItem.css +38 -0
- package/es/TabBar/TabBarItem.d.ts +5 -0
- package/es/TabBar/TabBarItem.js +54 -0
- package/es/TabBar/index.d.ts +4 -0
- package/es/TabBar/index.js +4 -0
- package/es/TabBar/index.types.d.ts +54 -0
- package/es/TabBar/index.types.js +1 -0
- package/es/Tabs/Tab.css +52 -0
- package/es/Tabs/Tab.d.ts +5 -0
- package/es/Tabs/Tab.js +50 -0
- package/es/Tabs/Tab.types.d.ts +12 -0
- package/es/Tabs/Tab.types.js +1 -0
- package/es/Tabs/TabPanel.css +9 -0
- package/es/Tabs/TabPanel.d.ts +5 -0
- package/es/Tabs/TabPanel.js +30 -0
- package/es/Tabs/TabPanel.types.d.ts +19 -0
- package/es/Tabs/TabPanel.types.js +1 -0
- package/es/Tabs/Tabs.css +56 -0
- package/es/Tabs/Tabs.d.ts +5 -0
- package/es/Tabs/Tabs.js +210 -0
- package/es/Tabs/Tabs.types.d.ts +45 -0
- package/es/Tabs/Tabs.types.js +1 -0
- package/es/Tabs/TabsContext.d.ts +9 -0
- package/es/Tabs/TabsContext.js +7 -0
- package/es/Tabs/index.d.ts +6 -0
- package/es/Tabs/index.js +6 -0
- package/es/Tabs/utils/bound.d.ts +1 -0
- package/es/Tabs/utils/bound.js +10 -0
- package/es/Tag/Tag.css +97 -0
- package/es/Tag/Tag.d.ts +5 -0
- package/es/Tag/Tag.js +76 -0
- package/es/Tag/Tag.types.d.ts +23 -0
- package/es/Tag/Tag.types.js +1 -0
- package/es/Tag/TagGroup.css +16 -0
- package/es/Tag/TagGroup.d.ts +5 -0
- package/es/Tag/TagGroup.js +21 -0
- package/es/Tag/TagGroup.types.d.ts +6 -0
- package/es/Tag/TagGroup.types.js +1 -0
- package/es/Tag/index.d.ts +5 -0
- package/es/Tag/index.js +5 -0
- package/es/TextArea/TextArea.css +43 -0
- package/es/TextArea/TextArea.d.ts +5 -0
- package/es/TextArea/TextArea.js +150 -0
- package/es/TextArea/TextArea.types.d.ts +70 -0
- package/es/TextArea/TextArea.types.js +1 -0
- package/es/TextArea/index.d.ts +2 -0
- package/es/TextArea/index.js +2 -0
- package/es/Transition/Transition.d.ts +4 -0
- package/es/Transition/Transition.js +12 -0
- package/es/Transition/Transition.miniapp.d.ts +4 -0
- package/es/Transition/Transition.miniapp.js +12 -0
- package/es/Transition/Transition.types.d.ts +100 -0
- package/es/Transition/Transition.types.js +1 -0
- package/es/Transition/TransitionCore.d.ts +4 -0
- package/es/Transition/TransitionCore.js +289 -0
- package/es/Transition/index.d.ts +3 -0
- package/es/Transition/index.js +3 -0
- package/es/index.d.ts +38 -0
- package/es/index.js +38 -0
- package/package.json +50 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
.bui-slider {
|
|
2
|
+
--line-color: var(--bui-color-primary);
|
|
3
|
+
--line-bg-color: var(--bui-color-border-default);
|
|
4
|
+
--tooltip-font-size: var(--bui-text-size-3);
|
|
5
|
+
--tooltip-color: var(--bui-color-white);
|
|
6
|
+
--tooltip-bg-color: var(--line-color);
|
|
7
|
+
position: relative;
|
|
8
|
+
width: 100%;
|
|
9
|
+
height: 2px;
|
|
10
|
+
padding: 19px 0;
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
font-family: var(--bui-font-family);
|
|
13
|
+
}
|
|
14
|
+
.bui-slider-disabled {
|
|
15
|
+
pointer-events: none;
|
|
16
|
+
opacity: 0.5;
|
|
17
|
+
}
|
|
18
|
+
.bui-slider-line {
|
|
19
|
+
position: absolute;
|
|
20
|
+
top: 50%;
|
|
21
|
+
left: 0;
|
|
22
|
+
height: 2px;
|
|
23
|
+
transform: translateY(-50%);
|
|
24
|
+
background-color: var(--line-color);
|
|
25
|
+
}
|
|
26
|
+
.bui-slider-rail {
|
|
27
|
+
position: absolute;
|
|
28
|
+
top: 50%;
|
|
29
|
+
left: 0;
|
|
30
|
+
width: 100%;
|
|
31
|
+
height: 2px;
|
|
32
|
+
transform: translateY(-50%);
|
|
33
|
+
background-color: var(--line-bg-color);
|
|
34
|
+
}
|
|
35
|
+
.bui-slider-button {
|
|
36
|
+
display: flex;
|
|
37
|
+
position: absolute;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
align-items: center;
|
|
40
|
+
width: 26px;
|
|
41
|
+
height: 26px;
|
|
42
|
+
background-color: #fff;
|
|
43
|
+
box-shadow: #ddd 0 0 10px;
|
|
44
|
+
border-radius: 50%;
|
|
45
|
+
transform: translate(-50%, -50%);
|
|
46
|
+
font-size: var(--bui-title-size-3);
|
|
47
|
+
cursor: grab;
|
|
48
|
+
}
|
|
49
|
+
.bui-slider-button::after {
|
|
50
|
+
position: absolute;
|
|
51
|
+
content: '';
|
|
52
|
+
top: -10px;
|
|
53
|
+
bottom: -10px;
|
|
54
|
+
left: -10px;
|
|
55
|
+
right: -10px;
|
|
56
|
+
}
|
|
57
|
+
.bui-slider-button-0 {
|
|
58
|
+
left: 0%;
|
|
59
|
+
top: 50%;
|
|
60
|
+
z-index: var(--bui-z-index-affix);
|
|
61
|
+
}
|
|
62
|
+
.bui-slider-button-1 {
|
|
63
|
+
left: 0%;
|
|
64
|
+
top: 50%;
|
|
65
|
+
z-index: var(--bui-z-index-affix);
|
|
66
|
+
}
|
|
67
|
+
.bui-slider-tooltip {
|
|
68
|
+
position: absolute;
|
|
69
|
+
top: -14px;
|
|
70
|
+
width: 46px;
|
|
71
|
+
height: 24px;
|
|
72
|
+
line-height: 24px;
|
|
73
|
+
font-size: var(--tooltip-font-size);
|
|
74
|
+
border-radius: 24px;
|
|
75
|
+
color: var(--tooltip-color);
|
|
76
|
+
text-align: center;
|
|
77
|
+
background-color: var(--tooltip-bg-color);
|
|
78
|
+
transform: translate(-50%, -50%);
|
|
79
|
+
z-index: var(--bui-z-index-popover);
|
|
80
|
+
}
|
|
81
|
+
.bui-slider-tooltip::after {
|
|
82
|
+
position: absolute;
|
|
83
|
+
bottom: -10px;
|
|
84
|
+
left: 0;
|
|
85
|
+
right: 0;
|
|
86
|
+
margin: 0 auto;
|
|
87
|
+
content: '';
|
|
88
|
+
width: 0;
|
|
89
|
+
height: 0;
|
|
90
|
+
border: 6px solid transparent;
|
|
91
|
+
border-top: 6px solid var(--tooltip-bg-color);
|
|
92
|
+
}
|
|
93
|
+
.bui-slider-tooltip-hidden {
|
|
94
|
+
display: none;
|
|
95
|
+
}
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["className", "defaultValue", "value", "min", "max", "step", "tipVisible", "tooltipRender", "disabled", "startIcon", "endIcon", "disableSwap", "onChange"];
|
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
8
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
10
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
11
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
12
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
13
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
14
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
15
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
16
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
17
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
18
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
19
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
21
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
22
|
+
import { GripperBarVerticalIcon } from '@bifrostui/icons';
|
|
23
|
+
import { isMini, useForkRef, useTouchEmulator, useValue, getBoundingClientRect } from '@bifrostui/utils';
|
|
24
|
+
import clsx from 'clsx';
|
|
25
|
+
import React, { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
26
|
+
import "./Slider.css";
|
|
27
|
+
import { formatValue, isSameValue, sortValue } from "./utils";
|
|
28
|
+
var classes = {
|
|
29
|
+
root: 'bui-slider',
|
|
30
|
+
button: 'bui-slider-button',
|
|
31
|
+
tooltip: 'bui-slider-tooltip',
|
|
32
|
+
disabled: 'bui-slider-disabled'
|
|
33
|
+
};
|
|
34
|
+
var SLIDER_BUTTON = {
|
|
35
|
+
FRONT: 0,
|
|
36
|
+
END: 1
|
|
37
|
+
};
|
|
38
|
+
var Slider = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
39
|
+
var className = props.className,
|
|
40
|
+
defaultValue = props.defaultValue,
|
|
41
|
+
valueProp = props.value,
|
|
42
|
+
min = props.min,
|
|
43
|
+
max = props.max,
|
|
44
|
+
step = props.step,
|
|
45
|
+
tipVisible = props.tipVisible,
|
|
46
|
+
tooltipRender = props.tooltipRender,
|
|
47
|
+
disabled = props.disabled,
|
|
48
|
+
startIcon = props.startIcon,
|
|
49
|
+
endIcon = props.endIcon,
|
|
50
|
+
disableSwap = props.disableSwap,
|
|
51
|
+
_onChange = props.onChange,
|
|
52
|
+
others = _objectWithoutProperties(props, _excluded);
|
|
53
|
+
var initialDefaultValue = useRef(defaultValue);
|
|
54
|
+
// 处理value/defaultValue都不传的异常场景
|
|
55
|
+
var latestVal = useRef(0);
|
|
56
|
+
var shouldProtection = valueProp === undefined && defaultValue === undefined;
|
|
57
|
+
var value = shouldProtection ? latestVal.current : valueProp;
|
|
58
|
+
var _useState = useState(null),
|
|
59
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
60
|
+
rootRef = _useState2[0],
|
|
61
|
+
setRootRef = _useState2[1];
|
|
62
|
+
var handleRef = useForkRef(ref, setRootRef);
|
|
63
|
+
useTouchEmulator(rootRef);
|
|
64
|
+
|
|
65
|
+
// Slider BoundingClientRect
|
|
66
|
+
var sliderRect = useRef();
|
|
67
|
+
// 滑动开始距离文档X轴原点距离
|
|
68
|
+
var touchStartPageX = useRef();
|
|
69
|
+
// 按钮在滑动开始时距离左边的距离
|
|
70
|
+
var touchStartLeft = useRef();
|
|
71
|
+
// 记录操作按钮
|
|
72
|
+
var buttonIndex = useRef(0);
|
|
73
|
+
// 记录双滑块touchMove之前的值
|
|
74
|
+
var beforeMoveValue = useRef([0, 0]);
|
|
75
|
+
|
|
76
|
+
// 默认图标
|
|
77
|
+
var defaultIcon = /*#__PURE__*/React.createElement(GripperBarVerticalIcon, {
|
|
78
|
+
htmlColor: "#2e333e"
|
|
79
|
+
});
|
|
80
|
+
// 根据初始化时的数据判断是否为双滑块
|
|
81
|
+
var initialRange = useRef(value !== undefined && Array.isArray(value) || defaultValue !== undefined && Array.isArray(defaultValue));
|
|
82
|
+
// 是否为双滑块
|
|
83
|
+
var range = useMemo(function () {
|
|
84
|
+
// defaultValue传state,且通过setState改变defaltValue类型,此时使用初始化时的range(initialRange)判断
|
|
85
|
+
if (Array.isArray(defaultValue) && !Array.isArray(initialDefaultValue.current)) {
|
|
86
|
+
return initialRange.current;
|
|
87
|
+
}
|
|
88
|
+
return value !== undefined && Array.isArray(value) || defaultValue !== undefined && Array.isArray(defaultValue);
|
|
89
|
+
}, [value, defaultValue]);
|
|
90
|
+
|
|
91
|
+
// 气泡提示显示与隐藏
|
|
92
|
+
var _useState3 = useState(false),
|
|
93
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
94
|
+
frontTooltipVisible = _useState4[0],
|
|
95
|
+
setFrontTooltipVisible = _useState4[1];
|
|
96
|
+
var _useState5 = useState(false),
|
|
97
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
98
|
+
endTooltipVisible = _useState6[0],
|
|
99
|
+
setEndTooltipVisible = _useState6[1];
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* 格式化value、defaultValue
|
|
103
|
+
* @type undefined | number[]
|
|
104
|
+
*/
|
|
105
|
+
var formattedValue = formatValue(value);
|
|
106
|
+
var formattedDefaultValue = formatValue(defaultValue);
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* 使用格式化后的value、defaultValue初始化sliderValue,应始终使用triggerChange改变值
|
|
110
|
+
* @type undefined | number[]
|
|
111
|
+
*/
|
|
112
|
+
var _useValue = useValue({
|
|
113
|
+
value: formattedValue,
|
|
114
|
+
defaultValue: formattedDefaultValue,
|
|
115
|
+
onChange: function onChange(e, data) {
|
|
116
|
+
_onChange === null || _onChange === void 0 || _onChange(e, {
|
|
117
|
+
value: data === null || data === void 0 ? void 0 : data.value,
|
|
118
|
+
buttonIndex: buttonIndex.current
|
|
119
|
+
});
|
|
120
|
+
},
|
|
121
|
+
config: {
|
|
122
|
+
name: 'Slider',
|
|
123
|
+
state: 'value'
|
|
124
|
+
}
|
|
125
|
+
}),
|
|
126
|
+
_useValue2 = _slicedToArray(_useValue, 2),
|
|
127
|
+
sliderValue = _useValue2[0],
|
|
128
|
+
triggerChange = _useValue2[1];
|
|
129
|
+
|
|
130
|
+
// 内部状态值
|
|
131
|
+
var internalValue = useMemo(function () {
|
|
132
|
+
return sliderValue === undefined ? [min, max] : sliderValue;
|
|
133
|
+
}, [sliderValue]);
|
|
134
|
+
// 记录上一次值
|
|
135
|
+
var preValueRef = useRef(internalValue[buttonIndex.current]);
|
|
136
|
+
// 记录气泡值
|
|
137
|
+
var tooltipRef = useRef(internalValue);
|
|
138
|
+
|
|
139
|
+
// 最大最小值范围
|
|
140
|
+
var scope = useMemo(function () {
|
|
141
|
+
return Number(max) - Number(min);
|
|
142
|
+
}, [max, min]);
|
|
143
|
+
|
|
144
|
+
// 提示气泡展示逻辑
|
|
145
|
+
var tooltipVisible = useMemo(function () {
|
|
146
|
+
var startVisible = buttonIndex.current === SLIDER_BUTTON.FRONT && frontTooltipVisible;
|
|
147
|
+
var endVisible = buttonIndex.current === SLIDER_BUTTON.END && endTooltipVisible;
|
|
148
|
+
return tipVisible || !tipVisible && (startVisible || endVisible);
|
|
149
|
+
}, [tipVisible, frontTooltipVisible, endTooltipVisible]);
|
|
150
|
+
|
|
151
|
+
// 着色条样式
|
|
152
|
+
var lineStyle = useMemo(function () {
|
|
153
|
+
var sortedValue = sortValue(internalValue);
|
|
154
|
+
var width = "".concat((sortedValue[1] - sortedValue[0] - min) / scope * 100, "%");
|
|
155
|
+
// 单滑块模式但动态修改value为数组,此时按照数组最小值计算着色条宽度
|
|
156
|
+
if (!range && Array.isArray(value)) {
|
|
157
|
+
width = "".concat((sortedValue[0] - min) / scope * 100, "%");
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
left: range ? "".concat((sortedValue[0] - min) / scope * 100, "%") : '0%',
|
|
161
|
+
width: width
|
|
162
|
+
};
|
|
163
|
+
}, [internalValue, scope, value]);
|
|
164
|
+
var getLineWidth = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
165
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
166
|
+
while (1) switch (_context.prev = _context.next) {
|
|
167
|
+
case 0:
|
|
168
|
+
if (rootRef) {
|
|
169
|
+
_context.next = 2;
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
return _context.abrupt("return");
|
|
173
|
+
case 2:
|
|
174
|
+
_context.next = 4;
|
|
175
|
+
return getBoundingClientRect(rootRef);
|
|
176
|
+
case 4:
|
|
177
|
+
sliderRect.current = _context.sent;
|
|
178
|
+
case 5:
|
|
179
|
+
case "end":
|
|
180
|
+
return _context.stop();
|
|
181
|
+
}
|
|
182
|
+
}, _callee);
|
|
183
|
+
})), [rootRef]);
|
|
184
|
+
useLayoutEffect(function () {
|
|
185
|
+
// 处理小程序初始化获取不到dom的问题
|
|
186
|
+
setTimeout(function () {
|
|
187
|
+
getLineWidth();
|
|
188
|
+
}, 100);
|
|
189
|
+
}, [rootRef]);
|
|
190
|
+
var _onTouchStart = function onTouchStart(e) {
|
|
191
|
+
if (disabled) return;
|
|
192
|
+
beforeMoveValue.current = internalValue;
|
|
193
|
+
tooltipRef.current = internalValue;
|
|
194
|
+
// 补偿获取宽度,隐藏元素getBoundingClientRect获取不到dom信息
|
|
195
|
+
if (!sliderRect.current.width) {
|
|
196
|
+
getLineWidth();
|
|
197
|
+
}
|
|
198
|
+
// currentTarget只存在于事件触发到事件处理结束之间,须在异步操作之前保存下来
|
|
199
|
+
var currentTarget = isMini ? e.mpEvent.currentTarget : e.currentTarget;
|
|
200
|
+
touchStartPageX.current = e.touches[0].pageX;
|
|
201
|
+
touchStartLeft.current = currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.offsetLeft;
|
|
202
|
+
|
|
203
|
+
// 显示气泡提示
|
|
204
|
+
if (buttonIndex.current === SLIDER_BUTTON.END) {
|
|
205
|
+
setEndTooltipVisible(true);
|
|
206
|
+
} else {
|
|
207
|
+
setFrontTooltipVisible(true);
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
var onTouchMove = function onTouchMove(e) {
|
|
211
|
+
if (disabled) return;
|
|
212
|
+
// 触碰点当前x坐标
|
|
213
|
+
var currentX = e.touches[0].pageX;
|
|
214
|
+
// X轴滑动距离
|
|
215
|
+
var moveX = currentX - touchStartPageX.current;
|
|
216
|
+
// 计算下一个值
|
|
217
|
+
var posX = (touchStartLeft.current + moveX) / sliderRect.current.width * scope;
|
|
218
|
+
// 兼容一位小数
|
|
219
|
+
var nextPosition = step < 1 ? Math.round(posX * 10) / 10 : Math.round(posX);
|
|
220
|
+
if (nextPosition <= 0) nextPosition = 0;
|
|
221
|
+
if (nextPosition >= scope) nextPosition = scope;
|
|
222
|
+
|
|
223
|
+
// 滑动最新值
|
|
224
|
+
var nextValue = min + nextPosition;
|
|
225
|
+
var inStep = nextValue % step === 0;
|
|
226
|
+
|
|
227
|
+
// 滑动的最新值与上一次值不等时 & 符合当前步长,则更新sliderValue
|
|
228
|
+
if (!isSameValue(nextValue, preValueRef.current) && inStep) {
|
|
229
|
+
var latestValue = nextValue;
|
|
230
|
+
preValueRef.current = nextValue;
|
|
231
|
+
// 单滑块
|
|
232
|
+
tooltipRef.current = [latestValue, 0];
|
|
233
|
+
if (range) {
|
|
234
|
+
latestValue = _toConsumableArray(beforeMoveValue.current);
|
|
235
|
+
if (disableSwap) {
|
|
236
|
+
// 滑动前按钮
|
|
237
|
+
if (buttonIndex.current === SLIDER_BUTTON.FRONT && nextValue >= latestValue[SLIDER_BUTTON.END]) {
|
|
238
|
+
latestValue[SLIDER_BUTTON.END] = nextValue;
|
|
239
|
+
} else {
|
|
240
|
+
latestValue[buttonIndex.current] = nextValue;
|
|
241
|
+
}
|
|
242
|
+
// 滑动后按钮
|
|
243
|
+
if (buttonIndex.current === SLIDER_BUTTON.END && nextValue <= latestValue[SLIDER_BUTTON.FRONT]) {
|
|
244
|
+
latestValue[SLIDER_BUTTON.FRONT] = nextValue;
|
|
245
|
+
} else {
|
|
246
|
+
latestValue[buttonIndex.current] = nextValue;
|
|
247
|
+
}
|
|
248
|
+
tooltipRef.current = latestValue;
|
|
249
|
+
} else {
|
|
250
|
+
latestValue[buttonIndex.current] = nextValue;
|
|
251
|
+
// 气泡值不应sort排序
|
|
252
|
+
tooltipRef.current = latestValue;
|
|
253
|
+
latestValue = sortValue(latestValue);
|
|
254
|
+
}
|
|
255
|
+
preValueRef.current = latestValue[buttonIndex.current];
|
|
256
|
+
}
|
|
257
|
+
latestVal.current = defaultValue !== undefined ? formatValue(latestValue) : latestValue;
|
|
258
|
+
triggerChange(e, latestVal.current);
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
var onTouchEnd = function onTouchEnd() {
|
|
262
|
+
if (disabled) return;
|
|
263
|
+
// 置为排序后的值
|
|
264
|
+
tooltipRef.current = internalValue;
|
|
265
|
+
// 隐藏左右气泡提示
|
|
266
|
+
setFrontTooltipVisible(false);
|
|
267
|
+
setEndTooltipVisible(false);
|
|
268
|
+
};
|
|
269
|
+
var renderButton = function renderButton(index) {
|
|
270
|
+
var valuenow = internalValue[index];
|
|
271
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
272
|
+
key: index,
|
|
273
|
+
role: "slider",
|
|
274
|
+
className: clsx(classes.button, "".concat(classes.button, "-").concat(index)),
|
|
275
|
+
style: {
|
|
276
|
+
left: "".concat((valuenow - min) / scope * 100, "%")
|
|
277
|
+
},
|
|
278
|
+
tabIndex: disabled ? -1 : 0,
|
|
279
|
+
"aria-valuemin": props.min,
|
|
280
|
+
"aria-valuenow": valuenow,
|
|
281
|
+
"aria-valuemax": props.max,
|
|
282
|
+
"aria-orientation": "horizontal",
|
|
283
|
+
onTouchStart: function onTouchStart(event) {
|
|
284
|
+
buttonIndex.current = index;
|
|
285
|
+
_onTouchStart(event);
|
|
286
|
+
},
|
|
287
|
+
onTouchMove: onTouchMove,
|
|
288
|
+
onTouchEnd: onTouchEnd,
|
|
289
|
+
onTouchCancel: onTouchEnd
|
|
290
|
+
}, index === SLIDER_BUTTON.FRONT ? startIcon || defaultIcon : endIcon || defaultIcon);
|
|
291
|
+
};
|
|
292
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
293
|
+
className: clsx(classes.root, className, _defineProperty({}, classes.disabled, disabled)),
|
|
294
|
+
ref: handleRef
|
|
295
|
+
}, others), /*#__PURE__*/React.createElement("div", {
|
|
296
|
+
className: "".concat(classes.root, "-rail")
|
|
297
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
298
|
+
className: "".concat(classes.root, "-line"),
|
|
299
|
+
style: lineStyle
|
|
300
|
+
}), renderButton(SLIDER_BUTTON.FRONT), range && renderButton(SLIDER_BUTTON.END), /*#__PURE__*/React.createElement("div", {
|
|
301
|
+
className: clsx(classes.tooltip, _defineProperty({}, "".concat(classes.tooltip, "-hidden"), !tooltipVisible)),
|
|
302
|
+
style: {
|
|
303
|
+
left: "".concat((tooltipRef.current[buttonIndex.current] - min) / scope * 100, "%")
|
|
304
|
+
}
|
|
305
|
+
}, tooltipRender(tooltipRef.current[buttonIndex.current])));
|
|
306
|
+
});
|
|
307
|
+
Slider.displayName = 'BuiSlider';
|
|
308
|
+
Slider.defaultProps = {
|
|
309
|
+
min: 0,
|
|
310
|
+
max: 100,
|
|
311
|
+
step: 1,
|
|
312
|
+
disableSwap: false,
|
|
313
|
+
tipVisible: false,
|
|
314
|
+
tooltipRender: function tooltipRender(value) {
|
|
315
|
+
return value;
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
export default Slider;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { OverrideProps } from '@bifrostui/types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export type SliderValue = number | [number, number];
|
|
4
|
+
export type SliderProps<D extends React.ElementType = 'div', P = {}> = OverrideProps<{
|
|
5
|
+
props: P & {
|
|
6
|
+
/**
|
|
7
|
+
* 设置初始取值,类型为number时,使用单滑块,类型为[number, number]时,使用双滑块
|
|
8
|
+
* 当组件非受控时使用
|
|
9
|
+
*/
|
|
10
|
+
defaultValue?: SliderValue;
|
|
11
|
+
/**
|
|
12
|
+
* 设置当前值,类型为number时,使用单滑块,类型为[number, number]时,使用双滑块
|
|
13
|
+
* 当组件受控时使用
|
|
14
|
+
*/
|
|
15
|
+
value?: SliderValue;
|
|
16
|
+
/**
|
|
17
|
+
* 最小值,默认为0
|
|
18
|
+
*/
|
|
19
|
+
min?: number;
|
|
20
|
+
/**
|
|
21
|
+
* 最大值,默认为100
|
|
22
|
+
*/
|
|
23
|
+
max?: number;
|
|
24
|
+
/**
|
|
25
|
+
* 步长,取值必须大于 0,并且可被 (max - min) 整除
|
|
26
|
+
* 默认值 1
|
|
27
|
+
*/
|
|
28
|
+
step?: number;
|
|
29
|
+
/**
|
|
30
|
+
* 提示气泡是否总是可见,默认为false,滑动时才可见
|
|
31
|
+
*/
|
|
32
|
+
tipVisible?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* 自定义提示气泡,默认:(value) => value
|
|
35
|
+
*/
|
|
36
|
+
tooltipRender?: (value: number) => React.ReactNode;
|
|
37
|
+
/**
|
|
38
|
+
* 是否禁用,默认false
|
|
39
|
+
*/
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* 开始图标
|
|
43
|
+
*/
|
|
44
|
+
startIcon?: React.ReactNode;
|
|
45
|
+
/**
|
|
46
|
+
* 结束图标
|
|
47
|
+
*/
|
|
48
|
+
endIcon?: React.ReactNode;
|
|
49
|
+
/**
|
|
50
|
+
* 禁止开始图标和结束图标交错,默认false,可以交错
|
|
51
|
+
*/
|
|
52
|
+
disableSwap?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* 改变时的回调
|
|
55
|
+
*/
|
|
56
|
+
onChange?: (event: React.SyntheticEvent, data: {
|
|
57
|
+
value: SliderValue;
|
|
58
|
+
buttonIndex: number;
|
|
59
|
+
}) => void;
|
|
60
|
+
};
|
|
61
|
+
defaultComponent: D;
|
|
62
|
+
}, D>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SliderValue } from './Slider.types';
|
|
2
|
+
/**
|
|
3
|
+
* 格式化数据
|
|
4
|
+
* @returns undefined | number[]
|
|
5
|
+
*/
|
|
6
|
+
export declare const formatValue: (value: SliderValue) => number | number[];
|
|
7
|
+
/**
|
|
8
|
+
* 从小到大排序
|
|
9
|
+
*/
|
|
10
|
+
export declare const sortValue: (v: [number, number]) => [number, number];
|
|
11
|
+
/**
|
|
12
|
+
* 是否为相同值
|
|
13
|
+
*/
|
|
14
|
+
export declare const isSameValue: (newValue: SliderValue, oldValue: SliderValue) => boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 格式化数据
|
|
3
|
+
* @returns undefined | number[]
|
|
4
|
+
*/
|
|
5
|
+
export var formatValue = function formatValue(value) {
|
|
6
|
+
if (value === undefined) return value;
|
|
7
|
+
return Array.isArray(value) ? value : [value, 0];
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 从小到大排序
|
|
12
|
+
*/
|
|
13
|
+
export var sortValue = function sortValue(v) {
|
|
14
|
+
if (!v) return v;
|
|
15
|
+
return v.slice().sort(function (a, b) {
|
|
16
|
+
return a - b;
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 是否为相同值
|
|
22
|
+
*/
|
|
23
|
+
export var isSameValue = function isSameValue(newValue, oldValue) {
|
|
24
|
+
return JSON.stringify(newValue) === JSON.stringify(oldValue);
|
|
25
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
.bui-stack {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: var(--align-items);
|
|
4
|
+
justify-content: var(--justify-content);
|
|
5
|
+
flex-direction: var(--flex-direction);
|
|
6
|
+
/* stylelint-disable-next-line declaration-block-no-redundant-longhand-properties */
|
|
7
|
+
flex-wrap: var(--flex-wrap);
|
|
8
|
+
row-gap: var(--spacing);
|
|
9
|
+
column-gap: var(--spacing);
|
|
10
|
+
font-family: var(--bui-font-family);
|
|
11
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["className", "children", "direction", "spacing", "divider", "justifyContent", "alignItems", "flexWrap", "style"];
|
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
8
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
9
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
10
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
11
|
+
import clsx from 'clsx';
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import "./Stack.css";
|
|
14
|
+
var prefixCls = 'bui-stack';
|
|
15
|
+
var Stack = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
16
|
+
var className = props.className,
|
|
17
|
+
children = props.children,
|
|
18
|
+
direction = props.direction,
|
|
19
|
+
spacing = props.spacing,
|
|
20
|
+
divider = props.divider,
|
|
21
|
+
justifyContent = props.justifyContent,
|
|
22
|
+
alignItems = props.alignItems,
|
|
23
|
+
flexWrap = props.flexWrap,
|
|
24
|
+
style = props.style,
|
|
25
|
+
others = _objectWithoutProperties(props, _excluded);
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* js写css变量方式
|
|
29
|
+
* 可通过css直接覆盖,不需要通过style
|
|
30
|
+
* */
|
|
31
|
+
var cssProperties = {
|
|
32
|
+
'--align-items': alignItems || 'center',
|
|
33
|
+
'--justify-content': justifyContent || 'center',
|
|
34
|
+
'--flex-direction': direction || 'column',
|
|
35
|
+
'--spacing': spacing || '0',
|
|
36
|
+
'--flex-wrap': flexWrap || 'nowrap'
|
|
37
|
+
};
|
|
38
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
39
|
+
className: clsx(prefixCls, className),
|
|
40
|
+
style: _objectSpread(_objectSpread({}, cssProperties), style),
|
|
41
|
+
ref: ref
|
|
42
|
+
}, others), divider ? React.Children.map(children, function (child, index) {
|
|
43
|
+
if (index < React.Children.toArray(children).length - 1) {
|
|
44
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, child, divider);
|
|
45
|
+
}
|
|
46
|
+
return child;
|
|
47
|
+
}) : children);
|
|
48
|
+
});
|
|
49
|
+
Stack.displayName = 'BuiStack';
|
|
50
|
+
export default Stack;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { OverrideProps } from '@bifrostui/types';
|
|
2
|
+
import React, { ReactNode } from 'react';
|
|
3
|
+
export type StackProps<D extends React.ElementType = 'div', P = {}> = OverrideProps<{
|
|
4
|
+
props: P & {
|
|
5
|
+
/**
|
|
6
|
+
* 方向, 设置子节点垂直/水平分布
|
|
7
|
+
* 默认column;
|
|
8
|
+
*/
|
|
9
|
+
direction?: 'row' | 'row-reverse' | 'column' | 'column-reverse';
|
|
10
|
+
/**
|
|
11
|
+
* 交叉轴轴上对齐方式
|
|
12
|
+
* 默认center
|
|
13
|
+
*/
|
|
14
|
+
alignItems?: 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline';
|
|
15
|
+
/**
|
|
16
|
+
* 主轴上对齐方式
|
|
17
|
+
* 默认center
|
|
18
|
+
*/
|
|
19
|
+
justifyContent?: 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly';
|
|
20
|
+
/**
|
|
21
|
+
* 间距,设置子节点之间间距
|
|
22
|
+
* 默认 0
|
|
23
|
+
*/
|
|
24
|
+
spacing?: string | number;
|
|
25
|
+
/**
|
|
26
|
+
* 分割线,允许在每个子节点之间插入一个元素
|
|
27
|
+
*/
|
|
28
|
+
divider?: ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* 控制节点换行
|
|
31
|
+
*/
|
|
32
|
+
flexWrap?: 'wrap' | 'nowrap' | 'wrap-reverse';
|
|
33
|
+
};
|
|
34
|
+
defaultComponent: D;
|
|
35
|
+
}, D>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|