@bifrostui/react 1.1.11-beta.0 → 1.1.11-beta.9
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/README.md +3 -0
- package/dist/ActionSheet/ActionSheet.js +107 -62
- package/dist/ActionSheet/ActionSheet.types.js +15 -5
- package/dist/ActionSheet/ActionSheetContext.js +35 -10
- package/dist/ActionSheet/ActionSheetItem.d.ts +1 -1
- package/dist/ActionSheet/ActionSheetItem.js +113 -52
- package/dist/ActionSheet/ActionSheetItem.types.js +15 -5
- package/dist/ActionSheet/index.js +42 -50
- package/dist/Alert/Alert.d.ts +1 -1
- package/dist/Alert/Alert.js +157 -95
- package/dist/Alert/Alert.types.js +15 -5
- package/dist/Alert/index.js +38 -30
- package/dist/Avatar/Avatar.d.ts +1 -1
- package/dist/Avatar/Avatar.js +118 -43
- package/dist/Avatar/Avatar.types.js +15 -5
- package/dist/Avatar/AvatarGroup.d.ts +1 -1
- package/dist/Avatar/AvatarGroup.js +122 -64
- package/dist/Avatar/AvatarGroup.types.js +15 -5
- package/dist/Avatar/index.js +43 -50
- package/dist/Backdrop/Backdrop.d.ts +1 -1
- package/dist/Backdrop/Backdrop.js +95 -33
- package/dist/Backdrop/Backdrop.types.js +15 -5
- package/dist/Backdrop/index.js +37 -30
- package/dist/Badge/Badge.d.ts +1 -1
- package/dist/Badge/Badge.js +102 -31
- package/dist/Badge/Badge.types.js +15 -5
- package/dist/Badge/index.js +37 -30
- package/dist/Button/Button.css +31 -7
- package/dist/Button/Button.d.ts +1 -1
- package/dist/Button/Button.js +111 -48
- package/dist/Button/Button.types.js +15 -5
- package/dist/Button/index.js +37 -30
- package/dist/Calendar/Calendar.d.ts +1 -1
- package/dist/Calendar/Calendar.js +303 -257
- package/dist/Calendar/Calendar.types.js +15 -5
- package/dist/Calendar/index.js +37 -30
- package/dist/Calendar/utils.js +55 -44
- package/dist/Card/Card.d.ts +1 -1
- package/dist/Card/Card.js +74 -25
- package/dist/Card/Card.types.js +15 -5
- package/dist/Card/CardContent.d.ts +1 -1
- package/dist/Card/CardContent.js +69 -24
- package/dist/Card/CardContent.types.js +15 -5
- package/dist/Card/CardFooter.d.ts +1 -1
- package/dist/Card/CardFooter.js +69 -24
- package/dist/Card/CardFooter.types.js +15 -5
- package/dist/Card/CardHeader.d.ts +1 -1
- package/dist/Card/CardHeader.js +91 -56
- package/dist/Card/CardHeader.types.js +15 -5
- package/dist/Card/index.js +54 -91
- package/dist/Checkbox/Checkbox.d.ts +1 -1
- package/dist/Checkbox/Checkbox.js +133 -66
- package/dist/Checkbox/Checkbox.types.js +15 -5
- package/dist/Checkbox/CheckboxContext.js +40 -10
- package/dist/Checkbox/CheckboxGroup.d.ts +1 -1
- package/dist/Checkbox/CheckboxGroup.js +109 -52
- package/dist/Checkbox/index.js +40 -38
- package/dist/CitySelector/CitySelector.d.ts +1 -1
- package/dist/CitySelector/CitySelector.js +83 -35
- package/dist/CitySelector/CitySelector.miniapp.d.ts +1 -1
- package/dist/CitySelector/CitySelector.miniapp.js +123 -77
- package/dist/CitySelector/CitySelector.types.js +15 -5
- package/dist/CitySelector/CitySelectorCore.js +228 -174
- package/dist/CitySelector/Selector/index.js +46 -20
- package/dist/CitySelector/index.js +37 -30
- package/dist/Countdown/Countdown.css +11 -1
- package/dist/Countdown/Countdown.d.ts +1 -1
- package/dist/Countdown/Countdown.js +126 -70
- package/dist/Countdown/Countdown.types.js +15 -5
- package/dist/Countdown/index.js +39 -42
- package/dist/Countdown/useCountdown.js +37 -27
- package/dist/Countdown/utils.js +73 -74
- package/dist/Divider/Divider.d.ts +1 -1
- package/dist/Divider/Divider.js +70 -51
- package/dist/Divider/Divider.types.js +15 -5
- package/dist/Divider/index.js +37 -30
- package/dist/Drawer/Drawer.css +0 -1
- package/dist/Drawer/Drawer.js +124 -46
- package/dist/Drawer/Drawer.types.js +15 -5
- package/dist/Drawer/index.js +37 -30
- package/dist/Fade/Fade.js +111 -52
- package/dist/Fade/Fade.types.js +15 -5
- package/dist/Fade/index.js +38 -30
- package/dist/IconButton/IconButton.css +26 -6
- package/dist/IconButton/IconButton.d.ts +1 -1
- package/dist/IconButton/IconButton.js +114 -46
- package/dist/IconButton/IconButton.types.js +15 -5
- package/dist/IconButton/index.js +37 -30
- package/dist/Image/Image.d.ts +1 -1
- package/dist/Image/Image.js +143 -78
- package/dist/Image/Image.types.js +15 -5
- package/dist/Image/index.js +38 -30
- package/dist/Input/Input.d.ts +1 -1
- package/dist/Input/Input.js +144 -74
- package/dist/Input/Input.types.js +15 -5
- package/dist/Input/index.js +37 -30
- package/dist/List/List.d.ts +1 -1
- package/dist/List/List.js +89 -28
- package/dist/List/List.types.js +15 -5
- package/dist/List/ListContext.js +34 -9
- package/dist/List/ListItem.d.ts +1 -1
- package/dist/List/ListItem.js +97 -42
- package/dist/List/ListItem.types.js +15 -5
- package/dist/List/ListItemContent.d.ts +1 -1
- package/dist/List/ListItemContent.js +82 -34
- package/dist/List/ListItemContent.types.js +15 -5
- package/dist/List/ListItemExtra.d.ts +1 -1
- package/dist/List/ListItemExtra.js +70 -26
- package/dist/List/ListItemExtra.types.js +15 -5
- package/dist/List/ListItemFooter.d.ts +1 -1
- package/dist/List/ListItemFooter.js +70 -26
- package/dist/List/ListItemFooter.types.js +15 -5
- package/dist/List/ListItemHeader.d.ts +1 -1
- package/dist/List/ListItemHeader.js +70 -26
- package/dist/List/ListItemHeader.types.js +15 -5
- package/dist/List/index.js +62 -130
- package/dist/Loading/Loading.d.ts +1 -1
- package/dist/Loading/Loading.js +82 -33
- package/dist/Loading/Loading.types.js +15 -5
- package/dist/Loading/index.js +37 -30
- package/dist/Modal/Modal.d.ts +1 -1
- package/dist/Modal/Modal.js +112 -56
- package/dist/Modal/Modal.miniapp.d.ts +3 -3
- package/dist/Modal/Modal.miniapp.js +132 -63
- package/dist/Modal/Modal.types.js +15 -5
- package/dist/Modal/index.js +38 -30
- package/dist/NavBar/NavBar.d.ts +1 -1
- package/dist/NavBar/NavBar.js +109 -59
- package/dist/NavBar/NavBar.types.js +15 -5
- package/dist/NavBar/index.js +37 -30
- package/dist/Picker/Picker.d.ts +1 -1
- package/dist/Picker/Picker.js +155 -97
- package/dist/Picker/Picker.types.js +15 -5
- package/dist/Picker/PickerPanel.css +9 -1
- package/dist/Picker/PickerPanel.d.ts +1 -1
- package/dist/Picker/PickerPanel.js +255 -202
- package/dist/Picker/index.js +37 -30
- package/dist/Picker/utils.js +42 -37
- package/dist/Portal/Portal.js +61 -16
- package/dist/Portal/Portal.miniapp.js +68 -31
- package/dist/Portal/Portal.types.js +15 -5
- package/dist/Portal/PortalCore.js +70 -52
- package/dist/Portal/index.js +38 -30
- package/dist/Progress/Progress.d.ts +1 -1
- package/dist/Progress/Progress.js +102 -61
- package/dist/Progress/Progress.types.js +15 -5
- package/dist/Progress/index.js +38 -30
- package/dist/Radio/Radio.d.ts +1 -1
- package/dist/Radio/Radio.js +144 -80
- package/dist/Radio/Radio.types.js +15 -5
- package/dist/Radio/RadioButtonIcon.js +63 -32
- package/dist/Radio/RadioContext.js +40 -10
- package/dist/Radio/RadioGroup.d.ts +1 -1
- package/dist/Radio/RadioGroup.js +89 -34
- package/dist/Radio/index.js +40 -38
- package/dist/Rating/Rating.d.ts +1 -1
- package/dist/Rating/Rating.js +139 -62
- package/dist/Rating/Rating.types.js +15 -5
- package/dist/Rating/index.js +37 -30
- package/dist/ScrollView/ScrollView.d.ts +1 -1
- package/dist/ScrollView/ScrollView.js +226 -178
- package/{es/ScrollView/index.miniapp.js → dist/ScrollView/ScrollView.miniapp.d.ts} +0 -1
- package/dist/ScrollView/ScrollView.miniapp.js +24 -0
- package/dist/ScrollView/ScrollView.types.js +15 -5
- package/dist/ScrollView/index.js +38 -30
- package/dist/Select/Select.d.ts +1 -1
- package/dist/Select/Select.js +176 -114
- package/dist/Select/Select.types.js +15 -5
- package/dist/Select/SelectOption.d.ts +1 -1
- package/dist/Select/SelectOption.js +92 -48
- package/dist/Select/index.js +40 -38
- package/dist/Select/selectContext.js +24 -8
- package/dist/Skeleton/Skeleton.css +7 -2
- package/dist/Skeleton/Skeleton.d.ts +1 -1
- package/dist/Skeleton/Skeleton.js +101 -37
- package/dist/Skeleton/Skeleton.types.js +15 -5
- package/dist/Skeleton/index.js +38 -30
- package/dist/Slide/Slide.js +125 -64
- package/dist/Slide/Slide.types.js +15 -5
- package/dist/Slide/index.js +38 -30
- package/dist/Slider/Slider.css +2 -2
- package/dist/Slider/Slider.d.ts +1 -1
- package/dist/Slider/Slider.js +215 -171
- package/dist/Slider/Slider.types.js +15 -5
- package/dist/Slider/index.js +37 -30
- package/dist/Slider/utils.js +35 -24
- package/dist/Stack/Stack.css +0 -1
- package/dist/Stack/Stack.d.ts +1 -1
- package/dist/Stack/Stack.js +96 -41
- package/dist/Stack/Stack.types.js +15 -5
- package/dist/Stack/demo/StackDemo.js +148 -122
- package/dist/Stack/index.js +38 -30
- package/dist/Steps/Step.css +2 -2
- package/dist/Steps/Step.d.ts +1 -1
- package/dist/Steps/Step.js +144 -87
- package/dist/Steps/Step.types.js +15 -5
- package/dist/Steps/Steps.d.ts +1 -1
- package/dist/Steps/Steps.js +107 -46
- package/dist/Steps/Steps.types.js +15 -5
- package/dist/Steps/StepsContext.js +40 -10
- package/dist/Steps/index.js +42 -50
- package/dist/Swiper/Swiper.d.ts +1 -1
- package/dist/Swiper/Swiper.js +149 -82
- package/dist/Swiper/Swiper.miniapp.d.ts +2 -0
- package/dist/Swiper/Swiper.miniapp.js +24 -0
- package/dist/Swiper/Swiper.types.js +15 -5
- package/dist/Swiper/SwiperItem.js +66 -28
- package/dist/Swiper/SwiperItem.miniapp.d.ts +2 -0
- package/dist/Swiper/SwiperItem.miniapp.js +24 -0
- package/dist/Swiper/index.js +40 -38
- package/dist/Switch/Switch.css +1 -1
- package/dist/Switch/Switch.d.ts +1 -1
- package/dist/Switch/Switch.js +121 -48
- package/dist/Switch/Switch.types.js +15 -5
- package/dist/Switch/index.js +38 -30
- package/dist/TabBar/TabBar.d.ts +1 -1
- package/dist/TabBar/TabBar.js +95 -37
- package/dist/TabBar/TabBarContext.js +24 -8
- package/dist/TabBar/TabBarItem.d.ts +1 -1
- package/dist/TabBar/TabBarItem.js +123 -59
- package/dist/TabBar/index.js +39 -32
- package/dist/TabBar/index.types.js +15 -5
- package/dist/Tabs/Tab.d.ts +1 -1
- package/dist/Tabs/Tab.js +104 -52
- package/dist/Tabs/Tab.types.js +15 -5
- package/dist/Tabs/TabPanel.d.ts +1 -1
- package/dist/Tabs/TabPanel.js +76 -31
- package/dist/Tabs/TabPanel.types.js +15 -5
- package/dist/Tabs/Tabs.css +10 -3
- package/dist/Tabs/Tabs.d.ts +1 -1
- package/dist/Tabs/Tabs.js +177 -127
- package/dist/Tabs/Tabs.types.js +15 -5
- package/dist/Tabs/TabsContext.d.ts +2 -2
- package/dist/Tabs/TabsContext.js +42 -12
- package/dist/Tabs/index.js +48 -71
- package/dist/Tabs/utils/bound.js +24 -8
- package/dist/Tag/Tag.d.ts +1 -1
- package/dist/Tag/Tag.js +102 -47
- package/dist/Tag/Tag.types.js +15 -5
- package/dist/Tag/TagGroup.css +1 -1
- package/dist/Tag/TagGroup.d.ts +1 -1
- package/dist/Tag/TagGroup.js +74 -25
- package/dist/Tag/TagGroup.types.js +15 -5
- package/dist/Tag/index.js +41 -44
- package/dist/TextArea/TextArea.d.ts +1 -1
- package/dist/TextArea/TextArea.js +203 -137
- package/dist/TextArea/TextArea.types.js +15 -5
- package/dist/TextArea/index.js +37 -30
- package/dist/Transition/Transition.js +61 -17
- package/dist/Transition/Transition.miniapp.js +62 -17
- package/dist/Transition/Transition.types.js +15 -5
- package/dist/Transition/TransitionCore.js +243 -161
- package/dist/Transition/index.js +38 -30
- package/dist/index.js +98 -444
- package/es/ActionSheet/ActionSheet.js +79 -54
- package/es/ActionSheet/ActionSheet.types.js +0 -1
- package/es/ActionSheet/ActionSheetContext.js +7 -4
- package/es/ActionSheet/ActionSheetItem.d.ts +1 -1
- package/es/ActionSheet/ActionSheetItem.js +86 -45
- package/es/ActionSheet/ActionSheetItem.types.js +0 -1
- package/es/ActionSheet/index.js +8 -3
- package/es/Alert/Alert.d.ts +1 -1
- package/es/Alert/Alert.js +145 -99
- package/es/Alert/Alert.types.js +0 -1
- package/es/Alert/index.js +5 -2
- package/es/Avatar/Avatar.d.ts +1 -1
- package/es/Avatar/Avatar.js +102 -50
- package/es/Avatar/Avatar.types.js +0 -1
- package/es/Avatar/AvatarGroup.d.ts +1 -1
- package/es/Avatar/AvatarGroup.js +96 -61
- package/es/Avatar/AvatarGroup.types.js +0 -1
- package/es/Avatar/index.js +7 -3
- package/es/Backdrop/Backdrop.d.ts +1 -1
- package/es/Backdrop/Backdrop.js +67 -28
- package/es/Backdrop/Backdrop.types.js +0 -1
- package/es/Backdrop/index.js +6 -2
- package/es/Badge/Badge.d.ts +1 -1
- package/es/Badge/Badge.js +82 -34
- package/es/Badge/Badge.types.js +0 -1
- package/es/Badge/index.js +6 -2
- package/es/Button/Button.css +31 -7
- package/es/Button/Button.d.ts +1 -1
- package/es/Button/Button.js +84 -42
- package/es/Button/Button.types.js +0 -1
- package/es/Button/index.js +6 -2
- package/es/Calendar/Calendar.d.ts +1 -1
- package/es/Calendar/Calendar.js +272 -264
- package/es/Calendar/Calendar.types.js +0 -1
- package/es/Calendar/index.js +6 -2
- package/es/Calendar/utils.js +27 -42
- package/es/Card/Card.d.ts +1 -1
- package/es/Card/Card.js +47 -19
- package/es/Card/Card.types.js +0 -1
- package/es/Card/CardContent.d.ts +1 -1
- package/es/Card/CardContent.js +42 -18
- package/es/Card/CardContent.types.js +0 -1
- package/es/Card/CardFooter.d.ts +1 -1
- package/es/Card/CardFooter.js +42 -18
- package/es/Card/CardFooter.types.js +0 -1
- package/es/Card/CardHeader.d.ts +1 -1
- package/es/Card/CardHeader.js +65 -51
- package/es/Card/CardHeader.types.js +0 -1
- package/es/Card/index.js +9 -3
- package/es/Checkbox/Checkbox.d.ts +1 -1
- package/es/Checkbox/Checkbox.js +123 -90
- package/es/Checkbox/Checkbox.types.js +0 -1
- package/es/Checkbox/CheckboxContext.js +8 -4
- package/es/Checkbox/CheckboxGroup.d.ts +1 -1
- package/es/Checkbox/CheckboxGroup.js +81 -58
- package/es/Checkbox/index.js +7 -2
- package/es/CitySelector/CitySelector.d.ts +1 -1
- package/es/CitySelector/CitySelector.js +56 -35
- package/es/CitySelector/CitySelector.miniapp.d.ts +1 -1
- package/es/CitySelector/CitySelector.miniapp.js +95 -74
- package/es/CitySelector/CitySelector.types.js +0 -1
- package/es/CitySelector/CitySelectorCore.js +203 -187
- package/es/CitySelector/Selector/index.js +17 -11
- package/es/CitySelector/index.js +6 -2
- package/es/Countdown/Countdown.css +11 -1
- package/es/Countdown/Countdown.d.ts +1 -1
- package/es/Countdown/Countdown.js +108 -85
- package/es/Countdown/Countdown.types.js +0 -1
- package/es/Countdown/index.js +6 -2
- package/es/Countdown/useCountdown.js +26 -43
- package/es/Countdown/utils.js +78 -105
- package/es/Divider/Divider.d.ts +1 -1
- package/es/Divider/Divider.js +45 -41
- package/es/Divider/Divider.types.js +0 -1
- package/es/Divider/index.js +6 -2
- package/es/Drawer/Drawer.css +0 -1
- package/es/Drawer/Drawer.js +107 -61
- package/es/Drawer/Drawer.types.js +0 -1
- package/es/Drawer/index.js +6 -2
- package/es/Fade/Fade.js +95 -55
- package/es/Fade/Fade.types.js +0 -1
- package/es/Fade/index.js +7 -3
- package/es/IconButton/IconButton.css +26 -6
- package/es/IconButton/IconButton.d.ts +1 -1
- package/es/IconButton/IconButton.js +87 -41
- package/es/IconButton/IconButton.types.js +0 -1
- package/es/IconButton/index.js +6 -2
- package/es/Image/Image.d.ts +1 -1
- package/es/Image/Image.js +136 -106
- package/es/Image/Image.types.js +0 -1
- package/es/Image/index.js +7 -3
- package/es/Input/Input.d.ts +1 -1
- package/es/Input/Input.js +136 -103
- package/es/Input/Input.types.js +0 -1
- package/es/Input/index.js +6 -2
- package/es/List/List.d.ts +1 -1
- package/es/List/List.js +68 -28
- package/es/List/List.types.js +0 -1
- package/es/List/ListContext.js +6 -3
- package/es/List/ListItem.d.ts +1 -1
- package/es/List/ListItem.js +75 -42
- package/es/List/ListItem.types.js +0 -1
- package/es/List/ListItemContent.d.ts +1 -1
- package/es/List/ListItemContent.js +55 -28
- package/es/List/ListItemContent.types.js +0 -1
- package/es/List/ListItemExtra.d.ts +1 -1
- package/es/List/ListItemExtra.js +43 -20
- package/es/List/ListItemExtra.types.js +0 -1
- package/es/List/ListItemFooter.d.ts +1 -1
- package/es/List/ListItemFooter.js +43 -20
- package/es/List/ListItemFooter.types.js +0 -1
- package/es/List/ListItemHeader.d.ts +1 -1
- package/es/List/ListItemHeader.js +43 -20
- package/es/List/ListItemHeader.types.js +0 -1
- package/es/List/index.js +10 -2
- package/es/Loading/Loading.d.ts +1 -1
- package/es/Loading/Loading.js +56 -28
- package/es/Loading/Loading.types.js +0 -1
- package/es/Loading/index.js +6 -2
- package/es/Modal/Modal.d.ts +1 -1
- package/es/Modal/Modal.js +93 -70
- package/es/Modal/Modal.miniapp.d.ts +3 -3
- package/es/Modal/Modal.miniapp.js +104 -67
- package/es/Modal/Modal.types.js +0 -1
- package/es/Modal/index.js +7 -3
- package/es/NavBar/NavBar.d.ts +1 -1
- package/es/NavBar/NavBar.js +95 -67
- package/es/NavBar/NavBar.types.js +0 -1
- package/es/NavBar/index.js +6 -2
- package/es/Picker/Picker.d.ts +1 -1
- package/es/Picker/Picker.js +139 -124
- package/es/Picker/Picker.types.js +0 -1
- package/es/Picker/PickerPanel.css +9 -1
- package/es/Picker/PickerPanel.d.ts +1 -1
- package/es/Picker/PickerPanel.js +228 -226
- package/es/Picker/index.js +6 -2
- package/es/Picker/utils.js +28 -47
- package/es/Portal/Portal.js +31 -10
- package/es/Portal/Portal.miniapp.js +40 -23
- package/es/Portal/Portal.types.js +0 -1
- package/es/Portal/PortalCore.js +42 -53
- package/es/Portal/index.js +7 -3
- package/es/Progress/Progress.d.ts +1 -1
- package/es/Progress/Progress.js +76 -67
- package/es/Progress/Progress.types.js +0 -1
- package/es/Progress/index.js +7 -3
- package/es/Radio/Radio.d.ts +1 -1
- package/es/Radio/Radio.js +133 -102
- package/es/Radio/Radio.types.js +0 -1
- package/es/Radio/RadioButtonIcon.js +38 -28
- package/es/Radio/RadioContext.js +8 -4
- package/es/Radio/RadioGroup.d.ts +1 -1
- package/es/Radio/RadioGroup.js +71 -44
- package/es/Radio/index.js +7 -2
- package/es/Rating/Rating.d.ts +1 -1
- package/es/Rating/Rating.js +132 -89
- package/es/Rating/Rating.types.js +0 -1
- package/es/Rating/index.js +6 -2
- package/es/ScrollView/ScrollView.d.ts +1 -1
- package/es/ScrollView/ScrollView.js +204 -185
- package/{dist/ScrollView/index.miniapp.d.ts → es/ScrollView/ScrollView.miniapp.d.ts} +0 -1
- package/es/ScrollView/ScrollView.miniapp.js +5 -0
- package/es/ScrollView/ScrollView.types.js +0 -1
- package/es/ScrollView/index.js +7 -3
- package/es/Select/Select.d.ts +1 -1
- package/es/Select/Select.js +167 -138
- package/es/Select/Select.types.js +0 -1
- package/es/Select/SelectOption.d.ts +1 -1
- package/es/Select/SelectOption.js +66 -41
- package/es/Select/index.js +6 -2
- package/es/Select/selectContext.js +6 -3
- package/es/Skeleton/Skeleton.css +7 -2
- package/es/Skeleton/Skeleton.d.ts +1 -1
- package/es/Skeleton/Skeleton.js +76 -35
- package/es/Skeleton/Skeleton.types.js +0 -1
- package/es/Skeleton/index.js +7 -3
- package/es/Slide/Slide.js +110 -67
- package/es/Slide/Slide.types.js +0 -1
- package/es/Slide/index.js +7 -3
- package/es/Slider/Slider.css +2 -2
- package/es/Slider/Slider.d.ts +1 -1
- package/es/Slider/Slider.js +236 -244
- package/es/Slider/Slider.types.js +0 -1
- package/es/Slider/index.js +6 -2
- package/es/Slider/utils.js +13 -22
- package/es/Stack/Stack.css +0 -1
- package/es/Stack/Stack.d.ts +1 -1
- package/es/Stack/Stack.js +78 -47
- package/es/Stack/Stack.types.js +0 -1
- package/es/Stack/demo/StackDemo.js +123 -126
- package/es/Stack/index.js +7 -3
- package/es/Steps/Step.css +2 -2
- package/es/Steps/Step.d.ts +1 -1
- package/es/Steps/Step.js +130 -77
- package/es/Steps/Step.types.js +0 -1
- package/es/Steps/Steps.d.ts +1 -1
- package/es/Steps/Steps.js +83 -44
- package/es/Steps/Steps.types.js +0 -1
- package/es/Steps/StepsContext.js +8 -4
- package/es/Steps/index.js +8 -3
- package/es/Swiper/Swiper.d.ts +1 -1
- package/es/Swiper/Swiper.js +136 -99
- package/es/Swiper/Swiper.miniapp.d.ts +2 -0
- package/es/Swiper/Swiper.miniapp.js +5 -0
- package/es/Swiper/Swiper.types.js +0 -1
- package/es/Swiper/SwiperItem.js +40 -23
- package/es/Swiper/SwiperItem.miniapp.d.ts +2 -0
- package/es/Swiper/SwiperItem.miniapp.js +5 -0
- package/es/Swiper/index.js +8 -3
- package/es/Switch/Switch.css +1 -1
- package/es/Switch/Switch.d.ts +1 -1
- package/es/Switch/Switch.js +110 -67
- package/es/Switch/Switch.types.js +0 -1
- package/es/Switch/index.js +7 -3
- package/es/TabBar/TabBar.d.ts +1 -1
- package/es/TabBar/TabBar.js +72 -36
- package/es/TabBar/TabBarContext.js +6 -3
- package/es/TabBar/TabBarItem.d.ts +1 -1
- package/es/TabBar/TabBarItem.js +97 -52
- package/es/TabBar/index.js +5 -2
- package/es/TabBar/index.types.js +0 -1
- package/es/Tabs/Tab.d.ts +1 -1
- package/es/Tabs/Tab.js +77 -44
- package/es/Tabs/Tab.types.js +0 -1
- package/es/Tabs/TabPanel.d.ts +1 -1
- package/es/Tabs/TabPanel.js +50 -25
- package/es/Tabs/TabPanel.types.js +0 -1
- package/es/Tabs/Tabs.css +10 -3
- package/es/Tabs/Tabs.d.ts +1 -1
- package/es/Tabs/Tabs.js +180 -163
- package/es/Tabs/Tabs.types.js +0 -1
- package/es/Tabs/TabsContext.d.ts +2 -2
- package/es/Tabs/TabsContext.js +10 -6
- package/es/Tabs/index.js +10 -4
- package/es/Tabs/utils/bound.js +8 -5
- package/es/Tag/Tag.d.ts +1 -1
- package/es/Tag/Tag.js +85 -53
- package/es/Tag/Tag.types.js +0 -1
- package/es/Tag/TagGroup.css +1 -1
- package/es/Tag/TagGroup.d.ts +1 -1
- package/es/Tag/TagGroup.js +47 -19
- package/es/Tag/TagGroup.types.js +0 -1
- package/es/Tag/index.js +5 -2
- package/es/TextArea/TextArea.d.ts +1 -1
- package/es/TextArea/TextArea.js +177 -139
- package/es/TextArea/TextArea.types.js +0 -1
- package/es/TextArea/index.js +6 -2
- package/es/Transition/Transition.js +31 -11
- package/es/Transition/Transition.miniapp.js +32 -11
- package/es/Transition/Transition.types.js +0 -1
- package/es/Transition/TransitionCore.js +218 -272
- package/es/Transition/index.js +7 -3
- package/es/index.js +1 -1
- package/package.json +15 -14
- package/dist/ScrollView/index.miniapp.js +0 -14
- package/dist/Swiper/index.miniapp.d.ts +0 -8
- package/dist/Swiper/index.miniapp.js +0 -23
- package/es/ScrollView/index.miniapp.d.ts +0 -3
- package/es/Swiper/index.miniapp.d.ts +0 -8
- package/es/Swiper/index.miniapp.js +0 -6
package/es/Tabs/Tabs.js
CHANGED
|
@@ -1,210 +1,227 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
var __objRest = (source, exclude) => {
|
|
18
|
+
var target = {};
|
|
19
|
+
for (var prop in source)
|
|
20
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
21
|
+
target[prop] = source[prop];
|
|
22
|
+
if (source != null && __getOwnPropSymbols)
|
|
23
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
24
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
25
|
+
target[prop] = source[prop];
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
};
|
|
29
|
+
import {
|
|
30
|
+
debounce,
|
|
31
|
+
isMini,
|
|
32
|
+
throttle,
|
|
33
|
+
useDidMountEffect
|
|
34
|
+
} from "@bifrostui/utils";
|
|
35
|
+
import clsx from "clsx";
|
|
36
|
+
import React, {
|
|
37
|
+
useEffect,
|
|
38
|
+
useLayoutEffect,
|
|
39
|
+
useMemo,
|
|
40
|
+
useRef,
|
|
41
|
+
useState
|
|
42
|
+
} from "react";
|
|
18
43
|
import Tab from "./Tab";
|
|
19
44
|
import "./Tabs.css";
|
|
20
45
|
import { TabsContextProvider } from "./TabsContext";
|
|
21
46
|
import bound from "./utils/bound";
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
setLineData = _useState4[1];
|
|
44
|
-
var _useState5 = useState({
|
|
45
|
-
leftMaskOpacity: 0,
|
|
46
|
-
rightMaskOpacity: 0
|
|
47
|
-
}),
|
|
48
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
49
|
-
maskData = _useState6[0],
|
|
50
|
-
setMaskData = _useState6[1];
|
|
51
|
-
var animate = function animate(_ref) {
|
|
52
|
-
var transitionInUse = _ref.transitionInUse;
|
|
53
|
-
var container = tabsRef.current;
|
|
54
|
-
if (!container) return;
|
|
55
|
-
var activeIndex = !!tabs.length && tabs.findIndex(function (item) {
|
|
56
|
-
var _tabs$;
|
|
57
|
-
return item.index === (active || ((_tabs$ = tabs[0]) === null || _tabs$ === void 0 ? void 0 : _tabs$.index));
|
|
47
|
+
const prefixCls = "bui-tabs";
|
|
48
|
+
const Tabs = React.forwardRef((props, ref) => {
|
|
49
|
+
const _a = props, { children, className, value, tabs, align, onChange } = _a, others = __objRest(_a, ["children", "className", "value", "tabs", "align", "onChange"]);
|
|
50
|
+
const [active, setActive] = useState("");
|
|
51
|
+
const tabsRef = useRef(null);
|
|
52
|
+
const activeLineRef = useRef(null);
|
|
53
|
+
const [lineData, setLineData] = useState({
|
|
54
|
+
x: 0,
|
|
55
|
+
transitionInUse: false
|
|
56
|
+
});
|
|
57
|
+
const [maskData, setMaskData] = useState({
|
|
58
|
+
leftMaskOpacity: 0,
|
|
59
|
+
rightMaskOpacity: 0
|
|
60
|
+
});
|
|
61
|
+
const animate = ({ transitionInUse }) => {
|
|
62
|
+
const container = tabsRef.current;
|
|
63
|
+
if (!container)
|
|
64
|
+
return;
|
|
65
|
+
const activeIndex = !!tabs.length && tabs.findIndex((item) => {
|
|
66
|
+
var _a2;
|
|
67
|
+
return item.index === (active || ((_a2 = tabs[0]) == null ? void 0 : _a2.index));
|
|
58
68
|
});
|
|
59
|
-
|
|
60
|
-
if (!activeLine)
|
|
61
|
-
|
|
69
|
+
const activeLine = activeLineRef.current;
|
|
70
|
+
if (!activeLine)
|
|
71
|
+
return;
|
|
72
|
+
let activeTab;
|
|
62
73
|
if (tabs.length) {
|
|
63
74
|
activeTab = container.childNodes[activeIndex + 1];
|
|
64
75
|
} else {
|
|
65
|
-
activeTab =
|
|
76
|
+
activeTab = [...container.childNodes].find((child) => {
|
|
66
77
|
if (isMini) {
|
|
67
|
-
return
|
|
78
|
+
return [...child.classList.tokenList].includes(
|
|
79
|
+
"bui-tab-miniapp-active"
|
|
80
|
+
);
|
|
68
81
|
}
|
|
69
|
-
return
|
|
82
|
+
return [...child.classList].includes("bui-tab-active");
|
|
70
83
|
});
|
|
71
84
|
}
|
|
72
|
-
if (!activeTab)
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
85
|
+
if (!activeTab)
|
|
86
|
+
return;
|
|
87
|
+
const activeTabLeft = activeTab.offsetLeft;
|
|
88
|
+
const activeTabWidth = activeTab.offsetWidth;
|
|
89
|
+
const containerWidth = container.offsetWidth;
|
|
90
|
+
const containerScrollWidth = container.scrollWidth;
|
|
91
|
+
const activeLineWidth = activeLine.offsetWidth;
|
|
92
|
+
const x = activeTabLeft + (activeTabWidth - activeLineWidth) / 2;
|
|
79
93
|
setLineData({
|
|
80
|
-
x
|
|
81
|
-
transitionInUse
|
|
94
|
+
x,
|
|
95
|
+
transitionInUse
|
|
82
96
|
});
|
|
83
|
-
|
|
84
|
-
if (maxScrollDistance <= 0)
|
|
85
|
-
|
|
97
|
+
const maxScrollDistance = containerScrollWidth - containerWidth;
|
|
98
|
+
if (maxScrollDistance <= 0)
|
|
99
|
+
return;
|
|
100
|
+
const nextScrollLeft = bound(
|
|
101
|
+
activeTabLeft - (containerWidth - activeTabWidth) / 2,
|
|
102
|
+
0,
|
|
103
|
+
containerScrollWidth - containerWidth
|
|
104
|
+
);
|
|
86
105
|
if (tabsRef.current) {
|
|
87
106
|
tabsRef.current.scrollLeft = nextScrollLeft;
|
|
88
107
|
}
|
|
89
108
|
};
|
|
90
|
-
useEffect(
|
|
91
|
-
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
const defaultIndex = safeValue();
|
|
92
111
|
setActive(defaultIndex);
|
|
93
112
|
}, [value]);
|
|
94
|
-
useLayoutEffect(
|
|
95
|
-
animate({
|
|
96
|
-
transitionInUse: false
|
|
97
|
-
});
|
|
113
|
+
useLayoutEffect(() => {
|
|
114
|
+
animate({ transitionInUse: false });
|
|
98
115
|
}, []);
|
|
99
|
-
useEffect(
|
|
100
|
-
|
|
101
|
-
animate({
|
|
102
|
-
transitionInUse: true
|
|
103
|
-
});
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
const handleResize = debounce(() => {
|
|
118
|
+
animate({ transitionInUse: true });
|
|
104
119
|
}, 100);
|
|
105
|
-
window.addEventListener(
|
|
106
|
-
return
|
|
107
|
-
window.removeEventListener(
|
|
120
|
+
window.addEventListener("resize", handleResize);
|
|
121
|
+
return () => {
|
|
122
|
+
window.removeEventListener("resize", handleResize);
|
|
108
123
|
};
|
|
109
124
|
}, [active]);
|
|
110
|
-
useDidMountEffect(
|
|
111
|
-
animate({
|
|
112
|
-
transitionInUse: true
|
|
113
|
-
});
|
|
125
|
+
useDidMountEffect(() => {
|
|
126
|
+
animate({ transitionInUse: true });
|
|
114
127
|
}, [active, tabs]);
|
|
115
|
-
|
|
116
|
-
var
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
var _tabs$2;
|
|
121
|
-
defaultIndex = (_tabs$2 = tabs[0]) === null || _tabs$2 === void 0 ? void 0 : _tabs$2.index;
|
|
128
|
+
const safeValue = () => {
|
|
129
|
+
var _a2;
|
|
130
|
+
let defaultIndex = value;
|
|
131
|
+
if (!!tabs.length && !tabs.some((item) => item.index === value)) {
|
|
132
|
+
defaultIndex = (_a2 = tabs[0]) == null ? void 0 : _a2.index;
|
|
122
133
|
}
|
|
123
134
|
return defaultIndex;
|
|
124
135
|
};
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
136
|
+
const updateMask = useMemo(
|
|
137
|
+
() => throttle(
|
|
138
|
+
() => {
|
|
139
|
+
const container = tabsRef.current;
|
|
140
|
+
if (!container)
|
|
141
|
+
return;
|
|
142
|
+
const scrollLeft = container == null ? void 0 : container.scrollLeft;
|
|
143
|
+
const showLeftMask = scrollLeft > 0;
|
|
144
|
+
const showRightMask = scrollLeft + container.offsetWidth < container.scrollWidth;
|
|
145
|
+
setMaskData({
|
|
146
|
+
leftMaskOpacity: showLeftMask ? 1 : 0,
|
|
147
|
+
rightMaskOpacity: showRightMask ? 1 : 0
|
|
148
|
+
});
|
|
149
|
+
},
|
|
150
|
+
100,
|
|
151
|
+
{
|
|
152
|
+
trailing: true,
|
|
153
|
+
leading: true
|
|
154
|
+
}
|
|
155
|
+
),
|
|
156
|
+
[]
|
|
157
|
+
);
|
|
158
|
+
useLayoutEffect(() => {
|
|
142
159
|
updateMask();
|
|
143
160
|
}, []);
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
if (
|
|
149
|
-
if (index === undefined || index === null) {
|
|
161
|
+
const handleClick = (e, item) => {
|
|
162
|
+
const { index, disabled = false } = item;
|
|
163
|
+
if (disabled)
|
|
164
|
+
return;
|
|
165
|
+
if (index === void 0 || index === null) {
|
|
150
166
|
return;
|
|
151
167
|
}
|
|
152
168
|
if (active !== value) {
|
|
153
169
|
setActive(index);
|
|
154
170
|
}
|
|
155
171
|
if (index !== value) {
|
|
156
|
-
onChange
|
|
157
|
-
index: index
|
|
158
|
-
});
|
|
172
|
+
onChange == null ? void 0 : onChange(e, { index });
|
|
159
173
|
}
|
|
160
174
|
};
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
return {
|
|
164
|
-
value: v,
|
|
165
|
-
align: align,
|
|
166
|
-
triggerChange: handleClick
|
|
167
|
-
};
|
|
175
|
+
const providerValue = useMemo(() => {
|
|
176
|
+
const v = safeValue();
|
|
177
|
+
return { value: v, align, triggerChange: handleClick };
|
|
168
178
|
}, [value, align, handleClick]);
|
|
169
|
-
return
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
179
|
+
return /* @__PURE__ */ React.createElement("div", __spreadValues({ ref, className: clsx(prefixCls, className) }, others), /* @__PURE__ */ React.createElement(
|
|
180
|
+
"div",
|
|
181
|
+
{
|
|
182
|
+
className: clsx(`${prefixCls}-mask`, `${prefixCls}-mask-left`),
|
|
183
|
+
style: {
|
|
184
|
+
opacity: maskData.leftMaskOpacity
|
|
185
|
+
}
|
|
176
186
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
187
|
+
), /* @__PURE__ */ React.createElement(
|
|
188
|
+
"div",
|
|
189
|
+
{
|
|
190
|
+
className: clsx(`${prefixCls}-mask`, `${prefixCls}-mask-right`),
|
|
191
|
+
style: {
|
|
192
|
+
opacity: maskData.rightMaskOpacity
|
|
193
|
+
}
|
|
181
194
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
transform: "translate3d(".concat(lineData.x, "px, 0px, 0px)")
|
|
195
|
+
), /* @__PURE__ */ React.createElement("div", { className: `${prefixCls}-tabs`, ref: tabsRef, onScroll: updateMask }, /* @__PURE__ */ React.createElement(
|
|
196
|
+
"div",
|
|
197
|
+
{
|
|
198
|
+
ref: activeLineRef,
|
|
199
|
+
className: clsx(`${prefixCls}-tabline`, {
|
|
200
|
+
"bui-tabline-invisible": isMini
|
|
201
|
+
}),
|
|
202
|
+
style: {
|
|
203
|
+
transition: lineData.transitionInUse ? "transform 0.25s ease-in-out" : "",
|
|
204
|
+
transform: `translate3d(${lineData.x}px, 0px, 0px)`
|
|
205
|
+
}
|
|
194
206
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
207
|
+
), /* @__PURE__ */ React.createElement(TabsContextProvider, { value: providerValue }, !!tabs.length && tabs.map((item) => {
|
|
208
|
+
return /* @__PURE__ */ React.createElement(
|
|
209
|
+
Tab,
|
|
210
|
+
{
|
|
211
|
+
key: item.index,
|
|
212
|
+
index: item == null ? void 0 : item.index,
|
|
213
|
+
disabled: item == null ? void 0 : item.disabled
|
|
214
|
+
},
|
|
215
|
+
item.title
|
|
216
|
+
);
|
|
203
217
|
}), children)));
|
|
204
218
|
});
|
|
205
|
-
Tabs.displayName =
|
|
219
|
+
Tabs.displayName = "BuiTabs";
|
|
206
220
|
Tabs.defaultProps = {
|
|
207
|
-
align:
|
|
221
|
+
align: "center",
|
|
208
222
|
tabs: []
|
|
209
223
|
};
|
|
210
|
-
|
|
224
|
+
var Tabs_default = Tabs;
|
|
225
|
+
export {
|
|
226
|
+
Tabs_default as default
|
|
227
|
+
};
|
package/es/Tabs/Tabs.types.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/es/Tabs/TabsContext.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TabChangeEvent, TabsProps } from './Tabs.types';
|
|
3
|
-
declare const TabsContext: React.Context<Omit<TabsProps, "onChange"> & {
|
|
3
|
+
declare const TabsContext: React.Context<Omit<TabsProps<"div", {}>, "onChange"> & {
|
|
4
4
|
triggerChange: TabChangeEvent;
|
|
5
5
|
}>;
|
|
6
|
-
export declare const TabsContextProvider: React.Provider<Omit<TabsProps, "onChange"> & {
|
|
6
|
+
export declare const TabsContextProvider: React.Provider<Omit<TabsProps<"div", {}>, "onChange"> & {
|
|
7
7
|
triggerChange: TabChangeEvent;
|
|
8
8
|
}>;
|
|
9
9
|
export default TabsContext;
|
package/es/Tabs/TabsContext.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
|
|
3
|
-
if (process.env.NODE_ENV !==
|
|
4
|
-
TabsContext.displayName =
|
|
1
|
+
import React from "react";
|
|
2
|
+
const TabsContext = React.createContext(void 0);
|
|
3
|
+
if (process.env.NODE_ENV !== "production") {
|
|
4
|
+
TabsContext.displayName = "BuiTabsContext";
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const TabsContextProvider = TabsContext.Provider;
|
|
7
|
+
var TabsContext_default = TabsContext;
|
|
8
|
+
export {
|
|
9
|
+
TabsContextProvider,
|
|
10
|
+
TabsContext_default as default
|
|
11
|
+
};
|
package/es/Tabs/index.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import { default as default2 } from "./Tab";
|
|
2
2
|
export * from "./Tab.types";
|
|
3
|
-
|
|
3
|
+
import { default as default3 } from "./TabPanel";
|
|
4
4
|
export * from "./TabPanel.types";
|
|
5
|
-
|
|
6
|
-
export * from "./Tabs.types";
|
|
5
|
+
import { default as default4, default as default5 } from "./Tabs";
|
|
6
|
+
export * from "./Tabs.types";
|
|
7
|
+
export {
|
|
8
|
+
default2 as Tab,
|
|
9
|
+
default3 as TabPanel,
|
|
10
|
+
default5 as Tabs,
|
|
11
|
+
default4 as default
|
|
12
|
+
};
|
package/es/Tabs/utils/bound.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (min !==
|
|
1
|
+
function bound(position, min, max) {
|
|
2
|
+
let ret = position;
|
|
3
|
+
if (min !== void 0) {
|
|
4
4
|
ret = Math.max(position, min);
|
|
5
5
|
}
|
|
6
|
-
if (max !==
|
|
6
|
+
if (max !== void 0) {
|
|
7
7
|
ret = Math.min(ret, max);
|
|
8
8
|
}
|
|
9
9
|
return ret;
|
|
10
|
-
}
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
bound as default
|
|
13
|
+
};
|
package/es/Tag/Tag.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TagProps } from './Tag.types';
|
|
3
3
|
import './Tag.less';
|
|
4
|
-
declare const Tag: React.ForwardRefExoticComponent<Omit<TagProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
declare const Tag: React.ForwardRefExoticComponent<Omit<TagProps<"div", {}>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
5
|
export default Tag;
|
package/es/Tag/Tag.js
CHANGED
|
@@ -1,56 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
var __objRest = (source, exclude) => {
|
|
18
|
+
var target = {};
|
|
19
|
+
for (var prop in source)
|
|
20
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
21
|
+
target[prop] = source[prop];
|
|
22
|
+
if (source != null && __getOwnPropSymbols)
|
|
23
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
24
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
25
|
+
target[prop] = source[prop];
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
};
|
|
29
|
+
import { convertHexToRGBA } from "@bifrostui/utils";
|
|
30
|
+
import clsx from "clsx";
|
|
31
|
+
import React from "react";
|
|
14
32
|
import "./Tag.css";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var opacity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
20
|
-
// rgba
|
|
21
|
-
if (color.includes('rgba')) {
|
|
22
|
-
var lastCommaIndex = color.lastIndexOf(',');
|
|
23
|
-
return "".concat(color.slice(0, lastCommaIndex), ", ").concat(opacity, ")");
|
|
33
|
+
const colorHandler = (color, opacity = 1) => {
|
|
34
|
+
if (color.includes("rgba")) {
|
|
35
|
+
const lastCommaIndex = color.lastIndexOf(",");
|
|
36
|
+
return `${color.slice(0, lastCommaIndex)}, ${opacity})`;
|
|
24
37
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
var len = color.length;
|
|
30
|
-
return "".concat(color.slice(0, len - 1), ", ").concat(opacity, ")");
|
|
38
|
+
if (color.includes("rgb")) {
|
|
39
|
+
color = color.replace("rgb", "rgba");
|
|
40
|
+
const len = color.length;
|
|
41
|
+
return `${color.slice(0, len - 1)}, ${opacity})`;
|
|
31
42
|
}
|
|
32
|
-
|
|
33
|
-
// hex
|
|
34
43
|
return convertHexToRGBA(color, opacity);
|
|
35
44
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
const prefixCls = "bui-tag";
|
|
46
|
+
const Tag = React.forwardRef((props, ref) => {
|
|
47
|
+
const _a = props, {
|
|
48
|
+
className,
|
|
49
|
+
style,
|
|
50
|
+
color,
|
|
51
|
+
htmlColor,
|
|
52
|
+
variant,
|
|
53
|
+
onClick,
|
|
54
|
+
children
|
|
55
|
+
} = _a, others = __objRest(_a, [
|
|
56
|
+
"className",
|
|
57
|
+
"style",
|
|
58
|
+
"color",
|
|
59
|
+
"htmlColor",
|
|
60
|
+
"variant",
|
|
61
|
+
"onClick",
|
|
62
|
+
"children"
|
|
63
|
+
]);
|
|
64
|
+
let customStyles;
|
|
47
65
|
if (htmlColor) {
|
|
48
|
-
if (variant ===
|
|
66
|
+
if (variant === "outlined") {
|
|
49
67
|
customStyles = {
|
|
50
68
|
color: htmlColor,
|
|
51
69
|
borderColor: colorHandler(htmlColor, 0.4)
|
|
52
70
|
};
|
|
53
|
-
} else if (variant ===
|
|
71
|
+
} else if (variant === "light") {
|
|
54
72
|
customStyles = {
|
|
55
73
|
color: htmlColor,
|
|
56
74
|
backgroundColor: colorHandler(htmlColor, 0.3)
|
|
@@ -61,16 +79,30 @@ var Tag = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
61
79
|
};
|
|
62
80
|
}
|
|
63
81
|
}
|
|
64
|
-
return
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
82
|
+
return /* @__PURE__ */ React.createElement(
|
|
83
|
+
"div",
|
|
84
|
+
__spreadValues({
|
|
85
|
+
className: clsx(
|
|
86
|
+
prefixCls,
|
|
87
|
+
{
|
|
88
|
+
[`${prefixCls}-${variant}`]: variant,
|
|
89
|
+
[`${prefixCls}-${color}`]: color
|
|
90
|
+
},
|
|
91
|
+
className
|
|
92
|
+
),
|
|
93
|
+
ref,
|
|
94
|
+
style: __spreadValues(__spreadValues({}, style), customStyles),
|
|
95
|
+
onClick
|
|
96
|
+
}, others),
|
|
97
|
+
children
|
|
98
|
+
);
|
|
70
99
|
});
|
|
71
|
-
Tag.displayName =
|
|
100
|
+
Tag.displayName = "BuiTag";
|
|
72
101
|
Tag.defaultProps = {
|
|
73
|
-
variant:
|
|
74
|
-
color:
|
|
102
|
+
variant: "outlined",
|
|
103
|
+
color: "default"
|
|
104
|
+
};
|
|
105
|
+
var Tag_default = Tag;
|
|
106
|
+
export {
|
|
107
|
+
Tag_default as default
|
|
75
108
|
};
|
|
76
|
-
export default Tag;
|
package/es/Tag/Tag.types.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|