@douyinfe/semi-ui 2.2.0-beta.1 → 2.3.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/_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/avatarGroup.tsx +1 -1
- package/avatar/index.tsx +10 -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 +21 -14
- package/checkbox/checkbox.tsx +40 -5
- package/checkbox/checkboxGroup.tsx +30 -5
- package/checkbox/checkboxInner.tsx +25 -2
- package/collapse/index.tsx +2 -2
- package/collapse/item.tsx +15 -8
- 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 +2785 -1508
- 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 +5 -5
- 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/avatarGroup.js +2 -1
- package/lib/cjs/avatar/index.d.ts +4 -3
- package/lib/cjs/avatar/index.js +20 -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/index.js +2 -1
- package/lib/cjs/collapse/item.d.ts +2 -1
- package/lib/cjs/collapse/item.js +17 -3
- 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/empty/index.js +2 -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 +12 -5
- 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 +2 -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 +3 -8
- 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 +23 -4
- 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/avatarGroup.js +2 -1
- package/lib/es/avatar/index.d.ts +4 -3
- package/lib/es/avatar/index.js +20 -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/index.js +2 -1
- package/lib/es/collapse/item.d.ts +2 -1
- package/lib/es/collapse/item.js +16 -3
- 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/empty/index.js +2 -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 +12 -5
- 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 +2 -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 +1 -6
- 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 +23 -4
- 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 +13 -9
- 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 +3 -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 +1 -2
- 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 +50 -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 +13 -15
- package/upload/index.tsx +10 -6
|
@@ -10,6 +10,7 @@ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance
|
|
|
10
10
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
11
11
|
import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
|
|
12
12
|
import _Set from "@babel/runtime-corejs3/core-js-stable/set";
|
|
13
|
+
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
13
14
|
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
14
15
|
import React, { Fragment } from 'react';
|
|
15
16
|
import ReactDOM from 'react-dom';
|
|
@@ -44,6 +45,8 @@ const key = 0;
|
|
|
44
45
|
|
|
45
46
|
class TreeSelect extends BaseComponent {
|
|
46
47
|
constructor(props) {
|
|
48
|
+
var _context2;
|
|
49
|
+
|
|
47
50
|
super(props);
|
|
48
51
|
|
|
49
52
|
this.renderSuffix = () => {
|
|
@@ -63,7 +66,8 @@ class TreeSelect extends BaseComponent {
|
|
|
63
66
|
this.renderPrefix = () => {
|
|
64
67
|
const {
|
|
65
68
|
prefix,
|
|
66
|
-
insetLabel
|
|
69
|
+
insetLabel,
|
|
70
|
+
insetLabelId
|
|
67
71
|
} = this.props;
|
|
68
72
|
const labelNode = prefix || insetLabel;
|
|
69
73
|
const prefixWrapperCls = cls({
|
|
@@ -74,7 +78,8 @@ class TreeSelect extends BaseComponent {
|
|
|
74
78
|
["".concat(prefixcls, "-prefix-icon")]: isSemiIcon(labelNode)
|
|
75
79
|
});
|
|
76
80
|
return /*#__PURE__*/React.createElement("div", {
|
|
77
|
-
className: prefixWrapperCls
|
|
81
|
+
className: prefixWrapperCls,
|
|
82
|
+
id: insetLabelId
|
|
78
83
|
}, labelNode);
|
|
79
84
|
};
|
|
80
85
|
|
|
@@ -94,7 +99,6 @@ class TreeSelect extends BaseComponent {
|
|
|
94
99
|
const popoverCls = cls(dropdownClassName, "".concat(prefixcls, "-popover"));
|
|
95
100
|
return /*#__PURE__*/React.createElement("div", {
|
|
96
101
|
className: popoverCls,
|
|
97
|
-
role: "list-box",
|
|
98
102
|
style: style
|
|
99
103
|
}, this.renderTree());
|
|
100
104
|
};
|
|
@@ -107,6 +111,10 @@ class TreeSelect extends BaseComponent {
|
|
|
107
111
|
this.foundation.handleClick(e);
|
|
108
112
|
};
|
|
109
113
|
|
|
114
|
+
this.handleSelectionEnterPress = e => {
|
|
115
|
+
this.foundation.handleSelectionEnterPress(e);
|
|
116
|
+
};
|
|
117
|
+
|
|
110
118
|
this.showClearBtn = () => {
|
|
111
119
|
const {
|
|
112
120
|
searchPosition
|
|
@@ -275,6 +283,11 @@ class TreeSelect extends BaseComponent {
|
|
|
275
283
|
this.foundation.handleClear(e);
|
|
276
284
|
};
|
|
277
285
|
|
|
286
|
+
this.handleClearEnterPress = e => {
|
|
287
|
+
e && e.stopPropagation();
|
|
288
|
+
this.foundation.handleClearEnterPress(e);
|
|
289
|
+
};
|
|
290
|
+
|
|
278
291
|
this.handleMouseOver = e => {
|
|
279
292
|
this.foundation.toggleHoverState(true);
|
|
280
293
|
};
|
|
@@ -312,8 +325,12 @@ class TreeSelect extends BaseComponent {
|
|
|
312
325
|
|
|
313
326
|
if (showClearBtn) {
|
|
314
327
|
return /*#__PURE__*/React.createElement("div", {
|
|
328
|
+
role: 'button',
|
|
329
|
+
tabIndex: 0,
|
|
330
|
+
"aria-label": "Clear TreeSelect value",
|
|
315
331
|
className: clearCls,
|
|
316
|
-
onClick: this.handleClear
|
|
332
|
+
onClick: this.handleClear,
|
|
333
|
+
onKeyPress: this.handleClearEnterPress
|
|
317
334
|
}, /*#__PURE__*/React.createElement(IconClear, null));
|
|
318
335
|
}
|
|
319
336
|
|
|
@@ -397,11 +414,29 @@ class TreeSelect extends BaseComponent {
|
|
|
397
414
|
}, showClear || isTriggerPositionSearch && inputValue ? this.renderClearBtn() : null), /*#__PURE__*/React.createElement(Fragment, {
|
|
398
415
|
key: 'arrow'
|
|
399
416
|
}, this.renderArrow())];
|
|
417
|
+
const tabIndex = disabled ? null : 0;
|
|
418
|
+
/**
|
|
419
|
+
* Reasons for disabling the a11y eslint rule:
|
|
420
|
+
* The following attributes(aria-controls,aria-expanded) will be automatically added by Tooltip, no need to declare here
|
|
421
|
+
*/
|
|
422
|
+
|
|
400
423
|
return /*#__PURE__*/React.createElement("div", _Object$assign({
|
|
424
|
+
// eslint-disable-next-line jsx-a11y/role-has-required-aria-props
|
|
425
|
+
role: 'combobox',
|
|
426
|
+
"aria-disabled": disabled,
|
|
427
|
+
"aria-haspopup": "tree",
|
|
428
|
+
tabIndex: tabIndex,
|
|
401
429
|
className: classNames,
|
|
402
430
|
style: style,
|
|
403
431
|
ref: this.triggerRef,
|
|
404
|
-
onClick: this.handleClick
|
|
432
|
+
onClick: this.handleClick,
|
|
433
|
+
onKeyPress: this.handleSelectionEnterPress,
|
|
434
|
+
"aria-invalid": this.props['aria-invalid'],
|
|
435
|
+
"aria-errormessage": this.props['aria-errormessage'],
|
|
436
|
+
"aria-label": this.props['aria-label'],
|
|
437
|
+
"aria-labelledby": this.props['aria-labelledby'],
|
|
438
|
+
"aria-describedby": this.props['aria-describedby'],
|
|
439
|
+
"aria-required": this.props['aria-required']
|
|
405
440
|
}, mouseEvent), inner);
|
|
406
441
|
}; // eslint-disable-next-line @typescript-eslint/no-shadow
|
|
407
442
|
|
|
@@ -478,7 +513,8 @@ class TreeSelect extends BaseComponent {
|
|
|
478
513
|
disabled,
|
|
479
514
|
size,
|
|
480
515
|
searchAutoFocus,
|
|
481
|
-
placeholder
|
|
516
|
+
placeholder,
|
|
517
|
+
maxTagCount
|
|
482
518
|
} = this.props;
|
|
483
519
|
const {
|
|
484
520
|
keyEntities,
|
|
@@ -487,6 +523,7 @@ class TreeSelect extends BaseComponent {
|
|
|
487
523
|
} = this.state;
|
|
488
524
|
const keyList = normalizeKeyList(checkedKeys, keyEntities, leafOnly);
|
|
489
525
|
return /*#__PURE__*/React.createElement(TagInput, {
|
|
526
|
+
maxTagCount: maxTagCount,
|
|
490
527
|
disabled: disabled,
|
|
491
528
|
onInputChange: v => this.search(v),
|
|
492
529
|
ref: this.tagInputRef,
|
|
@@ -558,6 +595,7 @@ class TreeSelect extends BaseComponent {
|
|
|
558
595
|
}
|
|
559
596
|
|
|
560
597
|
return /*#__PURE__*/React.createElement(Input, _Object$assign({
|
|
598
|
+
"aria-label": 'Filter TreeSelect item',
|
|
561
599
|
ref: this.inputRef,
|
|
562
600
|
autofocus: searchAutoFocus,
|
|
563
601
|
placeholder: placeholder
|
|
@@ -786,11 +824,11 @@ class TreeSelect extends BaseComponent {
|
|
|
786
824
|
labelEllipsis: typeof labelEllipsis === 'undefined' ? virtualize : labelEllipsis
|
|
787
825
|
}
|
|
788
826
|
}, /*#__PURE__*/React.createElement("div", {
|
|
789
|
-
className: wrapperCls
|
|
790
|
-
role: "list-box"
|
|
827
|
+
className: wrapperCls
|
|
791
828
|
}, outerTopSlot, !outerTopSlot && filterTreeNode && isDropdownPositionSearch && this.renderInput(), /*#__PURE__*/React.createElement("div", {
|
|
792
829
|
className: listCls,
|
|
793
830
|
role: "tree",
|
|
831
|
+
"aria-multiselectable": multiple ? true : false,
|
|
794
832
|
style: optionListStyle
|
|
795
833
|
}, noData ? this.renderEmpty() : this.renderNodeList()), outerBottomSlot));
|
|
796
834
|
};
|
|
@@ -827,6 +865,7 @@ class TreeSelect extends BaseComponent {
|
|
|
827
865
|
this.optionsRef = /*#__PURE__*/React.createRef();
|
|
828
866
|
this.clickOutsideHandler = null;
|
|
829
867
|
this.foundation = new TreeSelectFoundation(this.adapter);
|
|
868
|
+
this.treeSelectID = _sliceInstanceProperty(_context2 = Math.random().toString(36)).call(_context2, 2);
|
|
830
869
|
} // eslint-disable-next-line max-lines-per-function
|
|
831
870
|
|
|
832
871
|
|
|
@@ -1127,6 +1166,11 @@ class TreeSelect extends BaseComponent {
|
|
|
1127
1166
|
|
|
1128
1167
|
TreeSelect.contextType = ConfigContext;
|
|
1129
1168
|
TreeSelect.propTypes = {
|
|
1169
|
+
'aria-describedby': PropTypes.string,
|
|
1170
|
+
'aria-errormessage': PropTypes.string,
|
|
1171
|
+
'aria-invalid': PropTypes.bool,
|
|
1172
|
+
'aria-labelledby': PropTypes.string,
|
|
1173
|
+
'aria-required': PropTypes.bool,
|
|
1130
1174
|
loadedKeys: PropTypes.arrayOf(PropTypes.string),
|
|
1131
1175
|
loadData: PropTypes.func,
|
|
1132
1176
|
onLoad: PropTypes.func,
|
|
@@ -1179,6 +1223,7 @@ TreeSelect.propTypes = {
|
|
|
1179
1223
|
suffix: PropTypes.node,
|
|
1180
1224
|
prefix: PropTypes.node,
|
|
1181
1225
|
insetLabel: PropTypes.node,
|
|
1226
|
+
insetLabelId: PropTypes.string,
|
|
1182
1227
|
zIndex: PropTypes.number,
|
|
1183
1228
|
getPopupContainer: PropTypes.func,
|
|
1184
1229
|
dropdownMatchSelectWidth: PropTypes.bool,
|
|
@@ -1198,7 +1243,8 @@ TreeSelect.propTypes = {
|
|
|
1198
1243
|
labelEllipsis: PropTypes.bool,
|
|
1199
1244
|
optionListStyle: PropTypes.object,
|
|
1200
1245
|
searchRender: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
|
|
1201
|
-
renderSelectedItem: PropTypes.func
|
|
1246
|
+
renderSelectedItem: PropTypes.func,
|
|
1247
|
+
'aria-label': PropTypes.string
|
|
1202
1248
|
};
|
|
1203
1249
|
TreeSelect.defaultProps = {
|
|
1204
1250
|
searchPosition: strings.SEARCH_POSITION_DROPDOWN,
|
|
@@ -1225,6 +1271,7 @@ TreeSelect.defaultProps = {
|
|
|
1225
1271
|
onVisibleChange: _noop,
|
|
1226
1272
|
expandAction: false,
|
|
1227
1273
|
clickToHide: true,
|
|
1228
|
-
searchAutoFocus: false
|
|
1274
|
+
searchAutoFocus: false,
|
|
1275
|
+
'aria-label': 'TreeSelect'
|
|
1229
1276
|
};
|
|
1230
1277
|
export default TreeSelect;
|
|
@@ -32,6 +32,7 @@ import Tooltip from '../tooltip/index';
|
|
|
32
32
|
import Popover from '../popover/index';
|
|
33
33
|
import getRenderText from './util';
|
|
34
34
|
import warning from '@douyinfe/semi-foundation/lib/es/utils/warning';
|
|
35
|
+
import isEnterPress from '@douyinfe/semi-foundation/lib/es/utils/isEnterPress';
|
|
35
36
|
import LocaleConsumer from '../locale/localeConsumer';
|
|
36
37
|
import { isSemiIcon } from '../_utils';
|
|
37
38
|
const prefixCls = cssClasses.PREFIX;
|
|
@@ -234,13 +235,22 @@ export default class Base extends Component {
|
|
|
234
235
|
}
|
|
235
236
|
|
|
236
237
|
if (!noExpandText || !noCollapseText) {
|
|
237
|
-
return
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
238
|
+
return (
|
|
239
|
+
/*#__PURE__*/
|
|
240
|
+
// TODO: replace `a` tag with `span` in next major version
|
|
241
|
+
// NOTE: may have effect on style
|
|
242
|
+
// eslint-disable-next-line jsx-a11y/anchor-is-valid
|
|
243
|
+
React.createElement("a", {
|
|
244
|
+
role: "button",
|
|
245
|
+
tabIndex: 0,
|
|
246
|
+
className: "".concat(prefixCls, "-ellipsis-expand"),
|
|
247
|
+
key: "expand",
|
|
248
|
+
ref: this.expandRef,
|
|
249
|
+
"aria-label": text,
|
|
250
|
+
onClick: this.toggleOverflow,
|
|
251
|
+
onKeyPress: e => isEnterPress(e) && this.toggleOverflow(e)
|
|
252
|
+
}, text)
|
|
253
|
+
);
|
|
244
254
|
}
|
|
245
255
|
|
|
246
256
|
return null;
|
|
@@ -9,6 +9,7 @@ import cls from 'classnames';
|
|
|
9
9
|
import { noop } from '@douyinfe/semi-foundation/lib/es/utils/function';
|
|
10
10
|
import LocaleConsumer from '../locale/localeConsumer';
|
|
11
11
|
import { IconCopy, IconTick } from '@douyinfe/semi-icons';
|
|
12
|
+
import isEnterPress from '@douyinfe/semi-foundation/lib/es/utils/isEnterPress';
|
|
12
13
|
const prefixCls = cssClasses.PREFIX;
|
|
13
14
|
export class Copyable extends React.PureComponent {
|
|
14
15
|
constructor(props) {
|
|
@@ -100,7 +101,10 @@ export class Copyable extends React.PureComponent {
|
|
|
100
101
|
}, /*#__PURE__*/React.createElement("a", {
|
|
101
102
|
className: "".concat(prefixCls, "-action-copy-icon")
|
|
102
103
|
}, /*#__PURE__*/React.createElement(IconCopy, {
|
|
103
|
-
|
|
104
|
+
role: "button",
|
|
105
|
+
tabIndex: 0,
|
|
106
|
+
onClick: this.copy,
|
|
107
|
+
onKeyPress: e => isEnterPress(e) && this.copy(e)
|
|
104
108
|
})))));
|
|
105
109
|
}
|
|
106
110
|
|
|
@@ -16,6 +16,8 @@ const prefixCls = cssClasses.PREFIX;
|
|
|
16
16
|
const ErrorSvg = function () {
|
|
17
17
|
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
18
18
|
return /*#__PURE__*/React.createElement("svg", _Object$assign({
|
|
19
|
+
focusable: false,
|
|
20
|
+
"aria-hidden": true,
|
|
19
21
|
width: "16",
|
|
20
22
|
height: "16",
|
|
21
23
|
viewBox: "0 0 16 16",
|
|
@@ -37,6 +39,8 @@ const ErrorSvg = function () {
|
|
|
37
39
|
const ReplaceSvg = function () {
|
|
38
40
|
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
39
41
|
return /*#__PURE__*/React.createElement("svg", _Object$assign({
|
|
42
|
+
focusable: false,
|
|
43
|
+
"aria-hidden": true,
|
|
40
44
|
width: "28",
|
|
41
45
|
height: "28",
|
|
42
46
|
viewBox: "0 0 28 28",
|
|
@@ -64,6 +68,8 @@ const ReplaceSvg = function () {
|
|
|
64
68
|
const DirectorySvg = function () {
|
|
65
69
|
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
66
70
|
return /*#__PURE__*/React.createElement("svg", _Object$assign({
|
|
71
|
+
focusable: false,
|
|
72
|
+
"aria-hidden": true,
|
|
67
73
|
width: "24",
|
|
68
74
|
height: "24",
|
|
69
75
|
viewBox: "0 0 24 24",
|
|
@@ -177,6 +183,8 @@ class FileCard extends PureComponent {
|
|
|
177
183
|
});
|
|
178
184
|
const closeCls = "".concat(prefixCls, "-picture-file-card-close");
|
|
179
185
|
const retry = /*#__PURE__*/React.createElement("div", {
|
|
186
|
+
role: "button",
|
|
187
|
+
tabIndex: 0,
|
|
180
188
|
className: "".concat(prefixCls, "-picture-file-card-retry"),
|
|
181
189
|
onClick: e => this.onRetry(e)
|
|
182
190
|
}, /*#__PURE__*/React.createElement(IconRefresh, {
|
|
@@ -189,6 +197,8 @@ class FileCard extends PureComponent {
|
|
|
189
197
|
showArrow: false,
|
|
190
198
|
spacing: 4
|
|
191
199
|
}, /*#__PURE__*/React.createElement("div", {
|
|
200
|
+
role: "button",
|
|
201
|
+
tabIndex: 0,
|
|
192
202
|
className: "".concat(prefixCls, "-picture-file-card-replace"),
|
|
193
203
|
onClick: e => this.onReplace(e)
|
|
194
204
|
}, /*#__PURE__*/React.createElement(ReplaceSvg, {
|
|
@@ -199,9 +209,10 @@ class FileCard extends PureComponent {
|
|
|
199
209
|
}, index + 1);
|
|
200
210
|
const thumbnail = typeof renderThumbnail === 'function' ? renderThumbnail(this.props) : /*#__PURE__*/React.createElement("img", {
|
|
201
211
|
src: url,
|
|
202
|
-
alt:
|
|
212
|
+
alt: name
|
|
203
213
|
});
|
|
204
214
|
return /*#__PURE__*/React.createElement("div", {
|
|
215
|
+
role: "listitem",
|
|
205
216
|
className: filePicCardCls,
|
|
206
217
|
style: style,
|
|
207
218
|
onClick: onPreviewClick
|
|
@@ -209,10 +220,13 @@ class FileCard extends PureComponent {
|
|
|
209
220
|
percent: percent,
|
|
210
221
|
type: "circle",
|
|
211
222
|
size: "small",
|
|
212
|
-
orbitStroke: '#FFF'
|
|
223
|
+
orbitStroke: '#FFF',
|
|
224
|
+
"aria-label": "uploading file progress"
|
|
213
225
|
}) : null, showRetry ? retry : null, showReplace && replace, showPicInfo && picInfo, !disabled && /*#__PURE__*/React.createElement("div", {
|
|
214
226
|
className: closeCls
|
|
215
227
|
}, /*#__PURE__*/React.createElement(IconClose, {
|
|
228
|
+
tabIndex: 0,
|
|
229
|
+
role: "button",
|
|
216
230
|
size: "extra-small",
|
|
217
231
|
onClick: e => this.onRemove(e)
|
|
218
232
|
})), this.renderPicValidateMsg());
|
|
@@ -250,7 +264,8 @@ class FileCard extends PureComponent {
|
|
|
250
264
|
const showReplace = status === strings.FILE_STATUS_SUCCESS && propsShowReplace;
|
|
251
265
|
const fileSize = this.transSize(size);
|
|
252
266
|
let previewContent = preview ? /*#__PURE__*/React.createElement("img", {
|
|
253
|
-
src: url
|
|
267
|
+
src: url,
|
|
268
|
+
alt: name
|
|
254
269
|
}) : /*#__PURE__*/React.createElement(IconFile, {
|
|
255
270
|
size: "large"
|
|
256
271
|
});
|
|
@@ -260,6 +275,7 @@ class FileCard extends PureComponent {
|
|
|
260
275
|
}
|
|
261
276
|
|
|
262
277
|
return /*#__PURE__*/React.createElement("div", {
|
|
278
|
+
role: "listitem",
|
|
263
279
|
className: fileCardCls,
|
|
264
280
|
style: style,
|
|
265
281
|
onClick: onPreviewClick
|
|
@@ -289,12 +305,15 @@ class FileCard extends PureComponent {
|
|
|
289
305
|
percent: percent,
|
|
290
306
|
style: {
|
|
291
307
|
width: '100%'
|
|
292
|
-
}
|
|
308
|
+
},
|
|
309
|
+
"aria-label": "uploading file progress"
|
|
293
310
|
}) : null, /*#__PURE__*/React.createElement("div", {
|
|
294
311
|
className: "".concat(infoCls, "-main-control")
|
|
295
312
|
}, /*#__PURE__*/React.createElement("span", {
|
|
296
313
|
className: "".concat(infoCls, "-validate-message")
|
|
297
314
|
}, this.renderValidateMessage()), showRetry ? /*#__PURE__*/React.createElement("span", {
|
|
315
|
+
role: "button",
|
|
316
|
+
tabIndex: 0,
|
|
298
317
|
className: "".concat(infoCls, "-retry"),
|
|
299
318
|
onClick: e => this.onRetry(e)
|
|
300
319
|
}, locale.retry) : null)), /*#__PURE__*/React.createElement(IconButton, {
|
package/lib/es/upload/index.js
CHANGED
|
@@ -208,6 +208,7 @@ class Upload extends BaseComponent {
|
|
|
208
208
|
});
|
|
209
209
|
const mainCls = "".concat(prefixCls, "-file-list-main");
|
|
210
210
|
const addContentProps = {
|
|
211
|
+
role: 'button',
|
|
211
212
|
className: uploadAddCls,
|
|
212
213
|
onClick: this.onClick
|
|
213
214
|
};
|
|
@@ -240,7 +241,9 @@ class Upload extends BaseComponent {
|
|
|
240
241
|
return /*#__PURE__*/React.createElement(LocaleConsumer, {
|
|
241
242
|
componentName: "Upload"
|
|
242
243
|
}, locale => /*#__PURE__*/React.createElement("div", _Object$assign({}, containerProps), /*#__PURE__*/React.createElement("div", {
|
|
243
|
-
className: mainCls
|
|
244
|
+
className: mainCls,
|
|
245
|
+
role: "list",
|
|
246
|
+
"aria-label": "picture list"
|
|
244
247
|
}, _mapInstanceProperty(fileList).call(fileList, (file, index) => this.renderFile(file, index, locale)), showAddTriggerInList ? addContent : null)));
|
|
245
248
|
};
|
|
246
249
|
|
|
@@ -274,10 +277,14 @@ class Upload extends BaseComponent {
|
|
|
274
277
|
}, /*#__PURE__*/React.createElement("span", {
|
|
275
278
|
className: "".concat(titleCls, "-choosen")
|
|
276
279
|
}, locale.selectedFiles), showClear ? /*#__PURE__*/React.createElement("span", {
|
|
280
|
+
role: "button",
|
|
281
|
+
tabIndex: 0,
|
|
277
282
|
onClick: this.clear,
|
|
278
283
|
className: "".concat(titleCls, "-clear")
|
|
279
284
|
}, locale.clear) : null) : null, /*#__PURE__*/React.createElement("div", {
|
|
280
|
-
className: mainCls
|
|
285
|
+
className: mainCls,
|
|
286
|
+
role: "list",
|
|
287
|
+
"aria-label": "file list"
|
|
281
288
|
}, _mapInstanceProperty(fileList).call(fileList, (file, index) => this.renderFile(file, index, locale)))));
|
|
282
289
|
};
|
|
283
290
|
|
|
@@ -302,7 +309,8 @@ class Upload extends BaseComponent {
|
|
|
302
309
|
const {
|
|
303
310
|
draggable,
|
|
304
311
|
children,
|
|
305
|
-
listType
|
|
312
|
+
listType,
|
|
313
|
+
disabled
|
|
306
314
|
} = this.props;
|
|
307
315
|
const uploadAddCls = cls("".concat(prefixCls, "-add"));
|
|
308
316
|
|
|
@@ -315,6 +323,9 @@ class Upload extends BaseComponent {
|
|
|
315
323
|
}
|
|
316
324
|
|
|
317
325
|
return /*#__PURE__*/React.createElement("div", {
|
|
326
|
+
role: "button",
|
|
327
|
+
tabIndex: 0,
|
|
328
|
+
"aria-disabled": disabled,
|
|
318
329
|
className: uploadAddCls,
|
|
319
330
|
onClick: this.onClick
|
|
320
331
|
}, children);
|
|
@@ -328,7 +339,8 @@ class Upload extends BaseComponent {
|
|
|
328
339
|
children,
|
|
329
340
|
dragIcon,
|
|
330
341
|
dragMainText,
|
|
331
|
-
dragSubText
|
|
342
|
+
dragSubText,
|
|
343
|
+
disabled
|
|
332
344
|
} = this.props;
|
|
333
345
|
const dragAreaBaseCls = "".concat(prefixCls, "-drag-area");
|
|
334
346
|
const dragAreaCls = cls(dragAreaBaseCls, {
|
|
@@ -339,6 +351,9 @@ class Upload extends BaseComponent {
|
|
|
339
351
|
return /*#__PURE__*/React.createElement(LocaleConsumer, {
|
|
340
352
|
componentName: "Upload"
|
|
341
353
|
}, locale => /*#__PURE__*/React.createElement("div", {
|
|
354
|
+
role: "button",
|
|
355
|
+
tabIndex: 0,
|
|
356
|
+
"aria-disabled": disabled,
|
|
342
357
|
className: dragAreaCls,
|
|
343
358
|
onDrop: this.onDrop,
|
|
344
359
|
onDragOver: this.onDragOver,
|
package/list/item.tsx
CHANGED
package/modal/Modal.tsx
CHANGED
|
@@ -283,6 +283,7 @@ class Modal extends BaseComponent<ModalReactProps, ModalState> {
|
|
|
283
283
|
} else {
|
|
284
284
|
return (
|
|
285
285
|
<Button
|
|
286
|
+
aria-label="cancel"
|
|
286
287
|
onClick={this.handleCancel}
|
|
287
288
|
loading={cancelLoading}
|
|
288
289
|
type="tertiary"
|
|
@@ -300,6 +301,7 @@ class Modal extends BaseComponent<ModalReactProps, ModalState> {
|
|
|
300
301
|
<div>
|
|
301
302
|
{getCancelButton(locale)}
|
|
302
303
|
<Button
|
|
304
|
+
aria-label="confirm"
|
|
303
305
|
type={okType}
|
|
304
306
|
theme="solid"
|
|
305
307
|
loading={confirmLoading}
|
package/modal/ModalContent.tsx
CHANGED
|
@@ -13,8 +13,9 @@ import ModalContentFoundation, {
|
|
|
13
13
|
ModalContentProps,
|
|
14
14
|
ModalContentState
|
|
15
15
|
} from '@douyinfe/semi-foundation/modal/modalContentFoundation';
|
|
16
|
-
import { noop } from 'lodash';
|
|
16
|
+
import { noop, isFunction, get } from 'lodash';
|
|
17
17
|
import { IconClose } from '@douyinfe/semi-icons';
|
|
18
|
+
import { getActiveElement } from '../_utils';
|
|
18
19
|
|
|
19
20
|
let uuid = 0;
|
|
20
21
|
|
|
@@ -37,14 +38,17 @@ export default class ModalContent extends BaseComponent<ModalContentProps, Modal
|
|
|
37
38
|
dialogId: string;
|
|
38
39
|
private timeoutId: NodeJS.Timeout;
|
|
39
40
|
|
|
40
|
-
|
|
41
|
+
modalDialogRef: React.MutableRefObject<HTMLDivElement>;
|
|
42
|
+
foundation: ModalContentFoundation;
|
|
41
43
|
constructor(props: ModalContentProps) {
|
|
42
44
|
super(props);
|
|
43
45
|
this.state = {
|
|
44
46
|
dialogMouseDown: false,
|
|
47
|
+
prevFocusElement: getActiveElement(),
|
|
45
48
|
};
|
|
46
49
|
this.foundation = new ModalContentFoundation(this.adapter);
|
|
47
50
|
this.dialogId = `dialog-${uuid++}`;
|
|
51
|
+
this.modalDialogRef = React.createRef();
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
get adapter(): ModalContentAdapter {
|
|
@@ -75,11 +79,30 @@ export default class ModalContent extends BaseComponent<ModalContentProps, Modal
|
|
|
75
79
|
}
|
|
76
80
|
},
|
|
77
81
|
getMouseState: () => this.state.dialogMouseDown,
|
|
82
|
+
modalDialogFocus: () => {
|
|
83
|
+
let activeElementInDialog;
|
|
84
|
+
if (this.modalDialogRef) {
|
|
85
|
+
const activeElement = getActiveElement();
|
|
86
|
+
activeElementInDialog = this.modalDialogRef.current.contains(activeElement);
|
|
87
|
+
}
|
|
88
|
+
if (!activeElementInDialog) {
|
|
89
|
+
this.modalDialogRef && this.modalDialogRef.current.focus();
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
modalDialogBlur: () => {
|
|
93
|
+
this.modalDialogRef && this.modalDialogRef.current.blur();
|
|
94
|
+
},
|
|
95
|
+
prevFocusElementReFocus: () => {
|
|
96
|
+
const { prevFocusElement } = this.state;
|
|
97
|
+
const focus = get(prevFocusElement, 'focus');
|
|
98
|
+
isFunction(focus) && prevFocusElement.focus();
|
|
99
|
+
}
|
|
78
100
|
};
|
|
79
101
|
}
|
|
80
102
|
|
|
81
103
|
componentDidMount() {
|
|
82
104
|
this.foundation.handleKeyDownEventListenerMount();
|
|
105
|
+
this.foundation.modalDialogFocus();
|
|
83
106
|
}
|
|
84
107
|
|
|
85
108
|
componentWillUnmount() {
|
|
@@ -132,6 +155,7 @@ export default class ModalContent extends BaseComponent<ModalContentProps, Modal
|
|
|
132
155
|
const iconType = closeIcon || <IconClose/>;
|
|
133
156
|
closer = (
|
|
134
157
|
<Button
|
|
158
|
+
aria-label="close"
|
|
135
159
|
className={`${cssClasses.DIALOG}-close`}
|
|
136
160
|
key="close-btn"
|
|
137
161
|
onClick={this.close}
|
|
@@ -162,7 +186,7 @@ export default class ModalContent extends BaseComponent<ModalContentProps, Modal
|
|
|
162
186
|
(
|
|
163
187
|
<div className={`${cssClasses.DIALOG}-header`}>
|
|
164
188
|
{icon}
|
|
165
|
-
<Typography.Title heading={5} className={`${cssClasses.DIALOG}-title`}>{title}</Typography.Title>
|
|
189
|
+
<Typography.Title heading={5} className={`${cssClasses.DIALOG}-title`} id={`${cssClasses.DIALOG}-title`}>{title}</Typography.Title>
|
|
166
190
|
{closer}
|
|
167
191
|
</div>
|
|
168
192
|
);
|
|
@@ -181,7 +205,7 @@ export default class ModalContent extends BaseComponent<ModalContentProps, Modal
|
|
|
181
205
|
const icon = this.renderIcon();
|
|
182
206
|
const hasHeader = title !== null && title !== undefined || 'header' in this.props;
|
|
183
207
|
return hasHeader ?
|
|
184
|
-
<div className={bodyCls} style={bodyStyle}>{children}</div> :
|
|
208
|
+
<div className={bodyCls} id={`${cssClasses.DIALOG}-body`} style={bodyStyle}>{children}</div> :
|
|
185
209
|
(
|
|
186
210
|
<div className={`${cssClasses.DIALOG}-body-wrapper`}>
|
|
187
211
|
{icon}
|
|
@@ -214,6 +238,7 @@ export default class ModalContent extends BaseComponent<ModalContentProps, Modal
|
|
|
214
238
|
const header = this.renderHeader();
|
|
215
239
|
const footer = props.footer ? <div className={`${cssClasses.DIALOG}-footer`}>{props.footer}</div> : null;
|
|
216
240
|
const dialogElement = (
|
|
241
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
217
242
|
<div
|
|
218
243
|
key="dialog-element"
|
|
219
244
|
className={digCls}
|
|
@@ -222,6 +247,11 @@ export default class ModalContent extends BaseComponent<ModalContentProps, Modal
|
|
|
222
247
|
id={this.dialogId}
|
|
223
248
|
>
|
|
224
249
|
<div
|
|
250
|
+
role="dialog"
|
|
251
|
+
ref={this.modalDialogRef}
|
|
252
|
+
aria-modal="true"
|
|
253
|
+
aria-labelledby={`${cssClasses.DIALOG}-title`}
|
|
254
|
+
aria-describedby={`${cssClasses.DIALOG}-body`}
|
|
225
255
|
onAnimationEnd={props.onAnimationEnd}
|
|
226
256
|
className={cls([`${cssClasses.DIALOG}-content`,
|
|
227
257
|
props.contentClassName,
|
|
@@ -257,7 +287,7 @@ export default class ModalContent extends BaseComponent<ModalContentProps, Modal
|
|
|
257
287
|
<div className={classList}>
|
|
258
288
|
{this.getMaskElement()}
|
|
259
289
|
<div
|
|
260
|
-
role="
|
|
290
|
+
role="none"
|
|
261
291
|
tabIndex={-1}
|
|
262
292
|
className={`${cssClasses.DIALOG}-wrap`}
|
|
263
293
|
onClick={maskClosable ? this.onMaskClick : null}
|
package/navigation/Item.tsx
CHANGED
|
@@ -76,6 +76,7 @@ export default class NavItem extends BaseComponent<NavItemProps, NavItemState> {
|
|
|
76
76
|
disabled: false,
|
|
77
77
|
};
|
|
78
78
|
|
|
79
|
+
foundation: ItemFoundation;
|
|
79
80
|
constructor(props: NavItemProps) {
|
|
80
81
|
super(props);
|
|
81
82
|
this.state = {
|
|
@@ -108,6 +109,8 @@ export default class NavItem extends BaseComponent<NavItemProps, NavItemState> {
|
|
|
108
109
|
getIsCollapsed: () => this.props.isCollapsed || Boolean(this.context && this.context.isCollapsed) || false,
|
|
109
110
|
getSelected: () =>
|
|
110
111
|
Boolean(this.context && this.context.selectedKeys && this.context.selectedKeys.includes(this.props.itemKey)),
|
|
112
|
+
getIsOpen: () =>
|
|
113
|
+
Boolean(this.context && this.context.openKeys && this.context.openKeys.includes(this.props.itemKey)),
|
|
111
114
|
};
|
|
112
115
|
}
|
|
113
116
|
|
|
@@ -159,6 +162,7 @@ export default class NavItem extends BaseComponent<NavItemProps, NavItemState> {
|
|
|
159
162
|
};
|
|
160
163
|
|
|
161
164
|
handleClick = (e: React.MouseEvent) => this.foundation.handleClick(e);
|
|
165
|
+
handleKeyPress = (e: React.KeyboardEvent) => this.foundation.handleKeyPress(e);
|
|
162
166
|
|
|
163
167
|
render() {
|
|
164
168
|
const {
|
|
@@ -249,15 +253,26 @@ export default class NavItem extends BaseComponent<NavItemProps, NavItemState> {
|
|
|
249
253
|
[`${clsPrefix}-collapsed`]: isCollapsed,
|
|
250
254
|
[`${clsPrefix}-disabled`]: disabled,
|
|
251
255
|
});
|
|
256
|
+
const ariaProps = {
|
|
257
|
+
'aria-disabled': disabled,
|
|
258
|
+
};
|
|
259
|
+
if (isSubNav) {
|
|
260
|
+
const isOpen = this.adapter.getIsOpen();
|
|
261
|
+
ariaProps['aria-expanded'] = isOpen;
|
|
262
|
+
}
|
|
252
263
|
|
|
253
264
|
itemDom = (
|
|
254
265
|
<li
|
|
266
|
+
role="menuitem"
|
|
267
|
+
tabIndex={-1}
|
|
268
|
+
{...ariaProps}
|
|
255
269
|
style={style}
|
|
256
270
|
ref={this.setItemRef}
|
|
257
271
|
className={popoverItemCls}
|
|
258
272
|
onClick={this.handleClick}
|
|
259
273
|
onMouseEnter={onMouseEnter}
|
|
260
274
|
onMouseLeave={onMouseLeave}
|
|
275
|
+
onKeyPress={this.handleKeyPress}
|
|
261
276
|
>
|
|
262
277
|
{itemChildren}
|
|
263
278
|
</li>
|
package/navigation/SubNav.tsx
CHANGED
|
@@ -115,6 +115,7 @@ export default class SubNav extends BaseComponent<SubNavProps, SubNavState> {
|
|
|
115
115
|
|
|
116
116
|
titleRef: React.RefObject<HTMLDivElement>;
|
|
117
117
|
itemRef: React.RefObject<HTMLLIElement>;
|
|
118
|
+
foundation: SubNavFoundation;
|
|
118
119
|
constructor(props: SubNavProps) {
|
|
119
120
|
super(props);
|
|
120
121
|
this.state = {
|
|
@@ -171,6 +172,10 @@ export default class SubNav extends BaseComponent<SubNavProps, SubNavState> {
|
|
|
171
172
|
this.foundation.handleClick(e && e.nativeEvent, this.titleRef && this.titleRef.current);
|
|
172
173
|
};
|
|
173
174
|
|
|
175
|
+
handleKeyPress = (e: React.KeyboardEvent) => {
|
|
176
|
+
this.foundation.handleKeyPress(e && e.nativeEvent, this.titleRef && this.titleRef.current);
|
|
177
|
+
}
|
|
178
|
+
|
|
174
179
|
handleDropdownVisible = (visible: boolean) => this.foundation.handleDropdownVisibleChange(visible);
|
|
175
180
|
|
|
176
181
|
renderIcon(icon: React.ReactNode, pos: string, withTransition?: boolean, isToggleIcon = false, key: number | string = 0) {
|
|
@@ -239,7 +244,14 @@ export default class SubNav extends BaseComponent<SubNavProps, SubNavState> {
|
|
|
239
244
|
}
|
|
240
245
|
|
|
241
246
|
const titleDiv = (
|
|
242
|
-
<div
|
|
247
|
+
<div
|
|
248
|
+
role="menuitem"
|
|
249
|
+
tabIndex={-1}
|
|
250
|
+
ref={this.setTitleRef as any}
|
|
251
|
+
className={titleCls}
|
|
252
|
+
onClick={this.handleClick}
|
|
253
|
+
onKeyPress={this.handleKeyPress}
|
|
254
|
+
>
|
|
243
255
|
<div className={`${prefixCls}-item-inner`}>
|
|
244
256
|
{placeholderIcons}
|
|
245
257
|
{this.context.toggleIconPosition === strings.TOGGLE_ICON_LEFT && this.renderIcon(toggleIconType, strings.ICON_POS_RIGHT, withTransition, true, 'key-toggle-position-left')}
|
package/navigation/index.tsx
CHANGED
|
@@ -408,7 +408,7 @@ class Nav extends BaseComponent<NavProps, NavState> {
|
|
|
408
408
|
<div className={headerListOuterCls}>
|
|
409
409
|
{headers}
|
|
410
410
|
<div style={bodyStyle} className={`${prefixCls}-list-wrapper`}>
|
|
411
|
-
<ul className={`${prefixCls}-list`}>
|
|
411
|
+
<ul role="menu" aria-orientation={mode} className={`${prefixCls}-list`}>
|
|
412
412
|
{this.adapter.getCache('itemElems')}
|
|
413
413
|
{children}
|
|
414
414
|
</ul>
|