@bifrostui/react 2.0.0-alpha.0 → 2.0.0-alpha.2
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 +2 -2
- 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 +197 -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 +7 -4
- 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 +27 -202
- 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 +210 -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 +2 -2
- 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 +176 -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 +1 -1
- 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 +8 -5
- 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 +27 -202
- 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 +189 -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
|
@@ -1,195 +1,73 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { OverrideProps } from '@bifrostui/types';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* 滚动事件详情
|
|
5
|
+
*/
|
|
6
|
+
export interface ScrollViewScrollEvent extends Event {
|
|
4
7
|
detail?: {
|
|
5
8
|
scrollLeft: number;
|
|
6
9
|
scrollTop: number;
|
|
7
10
|
scrollHeight: number;
|
|
8
11
|
scrollWidth: number;
|
|
9
|
-
deltaX?: number;
|
|
10
|
-
deltaY?: number;
|
|
11
|
-
isDrag?: boolean;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
interface ScrollViewDragEvent extends Event {
|
|
15
|
-
detail?: {
|
|
16
|
-
/** 横向滚动条位置 */
|
|
17
|
-
scrollLeft?: number;
|
|
18
|
-
/** 竖向滚动条位置 */
|
|
19
|
-
scrollTop?: number;
|
|
20
|
-
/** 滚动速度 */
|
|
21
|
-
velocity?: number;
|
|
22
12
|
};
|
|
23
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* ScrollIntoView 对齐方式
|
|
16
|
+
*/
|
|
17
|
+
export type ScrollIntoViewAlignment = 'start' | 'center' | 'end' | 'nearest';
|
|
18
|
+
/**
|
|
19
|
+
* ScrollView 组件属性
|
|
20
|
+
*/
|
|
24
21
|
export type ScrollViewProps<D extends React.ElementType = 'div', P = {}> = OverrideProps<{
|
|
25
22
|
props: P & {
|
|
26
23
|
/**
|
|
27
24
|
* 允许横向滚动
|
|
28
25
|
* @default false
|
|
29
|
-
* @type {boolean}
|
|
30
26
|
*/
|
|
31
27
|
scrollX?: boolean;
|
|
32
28
|
/**
|
|
33
29
|
* 允许纵向滚动
|
|
34
30
|
* @default false
|
|
35
|
-
* @type {boolean}
|
|
36
31
|
*/
|
|
37
32
|
scrollY?: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* 距顶部/左边多远时(单位px),触发 scrolltoupper 事件
|
|
40
|
-
* @default 50
|
|
41
|
-
* @type {number}
|
|
42
|
-
*/
|
|
43
|
-
upperThreshold?: number;
|
|
44
|
-
/**
|
|
45
|
-
* 距底部/右边多远时(单位px),触发 scrolltolower 事件
|
|
46
|
-
* @default 50
|
|
47
|
-
* @type {number}
|
|
48
|
-
*/
|
|
49
|
-
lowerThreshold?: number;
|
|
50
33
|
/**
|
|
51
34
|
* 设置竖向滚动条位置
|
|
52
|
-
* @type {number}
|
|
53
35
|
*/
|
|
54
36
|
scrollTop?: number;
|
|
55
37
|
/**
|
|
56
38
|
* 设置横向滚动条位置
|
|
57
|
-
* @type {number}
|
|
58
39
|
*/
|
|
59
40
|
scrollLeft?: number;
|
|
60
41
|
/**
|
|
61
|
-
*
|
|
62
|
-
* @type {string}
|
|
42
|
+
* 滚动到指定元素(元素id,不能以数字开头)
|
|
63
43
|
*/
|
|
64
44
|
scrollIntoView?: string;
|
|
65
45
|
/**
|
|
66
|
-
*
|
|
67
|
-
* @default false
|
|
68
|
-
* @type {boolean}
|
|
69
|
-
*/
|
|
70
|
-
scrollWithAnimation?: boolean;
|
|
71
|
-
/** 指定 scroll-into-view 目标节点在视口内的位置。
|
|
72
|
-
* start - 目标节点显示在视口开始处
|
|
73
|
-
* center - 目标节点显示在视口中间
|
|
74
|
-
* end - 目标节点显示在视口结束处
|
|
75
|
-
* nearest - 目标节点在就近的视口边缘显示,若节点已在视口内则不触发滚动
|
|
46
|
+
* 指定 scroll-into-view 目标节点在视口内的位置
|
|
76
47
|
* @default 'start'
|
|
77
48
|
*/
|
|
78
|
-
scrollIntoViewAlignment?:
|
|
49
|
+
scrollIntoViewAlignment?: ScrollIntoViewAlignment;
|
|
79
50
|
/**
|
|
80
|
-
*
|
|
81
|
-
* @default false
|
|
82
|
-
* @type {boolean}
|
|
83
|
-
*/
|
|
84
|
-
enableBackToTop?: boolean;
|
|
85
|
-
/** 启用 flexbox 布局。开启后,当前节点声明了 `display: flex` 就会成为 flex container,并作用于其孩子节点。
|
|
86
|
-
* 仅小程序可用
|
|
87
|
-
* @default false
|
|
88
|
-
*/
|
|
89
|
-
enableFlex?: boolean;
|
|
90
|
-
/** 开启 scroll anchoring 特性,即控制滚动位置不随内容变化而抖动,仅在 iOS 下生效,安卓下可参考 CSS `overflow-anchor` 属性。
|
|
91
|
-
* 仅小程序可用
|
|
92
|
-
* @default false
|
|
93
|
-
*/
|
|
94
|
-
scrollAnchoring?: boolean;
|
|
95
|
-
/** 开启自定义下拉刷新
|
|
96
|
-
* 仅小程序可用
|
|
97
|
-
* @default false
|
|
98
|
-
*/
|
|
99
|
-
refresherEnabled?: boolean;
|
|
100
|
-
/** 设置自定义下拉刷新默认样式,支持设置 `black | white | none`, none 表示不使用默认样式
|
|
101
|
-
* 仅小程序可用
|
|
102
|
-
* @default 'black'
|
|
103
|
-
*/
|
|
104
|
-
refresherDefaultStyle?: string;
|
|
105
|
-
/** 设置自定义下拉刷新区域背景颜色
|
|
106
|
-
* 仅小程序可用
|
|
107
|
-
* @default '#FFF'
|
|
108
|
-
*/
|
|
109
|
-
refresherBackground?: string;
|
|
110
|
-
/** 设置当前下拉刷新状态,true 表示下拉刷新已经被触发,false 表示下拉刷新未被触发
|
|
111
|
-
* 仅小程序可用
|
|
112
|
-
* @default false
|
|
113
|
-
*/
|
|
114
|
-
refresherTriggered?: boolean;
|
|
115
|
-
/** 启用 scroll-view 增强特性
|
|
116
|
-
* 仅小程序可用
|
|
117
|
-
* @default false
|
|
118
|
-
*/
|
|
119
|
-
enhanced?: boolean;
|
|
120
|
-
/** iOS 下 scroll-view 边界弹性控制 (同时开启 enhanced 属性后生效)
|
|
121
|
-
* 仅小程序可用
|
|
122
|
-
* @default true
|
|
123
|
-
*/
|
|
124
|
-
bounces?: boolean;
|
|
125
|
-
/** 滚动条显隐控制 (同时开启 enhanced 属性后生效)
|
|
126
|
-
* 仅小程序可用
|
|
127
|
-
* @default true
|
|
128
|
-
*/
|
|
129
|
-
showScrollbar?: boolean;
|
|
130
|
-
/** 分页滑动效果 (同时开启 enhanced 属性后生效)
|
|
131
|
-
* 仅小程序可用
|
|
132
|
-
* @default false
|
|
133
|
-
*/
|
|
134
|
-
pagingEnabled?: boolean;
|
|
135
|
-
/** boolean false 滑动减速速率控制 (同时开启 enhanced 属性后生效)
|
|
136
|
-
* 仅小程序可用
|
|
137
|
-
* @default false
|
|
138
|
-
*/
|
|
139
|
-
fastDeceleration?: boolean;
|
|
140
|
-
/** 当 scroll-with-animation设置为 true 时,可以设置 scroll-animation-duration 来控制动画的执行时间,单位 ms。
|
|
141
|
-
* 仅小程序可用
|
|
142
|
-
*/
|
|
143
|
-
scrollAnimationDuration?: number;
|
|
144
|
-
/** 纵向滚动时,当滚动到顶部或底部时,强制禁止触发页面滚动,仍然只触发 scroll-view 自身的滚动。
|
|
145
|
-
* 仅小程序可用
|
|
146
|
-
* @default false
|
|
147
|
-
*/
|
|
148
|
-
trapScroll?: string;
|
|
149
|
-
/** 发生滚动前,对滚动方向进行判断,当方向是顶部/左边时,如果值为always将始终禁止滚动,如果值为out-of-bounds 且当前已经滚动到顶部/左边,禁止滚动。
|
|
150
|
-
* 仅小程序可用
|
|
151
|
-
*/
|
|
152
|
-
disableLowerScroll?: string;
|
|
153
|
-
/** 发生滚动前,对滚动方向进行判断,当方向是底部/右边时,如果值为always将始终禁止滚动,如果值为out-of-bounds 且当前已经滚动到底部/右边,禁止滚动。
|
|
154
|
-
* 仅小程序可用
|
|
155
|
-
*/
|
|
156
|
-
disableUpperScroll?: string;
|
|
157
|
-
/** 无障碍访问,(属性)元素的额外描述
|
|
158
|
-
* 仅小程序可用
|
|
159
|
-
*/
|
|
160
|
-
ariaLabel?: string;
|
|
161
|
-
/** 开启 passive 特性,能优化一定的滚动性能
|
|
162
|
-
* 仅小程序可用
|
|
163
|
-
* @default false
|
|
164
|
-
*/
|
|
165
|
-
enablePassive?: string;
|
|
166
|
-
/** 渲染模式
|
|
167
|
-
* list - 列表模式。只会渲染在屏节点,会根据直接子节点是否在屏来按需渲染,若只有一个直接子节点则性能会退化
|
|
168
|
-
* custom - 自定义模式。只会渲染在屏节点,子节点可以是 sticky-section list-view grid-view 等组件
|
|
169
|
-
* 仅小程序可用
|
|
170
|
-
* @default 'list'
|
|
171
|
-
*/
|
|
172
|
-
type?: 'list' | 'custom';
|
|
173
|
-
/** 是否反向滚动。一般初始滚动位置是在顶部,反向滚动则是在底部。
|
|
174
|
-
* 仅小程序可用
|
|
51
|
+
* 在设置滚动条位置时使用动画过渡
|
|
175
52
|
* @default false
|
|
176
53
|
*/
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
*
|
|
54
|
+
scrollWithAnimation?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* 距顶部/左边多远时(单位px),触发 onScrollToUpper 事件
|
|
57
|
+
* @default 50
|
|
180
58
|
*/
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
*
|
|
184
|
-
* @default
|
|
59
|
+
upperThreshold?: number;
|
|
60
|
+
/**
|
|
61
|
+
* 距底部/右边多远时(单位px),触发 onScrollToLower 事件
|
|
62
|
+
* @default 50
|
|
185
63
|
*/
|
|
186
|
-
|
|
64
|
+
lowerThreshold?: number;
|
|
187
65
|
/**
|
|
188
|
-
*
|
|
66
|
+
* 滚动到顶部/左边时触发
|
|
189
67
|
*/
|
|
190
68
|
onScrollToUpper?: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void;
|
|
191
69
|
/**
|
|
192
|
-
*
|
|
70
|
+
* 滚动到底部/右边时触发
|
|
193
71
|
*/
|
|
194
72
|
onScrollToLower?: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void;
|
|
195
73
|
/**
|
|
@@ -197,62 +75,9 @@ export type ScrollViewProps<D extends React.ElementType = 'div', P = {}> = Overr
|
|
|
197
75
|
*/
|
|
198
76
|
onScroll?: (e: React.SyntheticEvent<HTMLDivElement, ScrollViewScrollEvent>) => void;
|
|
199
77
|
/**
|
|
200
|
-
*
|
|
78
|
+
* 触摸移动时触发
|
|
201
79
|
*/
|
|
202
80
|
onTouchMove?: (e: React.SyntheticEvent<HTMLDivElement, TouchEvent>) => void;
|
|
203
|
-
/** 滚动开始事件
|
|
204
|
-
* 仅小程序可用
|
|
205
|
-
*/
|
|
206
|
-
onScrollStart?: (e: React.SyntheticEvent<HTMLDivElement, ScrollViewScrollEvent>) => void;
|
|
207
|
-
/** 滚动结束事件
|
|
208
|
-
* 仅小程序可用
|
|
209
|
-
*/
|
|
210
|
-
onScrollEnd?: (e: React.SyntheticEvent<HTMLDivElement, ScrollViewScrollEvent>) => void;
|
|
211
|
-
/** 自定义下拉刷新控件被下拉
|
|
212
|
-
* 仅小程序可用
|
|
213
|
-
*/
|
|
214
|
-
onRefresherPulling?: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void;
|
|
215
|
-
/** 自定义下拉刷新被触发
|
|
216
|
-
* 仅小程序可用
|
|
217
|
-
*/
|
|
218
|
-
onRefresherRefresh?: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void;
|
|
219
|
-
/** 自定义下拉刷新被复位
|
|
220
|
-
* 仅小程序可用
|
|
221
|
-
*/
|
|
222
|
-
onRefresherRestore?: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void;
|
|
223
|
-
/** 自定义下拉刷新被中止
|
|
224
|
-
* 仅小程序可用
|
|
225
|
-
*/
|
|
226
|
-
onRefresherAbort?: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void;
|
|
227
|
-
/** 自定义下拉刷新即将触发刷新(拖动超过 refresher-threshold 时)的事件
|
|
228
|
-
* 仅小程序可用
|
|
229
|
-
*/
|
|
230
|
-
onRefresherWillRefresh?: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void;
|
|
231
|
-
/** 滑动开始事件 (同时开启 enhanced 属性后生效)
|
|
232
|
-
* 仅小程序可用
|
|
233
|
-
*/
|
|
234
|
-
onDragStart?: (e: React.SyntheticEvent<HTMLDivElement, ScrollViewDragEvent>) => void;
|
|
235
|
-
/** 滑动事件 (同时开启 enhanced 属性后生效)
|
|
236
|
-
* 仅小程序可用
|
|
237
|
-
*/
|
|
238
|
-
onDragging?: (e: React.SyntheticEvent<HTMLDivElement, ScrollViewDragEvent>) => void;
|
|
239
|
-
/** 滑动结束事件 (同时开启 enhanced 属性后生效)
|
|
240
|
-
* 仅小程序可用
|
|
241
|
-
*/
|
|
242
|
-
onDragEnd?: (e: React.SyntheticEvent<HTMLDivElement, ScrollViewDragEvent>) => void;
|
|
243
|
-
/** 触摸动作开始。
|
|
244
|
-
* 仅小程序可用
|
|
245
|
-
*/
|
|
246
|
-
onTouchStart?: (e: React.SyntheticEvent<HTMLDivElement, TouchEvent>) => void;
|
|
247
|
-
/** 触摸动作结束。
|
|
248
|
-
* 仅小程序可用
|
|
249
|
-
*/
|
|
250
|
-
onTouchEnd?: (e: React.SyntheticEvent<HTMLDivElement, TouchEvent>) => void;
|
|
251
|
-
/** 触摸动作被打断,如来电提醒、弹窗。
|
|
252
|
-
* 仅小程序可用
|
|
253
|
-
*/
|
|
254
|
-
onTouchCancel?: (e: React.SyntheticEvent<HTMLDivElement, TouchEvent>) => void;
|
|
255
81
|
};
|
|
256
82
|
defaultComponent: D;
|
|
257
83
|
}, D>;
|
|
258
|
-
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const BasicScrollViewDemo: React.FC;
|
|
3
|
+
export declare const HorizontalScrollViewDemo: React.FC;
|
|
4
|
+
export declare const ScrollEventsDemo: React.FC;
|
|
5
|
+
export declare const ControlledScrollDemo: React.FC;
|
|
6
|
+
export declare const BidirectionalScrollDemo: React.FC;
|
|
7
|
+
export declare const ThresholdTestDemo: React.FC;
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import React from "react";
|
|
21
|
+
import ScrollView from "../../ScrollView";
|
|
22
|
+
const BasicScrollViewDemo = () => {
|
|
23
|
+
return /* @__PURE__ */ React.createElement(ScrollView, { scrollY: true, style: { height: "300px", width: "100%" } }, Array.from({ length: 50 }, (_, index) => /* @__PURE__ */ React.createElement(
|
|
24
|
+
"div",
|
|
25
|
+
{
|
|
26
|
+
key: index,
|
|
27
|
+
style: { padding: "10px", borderBottom: "1px solid #eee" }
|
|
28
|
+
},
|
|
29
|
+
"Item ",
|
|
30
|
+
index + 1
|
|
31
|
+
)));
|
|
32
|
+
};
|
|
33
|
+
const HorizontalScrollViewDemo = () => {
|
|
34
|
+
return /* @__PURE__ */ React.createElement(ScrollView, { scrollX: true, style: { width: "300px" } }, /* @__PURE__ */ React.createElement("div", { style: { display: "flex", width: "max-content" } }, Array.from({ length: 20 }, (_, index) => /* @__PURE__ */ React.createElement(
|
|
35
|
+
"div",
|
|
36
|
+
{
|
|
37
|
+
key: index,
|
|
38
|
+
style: {
|
|
39
|
+
minWidth: "100px",
|
|
40
|
+
height: "80px",
|
|
41
|
+
margin: "0 5px",
|
|
42
|
+
padding: "10px",
|
|
43
|
+
backgroundColor: "#f0f0f0",
|
|
44
|
+
display: "flex",
|
|
45
|
+
alignItems: "center",
|
|
46
|
+
justifyContent: "center"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"Item ",
|
|
50
|
+
index + 1
|
|
51
|
+
))));
|
|
52
|
+
};
|
|
53
|
+
const ScrollEventsDemo = () => {
|
|
54
|
+
const [scrollInfo, setScrollInfo] = React.useState({
|
|
55
|
+
scrollTop: 0,
|
|
56
|
+
atTop: false,
|
|
57
|
+
atBottom: false
|
|
58
|
+
});
|
|
59
|
+
const handleScroll = (e) => {
|
|
60
|
+
var _a;
|
|
61
|
+
const event = e;
|
|
62
|
+
const scrollTop = ((_a = event.detail) == null ? void 0 : _a.scrollTop) || 0;
|
|
63
|
+
setScrollInfo((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
64
|
+
scrollTop
|
|
65
|
+
}));
|
|
66
|
+
};
|
|
67
|
+
const handleScrollToUpper = () => {
|
|
68
|
+
setScrollInfo((prev) => __spreadProps(__spreadValues({}, prev), { atTop: true, atBottom: false }));
|
|
69
|
+
};
|
|
70
|
+
const handleScrollToLower = () => {
|
|
71
|
+
setScrollInfo((prev) => __spreadProps(__spreadValues({}, prev), { atTop: false, atBottom: true }));
|
|
72
|
+
};
|
|
73
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
|
|
74
|
+
"div",
|
|
75
|
+
{
|
|
76
|
+
"data-testid": "scroll-info",
|
|
77
|
+
style: {
|
|
78
|
+
marginBottom: "10px",
|
|
79
|
+
padding: "10px",
|
|
80
|
+
backgroundColor: "#f9f9f9"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
/* @__PURE__ */ React.createElement("p", null, "Scroll Top: ", scrollInfo.scrollTop),
|
|
84
|
+
/* @__PURE__ */ React.createElement("p", null, "At Top: ", scrollInfo.atTop ? "Yes" : "No"),
|
|
85
|
+
/* @__PURE__ */ React.createElement("p", null, "At Bottom: ", scrollInfo.atBottom ? "Yes" : "No")
|
|
86
|
+
), /* @__PURE__ */ React.createElement(
|
|
87
|
+
ScrollView,
|
|
88
|
+
{
|
|
89
|
+
scrollY: true,
|
|
90
|
+
style: { height: "200px", width: "100%" },
|
|
91
|
+
onScroll: handleScroll,
|
|
92
|
+
onScrollToUpper: handleScrollToUpper,
|
|
93
|
+
onScrollToLower: handleScrollToLower,
|
|
94
|
+
upperThreshold: 30,
|
|
95
|
+
lowerThreshold: 30
|
|
96
|
+
},
|
|
97
|
+
Array.from({ length: 30 }, (_, index) => /* @__PURE__ */ React.createElement(
|
|
98
|
+
"div",
|
|
99
|
+
{
|
|
100
|
+
key: index,
|
|
101
|
+
style: { padding: "15px", borderBottom: "1px solid #ddd" }
|
|
102
|
+
},
|
|
103
|
+
"Scroll Item ",
|
|
104
|
+
index + 1
|
|
105
|
+
))
|
|
106
|
+
));
|
|
107
|
+
};
|
|
108
|
+
const ControlledScrollDemo = () => {
|
|
109
|
+
const [scrollTop, setScrollTop] = React.useState(0);
|
|
110
|
+
const [scrollIntoView, setScrollIntoView] = React.useState("");
|
|
111
|
+
const scrollToPosition = (position) => {
|
|
112
|
+
setScrollIntoView("");
|
|
113
|
+
setScrollTop(position);
|
|
114
|
+
};
|
|
115
|
+
const scrollToElement = (elementId) => {
|
|
116
|
+
setScrollTop(0);
|
|
117
|
+
setScrollIntoView(elementId);
|
|
118
|
+
};
|
|
119
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
|
|
120
|
+
"div",
|
|
121
|
+
{
|
|
122
|
+
style: {
|
|
123
|
+
marginBottom: "10px",
|
|
124
|
+
padding: "10px",
|
|
125
|
+
backgroundColor: "#f5f5f5"
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
/* @__PURE__ */ React.createElement(
|
|
129
|
+
"button",
|
|
130
|
+
{
|
|
131
|
+
type: "button",
|
|
132
|
+
onClick: () => scrollToPosition(0),
|
|
133
|
+
style: { marginRight: "5px" }
|
|
134
|
+
},
|
|
135
|
+
"Top"
|
|
136
|
+
),
|
|
137
|
+
/* @__PURE__ */ React.createElement(
|
|
138
|
+
"button",
|
|
139
|
+
{
|
|
140
|
+
type: "button",
|
|
141
|
+
onClick: () => scrollToPosition(200),
|
|
142
|
+
style: { marginRight: "5px" }
|
|
143
|
+
},
|
|
144
|
+
"200px"
|
|
145
|
+
),
|
|
146
|
+
/* @__PURE__ */ React.createElement(
|
|
147
|
+
"button",
|
|
148
|
+
{
|
|
149
|
+
type: "button",
|
|
150
|
+
onClick: () => scrollToElement("item-10"),
|
|
151
|
+
style: { marginRight: "5px" }
|
|
152
|
+
},
|
|
153
|
+
"Item 10"
|
|
154
|
+
),
|
|
155
|
+
/* @__PURE__ */ React.createElement("button", { type: "button", onClick: () => scrollToElement("item-20") }, "Item 20")
|
|
156
|
+
), /* @__PURE__ */ React.createElement(
|
|
157
|
+
ScrollView,
|
|
158
|
+
{
|
|
159
|
+
scrollY: true,
|
|
160
|
+
style: { height: "250px", width: "100%" },
|
|
161
|
+
scrollTop,
|
|
162
|
+
scrollIntoView,
|
|
163
|
+
scrollWithAnimation: true
|
|
164
|
+
},
|
|
165
|
+
Array.from({ length: 30 }, (_, index) => /* @__PURE__ */ React.createElement(
|
|
166
|
+
"div",
|
|
167
|
+
{
|
|
168
|
+
key: index,
|
|
169
|
+
id: `item-${index + 1}`,
|
|
170
|
+
style: {
|
|
171
|
+
padding: "20px",
|
|
172
|
+
borderBottom: "1px solid #ccc",
|
|
173
|
+
backgroundColor: (index + 1) % 10 === 0 ? "#e6f3ff" : "white"
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
"Item ",
|
|
177
|
+
index + 1,
|
|
178
|
+
" ",
|
|
179
|
+
(index + 1) % 10 === 0 && "(Highlighted)"
|
|
180
|
+
))
|
|
181
|
+
));
|
|
182
|
+
};
|
|
183
|
+
const BidirectionalScrollDemo = () => {
|
|
184
|
+
return /* @__PURE__ */ React.createElement(
|
|
185
|
+
ScrollView,
|
|
186
|
+
{
|
|
187
|
+
scrollX: true,
|
|
188
|
+
scrollY: true,
|
|
189
|
+
style: {
|
|
190
|
+
width: "300px",
|
|
191
|
+
height: "200px",
|
|
192
|
+
border: "1px solid #ddd",
|
|
193
|
+
borderRadius: "4px"
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
/* @__PURE__ */ React.createElement(
|
|
197
|
+
"div",
|
|
198
|
+
{
|
|
199
|
+
style: {
|
|
200
|
+
width: "600px",
|
|
201
|
+
height: "400px",
|
|
202
|
+
backgroundImage: "linear-gradient(45deg, #f0f0f0 25%, transparent 25%), linear-gradient(-45deg, #f0f0f0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #f0f0f0 75%), linear-gradient(-45deg, transparent 75%, #f0f0f0 75%)",
|
|
203
|
+
backgroundSize: "20px 20px",
|
|
204
|
+
backgroundPosition: "0 0, 0 10px, 10px -10px, -10px 0px",
|
|
205
|
+
position: "relative"
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
/* @__PURE__ */ React.createElement(
|
|
209
|
+
"div",
|
|
210
|
+
{
|
|
211
|
+
style: {
|
|
212
|
+
position: "absolute",
|
|
213
|
+
top: "50%",
|
|
214
|
+
left: "50%",
|
|
215
|
+
transform: "translate(-50%, -50%)",
|
|
216
|
+
padding: "20px",
|
|
217
|
+
backgroundColor: "white",
|
|
218
|
+
border: "2px solid #007acc",
|
|
219
|
+
borderRadius: "8px",
|
|
220
|
+
boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
/* @__PURE__ */ React.createElement("h3", { style: { margin: "0 0 10px 0", color: "#007acc" } }, "Scroll in both directions!"),
|
|
224
|
+
/* @__PURE__ */ React.createElement("p", { style: { margin: 0, color: "#666" } }, "This content area is larger than the viewport")
|
|
225
|
+
)
|
|
226
|
+
)
|
|
227
|
+
);
|
|
228
|
+
};
|
|
229
|
+
const ThresholdTestDemo = () => {
|
|
230
|
+
const [thresholdEvents, setThresholdEvents] = React.useState([]);
|
|
231
|
+
const addEvent = (event) => {
|
|
232
|
+
setThresholdEvents((prev) => [
|
|
233
|
+
...prev.slice(-4),
|
|
234
|
+
`${(/* @__PURE__ */ new Date()).toLocaleTimeString()}: ${event}`
|
|
235
|
+
]);
|
|
236
|
+
};
|
|
237
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
|
|
238
|
+
"div",
|
|
239
|
+
{
|
|
240
|
+
"data-testid": "threshold-events",
|
|
241
|
+
style: {
|
|
242
|
+
marginBottom: "10px",
|
|
243
|
+
padding: "10px",
|
|
244
|
+
backgroundColor: "#f0f8ff",
|
|
245
|
+
minHeight: "80px"
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
/* @__PURE__ */ React.createElement("strong", null, "Threshold Events:"),
|
|
249
|
+
thresholdEvents.map((event, index) => /* @__PURE__ */ React.createElement("div", { key: index, style: { fontSize: "12px", color: "#666" } }, event))
|
|
250
|
+
), /* @__PURE__ */ React.createElement(
|
|
251
|
+
ScrollView,
|
|
252
|
+
{
|
|
253
|
+
scrollY: true,
|
|
254
|
+
style: { height: "150px", width: "100%" },
|
|
255
|
+
upperThreshold: 20,
|
|
256
|
+
lowerThreshold: 20,
|
|
257
|
+
onScrollToUpper: () => addEvent("Reached upper threshold (20px)"),
|
|
258
|
+
onScrollToLower: () => addEvent("Reached lower threshold (20px)")
|
|
259
|
+
},
|
|
260
|
+
Array.from({ length: 20 }, (_, index) => /* @__PURE__ */ React.createElement(
|
|
261
|
+
"div",
|
|
262
|
+
{
|
|
263
|
+
key: index,
|
|
264
|
+
style: {
|
|
265
|
+
padding: "12px",
|
|
266
|
+
borderBottom: "1px solid #eee",
|
|
267
|
+
backgroundColor: index === 0 || index === 19 ? "#fff3cd" : "white"
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
index === 0 && "First Item (Top Threshold Test)",
|
|
271
|
+
index === 19 && "Last Item (Bottom Threshold Test)",
|
|
272
|
+
index !== 0 && index !== 19 && `Item ${index + 1}`
|
|
273
|
+
))
|
|
274
|
+
));
|
|
275
|
+
};
|
|
276
|
+
export {
|
|
277
|
+
BasicScrollViewDemo,
|
|
278
|
+
BidirectionalScrollDemo,
|
|
279
|
+
ControlledScrollDemo,
|
|
280
|
+
HorizontalScrollViewDemo,
|
|
281
|
+
ScrollEventsDemo,
|
|
282
|
+
ThresholdTestDemo
|
|
283
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ScrollViewProps } from './ScrollView.types';
|
|
3
|
+
export interface UseScrollViewParameters extends ScrollViewProps {
|
|
4
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
5
|
+
}
|
|
6
|
+
export interface UseScrollViewReturnValue {
|
|
7
|
+
getRootProps: (otherHandlers?: Record<string, unknown>) => Record<string, unknown>;
|
|
8
|
+
containerRef: React.RefCallback<HTMLDivElement>;
|
|
9
|
+
}
|
|
10
|
+
export declare function useScrollView(parameters: UseScrollViewParameters): UseScrollViewReturnValue;
|