@douyinfe/semi-ui 2.2.2 → 2.4.0-beta.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/datePicker.tsx +19 -0
- package/dist/css/semi.css +23 -12
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +2502 -1249
- 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/dropdown/index.tsx +11 -3
- 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 +30 -9
- package/inputNumber/__test__/inputNumber.test.js +36 -8
- package/inputNumber/index.tsx +30 -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 +14 -1
- package/lib/cjs/dropdown/dropdownItem.js +3 -1
- package/lib/cjs/dropdown/dropdownMenu.js +4 -1
- package/lib/cjs/dropdown/index.d.ts +10 -3
- 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 +16 -3
- package/lib/cjs/inputNumber/index.d.ts +8 -0
- package/lib/cjs/inputNumber/index.js +35 -4
- 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/index.d.ts +4 -4
- 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 +35 -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 +14 -0
- package/lib/cjs/timePicker/TimePicker.js +11 -4
- package/lib/cjs/timePicker/index.d.ts +7 -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.js +32 -14
- 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 +54 -5
- 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 +14 -1
- package/lib/es/dropdown/dropdownItem.js +3 -1
- package/lib/es/dropdown/dropdownMenu.js +4 -1
- package/lib/es/dropdown/index.d.ts +10 -3
- 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 +16 -3
- package/lib/es/inputNumber/index.d.ts +8 -0
- package/lib/es/inputNumber/index.js +36 -4
- 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/index.d.ts +4 -4
- 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 +35 -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 +14 -0
- package/lib/es/timePicker/TimePicker.js +11 -4
- package/lib/es/timePicker/index.d.ts +7 -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.js +32 -14
- 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 +53 -5
- 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/index.tsx +5 -5
- 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 +57 -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 +30 -14
- package/table/TableCell.tsx +11 -1
- package/table/TableHeaderRow.tsx +16 -2
- package/table/__test__/table.test.js +46 -0
- package/table/_story/table.stories.js +2 -0
- package/table/_story/v2/FixedColumnsChange/index.jsx +104 -0
- package/table/_story/v2/FixedZIndex/index.jsx +87 -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 +17 -2
- package/timePicker/__test__/timePicker.test.js +34 -3
- package/timePicker/_story/timepicker.stories.js +18 -0
- 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 +29 -25
- package/tree/_story/tree.stories.js +3 -3
- package/tree/index.tsx +10 -2
- package/tree/treeNode.tsx +54 -11
- 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/_base/_story/a11y.jsx
CHANGED
|
@@ -839,12 +839,12 @@ export default function SemiA11y() {
|
|
|
839
839
|
</Timeline.Item>
|
|
840
840
|
</Timeline>
|
|
841
841
|
<div style={{ width: 200 }}>
|
|
842
|
-
<Progress className="mb12" percent={10} stroke="#fc8800" />
|
|
843
|
-
<Progress className="mb12" percent={25} stroke="#f93920" />
|
|
844
|
-
<Progress className="mb12" percent={50} />
|
|
845
|
-
<Progress className="mb12" percent={80} />
|
|
846
|
-
<Progress className="mb12" percent={80} size="large" />
|
|
847
|
-
<Progress className="mb12" percent={80} style={{ height: '8px' }} />
|
|
842
|
+
<Progress className="mb12" percent={10} stroke="#fc8800" aria-label='download progress'/>
|
|
843
|
+
<Progress className="mb12" percent={25} stroke="#f93920" aria-label='download progress'/>
|
|
844
|
+
<Progress className="mb12" percent={50} aria-label='download progress'/>
|
|
845
|
+
<Progress className="mb12" percent={80} aria-label='download progress'/>
|
|
846
|
+
<Progress className="mb12" percent={80} size="large" aria-label='download progress'/>
|
|
847
|
+
<Progress className="mb12" percent={80} style={{ height: '8px' }} aria-label='download progress'/>
|
|
848
848
|
</div>
|
|
849
849
|
<div className="mb12">
|
|
850
850
|
<Skeleton placeholder={placeholder} loading={true} active>
|
package/_base/_story/a11y.scss
CHANGED
package/_base/_story/index.scss
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import { getActiveElement } from '../index';
|
|
3
|
+
import { get, isFunction } from 'lodash';
|
|
4
|
+
|
|
5
|
+
export function usePrevFocus() {
|
|
6
|
+
const [prevFocusElement, setPrevFocus] = useState<HTMLElement>(getActiveElement());
|
|
7
|
+
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
return function cleanup() {
|
|
10
|
+
const blur = get(prevFocusElement, 'blur');
|
|
11
|
+
isFunction(blur) && blur();
|
|
12
|
+
};
|
|
13
|
+
}, [prevFocusElement]);
|
|
14
|
+
|
|
15
|
+
return [prevFocusElement, setPrevFocus];
|
|
16
|
+
}
|
package/_utils/index.ts
CHANGED
|
@@ -160,3 +160,7 @@ export interface HighLightTextHTMLChunk {
|
|
|
160
160
|
* @returns boolean
|
|
161
161
|
*/
|
|
162
162
|
export const isSemiIcon = (icon: any): boolean => React.isValidElement(icon) && get(icon.type, 'elementType') === 'Icon';
|
|
163
|
+
|
|
164
|
+
export function getActiveElement() {
|
|
165
|
+
return document ? document.activeElement as HTMLElement : null;
|
|
166
|
+
}
|
|
@@ -15,7 +15,7 @@ const Link = Anchor.Link;
|
|
|
15
15
|
export const Size = () => (
|
|
16
16
|
<div>
|
|
17
17
|
<div>小号尺寸</div>
|
|
18
|
-
<Anchor size={'small'}>
|
|
18
|
+
<Anchor aria-label='小号尺寸' size={'small'}>
|
|
19
19
|
<Link href="#welcome" title="welcome" />
|
|
20
20
|
<Link href="#api" title="api too much to show" />
|
|
21
21
|
<Link href="#contact" title="contact" />
|
package/anchor/index.tsx
CHANGED
|
@@ -31,6 +31,7 @@ export interface AnchorProps {
|
|
|
31
31
|
targetOffset?: number;
|
|
32
32
|
onChange?: (currentLink: string, previousLink: string) => void;
|
|
33
33
|
onClick?: (e: React.MouseEvent<HTMLElement>, currentLink: string) => void;
|
|
34
|
+
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
export interface AnchorState {
|
|
@@ -60,6 +61,7 @@ class Anchor extends BaseComponent<AnchorProps, AnchorState> {
|
|
|
60
61
|
onChange: PropTypes.func,
|
|
61
62
|
onClick: PropTypes.func,
|
|
62
63
|
defaultAnchor: PropTypes.string,
|
|
64
|
+
'aria-label': PropTypes.string,
|
|
63
65
|
};
|
|
64
66
|
|
|
65
67
|
static defaultProps = {
|
|
@@ -251,6 +253,7 @@ class Anchor extends BaseComponent<AnchorProps, AnchorState> {
|
|
|
251
253
|
position,
|
|
252
254
|
autoCollapse,
|
|
253
255
|
} = this.props;
|
|
256
|
+
const ariaLabel = this.props['aria-label'];
|
|
254
257
|
const { activeLink, scrollHeight, slideBarTop } = this.state;
|
|
255
258
|
const wrapperCls = cls(prefixCls, className, {
|
|
256
259
|
[`${prefixCls}-size-${size}`]: size,
|
|
@@ -282,8 +285,8 @@ class Anchor extends BaseComponent<AnchorProps, AnchorState> {
|
|
|
282
285
|
removeLink: this.removeLink,
|
|
283
286
|
}}
|
|
284
287
|
>
|
|
285
|
-
<div className={wrapperCls} style={wrapperStyle} id={this.anchorID}>
|
|
286
|
-
<div className={slideCls} style={{ height: scrollHeight }}>
|
|
288
|
+
<div role="navigation" aria-label={ ariaLabel || 'Side navigation'} className={wrapperCls} style={wrapperStyle} id={this.anchorID}>
|
|
289
|
+
<div aria-hidden className={slideCls} style={{ height: scrollHeight }}>
|
|
287
290
|
<span className={slideBarCls} style={{ top: slideBarTop }} />
|
|
288
291
|
</div>
|
|
289
292
|
<div className={anchorWrapper}>{children}</div>
|
package/anchor/link.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
|
|
|
4
4
|
import BaseComponent from '../_base/baseComponent';
|
|
5
5
|
import { cssClasses } from '@douyinfe/semi-foundation/anchor/constants';
|
|
6
6
|
import LinkFoundation, { LinkAdapter } from '@douyinfe/semi-foundation/anchor/linkFoundation';
|
|
7
|
-
import AnchorContext from './anchor-context';
|
|
7
|
+
import AnchorContext, { AnchorContextType } from './anchor-context';
|
|
8
8
|
import Typography from '../typography/index';
|
|
9
9
|
|
|
10
10
|
const prefixCls = cssClasses.PREFIX;
|
|
@@ -36,9 +36,11 @@ export default class Link extends BaseComponent<LinkProps, {}> {
|
|
|
36
36
|
|
|
37
37
|
foundation: LinkFoundation;
|
|
38
38
|
|
|
39
|
+
context!: AnchorContextType;
|
|
39
40
|
constructor(props: LinkProps) {
|
|
40
41
|
super(props);
|
|
41
42
|
this.foundation = new LinkFoundation(this.adapter);
|
|
43
|
+
this.handleClick = this.handleClick.bind(this);
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
get adapter(): LinkAdapter {
|
|
@@ -65,6 +67,12 @@ export default class Link extends BaseComponent<LinkProps, {}> {
|
|
|
65
67
|
this.foundation.handleUpdateLink(href, prevHref);
|
|
66
68
|
}
|
|
67
69
|
|
|
70
|
+
handleClick(e: React.KeyboardEvent | React.MouseEvent) {
|
|
71
|
+
const { disabled, href } = this.props;
|
|
72
|
+
const { onClick } = this.context;
|
|
73
|
+
!disabled && onClick(e as any, href);
|
|
74
|
+
}
|
|
75
|
+
|
|
68
76
|
componentDidMount() {
|
|
69
77
|
this.handleAddLink();
|
|
70
78
|
}
|
|
@@ -115,18 +123,35 @@ export default class Link extends BaseComponent<LinkProps, {}> {
|
|
|
115
123
|
};
|
|
116
124
|
|
|
117
125
|
render() {
|
|
118
|
-
const { href, className, style, disabled = false } = this.props;
|
|
119
|
-
const { activeLink,
|
|
126
|
+
const { href, className, style, disabled = false, title } = this.props;
|
|
127
|
+
const { activeLink, showTooltip } = this.context;
|
|
120
128
|
const active = activeLink === href;
|
|
121
129
|
const linkCls = cls(`${prefixCls}-link`, className);
|
|
122
130
|
const linkTitleCls = cls(`${prefixCls}-link-title`, {
|
|
123
131
|
[`${prefixCls}-link-title-active`]: active,
|
|
124
132
|
[`${prefixCls}-link-title-disabled`]: disabled,
|
|
125
133
|
});
|
|
134
|
+
const ariaProps = {
|
|
135
|
+
'aria-disabled': disabled,
|
|
136
|
+
'aria-label': href,
|
|
137
|
+
};
|
|
138
|
+
if (active) {
|
|
139
|
+
ariaProps['aria-details'] = 'active';
|
|
140
|
+
}
|
|
141
|
+
if (!showTooltip && typeof title === 'string') {
|
|
142
|
+
ariaProps['title'] = title;
|
|
143
|
+
}
|
|
126
144
|
|
|
127
145
|
return (
|
|
128
146
|
<div className={linkCls} style={style}>
|
|
129
|
-
<div
|
|
147
|
+
<div
|
|
148
|
+
role="link"
|
|
149
|
+
tabIndex={0}
|
|
150
|
+
{...ariaProps}
|
|
151
|
+
className={linkTitleCls}
|
|
152
|
+
onClick={e => this.handleClick(e)}
|
|
153
|
+
onKeyPress={e => this.handleClick(e)}
|
|
154
|
+
>
|
|
130
155
|
{this.renderTitle()}
|
|
131
156
|
</div>
|
|
132
157
|
{this.renderChildren()}
|
package/autoComplete/index.tsx
CHANGED
|
@@ -39,6 +39,12 @@ export interface BaseDataItem extends DataItem {
|
|
|
39
39
|
export type AutoCompleteItems = BaseDataItem | string | number;
|
|
40
40
|
|
|
41
41
|
export interface AutoCompleteProps<T extends AutoCompleteItems> {
|
|
42
|
+
'aria-describedby'?: React.AriaAttributes['aria-describedby'];
|
|
43
|
+
'aria-errormessage'?: React.AriaAttributes['aria-errormessage'];
|
|
44
|
+
'aria-invalid'?: React.AriaAttributes['aria-invalid'];
|
|
45
|
+
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
46
|
+
'aria-labelledby'?: React.AriaAttributes['aria-labelledby'];
|
|
47
|
+
'aria-required'?: React.AriaAttributes['aria-required'];
|
|
42
48
|
autoAdjustOverflow?: boolean;
|
|
43
49
|
autoFocus?: boolean;
|
|
44
50
|
className?: string;
|
|
@@ -54,6 +60,8 @@ export interface AutoCompleteProps<T extends AutoCompleteItems> {
|
|
|
54
60
|
emptyContent?: React.ReactNode | null;
|
|
55
61
|
getPopupContainer?: () => HTMLElement;
|
|
56
62
|
insetLabel?: React.ReactNode;
|
|
63
|
+
insetLabelId?: string;
|
|
64
|
+
id?: string;
|
|
57
65
|
loading?: boolean;
|
|
58
66
|
motion?: Motion;
|
|
59
67
|
maxHeight?: string | number;
|
|
@@ -101,6 +109,12 @@ interface AutoCompleteState {
|
|
|
101
109
|
|
|
102
110
|
class AutoComplete<T extends AutoCompleteItems> extends BaseComponent<AutoCompleteProps<T>, AutoCompleteState> {
|
|
103
111
|
static propTypes = {
|
|
112
|
+
'aria-label': PropTypes.string,
|
|
113
|
+
'aria-labelledby': PropTypes.string,
|
|
114
|
+
'aria-invalid': PropTypes.bool,
|
|
115
|
+
'aria-errormessage': PropTypes.string,
|
|
116
|
+
'aria-describedby': PropTypes.string,
|
|
117
|
+
'aria-required': PropTypes.bool,
|
|
104
118
|
autoFocus: PropTypes.bool,
|
|
105
119
|
autoAdjustOverflow: PropTypes.bool,
|
|
106
120
|
className: PropTypes.string,
|
|
@@ -114,6 +128,9 @@ class AutoComplete<T extends AutoCompleteItems> extends BaseComponent<AutoComple
|
|
|
114
128
|
dropdownClassName: PropTypes.string,
|
|
115
129
|
dropdownStyle: PropTypes.object,
|
|
116
130
|
emptyContent: PropTypes.node,
|
|
131
|
+
id: PropTypes.string,
|
|
132
|
+
insetLabel: PropTypes.node,
|
|
133
|
+
insetLabelId: PropTypes.string,
|
|
117
134
|
onSearch: PropTypes.func,
|
|
118
135
|
onSelect: PropTypes.func,
|
|
119
136
|
onClear: PropTypes.func,
|
|
@@ -313,6 +330,7 @@ class AutoComplete<T extends AutoCompleteItems> extends BaseComponent<AutoComple
|
|
|
313
330
|
size,
|
|
314
331
|
prefix,
|
|
315
332
|
insetLabel,
|
|
333
|
+
insetLabelId,
|
|
316
334
|
suffix,
|
|
317
335
|
placeholder,
|
|
318
336
|
style,
|
|
@@ -322,7 +340,8 @@ class AutoComplete<T extends AutoCompleteItems> extends BaseComponent<AutoComple
|
|
|
322
340
|
triggerRender,
|
|
323
341
|
validateStatus,
|
|
324
342
|
autoFocus,
|
|
325
|
-
value
|
|
343
|
+
value,
|
|
344
|
+
id,
|
|
326
345
|
} = this.props;
|
|
327
346
|
const { inputValue, keyboardEventSet, selection } = this.state;
|
|
328
347
|
|
|
@@ -341,6 +360,7 @@ class AutoComplete<T extends AutoCompleteItems> extends BaseComponent<AutoComple
|
|
|
341
360
|
),
|
|
342
361
|
onClick: this.handleInputClick,
|
|
343
362
|
ref: this.triggerRef,
|
|
363
|
+
id,
|
|
344
364
|
...keyboardEventSet,
|
|
345
365
|
};
|
|
346
366
|
|
|
@@ -350,9 +370,16 @@ class AutoComplete<T extends AutoCompleteItems> extends BaseComponent<AutoComple
|
|
|
350
370
|
autofocus: autoFocus,
|
|
351
371
|
onChange: this.onSearch,
|
|
352
372
|
onClear: this.onInputClear,
|
|
373
|
+
'aria-label': this.props['aria-label'],
|
|
374
|
+
'aria-labelledby': this.props['aria-labelledby'],
|
|
375
|
+
'aria-invalid': this.props['aria-invalid'],
|
|
376
|
+
'aria-errormessage': this.props['aria-errormessage'],
|
|
377
|
+
'aria-describedby': this.props['aria-describedby'],
|
|
378
|
+
'aria-required': this.props['aria-required'],
|
|
353
379
|
// TODO: remove in next major version
|
|
354
380
|
suffix,
|
|
355
381
|
prefix: prefix || insetLabel,
|
|
382
|
+
insetLabelId,
|
|
356
383
|
showClear,
|
|
357
384
|
validateStatus,
|
|
358
385
|
size,
|
|
@@ -11,7 +11,7 @@ export const Basic = () => (
|
|
|
11
11
|
<div>
|
|
12
12
|
<div>
|
|
13
13
|
<Avatar>U</Avatar>
|
|
14
|
-
<Avatar size="large">U</Avatar>
|
|
14
|
+
<Avatar autoFocus size="large" onClick={() => console.log('ok')}>U</Avatar>
|
|
15
15
|
<Avatar size="extra-small">U</Avatar>
|
|
16
16
|
<Avatar size="small">U</Avatar>
|
|
17
17
|
<Avatar size="default">U</Avatar>
|
|
@@ -45,9 +45,9 @@ export const CustomAvatar = () => (
|
|
|
45
45
|
<Avatar color="red" size="default">
|
|
46
46
|
DF
|
|
47
47
|
</Avatar>
|
|
48
|
-
<Avatar src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" />
|
|
49
|
-
<Avatar size="default" src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" />
|
|
50
|
-
<Avatar size="small" src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" />
|
|
48
|
+
<Avatar src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" alt="a man" />
|
|
49
|
+
<Avatar size="default" src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" alt="a man" />
|
|
50
|
+
<Avatar size="small" src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" alt="a man" />
|
|
51
51
|
<Avatar style={{ color: '#f56a00', backgroundColor: '#fde3cf' }}>U</Avatar>
|
|
52
52
|
<Avatar style={{ backgroundColor: '#87d068' }}>YZ</Avatar>
|
|
53
53
|
</div>
|
package/avatar/index.tsx
CHANGED
|
@@ -47,6 +47,7 @@ export default class Avatar extends BaseComponent<AvatarProps, AvatarState> {
|
|
|
47
47
|
onMouseLeave: PropTypes.func,
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
+
foundation!: AvatarFoundation;
|
|
50
51
|
constructor(props: AvatarProps) {
|
|
51
52
|
super(props);
|
|
52
53
|
this.state = {
|
|
@@ -106,12 +107,12 @@ export default class Avatar extends BaseComponent<AvatarProps, AvatarState> {
|
|
|
106
107
|
this.foundation.destroy();
|
|
107
108
|
}
|
|
108
109
|
|
|
109
|
-
onEnter() {
|
|
110
|
-
this.foundation.handleEnter();
|
|
110
|
+
onEnter(e: React.MouseEvent) {
|
|
111
|
+
this.foundation.handleEnter(e);
|
|
111
112
|
}
|
|
112
113
|
|
|
113
|
-
onLeave() {
|
|
114
|
-
this.foundation.handleLeave();
|
|
114
|
+
onLeave(e: React.MouseEvent) {
|
|
115
|
+
this.foundation.handleLeave(e);
|
|
115
116
|
}
|
|
116
117
|
|
|
117
118
|
handleError() {
|
|
@@ -147,6 +148,7 @@ export default class Avatar extends BaseComponent<AvatarProps, AvatarState> {
|
|
|
147
148
|
);
|
|
148
149
|
}
|
|
149
150
|
return (
|
|
151
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions,jsx-a11y/click-events-have-key-events
|
|
150
152
|
<span
|
|
151
153
|
{...(others as any)}
|
|
152
154
|
style={style}
|
package/banner/index.tsx
CHANGED
|
@@ -112,6 +112,7 @@ export default class Banner extends BaseComponent<BannerProps, BannerState> {
|
|
|
112
112
|
theme="borderless"
|
|
113
113
|
size="small"
|
|
114
114
|
type="tertiary"
|
|
115
|
+
aria-label='Close'
|
|
115
116
|
/>
|
|
116
117
|
);
|
|
117
118
|
return closer;
|
|
@@ -153,7 +154,7 @@ export default class Banner extends BaseComponent<BannerProps, BannerState> {
|
|
|
153
154
|
[`${prefixCls}-bordered`]: !fullMode && bordered,
|
|
154
155
|
});
|
|
155
156
|
const banner = visible ? (
|
|
156
|
-
<div className={wrapper} style={style}>
|
|
157
|
+
<div className={wrapper} style={style} role="alert">
|
|
157
158
|
<div className={`${prefixCls}-content-wrapper`}>
|
|
158
159
|
<div className={`${prefixCls}-content`}>
|
|
159
160
|
{this.renderIcon()}
|
|
@@ -25,9 +25,11 @@ export const Default = () => (
|
|
|
25
25
|
'breadcrumb',
|
|
26
26
|
'default',
|
|
27
27
|
]}
|
|
28
|
+
aria-label='example-1'
|
|
28
29
|
onClick={item => console.log(item)}
|
|
29
30
|
/>
|
|
30
31
|
<Breadcrumb
|
|
32
|
+
aria-label='example-2'
|
|
31
33
|
routes={[
|
|
32
34
|
{
|
|
33
35
|
path: '/home',
|
|
@@ -44,6 +46,7 @@ export const Default = () => (
|
|
|
44
46
|
onClick={item => console.log(item)}
|
|
45
47
|
/>
|
|
46
48
|
<Breadcrumb
|
|
49
|
+
aria-label='example-3'
|
|
47
50
|
routes={[
|
|
48
51
|
{
|
|
49
52
|
path: '/home',
|
|
@@ -57,6 +60,7 @@ export const Default = () => (
|
|
|
57
60
|
separator={'>'}
|
|
58
61
|
/>
|
|
59
62
|
<Breadcrumb
|
|
63
|
+
aria-label='example-4'
|
|
60
64
|
routes={[
|
|
61
65
|
{
|
|
62
66
|
path: '/home',
|
|
@@ -70,10 +74,12 @@ export const Default = () => (
|
|
|
70
74
|
separator={<IconArrowRight size={'small'} />}
|
|
71
75
|
/>
|
|
72
76
|
<Breadcrumb
|
|
77
|
+
aria-label='example-5'
|
|
73
78
|
routes={['首页', '当这个页面标题很长时需要省略', '详情页']}
|
|
74
79
|
onClick={item => console.log(item)}
|
|
75
80
|
/>
|
|
76
81
|
<Breadcrumb
|
|
82
|
+
aria-label='example-6'
|
|
77
83
|
routes={[
|
|
78
84
|
'首页',
|
|
79
85
|
'当层级很多的时候',
|
|
@@ -91,6 +97,7 @@ export const Default = () => (
|
|
|
91
97
|
export const Compact = () => (
|
|
92
98
|
<div>
|
|
93
99
|
<Breadcrumb
|
|
100
|
+
aria-label='example-1'
|
|
94
101
|
routes={[
|
|
95
102
|
{
|
|
96
103
|
path: '/home',
|
|
@@ -103,6 +110,7 @@ export const Compact = () => (
|
|
|
103
110
|
compact={true}
|
|
104
111
|
/>
|
|
105
112
|
<Breadcrumb
|
|
113
|
+
aria-label='example-2'
|
|
106
114
|
routes={[
|
|
107
115
|
{
|
|
108
116
|
path: '/home',
|
|
@@ -119,6 +127,7 @@ export const Compact = () => (
|
|
|
119
127
|
compact={true}
|
|
120
128
|
/>
|
|
121
129
|
<Breadcrumb
|
|
130
|
+
aria-label='example-3'
|
|
122
131
|
routes={[
|
|
123
132
|
{
|
|
124
133
|
path: '/home',
|
|
@@ -133,6 +142,7 @@ export const Compact = () => (
|
|
|
133
142
|
compact={true}
|
|
134
143
|
/>
|
|
135
144
|
<Breadcrumb
|
|
145
|
+
aria-label='example-4'
|
|
136
146
|
routes={[
|
|
137
147
|
{
|
|
138
148
|
path: '/home',
|
|
@@ -147,11 +157,13 @@ export const Compact = () => (
|
|
|
147
157
|
compact={true}
|
|
148
158
|
/>
|
|
149
159
|
<Breadcrumb
|
|
160
|
+
aria-label='example-5'
|
|
150
161
|
routes={['首页', '当这个页面标题很长时需要省略', '详情页']}
|
|
151
162
|
onClick={item => console.log(item)}
|
|
152
163
|
compact={true}
|
|
153
164
|
/>
|
|
154
165
|
<Breadcrumb
|
|
166
|
+
aria-label='example-6'
|
|
155
167
|
routes={[
|
|
156
168
|
'首页',
|
|
157
169
|
'当层级很多的时候',
|
|
@@ -169,32 +181,32 @@ export const Compact = () => (
|
|
|
169
181
|
|
|
170
182
|
export const BreadcrumbItemJSX = () => (
|
|
171
183
|
<div>
|
|
172
|
-
<Breadcrumb onClick={item => console.log(item)}>
|
|
184
|
+
<Breadcrumb aria-label='example-1' onClick={item => console.log(item)}>
|
|
173
185
|
<Breadcrumb.Item onClick={item => console.log('child', item)}>home</Breadcrumb.Item>
|
|
174
186
|
<Breadcrumb.Item href="#">breadcrumb</Breadcrumb.Item>
|
|
175
187
|
<Breadcrumb.Item>default</Breadcrumb.Item>
|
|
176
188
|
</Breadcrumb>
|
|
177
|
-
<Breadcrumb onClick={item => console.log(item)}>
|
|
189
|
+
<Breadcrumb aria-label='example-2' onClick={item => console.log(item)}>
|
|
178
190
|
<Breadcrumb.Item icon={<IconHome />}></Breadcrumb.Item>
|
|
179
191
|
<Breadcrumb.Item>breadcrumb</Breadcrumb.Item>
|
|
180
192
|
<Breadcrumb.Item>default</Breadcrumb.Item>
|
|
181
193
|
</Breadcrumb>
|
|
182
|
-
<Breadcrumb separator={'>'} onClick={item => console.log(item)}>
|
|
194
|
+
<Breadcrumb aria-label='example-3' separator={'>'} onClick={item => console.log(item)}>
|
|
183
195
|
<Breadcrumb.Item>home</Breadcrumb.Item>
|
|
184
196
|
<Breadcrumb.Item href="#">breadcrumb</Breadcrumb.Item>
|
|
185
197
|
<Breadcrumb.Item>separator</Breadcrumb.Item>
|
|
186
198
|
</Breadcrumb>
|
|
187
|
-
<Breadcrumb compact={true} onClick={item => console.log(item)}>
|
|
199
|
+
<Breadcrumb aria-label='example-4' compact={true} onClick={item => console.log(item)}>
|
|
188
200
|
<Breadcrumb.Item>home</Breadcrumb.Item>
|
|
189
201
|
<Breadcrumb.Item>breadcrumb</Breadcrumb.Item>
|
|
190
202
|
<Breadcrumb.Item>compact</Breadcrumb.Item>
|
|
191
203
|
</Breadcrumb>
|
|
192
|
-
<Breadcrumb onClick={item => console.log(item)}>
|
|
204
|
+
<Breadcrumb aria-label='example-5' onClick={item => console.log(item)}>
|
|
193
205
|
<Breadcrumb.Item>首页</Breadcrumb.Item>
|
|
194
206
|
<Breadcrumb.Item>当这个页面标题很长时需要省略</Breadcrumb.Item>
|
|
195
207
|
<Breadcrumb.Item>详情页</Breadcrumb.Item>
|
|
196
208
|
</Breadcrumb>
|
|
197
|
-
<Breadcrumb onClick={item => console.log(item)}>
|
|
209
|
+
<Breadcrumb aria-label='example-6' onClick={item => console.log(item)}>
|
|
198
210
|
<Breadcrumb.Item>首页</Breadcrumb.Item>
|
|
199
211
|
<Breadcrumb.Item>当层级很多的时候</Breadcrumb.Item>
|
|
200
212
|
<Breadcrumb.Item>又一层很长需要省略的时候</Breadcrumb.Item>
|
|
@@ -209,14 +221,14 @@ export const BreadcrumbItemJSX = () => (
|
|
|
209
221
|
|
|
210
222
|
export const Test = () => (
|
|
211
223
|
<div>
|
|
212
|
-
<Breadcrumb onClick={item => console.log(item)}>
|
|
224
|
+
<Breadcrumb aria-label='example-1' onClick={item => console.log(item)}>
|
|
213
225
|
<Breadcrumb.Item onClick={item => console.log('child', item)}>home jump</Breadcrumb.Item>
|
|
214
226
|
<Breadcrumb.Item href="#">breadcrumb</Breadcrumb.Item>
|
|
215
227
|
<Breadcrumb.Item>
|
|
216
228
|
<h1>default</h1>
|
|
217
229
|
</Breadcrumb.Item>
|
|
218
230
|
</Breadcrumb>
|
|
219
|
-
<Breadcrumb>
|
|
231
|
+
<Breadcrumb aria-label='example-2'>
|
|
220
232
|
<Breadcrumb.Item icon={<IconHome />}></Breadcrumb.Item>
|
|
221
233
|
<Breadcrumb.Item icon={<IconArticle />}>
|
|
222
234
|
<h5>breadcrumb</h5>
|
|
@@ -268,6 +280,7 @@ export const RenderMore = () => (
|
|
|
268
280
|
}}
|
|
269
281
|
>
|
|
270
282
|
<Breadcrumb
|
|
283
|
+
aria-label='example-1'
|
|
271
284
|
renderMore={restItem => renderMore(restItem)}
|
|
272
285
|
onClick={(item, e) => console.log(item, e)}
|
|
273
286
|
>
|
|
@@ -283,6 +296,7 @@ export const RenderMore = () => (
|
|
|
283
296
|
<br />
|
|
284
297
|
<div>
|
|
285
298
|
<Breadcrumb
|
|
299
|
+
aria-label='example-2'
|
|
286
300
|
renderMore={restItem => renderMore(restItem)}
|
|
287
301
|
onClick={(item, e) => console.log(item, e)}
|
|
288
302
|
routes={[
|
package/breadcrumb/index.tsx
CHANGED
|
@@ -41,6 +41,7 @@ export interface BreadcrumbProps extends BaseProps {
|
|
|
41
41
|
renderMore?: (restItem: Array<React.ReactNode>) => React.ReactNode;
|
|
42
42
|
/* Style type for ellipsis area */
|
|
43
43
|
moreType?: MoreType;
|
|
44
|
+
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
interface BreadcrumbState {
|
|
@@ -77,6 +78,7 @@ class Breadcrumb extends BaseComponent<BreadcrumbProps, BreadcrumbState> {
|
|
|
77
78
|
|
|
78
79
|
/* Type of ellipsis area */
|
|
79
80
|
moreType: propTypes.oneOf(strings.MORE_TYPE),
|
|
81
|
+
'aria-label': propTypes.string,
|
|
80
82
|
};
|
|
81
83
|
static defaultProps = {
|
|
82
84
|
routes: [] as [],
|
|
@@ -91,6 +93,7 @@ class Breadcrumb extends BaseComponent<BreadcrumbProps, BreadcrumbState> {
|
|
|
91
93
|
autoCollapse: true,
|
|
92
94
|
moreType: 'default',
|
|
93
95
|
maxItemCount: 4,
|
|
96
|
+
'aria-label': 'Breadcrumb'
|
|
94
97
|
};
|
|
95
98
|
|
|
96
99
|
constructor(props: BreadcrumbProps) {
|
|
@@ -164,8 +167,12 @@ class Breadcrumb extends BaseComponent<BreadcrumbProps, BreadcrumbState> {
|
|
|
164
167
|
<span className={`${clsPrefix}-collapse`} key={`more-${itemsLen}`}>
|
|
165
168
|
<span className={`${clsPrefix}-item-wrap`}>
|
|
166
169
|
<span
|
|
170
|
+
role='button'
|
|
171
|
+
tabIndex={0}
|
|
172
|
+
aria-label='Expand breadcrumb items'
|
|
167
173
|
className={`${clsPrefix}-item ${clsPrefix}-item-more`}
|
|
168
174
|
onClick={item => this.foundation.handleExpand(item)}
|
|
175
|
+
onKeyPress={e => this.foundation.handleExpandEnterPress(e)}
|
|
169
176
|
>
|
|
170
177
|
{hasRenderMore && renderMore(restItem)}
|
|
171
178
|
{!hasRenderMore && moreType === 'default' && <IconMore />}
|
|
@@ -282,7 +289,7 @@ class Breadcrumb extends BaseComponent<BreadcrumbProps, BreadcrumbState> {
|
|
|
282
289
|
separator,
|
|
283
290
|
}}
|
|
284
291
|
>
|
|
285
|
-
<nav aria-label={
|
|
292
|
+
<nav aria-label={this.props['aria-label']} className={sizeCls} style={style}>
|
|
286
293
|
{breadcrumbs}
|
|
287
294
|
</nav>
|
|
288
295
|
</BreadContext.Provider>
|
package/breadcrumb/item.tsx
CHANGED
|
@@ -188,7 +188,7 @@ export default class BreadcrumbItem extends BaseComponent<BreadcrumbItemProps, B
|
|
|
188
188
|
shouldRenderSeparator
|
|
189
189
|
// children,
|
|
190
190
|
} = this.props;
|
|
191
|
-
const pageLabel = active ? {
|
|
191
|
+
const pageLabel = active ? { 'aria-current': 'page' as const } : {} ;
|
|
192
192
|
const item = this.renderItem();
|
|
193
193
|
const separator = !active ?
|
|
194
194
|
this.props.separator || <span className={`${clsPrefix}-separator`}>{this.context.separator}</span> :
|
package/button/Button.tsx
CHANGED
|
@@ -33,6 +33,7 @@ export interface ButtonProps {
|
|
|
33
33
|
onMouseDown?: React.MouseEventHandler<HTMLButtonElement>;
|
|
34
34
|
onMouseEnter?: React.MouseEventHandler<HTMLButtonElement>;
|
|
35
35
|
onMouseLeave?: React.MouseEventHandler<HTMLButtonElement>;
|
|
36
|
+
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
// TODO: icon configuration
|
|
@@ -68,6 +69,7 @@ export default class Button extends PureComponent<ButtonProps> {
|
|
|
68
69
|
className: PropTypes.string,
|
|
69
70
|
onMouseEnter: PropTypes.func,
|
|
70
71
|
onMouseLeave: PropTypes.func,
|
|
72
|
+
'aria-label': PropTypes.string,
|
|
71
73
|
};
|
|
72
74
|
|
|
73
75
|
render() {
|
|
@@ -107,6 +109,7 @@ export default class Button extends PureComponent<ButtonProps> {
|
|
|
107
109
|
className
|
|
108
110
|
),
|
|
109
111
|
type: htmlType,
|
|
112
|
+
'aria-disabled': disabled,
|
|
110
113
|
};
|
|
111
114
|
|
|
112
115
|
return (
|
|
@@ -117,6 +120,7 @@ export default class Button extends PureComponent<ButtonProps> {
|
|
|
117
120
|
onMouseDown={this.props.onMouseDown}
|
|
118
121
|
style={style}
|
|
119
122
|
>
|
|
123
|
+
{/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */}
|
|
120
124
|
<span className={`${prefixCls}-content`} onClick={e => disabled && e.stopPropagation()}>
|
|
121
125
|
{children}
|
|
122
126
|
</span>
|
|
@@ -29,7 +29,7 @@ describe('Button', () => {
|
|
|
29
29
|
|
|
30
30
|
it(`test loading`, () => {
|
|
31
31
|
const elem = mount(<Button icon={<IconEdit />} loading />);
|
|
32
|
-
expect(elem.find(
|
|
32
|
+
expect(elem.find({ 'data-icon': 'spin' }).length).toBe(1);
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
it('test button type',()=>{
|