@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
|
@@ -10,6 +10,10 @@ export interface IPickerOptionItem {
|
|
|
10
10
|
* 选项对应唯一的值
|
|
11
11
|
*/
|
|
12
12
|
value: string | number;
|
|
13
|
+
/**
|
|
14
|
+
* 是否禁用
|
|
15
|
+
*/
|
|
16
|
+
disabled?: boolean;
|
|
13
17
|
}
|
|
14
18
|
export type ICascadePickerChildOptionItem = IPickerOptionItem & {
|
|
15
19
|
/**
|
|
@@ -34,6 +38,14 @@ export type PickerProps<D extends React.ElementType = 'div', P = DrawerProps> =
|
|
|
34
38
|
* 标题
|
|
35
39
|
*/
|
|
36
40
|
title?: string;
|
|
41
|
+
/**
|
|
42
|
+
* 确认文本内容
|
|
43
|
+
*/
|
|
44
|
+
confirmText?: string;
|
|
45
|
+
/**
|
|
46
|
+
* 取消文本内容
|
|
47
|
+
*/
|
|
48
|
+
cancelText?: string;
|
|
37
49
|
/**
|
|
38
50
|
* 列表数据
|
|
39
51
|
* @default []
|
|
@@ -61,6 +73,7 @@ export type PickerProps<D extends React.ElementType = 'div', P = DrawerProps> =
|
|
|
61
73
|
value: (string | number)[];
|
|
62
74
|
options: ICascadePickerChildOptionItem[][];
|
|
63
75
|
currentOption: ICascadePickerChildOptionItem;
|
|
76
|
+
columnIndex: number;
|
|
64
77
|
}) => void;
|
|
65
78
|
/**
|
|
66
79
|
* 点击取消按钮时候回调
|
|
@@ -85,9 +98,9 @@ export type PickerPanelProps<D extends React.ElementType = 'div', P = {}> = Over
|
|
|
85
98
|
*/
|
|
86
99
|
options?: ICascadePickerChildOptionItem[];
|
|
87
100
|
/**
|
|
88
|
-
*
|
|
101
|
+
* 选中值
|
|
89
102
|
*/
|
|
90
|
-
|
|
103
|
+
value?: string | number;
|
|
91
104
|
/**
|
|
92
105
|
* 列索引
|
|
93
106
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
.bui-picker-panel {
|
|
2
|
+
--bui-picker-option-disabled-opacity: 0.38;
|
|
2
3
|
flex: 1;
|
|
3
4
|
flex-shrink: 0;
|
|
4
5
|
position: relative;
|
|
@@ -56,6 +57,9 @@
|
|
|
56
57
|
white-space: nowrap;
|
|
57
58
|
width: 100%;
|
|
58
59
|
}
|
|
60
|
+
.bui-picker-panel-option-disabled {
|
|
61
|
+
opacity: var(--bui-picker-option-disabled-opacity);
|
|
62
|
+
}
|
|
59
63
|
.bui-picker-panel-option-hidden {
|
|
60
64
|
visibility: hidden;
|
|
61
65
|
opacity: 0;
|
package/es/Picker/PickerPanel.js
CHANGED
|
@@ -26,7 +26,6 @@ var __objRest = (source, exclude) => {
|
|
|
26
26
|
}
|
|
27
27
|
return target;
|
|
28
28
|
};
|
|
29
|
-
import clsx from "clsx";
|
|
30
29
|
import React, {
|
|
31
30
|
useEffect,
|
|
32
31
|
useState,
|
|
@@ -34,6 +33,7 @@ import React, {
|
|
|
34
33
|
useImperativeHandle,
|
|
35
34
|
useLayoutEffect
|
|
36
35
|
} from "react";
|
|
36
|
+
import clsx from "clsx";
|
|
37
37
|
import {
|
|
38
38
|
useTouch,
|
|
39
39
|
useForkRef,
|
|
@@ -42,29 +42,29 @@ import {
|
|
|
42
42
|
} from "@bifrostui/utils";
|
|
43
43
|
import "./PickerPanel.css";
|
|
44
44
|
const prefixCls = "bui-picker-panel";
|
|
45
|
+
const INERTIA_TIME = 200;
|
|
46
|
+
const INERTIA_DISTANCE = 15;
|
|
47
|
+
const DEFAULT_DURATION = 200;
|
|
48
|
+
const ROTATION = 20;
|
|
49
|
+
const TOUCH_END = "end";
|
|
50
|
+
const DEFAULT_LINE_SPACING = 36;
|
|
45
51
|
const PickerPanel = /* @__PURE__ */ React.forwardRef(
|
|
46
52
|
(props, ref) => {
|
|
47
53
|
const _a = props, {
|
|
48
54
|
options = [],
|
|
49
|
-
|
|
55
|
+
value,
|
|
50
56
|
onSelect,
|
|
51
57
|
columnIndex,
|
|
52
58
|
open
|
|
53
59
|
} = _a, others = __objRest(_a, [
|
|
54
60
|
"options",
|
|
55
|
-
"
|
|
61
|
+
"value",
|
|
56
62
|
"onSelect",
|
|
57
63
|
"columnIndex",
|
|
58
64
|
"open"
|
|
59
65
|
]);
|
|
60
66
|
const touch = useTouch();
|
|
61
|
-
|
|
62
|
-
const INERTIA_TIME = 200;
|
|
63
|
-
const INERTIA_DISTANCE = 15;
|
|
64
|
-
const DEFAULT_DURATION = 200;
|
|
65
|
-
const ROTATION = 20;
|
|
66
|
-
const TOUCH_END = "end";
|
|
67
|
-
const DEFAULT_LINE_SPACING = 36;
|
|
67
|
+
const timerRef = useRef(null);
|
|
68
68
|
const lineSpacing = useRef(DEFAULT_LINE_SPACING);
|
|
69
69
|
const [indicatorOffset, setIndicatorOffset] = useState(108);
|
|
70
70
|
const [startY, setStartY] = useState(0);
|
|
@@ -87,29 +87,6 @@ const PickerPanel = /* @__PURE__ */ React.forwardRef(
|
|
|
87
87
|
setIndicatorOffset(lineSpacing.current * 108 / DEFAULT_LINE_SPACING);
|
|
88
88
|
});
|
|
89
89
|
}, [open]);
|
|
90
|
-
const updateSelect = () => {
|
|
91
|
-
let index = -1;
|
|
92
|
-
if (defaultValue) {
|
|
93
|
-
options.some((item, idx) => {
|
|
94
|
-
if (item.value === defaultValue) {
|
|
95
|
-
index = idx;
|
|
96
|
-
return true;
|
|
97
|
-
}
|
|
98
|
-
return false;
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
setCurrIndex(index === -1 ? 1 : index + 1);
|
|
102
|
-
const move = index === -1 ? 0 : index * lineSpacing.current;
|
|
103
|
-
setMove({ move: -move });
|
|
104
|
-
};
|
|
105
|
-
useEffect(() => {
|
|
106
|
-
setScrollDistance(0);
|
|
107
|
-
transformY.current = 0;
|
|
108
|
-
updateSelect();
|
|
109
|
-
return () => {
|
|
110
|
-
clearTimeout(timer);
|
|
111
|
-
};
|
|
112
|
-
}, [options]);
|
|
113
90
|
const setTransform = (type, deg, time = DEFAULT_DURATION, translateY = 0) => {
|
|
114
91
|
let nTime = time;
|
|
115
92
|
if (type !== TOUCH_END) {
|
|
@@ -147,6 +124,29 @@ const PickerPanel = /* @__PURE__ */ React.forwardRef(
|
|
|
147
124
|
}
|
|
148
125
|
}
|
|
149
126
|
};
|
|
127
|
+
const updateSelect = () => {
|
|
128
|
+
let index = -1;
|
|
129
|
+
if (value) {
|
|
130
|
+
options.some((item, idx) => {
|
|
131
|
+
if (item.value === value) {
|
|
132
|
+
index = idx;
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
return false;
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
setCurrIndex(index === -1 ? 1 : index + 1);
|
|
139
|
+
const move = index === -1 ? 0 : index * lineSpacing.current;
|
|
140
|
+
setMove({ move: -move });
|
|
141
|
+
};
|
|
142
|
+
useEffect(() => {
|
|
143
|
+
setScrollDistance(0);
|
|
144
|
+
transformY.current = 0;
|
|
145
|
+
updateSelect();
|
|
146
|
+
return () => {
|
|
147
|
+
clearTimeout(timerRef.current);
|
|
148
|
+
};
|
|
149
|
+
}, [options, value]);
|
|
150
150
|
const momentum = (distance, duration) => {
|
|
151
151
|
let nDistance = distance;
|
|
152
152
|
const speed = Math.abs(nDistance / duration);
|
|
@@ -187,7 +187,7 @@ const PickerPanel = /* @__PURE__ */ React.forwardRef(
|
|
|
187
187
|
type: TOUCH_END
|
|
188
188
|
});
|
|
189
189
|
}
|
|
190
|
-
|
|
190
|
+
timerRef.current = setTimeout(() => {
|
|
191
191
|
touch.reset();
|
|
192
192
|
}, 0);
|
|
193
193
|
};
|
|
@@ -208,7 +208,7 @@ const PickerPanel = /* @__PURE__ */ React.forwardRef(
|
|
|
208
208
|
);
|
|
209
209
|
(_c2 = PickerPanelRef.current) == null ? void 0 : _c2.removeEventListener("touchend", panelTouchEnd);
|
|
210
210
|
};
|
|
211
|
-
});
|
|
211
|
+
}, [panelTouchStart, panelTouchMove, panelTouchEnd]);
|
|
212
212
|
const onTransitionEnd = (e) => {
|
|
213
213
|
isVerticalMoving.current = false;
|
|
214
214
|
setTouchTime(0);
|
|
@@ -217,9 +217,12 @@ const PickerPanel = /* @__PURE__ */ React.forwardRef(
|
|
|
217
217
|
columnIndex
|
|
218
218
|
});
|
|
219
219
|
};
|
|
220
|
-
useImperativeHandle(
|
|
221
|
-
|
|
222
|
-
|
|
220
|
+
useImperativeHandle(
|
|
221
|
+
ref,
|
|
222
|
+
() => ({
|
|
223
|
+
isMoving: isVerticalMoving.current
|
|
224
|
+
})
|
|
225
|
+
);
|
|
223
226
|
return /* @__PURE__ */ React.createElement(
|
|
224
227
|
"div",
|
|
225
228
|
__spreadValues({
|
|
@@ -227,7 +230,11 @@ const PickerPanel = /* @__PURE__ */ React.forwardRef(
|
|
|
227
230
|
ref: pickerPanelRef,
|
|
228
231
|
onTouchStart: panelTouchStart,
|
|
229
232
|
onTouchMove: panelTouchMove,
|
|
230
|
-
onTouchEnd: panelTouchEnd
|
|
233
|
+
onTouchEnd: panelTouchEnd,
|
|
234
|
+
role: "listbox",
|
|
235
|
+
"aria-label": "options",
|
|
236
|
+
"aria-orientation": "vertical",
|
|
237
|
+
tabIndex: 0
|
|
231
238
|
}, others),
|
|
232
239
|
/* @__PURE__ */ React.createElement(
|
|
233
240
|
"div",
|
|
@@ -247,12 +254,16 @@ const PickerPanel = /* @__PURE__ */ React.forwardRef(
|
|
|
247
254
|
fitstOptionRef.current = el;
|
|
248
255
|
},
|
|
249
256
|
className: clsx(`${prefixCls}-option`, {
|
|
250
|
-
[`${prefixCls}-option-hidden`]: i + 1 <= currIndex - 8 || i + 1 >= currIndex + 8
|
|
257
|
+
[`${prefixCls}-option-hidden`]: i + 1 <= currIndex - 8 || i + 1 >= currIndex + 8,
|
|
258
|
+
[`${prefixCls}-option-disabled`]: item == null ? void 0 : item.disabled
|
|
251
259
|
}),
|
|
252
260
|
key: `${item == null ? void 0 : item.value}-${i}`,
|
|
253
261
|
style: {
|
|
254
262
|
transform: `rotate3d(1, 0, 0, ${-ROTATION * (i + 1)}deg) translate3d(0px, 0px, ${indicatorOffset}px)`
|
|
255
|
-
}
|
|
263
|
+
},
|
|
264
|
+
role: "option",
|
|
265
|
+
"aria-selected": item.value === value,
|
|
266
|
+
"aria-disabled": !!(item == null ? void 0 : item.disabled)
|
|
256
267
|
},
|
|
257
268
|
item == null ? void 0 : item.label
|
|
258
269
|
))
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Picker from "../../Picker";
|
|
3
|
+
const CalendarDemo = () => {
|
|
4
|
+
return /* @__PURE__ */ React.createElement(
|
|
5
|
+
Picker,
|
|
6
|
+
{
|
|
7
|
+
open: true,
|
|
8
|
+
value: [2],
|
|
9
|
+
options: [
|
|
10
|
+
[
|
|
11
|
+
{
|
|
12
|
+
value: 1,
|
|
13
|
+
label: "\u5468\u4E00"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
value: 2,
|
|
17
|
+
label: "\u5468\u4E8C"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
value: 3,
|
|
21
|
+
label: "\u5468\u4E09"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
value: 4,
|
|
25
|
+
label: "\u5468\u56DB"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
value: 5,
|
|
29
|
+
label: "\u5468\u4E94"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
value: 6,
|
|
33
|
+
label: "\u5468\u516D"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
value: 7,
|
|
37
|
+
label: "\u5468\u65E5"
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
CalendarDemo
|
|
46
|
+
};
|
package/es/Picker/index.css
CHANGED
|
@@ -46,6 +46,10 @@ xhs-page {
|
|
|
46
46
|
line-height: var(--bui-picker-confirm-line-height);
|
|
47
47
|
color: var(--bui-color-primary);
|
|
48
48
|
}
|
|
49
|
+
.bui-picker-confirm-disabled {
|
|
50
|
+
color: var(--bui-color-fg-default);
|
|
51
|
+
opacity: var(--bui-picker-confirm-disabled-opacity);
|
|
52
|
+
}
|
|
49
53
|
.bui-picker-container {
|
|
50
54
|
width: 100%;
|
|
51
55
|
height: var(--bui-picker-panel-height);
|
|
@@ -53,6 +57,7 @@ xhs-page {
|
|
|
53
57
|
overflow: hidden;
|
|
54
58
|
}
|
|
55
59
|
.bui-picker-panel {
|
|
60
|
+
--bui-picker-option-disabled-opacity: 0.38;
|
|
56
61
|
flex: 1;
|
|
57
62
|
flex-shrink: 0;
|
|
58
63
|
position: relative;
|
|
@@ -110,6 +115,9 @@ xhs-page {
|
|
|
110
115
|
white-space: nowrap;
|
|
111
116
|
width: 100%;
|
|
112
117
|
}
|
|
118
|
+
.bui-picker-panel-option-disabled {
|
|
119
|
+
opacity: var(--bui-picker-option-disabled-opacity);
|
|
120
|
+
}
|
|
113
121
|
.bui-picker-panel-option-hidden {
|
|
114
122
|
visibility: hidden;
|
|
115
123
|
opacity: 0;
|
package/es/Picker/utils.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ICascadePickerOptionItem, ICascadePickerChildOptionItem } from './Picker.types';
|
|
1
|
+
import { IPickerOptionItem, ICascadePickerOptionItem, ICascadePickerChildOptionItem } from './Picker.types';
|
|
2
2
|
/**
|
|
3
3
|
* 根据第一列数据判断选择器类型
|
|
4
4
|
*/
|
|
5
|
-
export declare const pickerPanelType: (options?:
|
|
5
|
+
export declare const pickerPanelType: (options?: (IPickerOptionItem[] | ICascadePickerOptionItem)[]) => "multiple" | "single" | "cascade";
|
|
6
6
|
/**
|
|
7
7
|
* 格式化级联模式数据
|
|
8
8
|
*/
|
|
@@ -10,11 +10,14 @@ export declare const formatCascade: (columns: ICascadePickerOptionItem[], values
|
|
|
10
10
|
/**
|
|
11
11
|
* 统一options数据格式
|
|
12
12
|
*/
|
|
13
|
-
export declare const formatOptions: (internalValue:
|
|
13
|
+
export declare const formatOptions: (internalValue: (number | string)[], options?: any[]) => any[];
|
|
14
14
|
/**
|
|
15
15
|
* 在格式化后的数据源中是否存在等长子项的value
|
|
16
16
|
*/
|
|
17
|
-
export declare const existSameLengthValue: (value:
|
|
17
|
+
export declare const existSameLengthValue: (value: unknown[], formatted: {
|
|
18
|
+
[index: string]: unknown;
|
|
19
|
+
value: string | number;
|
|
20
|
+
}[][]) => boolean;
|
|
18
21
|
/**
|
|
19
22
|
* 关闭选择器时,纠正value和格式化数据
|
|
20
23
|
* 取决于formatted后的options有几列,若value为格式化后数据源(formatted)的等长子集,则取value,否则执行纠正逻辑
|
|
@@ -25,5 +28,5 @@ export declare const safeData: ({ value, formatted, options }: {
|
|
|
25
28
|
options: any;
|
|
26
29
|
}) => {
|
|
27
30
|
safeValue: any[];
|
|
28
|
-
|
|
31
|
+
safeFormattedValue: any[];
|
|
29
32
|
};
|
package/es/Picker/utils.js
CHANGED
|
@@ -30,14 +30,11 @@ const formatCascade = (columns, values) => {
|
|
|
30
30
|
};
|
|
31
31
|
const formatOptions = (internalValue, options = []) => {
|
|
32
32
|
const panelType = pickerPanelType(options);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
default:
|
|
39
|
-
return options;
|
|
40
|
-
}
|
|
33
|
+
if (panelType === "multiple")
|
|
34
|
+
return options;
|
|
35
|
+
if (panelType === "cascade")
|
|
36
|
+
return formatCascade(options, internalValue);
|
|
37
|
+
return options;
|
|
41
38
|
};
|
|
42
39
|
const existSameLengthValue = (value, formatted) => {
|
|
43
40
|
const result = formatted.every(
|
|
@@ -47,22 +44,22 @@ const existSameLengthValue = (value, formatted) => {
|
|
|
47
44
|
};
|
|
48
45
|
const safeData = ({ value, formatted, options }) => {
|
|
49
46
|
let safeValue = [];
|
|
50
|
-
let
|
|
47
|
+
let safeFormattedValue = [];
|
|
51
48
|
const existValidChildren = existSameLengthValue(value, formatted);
|
|
52
49
|
if (existValidChildren) {
|
|
53
50
|
safeValue = value;
|
|
54
|
-
|
|
51
|
+
safeFormattedValue = formatted;
|
|
55
52
|
} else {
|
|
56
53
|
formatted.forEach((item, index) => {
|
|
57
54
|
var _a, _b;
|
|
58
55
|
const childIndex = item.findIndex((i) => i.value === value[index]);
|
|
59
56
|
safeValue[index] = ((_a = item == null ? void 0 : item[childIndex]) == null ? void 0 : _a.value) || ((_b = item == null ? void 0 : item[0]) == null ? void 0 : _b.value);
|
|
60
57
|
});
|
|
61
|
-
|
|
58
|
+
safeFormattedValue = formatOptions(safeValue, options);
|
|
62
59
|
}
|
|
63
60
|
return {
|
|
64
61
|
safeValue,
|
|
65
|
-
|
|
62
|
+
safeFormattedValue
|
|
66
63
|
};
|
|
67
64
|
};
|
|
68
65
|
export {
|
package/es/Popover/Popover.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,31 +30,38 @@ 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";
|
|
34
|
+
import { useForkRef } from "@bifrostui/utils";
|
|
38
35
|
import Portal from "../Portal";
|
|
36
|
+
import Backdrop from "../Backdrop";
|
|
37
|
+
import {
|
|
38
|
+
usePopoverState,
|
|
39
|
+
usePopoverPosition,
|
|
40
|
+
usePopoverA11y,
|
|
41
|
+
usePopoverEvents
|
|
42
|
+
} from "./hooks";
|
|
39
43
|
import "./index.css";
|
|
40
44
|
const prefixCls = "bui-popover";
|
|
41
45
|
const Popover = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
46
|
+
var _b;
|
|
42
47
|
const _a = props, {
|
|
43
48
|
className,
|
|
44
49
|
style,
|
|
45
50
|
children,
|
|
46
51
|
title,
|
|
47
52
|
content,
|
|
48
|
-
defaultOpen,
|
|
53
|
+
defaultOpen = false,
|
|
49
54
|
offsetSpacing = 0,
|
|
50
|
-
|
|
55
|
+
anchorOrigin = { vertical: "top", horizontal: "center" },
|
|
51
56
|
trigger = "click",
|
|
52
|
-
onOpenChange,
|
|
53
57
|
open,
|
|
54
|
-
hideArrow
|
|
58
|
+
hideArrow,
|
|
59
|
+
onOpenChange,
|
|
60
|
+
role = "tooltip",
|
|
61
|
+
"aria-label": ariaLabel,
|
|
62
|
+
"aria-labelledby": ariaLabelledby,
|
|
63
|
+
autoFocus = false,
|
|
64
|
+
closeOnEscape = false
|
|
55
65
|
} = _a, others = __objRest(_a, [
|
|
56
66
|
"className",
|
|
57
67
|
"style",
|
|
@@ -60,110 +70,131 @@ const Popover = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
60
70
|
"content",
|
|
61
71
|
"defaultOpen",
|
|
62
72
|
"offsetSpacing",
|
|
63
|
-
"
|
|
73
|
+
"anchorOrigin",
|
|
64
74
|
"trigger",
|
|
65
|
-
"onOpenChange",
|
|
66
75
|
"open",
|
|
67
|
-
"hideArrow"
|
|
76
|
+
"hideArrow",
|
|
77
|
+
"onOpenChange",
|
|
78
|
+
"role",
|
|
79
|
+
"aria-label",
|
|
80
|
+
"aria-labelledby",
|
|
81
|
+
"autoFocus",
|
|
82
|
+
"closeOnEscape"
|
|
68
83
|
]);
|
|
69
|
-
const controlByUser
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const
|
|
84
|
+
const { isOpen, openStatus, controlByUser, changeOpenStatus } = usePopoverState({
|
|
85
|
+
defaultOpen,
|
|
86
|
+
open,
|
|
87
|
+
onOpenChange
|
|
88
|
+
});
|
|
89
|
+
const {
|
|
90
|
+
arrowDirection,
|
|
91
|
+
arrowLocation,
|
|
92
|
+
toolStyles,
|
|
93
|
+
tipRef,
|
|
94
|
+
childrenRef,
|
|
95
|
+
onMounted,
|
|
96
|
+
clearRef
|
|
97
|
+
} = usePopoverPosition({
|
|
98
|
+
anchorOrigin,
|
|
99
|
+
offsetSpacing,
|
|
100
|
+
isOpen
|
|
101
|
+
});
|
|
102
|
+
const nodeRef = useForkRef(ref, tipRef);
|
|
103
|
+
const handleHide = (event) => {
|
|
104
|
+
clearRef(false);
|
|
89
105
|
changeOpenStatus(event, false);
|
|
90
106
|
};
|
|
91
|
-
const
|
|
107
|
+
const handleShow = (event) => {
|
|
92
108
|
changeOpenStatus(event, true);
|
|
93
109
|
};
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
hidePopover(event);
|
|
103
|
-
};
|
|
104
|
-
const onRootElementMouted = throttle(() => {
|
|
105
|
-
const {
|
|
106
|
-
direction: newParsedDirection,
|
|
107
|
-
location: newParsedLocation = "center"
|
|
108
|
-
} = parsePlacement(placement);
|
|
109
|
-
const result = getStylesAndLocation({
|
|
110
|
-
childrenRef,
|
|
111
|
-
arrowDirection: newParsedDirection,
|
|
112
|
-
arrowLocation: newParsedLocation,
|
|
113
|
-
offsetSpacing,
|
|
114
|
-
selector: `[data-id="tt_${ttId}"]`
|
|
115
|
-
});
|
|
116
|
-
if (!result)
|
|
117
|
-
return;
|
|
118
|
-
const { styles, newArrowDirection, newArrowLocation } = result;
|
|
119
|
-
if (newArrowDirection !== arrowDirection) {
|
|
120
|
-
setArrowDirection(newArrowDirection);
|
|
121
|
-
}
|
|
122
|
-
if (newArrowLocation !== arrowLocation) {
|
|
123
|
-
setArrowLocation(newArrowLocation);
|
|
124
|
-
}
|
|
125
|
-
setTooltyles(styles);
|
|
126
|
-
}, 100);
|
|
127
|
-
const bindEvent = () => {
|
|
128
|
-
if (!controlByUser) {
|
|
129
|
-
document.addEventListener("click", clickEventHandler);
|
|
130
|
-
}
|
|
131
|
-
window.addEventListener("resize", onRootElementMouted);
|
|
132
|
-
};
|
|
133
|
-
const unbindEvent = () => {
|
|
134
|
-
if (!controlByUser) {
|
|
135
|
-
document.removeEventListener("click", clickEventHandler);
|
|
110
|
+
const handleTriggerClick = (event) => {
|
|
111
|
+
event.stopPropagation();
|
|
112
|
+
const targetStatus = !openStatus;
|
|
113
|
+
if (targetStatus) {
|
|
114
|
+
changeOpenStatus(event, true);
|
|
115
|
+
} else {
|
|
116
|
+
clearRef(false);
|
|
117
|
+
changeOpenStatus(event, false);
|
|
136
118
|
}
|
|
137
|
-
window.removeEventListener("resize", onRootElementMouted);
|
|
138
119
|
};
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
120
|
+
const { popoverId, handleKeyDown } = usePopoverA11y({
|
|
121
|
+
isOpen,
|
|
122
|
+
autoFocus,
|
|
123
|
+
closeOnEscape,
|
|
124
|
+
onClose: handleHide,
|
|
125
|
+
tipRef,
|
|
126
|
+
childrenRef
|
|
127
|
+
});
|
|
128
|
+
const { triggerEventOption, backdropProps } = usePopoverEvents({
|
|
129
|
+
isOpen,
|
|
130
|
+
controlByUser,
|
|
131
|
+
trigger,
|
|
132
|
+
onShow: handleShow,
|
|
133
|
+
onHide: handleHide,
|
|
134
|
+
onTriggerClick: handleTriggerClick,
|
|
135
|
+
onMounted,
|
|
136
|
+
handleKeyDown,
|
|
137
|
+
tipRef,
|
|
138
|
+
childrenRef
|
|
139
|
+
});
|
|
145
140
|
if (!title && !content)
|
|
146
141
|
return null;
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
const childrenOptions = __spreadValues({
|
|
142
|
+
const getAriaHasPopup = () => {
|
|
143
|
+
if (role === "menu")
|
|
144
|
+
return "menu";
|
|
145
|
+
if (role === "listbox")
|
|
146
|
+
return "listbox";
|
|
147
|
+
return "dialog";
|
|
148
|
+
};
|
|
149
|
+
const childrenOptions = __spreadValues(__spreadProps(__spreadValues({
|
|
157
150
|
ref: childrenRef
|
|
158
|
-
}, triggerEventOption)
|
|
159
|
-
|
|
151
|
+
}, triggerEventOption), {
|
|
152
|
+
"aria-describedby": isOpen ? popoverId : void 0,
|
|
153
|
+
"aria-haspopup": getAriaHasPopup()
|
|
154
|
+
}), React.isValidElement(children) && (children.type === "button" || children.type === "a" || ((_b = children.props) == null ? void 0 : _b.role) === "button") && {
|
|
155
|
+
"aria-expanded": isOpen
|
|
156
|
+
});
|
|
157
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, isOpen ? /* @__PURE__ */ React.createElement(Portal, { onMounted }, backdropProps && /* @__PURE__ */ React.createElement(
|
|
158
|
+
Backdrop,
|
|
159
|
+
__spreadValues({
|
|
160
|
+
className: "bui-popover-backdrop",
|
|
161
|
+
style: {
|
|
162
|
+
zIndex: 999
|
|
163
|
+
},
|
|
164
|
+
open: isOpen,
|
|
165
|
+
invisible: true,
|
|
166
|
+
role: "button",
|
|
167
|
+
tabIndex: -1,
|
|
168
|
+
onKeyDown: (e) => {
|
|
169
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
170
|
+
e.preventDefault();
|
|
171
|
+
if ((backdropProps == null ? void 0 : backdropProps.onClick) && typeof backdropProps.onClick === "function") {
|
|
172
|
+
backdropProps.onClick(
|
|
173
|
+
e
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}, backdropProps)
|
|
179
|
+
), /* @__PURE__ */ React.createElement(
|
|
160
180
|
"div",
|
|
161
181
|
__spreadValues({
|
|
162
182
|
className: clsx(prefixCls, className, `popover-${arrowDirection}`, {
|
|
163
183
|
"bui-popover-arrow-hide": hideArrow
|
|
164
184
|
}),
|
|
165
|
-
|
|
166
|
-
|
|
185
|
+
style: __spreadValues(__spreadValues({}, style), toolStyles),
|
|
186
|
+
ref: nodeRef,
|
|
187
|
+
id: popoverId,
|
|
188
|
+
role,
|
|
189
|
+
"aria-label": ariaLabel,
|
|
190
|
+
"aria-labelledby": ariaLabelledby,
|
|
191
|
+
tabIndex: autoFocus ? 0 : void 0,
|
|
192
|
+
onClick: (e) => e.stopPropagation(),
|
|
193
|
+
onKeyDown: (e) => {
|
|
194
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
195
|
+
e.stopPropagation();
|
|
196
|
+
}
|
|
197
|
+
}
|
|
167
198
|
}, others),
|
|
168
199
|
!hideArrow ? /* @__PURE__ */ React.createElement(
|
|
169
200
|
"div",
|