@bifrostui/react 2.0.0-alpha.0 → 2.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Alert/Alert.js +2 -1
- package/dist/Alert/__tests__/fixtures/A11yDemos.d.ts +17 -0
- package/dist/Alert/__tests__/fixtures/A11yDemos.js +143 -0
- package/dist/Alert/index.css +4 -4
- package/dist/Avatar/AvatarGroup.css +8 -8
- package/dist/Avatar/index.css +8 -8
- package/dist/Backdrop/Backdrop.js +3 -2
- package/dist/Backdrop/Backdrop.types.d.ts +4 -0
- package/dist/Backdrop/__tests__/fixtures/A11yDemos.d.ts +8 -0
- package/dist/Backdrop/__tests__/fixtures/A11yDemos.js +51 -0
- package/dist/Backdrop/index.css +2 -2
- package/dist/Badge/Badge.js +38 -11
- package/dist/Badge/Badge.types.d.ts +30 -1
- package/dist/Badge/__tests__/fixtures/A11yDemos.d.ts +25 -0
- package/dist/Badge/__tests__/fixtures/A11yDemos.js +110 -0
- package/dist/Badge/hooks/useBadgeA11y.d.ts +23 -0
- package/dist/Badge/hooks/useBadgeA11y.js +76 -0
- package/dist/Badge/hooks/useBadgeDisplay.d.ts +16 -0
- package/dist/Badge/hooks/useBadgeDisplay.js +56 -0
- package/dist/Button/Button.js +2 -1
- package/dist/Button/__tests__/fixtures/A11yDemos.d.ts +23 -0
- package/dist/Button/__tests__/fixtures/A11yDemos.js +81 -0
- package/dist/Button/index.css +4 -5
- package/dist/CSSTransition/CSSTransition.d.ts +4 -0
- package/dist/CSSTransition/CSSTransition.js +177 -0
- package/dist/CSSTransition/CSSTransition.types.d.ts +13 -0
- package/dist/CSSTransition/CSSTransition.types.js +15 -0
- package/dist/CSSTransition/demo/CSSTransitionDemo.d.ts +4 -0
- package/dist/CSSTransition/demo/CSSTransitionDemo.js +76 -0
- package/dist/CSSTransition/demo/index.css +25 -0
- package/dist/CSSTransition/index.d.ts +2 -0
- package/dist/CSSTransition/index.js +41 -0
- package/dist/Calendar/Calendar.js +131 -34
- package/dist/Calendar/Calendar.types.d.ts +16 -1
- package/dist/Calendar/__tests__/fixtures/A11yDemos.d.ts +2 -0
- package/dist/Calendar/__tests__/fixtures/A11yDemos.js +41 -0
- package/dist/Calendar/index.css +52 -9
- package/dist/Calendar/utils.d.ts +7 -3
- package/dist/Calendar/utils.js +33 -23
- package/dist/Checkbox/Checkbox.js +5 -4
- package/dist/Checkbox/__tests__/fixtures/A11yDemos.d.ts +15 -0
- package/dist/Checkbox/__tests__/fixtures/A11yDemos.js +57 -0
- package/dist/CitySelector/CitySelector.types.d.ts +0 -1
- package/dist/Collapse/Collapse.d.ts +1 -1
- package/dist/Collapse/Collapse.js +26 -12
- package/dist/Collapse/Collapse.miniapp.d.ts +10 -0
- package/dist/Collapse/Collapse.miniapp.js +255 -0
- package/dist/Collapse/index.css +40 -1
- package/dist/CollapsePanel/index.css +1 -1
- package/dist/Countdown/Countdown.js +61 -21
- package/dist/Countdown/Countdown.types.d.ts +19 -15
- package/dist/Countdown/__tests__/fixtures/A11yDemos.d.ts +23 -0
- package/dist/Countdown/__tests__/fixtures/A11yDemos.js +107 -0
- package/dist/Countdown/index.css +11 -0
- package/dist/DatePicker/DatePicker.d.ts +4 -0
- package/dist/DatePicker/DatePicker.js +335 -0
- package/dist/DatePicker/DatePicker.types.d.ts +36 -0
- package/dist/DatePicker/DatePicker.types.js +15 -0
- package/dist/DatePicker/constants.d.ts +9 -0
- package/dist/DatePicker/constants.js +37 -0
- package/dist/DatePicker/index.d.ts +3 -0
- package/dist/DatePicker/index.js +44 -0
- package/dist/DesktopDatePicker/DesktopDatePicker.css +61 -0
- package/dist/DesktopDatePicker/DesktopDatePicker.d.ts +5 -0
- package/dist/DesktopDatePicker/DesktopDatePicker.js +280 -0
- package/dist/DesktopDatePicker/DesktopDatePicker.types.d.ts +163 -0
- package/dist/DesktopDatePicker/DesktopDatePicker.types.js +15 -0
- package/dist/DesktopDatePicker/deskTopPickerContainer.css +100 -0
- package/dist/DesktopDatePicker/index.css +161 -0
- package/dist/DesktopDatePicker/index.d.ts +2 -0
- package/dist/DesktopDatePicker/index.js +41 -0
- package/dist/DesktopDatePicker/useGetDatePickerContent.d.ts +6 -0
- package/dist/DesktopDatePicker/useGetDatePickerContent.js +343 -0
- package/dist/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +5 -0
- package/dist/DesktopDateTimePicker/DesktopDateTimePicker.js +322 -0
- package/dist/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +163 -0
- package/dist/DesktopDateTimePicker/DesktopDateTimePicker.types.js +15 -0
- package/dist/DesktopDateTimePicker/index.css +66 -0
- package/dist/DesktopDateTimePicker/index.d.ts +2 -0
- package/dist/DesktopDateTimePicker/index.js +41 -0
- package/dist/DesktopPicker/DesktopPicker.d.ts +5 -0
- package/dist/DesktopPicker/DesktopPicker.js +243 -0
- package/dist/DesktopPicker/DesktopPicker.types.d.ts +61 -0
- package/dist/DesktopPicker/DesktopPicker.types.js +15 -0
- package/dist/DesktopPicker/index.css +39 -0
- package/dist/DesktopPicker/index.d.ts +2 -0
- package/dist/DesktopPicker/index.js +41 -0
- package/dist/DesktopPicker/utils/calcAfterMounted.d.ts +2 -0
- package/dist/{Tabs/utils/bound.js → DesktopPicker/utils/calcAfterMounted.js} +7 -14
- package/dist/DesktopPicker/utils/calcAfterMounted.miniapp.d.ts +2 -0
- package/dist/DesktopPicker/utils/calcAfterMounted.miniapp.js +38 -0
- package/dist/DesktopTimePicker/DesktopTimePicker.d.ts +5 -0
- package/dist/DesktopTimePicker/DesktopTimePicker.js +288 -0
- package/dist/DesktopTimePicker/DesktopTimePicker.types.d.ts +182 -0
- package/dist/DesktopTimePicker/DesktopTimePicker.types.js +15 -0
- package/dist/DesktopTimePicker/DesktopTimePickerList.d.ts +4 -0
- package/dist/DesktopTimePicker/DesktopTimePickerList.js +111 -0
- package/dist/DesktopTimePicker/index.css +170 -0
- package/dist/DesktopTimePicker/index.d.ts +2 -0
- package/dist/DesktopTimePicker/index.js +41 -0
- package/dist/DesktopTimePicker/useGetTimePickerContent.d.ts +6 -0
- package/dist/DesktopTimePicker/useGetTimePickerContent.js +249 -0
- package/dist/DesktopTimePicker/utils/scrollUtil.d.ts +2 -0
- package/dist/DesktopTimePicker/utils/scrollUtil.js +27 -0
- package/dist/DesktopTimePicker/utils/scrollUtil.miniapp.d.ts +2 -0
- package/dist/DesktopTimePicker/utils/scrollUtil.miniapp.js +51 -0
- package/dist/DesktopTimePicker/utils/utils.d.ts +28 -0
- package/dist/DesktopTimePicker/utils/utils.js +408 -0
- package/dist/Dialog/Dialog.d.ts +5 -2
- package/dist/Dialog/Dialog.js +56 -34
- package/dist/Dialog/Dialog.types.d.ts +50 -22
- package/dist/Dialog/FunctionalDialog.d.ts +10 -3
- package/dist/Dialog/FunctionalDialog.js +102 -80
- package/dist/Dialog/__tests__/fixtures/A11yDemos.d.ts +9 -0
- package/dist/Dialog/__tests__/fixtures/A11yDemos.js +78 -0
- package/dist/Dialog/index.css +19 -19
- package/dist/Dialog/index.d.ts +4 -1
- package/dist/Dialog/index.js +9 -2
- package/dist/Drawer/Drawer.js +7 -7
- package/dist/Drawer/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/dist/Drawer/__tests__/fixtures/A11yDemos.js +148 -0
- package/dist/Fade/Fade.js +2 -2
- package/dist/Fade/Fade.miniapp.d.ts +10 -0
- package/dist/Fade/Fade.miniapp.js +200 -0
- package/dist/Fade/index.css +18 -0
- package/dist/IconButton/IconButton.js +23 -8
- package/dist/IconButton/IconButton.types.d.ts +35 -1
- package/dist/IconButton/index.css +3 -0
- package/dist/Image/Image.js +17 -10
- package/dist/Image/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/dist/Image/__tests__/fixtures/A11yDemos.js +130 -0
- package/dist/Image/index.css +3 -8
- package/dist/Input/Input.js +5 -3
- package/dist/Input/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/dist/Input/__tests__/fixtures/A11yDemos.js +81 -0
- package/dist/Input/index.css +8 -8
- package/dist/ItemSelector/ItemSelector.types.d.ts +0 -1
- package/dist/Modal/Modal.js +47 -47
- package/dist/Modal/Modal.miniapp.d.ts +2 -2
- package/dist/Modal/Modal.miniapp.js +48 -32
- package/dist/Modal/Modal.types.d.ts +26 -2
- package/dist/Modal/ModalManager.d.ts +21 -0
- package/dist/Modal/ModalManager.js +238 -0
- package/dist/Modal/__tests__/fixtures/A11yDemos.d.ts +8 -0
- package/dist/Modal/__tests__/fixtures/A11yDemos.js +52 -0
- package/dist/Modal/index.css +1 -1
- package/dist/Modal/index.d.ts +3 -0
- package/dist/Modal/index.js +9 -1
- package/dist/Modal/useModal.d.ts +24 -0
- package/dist/Modal/useModal.js +190 -0
- package/dist/NavBar/index.css +2 -2
- package/dist/Picker/Picker.css +4 -0
- package/dist/Picker/Picker.js +72 -18
- package/dist/Picker/Picker.types.d.ts +15 -2
- package/dist/Picker/PickerPanel.css +4 -0
- package/dist/Picker/PickerPanel.js +52 -41
- package/dist/Picker/__tests__/fixtures/A11yDemos.d.ts +2 -0
- package/dist/Picker/__tests__/fixtures/A11yDemos.js +79 -0
- package/dist/Picker/index.css +8 -0
- package/dist/Picker/utils.d.ts +8 -5
- package/dist/Picker/utils.js +9 -12
- package/dist/Popover/Popover.js +123 -91
- package/dist/Popover/Popover.types.d.ts +44 -7
- package/dist/Popover/__tests__/fixtures/A11yDemos.d.ts +25 -0
- package/dist/Popover/__tests__/fixtures/A11yDemos.js +175 -0
- package/dist/Popover/hooks/index.d.ts +8 -0
- package/dist/Popover/hooks/index.js +36 -0
- package/dist/Popover/hooks/usePopoverA11y.d.ts +14 -0
- package/dist/Popover/hooks/usePopoverA11y.js +66 -0
- package/dist/Popover/hooks/usePopoverEvents.d.ts +21 -0
- package/dist/Popover/hooks/usePopoverEvents.js +150 -0
- package/dist/Popover/hooks/usePopoverPosition.d.ts +17 -0
- package/dist/Popover/hooks/usePopoverPosition.js +124 -0
- package/dist/Popover/hooks/usePopoverState.d.ts +16 -0
- package/dist/Popover/hooks/usePopoverState.js +54 -0
- package/dist/Portal/Portal.miniapp.js +20 -11
- package/dist/Portal/Portal.types.d.ts +1 -1
- package/dist/Portal/PortalCore.js +2 -2
- package/dist/Progress/Progress.js +61 -6
- package/dist/Progress/Progress.types.d.ts +44 -0
- package/dist/Progress/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/dist/Progress/__tests__/fixtures/A11yDemos.js +100 -0
- package/dist/Radio/Radio.js +5 -4
- package/dist/Radio/RadioGroup.js +1 -1
- package/dist/Radio/__tests__/fixtures/A11yDemos.d.ts +15 -0
- package/dist/Radio/__tests__/fixtures/A11yDemos.js +57 -0
- package/dist/Rating/index.css +8 -12
- package/dist/ScrollView/ScrollView.js +48 -196
- package/dist/ScrollView/ScrollView.types.d.ts +120 -86
- package/dist/ScrollView/__tests__/fixtures/A11yDemos.d.ts +7 -0
- package/dist/ScrollView/__tests__/fixtures/A11yDemos.js +319 -0
- package/dist/ScrollView/useScrollView.d.ts +10 -0
- package/dist/ScrollView/useScrollView.js +300 -0
- package/dist/Select/Select.js +73 -39
- package/dist/Select/Select.types.d.ts +2 -2
- package/dist/Select/SelectOption.js +5 -1
- package/dist/Select/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/dist/Select/__tests__/fixtures/A11yDemos.js +154 -0
- package/dist/Select/index.css +12 -8
- package/dist/Select/selectContext.d.ts +0 -1
- package/dist/Slide/Slide.js +2 -2
- package/dist/Slide/Slide.miniapp.d.ts +14 -0
- package/dist/Slide/Slide.miniapp.js +213 -0
- package/dist/Slide/index.css +72 -0
- package/dist/Slider/Slider.js +13 -5
- package/dist/Stack/demo/index.css +2 -0
- package/dist/SwipeAction/SwipeAction.css +79 -0
- package/dist/SwipeAction/SwipeAction.d.ts +5 -0
- package/dist/SwipeAction/SwipeAction.js +349 -0
- package/dist/SwipeAction/SwipeAction.types.d.ts +75 -0
- package/dist/SwipeAction/SwipeAction.types.js +15 -0
- package/dist/SwipeAction/SwipeActionContext.d.ts +3 -0
- package/dist/SwipeAction/SwipeActionContext.js +30 -0
- package/dist/SwipeAction/SwipeActionItem.css +31 -0
- package/dist/SwipeAction/SwipeActionItem.d.ts +5 -0
- package/dist/SwipeAction/SwipeActionItem.js +105 -0
- package/dist/SwipeAction/constants.d.ts +9 -0
- package/dist/SwipeAction/constants.js +39 -0
- package/dist/SwipeAction/index.css +110 -0
- package/dist/SwipeAction/index.d.ts +5 -0
- package/dist/SwipeAction/index.js +50 -0
- package/dist/Swiper/Swiper.js +18 -4
- package/dist/Switch/Switch.js +5 -4
- package/dist/Switch/__tests__/fixtures/A11yDemos.d.ts +15 -0
- package/dist/Switch/__tests__/fixtures/A11yDemos.js +57 -0
- package/dist/Tabs/Tab.js +36 -21
- package/dist/Tabs/Tab.types.d.ts +1 -1
- package/dist/Tabs/TabPanel.d.ts +1 -1
- package/dist/Tabs/TabPanel.js +9 -5
- package/dist/Tabs/Tabs.css +2 -2
- package/dist/Tabs/Tabs.js +87 -64
- package/dist/Tabs/Tabs.types.d.ts +1 -1
- package/dist/Tabs/TabsContext.d.ts +4 -5
- package/dist/Tabs/TabsContext.js +3 -1
- package/dist/Tabs/index.css +2 -2
- package/dist/Tabs/utils/scroll.d.ts +2 -0
- package/dist/Tabs/utils/scroll.js +55 -0
- package/dist/Tag/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/dist/Tag/__tests__/fixtures/A11yDemos.js +196 -0
- package/dist/TextArea/TextArea.js +50 -7
- package/dist/TextArea/TextArea.types.d.ts +28 -0
- package/dist/TextArea/__tests__/fixtures/A11yDemos.d.ts +19 -0
- package/dist/TextArea/__tests__/fixtures/A11yDemos.js +91 -0
- package/dist/TextArea/index.css +4 -4
- package/dist/ThemeProvider/ThemeProvider.types.d.ts +2 -2
- package/dist/ThemeProvider/ThemeProvider.types.js +0 -12
- package/dist/Toast/FunctionalToast.d.ts +2 -2
- package/dist/Toast/FunctionalToast.js +180 -85
- package/dist/Toast/Toast.d.ts +2 -2
- package/dist/Toast/Toast.js +69 -28
- package/dist/Toast/Toast.types.d.ts +13 -10
- package/dist/Toast/__tests__/fixtures/A11yDemos.d.ts +2 -0
- package/dist/Toast/__tests__/fixtures/A11yDemos.js +54 -0
- package/dist/Toast/index.css +0 -1
- package/dist/Tooltip/Tooltip.js +63 -107
- package/dist/Tooltip/Tooltip.types.d.ts +94 -43
- package/dist/Tooltip/__tests__/fixtures/A11yDemos.d.ts +25 -0
- package/dist/Tooltip/__tests__/fixtures/A11yDemos.js +100 -0
- package/dist/Tooltip/useTooltip.d.ts +29 -0
- package/dist/Tooltip/useTooltip.js +313 -0
- package/dist/Transition/TransitionCore.js +30 -25
- package/dist/TransitionGroup/TransitionGroup.d.ts +7 -0
- package/dist/TransitionGroup/TransitionGroup.js +132 -0
- package/dist/TransitionGroup/TransitionGroup.types.d.ts +47 -0
- package/dist/TransitionGroup/TransitionGroup.types.js +15 -0
- package/dist/TransitionGroup/demo/TransitionGroupDemo.d.ts +4 -0
- package/dist/TransitionGroup/demo/TransitionGroupDemo.js +68 -0
- package/dist/TransitionGroup/demo/index.css +33 -0
- package/dist/TransitionGroup/index.d.ts +2 -0
- package/dist/TransitionGroup/index.js +41 -0
- package/dist/TransitionGroup/utils/childMapping.d.ts +27 -0
- package/dist/TransitionGroup/utils/childMapping.js +119 -0
- package/dist/_.._/benchmarks/components/Button.js +41 -0
- package/dist/_.._/benchmarks/components/Input.js +45 -0
- package/dist/_.._/benchmarks/components/Tabs.js +50 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +17 -1
- package/dist/locales/base.d.ts +40 -1
- package/dist/locales/en-US.js +54 -2
- package/dist/locales/zh-CN.js +56 -1
- package/dist/locales/zh-TW.js +56 -1
- package/es/Alert/Alert.js +2 -1
- package/es/Alert/__tests__/fixtures/A11yDemos.d.ts +17 -0
- package/es/Alert/__tests__/fixtures/A11yDemos.js +107 -0
- package/es/Alert/index.css +4 -4
- package/es/Avatar/AvatarGroup.css +8 -8
- package/es/Avatar/index.css +8 -8
- package/es/Backdrop/Backdrop.js +3 -2
- package/es/Backdrop/Backdrop.types.d.ts +4 -0
- package/es/Backdrop/__tests__/fixtures/A11yDemos.d.ts +8 -0
- package/es/Backdrop/__tests__/fixtures/A11yDemos.js +17 -0
- package/es/Backdrop/index.css +2 -2
- package/es/Badge/Badge.js +38 -11
- package/es/Badge/Badge.types.d.ts +30 -1
- package/es/Badge/__tests__/fixtures/A11yDemos.d.ts +25 -0
- package/es/Badge/__tests__/fixtures/A11yDemos.js +70 -0
- package/es/Badge/hooks/useBadgeA11y.d.ts +23 -0
- package/es/Badge/hooks/useBadgeA11y.js +53 -0
- package/es/Badge/hooks/useBadgeDisplay.d.ts +16 -0
- package/es/Badge/hooks/useBadgeDisplay.js +33 -0
- package/es/Button/Button.js +2 -1
- package/es/Button/__tests__/fixtures/A11yDemos.d.ts +23 -0
- package/es/Button/__tests__/fixtures/A11yDemos.js +42 -0
- package/es/Button/index.css +4 -5
- package/es/CSSTransition/CSSTransition.d.ts +4 -0
- package/es/CSSTransition/CSSTransition.js +153 -0
- package/es/CSSTransition/CSSTransition.types.d.ts +13 -0
- package/es/CSSTransition/CSSTransition.types.js +1 -0
- package/es/CSSTransition/demo/CSSTransitionDemo.d.ts +4 -0
- package/es/CSSTransition/demo/CSSTransitionDemo.js +47 -0
- package/es/CSSTransition/demo/index.css +25 -0
- package/es/CSSTransition/index.d.ts +2 -0
- package/es/CSSTransition/index.js +6 -0
- package/es/Calendar/Calendar.js +131 -34
- package/es/Calendar/Calendar.types.d.ts +16 -1
- package/es/Calendar/__tests__/fixtures/A11yDemos.d.ts +2 -0
- package/es/Calendar/__tests__/fixtures/A11yDemos.js +8 -0
- package/es/Calendar/index.css +52 -9
- package/es/Calendar/utils.d.ts +7 -3
- package/es/Calendar/utils.js +29 -20
- package/es/Checkbox/Checkbox.js +5 -4
- package/es/Checkbox/__tests__/fixtures/A11yDemos.d.ts +15 -0
- package/es/Checkbox/__tests__/fixtures/A11yDemos.js +22 -0
- package/es/CitySelector/CitySelector.types.d.ts +0 -1
- package/es/Collapse/Collapse.d.ts +1 -1
- package/es/Collapse/Collapse.js +26 -12
- package/es/Collapse/Collapse.miniapp.d.ts +10 -0
- package/es/Collapse/Collapse.miniapp.js +236 -0
- package/es/Collapse/index.css +40 -1
- package/es/CollapsePanel/index.css +1 -1
- package/es/Countdown/Countdown.js +61 -21
- package/es/Countdown/Countdown.types.d.ts +19 -15
- package/es/Countdown/__tests__/fixtures/A11yDemos.d.ts +23 -0
- package/es/Countdown/__tests__/fixtures/A11yDemos.js +68 -0
- package/es/Countdown/index.css +11 -0
- package/es/DatePicker/DatePicker.d.ts +4 -0
- package/es/DatePicker/DatePicker.js +308 -0
- package/es/DatePicker/DatePicker.types.d.ts +36 -0
- package/es/DatePicker/DatePicker.types.js +1 -0
- package/es/DatePicker/constants.d.ts +9 -0
- package/es/DatePicker/constants.js +14 -0
- package/es/DatePicker/index.d.ts +3 -0
- package/es/DatePicker/index.js +8 -0
- package/es/DesktopDatePicker/DesktopDatePicker.css +61 -0
- package/es/DesktopDatePicker/DesktopDatePicker.d.ts +5 -0
- package/es/DesktopDatePicker/DesktopDatePicker.js +253 -0
- package/es/DesktopDatePicker/DesktopDatePicker.types.d.ts +163 -0
- package/es/DesktopDatePicker/DesktopDatePicker.types.js +1 -0
- package/es/DesktopDatePicker/deskTopPickerContainer.css +100 -0
- package/es/DesktopDatePicker/index.css +161 -0
- package/es/DesktopDatePicker/index.d.ts +2 -0
- package/es/DesktopDatePicker/index.js +6 -0
- package/es/DesktopDatePicker/useGetDatePickerContent.d.ts +6 -0
- package/es/DesktopDatePicker/useGetDatePickerContent.js +316 -0
- package/es/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +5 -0
- package/es/DesktopDateTimePicker/DesktopDateTimePicker.js +295 -0
- package/es/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +163 -0
- package/es/DesktopDateTimePicker/DesktopDateTimePicker.types.js +1 -0
- package/es/DesktopDateTimePicker/index.css +66 -0
- package/es/DesktopDateTimePicker/index.d.ts +2 -0
- package/es/DesktopDateTimePicker/index.js +9 -0
- package/es/DesktopPicker/DesktopPicker.d.ts +5 -0
- package/es/DesktopPicker/DesktopPicker.js +226 -0
- package/es/DesktopPicker/DesktopPicker.types.d.ts +61 -0
- package/es/DesktopPicker/DesktopPicker.types.js +1 -0
- package/es/DesktopPicker/index.css +39 -0
- package/es/DesktopPicker/index.d.ts +2 -0
- package/es/DesktopPicker/index.js +6 -0
- package/es/DesktopPicker/utils/calcAfterMounted.d.ts +2 -0
- package/es/DesktopPicker/utils/calcAfterMounted.js +6 -0
- package/es/DesktopPicker/utils/calcAfterMounted.miniapp.d.ts +2 -0
- package/es/DesktopPicker/utils/calcAfterMounted.miniapp.js +9 -0
- package/es/DesktopTimePicker/DesktopTimePicker.d.ts +5 -0
- package/es/DesktopTimePicker/DesktopTimePicker.js +261 -0
- package/es/DesktopTimePicker/DesktopTimePicker.types.d.ts +182 -0
- package/es/DesktopTimePicker/DesktopTimePicker.types.js +1 -0
- package/es/DesktopTimePicker/DesktopTimePickerList.d.ts +4 -0
- package/es/DesktopTimePicker/DesktopTimePickerList.js +84 -0
- package/es/DesktopTimePicker/index.css +170 -0
- package/es/DesktopTimePicker/index.d.ts +2 -0
- package/es/DesktopTimePicker/index.js +6 -0
- package/es/DesktopTimePicker/useGetTimePickerContent.d.ts +6 -0
- package/es/DesktopTimePicker/useGetTimePickerContent.js +226 -0
- package/es/DesktopTimePicker/utils/scrollUtil.d.ts +2 -0
- package/es/DesktopTimePicker/utils/scrollUtil.js +8 -0
- package/es/DesktopTimePicker/utils/scrollUtil.miniapp.d.ts +2 -0
- package/es/DesktopTimePicker/utils/scrollUtil.miniapp.js +22 -0
- package/es/DesktopTimePicker/utils/utils.d.ts +28 -0
- package/es/DesktopTimePicker/utils/utils.js +365 -0
- package/es/Dialog/Dialog.d.ts +5 -2
- package/es/Dialog/Dialog.js +57 -35
- package/es/Dialog/Dialog.types.d.ts +50 -22
- package/es/Dialog/FunctionalDialog.d.ts +10 -3
- package/es/Dialog/FunctionalDialog.js +106 -84
- package/es/Dialog/__tests__/fixtures/A11yDemos.d.ts +9 -0
- package/es/Dialog/__tests__/fixtures/A11yDemos.js +43 -0
- package/es/Dialog/index.css +19 -19
- package/es/Dialog/index.d.ts +4 -1
- package/es/Dialog/index.js +10 -3
- package/es/Drawer/Drawer.js +8 -8
- package/es/Drawer/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/es/Drawer/__tests__/fixtures/A11yDemos.js +112 -0
- package/es/Fade/Fade.js +2 -2
- package/es/Fade/Fade.miniapp.d.ts +10 -0
- package/es/Fade/Fade.miniapp.js +179 -0
- package/es/Fade/index.css +18 -0
- package/es/IconButton/IconButton.js +23 -8
- package/es/IconButton/IconButton.types.d.ts +35 -1
- package/es/IconButton/index.css +3 -0
- package/es/Image/Image.js +17 -10
- package/es/Image/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/es/Image/__tests__/fixtures/A11yDemos.js +92 -0
- package/es/Image/index.css +3 -8
- package/es/Input/Input.js +5 -3
- package/es/Input/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/es/Input/__tests__/fixtures/A11yDemos.js +43 -0
- package/es/Input/index.css +8 -8
- package/es/ItemSelector/ItemSelector.types.d.ts +0 -1
- package/es/Modal/Modal.js +48 -48
- package/es/Modal/Modal.miniapp.d.ts +2 -2
- package/es/Modal/Modal.miniapp.js +49 -33
- package/es/Modal/Modal.types.d.ts +26 -2
- package/es/Modal/ModalManager.d.ts +21 -0
- package/es/Modal/ModalManager.js +214 -0
- package/es/Modal/__tests__/fixtures/A11yDemos.d.ts +8 -0
- package/es/Modal/__tests__/fixtures/A11yDemos.js +18 -0
- package/es/Modal/index.css +1 -1
- package/es/Modal/index.d.ts +3 -0
- package/es/Modal/index.js +6 -1
- package/es/Modal/useModal.d.ts +24 -0
- package/es/Modal/useModal.js +169 -0
- package/es/NavBar/index.css +2 -2
- package/es/Picker/Picker.css +4 -0
- package/es/Picker/Picker.js +72 -18
- package/es/Picker/Picker.types.d.ts +15 -2
- package/es/Picker/PickerPanel.css +4 -0
- package/es/Picker/PickerPanel.js +52 -41
- package/es/Picker/__tests__/fixtures/A11yDemos.d.ts +2 -0
- package/es/Picker/__tests__/fixtures/A11yDemos.js +46 -0
- package/es/Picker/index.css +8 -0
- package/es/Picker/utils.d.ts +8 -5
- package/es/Picker/utils.js +9 -12
- package/es/Popover/Popover.js +130 -99
- package/es/Popover/Popover.types.d.ts +44 -7
- package/es/Popover/__tests__/fixtures/A11yDemos.d.ts +25 -0
- package/es/Popover/__tests__/fixtures/A11yDemos.js +135 -0
- package/es/Popover/hooks/index.d.ts +8 -0
- package/es/Popover/hooks/index.js +10 -0
- package/es/Popover/hooks/usePopoverA11y.d.ts +14 -0
- package/es/Popover/hooks/usePopoverA11y.js +43 -0
- package/es/Popover/hooks/usePopoverEvents.d.ts +21 -0
- package/es/Popover/hooks/usePopoverEvents.js +127 -0
- package/es/Popover/hooks/usePopoverPosition.d.ts +17 -0
- package/es/Popover/hooks/usePopoverPosition.js +105 -0
- package/es/Popover/hooks/usePopoverState.d.ts +16 -0
- package/es/Popover/hooks/usePopoverState.js +31 -0
- package/es/Portal/Portal.miniapp.js +21 -12
- package/es/Portal/Portal.types.d.ts +1 -1
- package/es/Portal/PortalCore.js +2 -2
- package/es/Progress/Progress.js +61 -6
- package/es/Progress/Progress.types.d.ts +44 -0
- package/es/Progress/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/es/Progress/__tests__/fixtures/A11yDemos.js +62 -0
- package/es/Radio/Radio.js +5 -4
- package/es/Radio/RadioGroup.js +1 -1
- package/es/Radio/__tests__/fixtures/A11yDemos.d.ts +15 -0
- package/es/Radio/__tests__/fixtures/A11yDemos.js +22 -0
- package/es/Rating/index.css +8 -12
- package/es/ScrollView/ScrollView.js +51 -197
- package/es/ScrollView/ScrollView.types.d.ts +120 -86
- package/es/ScrollView/__tests__/fixtures/A11yDemos.d.ts +7 -0
- package/es/ScrollView/__tests__/fixtures/A11yDemos.js +283 -0
- package/es/ScrollView/useScrollView.d.ts +10 -0
- package/es/ScrollView/useScrollView.js +279 -0
- package/es/Select/Select.js +73 -40
- package/es/Select/Select.types.d.ts +2 -2
- package/es/Select/SelectOption.js +5 -1
- package/es/Select/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/es/Select/__tests__/fixtures/A11yDemos.js +118 -0
- package/es/Select/index.css +12 -8
- package/es/Select/selectContext.d.ts +0 -1
- package/es/Slide/Slide.js +2 -2
- package/es/Slide/Slide.miniapp.d.ts +14 -0
- package/es/Slide/Slide.miniapp.js +192 -0
- package/es/Slide/index.css +72 -0
- package/es/Slider/Slider.js +16 -6
- package/es/Stack/demo/index.css +2 -0
- package/es/SwipeAction/SwipeAction.css +79 -0
- package/es/SwipeAction/SwipeAction.d.ts +5 -0
- package/es/SwipeAction/SwipeAction.js +334 -0
- package/es/SwipeAction/SwipeAction.types.d.ts +75 -0
- package/es/SwipeAction/SwipeAction.types.js +1 -0
- package/es/SwipeAction/SwipeActionContext.d.ts +3 -0
- package/es/SwipeAction/SwipeActionContext.js +11 -0
- package/es/SwipeAction/SwipeActionItem.css +31 -0
- package/es/SwipeAction/SwipeActionItem.d.ts +5 -0
- package/es/SwipeAction/SwipeActionItem.js +78 -0
- package/es/SwipeAction/constants.d.ts +9 -0
- package/es/SwipeAction/constants.js +15 -0
- package/es/SwipeAction/index.css +110 -0
- package/es/SwipeAction/index.d.ts +5 -0
- package/es/SwipeAction/index.js +12 -0
- package/es/Swiper/Swiper.js +18 -4
- package/es/Switch/Switch.js +5 -4
- package/es/Switch/__tests__/fixtures/A11yDemos.d.ts +15 -0
- package/es/Switch/__tests__/fixtures/A11yDemos.js +22 -0
- package/es/Tabs/Tab.js +36 -21
- package/es/Tabs/Tab.types.d.ts +1 -1
- package/es/Tabs/TabPanel.d.ts +1 -1
- package/es/Tabs/TabPanel.js +8 -4
- package/es/Tabs/Tabs.css +2 -2
- package/es/Tabs/Tabs.js +87 -64
- package/es/Tabs/Tabs.types.d.ts +1 -1
- package/es/Tabs/TabsContext.d.ts +4 -5
- package/es/Tabs/TabsContext.js +3 -1
- package/es/Tabs/index.css +2 -2
- package/es/Tabs/utils/scroll.d.ts +2 -0
- package/es/Tabs/utils/scroll.js +36 -0
- package/es/Tag/__tests__/fixtures/A11yDemos.d.ts +21 -0
- package/es/Tag/__tests__/fixtures/A11yDemos.js +160 -0
- package/es/TextArea/TextArea.js +51 -8
- package/es/TextArea/TextArea.types.d.ts +28 -0
- package/es/TextArea/__tests__/fixtures/A11yDemos.d.ts +19 -0
- package/es/TextArea/__tests__/fixtures/A11yDemos.js +54 -0
- package/es/TextArea/index.css +4 -4
- package/es/ThemeProvider/ThemeProvider.types.d.ts +2 -2
- package/es/Toast/FunctionalToast.d.ts +2 -2
- package/es/Toast/FunctionalToast.js +186 -86
- package/es/Toast/Toast.d.ts +2 -2
- package/es/Toast/Toast.js +69 -28
- package/es/Toast/Toast.types.d.ts +13 -10
- package/es/Toast/__tests__/fixtures/A11yDemos.d.ts +2 -0
- package/es/Toast/__tests__/fixtures/A11yDemos.js +21 -0
- package/es/Toast/index.css +0 -1
- package/es/Tooltip/Tooltip.js +64 -114
- package/es/Tooltip/Tooltip.types.d.ts +94 -43
- package/es/Tooltip/__tests__/fixtures/A11yDemos.d.ts +25 -0
- package/es/Tooltip/__tests__/fixtures/A11yDemos.js +60 -0
- package/es/Tooltip/useTooltip.d.ts +29 -0
- package/es/Tooltip/useTooltip.js +290 -0
- package/es/Transition/TransitionCore.js +31 -26
- package/es/TransitionGroup/TransitionGroup.d.ts +7 -0
- package/es/TransitionGroup/TransitionGroup.js +109 -0
- package/es/TransitionGroup/TransitionGroup.types.d.ts +47 -0
- package/es/TransitionGroup/TransitionGroup.types.js +1 -0
- package/es/TransitionGroup/demo/TransitionGroupDemo.d.ts +4 -0
- package/es/TransitionGroup/demo/TransitionGroupDemo.js +39 -0
- package/es/TransitionGroup/demo/index.css +33 -0
- package/es/TransitionGroup/index.d.ts +2 -0
- package/es/TransitionGroup/index.js +6 -0
- package/es/TransitionGroup/utils/childMapping.d.ts +27 -0
- package/es/TransitionGroup/utils/childMapping.js +93 -0
- package/es/_.._/benchmarks/components/Button.js +8 -0
- package/es/_.._/benchmarks/components/Input.js +12 -0
- package/es/_.._/benchmarks/components/Tabs.js +17 -0
- package/es/index.d.ts +8 -0
- package/es/index.js +8 -0
- package/es/locales/base.d.ts +40 -1
- package/es/locales/en-US.js +54 -2
- package/es/locales/zh-CN.js +56 -1
- package/es/locales/zh-TW.js +56 -1
- package/package.json +9 -6
- package/dist/Tabs/utils/bound.d.ts +0 -1
- package/es/Tabs/utils/bound.d.ts +0 -1
- package/es/Tabs/utils/bound.js +0 -13
package/es/Tabs/Tabs.js
CHANGED
|
@@ -26,14 +26,15 @@ var __objRest = (source, exclude) => {
|
|
|
26
26
|
}
|
|
27
27
|
return target;
|
|
28
28
|
};
|
|
29
|
-
import { debounce, isMini, throttle, useEventCallback } from "@bifrostui/utils";
|
|
30
|
-
import clsx from "clsx";
|
|
31
29
|
import React, { useEffect, useMemo, useRef, useState } from "react";
|
|
30
|
+
import clsx from "clsx";
|
|
31
|
+
import { debounce, isMini, throttle, useEventCallback } from "@bifrostui/utils";
|
|
32
|
+
import scrollLeftTo from "./utils/scroll";
|
|
32
33
|
import Tab from "./Tab";
|
|
33
34
|
import { TabsContextProvider } from "./TabsContext";
|
|
34
|
-
import bound from "./utils/bound";
|
|
35
35
|
import "./Tabs.css";
|
|
36
36
|
const prefixCls = "bui-tabs";
|
|
37
|
+
const duration = 300;
|
|
37
38
|
const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
38
39
|
const _a = props, { children, className, value, tabs = [], onChange } = _a, others = __objRest(_a, ["children", "className", "value", "tabs", "onChange"]);
|
|
39
40
|
const tabsRef = useRef(null);
|
|
@@ -46,27 +47,41 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
46
47
|
leftMaskOpacity: 0,
|
|
47
48
|
rightMaskOpacity: 0
|
|
48
49
|
});
|
|
50
|
+
const getActiveTabElement = () => {
|
|
51
|
+
const tabsEl = tabsRef.current;
|
|
52
|
+
if (!tabsEl)
|
|
53
|
+
return;
|
|
54
|
+
const activeIndex = tabs.findIndex((item) => item.index === value);
|
|
55
|
+
if (tabs.length) {
|
|
56
|
+
return activeIndex > -1 ? tabsEl.childNodes[activeIndex + 1] : void 0;
|
|
57
|
+
}
|
|
58
|
+
return [...tabsEl.childNodes].find((child) => {
|
|
59
|
+
var _a2, _b;
|
|
60
|
+
if (isMini) {
|
|
61
|
+
return [...(_b = (_a2 = child == null ? void 0 : child.classList) == null ? void 0 : _a2.tokenList) != null ? _b : []].includes(
|
|
62
|
+
"bui-tab-miniapp-active"
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
return [...child.classList].includes("bui-tab-active");
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
const scrollIntoView = () => {
|
|
69
|
+
const tabsEl = tabsRef.current;
|
|
70
|
+
const activeTab = getActiveTabElement();
|
|
71
|
+
if (!tabsEl || !activeTab) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const to = activeTab.offsetLeft - (tabsEl.offsetWidth - activeTab.offsetWidth) / 2;
|
|
75
|
+
scrollLeftTo(tabsEl, to, duration);
|
|
76
|
+
};
|
|
49
77
|
const animate = useEventCallback(() => {
|
|
50
|
-
const
|
|
51
|
-
if (!
|
|
78
|
+
const tabsEl = tabsRef.current;
|
|
79
|
+
if (!tabsEl)
|
|
52
80
|
return;
|
|
53
|
-
const activeIndex = !!tabs.length && tabs.findIndex((item) => item.index === value);
|
|
54
81
|
const activeLine = activeLineRef.current;
|
|
55
82
|
if (!activeLine)
|
|
56
83
|
return;
|
|
57
|
-
|
|
58
|
-
if (tabs.length) {
|
|
59
|
-
activeTab = activeIndex > -1 ? container.childNodes[activeIndex + 1] : void 0;
|
|
60
|
-
} else {
|
|
61
|
-
activeTab = [...container.childNodes].find((child) => {
|
|
62
|
-
if (isMini) {
|
|
63
|
-
return [...child.classList.tokenList].includes(
|
|
64
|
-
"bui-tab-miniapp-active"
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
return [...child.classList].includes("bui-tab-active");
|
|
68
|
-
});
|
|
69
|
-
}
|
|
84
|
+
const activeTab = getActiveTabElement();
|
|
70
85
|
let activeTabLeft = 0;
|
|
71
86
|
let activeTabWidth = 0;
|
|
72
87
|
let containerWidth = 0;
|
|
@@ -76,8 +91,8 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
76
91
|
if (activeTab) {
|
|
77
92
|
activeTabLeft = activeTab.offsetLeft;
|
|
78
93
|
activeTabWidth = activeTab.offsetWidth;
|
|
79
|
-
containerWidth =
|
|
80
|
-
containerScrollWidth =
|
|
94
|
+
containerWidth = tabsEl.offsetWidth;
|
|
95
|
+
containerScrollWidth = tabsEl.scrollWidth;
|
|
81
96
|
activeLineWidth = activeLine.offsetWidth;
|
|
82
97
|
x = activeTabLeft + (activeTabWidth - activeLineWidth) / 2;
|
|
83
98
|
}
|
|
@@ -88,24 +103,22 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
88
103
|
const maxScrollDistance = containerScrollWidth - containerWidth;
|
|
89
104
|
if (maxScrollDistance <= 0 || !activeTab)
|
|
90
105
|
return;
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
0,
|
|
94
|
-
containerScrollWidth - containerWidth
|
|
95
|
-
);
|
|
96
|
-
if (tabsRef.current) {
|
|
97
|
-
tabsRef.current.scrollLeft = nextScrollLeft;
|
|
106
|
+
if (!isMini) {
|
|
107
|
+
scrollIntoView();
|
|
98
108
|
}
|
|
99
109
|
});
|
|
100
110
|
const updateMask = useMemo(
|
|
101
111
|
() => throttle(
|
|
102
112
|
() => {
|
|
103
|
-
const
|
|
104
|
-
if (!
|
|
113
|
+
const tabsEl = tabsRef.current;
|
|
114
|
+
if (!tabsEl)
|
|
105
115
|
return;
|
|
106
|
-
const scrollLeft =
|
|
116
|
+
const scrollLeft = tabsEl == null ? void 0 : tabsEl.scrollLeft;
|
|
107
117
|
const showLeftMask = scrollLeft > 0;
|
|
108
|
-
const
|
|
118
|
+
const rightRange = Math.abs(
|
|
119
|
+
tabsEl.scrollWidth - (scrollLeft + tabsEl.offsetWidth)
|
|
120
|
+
);
|
|
121
|
+
const showRightMask = rightRange > 1;
|
|
109
122
|
setMaskData({
|
|
110
123
|
leftMaskOpacity: showLeftMask ? 1 : 0,
|
|
111
124
|
rightMaskOpacity: showRightMask ? 1 : 0
|
|
@@ -123,6 +136,7 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
123
136
|
animate();
|
|
124
137
|
}, [value, tabs.length, React.Children.toArray(children).length]);
|
|
125
138
|
useEffect(() => {
|
|
139
|
+
updateMask();
|
|
126
140
|
const handleResize = debounce(() => {
|
|
127
141
|
animate();
|
|
128
142
|
updateMask();
|
|
@@ -132,30 +146,22 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
132
146
|
window.removeEventListener("resize", handleResize);
|
|
133
147
|
};
|
|
134
148
|
}, []);
|
|
135
|
-
useEffect(() => {
|
|
136
|
-
updateMask();
|
|
137
|
-
}, []);
|
|
138
149
|
const handleClick = (e, item) => {
|
|
139
150
|
const { index, disabled = false } = item;
|
|
140
|
-
if (disabled)
|
|
141
|
-
return;
|
|
142
|
-
if (index === void 0 || index === null) {
|
|
151
|
+
if (disabled || [void 0, null].includes(index))
|
|
143
152
|
return;
|
|
144
|
-
}
|
|
145
153
|
if (index !== value) {
|
|
146
154
|
onChange == null ? void 0 : onChange(e, { index });
|
|
147
155
|
}
|
|
148
156
|
};
|
|
149
|
-
const providerValue = useMemo(() => {
|
|
150
|
-
return { value, triggerChange: handleClick };
|
|
151
|
-
}, [value, children, handleClick]);
|
|
152
157
|
return /* @__PURE__ */ React.createElement("div", __spreadValues({ ref, className: clsx(prefixCls, className) }, others), /* @__PURE__ */ React.createElement(
|
|
153
158
|
"div",
|
|
154
159
|
{
|
|
155
160
|
className: clsx(`${prefixCls}-mask`, `${prefixCls}-mask-left`),
|
|
156
161
|
style: {
|
|
157
162
|
opacity: maskData.leftMaskOpacity
|
|
158
|
-
}
|
|
163
|
+
},
|
|
164
|
+
"aria-hidden": "true"
|
|
159
165
|
}
|
|
160
166
|
), /* @__PURE__ */ React.createElement(
|
|
161
167
|
"div",
|
|
@@ -163,31 +169,48 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
163
169
|
className: clsx(`${prefixCls}-mask`, `${prefixCls}-mask-right`),
|
|
164
170
|
style: {
|
|
165
171
|
opacity: maskData.rightMaskOpacity
|
|
166
|
-
}
|
|
172
|
+
},
|
|
173
|
+
"aria-hidden": "true"
|
|
167
174
|
}
|
|
168
|
-
), /* @__PURE__ */ React.createElement(
|
|
175
|
+
), /* @__PURE__ */ React.createElement(
|
|
169
176
|
"div",
|
|
170
177
|
{
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
-
), /* @__PURE__ */ React.createElement(TabsContextProvider, { value: providerValue }, !!tabs.length && tabs.map((item) => {
|
|
181
|
-
return /* @__PURE__ */ React.createElement(
|
|
182
|
-
Tab,
|
|
178
|
+
className: `${prefixCls}-tabs`,
|
|
179
|
+
ref: tabsRef,
|
|
180
|
+
onScroll: updateMask,
|
|
181
|
+
role: "tablist",
|
|
182
|
+
"aria-orientation": "horizontal"
|
|
183
|
+
},
|
|
184
|
+
/* @__PURE__ */ React.createElement(
|
|
185
|
+
"div",
|
|
183
186
|
{
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
187
|
+
ref: activeLineRef,
|
|
188
|
+
className: clsx(`${prefixCls}-indicator`, {
|
|
189
|
+
"bui-indicator-invisible": isMini || !indicatorData.hasActiveTab
|
|
190
|
+
}),
|
|
191
|
+
style: {
|
|
192
|
+
transition: "transform 0.3s ease-in-out",
|
|
193
|
+
transform: `translate(${indicatorData.x}px, 0px)`
|
|
194
|
+
},
|
|
195
|
+
"aria-hidden": "true"
|
|
196
|
+
}
|
|
197
|
+
),
|
|
198
|
+
/* @__PURE__ */ React.createElement(TabsContextProvider, { value: { value, triggerChange: handleClick } }, !!tabs.length && tabs.map((item) => {
|
|
199
|
+
return /* @__PURE__ */ React.createElement(
|
|
200
|
+
Tab,
|
|
201
|
+
{
|
|
202
|
+
key: item.index,
|
|
203
|
+
index: item == null ? void 0 : item.index,
|
|
204
|
+
disabled: item == null ? void 0 : item.disabled,
|
|
205
|
+
role: "tab",
|
|
206
|
+
"aria-selected": value === item.index,
|
|
207
|
+
"aria-disabled": item == null ? void 0 : item.disabled,
|
|
208
|
+
tabIndex: (item == null ? void 0 : item.disabled) ? -1 : 0
|
|
209
|
+
},
|
|
210
|
+
item.title
|
|
211
|
+
);
|
|
212
|
+
}), children)
|
|
213
|
+
));
|
|
191
214
|
});
|
|
192
215
|
Tabs.displayName = "BuiTabs";
|
|
193
216
|
var Tabs_default = Tabs;
|
package/es/Tabs/Tabs.types.d.ts
CHANGED
package/es/Tabs/TabsContext.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TabChangeEvent, TabsProps } from './Tabs.types';
|
|
3
|
-
|
|
3
|
+
type TabsContextValueType = Omit<TabsProps, 'onChange'> & {
|
|
4
4
|
triggerChange: TabChangeEvent;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}>;
|
|
5
|
+
};
|
|
6
|
+
declare const TabsContext: React.Context<TabsContextValueType>;
|
|
7
|
+
export declare const TabsContextProvider: React.Provider<TabsContextValueType>;
|
|
9
8
|
export default TabsContext;
|
package/es/Tabs/TabsContext.js
CHANGED
package/es/Tabs/index.css
CHANGED
|
@@ -3,7 +3,7 @@ page,
|
|
|
3
3
|
xhs-page {
|
|
4
4
|
--bui-tabs-height: 39px;
|
|
5
5
|
--bui-tabs-font-weight: var(--bui-font-weight-medium);
|
|
6
|
-
--bui-tabs-indicator-
|
|
6
|
+
--bui-tabs-indicator-bg: var(--bui-color-primary);
|
|
7
7
|
--bui-tabs-indicator-height: 3PX;
|
|
8
8
|
--bui-tabs-indicator-width: 24px;
|
|
9
9
|
--bui-tabs-indicator-border-radius: 3px 3px 0 0;
|
|
@@ -42,7 +42,7 @@ xhs-page {
|
|
|
42
42
|
bottom: var(--bui-tabs-indicator-bottom);
|
|
43
43
|
height: var(--bui-tabs-indicator-height);
|
|
44
44
|
color: var(--bui-color-primary);
|
|
45
|
-
background: var(--bui-tabs-indicator-
|
|
45
|
+
background: var(--bui-tabs-indicator-bg);
|
|
46
46
|
border-radius: var(--bui-tabs-indicator-border-radius);
|
|
47
47
|
box-shadow: var(--bui-tabs-indicator-box-shadow);
|
|
48
48
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const root = window || global;
|
|
2
|
+
let rafId;
|
|
3
|
+
let prev = Date.now();
|
|
4
|
+
const rafPolyfill = (fn) => {
|
|
5
|
+
const curr = Date.now();
|
|
6
|
+
const ms = Math.max(0, 16 - (curr - prev));
|
|
7
|
+
const id = setTimeout(fn, ms);
|
|
8
|
+
prev = curr + ms;
|
|
9
|
+
return id;
|
|
10
|
+
};
|
|
11
|
+
const cancelRaf = (id) => {
|
|
12
|
+
const cancelAnimationFrame = (root == null ? void 0 : root.cancelAnimationFrame) || (root == null ? void 0 : root.clearTimeout) || clearTimeout;
|
|
13
|
+
cancelAnimationFrame.call(root, id);
|
|
14
|
+
};
|
|
15
|
+
const raf = (fn) => {
|
|
16
|
+
const requestAnimationFrame = (root == null ? void 0 : root.requestAnimationFrame) || rafPolyfill;
|
|
17
|
+
return requestAnimationFrame.call(root, fn);
|
|
18
|
+
};
|
|
19
|
+
const scrollLeftTo = (scroller, to, duration) => {
|
|
20
|
+
cancelRaf(rafId);
|
|
21
|
+
let count = 0;
|
|
22
|
+
const from = scroller.scrollLeft;
|
|
23
|
+
const frames = duration === 0 ? 1 : Math.round(duration / 16);
|
|
24
|
+
function animate() {
|
|
25
|
+
scroller.scrollLeft += (to - from) / frames;
|
|
26
|
+
count += 1;
|
|
27
|
+
if (count < frames) {
|
|
28
|
+
rafId = raf(animate);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
animate();
|
|
32
|
+
};
|
|
33
|
+
var scroll_default = scrollLeftTo;
|
|
34
|
+
export {
|
|
35
|
+
scroll_default as default
|
|
36
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* 自定义 Tag 组件 Demo 集合
|
|
4
|
+
* 这个文件包含多个测试 demo,展示如何使用 getCustomDemoCodesFromFile 进行无障碍测试
|
|
5
|
+
* 文件名必须是 A11yDemos.tsx(固定约定)
|
|
6
|
+
*/
|
|
7
|
+
export declare const basicTagDemo: () => React.JSX.Element;
|
|
8
|
+
export declare const variantTagDemo: () => React.JSX.Element;
|
|
9
|
+
export declare const ClickableTagDemo: () => React.JSX.Element;
|
|
10
|
+
export declare const customColorTagDemo: () => React.JSX.Element;
|
|
11
|
+
export declare const ariaLabelTagDemo: () => React.JSX.Element;
|
|
12
|
+
export declare const complexTagListDemo: () => React.JSX.Element;
|
|
13
|
+
declare const _default: {
|
|
14
|
+
basicTagDemo: () => React.JSX.Element;
|
|
15
|
+
variantTagDemo: () => React.JSX.Element;
|
|
16
|
+
ClickableTagDemo: () => React.JSX.Element;
|
|
17
|
+
customColorTagDemo: () => React.JSX.Element;
|
|
18
|
+
ariaLabelTagDemo: () => React.JSX.Element;
|
|
19
|
+
complexTagListDemo: () => React.JSX.Element;
|
|
20
|
+
};
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import React, { useState } from "react";
|
|
21
|
+
import Tag from "../../Tag";
|
|
22
|
+
const basicTagDemo = () => {
|
|
23
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Tag, { color: "primary" }, "\u4E3B\u8981\u6807\u7B7E"), /* @__PURE__ */ React.createElement(Tag, { color: "success" }, "\u6210\u529F\u6807\u7B7E"), /* @__PURE__ */ React.createElement(Tag, { color: "warning" }, "\u8B66\u544A\u6807\u7B7E"), /* @__PURE__ */ React.createElement(Tag, { color: "danger" }, "\u5371\u9669\u6807\u7B7E"), /* @__PURE__ */ React.createElement(Tag, { color: "info" }, "\u4FE1\u606F\u6807\u7B7E"), /* @__PURE__ */ React.createElement(Tag, { color: "neutral" }, "\u4E2D\u6027\u6807\u7B7E"));
|
|
24
|
+
};
|
|
25
|
+
const variantTagDemo = () => {
|
|
26
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Tag, { variant: "filled", color: "primary" }, "\u586B\u5145\u6807\u7B7E"), /* @__PURE__ */ React.createElement(Tag, { variant: "outlined", color: "success" }, "\u8FB9\u6846\u6807\u7B7E"), /* @__PURE__ */ React.createElement(Tag, { variant: "subtle", color: "warning" }, "\u8F7B\u91CF\u6807\u7B7E"));
|
|
27
|
+
};
|
|
28
|
+
const ClickableTagDemo = () => {
|
|
29
|
+
const [clicked, setClicked] = useState([]);
|
|
30
|
+
const handleTagClick = (tag) => {
|
|
31
|
+
setClicked(
|
|
32
|
+
(prev) => prev.includes(tag) ? prev.filter((t) => t !== tag) : [...prev, tag]
|
|
33
|
+
);
|
|
34
|
+
console.log(`\u70B9\u51FB\u4E86\u6807\u7B7E: ${tag}`);
|
|
35
|
+
};
|
|
36
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
|
|
37
|
+
Tag,
|
|
38
|
+
{
|
|
39
|
+
color: "primary",
|
|
40
|
+
onClick: () => handleTagClick("tag1"),
|
|
41
|
+
style: {
|
|
42
|
+
opacity: clicked.includes("tag1") ? 0.6 : 1,
|
|
43
|
+
margin: "4px"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"\u53EF\u70B9\u51FB\u6807\u7B7E 1"
|
|
47
|
+
), /* @__PURE__ */ React.createElement(
|
|
48
|
+
Tag,
|
|
49
|
+
{
|
|
50
|
+
color: "success",
|
|
51
|
+
onClick: () => handleTagClick("tag2"),
|
|
52
|
+
style: {
|
|
53
|
+
opacity: clicked.includes("tag2") ? 0.6 : 1,
|
|
54
|
+
margin: "4px"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"\u53EF\u70B9\u51FB\u6807\u7B7E 2"
|
|
58
|
+
), /* @__PURE__ */ React.createElement(
|
|
59
|
+
Tag,
|
|
60
|
+
{
|
|
61
|
+
color: "warning",
|
|
62
|
+
onClick: () => handleTagClick("tag3"),
|
|
63
|
+
style: {
|
|
64
|
+
opacity: clicked.includes("tag3") ? 0.6 : 1,
|
|
65
|
+
margin: "4px"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"\u53EF\u70B9\u51FB\u6807\u7B7E 3"
|
|
69
|
+
), clicked.length > 0 && /* @__PURE__ */ React.createElement("p", null, "\u5DF2\u70B9\u51FB\u7684\u6807\u7B7E: ", clicked.join(", ")));
|
|
70
|
+
};
|
|
71
|
+
const customColorTagDemo = () => {
|
|
72
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Tag, { htmlColor: "#ff6b6b", variant: "filled" }, "\u81EA\u5B9A\u4E49\u7EA2\u8272"), /* @__PURE__ */ React.createElement(Tag, { htmlColor: "#4ecdc4", variant: "outlined" }, "\u81EA\u5B9A\u4E49\u9752\u8272"), /* @__PURE__ */ React.createElement(Tag, { htmlColor: "#45b7d1", variant: "subtle" }, "\u81EA\u5B9A\u4E49\u84DD\u8272"), /* @__PURE__ */ React.createElement(Tag, { htmlColor: "rgb(255, 193, 7)", variant: "filled" }, "RGB \u9EC4\u8272"));
|
|
73
|
+
};
|
|
74
|
+
const ariaLabelTagDemo = () => {
|
|
75
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
|
|
76
|
+
Tag,
|
|
77
|
+
{
|
|
78
|
+
color: "primary",
|
|
79
|
+
onClick: () => {
|
|
80
|
+
console.log("\u5220\u9664\u7528\u6237");
|
|
81
|
+
},
|
|
82
|
+
"aria-label": "\u5220\u9664\u7528\u6237\u6807\u7B7E"
|
|
83
|
+
},
|
|
84
|
+
"\u7528\u6237"
|
|
85
|
+
), /* @__PURE__ */ React.createElement(
|
|
86
|
+
Tag,
|
|
87
|
+
{
|
|
88
|
+
color: "success",
|
|
89
|
+
onClick: () => {
|
|
90
|
+
console.log("\u7F16\u8F91\u9879\u76EE");
|
|
91
|
+
},
|
|
92
|
+
"aria-label": "\u7F16\u8F91\u9879\u76EE\u6807\u7B7E"
|
|
93
|
+
},
|
|
94
|
+
"\u9879\u76EE"
|
|
95
|
+
), /* @__PURE__ */ React.createElement(Tag, { color: "info", "aria-label": "\u53EA\u8BFB\u7684\u8BBE\u7F6E\u4FE1\u606F" }, "\u8BBE\u7F6E"));
|
|
96
|
+
};
|
|
97
|
+
const ComplexTagListDemo = () => {
|
|
98
|
+
const [tags, setTags] = useState([
|
|
99
|
+
{ id: 1, name: "React", active: true, color: "primary" },
|
|
100
|
+
{ id: 2, name: "Vue", active: false, color: "success" },
|
|
101
|
+
{ id: 3, name: "Angular", active: false, color: "warning" },
|
|
102
|
+
{ id: 4, name: "Svelte", active: true, color: "info" },
|
|
103
|
+
{ id: 5, name: "TypeScript", active: true, color: "danger" }
|
|
104
|
+
]);
|
|
105
|
+
const toggleTag = (id) => {
|
|
106
|
+
setTags(
|
|
107
|
+
(prevTags) => prevTags.map(
|
|
108
|
+
(tag) => tag.id === id ? __spreadProps(__spreadValues({}, tag), { active: !tag.active }) : tag
|
|
109
|
+
)
|
|
110
|
+
);
|
|
111
|
+
};
|
|
112
|
+
const activeTags = tags.filter((tag) => tag.active);
|
|
113
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("h4", null, "\u6280\u672F\u6807\u7B7E\u9009\u62E9\u5668"), /* @__PURE__ */ React.createElement("div", { style: { marginBottom: "10px" } }, tags.map((tag) => /* @__PURE__ */ React.createElement(
|
|
114
|
+
Tag,
|
|
115
|
+
{
|
|
116
|
+
key: tag.id,
|
|
117
|
+
color: tag.color,
|
|
118
|
+
variant: tag.active ? "filled" : "outlined",
|
|
119
|
+
onClick: () => toggleTag(tag.id),
|
|
120
|
+
"aria-label": `${tag.active ? "\u53D6\u6D88\u9009\u62E9" : "\u9009\u62E9"} ${tag.name} \u6280\u672F\u6807\u7B7E`,
|
|
121
|
+
style: {
|
|
122
|
+
margin: "2px",
|
|
123
|
+
cursor: "pointer",
|
|
124
|
+
opacity: tag.active ? 1 : 0.7
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
tag.name
|
|
128
|
+
))), /* @__PURE__ */ React.createElement("p", null, "\u5DF2\u9009\u62E9\u7684\u6280\u672F:", " ", activeTags.length > 0 ? activeTags.map((tag) => tag.name).join(", ") : "\u65E0"), /* @__PURE__ */ React.createElement(
|
|
129
|
+
"button",
|
|
130
|
+
{
|
|
131
|
+
type: "button",
|
|
132
|
+
onClick: () => {
|
|
133
|
+
setTags(
|
|
134
|
+
(prevTags) => prevTags.map((tag) => __spreadProps(__spreadValues({}, tag), { active: false }))
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"\u6E05\u9664\u6240\u6709\u9009\u62E9"
|
|
139
|
+
));
|
|
140
|
+
};
|
|
141
|
+
const complexTagListDemo = () => {
|
|
142
|
+
return /* @__PURE__ */ React.createElement(ComplexTagListDemo, null);
|
|
143
|
+
};
|
|
144
|
+
var A11yDemos_default = {
|
|
145
|
+
basicTagDemo,
|
|
146
|
+
variantTagDemo,
|
|
147
|
+
ClickableTagDemo,
|
|
148
|
+
customColorTagDemo,
|
|
149
|
+
ariaLabelTagDemo,
|
|
150
|
+
complexTagListDemo
|
|
151
|
+
};
|
|
152
|
+
export {
|
|
153
|
+
ClickableTagDemo,
|
|
154
|
+
ariaLabelTagDemo,
|
|
155
|
+
basicTagDemo,
|
|
156
|
+
complexTagListDemo,
|
|
157
|
+
customColorTagDemo,
|
|
158
|
+
A11yDemos_default as default,
|
|
159
|
+
variantTagDemo
|
|
160
|
+
};
|
package/es/TextArea/TextArea.js
CHANGED
|
@@ -31,12 +31,14 @@ var __objRest = (source, exclude) => {
|
|
|
31
31
|
};
|
|
32
32
|
import { isMini, useForkRef, useValue } from "@bifrostui/utils";
|
|
33
33
|
import clsx from "clsx";
|
|
34
|
-
import React, { useEffect, useRef } from "react";
|
|
34
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
35
|
+
import { useLocaleText } from "../locales";
|
|
35
36
|
import "./index.css";
|
|
36
37
|
const prefixCls = "bui-textarea";
|
|
37
38
|
const DEFAULT_ROWS = 2;
|
|
38
39
|
const TextArea = /* @__PURE__ */ React.forwardRef(
|
|
39
40
|
(props, ref) => {
|
|
41
|
+
const textareaText = useLocaleText("textarea");
|
|
40
42
|
const _a = props, {
|
|
41
43
|
className,
|
|
42
44
|
value,
|
|
@@ -47,10 +49,19 @@ const TextArea = /* @__PURE__ */ React.forwardRef(
|
|
|
47
49
|
placeholder,
|
|
48
50
|
disabled,
|
|
49
51
|
rows = DEFAULT_ROWS,
|
|
50
|
-
maxLength,
|
|
52
|
+
maxLength: maxLength,
|
|
51
53
|
autoSize = false,
|
|
52
|
-
autoFocus = false,
|
|
53
|
-
showCount = false,
|
|
54
|
+
autoFocus: autoFocus = false,
|
|
55
|
+
showCount: showCount = false,
|
|
56
|
+
// 是否展示字数统计
|
|
57
|
+
// 无障碍属性
|
|
58
|
+
"aria-label": ariaLabel = textareaText.labelName,
|
|
59
|
+
"aria-hidden": ariaHidden,
|
|
60
|
+
"aria-details": ariaDetails,
|
|
61
|
+
"aria-required": ariaRequired,
|
|
62
|
+
"aria-readonly": ariaReadonly,
|
|
63
|
+
"aria-rowindex": ariaRowindex,
|
|
64
|
+
"aria-colcount": ariaColcount,
|
|
54
65
|
onChange
|
|
55
66
|
} = _a, others = __objRest(_a, [
|
|
56
67
|
"className",
|
|
@@ -62,10 +73,20 @@ const TextArea = /* @__PURE__ */ React.forwardRef(
|
|
|
62
73
|
"placeholder",
|
|
63
74
|
"disabled",
|
|
64
75
|
"rows",
|
|
76
|
+
// 默认行数
|
|
65
77
|
"maxLength",
|
|
66
78
|
"autoSize",
|
|
79
|
+
// 是否自适应高度
|
|
67
80
|
"autoFocus",
|
|
81
|
+
// 是否自动聚焦
|
|
68
82
|
"showCount",
|
|
83
|
+
"aria-label",
|
|
84
|
+
"aria-hidden",
|
|
85
|
+
"aria-details",
|
|
86
|
+
"aria-required",
|
|
87
|
+
"aria-readonly",
|
|
88
|
+
"aria-rowindex",
|
|
89
|
+
"aria-colcount",
|
|
69
90
|
"onChange"
|
|
70
91
|
]);
|
|
71
92
|
const [textAreaValue, triggerChange] = useValue({
|
|
@@ -80,7 +101,7 @@ const TextArea = /* @__PURE__ */ React.forwardRef(
|
|
|
80
101
|
if (autoFocus && internalRef.current) {
|
|
81
102
|
internalRef.current.focus();
|
|
82
103
|
}
|
|
83
|
-
}, [
|
|
104
|
+
}, [autoFocus]);
|
|
84
105
|
const handleAutoHeight = (height) => {
|
|
85
106
|
if (typeof autoSize === "object") {
|
|
86
107
|
const { maxHeight, minHeight } = autoSize;
|
|
@@ -110,8 +131,7 @@ const TextArea = /* @__PURE__ */ React.forwardRef(
|
|
|
110
131
|
const textArea = internalRef.current;
|
|
111
132
|
const { height, lineCount } = (e == null ? void 0 : e.detail) || {};
|
|
112
133
|
const line = lineCount <= 1 ? rows : lineCount;
|
|
113
|
-
|
|
114
|
-
textAreaHeight = handleAutoHeight(textAreaHeight);
|
|
134
|
+
const textAreaHeight = handleAutoHeight(line * (height / lineCount));
|
|
115
135
|
if (!initLock.current && !autoSize && rows === DEFAULT_ROWS) {
|
|
116
136
|
textArea.style.height = `${textAreaHeight}px`;
|
|
117
137
|
initLock.current = true;
|
|
@@ -121,12 +141,29 @@ const TextArea = /* @__PURE__ */ React.forwardRef(
|
|
|
121
141
|
textArea.style.height = `${textAreaHeight}px`;
|
|
122
142
|
}
|
|
123
143
|
};
|
|
144
|
+
const [ariaDescription, setAriaDescription] = useState("");
|
|
124
145
|
let nativeProps = {
|
|
125
|
-
[isMini ? "maxlength" : "maxLength"]: maxLength != null ? maxLength : -1
|
|
146
|
+
[isMini ? "maxlength" : "maxLength"]: maxLength != null ? maxLength : -1,
|
|
147
|
+
"aria-description": ariaDescription
|
|
126
148
|
};
|
|
149
|
+
const accessibilityProps = {
|
|
150
|
+
"aria-label": ariaLabel,
|
|
151
|
+
"aria-hidden": ariaHidden,
|
|
152
|
+
"aria-details": ariaDetails,
|
|
153
|
+
"aria-required": ariaRequired,
|
|
154
|
+
"aria-readonly": ariaReadonly,
|
|
155
|
+
"aria-rowindex": ariaRowindex,
|
|
156
|
+
"aria-colcount": ariaColcount
|
|
157
|
+
};
|
|
158
|
+
Object.keys(accessibilityProps).forEach((key) => {
|
|
159
|
+
if (accessibilityProps[key] !== void 0) {
|
|
160
|
+
nativeProps[key] = accessibilityProps[key];
|
|
161
|
+
}
|
|
162
|
+
});
|
|
127
163
|
if (isMini) {
|
|
128
164
|
nativeProps = __spreadProps(__spreadValues({}, nativeProps), {
|
|
129
165
|
onLineChange: handleLineChange,
|
|
166
|
+
// 小程序行高变化事件
|
|
130
167
|
placeholderClass: "bui-mini-placeholder",
|
|
131
168
|
autoFocus,
|
|
132
169
|
focus: autoFocus
|
|
@@ -162,6 +199,12 @@ const TextArea = /* @__PURE__ */ React.forwardRef(
|
|
|
162
199
|
},
|
|
163
200
|
onInput: (e) => {
|
|
164
201
|
var _a2;
|
|
202
|
+
if (showCount) {
|
|
203
|
+
const remaining = maxLength - e.target.value.length;
|
|
204
|
+
setAriaDescription(
|
|
205
|
+
`${textareaText.remaining} ${remaining} ${textareaText.characters}`
|
|
206
|
+
);
|
|
207
|
+
}
|
|
165
208
|
if (isMini) {
|
|
166
209
|
triggerChange(e, e.target.value);
|
|
167
210
|
}
|
|
@@ -64,6 +64,34 @@ export type TextAreaProps<D extends React.ElementType = 'div', P = {}> = Overrid
|
|
|
64
64
|
onChange?: (e: React.ChangeEvent<HTMLTextAreaElement>, data: {
|
|
65
65
|
value: string;
|
|
66
66
|
}) => void;
|
|
67
|
+
/**
|
|
68
|
+
* 无障碍功能:ARIA标签
|
|
69
|
+
*/
|
|
70
|
+
'aria-label'?: string;
|
|
71
|
+
/**
|
|
72
|
+
* 无障碍功能:是否隐藏元素
|
|
73
|
+
*/
|
|
74
|
+
'aria-hidden'?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* 无障碍功能:元素在无障碍树中的细节程度
|
|
77
|
+
*/
|
|
78
|
+
'aria-details'?: string;
|
|
79
|
+
/**
|
|
80
|
+
* 无障碍功能:当前元素是否为必填
|
|
81
|
+
*/
|
|
82
|
+
'aria-required'?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* 无障碍功能:当前元素是否为只读
|
|
85
|
+
*/
|
|
86
|
+
'aria-readonly'?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* 无障碍功能:多行文本框的第一行索引
|
|
89
|
+
*/
|
|
90
|
+
'aria-rowindex'?: number;
|
|
91
|
+
/**
|
|
92
|
+
* 无障碍功能:多行文本框的列数
|
|
93
|
+
*/
|
|
94
|
+
'aria-colcount'?: number;
|
|
67
95
|
};
|
|
68
96
|
defaultComponent: D;
|
|
69
97
|
}, D>;
|