@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
|
@@ -30,12 +30,12 @@ export const Warning = () => <Button type="warning">hello button</Button>;
|
|
|
30
30
|
|
|
31
31
|
export const WithIcon = () => (
|
|
32
32
|
<>
|
|
33
|
-
<Button icon={<IconTick />}>hello button</Button>
|
|
33
|
+
<Button aria-label='Button demo' icon={<IconTick />}>hello button</Button>
|
|
34
34
|
<br />
|
|
35
|
-
<Button icon={<IconEdit />} noHorizontalPadding={false} ghost={false}>
|
|
35
|
+
<Button aria-label='Button demo' icon={<IconEdit />} noHorizontalPadding={false} ghost={false}>
|
|
36
36
|
Edit me
|
|
37
37
|
</Button>
|
|
38
|
-
<Button icon={<IconUser />} />
|
|
38
|
+
<Button aria-label='Button demo' icon={<IconUser />} />
|
|
39
39
|
</>
|
|
40
40
|
);
|
|
41
41
|
|
|
@@ -57,34 +57,34 @@ export const CombinationShow = withPropsCombinations(
|
|
|
57
57
|
|
|
58
58
|
export const ButtonGroupDemo = () => (
|
|
59
59
|
<div>
|
|
60
|
-
<ButtonGroup disabled>
|
|
60
|
+
<ButtonGroup aria-label='ButtonGroup demo' disabled>
|
|
61
61
|
<Button>复制</Button>
|
|
62
62
|
<Button type="primary">查找</Button>
|
|
63
63
|
<Button type="danger">粘贴</Button>
|
|
64
64
|
</ButtonGroup>
|
|
65
65
|
<br />
|
|
66
|
-
<ButtonGroup>
|
|
66
|
+
<ButtonGroup aria-label='ButtonGroup demo'>
|
|
67
67
|
<Button icon={<IconCopy />} theme={'solid'} />
|
|
68
68
|
<Button icon={<IconSearch />} theme={'solid'} />
|
|
69
69
|
<Button icon={<IconPlay />} theme={'solid'} />
|
|
70
70
|
</ButtonGroup>
|
|
71
71
|
<br />
|
|
72
72
|
|
|
73
|
-
<ButtonGroup size={'large'}>
|
|
73
|
+
<ButtonGroup size={'large'} aria-label='ButtonGroup demo'>
|
|
74
74
|
<Button icon={<IconCopy />} theme={'solid'} />
|
|
75
75
|
<Button icon={<IconSearch />} theme={'solid'} />
|
|
76
76
|
<Button icon={<IconPlay />} theme={'solid'} />
|
|
77
77
|
</ButtonGroup>
|
|
78
78
|
<br />
|
|
79
79
|
|
|
80
|
-
<ButtonGroup size={'small'}>
|
|
80
|
+
<ButtonGroup size={'small'} aria-label='ButtonGroup demo'>
|
|
81
81
|
<Button icon={<IconCopy />} theme={'solid'} />
|
|
82
82
|
<Button icon={<IconSearch />} theme={'solid'} />
|
|
83
83
|
<Button icon={<IconPlay />} theme={'solid'} />
|
|
84
84
|
</ButtonGroup>
|
|
85
85
|
<br />
|
|
86
86
|
|
|
87
|
-
<ButtonGroup>
|
|
87
|
+
<ButtonGroup aria-label='ButtonGroup demo'>
|
|
88
88
|
<Button icon={<IconCopy />} theme={'solid'}>
|
|
89
89
|
拷贝
|
|
90
90
|
</Button>
|
|
@@ -97,7 +97,7 @@ export const ButtonGroupDemo = () => (
|
|
|
97
97
|
</ButtonGroup>
|
|
98
98
|
<br />
|
|
99
99
|
|
|
100
|
-
<ButtonGroup size={'large'}>
|
|
100
|
+
<ButtonGroup size={'large'} aria-label='ButtonGroup demo'>
|
|
101
101
|
<Button icon={<IconCopy />} theme={'solid'}>
|
|
102
102
|
拷贝
|
|
103
103
|
</Button>
|
|
@@ -110,7 +110,7 @@ export const ButtonGroupDemo = () => (
|
|
|
110
110
|
</ButtonGroup>
|
|
111
111
|
<br />
|
|
112
112
|
|
|
113
|
-
<ButtonGroup size={'small'}>
|
|
113
|
+
<ButtonGroup size={'small'} aria-label='ButtonGroup demo'>
|
|
114
114
|
<Button icon={<IconCopy />} theme={'solid'}>
|
|
115
115
|
拷贝
|
|
116
116
|
</Button>
|
package/button/buttonGroup.tsx
CHANGED
|
@@ -13,6 +13,7 @@ export interface ButtonGroupProps extends BaseProps {
|
|
|
13
13
|
type?: Type;
|
|
14
14
|
size?: Size;
|
|
15
15
|
theme?: Theme;
|
|
16
|
+
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
const prefixCls = cssClasses.PREFIX;
|
|
@@ -25,6 +26,7 @@ export default class ButtonGroup extends BaseComponent<ButtonGroupProps> {
|
|
|
25
26
|
type: PropTypes.string,
|
|
26
27
|
size: PropTypes.oneOf(btnSizes),
|
|
27
28
|
theme: PropTypes.oneOf(strings.themes),
|
|
29
|
+
'aria-label': PropTypes.string,
|
|
28
30
|
};
|
|
29
31
|
|
|
30
32
|
static defaultProps = {
|
|
@@ -34,7 +36,7 @@ export default class ButtonGroup extends BaseComponent<ButtonGroupProps> {
|
|
|
34
36
|
};
|
|
35
37
|
|
|
36
38
|
render() {
|
|
37
|
-
const { children, disabled, size, type, ...rest } = this.props;
|
|
39
|
+
const { children, disabled, size, type, 'aria-label': ariaLabel, ...rest } = this.props;
|
|
38
40
|
let inner;
|
|
39
41
|
|
|
40
42
|
if (children) {
|
|
@@ -44,6 +46,6 @@ export default class ButtonGroup extends BaseComponent<ButtonGroupProps> {
|
|
|
44
46
|
: itm
|
|
45
47
|
));
|
|
46
48
|
}
|
|
47
|
-
return <div className={`${prefixCls}-group`}>{inner}</div>;
|
|
49
|
+
return <div className={`${prefixCls}-group`} role="group" aria-label={ariaLabel}>{inner}</div>;
|
|
48
50
|
}
|
|
49
51
|
}
|
|
@@ -8,18 +8,21 @@ import BaseComponent, { BaseProps } from '../_base/baseComponent';
|
|
|
8
8
|
const prefixCls = cssClasses.PREFIX;
|
|
9
9
|
|
|
10
10
|
// eslint-disable-next-line
|
|
11
|
-
export interface SplitButtonGroupProps extends BaseProps {
|
|
11
|
+
export interface SplitButtonGroupProps extends BaseProps {
|
|
12
|
+
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
13
|
+
}
|
|
12
14
|
|
|
13
15
|
export default class SplitButtonGroup extends BaseComponent<SplitButtonGroupProps> {
|
|
14
16
|
static propTypes = {
|
|
15
17
|
style: PropTypes.object,
|
|
16
18
|
className: PropTypes.string,
|
|
19
|
+
'aria-label': PropTypes.string,
|
|
17
20
|
};
|
|
18
21
|
render() {
|
|
19
22
|
const { children, style, className } = this.props;
|
|
20
23
|
const cls = classNames(`${prefixCls}-split`, className);
|
|
21
24
|
return (
|
|
22
|
-
<div className={cls} style={style}>
|
|
25
|
+
<div className={cls} style={style} role="group" aria-label={this.props['aria-label']}>
|
|
23
26
|
{children}
|
|
24
27
|
</div>
|
|
25
28
|
);
|
|
@@ -36,6 +36,7 @@ export const Default = () => (
|
|
|
36
36
|
style={{
|
|
37
37
|
width: 360,
|
|
38
38
|
}}
|
|
39
|
+
aria-label='basic card'
|
|
39
40
|
headerExtraContent={<Text link={{}}>更多</Text>}
|
|
40
41
|
>
|
|
41
42
|
Semi Design 是由互娱社区前端团队与 UED
|
|
@@ -129,6 +130,7 @@ export function Simple() {
|
|
|
129
130
|
avatar={
|
|
130
131
|
<Avatar
|
|
131
132
|
size="default"
|
|
133
|
+
alt="Card meta avatar"
|
|
132
134
|
src="https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/card-meta-avatar-docs-demo.jpg"
|
|
133
135
|
/>
|
|
134
136
|
}
|
|
@@ -233,6 +235,7 @@ export const MetaDemo = () => (
|
|
|
233
235
|
description="全面、易用、优质"
|
|
234
236
|
avatar={
|
|
235
237
|
<Avatar
|
|
238
|
+
alt="Card meta avatar"
|
|
236
239
|
size="default"
|
|
237
240
|
src="https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/card-meta-avatar-docs-demo.jpg"
|
|
238
241
|
/>
|
|
@@ -335,12 +338,13 @@ export function Loading() {
|
|
|
335
338
|
const { Title, Paragraph, Image } = Skeleton;
|
|
336
339
|
return (
|
|
337
340
|
<Space vertical align="start" spacing="medium">
|
|
338
|
-
<Switch onChange={v => setLoading(!v)} />
|
|
341
|
+
<Switch onChange={v => setLoading(!v)} aria-label='switch card loading status'/>
|
|
339
342
|
<Card
|
|
340
343
|
style={{
|
|
341
344
|
width: 360,
|
|
342
345
|
}}
|
|
343
346
|
loading={loading}
|
|
347
|
+
aria-busy={loading}
|
|
344
348
|
>
|
|
345
349
|
<Meta title="Semi Doc" description="全面、易用、优质" />
|
|
346
350
|
</Card>
|
|
@@ -451,6 +455,7 @@ export const Actions = () => (
|
|
|
451
455
|
avatar={
|
|
452
456
|
<Avatar
|
|
453
457
|
size="default"
|
|
458
|
+
alt="Card meta avatar"
|
|
454
459
|
src="https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/card-meta-avatar-docs-demo.jpg"
|
|
455
460
|
/>
|
|
456
461
|
}
|
|
@@ -485,6 +490,7 @@ export const Actions = () => (
|
|
|
485
490
|
description="全面、易用、优质"
|
|
486
491
|
avatar={
|
|
487
492
|
<Avatar
|
|
493
|
+
alt="Card meta avatar"
|
|
488
494
|
size="default"
|
|
489
495
|
src="https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/card-meta-avatar-docs-demo.jpg"
|
|
490
496
|
/>
|
|
@@ -515,6 +521,7 @@ export const CardGroupDemo = () => (
|
|
|
515
521
|
description="全面、易用、优质"
|
|
516
522
|
avatar={
|
|
517
523
|
<Avatar
|
|
524
|
+
alt="Card meta avatar"
|
|
518
525
|
size="default"
|
|
519
526
|
src="https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/card-meta-avatar-docs-demo.jpg"
|
|
520
527
|
/>
|
|
@@ -21,6 +21,7 @@ stories.add('default', () => (
|
|
|
21
21
|
avatar={
|
|
22
22
|
<Avatar
|
|
23
23
|
size="default"
|
|
24
|
+
alt="example"
|
|
24
25
|
src='https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/card-meta-avatar-docs-demo.jpg'
|
|
25
26
|
/>
|
|
26
27
|
}
|
|
@@ -48,6 +49,7 @@ stories.add('default', () => (
|
|
|
48
49
|
description="全面、易用、优质"
|
|
49
50
|
avatar={
|
|
50
51
|
<Avatar
|
|
52
|
+
alt="example"
|
|
51
53
|
size="default"
|
|
52
54
|
src='https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/card-meta-avatar-docs-demo.jpg'
|
|
53
55
|
/>
|
|
@@ -76,6 +78,7 @@ stories.add('default', () => (
|
|
|
76
78
|
description="全面、易用、优质"
|
|
77
79
|
avatar={
|
|
78
80
|
<Avatar
|
|
81
|
+
alt='example'
|
|
79
82
|
size="default"
|
|
80
83
|
src='https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/card-meta-avatar-docs-demo.jpg'
|
|
81
84
|
/>
|
package/card/index.tsx
CHANGED
|
@@ -50,6 +50,8 @@ export interface CardProps {
|
|
|
50
50
|
style?: CSSProperties;
|
|
51
51
|
/** Title */
|
|
52
52
|
title?: ReactNode;
|
|
53
|
+
/** aria label */
|
|
54
|
+
'aria-label'?: string;
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
|
|
@@ -73,7 +75,8 @@ class Card extends PureComponent<CardProps> {
|
|
|
73
75
|
loading: PropTypes.bool,
|
|
74
76
|
shadows: PropTypes.oneOf(strings.SHADOWS),
|
|
75
77
|
style: PropTypes.object,
|
|
76
|
-
title: PropTypes.node
|
|
78
|
+
title: PropTypes.node,
|
|
79
|
+
'aria-label': PropTypes.string,
|
|
77
80
|
};
|
|
78
81
|
|
|
79
82
|
static defaultProps = {
|
|
@@ -230,7 +233,7 @@ class Card extends PureComponent<CardProps> {
|
|
|
230
233
|
});
|
|
231
234
|
|
|
232
235
|
return (
|
|
233
|
-
<div {...others} className={cardCls} style={style}>
|
|
236
|
+
<div {...others} aria-busy={this.props.loading} className={cardCls} style={style}>
|
|
234
237
|
{this.renderHeader()}
|
|
235
238
|
{this.renderCover()}
|
|
236
239
|
{this.renderBody()}
|
package/cascader/index.tsx
CHANGED
|
@@ -49,6 +49,11 @@ export type SimpleValueType = string | number | CascaderData;
|
|
|
49
49
|
export type Value = SimpleValueType | Array<SimpleValueType> | Array<Array<SimpleValueType>>;
|
|
50
50
|
|
|
51
51
|
export interface CascaderProps extends BasicCascaderProps {
|
|
52
|
+
'aria-describedby'?: React.AriaAttributes['aria-describedby'];
|
|
53
|
+
'aria-errormessage'?: React.AriaAttributes['aria-errormessage'];
|
|
54
|
+
'aria-invalid'?: React.AriaAttributes['aria-invalid'];
|
|
55
|
+
'aria-labelledby'?: React.AriaAttributes['aria-labelledby'];
|
|
56
|
+
'aria-required'?: React.AriaAttributes['aria-required'];
|
|
52
57
|
arrowIcon?: ReactNode;
|
|
53
58
|
defaultValue?: Value;
|
|
54
59
|
dropdownStyle?: CSSProperties;
|
|
@@ -60,7 +65,9 @@ export interface CascaderProps extends BasicCascaderProps {
|
|
|
60
65
|
value?: Value;
|
|
61
66
|
prefix?: ReactNode;
|
|
62
67
|
suffix?: ReactNode;
|
|
68
|
+
id?: string;
|
|
63
69
|
insetLabel?: ReactNode;
|
|
70
|
+
insetLabelId?: string;
|
|
64
71
|
style?: CSSProperties;
|
|
65
72
|
bottomSlot?: ReactNode;
|
|
66
73
|
topSlot?: ReactNode;
|
|
@@ -88,6 +95,11 @@ const resetkey = 0;
|
|
|
88
95
|
class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
89
96
|
static contextType = ConfigContext;
|
|
90
97
|
static propTypes = {
|
|
98
|
+
'aria-labelledby': PropTypes.string,
|
|
99
|
+
'aria-invalid': PropTypes.bool,
|
|
100
|
+
'aria-errormessage': PropTypes.string,
|
|
101
|
+
'aria-describedby': PropTypes.string,
|
|
102
|
+
'aria-required': PropTypes.bool,
|
|
91
103
|
arrowIcon: PropTypes.node,
|
|
92
104
|
changeOnSelect: PropTypes.bool,
|
|
93
105
|
defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
|
|
@@ -114,6 +126,8 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
114
126
|
suffix: PropTypes.node,
|
|
115
127
|
prefix: PropTypes.node,
|
|
116
128
|
insetLabel: PropTypes.node,
|
|
129
|
+
insetLabelId: PropTypes.string,
|
|
130
|
+
id: PropTypes.string,
|
|
117
131
|
displayProp: PropTypes.string,
|
|
118
132
|
displayRender: PropTypes.func,
|
|
119
133
|
onChange: PropTypes.func,
|
|
@@ -610,7 +624,7 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
610
624
|
const popoverCls = cls(dropdownClassName, `${prefixcls}-popover`);
|
|
611
625
|
const renderData = this.foundation.getRenderData();
|
|
612
626
|
const content = (
|
|
613
|
-
<div className={popoverCls} role="
|
|
627
|
+
<div className={popoverCls} role="listbox" style={dropdownStyle}>
|
|
614
628
|
{topSlot}
|
|
615
629
|
<Item
|
|
616
630
|
activeKeys={activeKeys}
|
|
@@ -726,7 +740,7 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
726
740
|
};
|
|
727
741
|
|
|
728
742
|
renderPrefix = () => {
|
|
729
|
-
const { prefix, insetLabel } = this.props;
|
|
743
|
+
const { prefix, insetLabel, insetLabelId } = this.props;
|
|
730
744
|
const labelNode: any = prefix || insetLabel;
|
|
731
745
|
|
|
732
746
|
const prefixWrapperCls = cls({
|
|
@@ -737,7 +751,7 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
737
751
|
[`${prefixcls}-prefix-icon`]: isSemiIcon(labelNode),
|
|
738
752
|
});
|
|
739
753
|
|
|
740
|
-
return <div className={prefixWrapperCls}>{labelNode}</div>;
|
|
754
|
+
return <div className={prefixWrapperCls} id={insetLabelId}>{labelNode}</div>;
|
|
741
755
|
};
|
|
742
756
|
|
|
743
757
|
renderCustomTrigger = () => {
|
|
@@ -794,7 +808,7 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
794
808
|
const allowClear = this.showClearBtn();
|
|
795
809
|
if (allowClear) {
|
|
796
810
|
return (
|
|
797
|
-
<div className={clearCls} onClick={this.handleClear}>
|
|
811
|
+
<div className={clearCls} onClick={this.handleClear} role='button' tabIndex={0}>
|
|
798
812
|
<IconClear />
|
|
799
813
|
</div>
|
|
800
814
|
);
|
|
@@ -825,6 +839,7 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
825
839
|
insetLabel,
|
|
826
840
|
triggerRender,
|
|
827
841
|
showClear,
|
|
842
|
+
id,
|
|
828
843
|
} = this.props;
|
|
829
844
|
const { isOpen, isFocus, isInput, checkedKeys } = this.state;
|
|
830
845
|
const filterable = Boolean(filterTreeNode);
|
|
@@ -863,14 +878,27 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
863
878
|
<Fragment key={'suffix'}>{suffix ? this.renderSuffix() : null}</Fragment>,
|
|
864
879
|
<Fragment key={'arrow'}>{this.renderArrow()}</Fragment>,
|
|
865
880
|
];
|
|
866
|
-
|
|
881
|
+
/**
|
|
882
|
+
* Reasons for disabling the a11y eslint rule:
|
|
883
|
+
* The following attributes(aria-controls,aria-expanded) will be automatically added by Tooltip, no need to declare here
|
|
884
|
+
*/
|
|
867
885
|
return (
|
|
868
886
|
<div
|
|
869
887
|
className={classNames}
|
|
870
888
|
style={style}
|
|
871
889
|
ref={this.triggerRef}
|
|
872
890
|
onClick={e => this.foundation.handleClick(e)}
|
|
891
|
+
aria-invalid={this.props['aria-invalid']}
|
|
892
|
+
aria-errormessage={this.props['aria-errormessage']}
|
|
893
|
+
aria-label={this.props['aria-label']}
|
|
894
|
+
aria-labelledby={this.props['aria-labelledby']}
|
|
895
|
+
aria-describedby={this.props["aria-describedby"]}
|
|
896
|
+
aria-required={this.props['aria-required']}
|
|
897
|
+
id={id}
|
|
873
898
|
{...mouseEvent}
|
|
899
|
+
// eslint-disable-next-line jsx-a11y/role-has-required-aria-props
|
|
900
|
+
role='combobox'
|
|
901
|
+
tabIndex={0}
|
|
874
902
|
>
|
|
875
903
|
{inner}
|
|
876
904
|
</div>
|
|
@@ -7,6 +7,7 @@ import Checkbox from '../index';
|
|
|
7
7
|
import CheckboxGroup from '../checkboxGroup';
|
|
8
8
|
import { Col, Input, Row } from '../../index';
|
|
9
9
|
import { IconClose } from '@douyinfe/semi-icons';
|
|
10
|
+
import { getUuidShort } from '@douyinfe/semi-foundation/utils/uuid';
|
|
10
11
|
|
|
11
12
|
export default {
|
|
12
13
|
title: 'Checkbox',
|
|
@@ -37,7 +38,7 @@ export const CheckboxDefault = () => {
|
|
|
37
38
|
export const CheckboxWithoutText = () => {
|
|
38
39
|
return (
|
|
39
40
|
<div>
|
|
40
|
-
<Checkbox onChange={e => console.log(e)} />
|
|
41
|
+
<Checkbox aria-label='选择框示例' onChange={e => console.log(e)} />
|
|
41
42
|
</div>
|
|
42
43
|
);
|
|
43
44
|
};
|
|
@@ -412,6 +413,7 @@ export const CheckboxRenderInDiv = () => (
|
|
|
412
413
|
}}
|
|
413
414
|
>
|
|
414
415
|
<Checkbox
|
|
416
|
+
aria-label='checkbox demo'
|
|
415
417
|
onChange={(...args) => {
|
|
416
418
|
console.log('clicked checkbox: ', ...args);
|
|
417
419
|
}}
|
|
@@ -499,6 +501,7 @@ const TransformSelect = props => {
|
|
|
499
501
|
<div>
|
|
500
502
|
<div>
|
|
501
503
|
<Input
|
|
504
|
+
aria-label='input'
|
|
502
505
|
value={inputValue}
|
|
503
506
|
prefix="search"
|
|
504
507
|
clearable
|
|
@@ -514,6 +517,7 @@ const TransformSelect = props => {
|
|
|
514
517
|
</div>
|
|
515
518
|
<div>
|
|
516
519
|
<CheckboxGroup
|
|
520
|
+
aria-label='checkbox group box'
|
|
517
521
|
options={viewsOptions}
|
|
518
522
|
value={currentValue}
|
|
519
523
|
onChange={onSelectChange}
|
|
@@ -561,7 +565,7 @@ export const BugDemo = () => <TransformSelect />;
|
|
|
561
565
|
export const CheckboxGroupCardStyle = () => (
|
|
562
566
|
<>
|
|
563
567
|
<div>常见情况</div>
|
|
564
|
-
<CheckboxGroup type="card" direction="horizontal" defaultValue={['1']}>
|
|
568
|
+
<CheckboxGroup key={getUuidShort({ prefix: '' })} aria-label='group demo' type="card" direction="horizontal" defaultValue={['1']}>
|
|
565
569
|
<Checkbox value="1" extra="Semi Design" style={{ width: 280 }}>
|
|
566
570
|
多选框标题
|
|
567
571
|
</Checkbox>
|
|
@@ -574,9 +578,9 @@ export const CheckboxGroupCardStyle = () => (
|
|
|
574
578
|
</CheckboxGroup>
|
|
575
579
|
<br />
|
|
576
580
|
<br />
|
|
577
|
-
<div>
|
|
578
|
-
<CheckboxGroup type="card" direction="horizontal" defaultValue={['1']}>
|
|
579
|
-
<Checkbox value="1" disabled extra="
|
|
581
|
+
<div>radio disabled</div>
|
|
582
|
+
<CheckboxGroup key={getUuidShort({ prefix: '' })} aria-label='group demo' type="card" direction="horizontal" defaultValue={['1']}>
|
|
583
|
+
<Checkbox value="1" disabled extra="Semi Design" style={{ width: 280 }}>
|
|
580
584
|
多选框标题
|
|
581
585
|
</Checkbox>
|
|
582
586
|
<Checkbox value="2" disabled extra="disabled+unchecked" style={{ width: 280 }}>
|
|
@@ -589,7 +593,7 @@ export const CheckboxGroupCardStyle = () => (
|
|
|
589
593
|
<br />
|
|
590
594
|
<br />
|
|
591
595
|
<div>checkboxGroup disabled</div>
|
|
592
|
-
<CheckboxGroup type="card" direction="horizontal" disabled defaultValue={['1']}>
|
|
596
|
+
<CheckboxGroup key={getUuidShort({ prefix: '' })} aria-label='group demo' type="card" direction="horizontal" disabled defaultValue={['1']}>
|
|
593
597
|
<Checkbox value="1" extra="Semi Design" style={{ width: 280 }}>
|
|
594
598
|
多选框标题
|
|
595
599
|
</Checkbox>
|
|
@@ -603,7 +607,7 @@ export const CheckboxGroupCardStyle = () => (
|
|
|
603
607
|
<br />
|
|
604
608
|
<br />
|
|
605
609
|
<div>文字很长,并且没有设置宽度,因此换行显示</div>
|
|
606
|
-
<CheckboxGroup type="card" direction="horizontal" defaultValue={['1']}>
|
|
610
|
+
<CheckboxGroup key={getUuidShort({ prefix: '' })} aria-label='group demo' type="card" direction="horizontal" defaultValue={['1']}>
|
|
607
611
|
<Checkbox
|
|
608
612
|
value="1"
|
|
609
613
|
extra="Semi Design 是由互娱社区前端团队与 UED 团队共同设计开发并维护的设计系统"
|
|
@@ -626,7 +630,7 @@ export const CheckboxGroupCardStyle = () => (
|
|
|
626
630
|
<br />
|
|
627
631
|
<br />
|
|
628
632
|
<div>设置了width=180</div>
|
|
629
|
-
<CheckboxGroup type="card" direction="horizontal" defaultValue={['1']}>
|
|
633
|
+
<CheckboxGroup key={getUuidShort({ prefix: '' })} aria-label='group demo' type="card" direction="horizontal" defaultValue={['1']}>
|
|
630
634
|
<Checkbox
|
|
631
635
|
value="1"
|
|
632
636
|
extra="Semi Design 是由互娱社区前端团队与 UED 团队共同设计开发并维护的设计系统"
|
|
@@ -652,7 +656,7 @@ export const CheckboxGroupCardStyle = () => (
|
|
|
652
656
|
<br />
|
|
653
657
|
<br />
|
|
654
658
|
<div>没有extra,width=180</div>
|
|
655
|
-
<CheckboxGroup type="card" direction="horizontal" defaultValue={['1']}>
|
|
659
|
+
<CheckboxGroup key={getUuidShort({ prefix: '' })} aria-label='group demo' type="card" direction="horizontal" defaultValue={['1']}>
|
|
656
660
|
<Checkbox value="1" style={{ width: 180 }}>
|
|
657
661
|
多选框标题
|
|
658
662
|
</Checkbox>
|
|
@@ -666,19 +670,22 @@ export const CheckboxGroupCardStyle = () => (
|
|
|
666
670
|
<br />
|
|
667
671
|
<br />
|
|
668
672
|
<div>没有标题,width=380</div>
|
|
669
|
-
<CheckboxGroup type="card" direction="horizontal" defaultValue={['1']}>
|
|
673
|
+
<CheckboxGroup key={getUuidShort({ prefix: 'test' })} aria-label='group demo' type="card" direction="horizontal" defaultValue={['1']}>
|
|
670
674
|
<Checkbox
|
|
671
675
|
value="1"
|
|
676
|
+
aria-label='checkbox demo'
|
|
672
677
|
extra="Semi Design 是由互娱社区前端团队与 UED 团队共同设计开发并维护的设计系统"
|
|
673
678
|
style={{ width: 380 }}
|
|
674
679
|
></Checkbox>
|
|
675
680
|
<Checkbox
|
|
676
681
|
value="2"
|
|
682
|
+
aria-label='checkbox demo'
|
|
677
683
|
extra="Semi Design 是由互娱社区前端团队与 UED 团队共同设计开发并维护的设计系统"
|
|
678
684
|
style={{ width: 380 }}
|
|
679
685
|
></Checkbox>
|
|
680
686
|
<Checkbox
|
|
681
687
|
value="3"
|
|
688
|
+
aria-label='checkbox demo'
|
|
682
689
|
extra="Semi Design 是由互娱社区前端团队与 UED 团队共同设计开发并维护的设计系统"
|
|
683
690
|
style={{ width: 380 }}
|
|
684
691
|
></Checkbox>
|
|
@@ -688,7 +695,7 @@ export const CheckboxGroupCardStyle = () => (
|
|
|
688
695
|
<hr />
|
|
689
696
|
<div>下面是垂直的情况:</div>
|
|
690
697
|
<div>常见情况</div>
|
|
691
|
-
<CheckboxGroup direction="vertical" type="card" defaultValue={['1']}>
|
|
698
|
+
<CheckboxGroup key={getUuidShort({ prefix: '' })} aria-label='group demo' direction="vertical" type="card" defaultValue={['1']}>
|
|
692
699
|
<Checkbox value="1" extra="Semi Design" style={{ width: 280 }}>
|
|
693
700
|
多选框标题
|
|
694
701
|
</Checkbox>
|
|
@@ -702,7 +709,7 @@ export const CheckboxGroupCardStyle = () => (
|
|
|
702
709
|
<br />
|
|
703
710
|
<br />
|
|
704
711
|
<div>没有设置宽度</div>
|
|
705
|
-
<CheckboxGroup direction="vertical" type="card" defaultValue={['1']}>
|
|
712
|
+
<CheckboxGroup key={getUuidShort({ prefix: '' })} aria-label='group demo' direction="vertical" type="card" defaultValue={['1']}>
|
|
706
713
|
<Checkbox
|
|
707
714
|
value="1"
|
|
708
715
|
extra="Semi Design 是由互娱社区前端团队与 UED 团队共同设计开发并维护的设计系统"
|
|
@@ -725,7 +732,7 @@ export const CheckboxGroupCardStyle = () => (
|
|
|
725
732
|
<br />
|
|
726
733
|
<br />
|
|
727
734
|
<div>设置了width=380</div>
|
|
728
|
-
<CheckboxGroup direction="vertical" type="card" defaultValue={['1']}>
|
|
735
|
+
<CheckboxGroup key={getUuidShort({ prefix: '' })} aria-label='group demo' direction="vertical" type="card" defaultValue={['1']}>
|
|
729
736
|
<Checkbox
|
|
730
737
|
value="1"
|
|
731
738
|
extra="Semi Design 是由互娱社区前端团队与 UED 团队共同设计开发并维护的设计系统"
|
|
@@ -747,7 +754,7 @@ export const CheckboxGroupCardStyle = () => (
|
|
|
747
754
|
>
|
|
748
755
|
多选框标题
|
|
749
756
|
</Checkbox>
|
|
750
|
-
</CheckboxGroup>
|
|
757
|
+
</CheckboxGroup> */}
|
|
751
758
|
</>
|
|
752
759
|
);
|
|
753
760
|
|
package/checkbox/checkbox.tsx
CHANGED
|
@@ -9,16 +9,25 @@ import BaseComponent from '../_base/baseComponent';
|
|
|
9
9
|
import '@douyinfe/semi-foundation/checkbox/checkbox.scss';
|
|
10
10
|
import { Context } from './context';
|
|
11
11
|
import { isUndefined, isBoolean, noop } from 'lodash';
|
|
12
|
+
import { getUuidShort } from '@douyinfe/semi-foundation/utils/uuid';
|
|
12
13
|
export type CheckboxEvent = BasicCheckboxEvent;
|
|
13
14
|
export type TargetObject = BasicTargetObject;
|
|
14
15
|
|
|
15
16
|
export interface CheckboxProps extends BaseCheckboxProps {
|
|
17
|
+
'aria-describedby'?: React.AriaAttributes['aria-describedby'];
|
|
18
|
+
'aria-errormessage'?: React.AriaAttributes['aria-errormessage'];
|
|
19
|
+
'aria-invalid'?: React.AriaAttributes['aria-invalid'];
|
|
20
|
+
'aria-labelledby'?: React.AriaAttributes['aria-labelledby'];
|
|
21
|
+
'aria-required'?: React.AriaAttributes['aria-required'];
|
|
16
22
|
onChange?: (e: CheckboxEvent) => any;
|
|
17
23
|
// TODO, docs
|
|
18
24
|
style?: React.CSSProperties;
|
|
19
25
|
onMouseEnter?: React.MouseEventHandler<HTMLSpanElement>;
|
|
20
26
|
onMouseLeave?: React.MouseEventHandler<HTMLSpanElement>;
|
|
21
27
|
extra?: React.ReactNode;
|
|
28
|
+
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
29
|
+
role?: React.HTMLAttributes<HTMLSpanElement>['role']; // a11y: wrapper role
|
|
30
|
+
tabIndex?: number; // a11y: wrapper tabIndex
|
|
22
31
|
}
|
|
23
32
|
interface CheckboxState {
|
|
24
33
|
checked: boolean;
|
|
@@ -27,6 +36,11 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
27
36
|
static contextType = Context;
|
|
28
37
|
|
|
29
38
|
static propTypes = {
|
|
39
|
+
'aria-describedby': PropTypes.string,
|
|
40
|
+
'aria-errormessage': PropTypes.string,
|
|
41
|
+
'aria-invalid': PropTypes.bool,
|
|
42
|
+
'aria-labelledby': PropTypes.string,
|
|
43
|
+
'aria-required': PropTypes.bool,
|
|
30
44
|
// Specifies whether it is currently selected
|
|
31
45
|
checked: PropTypes.bool,
|
|
32
46
|
// Initial check
|
|
@@ -44,6 +58,9 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
44
58
|
onMouseEnter: PropTypes.func,
|
|
45
59
|
onMouseLeave: PropTypes.func,
|
|
46
60
|
extra: PropTypes.node,
|
|
61
|
+
index: PropTypes.number,
|
|
62
|
+
'aria-label': PropTypes.string,
|
|
63
|
+
tabIndex: PropTypes.number,
|
|
47
64
|
};
|
|
48
65
|
|
|
49
66
|
static defaultProps = {
|
|
@@ -74,6 +91,9 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
74
91
|
};
|
|
75
92
|
}
|
|
76
93
|
|
|
94
|
+
foundation: CheckboxFoundation;
|
|
95
|
+
addonId: string;
|
|
96
|
+
extraId: string;
|
|
77
97
|
constructor(props: CheckboxProps) {
|
|
78
98
|
super(props);
|
|
79
99
|
|
|
@@ -84,6 +104,8 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
84
104
|
};
|
|
85
105
|
|
|
86
106
|
this.checkboxEntity = null;
|
|
107
|
+
this.addonId = getUuidShort({ prefix: 'addon' });
|
|
108
|
+
this.extraId = getUuidShort({ prefix: 'extra' });
|
|
87
109
|
this.foundation = new CheckboxFoundation(this.adapter);
|
|
88
110
|
}
|
|
89
111
|
|
|
@@ -111,6 +133,8 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
111
133
|
|
|
112
134
|
handleChange: React.MouseEventHandler<HTMLSpanElement> = e => this.foundation.handleChange(e);
|
|
113
135
|
|
|
136
|
+
handleEnterPress = (e: React.KeyboardEvent<HTMLSpanElement>) => this.foundation.handleEnterPress(e);
|
|
137
|
+
|
|
114
138
|
render() {
|
|
115
139
|
const {
|
|
116
140
|
disabled,
|
|
@@ -123,7 +147,9 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
123
147
|
onMouseLeave,
|
|
124
148
|
extra,
|
|
125
149
|
value,
|
|
126
|
-
|
|
150
|
+
role,
|
|
151
|
+
tabIndex,
|
|
152
|
+
id
|
|
127
153
|
} = this.props;
|
|
128
154
|
const { checked } = this.state;
|
|
129
155
|
const props: Record<string, any> = {
|
|
@@ -131,7 +157,8 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
131
157
|
disabled,
|
|
132
158
|
};
|
|
133
159
|
|
|
134
|
-
|
|
160
|
+
const inGroup = this.isInGroup();
|
|
161
|
+
if (inGroup) {
|
|
135
162
|
if (this.context.checkboxGroup.value) {
|
|
136
163
|
const realChecked = (this.context.checkboxGroup.value || []).includes(value);
|
|
137
164
|
props.checked = realChecked;
|
|
@@ -163,26 +190,34 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
163
190
|
[`${prefix}-cardType_extra_noChildren`]: props.isCardType && !children,
|
|
164
191
|
});
|
|
165
192
|
|
|
166
|
-
const name =
|
|
193
|
+
const name = inGroup && this.context.checkboxGroup.name;
|
|
167
194
|
|
|
168
195
|
const renderContent = () => (
|
|
169
196
|
<>
|
|
170
|
-
{children ? <span className={`${prefix}-addon`}>{children}</span> : null}
|
|
171
|
-
{extra ? <div className={extraCls}>{extra}</div> : null}
|
|
197
|
+
{children ? <span id={this.addonId} className={`${prefix}-addon`}>{children}</span> : null}
|
|
198
|
+
{extra ? <div id={this.extraId} className={extraCls}>{extra}</div> : null}
|
|
172
199
|
</>
|
|
173
200
|
);
|
|
174
201
|
return (
|
|
202
|
+
// label is better than span, however span is here which is to solve gitlab issue #364
|
|
203
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
175
204
|
<span
|
|
205
|
+
role={role}
|
|
206
|
+
tabIndex={tabIndex}
|
|
176
207
|
style={style}
|
|
177
208
|
className={wrapper}
|
|
178
209
|
id={id}
|
|
179
210
|
onMouseEnter={onMouseEnter}
|
|
180
211
|
onMouseLeave={onMouseLeave}
|
|
181
212
|
onClick={this.handleChange}
|
|
213
|
+
onKeyPress={this.handleEnterPress}
|
|
214
|
+
aria-labelledby={this.props['aria-labelledby']}
|
|
182
215
|
>
|
|
183
216
|
<CheckboxInner
|
|
184
217
|
{...this.props}
|
|
185
218
|
{...props}
|
|
219
|
+
addonId={children && this.addonId}
|
|
220
|
+
extraId={extra && this.extraId}
|
|
186
221
|
name={name}
|
|
187
222
|
isPureCardType={props.isPureCardType}
|
|
188
223
|
ref={ref => {
|