@bifrostui/react 2.0.0-alpha.0 → 2.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Alert/Alert.js +2 -1
- package/dist/Alert/__tests__/fixtures/A11yDemos.d.ts +17 -0
- package/dist/Alert/__tests__/fixtures/A11yDemos.js +143 -0
- package/dist/Alert/index.css +4 -4
- package/dist/Avatar/AvatarGroup.css +8 -8
- package/dist/Avatar/index.css +8 -8
- package/dist/Backdrop/Backdrop.js +3 -2
- package/dist/Backdrop/Backdrop.types.d.ts +4 -0
- package/dist/Backdrop/__tests__/fixtures/A11yDemos.d.ts +8 -0
- package/dist/Backdrop/__tests__/fixtures/A11yDemos.js +51 -0
- package/dist/Backdrop/index.css +2 -2
- package/dist/Badge/Badge.js +38 -11
- package/dist/Badge/Badge.types.d.ts +30 -1
- package/dist/Badge/__tests__/fixtures/A11yDemos.d.ts +25 -0
- package/dist/Badge/__tests__/fixtures/A11yDemos.js +110 -0
- package/dist/Badge/hooks/useBadgeA11y.d.ts +23 -0
- package/dist/Badge/hooks/useBadgeA11y.js +76 -0
- package/dist/Badge/hooks/useBadgeDisplay.d.ts +16 -0
- package/dist/Badge/hooks/useBadgeDisplay.js +56 -0
- package/dist/Button/Button.js +2 -1
- package/dist/Button/__tests__/fixtures/A11yDemos.d.ts +23 -0
- package/dist/Button/__tests__/fixtures/A11yDemos.js +81 -0
- package/dist/Button/index.css +4 -5
- package/dist/CSSTransition/CSSTransition.d.ts +4 -0
- package/dist/CSSTransition/CSSTransition.js +177 -0
- package/dist/CSSTransition/CSSTransition.types.d.ts +13 -0
- package/dist/CSSTransition/CSSTransition.types.js +15 -0
- package/dist/CSSTransition/demo/CSSTransitionDemo.d.ts +4 -0
- package/dist/CSSTransition/demo/CSSTransitionDemo.js +76 -0
- package/dist/CSSTransition/demo/index.css +25 -0
- package/dist/CSSTransition/index.d.ts +2 -0
- package/dist/CSSTransition/index.js +41 -0
- package/dist/Calendar/Calendar.js +131 -34
- package/dist/Calendar/Calendar.types.d.ts +16 -1
- package/dist/Calendar/__tests__/fixtures/A11yDemos.d.ts +2 -0
- package/dist/Calendar/__tests__/fixtures/A11yDemos.js +41 -0
- package/dist/Calendar/index.css +52 -9
- package/dist/Calendar/utils.d.ts +7 -3
- package/dist/Calendar/utils.js +33 -23
- package/dist/Checkbox/Checkbox.js +5 -4
- package/dist/Checkbox/__tests__/fixtures/A11yDemos.d.ts +15 -0
- package/dist/Checkbox/__tests__/fixtures/A11yDemos.js +57 -0
- package/dist/CitySelector/CitySelector.types.d.ts +0 -1
- package/dist/Collapse/Collapse.d.ts +1 -1
- package/dist/Collapse/Collapse.js +26 -12
- package/dist/Collapse/Collapse.miniapp.d.ts +10 -0
- package/dist/Collapse/Collapse.miniapp.js +255 -0
- package/dist/Collapse/index.css +40 -1
- package/dist/CollapsePanel/index.css +1 -1
- package/dist/Countdown/Countdown.js +61 -21
- package/dist/Countdown/Countdown.types.d.ts +19 -15
- package/dist/Countdown/__tests__/fixtures/A11yDemos.d.ts +23 -0
- package/dist/Countdown/__tests__/fixtures/A11yDemos.js +107 -0
- package/dist/Countdown/index.css +11 -0
- package/dist/DatePicker/DatePicker.d.ts +4 -0
- package/dist/DatePicker/DatePicker.js +335 -0
- package/dist/DatePicker/DatePicker.types.d.ts +36 -0
- package/dist/DatePicker/DatePicker.types.js +15 -0
- package/dist/DatePicker/constants.d.ts +9 -0
- package/dist/DatePicker/constants.js +37 -0
- package/dist/DatePicker/index.d.ts +3 -0
- package/dist/DatePicker/index.js +44 -0
- package/dist/DesktopDatePicker/DesktopDatePicker.css +61 -0
- package/dist/DesktopDatePicker/DesktopDatePicker.d.ts +5 -0
- package/dist/DesktopDatePicker/DesktopDatePicker.js +280 -0
- package/dist/DesktopDatePicker/DesktopDatePicker.types.d.ts +163 -0
- package/dist/DesktopDatePicker/DesktopDatePicker.types.js +15 -0
- package/dist/DesktopDatePicker/deskTopPickerContainer.css +100 -0
- package/dist/DesktopDatePicker/index.css +161 -0
- package/dist/DesktopDatePicker/index.d.ts +2 -0
- package/dist/DesktopDatePicker/index.js +41 -0
- package/dist/DesktopDatePicker/useGetDatePickerContent.d.ts +6 -0
- package/dist/DesktopDatePicker/useGetDatePickerContent.js +343 -0
- package/dist/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +5 -0
- package/dist/DesktopDateTimePicker/DesktopDateTimePicker.js +322 -0
- package/dist/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +163 -0
- package/dist/DesktopDateTimePicker/DesktopDateTimePicker.types.js +15 -0
- package/dist/DesktopDateTimePicker/index.css +66 -0
- package/dist/DesktopDateTimePicker/index.d.ts +2 -0
- package/dist/DesktopDateTimePicker/index.js +41 -0
- package/dist/DesktopPicker/DesktopPicker.d.ts +5 -0
- package/dist/DesktopPicker/DesktopPicker.js +243 -0
- package/dist/DesktopPicker/DesktopPicker.types.d.ts +61 -0
- package/dist/DesktopPicker/DesktopPicker.types.js +15 -0
- package/dist/DesktopPicker/index.css +39 -0
- package/dist/DesktopPicker/index.d.ts +2 -0
- package/dist/DesktopPicker/index.js +41 -0
- package/dist/DesktopPicker/utils/calcAfterMounted.d.ts +2 -0
- package/dist/{Tabs/utils/bound.js → DesktopPicker/utils/calcAfterMounted.js} +7 -14
- package/dist/DesktopPicker/utils/calcAfterMounted.miniapp.d.ts +2 -0
- package/dist/DesktopPicker/utils/calcAfterMounted.miniapp.js +38 -0
- package/dist/DesktopTimePicker/DesktopTimePicker.d.ts +5 -0
- package/dist/DesktopTimePicker/DesktopTimePicker.js +288 -0
- package/dist/DesktopTimePicker/DesktopTimePicker.types.d.ts +182 -0
- package/dist/DesktopTimePicker/DesktopTimePicker.types.js +15 -0
- package/dist/DesktopTimePicker/DesktopTimePickerList.d.ts +4 -0
- package/dist/DesktopTimePicker/DesktopTimePickerList.js +111 -0
- package/dist/DesktopTimePicker/index.css +170 -0
- package/dist/DesktopTimePicker/index.d.ts +2 -0
- package/dist/DesktopTimePicker/index.js +41 -0
- package/dist/DesktopTimePicker/useGetTimePickerContent.d.ts +6 -0
- package/dist/DesktopTimePicker/useGetTimePickerContent.js +249 -0
- package/dist/DesktopTimePicker/utils/scrollUtil.d.ts +2 -0
- package/dist/DesktopTimePicker/utils/scrollUtil.js +27 -0
- package/dist/DesktopTimePicker/utils/scrollUtil.miniapp.d.ts +2 -0
- package/dist/DesktopTimePicker/utils/scrollUtil.miniapp.js +51 -0
- package/dist/DesktopTimePicker/utils/utils.d.ts +28 -0
- package/dist/DesktopTimePicker/utils/utils.js +408 -0
- package/dist/Dialog/Dialog.d.ts +5 -2
- package/dist/Dialog/Dialog.js +56 -34
- package/dist/Dialog/Dialog.types.d.ts +50 -22
- package/dist/Dialog/FunctionalDialog.d.ts +10 -3
- package/dist/Dialog/FunctionalDialog.js +102 -80
- package/dist/Dialog/__tests__/fixtures/A11yDemos.d.ts +9 -0
- package/dist/Dialog/__tests__/fixtures/A11yDemos.js +78 -0
- package/dist/Dialog/index.css +19 -19
- package/dist/Dialog/index.d.ts +4 -1
- package/dist/Dialog/index.js +9 -2
- package/dist/Drawer/Drawer.js +7 -7
- package/dist/Drawer/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/dist/Drawer/__tests__/fixtures/A11yDemos.js +148 -0
- package/dist/Fade/Fade.js +2 -2
- package/dist/Fade/Fade.miniapp.d.ts +10 -0
- package/dist/Fade/Fade.miniapp.js +200 -0
- package/dist/Fade/index.css +18 -0
- package/dist/IconButton/IconButton.js +23 -8
- package/dist/IconButton/IconButton.types.d.ts +35 -1
- package/dist/IconButton/index.css +3 -0
- package/dist/Image/Image.js +17 -10
- package/dist/Image/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/dist/Image/__tests__/fixtures/A11yDemos.js +130 -0
- package/dist/Image/index.css +3 -8
- package/dist/Input/Input.js +5 -3
- package/dist/Input/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/dist/Input/__tests__/fixtures/A11yDemos.js +81 -0
- package/dist/Input/index.css +8 -8
- package/dist/ItemSelector/ItemSelector.types.d.ts +0 -1
- package/dist/Modal/Modal.js +47 -47
- package/dist/Modal/Modal.miniapp.d.ts +2 -2
- package/dist/Modal/Modal.miniapp.js +48 -32
- package/dist/Modal/Modal.types.d.ts +26 -2
- package/dist/Modal/ModalManager.d.ts +21 -0
- package/dist/Modal/ModalManager.js +238 -0
- package/dist/Modal/__tests__/fixtures/A11yDemos.d.ts +8 -0
- package/dist/Modal/__tests__/fixtures/A11yDemos.js +52 -0
- package/dist/Modal/index.css +1 -1
- package/dist/Modal/index.d.ts +3 -0
- package/dist/Modal/index.js +9 -1
- package/dist/Modal/useModal.d.ts +24 -0
- package/dist/Modal/useModal.js +190 -0
- package/dist/NavBar/index.css +2 -2
- package/dist/Picker/Picker.css +4 -0
- package/dist/Picker/Picker.js +72 -18
- package/dist/Picker/Picker.types.d.ts +15 -2
- package/dist/Picker/PickerPanel.css +4 -0
- package/dist/Picker/PickerPanel.js +52 -41
- package/dist/Picker/__tests__/fixtures/A11yDemos.d.ts +2 -0
- package/dist/Picker/__tests__/fixtures/A11yDemos.js +79 -0
- package/dist/Picker/index.css +8 -0
- package/dist/Picker/utils.d.ts +8 -5
- package/dist/Picker/utils.js +9 -12
- package/dist/Popover/Popover.js +123 -91
- package/dist/Popover/Popover.types.d.ts +44 -7
- package/dist/Popover/__tests__/fixtures/A11yDemos.d.ts +25 -0
- package/dist/Popover/__tests__/fixtures/A11yDemos.js +175 -0
- package/dist/Popover/hooks/index.d.ts +8 -0
- package/dist/Popover/hooks/index.js +36 -0
- package/dist/Popover/hooks/usePopoverA11y.d.ts +14 -0
- package/dist/Popover/hooks/usePopoverA11y.js +66 -0
- package/dist/Popover/hooks/usePopoverEvents.d.ts +21 -0
- package/dist/Popover/hooks/usePopoverEvents.js +150 -0
- package/dist/Popover/hooks/usePopoverPosition.d.ts +17 -0
- package/dist/Popover/hooks/usePopoverPosition.js +124 -0
- package/dist/Popover/hooks/usePopoverState.d.ts +16 -0
- package/dist/Popover/hooks/usePopoverState.js +54 -0
- package/dist/Portal/Portal.miniapp.js +20 -11
- package/dist/Portal/Portal.types.d.ts +1 -1
- package/dist/Portal/PortalCore.js +2 -2
- package/dist/Progress/Progress.js +61 -6
- package/dist/Progress/Progress.types.d.ts +44 -0
- package/dist/Progress/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/dist/Progress/__tests__/fixtures/A11yDemos.js +100 -0
- package/dist/Radio/Radio.js +5 -4
- package/dist/Radio/RadioGroup.js +1 -1
- package/dist/Radio/__tests__/fixtures/A11yDemos.d.ts +15 -0
- package/dist/Radio/__tests__/fixtures/A11yDemos.js +57 -0
- package/dist/Rating/index.css +8 -12
- package/dist/ScrollView/ScrollView.js +48 -196
- package/dist/ScrollView/ScrollView.types.d.ts +120 -86
- package/dist/ScrollView/__tests__/fixtures/A11yDemos.d.ts +7 -0
- package/dist/ScrollView/__tests__/fixtures/A11yDemos.js +319 -0
- package/dist/ScrollView/useScrollView.d.ts +10 -0
- package/dist/ScrollView/useScrollView.js +300 -0
- package/dist/Select/Select.js +73 -39
- package/dist/Select/Select.types.d.ts +2 -2
- package/dist/Select/SelectOption.js +5 -1
- package/dist/Select/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/dist/Select/__tests__/fixtures/A11yDemos.js +154 -0
- package/dist/Select/index.css +12 -8
- package/dist/Select/selectContext.d.ts +0 -1
- package/dist/Slide/Slide.js +2 -2
- package/dist/Slide/Slide.miniapp.d.ts +14 -0
- package/dist/Slide/Slide.miniapp.js +213 -0
- package/dist/Slide/index.css +72 -0
- package/dist/Slider/Slider.js +13 -5
- package/dist/Stack/demo/index.css +2 -0
- package/dist/SwipeAction/SwipeAction.css +79 -0
- package/dist/SwipeAction/SwipeAction.d.ts +5 -0
- package/dist/SwipeAction/SwipeAction.js +349 -0
- package/dist/SwipeAction/SwipeAction.types.d.ts +75 -0
- package/dist/SwipeAction/SwipeAction.types.js +15 -0
- package/dist/SwipeAction/SwipeActionContext.d.ts +3 -0
- package/dist/SwipeAction/SwipeActionContext.js +30 -0
- package/dist/SwipeAction/SwipeActionItem.css +31 -0
- package/dist/SwipeAction/SwipeActionItem.d.ts +5 -0
- package/dist/SwipeAction/SwipeActionItem.js +105 -0
- package/dist/SwipeAction/constants.d.ts +9 -0
- package/dist/SwipeAction/constants.js +39 -0
- package/dist/SwipeAction/index.css +110 -0
- package/dist/SwipeAction/index.d.ts +5 -0
- package/dist/SwipeAction/index.js +50 -0
- package/dist/Swiper/Swiper.js +18 -4
- package/dist/Switch/Switch.js +5 -4
- package/dist/Switch/__tests__/fixtures/A11yDemos.d.ts +15 -0
- package/dist/Switch/__tests__/fixtures/A11yDemos.js +57 -0
- package/dist/Tabs/Tab.js +36 -21
- package/dist/Tabs/Tab.types.d.ts +1 -1
- package/dist/Tabs/TabPanel.d.ts +1 -1
- package/dist/Tabs/TabPanel.js +9 -5
- package/dist/Tabs/Tabs.css +2 -2
- package/dist/Tabs/Tabs.js +87 -64
- package/dist/Tabs/Tabs.types.d.ts +1 -1
- package/dist/Tabs/TabsContext.d.ts +4 -5
- package/dist/Tabs/TabsContext.js +3 -1
- package/dist/Tabs/index.css +2 -2
- package/dist/Tabs/utils/scroll.d.ts +2 -0
- package/dist/Tabs/utils/scroll.js +55 -0
- package/dist/Tag/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/dist/Tag/__tests__/fixtures/A11yDemos.js +196 -0
- package/dist/TextArea/TextArea.js +50 -7
- package/dist/TextArea/TextArea.types.d.ts +28 -0
- package/dist/TextArea/__tests__/fixtures/A11yDemos.d.ts +19 -0
- package/dist/TextArea/__tests__/fixtures/A11yDemos.js +91 -0
- package/dist/TextArea/index.css +4 -4
- package/dist/ThemeProvider/ThemeProvider.types.d.ts +2 -2
- package/dist/ThemeProvider/ThemeProvider.types.js +0 -12
- package/dist/Toast/FunctionalToast.d.ts +2 -2
- package/dist/Toast/FunctionalToast.js +180 -85
- package/dist/Toast/Toast.d.ts +2 -2
- package/dist/Toast/Toast.js +69 -28
- package/dist/Toast/Toast.types.d.ts +13 -10
- package/dist/Toast/__tests__/fixtures/A11yDemos.d.ts +2 -0
- package/dist/Toast/__tests__/fixtures/A11yDemos.js +54 -0
- package/dist/Toast/index.css +0 -1
- package/dist/Tooltip/Tooltip.js +63 -107
- package/dist/Tooltip/Tooltip.types.d.ts +94 -43
- package/dist/Tooltip/__tests__/fixtures/A11yDemos.d.ts +25 -0
- package/dist/Tooltip/__tests__/fixtures/A11yDemos.js +100 -0
- package/dist/Tooltip/useTooltip.d.ts +29 -0
- package/dist/Tooltip/useTooltip.js +313 -0
- package/dist/Transition/TransitionCore.js +30 -25
- package/dist/TransitionGroup/TransitionGroup.d.ts +7 -0
- package/dist/TransitionGroup/TransitionGroup.js +132 -0
- package/dist/TransitionGroup/TransitionGroup.types.d.ts +47 -0
- package/dist/TransitionGroup/TransitionGroup.types.js +15 -0
- package/dist/TransitionGroup/demo/TransitionGroupDemo.d.ts +4 -0
- package/dist/TransitionGroup/demo/TransitionGroupDemo.js +68 -0
- package/dist/TransitionGroup/demo/index.css +33 -0
- package/dist/TransitionGroup/index.d.ts +2 -0
- package/dist/TransitionGroup/index.js +41 -0
- package/dist/TransitionGroup/utils/childMapping.d.ts +27 -0
- package/dist/TransitionGroup/utils/childMapping.js +119 -0
- package/dist/_.._/benchmarks/components/Button.js +41 -0
- package/dist/_.._/benchmarks/components/Input.js +45 -0
- package/dist/_.._/benchmarks/components/Tabs.js +50 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +17 -1
- package/dist/locales/base.d.ts +40 -1
- package/dist/locales/en-US.js +54 -2
- package/dist/locales/zh-CN.js +56 -1
- package/dist/locales/zh-TW.js +56 -1
- package/es/Alert/Alert.js +2 -1
- package/es/Alert/__tests__/fixtures/A11yDemos.d.ts +17 -0
- package/es/Alert/__tests__/fixtures/A11yDemos.js +107 -0
- package/es/Alert/index.css +4 -4
- package/es/Avatar/AvatarGroup.css +8 -8
- package/es/Avatar/index.css +8 -8
- package/es/Backdrop/Backdrop.js +3 -2
- package/es/Backdrop/Backdrop.types.d.ts +4 -0
- package/es/Backdrop/__tests__/fixtures/A11yDemos.d.ts +8 -0
- package/es/Backdrop/__tests__/fixtures/A11yDemos.js +17 -0
- package/es/Backdrop/index.css +2 -2
- package/es/Badge/Badge.js +38 -11
- package/es/Badge/Badge.types.d.ts +30 -1
- package/es/Badge/__tests__/fixtures/A11yDemos.d.ts +25 -0
- package/es/Badge/__tests__/fixtures/A11yDemos.js +70 -0
- package/es/Badge/hooks/useBadgeA11y.d.ts +23 -0
- package/es/Badge/hooks/useBadgeA11y.js +53 -0
- package/es/Badge/hooks/useBadgeDisplay.d.ts +16 -0
- package/es/Badge/hooks/useBadgeDisplay.js +33 -0
- package/es/Button/Button.js +2 -1
- package/es/Button/__tests__/fixtures/A11yDemos.d.ts +23 -0
- package/es/Button/__tests__/fixtures/A11yDemos.js +42 -0
- package/es/Button/index.css +4 -5
- package/es/CSSTransition/CSSTransition.d.ts +4 -0
- package/es/CSSTransition/CSSTransition.js +153 -0
- package/es/CSSTransition/CSSTransition.types.d.ts +13 -0
- package/es/CSSTransition/CSSTransition.types.js +1 -0
- package/es/CSSTransition/demo/CSSTransitionDemo.d.ts +4 -0
- package/es/CSSTransition/demo/CSSTransitionDemo.js +47 -0
- package/es/CSSTransition/demo/index.css +25 -0
- package/es/CSSTransition/index.d.ts +2 -0
- package/es/CSSTransition/index.js +6 -0
- package/es/Calendar/Calendar.js +131 -34
- package/es/Calendar/Calendar.types.d.ts +16 -1
- package/es/Calendar/__tests__/fixtures/A11yDemos.d.ts +2 -0
- package/es/Calendar/__tests__/fixtures/A11yDemos.js +8 -0
- package/es/Calendar/index.css +52 -9
- package/es/Calendar/utils.d.ts +7 -3
- package/es/Calendar/utils.js +29 -20
- package/es/Checkbox/Checkbox.js +5 -4
- package/es/Checkbox/__tests__/fixtures/A11yDemos.d.ts +15 -0
- package/es/Checkbox/__tests__/fixtures/A11yDemos.js +22 -0
- package/es/CitySelector/CitySelector.types.d.ts +0 -1
- package/es/Collapse/Collapse.d.ts +1 -1
- package/es/Collapse/Collapse.js +26 -12
- package/es/Collapse/Collapse.miniapp.d.ts +10 -0
- package/es/Collapse/Collapse.miniapp.js +236 -0
- package/es/Collapse/index.css +40 -1
- package/es/CollapsePanel/index.css +1 -1
- package/es/Countdown/Countdown.js +61 -21
- package/es/Countdown/Countdown.types.d.ts +19 -15
- package/es/Countdown/__tests__/fixtures/A11yDemos.d.ts +23 -0
- package/es/Countdown/__tests__/fixtures/A11yDemos.js +68 -0
- package/es/Countdown/index.css +11 -0
- package/es/DatePicker/DatePicker.d.ts +4 -0
- package/es/DatePicker/DatePicker.js +308 -0
- package/es/DatePicker/DatePicker.types.d.ts +36 -0
- package/es/DatePicker/DatePicker.types.js +1 -0
- package/es/DatePicker/constants.d.ts +9 -0
- package/es/DatePicker/constants.js +14 -0
- package/es/DatePicker/index.d.ts +3 -0
- package/es/DatePicker/index.js +8 -0
- package/es/DesktopDatePicker/DesktopDatePicker.css +61 -0
- package/es/DesktopDatePicker/DesktopDatePicker.d.ts +5 -0
- package/es/DesktopDatePicker/DesktopDatePicker.js +253 -0
- package/es/DesktopDatePicker/DesktopDatePicker.types.d.ts +163 -0
- package/es/DesktopDatePicker/DesktopDatePicker.types.js +1 -0
- package/es/DesktopDatePicker/deskTopPickerContainer.css +100 -0
- package/es/DesktopDatePicker/index.css +161 -0
- package/es/DesktopDatePicker/index.d.ts +2 -0
- package/es/DesktopDatePicker/index.js +6 -0
- package/es/DesktopDatePicker/useGetDatePickerContent.d.ts +6 -0
- package/es/DesktopDatePicker/useGetDatePickerContent.js +316 -0
- package/es/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +5 -0
- package/es/DesktopDateTimePicker/DesktopDateTimePicker.js +295 -0
- package/es/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +163 -0
- package/es/DesktopDateTimePicker/DesktopDateTimePicker.types.js +1 -0
- package/es/DesktopDateTimePicker/index.css +66 -0
- package/es/DesktopDateTimePicker/index.d.ts +2 -0
- package/es/DesktopDateTimePicker/index.js +9 -0
- package/es/DesktopPicker/DesktopPicker.d.ts +5 -0
- package/es/DesktopPicker/DesktopPicker.js +226 -0
- package/es/DesktopPicker/DesktopPicker.types.d.ts +61 -0
- package/es/DesktopPicker/DesktopPicker.types.js +1 -0
- package/es/DesktopPicker/index.css +39 -0
- package/es/DesktopPicker/index.d.ts +2 -0
- package/es/DesktopPicker/index.js +6 -0
- package/es/DesktopPicker/utils/calcAfterMounted.d.ts +2 -0
- package/es/DesktopPicker/utils/calcAfterMounted.js +6 -0
- package/es/DesktopPicker/utils/calcAfterMounted.miniapp.d.ts +2 -0
- package/es/DesktopPicker/utils/calcAfterMounted.miniapp.js +9 -0
- package/es/DesktopTimePicker/DesktopTimePicker.d.ts +5 -0
- package/es/DesktopTimePicker/DesktopTimePicker.js +261 -0
- package/es/DesktopTimePicker/DesktopTimePicker.types.d.ts +182 -0
- package/es/DesktopTimePicker/DesktopTimePicker.types.js +1 -0
- package/es/DesktopTimePicker/DesktopTimePickerList.d.ts +4 -0
- package/es/DesktopTimePicker/DesktopTimePickerList.js +84 -0
- package/es/DesktopTimePicker/index.css +170 -0
- package/es/DesktopTimePicker/index.d.ts +2 -0
- package/es/DesktopTimePicker/index.js +6 -0
- package/es/DesktopTimePicker/useGetTimePickerContent.d.ts +6 -0
- package/es/DesktopTimePicker/useGetTimePickerContent.js +226 -0
- package/es/DesktopTimePicker/utils/scrollUtil.d.ts +2 -0
- package/es/DesktopTimePicker/utils/scrollUtil.js +8 -0
- package/es/DesktopTimePicker/utils/scrollUtil.miniapp.d.ts +2 -0
- package/es/DesktopTimePicker/utils/scrollUtil.miniapp.js +22 -0
- package/es/DesktopTimePicker/utils/utils.d.ts +28 -0
- package/es/DesktopTimePicker/utils/utils.js +365 -0
- package/es/Dialog/Dialog.d.ts +5 -2
- package/es/Dialog/Dialog.js +57 -35
- package/es/Dialog/Dialog.types.d.ts +50 -22
- package/es/Dialog/FunctionalDialog.d.ts +10 -3
- package/es/Dialog/FunctionalDialog.js +106 -84
- package/es/Dialog/__tests__/fixtures/A11yDemos.d.ts +9 -0
- package/es/Dialog/__tests__/fixtures/A11yDemos.js +43 -0
- package/es/Dialog/index.css +19 -19
- package/es/Dialog/index.d.ts +4 -1
- package/es/Dialog/index.js +10 -3
- package/es/Drawer/Drawer.js +8 -8
- package/es/Drawer/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/es/Drawer/__tests__/fixtures/A11yDemos.js +112 -0
- package/es/Fade/Fade.js +2 -2
- package/es/Fade/Fade.miniapp.d.ts +10 -0
- package/es/Fade/Fade.miniapp.js +179 -0
- package/es/Fade/index.css +18 -0
- package/es/IconButton/IconButton.js +23 -8
- package/es/IconButton/IconButton.types.d.ts +35 -1
- package/es/IconButton/index.css +3 -0
- package/es/Image/Image.js +17 -10
- package/es/Image/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/es/Image/__tests__/fixtures/A11yDemos.js +92 -0
- package/es/Image/index.css +3 -8
- package/es/Input/Input.js +5 -3
- package/es/Input/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/es/Input/__tests__/fixtures/A11yDemos.js +43 -0
- package/es/Input/index.css +8 -8
- package/es/ItemSelector/ItemSelector.types.d.ts +0 -1
- package/es/Modal/Modal.js +48 -48
- package/es/Modal/Modal.miniapp.d.ts +2 -2
- package/es/Modal/Modal.miniapp.js +49 -33
- package/es/Modal/Modal.types.d.ts +26 -2
- package/es/Modal/ModalManager.d.ts +21 -0
- package/es/Modal/ModalManager.js +214 -0
- package/es/Modal/__tests__/fixtures/A11yDemos.d.ts +8 -0
- package/es/Modal/__tests__/fixtures/A11yDemos.js +18 -0
- package/es/Modal/index.css +1 -1
- package/es/Modal/index.d.ts +3 -0
- package/es/Modal/index.js +6 -1
- package/es/Modal/useModal.d.ts +24 -0
- package/es/Modal/useModal.js +169 -0
- package/es/NavBar/index.css +2 -2
- package/es/Picker/Picker.css +4 -0
- package/es/Picker/Picker.js +72 -18
- package/es/Picker/Picker.types.d.ts +15 -2
- package/es/Picker/PickerPanel.css +4 -0
- package/es/Picker/PickerPanel.js +52 -41
- package/es/Picker/__tests__/fixtures/A11yDemos.d.ts +2 -0
- package/es/Picker/__tests__/fixtures/A11yDemos.js +46 -0
- package/es/Picker/index.css +8 -0
- package/es/Picker/utils.d.ts +8 -5
- package/es/Picker/utils.js +9 -12
- package/es/Popover/Popover.js +130 -99
- package/es/Popover/Popover.types.d.ts +44 -7
- package/es/Popover/__tests__/fixtures/A11yDemos.d.ts +25 -0
- package/es/Popover/__tests__/fixtures/A11yDemos.js +135 -0
- package/es/Popover/hooks/index.d.ts +8 -0
- package/es/Popover/hooks/index.js +10 -0
- package/es/Popover/hooks/usePopoverA11y.d.ts +14 -0
- package/es/Popover/hooks/usePopoverA11y.js +43 -0
- package/es/Popover/hooks/usePopoverEvents.d.ts +21 -0
- package/es/Popover/hooks/usePopoverEvents.js +127 -0
- package/es/Popover/hooks/usePopoverPosition.d.ts +17 -0
- package/es/Popover/hooks/usePopoverPosition.js +105 -0
- package/es/Popover/hooks/usePopoverState.d.ts +16 -0
- package/es/Popover/hooks/usePopoverState.js +31 -0
- package/es/Portal/Portal.miniapp.js +21 -12
- package/es/Portal/Portal.types.d.ts +1 -1
- package/es/Portal/PortalCore.js +2 -2
- package/es/Progress/Progress.js +61 -6
- package/es/Progress/Progress.types.d.ts +44 -0
- package/es/Progress/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/es/Progress/__tests__/fixtures/A11yDemos.js +62 -0
- package/es/Radio/Radio.js +5 -4
- package/es/Radio/RadioGroup.js +1 -1
- package/es/Radio/__tests__/fixtures/A11yDemos.d.ts +15 -0
- package/es/Radio/__tests__/fixtures/A11yDemos.js +22 -0
- package/es/Rating/index.css +8 -12
- package/es/ScrollView/ScrollView.js +51 -197
- package/es/ScrollView/ScrollView.types.d.ts +120 -86
- package/es/ScrollView/__tests__/fixtures/A11yDemos.d.ts +7 -0
- package/es/ScrollView/__tests__/fixtures/A11yDemos.js +283 -0
- package/es/ScrollView/useScrollView.d.ts +10 -0
- package/es/ScrollView/useScrollView.js +279 -0
- package/es/Select/Select.js +73 -40
- package/es/Select/Select.types.d.ts +2 -2
- package/es/Select/SelectOption.js +5 -1
- package/es/Select/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/es/Select/__tests__/fixtures/A11yDemos.js +118 -0
- package/es/Select/index.css +12 -8
- package/es/Select/selectContext.d.ts +0 -1
- package/es/Slide/Slide.js +2 -2
- package/es/Slide/Slide.miniapp.d.ts +14 -0
- package/es/Slide/Slide.miniapp.js +192 -0
- package/es/Slide/index.css +72 -0
- package/es/Slider/Slider.js +16 -6
- package/es/Stack/demo/index.css +2 -0
- package/es/SwipeAction/SwipeAction.css +79 -0
- package/es/SwipeAction/SwipeAction.d.ts +5 -0
- package/es/SwipeAction/SwipeAction.js +334 -0
- package/es/SwipeAction/SwipeAction.types.d.ts +75 -0
- package/es/SwipeAction/SwipeAction.types.js +1 -0
- package/es/SwipeAction/SwipeActionContext.d.ts +3 -0
- package/es/SwipeAction/SwipeActionContext.js +11 -0
- package/es/SwipeAction/SwipeActionItem.css +31 -0
- package/es/SwipeAction/SwipeActionItem.d.ts +5 -0
- package/es/SwipeAction/SwipeActionItem.js +78 -0
- package/es/SwipeAction/constants.d.ts +9 -0
- package/es/SwipeAction/constants.js +15 -0
- package/es/SwipeAction/index.css +110 -0
- package/es/SwipeAction/index.d.ts +5 -0
- package/es/SwipeAction/index.js +12 -0
- package/es/Swiper/Swiper.js +18 -4
- package/es/Switch/Switch.js +5 -4
- package/es/Switch/__tests__/fixtures/A11yDemos.d.ts +15 -0
- package/es/Switch/__tests__/fixtures/A11yDemos.js +22 -0
- package/es/Tabs/Tab.js +36 -21
- package/es/Tabs/Tab.types.d.ts +1 -1
- package/es/Tabs/TabPanel.d.ts +1 -1
- package/es/Tabs/TabPanel.js +8 -4
- package/es/Tabs/Tabs.css +2 -2
- package/es/Tabs/Tabs.js +87 -64
- package/es/Tabs/Tabs.types.d.ts +1 -1
- package/es/Tabs/TabsContext.d.ts +4 -5
- package/es/Tabs/TabsContext.js +3 -1
- package/es/Tabs/index.css +2 -2
- package/es/Tabs/utils/scroll.d.ts +2 -0
- package/es/Tabs/utils/scroll.js +36 -0
- package/es/Tag/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/es/Tag/__tests__/fixtures/A11yDemos.js +160 -0
- package/es/TextArea/TextArea.js +51 -8
- package/es/TextArea/TextArea.types.d.ts +28 -0
- package/es/TextArea/__tests__/fixtures/A11yDemos.d.ts +19 -0
- package/es/TextArea/__tests__/fixtures/A11yDemos.js +54 -0
- package/es/TextArea/index.css +4 -4
- package/es/ThemeProvider/ThemeProvider.types.d.ts +2 -2
- package/es/Toast/FunctionalToast.d.ts +2 -2
- package/es/Toast/FunctionalToast.js +186 -86
- package/es/Toast/Toast.d.ts +2 -2
- package/es/Toast/Toast.js +69 -28
- package/es/Toast/Toast.types.d.ts +13 -10
- package/es/Toast/__tests__/fixtures/A11yDemos.d.ts +2 -0
- package/es/Toast/__tests__/fixtures/A11yDemos.js +21 -0
- package/es/Toast/index.css +0 -1
- package/es/Tooltip/Tooltip.js +64 -114
- package/es/Tooltip/Tooltip.types.d.ts +94 -43
- package/es/Tooltip/__tests__/fixtures/A11yDemos.d.ts +25 -0
- package/es/Tooltip/__tests__/fixtures/A11yDemos.js +60 -0
- package/es/Tooltip/useTooltip.d.ts +29 -0
- package/es/Tooltip/useTooltip.js +290 -0
- package/es/Transition/TransitionCore.js +31 -26
- package/es/TransitionGroup/TransitionGroup.d.ts +7 -0
- package/es/TransitionGroup/TransitionGroup.js +109 -0
- package/es/TransitionGroup/TransitionGroup.types.d.ts +47 -0
- package/es/TransitionGroup/TransitionGroup.types.js +1 -0
- package/es/TransitionGroup/demo/TransitionGroupDemo.d.ts +4 -0
- package/es/TransitionGroup/demo/TransitionGroupDemo.js +39 -0
- package/es/TransitionGroup/demo/index.css +33 -0
- package/es/TransitionGroup/index.d.ts +2 -0
- package/es/TransitionGroup/index.js +6 -0
- package/es/TransitionGroup/utils/childMapping.d.ts +27 -0
- package/es/TransitionGroup/utils/childMapping.js +93 -0
- package/es/_.._/benchmarks/components/Button.js +8 -0
- package/es/_.._/benchmarks/components/Input.js +12 -0
- package/es/_.._/benchmarks/components/Tabs.js +17 -0
- package/es/index.d.ts +8 -0
- package/es/index.js +8 -0
- package/es/locales/base.d.ts +40 -1
- package/es/locales/en-US.js +54 -2
- package/es/locales/zh-CN.js +56 -1
- package/es/locales/zh-TW.js +56 -1
- package/package.json +9 -6
- package/dist/Tabs/utils/bound.d.ts +0 -1
- package/es/Tabs/utils/bound.d.ts +0 -1
- package/es/Tabs/utils/bound.js +0 -13
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
7
|
+
function isOverflowing(container) {
|
|
8
|
+
if (document.body === container) {
|
|
9
|
+
return window.innerWidth > document.documentElement.clientWidth;
|
|
10
|
+
}
|
|
11
|
+
return container.scrollHeight > container.clientHeight;
|
|
12
|
+
}
|
|
13
|
+
function ariaHidden(element, show) {
|
|
14
|
+
if (show) {
|
|
15
|
+
element.setAttribute("aria-hidden", "true");
|
|
16
|
+
} else {
|
|
17
|
+
element.removeAttribute("aria-hidden");
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function getPaddingRight(element) {
|
|
21
|
+
return parseInt(window.getComputedStyle(element).paddingRight, 10) || 0;
|
|
22
|
+
}
|
|
23
|
+
function isAriaHiddenForbiddenOnElement(element) {
|
|
24
|
+
const forbiddenTagNames = [
|
|
25
|
+
"TEMPLATE",
|
|
26
|
+
"SCRIPT",
|
|
27
|
+
"STYLE",
|
|
28
|
+
"LINK",
|
|
29
|
+
"MAP",
|
|
30
|
+
"META",
|
|
31
|
+
"NOSCRIPT",
|
|
32
|
+
"PICTURE",
|
|
33
|
+
"COL",
|
|
34
|
+
"COLGROUP",
|
|
35
|
+
"PARAM",
|
|
36
|
+
"SLOT",
|
|
37
|
+
"SOURCE",
|
|
38
|
+
"TRACK"
|
|
39
|
+
];
|
|
40
|
+
const isForbiddenTagName = forbiddenTagNames.includes(element.tagName);
|
|
41
|
+
const isInputHidden = element.tagName === "INPUT" && element.getAttribute("type") === "hidden";
|
|
42
|
+
return isForbiddenTagName || isInputHidden;
|
|
43
|
+
}
|
|
44
|
+
function ariaHiddenSiblings(container, mountElement, currentElement, elementsToExclude, hide) {
|
|
45
|
+
const blacklist = [mountElement, currentElement, ...elementsToExclude];
|
|
46
|
+
[].forEach.call(container.children, (element) => {
|
|
47
|
+
const isNotExcludedElement = !blacklist.includes(element);
|
|
48
|
+
const isNotForbiddenElement = !isAriaHiddenForbiddenOnElement(element);
|
|
49
|
+
if (isNotExcludedElement && isNotForbiddenElement) {
|
|
50
|
+
ariaHidden(element, hide);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function findIndexOf(items, callback) {
|
|
55
|
+
let idx = -1;
|
|
56
|
+
items.some((item, index) => {
|
|
57
|
+
if (callback(item)) {
|
|
58
|
+
idx = index;
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
return false;
|
|
62
|
+
});
|
|
63
|
+
return idx;
|
|
64
|
+
}
|
|
65
|
+
function handleContainer(containerInfo) {
|
|
66
|
+
const restoreStyle = [];
|
|
67
|
+
const container = containerInfo.container;
|
|
68
|
+
const { disableScrollLock } = containerInfo;
|
|
69
|
+
if (!disableScrollLock) {
|
|
70
|
+
if (isOverflowing(container)) {
|
|
71
|
+
const scrollbarSize = window.innerWidth - document.documentElement.clientWidth;
|
|
72
|
+
restoreStyle.push({
|
|
73
|
+
property: "padding-right",
|
|
74
|
+
el: container,
|
|
75
|
+
value: container.style.paddingRight
|
|
76
|
+
});
|
|
77
|
+
container.style.paddingRight = `${getPaddingRight(container) + scrollbarSize}px`;
|
|
78
|
+
}
|
|
79
|
+
restoreStyle.push(
|
|
80
|
+
{
|
|
81
|
+
property: "overflow",
|
|
82
|
+
el: container,
|
|
83
|
+
value: container.style.overflow
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
property: "overflow-x",
|
|
87
|
+
el: container,
|
|
88
|
+
value: container.style.overflowX
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
property: "overflow-y",
|
|
92
|
+
el: container,
|
|
93
|
+
value: container.style.overflowY
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
container.style.overflow = "hidden";
|
|
97
|
+
}
|
|
98
|
+
const restore = () => {
|
|
99
|
+
restoreStyle.forEach(({ property, el, value }) => {
|
|
100
|
+
if (value) {
|
|
101
|
+
el.style.setProperty(property, value);
|
|
102
|
+
} else {
|
|
103
|
+
el.style.removeProperty(property);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
return restore;
|
|
108
|
+
}
|
|
109
|
+
function getHiddenSiblings(container) {
|
|
110
|
+
const hiddenSiblings = [];
|
|
111
|
+
[].forEach.call(container.children, (element) => {
|
|
112
|
+
if (element.getAttribute("aria-hidden") === "true") {
|
|
113
|
+
hiddenSiblings.push(element);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
return hiddenSiblings;
|
|
117
|
+
}
|
|
118
|
+
class ModalManager {
|
|
119
|
+
constructor() {
|
|
120
|
+
__publicField(this, "modals", []);
|
|
121
|
+
__publicField(this, "containers", []);
|
|
122
|
+
}
|
|
123
|
+
add(modal, container) {
|
|
124
|
+
let modalIndex = this.modals.indexOf(modal);
|
|
125
|
+
if (modalIndex !== -1) {
|
|
126
|
+
return modalIndex;
|
|
127
|
+
}
|
|
128
|
+
modalIndex = this.modals.length;
|
|
129
|
+
this.modals.push(modal);
|
|
130
|
+
if (modal.modalRef) {
|
|
131
|
+
ariaHidden(modal.modalRef, false);
|
|
132
|
+
}
|
|
133
|
+
const hiddenSiblings = getHiddenSiblings(container);
|
|
134
|
+
ariaHiddenSiblings(
|
|
135
|
+
container,
|
|
136
|
+
modal.mount,
|
|
137
|
+
modal.modalRef,
|
|
138
|
+
hiddenSiblings,
|
|
139
|
+
true
|
|
140
|
+
);
|
|
141
|
+
const containerIndex = findIndexOf(
|
|
142
|
+
this.containers,
|
|
143
|
+
(item) => item.container === container
|
|
144
|
+
);
|
|
145
|
+
if (containerIndex !== -1) {
|
|
146
|
+
this.containers[containerIndex].modals.push(modal);
|
|
147
|
+
return modalIndex;
|
|
148
|
+
}
|
|
149
|
+
this.containers.push({
|
|
150
|
+
modals: [modal],
|
|
151
|
+
container,
|
|
152
|
+
restore: null,
|
|
153
|
+
hiddenSiblings
|
|
154
|
+
});
|
|
155
|
+
return modalIndex;
|
|
156
|
+
}
|
|
157
|
+
mount(modal, props) {
|
|
158
|
+
const containerIndex = findIndexOf(
|
|
159
|
+
this.containers,
|
|
160
|
+
(item) => item.modals.includes(modal)
|
|
161
|
+
);
|
|
162
|
+
const containerInfo = this.containers[containerIndex];
|
|
163
|
+
if (!containerInfo.restore) {
|
|
164
|
+
containerInfo.restore = handleContainer({
|
|
165
|
+
container: document.body,
|
|
166
|
+
disableScrollLock: props.disableScrollLock
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
remove(modal, ariaHiddenState = true) {
|
|
171
|
+
const modalIndex = this.modals.indexOf(modal);
|
|
172
|
+
if (modalIndex === -1) {
|
|
173
|
+
return modalIndex;
|
|
174
|
+
}
|
|
175
|
+
const containerIndex = findIndexOf(
|
|
176
|
+
this.containers,
|
|
177
|
+
(item) => item.modals.indexOf(modal) !== -1
|
|
178
|
+
);
|
|
179
|
+
const containerInfo = this.containers[containerIndex];
|
|
180
|
+
containerInfo.modals.splice(containerInfo.modals.indexOf(modal), 1);
|
|
181
|
+
this.modals.splice(modalIndex, 1);
|
|
182
|
+
if (containerInfo.modals.length === 0) {
|
|
183
|
+
if (containerInfo.restore) {
|
|
184
|
+
containerInfo.restore();
|
|
185
|
+
}
|
|
186
|
+
if (modal.modalRef) {
|
|
187
|
+
ariaHidden(modal.modalRef, ariaHiddenState);
|
|
188
|
+
}
|
|
189
|
+
ariaHiddenSiblings(
|
|
190
|
+
containerInfo.container,
|
|
191
|
+
modal.mount,
|
|
192
|
+
modal.modalRef,
|
|
193
|
+
containerInfo.hiddenSiblings,
|
|
194
|
+
false
|
|
195
|
+
);
|
|
196
|
+
this.containers.splice(containerIndex, 1);
|
|
197
|
+
} else {
|
|
198
|
+
const nextTop = containerInfo.modals[containerInfo.modals.length - 1];
|
|
199
|
+
if (nextTop.modalRef) {
|
|
200
|
+
ariaHidden(nextTop.modalRef, false);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return modalIndex;
|
|
204
|
+
}
|
|
205
|
+
isTopModal(modal) {
|
|
206
|
+
return this.modals.length > 0 && this.modals[this.modals.length - 1] === modal;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
const modalManager = new ModalManager();
|
|
210
|
+
export {
|
|
211
|
+
ModalManager,
|
|
212
|
+
ariaHidden,
|
|
213
|
+
modalManager
|
|
214
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* 自定义 Modal 组件 Demo 集合
|
|
4
|
+
* 这个文件包含多个测试 demo,展示如何使用 getCustomDemoCodesFromFile 进行无障碍测试
|
|
5
|
+
* 文件名必须是 customDemoComponent.tsx(固定约定)
|
|
6
|
+
*/
|
|
7
|
+
export declare const basicModalDemo: () => React.JSX.Element;
|
|
8
|
+
export declare const keepMountedDemo: () => React.JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Modal from "../../Modal";
|
|
3
|
+
const basicModalDemo = () => {
|
|
4
|
+
return /* @__PURE__ */ React.createElement(Modal, { open: true, disablePortal: true }, "\u8FD9\u662F\u4E00\u4E2A\u57FA\u7840\u7684 Modal \u7EC4\u4EF6\u793A\u4F8B");
|
|
5
|
+
};
|
|
6
|
+
const keepMountedDemo = () => {
|
|
7
|
+
return /* @__PURE__ */ React.createElement(Modal, { disablePortal: true, keepMounted: true }, /* @__PURE__ */ React.createElement(
|
|
8
|
+
"div",
|
|
9
|
+
{
|
|
10
|
+
style: { padding: "20px", background: "white", borderRadius: "8px" }
|
|
11
|
+
},
|
|
12
|
+
"\u8FD9\u662F\u4E00\u4E2A\u57FA\u7840\u7684 keepMounted Modal \u7EC4\u4EF6\u793A\u4F8B"
|
|
13
|
+
));
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
basicModalDemo,
|
|
17
|
+
keepMountedDemo
|
|
18
|
+
};
|
package/es/Modal/index.css
CHANGED
package/es/Modal/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
export { default } from './Modal';
|
|
2
2
|
export { default as Modal } from './Modal';
|
|
3
3
|
export * from './Modal.types';
|
|
4
|
+
export { ModalManager, modalManager } from './ModalManager';
|
|
5
|
+
export { useModal } from './useModal';
|
|
6
|
+
export type { UseModalParameters, UseModalReturnValue } from './useModal';
|
package/es/Modal/index.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { default as default2 } from "./Modal";
|
|
2
2
|
import { default as default3 } from "./Modal";
|
|
3
3
|
export * from "./Modal.types";
|
|
4
|
+
import { ModalManager, modalManager } from "./ModalManager";
|
|
5
|
+
import { useModal } from "./useModal";
|
|
4
6
|
export {
|
|
5
7
|
default3 as Modal,
|
|
6
|
-
|
|
8
|
+
ModalManager,
|
|
9
|
+
default2 as default,
|
|
10
|
+
modalManager,
|
|
11
|
+
useModal
|
|
7
12
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface UseModalParameters {
|
|
3
|
+
container?: Element | (() => Element | null) | null;
|
|
4
|
+
disableScrollLock?: boolean;
|
|
5
|
+
onClose?: (event: React.SyntheticEvent<Element, Event>, detail?: {
|
|
6
|
+
from: 'backdropClick' | 'escapeKeyDown';
|
|
7
|
+
}) => void;
|
|
8
|
+
open: boolean;
|
|
9
|
+
rootRef?: React.Ref<Element>;
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}
|
|
12
|
+
export interface UseModalReturnValue {
|
|
13
|
+
getRootProps: (otherHandlers?: Record<string, any>) => Record<string, unknown>;
|
|
14
|
+
getBackdropProps: (otherHandlers?: Record<string, any>) => Record<string, unknown>;
|
|
15
|
+
getTransitionProps: () => {
|
|
16
|
+
onEnter: () => void;
|
|
17
|
+
onExited: () => void;
|
|
18
|
+
};
|
|
19
|
+
rootRef: React.RefCallback<Element>;
|
|
20
|
+
portalRef: React.RefCallback<HTMLElement>;
|
|
21
|
+
exited: boolean;
|
|
22
|
+
hasTransition: boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare function useModal(parameters: UseModalParameters): UseModalReturnValue;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
21
|
+
import { useForkRef, useEventCallback } from "@bifrostui/utils";
|
|
22
|
+
import { ariaHidden, modalManager } from "./ModalManager";
|
|
23
|
+
function getContainer(container) {
|
|
24
|
+
if (typeof container === "function") {
|
|
25
|
+
return container();
|
|
26
|
+
}
|
|
27
|
+
return container || null;
|
|
28
|
+
}
|
|
29
|
+
function getHasTransition(children) {
|
|
30
|
+
return Object.prototype.hasOwnProperty.call((children == null ? void 0 : children.props) || {}, "in");
|
|
31
|
+
}
|
|
32
|
+
function useModal(parameters) {
|
|
33
|
+
const {
|
|
34
|
+
container,
|
|
35
|
+
disableScrollLock = false,
|
|
36
|
+
onClose,
|
|
37
|
+
open,
|
|
38
|
+
rootRef,
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
|
+
children
|
|
41
|
+
} = parameters;
|
|
42
|
+
const modal = useRef({
|
|
43
|
+
modalRef: null,
|
|
44
|
+
mount: null
|
|
45
|
+
});
|
|
46
|
+
const modalRef = useRef(null);
|
|
47
|
+
const mountNodeRef = useRef(null);
|
|
48
|
+
const handleRef = useForkRef(modalRef, rootRef);
|
|
49
|
+
const [exited, setExited] = useState(!open);
|
|
50
|
+
const hasTransition = getHasTransition(children);
|
|
51
|
+
let ariaHiddenProp = true;
|
|
52
|
+
if (parameters["aria-hidden"] === "false" || parameters["aria-hidden"] === false) {
|
|
53
|
+
ariaHiddenProp = false;
|
|
54
|
+
}
|
|
55
|
+
const getModal = () => {
|
|
56
|
+
if (modalRef.current && mountNodeRef.current) {
|
|
57
|
+
modal.current.modalRef = modalRef.current;
|
|
58
|
+
modal.current.mount = mountNodeRef.current;
|
|
59
|
+
}
|
|
60
|
+
return modal.current;
|
|
61
|
+
};
|
|
62
|
+
const isTopModal = () => modalManager.isTopModal(getModal());
|
|
63
|
+
const handleMounted = () => {
|
|
64
|
+
modalManager.mount(getModal(), {
|
|
65
|
+
disableScrollLock
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
const handleOpen = useEventCallback(() => {
|
|
69
|
+
const resolvedContainer = getContainer(container) || document.body;
|
|
70
|
+
modalManager.add(getModal(), resolvedContainer);
|
|
71
|
+
if (modalRef.current) {
|
|
72
|
+
handleMounted();
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
const handlePortalRef = useEventCallback((node) => {
|
|
76
|
+
mountNodeRef.current = node;
|
|
77
|
+
if (!node) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (open && isTopModal()) {
|
|
81
|
+
handleMounted();
|
|
82
|
+
} else if (modalRef.current) {
|
|
83
|
+
ariaHidden(modalRef.current, ariaHiddenProp);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
const handleClose = useCallback(() => {
|
|
87
|
+
modalManager.remove(getModal(), ariaHiddenProp);
|
|
88
|
+
}, [ariaHiddenProp]);
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
return () => {
|
|
91
|
+
handleClose();
|
|
92
|
+
};
|
|
93
|
+
}, [handleClose]);
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
if (open) {
|
|
96
|
+
handleOpen();
|
|
97
|
+
} else {
|
|
98
|
+
handleClose();
|
|
99
|
+
}
|
|
100
|
+
}, [open, handleClose, hasTransition, handleOpen]);
|
|
101
|
+
const createHandleBackdropClick = (
|
|
102
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
103
|
+
(backdropHandlers = {}) => (event) => {
|
|
104
|
+
var _a;
|
|
105
|
+
(_a = backdropHandlers.onClick) == null ? void 0 : _a.call(backdropHandlers, event);
|
|
106
|
+
if (event.target !== event.currentTarget) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (onClose) {
|
|
110
|
+
onClose(event, { from: "backdropClick" });
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
const getRootProps = useCallback(
|
|
115
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
116
|
+
(rootHandlers) => {
|
|
117
|
+
return __spreadProps(__spreadValues({
|
|
118
|
+
role: "presentation"
|
|
119
|
+
}, rootHandlers), {
|
|
120
|
+
ref: handleRef
|
|
121
|
+
});
|
|
122
|
+
},
|
|
123
|
+
[handleRef]
|
|
124
|
+
);
|
|
125
|
+
const getBackdropProps = useCallback(
|
|
126
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
127
|
+
(backdropHandlers = {}) => {
|
|
128
|
+
const propsEventHandlers = {
|
|
129
|
+
onClick: createHandleBackdropClick(backdropHandlers)
|
|
130
|
+
};
|
|
131
|
+
const cleanedHandlers = __spreadValues({}, backdropHandlers);
|
|
132
|
+
delete cleanedHandlers.onClick;
|
|
133
|
+
return __spreadProps(__spreadValues(__spreadValues({
|
|
134
|
+
"aria-hidden": true
|
|
135
|
+
}, cleanedHandlers), propsEventHandlers), {
|
|
136
|
+
open
|
|
137
|
+
});
|
|
138
|
+
},
|
|
139
|
+
[createHandleBackdropClick, open]
|
|
140
|
+
);
|
|
141
|
+
const getTransitionProps = useCallback(() => {
|
|
142
|
+
const handleEnter = () => {
|
|
143
|
+
var _a, _b;
|
|
144
|
+
setExited(false);
|
|
145
|
+
(_b = (_a = children == null ? void 0 : children.props) == null ? void 0 : _a.onEnter) == null ? void 0 : _b.call(_a);
|
|
146
|
+
};
|
|
147
|
+
const handleExited = () => {
|
|
148
|
+
var _a, _b;
|
|
149
|
+
setExited(true);
|
|
150
|
+
(_b = (_a = children == null ? void 0 : children.props) == null ? void 0 : _a.onExited) == null ? void 0 : _b.call(_a);
|
|
151
|
+
};
|
|
152
|
+
return {
|
|
153
|
+
onEnter: handleEnter,
|
|
154
|
+
onExited: handleExited
|
|
155
|
+
};
|
|
156
|
+
}, [children]);
|
|
157
|
+
return {
|
|
158
|
+
getRootProps,
|
|
159
|
+
getBackdropProps,
|
|
160
|
+
getTransitionProps,
|
|
161
|
+
rootRef: handleRef,
|
|
162
|
+
portalRef: handlePortalRef,
|
|
163
|
+
exited,
|
|
164
|
+
hasTransition
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
export {
|
|
168
|
+
useModal
|
|
169
|
+
};
|
package/es/NavBar/index.css
CHANGED
|
@@ -6,7 +6,7 @@ xhs-page {
|
|
|
6
6
|
--bui-navbar-padding: 0 8px;
|
|
7
7
|
--bui-navbar-title-padding: 0 8px;
|
|
8
8
|
--bui-navbar-icon-font-size: 24px;
|
|
9
|
-
--bui-navbar-
|
|
9
|
+
--bui-navbar-bg-color: var(--bui-color-white);
|
|
10
10
|
--bui-navbar-border-bottom: none;
|
|
11
11
|
--bui-navbar-z-index: auto;
|
|
12
12
|
--bui-navbar-title-max-width: 60%;
|
|
@@ -20,7 +20,7 @@ xhs-page {
|
|
|
20
20
|
display: flex;
|
|
21
21
|
justify-content: center;
|
|
22
22
|
align-items: center;
|
|
23
|
-
background-color: var(--bui-navbar-
|
|
23
|
+
background-color: var(--bui-navbar-bg-color);
|
|
24
24
|
border-bottom: var(--bui-navbar-border-bottom);
|
|
25
25
|
user-select: none;
|
|
26
26
|
z-index: var(--bui-navbar-z-index);
|
package/es/Picker/Picker.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);
|
package/es/Picker/Picker.js
CHANGED
|
@@ -29,14 +29,20 @@ var __objRest = (source, exclude) => {
|
|
|
29
29
|
}
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
|
-
import clsx from "clsx";
|
|
33
32
|
import React, { useEffect, useRef, useState, useCallback } from "react";
|
|
33
|
+
import clsx from "clsx";
|
|
34
34
|
import Drawer from "../Drawer";
|
|
35
|
-
import PickerPanel from "./PickerPanel";
|
|
36
35
|
import { useLocaleText } from "../locales";
|
|
37
36
|
import { formatOptions, pickerPanelType, safeData } from "./utils";
|
|
37
|
+
import PickerPanel from "./PickerPanel";
|
|
38
38
|
import "./Picker.css";
|
|
39
39
|
const prefixCls = "bui-picker";
|
|
40
|
+
const checkDisabled = (values, columns) => values.find(
|
|
41
|
+
(value, index) => {
|
|
42
|
+
var _a, _b;
|
|
43
|
+
return (_b = (_a = columns == null ? void 0 : columns[index]) == null ? void 0 : _a.find((column) => (column == null ? void 0 : column.value) === value)) == null ? void 0 : _b.disabled;
|
|
44
|
+
}
|
|
45
|
+
);
|
|
40
46
|
const Picker = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
41
47
|
const _a = props, {
|
|
42
48
|
className,
|
|
@@ -44,6 +50,8 @@ const Picker = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
44
50
|
title,
|
|
45
51
|
options = [],
|
|
46
52
|
value,
|
|
53
|
+
confirmText: propConfirmText,
|
|
54
|
+
cancelText: propCancelText,
|
|
47
55
|
contentProps,
|
|
48
56
|
onConfirm,
|
|
49
57
|
onOptionChange,
|
|
@@ -55,6 +63,8 @@ const Picker = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
55
63
|
"title",
|
|
56
64
|
"options",
|
|
57
65
|
"value",
|
|
66
|
+
"confirmText",
|
|
67
|
+
"cancelText",
|
|
58
68
|
"contentProps",
|
|
59
69
|
"onConfirm",
|
|
60
70
|
"onOptionChange",
|
|
@@ -66,6 +76,7 @@ const Picker = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
66
76
|
const [columns, setColumns] = useState([]);
|
|
67
77
|
const [internalValue, setInternalValue] = useState([]);
|
|
68
78
|
const { cancel: cancelText, confirm: confirmText } = useLocaleText("picker");
|
|
79
|
+
const disabled = checkDisabled(internalValue, columns);
|
|
69
80
|
useEffect(() => {
|
|
70
81
|
if (!open)
|
|
71
82
|
return;
|
|
@@ -88,7 +99,7 @@ const Picker = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
88
99
|
}, [value, options]);
|
|
89
100
|
const confirm = (e) => {
|
|
90
101
|
const isMoving = rollerRefs.current.some((roller) => roller == null ? void 0 : roller.isMoving);
|
|
91
|
-
if (isMoving)
|
|
102
|
+
if (isMoving || disabled)
|
|
92
103
|
return;
|
|
93
104
|
const { safeValue } = safeData({
|
|
94
105
|
value: internalValue,
|
|
@@ -147,7 +158,8 @@ const Picker = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
147
158
|
onOptionChange == null ? void 0 : onOptionChange(e, {
|
|
148
159
|
value: conbineValues,
|
|
149
160
|
options: formatted,
|
|
150
|
-
currentOption: columnOption
|
|
161
|
+
currentOption: columnOption,
|
|
162
|
+
columnIndex
|
|
151
163
|
});
|
|
152
164
|
} else {
|
|
153
165
|
const result = [...internalValue];
|
|
@@ -156,7 +168,8 @@ const Picker = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
156
168
|
onOptionChange == null ? void 0 : onOptionChange(e, {
|
|
157
169
|
value: result,
|
|
158
170
|
options,
|
|
159
|
-
currentOption: columnOption
|
|
171
|
+
currentOption: columnOption,
|
|
172
|
+
columnIndex
|
|
160
173
|
});
|
|
161
174
|
}
|
|
162
175
|
}
|
|
@@ -191,26 +204,67 @@ const Picker = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
191
204
|
ref,
|
|
192
205
|
open,
|
|
193
206
|
className: clsx(prefixCls, className),
|
|
194
|
-
onClose: handleClose
|
|
207
|
+
onClose: handleClose,
|
|
208
|
+
role: "dialog",
|
|
209
|
+
"aria-modal": "true",
|
|
210
|
+
"aria-label": title || "Picker"
|
|
195
211
|
}, others),
|
|
196
212
|
/* @__PURE__ */ React.createElement(
|
|
197
213
|
"div",
|
|
198
214
|
__spreadProps(__spreadValues({}, contentProps), {
|
|
199
215
|
className: clsx(`${prefixCls}-content`, contentProps == null ? void 0 : contentProps.className)
|
|
200
216
|
}),
|
|
201
|
-
/* @__PURE__ */ React.createElement(
|
|
202
|
-
|
|
203
|
-
PickerPanel,
|
|
217
|
+
/* @__PURE__ */ React.createElement(
|
|
218
|
+
"div",
|
|
204
219
|
{
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
220
|
+
className: `${prefixCls}-header`,
|
|
221
|
+
role: "toolbar",
|
|
222
|
+
"aria-label": "Toolbar"
|
|
223
|
+
},
|
|
224
|
+
/* @__PURE__ */ React.createElement(
|
|
225
|
+
"div",
|
|
226
|
+
{
|
|
227
|
+
className: `${prefixCls}-cancel`,
|
|
228
|
+
onClick: cancel,
|
|
229
|
+
"aria-label": "Cancel"
|
|
230
|
+
},
|
|
231
|
+
propCancelText || cancelText
|
|
232
|
+
),
|
|
233
|
+
title && /* @__PURE__ */ React.createElement("div", { className: `${prefixCls}-title`, role: "heading", "aria-level": 2 }, title),
|
|
234
|
+
/* @__PURE__ */ React.createElement(
|
|
235
|
+
"div",
|
|
236
|
+
{
|
|
237
|
+
className: clsx(`${prefixCls}-confirm`, {
|
|
238
|
+
[`${prefixCls}-confirm-disabled`]: disabled
|
|
239
|
+
}),
|
|
240
|
+
onClick: confirm,
|
|
241
|
+
type: "button",
|
|
242
|
+
"aria-label": "Confirm",
|
|
243
|
+
tabIndex: disabled ? -1 : 0
|
|
244
|
+
},
|
|
245
|
+
propConfirmText || confirmText
|
|
246
|
+
)
|
|
247
|
+
),
|
|
248
|
+
/* @__PURE__ */ React.createElement(
|
|
249
|
+
"div",
|
|
250
|
+
{
|
|
251
|
+
className: `${prefixCls}-container`,
|
|
252
|
+
role: "listbox",
|
|
253
|
+
"aria-label": "Options"
|
|
254
|
+
},
|
|
255
|
+
columns.map((column, index) => /* @__PURE__ */ React.createElement(
|
|
256
|
+
PickerPanel,
|
|
257
|
+
{
|
|
258
|
+
ref: setRefs(index),
|
|
259
|
+
key: index,
|
|
260
|
+
options: column,
|
|
261
|
+
columnIndex: index,
|
|
262
|
+
value: internalValue == null ? void 0 : internalValue[index],
|
|
263
|
+
onSelect: handleSelect,
|
|
264
|
+
open
|
|
265
|
+
}
|
|
266
|
+
))
|
|
267
|
+
)
|
|
214
268
|
)
|
|
215
269
|
);
|
|
216
270
|
});
|