@douyinfe/semi-ui 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_base/_story/a11y.jsx +6 -6
- package/_base/_story/a11y.scss +0 -1
- package/_base/_story/index.scss +2 -5
- package/_utils/hooks/usePrevFocus.ts +16 -0
- package/_utils/index.ts +4 -0
- package/anchor/_story/anchor.stories.js +1 -1
- package/anchor/index.tsx +5 -2
- package/anchor/link.tsx +29 -4
- package/autoComplete/index.tsx +28 -1
- package/avatar/_story/avatar.stories.js +4 -4
- package/avatar/index.tsx +6 -4
- package/banner/index.tsx +2 -1
- package/breadcrumb/_story/breadcrumb.stories.js +22 -8
- package/breadcrumb/index.tsx +8 -1
- package/breadcrumb/item.tsx +1 -1
- package/button/Button.tsx +4 -0
- package/button/__test__/button.test.js +1 -1
- package/button/_story/button.stories.js +10 -10
- package/button/buttonGroup.tsx +4 -2
- package/button/splitButtonGroup.tsx +5 -2
- package/card/_story/card.stories.js +8 -1
- package/card/_story/card.stories.tsx +3 -0
- package/card/index.tsx +5 -2
- package/cascader/index.tsx +33 -5
- package/checkbox/_story/checkbox.stories.js +19 -12
- package/checkbox/checkbox.tsx +40 -5
- package/checkbox/checkboxGroup.tsx +30 -5
- package/checkbox/checkboxInner.tsx +25 -2
- package/collapse/index.tsx +1 -1
- package/collapse/item.tsx +12 -7
- package/collapsible/index.tsx +4 -2
- package/configProvider/_story/configProvider.stories.tsx +27 -0
- package/datePicker/__test__/datePicker.test.js +108 -0
- package/datePicker/_story/datePicker.stories.js +146 -2
- package/datePicker/datePicker.tsx +24 -0
- package/datePicker/monthsGrid.tsx +2 -1
- package/dist/css/semi.css +34 -7
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +2768 -1501
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/dropdown/dropdownItem.tsx +1 -1
- package/dropdown/dropdownMenu.tsx +1 -1
- package/empty/index.tsx +4 -4
- package/form/_story/FormApi/formApiDemo.jsx +3 -2
- package/form/_story/Validate/validateDemo.jsx +1 -1
- package/form/_story/demo.jsx +12 -3
- package/form/_story/form.stories.js +0 -7
- package/form/baseForm.tsx +2 -0
- package/form/errorMessage.tsx +13 -2
- package/form/hoc/withField.tsx +37 -8
- package/form/index.tsx +0 -2
- package/form/interface.ts +2 -0
- package/form/label.tsx +4 -2
- package/input/index.tsx +49 -4
- package/input/inputGroup.tsx +9 -4
- package/input/textarea.tsx +25 -6
- package/inputNumber/_story/inputNumber.stories.js +12 -0
- package/inputNumber/index.tsx +33 -2
- package/layout/Sider.tsx +6 -2
- package/layout/index.tsx +4 -3
- package/lib/cjs/_utils/hooks/usePrevFocus.d.ts +2 -0
- package/lib/cjs/_utils/hooks/usePrevFocus.js +30 -0
- package/lib/cjs/_utils/index.d.ts +1 -0
- package/lib/cjs/_utils/index.js +6 -1
- package/lib/cjs/anchor/index.d.ts +2 -0
- package/lib/cjs/anchor/index.js +6 -1
- package/lib/cjs/anchor/link.d.ts +4 -1
- package/lib/cjs/anchor/link.js +39 -5
- package/lib/cjs/autoComplete/index.d.ts +17 -0
- package/lib/cjs/autoComplete/index.js +21 -2
- package/lib/cjs/avatar/index.d.ts +4 -3
- package/lib/cjs/avatar/index.js +15 -11
- package/lib/cjs/banner/index.js +4 -2
- package/lib/cjs/breadcrumb/index.d.ts +3 -0
- package/lib/cjs/breadcrumb/index.js +10 -4
- package/lib/cjs/breadcrumb/item.js +2 -2
- package/lib/cjs/button/Button.d.ts +2 -0
- package/lib/cjs/button/Button.js +4 -2
- package/lib/cjs/button/buttonGroup.d.ts +3 -0
- package/lib/cjs/button/buttonGroup.js +8 -4
- package/lib/cjs/button/index.d.ts +1 -0
- package/lib/cjs/button/splitButtonGroup.d.ts +3 -0
- package/lib/cjs/button/splitButtonGroup.js +5 -2
- package/lib/cjs/card/index.d.ts +3 -0
- package/lib/cjs/card/index.js +3 -1
- package/lib/cjs/cascader/index.d.ts +14 -0
- package/lib/cjs/cascader/index.js +35 -7
- package/lib/cjs/checkbox/checkbox.d.ts +21 -1
- package/lib/cjs/checkbox/checkbox.js +51 -17
- package/lib/cjs/checkbox/checkboxGroup.d.ts +13 -1
- package/lib/cjs/checkbox/checkboxGroup.js +16 -3
- package/lib/cjs/checkbox/checkboxInner.d.ts +15 -0
- package/lib/cjs/checkbox/checkboxInner.js +20 -3
- package/lib/cjs/collapse/item.d.ts +2 -1
- package/lib/cjs/collapse/item.js +12 -2
- package/lib/cjs/collapsible/index.d.ts +1 -0
- package/lib/cjs/collapsible/index.js +4 -2
- package/lib/cjs/datePicker/datePicker.d.ts +12 -0
- package/lib/cjs/datePicker/datePicker.js +22 -3
- package/lib/cjs/datePicker/monthsGrid.d.ts +1 -0
- package/lib/cjs/datePicker/monthsGrid.js +2 -1
- package/lib/cjs/dropdown/dropdownItem.js +3 -1
- package/lib/cjs/dropdown/dropdownMenu.js +4 -1
- package/lib/cjs/form/baseForm.d.ts +9 -0
- package/lib/cjs/form/baseForm.js +3 -1
- package/lib/cjs/form/errorMessage.d.ts +4 -0
- package/lib/cjs/form/errorMessage.js +21 -3
- package/lib/cjs/form/field.d.ts +7 -0
- package/lib/cjs/form/hoc/withField.js +49 -16
- package/lib/cjs/form/index.d.ts +0 -1
- package/lib/cjs/form/interface.d.ts +2 -0
- package/lib/cjs/form/label.d.ts +2 -0
- package/lib/cjs/form/label.js +5 -2
- package/lib/cjs/input/index.d.ts +16 -0
- package/lib/cjs/input/index.js +51 -15
- package/lib/cjs/input/inputGroup.d.ts +2 -1
- package/lib/cjs/input/inputGroup.js +11 -1
- package/lib/cjs/input/textarea.js +12 -1
- package/lib/cjs/inputNumber/index.d.ts +21 -12
- package/lib/cjs/inputNumber/index.js +37 -3
- package/lib/cjs/layout/Sider.d.ts +4 -0
- package/lib/cjs/layout/Sider.js +4 -1
- package/lib/cjs/layout/index.js +2 -0
- package/lib/cjs/list/item.js +0 -1
- package/lib/cjs/modal/Modal.js +2 -0
- package/lib/cjs/modal/ModalContent.d.ts +3 -1
- package/lib/cjs/modal/ModalContent.js +47 -5
- package/lib/cjs/navigation/Item.d.ts +4 -2
- package/lib/cjs/navigation/Item.js +25 -5
- package/lib/cjs/navigation/SubNav.d.ts +4 -2
- package/lib/cjs/navigation/SubNav.js +8 -1
- package/lib/cjs/navigation/index.js +2 -0
- package/lib/cjs/notification/notice.d.ts +1 -1
- package/lib/cjs/notification/notice.js +32 -22
- package/lib/cjs/pagination/index.js +16 -6
- package/lib/cjs/popover/index.js +7 -3
- package/lib/cjs/progress/index.d.ts +8 -0
- package/lib/cjs/progress/index.js +42 -9
- package/lib/cjs/radio/radio.d.ts +6 -1
- package/lib/cjs/radio/radio.js +17 -5
- package/lib/cjs/radio/radioGroup.d.ts +16 -1
- package/lib/cjs/radio/radioGroup.js +18 -3
- package/lib/cjs/radio/radioInner.d.ts +6 -1
- package/lib/cjs/radio/radioInner.js +11 -3
- package/lib/cjs/rating/index.d.ts +14 -0
- package/lib/cjs/rating/index.js +14 -3
- package/lib/cjs/rating/item.d.ts +2 -0
- package/lib/cjs/rating/item.js +6 -1
- package/lib/cjs/select/index.d.ts +16 -0
- package/lib/cjs/select/index.js +65 -19
- package/lib/cjs/select/option.js +28 -22
- package/lib/cjs/sideSheet/SideSheetContent.d.ts +1 -0
- package/lib/cjs/sideSheet/SideSheetContent.js +4 -1
- package/lib/cjs/sideSheet/index.d.ts +1 -0
- package/lib/cjs/sideSheet/index.js +2 -1
- package/lib/cjs/slider/index.d.ts +2 -1
- package/lib/cjs/slider/index.js +64 -17
- package/lib/cjs/spin/icon.js +3 -4
- package/lib/cjs/steps/basicStep.d.ts +3 -0
- package/lib/cjs/steps/basicStep.js +23 -25
- package/lib/cjs/steps/basicSteps.d.ts +1 -0
- package/lib/cjs/steps/basicSteps.js +2 -1
- package/lib/cjs/steps/fillStep.d.ts +3 -0
- package/lib/cjs/steps/fillStep.js +19 -4
- package/lib/cjs/steps/fillSteps.d.ts +1 -0
- package/lib/cjs/steps/fillSteps.js +2 -1
- package/lib/cjs/steps/navStep.d.ts +3 -0
- package/lib/cjs/steps/navStep.js +22 -25
- package/lib/cjs/steps/navSteps.d.ts +1 -0
- package/lib/cjs/steps/navSteps.js +2 -1
- package/lib/cjs/switch/index.d.ts +12 -0
- package/lib/cjs/switch/index.js +19 -4
- package/lib/cjs/table/Body/BaseRow.js +35 -3
- package/lib/cjs/table/Body/index.js +9 -1
- package/lib/cjs/table/ColumnFilter.js +4 -0
- package/lib/cjs/table/ColumnSelection.d.ts +3 -0
- package/lib/cjs/table/ColumnSelection.js +6 -2
- package/lib/cjs/table/ColumnSorter.js +19 -3
- package/lib/cjs/table/CustomExpandIcon.js +7 -1
- package/lib/cjs/table/Table.d.ts +2 -0
- package/lib/cjs/table/Table.js +31 -15
- package/lib/cjs/table/TableCell.d.ts +2 -0
- package/lib/cjs/table/TableCell.js +6 -2
- package/lib/cjs/table/TableHeaderRow.js +8 -2
- package/lib/cjs/tabs/TabBar.js +11 -3
- package/lib/cjs/tabs/TabPane.js +3 -1
- package/lib/cjs/tabs/index.js +0 -1
- package/lib/cjs/tagInput/index.d.ts +4 -1
- package/lib/cjs/tagInput/index.js +29 -3
- package/lib/cjs/timePicker/TimePicker.d.ts +12 -0
- package/lib/cjs/timePicker/TimePicker.js +9 -1
- package/lib/cjs/timePicker/index.d.ts +6 -0
- package/lib/cjs/timeline/index.d.ts +1 -1
- package/lib/cjs/timeline/index.js +1 -0
- package/lib/cjs/timeline/item.js +4 -2
- package/lib/cjs/toast/toast.js +2 -0
- package/lib/cjs/tooltip/TriangleArrow.js +1 -0
- package/lib/cjs/tooltip/TriangleArrowVertical.js +1 -0
- package/lib/cjs/tooltip/index.d.ts +16 -12
- package/lib/cjs/tooltip/index.js +55 -39
- package/lib/cjs/transfer/index.d.ts +1 -1
- package/lib/cjs/transfer/index.js +35 -17
- package/lib/cjs/tree/index.d.ts +1 -0
- package/lib/cjs/tree/index.js +15 -6
- package/lib/cjs/tree/treeNode.d.ts +12 -4
- package/lib/cjs/tree/treeNode.js +44 -4
- package/lib/cjs/treeSelect/index.d.ts +16 -0
- package/lib/cjs/treeSelect/index.js +60 -12
- package/lib/cjs/typography/base.js +18 -7
- package/lib/cjs/typography/copyable.js +6 -1
- package/lib/cjs/upload/fileCard.js +26 -7
- package/lib/cjs/upload/index.js +19 -4
- package/lib/es/_utils/hooks/usePrevFocus.d.ts +2 -0
- package/lib/es/_utils/hooks/usePrevFocus.js +15 -0
- package/lib/es/_utils/index.d.ts +1 -0
- package/lib/es/_utils/index.js +4 -1
- package/lib/es/anchor/index.d.ts +2 -0
- package/lib/es/anchor/index.js +6 -1
- package/lib/es/anchor/link.d.ts +4 -1
- package/lib/es/anchor/link.js +38 -5
- package/lib/es/autoComplete/index.d.ts +17 -0
- package/lib/es/autoComplete/index.js +21 -2
- package/lib/es/avatar/index.d.ts +4 -3
- package/lib/es/avatar/index.js +15 -11
- package/lib/es/banner/index.js +4 -2
- package/lib/es/breadcrumb/index.d.ts +3 -0
- package/lib/es/breadcrumb/index.js +10 -4
- package/lib/es/breadcrumb/item.js +2 -2
- package/lib/es/button/Button.d.ts +2 -0
- package/lib/es/button/Button.js +4 -2
- package/lib/es/button/buttonGroup.d.ts +3 -0
- package/lib/es/button/buttonGroup.js +8 -4
- package/lib/es/button/index.d.ts +1 -0
- package/lib/es/button/splitButtonGroup.d.ts +3 -0
- package/lib/es/button/splitButtonGroup.js +5 -2
- package/lib/es/card/index.d.ts +3 -0
- package/lib/es/card/index.js +3 -1
- package/lib/es/cascader/index.d.ts +14 -0
- package/lib/es/cascader/index.js +35 -7
- package/lib/es/checkbox/checkbox.d.ts +21 -1
- package/lib/es/checkbox/checkbox.js +50 -17
- package/lib/es/checkbox/checkboxGroup.d.ts +13 -1
- package/lib/es/checkbox/checkboxGroup.js +18 -5
- package/lib/es/checkbox/checkboxInner.d.ts +15 -0
- package/lib/es/checkbox/checkboxInner.js +20 -3
- package/lib/es/collapse/item.d.ts +2 -1
- package/lib/es/collapse/item.js +11 -2
- package/lib/es/collapsible/index.d.ts +1 -0
- package/lib/es/collapsible/index.js +4 -2
- package/lib/es/datePicker/datePicker.d.ts +12 -0
- package/lib/es/datePicker/datePicker.js +22 -3
- package/lib/es/datePicker/monthsGrid.d.ts +1 -0
- package/lib/es/datePicker/monthsGrid.js +2 -1
- package/lib/es/dropdown/dropdownItem.js +3 -1
- package/lib/es/dropdown/dropdownMenu.js +4 -1
- package/lib/es/form/baseForm.d.ts +9 -0
- package/lib/es/form/baseForm.js +3 -1
- package/lib/es/form/errorMessage.d.ts +4 -0
- package/lib/es/form/errorMessage.js +21 -3
- package/lib/es/form/field.d.ts +7 -0
- package/lib/es/form/hoc/withField.js +48 -15
- package/lib/es/form/index.d.ts +0 -1
- package/lib/es/form/index.js +0 -1
- package/lib/es/form/interface.d.ts +2 -0
- package/lib/es/form/label.d.ts +2 -0
- package/lib/es/form/label.js +5 -2
- package/lib/es/input/index.d.ts +16 -0
- package/lib/es/input/index.js +51 -15
- package/lib/es/input/inputGroup.d.ts +2 -1
- package/lib/es/input/inputGroup.js +11 -1
- package/lib/es/input/textarea.js +12 -1
- package/lib/es/inputNumber/index.d.ts +21 -12
- package/lib/es/inputNumber/index.js +38 -3
- package/lib/es/layout/Sider.d.ts +4 -0
- package/lib/es/layout/Sider.js +4 -1
- package/lib/es/layout/index.js +2 -0
- package/lib/es/list/item.js +0 -1
- package/lib/es/modal/Modal.js +2 -0
- package/lib/es/modal/ModalContent.d.ts +3 -1
- package/lib/es/modal/ModalContent.js +46 -5
- package/lib/es/navigation/Item.d.ts +4 -2
- package/lib/es/navigation/Item.js +25 -5
- package/lib/es/navigation/SubNav.d.ts +4 -2
- package/lib/es/navigation/SubNav.js +8 -1
- package/lib/es/navigation/index.js +2 -0
- package/lib/es/notification/notice.d.ts +1 -1
- package/lib/es/notification/notice.js +33 -24
- package/lib/es/pagination/index.js +16 -6
- package/lib/es/popover/index.js +7 -3
- package/lib/es/progress/index.d.ts +8 -0
- package/lib/es/progress/index.js +42 -9
- package/lib/es/radio/radio.d.ts +6 -1
- package/lib/es/radio/radio.js +16 -5
- package/lib/es/radio/radioGroup.d.ts +16 -1
- package/lib/es/radio/radioGroup.js +18 -3
- package/lib/es/radio/radioInner.d.ts +6 -1
- package/lib/es/radio/radioInner.js +11 -3
- package/lib/es/rating/index.d.ts +14 -0
- package/lib/es/rating/index.js +14 -3
- package/lib/es/rating/item.d.ts +2 -0
- package/lib/es/rating/item.js +6 -1
- package/lib/es/select/index.d.ts +16 -0
- package/lib/es/select/index.js +63 -17
- package/lib/es/select/option.js +28 -22
- package/lib/es/sideSheet/SideSheetContent.d.ts +1 -0
- package/lib/es/sideSheet/SideSheetContent.js +4 -1
- package/lib/es/sideSheet/index.d.ts +1 -0
- package/lib/es/sideSheet/index.js +2 -1
- package/lib/es/slider/index.d.ts +2 -1
- package/lib/es/slider/index.js +63 -16
- package/lib/es/spin/icon.js +3 -4
- package/lib/es/steps/basicStep.d.ts +3 -0
- package/lib/es/steps/basicStep.js +23 -23
- package/lib/es/steps/basicSteps.d.ts +1 -0
- package/lib/es/steps/basicSteps.js +2 -1
- package/lib/es/steps/fillStep.d.ts +3 -0
- package/lib/es/steps/fillStep.js +19 -4
- package/lib/es/steps/fillSteps.d.ts +1 -0
- package/lib/es/steps/fillSteps.js +2 -1
- package/lib/es/steps/navStep.d.ts +3 -0
- package/lib/es/steps/navStep.js +22 -23
- package/lib/es/steps/navSteps.d.ts +1 -0
- package/lib/es/steps/navSteps.js +2 -1
- package/lib/es/switch/index.d.ts +12 -0
- package/lib/es/switch/index.js +19 -4
- package/lib/es/table/Body/BaseRow.js +35 -3
- package/lib/es/table/Body/index.js +9 -2
- package/lib/es/table/ColumnFilter.js +4 -0
- package/lib/es/table/ColumnSelection.d.ts +3 -0
- package/lib/es/table/ColumnSelection.js +6 -2
- package/lib/es/table/ColumnSorter.js +17 -3
- package/lib/es/table/CustomExpandIcon.js +6 -1
- package/lib/es/table/Table.d.ts +2 -0
- package/lib/es/table/Table.js +31 -15
- package/lib/es/table/TableCell.d.ts +2 -0
- package/lib/es/table/TableCell.js +6 -2
- package/lib/es/table/TableHeaderRow.js +8 -2
- package/lib/es/tabs/TabBar.js +11 -3
- package/lib/es/tabs/TabPane.js +3 -1
- package/lib/es/tabs/index.js +0 -1
- package/lib/es/tagInput/index.d.ts +4 -1
- package/lib/es/tagInput/index.js +29 -3
- package/lib/es/timePicker/TimePicker.d.ts +12 -0
- package/lib/es/timePicker/TimePicker.js +9 -1
- package/lib/es/timePicker/index.d.ts +6 -0
- package/lib/es/timeline/index.d.ts +1 -1
- package/lib/es/timeline/index.js +1 -0
- package/lib/es/timeline/item.js +4 -2
- package/lib/es/toast/toast.js +2 -0
- package/lib/es/tooltip/TriangleArrow.js +1 -0
- package/lib/es/tooltip/TriangleArrowVertical.js +1 -0
- package/lib/es/tooltip/index.d.ts +16 -12
- package/lib/es/tooltip/index.js +53 -39
- package/lib/es/transfer/index.d.ts +1 -1
- package/lib/es/transfer/index.js +35 -17
- package/lib/es/tree/index.d.ts +1 -0
- package/lib/es/tree/index.js +15 -6
- package/lib/es/tree/treeNode.d.ts +12 -4
- package/lib/es/tree/treeNode.js +44 -4
- package/lib/es/treeSelect/index.d.ts +16 -0
- package/lib/es/treeSelect/index.js +57 -10
- package/lib/es/typography/base.js +17 -7
- package/lib/es/typography/copyable.js +5 -1
- package/lib/es/upload/fileCard.js +26 -7
- package/lib/es/upload/index.js +19 -4
- package/list/item.tsx +0 -1
- package/modal/Modal.tsx +2 -0
- package/modal/ModalContent.tsx +35 -5
- package/navigation/Item.tsx +15 -0
- package/navigation/SubNav.tsx +13 -1
- package/navigation/index.tsx +1 -1
- package/notification/notice.tsx +19 -14
- package/package.json +8 -8
- package/pagination/index.tsx +9 -5
- package/popover/index.tsx +5 -0
- package/progress/_story/progress.stories.js +18 -18
- package/progress/index.tsx +58 -20
- package/radio/radio.tsx +12 -2
- package/radio/radioGroup.tsx +29 -3
- package/radio/radioInner.tsx +10 -1
- package/rating/index.tsx +19 -2
- package/rating/item.tsx +6 -0
- package/select/__test__/select.test.js +45 -0
- package/select/_story/select.stories.js +29 -0
- package/select/index.tsx +52 -4
- package/select/option.tsx +3 -0
- package/sideSheet/SideSheetContent.tsx +6 -4
- package/sideSheet/index.tsx +3 -2
- package/slider/__test__/slider.test.js +9 -0
- package/slider/_story/slider.stories.js +1 -1
- package/slider/index.tsx +44 -7
- package/spin/icon.tsx +4 -3
- package/steps/basicStep.tsx +15 -4
- package/steps/basicSteps.tsx +3 -2
- package/steps/fillStep.tsx +27 -12
- package/steps/fillSteps.tsx +2 -0
- package/steps/navStep.tsx +15 -4
- package/steps/navSteps.tsx +3 -2
- package/switch/_story/switch.stories.js +20 -19
- package/switch/_story/switch.stories.tsx +13 -13
- package/switch/index.tsx +23 -5
- package/table/Body/BaseRow.tsx +25 -1
- package/table/Body/index.tsx +7 -2
- package/table/ColumnFilter.tsx +7 -1
- package/table/ColumnSelection.tsx +4 -1
- package/table/ColumnSorter.tsx +18 -1
- package/table/CustomExpandIcon.tsx +5 -0
- package/table/Table.tsx +26 -13
- package/table/TableCell.tsx +11 -1
- package/table/TableHeaderRow.tsx +16 -2
- package/table/__test__/table.test.js +46 -0
- package/tabs/TabBar.tsx +8 -5
- package/tabs/TabPane.tsx +3 -1
- package/tabs/index.tsx +0 -1
- package/tagInput/__test__/tagInput.test.js +46 -0
- package/tagInput/_story/tagInput.stories.js +2 -2
- package/tagInput/index.tsx +31 -8
- package/timePicker/TimePicker.tsx +14 -1
- package/timeline/_story/timeline.stories.js +1 -1
- package/timeline/index.tsx +2 -2
- package/timeline/item.tsx +2 -1
- package/toast/toast.tsx +2 -0
- package/tooltip/TriangleArrow.tsx +1 -1
- package/tooltip/TriangleArrowVertical.tsx +1 -1
- package/tooltip/_story/tooltip.stories.js +562 -514
- package/tooltip/index.tsx +51 -33
- package/transfer/index.tsx +32 -28
- package/tree/_story/tree.stories.js +3 -3
- package/tree/index.tsx +10 -2
- package/tree/treeNode.tsx +46 -10
- package/treeSelect/__test__/treeMultiple.test.js +5 -0
- package/treeSelect/_story/treeSelect.stories.js +12 -0
- package/treeSelect/index.tsx +58 -7
- package/typography/base.tsx +7 -1
- package/typography/copyable.tsx +10 -1
- package/upload/fileCard.tsx +14 -16
- package/upload/index.tsx +10 -6
|
@@ -25,6 +25,7 @@ export interface ButtonProps {
|
|
|
25
25
|
onMouseDown?: React.MouseEventHandler<HTMLButtonElement>;
|
|
26
26
|
onMouseEnter?: React.MouseEventHandler<HTMLButtonElement>;
|
|
27
27
|
onMouseLeave?: React.MouseEventHandler<HTMLButtonElement>;
|
|
28
|
+
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
28
29
|
}
|
|
29
30
|
export default class Button extends PureComponent<ButtonProps> {
|
|
30
31
|
static defaultProps: {
|
|
@@ -57,6 +58,7 @@ export default class Button extends PureComponent<ButtonProps> {
|
|
|
57
58
|
className: PropTypes.Requireable<string>;
|
|
58
59
|
onMouseEnter: PropTypes.Requireable<(...args: any[]) => any>;
|
|
59
60
|
onMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
|
|
61
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
60
62
|
};
|
|
61
63
|
render(): JSX.Element;
|
|
62
64
|
}
|
package/lib/cjs/button/Button.js
CHANGED
|
@@ -93,7 +93,8 @@ class Button extends _react.PureComponent {
|
|
|
93
93
|
["".concat(prefixCls, "-circle")]: circle,
|
|
94
94
|
["".concat(prefixCls, "-borderless")]: theme === 'borderless'
|
|
95
95
|
}, className),
|
|
96
|
-
type: htmlType
|
|
96
|
+
type: htmlType,
|
|
97
|
+
'aria-disabled': disabled
|
|
97
98
|
});
|
|
98
99
|
return (
|
|
99
100
|
/*#__PURE__*/
|
|
@@ -141,5 +142,6 @@ Button.propTypes = {
|
|
|
141
142
|
theme: _propTypes.default.oneOf(_constants.strings.themes),
|
|
142
143
|
className: _propTypes.default.string,
|
|
143
144
|
onMouseEnter: _propTypes.default.func,
|
|
144
|
-
onMouseLeave: _propTypes.default.func
|
|
145
|
+
onMouseLeave: _propTypes.default.func,
|
|
146
|
+
'aria-label': _propTypes.default.string
|
|
145
147
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import BaseComponent, { BaseProps } from '../_base/baseComponent';
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
3
4
|
import { Type, Size } from './Button';
|
|
@@ -8,6 +9,7 @@ export interface ButtonGroupProps extends BaseProps {
|
|
|
8
9
|
type?: Type;
|
|
9
10
|
size?: Size;
|
|
10
11
|
theme?: Theme;
|
|
12
|
+
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
11
13
|
}
|
|
12
14
|
export default class ButtonGroup extends BaseComponent<ButtonGroupProps> {
|
|
13
15
|
static propTypes: {
|
|
@@ -16,6 +18,7 @@ export default class ButtonGroup extends BaseComponent<ButtonGroupProps> {
|
|
|
16
18
|
type: PropTypes.Requireable<string>;
|
|
17
19
|
size: PropTypes.Requireable<unknown>;
|
|
18
20
|
theme: PropTypes.Requireable<unknown>;
|
|
21
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
19
22
|
};
|
|
20
23
|
static defaultProps: {
|
|
21
24
|
size: string;
|
|
@@ -59,9 +59,10 @@ class ButtonGroup extends _baseComponent.default {
|
|
|
59
59
|
children,
|
|
60
60
|
disabled,
|
|
61
61
|
size,
|
|
62
|
-
type
|
|
62
|
+
type,
|
|
63
|
+
'aria-label': ariaLabel
|
|
63
64
|
} = _a,
|
|
64
|
-
rest = __rest(_a, ["children", "disabled", "size", "type"]);
|
|
65
|
+
rest = __rest(_a, ["children", "disabled", "size", "type", 'aria-label']);
|
|
65
66
|
|
|
66
67
|
let inner;
|
|
67
68
|
|
|
@@ -78,7 +79,9 @@ class ButtonGroup extends _baseComponent.default {
|
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
81
|
-
className: "".concat(prefixCls, "-group")
|
|
82
|
+
className: "".concat(prefixCls, "-group"),
|
|
83
|
+
role: "group",
|
|
84
|
+
"aria-label": ariaLabel
|
|
82
85
|
}, inner);
|
|
83
86
|
}
|
|
84
87
|
|
|
@@ -90,7 +93,8 @@ ButtonGroup.propTypes = {
|
|
|
90
93
|
disabled: _propTypes.default.bool,
|
|
91
94
|
type: _propTypes.default.string,
|
|
92
95
|
size: _propTypes.default.oneOf(btnSizes),
|
|
93
|
-
theme: _propTypes.default.oneOf(_constants.strings.themes)
|
|
96
|
+
theme: _propTypes.default.oneOf(_constants.strings.themes),
|
|
97
|
+
'aria-label': _propTypes.default.string
|
|
94
98
|
};
|
|
95
99
|
ButtonGroup.defaultProps = {
|
|
96
100
|
size: 'default',
|
|
@@ -30,6 +30,7 @@ declare class Button extends React.PureComponent<ButtonProps> {
|
|
|
30
30
|
onMouseDown: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
31
31
|
circle: import("prop-types").Requireable<boolean>;
|
|
32
32
|
htmlType: import("prop-types").Requireable<unknown>;
|
|
33
|
+
'aria-label': import("prop-types").Requireable<string>;
|
|
33
34
|
};
|
|
34
35
|
constructor(props?: {});
|
|
35
36
|
render(): JSX.Element;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import PropTypes from 'prop-types';
|
|
2
3
|
import '@douyinfe/semi-foundation/lib/cjs/button/button.css';
|
|
3
4
|
import BaseComponent, { BaseProps } from '../_base/baseComponent';
|
|
4
5
|
export interface SplitButtonGroupProps extends BaseProps {
|
|
6
|
+
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
5
7
|
}
|
|
6
8
|
export default class SplitButtonGroup extends BaseComponent<SplitButtonGroupProps> {
|
|
7
9
|
static propTypes: {
|
|
8
10
|
style: PropTypes.Requireable<object>;
|
|
9
11
|
className: PropTypes.Requireable<string>;
|
|
12
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
10
13
|
};
|
|
11
14
|
render(): JSX.Element;
|
|
12
15
|
}
|
|
@@ -34,7 +34,9 @@ class SplitButtonGroup extends _baseComponent.default {
|
|
|
34
34
|
const cls = (0, _classnames.default)("".concat(prefixCls, "-split"), className);
|
|
35
35
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
36
36
|
className: cls,
|
|
37
|
-
style: style
|
|
37
|
+
style: style,
|
|
38
|
+
role: "group",
|
|
39
|
+
"aria-label": this.props['aria-label']
|
|
38
40
|
}, children);
|
|
39
41
|
}
|
|
40
42
|
|
|
@@ -43,5 +45,6 @@ class SplitButtonGroup extends _baseComponent.default {
|
|
|
43
45
|
exports.default = SplitButtonGroup;
|
|
44
46
|
SplitButtonGroup.propTypes = {
|
|
45
47
|
style: _propTypes.default.object,
|
|
46
|
-
className: _propTypes.default.string
|
|
48
|
+
className: _propTypes.default.string,
|
|
49
|
+
'aria-label': _propTypes.default.string
|
|
47
50
|
};
|
package/lib/cjs/card/index.d.ts
CHANGED
|
@@ -38,6 +38,8 @@ export interface CardProps {
|
|
|
38
38
|
style?: CSSProperties;
|
|
39
39
|
/** Title */
|
|
40
40
|
title?: ReactNode;
|
|
41
|
+
/** aria label */
|
|
42
|
+
'aria-label'?: string;
|
|
41
43
|
}
|
|
42
44
|
declare class Card extends PureComponent<CardProps> {
|
|
43
45
|
static Meta: typeof Meta;
|
|
@@ -59,6 +61,7 @@ declare class Card extends PureComponent<CardProps> {
|
|
|
59
61
|
shadows: PropTypes.Requireable<string>;
|
|
60
62
|
style: PropTypes.Requireable<object>;
|
|
61
63
|
title: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
64
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
62
65
|
};
|
|
63
66
|
static defaultProps: {
|
|
64
67
|
bordered: boolean;
|
package/lib/cjs/card/index.js
CHANGED
|
@@ -187,6 +187,7 @@ class Card extends _react.PureComponent {
|
|
|
187
187
|
[(0, _concat.default)(_context = "".concat(prefixcls, "-shadows-")).call(_context, shadows)]: shadows
|
|
188
188
|
});
|
|
189
189
|
return /*#__PURE__*/_react.default.createElement("div", (0, _assign.default)({}, others, {
|
|
190
|
+
"aria-busy": this.props.loading,
|
|
190
191
|
className: cardCls,
|
|
191
192
|
style: style
|
|
192
193
|
}), this.renderHeader(), this.renderCover(), this.renderBody(), this.renderFooter());
|
|
@@ -212,7 +213,8 @@ Card.propTypes = {
|
|
|
212
213
|
loading: _propTypes.default.bool,
|
|
213
214
|
shadows: _propTypes.default.oneOf(_constants.strings.SHADOWS),
|
|
214
215
|
style: _propTypes.default.object,
|
|
215
|
-
title: _propTypes.default.node
|
|
216
|
+
title: _propTypes.default.node,
|
|
217
|
+
'aria-label': _propTypes.default.string
|
|
216
218
|
};
|
|
217
219
|
Card.defaultProps = {
|
|
218
220
|
bordered: true,
|
|
@@ -19,6 +19,11 @@ export interface TriggerRenderProps extends BasicTriggerRenderProps {
|
|
|
19
19
|
export declare type SimpleValueType = string | number | CascaderData;
|
|
20
20
|
export declare type Value = SimpleValueType | Array<SimpleValueType> | Array<Array<SimpleValueType>>;
|
|
21
21
|
export interface CascaderProps extends BasicCascaderProps {
|
|
22
|
+
'aria-describedby'?: React.AriaAttributes['aria-describedby'];
|
|
23
|
+
'aria-errormessage'?: React.AriaAttributes['aria-errormessage'];
|
|
24
|
+
'aria-invalid'?: React.AriaAttributes['aria-invalid'];
|
|
25
|
+
'aria-labelledby'?: React.AriaAttributes['aria-labelledby'];
|
|
26
|
+
'aria-required'?: React.AriaAttributes['aria-required'];
|
|
22
27
|
arrowIcon?: ReactNode;
|
|
23
28
|
defaultValue?: Value;
|
|
24
29
|
dropdownStyle?: CSSProperties;
|
|
@@ -30,7 +35,9 @@ export interface CascaderProps extends BasicCascaderProps {
|
|
|
30
35
|
value?: Value;
|
|
31
36
|
prefix?: ReactNode;
|
|
32
37
|
suffix?: ReactNode;
|
|
38
|
+
id?: string;
|
|
33
39
|
insetLabel?: ReactNode;
|
|
40
|
+
insetLabelId?: string;
|
|
34
41
|
style?: CSSProperties;
|
|
35
42
|
bottomSlot?: ReactNode;
|
|
36
43
|
topSlot?: ReactNode;
|
|
@@ -53,6 +60,11 @@ export interface CascaderState extends BasicCascaderInnerData {
|
|
|
53
60
|
declare class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
54
61
|
static contextType: React.Context<import("../configProvider/context").ContextValue>;
|
|
55
62
|
static propTypes: {
|
|
63
|
+
'aria-labelledby': PropTypes.Requireable<string>;
|
|
64
|
+
'aria-invalid': PropTypes.Requireable<boolean>;
|
|
65
|
+
'aria-errormessage': PropTypes.Requireable<string>;
|
|
66
|
+
'aria-describedby': PropTypes.Requireable<string>;
|
|
67
|
+
'aria-required': PropTypes.Requireable<boolean>;
|
|
56
68
|
arrowIcon: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
57
69
|
changeOnSelect: PropTypes.Requireable<boolean>;
|
|
58
70
|
defaultValue: PropTypes.Requireable<string | any[]>;
|
|
@@ -76,6 +88,8 @@ declare class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
76
88
|
suffix: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
77
89
|
prefix: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
78
90
|
insetLabel: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
91
|
+
insetLabelId: PropTypes.Requireable<string>;
|
|
92
|
+
id: PropTypes.Requireable<string>;
|
|
79
93
|
displayProp: PropTypes.Requireable<string>;
|
|
80
94
|
displayRender: PropTypes.Requireable<(...args: any[]) => any>;
|
|
81
95
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -189,7 +189,7 @@ class Cascader extends _baseComponent.default {
|
|
|
189
189
|
|
|
190
190
|
const content = /*#__PURE__*/_react.default.createElement("div", {
|
|
191
191
|
className: popoverCls,
|
|
192
|
-
role: "
|
|
192
|
+
role: "listbox",
|
|
193
193
|
style: dropdownStyle
|
|
194
194
|
}, topSlot, /*#__PURE__*/_react.default.createElement(_item.default, {
|
|
195
195
|
activeKeys: activeKeys,
|
|
@@ -318,7 +318,8 @@ class Cascader extends _baseComponent.default {
|
|
|
318
318
|
this.renderPrefix = () => {
|
|
319
319
|
const {
|
|
320
320
|
prefix,
|
|
321
|
-
insetLabel
|
|
321
|
+
insetLabel,
|
|
322
|
+
insetLabelId
|
|
322
323
|
} = this.props;
|
|
323
324
|
const labelNode = prefix || insetLabel;
|
|
324
325
|
const prefixWrapperCls = (0, _classnames.default)({
|
|
@@ -329,7 +330,8 @@ class Cascader extends _baseComponent.default {
|
|
|
329
330
|
["".concat(prefixcls, "-prefix-icon")]: (0, _utils.isSemiIcon)(labelNode)
|
|
330
331
|
});
|
|
331
332
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
332
|
-
className: prefixWrapperCls
|
|
333
|
+
className: prefixWrapperCls,
|
|
334
|
+
id: insetLabelId
|
|
333
335
|
}, labelNode);
|
|
334
336
|
};
|
|
335
337
|
|
|
@@ -408,7 +410,9 @@ class Cascader extends _baseComponent.default {
|
|
|
408
410
|
if (allowClear) {
|
|
409
411
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
410
412
|
className: clearCls,
|
|
411
|
-
onClick: this.handleClear
|
|
413
|
+
onClick: this.handleClear,
|
|
414
|
+
role: 'button',
|
|
415
|
+
tabIndex: 0
|
|
412
416
|
}, /*#__PURE__*/_react.default.createElement(_semiIcons.IconClear, null));
|
|
413
417
|
}
|
|
414
418
|
|
|
@@ -443,7 +447,8 @@ class Cascader extends _baseComponent.default {
|
|
|
443
447
|
suffix,
|
|
444
448
|
insetLabel,
|
|
445
449
|
triggerRender,
|
|
446
|
-
showClear
|
|
450
|
+
showClear,
|
|
451
|
+
id
|
|
447
452
|
} = this.props;
|
|
448
453
|
const {
|
|
449
454
|
isOpen,
|
|
@@ -485,12 +490,28 @@ class Cascader extends _baseComponent.default {
|
|
|
485
490
|
}, suffix ? this.renderSuffix() : null), /*#__PURE__*/_react.default.createElement(_react.Fragment, {
|
|
486
491
|
key: 'arrow'
|
|
487
492
|
}, this.renderArrow())];
|
|
493
|
+
/**
|
|
494
|
+
* Reasons for disabling the a11y eslint rule:
|
|
495
|
+
* The following attributes(aria-controls,aria-expanded) will be automatically added by Tooltip, no need to declare here
|
|
496
|
+
*/
|
|
497
|
+
|
|
488
498
|
return /*#__PURE__*/_react.default.createElement("div", (0, _assign.default)({
|
|
489
499
|
className: classNames,
|
|
490
500
|
style: style,
|
|
491
501
|
ref: this.triggerRef,
|
|
492
|
-
onClick: e => this.foundation.handleClick(e)
|
|
493
|
-
|
|
502
|
+
onClick: e => this.foundation.handleClick(e),
|
|
503
|
+
"aria-invalid": this.props['aria-invalid'],
|
|
504
|
+
"aria-errormessage": this.props['aria-errormessage'],
|
|
505
|
+
"aria-label": this.props['aria-label'],
|
|
506
|
+
"aria-labelledby": this.props['aria-labelledby'],
|
|
507
|
+
"aria-describedby": this.props["aria-describedby"],
|
|
508
|
+
"aria-required": this.props['aria-required'],
|
|
509
|
+
id: id
|
|
510
|
+
}, mouseEvent, {
|
|
511
|
+
// eslint-disable-next-line jsx-a11y/role-has-required-aria-props
|
|
512
|
+
role: 'combobox',
|
|
513
|
+
tabIndex: 0
|
|
514
|
+
}), inner);
|
|
494
515
|
};
|
|
495
516
|
|
|
496
517
|
this.state = {
|
|
@@ -909,6 +930,11 @@ class Cascader extends _baseComponent.default {
|
|
|
909
930
|
|
|
910
931
|
Cascader.contextType = _context4.default;
|
|
911
932
|
Cascader.propTypes = {
|
|
933
|
+
'aria-labelledby': _propTypes.default.string,
|
|
934
|
+
'aria-invalid': _propTypes.default.bool,
|
|
935
|
+
'aria-errormessage': _propTypes.default.string,
|
|
936
|
+
'aria-describedby': _propTypes.default.string,
|
|
937
|
+
'aria-required': _propTypes.default.bool,
|
|
912
938
|
arrowIcon: _propTypes.default.node,
|
|
913
939
|
changeOnSelect: _propTypes.default.bool,
|
|
914
940
|
defaultValue: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.array]),
|
|
@@ -934,6 +960,8 @@ Cascader.propTypes = {
|
|
|
934
960
|
suffix: _propTypes.default.node,
|
|
935
961
|
prefix: _propTypes.default.node,
|
|
936
962
|
insetLabel: _propTypes.default.node,
|
|
963
|
+
insetLabelId: _propTypes.default.string,
|
|
964
|
+
id: _propTypes.default.string,
|
|
937
965
|
displayProp: _propTypes.default.string,
|
|
938
966
|
displayRender: _propTypes.default.func,
|
|
939
967
|
onChange: _propTypes.default.func,
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { CheckboxAdapter, BasicCheckboxEvent, BasicTargetObject, BaseCheckboxProps } from '@douyinfe/semi-foundation/lib/cjs/checkbox/checkboxFoundation';
|
|
3
|
+
import CheckboxFoundation, { CheckboxAdapter, BasicCheckboxEvent, BasicTargetObject, BaseCheckboxProps } from '@douyinfe/semi-foundation/lib/cjs/checkbox/checkboxFoundation';
|
|
4
4
|
import CheckboxInner from './checkboxInner';
|
|
5
5
|
import BaseComponent from '../_base/baseComponent';
|
|
6
6
|
import '@douyinfe/semi-foundation/lib/cjs/checkbox/checkbox.css';
|
|
7
7
|
export declare type CheckboxEvent = BasicCheckboxEvent;
|
|
8
8
|
export declare type TargetObject = BasicTargetObject;
|
|
9
9
|
export interface CheckboxProps extends BaseCheckboxProps {
|
|
10
|
+
'aria-describedby'?: React.AriaAttributes['aria-describedby'];
|
|
11
|
+
'aria-errormessage'?: React.AriaAttributes['aria-errormessage'];
|
|
12
|
+
'aria-invalid'?: React.AriaAttributes['aria-invalid'];
|
|
13
|
+
'aria-labelledby'?: React.AriaAttributes['aria-labelledby'];
|
|
14
|
+
'aria-required'?: React.AriaAttributes['aria-required'];
|
|
10
15
|
onChange?: (e: CheckboxEvent) => any;
|
|
11
16
|
style?: React.CSSProperties;
|
|
12
17
|
onMouseEnter?: React.MouseEventHandler<HTMLSpanElement>;
|
|
13
18
|
onMouseLeave?: React.MouseEventHandler<HTMLSpanElement>;
|
|
14
19
|
extra?: React.ReactNode;
|
|
20
|
+
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
21
|
+
role?: React.HTMLAttributes<HTMLSpanElement>['role'];
|
|
22
|
+
tabIndex?: number;
|
|
15
23
|
}
|
|
16
24
|
interface CheckboxState {
|
|
17
25
|
checked: boolean;
|
|
@@ -28,6 +36,11 @@ declare class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
28
36
|
};
|
|
29
37
|
}>;
|
|
30
38
|
static propTypes: {
|
|
39
|
+
'aria-describedby': PropTypes.Requireable<string>;
|
|
40
|
+
'aria-errormessage': PropTypes.Requireable<string>;
|
|
41
|
+
'aria-invalid': PropTypes.Requireable<boolean>;
|
|
42
|
+
'aria-labelledby': PropTypes.Requireable<string>;
|
|
43
|
+
'aria-required': PropTypes.Requireable<boolean>;
|
|
31
44
|
checked: PropTypes.Requireable<boolean>;
|
|
32
45
|
defaultChecked: PropTypes.Requireable<boolean>;
|
|
33
46
|
disabled: PropTypes.Requireable<boolean>;
|
|
@@ -40,6 +53,9 @@ declare class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
40
53
|
onMouseEnter: PropTypes.Requireable<(...args: any[]) => any>;
|
|
41
54
|
onMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
|
|
42
55
|
extra: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
56
|
+
index: PropTypes.Requireable<number>;
|
|
57
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
58
|
+
tabIndex: PropTypes.Requireable<number>;
|
|
43
59
|
};
|
|
44
60
|
static defaultProps: {
|
|
45
61
|
defaultChecked: boolean;
|
|
@@ -50,12 +66,16 @@ declare class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
50
66
|
};
|
|
51
67
|
checkboxEntity: CheckboxInner;
|
|
52
68
|
get adapter(): CheckboxAdapter<CheckboxProps, CheckboxState>;
|
|
69
|
+
foundation: CheckboxFoundation;
|
|
70
|
+
addonId: string;
|
|
71
|
+
extraId: string;
|
|
53
72
|
constructor(props: CheckboxProps);
|
|
54
73
|
componentDidUpdate(prevProps: CheckboxProps): void;
|
|
55
74
|
isInGroup(): any;
|
|
56
75
|
focus(): void;
|
|
57
76
|
blur(): void;
|
|
58
77
|
handleChange: React.MouseEventHandler<HTMLSpanElement>;
|
|
78
|
+
handleEnterPress: (e: React.KeyboardEvent<HTMLSpanElement>) => void;
|
|
59
79
|
render(): JSX.Element;
|
|
60
80
|
}
|
|
61
81
|
export default Checkbox;
|
|
@@ -38,6 +38,8 @@ require("@douyinfe/semi-foundation/lib/cjs/checkbox/checkbox.css");
|
|
|
38
38
|
|
|
39
39
|
var _context2 = require("./context");
|
|
40
40
|
|
|
41
|
+
var _uuid = require("@douyinfe/semi-foundation/lib/cjs/utils/uuid");
|
|
42
|
+
|
|
41
43
|
/* eslint-disable max-len */
|
|
42
44
|
class Checkbox extends _baseComponent.default {
|
|
43
45
|
constructor(props) {
|
|
@@ -45,11 +47,19 @@ class Checkbox extends _baseComponent.default {
|
|
|
45
47
|
|
|
46
48
|
this.handleChange = e => this.foundation.handleChange(e);
|
|
47
49
|
|
|
50
|
+
this.handleEnterPress = e => this.foundation.handleEnterPress(e);
|
|
51
|
+
|
|
48
52
|
const checked = false;
|
|
49
53
|
this.state = {
|
|
50
54
|
checked: props.checked || props.defaultChecked || checked
|
|
51
55
|
};
|
|
52
56
|
this.checkboxEntity = null;
|
|
57
|
+
this.addonId = (0, _uuid.getUuidShort)({
|
|
58
|
+
prefix: 'addon'
|
|
59
|
+
});
|
|
60
|
+
this.extraId = (0, _uuid.getUuidShort)({
|
|
61
|
+
prefix: 'extra'
|
|
62
|
+
});
|
|
53
63
|
this.foundation = new _checkboxFoundation.default(this.adapter);
|
|
54
64
|
}
|
|
55
65
|
|
|
@@ -109,6 +119,8 @@ class Checkbox extends _baseComponent.default {
|
|
|
109
119
|
onMouseLeave,
|
|
110
120
|
extra,
|
|
111
121
|
value,
|
|
122
|
+
role,
|
|
123
|
+
tabIndex,
|
|
112
124
|
id
|
|
113
125
|
} = this.props;
|
|
114
126
|
const {
|
|
@@ -118,8 +130,9 @@ class Checkbox extends _baseComponent.default {
|
|
|
118
130
|
checked,
|
|
119
131
|
disabled
|
|
120
132
|
};
|
|
133
|
+
const inGroup = this.isInGroup();
|
|
121
134
|
|
|
122
|
-
if (
|
|
135
|
+
if (inGroup) {
|
|
123
136
|
if (this.context.checkboxGroup.value) {
|
|
124
137
|
var _context;
|
|
125
138
|
|
|
@@ -155,34 +168,52 @@ class Checkbox extends _baseComponent.default {
|
|
|
155
168
|
const extraCls = (0, _classnames.default)("".concat(prefix, "-extra"), {
|
|
156
169
|
["".concat(prefix, "-cardType_extra_noChildren")]: props.isCardType && !children
|
|
157
170
|
});
|
|
158
|
-
const name =
|
|
171
|
+
const name = inGroup && this.context.checkboxGroup.name;
|
|
159
172
|
|
|
160
173
|
const renderContent = () => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children ? /*#__PURE__*/_react.default.createElement("span", {
|
|
174
|
+
id: this.addonId,
|
|
161
175
|
className: "".concat(prefix, "-addon")
|
|
162
176
|
}, children) : null, extra ? /*#__PURE__*/_react.default.createElement("div", {
|
|
177
|
+
id: this.extraId,
|
|
163
178
|
className: extraCls
|
|
164
179
|
}, extra) : null);
|
|
165
180
|
|
|
166
|
-
return
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
181
|
+
return (
|
|
182
|
+
/*#__PURE__*/
|
|
183
|
+
// label is better than span, however span is here which is to solve gitlab issue #364
|
|
184
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
185
|
+
_react.default.createElement("span", {
|
|
186
|
+
role: role,
|
|
187
|
+
tabIndex: tabIndex,
|
|
188
|
+
style: style,
|
|
189
|
+
className: wrapper,
|
|
190
|
+
id: id,
|
|
191
|
+
onMouseEnter: onMouseEnter,
|
|
192
|
+
onMouseLeave: onMouseLeave,
|
|
193
|
+
onClick: this.handleChange,
|
|
194
|
+
onKeyPress: this.handleEnterPress,
|
|
195
|
+
"aria-labelledby": this.props['aria-labelledby']
|
|
196
|
+
}, /*#__PURE__*/_react.default.createElement(_checkboxInner.default, (0, _assign.default)({}, this.props, props, {
|
|
197
|
+
addonId: children && this.addonId,
|
|
198
|
+
extraId: extra && this.extraId,
|
|
199
|
+
name: name,
|
|
200
|
+
isPureCardType: props.isPureCardType,
|
|
201
|
+
ref: ref => {
|
|
202
|
+
this.checkboxEntity = ref;
|
|
203
|
+
}
|
|
204
|
+
})), props.isCardType ? /*#__PURE__*/_react.default.createElement("div", null, renderContent()) : renderContent())
|
|
205
|
+
);
|
|
180
206
|
}
|
|
181
207
|
|
|
182
208
|
}
|
|
183
209
|
|
|
184
210
|
Checkbox.contextType = _context2.Context;
|
|
185
211
|
Checkbox.propTypes = {
|
|
212
|
+
'aria-describedby': _propTypes.default.string,
|
|
213
|
+
'aria-errormessage': _propTypes.default.string,
|
|
214
|
+
'aria-invalid': _propTypes.default.bool,
|
|
215
|
+
'aria-labelledby': _propTypes.default.string,
|
|
216
|
+
'aria-required': _propTypes.default.bool,
|
|
186
217
|
// Specifies whether it is currently selected
|
|
187
218
|
checked: _propTypes.default.bool,
|
|
188
219
|
// Initial check
|
|
@@ -199,7 +230,10 @@ Checkbox.propTypes = {
|
|
|
199
230
|
prefixCls: _propTypes.default.string,
|
|
200
231
|
onMouseEnter: _propTypes.default.func,
|
|
201
232
|
onMouseLeave: _propTypes.default.func,
|
|
202
|
-
extra: _propTypes.default.node
|
|
233
|
+
extra: _propTypes.default.node,
|
|
234
|
+
index: _propTypes.default.number,
|
|
235
|
+
'aria-label': _propTypes.default.string,
|
|
236
|
+
tabIndex: _propTypes.default.number
|
|
203
237
|
};
|
|
204
238
|
Checkbox.defaultProps = {
|
|
205
239
|
defaultChecked: false,
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { CheckboxGroupAdapter } from '@douyinfe/semi-foundation/lib/cjs/checkbox/checkboxGroupFoundation';
|
|
3
|
+
import CheckboxGroupFoundation, { CheckboxGroupAdapter } from '@douyinfe/semi-foundation/lib/cjs/checkbox/checkboxGroupFoundation';
|
|
4
4
|
import BaseComponent from '../_base/baseComponent';
|
|
5
5
|
import { CheckboxEvent } from './checkbox';
|
|
6
6
|
export declare type CheckboxDirection = 'horizontal' | 'vertical';
|
|
7
7
|
export declare type CheckboxType = 'default' | 'card' | 'pureCard';
|
|
8
8
|
export declare type CheckboxGroupProps = {
|
|
9
|
+
'aria-describedby'?: React.AriaAttributes['aria-describedby'];
|
|
10
|
+
'aria-errormessage'?: React.AriaAttributes['aria-errormessage'];
|
|
11
|
+
'aria-invalid'?: React.AriaAttributes['aria-invalid'];
|
|
12
|
+
'aria-labelledby'?: React.AriaAttributes['aria-labelledby'];
|
|
13
|
+
'aria-required'?: React.AriaAttributes['aria-required'];
|
|
9
14
|
defaultValue?: any[];
|
|
10
15
|
disabled?: boolean;
|
|
11
16
|
name?: string;
|
|
@@ -19,12 +24,18 @@ export declare type CheckboxGroupProps = {
|
|
|
19
24
|
className?: string;
|
|
20
25
|
type?: CheckboxType;
|
|
21
26
|
id?: string;
|
|
27
|
+
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
22
28
|
};
|
|
23
29
|
export declare type CheckboxGroupState = {
|
|
24
30
|
value?: any[];
|
|
25
31
|
};
|
|
26
32
|
declare class CheckboxGroup extends BaseComponent<CheckboxGroupProps, CheckboxGroupState> {
|
|
27
33
|
static propTypes: {
|
|
34
|
+
'aria-describedby': PropTypes.Requireable<string>;
|
|
35
|
+
'aria-errormessage': PropTypes.Requireable<string>;
|
|
36
|
+
'aria-invalid': PropTypes.Requireable<boolean>;
|
|
37
|
+
'aria-labelledby': PropTypes.Requireable<string>;
|
|
38
|
+
'aria-required': PropTypes.Requireable<boolean>;
|
|
28
39
|
defaultValue: PropTypes.Requireable<any[]>;
|
|
29
40
|
disabled: PropTypes.Requireable<boolean>;
|
|
30
41
|
name: PropTypes.Requireable<string>;
|
|
@@ -40,6 +51,7 @@ declare class CheckboxGroup extends BaseComponent<CheckboxGroupProps, CheckboxGr
|
|
|
40
51
|
};
|
|
41
52
|
static defaultProps: Partial<CheckboxGroupProps>;
|
|
42
53
|
get adapter(): CheckboxGroupAdapter;
|
|
54
|
+
foundation: CheckboxGroupFoundation;
|
|
43
55
|
constructor(props: CheckboxGroupProps);
|
|
44
56
|
componentDidMount(): void;
|
|
45
57
|
componentDidUpdate(prevProps: CheckboxGroupProps): void;
|
|
@@ -93,7 +93,8 @@ class CheckboxGroup extends _baseComponent.default {
|
|
|
93
93
|
className,
|
|
94
94
|
id,
|
|
95
95
|
style,
|
|
96
|
-
type
|
|
96
|
+
type,
|
|
97
|
+
disabled
|
|
97
98
|
} = this.props;
|
|
98
99
|
const isPureCardType = type === _constants.strings.TYPE_PURECARD;
|
|
99
100
|
const isCardType = type === _constants.strings.TYPE_CARD || isPureCardType;
|
|
@@ -113,6 +114,7 @@ class CheckboxGroup extends _baseComponent.default {
|
|
|
113
114
|
inner = (0, _map.default)(_context5 = options || []).call(_context5, (option, index) => {
|
|
114
115
|
if (typeof option === 'string') {
|
|
115
116
|
return /*#__PURE__*/_react.default.createElement(_checkbox.default, {
|
|
117
|
+
role: "listitem",
|
|
116
118
|
key: index,
|
|
117
119
|
disabled: this.props.disabled,
|
|
118
120
|
value: option,
|
|
@@ -120,6 +122,7 @@ class CheckboxGroup extends _baseComponent.default {
|
|
|
120
122
|
}, option);
|
|
121
123
|
} else {
|
|
122
124
|
return /*#__PURE__*/_react.default.createElement(_checkbox.default, {
|
|
125
|
+
role: "listitem",
|
|
123
126
|
key: index,
|
|
124
127
|
disabled: option.disabled || this.props.disabled,
|
|
125
128
|
value: option.value,
|
|
@@ -135,14 +138,19 @@ class CheckboxGroup extends _baseComponent.default {
|
|
|
135
138
|
var _context6;
|
|
136
139
|
|
|
137
140
|
inner = (0, _map.default)(_context6 = _react.default.Children.toArray(children)).call(_context6, (itm, index) => /*#__PURE__*/_react.default.cloneElement(itm, {
|
|
138
|
-
key: index
|
|
141
|
+
key: index,
|
|
142
|
+
role: 'listitem'
|
|
139
143
|
}));
|
|
140
144
|
}
|
|
141
145
|
|
|
142
146
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
147
|
+
id: id,
|
|
148
|
+
role: "list",
|
|
149
|
+
"aria-label": this.props['aria-label'],
|
|
143
150
|
className: prefixClsDisplay,
|
|
144
151
|
style: style,
|
|
145
|
-
|
|
152
|
+
"aria-labelledby": this.props['aria-labelledby'],
|
|
153
|
+
"aria-describedby": this.props['aria-describedby']
|
|
146
154
|
}, /*#__PURE__*/_react.default.createElement(_context7.Context.Provider, {
|
|
147
155
|
value: {
|
|
148
156
|
checkboxGroup: {
|
|
@@ -160,6 +168,11 @@ class CheckboxGroup extends _baseComponent.default {
|
|
|
160
168
|
}
|
|
161
169
|
|
|
162
170
|
CheckboxGroup.propTypes = {
|
|
171
|
+
'aria-describedby': _propTypes.default.string,
|
|
172
|
+
'aria-errormessage': _propTypes.default.string,
|
|
173
|
+
'aria-invalid': _propTypes.default.bool,
|
|
174
|
+
'aria-labelledby': _propTypes.default.string,
|
|
175
|
+
'aria-required': _propTypes.default.bool,
|
|
163
176
|
defaultValue: _propTypes.default.array,
|
|
164
177
|
disabled: _propTypes.default.bool,
|
|
165
178
|
name: _propTypes.default.string,
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import React, { PureComponent } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
export interface CheckboxInnerProps {
|
|
4
|
+
'aria-describedby'?: React.AriaAttributes['aria-describedby'];
|
|
5
|
+
'aria-errormessage'?: React.AriaAttributes['aria-errormessage'];
|
|
6
|
+
'aria-invalid'?: React.AriaAttributes['aria-invalid'];
|
|
7
|
+
'aria-labelledby'?: React.AriaAttributes['aria-labelledby'];
|
|
8
|
+
'aria-required'?: React.AriaAttributes['aria-required'];
|
|
4
9
|
indeterminate?: boolean;
|
|
5
10
|
checked?: boolean;
|
|
6
11
|
disabled?: boolean;
|
|
@@ -8,6 +13,9 @@ export interface CheckboxInnerProps {
|
|
|
8
13
|
name?: string;
|
|
9
14
|
isPureCardType?: boolean;
|
|
10
15
|
ref?: React.MutableRefObject<CheckboxInner> | ((ref: CheckboxInner) => void);
|
|
16
|
+
addonId?: string;
|
|
17
|
+
extraId?: string;
|
|
18
|
+
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
11
19
|
}
|
|
12
20
|
declare class CheckboxInner extends PureComponent<CheckboxInnerProps> {
|
|
13
21
|
static contextType: React.Context<{
|
|
@@ -21,6 +29,11 @@ declare class CheckboxInner extends PureComponent<CheckboxInnerProps> {
|
|
|
21
29
|
};
|
|
22
30
|
}>;
|
|
23
31
|
static propTypes: {
|
|
32
|
+
'aria-describedby': PropTypes.Requireable<string>;
|
|
33
|
+
'aria-errormessage': PropTypes.Requireable<string>;
|
|
34
|
+
'aria-invalid': PropTypes.Requireable<boolean>;
|
|
35
|
+
'aria-labelledby': PropTypes.Requireable<string>;
|
|
36
|
+
'aria-required': PropTypes.Requireable<boolean>;
|
|
24
37
|
checked: PropTypes.Requireable<boolean>;
|
|
25
38
|
disabled: PropTypes.Requireable<boolean>;
|
|
26
39
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -28,6 +41,8 @@ declare class CheckboxInner extends PureComponent<CheckboxInnerProps> {
|
|
|
28
41
|
grouped: PropTypes.Requireable<boolean>;
|
|
29
42
|
value: PropTypes.Requireable<any>;
|
|
30
43
|
isPureCardType: PropTypes.Requireable<boolean>;
|
|
44
|
+
addonId: PropTypes.Requireable<string>;
|
|
45
|
+
extraId: PropTypes.Requireable<string>;
|
|
31
46
|
};
|
|
32
47
|
static defaultProps: {
|
|
33
48
|
onChange: (...args: any[]) => void;
|