@bifrostui/react 2.0.0-alpha.0 → 2.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Alert/Alert.js +2 -1
- package/dist/Alert/__tests__/fixtures/A11yDemos.d.ts +17 -0
- package/dist/Alert/__tests__/fixtures/A11yDemos.js +143 -0
- package/dist/Alert/index.css +4 -4
- package/dist/Avatar/AvatarGroup.css +8 -8
- package/dist/Avatar/index.css +8 -8
- package/dist/Backdrop/Backdrop.js +3 -2
- package/dist/Backdrop/Backdrop.types.d.ts +4 -0
- package/dist/Backdrop/__tests__/fixtures/A11yDemos.d.ts +8 -0
- package/dist/Backdrop/__tests__/fixtures/A11yDemos.js +51 -0
- package/dist/Backdrop/index.css +2 -2
- package/dist/Badge/Badge.js +38 -11
- package/dist/Badge/Badge.types.d.ts +30 -1
- package/dist/Badge/__tests__/fixtures/A11yDemos.d.ts +25 -0
- package/dist/Badge/__tests__/fixtures/A11yDemos.js +110 -0
- package/dist/Badge/hooks/useBadgeA11y.d.ts +23 -0
- package/dist/Badge/hooks/useBadgeA11y.js +76 -0
- package/dist/Badge/hooks/useBadgeDisplay.d.ts +16 -0
- package/dist/Badge/hooks/useBadgeDisplay.js +56 -0
- package/dist/Button/Button.js +2 -1
- package/dist/Button/__tests__/fixtures/A11yDemos.d.ts +23 -0
- package/dist/Button/__tests__/fixtures/A11yDemos.js +81 -0
- package/dist/Button/index.css +4 -5
- package/dist/CSSTransition/CSSTransition.d.ts +4 -0
- package/dist/CSSTransition/CSSTransition.js +177 -0
- package/dist/CSSTransition/CSSTransition.types.d.ts +13 -0
- package/dist/CSSTransition/CSSTransition.types.js +15 -0
- package/dist/CSSTransition/demo/CSSTransitionDemo.d.ts +4 -0
- package/dist/CSSTransition/demo/CSSTransitionDemo.js +76 -0
- package/dist/CSSTransition/demo/index.css +25 -0
- package/dist/CSSTransition/index.d.ts +2 -0
- package/dist/CSSTransition/index.js +41 -0
- package/dist/Calendar/Calendar.js +131 -34
- package/dist/Calendar/Calendar.types.d.ts +16 -1
- package/dist/Calendar/__tests__/fixtures/A11yDemos.d.ts +2 -0
- package/dist/Calendar/__tests__/fixtures/A11yDemos.js +41 -0
- package/dist/Calendar/index.css +52 -9
- package/dist/Calendar/utils.d.ts +7 -3
- package/dist/Calendar/utils.js +33 -23
- package/dist/Checkbox/Checkbox.js +5 -4
- package/dist/Checkbox/__tests__/fixtures/A11yDemos.d.ts +15 -0
- package/dist/Checkbox/__tests__/fixtures/A11yDemos.js +57 -0
- package/dist/CitySelector/CitySelector.types.d.ts +0 -1
- package/dist/Collapse/Collapse.d.ts +1 -1
- package/dist/Collapse/Collapse.js +26 -12
- package/dist/Collapse/Collapse.miniapp.d.ts +10 -0
- package/dist/Collapse/Collapse.miniapp.js +255 -0
- package/dist/Collapse/index.css +40 -1
- package/dist/CollapsePanel/index.css +1 -1
- package/dist/Countdown/Countdown.js +61 -21
- package/dist/Countdown/Countdown.types.d.ts +19 -15
- package/dist/Countdown/__tests__/fixtures/A11yDemos.d.ts +23 -0
- package/dist/Countdown/__tests__/fixtures/A11yDemos.js +107 -0
- package/dist/Countdown/index.css +11 -0
- package/dist/DatePicker/DatePicker.d.ts +4 -0
- package/dist/DatePicker/DatePicker.js +335 -0
- package/dist/DatePicker/DatePicker.types.d.ts +36 -0
- package/dist/DatePicker/DatePicker.types.js +15 -0
- package/dist/DatePicker/constants.d.ts +9 -0
- package/dist/DatePicker/constants.js +37 -0
- package/dist/DatePicker/index.d.ts +3 -0
- package/dist/DatePicker/index.js +44 -0
- package/dist/DesktopDatePicker/DesktopDatePicker.css +61 -0
- package/dist/DesktopDatePicker/DesktopDatePicker.d.ts +5 -0
- package/dist/DesktopDatePicker/DesktopDatePicker.js +280 -0
- package/dist/DesktopDatePicker/DesktopDatePicker.types.d.ts +163 -0
- package/dist/DesktopDatePicker/DesktopDatePicker.types.js +15 -0
- package/dist/DesktopDatePicker/deskTopPickerContainer.css +100 -0
- package/dist/DesktopDatePicker/index.css +161 -0
- package/dist/DesktopDatePicker/index.d.ts +2 -0
- package/dist/DesktopDatePicker/index.js +41 -0
- package/dist/DesktopDatePicker/useGetDatePickerContent.d.ts +6 -0
- package/dist/DesktopDatePicker/useGetDatePickerContent.js +343 -0
- package/dist/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +5 -0
- package/dist/DesktopDateTimePicker/DesktopDateTimePicker.js +322 -0
- package/dist/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +163 -0
- package/dist/DesktopDateTimePicker/DesktopDateTimePicker.types.js +15 -0
- package/dist/DesktopDateTimePicker/index.css +66 -0
- package/dist/DesktopDateTimePicker/index.d.ts +2 -0
- package/dist/DesktopDateTimePicker/index.js +41 -0
- package/dist/DesktopPicker/DesktopPicker.d.ts +5 -0
- package/dist/DesktopPicker/DesktopPicker.js +243 -0
- package/dist/DesktopPicker/DesktopPicker.types.d.ts +61 -0
- package/dist/DesktopPicker/DesktopPicker.types.js +15 -0
- package/dist/DesktopPicker/index.css +39 -0
- package/dist/DesktopPicker/index.d.ts +2 -0
- package/dist/DesktopPicker/index.js +41 -0
- package/dist/DesktopPicker/utils/calcAfterMounted.d.ts +2 -0
- package/dist/{Tabs/utils/bound.js → DesktopPicker/utils/calcAfterMounted.js} +7 -14
- package/dist/DesktopPicker/utils/calcAfterMounted.miniapp.d.ts +2 -0
- package/dist/DesktopPicker/utils/calcAfterMounted.miniapp.js +38 -0
- package/dist/DesktopTimePicker/DesktopTimePicker.d.ts +5 -0
- package/dist/DesktopTimePicker/DesktopTimePicker.js +288 -0
- package/dist/DesktopTimePicker/DesktopTimePicker.types.d.ts +182 -0
- package/dist/DesktopTimePicker/DesktopTimePicker.types.js +15 -0
- package/dist/DesktopTimePicker/DesktopTimePickerList.d.ts +4 -0
- package/dist/DesktopTimePicker/DesktopTimePickerList.js +111 -0
- package/dist/DesktopTimePicker/index.css +170 -0
- package/dist/DesktopTimePicker/index.d.ts +2 -0
- package/dist/DesktopTimePicker/index.js +41 -0
- package/dist/DesktopTimePicker/useGetTimePickerContent.d.ts +6 -0
- package/dist/DesktopTimePicker/useGetTimePickerContent.js +249 -0
- package/dist/DesktopTimePicker/utils/scrollUtil.d.ts +2 -0
- package/dist/DesktopTimePicker/utils/scrollUtil.js +27 -0
- package/dist/DesktopTimePicker/utils/scrollUtil.miniapp.d.ts +2 -0
- package/dist/DesktopTimePicker/utils/scrollUtil.miniapp.js +51 -0
- package/dist/DesktopTimePicker/utils/utils.d.ts +28 -0
- package/dist/DesktopTimePicker/utils/utils.js +408 -0
- package/dist/Dialog/Dialog.d.ts +5 -2
- package/dist/Dialog/Dialog.js +56 -34
- package/dist/Dialog/Dialog.types.d.ts +50 -22
- package/dist/Dialog/FunctionalDialog.d.ts +10 -3
- package/dist/Dialog/FunctionalDialog.js +102 -80
- package/dist/Dialog/__tests__/fixtures/A11yDemos.d.ts +9 -0
- package/dist/Dialog/__tests__/fixtures/A11yDemos.js +78 -0
- package/dist/Dialog/index.css +19 -19
- package/dist/Dialog/index.d.ts +4 -1
- package/dist/Dialog/index.js +9 -2
- package/dist/Drawer/Drawer.js +7 -7
- package/dist/Drawer/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/dist/Drawer/__tests__/fixtures/A11yDemos.js +148 -0
- package/dist/Fade/Fade.js +2 -2
- package/dist/Fade/Fade.miniapp.d.ts +10 -0
- package/dist/Fade/Fade.miniapp.js +200 -0
- package/dist/Fade/index.css +18 -0
- package/dist/IconButton/IconButton.js +23 -8
- package/dist/IconButton/IconButton.types.d.ts +35 -1
- package/dist/IconButton/index.css +3 -0
- package/dist/Image/Image.js +17 -10
- package/dist/Image/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/dist/Image/__tests__/fixtures/A11yDemos.js +130 -0
- package/dist/Image/index.css +3 -8
- package/dist/Input/Input.js +5 -3
- package/dist/Input/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/dist/Input/__tests__/fixtures/A11yDemos.js +81 -0
- package/dist/Input/index.css +8 -8
- package/dist/ItemSelector/ItemSelector.types.d.ts +0 -1
- package/dist/Modal/Modal.js +47 -47
- package/dist/Modal/Modal.miniapp.d.ts +2 -2
- package/dist/Modal/Modal.miniapp.js +48 -32
- package/dist/Modal/Modal.types.d.ts +26 -2
- package/dist/Modal/ModalManager.d.ts +21 -0
- package/dist/Modal/ModalManager.js +238 -0
- package/dist/Modal/__tests__/fixtures/A11yDemos.d.ts +8 -0
- package/dist/Modal/__tests__/fixtures/A11yDemos.js +52 -0
- package/dist/Modal/index.css +1 -1
- package/dist/Modal/index.d.ts +3 -0
- package/dist/Modal/index.js +9 -1
- package/dist/Modal/useModal.d.ts +24 -0
- package/dist/Modal/useModal.js +190 -0
- package/dist/NavBar/index.css +2 -2
- package/dist/Picker/Picker.css +4 -0
- package/dist/Picker/Picker.js +72 -18
- package/dist/Picker/Picker.types.d.ts +15 -2
- package/dist/Picker/PickerPanel.css +4 -0
- package/dist/Picker/PickerPanel.js +52 -41
- package/dist/Picker/__tests__/fixtures/A11yDemos.d.ts +2 -0
- package/dist/Picker/__tests__/fixtures/A11yDemos.js +79 -0
- package/dist/Picker/index.css +8 -0
- package/dist/Picker/utils.d.ts +8 -5
- package/dist/Picker/utils.js +9 -12
- package/dist/Popover/Popover.js +123 -91
- package/dist/Popover/Popover.types.d.ts +44 -7
- package/dist/Popover/__tests__/fixtures/A11yDemos.d.ts +25 -0
- package/dist/Popover/__tests__/fixtures/A11yDemos.js +175 -0
- package/dist/Popover/hooks/index.d.ts +8 -0
- package/dist/Popover/hooks/index.js +36 -0
- package/dist/Popover/hooks/usePopoverA11y.d.ts +14 -0
- package/dist/Popover/hooks/usePopoverA11y.js +66 -0
- package/dist/Popover/hooks/usePopoverEvents.d.ts +21 -0
- package/dist/Popover/hooks/usePopoverEvents.js +150 -0
- package/dist/Popover/hooks/usePopoverPosition.d.ts +17 -0
- package/dist/Popover/hooks/usePopoverPosition.js +124 -0
- package/dist/Popover/hooks/usePopoverState.d.ts +16 -0
- package/dist/Popover/hooks/usePopoverState.js +54 -0
- package/dist/Portal/Portal.miniapp.js +20 -11
- package/dist/Portal/Portal.types.d.ts +1 -1
- package/dist/Portal/PortalCore.js +2 -2
- package/dist/Progress/Progress.js +61 -6
- package/dist/Progress/Progress.types.d.ts +44 -0
- package/dist/Progress/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/dist/Progress/__tests__/fixtures/A11yDemos.js +100 -0
- package/dist/Radio/Radio.js +5 -4
- package/dist/Radio/RadioGroup.js +1 -1
- package/dist/Radio/__tests__/fixtures/A11yDemos.d.ts +15 -0
- package/dist/Radio/__tests__/fixtures/A11yDemos.js +57 -0
- package/dist/Rating/index.css +8 -12
- package/dist/ScrollView/ScrollView.js +48 -196
- package/dist/ScrollView/ScrollView.types.d.ts +120 -86
- package/dist/ScrollView/__tests__/fixtures/A11yDemos.d.ts +7 -0
- package/dist/ScrollView/__tests__/fixtures/A11yDemos.js +319 -0
- package/dist/ScrollView/useScrollView.d.ts +10 -0
- package/dist/ScrollView/useScrollView.js +300 -0
- package/dist/Select/Select.js +73 -39
- package/dist/Select/Select.types.d.ts +2 -2
- package/dist/Select/SelectOption.js +5 -1
- package/dist/Select/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/dist/Select/__tests__/fixtures/A11yDemos.js +154 -0
- package/dist/Select/index.css +12 -8
- package/dist/Select/selectContext.d.ts +0 -1
- package/dist/Slide/Slide.js +2 -2
- package/dist/Slide/Slide.miniapp.d.ts +14 -0
- package/dist/Slide/Slide.miniapp.js +213 -0
- package/dist/Slide/index.css +72 -0
- package/dist/Slider/Slider.js +13 -5
- package/dist/Stack/demo/index.css +2 -0
- package/dist/SwipeAction/SwipeAction.css +79 -0
- package/dist/SwipeAction/SwipeAction.d.ts +5 -0
- package/dist/SwipeAction/SwipeAction.js +349 -0
- package/dist/SwipeAction/SwipeAction.types.d.ts +75 -0
- package/dist/SwipeAction/SwipeAction.types.js +15 -0
- package/dist/SwipeAction/SwipeActionContext.d.ts +3 -0
- package/dist/SwipeAction/SwipeActionContext.js +30 -0
- package/dist/SwipeAction/SwipeActionItem.css +31 -0
- package/dist/SwipeAction/SwipeActionItem.d.ts +5 -0
- package/dist/SwipeAction/SwipeActionItem.js +105 -0
- package/dist/SwipeAction/constants.d.ts +9 -0
- package/dist/SwipeAction/constants.js +39 -0
- package/dist/SwipeAction/index.css +110 -0
- package/dist/SwipeAction/index.d.ts +5 -0
- package/dist/SwipeAction/index.js +50 -0
- package/dist/Swiper/Swiper.js +18 -4
- package/dist/Switch/Switch.js +5 -4
- package/dist/Switch/__tests__/fixtures/A11yDemos.d.ts +15 -0
- package/dist/Switch/__tests__/fixtures/A11yDemos.js +57 -0
- package/dist/Tabs/Tab.js +36 -21
- package/dist/Tabs/Tab.types.d.ts +1 -1
- package/dist/Tabs/TabPanel.d.ts +1 -1
- package/dist/Tabs/TabPanel.js +9 -5
- package/dist/Tabs/Tabs.css +2 -2
- package/dist/Tabs/Tabs.js +87 -64
- package/dist/Tabs/Tabs.types.d.ts +1 -1
- package/dist/Tabs/TabsContext.d.ts +4 -5
- package/dist/Tabs/TabsContext.js +3 -1
- package/dist/Tabs/index.css +2 -2
- package/dist/Tabs/utils/scroll.d.ts +2 -0
- package/dist/Tabs/utils/scroll.js +55 -0
- package/dist/Tag/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/dist/Tag/__tests__/fixtures/A11yDemos.js +196 -0
- package/dist/TextArea/TextArea.js +50 -7
- package/dist/TextArea/TextArea.types.d.ts +28 -0
- package/dist/TextArea/__tests__/fixtures/A11yDemos.d.ts +19 -0
- package/dist/TextArea/__tests__/fixtures/A11yDemos.js +91 -0
- package/dist/TextArea/index.css +4 -4
- package/dist/ThemeProvider/ThemeProvider.types.d.ts +2 -2
- package/dist/ThemeProvider/ThemeProvider.types.js +0 -12
- package/dist/Toast/FunctionalToast.d.ts +2 -2
- package/dist/Toast/FunctionalToast.js +180 -85
- package/dist/Toast/Toast.d.ts +2 -2
- package/dist/Toast/Toast.js +69 -28
- package/dist/Toast/Toast.types.d.ts +13 -10
- package/dist/Toast/__tests__/fixtures/A11yDemos.d.ts +2 -0
- package/dist/Toast/__tests__/fixtures/A11yDemos.js +54 -0
- package/dist/Toast/index.css +0 -1
- package/dist/Tooltip/Tooltip.js +63 -107
- package/dist/Tooltip/Tooltip.types.d.ts +94 -43
- package/dist/Tooltip/__tests__/fixtures/A11yDemos.d.ts +25 -0
- package/dist/Tooltip/__tests__/fixtures/A11yDemos.js +100 -0
- package/dist/Tooltip/useTooltip.d.ts +29 -0
- package/dist/Tooltip/useTooltip.js +313 -0
- package/dist/Transition/TransitionCore.js +30 -25
- package/dist/TransitionGroup/TransitionGroup.d.ts +7 -0
- package/dist/TransitionGroup/TransitionGroup.js +132 -0
- package/dist/TransitionGroup/TransitionGroup.types.d.ts +47 -0
- package/dist/TransitionGroup/TransitionGroup.types.js +15 -0
- package/dist/TransitionGroup/demo/TransitionGroupDemo.d.ts +4 -0
- package/dist/TransitionGroup/demo/TransitionGroupDemo.js +68 -0
- package/dist/TransitionGroup/demo/index.css +33 -0
- package/dist/TransitionGroup/index.d.ts +2 -0
- package/dist/TransitionGroup/index.js +41 -0
- package/dist/TransitionGroup/utils/childMapping.d.ts +27 -0
- package/dist/TransitionGroup/utils/childMapping.js +119 -0
- package/dist/_.._/benchmarks/components/Button.js +41 -0
- package/dist/_.._/benchmarks/components/Input.js +45 -0
- package/dist/_.._/benchmarks/components/Tabs.js +50 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +17 -1
- package/dist/locales/base.d.ts +40 -1
- package/dist/locales/en-US.js +54 -2
- package/dist/locales/zh-CN.js +56 -1
- package/dist/locales/zh-TW.js +56 -1
- package/es/Alert/Alert.js +2 -1
- package/es/Alert/__tests__/fixtures/A11yDemos.d.ts +17 -0
- package/es/Alert/__tests__/fixtures/A11yDemos.js +107 -0
- package/es/Alert/index.css +4 -4
- package/es/Avatar/AvatarGroup.css +8 -8
- package/es/Avatar/index.css +8 -8
- package/es/Backdrop/Backdrop.js +3 -2
- package/es/Backdrop/Backdrop.types.d.ts +4 -0
- package/es/Backdrop/__tests__/fixtures/A11yDemos.d.ts +8 -0
- package/es/Backdrop/__tests__/fixtures/A11yDemos.js +17 -0
- package/es/Backdrop/index.css +2 -2
- package/es/Badge/Badge.js +38 -11
- package/es/Badge/Badge.types.d.ts +30 -1
- package/es/Badge/__tests__/fixtures/A11yDemos.d.ts +25 -0
- package/es/Badge/__tests__/fixtures/A11yDemos.js +70 -0
- package/es/Badge/hooks/useBadgeA11y.d.ts +23 -0
- package/es/Badge/hooks/useBadgeA11y.js +53 -0
- package/es/Badge/hooks/useBadgeDisplay.d.ts +16 -0
- package/es/Badge/hooks/useBadgeDisplay.js +33 -0
- package/es/Button/Button.js +2 -1
- package/es/Button/__tests__/fixtures/A11yDemos.d.ts +23 -0
- package/es/Button/__tests__/fixtures/A11yDemos.js +42 -0
- package/es/Button/index.css +4 -5
- package/es/CSSTransition/CSSTransition.d.ts +4 -0
- package/es/CSSTransition/CSSTransition.js +153 -0
- package/es/CSSTransition/CSSTransition.types.d.ts +13 -0
- package/es/CSSTransition/CSSTransition.types.js +1 -0
- package/es/CSSTransition/demo/CSSTransitionDemo.d.ts +4 -0
- package/es/CSSTransition/demo/CSSTransitionDemo.js +47 -0
- package/es/CSSTransition/demo/index.css +25 -0
- package/es/CSSTransition/index.d.ts +2 -0
- package/es/CSSTransition/index.js +6 -0
- package/es/Calendar/Calendar.js +131 -34
- package/es/Calendar/Calendar.types.d.ts +16 -1
- package/es/Calendar/__tests__/fixtures/A11yDemos.d.ts +2 -0
- package/es/Calendar/__tests__/fixtures/A11yDemos.js +8 -0
- package/es/Calendar/index.css +52 -9
- package/es/Calendar/utils.d.ts +7 -3
- package/es/Calendar/utils.js +29 -20
- package/es/Checkbox/Checkbox.js +5 -4
- package/es/Checkbox/__tests__/fixtures/A11yDemos.d.ts +15 -0
- package/es/Checkbox/__tests__/fixtures/A11yDemos.js +22 -0
- package/es/CitySelector/CitySelector.types.d.ts +0 -1
- package/es/Collapse/Collapse.d.ts +1 -1
- package/es/Collapse/Collapse.js +26 -12
- package/es/Collapse/Collapse.miniapp.d.ts +10 -0
- package/es/Collapse/Collapse.miniapp.js +236 -0
- package/es/Collapse/index.css +40 -1
- package/es/CollapsePanel/index.css +1 -1
- package/es/Countdown/Countdown.js +61 -21
- package/es/Countdown/Countdown.types.d.ts +19 -15
- package/es/Countdown/__tests__/fixtures/A11yDemos.d.ts +23 -0
- package/es/Countdown/__tests__/fixtures/A11yDemos.js +68 -0
- package/es/Countdown/index.css +11 -0
- package/es/DatePicker/DatePicker.d.ts +4 -0
- package/es/DatePicker/DatePicker.js +308 -0
- package/es/DatePicker/DatePicker.types.d.ts +36 -0
- package/es/DatePicker/DatePicker.types.js +1 -0
- package/es/DatePicker/constants.d.ts +9 -0
- package/es/DatePicker/constants.js +14 -0
- package/es/DatePicker/index.d.ts +3 -0
- package/es/DatePicker/index.js +8 -0
- package/es/DesktopDatePicker/DesktopDatePicker.css +61 -0
- package/es/DesktopDatePicker/DesktopDatePicker.d.ts +5 -0
- package/es/DesktopDatePicker/DesktopDatePicker.js +253 -0
- package/es/DesktopDatePicker/DesktopDatePicker.types.d.ts +163 -0
- package/es/DesktopDatePicker/DesktopDatePicker.types.js +1 -0
- package/es/DesktopDatePicker/deskTopPickerContainer.css +100 -0
- package/es/DesktopDatePicker/index.css +161 -0
- package/es/DesktopDatePicker/index.d.ts +2 -0
- package/es/DesktopDatePicker/index.js +6 -0
- package/es/DesktopDatePicker/useGetDatePickerContent.d.ts +6 -0
- package/es/DesktopDatePicker/useGetDatePickerContent.js +316 -0
- package/es/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +5 -0
- package/es/DesktopDateTimePicker/DesktopDateTimePicker.js +295 -0
- package/es/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +163 -0
- package/es/DesktopDateTimePicker/DesktopDateTimePicker.types.js +1 -0
- package/es/DesktopDateTimePicker/index.css +66 -0
- package/es/DesktopDateTimePicker/index.d.ts +2 -0
- package/es/DesktopDateTimePicker/index.js +9 -0
- package/es/DesktopPicker/DesktopPicker.d.ts +5 -0
- package/es/DesktopPicker/DesktopPicker.js +226 -0
- package/es/DesktopPicker/DesktopPicker.types.d.ts +61 -0
- package/es/DesktopPicker/DesktopPicker.types.js +1 -0
- package/es/DesktopPicker/index.css +39 -0
- package/es/DesktopPicker/index.d.ts +2 -0
- package/es/DesktopPicker/index.js +6 -0
- package/es/DesktopPicker/utils/calcAfterMounted.d.ts +2 -0
- package/es/DesktopPicker/utils/calcAfterMounted.js +6 -0
- package/es/DesktopPicker/utils/calcAfterMounted.miniapp.d.ts +2 -0
- package/es/DesktopPicker/utils/calcAfterMounted.miniapp.js +9 -0
- package/es/DesktopTimePicker/DesktopTimePicker.d.ts +5 -0
- package/es/DesktopTimePicker/DesktopTimePicker.js +261 -0
- package/es/DesktopTimePicker/DesktopTimePicker.types.d.ts +182 -0
- package/es/DesktopTimePicker/DesktopTimePicker.types.js +1 -0
- package/es/DesktopTimePicker/DesktopTimePickerList.d.ts +4 -0
- package/es/DesktopTimePicker/DesktopTimePickerList.js +84 -0
- package/es/DesktopTimePicker/index.css +170 -0
- package/es/DesktopTimePicker/index.d.ts +2 -0
- package/es/DesktopTimePicker/index.js +6 -0
- package/es/DesktopTimePicker/useGetTimePickerContent.d.ts +6 -0
- package/es/DesktopTimePicker/useGetTimePickerContent.js +226 -0
- package/es/DesktopTimePicker/utils/scrollUtil.d.ts +2 -0
- package/es/DesktopTimePicker/utils/scrollUtil.js +8 -0
- package/es/DesktopTimePicker/utils/scrollUtil.miniapp.d.ts +2 -0
- package/es/DesktopTimePicker/utils/scrollUtil.miniapp.js +22 -0
- package/es/DesktopTimePicker/utils/utils.d.ts +28 -0
- package/es/DesktopTimePicker/utils/utils.js +365 -0
- package/es/Dialog/Dialog.d.ts +5 -2
- package/es/Dialog/Dialog.js +57 -35
- package/es/Dialog/Dialog.types.d.ts +50 -22
- package/es/Dialog/FunctionalDialog.d.ts +10 -3
- package/es/Dialog/FunctionalDialog.js +106 -84
- package/es/Dialog/__tests__/fixtures/A11yDemos.d.ts +9 -0
- package/es/Dialog/__tests__/fixtures/A11yDemos.js +43 -0
- package/es/Dialog/index.css +19 -19
- package/es/Dialog/index.d.ts +4 -1
- package/es/Dialog/index.js +10 -3
- package/es/Drawer/Drawer.js +8 -8
- package/es/Drawer/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/es/Drawer/__tests__/fixtures/A11yDemos.js +112 -0
- package/es/Fade/Fade.js +2 -2
- package/es/Fade/Fade.miniapp.d.ts +10 -0
- package/es/Fade/Fade.miniapp.js +179 -0
- package/es/Fade/index.css +18 -0
- package/es/IconButton/IconButton.js +23 -8
- package/es/IconButton/IconButton.types.d.ts +35 -1
- package/es/IconButton/index.css +3 -0
- package/es/Image/Image.js +17 -10
- package/es/Image/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/es/Image/__tests__/fixtures/A11yDemos.js +92 -0
- package/es/Image/index.css +3 -8
- package/es/Input/Input.js +5 -3
- package/es/Input/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/es/Input/__tests__/fixtures/A11yDemos.js +43 -0
- package/es/Input/index.css +8 -8
- package/es/ItemSelector/ItemSelector.types.d.ts +0 -1
- package/es/Modal/Modal.js +48 -48
- package/es/Modal/Modal.miniapp.d.ts +2 -2
- package/es/Modal/Modal.miniapp.js +49 -33
- package/es/Modal/Modal.types.d.ts +26 -2
- package/es/Modal/ModalManager.d.ts +21 -0
- package/es/Modal/ModalManager.js +214 -0
- package/es/Modal/__tests__/fixtures/A11yDemos.d.ts +8 -0
- package/es/Modal/__tests__/fixtures/A11yDemos.js +18 -0
- package/es/Modal/index.css +1 -1
- package/es/Modal/index.d.ts +3 -0
- package/es/Modal/index.js +6 -1
- package/es/Modal/useModal.d.ts +24 -0
- package/es/Modal/useModal.js +169 -0
- package/es/NavBar/index.css +2 -2
- package/es/Picker/Picker.css +4 -0
- package/es/Picker/Picker.js +72 -18
- package/es/Picker/Picker.types.d.ts +15 -2
- package/es/Picker/PickerPanel.css +4 -0
- package/es/Picker/PickerPanel.js +52 -41
- package/es/Picker/__tests__/fixtures/A11yDemos.d.ts +2 -0
- package/es/Picker/__tests__/fixtures/A11yDemos.js +46 -0
- package/es/Picker/index.css +8 -0
- package/es/Picker/utils.d.ts +8 -5
- package/es/Picker/utils.js +9 -12
- package/es/Popover/Popover.js +130 -99
- package/es/Popover/Popover.types.d.ts +44 -7
- package/es/Popover/__tests__/fixtures/A11yDemos.d.ts +25 -0
- package/es/Popover/__tests__/fixtures/A11yDemos.js +135 -0
- package/es/Popover/hooks/index.d.ts +8 -0
- package/es/Popover/hooks/index.js +10 -0
- package/es/Popover/hooks/usePopoverA11y.d.ts +14 -0
- package/es/Popover/hooks/usePopoverA11y.js +43 -0
- package/es/Popover/hooks/usePopoverEvents.d.ts +21 -0
- package/es/Popover/hooks/usePopoverEvents.js +127 -0
- package/es/Popover/hooks/usePopoverPosition.d.ts +17 -0
- package/es/Popover/hooks/usePopoverPosition.js +105 -0
- package/es/Popover/hooks/usePopoverState.d.ts +16 -0
- package/es/Popover/hooks/usePopoverState.js +31 -0
- package/es/Portal/Portal.miniapp.js +21 -12
- package/es/Portal/Portal.types.d.ts +1 -1
- package/es/Portal/PortalCore.js +2 -2
- package/es/Progress/Progress.js +61 -6
- package/es/Progress/Progress.types.d.ts +44 -0
- package/es/Progress/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/es/Progress/__tests__/fixtures/A11yDemos.js +62 -0
- package/es/Radio/Radio.js +5 -4
- package/es/Radio/RadioGroup.js +1 -1
- package/es/Radio/__tests__/fixtures/A11yDemos.d.ts +15 -0
- package/es/Radio/__tests__/fixtures/A11yDemos.js +22 -0
- package/es/Rating/index.css +8 -12
- package/es/ScrollView/ScrollView.js +51 -197
- package/es/ScrollView/ScrollView.types.d.ts +120 -86
- package/es/ScrollView/__tests__/fixtures/A11yDemos.d.ts +7 -0
- package/es/ScrollView/__tests__/fixtures/A11yDemos.js +283 -0
- package/es/ScrollView/useScrollView.d.ts +10 -0
- package/es/ScrollView/useScrollView.js +279 -0
- package/es/Select/Select.js +73 -40
- package/es/Select/Select.types.d.ts +2 -2
- package/es/Select/SelectOption.js +5 -1
- package/es/Select/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/es/Select/__tests__/fixtures/A11yDemos.js +118 -0
- package/es/Select/index.css +12 -8
- package/es/Select/selectContext.d.ts +0 -1
- package/es/Slide/Slide.js +2 -2
- package/es/Slide/Slide.miniapp.d.ts +14 -0
- package/es/Slide/Slide.miniapp.js +192 -0
- package/es/Slide/index.css +72 -0
- package/es/Slider/Slider.js +16 -6
- package/es/Stack/demo/index.css +2 -0
- package/es/SwipeAction/SwipeAction.css +79 -0
- package/es/SwipeAction/SwipeAction.d.ts +5 -0
- package/es/SwipeAction/SwipeAction.js +334 -0
- package/es/SwipeAction/SwipeAction.types.d.ts +75 -0
- package/es/SwipeAction/SwipeAction.types.js +1 -0
- package/es/SwipeAction/SwipeActionContext.d.ts +3 -0
- package/es/SwipeAction/SwipeActionContext.js +11 -0
- package/es/SwipeAction/SwipeActionItem.css +31 -0
- package/es/SwipeAction/SwipeActionItem.d.ts +5 -0
- package/es/SwipeAction/SwipeActionItem.js +78 -0
- package/es/SwipeAction/constants.d.ts +9 -0
- package/es/SwipeAction/constants.js +15 -0
- package/es/SwipeAction/index.css +110 -0
- package/es/SwipeAction/index.d.ts +5 -0
- package/es/SwipeAction/index.js +12 -0
- package/es/Swiper/Swiper.js +18 -4
- package/es/Switch/Switch.js +5 -4
- package/es/Switch/__tests__/fixtures/A11yDemos.d.ts +15 -0
- package/es/Switch/__tests__/fixtures/A11yDemos.js +22 -0
- package/es/Tabs/Tab.js +36 -21
- package/es/Tabs/Tab.types.d.ts +1 -1
- package/es/Tabs/TabPanel.d.ts +1 -1
- package/es/Tabs/TabPanel.js +8 -4
- package/es/Tabs/Tabs.css +2 -2
- package/es/Tabs/Tabs.js +87 -64
- package/es/Tabs/Tabs.types.d.ts +1 -1
- package/es/Tabs/TabsContext.d.ts +4 -5
- package/es/Tabs/TabsContext.js +3 -1
- package/es/Tabs/index.css +2 -2
- package/es/Tabs/utils/scroll.d.ts +2 -0
- package/es/Tabs/utils/scroll.js +36 -0
- package/es/Tag/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/es/Tag/__tests__/fixtures/A11yDemos.js +160 -0
- package/es/TextArea/TextArea.js +51 -8
- package/es/TextArea/TextArea.types.d.ts +28 -0
- package/es/TextArea/__tests__/fixtures/A11yDemos.d.ts +19 -0
- package/es/TextArea/__tests__/fixtures/A11yDemos.js +54 -0
- package/es/TextArea/index.css +4 -4
- package/es/ThemeProvider/ThemeProvider.types.d.ts +2 -2
- package/es/Toast/FunctionalToast.d.ts +2 -2
- package/es/Toast/FunctionalToast.js +186 -86
- package/es/Toast/Toast.d.ts +2 -2
- package/es/Toast/Toast.js +69 -28
- package/es/Toast/Toast.types.d.ts +13 -10
- package/es/Toast/__tests__/fixtures/A11yDemos.d.ts +2 -0
- package/es/Toast/__tests__/fixtures/A11yDemos.js +21 -0
- package/es/Toast/index.css +0 -1
- package/es/Tooltip/Tooltip.js +64 -114
- package/es/Tooltip/Tooltip.types.d.ts +94 -43
- package/es/Tooltip/__tests__/fixtures/A11yDemos.d.ts +25 -0
- package/es/Tooltip/__tests__/fixtures/A11yDemos.js +60 -0
- package/es/Tooltip/useTooltip.d.ts +29 -0
- package/es/Tooltip/useTooltip.js +290 -0
- package/es/Transition/TransitionCore.js +31 -26
- package/es/TransitionGroup/TransitionGroup.d.ts +7 -0
- package/es/TransitionGroup/TransitionGroup.js +109 -0
- package/es/TransitionGroup/TransitionGroup.types.d.ts +47 -0
- package/es/TransitionGroup/TransitionGroup.types.js +1 -0
- package/es/TransitionGroup/demo/TransitionGroupDemo.d.ts +4 -0
- package/es/TransitionGroup/demo/TransitionGroupDemo.js +39 -0
- package/es/TransitionGroup/demo/index.css +33 -0
- package/es/TransitionGroup/index.d.ts +2 -0
- package/es/TransitionGroup/index.js +6 -0
- package/es/TransitionGroup/utils/childMapping.d.ts +27 -0
- package/es/TransitionGroup/utils/childMapping.js +93 -0
- package/es/_.._/benchmarks/components/Button.js +8 -0
- package/es/_.._/benchmarks/components/Input.js +12 -0
- package/es/_.._/benchmarks/components/Tabs.js +17 -0
- package/es/index.d.ts +8 -0
- package/es/index.js +8 -0
- package/es/locales/base.d.ts +40 -1
- package/es/locales/en-US.js +54 -2
- package/es/locales/zh-CN.js +56 -1
- package/es/locales/zh-TW.js +56 -1
- package/package.json +9 -6
- package/dist/Tabs/utils/bound.d.ts +0 -1
- package/es/Tabs/utils/bound.d.ts +0 -1
- package/es/Tabs/utils/bound.js +0 -13
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
@keyframes bui-slide-left-in {
|
|
2
|
+
from {
|
|
3
|
+
transform: translateX(100%);
|
|
4
|
+
}
|
|
5
|
+
to {
|
|
6
|
+
visibility: visible;
|
|
7
|
+
transform: none;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
@keyframes bui-slide-left-out {
|
|
11
|
+
from {
|
|
12
|
+
transform: none;
|
|
13
|
+
}
|
|
14
|
+
to {
|
|
15
|
+
visibility: hidden;
|
|
16
|
+
transform: translateX(100%);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
@keyframes bui-slide-right-in {
|
|
20
|
+
from {
|
|
21
|
+
transform: translateX(-100%);
|
|
22
|
+
}
|
|
23
|
+
to {
|
|
24
|
+
visibility: visible;
|
|
25
|
+
transform: none;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
@keyframes bui-slide-right-out {
|
|
29
|
+
from {
|
|
30
|
+
transform: none;
|
|
31
|
+
}
|
|
32
|
+
to {
|
|
33
|
+
visibility: hidden;
|
|
34
|
+
transform: translateX(-100%);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
@keyframes bui-slide-up-in {
|
|
38
|
+
from {
|
|
39
|
+
transform: translateY(100%);
|
|
40
|
+
}
|
|
41
|
+
to {
|
|
42
|
+
visibility: visible;
|
|
43
|
+
transform: none;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
@keyframes bui-slide-up-out {
|
|
47
|
+
from {
|
|
48
|
+
transform: none;
|
|
49
|
+
}
|
|
50
|
+
to {
|
|
51
|
+
visibility: hidden;
|
|
52
|
+
transform: translateY(100%);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
@keyframes bui-slide-down-in {
|
|
56
|
+
from {
|
|
57
|
+
transform: translateY(-100%);
|
|
58
|
+
}
|
|
59
|
+
to {
|
|
60
|
+
visibility: visible;
|
|
61
|
+
transform: none;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
@keyframes bui-slide-down-out {
|
|
65
|
+
from {
|
|
66
|
+
transform: none;
|
|
67
|
+
}
|
|
68
|
+
to {
|
|
69
|
+
visibility: hidden;
|
|
70
|
+
transform: translateY(-100%);
|
|
71
|
+
}
|
|
72
|
+
}
|
package/es/Slider/Slider.js
CHANGED
|
@@ -50,7 +50,9 @@ import { GripperBarVerticalIcon } from "@bifrostui/icons";
|
|
|
50
50
|
import {
|
|
51
51
|
isMini,
|
|
52
52
|
useForkRef,
|
|
53
|
-
|
|
53
|
+
emulateTouchStart,
|
|
54
|
+
emulateTouchMove,
|
|
55
|
+
emulateTouchEnd,
|
|
54
56
|
useValue,
|
|
55
57
|
getBoundingClientRect
|
|
56
58
|
} from "@bifrostui/utils";
|
|
@@ -110,7 +112,6 @@ const Slider = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
110
112
|
const value = shouldProtection ? latestVal.current : valueProp;
|
|
111
113
|
const [rootRef, setRootRef] = useState(null);
|
|
112
114
|
const handleRef = useForkRef(ref, setRootRef);
|
|
113
|
-
useTouchEmulator(rootRef);
|
|
114
115
|
const sliderRect = useRef();
|
|
115
116
|
const touchStartPageX = useRef();
|
|
116
117
|
const touchStartLeft = useRef();
|
|
@@ -181,9 +182,7 @@ const Slider = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
181
182
|
return;
|
|
182
183
|
beforeMoveValue.current = internalValue;
|
|
183
184
|
tooltipRef.current = internalValue;
|
|
184
|
-
|
|
185
|
-
getLineWidth();
|
|
186
|
-
}
|
|
185
|
+
getLineWidth();
|
|
187
186
|
const currentTarget = isMini ? e.mpEvent.currentTarget : e.currentTarget;
|
|
188
187
|
touchStartPageX.current = e.touches[0].pageX;
|
|
189
188
|
touchStartLeft.current = currentTarget == null ? void 0 : currentTarget.offsetLeft;
|
|
@@ -242,6 +241,16 @@ const Slider = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
242
241
|
setFrontTooltipVisible(false);
|
|
243
242
|
setEndTooltipVisible(false);
|
|
244
243
|
};
|
|
244
|
+
const onMouseUp = (e) => {
|
|
245
|
+
emulateTouchEnd(e);
|
|
246
|
+
document.removeEventListener("mousemove", emulateTouchMove);
|
|
247
|
+
document.removeEventListener("mouseup", onMouseUp);
|
|
248
|
+
};
|
|
249
|
+
const onMouseDown = (e) => {
|
|
250
|
+
emulateTouchStart(e);
|
|
251
|
+
document.addEventListener("mousemove", emulateTouchMove);
|
|
252
|
+
document.addEventListener("mouseup", onMouseUp);
|
|
253
|
+
};
|
|
245
254
|
const renderButton = (index) => {
|
|
246
255
|
const valuenow = internalValue[index];
|
|
247
256
|
return /* @__PURE__ */ React.createElement(
|
|
@@ -264,7 +273,8 @@ const Slider = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
264
273
|
},
|
|
265
274
|
onTouchMove,
|
|
266
275
|
onTouchEnd,
|
|
267
|
-
onTouchCancel: onTouchEnd
|
|
276
|
+
onTouchCancel: onTouchEnd,
|
|
277
|
+
onMouseDown
|
|
268
278
|
},
|
|
269
279
|
index === SLIDER_BUTTON.FRONT ? startIcon || defaultIcon : endIcon || defaultIcon
|
|
270
280
|
);
|
package/es/Stack/demo/index.css
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
.bui-stack-demo-options {
|
|
2
2
|
display: flex;
|
|
3
3
|
column-gap: 30px;
|
|
4
|
+
flex-wrap: wrap;
|
|
4
5
|
}
|
|
5
6
|
.bui-stack-demo-options-title {
|
|
6
7
|
font-weight: 500;
|
|
@@ -10,6 +11,7 @@
|
|
|
10
11
|
display: flex;
|
|
11
12
|
flex-direction: column;
|
|
12
13
|
row-gap: 15px;
|
|
14
|
+
flex-wrap: wrap;
|
|
13
15
|
}
|
|
14
16
|
.bui-stack-demo-options-title {
|
|
15
17
|
width: 100%;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
:root,
|
|
2
|
+
page,
|
|
3
|
+
xhs-page {
|
|
4
|
+
--bui-swipe-action-container-padding: 10px;
|
|
5
|
+
--bui-swipe-action-container-color: var(--bui-color-black);
|
|
6
|
+
}
|
|
7
|
+
.bui-swipe-action {
|
|
8
|
+
background: var(--bui-color-bg-view);
|
|
9
|
+
font-family: var(--bui-font-family);
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
touch-action: pan-x;
|
|
12
|
+
}
|
|
13
|
+
.bui-swipe-action-track {
|
|
14
|
+
position: relative;
|
|
15
|
+
transition: transform 200ms ease;
|
|
16
|
+
}
|
|
17
|
+
.bui-swipe-action-actions {
|
|
18
|
+
position: absolute;
|
|
19
|
+
top: 0;
|
|
20
|
+
display: flex;
|
|
21
|
+
width: auto;
|
|
22
|
+
white-space: nowrap;
|
|
23
|
+
}
|
|
24
|
+
.bui-swipe-action-actions-right {
|
|
25
|
+
left: 100%;
|
|
26
|
+
height: 100%;
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
margin-left: 1px;
|
|
29
|
+
user-select: none;
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
box-sizing: content-box;
|
|
33
|
+
}
|
|
34
|
+
.bui-swipe-action-actions-left {
|
|
35
|
+
margin-right: 1px;
|
|
36
|
+
right: 100%;
|
|
37
|
+
height: 100%;
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
box-sizing: content-box;
|
|
40
|
+
user-select: none;
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
}
|
|
44
|
+
.bui-swipe-action-button {
|
|
45
|
+
padding: 0 15px;
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
justify-content: center;
|
|
49
|
+
height: 100%;
|
|
50
|
+
width: 100%;
|
|
51
|
+
color: #fff;
|
|
52
|
+
box-sizing: content-box;
|
|
53
|
+
white-space: nowrap;
|
|
54
|
+
}
|
|
55
|
+
.bui-swipe-action-content-container {
|
|
56
|
+
overflow: hidden;
|
|
57
|
+
position: relative;
|
|
58
|
+
cursor: grab;
|
|
59
|
+
user-select: none;
|
|
60
|
+
padding: var(--bui-swipe-action-container-padding);
|
|
61
|
+
color: var(--bui-swipe-action-container-color);
|
|
62
|
+
}
|
|
63
|
+
.bui-swipe-action-content-container:active {
|
|
64
|
+
cursor: grabbing;
|
|
65
|
+
}
|
|
66
|
+
.bui-swipe-action-content-mask {
|
|
67
|
+
position: absolute;
|
|
68
|
+
left: 0;
|
|
69
|
+
top: 0;
|
|
70
|
+
width: 100%;
|
|
71
|
+
height: 100%;
|
|
72
|
+
}
|
|
73
|
+
.bui-swipe-action-action {
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
justify-content: center;
|
|
77
|
+
padding: 0 10px;
|
|
78
|
+
height: 100%;
|
|
79
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SwipeActionProps, SwipeActionRef } from './SwipeAction.types';
|
|
3
|
+
import './SwipeAction.less';
|
|
4
|
+
declare const SwipeAction: React.ForwardRefExoticComponent<Omit<SwipeActionProps<"div", {}>, "ref"> & React.RefAttributes<SwipeActionRef>>;
|
|
5
|
+
export default SwipeAction;
|
|
@@ -0,0 +1,334 @@
|
|
|
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
|
+
var __async = (__this, __arguments, generator) => {
|
|
30
|
+
return new Promise((resolve, reject) => {
|
|
31
|
+
var fulfilled = (value) => {
|
|
32
|
+
try {
|
|
33
|
+
step(generator.next(value));
|
|
34
|
+
} catch (e) {
|
|
35
|
+
reject(e);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var rejected = (value) => {
|
|
39
|
+
try {
|
|
40
|
+
step(generator.throw(value));
|
|
41
|
+
} catch (e) {
|
|
42
|
+
reject(e);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
46
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
import React, {
|
|
50
|
+
useImperativeHandle,
|
|
51
|
+
useRef,
|
|
52
|
+
useState,
|
|
53
|
+
useEffect,
|
|
54
|
+
useMemo
|
|
55
|
+
} from "react";
|
|
56
|
+
import clsx from "clsx";
|
|
57
|
+
import {
|
|
58
|
+
useTouch,
|
|
59
|
+
touchEmulator,
|
|
60
|
+
isMini,
|
|
61
|
+
getBoundingClientRect,
|
|
62
|
+
throttle
|
|
63
|
+
} from "@bifrostui/utils";
|
|
64
|
+
import BuiSwipeActionContext from "./SwipeActionContext";
|
|
65
|
+
import { DragPhaseEnum, SideTypeEnum } from "./constants";
|
|
66
|
+
import "./SwipeAction.css";
|
|
67
|
+
const classPrefix = "bui-swipe-action";
|
|
68
|
+
const SwipeAction = /* @__PURE__ */ React.forwardRef(
|
|
69
|
+
(props, ref) => {
|
|
70
|
+
const _a = props, {
|
|
71
|
+
className,
|
|
72
|
+
children,
|
|
73
|
+
rightActions,
|
|
74
|
+
leftActions,
|
|
75
|
+
disabled,
|
|
76
|
+
closeOnClickActionItem = true,
|
|
77
|
+
closeOnClickContainer = false,
|
|
78
|
+
onActionsReveal
|
|
79
|
+
} = _a, others = __objRest(_a, [
|
|
80
|
+
"className",
|
|
81
|
+
"children",
|
|
82
|
+
"rightActions",
|
|
83
|
+
"leftActions",
|
|
84
|
+
"disabled",
|
|
85
|
+
"closeOnClickActionItem",
|
|
86
|
+
"closeOnClickContainer",
|
|
87
|
+
"onActionsReveal"
|
|
88
|
+
]);
|
|
89
|
+
const touch = useTouch();
|
|
90
|
+
const rootRef = useRef(null);
|
|
91
|
+
const leftRef = useRef(null);
|
|
92
|
+
const rightRef = useRef(null);
|
|
93
|
+
const contentRef = useRef(null);
|
|
94
|
+
const [translateX, setTranslateX] = useState(0);
|
|
95
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
96
|
+
const startingX = useRef(0);
|
|
97
|
+
const currentX = useRef(0);
|
|
98
|
+
const isDragging = useRef(false);
|
|
99
|
+
let pretranslateX = 0;
|
|
100
|
+
let dragPhase = DragPhaseEnum.START;
|
|
101
|
+
const dragThreshold = 5;
|
|
102
|
+
const leftWidthCache = useRef(0);
|
|
103
|
+
const rightWidthCache = useRef(0);
|
|
104
|
+
const getWidth = (_ref) => {
|
|
105
|
+
if (!_ref.current)
|
|
106
|
+
return Promise.resolve(0);
|
|
107
|
+
return new Promise((resolve) => {
|
|
108
|
+
if (isMini) {
|
|
109
|
+
getBoundingClientRect(_ref.current).then((rect) => {
|
|
110
|
+
if (rect) {
|
|
111
|
+
resolve(rect.width || 0);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
} else {
|
|
115
|
+
resolve(_ref.current.offsetWidth);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
const getLefRefWidth = () => __async(void 0, null, function* () {
|
|
120
|
+
if (leftRef.current && leftActions && !leftWidthCache.current) {
|
|
121
|
+
leftWidthCache.current = yield getWidth(leftRef);
|
|
122
|
+
}
|
|
123
|
+
return leftWidthCache.current;
|
|
124
|
+
});
|
|
125
|
+
const getRightRefWidth = () => __async(void 0, null, function* () {
|
|
126
|
+
if (rightRef.current && rightActions && !rightWidthCache.current) {
|
|
127
|
+
rightWidthCache.current = yield getWidth(rightRef);
|
|
128
|
+
}
|
|
129
|
+
return rightWidthCache.current;
|
|
130
|
+
});
|
|
131
|
+
const initRefWidth = () => {
|
|
132
|
+
getLefRefWidth();
|
|
133
|
+
getRightRefWidth();
|
|
134
|
+
};
|
|
135
|
+
const handleTouchStart = (e) => {
|
|
136
|
+
dragPhase = DragPhaseEnum.START;
|
|
137
|
+
const isMaskEle = e.target.id === "content-mask";
|
|
138
|
+
if (isDragging.current || disabled || isMaskEle)
|
|
139
|
+
return;
|
|
140
|
+
touch.start(e);
|
|
141
|
+
isDragging.current = true;
|
|
142
|
+
startingX.current = touch.deltaX.current - translateX;
|
|
143
|
+
};
|
|
144
|
+
const handleTouchMove = throttle(
|
|
145
|
+
(e) => __async(void 0, null, function* () {
|
|
146
|
+
if (!isDragging.current || disabled)
|
|
147
|
+
return;
|
|
148
|
+
if (dragPhase === DragPhaseEnum.START) {
|
|
149
|
+
dragPhase = DragPhaseEnum.MOVE;
|
|
150
|
+
}
|
|
151
|
+
touch.move(e);
|
|
152
|
+
currentX.current = touch.deltaX.current - startingX.current;
|
|
153
|
+
if (Math.abs(currentX.current) < dragThreshold)
|
|
154
|
+
return;
|
|
155
|
+
const leftWidth = yield getLefRefWidth();
|
|
156
|
+
const rightWidth = yield getRightRefWidth();
|
|
157
|
+
currentX.current = Math.max(
|
|
158
|
+
-rightWidth,
|
|
159
|
+
Math.min(leftWidth, currentX.current)
|
|
160
|
+
);
|
|
161
|
+
setTranslateX(currentX.current);
|
|
162
|
+
}),
|
|
163
|
+
100
|
|
164
|
+
);
|
|
165
|
+
const emitActionsReveal = (targetX, stop = false) => {
|
|
166
|
+
const isSpecial = targetX === pretranslateX && targetX !== 0;
|
|
167
|
+
if (targetX === pretranslateX && !isSpecial || stop)
|
|
168
|
+
return;
|
|
169
|
+
let resStr = null;
|
|
170
|
+
const shouldOpen = targetX > 0 && pretranslateX <= 0 || targetX < 0 && pretranslateX >= 0 || isSpecial;
|
|
171
|
+
if (shouldOpen) {
|
|
172
|
+
if (targetX > 0) {
|
|
173
|
+
resStr = SideTypeEnum.LEFT;
|
|
174
|
+
} else if (targetX < 0) {
|
|
175
|
+
resStr = SideTypeEnum.RIGHT;
|
|
176
|
+
}
|
|
177
|
+
setIsOpen(true);
|
|
178
|
+
} else {
|
|
179
|
+
setIsOpen(false);
|
|
180
|
+
}
|
|
181
|
+
if (resStr) {
|
|
182
|
+
onActionsReveal == null ? void 0 : onActionsReveal({ side: resStr });
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
const handleTouchEnd = (e) => __async(void 0, null, function* () {
|
|
186
|
+
if (!isDragging.current)
|
|
187
|
+
return;
|
|
188
|
+
if (dragPhase === DragPhaseEnum.MOVE) {
|
|
189
|
+
dragPhase = DragPhaseEnum.END;
|
|
190
|
+
}
|
|
191
|
+
const leftWidth = yield getLefRefWidth();
|
|
192
|
+
const rightWidth = yield getRightRefWidth();
|
|
193
|
+
const threshold = 0.5;
|
|
194
|
+
let targetX = 0;
|
|
195
|
+
isDragging.current = false;
|
|
196
|
+
if (Math.abs(currentX.current) < dragThreshold)
|
|
197
|
+
return;
|
|
198
|
+
if (currentX.current > leftWidth * threshold) {
|
|
199
|
+
targetX = leftWidth;
|
|
200
|
+
} else if (currentX.current < -rightWidth * threshold) {
|
|
201
|
+
targetX = -rightWidth;
|
|
202
|
+
}
|
|
203
|
+
if (dragPhase === DragPhaseEnum.END || isMini) {
|
|
204
|
+
emitActionsReveal(targetX);
|
|
205
|
+
console.log("handleTouchEnd\uFF1A", targetX, e);
|
|
206
|
+
setTranslateX(targetX);
|
|
207
|
+
pretranslateX = targetX;
|
|
208
|
+
}
|
|
209
|
+
currentX.current = 0;
|
|
210
|
+
});
|
|
211
|
+
const close = () => {
|
|
212
|
+
setTranslateX(0);
|
|
213
|
+
pretranslateX = 0;
|
|
214
|
+
setIsOpen(false);
|
|
215
|
+
};
|
|
216
|
+
useEffect(() => {
|
|
217
|
+
initRefWidth();
|
|
218
|
+
if (!contentRef.current)
|
|
219
|
+
return;
|
|
220
|
+
const removeTouchEmulator = touchEmulator(contentRef.current);
|
|
221
|
+
return () => {
|
|
222
|
+
removeTouchEmulator();
|
|
223
|
+
};
|
|
224
|
+
}, []);
|
|
225
|
+
useEffect(() => {
|
|
226
|
+
var _a2, _b, _c, _d;
|
|
227
|
+
(_a2 = contentRef == null ? void 0 : contentRef.current) == null ? void 0 : _a2.addEventListener("touchstart", handleTouchStart);
|
|
228
|
+
(_b = contentRef == null ? void 0 : contentRef.current) == null ? void 0 : _b.addEventListener("touchmove", handleTouchMove);
|
|
229
|
+
(_c = contentRef == null ? void 0 : contentRef.current) == null ? void 0 : _c.addEventListener("touchend", handleTouchEnd);
|
|
230
|
+
(_d = contentRef == null ? void 0 : contentRef.current) == null ? void 0 : _d.addEventListener("touchcancel", handleTouchEnd);
|
|
231
|
+
if (!isMini && document) {
|
|
232
|
+
document.addEventListener("mouseup", handleTouchEnd);
|
|
233
|
+
}
|
|
234
|
+
return () => {
|
|
235
|
+
var _a3, _b2, _c2, _d2;
|
|
236
|
+
(_a3 = contentRef == null ? void 0 : contentRef.current) == null ? void 0 : _a3.removeEventListener(
|
|
237
|
+
"touchstart",
|
|
238
|
+
handleTouchStart
|
|
239
|
+
);
|
|
240
|
+
(_b2 = contentRef == null ? void 0 : contentRef.current) == null ? void 0 : _b2.removeEventListener("touchmove", handleTouchMove);
|
|
241
|
+
(_c2 = contentRef == null ? void 0 : contentRef.current) == null ? void 0 : _c2.removeEventListener("touchend", handleTouchEnd);
|
|
242
|
+
(_d2 = contentRef == null ? void 0 : contentRef.current) == null ? void 0 : _d2.removeEventListener("touchcancel", handleTouchEnd);
|
|
243
|
+
if (!isMini && document) {
|
|
244
|
+
document.removeEventListener("mouseup", handleTouchEnd);
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
}, []);
|
|
248
|
+
useImperativeHandle(ref, () => ({
|
|
249
|
+
show: (params) => __async(void 0, null, function* () {
|
|
250
|
+
let targetX = 0;
|
|
251
|
+
if (params && params.side === SideTypeEnum.RIGHT) {
|
|
252
|
+
targetX = -(yield getRightRefWidth());
|
|
253
|
+
} else {
|
|
254
|
+
targetX = yield getLefRefWidth();
|
|
255
|
+
}
|
|
256
|
+
setTranslateX(targetX);
|
|
257
|
+
pretranslateX = targetX;
|
|
258
|
+
emitActionsReveal(targetX);
|
|
259
|
+
}),
|
|
260
|
+
close,
|
|
261
|
+
// 获取当前是否打开
|
|
262
|
+
open: isOpen,
|
|
263
|
+
ref: rootRef.current
|
|
264
|
+
}));
|
|
265
|
+
const outClickHandle = (e) => {
|
|
266
|
+
e.preventDefault();
|
|
267
|
+
e.stopPropagation();
|
|
268
|
+
if (translateX !== 0 && closeOnClickContainer) {
|
|
269
|
+
close();
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
const SwipeActionContext = useMemo(
|
|
273
|
+
() => ({ closeOnClickActionItem, close }),
|
|
274
|
+
[closeOnClickActionItem]
|
|
275
|
+
);
|
|
276
|
+
return /* @__PURE__ */ React.createElement(BuiSwipeActionContext.Provider, { value: SwipeActionContext }, /* @__PURE__ */ React.createElement(
|
|
277
|
+
"div",
|
|
278
|
+
__spreadValues({
|
|
279
|
+
className: clsx(`${classPrefix}`, className),
|
|
280
|
+
ref: rootRef
|
|
281
|
+
}, others),
|
|
282
|
+
/* @__PURE__ */ React.createElement(
|
|
283
|
+
"div",
|
|
284
|
+
{
|
|
285
|
+
className: `${classPrefix}-track`,
|
|
286
|
+
style: {
|
|
287
|
+
transform: `translate3d(${translateX}px, 0, 0)`
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
/* @__PURE__ */ React.createElement(
|
|
291
|
+
"div",
|
|
292
|
+
{
|
|
293
|
+
className: `${classPrefix}-actions ${classPrefix}-actions-left`,
|
|
294
|
+
ref: leftRef
|
|
295
|
+
},
|
|
296
|
+
leftActions
|
|
297
|
+
),
|
|
298
|
+
/* @__PURE__ */ React.createElement(
|
|
299
|
+
"div",
|
|
300
|
+
{
|
|
301
|
+
className: `${classPrefix}-content-container`,
|
|
302
|
+
ref: contentRef,
|
|
303
|
+
onTouchStart: handleTouchStart,
|
|
304
|
+
onTouchMove: handleTouchMove,
|
|
305
|
+
onTouchEnd: handleTouchEnd,
|
|
306
|
+
onTouchCancel: handleTouchEnd
|
|
307
|
+
},
|
|
308
|
+
isOpen && closeOnClickContainer && /* @__PURE__ */ React.createElement(
|
|
309
|
+
"div",
|
|
310
|
+
{
|
|
311
|
+
className: `${classPrefix}-content-mask`,
|
|
312
|
+
id: "content-mask",
|
|
313
|
+
onClick: outClickHandle
|
|
314
|
+
}
|
|
315
|
+
),
|
|
316
|
+
children
|
|
317
|
+
),
|
|
318
|
+
/* @__PURE__ */ React.createElement(
|
|
319
|
+
"div",
|
|
320
|
+
{
|
|
321
|
+
className: `${classPrefix}-actions ${classPrefix}-actions-right`,
|
|
322
|
+
ref: rightRef
|
|
323
|
+
},
|
|
324
|
+
rightActions
|
|
325
|
+
)
|
|
326
|
+
)
|
|
327
|
+
));
|
|
328
|
+
}
|
|
329
|
+
);
|
|
330
|
+
SwipeAction.displayName = "BuiSwipeAction";
|
|
331
|
+
var SwipeAction_default = SwipeAction;
|
|
332
|
+
export {
|
|
333
|
+
SwipeAction_default as default
|
|
334
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { OverrideProps, ThemeColor } from '@bifrostui/types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { SideTypeEnum } from './constants';
|
|
4
|
+
export type SwipeActionProps<D extends React.ElementType = 'div', P = {}> = OverrideProps<{
|
|
5
|
+
props: P & {
|
|
6
|
+
/**
|
|
7
|
+
* 右侧的操作按钮列表区域
|
|
8
|
+
*/
|
|
9
|
+
rightActions?: React.ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* 左侧的操作按钮列表区域
|
|
12
|
+
*/
|
|
13
|
+
leftActions?: React.ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* 是否在点击按钮区自动归位
|
|
16
|
+
*/
|
|
17
|
+
closeOnClickActionItem?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* 是否在点击其他区域时自动归位
|
|
20
|
+
*/
|
|
21
|
+
closeOnClickContainer?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* 操作按钮展开时触发
|
|
24
|
+
*/
|
|
25
|
+
onActionsReveal?: (params: RevealParams) => void;
|
|
26
|
+
/**
|
|
27
|
+
* 是否禁用拖动
|
|
28
|
+
*/
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
};
|
|
31
|
+
defaultComponent: D;
|
|
32
|
+
}, D>;
|
|
33
|
+
interface RevealParams {
|
|
34
|
+
side: SideTypeEnum | '';
|
|
35
|
+
}
|
|
36
|
+
export type SwipeActionItemProps<D extends React.ElementType = 'div', P = {}> = OverrideProps<{
|
|
37
|
+
props: P & {
|
|
38
|
+
/**
|
|
39
|
+
* 颜色风格
|
|
40
|
+
*/
|
|
41
|
+
color?: ThemeColor | 'vip';
|
|
42
|
+
/**
|
|
43
|
+
* id
|
|
44
|
+
*/
|
|
45
|
+
id?: string | number;
|
|
46
|
+
/**
|
|
47
|
+
* 点击事件
|
|
48
|
+
*/
|
|
49
|
+
onClick?: (e: React.SyntheticEvent, item: {
|
|
50
|
+
id: string | number;
|
|
51
|
+
color: ThemeColor | 'vip';
|
|
52
|
+
text: React.ReactNode;
|
|
53
|
+
}) => void;
|
|
54
|
+
};
|
|
55
|
+
defaultComponent: D;
|
|
56
|
+
}, D>;
|
|
57
|
+
export interface BuiSwipeActionContextProps {
|
|
58
|
+
/**
|
|
59
|
+
* 是否在点击操作按钮时自动归位
|
|
60
|
+
*/
|
|
61
|
+
closeOnClickActionItem?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* 关闭函数
|
|
64
|
+
*/
|
|
65
|
+
close: () => void;
|
|
66
|
+
}
|
|
67
|
+
export type SwipeActionRef = {
|
|
68
|
+
close: () => void;
|
|
69
|
+
show: (params?: {
|
|
70
|
+
side: SideTypeEnum;
|
|
71
|
+
}) => void;
|
|
72
|
+
open: boolean;
|
|
73
|
+
ref?: HTMLDivElement;
|
|
74
|
+
};
|
|
75
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createContext } from "react";
|
|
2
|
+
const BuiSwipeActionContext = createContext({
|
|
3
|
+
closeOnClickActionItem: true,
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
5
|
+
close: () => {
|
|
6
|
+
}
|
|
7
|
+
});
|
|
8
|
+
var SwipeActionContext_default = BuiSwipeActionContext;
|
|
9
|
+
export {
|
|
10
|
+
SwipeActionContext_default as default
|
|
11
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
.bui-swipe-action-item {
|
|
2
|
+
padding: 0 15px;
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
height: 100%;
|
|
7
|
+
width: 100%;
|
|
8
|
+
background: var(--background-button-color);
|
|
9
|
+
color: #fff;
|
|
10
|
+
box-sizing: content-box;
|
|
11
|
+
white-space: nowrap;
|
|
12
|
+
font-family: var(--bui-font-family);
|
|
13
|
+
}
|
|
14
|
+
.bui-swipe-action-item-primary {
|
|
15
|
+
background-color: var(--bui-color-primary);
|
|
16
|
+
}
|
|
17
|
+
.bui-swipe-action-item-vip {
|
|
18
|
+
background-color: var(--bui-color-vip);
|
|
19
|
+
}
|
|
20
|
+
.bui-swipe-action-item-success {
|
|
21
|
+
background-color: var(--bui-color-success);
|
|
22
|
+
}
|
|
23
|
+
.bui-swipe-action-item-info {
|
|
24
|
+
background-color: var(--bui-color-info);
|
|
25
|
+
}
|
|
26
|
+
.bui-swipe-action-item-warning {
|
|
27
|
+
background-color: var(--bui-color-warning);
|
|
28
|
+
}
|
|
29
|
+
.bui-swipe-action-item-danger {
|
|
30
|
+
background-color: var(--bui-color-danger);
|
|
31
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SwipeActionItemProps } from './SwipeAction.types';
|
|
3
|
+
import './SwipeActionItem.less';
|
|
4
|
+
declare const SwipeActionItem: React.ForwardRefExoticComponent<Omit<SwipeActionItemProps<"div", {}>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
export default SwipeActionItem;
|