@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/steps/basicStep.tsx
CHANGED
|
@@ -21,6 +21,9 @@ export interface BasicStepProps {
|
|
|
21
21
|
done?: boolean;
|
|
22
22
|
onChange?: () => void;
|
|
23
23
|
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
24
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
|
|
25
|
+
"role"?: React.AriaRole;
|
|
26
|
+
"aria-label"?: React.AriaAttributes["aria-label"];
|
|
24
27
|
}
|
|
25
28
|
export enum stepSizeMapIconSize {
|
|
26
29
|
small = 'large',
|
|
@@ -42,7 +45,7 @@ const BasicStep = (props: BasicStepProps) => {
|
|
|
42
45
|
stepNumber,
|
|
43
46
|
onClick,
|
|
44
47
|
onChange,
|
|
45
|
-
|
|
48
|
+
onKeyDown,
|
|
46
49
|
} = props;
|
|
47
50
|
const renderIcon = () => {
|
|
48
51
|
let inner, progress;
|
|
@@ -82,18 +85,26 @@ const BasicStep = (props: BasicStepProps) => {
|
|
|
82
85
|
|
|
83
86
|
return inner ? <span className={cls}>{inner}</span> : null;
|
|
84
87
|
};
|
|
85
|
-
const classString = classnames(prefixCls,
|
|
88
|
+
const classString = classnames(prefixCls, `${prefixCls}-${status}`, {
|
|
86
89
|
[`${prefixCls}-active`]: active,
|
|
87
90
|
[`${prefixCls}-done`]: done
|
|
88
|
-
});
|
|
91
|
+
}, className);
|
|
89
92
|
const handleClick = (e: React.MouseEvent) => {
|
|
90
93
|
if (isFunction(onClick)) {
|
|
91
94
|
onClick(e);
|
|
92
95
|
}
|
|
93
96
|
onChange();
|
|
94
97
|
};
|
|
98
|
+
const handleKeyDown = (e) => {
|
|
99
|
+
if (e.key === 'Enter') {
|
|
100
|
+
if (isFunction(onKeyDown)) {
|
|
101
|
+
onKeyDown(e);
|
|
102
|
+
}
|
|
103
|
+
onChange();
|
|
104
|
+
}
|
|
105
|
+
};
|
|
95
106
|
return (
|
|
96
|
-
<div {
|
|
107
|
+
<div role={props["role"]} aria-label={props["aria-label"]} tabIndex={0} aria-current="step" className={classString} style={style} onClick={e => handleClick(e)} onKeyDown={handleKeyDown}>
|
|
97
108
|
<div className={`${prefixCls}-container`}>
|
|
98
109
|
<div className={`${prefixCls}-left`}>{renderIcon()}</div>
|
|
99
110
|
<div className={`${prefixCls}-content`}>
|
package/steps/basicSteps.tsx
CHANGED
|
@@ -18,6 +18,7 @@ export interface BasicStepsProps {
|
|
|
18
18
|
hasLine?: boolean;
|
|
19
19
|
children?: React.ReactNode;
|
|
20
20
|
onChange?: (current: number) => void;
|
|
21
|
+
"aria-label"?: string;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
const Steps = (props: BasicStepsProps) => {
|
|
@@ -70,7 +71,7 @@ const Steps = (props: BasicStepsProps) => {
|
|
|
70
71
|
return cloneElement(child, { ...childProps });
|
|
71
72
|
});
|
|
72
73
|
return content;
|
|
73
|
-
}, [children, initial, prefixCls, direction, status, current, size]);
|
|
74
|
+
}, [children, initial, prefixCls, direction, status, current, size, onChange]);
|
|
74
75
|
|
|
75
76
|
const wrapperCls = cls(className, {
|
|
76
77
|
[`${prefixCls}-basic`]: true,
|
|
@@ -80,7 +81,7 @@ const Steps = (props: BasicStepsProps) => {
|
|
|
80
81
|
});
|
|
81
82
|
|
|
82
83
|
return (
|
|
83
|
-
<div className={wrapperCls} style={style}>
|
|
84
|
+
<div aria-label={props["aria-label"]} className={wrapperCls} style={style}>
|
|
84
85
|
{inner}
|
|
85
86
|
</div>
|
|
86
87
|
);
|
package/steps/fillStep.tsx
CHANGED
|
@@ -18,10 +18,13 @@ export interface FillStepProps {
|
|
|
18
18
|
stepNumber?: string;
|
|
19
19
|
onChange?: () => void;
|
|
20
20
|
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
21
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
|
|
22
|
+
"role"?: React.AriaRole;
|
|
23
|
+
"aria-label"?: React.AriaAttributes["aria-label"];
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
const FillStep = (props: FillStepProps) => {
|
|
24
|
-
const { prefixCls, className, title, description, status, style, onClick, icon, onChange, stepNumber } = props;
|
|
27
|
+
const { prefixCls, className, title, description, status, style, onClick, icon, onChange, stepNumber, onKeyDown } = props;
|
|
25
28
|
const renderIcon = () => {
|
|
26
29
|
let inner, progress;
|
|
27
30
|
|
|
@@ -51,10 +54,10 @@ const FillStep = (props: FillStepProps) => {
|
|
|
51
54
|
}
|
|
52
55
|
}
|
|
53
56
|
const cls = classnames({
|
|
54
|
-
[`${prefixCls
|
|
55
|
-
[`${prefixCls
|
|
56
|
-
[`${prefixCls
|
|
57
|
-
[`${prefixCls
|
|
57
|
+
[`${prefixCls}-left`]: true,
|
|
58
|
+
[`${prefixCls}-icon`]: 'icon' in props,
|
|
59
|
+
[`${prefixCls}-plain`]: !('icon' in props),
|
|
60
|
+
[`${prefixCls}-icon-process`]: progress,
|
|
58
61
|
});
|
|
59
62
|
|
|
60
63
|
return inner ? <div className={cls}>{inner}</div> : null;
|
|
@@ -65,26 +68,38 @@ const FillStep = (props: FillStepProps) => {
|
|
|
65
68
|
}
|
|
66
69
|
onChange();
|
|
67
70
|
};
|
|
71
|
+
const handleKeyDown = (e) => {
|
|
72
|
+
if (e.key === 'Enter') {
|
|
73
|
+
if (isFunction(onKeyDown)) {
|
|
74
|
+
onKeyDown(e);
|
|
75
|
+
}
|
|
76
|
+
onChange();
|
|
77
|
+
}
|
|
78
|
+
};
|
|
68
79
|
return (
|
|
69
80
|
<div
|
|
81
|
+
role={props["role"]}
|
|
82
|
+
aria-label={props["aria-label"]}
|
|
83
|
+
aria-current="step"
|
|
84
|
+
tabIndex={0}
|
|
70
85
|
className={classnames({
|
|
71
|
-
[className]: Boolean(className),
|
|
72
86
|
[prefixCls]: true,
|
|
73
87
|
[`${prefixCls}-${status}`]: Boolean(status),
|
|
74
|
-
[`${prefixCls
|
|
75
|
-
})}
|
|
88
|
+
[`${prefixCls}-clickable`]: onClick,
|
|
89
|
+
}, className)}
|
|
76
90
|
style={style}
|
|
77
91
|
onClick={e => {
|
|
78
92
|
handleClick(e);
|
|
79
93
|
}}
|
|
94
|
+
onKeyDown={handleKeyDown}
|
|
80
95
|
>
|
|
81
96
|
{renderIcon()}
|
|
82
|
-
<div className={`${prefixCls
|
|
83
|
-
<div className={`${prefixCls
|
|
84
|
-
<span className={`${prefixCls
|
|
97
|
+
<div className={`${prefixCls}-content`}>
|
|
98
|
+
<div className={`${prefixCls}-title`} title={typeof title === 'string' ? title : null}>
|
|
99
|
+
<span className={`${prefixCls}-title-text`}>{title}</span>
|
|
85
100
|
</div>
|
|
86
101
|
<div
|
|
87
|
-
className={`${prefixCls
|
|
102
|
+
className={`${prefixCls}-description`}
|
|
88
103
|
title={typeof description === 'string' ? description : null}
|
|
89
104
|
>
|
|
90
105
|
{description}
|
package/steps/fillSteps.tsx
CHANGED
|
@@ -16,6 +16,7 @@ export interface FillStepsProps {
|
|
|
16
16
|
style?: React.CSSProperties;
|
|
17
17
|
children?: React.ReactNode;
|
|
18
18
|
onChange?: (current: number) => void;
|
|
19
|
+
"aria-label"?: string;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
const Steps = (props: FillStepsProps) => {
|
|
@@ -66,6 +67,7 @@ const Steps = (props: FillStepsProps) => {
|
|
|
66
67
|
<div
|
|
67
68
|
className={wrapperCls}
|
|
68
69
|
style={style}
|
|
70
|
+
aria-label={props["aria-label"]}
|
|
69
71
|
>
|
|
70
72
|
<Row type="flex" justify="start">
|
|
71
73
|
{inner}
|
package/steps/navStep.tsx
CHANGED
|
@@ -15,21 +15,32 @@ export interface NavStepProps {
|
|
|
15
15
|
prefixCls?: string;
|
|
16
16
|
onChange?: () => void;
|
|
17
17
|
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
18
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
|
|
19
|
+
"role"?: React.AriaRole;
|
|
20
|
+
"aria-label"?: React.AriaAttributes["aria-label"];
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
const NavStep = (props: NavStepProps) => {
|
|
21
|
-
const { prefixCls, className, title, style, active, index, total, onClick,
|
|
22
|
-
const classString = classnames(prefixCls,
|
|
24
|
+
const { prefixCls, className, title, style, active, index, total, onClick, onKeyDown, onChange } = props;
|
|
25
|
+
const classString = classnames(prefixCls, {
|
|
23
26
|
[`${prefixCls}-active`]: active
|
|
24
|
-
});
|
|
27
|
+
}, className);
|
|
25
28
|
const handleClick = (e: React.MouseEvent) => {
|
|
26
29
|
if (isFunction(onClick)) {
|
|
27
30
|
onClick(e);
|
|
28
31
|
}
|
|
29
32
|
onChange();
|
|
30
33
|
};
|
|
34
|
+
const handleKeyDown = (e) => {
|
|
35
|
+
if (e.key === 'Enter') {
|
|
36
|
+
if (isFunction(onKeyDown)) {
|
|
37
|
+
onKeyDown(e);
|
|
38
|
+
}
|
|
39
|
+
onChange();
|
|
40
|
+
}
|
|
41
|
+
};
|
|
31
42
|
return (
|
|
32
|
-
<div {
|
|
43
|
+
<div role={props["role"]} aria-label={props["aria-label"]} aria-current="step" tabIndex={0} className={classString} style={style} onClick={e => handleClick(e)} onKeyDown={handleKeyDown}>
|
|
33
44
|
<div className={`${prefixCls}-container`}>
|
|
34
45
|
<div className={`${prefixCls}-content`}>
|
|
35
46
|
<div className={`${prefixCls}-title`}>
|
package/steps/navSteps.tsx
CHANGED
|
@@ -13,6 +13,7 @@ export interface NavStepsProps {
|
|
|
13
13
|
size?: Size;
|
|
14
14
|
children?: React.ReactNode;
|
|
15
15
|
onChange?: (current: number) => void;
|
|
16
|
+
"aria-label"?: string;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
const Steps = (props: NavStepsProps) => {
|
|
@@ -38,7 +39,7 @@ const Steps = (props: NavStepsProps) => {
|
|
|
38
39
|
return cloneElement(child, { ...childProps });
|
|
39
40
|
});
|
|
40
41
|
return content;
|
|
41
|
-
}, [children, prefixCls, current, size]);
|
|
42
|
+
}, [children, prefixCls, current, size, initial, onChange]);
|
|
42
43
|
|
|
43
44
|
const wrapperCls = cls(className, {
|
|
44
45
|
[`${prefixCls}-nav`]: true,
|
|
@@ -46,7 +47,7 @@ const Steps = (props: NavStepsProps) => {
|
|
|
46
47
|
});
|
|
47
48
|
|
|
48
49
|
return (
|
|
49
|
-
<div className={wrapperCls} style={style}>
|
|
50
|
+
<div aria-label={props["aria-label"]} className={wrapperCls} style={style}>
|
|
50
51
|
{inner}
|
|
51
52
|
</div>
|
|
52
53
|
);
|
|
@@ -9,8 +9,8 @@ export default {
|
|
|
9
9
|
|
|
10
10
|
export const _Switch = () => (
|
|
11
11
|
<div>
|
|
12
|
-
<Switch onChange={(v, e) => console.log(v)}></Switch>
|
|
13
|
-
<Switch defaultChecked={true} onChange={(v, e) => console.log(v)}></Switch>
|
|
12
|
+
<Switch onChange={(v, e) => console.log(v)} aria-label='power-switch'></Switch>
|
|
13
|
+
<Switch defaultChecked={true} onChange={(v, e) => console.log(v)} aria-label='mode-switch'></Switch>
|
|
14
14
|
</div>
|
|
15
15
|
);
|
|
16
16
|
|
|
@@ -20,9 +20,9 @@ _Switch.story = {
|
|
|
20
20
|
|
|
21
21
|
export const SwitchSize = () => (
|
|
22
22
|
<div>
|
|
23
|
-
<Switch onChange={(v, e) => console.log(v)}></Switch>
|
|
24
|
-
<Switch onChange={(v, e) => console.log(v)} size="small"></Switch>
|
|
25
|
-
<Switch onChange={(v, e) => console.log(v)} size="large"></Switch>
|
|
23
|
+
<Switch onChange={(v, e) => console.log(v)} aria-label='power-switch'></Switch>
|
|
24
|
+
<Switch onChange={(v, e) => console.log(v)} size="small" aria-label='power-switch'></Switch>
|
|
25
|
+
<Switch onChange={(v, e) => console.log(v)} size="large" aria-label='power-switch'></Switch>
|
|
26
26
|
</div>
|
|
27
27
|
);
|
|
28
28
|
|
|
@@ -32,20 +32,20 @@ SwitchSize.story = {
|
|
|
32
32
|
|
|
33
33
|
export const SwitchCheckedTextUncheckedText = () => (
|
|
34
34
|
<div>
|
|
35
|
-
<Switch defaultChecked checkedText="开" uncheckedText="关" />
|
|
36
|
-
<Switch checkedText={'|'} uncheckedText="〇" />
|
|
35
|
+
<Switch defaultChecked checkedText="开" uncheckedText="关" aria-label='power-switch'/>
|
|
36
|
+
<Switch checkedText={'|'} uncheckedText="〇" aria-label='power-switch'/>
|
|
37
37
|
<br />
|
|
38
38
|
<br />
|
|
39
|
-
<Switch checkedText="开" uncheckedText="关" />
|
|
40
|
-
<Switch defaultChecked checkedText="|" uncheckedText="〇" />
|
|
39
|
+
<Switch checkedText="开" uncheckedText="关" aria-label='power-switch'/>
|
|
40
|
+
<Switch defaultChecked checkedText="|" uncheckedText="〇" aria-label='power-switch'/>
|
|
41
41
|
<br />
|
|
42
42
|
<br />
|
|
43
|
-
<Switch checkedText="开" uncheckedText="关" size="large" />
|
|
44
|
-
<Switch checkedText="|" uncheckedText="〇" size="large" />
|
|
43
|
+
<Switch checkedText="开" uncheckedText="关" size="large" aria-label='power-switch'/>
|
|
44
|
+
<Switch checkedText="|" uncheckedText="〇" size="large" aria-label='power-switch'/>
|
|
45
45
|
<br />
|
|
46
46
|
<br />
|
|
47
|
-
<Switch defaultChecked checkedText="开" uncheckedText="关" size="large" />
|
|
48
|
-
<Switch defaultChecked checkedText="|" uncheckedText="〇" size="large" />
|
|
47
|
+
<Switch defaultChecked checkedText="开" uncheckedText="关" size="large" aria-label='power-switch'/>
|
|
48
|
+
<Switch defaultChecked checkedText="|" uncheckedText="〇" size="large" aria-label='power-switch'/>
|
|
49
49
|
</div>
|
|
50
50
|
);
|
|
51
51
|
|
|
@@ -55,9 +55,9 @@ SwitchCheckedTextUncheckedText.story = {
|
|
|
55
55
|
|
|
56
56
|
export const SwitchDisabled = () => (
|
|
57
57
|
<>
|
|
58
|
-
<Switch disabled>disabled</Switch>
|
|
58
|
+
<Switch disabled aria-label='power-switch'>disabled</Switch>
|
|
59
59
|
|
|
60
|
-
<Switch disabled checked={true} onChange={(v, e) => console.log(v)}></Switch>
|
|
60
|
+
<Switch disabled checked={true} onChange={(v, e) => console.log(v)} aria-label='power-switch'></Switch>
|
|
61
61
|
</>
|
|
62
62
|
);
|
|
63
63
|
|
|
@@ -67,7 +67,7 @@ SwitchDisabled.story = {
|
|
|
67
67
|
|
|
68
68
|
const ControledSwitch = () => {
|
|
69
69
|
const [checked, onChange] = useState(true);
|
|
70
|
-
return <Switch checked={checked} onChange={(v, e) => onChange(v)} />;
|
|
70
|
+
return <Switch checked={checked} onChange={(v, e) => onChange(v)} aria-label='power-switch'/>;
|
|
71
71
|
};
|
|
72
72
|
export const SwitchCheckedOnChange = () => <ControledSwitch />;
|
|
73
73
|
|
|
@@ -82,7 +82,7 @@ const UnControledSwitch = () => {
|
|
|
82
82
|
return (
|
|
83
83
|
<>
|
|
84
84
|
{/* <Switch onChange={onChange} defaultChecked={false}/> */}
|
|
85
|
-
<Switch onChange={onChange} defaultChecked={true} />
|
|
85
|
+
<Switch onChange={onChange} defaultChecked={true} aria-label='power-switch'/>
|
|
86
86
|
</>
|
|
87
87
|
);
|
|
88
88
|
};
|
|
@@ -137,15 +137,16 @@ class LoadingDemo extends React.Component {
|
|
|
137
137
|
<Switch
|
|
138
138
|
checked={this.state.checked}
|
|
139
139
|
onChange={this.onChange}
|
|
140
|
+
aria-label='power-switch'
|
|
140
141
|
loading={this.state.loading}
|
|
141
142
|
></Switch>
|
|
142
143
|
<br />
|
|
143
144
|
<br />
|
|
144
145
|
<hr />
|
|
145
|
-
<Switch loading disabled />
|
|
146
|
+
<Switch loading disabled aria-label='power-switch'/>
|
|
146
147
|
<br />
|
|
147
148
|
<br />
|
|
148
|
-
<Switch loading disabled defaultChecked />
|
|
149
|
+
<Switch loading disabled defaultChecked aria-label='power-switch'/>
|
|
149
150
|
<br />
|
|
150
151
|
<br />
|
|
151
152
|
</>
|
|
@@ -13,9 +13,9 @@ const stories = storiesOf('Switch', module);
|
|
|
13
13
|
|
|
14
14
|
stories.add('switch', () => (
|
|
15
15
|
<div>
|
|
16
|
-
<Switch onChange={(v, e) => console.log(v)}>
|
|
16
|
+
<Switch onChange={(v, e) => console.log(v)} aria-label='power-switch'>
|
|
17
17
|
</Switch>
|
|
18
|
-
<Switch defaultChecked={true} onChange={(v, e) => console.log(v)}>
|
|
18
|
+
<Switch defaultChecked={true} onChange={(v, e) => console.log(v)} aria-label='power-switch'>
|
|
19
19
|
</Switch>
|
|
20
20
|
</div>
|
|
21
21
|
));
|
|
@@ -24,24 +24,24 @@ stories.add('switch', () => (
|
|
|
24
24
|
stories.add('switch size', () => (
|
|
25
25
|
<div>
|
|
26
26
|
<Switch onChange={(v, e) => console.log(v)}></Switch>
|
|
27
|
-
<Switch onChange={(v, e) => console.log(v)} size='small'></Switch>
|
|
28
|
-
<Switch onChange={(v, e) => console.log(v)} size='large'></Switch>
|
|
27
|
+
<Switch onChange={(v, e) => console.log(v)} size='small' aria-label='power-switch'></Switch>
|
|
28
|
+
<Switch onChange={(v, e) => console.log(v)} size='large' aria-label='power-switch'></Switch>
|
|
29
29
|
</div>
|
|
30
30
|
));
|
|
31
31
|
|
|
32
32
|
stories.add('switch checkedText & uncheckedText', () => (
|
|
33
33
|
<div>
|
|
34
|
-
<Switch defaultChecked checkedText='开' uncheckedText='关' />
|
|
34
|
+
<Switch defaultChecked checkedText='开' uncheckedText='关' aria-label='power-switch'/>
|
|
35
35
|
<Switch checkedText={'|'} uncheckedText='〇' />
|
|
36
36
|
<br/><br/>
|
|
37
37
|
<Switch checkedText='开' uncheckedText='关' />
|
|
38
|
-
<Switch defaultChecked
|
|
38
|
+
<Switch defaultChecked checkedText='|' uncheckedText='〇' aria-label='power-switch'/>
|
|
39
39
|
<br/><br/>
|
|
40
|
-
<Switch checkedText='开' uncheckedText='关' size='large' />
|
|
41
|
-
<Switch
|
|
40
|
+
<Switch checkedText='开' uncheckedText='关' size='large' aria-label='power-switch'/>
|
|
41
|
+
<Switch checkedText='|' uncheckedText='〇' size='large' aria-label='power-switch'/>
|
|
42
42
|
<br/><br/>
|
|
43
|
-
<Switch defaultChecked checkedText='开' uncheckedText='关' size='large' />
|
|
44
|
-
<Switch defaultChecked checkedText='|' uncheckedText='〇' size='large' />
|
|
43
|
+
<Switch defaultChecked checkedText='开' uncheckedText='关' size='large' aria-label='power-switch'/>
|
|
44
|
+
<Switch defaultChecked checkedText='|' uncheckedText='〇' size='large' aria-label='power-switch'/>
|
|
45
45
|
</div>
|
|
46
46
|
));
|
|
47
47
|
|
|
@@ -51,7 +51,7 @@ stories.add('switch disabled', () => (
|
|
|
51
51
|
disabled
|
|
52
52
|
</Switch>
|
|
53
53
|
|
|
54
|
-
<Switch disabled checked={true} onChange={(v, e) => console.log(v)}>
|
|
54
|
+
<Switch disabled checked={true} onChange={(v, e) => console.log(v)} aria-label='power-switch'>
|
|
55
55
|
</Switch>
|
|
56
56
|
</>
|
|
57
57
|
));
|
|
@@ -79,8 +79,8 @@ const UnControledSwitch = () => {
|
|
|
79
79
|
stories.add('switch defaultChecked + onChange', () => <UnControledSwitch/>);
|
|
80
80
|
|
|
81
81
|
class LoadingDemo extends React.Component {
|
|
82
|
-
constructor() {
|
|
83
|
-
super()
|
|
82
|
+
constructor(props) {
|
|
83
|
+
super(props);
|
|
84
84
|
this.state = {
|
|
85
85
|
checked: true,
|
|
86
86
|
loading:false
|
package/switch/index.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* eslint-disable max-len */
|
|
1
|
+
/* eslint-disable max-len, jsx-a11y/role-supports-aria-props */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import cls from 'classnames';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
@@ -9,8 +9,12 @@ import '@douyinfe/semi-foundation/switch/switch.scss';
|
|
|
9
9
|
|
|
10
10
|
import { noop } from 'lodash';
|
|
11
11
|
import Spin from '../spin';
|
|
12
|
-
|
|
13
12
|
export interface SwitchProps {
|
|
13
|
+
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
14
|
+
'aria-describedby'?: React.AriaAttributes['aria-describedby'];
|
|
15
|
+
'aria-errormessage'?: React.AriaAttributes['aria-errormessage'];
|
|
16
|
+
'aria-invalid'?: React.AriaAttributes['aria-invalid'];
|
|
17
|
+
'aria-labelledby'?: React.AriaAttributes['aria-labelledby'];
|
|
14
18
|
defaultChecked?: boolean;
|
|
15
19
|
checked?: boolean;
|
|
16
20
|
disabled?: boolean;
|
|
@@ -23,7 +27,8 @@ export interface SwitchProps {
|
|
|
23
27
|
size?: 'large' | 'default' | 'small';
|
|
24
28
|
checkedText?: React.ReactNode;
|
|
25
29
|
uncheckedText?: React.ReactNode;
|
|
26
|
-
|
|
30
|
+
id?: string;
|
|
31
|
+
}
|
|
27
32
|
|
|
28
33
|
export interface SwitchState {
|
|
29
34
|
nativeControlChecked: boolean;
|
|
@@ -32,6 +37,11 @@ export interface SwitchState {
|
|
|
32
37
|
|
|
33
38
|
class Switch extends BaseComponent<SwitchProps, SwitchState> {
|
|
34
39
|
static propTypes = {
|
|
40
|
+
'aria-label': PropTypes.string,
|
|
41
|
+
'aria-labelledby': PropTypes.string,
|
|
42
|
+
'aria-invalid': PropTypes.bool,
|
|
43
|
+
'aria-errormessage': PropTypes.string,
|
|
44
|
+
'aria-describedby': PropTypes.string,
|
|
35
45
|
className: PropTypes.string,
|
|
36
46
|
checked: PropTypes.bool,
|
|
37
47
|
checkedText: PropTypes.node,
|
|
@@ -44,6 +54,7 @@ class Switch extends BaseComponent<SwitchProps, SwitchState> {
|
|
|
44
54
|
style: PropTypes.object,
|
|
45
55
|
size: PropTypes.oneOf<SwitchProps['size']>(strings.SIZE_MAP),
|
|
46
56
|
uncheckedText: PropTypes.node,
|
|
57
|
+
id: PropTypes.string,
|
|
47
58
|
};
|
|
48
59
|
|
|
49
60
|
static defaultProps: Partial<SwitchProps> = {
|
|
@@ -102,7 +113,7 @@ class Switch extends BaseComponent<SwitchProps, SwitchState> {
|
|
|
102
113
|
|
|
103
114
|
render() {
|
|
104
115
|
const { nativeControlChecked, nativeControlDisabled } = this.state;
|
|
105
|
-
const { className, style, onMouseEnter, onMouseLeave, size, checkedText, uncheckedText, loading } = this.props;
|
|
116
|
+
const { className, style, onMouseEnter, onMouseLeave, size, checkedText, uncheckedText, loading, id } = this.props;
|
|
106
117
|
const wrapperCls = cls(className, {
|
|
107
118
|
[cssClasses.PREFIX]: true,
|
|
108
119
|
[cssClasses.CHECKED]: nativeControlChecked,
|
|
@@ -130,7 +141,7 @@ class Switch extends BaseComponent<SwitchProps, SwitchState> {
|
|
|
130
141
|
size={size === 'default' ? 'middle' : size}
|
|
131
142
|
/>
|
|
132
143
|
)
|
|
133
|
-
: <div className={cssClasses.KNOB} />
|
|
144
|
+
: <div className={cssClasses.KNOB} aria-hidden={true} />
|
|
134
145
|
}
|
|
135
146
|
{showCheckedText ? (
|
|
136
147
|
<div className={cssClasses.CHECKED_TEXT}>
|
|
@@ -145,6 +156,13 @@ class Switch extends BaseComponent<SwitchProps, SwitchState> {
|
|
|
145
156
|
<input
|
|
146
157
|
{...switchProps}
|
|
147
158
|
ref={this.switchRef}
|
|
159
|
+
id={id}
|
|
160
|
+
aria-checked={nativeControlChecked}
|
|
161
|
+
aria-invalid={this.props['aria-invalid']}
|
|
162
|
+
aria-errormessage={this.props['aria-errormessage']}
|
|
163
|
+
aria-label={this.props['aria-label']}
|
|
164
|
+
aria-labelledby={this.props['aria-labelledby']}
|
|
165
|
+
aria-describedby={this.props["aria-describedby"]}
|
|
148
166
|
onChange={e => this.foundation.handleChange(e.target.checked, e)}
|
|
149
167
|
/>
|
|
150
168
|
</div>
|
package/table/Body/BaseRow.tsx
CHANGED
|
@@ -238,7 +238,7 @@ export default class TableRow extends BaseComponent<BaseRowProps, Record<string,
|
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
if (isExpandedColumn(column) && !displayExpandedColumn) {
|
|
241
|
-
cells.push(<TableCell key={columnIndex} isSection={isSection} />);
|
|
241
|
+
cells.push(<TableCell key={columnIndex} colIndex={columnIndex} isSection={isSection} />);
|
|
242
242
|
} else if (!isScrollbarColumn(column)) {
|
|
243
243
|
const diyProps: { width?: number } = {};
|
|
244
244
|
|
|
@@ -248,6 +248,7 @@ export default class TableRow extends BaseComponent<BaseRowProps, Record<string,
|
|
|
248
248
|
|
|
249
249
|
cells.push(
|
|
250
250
|
<TableCell
|
|
251
|
+
colIndex={columnIndex}
|
|
251
252
|
{...expandableProps}
|
|
252
253
|
{...diyProps}
|
|
253
254
|
hideExpandedColumn={hideExpandedColumn}
|
|
@@ -318,6 +319,10 @@ export default class TableRow extends BaseComponent<BaseRowProps, Record<string,
|
|
|
318
319
|
record,
|
|
319
320
|
hovered,
|
|
320
321
|
expanded,
|
|
322
|
+
expandableRow,
|
|
323
|
+
level,
|
|
324
|
+
expandedRow,
|
|
325
|
+
isSection
|
|
321
326
|
} = this.props;
|
|
322
327
|
|
|
323
328
|
const BodyRow: any = components.body.row;
|
|
@@ -341,9 +346,28 @@ export default class TableRow extends BaseComponent<BaseRowProps, Record<string,
|
|
|
341
346
|
},
|
|
342
347
|
customClassName
|
|
343
348
|
);
|
|
349
|
+
const ariaProps = {};
|
|
350
|
+
if (typeof index === 'number') {
|
|
351
|
+
ariaProps['aria-rowindex'] = index + 1;
|
|
352
|
+
}
|
|
353
|
+
if (expandableRow) {
|
|
354
|
+
ariaProps['aria-expanded'] = expanded;
|
|
355
|
+
}
|
|
356
|
+
// if row is expandedRow, set it's level to 2
|
|
357
|
+
if (expanded || expandedRow) {
|
|
358
|
+
ariaProps['aria-level'] = 2;
|
|
359
|
+
}
|
|
360
|
+
if (typeof level === 'number') {
|
|
361
|
+
ariaProps['aria-level'] = level + 1;
|
|
362
|
+
}
|
|
363
|
+
if (isSection) {
|
|
364
|
+
ariaProps['aria-level'] = 1;
|
|
365
|
+
}
|
|
344
366
|
|
|
345
367
|
return (
|
|
346
368
|
<BodyRow
|
|
369
|
+
role="row"
|
|
370
|
+
{...ariaProps}
|
|
347
371
|
{...rowProps}
|
|
348
372
|
style={baseRowStyle}
|
|
349
373
|
className={rowCls}
|
package/table/Body/index.tsx
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/* eslint-disable max-len */
|
|
4
4
|
import React, { ReactNode } from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { get, size, isMap, each, isEqual, pick, isNull } from 'lodash';
|
|
6
|
+
import { get, size, isMap, each, isEqual, pick, isNull, isFunction } from 'lodash';
|
|
7
7
|
import classnames from 'classnames';
|
|
8
8
|
import { VariableSizeList as List } from 'react-window';
|
|
9
9
|
|
|
@@ -15,7 +15,8 @@ import {
|
|
|
15
15
|
isDisabled,
|
|
16
16
|
getRecord,
|
|
17
17
|
genExpandedRowKey,
|
|
18
|
-
getDefaultVirtualizedRowConfig
|
|
18
|
+
getDefaultVirtualizedRowConfig,
|
|
19
|
+
isTreeTable
|
|
19
20
|
} from '@douyinfe/semi-foundation/table/utils';
|
|
20
21
|
import BodyFoundation, { BodyAdapter, FlattenData, GroupFlattenData } from '@douyinfe/semi-foundation/table/bodyFoundation';
|
|
21
22
|
import { strings } from '@douyinfe/semi-foundation/table/constants';
|
|
@@ -730,6 +731,7 @@ class Body extends BaseComponent<BodyProps, BodyState> {
|
|
|
730
731
|
dataSource,
|
|
731
732
|
onScroll,
|
|
732
733
|
groups,
|
|
734
|
+
expandedRowRender,
|
|
733
735
|
} = this.props;
|
|
734
736
|
|
|
735
737
|
const x = get(scroll, 'x');
|
|
@@ -775,6 +777,9 @@ class Body extends BaseComponent<BodyProps, BodyState> {
|
|
|
775
777
|
onScroll={handleBodyScroll}
|
|
776
778
|
>
|
|
777
779
|
<Table
|
|
780
|
+
role={ isMap(groups) || isFunction(expandedRowRender) || isTreeTable({ dataSource }) ? 'treegrid' : 'grid'}
|
|
781
|
+
aria-rowcount={dataSource && dataSource.length}
|
|
782
|
+
aria-colcount={columns && columns.length}
|
|
778
783
|
style={tableStyle}
|
|
779
784
|
className={classnames(prefixCls, {
|
|
780
785
|
[`${prefixCls}-fixed`]: anyColumnFixed,
|
package/table/ColumnFilter.tsx
CHANGED
|
@@ -164,7 +164,13 @@ export default function ColumnFilter(props: ColumnFilterProps = {}): React.React
|
|
|
164
164
|
} else {
|
|
165
165
|
iconElem = (
|
|
166
166
|
<div className={finalCls}>
|
|
167
|
-
<IconFilter
|
|
167
|
+
<IconFilter
|
|
168
|
+
role="button"
|
|
169
|
+
aria-label="Filter data with this column"
|
|
170
|
+
aria-haspopup="listbox"
|
|
171
|
+
tabIndex={-1}
|
|
172
|
+
size="small"
|
|
173
|
+
/>
|
|
168
174
|
</div>
|
|
169
175
|
);
|
|
170
176
|
}
|
|
@@ -20,6 +20,7 @@ export interface TableSelectionCellProps {
|
|
|
20
20
|
indeterminate?: boolean; // Intermediate state, shown as a solid horizontal line
|
|
21
21
|
prefixCls?: string;
|
|
22
22
|
className?: string;
|
|
23
|
+
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
/**
|
|
@@ -36,6 +37,7 @@ export default class TableSelectionCell extends BaseComponent<TableSelectionCell
|
|
|
36
37
|
indeterminate: PropTypes.bool,
|
|
37
38
|
prefixCls: PropTypes.string,
|
|
38
39
|
className: PropTypes.string,
|
|
40
|
+
'aria-label': PropTypes.string,
|
|
39
41
|
};
|
|
40
42
|
|
|
41
43
|
static defaultProps = {
|
|
@@ -60,6 +62,7 @@ export default class TableSelectionCell extends BaseComponent<TableSelectionCell
|
|
|
60
62
|
|
|
61
63
|
render() {
|
|
62
64
|
const { selected, getCheckboxProps, indeterminate, disabled, prefixCls, className } = this.props;
|
|
65
|
+
const ariaLabel = this.props['aria-label'];
|
|
63
66
|
let checkboxProps = {
|
|
64
67
|
onChange: this.handleChange,
|
|
65
68
|
disabled,
|
|
@@ -81,7 +84,7 @@ export default class TableSelectionCell extends BaseComponent<TableSelectionCell
|
|
|
81
84
|
|
|
82
85
|
return (
|
|
83
86
|
<span className={wrapCls}>
|
|
84
|
-
<Checkbox {...checkboxProps} />
|
|
87
|
+
<Checkbox aria-label={ariaLabel} {...checkboxProps} />
|
|
85
88
|
</span>
|
|
86
89
|
);
|
|
87
90
|
}
|
package/table/ColumnSorter.tsx
CHANGED
|
@@ -7,6 +7,7 @@ import { IconCaretup, IconCaretdown } from '@douyinfe/semi-icons';
|
|
|
7
7
|
import { cssClasses, strings } from '@douyinfe/semi-foundation/table/constants';
|
|
8
8
|
|
|
9
9
|
import { SortOrder } from './interface';
|
|
10
|
+
import isEnterPress from '@douyinfe/semi-foundation/utils/isEnterPress';
|
|
10
11
|
|
|
11
12
|
export interface ColumnSorterProps {
|
|
12
13
|
className?: string;
|
|
@@ -43,9 +44,25 @@ export default class ColumnSorter extends PureComponent<ColumnSorterProps> {
|
|
|
43
44
|
const downCls = cls(`${prefixCls}-column-sorter-down`, {
|
|
44
45
|
on: sortOrder === strings.SORT_DIRECTIONS[1],
|
|
45
46
|
});
|
|
47
|
+
const ariaProps = {
|
|
48
|
+
/**
|
|
49
|
+
* Set 'aria-sort' to aria-columnheader is difficult, so set 'aria-label' about sort info to sorter
|
|
50
|
+
* reference: https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaSort
|
|
51
|
+
*/
|
|
52
|
+
'aria-label': `Current sort order is ${sortOrder ? `${sortOrder}ing` : 'none'}`,
|
|
53
|
+
'aria-roledescription': 'Sort data with this column',
|
|
54
|
+
};
|
|
46
55
|
|
|
47
56
|
return (
|
|
48
|
-
<div
|
|
57
|
+
<div
|
|
58
|
+
role='button'
|
|
59
|
+
{...ariaProps}
|
|
60
|
+
tabIndex={-1}
|
|
61
|
+
style={style}
|
|
62
|
+
className={`${prefixCls}-column-sorter`}
|
|
63
|
+
onClick={onClick}
|
|
64
|
+
onKeyPress={e => isEnterPress(e) && onClick(e as any)}
|
|
65
|
+
>
|
|
49
66
|
<span className={`${upCls}`}>
|
|
50
67
|
<IconCaretup size={iconBtnSize} />
|
|
51
68
|
</span>
|