@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
package/es/Select/Select.js
CHANGED
|
@@ -29,13 +29,32 @@ var __objRest = (source, exclude) => {
|
|
|
29
29
|
}
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
|
+
var __async = (__this, __arguments, generator) => {
|
|
33
|
+
return new Promise((resolve, reject) => {
|
|
34
|
+
var fulfilled = (value) => {
|
|
35
|
+
try {
|
|
36
|
+
step(generator.next(value));
|
|
37
|
+
} catch (e) {
|
|
38
|
+
reject(e);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var rejected = (value) => {
|
|
42
|
+
try {
|
|
43
|
+
step(generator.throw(value));
|
|
44
|
+
} catch (e) {
|
|
45
|
+
reject(e);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
49
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
50
|
+
});
|
|
51
|
+
};
|
|
32
52
|
import { CaretDownIcon, CaretUpIcon } from "@bifrostui/icons";
|
|
33
53
|
import {
|
|
34
54
|
getStylesAndLocation,
|
|
35
55
|
isMini,
|
|
36
56
|
throttle,
|
|
37
57
|
useForkRef,
|
|
38
|
-
useUniqueId,
|
|
39
58
|
useValue
|
|
40
59
|
} from "@bifrostui/utils";
|
|
41
60
|
import clsx from "clsx";
|
|
@@ -100,38 +119,36 @@ const Select = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
100
119
|
const isOpen = open !== void 0 ? open : internalOpen;
|
|
101
120
|
const locatorRef = useRef(null);
|
|
102
121
|
const rootRef = useForkRef(ref, locatorRef);
|
|
103
|
-
const
|
|
104
|
-
const
|
|
105
|
-
const updateOptionStyle =
|
|
122
|
+
const optionContainerRef = useRef(null);
|
|
123
|
+
const optionMainRef = useRef(null);
|
|
124
|
+
const updateOptionStyle = () => __async(void 0, null, function* () {
|
|
106
125
|
const curScrollRoot = scrollContainer();
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
const changeOpen = (newOpen) => {
|
|
126
|
+
const result = yield getStylesAndLocation({
|
|
127
|
+
scrollRoot: curScrollRoot,
|
|
128
|
+
childrenRef: locatorRef,
|
|
129
|
+
tipRef: optionContainerRef,
|
|
130
|
+
arrowDirection: defaultPlacement,
|
|
131
|
+
arrowLocation: "none",
|
|
132
|
+
offsetSpacing: 0
|
|
133
|
+
});
|
|
134
|
+
if (!result)
|
|
135
|
+
return;
|
|
136
|
+
const { styles, childrenStyle, newArrowDirection } = result;
|
|
137
|
+
optionMainRef.current.style.transition = "none";
|
|
138
|
+
optionMainRef.current.style.transform = `translateY(${newArrowDirection === "bottom" ? "-100%" : "100%"})`;
|
|
139
|
+
setPlacement(newArrowDirection);
|
|
140
|
+
setOptionStyle(__spreadProps(__spreadValues({}, styles), { width: childrenStyle == null ? void 0 : childrenStyle.width }));
|
|
141
|
+
});
|
|
142
|
+
const changeOpen = (newOpen) => __async(void 0, null, function* () {
|
|
124
143
|
if (newOpen) {
|
|
125
|
-
updateOptionStyle();
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
onOpen == null ? void 0 : onOpen();
|
|
129
|
-
}, 100);
|
|
144
|
+
yield updateOptionStyle();
|
|
145
|
+
setInternalOpen(newOpen);
|
|
146
|
+
onOpen == null ? void 0 : onOpen();
|
|
130
147
|
} else {
|
|
131
148
|
onClose == null ? void 0 : onClose();
|
|
132
149
|
setInternalOpen(newOpen);
|
|
133
150
|
}
|
|
134
|
-
};
|
|
151
|
+
});
|
|
135
152
|
const handleSelectClick = (e) => {
|
|
136
153
|
if (disabled)
|
|
137
154
|
return;
|
|
@@ -156,10 +173,11 @@ const Select = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
156
173
|
[selectValue, onChange, setRenderValue]
|
|
157
174
|
);
|
|
158
175
|
useEffect(() => {
|
|
176
|
+
const resizeCb = throttle(updateOptionStyle, 100);
|
|
159
177
|
if (!isMini) {
|
|
160
|
-
window.addEventListener("resize",
|
|
178
|
+
window.addEventListener("resize", resizeCb);
|
|
161
179
|
return () => {
|
|
162
|
-
window.removeEventListener("resize",
|
|
180
|
+
window.removeEventListener("resize", resizeCb);
|
|
163
181
|
};
|
|
164
182
|
}
|
|
165
183
|
}, []);
|
|
@@ -171,8 +189,8 @@ const Select = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
171
189
|
{
|
|
172
190
|
in: isOpen,
|
|
173
191
|
timeout: {
|
|
174
|
-
enter:
|
|
175
|
-
exit:
|
|
192
|
+
enter: 167,
|
|
193
|
+
exit: 167
|
|
176
194
|
}
|
|
177
195
|
},
|
|
178
196
|
/* @__PURE__ */ React.createElement(
|
|
@@ -186,7 +204,7 @@ const Select = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
186
204
|
[`${prefixCls}-option-container-hide`]: !isOpen
|
|
187
205
|
}
|
|
188
206
|
),
|
|
189
|
-
|
|
207
|
+
ref: optionContainerRef,
|
|
190
208
|
style: optionStyle
|
|
191
209
|
},
|
|
192
210
|
/* @__PURE__ */ React.createElement(
|
|
@@ -195,11 +213,20 @@ const Select = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
195
213
|
in: isOpen,
|
|
196
214
|
direction: placement === "bottom" ? "down" : "up",
|
|
197
215
|
timeout: {
|
|
198
|
-
enter:
|
|
199
|
-
exit:
|
|
216
|
+
enter: 167,
|
|
217
|
+
exit: 167
|
|
200
218
|
}
|
|
201
219
|
},
|
|
202
|
-
/* @__PURE__ */ React.createElement(
|
|
220
|
+
/* @__PURE__ */ React.createElement(
|
|
221
|
+
"div",
|
|
222
|
+
{
|
|
223
|
+
className: clsx(`${prefixCls}-option-main`),
|
|
224
|
+
ref: optionMainRef,
|
|
225
|
+
role: "listbox",
|
|
226
|
+
"aria-label": "option list"
|
|
227
|
+
},
|
|
228
|
+
children
|
|
229
|
+
)
|
|
203
230
|
)
|
|
204
231
|
)
|
|
205
232
|
);
|
|
@@ -211,7 +238,12 @@ const Select = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
211
238
|
[`${prefixCls}-disabled`]: disabled,
|
|
212
239
|
[`${prefixCls}-active`]: isOpen
|
|
213
240
|
}),
|
|
214
|
-
ref: rootRef
|
|
241
|
+
ref: rootRef,
|
|
242
|
+
role: "combobox",
|
|
243
|
+
"aria-expanded": isOpen,
|
|
244
|
+
"aria-haspopup": "listbox",
|
|
245
|
+
"aria-label": others["aria-label"] || "Select",
|
|
246
|
+
tabIndex: disabled ? -1 : 0
|
|
215
247
|
}, others), {
|
|
216
248
|
onClick: handleSelectClick
|
|
217
249
|
}),
|
|
@@ -221,15 +253,16 @@ const Select = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
221
253
|
name,
|
|
222
254
|
readOnly: true,
|
|
223
255
|
ref: inputRef,
|
|
224
|
-
value: selectValue
|
|
256
|
+
value: selectValue,
|
|
257
|
+
"aria-hidden": "true",
|
|
258
|
+
tabIndex: -1
|
|
225
259
|
}, inputProps), {
|
|
226
260
|
className: clsx(`${prefixCls}-input`, {
|
|
227
261
|
[inputProps == null ? void 0 : inputProps.className]: inputProps == null ? void 0 : inputProps.className
|
|
228
262
|
})
|
|
229
263
|
})
|
|
230
|
-
), icon || defaultIcon)
|
|
231
|
-
|
|
232
|
-
), !isMini && /* @__PURE__ */ React.createElement(Portal, { onRootElementMouted: updateOptionStyle }, renderOptions()), /* @__PURE__ */ React.createElement(
|
|
264
|
+
), icon || defaultIcon)
|
|
265
|
+
), /* @__PURE__ */ React.createElement(Portal, { onMounted: updateOptionStyle }, renderOptions()), /* @__PURE__ */ React.createElement(
|
|
233
266
|
Backdrop,
|
|
234
267
|
__spreadProps(__spreadValues({
|
|
235
268
|
open: isOpen,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OverrideProps } from '@bifrostui/types';
|
|
2
|
-
import React, { Ref, SyntheticEvent } from 'react';
|
|
2
|
+
import React, { ReactNode, Ref, SyntheticEvent } from 'react';
|
|
3
3
|
import { BackdropProps } from '../Backdrop';
|
|
4
4
|
export type BuiSelectValue = string | number;
|
|
5
5
|
export interface BuiSelectContextProps {
|
|
@@ -10,7 +10,7 @@ export interface BuiSelectContextProps {
|
|
|
10
10
|
/**
|
|
11
11
|
* 设置根选择器展示内容
|
|
12
12
|
*/
|
|
13
|
-
setRenderValue?: React.Dispatch<React.SetStateAction<
|
|
13
|
+
setRenderValue?: React.Dispatch<React.SetStateAction<ReactNode>>;
|
|
14
14
|
/**
|
|
15
15
|
* 选项点击的回调
|
|
16
16
|
*/
|
|
@@ -53,7 +53,11 @@ const SelectOption = /* @__PURE__ */ React.forwardRef(
|
|
|
53
53
|
[`${prefixCls}-active`]: !disabled && value === selectValue,
|
|
54
54
|
[`${prefixCls}-disabled`]: disabled
|
|
55
55
|
}),
|
|
56
|
-
ref
|
|
56
|
+
ref,
|
|
57
|
+
role: "option",
|
|
58
|
+
"aria-selected": !disabled && value === selectValue,
|
|
59
|
+
"aria-disabled": disabled,
|
|
60
|
+
tabIndex: disabled ? -1 : 0
|
|
57
61
|
}, others), {
|
|
58
62
|
onClick: (e) => {
|
|
59
63
|
if (!disabled)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* 自定义 Select 组件 Demo 集合
|
|
4
|
+
* 这个文件包含多个测试 demo,展示如何使用 getCustomDemoCodesFromFile 进行无障碍测试
|
|
5
|
+
* 文件名必须是 A11yDemos.tsx(固定约定)
|
|
6
|
+
*/
|
|
7
|
+
export declare const basicSelectDemo: () => React.JSX.Element;
|
|
8
|
+
export declare const ControlledSelectDemo: () => React.JSX.Element;
|
|
9
|
+
export declare const disabledSelectDemo: () => React.JSX.Element;
|
|
10
|
+
export declare const selectWithDisabledOptionsDemo: () => React.JSX.Element;
|
|
11
|
+
export declare const defaultValueSelectDemo: () => React.JSX.Element;
|
|
12
|
+
export declare const complexInteractionSelectDemo: () => React.JSX.Element;
|
|
13
|
+
declare const _default: {
|
|
14
|
+
basicSelectDemo: () => React.JSX.Element;
|
|
15
|
+
ControlledSelectDemo: () => React.JSX.Element;
|
|
16
|
+
disabledSelectDemo: () => React.JSX.Element;
|
|
17
|
+
selectWithDisabledOptionsDemo: () => React.JSX.Element;
|
|
18
|
+
defaultValueSelectDemo: () => React.JSX.Element;
|
|
19
|
+
complexInteractionSelectDemo: () => React.JSX.Element;
|
|
20
|
+
};
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,118 @@
|
|
|
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, { useState } from "react";
|
|
21
|
+
import Select from "../../Select";
|
|
22
|
+
import SelectOption from "../../SelectOption";
|
|
23
|
+
const basicSelectDemo = () => {
|
|
24
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Select, { placeholder: "\u8BF7\u9009\u62E9\u9009\u9879", "aria-label": "\u57FA\u7840\u9009\u62E9\u5668" }, /* @__PURE__ */ React.createElement(SelectOption, { value: "option1", label: "\u9009\u9879\u4E00" }, "\u9009\u9879\u4E00"), /* @__PURE__ */ React.createElement(SelectOption, { value: "option2", label: "\u9009\u9879\u4E8C" }, "\u9009\u9879\u4E8C"), /* @__PURE__ */ React.createElement(SelectOption, { value: "option3", label: "\u9009\u9879\u4E09" }, "\u9009\u9879\u4E09")));
|
|
25
|
+
};
|
|
26
|
+
const ControlledSelectDemo = () => {
|
|
27
|
+
const [value, setValue] = useState("option1");
|
|
28
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
|
|
29
|
+
Select,
|
|
30
|
+
{
|
|
31
|
+
value,
|
|
32
|
+
placeholder: "\u53D7\u63A7\u9009\u62E9\u5668",
|
|
33
|
+
"aria-label": "\u53D7\u63A7\u9009\u62E9\u5668",
|
|
34
|
+
onChange: (e, { value: newValue }) => {
|
|
35
|
+
setValue(newValue);
|
|
36
|
+
console.log("\u9009\u4E2D\u503C:", newValue);
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
/* @__PURE__ */ React.createElement(SelectOption, { value: "option1", label: "\u9009\u9879\u4E00" }, "\u9009\u9879\u4E00"),
|
|
40
|
+
/* @__PURE__ */ React.createElement(SelectOption, { value: "option2", label: "\u9009\u9879\u4E8C" }, "\u9009\u9879\u4E8C"),
|
|
41
|
+
/* @__PURE__ */ React.createElement(SelectOption, { value: "option3", label: "\u9009\u9879\u4E09" }, "\u9009\u9879\u4E09")
|
|
42
|
+
), /* @__PURE__ */ React.createElement("p", null, "\u5F53\u524D\u9009\u4E2D\u503C: ", value));
|
|
43
|
+
};
|
|
44
|
+
const disabledSelectDemo = () => {
|
|
45
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Select, { disabled: true, placeholder: "\u7981\u7528\u7684\u9009\u62E9\u5668", "aria-label": "\u7981\u7528\u9009\u62E9\u5668" }, /* @__PURE__ */ React.createElement(SelectOption, { value: "option1", label: "\u9009\u9879\u4E00" }, "\u9009\u9879\u4E00"), /* @__PURE__ */ React.createElement(SelectOption, { value: "option2", label: "\u9009\u9879\u4E8C" }, "\u9009\u9879\u4E8C")));
|
|
46
|
+
};
|
|
47
|
+
const selectWithDisabledOptionsDemo = () => {
|
|
48
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Select, { placeholder: "\u5305\u542B\u7981\u7528\u9009\u9879", "aria-label": "\u5305\u542B\u7981\u7528\u9009\u9879\u7684\u9009\u62E9\u5668" }, /* @__PURE__ */ React.createElement(SelectOption, { value: "option1", label: "\u9009\u9879\u4E00" }, "\u9009\u9879\u4E00"), /* @__PURE__ */ React.createElement(SelectOption, { value: "option2", label: "\u9009\u9879\u4E8C", disabled: true }, "\u9009\u9879\u4E8C\uFF08\u7981\u7528\uFF09"), /* @__PURE__ */ React.createElement(SelectOption, { value: "option3", label: "\u9009\u9879\u4E09" }, "\u9009\u9879\u4E09"), /* @__PURE__ */ React.createElement(SelectOption, { value: "option4", label: "\u9009\u9879\u56DB", disabled: true }, "\u9009\u9879\u56DB\uFF08\u7981\u7528\uFF09")));
|
|
49
|
+
};
|
|
50
|
+
const defaultValueSelectDemo = () => {
|
|
51
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
|
|
52
|
+
Select,
|
|
53
|
+
{
|
|
54
|
+
defaultValue: "option2",
|
|
55
|
+
placeholder: "\u6709\u9ED8\u8BA4\u503C\u7684\u9009\u62E9\u5668",
|
|
56
|
+
"aria-label": "\u6709\u9ED8\u8BA4\u503C\u7684\u9009\u62E9\u5668"
|
|
57
|
+
},
|
|
58
|
+
/* @__PURE__ */ React.createElement(SelectOption, { value: "option1", label: "\u9009\u9879\u4E00" }, "\u9009\u9879\u4E00"),
|
|
59
|
+
/* @__PURE__ */ React.createElement(SelectOption, { value: "option2", label: "\u9009\u9879\u4E8C" }, "\u9009\u9879\u4E8C"),
|
|
60
|
+
/* @__PURE__ */ React.createElement(SelectOption, { value: "option3", label: "\u9009\u9879\u4E09" }, "\u9009\u9879\u4E09")
|
|
61
|
+
));
|
|
62
|
+
};
|
|
63
|
+
const complexInteractionSelectDemo = () => {
|
|
64
|
+
const ComplexInteractionSelectDemo = () => {
|
|
65
|
+
const [value, setValue] = useState("");
|
|
66
|
+
const [options, setOptions] = useState([
|
|
67
|
+
{ value: "option1", label: "\u9009\u9879\u4E00", disabled: false },
|
|
68
|
+
{ value: "option2", label: "\u9009\u9879\u4E8C", disabled: false },
|
|
69
|
+
{ value: "option3", label: "\u9009\u9879\u4E09", disabled: false }
|
|
70
|
+
]);
|
|
71
|
+
const toggleOptionDisabled = (targetValue) => {
|
|
72
|
+
setOptions(
|
|
73
|
+
(prevOptions) => prevOptions.map(
|
|
74
|
+
(option) => option.value === targetValue ? __spreadProps(__spreadValues({}, option), { disabled: !option.disabled }) : option
|
|
75
|
+
)
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
|
|
79
|
+
Select,
|
|
80
|
+
{
|
|
81
|
+
value,
|
|
82
|
+
placeholder: "\u590D\u6742\u4EA4\u4E92\u9009\u62E9\u5668",
|
|
83
|
+
"aria-label": "\u590D\u6742\u4EA4\u4E92\u9009\u62E9\u5668",
|
|
84
|
+
onChange: (e, { value: newValue }) => {
|
|
85
|
+
setValue(newValue);
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
options.map((option) => /* @__PURE__ */ React.createElement(
|
|
89
|
+
SelectOption,
|
|
90
|
+
{
|
|
91
|
+
key: option.value,
|
|
92
|
+
value: option.value,
|
|
93
|
+
label: option.label,
|
|
94
|
+
disabled: option.disabled
|
|
95
|
+
},
|
|
96
|
+
option.label
|
|
97
|
+
))
|
|
98
|
+
), /* @__PURE__ */ React.createElement("div", { style: { marginTop: 10 } }, /* @__PURE__ */ React.createElement("button", { type: "button", onClick: () => toggleOptionDisabled("option2") }, "\u5207\u6362\u9009\u9879\u4E8C\u72B6\u6001")), value && /* @__PURE__ */ React.createElement("p", null, "\u5F53\u524D\u9009\u4E2D: ", value));
|
|
99
|
+
};
|
|
100
|
+
return /* @__PURE__ */ React.createElement(ComplexInteractionSelectDemo, null);
|
|
101
|
+
};
|
|
102
|
+
var A11yDemos_default = {
|
|
103
|
+
basicSelectDemo,
|
|
104
|
+
ControlledSelectDemo,
|
|
105
|
+
disabledSelectDemo,
|
|
106
|
+
selectWithDisabledOptionsDemo,
|
|
107
|
+
defaultValueSelectDemo,
|
|
108
|
+
complexInteractionSelectDemo
|
|
109
|
+
};
|
|
110
|
+
export {
|
|
111
|
+
ControlledSelectDemo,
|
|
112
|
+
basicSelectDemo,
|
|
113
|
+
complexInteractionSelectDemo,
|
|
114
|
+
A11yDemos_default as default,
|
|
115
|
+
defaultValueSelectDemo,
|
|
116
|
+
disabledSelectDemo,
|
|
117
|
+
selectWithDisabledOptionsDemo
|
|
118
|
+
};
|
package/es/Select/index.css
CHANGED
|
@@ -8,9 +8,10 @@ xhs-page {
|
|
|
8
8
|
--bui-select-option-main-padding: 3px 0;
|
|
9
9
|
--bui-select-option-padding: 0 14px;
|
|
10
10
|
--bui-select-option-border-radius: 5px;
|
|
11
|
-
--bui-select-option-margin:
|
|
11
|
+
--bui-select-option-margin: 2px 3px;
|
|
12
12
|
--bui-select-option-height: 32px;
|
|
13
13
|
--bui-select-option-active-bg-color: #fff2f0;
|
|
14
|
+
--bui-select-option-hover-bg-color: rgba(255, 242, 240, 0.4);
|
|
14
15
|
}
|
|
15
16
|
.bui-select {
|
|
16
17
|
position: relative;
|
|
@@ -58,13 +59,9 @@ xhs-page {
|
|
|
58
59
|
.bui-select-option-container {
|
|
59
60
|
position: absolute;
|
|
60
61
|
box-sizing: border-box;
|
|
61
|
-
top: 100%;
|
|
62
|
-
left: 0;
|
|
63
|
-
width: 100%;
|
|
64
62
|
font-size: var(--bui-select-font-size, var(--bui-title-size-3));
|
|
65
63
|
z-index: var(--bui-z-index-tooltip);
|
|
66
64
|
border-radius: 3px;
|
|
67
|
-
background-color: var(--bui-color-bg-view);
|
|
68
65
|
padding: 2px;
|
|
69
66
|
overflow: hidden;
|
|
70
67
|
}
|
|
@@ -81,18 +78,22 @@ xhs-page {
|
|
|
81
78
|
border-radius: 3px;
|
|
82
79
|
padding: var(--bui-select-option-main-padding);
|
|
83
80
|
box-shadow: 0 0 0 2px var(--bui-color-bg-default);
|
|
81
|
+
background-color: var(--bui-color-bg-view);
|
|
84
82
|
overflow: hidden;
|
|
85
83
|
}
|
|
86
84
|
.bui-select-option {
|
|
87
|
-
display: flex;
|
|
88
|
-
align-items: center;
|
|
89
85
|
height: var(--bui-select-option-height);
|
|
86
|
+
line-height: var(--bui-select-option-height);
|
|
90
87
|
padding: var(--bui-select-option-padding);
|
|
91
88
|
border-radius: var(--bui-select-option-border-radius);
|
|
92
89
|
margin: var(--bui-select-option-margin);
|
|
90
|
+
width: auto;
|
|
91
|
+
overflow: hidden;
|
|
92
|
+
text-overflow: ellipsis;
|
|
93
|
+
white-space: nowrap;
|
|
93
94
|
}
|
|
94
95
|
.bui-select-option:hover {
|
|
95
|
-
background-color: var(--bui-select-option-
|
|
96
|
+
background-color: var(--bui-select-option-hover-bg-color);
|
|
96
97
|
color: var(--bui-color-primary);
|
|
97
98
|
}
|
|
98
99
|
.bui-select-option-active {
|
|
@@ -100,6 +101,9 @@ xhs-page {
|
|
|
100
101
|
color: var(--bui-color-primary);
|
|
101
102
|
background-color: var(--bui-select-option-active-bg-color);
|
|
102
103
|
}
|
|
104
|
+
.bui-select-option-active:hover {
|
|
105
|
+
background-color: var(--bui-select-option-active-bg-color);
|
|
106
|
+
}
|
|
103
107
|
.bui-select-option-hide {
|
|
104
108
|
opacity: 0;
|
|
105
109
|
transform: translateY(-5px);
|
package/es/Slide/Slide.js
CHANGED
|
@@ -93,7 +93,7 @@ const Slide = /* @__PURE__ */ React.forwardRef(
|
|
|
93
93
|
ref: nodeRef
|
|
94
94
|
}),
|
|
95
95
|
(state, childProps) => {
|
|
96
|
-
const transition = transitions.create(
|
|
96
|
+
const transition = state === "entering" || state === "exiting" ? transitions.create(
|
|
97
97
|
"transform",
|
|
98
98
|
getTransitionProps(
|
|
99
99
|
{ timeout, style, easing: easingProp, delay },
|
|
@@ -101,7 +101,7 @@ const Slide = /* @__PURE__ */ React.forwardRef(
|
|
|
101
101
|
mode: state
|
|
102
102
|
}
|
|
103
103
|
)
|
|
104
|
-
);
|
|
104
|
+
) : "none";
|
|
105
105
|
const transform = state === "entering" || state === "entered" ? "none" : getTranslateValue(direction);
|
|
106
106
|
return React.cloneElement(children, __spreadValues({
|
|
107
107
|
style: __spreadValues(__spreadValues({
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slide Animation Component
|
|
3
|
+
* @description A component that implements slide in/out animation effects for elements
|
|
4
|
+
* @component Slide
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import type { SlideProps } from './Slide.types';
|
|
8
|
+
import './index.less';
|
|
9
|
+
/**
|
|
10
|
+
* Slide Component
|
|
11
|
+
* @component
|
|
12
|
+
*/
|
|
13
|
+
declare const Slide: React.ForwardRefExoticComponent<SlideProps & React.RefAttributes<HTMLElement>>;
|
|
14
|
+
export default Slide;
|
|
@@ -0,0 +1,192 @@
|
|
|
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
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
import React, { useEffect, useState, useRef, useMemo } from "react";
|
|
33
|
+
import {
|
|
34
|
+
createTransitions,
|
|
35
|
+
duration,
|
|
36
|
+
easing,
|
|
37
|
+
getTransitionProps,
|
|
38
|
+
useForkRef
|
|
39
|
+
} from "@bifrostui/utils";
|
|
40
|
+
import "./index.css";
|
|
41
|
+
const defaultEasing = {
|
|
42
|
+
enter: easing.easeOut,
|
|
43
|
+
exit: easing.sharp
|
|
44
|
+
};
|
|
45
|
+
const defaultTimeout = {
|
|
46
|
+
enter: duration.enteringScreen,
|
|
47
|
+
exit: duration.leavingScreen
|
|
48
|
+
};
|
|
49
|
+
const getAnimationName = (direction, inProp) => {
|
|
50
|
+
const animations = {
|
|
51
|
+
left: inProp ? "bui-slide-left-in" : "bui-slide-left-out",
|
|
52
|
+
right: inProp ? "bui-slide-right-in" : "bui-slide-right-out",
|
|
53
|
+
up: inProp ? "bui-slide-up-in" : "bui-slide-up-out",
|
|
54
|
+
down: inProp ? "bui-slide-down-in" : "bui-slide-down-out"
|
|
55
|
+
};
|
|
56
|
+
return animations[direction] || animations.down;
|
|
57
|
+
};
|
|
58
|
+
const Slide = /* @__PURE__ */ React.forwardRef(
|
|
59
|
+
(_a, ref) => {
|
|
60
|
+
var _b = _a, {
|
|
61
|
+
children: children,
|
|
62
|
+
in: inProp,
|
|
63
|
+
style,
|
|
64
|
+
direction = "down",
|
|
65
|
+
appear: appear = true,
|
|
66
|
+
enter = true,
|
|
67
|
+
exit = true,
|
|
68
|
+
delay = 0,
|
|
69
|
+
easing: easingProp = defaultEasing,
|
|
70
|
+
timeout = defaultTimeout,
|
|
71
|
+
mountOnEnter: mountOnEnter,
|
|
72
|
+
unmountOnExit,
|
|
73
|
+
onEnter: onEnter,
|
|
74
|
+
onEntering,
|
|
75
|
+
onEntered,
|
|
76
|
+
onExit,
|
|
77
|
+
onExiting,
|
|
78
|
+
onExited
|
|
79
|
+
} = _b, others = __objRest(_b, [
|
|
80
|
+
// Base props
|
|
81
|
+
"children",
|
|
82
|
+
"in",
|
|
83
|
+
"style",
|
|
84
|
+
"direction",
|
|
85
|
+
// Animation controls
|
|
86
|
+
"appear",
|
|
87
|
+
"enter",
|
|
88
|
+
"exit",
|
|
89
|
+
"delay",
|
|
90
|
+
"easing",
|
|
91
|
+
"timeout",
|
|
92
|
+
// Lifecycle hooks
|
|
93
|
+
"mountOnEnter",
|
|
94
|
+
"unmountOnExit",
|
|
95
|
+
// Animation callbacks
|
|
96
|
+
"onEnter",
|
|
97
|
+
"onEntering",
|
|
98
|
+
"onEntered",
|
|
99
|
+
"onExit",
|
|
100
|
+
"onExiting",
|
|
101
|
+
"onExited"
|
|
102
|
+
]);
|
|
103
|
+
var _a2;
|
|
104
|
+
const isFirstMount = useRef(inProp || !mountOnEnter);
|
|
105
|
+
const [isMounted, setIsMounted] = useState(inProp || !mountOnEnter);
|
|
106
|
+
const elementRef = useRef(null);
|
|
107
|
+
const handleRef = useForkRef(ref, children == null ? void 0 : children.ref, elementRef);
|
|
108
|
+
const shouldAnimateOnFirstMount = inProp && appear;
|
|
109
|
+
const shouldAnimate = inProp && enter || !inProp && exit;
|
|
110
|
+
const shouldExecuteAnimation = isFirstMount.current ? shouldAnimateOnFirstMount : shouldAnimate;
|
|
111
|
+
const getAnimationDurationAndDelay = () => {
|
|
112
|
+
if (!shouldExecuteAnimation) {
|
|
113
|
+
return { timeout: 0, delay: 0 };
|
|
114
|
+
}
|
|
115
|
+
return { timeout, delay };
|
|
116
|
+
};
|
|
117
|
+
const shouldSkipFirstAnimation = isFirstMount.current && !shouldAnimateOnFirstMount;
|
|
118
|
+
const transitions = createTransitions();
|
|
119
|
+
const animationName = getAnimationName(direction, inProp);
|
|
120
|
+
const animationDurationAndDelay = getAnimationDurationAndDelay();
|
|
121
|
+
const animation = useMemo(
|
|
122
|
+
() => transitions.create(
|
|
123
|
+
animationName,
|
|
124
|
+
getTransitionProps(
|
|
125
|
+
__spreadProps(__spreadValues({}, animationDurationAndDelay), {
|
|
126
|
+
style,
|
|
127
|
+
easing: easingProp
|
|
128
|
+
}),
|
|
129
|
+
{ mode: inProp ? "enter" : "exit" }
|
|
130
|
+
)
|
|
131
|
+
),
|
|
132
|
+
[inProp]
|
|
133
|
+
);
|
|
134
|
+
useEffect(() => {
|
|
135
|
+
if (inProp && !isMounted) {
|
|
136
|
+
setIsMounted(true);
|
|
137
|
+
}
|
|
138
|
+
}, [inProp, isMounted]);
|
|
139
|
+
useEffect(() => {
|
|
140
|
+
if (isMounted && isFirstMount.current) {
|
|
141
|
+
isFirstMount.current = false;
|
|
142
|
+
}
|
|
143
|
+
}, [isMounted]);
|
|
144
|
+
useEffect(() => {
|
|
145
|
+
const shouldTriggerCallback = isMounted && shouldExecuteAnimation;
|
|
146
|
+
if (!shouldTriggerCallback)
|
|
147
|
+
return;
|
|
148
|
+
if (inProp) {
|
|
149
|
+
onEnter == null ? void 0 : onEnter(elementRef.current);
|
|
150
|
+
} else {
|
|
151
|
+
onExit == null ? void 0 : onExit(elementRef.current);
|
|
152
|
+
}
|
|
153
|
+
}, [inProp, isMounted]);
|
|
154
|
+
const handleAnimationStart = () => {
|
|
155
|
+
if (!shouldExecuteAnimation)
|
|
156
|
+
return;
|
|
157
|
+
if (inProp) {
|
|
158
|
+
onEntering == null ? void 0 : onEntering(elementRef.current);
|
|
159
|
+
} else {
|
|
160
|
+
onExiting == null ? void 0 : onExiting(elementRef.current);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
const handleAnimationEnd = () => {
|
|
164
|
+
if (shouldSkipFirstAnimation)
|
|
165
|
+
return;
|
|
166
|
+
if (inProp) {
|
|
167
|
+
onEntered == null ? void 0 : onEntered(elementRef.current);
|
|
168
|
+
} else {
|
|
169
|
+
onExited == null ? void 0 : onExited(elementRef.current);
|
|
170
|
+
if (unmountOnExit) {
|
|
171
|
+
setIsMounted(false);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
if (!children || !isMounted)
|
|
176
|
+
return null;
|
|
177
|
+
return React.cloneElement(children, __spreadProps(__spreadValues({}, others), {
|
|
178
|
+
ref: handleRef,
|
|
179
|
+
onAnimationEnd: handleAnimationEnd,
|
|
180
|
+
onAnimationStart: handleAnimationStart,
|
|
181
|
+
style: __spreadValues(__spreadValues({
|
|
182
|
+
animation,
|
|
183
|
+
animationFillMode: "both"
|
|
184
|
+
}, style), (_a2 = children.props) == null ? void 0 : _a2.style)
|
|
185
|
+
}));
|
|
186
|
+
}
|
|
187
|
+
);
|
|
188
|
+
Slide.displayName = "BuiSlide";
|
|
189
|
+
var Slide_miniapp_default = Slide;
|
|
190
|
+
export {
|
|
191
|
+
Slide_miniapp_default as default
|
|
192
|
+
};
|