@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
|
@@ -15,12 +15,15 @@ export default class SplitButtonGroup extends BaseComponent {
|
|
|
15
15
|
const cls = classNames("".concat(prefixCls, "-split"), className);
|
|
16
16
|
return /*#__PURE__*/React.createElement("div", {
|
|
17
17
|
className: cls,
|
|
18
|
-
style: style
|
|
18
|
+
style: style,
|
|
19
|
+
role: "group",
|
|
20
|
+
"aria-label": this.props['aria-label']
|
|
19
21
|
}, children);
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
}
|
|
23
25
|
SplitButtonGroup.propTypes = {
|
|
24
26
|
style: PropTypes.object,
|
|
25
|
-
className: PropTypes.string
|
|
27
|
+
className: PropTypes.string,
|
|
28
|
+
'aria-label': PropTypes.string
|
|
26
29
|
};
|
package/lib/es/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/es/card/index.js
CHANGED
|
@@ -150,6 +150,7 @@ class Card extends PureComponent {
|
|
|
150
150
|
[_concatInstanceProperty(_context = "".concat(prefixcls, "-shadows-")).call(_context, shadows)]: shadows
|
|
151
151
|
});
|
|
152
152
|
return /*#__PURE__*/React.createElement("div", _Object$assign({}, others, {
|
|
153
|
+
"aria-busy": this.props.loading,
|
|
153
154
|
className: cardCls,
|
|
154
155
|
style: style
|
|
155
156
|
}), this.renderHeader(), this.renderCover(), this.renderBody(), this.renderFooter());
|
|
@@ -175,7 +176,8 @@ Card.propTypes = {
|
|
|
175
176
|
loading: PropTypes.bool,
|
|
176
177
|
shadows: PropTypes.oneOf(strings.SHADOWS),
|
|
177
178
|
style: PropTypes.object,
|
|
178
|
-
title: PropTypes.node
|
|
179
|
+
title: PropTypes.node,
|
|
180
|
+
'aria-label': PropTypes.string
|
|
179
181
|
};
|
|
180
182
|
Card.defaultProps = {
|
|
181
183
|
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>;
|
package/lib/es/cascader/index.js
CHANGED
|
@@ -134,7 +134,7 @@ class Cascader extends BaseComponent {
|
|
|
134
134
|
const renderData = this.foundation.getRenderData();
|
|
135
135
|
const content = /*#__PURE__*/React.createElement("div", {
|
|
136
136
|
className: popoverCls,
|
|
137
|
-
role: "
|
|
137
|
+
role: "listbox",
|
|
138
138
|
style: dropdownStyle
|
|
139
139
|
}, topSlot, /*#__PURE__*/React.createElement(Item, {
|
|
140
140
|
activeKeys: activeKeys,
|
|
@@ -262,7 +262,8 @@ class Cascader extends BaseComponent {
|
|
|
262
262
|
this.renderPrefix = () => {
|
|
263
263
|
const {
|
|
264
264
|
prefix,
|
|
265
|
-
insetLabel
|
|
265
|
+
insetLabel,
|
|
266
|
+
insetLabelId
|
|
266
267
|
} = this.props;
|
|
267
268
|
const labelNode = prefix || insetLabel;
|
|
268
269
|
const prefixWrapperCls = cls({
|
|
@@ -273,7 +274,8 @@ class Cascader extends BaseComponent {
|
|
|
273
274
|
["".concat(prefixcls, "-prefix-icon")]: isSemiIcon(labelNode)
|
|
274
275
|
});
|
|
275
276
|
return /*#__PURE__*/React.createElement("div", {
|
|
276
|
-
className: prefixWrapperCls
|
|
277
|
+
className: prefixWrapperCls,
|
|
278
|
+
id: insetLabelId
|
|
277
279
|
}, labelNode);
|
|
278
280
|
};
|
|
279
281
|
|
|
@@ -352,7 +354,9 @@ class Cascader extends BaseComponent {
|
|
|
352
354
|
if (allowClear) {
|
|
353
355
|
return /*#__PURE__*/React.createElement("div", {
|
|
354
356
|
className: clearCls,
|
|
355
|
-
onClick: this.handleClear
|
|
357
|
+
onClick: this.handleClear,
|
|
358
|
+
role: 'button',
|
|
359
|
+
tabIndex: 0
|
|
356
360
|
}, /*#__PURE__*/React.createElement(IconClear, null));
|
|
357
361
|
}
|
|
358
362
|
|
|
@@ -387,7 +391,8 @@ class Cascader extends BaseComponent {
|
|
|
387
391
|
suffix,
|
|
388
392
|
insetLabel,
|
|
389
393
|
triggerRender,
|
|
390
|
-
showClear
|
|
394
|
+
showClear,
|
|
395
|
+
id
|
|
391
396
|
} = this.props;
|
|
392
397
|
const {
|
|
393
398
|
isOpen,
|
|
@@ -429,12 +434,28 @@ class Cascader extends BaseComponent {
|
|
|
429
434
|
}, suffix ? this.renderSuffix() : null), /*#__PURE__*/React.createElement(Fragment, {
|
|
430
435
|
key: 'arrow'
|
|
431
436
|
}, this.renderArrow())];
|
|
437
|
+
/**
|
|
438
|
+
* Reasons for disabling the a11y eslint rule:
|
|
439
|
+
* The following attributes(aria-controls,aria-expanded) will be automatically added by Tooltip, no need to declare here
|
|
440
|
+
*/
|
|
441
|
+
|
|
432
442
|
return /*#__PURE__*/React.createElement("div", _Object$assign({
|
|
433
443
|
className: classNames,
|
|
434
444
|
style: style,
|
|
435
445
|
ref: this.triggerRef,
|
|
436
|
-
onClick: e => this.foundation.handleClick(e)
|
|
437
|
-
|
|
446
|
+
onClick: e => this.foundation.handleClick(e),
|
|
447
|
+
"aria-invalid": this.props['aria-invalid'],
|
|
448
|
+
"aria-errormessage": this.props['aria-errormessage'],
|
|
449
|
+
"aria-label": this.props['aria-label'],
|
|
450
|
+
"aria-labelledby": this.props['aria-labelledby'],
|
|
451
|
+
"aria-describedby": this.props["aria-describedby"],
|
|
452
|
+
"aria-required": this.props['aria-required'],
|
|
453
|
+
id: id
|
|
454
|
+
}, mouseEvent, {
|
|
455
|
+
// eslint-disable-next-line jsx-a11y/role-has-required-aria-props
|
|
456
|
+
role: 'combobox',
|
|
457
|
+
tabIndex: 0
|
|
458
|
+
}), inner);
|
|
438
459
|
};
|
|
439
460
|
|
|
440
461
|
this.state = {
|
|
@@ -856,6 +877,11 @@ class Cascader extends BaseComponent {
|
|
|
856
877
|
|
|
857
878
|
Cascader.contextType = ConfigContext;
|
|
858
879
|
Cascader.propTypes = {
|
|
880
|
+
'aria-labelledby': PropTypes.string,
|
|
881
|
+
'aria-invalid': PropTypes.bool,
|
|
882
|
+
'aria-errormessage': PropTypes.string,
|
|
883
|
+
'aria-describedby': PropTypes.string,
|
|
884
|
+
'aria-required': PropTypes.bool,
|
|
859
885
|
arrowIcon: PropTypes.node,
|
|
860
886
|
changeOnSelect: PropTypes.bool,
|
|
861
887
|
defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
|
|
@@ -881,6 +907,8 @@ Cascader.propTypes = {
|
|
|
881
907
|
suffix: PropTypes.node,
|
|
882
908
|
prefix: PropTypes.node,
|
|
883
909
|
insetLabel: PropTypes.node,
|
|
910
|
+
insetLabelId: PropTypes.string,
|
|
911
|
+
id: PropTypes.string,
|
|
884
912
|
displayProp: PropTypes.string,
|
|
885
913
|
displayRender: PropTypes.func,
|
|
886
914
|
onChange: PropTypes.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/es/checkbox/checkboxFoundation';
|
|
3
|
+
import CheckboxFoundation, { CheckboxAdapter, BasicCheckboxEvent, BasicTargetObject, BaseCheckboxProps } from '@douyinfe/semi-foundation/lib/es/checkbox/checkboxFoundation';
|
|
4
4
|
import CheckboxInner from './checkboxInner';
|
|
5
5
|
import BaseComponent from '../_base/baseComponent';
|
|
6
6
|
import '@douyinfe/semi-foundation/lib/es/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;
|
|
@@ -14,6 +14,7 @@ import CheckboxInner from './checkboxInner';
|
|
|
14
14
|
import BaseComponent from '../_base/baseComponent';
|
|
15
15
|
import '@douyinfe/semi-foundation/lib/es/checkbox/checkbox.css';
|
|
16
16
|
import { Context } from './context';
|
|
17
|
+
import { getUuidShort } from '@douyinfe/semi-foundation/lib/es/utils/uuid';
|
|
17
18
|
|
|
18
19
|
class Checkbox extends BaseComponent {
|
|
19
20
|
constructor(props) {
|
|
@@ -21,11 +22,19 @@ class Checkbox extends BaseComponent {
|
|
|
21
22
|
|
|
22
23
|
this.handleChange = e => this.foundation.handleChange(e);
|
|
23
24
|
|
|
25
|
+
this.handleEnterPress = e => this.foundation.handleEnterPress(e);
|
|
26
|
+
|
|
24
27
|
const checked = false;
|
|
25
28
|
this.state = {
|
|
26
29
|
checked: props.checked || props.defaultChecked || checked
|
|
27
30
|
};
|
|
28
31
|
this.checkboxEntity = null;
|
|
32
|
+
this.addonId = getUuidShort({
|
|
33
|
+
prefix: 'addon'
|
|
34
|
+
});
|
|
35
|
+
this.extraId = getUuidShort({
|
|
36
|
+
prefix: 'extra'
|
|
37
|
+
});
|
|
29
38
|
this.foundation = new CheckboxFoundation(this.adapter);
|
|
30
39
|
}
|
|
31
40
|
|
|
@@ -85,6 +94,8 @@ class Checkbox extends BaseComponent {
|
|
|
85
94
|
onMouseLeave,
|
|
86
95
|
extra,
|
|
87
96
|
value,
|
|
97
|
+
role,
|
|
98
|
+
tabIndex,
|
|
88
99
|
id
|
|
89
100
|
} = this.props;
|
|
90
101
|
const {
|
|
@@ -94,8 +105,9 @@ class Checkbox extends BaseComponent {
|
|
|
94
105
|
checked,
|
|
95
106
|
disabled
|
|
96
107
|
};
|
|
108
|
+
const inGroup = this.isInGroup();
|
|
97
109
|
|
|
98
|
-
if (
|
|
110
|
+
if (inGroup) {
|
|
99
111
|
if (this.context.checkboxGroup.value) {
|
|
100
112
|
var _context;
|
|
101
113
|
|
|
@@ -132,34 +144,52 @@ class Checkbox extends BaseComponent {
|
|
|
132
144
|
const extraCls = classnames("".concat(prefix, "-extra"), {
|
|
133
145
|
["".concat(prefix, "-cardType_extra_noChildren")]: props.isCardType && !children
|
|
134
146
|
});
|
|
135
|
-
const name =
|
|
147
|
+
const name = inGroup && this.context.checkboxGroup.name;
|
|
136
148
|
|
|
137
149
|
const renderContent = () => /*#__PURE__*/React.createElement(React.Fragment, null, children ? /*#__PURE__*/React.createElement("span", {
|
|
150
|
+
id: this.addonId,
|
|
138
151
|
className: "".concat(prefix, "-addon")
|
|
139
152
|
}, children) : null, extra ? /*#__PURE__*/React.createElement("div", {
|
|
153
|
+
id: this.extraId,
|
|
140
154
|
className: extraCls
|
|
141
155
|
}, extra) : null);
|
|
142
156
|
|
|
143
|
-
return
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
+
return (
|
|
158
|
+
/*#__PURE__*/
|
|
159
|
+
// label is better than span, however span is here which is to solve gitlab issue #364
|
|
160
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
161
|
+
React.createElement("span", {
|
|
162
|
+
role: role,
|
|
163
|
+
tabIndex: tabIndex,
|
|
164
|
+
style: style,
|
|
165
|
+
className: wrapper,
|
|
166
|
+
id: id,
|
|
167
|
+
onMouseEnter: onMouseEnter,
|
|
168
|
+
onMouseLeave: onMouseLeave,
|
|
169
|
+
onClick: this.handleChange,
|
|
170
|
+
onKeyPress: this.handleEnterPress,
|
|
171
|
+
"aria-labelledby": this.props['aria-labelledby']
|
|
172
|
+
}, /*#__PURE__*/React.createElement(CheckboxInner, _Object$assign({}, this.props, props, {
|
|
173
|
+
addonId: children && this.addonId,
|
|
174
|
+
extraId: extra && this.extraId,
|
|
175
|
+
name: name,
|
|
176
|
+
isPureCardType: props.isPureCardType,
|
|
177
|
+
ref: ref => {
|
|
178
|
+
this.checkboxEntity = ref;
|
|
179
|
+
}
|
|
180
|
+
})), props.isCardType ? /*#__PURE__*/React.createElement("div", null, renderContent()) : renderContent())
|
|
181
|
+
);
|
|
157
182
|
}
|
|
158
183
|
|
|
159
184
|
}
|
|
160
185
|
|
|
161
186
|
Checkbox.contextType = Context;
|
|
162
187
|
Checkbox.propTypes = {
|
|
188
|
+
'aria-describedby': PropTypes.string,
|
|
189
|
+
'aria-errormessage': PropTypes.string,
|
|
190
|
+
'aria-invalid': PropTypes.bool,
|
|
191
|
+
'aria-labelledby': PropTypes.string,
|
|
192
|
+
'aria-required': PropTypes.bool,
|
|
163
193
|
// Specifies whether it is currently selected
|
|
164
194
|
checked: PropTypes.bool,
|
|
165
195
|
// Initial check
|
|
@@ -176,7 +206,10 @@ Checkbox.propTypes = {
|
|
|
176
206
|
prefixCls: PropTypes.string,
|
|
177
207
|
onMouseEnter: PropTypes.func,
|
|
178
208
|
onMouseLeave: PropTypes.func,
|
|
179
|
-
extra: PropTypes.node
|
|
209
|
+
extra: PropTypes.node,
|
|
210
|
+
index: PropTypes.number,
|
|
211
|
+
'aria-label': PropTypes.string,
|
|
212
|
+
tabIndex: PropTypes.number
|
|
180
213
|
};
|
|
181
214
|
Checkbox.defaultProps = {
|
|
182
215
|
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/es/checkbox/checkboxGroupFoundation';
|
|
3
|
+
import CheckboxGroupFoundation, { CheckboxGroupAdapter } from '@douyinfe/semi-foundation/lib/es/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;
|
|
@@ -10,7 +10,7 @@ import React from 'react';
|
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import classnames from 'classnames';
|
|
12
12
|
import { checkboxGroupClasses as css, strings } from '@douyinfe/semi-foundation/lib/es/checkbox/constants';
|
|
13
|
-
import
|
|
13
|
+
import CheckboxGroupFoundation from '@douyinfe/semi-foundation/lib/es/checkbox/checkboxGroupFoundation';
|
|
14
14
|
import BaseComponent from '../_base/baseComponent';
|
|
15
15
|
import { Context } from './context';
|
|
16
16
|
import Checkbox from './checkbox';
|
|
@@ -23,7 +23,7 @@ class CheckboxGroup extends BaseComponent {
|
|
|
23
23
|
this.state = {
|
|
24
24
|
value: props.value || props.defaultValue
|
|
25
25
|
};
|
|
26
|
-
this.foundation = new
|
|
26
|
+
this.foundation = new CheckboxGroupFoundation(this.adapter);
|
|
27
27
|
this.onChange = _bindInstanceProperty(_context = this.onChange).call(_context, this);
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -69,7 +69,8 @@ class CheckboxGroup extends BaseComponent {
|
|
|
69
69
|
className,
|
|
70
70
|
id,
|
|
71
71
|
style,
|
|
72
|
-
type
|
|
72
|
+
type,
|
|
73
|
+
disabled
|
|
73
74
|
} = this.props;
|
|
74
75
|
const isPureCardType = type === strings.TYPE_PURECARD;
|
|
75
76
|
const isCardType = type === strings.TYPE_CARD || isPureCardType;
|
|
@@ -91,6 +92,7 @@ class CheckboxGroup extends BaseComponent {
|
|
|
91
92
|
inner = _mapInstanceProperty(_context5 = options || []).call(_context5, (option, index) => {
|
|
92
93
|
if (typeof option === 'string') {
|
|
93
94
|
return /*#__PURE__*/React.createElement(Checkbox, {
|
|
95
|
+
role: "listitem",
|
|
94
96
|
key: index,
|
|
95
97
|
disabled: this.props.disabled,
|
|
96
98
|
value: option,
|
|
@@ -98,6 +100,7 @@ class CheckboxGroup extends BaseComponent {
|
|
|
98
100
|
}, option);
|
|
99
101
|
} else {
|
|
100
102
|
return /*#__PURE__*/React.createElement(Checkbox, {
|
|
103
|
+
role: "listitem",
|
|
101
104
|
key: index,
|
|
102
105
|
disabled: option.disabled || this.props.disabled,
|
|
103
106
|
value: option.value,
|
|
@@ -113,14 +116,19 @@ class CheckboxGroup extends BaseComponent {
|
|
|
113
116
|
var _context6;
|
|
114
117
|
|
|
115
118
|
inner = _mapInstanceProperty(_context6 = React.Children.toArray(children)).call(_context6, (itm, index) => /*#__PURE__*/React.cloneElement(itm, {
|
|
116
|
-
key: index
|
|
119
|
+
key: index,
|
|
120
|
+
role: 'listitem'
|
|
117
121
|
}));
|
|
118
122
|
}
|
|
119
123
|
|
|
120
124
|
return /*#__PURE__*/React.createElement("div", {
|
|
125
|
+
id: id,
|
|
126
|
+
role: "list",
|
|
127
|
+
"aria-label": this.props['aria-label'],
|
|
121
128
|
className: prefixClsDisplay,
|
|
122
129
|
style: style,
|
|
123
|
-
|
|
130
|
+
"aria-labelledby": this.props['aria-labelledby'],
|
|
131
|
+
"aria-describedby": this.props['aria-describedby']
|
|
124
132
|
}, /*#__PURE__*/React.createElement(Context.Provider, {
|
|
125
133
|
value: {
|
|
126
134
|
checkboxGroup: {
|
|
@@ -138,6 +146,11 @@ class CheckboxGroup extends BaseComponent {
|
|
|
138
146
|
}
|
|
139
147
|
|
|
140
148
|
CheckboxGroup.propTypes = {
|
|
149
|
+
'aria-describedby': PropTypes.string,
|
|
150
|
+
'aria-errormessage': PropTypes.string,
|
|
151
|
+
'aria-invalid': PropTypes.bool,
|
|
152
|
+
'aria-labelledby': PropTypes.string,
|
|
153
|
+
'aria-required': PropTypes.bool,
|
|
141
154
|
defaultValue: PropTypes.array,
|
|
142
155
|
disabled: PropTypes.bool,
|
|
143
156
|
name: PropTypes.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;
|
|
@@ -24,7 +24,9 @@ class CheckboxInner extends PureComponent {
|
|
|
24
24
|
disabled,
|
|
25
25
|
prefixCls,
|
|
26
26
|
name,
|
|
27
|
-
isPureCardType
|
|
27
|
+
isPureCardType,
|
|
28
|
+
addonId,
|
|
29
|
+
extraId
|
|
28
30
|
} = this.props;
|
|
29
31
|
const prefix = prefixCls || css.PREFIX;
|
|
30
32
|
const wrapper = classnames({
|
|
@@ -39,10 +41,18 @@ class CheckboxInner extends PureComponent {
|
|
|
39
41
|
return /*#__PURE__*/React.createElement("span", {
|
|
40
42
|
className: wrapper
|
|
41
43
|
}, /*#__PURE__*/React.createElement("input", {
|
|
44
|
+
type: "checkbox",
|
|
45
|
+
"aria-label": this.props['aria-label'],
|
|
46
|
+
"aria-disabled": disabled,
|
|
47
|
+
"aria-checked": checked,
|
|
48
|
+
"aria-labelledby": addonId,
|
|
49
|
+
"aria-describedby": extraId || this.props['aria-describedby'],
|
|
50
|
+
"aria-invalid": this.props['aria-invalid'],
|
|
51
|
+
"aria-errormessage": this.props['aria-errormessage'],
|
|
52
|
+
"aria-required": this.props['aria-required'],
|
|
42
53
|
ref: ref => {
|
|
43
54
|
this.inputEntity = ref;
|
|
44
55
|
},
|
|
45
|
-
type: "checkbox",
|
|
46
56
|
className: css.INPUT,
|
|
47
57
|
onChange: _noop,
|
|
48
58
|
checked: checked,
|
|
@@ -57,13 +67,20 @@ class CheckboxInner extends PureComponent {
|
|
|
57
67
|
|
|
58
68
|
CheckboxInner.contextType = Context;
|
|
59
69
|
CheckboxInner.propTypes = {
|
|
70
|
+
'aria-describedby': PropTypes.string,
|
|
71
|
+
'aria-errormessage': PropTypes.string,
|
|
72
|
+
'aria-invalid': PropTypes.bool,
|
|
73
|
+
'aria-labelledby': PropTypes.string,
|
|
74
|
+
'aria-required': PropTypes.bool,
|
|
60
75
|
checked: PropTypes.bool,
|
|
61
76
|
disabled: PropTypes.bool,
|
|
62
77
|
onChange: PropTypes.func,
|
|
63
78
|
children: PropTypes.node,
|
|
64
79
|
grouped: PropTypes.bool,
|
|
65
80
|
value: PropTypes.any,
|
|
66
|
-
isPureCardType: PropTypes.bool
|
|
81
|
+
isPureCardType: PropTypes.bool,
|
|
82
|
+
addonId: PropTypes.string,
|
|
83
|
+
extraId: PropTypes.string
|
|
67
84
|
};
|
|
68
85
|
CheckboxInner.defaultProps = {
|
|
69
86
|
onChange: _noop
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { PureComponent, ReactNode
|
|
1
|
+
import React, { CSSProperties, PureComponent, ReactNode } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { CollapseContextType } from './collapse-context';
|
|
4
4
|
export interface CollapsePanelProps {
|
|
@@ -18,6 +18,7 @@ export default class CollapsePanel extends PureComponent<CollapsePanelProps> {
|
|
|
18
18
|
className: PropTypes.Requireable<string>;
|
|
19
19
|
reCalcKey: PropTypes.Requireable<string | number>;
|
|
20
20
|
};
|
|
21
|
+
private ariaID;
|
|
21
22
|
renderHeader(active: boolean, expandIconEnable?: boolean): JSX.Element;
|
|
22
23
|
render(): JSX.Element;
|
|
23
24
|
}
|
package/lib/es/collapse/item.js
CHANGED
|
@@ -20,7 +20,13 @@ import { cssClasses } from '@douyinfe/semi-foundation/lib/es/collapse/constants'
|
|
|
20
20
|
import Collapsible from '../collapsible';
|
|
21
21
|
import CollapseContext from './collapse-context';
|
|
22
22
|
import { IconChevronDown, IconChevronUp } from '@douyinfe/semi-icons';
|
|
23
|
+
import { getUuidShort } from '@douyinfe/semi-foundation/lib/es/utils/uuid';
|
|
23
24
|
export default class CollapsePanel extends PureComponent {
|
|
25
|
+
constructor() {
|
|
26
|
+
super(...arguments);
|
|
27
|
+
this.ariaID = getUuidShort({});
|
|
28
|
+
}
|
|
29
|
+
|
|
24
30
|
renderHeader(active) {
|
|
25
31
|
let expandIconEnable = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
26
32
|
const {
|
|
@@ -44,6 +50,7 @@ export default class CollapsePanel extends PureComponent {
|
|
|
44
50
|
}
|
|
45
51
|
|
|
46
52
|
const icon = /*#__PURE__*/React.createElement("span", {
|
|
53
|
+
"aria-hidden": 'true',
|
|
47
54
|
className: cls(["".concat(cssClasses.PREFIX, "-header-icon"), {
|
|
48
55
|
["".concat(cssClasses.PREFIX, "-header-iconDisabled")]: !expandIconEnable
|
|
49
56
|
}])
|
|
@@ -88,13 +95,13 @@ export default class CollapsePanel extends PureComponent {
|
|
|
88
95
|
["".concat(cssClasses.PREFIX, "-content")]: true
|
|
89
96
|
});
|
|
90
97
|
return /*#__PURE__*/React.createElement("div", _Object$assign({
|
|
91
|
-
role: "Collapse-panel",
|
|
92
98
|
className: itemCls
|
|
93
99
|
}, restProps), /*#__PURE__*/React.createElement("div", {
|
|
94
100
|
role: "button",
|
|
95
101
|
tabIndex: 0,
|
|
96
102
|
className: headerCls,
|
|
97
103
|
"aria-expanded": active ? 'true' : 'false',
|
|
104
|
+
"aria-owns": this.ariaID,
|
|
98
105
|
onClick: e => onClick(itemKey, e)
|
|
99
106
|
}, this.renderHeader(active, children !== undefined)), children && /*#__PURE__*/React.createElement(Collapsible, {
|
|
100
107
|
isOpen: active,
|
|
@@ -102,7 +109,9 @@ export default class CollapsePanel extends PureComponent {
|
|
|
102
109
|
motion: motion,
|
|
103
110
|
reCalcKey: reCalcKey
|
|
104
111
|
}, /*#__PURE__*/React.createElement("div", {
|
|
105
|
-
className: contentCls
|
|
112
|
+
className: contentCls,
|
|
113
|
+
"aria-hidden": !active,
|
|
114
|
+
id: this.ariaID
|
|
106
115
|
}, /*#__PURE__*/React.createElement("div", {
|
|
107
116
|
className: "".concat(cssClasses.PREFIX, "-content-wrapper")
|
|
108
117
|
}, children))));
|