@douyinfe/semi-ui 2.2.0 → 2.3.0
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/_base/_story/a11y.jsx +6 -6
- package/_base/_story/a11y.scss +0 -1
- package/_base/_story/index.scss +2 -5
- package/_utils/hooks/usePrevFocus.ts +16 -0
- package/_utils/index.ts +4 -0
- package/anchor/_story/anchor.stories.js +1 -1
- package/anchor/index.tsx +5 -2
- package/anchor/link.tsx +29 -4
- package/autoComplete/index.tsx +28 -1
- package/avatar/_story/avatar.stories.js +4 -4
- package/avatar/index.tsx +6 -4
- package/banner/index.tsx +2 -1
- package/breadcrumb/_story/breadcrumb.stories.js +22 -8
- package/breadcrumb/index.tsx +8 -1
- package/breadcrumb/item.tsx +1 -1
- package/button/Button.tsx +4 -0
- package/button/__test__/button.test.js +1 -1
- package/button/_story/button.stories.js +10 -10
- package/button/buttonGroup.tsx +4 -2
- package/button/splitButtonGroup.tsx +5 -2
- package/card/_story/card.stories.js +8 -1
- package/card/_story/card.stories.tsx +3 -0
- package/card/index.tsx +5 -2
- package/cascader/index.tsx +33 -5
- package/checkbox/_story/checkbox.stories.js +19 -12
- package/checkbox/checkbox.tsx +40 -5
- package/checkbox/checkboxGroup.tsx +30 -5
- package/checkbox/checkboxInner.tsx +25 -2
- package/collapse/index.tsx +1 -1
- package/collapse/item.tsx +12 -7
- package/collapsible/index.tsx +4 -2
- package/configProvider/_story/configProvider.stories.tsx +27 -0
- package/datePicker/__test__/datePicker.test.js +108 -0
- package/datePicker/_story/datePicker.stories.js +146 -2
- package/datePicker/datePicker.tsx +24 -0
- package/datePicker/monthsGrid.tsx +2 -1
- package/dist/css/semi.css +34 -7
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +2768 -1501
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/dropdown/dropdownItem.tsx +1 -1
- package/dropdown/dropdownMenu.tsx +1 -1
- package/empty/index.tsx +4 -4
- package/form/_story/FormApi/formApiDemo.jsx +3 -2
- package/form/_story/Validate/validateDemo.jsx +1 -1
- package/form/_story/demo.jsx +12 -3
- package/form/_story/form.stories.js +0 -7
- package/form/baseForm.tsx +2 -0
- package/form/errorMessage.tsx +13 -2
- package/form/hoc/withField.tsx +37 -8
- package/form/index.tsx +0 -2
- package/form/interface.ts +2 -0
- package/form/label.tsx +4 -2
- package/input/index.tsx +49 -4
- package/input/inputGroup.tsx +9 -4
- package/input/textarea.tsx +25 -6
- package/inputNumber/_story/inputNumber.stories.js +12 -0
- package/inputNumber/index.tsx +33 -2
- package/layout/Sider.tsx +6 -2
- package/layout/index.tsx +4 -3
- package/lib/cjs/_utils/hooks/usePrevFocus.d.ts +2 -0
- package/lib/cjs/_utils/hooks/usePrevFocus.js +30 -0
- package/lib/cjs/_utils/index.d.ts +1 -0
- package/lib/cjs/_utils/index.js +6 -1
- package/lib/cjs/anchor/index.d.ts +2 -0
- package/lib/cjs/anchor/index.js +6 -1
- package/lib/cjs/anchor/link.d.ts +4 -1
- package/lib/cjs/anchor/link.js +39 -5
- package/lib/cjs/autoComplete/index.d.ts +17 -0
- package/lib/cjs/autoComplete/index.js +21 -2
- package/lib/cjs/avatar/index.d.ts +4 -3
- package/lib/cjs/avatar/index.js +15 -11
- package/lib/cjs/banner/index.js +4 -2
- package/lib/cjs/breadcrumb/index.d.ts +3 -0
- package/lib/cjs/breadcrumb/index.js +10 -4
- package/lib/cjs/breadcrumb/item.js +2 -2
- package/lib/cjs/button/Button.d.ts +2 -0
- package/lib/cjs/button/Button.js +4 -2
- package/lib/cjs/button/buttonGroup.d.ts +3 -0
- package/lib/cjs/button/buttonGroup.js +8 -4
- package/lib/cjs/button/index.d.ts +1 -0
- package/lib/cjs/button/splitButtonGroup.d.ts +3 -0
- package/lib/cjs/button/splitButtonGroup.js +5 -2
- package/lib/cjs/card/index.d.ts +3 -0
- package/lib/cjs/card/index.js +3 -1
- package/lib/cjs/cascader/index.d.ts +14 -0
- package/lib/cjs/cascader/index.js +35 -7
- package/lib/cjs/checkbox/checkbox.d.ts +21 -1
- package/lib/cjs/checkbox/checkbox.js +51 -17
- package/lib/cjs/checkbox/checkboxGroup.d.ts +13 -1
- package/lib/cjs/checkbox/checkboxGroup.js +16 -3
- package/lib/cjs/checkbox/checkboxInner.d.ts +15 -0
- package/lib/cjs/checkbox/checkboxInner.js +20 -3
- package/lib/cjs/collapse/item.d.ts +2 -1
- package/lib/cjs/collapse/item.js +12 -2
- package/lib/cjs/collapsible/index.d.ts +1 -0
- package/lib/cjs/collapsible/index.js +4 -2
- package/lib/cjs/datePicker/datePicker.d.ts +12 -0
- package/lib/cjs/datePicker/datePicker.js +22 -3
- package/lib/cjs/datePicker/monthsGrid.d.ts +1 -0
- package/lib/cjs/datePicker/monthsGrid.js +2 -1
- package/lib/cjs/dropdown/dropdownItem.js +3 -1
- package/lib/cjs/dropdown/dropdownMenu.js +4 -1
- package/lib/cjs/form/baseForm.d.ts +9 -0
- package/lib/cjs/form/baseForm.js +3 -1
- package/lib/cjs/form/errorMessage.d.ts +4 -0
- package/lib/cjs/form/errorMessage.js +21 -3
- package/lib/cjs/form/field.d.ts +7 -0
- package/lib/cjs/form/hoc/withField.js +49 -16
- package/lib/cjs/form/index.d.ts +0 -1
- package/lib/cjs/form/interface.d.ts +2 -0
- package/lib/cjs/form/label.d.ts +2 -0
- package/lib/cjs/form/label.js +5 -2
- package/lib/cjs/input/index.d.ts +16 -0
- package/lib/cjs/input/index.js +51 -15
- package/lib/cjs/input/inputGroup.d.ts +2 -1
- package/lib/cjs/input/inputGroup.js +11 -1
- package/lib/cjs/input/textarea.js +12 -1
- package/lib/cjs/inputNumber/index.d.ts +21 -12
- package/lib/cjs/inputNumber/index.js +37 -3
- package/lib/cjs/layout/Sider.d.ts +4 -0
- package/lib/cjs/layout/Sider.js +4 -1
- package/lib/cjs/layout/index.js +2 -0
- package/lib/cjs/list/item.js +0 -1
- package/lib/cjs/modal/Modal.js +2 -0
- package/lib/cjs/modal/ModalContent.d.ts +3 -1
- package/lib/cjs/modal/ModalContent.js +47 -5
- package/lib/cjs/navigation/Item.d.ts +4 -2
- package/lib/cjs/navigation/Item.js +25 -5
- package/lib/cjs/navigation/SubNav.d.ts +4 -2
- package/lib/cjs/navigation/SubNav.js +8 -1
- package/lib/cjs/navigation/index.js +2 -0
- package/lib/cjs/notification/notice.d.ts +1 -1
- package/lib/cjs/notification/notice.js +32 -22
- package/lib/cjs/pagination/index.js +16 -6
- package/lib/cjs/popover/index.js +7 -3
- package/lib/cjs/progress/index.d.ts +8 -0
- package/lib/cjs/progress/index.js +42 -9
- package/lib/cjs/radio/radio.d.ts +6 -1
- package/lib/cjs/radio/radio.js +17 -5
- package/lib/cjs/radio/radioGroup.d.ts +16 -1
- package/lib/cjs/radio/radioGroup.js +18 -3
- package/lib/cjs/radio/radioInner.d.ts +6 -1
- package/lib/cjs/radio/radioInner.js +11 -3
- package/lib/cjs/rating/index.d.ts +14 -0
- package/lib/cjs/rating/index.js +14 -3
- package/lib/cjs/rating/item.d.ts +2 -0
- package/lib/cjs/rating/item.js +6 -1
- package/lib/cjs/select/index.d.ts +16 -0
- package/lib/cjs/select/index.js +65 -19
- package/lib/cjs/select/option.js +28 -22
- package/lib/cjs/sideSheet/SideSheetContent.d.ts +1 -0
- package/lib/cjs/sideSheet/SideSheetContent.js +4 -1
- package/lib/cjs/sideSheet/index.d.ts +1 -0
- package/lib/cjs/sideSheet/index.js +2 -1
- package/lib/cjs/slider/index.d.ts +2 -1
- package/lib/cjs/slider/index.js +64 -17
- package/lib/cjs/spin/icon.js +3 -4
- package/lib/cjs/steps/basicStep.d.ts +3 -0
- package/lib/cjs/steps/basicStep.js +23 -25
- package/lib/cjs/steps/basicSteps.d.ts +1 -0
- package/lib/cjs/steps/basicSteps.js +2 -1
- package/lib/cjs/steps/fillStep.d.ts +3 -0
- package/lib/cjs/steps/fillStep.js +19 -4
- package/lib/cjs/steps/fillSteps.d.ts +1 -0
- package/lib/cjs/steps/fillSteps.js +2 -1
- package/lib/cjs/steps/navStep.d.ts +3 -0
- package/lib/cjs/steps/navStep.js +22 -25
- package/lib/cjs/steps/navSteps.d.ts +1 -0
- package/lib/cjs/steps/navSteps.js +2 -1
- package/lib/cjs/switch/index.d.ts +12 -0
- package/lib/cjs/switch/index.js +19 -4
- package/lib/cjs/table/Body/BaseRow.js +35 -3
- package/lib/cjs/table/Body/index.js +9 -1
- package/lib/cjs/table/ColumnFilter.js +4 -0
- package/lib/cjs/table/ColumnSelection.d.ts +3 -0
- package/lib/cjs/table/ColumnSelection.js +6 -2
- package/lib/cjs/table/ColumnSorter.js +19 -3
- package/lib/cjs/table/CustomExpandIcon.js +7 -1
- package/lib/cjs/table/Table.d.ts +2 -0
- package/lib/cjs/table/Table.js +31 -15
- package/lib/cjs/table/TableCell.d.ts +2 -0
- package/lib/cjs/table/TableCell.js +6 -2
- package/lib/cjs/table/TableHeaderRow.js +8 -2
- package/lib/cjs/tabs/TabBar.js +11 -3
- package/lib/cjs/tabs/TabPane.js +3 -1
- package/lib/cjs/tabs/index.js +0 -1
- package/lib/cjs/tagInput/index.d.ts +4 -1
- package/lib/cjs/tagInput/index.js +29 -3
- package/lib/cjs/timePicker/TimePicker.d.ts +12 -0
- package/lib/cjs/timePicker/TimePicker.js +9 -1
- package/lib/cjs/timePicker/index.d.ts +6 -0
- package/lib/cjs/timeline/index.d.ts +1 -1
- package/lib/cjs/timeline/index.js +1 -0
- package/lib/cjs/timeline/item.js +4 -2
- package/lib/cjs/toast/toast.js +2 -0
- package/lib/cjs/tooltip/TriangleArrow.js +1 -0
- package/lib/cjs/tooltip/TriangleArrowVertical.js +1 -0
- package/lib/cjs/tooltip/index.d.ts +16 -12
- package/lib/cjs/tooltip/index.js +55 -39
- package/lib/cjs/transfer/index.d.ts +1 -1
- package/lib/cjs/transfer/index.js +35 -17
- package/lib/cjs/tree/index.d.ts +1 -0
- package/lib/cjs/tree/index.js +15 -6
- package/lib/cjs/tree/treeNode.d.ts +12 -4
- package/lib/cjs/tree/treeNode.js +44 -4
- package/lib/cjs/treeSelect/index.d.ts +16 -0
- package/lib/cjs/treeSelect/index.js +60 -12
- package/lib/cjs/typography/base.js +18 -7
- package/lib/cjs/typography/copyable.js +6 -1
- package/lib/cjs/upload/fileCard.js +26 -7
- package/lib/cjs/upload/index.js +19 -4
- package/lib/es/_utils/hooks/usePrevFocus.d.ts +2 -0
- package/lib/es/_utils/hooks/usePrevFocus.js +15 -0
- package/lib/es/_utils/index.d.ts +1 -0
- package/lib/es/_utils/index.js +4 -1
- package/lib/es/anchor/index.d.ts +2 -0
- package/lib/es/anchor/index.js +6 -1
- package/lib/es/anchor/link.d.ts +4 -1
- package/lib/es/anchor/link.js +38 -5
- package/lib/es/autoComplete/index.d.ts +17 -0
- package/lib/es/autoComplete/index.js +21 -2
- package/lib/es/avatar/index.d.ts +4 -3
- package/lib/es/avatar/index.js +15 -11
- package/lib/es/banner/index.js +4 -2
- package/lib/es/breadcrumb/index.d.ts +3 -0
- package/lib/es/breadcrumb/index.js +10 -4
- package/lib/es/breadcrumb/item.js +2 -2
- package/lib/es/button/Button.d.ts +2 -0
- package/lib/es/button/Button.js +4 -2
- package/lib/es/button/buttonGroup.d.ts +3 -0
- package/lib/es/button/buttonGroup.js +8 -4
- package/lib/es/button/index.d.ts +1 -0
- package/lib/es/button/splitButtonGroup.d.ts +3 -0
- package/lib/es/button/splitButtonGroup.js +5 -2
- package/lib/es/card/index.d.ts +3 -0
- package/lib/es/card/index.js +3 -1
- package/lib/es/cascader/index.d.ts +14 -0
- package/lib/es/cascader/index.js +35 -7
- package/lib/es/checkbox/checkbox.d.ts +21 -1
- package/lib/es/checkbox/checkbox.js +50 -17
- package/lib/es/checkbox/checkboxGroup.d.ts +13 -1
- package/lib/es/checkbox/checkboxGroup.js +18 -5
- package/lib/es/checkbox/checkboxInner.d.ts +15 -0
- package/lib/es/checkbox/checkboxInner.js +20 -3
- package/lib/es/collapse/item.d.ts +2 -1
- package/lib/es/collapse/item.js +11 -2
- package/lib/es/collapsible/index.d.ts +1 -0
- package/lib/es/collapsible/index.js +4 -2
- package/lib/es/datePicker/datePicker.d.ts +12 -0
- package/lib/es/datePicker/datePicker.js +22 -3
- package/lib/es/datePicker/monthsGrid.d.ts +1 -0
- package/lib/es/datePicker/monthsGrid.js +2 -1
- package/lib/es/dropdown/dropdownItem.js +3 -1
- package/lib/es/dropdown/dropdownMenu.js +4 -1
- package/lib/es/form/baseForm.d.ts +9 -0
- package/lib/es/form/baseForm.js +3 -1
- package/lib/es/form/errorMessage.d.ts +4 -0
- package/lib/es/form/errorMessage.js +21 -3
- package/lib/es/form/field.d.ts +7 -0
- package/lib/es/form/hoc/withField.js +48 -15
- package/lib/es/form/index.d.ts +0 -1
- package/lib/es/form/index.js +0 -1
- package/lib/es/form/interface.d.ts +2 -0
- package/lib/es/form/label.d.ts +2 -0
- package/lib/es/form/label.js +5 -2
- package/lib/es/input/index.d.ts +16 -0
- package/lib/es/input/index.js +51 -15
- package/lib/es/input/inputGroup.d.ts +2 -1
- package/lib/es/input/inputGroup.js +11 -1
- package/lib/es/input/textarea.js +12 -1
- package/lib/es/inputNumber/index.d.ts +21 -12
- package/lib/es/inputNumber/index.js +38 -3
- package/lib/es/layout/Sider.d.ts +4 -0
- package/lib/es/layout/Sider.js +4 -1
- package/lib/es/layout/index.js +2 -0
- package/lib/es/list/item.js +0 -1
- package/lib/es/modal/Modal.js +2 -0
- package/lib/es/modal/ModalContent.d.ts +3 -1
- package/lib/es/modal/ModalContent.js +46 -5
- package/lib/es/navigation/Item.d.ts +4 -2
- package/lib/es/navigation/Item.js +25 -5
- package/lib/es/navigation/SubNav.d.ts +4 -2
- package/lib/es/navigation/SubNav.js +8 -1
- package/lib/es/navigation/index.js +2 -0
- package/lib/es/notification/notice.d.ts +1 -1
- package/lib/es/notification/notice.js +33 -24
- package/lib/es/pagination/index.js +16 -6
- package/lib/es/popover/index.js +7 -3
- package/lib/es/progress/index.d.ts +8 -0
- package/lib/es/progress/index.js +42 -9
- package/lib/es/radio/radio.d.ts +6 -1
- package/lib/es/radio/radio.js +16 -5
- package/lib/es/radio/radioGroup.d.ts +16 -1
- package/lib/es/radio/radioGroup.js +18 -3
- package/lib/es/radio/radioInner.d.ts +6 -1
- package/lib/es/radio/radioInner.js +11 -3
- package/lib/es/rating/index.d.ts +14 -0
- package/lib/es/rating/index.js +14 -3
- package/lib/es/rating/item.d.ts +2 -0
- package/lib/es/rating/item.js +6 -1
- package/lib/es/select/index.d.ts +16 -0
- package/lib/es/select/index.js +63 -17
- package/lib/es/select/option.js +28 -22
- package/lib/es/sideSheet/SideSheetContent.d.ts +1 -0
- package/lib/es/sideSheet/SideSheetContent.js +4 -1
- package/lib/es/sideSheet/index.d.ts +1 -0
- package/lib/es/sideSheet/index.js +2 -1
- package/lib/es/slider/index.d.ts +2 -1
- package/lib/es/slider/index.js +63 -16
- package/lib/es/spin/icon.js +3 -4
- package/lib/es/steps/basicStep.d.ts +3 -0
- package/lib/es/steps/basicStep.js +23 -23
- package/lib/es/steps/basicSteps.d.ts +1 -0
- package/lib/es/steps/basicSteps.js +2 -1
- package/lib/es/steps/fillStep.d.ts +3 -0
- package/lib/es/steps/fillStep.js +19 -4
- package/lib/es/steps/fillSteps.d.ts +1 -0
- package/lib/es/steps/fillSteps.js +2 -1
- package/lib/es/steps/navStep.d.ts +3 -0
- package/lib/es/steps/navStep.js +22 -23
- package/lib/es/steps/navSteps.d.ts +1 -0
- package/lib/es/steps/navSteps.js +2 -1
- package/lib/es/switch/index.d.ts +12 -0
- package/lib/es/switch/index.js +19 -4
- package/lib/es/table/Body/BaseRow.js +35 -3
- package/lib/es/table/Body/index.js +9 -2
- package/lib/es/table/ColumnFilter.js +4 -0
- package/lib/es/table/ColumnSelection.d.ts +3 -0
- package/lib/es/table/ColumnSelection.js +6 -2
- package/lib/es/table/ColumnSorter.js +17 -3
- package/lib/es/table/CustomExpandIcon.js +6 -1
- package/lib/es/table/Table.d.ts +2 -0
- package/lib/es/table/Table.js +31 -15
- package/lib/es/table/TableCell.d.ts +2 -0
- package/lib/es/table/TableCell.js +6 -2
- package/lib/es/table/TableHeaderRow.js +8 -2
- package/lib/es/tabs/TabBar.js +11 -3
- package/lib/es/tabs/TabPane.js +3 -1
- package/lib/es/tabs/index.js +0 -1
- package/lib/es/tagInput/index.d.ts +4 -1
- package/lib/es/tagInput/index.js +29 -3
- package/lib/es/timePicker/TimePicker.d.ts +12 -0
- package/lib/es/timePicker/TimePicker.js +9 -1
- package/lib/es/timePicker/index.d.ts +6 -0
- package/lib/es/timeline/index.d.ts +1 -1
- package/lib/es/timeline/index.js +1 -0
- package/lib/es/timeline/item.js +4 -2
- package/lib/es/toast/toast.js +2 -0
- package/lib/es/tooltip/TriangleArrow.js +1 -0
- package/lib/es/tooltip/TriangleArrowVertical.js +1 -0
- package/lib/es/tooltip/index.d.ts +16 -12
- package/lib/es/tooltip/index.js +53 -39
- package/lib/es/transfer/index.d.ts +1 -1
- package/lib/es/transfer/index.js +35 -17
- package/lib/es/tree/index.d.ts +1 -0
- package/lib/es/tree/index.js +15 -6
- package/lib/es/tree/treeNode.d.ts +12 -4
- package/lib/es/tree/treeNode.js +44 -4
- package/lib/es/treeSelect/index.d.ts +16 -0
- package/lib/es/treeSelect/index.js +57 -10
- package/lib/es/typography/base.js +17 -7
- package/lib/es/typography/copyable.js +5 -1
- package/lib/es/upload/fileCard.js +26 -7
- package/lib/es/upload/index.js +19 -4
- package/list/item.tsx +0 -1
- package/modal/Modal.tsx +2 -0
- package/modal/ModalContent.tsx +35 -5
- package/navigation/Item.tsx +15 -0
- package/navigation/SubNav.tsx +13 -1
- package/navigation/index.tsx +1 -1
- package/notification/notice.tsx +19 -14
- package/package.json +8 -8
- package/pagination/index.tsx +9 -5
- package/popover/index.tsx +5 -0
- package/progress/_story/progress.stories.js +18 -18
- package/progress/index.tsx +58 -20
- package/radio/radio.tsx +12 -2
- package/radio/radioGroup.tsx +29 -3
- package/radio/radioInner.tsx +10 -1
- package/rating/index.tsx +19 -2
- package/rating/item.tsx +6 -0
- package/select/__test__/select.test.js +45 -0
- package/select/_story/select.stories.js +29 -0
- package/select/index.tsx +52 -4
- package/select/option.tsx +3 -0
- package/sideSheet/SideSheetContent.tsx +6 -4
- package/sideSheet/index.tsx +3 -2
- package/slider/__test__/slider.test.js +9 -0
- package/slider/_story/slider.stories.js +1 -1
- package/slider/index.tsx +44 -7
- package/spin/icon.tsx +4 -3
- package/steps/basicStep.tsx +15 -4
- package/steps/basicSteps.tsx +3 -2
- package/steps/fillStep.tsx +27 -12
- package/steps/fillSteps.tsx +2 -0
- package/steps/navStep.tsx +15 -4
- package/steps/navSteps.tsx +3 -2
- package/switch/_story/switch.stories.js +20 -19
- package/switch/_story/switch.stories.tsx +13 -13
- package/switch/index.tsx +23 -5
- package/table/Body/BaseRow.tsx +25 -1
- package/table/Body/index.tsx +7 -2
- package/table/ColumnFilter.tsx +7 -1
- package/table/ColumnSelection.tsx +4 -1
- package/table/ColumnSorter.tsx +18 -1
- package/table/CustomExpandIcon.tsx +5 -0
- package/table/Table.tsx +26 -13
- package/table/TableCell.tsx +11 -1
- package/table/TableHeaderRow.tsx +16 -2
- package/table/__test__/table.test.js +46 -0
- package/tabs/TabBar.tsx +8 -5
- package/tabs/TabPane.tsx +3 -1
- package/tabs/index.tsx +0 -1
- package/tagInput/__test__/tagInput.test.js +46 -0
- package/tagInput/_story/tagInput.stories.js +2 -2
- package/tagInput/index.tsx +31 -8
- package/timePicker/TimePicker.tsx +14 -1
- package/timeline/_story/timeline.stories.js +1 -1
- package/timeline/index.tsx +2 -2
- package/timeline/item.tsx +2 -1
- package/toast/toast.tsx +2 -0
- package/tooltip/TriangleArrow.tsx +1 -1
- package/tooltip/TriangleArrowVertical.tsx +1 -1
- package/tooltip/_story/tooltip.stories.js +562 -514
- package/tooltip/index.tsx +51 -33
- package/transfer/index.tsx +32 -28
- package/tree/_story/tree.stories.js +3 -3
- package/tree/index.tsx +10 -2
- package/tree/treeNode.tsx +46 -10
- package/treeSelect/__test__/treeMultiple.test.js +5 -0
- package/treeSelect/_story/treeSelect.stories.js +12 -0
- package/treeSelect/index.tsx +58 -7
- package/typography/base.tsx +7 -1
- package/typography/copyable.tsx +10 -1
- package/upload/fileCard.tsx +14 -16
- package/upload/index.tsx +10 -6
package/lib/cjs/upload/index.js
CHANGED
|
@@ -233,6 +233,7 @@ class Upload extends _baseComponent.default {
|
|
|
233
233
|
});
|
|
234
234
|
const mainCls = "".concat(prefixCls, "-file-list-main");
|
|
235
235
|
const addContentProps = {
|
|
236
|
+
role: 'button',
|
|
236
237
|
className: uploadAddCls,
|
|
237
238
|
onClick: this.onClick
|
|
238
239
|
};
|
|
@@ -265,7 +266,9 @@ class Upload extends _baseComponent.default {
|
|
|
265
266
|
return /*#__PURE__*/_react.default.createElement(_localeConsumer.default, {
|
|
266
267
|
componentName: "Upload"
|
|
267
268
|
}, locale => /*#__PURE__*/_react.default.createElement("div", (0, _assign.default)({}, containerProps), /*#__PURE__*/_react.default.createElement("div", {
|
|
268
|
-
className: mainCls
|
|
269
|
+
className: mainCls,
|
|
270
|
+
role: "list",
|
|
271
|
+
"aria-label": "picture list"
|
|
269
272
|
}, (0, _map.default)(fileList).call(fileList, (file, index) => this.renderFile(file, index, locale)), showAddTriggerInList ? addContent : null)));
|
|
270
273
|
};
|
|
271
274
|
|
|
@@ -299,10 +302,14 @@ class Upload extends _baseComponent.default {
|
|
|
299
302
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
300
303
|
className: "".concat(titleCls, "-choosen")
|
|
301
304
|
}, locale.selectedFiles), showClear ? /*#__PURE__*/_react.default.createElement("span", {
|
|
305
|
+
role: "button",
|
|
306
|
+
tabIndex: 0,
|
|
302
307
|
onClick: this.clear,
|
|
303
308
|
className: "".concat(titleCls, "-clear")
|
|
304
309
|
}, locale.clear) : null) : null, /*#__PURE__*/_react.default.createElement("div", {
|
|
305
|
-
className: mainCls
|
|
310
|
+
className: mainCls,
|
|
311
|
+
role: "list",
|
|
312
|
+
"aria-label": "file list"
|
|
306
313
|
}, (0, _map.default)(fileList).call(fileList, (file, index) => this.renderFile(file, index, locale)))));
|
|
307
314
|
};
|
|
308
315
|
|
|
@@ -327,7 +334,8 @@ class Upload extends _baseComponent.default {
|
|
|
327
334
|
const {
|
|
328
335
|
draggable,
|
|
329
336
|
children,
|
|
330
|
-
listType
|
|
337
|
+
listType,
|
|
338
|
+
disabled
|
|
331
339
|
} = this.props;
|
|
332
340
|
const uploadAddCls = (0, _classnames.default)("".concat(prefixCls, "-add"));
|
|
333
341
|
|
|
@@ -340,6 +348,9 @@ class Upload extends _baseComponent.default {
|
|
|
340
348
|
}
|
|
341
349
|
|
|
342
350
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
351
|
+
role: "button",
|
|
352
|
+
tabIndex: 0,
|
|
353
|
+
"aria-disabled": disabled,
|
|
343
354
|
className: uploadAddCls,
|
|
344
355
|
onClick: this.onClick
|
|
345
356
|
}, children);
|
|
@@ -353,7 +364,8 @@ class Upload extends _baseComponent.default {
|
|
|
353
364
|
children,
|
|
354
365
|
dragIcon,
|
|
355
366
|
dragMainText,
|
|
356
|
-
dragSubText
|
|
367
|
+
dragSubText,
|
|
368
|
+
disabled
|
|
357
369
|
} = this.props;
|
|
358
370
|
const dragAreaBaseCls = "".concat(prefixCls, "-drag-area");
|
|
359
371
|
const dragAreaCls = (0, _classnames.default)(dragAreaBaseCls, {
|
|
@@ -364,6 +376,9 @@ class Upload extends _baseComponent.default {
|
|
|
364
376
|
return /*#__PURE__*/_react.default.createElement(_localeConsumer.default, {
|
|
365
377
|
componentName: "Upload"
|
|
366
378
|
}, locale => /*#__PURE__*/_react.default.createElement("div", {
|
|
379
|
+
role: "button",
|
|
380
|
+
tabIndex: 0,
|
|
381
|
+
"aria-disabled": disabled,
|
|
367
382
|
className: dragAreaCls,
|
|
368
383
|
onDrop: this.onDrop,
|
|
369
384
|
onDragOver: this.onDragOver,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import _isFunction from "lodash/isFunction";
|
|
2
|
+
import _get from "lodash/get";
|
|
3
|
+
import { useState, useEffect } from 'react';
|
|
4
|
+
import { getActiveElement } from '../index';
|
|
5
|
+
export function usePrevFocus() {
|
|
6
|
+
const [prevFocusElement, setPrevFocus] = useState(getActiveElement());
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
return function cleanup() {
|
|
9
|
+
const blur = _get(prevFocusElement, 'blur');
|
|
10
|
+
|
|
11
|
+
_isFunction(blur) && blur();
|
|
12
|
+
};
|
|
13
|
+
}, [prevFocusElement]);
|
|
14
|
+
return [prevFocusElement, setPrevFocus];
|
|
15
|
+
}
|
package/lib/es/_utils/index.d.ts
CHANGED
package/lib/es/_utils/index.js
CHANGED
|
@@ -165,4 +165,7 @@ export const registerMediaQuery = (media, _ref2) => {
|
|
|
165
165
|
* @returns boolean
|
|
166
166
|
*/
|
|
167
167
|
|
|
168
|
-
export const isSemiIcon = icon => /*#__PURE__*/React.isValidElement(icon) && _get(icon.type, 'elementType') === 'Icon';
|
|
168
|
+
export const isSemiIcon = icon => /*#__PURE__*/React.isValidElement(icon) && _get(icon.type, 'elementType') === 'Icon';
|
|
169
|
+
export function getActiveElement() {
|
|
170
|
+
return document ? document.activeElement : null;
|
|
171
|
+
}
|
package/lib/es/anchor/index.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export interface AnchorProps {
|
|
|
24
24
|
targetOffset?: number;
|
|
25
25
|
onChange?: (currentLink: string, previousLink: string) => void;
|
|
26
26
|
onClick?: (e: React.MouseEvent<HTMLElement>, currentLink: string) => void;
|
|
27
|
+
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
27
28
|
}
|
|
28
29
|
export interface AnchorState {
|
|
29
30
|
activeLink: string;
|
|
@@ -51,6 +52,7 @@ declare class Anchor extends BaseComponent<AnchorProps, AnchorState> {
|
|
|
51
52
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
52
53
|
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
53
54
|
defaultAnchor: PropTypes.Requireable<string>;
|
|
55
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
54
56
|
};
|
|
55
57
|
static defaultProps: {
|
|
56
58
|
size: string;
|
package/lib/es/anchor/index.js
CHANGED
|
@@ -221,6 +221,7 @@ class Anchor extends BaseComponent {
|
|
|
221
221
|
position,
|
|
222
222
|
autoCollapse
|
|
223
223
|
} = this.props;
|
|
224
|
+
const ariaLabel = this.props['aria-label'];
|
|
224
225
|
const {
|
|
225
226
|
activeLink,
|
|
226
227
|
scrollHeight,
|
|
@@ -255,10 +256,13 @@ class Anchor extends BaseComponent {
|
|
|
255
256
|
removeLink: this.removeLink
|
|
256
257
|
}
|
|
257
258
|
}, /*#__PURE__*/React.createElement("div", {
|
|
259
|
+
role: "navigation",
|
|
260
|
+
"aria-label": ariaLabel || 'Side navigation',
|
|
258
261
|
className: wrapperCls,
|
|
259
262
|
style: wrapperStyle,
|
|
260
263
|
id: this.anchorID
|
|
261
264
|
}, /*#__PURE__*/React.createElement("div", {
|
|
265
|
+
"aria-hidden": true,
|
|
262
266
|
className: slideCls,
|
|
263
267
|
style: {
|
|
264
268
|
height: scrollHeight
|
|
@@ -292,7 +296,8 @@ Anchor.PropTypes = {
|
|
|
292
296
|
getContainer: PropTypes.func,
|
|
293
297
|
onChange: PropTypes.func,
|
|
294
298
|
onClick: PropTypes.func,
|
|
295
|
-
defaultAnchor: PropTypes.string
|
|
299
|
+
defaultAnchor: PropTypes.string,
|
|
300
|
+
'aria-label': PropTypes.string
|
|
296
301
|
};
|
|
297
302
|
Anchor.defaultProps = {
|
|
298
303
|
size: 'default',
|
package/lib/es/anchor/link.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import BaseComponent from '../_base/baseComponent';
|
|
4
4
|
import LinkFoundation, { LinkAdapter } from '@douyinfe/semi-foundation/lib/es/anchor/linkFoundation';
|
|
5
|
+
import { AnchorContextType } from './anchor-context';
|
|
5
6
|
export interface LinkProps {
|
|
6
7
|
href?: string;
|
|
7
8
|
title?: string | React.ReactNode;
|
|
@@ -21,13 +22,15 @@ export default class Link extends BaseComponent<LinkProps, {}> {
|
|
|
21
22
|
title: string;
|
|
22
23
|
className: string;
|
|
23
24
|
};
|
|
24
|
-
static contextType: React.Context<
|
|
25
|
+
static contextType: React.Context<AnchorContextType>;
|
|
25
26
|
foundation: LinkFoundation;
|
|
27
|
+
context: AnchorContextType;
|
|
26
28
|
constructor(props: LinkProps);
|
|
27
29
|
get adapter(): LinkAdapter;
|
|
28
30
|
handleAddLink(): void;
|
|
29
31
|
handleRemoveLink(): void;
|
|
30
32
|
handleUpdateLink(href: string, prevHref: string): void;
|
|
33
|
+
handleClick(e: React.KeyboardEvent | React.MouseEvent): void;
|
|
31
34
|
componentDidMount(): void;
|
|
32
35
|
componentDidUpdate(prevProps: LinkProps): void;
|
|
33
36
|
componentWillUnmount(): void;
|
package/lib/es/anchor/link.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
2
|
+
import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import cls from 'classnames';
|
|
4
5
|
import PropTypes from 'prop-types';
|
|
@@ -11,6 +12,8 @@ const prefixCls = cssClasses.PREFIX; // eslint-disable-next-line @typescript-esl
|
|
|
11
12
|
|
|
12
13
|
export default class Link extends BaseComponent {
|
|
13
14
|
constructor(props) {
|
|
15
|
+
var _context;
|
|
16
|
+
|
|
14
17
|
super(props);
|
|
15
18
|
|
|
16
19
|
this.renderTitle = () => {
|
|
@@ -69,6 +72,7 @@ export default class Link extends BaseComponent {
|
|
|
69
72
|
};
|
|
70
73
|
|
|
71
74
|
this.foundation = new LinkFoundation(this.adapter);
|
|
75
|
+
this.handleClick = _bindInstanceProperty(_context = this.handleClick).call(_context, this);
|
|
72
76
|
}
|
|
73
77
|
|
|
74
78
|
get adapter() {
|
|
@@ -94,6 +98,17 @@ export default class Link extends BaseComponent {
|
|
|
94
98
|
this.foundation.handleUpdateLink(href, prevHref);
|
|
95
99
|
}
|
|
96
100
|
|
|
101
|
+
handleClick(e) {
|
|
102
|
+
const {
|
|
103
|
+
disabled,
|
|
104
|
+
href
|
|
105
|
+
} = this.props;
|
|
106
|
+
const {
|
|
107
|
+
onClick
|
|
108
|
+
} = this.context;
|
|
109
|
+
!disabled && onClick(e, href);
|
|
110
|
+
}
|
|
111
|
+
|
|
97
112
|
componentDidMount() {
|
|
98
113
|
this.handleAddLink();
|
|
99
114
|
}
|
|
@@ -115,11 +130,12 @@ export default class Link extends BaseComponent {
|
|
|
115
130
|
href,
|
|
116
131
|
className,
|
|
117
132
|
style,
|
|
118
|
-
disabled = false
|
|
133
|
+
disabled = false,
|
|
134
|
+
title
|
|
119
135
|
} = this.props;
|
|
120
136
|
const {
|
|
121
137
|
activeLink,
|
|
122
|
-
|
|
138
|
+
showTooltip
|
|
123
139
|
} = this.context;
|
|
124
140
|
const active = activeLink === href;
|
|
125
141
|
const linkCls = cls("".concat(prefixCls, "-link"), className);
|
|
@@ -127,13 +143,30 @@ export default class Link extends BaseComponent {
|
|
|
127
143
|
["".concat(prefixCls, "-link-title-active")]: active,
|
|
128
144
|
["".concat(prefixCls, "-link-title-disabled")]: disabled
|
|
129
145
|
});
|
|
146
|
+
const ariaProps = {
|
|
147
|
+
'aria-disabled': disabled,
|
|
148
|
+
'aria-label': href
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
if (active) {
|
|
152
|
+
ariaProps['aria-details'] = 'active';
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (!showTooltip && typeof title === 'string') {
|
|
156
|
+
ariaProps['title'] = title;
|
|
157
|
+
}
|
|
158
|
+
|
|
130
159
|
return /*#__PURE__*/React.createElement("div", {
|
|
131
160
|
className: linkCls,
|
|
132
161
|
style: style
|
|
133
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
162
|
+
}, /*#__PURE__*/React.createElement("div", _Object$assign({
|
|
163
|
+
role: "link",
|
|
164
|
+
tabIndex: 0
|
|
165
|
+
}, ariaProps, {
|
|
134
166
|
className: linkTitleCls,
|
|
135
|
-
onClick: e =>
|
|
136
|
-
|
|
167
|
+
onClick: e => this.handleClick(e),
|
|
168
|
+
onKeyPress: e => this.handleClick(e)
|
|
169
|
+
}), this.renderTitle()), this.renderChildren());
|
|
137
170
|
}
|
|
138
171
|
|
|
139
172
|
}
|
|
@@ -18,6 +18,12 @@ export interface BaseDataItem extends DataItem {
|
|
|
18
18
|
}
|
|
19
19
|
export declare type AutoCompleteItems = BaseDataItem | string | number;
|
|
20
20
|
export interface AutoCompleteProps<T extends AutoCompleteItems> {
|
|
21
|
+
'aria-describedby'?: React.AriaAttributes['aria-describedby'];
|
|
22
|
+
'aria-errormessage'?: React.AriaAttributes['aria-errormessage'];
|
|
23
|
+
'aria-invalid'?: React.AriaAttributes['aria-invalid'];
|
|
24
|
+
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
25
|
+
'aria-labelledby'?: React.AriaAttributes['aria-labelledby'];
|
|
26
|
+
'aria-required'?: React.AriaAttributes['aria-required'];
|
|
21
27
|
autoAdjustOverflow?: boolean;
|
|
22
28
|
autoFocus?: boolean;
|
|
23
29
|
className?: string;
|
|
@@ -33,6 +39,8 @@ export interface AutoCompleteProps<T extends AutoCompleteItems> {
|
|
|
33
39
|
emptyContent?: React.ReactNode | null;
|
|
34
40
|
getPopupContainer?: () => HTMLElement;
|
|
35
41
|
insetLabel?: React.ReactNode;
|
|
42
|
+
insetLabelId?: string;
|
|
43
|
+
id?: string;
|
|
36
44
|
loading?: boolean;
|
|
37
45
|
motion?: Motion;
|
|
38
46
|
maxHeight?: string | number;
|
|
@@ -77,6 +85,12 @@ interface AutoCompleteState {
|
|
|
77
85
|
}
|
|
78
86
|
declare class AutoComplete<T extends AutoCompleteItems> extends BaseComponent<AutoCompleteProps<T>, AutoCompleteState> {
|
|
79
87
|
static propTypes: {
|
|
88
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
89
|
+
'aria-labelledby': PropTypes.Requireable<string>;
|
|
90
|
+
'aria-invalid': PropTypes.Requireable<boolean>;
|
|
91
|
+
'aria-errormessage': PropTypes.Requireable<string>;
|
|
92
|
+
'aria-describedby': PropTypes.Requireable<string>;
|
|
93
|
+
'aria-required': PropTypes.Requireable<boolean>;
|
|
80
94
|
autoFocus: PropTypes.Requireable<boolean>;
|
|
81
95
|
autoAdjustOverflow: PropTypes.Requireable<boolean>;
|
|
82
96
|
className: PropTypes.Requireable<string>;
|
|
@@ -90,6 +104,9 @@ declare class AutoComplete<T extends AutoCompleteItems> extends BaseComponent<Au
|
|
|
90
104
|
dropdownClassName: PropTypes.Requireable<string>;
|
|
91
105
|
dropdownStyle: PropTypes.Requireable<object>;
|
|
92
106
|
emptyContent: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
107
|
+
id: PropTypes.Requireable<string>;
|
|
108
|
+
insetLabel: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
109
|
+
insetLabelId: PropTypes.Requireable<string>;
|
|
93
110
|
onSearch: PropTypes.Requireable<(...args: any[]) => any>;
|
|
94
111
|
onSelect: PropTypes.Requireable<(...args: any[]) => any>;
|
|
95
112
|
onClear: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -175,6 +175,7 @@ class AutoComplete extends BaseComponent {
|
|
|
175
175
|
size,
|
|
176
176
|
prefix,
|
|
177
177
|
insetLabel,
|
|
178
|
+
insetLabelId,
|
|
178
179
|
suffix,
|
|
179
180
|
placeholder,
|
|
180
181
|
style,
|
|
@@ -184,7 +185,8 @@ class AutoComplete extends BaseComponent {
|
|
|
184
185
|
triggerRender,
|
|
185
186
|
validateStatus,
|
|
186
187
|
autoFocus,
|
|
187
|
-
value
|
|
188
|
+
value,
|
|
189
|
+
id
|
|
188
190
|
} = this.props;
|
|
189
191
|
const {
|
|
190
192
|
inputValue,
|
|
@@ -200,7 +202,8 @@ class AutoComplete extends BaseComponent {
|
|
|
200
202
|
["".concat(prefixCls, "-disabled")]: disabled
|
|
201
203
|
}, className),
|
|
202
204
|
onClick: this.handleInputClick,
|
|
203
|
-
ref: this.triggerRef
|
|
205
|
+
ref: this.triggerRef,
|
|
206
|
+
id
|
|
204
207
|
}, keyboardEventSet);
|
|
205
208
|
|
|
206
209
|
const innerProps = {
|
|
@@ -209,9 +212,16 @@ class AutoComplete extends BaseComponent {
|
|
|
209
212
|
autofocus: autoFocus,
|
|
210
213
|
onChange: this.onSearch,
|
|
211
214
|
onClear: this.onInputClear,
|
|
215
|
+
'aria-label': this.props['aria-label'],
|
|
216
|
+
'aria-labelledby': this.props['aria-labelledby'],
|
|
217
|
+
'aria-invalid': this.props['aria-invalid'],
|
|
218
|
+
'aria-errormessage': this.props['aria-errormessage'],
|
|
219
|
+
'aria-describedby': this.props['aria-describedby'],
|
|
220
|
+
'aria-required': this.props['aria-required'],
|
|
212
221
|
// TODO: remove in next major version
|
|
213
222
|
suffix,
|
|
214
223
|
prefix: prefix || insetLabel,
|
|
224
|
+
insetLabelId,
|
|
215
225
|
showClear,
|
|
216
226
|
validateStatus,
|
|
217
227
|
size,
|
|
@@ -326,6 +336,12 @@ class AutoComplete extends BaseComponent {
|
|
|
326
336
|
}
|
|
327
337
|
|
|
328
338
|
AutoComplete.propTypes = {
|
|
339
|
+
'aria-label': PropTypes.string,
|
|
340
|
+
'aria-labelledby': PropTypes.string,
|
|
341
|
+
'aria-invalid': PropTypes.bool,
|
|
342
|
+
'aria-errormessage': PropTypes.string,
|
|
343
|
+
'aria-describedby': PropTypes.string,
|
|
344
|
+
'aria-required': PropTypes.bool,
|
|
329
345
|
autoFocus: PropTypes.bool,
|
|
330
346
|
autoAdjustOverflow: PropTypes.bool,
|
|
331
347
|
className: PropTypes.string,
|
|
@@ -339,6 +355,9 @@ AutoComplete.propTypes = {
|
|
|
339
355
|
dropdownClassName: PropTypes.string,
|
|
340
356
|
dropdownStyle: PropTypes.object,
|
|
341
357
|
emptyContent: PropTypes.node,
|
|
358
|
+
id: PropTypes.string,
|
|
359
|
+
insetLabel: PropTypes.node,
|
|
360
|
+
insetLabelId: PropTypes.string,
|
|
342
361
|
onSearch: PropTypes.func,
|
|
343
362
|
onSelect: PropTypes.func,
|
|
344
363
|
onClear: PropTypes.func,
|
package/lib/es/avatar/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { AvatarAdapter } from '@douyinfe/semi-foundation/lib/es/avatar/foundation';
|
|
3
|
+
import AvatarFoundation, { AvatarAdapter } from '@douyinfe/semi-foundation/lib/es/avatar/foundation';
|
|
4
4
|
import '@douyinfe/semi-foundation/lib/es/avatar/avatar.css';
|
|
5
5
|
import { noop } from '@douyinfe/semi-foundation/lib/es/utils/function';
|
|
6
6
|
import BaseComponent from '../_base/baseComponent';
|
|
@@ -36,13 +36,14 @@ export default class Avatar extends BaseComponent<AvatarProps, AvatarState> {
|
|
|
36
36
|
onMouseEnter: PropTypes.Requireable<(...args: any[]) => any>;
|
|
37
37
|
onMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
|
|
38
38
|
};
|
|
39
|
+
foundation: AvatarFoundation;
|
|
39
40
|
constructor(props: AvatarProps);
|
|
40
41
|
get adapter(): AvatarAdapter<AvatarProps, AvatarState>;
|
|
41
42
|
componentDidMount(): void;
|
|
42
43
|
componentDidUpdate(prevProps: AvatarProps): void;
|
|
43
44
|
componentWillUnmount(): void;
|
|
44
|
-
onEnter(): void;
|
|
45
|
-
onLeave(): void;
|
|
45
|
+
onEnter(e: React.MouseEvent): void;
|
|
46
|
+
onLeave(e: React.MouseEvent): void;
|
|
46
47
|
handleError(): void;
|
|
47
48
|
render(): JSX.Element;
|
|
48
49
|
}
|
package/lib/es/avatar/index.js
CHANGED
|
@@ -110,12 +110,12 @@ export default class Avatar extends BaseComponent {
|
|
|
110
110
|
this.foundation.destroy();
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
onEnter() {
|
|
114
|
-
this.foundation.handleEnter();
|
|
113
|
+
onEnter(e) {
|
|
114
|
+
this.foundation.handleEnter(e);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
onLeave() {
|
|
118
|
-
this.foundation.handleLeave();
|
|
117
|
+
onLeave(e) {
|
|
118
|
+
this.foundation.handleLeave(e);
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
handleError() {
|
|
@@ -174,13 +174,17 @@ export default class Avatar extends BaseComponent {
|
|
|
174
174
|
}, children));
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
return
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
177
|
+
return (
|
|
178
|
+
/*#__PURE__*/
|
|
179
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions,jsx-a11y/click-events-have-key-events
|
|
180
|
+
React.createElement("span", _Object$assign({}, others, {
|
|
181
|
+
style: style,
|
|
182
|
+
className: avatarCls,
|
|
183
|
+
onClick: onClick,
|
|
184
|
+
onMouseEnter: this.onEnter,
|
|
185
|
+
onMouseLeave: this.onLeave
|
|
186
|
+
}), content, hoverRender)
|
|
187
|
+
);
|
|
184
188
|
}
|
|
185
189
|
|
|
186
190
|
}
|
package/lib/es/banner/index.js
CHANGED
|
@@ -70,7 +70,8 @@ export default class Banner extends BaseComponent {
|
|
|
70
70
|
icon: closeIcon || /*#__PURE__*/React.createElement(IconClose, null),
|
|
71
71
|
theme: "borderless",
|
|
72
72
|
size: "small",
|
|
73
|
-
type: "tertiary"
|
|
73
|
+
type: "tertiary",
|
|
74
|
+
"aria-label": 'Close'
|
|
74
75
|
});
|
|
75
76
|
return closer;
|
|
76
77
|
}
|
|
@@ -137,7 +138,8 @@ export default class Banner extends BaseComponent {
|
|
|
137
138
|
});
|
|
138
139
|
const banner = visible ? /*#__PURE__*/React.createElement("div", {
|
|
139
140
|
className: wrapper,
|
|
140
|
-
style: style
|
|
141
|
+
style: style,
|
|
142
|
+
role: "alert"
|
|
141
143
|
}, /*#__PURE__*/React.createElement("div", {
|
|
142
144
|
className: "".concat(prefixCls, "-content-wrapper")
|
|
143
145
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -27,6 +27,7 @@ export interface BreadcrumbProps extends BaseProps {
|
|
|
27
27
|
autoCollapse?: boolean;
|
|
28
28
|
renderMore?: (restItem: Array<React.ReactNode>) => React.ReactNode;
|
|
29
29
|
moreType?: MoreType;
|
|
30
|
+
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
30
31
|
}
|
|
31
32
|
interface BreadcrumbState {
|
|
32
33
|
isCollapsed: boolean;
|
|
@@ -52,6 +53,7 @@ declare class Breadcrumb extends BaseComponent<BreadcrumbProps, BreadcrumbState>
|
|
|
52
53
|
maxItemCount: propTypes.Requireable<number>;
|
|
53
54
|
renderMore: propTypes.Requireable<(...args: any[]) => any>;
|
|
54
55
|
moreType: propTypes.Requireable<string>;
|
|
56
|
+
'aria-label': propTypes.Requireable<string>;
|
|
55
57
|
};
|
|
56
58
|
static defaultProps: {
|
|
57
59
|
routes: [];
|
|
@@ -66,6 +68,7 @@ declare class Breadcrumb extends BaseComponent<BreadcrumbProps, BreadcrumbState>
|
|
|
66
68
|
autoCollapse: boolean;
|
|
67
69
|
moreType: string;
|
|
68
70
|
maxItemCount: number;
|
|
71
|
+
'aria-label': string;
|
|
69
72
|
};
|
|
70
73
|
constructor(props: BreadcrumbProps);
|
|
71
74
|
get adapter(): BreadcrumbAdapter<BreadcrumbProps, BreadcrumbState>;
|
|
@@ -47,8 +47,12 @@ class Breadcrumb extends BaseComponent {
|
|
|
47
47
|
}, /*#__PURE__*/React.createElement("span", {
|
|
48
48
|
className: "".concat(clsPrefix, "-item-wrap")
|
|
49
49
|
}, /*#__PURE__*/React.createElement("span", {
|
|
50
|
+
role: 'button',
|
|
51
|
+
tabIndex: 0,
|
|
52
|
+
"aria-label": 'Expand breadcrumb items',
|
|
50
53
|
className: _concatInstanceProperty(_context = "".concat(clsPrefix, "-item ")).call(_context, clsPrefix, "-item-more"),
|
|
51
|
-
onClick: item => this.foundation.handleExpand(item)
|
|
54
|
+
onClick: item => this.foundation.handleExpand(item),
|
|
55
|
+
onKeyPress: e => this.foundation.handleExpandEnterPress(e)
|
|
52
56
|
}, hasRenderMore && renderMore(restItem), !hasRenderMore && moreType === 'default' && /*#__PURE__*/React.createElement(IconMore, null), !hasRenderMore && moreType === 'popover' && this.renderPopoverMore(restItem)), /*#__PURE__*/React.createElement("span", {
|
|
53
57
|
className: "".concat(clsPrefix, "-separator")
|
|
54
58
|
}, this.props.separator)));
|
|
@@ -210,7 +214,7 @@ class Breadcrumb extends BaseComponent {
|
|
|
210
214
|
separator
|
|
211
215
|
}
|
|
212
216
|
}, /*#__PURE__*/React.createElement("nav", {
|
|
213
|
-
"aria-label":
|
|
217
|
+
"aria-label": this.props['aria-label'],
|
|
214
218
|
className: sizeCls,
|
|
215
219
|
style: style
|
|
216
220
|
}, breadcrumbs));
|
|
@@ -241,7 +245,8 @@ Breadcrumb.propTypes = {
|
|
|
241
245
|
renderMore: propTypes.func,
|
|
242
246
|
|
|
243
247
|
/* Type of ellipsis area */
|
|
244
|
-
moreType: propTypes.oneOf(strings.MORE_TYPE)
|
|
248
|
+
moreType: propTypes.oneOf(strings.MORE_TYPE),
|
|
249
|
+
'aria-label': propTypes.string
|
|
245
250
|
};
|
|
246
251
|
Breadcrumb.defaultProps = {
|
|
247
252
|
routes: [],
|
|
@@ -255,6 +260,7 @@ Breadcrumb.defaultProps = {
|
|
|
255
260
|
},
|
|
256
261
|
autoCollapse: true,
|
|
257
262
|
moreType: 'default',
|
|
258
|
-
maxItemCount: 4
|
|
263
|
+
maxItemCount: 4,
|
|
264
|
+
'aria-label': 'Breadcrumb'
|
|
259
265
|
};
|
|
260
266
|
export default Breadcrumb;
|
|
@@ -177,9 +177,9 @@ export default class BreadcrumbItem extends BaseComponent {
|
|
|
177
177
|
shouldRenderSeparator // children,
|
|
178
178
|
|
|
179
179
|
} = this.props;
|
|
180
|
-
const pageLabel = active ? {
|
|
180
|
+
const pageLabel = active ? {
|
|
181
181
|
'aria-current': 'page'
|
|
182
|
-
};
|
|
182
|
+
} : {};
|
|
183
183
|
const item = this.renderItem();
|
|
184
184
|
const separator = !active ? this.props.separator || /*#__PURE__*/React.createElement("span", {
|
|
185
185
|
className: "".concat(clsPrefix, "-separator")
|
|
@@ -25,6 +25,7 @@ export interface ButtonProps {
|
|
|
25
25
|
onMouseDown?: React.MouseEventHandler<HTMLButtonElement>;
|
|
26
26
|
onMouseEnter?: React.MouseEventHandler<HTMLButtonElement>;
|
|
27
27
|
onMouseLeave?: React.MouseEventHandler<HTMLButtonElement>;
|
|
28
|
+
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
28
29
|
}
|
|
29
30
|
export default class Button extends PureComponent<ButtonProps> {
|
|
30
31
|
static defaultProps: {
|
|
@@ -57,6 +58,7 @@ export default class Button extends PureComponent<ButtonProps> {
|
|
|
57
58
|
className: PropTypes.Requireable<string>;
|
|
58
59
|
onMouseEnter: PropTypes.Requireable<(...args: any[]) => any>;
|
|
59
60
|
onMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
|
|
61
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
60
62
|
};
|
|
61
63
|
render(): JSX.Element;
|
|
62
64
|
}
|
package/lib/es/button/Button.js
CHANGED
|
@@ -64,7 +64,8 @@ export default class Button extends PureComponent {
|
|
|
64
64
|
["".concat(prefixCls, "-circle")]: circle,
|
|
65
65
|
["".concat(prefixCls, "-borderless")]: theme === 'borderless'
|
|
66
66
|
}, className),
|
|
67
|
-
type: htmlType
|
|
67
|
+
type: htmlType,
|
|
68
|
+
'aria-disabled': disabled
|
|
68
69
|
});
|
|
69
70
|
|
|
70
71
|
return (
|
|
@@ -111,5 +112,6 @@ Button.propTypes = {
|
|
|
111
112
|
theme: PropTypes.oneOf(strings.themes),
|
|
112
113
|
className: PropTypes.string,
|
|
113
114
|
onMouseEnter: PropTypes.func,
|
|
114
|
-
onMouseLeave: PropTypes.func
|
|
115
|
+
onMouseLeave: PropTypes.func,
|
|
116
|
+
'aria-label': PropTypes.string
|
|
115
117
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import BaseComponent, { BaseProps } from '../_base/baseComponent';
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
3
4
|
import { Type, Size } from './Button';
|
|
@@ -8,6 +9,7 @@ export interface ButtonGroupProps extends BaseProps {
|
|
|
8
9
|
type?: Type;
|
|
9
10
|
size?: Size;
|
|
10
11
|
theme?: Theme;
|
|
12
|
+
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
11
13
|
}
|
|
12
14
|
export default class ButtonGroup extends BaseComponent<ButtonGroupProps> {
|
|
13
15
|
static propTypes: {
|
|
@@ -16,6 +18,7 @@ export default class ButtonGroup extends BaseComponent<ButtonGroupProps> {
|
|
|
16
18
|
type: PropTypes.Requireable<string>;
|
|
17
19
|
size: PropTypes.Requireable<unknown>;
|
|
18
20
|
theme: PropTypes.Requireable<unknown>;
|
|
21
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
19
22
|
};
|
|
20
23
|
static defaultProps: {
|
|
21
24
|
size: string;
|
|
@@ -29,9 +29,10 @@ export default class ButtonGroup extends BaseComponent {
|
|
|
29
29
|
children,
|
|
30
30
|
disabled,
|
|
31
31
|
size,
|
|
32
|
-
type
|
|
32
|
+
type,
|
|
33
|
+
'aria-label': ariaLabel
|
|
33
34
|
} = _a,
|
|
34
|
-
rest = __rest(_a, ["children", "disabled", "size", "type"]);
|
|
35
|
+
rest = __rest(_a, ["children", "disabled", "size", "type", 'aria-label']);
|
|
35
36
|
|
|
36
37
|
let inner;
|
|
37
38
|
|
|
@@ -48,7 +49,9 @@ export default class ButtonGroup extends BaseComponent {
|
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
return /*#__PURE__*/React.createElement("div", {
|
|
51
|
-
className: "".concat(prefixCls, "-group")
|
|
52
|
+
className: "".concat(prefixCls, "-group"),
|
|
53
|
+
role: "group",
|
|
54
|
+
"aria-label": ariaLabel
|
|
52
55
|
}, inner);
|
|
53
56
|
}
|
|
54
57
|
|
|
@@ -58,7 +61,8 @@ ButtonGroup.propTypes = {
|
|
|
58
61
|
disabled: PropTypes.bool,
|
|
59
62
|
type: PropTypes.string,
|
|
60
63
|
size: PropTypes.oneOf(btnSizes),
|
|
61
|
-
theme: PropTypes.oneOf(strings.themes)
|
|
64
|
+
theme: PropTypes.oneOf(strings.themes),
|
|
65
|
+
'aria-label': PropTypes.string
|
|
62
66
|
};
|
|
63
67
|
ButtonGroup.defaultProps = {
|
|
64
68
|
size: 'default',
|
package/lib/es/button/index.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ declare class Button extends React.PureComponent<ButtonProps> {
|
|
|
30
30
|
onMouseDown: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
31
31
|
circle: import("prop-types").Requireable<boolean>;
|
|
32
32
|
htmlType: import("prop-types").Requireable<unknown>;
|
|
33
|
+
'aria-label': import("prop-types").Requireable<string>;
|
|
33
34
|
};
|
|
34
35
|
constructor(props?: {});
|
|
35
36
|
render(): JSX.Element;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import PropTypes from 'prop-types';
|
|
2
3
|
import '@douyinfe/semi-foundation/lib/es/button/button.css';
|
|
3
4
|
import BaseComponent, { BaseProps } from '../_base/baseComponent';
|
|
4
5
|
export interface SplitButtonGroupProps extends BaseProps {
|
|
6
|
+
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
5
7
|
}
|
|
6
8
|
export default class SplitButtonGroup extends BaseComponent<SplitButtonGroupProps> {
|
|
7
9
|
static propTypes: {
|
|
8
10
|
style: PropTypes.Requireable<object>;
|
|
9
11
|
className: PropTypes.Requireable<string>;
|
|
12
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
10
13
|
};
|
|
11
14
|
render(): JSX.Element;
|
|
12
15
|
}
|