@bifrostui/react 2.0.0-alpha.0 → 2.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Alert/Alert.js +2 -1
- package/dist/Alert/__tests__/fixtures/A11yDemos.d.ts +17 -0
- package/dist/Alert/__tests__/fixtures/A11yDemos.js +143 -0
- package/dist/Alert/index.css +4 -4
- package/dist/Avatar/AvatarGroup.css +8 -8
- package/dist/Avatar/index.css +8 -8
- package/dist/Backdrop/Backdrop.js +3 -2
- package/dist/Backdrop/Backdrop.types.d.ts +4 -0
- package/dist/Backdrop/__tests__/fixtures/A11yDemos.d.ts +8 -0
- package/dist/Backdrop/__tests__/fixtures/A11yDemos.js +51 -0
- package/dist/Backdrop/index.css +2 -2
- package/dist/Badge/Badge.js +38 -11
- package/dist/Badge/Badge.types.d.ts +30 -1
- package/dist/Badge/__tests__/fixtures/A11yDemos.d.ts +25 -0
- package/dist/Badge/__tests__/fixtures/A11yDemos.js +110 -0
- package/dist/Badge/hooks/useBadgeA11y.d.ts +23 -0
- package/dist/Badge/hooks/useBadgeA11y.js +76 -0
- package/dist/Badge/hooks/useBadgeDisplay.d.ts +16 -0
- package/dist/Badge/hooks/useBadgeDisplay.js +56 -0
- package/dist/Button/Button.js +2 -1
- package/dist/Button/__tests__/fixtures/A11yDemos.d.ts +23 -0
- package/dist/Button/__tests__/fixtures/A11yDemos.js +81 -0
- package/dist/Button/index.css +4 -5
- package/dist/CSSTransition/CSSTransition.d.ts +4 -0
- package/dist/CSSTransition/CSSTransition.js +177 -0
- package/dist/CSSTransition/CSSTransition.types.d.ts +13 -0
- package/dist/CSSTransition/CSSTransition.types.js +15 -0
- package/dist/CSSTransition/demo/CSSTransitionDemo.d.ts +4 -0
- package/dist/CSSTransition/demo/CSSTransitionDemo.js +76 -0
- package/dist/CSSTransition/demo/index.css +25 -0
- package/dist/CSSTransition/index.d.ts +2 -0
- package/dist/CSSTransition/index.js +41 -0
- package/dist/Calendar/Calendar.js +131 -34
- package/dist/Calendar/Calendar.types.d.ts +16 -1
- package/dist/Calendar/__tests__/fixtures/A11yDemos.d.ts +2 -0
- package/dist/Calendar/__tests__/fixtures/A11yDemos.js +41 -0
- package/dist/Calendar/index.css +52 -9
- package/dist/Calendar/utils.d.ts +7 -3
- package/dist/Calendar/utils.js +33 -23
- package/dist/Checkbox/Checkbox.js +5 -4
- package/dist/Checkbox/__tests__/fixtures/A11yDemos.d.ts +15 -0
- package/dist/Checkbox/__tests__/fixtures/A11yDemos.js +57 -0
- package/dist/CitySelector/CitySelector.types.d.ts +0 -1
- package/dist/Collapse/Collapse.d.ts +1 -1
- package/dist/Collapse/Collapse.js +26 -12
- package/dist/Collapse/Collapse.miniapp.d.ts +10 -0
- package/dist/Collapse/Collapse.miniapp.js +255 -0
- package/dist/Collapse/index.css +40 -1
- package/dist/CollapsePanel/index.css +1 -1
- package/dist/Countdown/Countdown.js +61 -21
- package/dist/Countdown/Countdown.types.d.ts +19 -15
- package/dist/Countdown/__tests__/fixtures/A11yDemos.d.ts +23 -0
- package/dist/Countdown/__tests__/fixtures/A11yDemos.js +107 -0
- package/dist/Countdown/index.css +11 -0
- package/dist/DatePicker/DatePicker.d.ts +4 -0
- package/dist/DatePicker/DatePicker.js +335 -0
- package/dist/DatePicker/DatePicker.types.d.ts +36 -0
- package/dist/DatePicker/DatePicker.types.js +15 -0
- package/dist/DatePicker/constants.d.ts +9 -0
- package/dist/DatePicker/constants.js +37 -0
- package/dist/DatePicker/index.d.ts +3 -0
- package/dist/DatePicker/index.js +44 -0
- package/dist/DesktopDatePicker/DesktopDatePicker.css +61 -0
- package/dist/DesktopDatePicker/DesktopDatePicker.d.ts +5 -0
- package/dist/DesktopDatePicker/DesktopDatePicker.js +280 -0
- package/dist/DesktopDatePicker/DesktopDatePicker.types.d.ts +163 -0
- package/dist/DesktopDatePicker/DesktopDatePicker.types.js +15 -0
- package/dist/DesktopDatePicker/deskTopPickerContainer.css +100 -0
- package/dist/DesktopDatePicker/index.css +161 -0
- package/dist/DesktopDatePicker/index.d.ts +2 -0
- package/dist/DesktopDatePicker/index.js +41 -0
- package/dist/DesktopDatePicker/useGetDatePickerContent.d.ts +6 -0
- package/dist/DesktopDatePicker/useGetDatePickerContent.js +343 -0
- package/dist/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +5 -0
- package/dist/DesktopDateTimePicker/DesktopDateTimePicker.js +322 -0
- package/dist/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +163 -0
- package/dist/DesktopDateTimePicker/DesktopDateTimePicker.types.js +15 -0
- package/dist/DesktopDateTimePicker/index.css +66 -0
- package/dist/DesktopDateTimePicker/index.d.ts +2 -0
- package/dist/DesktopDateTimePicker/index.js +41 -0
- package/dist/DesktopPicker/DesktopPicker.d.ts +5 -0
- package/dist/DesktopPicker/DesktopPicker.js +243 -0
- package/dist/DesktopPicker/DesktopPicker.types.d.ts +61 -0
- package/dist/DesktopPicker/DesktopPicker.types.js +15 -0
- package/dist/DesktopPicker/index.css +39 -0
- package/dist/DesktopPicker/index.d.ts +2 -0
- package/dist/DesktopPicker/index.js +41 -0
- package/dist/DesktopPicker/utils/calcAfterMounted.d.ts +2 -0
- package/dist/{Tabs/utils/bound.js → DesktopPicker/utils/calcAfterMounted.js} +7 -14
- package/dist/DesktopPicker/utils/calcAfterMounted.miniapp.d.ts +2 -0
- package/dist/DesktopPicker/utils/calcAfterMounted.miniapp.js +38 -0
- package/dist/DesktopTimePicker/DesktopTimePicker.d.ts +5 -0
- package/dist/DesktopTimePicker/DesktopTimePicker.js +288 -0
- package/dist/DesktopTimePicker/DesktopTimePicker.types.d.ts +182 -0
- package/dist/DesktopTimePicker/DesktopTimePicker.types.js +15 -0
- package/dist/DesktopTimePicker/DesktopTimePickerList.d.ts +4 -0
- package/dist/DesktopTimePicker/DesktopTimePickerList.js +111 -0
- package/dist/DesktopTimePicker/index.css +170 -0
- package/dist/DesktopTimePicker/index.d.ts +2 -0
- package/dist/DesktopTimePicker/index.js +41 -0
- package/dist/DesktopTimePicker/useGetTimePickerContent.d.ts +6 -0
- package/dist/DesktopTimePicker/useGetTimePickerContent.js +249 -0
- package/dist/DesktopTimePicker/utils/scrollUtil.d.ts +2 -0
- package/dist/DesktopTimePicker/utils/scrollUtil.js +27 -0
- package/dist/DesktopTimePicker/utils/scrollUtil.miniapp.d.ts +2 -0
- package/dist/DesktopTimePicker/utils/scrollUtil.miniapp.js +51 -0
- package/dist/DesktopTimePicker/utils/utils.d.ts +28 -0
- package/dist/DesktopTimePicker/utils/utils.js +408 -0
- package/dist/Dialog/Dialog.d.ts +5 -2
- package/dist/Dialog/Dialog.js +56 -34
- package/dist/Dialog/Dialog.types.d.ts +50 -22
- package/dist/Dialog/FunctionalDialog.d.ts +10 -3
- package/dist/Dialog/FunctionalDialog.js +102 -80
- package/dist/Dialog/__tests__/fixtures/A11yDemos.d.ts +9 -0
- package/dist/Dialog/__tests__/fixtures/A11yDemos.js +78 -0
- package/dist/Dialog/index.css +19 -19
- package/dist/Dialog/index.d.ts +4 -1
- package/dist/Dialog/index.js +9 -2
- package/dist/Drawer/Drawer.js +7 -7
- package/dist/Drawer/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/dist/Drawer/__tests__/fixtures/A11yDemos.js +148 -0
- package/dist/Fade/Fade.js +2 -2
- package/dist/Fade/Fade.miniapp.d.ts +10 -0
- package/dist/Fade/Fade.miniapp.js +200 -0
- package/dist/Fade/index.css +18 -0
- package/dist/IconButton/IconButton.js +23 -8
- package/dist/IconButton/IconButton.types.d.ts +35 -1
- package/dist/IconButton/index.css +3 -0
- package/dist/Image/Image.js +17 -10
- package/dist/Image/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/dist/Image/__tests__/fixtures/A11yDemos.js +130 -0
- package/dist/Image/index.css +3 -8
- package/dist/Input/Input.js +5 -3
- package/dist/Input/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/dist/Input/__tests__/fixtures/A11yDemos.js +81 -0
- package/dist/Input/index.css +8 -8
- package/dist/ItemSelector/ItemSelector.types.d.ts +0 -1
- package/dist/Modal/Modal.js +47 -47
- package/dist/Modal/Modal.miniapp.d.ts +2 -2
- package/dist/Modal/Modal.miniapp.js +48 -32
- package/dist/Modal/Modal.types.d.ts +26 -2
- package/dist/Modal/ModalManager.d.ts +21 -0
- package/dist/Modal/ModalManager.js +238 -0
- package/dist/Modal/__tests__/fixtures/A11yDemos.d.ts +8 -0
- package/dist/Modal/__tests__/fixtures/A11yDemos.js +52 -0
- package/dist/Modal/index.css +1 -1
- package/dist/Modal/index.d.ts +3 -0
- package/dist/Modal/index.js +9 -1
- package/dist/Modal/useModal.d.ts +24 -0
- package/dist/Modal/useModal.js +190 -0
- package/dist/NavBar/index.css +2 -2
- package/dist/Picker/Picker.css +4 -0
- package/dist/Picker/Picker.js +72 -18
- package/dist/Picker/Picker.types.d.ts +15 -2
- package/dist/Picker/PickerPanel.css +4 -0
- package/dist/Picker/PickerPanel.js +52 -41
- package/dist/Picker/__tests__/fixtures/A11yDemos.d.ts +2 -0
- package/dist/Picker/__tests__/fixtures/A11yDemos.js +79 -0
- package/dist/Picker/index.css +8 -0
- package/dist/Picker/utils.d.ts +8 -5
- package/dist/Picker/utils.js +9 -12
- package/dist/Popover/Popover.js +123 -91
- package/dist/Popover/Popover.types.d.ts +44 -7
- package/dist/Popover/__tests__/fixtures/A11yDemos.d.ts +25 -0
- package/dist/Popover/__tests__/fixtures/A11yDemos.js +175 -0
- package/dist/Popover/hooks/index.d.ts +8 -0
- package/dist/Popover/hooks/index.js +36 -0
- package/dist/Popover/hooks/usePopoverA11y.d.ts +14 -0
- package/dist/Popover/hooks/usePopoverA11y.js +66 -0
- package/dist/Popover/hooks/usePopoverEvents.d.ts +21 -0
- package/dist/Popover/hooks/usePopoverEvents.js +150 -0
- package/dist/Popover/hooks/usePopoverPosition.d.ts +17 -0
- package/dist/Popover/hooks/usePopoverPosition.js +124 -0
- package/dist/Popover/hooks/usePopoverState.d.ts +16 -0
- package/dist/Popover/hooks/usePopoverState.js +54 -0
- package/dist/Portal/Portal.miniapp.js +20 -11
- package/dist/Portal/Portal.types.d.ts +1 -1
- package/dist/Portal/PortalCore.js +2 -2
- package/dist/Progress/Progress.js +61 -6
- package/dist/Progress/Progress.types.d.ts +44 -0
- package/dist/Progress/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/dist/Progress/__tests__/fixtures/A11yDemos.js +100 -0
- package/dist/Radio/Radio.js +5 -4
- package/dist/Radio/RadioGroup.js +1 -1
- package/dist/Radio/__tests__/fixtures/A11yDemos.d.ts +15 -0
- package/dist/Radio/__tests__/fixtures/A11yDemos.js +57 -0
- package/dist/Rating/index.css +8 -12
- package/dist/ScrollView/ScrollView.js +48 -196
- package/dist/ScrollView/ScrollView.types.d.ts +120 -86
- package/dist/ScrollView/__tests__/fixtures/A11yDemos.d.ts +7 -0
- package/dist/ScrollView/__tests__/fixtures/A11yDemos.js +319 -0
- package/dist/ScrollView/useScrollView.d.ts +10 -0
- package/dist/ScrollView/useScrollView.js +300 -0
- package/dist/Select/Select.js +73 -39
- package/dist/Select/Select.types.d.ts +2 -2
- package/dist/Select/SelectOption.js +5 -1
- package/dist/Select/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/dist/Select/__tests__/fixtures/A11yDemos.js +154 -0
- package/dist/Select/index.css +12 -8
- package/dist/Select/selectContext.d.ts +0 -1
- package/dist/Slide/Slide.js +2 -2
- package/dist/Slide/Slide.miniapp.d.ts +14 -0
- package/dist/Slide/Slide.miniapp.js +213 -0
- package/dist/Slide/index.css +72 -0
- package/dist/Slider/Slider.js +13 -5
- package/dist/Stack/demo/index.css +2 -0
- package/dist/SwipeAction/SwipeAction.css +79 -0
- package/dist/SwipeAction/SwipeAction.d.ts +5 -0
- package/dist/SwipeAction/SwipeAction.js +349 -0
- package/dist/SwipeAction/SwipeAction.types.d.ts +75 -0
- package/dist/SwipeAction/SwipeAction.types.js +15 -0
- package/dist/SwipeAction/SwipeActionContext.d.ts +3 -0
- package/dist/SwipeAction/SwipeActionContext.js +30 -0
- package/dist/SwipeAction/SwipeActionItem.css +31 -0
- package/dist/SwipeAction/SwipeActionItem.d.ts +5 -0
- package/dist/SwipeAction/SwipeActionItem.js +105 -0
- package/dist/SwipeAction/constants.d.ts +9 -0
- package/dist/SwipeAction/constants.js +39 -0
- package/dist/SwipeAction/index.css +110 -0
- package/dist/SwipeAction/index.d.ts +5 -0
- package/dist/SwipeAction/index.js +50 -0
- package/dist/Swiper/Swiper.js +18 -4
- package/dist/Switch/Switch.js +5 -4
- package/dist/Switch/__tests__/fixtures/A11yDemos.d.ts +15 -0
- package/dist/Switch/__tests__/fixtures/A11yDemos.js +57 -0
- package/dist/Tabs/Tab.js +36 -21
- package/dist/Tabs/Tab.types.d.ts +1 -1
- package/dist/Tabs/TabPanel.d.ts +1 -1
- package/dist/Tabs/TabPanel.js +9 -5
- package/dist/Tabs/Tabs.css +2 -2
- package/dist/Tabs/Tabs.js +87 -64
- package/dist/Tabs/Tabs.types.d.ts +1 -1
- package/dist/Tabs/TabsContext.d.ts +4 -5
- package/dist/Tabs/TabsContext.js +3 -1
- package/dist/Tabs/index.css +2 -2
- package/dist/Tabs/utils/scroll.d.ts +2 -0
- package/dist/Tabs/utils/scroll.js +55 -0
- package/dist/Tag/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/dist/Tag/__tests__/fixtures/A11yDemos.js +196 -0
- package/dist/TextArea/TextArea.js +50 -7
- package/dist/TextArea/TextArea.types.d.ts +28 -0
- package/dist/TextArea/__tests__/fixtures/A11yDemos.d.ts +19 -0
- package/dist/TextArea/__tests__/fixtures/A11yDemos.js +91 -0
- package/dist/TextArea/index.css +4 -4
- package/dist/ThemeProvider/ThemeProvider.types.d.ts +2 -2
- package/dist/ThemeProvider/ThemeProvider.types.js +0 -12
- package/dist/Toast/FunctionalToast.d.ts +2 -2
- package/dist/Toast/FunctionalToast.js +180 -85
- package/dist/Toast/Toast.d.ts +2 -2
- package/dist/Toast/Toast.js +69 -28
- package/dist/Toast/Toast.types.d.ts +13 -10
- package/dist/Toast/__tests__/fixtures/A11yDemos.d.ts +2 -0
- package/dist/Toast/__tests__/fixtures/A11yDemos.js +54 -0
- package/dist/Toast/index.css +0 -1
- package/dist/Tooltip/Tooltip.js +63 -107
- package/dist/Tooltip/Tooltip.types.d.ts +94 -43
- package/dist/Tooltip/__tests__/fixtures/A11yDemos.d.ts +25 -0
- package/dist/Tooltip/__tests__/fixtures/A11yDemos.js +100 -0
- package/dist/Tooltip/useTooltip.d.ts +29 -0
- package/dist/Tooltip/useTooltip.js +313 -0
- package/dist/Transition/TransitionCore.js +30 -25
- package/dist/TransitionGroup/TransitionGroup.d.ts +7 -0
- package/dist/TransitionGroup/TransitionGroup.js +132 -0
- package/dist/TransitionGroup/TransitionGroup.types.d.ts +47 -0
- package/dist/TransitionGroup/TransitionGroup.types.js +15 -0
- package/dist/TransitionGroup/demo/TransitionGroupDemo.d.ts +4 -0
- package/dist/TransitionGroup/demo/TransitionGroupDemo.js +68 -0
- package/dist/TransitionGroup/demo/index.css +33 -0
- package/dist/TransitionGroup/index.d.ts +2 -0
- package/dist/TransitionGroup/index.js +41 -0
- package/dist/TransitionGroup/utils/childMapping.d.ts +27 -0
- package/dist/TransitionGroup/utils/childMapping.js +119 -0
- package/dist/_.._/benchmarks/components/Button.js +41 -0
- package/dist/_.._/benchmarks/components/Input.js +45 -0
- package/dist/_.._/benchmarks/components/Tabs.js +50 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +17 -1
- package/dist/locales/base.d.ts +40 -1
- package/dist/locales/en-US.js +54 -2
- package/dist/locales/zh-CN.js +56 -1
- package/dist/locales/zh-TW.js +56 -1
- package/es/Alert/Alert.js +2 -1
- package/es/Alert/__tests__/fixtures/A11yDemos.d.ts +17 -0
- package/es/Alert/__tests__/fixtures/A11yDemos.js +107 -0
- package/es/Alert/index.css +4 -4
- package/es/Avatar/AvatarGroup.css +8 -8
- package/es/Avatar/index.css +8 -8
- package/es/Backdrop/Backdrop.js +3 -2
- package/es/Backdrop/Backdrop.types.d.ts +4 -0
- package/es/Backdrop/__tests__/fixtures/A11yDemos.d.ts +8 -0
- package/es/Backdrop/__tests__/fixtures/A11yDemos.js +17 -0
- package/es/Backdrop/index.css +2 -2
- package/es/Badge/Badge.js +38 -11
- package/es/Badge/Badge.types.d.ts +30 -1
- package/es/Badge/__tests__/fixtures/A11yDemos.d.ts +25 -0
- package/es/Badge/__tests__/fixtures/A11yDemos.js +70 -0
- package/es/Badge/hooks/useBadgeA11y.d.ts +23 -0
- package/es/Badge/hooks/useBadgeA11y.js +53 -0
- package/es/Badge/hooks/useBadgeDisplay.d.ts +16 -0
- package/es/Badge/hooks/useBadgeDisplay.js +33 -0
- package/es/Button/Button.js +2 -1
- package/es/Button/__tests__/fixtures/A11yDemos.d.ts +23 -0
- package/es/Button/__tests__/fixtures/A11yDemos.js +42 -0
- package/es/Button/index.css +4 -5
- package/es/CSSTransition/CSSTransition.d.ts +4 -0
- package/es/CSSTransition/CSSTransition.js +153 -0
- package/es/CSSTransition/CSSTransition.types.d.ts +13 -0
- package/es/CSSTransition/CSSTransition.types.js +1 -0
- package/es/CSSTransition/demo/CSSTransitionDemo.d.ts +4 -0
- package/es/CSSTransition/demo/CSSTransitionDemo.js +47 -0
- package/es/CSSTransition/demo/index.css +25 -0
- package/es/CSSTransition/index.d.ts +2 -0
- package/es/CSSTransition/index.js +6 -0
- package/es/Calendar/Calendar.js +131 -34
- package/es/Calendar/Calendar.types.d.ts +16 -1
- package/es/Calendar/__tests__/fixtures/A11yDemos.d.ts +2 -0
- package/es/Calendar/__tests__/fixtures/A11yDemos.js +8 -0
- package/es/Calendar/index.css +52 -9
- package/es/Calendar/utils.d.ts +7 -3
- package/es/Calendar/utils.js +29 -20
- package/es/Checkbox/Checkbox.js +5 -4
- package/es/Checkbox/__tests__/fixtures/A11yDemos.d.ts +15 -0
- package/es/Checkbox/__tests__/fixtures/A11yDemos.js +22 -0
- package/es/CitySelector/CitySelector.types.d.ts +0 -1
- package/es/Collapse/Collapse.d.ts +1 -1
- package/es/Collapse/Collapse.js +26 -12
- package/es/Collapse/Collapse.miniapp.d.ts +10 -0
- package/es/Collapse/Collapse.miniapp.js +236 -0
- package/es/Collapse/index.css +40 -1
- package/es/CollapsePanel/index.css +1 -1
- package/es/Countdown/Countdown.js +61 -21
- package/es/Countdown/Countdown.types.d.ts +19 -15
- package/es/Countdown/__tests__/fixtures/A11yDemos.d.ts +23 -0
- package/es/Countdown/__tests__/fixtures/A11yDemos.js +68 -0
- package/es/Countdown/index.css +11 -0
- package/es/DatePicker/DatePicker.d.ts +4 -0
- package/es/DatePicker/DatePicker.js +308 -0
- package/es/DatePicker/DatePicker.types.d.ts +36 -0
- package/es/DatePicker/DatePicker.types.js +1 -0
- package/es/DatePicker/constants.d.ts +9 -0
- package/es/DatePicker/constants.js +14 -0
- package/es/DatePicker/index.d.ts +3 -0
- package/es/DatePicker/index.js +8 -0
- package/es/DesktopDatePicker/DesktopDatePicker.css +61 -0
- package/es/DesktopDatePicker/DesktopDatePicker.d.ts +5 -0
- package/es/DesktopDatePicker/DesktopDatePicker.js +253 -0
- package/es/DesktopDatePicker/DesktopDatePicker.types.d.ts +163 -0
- package/es/DesktopDatePicker/DesktopDatePicker.types.js +1 -0
- package/es/DesktopDatePicker/deskTopPickerContainer.css +100 -0
- package/es/DesktopDatePicker/index.css +161 -0
- package/es/DesktopDatePicker/index.d.ts +2 -0
- package/es/DesktopDatePicker/index.js +6 -0
- package/es/DesktopDatePicker/useGetDatePickerContent.d.ts +6 -0
- package/es/DesktopDatePicker/useGetDatePickerContent.js +316 -0
- package/es/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +5 -0
- package/es/DesktopDateTimePicker/DesktopDateTimePicker.js +295 -0
- package/es/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +163 -0
- package/es/DesktopDateTimePicker/DesktopDateTimePicker.types.js +1 -0
- package/es/DesktopDateTimePicker/index.css +66 -0
- package/es/DesktopDateTimePicker/index.d.ts +2 -0
- package/es/DesktopDateTimePicker/index.js +9 -0
- package/es/DesktopPicker/DesktopPicker.d.ts +5 -0
- package/es/DesktopPicker/DesktopPicker.js +226 -0
- package/es/DesktopPicker/DesktopPicker.types.d.ts +61 -0
- package/es/DesktopPicker/DesktopPicker.types.js +1 -0
- package/es/DesktopPicker/index.css +39 -0
- package/es/DesktopPicker/index.d.ts +2 -0
- package/es/DesktopPicker/index.js +6 -0
- package/es/DesktopPicker/utils/calcAfterMounted.d.ts +2 -0
- package/es/DesktopPicker/utils/calcAfterMounted.js +6 -0
- package/es/DesktopPicker/utils/calcAfterMounted.miniapp.d.ts +2 -0
- package/es/DesktopPicker/utils/calcAfterMounted.miniapp.js +9 -0
- package/es/DesktopTimePicker/DesktopTimePicker.d.ts +5 -0
- package/es/DesktopTimePicker/DesktopTimePicker.js +261 -0
- package/es/DesktopTimePicker/DesktopTimePicker.types.d.ts +182 -0
- package/es/DesktopTimePicker/DesktopTimePicker.types.js +1 -0
- package/es/DesktopTimePicker/DesktopTimePickerList.d.ts +4 -0
- package/es/DesktopTimePicker/DesktopTimePickerList.js +84 -0
- package/es/DesktopTimePicker/index.css +170 -0
- package/es/DesktopTimePicker/index.d.ts +2 -0
- package/es/DesktopTimePicker/index.js +6 -0
- package/es/DesktopTimePicker/useGetTimePickerContent.d.ts +6 -0
- package/es/DesktopTimePicker/useGetTimePickerContent.js +226 -0
- package/es/DesktopTimePicker/utils/scrollUtil.d.ts +2 -0
- package/es/DesktopTimePicker/utils/scrollUtil.js +8 -0
- package/es/DesktopTimePicker/utils/scrollUtil.miniapp.d.ts +2 -0
- package/es/DesktopTimePicker/utils/scrollUtil.miniapp.js +22 -0
- package/es/DesktopTimePicker/utils/utils.d.ts +28 -0
- package/es/DesktopTimePicker/utils/utils.js +365 -0
- package/es/Dialog/Dialog.d.ts +5 -2
- package/es/Dialog/Dialog.js +57 -35
- package/es/Dialog/Dialog.types.d.ts +50 -22
- package/es/Dialog/FunctionalDialog.d.ts +10 -3
- package/es/Dialog/FunctionalDialog.js +106 -84
- package/es/Dialog/__tests__/fixtures/A11yDemos.d.ts +9 -0
- package/es/Dialog/__tests__/fixtures/A11yDemos.js +43 -0
- package/es/Dialog/index.css +19 -19
- package/es/Dialog/index.d.ts +4 -1
- package/es/Dialog/index.js +10 -3
- package/es/Drawer/Drawer.js +8 -8
- package/es/Drawer/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/es/Drawer/__tests__/fixtures/A11yDemos.js +112 -0
- package/es/Fade/Fade.js +2 -2
- package/es/Fade/Fade.miniapp.d.ts +10 -0
- package/es/Fade/Fade.miniapp.js +179 -0
- package/es/Fade/index.css +18 -0
- package/es/IconButton/IconButton.js +23 -8
- package/es/IconButton/IconButton.types.d.ts +35 -1
- package/es/IconButton/index.css +3 -0
- package/es/Image/Image.js +17 -10
- package/es/Image/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/es/Image/__tests__/fixtures/A11yDemos.js +92 -0
- package/es/Image/index.css +3 -8
- package/es/Input/Input.js +5 -3
- package/es/Input/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/es/Input/__tests__/fixtures/A11yDemos.js +43 -0
- package/es/Input/index.css +8 -8
- package/es/ItemSelector/ItemSelector.types.d.ts +0 -1
- package/es/Modal/Modal.js +48 -48
- package/es/Modal/Modal.miniapp.d.ts +2 -2
- package/es/Modal/Modal.miniapp.js +49 -33
- package/es/Modal/Modal.types.d.ts +26 -2
- package/es/Modal/ModalManager.d.ts +21 -0
- package/es/Modal/ModalManager.js +214 -0
- package/es/Modal/__tests__/fixtures/A11yDemos.d.ts +8 -0
- package/es/Modal/__tests__/fixtures/A11yDemos.js +18 -0
- package/es/Modal/index.css +1 -1
- package/es/Modal/index.d.ts +3 -0
- package/es/Modal/index.js +6 -1
- package/es/Modal/useModal.d.ts +24 -0
- package/es/Modal/useModal.js +169 -0
- package/es/NavBar/index.css +2 -2
- package/es/Picker/Picker.css +4 -0
- package/es/Picker/Picker.js +72 -18
- package/es/Picker/Picker.types.d.ts +15 -2
- package/es/Picker/PickerPanel.css +4 -0
- package/es/Picker/PickerPanel.js +52 -41
- package/es/Picker/__tests__/fixtures/A11yDemos.d.ts +2 -0
- package/es/Picker/__tests__/fixtures/A11yDemos.js +46 -0
- package/es/Picker/index.css +8 -0
- package/es/Picker/utils.d.ts +8 -5
- package/es/Picker/utils.js +9 -12
- package/es/Popover/Popover.js +130 -99
- package/es/Popover/Popover.types.d.ts +44 -7
- package/es/Popover/__tests__/fixtures/A11yDemos.d.ts +25 -0
- package/es/Popover/__tests__/fixtures/A11yDemos.js +135 -0
- package/es/Popover/hooks/index.d.ts +8 -0
- package/es/Popover/hooks/index.js +10 -0
- package/es/Popover/hooks/usePopoverA11y.d.ts +14 -0
- package/es/Popover/hooks/usePopoverA11y.js +43 -0
- package/es/Popover/hooks/usePopoverEvents.d.ts +21 -0
- package/es/Popover/hooks/usePopoverEvents.js +127 -0
- package/es/Popover/hooks/usePopoverPosition.d.ts +17 -0
- package/es/Popover/hooks/usePopoverPosition.js +105 -0
- package/es/Popover/hooks/usePopoverState.d.ts +16 -0
- package/es/Popover/hooks/usePopoverState.js +31 -0
- package/es/Portal/Portal.miniapp.js +21 -12
- package/es/Portal/Portal.types.d.ts +1 -1
- package/es/Portal/PortalCore.js +2 -2
- package/es/Progress/Progress.js +61 -6
- package/es/Progress/Progress.types.d.ts +44 -0
- package/es/Progress/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/es/Progress/__tests__/fixtures/A11yDemos.js +62 -0
- package/es/Radio/Radio.js +5 -4
- package/es/Radio/RadioGroup.js +1 -1
- package/es/Radio/__tests__/fixtures/A11yDemos.d.ts +15 -0
- package/es/Radio/__tests__/fixtures/A11yDemos.js +22 -0
- package/es/Rating/index.css +8 -12
- package/es/ScrollView/ScrollView.js +51 -197
- package/es/ScrollView/ScrollView.types.d.ts +120 -86
- package/es/ScrollView/__tests__/fixtures/A11yDemos.d.ts +7 -0
- package/es/ScrollView/__tests__/fixtures/A11yDemos.js +283 -0
- package/es/ScrollView/useScrollView.d.ts +10 -0
- package/es/ScrollView/useScrollView.js +279 -0
- package/es/Select/Select.js +73 -40
- package/es/Select/Select.types.d.ts +2 -2
- package/es/Select/SelectOption.js +5 -1
- package/es/Select/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/es/Select/__tests__/fixtures/A11yDemos.js +118 -0
- package/es/Select/index.css +12 -8
- package/es/Select/selectContext.d.ts +0 -1
- package/es/Slide/Slide.js +2 -2
- package/es/Slide/Slide.miniapp.d.ts +14 -0
- package/es/Slide/Slide.miniapp.js +192 -0
- package/es/Slide/index.css +72 -0
- package/es/Slider/Slider.js +16 -6
- package/es/Stack/demo/index.css +2 -0
- package/es/SwipeAction/SwipeAction.css +79 -0
- package/es/SwipeAction/SwipeAction.d.ts +5 -0
- package/es/SwipeAction/SwipeAction.js +334 -0
- package/es/SwipeAction/SwipeAction.types.d.ts +75 -0
- package/es/SwipeAction/SwipeAction.types.js +1 -0
- package/es/SwipeAction/SwipeActionContext.d.ts +3 -0
- package/es/SwipeAction/SwipeActionContext.js +11 -0
- package/es/SwipeAction/SwipeActionItem.css +31 -0
- package/es/SwipeAction/SwipeActionItem.d.ts +5 -0
- package/es/SwipeAction/SwipeActionItem.js +78 -0
- package/es/SwipeAction/constants.d.ts +9 -0
- package/es/SwipeAction/constants.js +15 -0
- package/es/SwipeAction/index.css +110 -0
- package/es/SwipeAction/index.d.ts +5 -0
- package/es/SwipeAction/index.js +12 -0
- package/es/Swiper/Swiper.js +18 -4
- package/es/Switch/Switch.js +5 -4
- package/es/Switch/__tests__/fixtures/A11yDemos.d.ts +15 -0
- package/es/Switch/__tests__/fixtures/A11yDemos.js +22 -0
- package/es/Tabs/Tab.js +36 -21
- package/es/Tabs/Tab.types.d.ts +1 -1
- package/es/Tabs/TabPanel.d.ts +1 -1
- package/es/Tabs/TabPanel.js +8 -4
- package/es/Tabs/Tabs.css +2 -2
- package/es/Tabs/Tabs.js +87 -64
- package/es/Tabs/Tabs.types.d.ts +1 -1
- package/es/Tabs/TabsContext.d.ts +4 -5
- package/es/Tabs/TabsContext.js +3 -1
- package/es/Tabs/index.css +2 -2
- package/es/Tabs/utils/scroll.d.ts +2 -0
- package/es/Tabs/utils/scroll.js +36 -0
- package/es/Tag/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/es/Tag/__tests__/fixtures/A11yDemos.js +160 -0
- package/es/TextArea/TextArea.js +51 -8
- package/es/TextArea/TextArea.types.d.ts +28 -0
- package/es/TextArea/__tests__/fixtures/A11yDemos.d.ts +19 -0
- package/es/TextArea/__tests__/fixtures/A11yDemos.js +54 -0
- package/es/TextArea/index.css +4 -4
- package/es/ThemeProvider/ThemeProvider.types.d.ts +2 -2
- package/es/Toast/FunctionalToast.d.ts +2 -2
- package/es/Toast/FunctionalToast.js +186 -86
- package/es/Toast/Toast.d.ts +2 -2
- package/es/Toast/Toast.js +69 -28
- package/es/Toast/Toast.types.d.ts +13 -10
- package/es/Toast/__tests__/fixtures/A11yDemos.d.ts +2 -0
- package/es/Toast/__tests__/fixtures/A11yDemos.js +21 -0
- package/es/Toast/index.css +0 -1
- package/es/Tooltip/Tooltip.js +64 -114
- package/es/Tooltip/Tooltip.types.d.ts +94 -43
- package/es/Tooltip/__tests__/fixtures/A11yDemos.d.ts +25 -0
- package/es/Tooltip/__tests__/fixtures/A11yDemos.js +60 -0
- package/es/Tooltip/useTooltip.d.ts +29 -0
- package/es/Tooltip/useTooltip.js +290 -0
- package/es/Transition/TransitionCore.js +31 -26
- package/es/TransitionGroup/TransitionGroup.d.ts +7 -0
- package/es/TransitionGroup/TransitionGroup.js +109 -0
- package/es/TransitionGroup/TransitionGroup.types.d.ts +47 -0
- package/es/TransitionGroup/TransitionGroup.types.js +1 -0
- package/es/TransitionGroup/demo/TransitionGroupDemo.d.ts +4 -0
- package/es/TransitionGroup/demo/TransitionGroupDemo.js +39 -0
- package/es/TransitionGroup/demo/index.css +33 -0
- package/es/TransitionGroup/index.d.ts +2 -0
- package/es/TransitionGroup/index.js +6 -0
- package/es/TransitionGroup/utils/childMapping.d.ts +27 -0
- package/es/TransitionGroup/utils/childMapping.js +93 -0
- package/es/_.._/benchmarks/components/Button.js +8 -0
- package/es/_.._/benchmarks/components/Input.js +12 -0
- package/es/_.._/benchmarks/components/Tabs.js +17 -0
- package/es/index.d.ts +8 -0
- package/es/index.js +8 -0
- package/es/locales/base.d.ts +40 -1
- package/es/locales/en-US.js +54 -2
- package/es/locales/zh-CN.js +56 -1
- package/es/locales/zh-TW.js +56 -1
- package/package.json +9 -6
- package/dist/Tabs/utils/bound.d.ts +0 -1
- package/es/Tabs/utils/bound.d.ts +0 -1
- package/es/Tabs/utils/bound.js +0 -13
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PopoverProps } from '../Popover.types';
|
|
3
|
+
type TriggerType = PopoverProps['trigger'];
|
|
4
|
+
export interface UsePopoverEventsProps {
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
controlByUser: boolean;
|
|
7
|
+
trigger: TriggerType;
|
|
8
|
+
onShow: (event: React.SyntheticEvent | Event) => void;
|
|
9
|
+
onHide: (event: React.SyntheticEvent | Event) => void;
|
|
10
|
+
onTriggerClick: (event: React.SyntheticEvent | Event) => void;
|
|
11
|
+
onMounted: () => void;
|
|
12
|
+
handleKeyDown: (event: KeyboardEvent) => void;
|
|
13
|
+
tipRef: React.RefObject<HTMLDivElement>;
|
|
14
|
+
childrenRef: React.RefObject<Element>;
|
|
15
|
+
}
|
|
16
|
+
export interface UsePopoverEventsReturn {
|
|
17
|
+
triggerEventOption?: Record<string, unknown>;
|
|
18
|
+
backdropProps?: Record<string, unknown>;
|
|
19
|
+
}
|
|
20
|
+
export declare const usePopoverEvents: ({ isOpen, controlByUser, trigger, onShow, onHide, onTriggerClick, onMounted, handleKeyDown, tipRef, childrenRef, }: UsePopoverEventsProps) => UsePopoverEventsReturn;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var usePopoverEvents_exports = {};
|
|
19
|
+
__export(usePopoverEvents_exports, {
|
|
20
|
+
usePopoverEvents: () => usePopoverEvents
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(usePopoverEvents_exports);
|
|
23
|
+
var import_react = require("react");
|
|
24
|
+
var import_utils = require("@bifrostui/utils");
|
|
25
|
+
const getScrollParents = (element) => {
|
|
26
|
+
const scrollParents = [];
|
|
27
|
+
let parent = element.parentElement;
|
|
28
|
+
while (parent && parent !== document.body) {
|
|
29
|
+
const { overflow, overflowX, overflowY } = getComputedStyle(parent);
|
|
30
|
+
if (/auto|scroll|overlay|hidden/.test(overflow + overflowX + overflowY)) {
|
|
31
|
+
scrollParents.push(parent);
|
|
32
|
+
}
|
|
33
|
+
parent = parent.parentElement;
|
|
34
|
+
}
|
|
35
|
+
return scrollParents;
|
|
36
|
+
};
|
|
37
|
+
const usePopoverEvents = ({
|
|
38
|
+
isOpen,
|
|
39
|
+
controlByUser,
|
|
40
|
+
trigger,
|
|
41
|
+
onShow,
|
|
42
|
+
onHide,
|
|
43
|
+
onTriggerClick,
|
|
44
|
+
onMounted,
|
|
45
|
+
handleKeyDown,
|
|
46
|
+
tipRef,
|
|
47
|
+
childrenRef
|
|
48
|
+
}) => {
|
|
49
|
+
const clickEventHandler = (event) => {
|
|
50
|
+
if (trigger === "hover" || trigger === "none" || (trigger == null ? void 0 : trigger.length) === 1 && (trigger == null ? void 0 : trigger[0]) === "hover")
|
|
51
|
+
return;
|
|
52
|
+
onHide(event);
|
|
53
|
+
};
|
|
54
|
+
(0, import_react.useEffect)(() => {
|
|
55
|
+
let scrollParents = [];
|
|
56
|
+
let resizeObserver = null;
|
|
57
|
+
const bindEvent = () => {
|
|
58
|
+
if (isOpen && !import_utils.isMini) {
|
|
59
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
60
|
+
}
|
|
61
|
+
if (!tipRef.current)
|
|
62
|
+
return;
|
|
63
|
+
if (!controlByUser && trigger !== "none" && trigger !== "hover" && !((trigger == null ? void 0 : trigger.length) === 1 && (trigger == null ? void 0 : trigger[0]) === "hover") && !import_utils.isMini) {
|
|
64
|
+
document.addEventListener("click", clickEventHandler);
|
|
65
|
+
}
|
|
66
|
+
if (!import_utils.isMini) {
|
|
67
|
+
window.addEventListener("resize", onMounted);
|
|
68
|
+
window.addEventListener("scroll", onMounted, true);
|
|
69
|
+
if (childrenRef.current) {
|
|
70
|
+
scrollParents = getScrollParents(childrenRef.current);
|
|
71
|
+
scrollParents.forEach((parent) => {
|
|
72
|
+
parent.addEventListener("scroll", onMounted);
|
|
73
|
+
});
|
|
74
|
+
if (isOpen && typeof ResizeObserver !== "undefined") {
|
|
75
|
+
resizeObserver = new ResizeObserver(() => {
|
|
76
|
+
setTimeout(() => {
|
|
77
|
+
onMounted();
|
|
78
|
+
}, 0);
|
|
79
|
+
});
|
|
80
|
+
resizeObserver.observe(childrenRef.current);
|
|
81
|
+
scrollParents.forEach((parent) => {
|
|
82
|
+
if (resizeObserver) {
|
|
83
|
+
resizeObserver.observe(parent);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
resizeObserver.observe(document.body);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
const unbindEvent = () => {
|
|
92
|
+
if (!import_utils.isMini) {
|
|
93
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
94
|
+
}
|
|
95
|
+
if (!controlByUser && trigger !== "none" && trigger !== "hover" && !((trigger == null ? void 0 : trigger.length) === 1 && (trigger == null ? void 0 : trigger[0]) === "hover") && !import_utils.isMini) {
|
|
96
|
+
document.removeEventListener("click", clickEventHandler);
|
|
97
|
+
}
|
|
98
|
+
if (!import_utils.isMini) {
|
|
99
|
+
window.removeEventListener("resize", onMounted);
|
|
100
|
+
window.removeEventListener("scroll", onMounted, true);
|
|
101
|
+
scrollParents.forEach((parent) => {
|
|
102
|
+
parent.removeEventListener("scroll", onMounted);
|
|
103
|
+
});
|
|
104
|
+
if (resizeObserver) {
|
|
105
|
+
resizeObserver.disconnect();
|
|
106
|
+
resizeObserver = null;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
bindEvent();
|
|
111
|
+
return () => {
|
|
112
|
+
unbindEvent();
|
|
113
|
+
};
|
|
114
|
+
}, [
|
|
115
|
+
isOpen,
|
|
116
|
+
handleKeyDown,
|
|
117
|
+
controlByUser,
|
|
118
|
+
trigger,
|
|
119
|
+
onHide,
|
|
120
|
+
onMounted,
|
|
121
|
+
tipRef,
|
|
122
|
+
childrenRef
|
|
123
|
+
]);
|
|
124
|
+
let triggerEventOption;
|
|
125
|
+
if (!controlByUser && trigger !== "none") {
|
|
126
|
+
triggerEventOption = (0, import_utils.triggerEventTransform)({
|
|
127
|
+
trigger,
|
|
128
|
+
click: onTriggerClick,
|
|
129
|
+
show: onShow,
|
|
130
|
+
hide: onHide
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
let backdropProps;
|
|
134
|
+
if (import_utils.isMini && isOpen && !controlByUser && trigger !== "none" && trigger !== "hover" && !((trigger == null ? void 0 : trigger.length) === 1 && (trigger == null ? void 0 : trigger[0]) === "hover")) {
|
|
135
|
+
backdropProps = {
|
|
136
|
+
onClick: (event) => {
|
|
137
|
+
event.stopPropagation();
|
|
138
|
+
onHide(event);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
triggerEventOption,
|
|
144
|
+
backdropProps
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
148
|
+
0 && (module.exports = {
|
|
149
|
+
usePopoverEvents
|
|
150
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AnchorOrigin } from '../Popover.types';
|
|
3
|
+
export interface UsePopoverPositionProps {
|
|
4
|
+
anchorOrigin: AnchorOrigin;
|
|
5
|
+
offsetSpacing: number;
|
|
6
|
+
isOpen: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface UsePopoverPositionReturn {
|
|
9
|
+
arrowDirection: string;
|
|
10
|
+
arrowLocation: string;
|
|
11
|
+
toolStyles: React.CSSProperties;
|
|
12
|
+
tipRef: React.RefObject<HTMLDivElement>;
|
|
13
|
+
childrenRef: React.RefObject<Element>;
|
|
14
|
+
onMounted: () => void;
|
|
15
|
+
clearRef: (status: boolean) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare const usePopoverPosition: ({ anchorOrigin, offsetSpacing, isOpen, }: UsePopoverPositionProps) => UsePopoverPositionReturn;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var __async = (__this, __arguments, generator) => {
|
|
19
|
+
return new Promise((resolve, reject) => {
|
|
20
|
+
var fulfilled = (value) => {
|
|
21
|
+
try {
|
|
22
|
+
step(generator.next(value));
|
|
23
|
+
} catch (e) {
|
|
24
|
+
reject(e);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
var rejected = (value) => {
|
|
28
|
+
try {
|
|
29
|
+
step(generator.throw(value));
|
|
30
|
+
} catch (e) {
|
|
31
|
+
reject(e);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
35
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
var usePopoverPosition_exports = {};
|
|
39
|
+
__export(usePopoverPosition_exports, {
|
|
40
|
+
usePopoverPosition: () => usePopoverPosition
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(usePopoverPosition_exports);
|
|
43
|
+
var import_react = require("react");
|
|
44
|
+
var import_utils = require("@bifrostui/utils");
|
|
45
|
+
const anchorOriginToPlacement = (anchorOrigin) => {
|
|
46
|
+
const { vertical, horizontal } = anchorOrigin;
|
|
47
|
+
if (vertical === "center" && horizontal === "center") {
|
|
48
|
+
return "top";
|
|
49
|
+
}
|
|
50
|
+
if (horizontal === "center") {
|
|
51
|
+
return vertical;
|
|
52
|
+
}
|
|
53
|
+
const horizontalMap = {
|
|
54
|
+
left: "Left",
|
|
55
|
+
right: "Right"
|
|
56
|
+
};
|
|
57
|
+
if (vertical === "center") {
|
|
58
|
+
return horizontal;
|
|
59
|
+
}
|
|
60
|
+
return `${vertical}${horizontalMap[horizontal]}`;
|
|
61
|
+
};
|
|
62
|
+
const usePopoverPosition = ({
|
|
63
|
+
anchorOrigin,
|
|
64
|
+
offsetSpacing,
|
|
65
|
+
isOpen
|
|
66
|
+
}) => {
|
|
67
|
+
const placement = anchorOriginToPlacement(anchorOrigin);
|
|
68
|
+
const { direction, location = "center" } = (0, import_utils.parsePlacement)(placement);
|
|
69
|
+
const childrenRef = (0, import_react.useRef)();
|
|
70
|
+
const [arrowDirection, setArrowDirection] = (0, import_react.useState)(direction);
|
|
71
|
+
const [arrowLocation, setArrowLocation] = (0, import_react.useState)(location);
|
|
72
|
+
const [toolStyles, setToolStyles] = (0, import_react.useState)({});
|
|
73
|
+
const tipRef = (0, import_react.useRef)(null);
|
|
74
|
+
const clearRef = (status) => {
|
|
75
|
+
if (status === false) {
|
|
76
|
+
tipRef.current = null;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const onMounted = (0, import_utils.throttle)(() => __async(void 0, null, function* () {
|
|
80
|
+
if (!tipRef.current)
|
|
81
|
+
return;
|
|
82
|
+
const {
|
|
83
|
+
direction: newParsedDirection,
|
|
84
|
+
location: newParsedLocation = "center"
|
|
85
|
+
} = (0, import_utils.parsePlacement)(placement);
|
|
86
|
+
const result = yield (0, import_utils.getStylesAndLocation)({
|
|
87
|
+
childrenRef,
|
|
88
|
+
arrowDirection: newParsedDirection,
|
|
89
|
+
arrowLocation: newParsedLocation,
|
|
90
|
+
offsetSpacing,
|
|
91
|
+
tipRef
|
|
92
|
+
});
|
|
93
|
+
if (!result)
|
|
94
|
+
return;
|
|
95
|
+
const { styles, newArrowDirection, newArrowLocation } = result;
|
|
96
|
+
if (newArrowDirection !== arrowDirection) {
|
|
97
|
+
setArrowDirection(newArrowDirection);
|
|
98
|
+
}
|
|
99
|
+
if (newArrowLocation !== arrowLocation) {
|
|
100
|
+
setArrowLocation(newArrowLocation);
|
|
101
|
+
}
|
|
102
|
+
setToolStyles(styles);
|
|
103
|
+
}), 16);
|
|
104
|
+
(0, import_react.useEffect)(() => {
|
|
105
|
+
if (!isOpen) {
|
|
106
|
+
setToolStyles({
|
|
107
|
+
visibility: "hidden"
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}, [isOpen]);
|
|
111
|
+
return {
|
|
112
|
+
arrowDirection,
|
|
113
|
+
arrowLocation,
|
|
114
|
+
toolStyles,
|
|
115
|
+
tipRef,
|
|
116
|
+
childrenRef,
|
|
117
|
+
onMounted,
|
|
118
|
+
clearRef
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
122
|
+
0 && (module.exports = {
|
|
123
|
+
usePopoverPosition
|
|
124
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface UsePopoverStateProps {
|
|
3
|
+
defaultOpen?: boolean;
|
|
4
|
+
open?: boolean;
|
|
5
|
+
onOpenChange?: (event: React.SyntheticEvent | Event, data: {
|
|
6
|
+
open: boolean;
|
|
7
|
+
}) => void;
|
|
8
|
+
}
|
|
9
|
+
export interface UsePopoverStateReturn {
|
|
10
|
+
isOpen: boolean;
|
|
11
|
+
openStatus: boolean;
|
|
12
|
+
controlByUser: boolean;
|
|
13
|
+
changeOpenStatus: (event: React.SyntheticEvent | Event, status: boolean) => void;
|
|
14
|
+
setOpenStatus: React.Dispatch<React.SetStateAction<boolean>>;
|
|
15
|
+
}
|
|
16
|
+
export declare const usePopoverState: ({ defaultOpen, open, onOpenChange, }: UsePopoverStateProps) => UsePopoverStateReturn;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var usePopoverState_exports = {};
|
|
19
|
+
__export(usePopoverState_exports, {
|
|
20
|
+
usePopoverState: () => usePopoverState
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(usePopoverState_exports);
|
|
23
|
+
var import_react = require("react");
|
|
24
|
+
const usePopoverState = ({
|
|
25
|
+
defaultOpen = false,
|
|
26
|
+
open,
|
|
27
|
+
onOpenChange
|
|
28
|
+
}) => {
|
|
29
|
+
const controlByUser = typeof open !== "undefined";
|
|
30
|
+
const [openStatus, setOpenStatus] = (0, import_react.useState)(defaultOpen);
|
|
31
|
+
const isOpen = controlByUser ? open : openStatus;
|
|
32
|
+
const changeOpenStatus = (event, status) => {
|
|
33
|
+
if (controlByUser)
|
|
34
|
+
return;
|
|
35
|
+
setOpenStatus(status);
|
|
36
|
+
onOpenChange == null ? void 0 : onOpenChange(event, { open: status });
|
|
37
|
+
};
|
|
38
|
+
(0, import_react.useEffect)(() => {
|
|
39
|
+
if (!controlByUser)
|
|
40
|
+
return;
|
|
41
|
+
setOpenStatus(open);
|
|
42
|
+
}, [open, controlByUser]);
|
|
43
|
+
return {
|
|
44
|
+
isOpen,
|
|
45
|
+
openStatus,
|
|
46
|
+
controlByUser,
|
|
47
|
+
changeOpenStatus,
|
|
48
|
+
setOpenStatus
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
+
0 && (module.exports = {
|
|
53
|
+
usePopoverState
|
|
54
|
+
});
|
|
@@ -53,24 +53,33 @@ var import_react = __toESM(require("react"));
|
|
|
53
53
|
var import_PortalCore = __toESM(require("./PortalCore"));
|
|
54
54
|
const Portal = (0, import_react.forwardRef)((props, ref) => {
|
|
55
55
|
const { disablePortal } = props;
|
|
56
|
-
const rootWrapperElement = (0, import_react.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
56
|
+
const [rootWrapperElement, setRootWrapperElement] = (0, import_react.useState)();
|
|
57
|
+
const initialPageInfo = (0, import_react.useMemo)(() => {
|
|
58
|
+
const currentPages = import_taro.default.getCurrentPages() || [];
|
|
59
|
+
const currentPage = currentPages[currentPages.length - 1];
|
|
60
|
+
return {
|
|
61
|
+
path: currentPage == null ? void 0 : currentPage.$taroPath
|
|
62
|
+
};
|
|
63
|
+
}, []);
|
|
64
|
+
(0, import_react.useLayoutEffect)(() => {
|
|
65
|
+
let root;
|
|
66
|
+
if (!disablePortal && initialPageInfo.path) {
|
|
67
|
+
const { path } = initialPageInfo;
|
|
68
|
+
const rootElement = document.getElementById(path);
|
|
69
|
+
const elementWithSid = rootElement;
|
|
70
|
+
const portalId = (elementWithSid == null ? void 0 : elementWithSid.sid) ? `${elementWithSid.sid}_portalId` : `${path}_portalId`;
|
|
63
71
|
const portalWrapperElement = document.getElementById(portalId);
|
|
64
72
|
if (!portalWrapperElement) {
|
|
65
73
|
const view = document.createElement("view");
|
|
66
74
|
view.id = portalId;
|
|
67
75
|
rootElement == null ? void 0 : rootElement.appendChild(view);
|
|
68
|
-
|
|
76
|
+
root = view;
|
|
77
|
+
} else {
|
|
78
|
+
root = portalWrapperElement;
|
|
69
79
|
}
|
|
70
|
-
return portalWrapperElement;
|
|
71
80
|
}
|
|
72
|
-
|
|
73
|
-
}, []);
|
|
81
|
+
setRootWrapperElement(root);
|
|
82
|
+
}, [disablePortal, initialPageInfo.path]);
|
|
74
83
|
return /* @__PURE__ */ import_react.default.createElement(import_PortalCore.default, __spreadProps(__spreadValues({}, props), { ref, rootElement: rootWrapperElement }));
|
|
75
84
|
});
|
|
76
85
|
Portal.displayName = "BuiPortal";
|
|
@@ -43,7 +43,7 @@ const PortalCore = /* @__PURE__ */ import_react.default.forwardRef(
|
|
|
43
43
|
container,
|
|
44
44
|
disablePortal = false,
|
|
45
45
|
rootElement,
|
|
46
|
-
|
|
46
|
+
onMounted
|
|
47
47
|
} = props;
|
|
48
48
|
const [mountNode, setMountNode] = import_react.default.useState(null);
|
|
49
49
|
const handleRef = (0, import_utils.useForkRef)(
|
|
@@ -59,7 +59,7 @@ const PortalCore = /* @__PURE__ */ import_react.default.forwardRef(
|
|
|
59
59
|
(0, import_react.useLayoutEffect)(() => {
|
|
60
60
|
if (mountNode && !disablePortal) {
|
|
61
61
|
(0, import_utils.setRef)(ref, mountNode);
|
|
62
|
-
|
|
62
|
+
onMounted == null ? void 0 : onMounted(mountNode);
|
|
63
63
|
return () => {
|
|
64
64
|
(0, import_utils.setRef)(ref, null);
|
|
65
65
|
};
|
|
@@ -59,6 +59,7 @@ __export(Progress_exports, {
|
|
|
59
59
|
module.exports = __toCommonJS(Progress_exports);
|
|
60
60
|
var import_clsx = __toESM(require("clsx"));
|
|
61
61
|
var import_react = __toESM(require("react"));
|
|
62
|
+
var import_locales = require("../locales");
|
|
62
63
|
var import_index = require("./index.css");
|
|
63
64
|
const prefixCls = "bui-progress";
|
|
64
65
|
function validProgress(progress) {
|
|
@@ -94,20 +95,55 @@ const handleGradient = (strokeColor) => {
|
|
|
94
95
|
}
|
|
95
96
|
return { backgroundImage: `linear-gradient(${direction}, ${from}, ${to})` };
|
|
96
97
|
};
|
|
98
|
+
function getAriaValueText(progress, t) {
|
|
99
|
+
const validatedProgress = validProgress(progress);
|
|
100
|
+
if (validatedProgress === 0)
|
|
101
|
+
return t.notStarted;
|
|
102
|
+
if (validatedProgress < 10)
|
|
103
|
+
return t.justBegun;
|
|
104
|
+
if (validatedProgress < 25)
|
|
105
|
+
return t.gettingStarted;
|
|
106
|
+
if (validatedProgress < 50)
|
|
107
|
+
return t.inProgress;
|
|
108
|
+
if (validatedProgress < 75)
|
|
109
|
+
return t.moreThanHalfway;
|
|
110
|
+
if (validatedProgress < 90)
|
|
111
|
+
return t.nearingCompletion;
|
|
112
|
+
if (validatedProgress < 100)
|
|
113
|
+
return t.almostComplete;
|
|
114
|
+
return t.complete;
|
|
115
|
+
}
|
|
97
116
|
const Progress = /* @__PURE__ */ import_react.default.forwardRef(
|
|
98
117
|
(props, ref) => {
|
|
118
|
+
const progressText = (0, import_locales.useLocaleText)("progress");
|
|
99
119
|
const _a = props, {
|
|
100
120
|
className,
|
|
101
|
-
percent,
|
|
102
|
-
strokeWidth,
|
|
103
|
-
strokeColor,
|
|
104
|
-
trailColor
|
|
121
|
+
percent = 0,
|
|
122
|
+
strokeWidth: strokeWidth,
|
|
123
|
+
strokeColor: strokeColor,
|
|
124
|
+
trailColor: trailColor,
|
|
125
|
+
// 轨道颜色
|
|
126
|
+
"aria-label": ariaLabel = progressText.labelName,
|
|
127
|
+
"aria-labelledby": ariaLabelledby = "",
|
|
128
|
+
"aria-valuenow": ariaValueNow,
|
|
129
|
+
"aria-valuemin": ariaValueMin = 0,
|
|
130
|
+
"aria-valuemax": ariaValueMax = 100,
|
|
131
|
+
"aria-valuetext": ariaValueText
|
|
105
132
|
} = _a, others = __objRest(_a, [
|
|
106
133
|
"className",
|
|
107
134
|
"percent",
|
|
135
|
+
// 当前进度百分比
|
|
108
136
|
"strokeWidth",
|
|
137
|
+
// 进度条高度
|
|
109
138
|
"strokeColor",
|
|
110
|
-
|
|
139
|
+
// 进度条颜色或渐变
|
|
140
|
+
"trailColor",
|
|
141
|
+
"aria-label",
|
|
142
|
+
"aria-labelledby",
|
|
143
|
+
"aria-valuenow",
|
|
144
|
+
"aria-valuemin",
|
|
145
|
+
"aria-valuemax",
|
|
146
|
+
"aria-valuetext"
|
|
111
147
|
]);
|
|
112
148
|
const backgroundProps = strokeColor && typeof strokeColor !== "string" ? handleGradient(strokeColor) : {
|
|
113
149
|
background: strokeColor
|
|
@@ -119,7 +155,26 @@ const Progress = /* @__PURE__ */ import_react.default.forwardRef(
|
|
|
119
155
|
const trailStyle = {
|
|
120
156
|
background: trailColor || void 0
|
|
121
157
|
};
|
|
122
|
-
|
|
158
|
+
const accessibilityProps = {
|
|
159
|
+
"aria-valuenow": typeof ariaValueNow === "number" ? ariaValueNow : validProgress(percent),
|
|
160
|
+
"aria-label": ariaLabel,
|
|
161
|
+
"aria-labelledby": ariaLabelledby,
|
|
162
|
+
"aria-valuemin": ariaValueMin,
|
|
163
|
+
"aria-valuemax": ariaValueMax,
|
|
164
|
+
"aria-valuetext": ariaValueText !== void 0 ? ariaValueText : getAriaValueText(percent, progressText),
|
|
165
|
+
role: "progressbar"
|
|
166
|
+
};
|
|
167
|
+
return (
|
|
168
|
+
// 外层容器
|
|
169
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
170
|
+
"div",
|
|
171
|
+
__spreadValues(__spreadValues({
|
|
172
|
+
className: (0, import_clsx.default)(prefixCls, className),
|
|
173
|
+
ref
|
|
174
|
+
}, accessibilityProps), others),
|
|
175
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: `${prefixCls}-inner`, style: trailStyle }, /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefixCls}-bg`, style: percentStyle }))
|
|
176
|
+
)
|
|
177
|
+
);
|
|
123
178
|
}
|
|
124
179
|
);
|
|
125
180
|
Progress.displayName = "BuiProgress";
|
|
@@ -22,6 +22,50 @@ export type ProgressProps<D extends React.ElementType = 'div', P = {}> = Overrid
|
|
|
22
22
|
trailColor?: string;
|
|
23
23
|
/** 进度条线的宽度,单位 */
|
|
24
24
|
strokeWidth?: number | string;
|
|
25
|
+
/**
|
|
26
|
+
* 无障碍功能:ARIA标签
|
|
27
|
+
*/
|
|
28
|
+
'aria-label'?: string;
|
|
29
|
+
/**
|
|
30
|
+
* 无障碍功能:描述元素的详细信息
|
|
31
|
+
*/
|
|
32
|
+
'aria-describedby'?: string;
|
|
33
|
+
/**
|
|
34
|
+
* 无障碍功能:是否隐藏元素
|
|
35
|
+
*/
|
|
36
|
+
'aria-hidden'?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* 无障碍功能:元素在无障碍树中的细节程度
|
|
39
|
+
*/
|
|
40
|
+
'aria-details'?: string;
|
|
41
|
+
/**
|
|
42
|
+
* 无障碍功能:当前元素是否处于忙碌状态
|
|
43
|
+
*/
|
|
44
|
+
'aria-busy'?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* 无障碍功能:当前元素是否为只读
|
|
47
|
+
*/
|
|
48
|
+
'aria-readonly'?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* 无障碍功能:当前元素是否为必填
|
|
51
|
+
*/
|
|
52
|
+
'aria-required'?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* 无障碍功能:进度条的当前值
|
|
55
|
+
*/
|
|
56
|
+
'aria-valuenow'?: number;
|
|
57
|
+
/**
|
|
58
|
+
* 无障碍功能:进度条的最小值
|
|
59
|
+
*/
|
|
60
|
+
'aria-valuemin'?: number;
|
|
61
|
+
/**
|
|
62
|
+
* 无障碍功能:进度条的最大值
|
|
63
|
+
*/
|
|
64
|
+
'aria-valuemax'?: number;
|
|
65
|
+
/**
|
|
66
|
+
* 无障碍功能:进度条的文本描述
|
|
67
|
+
*/
|
|
68
|
+
'aria-valuetext'?: string;
|
|
25
69
|
};
|
|
26
70
|
defaultComponent: D;
|
|
27
71
|
}, D>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* 自定义 Progress 组件 Demo 集合
|
|
4
|
+
* 这个文件包含多个测试 demo,展示如何使用 getCustomDemoCodesFromFile 进行无障碍测试
|
|
5
|
+
* 文件名必须是 customDemoComponent.tsx(固定约定)
|
|
6
|
+
*/
|
|
7
|
+
export declare const basicProgressDemo: () => React.JSX.Element;
|
|
8
|
+
export declare const coloredProgressDemo: () => React.JSX.Element;
|
|
9
|
+
export declare const sizedProgressDemo: () => React.JSX.Element;
|
|
10
|
+
export declare const gradientProgressDemo: () => React.JSX.Element;
|
|
11
|
+
export declare const customTrailColorProgressDemo: () => React.JSX.Element;
|
|
12
|
+
export declare const accessibilityProgressDemo: () => React.JSX.Element;
|
|
13
|
+
declare const _default: {
|
|
14
|
+
basicProgressDemo: () => React.JSX.Element;
|
|
15
|
+
coloredProgressDemo: () => React.JSX.Element;
|
|
16
|
+
sizedProgressDemo: () => React.JSX.Element;
|
|
17
|
+
gradientProgressDemo: () => React.JSX.Element;
|
|
18
|
+
customTrailColorProgressDemo: () => React.JSX.Element;
|
|
19
|
+
accessibilityProgressDemo: () => React.JSX.Element;
|
|
20
|
+
};
|
|
21
|
+
export default _default;
|