@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/Tooltip/Tooltip.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
2
4
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
6
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -14,6 +16,7 @@ var __spreadValues = (a, b) => {
|
|
|
14
16
|
}
|
|
15
17
|
return a;
|
|
16
18
|
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
17
20
|
var __objRest = (source, exclude) => {
|
|
18
21
|
var target = {};
|
|
19
22
|
for (var prop in source)
|
|
@@ -27,15 +30,9 @@ var __objRest = (source, exclude) => {
|
|
|
27
30
|
return target;
|
|
28
31
|
};
|
|
29
32
|
import clsx from "clsx";
|
|
30
|
-
import React
|
|
31
|
-
import {
|
|
32
|
-
getStylesAndLocation,
|
|
33
|
-
triggerEventTransform,
|
|
34
|
-
parsePlacement,
|
|
35
|
-
useUniqueId,
|
|
36
|
-
throttle
|
|
37
|
-
} from "@bifrostui/utils";
|
|
33
|
+
import React from "react";
|
|
38
34
|
import Portal from "../Portal";
|
|
35
|
+
import { useTooltip } from "./useTooltip";
|
|
39
36
|
import "./index.css";
|
|
40
37
|
const prefixCls = "bui-tooltip";
|
|
41
38
|
const Tooltip = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
@@ -44,127 +41,80 @@ const Tooltip = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
44
41
|
style,
|
|
45
42
|
children,
|
|
46
43
|
title,
|
|
47
|
-
defaultOpen,
|
|
48
|
-
|
|
44
|
+
defaultOpen = false,
|
|
45
|
+
offset,
|
|
49
46
|
placement = "top",
|
|
50
47
|
trigger = "click",
|
|
48
|
+
open,
|
|
51
49
|
onOpenChange,
|
|
52
|
-
|
|
50
|
+
role: role = "tooltip",
|
|
51
|
+
"aria-label": ariaLabel,
|
|
52
|
+
"aria-labelledby": ariaLabelledby,
|
|
53
|
+
autoFocus = false,
|
|
54
|
+
closeOnEscape = false,
|
|
55
|
+
"aria-hidden": ariaHidden = false
|
|
53
56
|
} = _a, others = __objRest(_a, [
|
|
54
57
|
"className",
|
|
55
58
|
"style",
|
|
56
59
|
"children",
|
|
57
60
|
"title",
|
|
58
61
|
"defaultOpen",
|
|
59
|
-
"
|
|
62
|
+
"offset",
|
|
60
63
|
"placement",
|
|
61
64
|
"trigger",
|
|
65
|
+
"open",
|
|
62
66
|
"onOpenChange",
|
|
63
|
-
|
|
67
|
+
// 无障碍功能相关属性
|
|
68
|
+
"role",
|
|
69
|
+
"aria-label",
|
|
70
|
+
"aria-labelledby",
|
|
71
|
+
"autoFocus",
|
|
72
|
+
"closeOnEscape",
|
|
73
|
+
"aria-hidden"
|
|
64
74
|
]);
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (!controlByUser)
|
|
92
|
-
return;
|
|
93
|
-
setOpenStatus(open);
|
|
94
|
-
}, [open]);
|
|
95
|
-
const clickEventHandler = (event) => {
|
|
96
|
-
if (trigger === "hover" || (trigger == null ? void 0 : trigger.length) === 1 && (trigger == null ? void 0 : trigger[0]) === "hover")
|
|
97
|
-
return;
|
|
98
|
-
hideTooltip(event);
|
|
99
|
-
};
|
|
100
|
-
const onRootElementMouted = throttle(() => {
|
|
101
|
-
const {
|
|
102
|
-
direction: newParsedDirection,
|
|
103
|
-
location: newParsedLocation = "center"
|
|
104
|
-
} = parsePlacement(placement);
|
|
105
|
-
const result = getStylesAndLocation({
|
|
106
|
-
childrenRef,
|
|
107
|
-
arrowDirection: newParsedDirection,
|
|
108
|
-
arrowLocation: newParsedLocation,
|
|
109
|
-
offsetSpacing,
|
|
110
|
-
selector: `[data-id="tt_${ttId}"]`
|
|
111
|
-
});
|
|
112
|
-
if (!result)
|
|
113
|
-
return;
|
|
114
|
-
const { styles, newArrowDirection, newArrowLocation } = result;
|
|
115
|
-
if (newArrowDirection !== arrowDirection) {
|
|
116
|
-
setArrowDirection(newArrowDirection);
|
|
117
|
-
}
|
|
118
|
-
if (newArrowLocation !== arrowLocation) {
|
|
119
|
-
setArrowLocation(newArrowLocation);
|
|
120
|
-
}
|
|
121
|
-
setTooltyles(styles);
|
|
122
|
-
}, 100);
|
|
123
|
-
const bindEvent = () => {
|
|
124
|
-
if (!controlByUser) {
|
|
125
|
-
document.addEventListener("click", clickEventHandler);
|
|
126
|
-
}
|
|
127
|
-
window.addEventListener("resize", onRootElementMouted);
|
|
128
|
-
};
|
|
129
|
-
const unbindEvent = () => {
|
|
130
|
-
if (!controlByUser) {
|
|
131
|
-
document.removeEventListener("click", clickEventHandler);
|
|
132
|
-
}
|
|
133
|
-
window.removeEventListener("resize", onRootElementMouted);
|
|
134
|
-
};
|
|
135
|
-
useEffect(() => {
|
|
136
|
-
bindEvent();
|
|
137
|
-
return () => {
|
|
138
|
-
unbindEvent();
|
|
139
|
-
};
|
|
140
|
-
}, []);
|
|
141
|
-
let triggerEventOption;
|
|
142
|
-
if (!controlByUser) {
|
|
143
|
-
triggerEventOption = triggerEventTransform({
|
|
144
|
-
trigger,
|
|
145
|
-
click: triggerClick,
|
|
146
|
-
show: showTooltip,
|
|
147
|
-
hide: hideTooltip
|
|
148
|
-
});
|
|
75
|
+
const {
|
|
76
|
+
getTooltipProps,
|
|
77
|
+
getChildProps,
|
|
78
|
+
getPortalProps,
|
|
79
|
+
isOpen,
|
|
80
|
+
toolStyles,
|
|
81
|
+
arrowDirection,
|
|
82
|
+
arrowLocation
|
|
83
|
+
} = useTooltip({
|
|
84
|
+
title,
|
|
85
|
+
defaultOpen,
|
|
86
|
+
open,
|
|
87
|
+
offset,
|
|
88
|
+
placement,
|
|
89
|
+
trigger,
|
|
90
|
+
onOpenChange,
|
|
91
|
+
autoFocus,
|
|
92
|
+
closeOnEscape,
|
|
93
|
+
children,
|
|
94
|
+
rootRef: ref
|
|
95
|
+
});
|
|
96
|
+
if (!React.isValidElement(children)) {
|
|
97
|
+
console.warn(
|
|
98
|
+
"BUI Tooltip: children must be a valid React element that can accept a ref."
|
|
99
|
+
);
|
|
100
|
+
return children;
|
|
149
101
|
}
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
102
|
+
const tooltipProps = getTooltipProps(__spreadProps(__spreadValues({}, others), {
|
|
103
|
+
className: clsx(prefixCls, className, `tooltip-${arrowDirection}`),
|
|
104
|
+
style: __spreadValues(__spreadValues({}, style), toolStyles),
|
|
105
|
+
role,
|
|
106
|
+
"aria-label": ariaLabel,
|
|
107
|
+
"aria-labelledby": ariaLabelledby,
|
|
108
|
+
"aria-hidden": ariaHidden
|
|
109
|
+
}));
|
|
110
|
+
const childProps = getChildProps();
|
|
111
|
+
const portalProps = getPortalProps();
|
|
112
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, isOpen && title ? /* @__PURE__ */ React.createElement(Portal, __spreadValues({}, portalProps), /* @__PURE__ */ React.createElement("div", __spreadValues({}, tooltipProps), /* @__PURE__ */ React.createElement(
|
|
154
113
|
"div",
|
|
155
|
-
|
|
156
|
-
className: clsx(
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}, others),
|
|
160
|
-
/* @__PURE__ */ React.createElement(
|
|
161
|
-
"div",
|
|
162
|
-
{
|
|
163
|
-
className: clsx("bui-tooltip-arrow", `location-${arrowLocation}`)
|
|
164
|
-
}
|
|
165
|
-
),
|
|
166
|
-
/* @__PURE__ */ React.createElement("div", { className: "bui-tooltip-content" }, title)
|
|
167
|
-
)) : null, React.isValidElement(children) ? React.cloneElement(children, childrenOptions) : children);
|
|
114
|
+
{
|
|
115
|
+
className: clsx("bui-tooltip-arrow", `location-${arrowLocation}`)
|
|
116
|
+
}
|
|
117
|
+
), /* @__PURE__ */ React.createElement("div", { className: "bui-tooltip-content" }, title))) : null, React.cloneElement(children, childProps));
|
|
168
118
|
});
|
|
169
119
|
Tooltip.displayName = "BuiTooltip";
|
|
170
120
|
var Tooltip_default = Tooltip;
|
|
@@ -1,48 +1,99 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { OverrideProps } from '@bifrostui/types';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* 触发 Tooltip 显示的事件类型
|
|
5
|
+
*/
|
|
6
|
+
export type TooltipTriggerType = 'click' | 'hover';
|
|
7
|
+
/**
|
|
8
|
+
* Tooltip 的位置选项
|
|
9
|
+
*/
|
|
10
|
+
export type TooltipPlacement = 'top' | 'left' | 'right' | 'bottom' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'leftTop' | 'leftBottom' | 'rightTop' | 'rightBottom';
|
|
11
|
+
/**
|
|
12
|
+
* onOpenChange 回调函数的数据参数
|
|
13
|
+
*/
|
|
14
|
+
export interface TooltipOpenChangeData {
|
|
15
|
+
/** 浮层显隐状态 */
|
|
16
|
+
open: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Tooltip 组件的属性接口
|
|
20
|
+
*/
|
|
21
|
+
export interface TooltipBaseProps {
|
|
22
|
+
/**
|
|
23
|
+
* 气泡浮层显示内容
|
|
24
|
+
* 支持文本、React 节点等
|
|
25
|
+
*/
|
|
26
|
+
title?: React.ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* 默认是否显隐
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
defaultOpen?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* 用于手动控制气泡浮层显隐
|
|
34
|
+
* 当提供此属性时,组件变为受控模式
|
|
35
|
+
*/
|
|
36
|
+
open?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* 浮层与目标元素的偏移距离(像素)
|
|
39
|
+
* @default 0
|
|
40
|
+
*/
|
|
41
|
+
offset?: number;
|
|
42
|
+
/**
|
|
43
|
+
* 气泡框相对于目标元素的位置
|
|
44
|
+
* @default 'top'
|
|
45
|
+
*/
|
|
46
|
+
placement?: TooltipPlacement;
|
|
47
|
+
/**
|
|
48
|
+
* 触发 Tooltip 显示的事件类型
|
|
49
|
+
* - 'click': 点击触发
|
|
50
|
+
* - 'hover': 悬停触发
|
|
51
|
+
* - 可以传递数组来组合多种触发方式
|
|
52
|
+
* @default 'click'
|
|
53
|
+
*/
|
|
54
|
+
trigger?: TooltipTriggerType | TooltipTriggerType[];
|
|
55
|
+
/**
|
|
56
|
+
* 显隐状态变化时的回调函数
|
|
57
|
+
* @param event - 触发事件
|
|
58
|
+
* @param data - 回调数据,包含当前的显隐状态
|
|
59
|
+
*/
|
|
60
|
+
onOpenChange?: (event: React.SyntheticEvent, data: TooltipOpenChangeData) => void;
|
|
61
|
+
/**
|
|
62
|
+
* 子元素,必须是可以接收 ref 的 React 元素
|
|
63
|
+
*/
|
|
64
|
+
children?: React.ReactElement;
|
|
65
|
+
/**
|
|
66
|
+
* 无障碍功能:Tooltip的角色
|
|
67
|
+
* @default 'tooltip'
|
|
68
|
+
*/
|
|
69
|
+
role?: 'tooltip' | 'dialog' | 'status' | 'alert';
|
|
70
|
+
/**
|
|
71
|
+
* 无障碍功能:为Tooltip提供可访问的标签
|
|
72
|
+
*/
|
|
73
|
+
'aria-label'?: string;
|
|
74
|
+
/**
|
|
75
|
+
* 无障碍功能:引用描述此Tooltip的元素ID
|
|
76
|
+
*/
|
|
77
|
+
'aria-labelledby'?: string;
|
|
78
|
+
/**
|
|
79
|
+
* 无障碍功能:是否自动管理焦点
|
|
80
|
+
* 当为true时,Tooltip显示时会自动获取焦点,关闭时焦点返回到触发元素
|
|
81
|
+
* @default false
|
|
82
|
+
*/
|
|
83
|
+
autoFocus?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* 无障碍功能:是否支持Escape键关闭
|
|
86
|
+
* @default false
|
|
87
|
+
*/
|
|
88
|
+
closeOnEscape?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* 无障碍功能:是否对屏幕阅读器隐藏Tooltip
|
|
91
|
+
* 当为true时,Tooltip将被屏幕阅读器忽略
|
|
92
|
+
* @default false
|
|
93
|
+
*/
|
|
94
|
+
'aria-hidden'?: boolean;
|
|
95
|
+
}
|
|
4
96
|
export type TooltipProps<D extends React.ElementType = 'div', P = {}> = OverrideProps<{
|
|
5
|
-
props: P &
|
|
6
|
-
/**
|
|
7
|
-
* 气泡浮层显示内容
|
|
8
|
-
*/
|
|
9
|
-
title?: string;
|
|
10
|
-
/**
|
|
11
|
-
* 默认是否显隐
|
|
12
|
-
* @default false
|
|
13
|
-
*/
|
|
14
|
-
defaultOpen?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* 用于手动控制气泡浮层显隐
|
|
17
|
-
*/
|
|
18
|
-
open?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* 用于控制气泡浮层和目标元素偏移量
|
|
21
|
-
*/
|
|
22
|
-
offsetSpacing?: number;
|
|
23
|
-
/**
|
|
24
|
-
* 气泡框位置
|
|
25
|
-
* @default 'top'
|
|
26
|
-
*/
|
|
27
|
-
placement?: 'top' | 'left' | 'right' | 'bottom' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'leftTop' | 'leftBottom' | 'rightTop' | 'rightBottom';
|
|
28
|
-
/**
|
|
29
|
-
* 触发行为
|
|
30
|
-
* - click: 点击触发
|
|
31
|
-
* - hover: hover触发
|
|
32
|
-
* - 或者是他们的数组
|
|
33
|
-
* @default 'click'
|
|
34
|
-
*/
|
|
35
|
-
trigger?: triggerType | triggerType[];
|
|
36
|
-
/**
|
|
37
|
-
* 点击事件回调方法
|
|
38
|
-
* - event 触发事件
|
|
39
|
-
* - data.open 浮层显隐状态
|
|
40
|
-
* @returns
|
|
41
|
-
*/
|
|
42
|
-
onOpenChange?: (event: React.SyntheticEvent, data: {
|
|
43
|
-
open: boolean;
|
|
44
|
-
}) => void;
|
|
45
|
-
};
|
|
97
|
+
props: P & TooltipBaseProps;
|
|
46
98
|
defaultComponent: D;
|
|
47
99
|
}, D>;
|
|
48
|
-
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* 自定义 Tooltip 组件 Demo 集合
|
|
4
|
+
* 这个文件包含多个测试 demo,展示如何使用 getCustomDemoCodesFromFile 进行无障碍测试
|
|
5
|
+
* 文件名必须是 A11yDemos.tsx(固定约定)
|
|
6
|
+
*/
|
|
7
|
+
export declare const basicTooltipDemo: () => React.JSX.Element;
|
|
8
|
+
export declare const placementTooltipDemo: () => React.JSX.Element;
|
|
9
|
+
export declare const triggerTooltipDemo: () => React.JSX.Element;
|
|
10
|
+
export declare const accessibilityTooltipDemo: () => React.JSX.Element;
|
|
11
|
+
export declare const complexInteractionTooltipDemo: () => React.JSX.Element;
|
|
12
|
+
export declare const complexContentTooltipDemo: () => React.JSX.Element;
|
|
13
|
+
export declare const offsetTooltipDemo: () => React.JSX.Element;
|
|
14
|
+
export declare const edgeCaseTooltipDemo: () => React.JSX.Element;
|
|
15
|
+
declare const _default: {
|
|
16
|
+
basicTooltipDemo: () => React.JSX.Element;
|
|
17
|
+
placementTooltipDemo: () => React.JSX.Element;
|
|
18
|
+
triggerTooltipDemo: () => React.JSX.Element;
|
|
19
|
+
accessibilityTooltipDemo: () => React.JSX.Element;
|
|
20
|
+
complexInteractionTooltipDemo: () => React.JSX.Element;
|
|
21
|
+
complexContentTooltipDemo: () => React.JSX.Element;
|
|
22
|
+
offsetTooltipDemo: () => React.JSX.Element;
|
|
23
|
+
edgeCaseTooltipDemo: () => React.JSX.Element;
|
|
24
|
+
};
|
|
25
|
+
export default _default;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Tooltip from "../../Tooltip";
|
|
3
|
+
const basicTooltipDemo = () => {
|
|
4
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Tooltip, { title: "\u8FD9\u662F\u4E00\u4E2A\u57FA\u7840\u7684\u63D0\u793A\u6587\u672C" }, /* @__PURE__ */ React.createElement("button", { type: "button" }, "\u57FA\u7840Tooltip")));
|
|
5
|
+
};
|
|
6
|
+
const placementTooltipDemo = () => {
|
|
7
|
+
return /* @__PURE__ */ React.createElement("div", { style: { display: "flex", gap: "10px", flexWrap: "wrap" } }, /* @__PURE__ */ React.createElement(Tooltip, { title: "\u9876\u90E8\u63D0\u793A", placement: "top" }, /* @__PURE__ */ React.createElement("button", { type: "button" }, "\u9876\u90E8")), /* @__PURE__ */ React.createElement(Tooltip, { title: "\u53F3\u4FA7\u63D0\u793A", placement: "right" }, /* @__PURE__ */ React.createElement("button", { type: "button" }, "\u53F3\u4FA7")), /* @__PURE__ */ React.createElement(Tooltip, { title: "\u5E95\u90E8\u63D0\u793A", placement: "bottom" }, /* @__PURE__ */ React.createElement("button", { type: "button" }, "\u5E95\u90E8")), /* @__PURE__ */ React.createElement(Tooltip, { title: "\u5DE6\u4FA7\u63D0\u793A", placement: "left" }, /* @__PURE__ */ React.createElement("button", { type: "button" }, "\u5DE6\u4FA7")));
|
|
8
|
+
};
|
|
9
|
+
const triggerTooltipDemo = () => {
|
|
10
|
+
return /* @__PURE__ */ React.createElement("div", { style: { display: "flex", gap: "10px" } }, /* @__PURE__ */ React.createElement(Tooltip, { title: "\u70B9\u51FB\u89E6\u53D1\u7684\u63D0\u793A", trigger: "click" }, /* @__PURE__ */ React.createElement("button", { type: "button" }, "\u70B9\u51FB\u89E6\u53D1")), /* @__PURE__ */ React.createElement(Tooltip, { title: "\u60AC\u505C\u89E6\u53D1\u7684\u63D0\u793A", trigger: "hover" }, /* @__PURE__ */ React.createElement("button", { type: "button" }, "\u60AC\u505C\u89E6\u53D1")));
|
|
11
|
+
};
|
|
12
|
+
const accessibilityTooltipDemo = () => {
|
|
13
|
+
return /* @__PURE__ */ React.createElement("div", { style: { display: "flex", gap: "10px", flexDirection: "column" } }, /* @__PURE__ */ React.createElement(Tooltip, { title: "\u81EA\u5B9A\u4E49\u89D2\u8272\u7684\u63D0\u793A", role: "status", "aria-label": "\u72B6\u6001\u63D0\u793A" }, /* @__PURE__ */ React.createElement("button", { type: "button" }, "\u72B6\u6001\u63D0\u793A")), /* @__PURE__ */ React.createElement(Tooltip, { title: "\u652F\u6301Escape\u952E\u5173\u95ED", closeOnEscape: true, trigger: "click" }, /* @__PURE__ */ React.createElement("button", { type: "button" }, "Escape\u952E\u5173\u95ED")));
|
|
14
|
+
};
|
|
15
|
+
const complexInteractionTooltipDemo = () => {
|
|
16
|
+
const ComplexInteractionTooltipDemo = () => {
|
|
17
|
+
const [open, setOpen] = React.useState(false);
|
|
18
|
+
return /* @__PURE__ */ React.createElement("div", { style: { display: "flex", gap: "10px", alignItems: "center" } }, /* @__PURE__ */ React.createElement(
|
|
19
|
+
Tooltip,
|
|
20
|
+
{
|
|
21
|
+
title: "\u53D7\u63A7\u6A21\u5F0F\u7684\u63D0\u793A",
|
|
22
|
+
open,
|
|
23
|
+
onOpenChange: (_, data) => setOpen(data.open)
|
|
24
|
+
},
|
|
25
|
+
/* @__PURE__ */ React.createElement("button", { type: "button" }, "\u53D7\u63A7Tooltip")
|
|
26
|
+
), /* @__PURE__ */ React.createElement("button", { type: "button", onClick: () => setOpen(!open) }, "\u5916\u90E8\u63A7\u5236: ", open ? "\u5173\u95ED" : "\u6253\u5F00"));
|
|
27
|
+
};
|
|
28
|
+
return /* @__PURE__ */ React.createElement(ComplexInteractionTooltipDemo, null);
|
|
29
|
+
};
|
|
30
|
+
const complexContentTooltipDemo = () => {
|
|
31
|
+
const ComplexContent = () => /* @__PURE__ */ React.createElement("div", { style: { maxWidth: "200px" } }, /* @__PURE__ */ React.createElement("h4", { style: { margin: "0 0 8px 0", fontSize: "14px" } }, "\u590D\u6742\u5185\u5BB9"), /* @__PURE__ */ React.createElement("p", { style: { margin: "0 0 8px 0", fontSize: "12px" } }, "\u8FD9\u662F\u4E00\u4E2A\u5305\u542B\u591A\u79CD\u5143\u7D20\u7684\u590D\u6742\u63D0\u793A\u5185\u5BB9\u3002"), /* @__PURE__ */ React.createElement("ul", { style: { margin: 0, fontSize: "12px", paddingLeft: "16px" } }, /* @__PURE__ */ React.createElement("li", null, "\u9879\u76EE\u4E00"), /* @__PURE__ */ React.createElement("li", null, "\u9879\u76EE\u4E8C")));
|
|
32
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Tooltip, { title: /* @__PURE__ */ React.createElement(ComplexContent, null) }, /* @__PURE__ */ React.createElement("button", { type: "button" }, "\u590D\u6742\u5185\u5BB9Tooltip")));
|
|
33
|
+
};
|
|
34
|
+
const offsetTooltipDemo = () => {
|
|
35
|
+
return /* @__PURE__ */ React.createElement("div", { style: { display: "flex", gap: "10px" } }, /* @__PURE__ */ React.createElement(Tooltip, { title: "\u65E0\u504F\u79FB", offset: 0 }, /* @__PURE__ */ React.createElement("button", { type: "button" }, "\u65E0\u504F\u79FB")), /* @__PURE__ */ React.createElement(Tooltip, { title: "\u504F\u79FB10px", offset: 10 }, /* @__PURE__ */ React.createElement("button", { type: "button" }, "\u504F\u79FB10px")), /* @__PURE__ */ React.createElement(Tooltip, { title: "\u504F\u79FB20px", offset: 20 }, /* @__PURE__ */ React.createElement("button", { type: "button" }, "\u504F\u79FB20px")));
|
|
36
|
+
};
|
|
37
|
+
const edgeCaseTooltipDemo = () => {
|
|
38
|
+
return /* @__PURE__ */ React.createElement("div", { style: { display: "flex", gap: "10px", flexDirection: "column" } }, /* @__PURE__ */ React.createElement(Tooltip, { title: "" }, /* @__PURE__ */ React.createElement("button", { type: "button" }, "\u7A7A\u5185\u5BB9")), /* @__PURE__ */ React.createElement(Tooltip, { title: "\u5F88\u957F\u5F88\u957F\u5F88\u957F\u5F88\u957F\u5F88\u957F\u5F88\u957F\u5F88\u957F\u5F88\u957F\u5F88\u957F\u5F88\u957F\u5F88\u957F\u5F88\u957F\u7684\u63D0\u793A\u6587\u672C\u5185\u5BB9" }, /* @__PURE__ */ React.createElement("button", { type: "button" }, "\u957F\u6587\u672C")), /* @__PURE__ */ React.createElement(Tooltip, { title: `\u7279\u6B8A\u5B57\u7B26 !@#$%^&*()_+-=[]{}|;':",./` }, /* @__PURE__ */ React.createElement("button", { type: "button" }, "\u7279\u6B8A\u5B57\u7B26")));
|
|
39
|
+
};
|
|
40
|
+
var A11yDemos_default = {
|
|
41
|
+
basicTooltipDemo,
|
|
42
|
+
placementTooltipDemo,
|
|
43
|
+
triggerTooltipDemo,
|
|
44
|
+
accessibilityTooltipDemo,
|
|
45
|
+
complexInteractionTooltipDemo,
|
|
46
|
+
complexContentTooltipDemo,
|
|
47
|
+
offsetTooltipDemo,
|
|
48
|
+
edgeCaseTooltipDemo
|
|
49
|
+
};
|
|
50
|
+
export {
|
|
51
|
+
accessibilityTooltipDemo,
|
|
52
|
+
basicTooltipDemo,
|
|
53
|
+
complexContentTooltipDemo,
|
|
54
|
+
complexInteractionTooltipDemo,
|
|
55
|
+
A11yDemos_default as default,
|
|
56
|
+
edgeCaseTooltipDemo,
|
|
57
|
+
offsetTooltipDemo,
|
|
58
|
+
placementTooltipDemo,
|
|
59
|
+
triggerTooltipDemo
|
|
60
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TooltipProps } from './Tooltip.types';
|
|
3
|
+
export interface UseTooltipParameters {
|
|
4
|
+
title?: React.ReactNode;
|
|
5
|
+
defaultOpen?: boolean;
|
|
6
|
+
open?: boolean;
|
|
7
|
+
offset?: number;
|
|
8
|
+
placement?: TooltipProps['placement'];
|
|
9
|
+
trigger?: TooltipProps['trigger'];
|
|
10
|
+
onOpenChange?: TooltipProps['onOpenChange'];
|
|
11
|
+
autoFocus?: boolean;
|
|
12
|
+
closeOnEscape?: boolean;
|
|
13
|
+
children: React.ReactElement;
|
|
14
|
+
rootRef?: React.Ref<HTMLElement>;
|
|
15
|
+
}
|
|
16
|
+
export interface UseTooltipReturnValue {
|
|
17
|
+
getTooltipProps: (otherProps?: Record<string, unknown>) => Record<string, unknown>;
|
|
18
|
+
getChildProps: () => Record<string, unknown>;
|
|
19
|
+
getPortalProps: () => {
|
|
20
|
+
onMounted: () => void;
|
|
21
|
+
};
|
|
22
|
+
tooltipRef: React.RefCallback<HTMLElement>;
|
|
23
|
+
isOpen: boolean;
|
|
24
|
+
toolStyles: React.CSSProperties;
|
|
25
|
+
arrowDirection: string;
|
|
26
|
+
arrowLocation: string;
|
|
27
|
+
tooltipId: string;
|
|
28
|
+
}
|
|
29
|
+
export declare function useTooltip(parameters: UseTooltipParameters): UseTooltipReturnValue;
|