@douyinfe/semi-ui 2.2.0-beta.1 → 2.3.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_base/_story/a11y.jsx +6 -6
- package/_utils/hooks/usePrevFocus.ts +16 -0
- package/_utils/index.ts +4 -0
- package/anchor/_story/anchor.stories.js +1 -1
- package/anchor/index.tsx +5 -2
- package/anchor/link.tsx +29 -4
- package/autoComplete/index.tsx +28 -1
- package/avatar/_story/avatar.stories.js +4 -4
- package/avatar/avatarGroup.tsx +1 -1
- package/avatar/index.tsx +10 -4
- package/banner/index.tsx +2 -1
- package/breadcrumb/_story/breadcrumb.stories.js +22 -8
- package/breadcrumb/index.tsx +8 -1
- package/breadcrumb/item.tsx +1 -1
- package/button/Button.tsx +4 -0
- package/button/__test__/button.test.js +1 -1
- package/button/_story/button.stories.js +10 -10
- package/button/buttonGroup.tsx +4 -2
- package/button/splitButtonGroup.tsx +5 -2
- package/card/_story/card.stories.js +8 -1
- package/card/_story/card.stories.tsx +3 -0
- package/card/index.tsx +5 -2
- package/cascader/index.tsx +33 -5
- package/checkbox/_story/checkbox.stories.js +21 -14
- package/checkbox/checkbox.tsx +40 -5
- package/checkbox/checkboxGroup.tsx +30 -5
- package/checkbox/checkboxInner.tsx +25 -2
- package/collapse/index.tsx +2 -2
- package/collapse/item.tsx +15 -8
- package/collapsible/index.tsx +4 -2
- package/configProvider/_story/configProvider.stories.tsx +27 -0
- package/datePicker/__test__/datePicker.test.js +108 -0
- package/datePicker/_story/datePicker.stories.js +146 -2
- package/datePicker/datePicker.tsx +24 -0
- package/datePicker/monthsGrid.tsx +2 -1
- package/dist/css/semi.css +34 -7
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +2785 -1508
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/dropdown/dropdownItem.tsx +1 -1
- package/dropdown/dropdownMenu.tsx +1 -1
- package/empty/index.tsx +5 -5
- package/form/_story/FormApi/formApiDemo.jsx +3 -2
- package/form/_story/Validate/validateDemo.jsx +1 -1
- package/form/_story/demo.jsx +12 -3
- package/form/_story/form.stories.js +0 -7
- package/form/baseForm.tsx +2 -0
- package/form/errorMessage.tsx +13 -2
- package/form/hoc/withField.tsx +37 -8
- package/form/index.tsx +0 -2
- package/form/interface.ts +2 -0
- package/form/label.tsx +4 -2
- package/input/index.tsx +49 -4
- package/input/inputGroup.tsx +9 -4
- package/input/textarea.tsx +25 -6
- package/inputNumber/_story/inputNumber.stories.js +12 -0
- package/inputNumber/index.tsx +33 -2
- package/layout/Sider.tsx +6 -2
- package/layout/index.tsx +4 -3
- package/lib/cjs/_utils/hooks/usePrevFocus.d.ts +2 -0
- package/lib/cjs/_utils/hooks/usePrevFocus.js +30 -0
- package/lib/cjs/_utils/index.d.ts +1 -0
- package/lib/cjs/_utils/index.js +6 -1
- package/lib/cjs/anchor/index.d.ts +2 -0
- package/lib/cjs/anchor/index.js +6 -1
- package/lib/cjs/anchor/link.d.ts +4 -1
- package/lib/cjs/anchor/link.js +39 -5
- package/lib/cjs/autoComplete/index.d.ts +17 -0
- package/lib/cjs/autoComplete/index.js +21 -2
- package/lib/cjs/avatar/avatarGroup.js +2 -1
- package/lib/cjs/avatar/index.d.ts +4 -3
- package/lib/cjs/avatar/index.js +20 -11
- package/lib/cjs/banner/index.js +4 -2
- package/lib/cjs/breadcrumb/index.d.ts +3 -0
- package/lib/cjs/breadcrumb/index.js +10 -4
- package/lib/cjs/breadcrumb/item.js +2 -2
- package/lib/cjs/button/Button.d.ts +2 -0
- package/lib/cjs/button/Button.js +4 -2
- package/lib/cjs/button/buttonGroup.d.ts +3 -0
- package/lib/cjs/button/buttonGroup.js +8 -4
- package/lib/cjs/button/index.d.ts +1 -0
- package/lib/cjs/button/splitButtonGroup.d.ts +3 -0
- package/lib/cjs/button/splitButtonGroup.js +5 -2
- package/lib/cjs/card/index.d.ts +3 -0
- package/lib/cjs/card/index.js +3 -1
- package/lib/cjs/cascader/index.d.ts +14 -0
- package/lib/cjs/cascader/index.js +35 -7
- package/lib/cjs/checkbox/checkbox.d.ts +21 -1
- package/lib/cjs/checkbox/checkbox.js +51 -17
- package/lib/cjs/checkbox/checkboxGroup.d.ts +13 -1
- package/lib/cjs/checkbox/checkboxGroup.js +16 -3
- package/lib/cjs/checkbox/checkboxInner.d.ts +15 -0
- package/lib/cjs/checkbox/checkboxInner.js +20 -3
- package/lib/cjs/collapse/index.js +2 -1
- package/lib/cjs/collapse/item.d.ts +2 -1
- package/lib/cjs/collapse/item.js +17 -3
- package/lib/cjs/collapsible/index.d.ts +1 -0
- package/lib/cjs/collapsible/index.js +4 -2
- package/lib/cjs/datePicker/datePicker.d.ts +12 -0
- package/lib/cjs/datePicker/datePicker.js +22 -3
- package/lib/cjs/datePicker/monthsGrid.d.ts +1 -0
- package/lib/cjs/datePicker/monthsGrid.js +2 -1
- package/lib/cjs/dropdown/dropdownItem.js +3 -1
- package/lib/cjs/dropdown/dropdownMenu.js +4 -1
- package/lib/cjs/empty/index.js +2 -1
- package/lib/cjs/form/baseForm.d.ts +9 -0
- package/lib/cjs/form/baseForm.js +3 -1
- package/lib/cjs/form/errorMessage.d.ts +4 -0
- package/lib/cjs/form/errorMessage.js +21 -3
- package/lib/cjs/form/field.d.ts +7 -0
- package/lib/cjs/form/hoc/withField.js +49 -16
- package/lib/cjs/form/index.d.ts +0 -1
- package/lib/cjs/form/interface.d.ts +2 -0
- package/lib/cjs/form/label.d.ts +2 -0
- package/lib/cjs/form/label.js +5 -2
- package/lib/cjs/input/index.d.ts +16 -0
- package/lib/cjs/input/index.js +51 -15
- package/lib/cjs/input/inputGroup.d.ts +2 -1
- package/lib/cjs/input/inputGroup.js +11 -1
- package/lib/cjs/input/textarea.js +12 -1
- package/lib/cjs/inputNumber/index.d.ts +21 -12
- package/lib/cjs/inputNumber/index.js +37 -3
- package/lib/cjs/layout/Sider.d.ts +4 -0
- package/lib/cjs/layout/Sider.js +4 -1
- package/lib/cjs/layout/index.js +2 -0
- package/lib/cjs/list/item.js +0 -1
- package/lib/cjs/modal/Modal.js +2 -0
- package/lib/cjs/modal/ModalContent.d.ts +3 -1
- package/lib/cjs/modal/ModalContent.js +47 -5
- package/lib/cjs/navigation/Item.d.ts +4 -2
- package/lib/cjs/navigation/Item.js +25 -5
- package/lib/cjs/navigation/SubNav.d.ts +4 -2
- package/lib/cjs/navigation/SubNav.js +8 -1
- package/lib/cjs/navigation/index.js +2 -0
- package/lib/cjs/notification/notice.d.ts +1 -1
- package/lib/cjs/notification/notice.js +32 -22
- package/lib/cjs/pagination/index.js +16 -6
- package/lib/cjs/popover/index.js +7 -3
- package/lib/cjs/progress/index.d.ts +8 -0
- package/lib/cjs/progress/index.js +42 -9
- package/lib/cjs/radio/radio.d.ts +6 -1
- package/lib/cjs/radio/radio.js +17 -5
- package/lib/cjs/radio/radioGroup.d.ts +16 -1
- package/lib/cjs/radio/radioGroup.js +18 -3
- package/lib/cjs/radio/radioInner.d.ts +6 -1
- package/lib/cjs/radio/radioInner.js +11 -3
- package/lib/cjs/rating/index.d.ts +14 -0
- package/lib/cjs/rating/index.js +14 -3
- package/lib/cjs/rating/item.d.ts +2 -0
- package/lib/cjs/rating/item.js +6 -1
- package/lib/cjs/select/index.d.ts +16 -0
- package/lib/cjs/select/index.js +65 -19
- package/lib/cjs/select/option.js +28 -22
- package/lib/cjs/sideSheet/SideSheetContent.d.ts +1 -0
- package/lib/cjs/sideSheet/SideSheetContent.js +12 -5
- package/lib/cjs/sideSheet/index.d.ts +1 -0
- package/lib/cjs/sideSheet/index.js +2 -1
- package/lib/cjs/slider/index.d.ts +2 -1
- package/lib/cjs/slider/index.js +64 -17
- package/lib/cjs/spin/icon.js +2 -4
- package/lib/cjs/steps/basicStep.d.ts +3 -0
- package/lib/cjs/steps/basicStep.js +23 -25
- package/lib/cjs/steps/basicSteps.d.ts +1 -0
- package/lib/cjs/steps/basicSteps.js +2 -1
- package/lib/cjs/steps/fillStep.d.ts +3 -0
- package/lib/cjs/steps/fillStep.js +19 -4
- package/lib/cjs/steps/fillSteps.d.ts +1 -0
- package/lib/cjs/steps/fillSteps.js +2 -1
- package/lib/cjs/steps/navStep.d.ts +3 -0
- package/lib/cjs/steps/navStep.js +22 -25
- package/lib/cjs/steps/navSteps.d.ts +1 -0
- package/lib/cjs/steps/navSteps.js +2 -1
- package/lib/cjs/switch/index.d.ts +12 -0
- package/lib/cjs/switch/index.js +19 -4
- package/lib/cjs/table/Body/BaseRow.js +35 -3
- package/lib/cjs/table/Body/index.js +9 -1
- package/lib/cjs/table/ColumnFilter.js +4 -0
- package/lib/cjs/table/ColumnSelection.d.ts +3 -0
- package/lib/cjs/table/ColumnSelection.js +6 -2
- package/lib/cjs/table/ColumnSorter.js +19 -3
- package/lib/cjs/table/CustomExpandIcon.js +7 -1
- package/lib/cjs/table/Table.d.ts +2 -0
- package/lib/cjs/table/Table.js +31 -15
- package/lib/cjs/table/TableCell.d.ts +2 -0
- package/lib/cjs/table/TableCell.js +6 -2
- package/lib/cjs/table/TableHeaderRow.js +8 -2
- package/lib/cjs/tabs/TabBar.js +11 -3
- package/lib/cjs/tabs/TabPane.js +3 -1
- package/lib/cjs/tabs/index.js +3 -8
- package/lib/cjs/tagInput/index.d.ts +4 -1
- package/lib/cjs/tagInput/index.js +29 -3
- package/lib/cjs/timePicker/TimePicker.d.ts +12 -0
- package/lib/cjs/timePicker/TimePicker.js +9 -1
- package/lib/cjs/timePicker/index.d.ts +6 -0
- package/lib/cjs/timeline/index.d.ts +1 -1
- package/lib/cjs/timeline/index.js +1 -0
- package/lib/cjs/timeline/item.js +4 -2
- package/lib/cjs/toast/toast.js +2 -0
- package/lib/cjs/tooltip/TriangleArrow.js +1 -0
- package/lib/cjs/tooltip/TriangleArrowVertical.js +1 -0
- package/lib/cjs/tooltip/index.d.ts +16 -12
- package/lib/cjs/tooltip/index.js +55 -39
- package/lib/cjs/transfer/index.d.ts +1 -1
- package/lib/cjs/transfer/index.js +35 -17
- package/lib/cjs/tree/index.d.ts +1 -0
- package/lib/cjs/tree/index.js +15 -6
- package/lib/cjs/tree/treeNode.d.ts +12 -4
- package/lib/cjs/tree/treeNode.js +44 -4
- package/lib/cjs/treeSelect/index.d.ts +16 -0
- package/lib/cjs/treeSelect/index.js +60 -12
- package/lib/cjs/typography/base.js +18 -7
- package/lib/cjs/typography/copyable.js +6 -1
- package/lib/cjs/upload/fileCard.js +23 -4
- package/lib/cjs/upload/index.js +19 -4
- package/lib/es/_utils/hooks/usePrevFocus.d.ts +2 -0
- package/lib/es/_utils/hooks/usePrevFocus.js +15 -0
- package/lib/es/_utils/index.d.ts +1 -0
- package/lib/es/_utils/index.js +4 -1
- package/lib/es/anchor/index.d.ts +2 -0
- package/lib/es/anchor/index.js +6 -1
- package/lib/es/anchor/link.d.ts +4 -1
- package/lib/es/anchor/link.js +38 -5
- package/lib/es/autoComplete/index.d.ts +17 -0
- package/lib/es/autoComplete/index.js +21 -2
- package/lib/es/avatar/avatarGroup.js +2 -1
- package/lib/es/avatar/index.d.ts +4 -3
- package/lib/es/avatar/index.js +20 -11
- package/lib/es/banner/index.js +4 -2
- package/lib/es/breadcrumb/index.d.ts +3 -0
- package/lib/es/breadcrumb/index.js +10 -4
- package/lib/es/breadcrumb/item.js +2 -2
- package/lib/es/button/Button.d.ts +2 -0
- package/lib/es/button/Button.js +4 -2
- package/lib/es/button/buttonGroup.d.ts +3 -0
- package/lib/es/button/buttonGroup.js +8 -4
- package/lib/es/button/index.d.ts +1 -0
- package/lib/es/button/splitButtonGroup.d.ts +3 -0
- package/lib/es/button/splitButtonGroup.js +5 -2
- package/lib/es/card/index.d.ts +3 -0
- package/lib/es/card/index.js +3 -1
- package/lib/es/cascader/index.d.ts +14 -0
- package/lib/es/cascader/index.js +35 -7
- package/lib/es/checkbox/checkbox.d.ts +21 -1
- package/lib/es/checkbox/checkbox.js +50 -17
- package/lib/es/checkbox/checkboxGroup.d.ts +13 -1
- package/lib/es/checkbox/checkboxGroup.js +18 -5
- package/lib/es/checkbox/checkboxInner.d.ts +15 -0
- package/lib/es/checkbox/checkboxInner.js +20 -3
- package/lib/es/collapse/index.js +2 -1
- package/lib/es/collapse/item.d.ts +2 -1
- package/lib/es/collapse/item.js +16 -3
- package/lib/es/collapsible/index.d.ts +1 -0
- package/lib/es/collapsible/index.js +4 -2
- package/lib/es/datePicker/datePicker.d.ts +12 -0
- package/lib/es/datePicker/datePicker.js +22 -3
- package/lib/es/datePicker/monthsGrid.d.ts +1 -0
- package/lib/es/datePicker/monthsGrid.js +2 -1
- package/lib/es/dropdown/dropdownItem.js +3 -1
- package/lib/es/dropdown/dropdownMenu.js +4 -1
- package/lib/es/empty/index.js +2 -1
- package/lib/es/form/baseForm.d.ts +9 -0
- package/lib/es/form/baseForm.js +3 -1
- package/lib/es/form/errorMessage.d.ts +4 -0
- package/lib/es/form/errorMessage.js +21 -3
- package/lib/es/form/field.d.ts +7 -0
- package/lib/es/form/hoc/withField.js +48 -15
- package/lib/es/form/index.d.ts +0 -1
- package/lib/es/form/index.js +0 -1
- package/lib/es/form/interface.d.ts +2 -0
- package/lib/es/form/label.d.ts +2 -0
- package/lib/es/form/label.js +5 -2
- package/lib/es/input/index.d.ts +16 -0
- package/lib/es/input/index.js +51 -15
- package/lib/es/input/inputGroup.d.ts +2 -1
- package/lib/es/input/inputGroup.js +11 -1
- package/lib/es/input/textarea.js +12 -1
- package/lib/es/inputNumber/index.d.ts +21 -12
- package/lib/es/inputNumber/index.js +38 -3
- package/lib/es/layout/Sider.d.ts +4 -0
- package/lib/es/layout/Sider.js +4 -1
- package/lib/es/layout/index.js +2 -0
- package/lib/es/list/item.js +0 -1
- package/lib/es/modal/Modal.js +2 -0
- package/lib/es/modal/ModalContent.d.ts +3 -1
- package/lib/es/modal/ModalContent.js +46 -5
- package/lib/es/navigation/Item.d.ts +4 -2
- package/lib/es/navigation/Item.js +25 -5
- package/lib/es/navigation/SubNav.d.ts +4 -2
- package/lib/es/navigation/SubNav.js +8 -1
- package/lib/es/navigation/index.js +2 -0
- package/lib/es/notification/notice.d.ts +1 -1
- package/lib/es/notification/notice.js +33 -24
- package/lib/es/pagination/index.js +16 -6
- package/lib/es/popover/index.js +7 -3
- package/lib/es/progress/index.d.ts +8 -0
- package/lib/es/progress/index.js +42 -9
- package/lib/es/radio/radio.d.ts +6 -1
- package/lib/es/radio/radio.js +16 -5
- package/lib/es/radio/radioGroup.d.ts +16 -1
- package/lib/es/radio/radioGroup.js +18 -3
- package/lib/es/radio/radioInner.d.ts +6 -1
- package/lib/es/radio/radioInner.js +11 -3
- package/lib/es/rating/index.d.ts +14 -0
- package/lib/es/rating/index.js +14 -3
- package/lib/es/rating/item.d.ts +2 -0
- package/lib/es/rating/item.js +6 -1
- package/lib/es/select/index.d.ts +16 -0
- package/lib/es/select/index.js +63 -17
- package/lib/es/select/option.js +28 -22
- package/lib/es/sideSheet/SideSheetContent.d.ts +1 -0
- package/lib/es/sideSheet/SideSheetContent.js +12 -5
- package/lib/es/sideSheet/index.d.ts +1 -0
- package/lib/es/sideSheet/index.js +2 -1
- package/lib/es/slider/index.d.ts +2 -1
- package/lib/es/slider/index.js +63 -16
- package/lib/es/spin/icon.js +2 -4
- package/lib/es/steps/basicStep.d.ts +3 -0
- package/lib/es/steps/basicStep.js +23 -23
- package/lib/es/steps/basicSteps.d.ts +1 -0
- package/lib/es/steps/basicSteps.js +2 -1
- package/lib/es/steps/fillStep.d.ts +3 -0
- package/lib/es/steps/fillStep.js +19 -4
- package/lib/es/steps/fillSteps.d.ts +1 -0
- package/lib/es/steps/fillSteps.js +2 -1
- package/lib/es/steps/navStep.d.ts +3 -0
- package/lib/es/steps/navStep.js +22 -23
- package/lib/es/steps/navSteps.d.ts +1 -0
- package/lib/es/steps/navSteps.js +2 -1
- package/lib/es/switch/index.d.ts +12 -0
- package/lib/es/switch/index.js +19 -4
- package/lib/es/table/Body/BaseRow.js +35 -3
- package/lib/es/table/Body/index.js +9 -2
- package/lib/es/table/ColumnFilter.js +4 -0
- package/lib/es/table/ColumnSelection.d.ts +3 -0
- package/lib/es/table/ColumnSelection.js +6 -2
- package/lib/es/table/ColumnSorter.js +17 -3
- package/lib/es/table/CustomExpandIcon.js +6 -1
- package/lib/es/table/Table.d.ts +2 -0
- package/lib/es/table/Table.js +31 -15
- package/lib/es/table/TableCell.d.ts +2 -0
- package/lib/es/table/TableCell.js +6 -2
- package/lib/es/table/TableHeaderRow.js +8 -2
- package/lib/es/tabs/TabBar.js +11 -3
- package/lib/es/tabs/TabPane.js +3 -1
- package/lib/es/tabs/index.js +1 -6
- package/lib/es/tagInput/index.d.ts +4 -1
- package/lib/es/tagInput/index.js +29 -3
- package/lib/es/timePicker/TimePicker.d.ts +12 -0
- package/lib/es/timePicker/TimePicker.js +9 -1
- package/lib/es/timePicker/index.d.ts +6 -0
- package/lib/es/timeline/index.d.ts +1 -1
- package/lib/es/timeline/index.js +1 -0
- package/lib/es/timeline/item.js +4 -2
- package/lib/es/toast/toast.js +2 -0
- package/lib/es/tooltip/TriangleArrow.js +1 -0
- package/lib/es/tooltip/TriangleArrowVertical.js +1 -0
- package/lib/es/tooltip/index.d.ts +16 -12
- package/lib/es/tooltip/index.js +53 -39
- package/lib/es/transfer/index.d.ts +1 -1
- package/lib/es/transfer/index.js +35 -17
- package/lib/es/tree/index.d.ts +1 -0
- package/lib/es/tree/index.js +15 -6
- package/lib/es/tree/treeNode.d.ts +12 -4
- package/lib/es/tree/treeNode.js +44 -4
- package/lib/es/treeSelect/index.d.ts +16 -0
- package/lib/es/treeSelect/index.js +57 -10
- package/lib/es/typography/base.js +17 -7
- package/lib/es/typography/copyable.js +5 -1
- package/lib/es/upload/fileCard.js +23 -4
- package/lib/es/upload/index.js +19 -4
- package/list/item.tsx +0 -1
- package/modal/Modal.tsx +2 -0
- package/modal/ModalContent.tsx +35 -5
- package/navigation/Item.tsx +15 -0
- package/navigation/SubNav.tsx +13 -1
- package/navigation/index.tsx +1 -1
- package/notification/notice.tsx +19 -14
- package/package.json +8 -8
- package/pagination/index.tsx +9 -5
- package/popover/index.tsx +5 -0
- package/progress/_story/progress.stories.js +18 -18
- package/progress/index.tsx +58 -20
- package/radio/radio.tsx +12 -2
- package/radio/radioGroup.tsx +29 -3
- package/radio/radioInner.tsx +10 -1
- package/rating/index.tsx +19 -2
- package/rating/item.tsx +6 -0
- package/select/__test__/select.test.js +45 -0
- package/select/_story/select.stories.js +29 -0
- package/select/index.tsx +52 -4
- package/select/option.tsx +3 -0
- package/sideSheet/SideSheetContent.tsx +13 -9
- package/sideSheet/index.tsx +3 -2
- package/slider/__test__/slider.test.js +9 -0
- package/slider/_story/slider.stories.js +1 -1
- package/slider/index.tsx +44 -7
- package/spin/icon.tsx +3 -3
- package/steps/basicStep.tsx +15 -4
- package/steps/basicSteps.tsx +3 -2
- package/steps/fillStep.tsx +27 -12
- package/steps/fillSteps.tsx +2 -0
- package/steps/navStep.tsx +15 -4
- package/steps/navSteps.tsx +3 -2
- package/switch/_story/switch.stories.js +20 -19
- package/switch/_story/switch.stories.tsx +13 -13
- package/switch/index.tsx +23 -5
- package/table/Body/BaseRow.tsx +25 -1
- package/table/Body/index.tsx +7 -2
- package/table/ColumnFilter.tsx +7 -1
- package/table/ColumnSelection.tsx +4 -1
- package/table/ColumnSorter.tsx +18 -1
- package/table/CustomExpandIcon.tsx +5 -0
- package/table/Table.tsx +26 -13
- package/table/TableCell.tsx +11 -1
- package/table/TableHeaderRow.tsx +16 -2
- package/table/__test__/table.test.js +46 -0
- package/tabs/TabBar.tsx +8 -5
- package/tabs/TabPane.tsx +3 -1
- package/tabs/index.tsx +1 -2
- package/tagInput/__test__/tagInput.test.js +46 -0
- package/tagInput/_story/tagInput.stories.js +2 -2
- package/tagInput/index.tsx +31 -8
- package/timePicker/TimePicker.tsx +14 -1
- package/timeline/_story/timeline.stories.js +1 -1
- package/timeline/index.tsx +2 -2
- package/timeline/item.tsx +2 -1
- package/toast/toast.tsx +2 -0
- package/tooltip/TriangleArrow.tsx +1 -1
- package/tooltip/TriangleArrowVertical.tsx +1 -1
- package/tooltip/_story/tooltip.stories.js +562 -514
- package/tooltip/index.tsx +50 -33
- package/transfer/index.tsx +32 -28
- package/tree/_story/tree.stories.js +3 -3
- package/tree/index.tsx +10 -2
- package/tree/treeNode.tsx +46 -10
- package/treeSelect/__test__/treeMultiple.test.js +5 -0
- package/treeSelect/_story/treeSelect.stories.js +12 -0
- package/treeSelect/index.tsx +58 -7
- package/typography/base.tsx +7 -1
- package/typography/copyable.tsx +10 -1
- package/upload/fileCard.tsx +13 -15
- package/upload/index.tsx +10 -6
|
@@ -92,7 +92,7 @@ class DropdownItem extends BaseComponent<DropdownItemProps> {
|
|
|
92
92
|
);
|
|
93
93
|
}
|
|
94
94
|
return (
|
|
95
|
-
<li {...events} ref={ref => forwardRef(ref)} className={itemclass} style={style}>
|
|
95
|
+
<li role="menuitem" {...events} ref={ref => forwardRef(ref)} className={itemclass} style={style}>
|
|
96
96
|
{tick}
|
|
97
97
|
{iconContent}
|
|
98
98
|
{children}
|
|
@@ -18,7 +18,7 @@ class DropdownMenu extends BaseComponent<DropdownMenuProps> {
|
|
|
18
18
|
render() {
|
|
19
19
|
const { children, className, style, ...rest } = this.props;
|
|
20
20
|
return (
|
|
21
|
-
<ul {...rest} className={classnames(`${prefixCls}-menu`, className)} style={style}>
|
|
21
|
+
<ul role="menu" aria-orientation="vertical" {...rest} className={classnames(`${prefixCls}-menu`, className)} style={style}>
|
|
22
22
|
{children}
|
|
23
23
|
</ul>
|
|
24
24
|
);
|
package/empty/index.tsx
CHANGED
|
@@ -108,17 +108,17 @@ export default class Empty extends BaseComponent<EmptyProps, EmptyState> {
|
|
|
108
108
|
style: { fontWeight: 400 },
|
|
109
109
|
};
|
|
110
110
|
return (
|
|
111
|
-
<div className={wrapperCls} style={style}>
|
|
112
|
-
<div className={`${prefixCls}-image`} style={imageStyle}>
|
|
111
|
+
<div className={wrapperCls} style={style} aria-label="empty placeholder image">
|
|
112
|
+
<div className={`${prefixCls}-image`} style={imageStyle} >
|
|
113
113
|
{imageNode}
|
|
114
114
|
</div>
|
|
115
|
-
<div className={`${prefixCls}-content`}>
|
|
115
|
+
<div className={`${prefixCls}-content`} >
|
|
116
116
|
{title ? (
|
|
117
|
-
<Typography.Title {...(titleProps as any)} className={`${prefixCls}-title`}>
|
|
117
|
+
<Typography.Title {...(titleProps as any)} className={`${prefixCls}-title`} >
|
|
118
118
|
{title}
|
|
119
119
|
</Typography.Title>
|
|
120
120
|
) : null}
|
|
121
|
-
{description ? <div className={`${prefixCls}-description`}>{description}</div> : null}
|
|
121
|
+
{description ? <div className={`${prefixCls}-description`} >{description}</div> : null}
|
|
122
122
|
{children ? <div className={`${prefixCls}-footer`}>{children}</div> : null}
|
|
123
123
|
</div>
|
|
124
124
|
</div>
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
} from '../../../index';
|
|
18
18
|
const { Input, Select, DatePicker, Switch, Slider, CheckboxGroup, Checkbox, RadioGroup, Radio, TimePicker, InputNumber, InputGroup } = Form;
|
|
19
19
|
|
|
20
|
+
import { IconPlusCircle, IconMinusCircle } from '@douyinfe/semi-icons';
|
|
20
21
|
|
|
21
22
|
const SetValueUsingParentPath = () => {
|
|
22
23
|
const { Option } = Form.Select;
|
|
@@ -51,7 +52,7 @@ const SetValueUsingParentPath = () => {
|
|
|
51
52
|
<React.Fragment>
|
|
52
53
|
<Button onClick={add} icon="plus_circle" theme="light">新增空白行</Button>
|
|
53
54
|
<Button
|
|
54
|
-
icon=
|
|
55
|
+
icon={<IconPlusCircle></IconPlusCircle>} onClick={() => {
|
|
55
56
|
addWithInitValue({ name: '自定义贴纸', type: '2D' });
|
|
56
57
|
}} style={{ marginLeft: 8 }}>新增带有初始值的行
|
|
57
58
|
</Button>
|
|
@@ -68,7 +69,7 @@ const SetValueUsingParentPath = () => {
|
|
|
68
69
|
label={`素材类型:(${field}.type)`}
|
|
69
70
|
style={{ width: 90 }}
|
|
70
71
|
/>
|
|
71
|
-
<Button type="danger" theme="borderless" icon=
|
|
72
|
+
<Button type="danger" theme="borderless" icon={<IconMinusCircle></IconMinusCircle>} onClick={remove} style={{ margin: 12 }} />
|
|
72
73
|
</div>
|
|
73
74
|
))
|
|
74
75
|
}
|
|
@@ -201,7 +201,7 @@ class PartValidAndResetDemo extends Component {
|
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
render() {
|
|
204
|
-
let options = ['a', 'b', 'c', 'd'].map(item => ({ label: item, value: item }));
|
|
204
|
+
let options = ['a', 'b', 'c', 'd', 'b.name'].map(item => ({ label: item, value: item }));
|
|
205
205
|
return (
|
|
206
206
|
<Form getFormApi={this.getFormApi} autoScrollToError>
|
|
207
207
|
<Input field="a[1]" validate={this.validate} trigger="blur" />
|
package/form/_story/demo.jsx
CHANGED
|
@@ -196,6 +196,8 @@ class BasicDemoWithInit extends Component {
|
|
|
196
196
|
onValueChange={(v)=>console.log(v)}
|
|
197
197
|
style={{ padding: '10px', width: 600 }}
|
|
198
198
|
autoScrollToError
|
|
199
|
+
aria-label='Demo Form'
|
|
200
|
+
id='demo-form-id'
|
|
199
201
|
>
|
|
200
202
|
<Form.Section text={'基本信息'}>
|
|
201
203
|
<Row>
|
|
@@ -265,13 +267,20 @@ class BasicDemoWithInit extends Component {
|
|
|
265
267
|
<Row>
|
|
266
268
|
<Col span={12}>
|
|
267
269
|
<Form.TimePicker
|
|
268
|
-
treeData={treeData}
|
|
269
270
|
field='time'
|
|
271
|
+
helpText='原则上应当在 9:00 - 18:00 之间'
|
|
270
272
|
label='时间选择'
|
|
271
273
|
>
|
|
272
|
-
</Form.TimePicker>
|
|
274
|
+
</Form.TimePicker>
|
|
275
|
+
</Col>
|
|
276
|
+
<Col span={12}>
|
|
277
|
+
<Form.AutoComplete
|
|
278
|
+
field='typeData'
|
|
279
|
+
label='类型选择'
|
|
280
|
+
data={['1', '2' , '3']}
|
|
281
|
+
>
|
|
282
|
+
</Form.AutoComplete>
|
|
273
283
|
</Col>
|
|
274
|
-
|
|
275
284
|
</Row>
|
|
276
285
|
</Form.Section>
|
|
277
286
|
<Form.Section text='资源详情'>
|
|
@@ -54,7 +54,6 @@ import { AssistComponent } from './Layout/slotDemo';
|
|
|
54
54
|
import { ModalFormDemo } from './Layout/modalFormDemo';
|
|
55
55
|
|
|
56
56
|
import { WithFieldDemo, CustomFieldDemo, NumberRange } from './HOC/withFieldDemo';
|
|
57
|
-
import { WithDisplayName } from './HOC/displayName';
|
|
58
57
|
import {
|
|
59
58
|
CustomValidateDemo,
|
|
60
59
|
ValidateFieldsDemo,
|
|
@@ -426,12 +425,6 @@ DebugRerenderTwice.story = {
|
|
|
426
425
|
name: 'Debug-RerenderTwice',
|
|
427
426
|
};
|
|
428
427
|
|
|
429
|
-
export const FieldDisplayName = () => <WithDisplayName attr="form" />;
|
|
430
|
-
|
|
431
|
-
FieldDisplayName.story = {
|
|
432
|
-
name: 'Field displayName',
|
|
433
|
-
};
|
|
434
|
-
|
|
435
428
|
export const _ChildDidMount = () => <ChildDidMount />;
|
|
436
429
|
|
|
437
430
|
_ChildDidMount.story = {
|
package/form/baseForm.tsx
CHANGED
|
@@ -49,6 +49,7 @@ interface BaseFormState {
|
|
|
49
49
|
}
|
|
50
50
|
class Form extends BaseComponent<BaseFormProps, BaseFormState> {
|
|
51
51
|
static propTypes = {
|
|
52
|
+
'aria-label': PropTypes.string,
|
|
52
53
|
onSubmit: PropTypes.func,
|
|
53
54
|
onSubmitFail: PropTypes.func,
|
|
54
55
|
/* Triggered from update, including field mount/unmount/value change/blur/verification status change/error prompt change, input parameter is formState, currentField */
|
|
@@ -74,6 +75,7 @@ class Form extends BaseComponent<BaseFormProps, BaseFormState> {
|
|
|
74
75
|
disabled: PropTypes.bool,
|
|
75
76
|
showValidateIcon: PropTypes.bool,
|
|
76
77
|
extraTextPosition: PropTypes.oneOf(strings.EXTRA_POS),
|
|
78
|
+
id: PropTypes.string,
|
|
77
79
|
};
|
|
78
80
|
|
|
79
81
|
static defaultProps = {
|
package/form/errorMessage.tsx
CHANGED
|
@@ -17,6 +17,8 @@ export interface ErrorMessageProps {
|
|
|
17
17
|
validateStatus?: string;
|
|
18
18
|
helpText?: React.ReactNode;
|
|
19
19
|
isInInputGroup?: boolean;
|
|
20
|
+
errorMessageId?: string;
|
|
21
|
+
helpTextId?: string;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
export default class ErrorMessage extends PureComponent<ErrorMessageProps> {
|
|
@@ -28,14 +30,23 @@ export default class ErrorMessage extends PureComponent<ErrorMessageProps> {
|
|
|
28
30
|
showValidateIcon: PropTypes.bool,
|
|
29
31
|
helpText: PropTypes.node,
|
|
30
32
|
isInInputGroup: PropTypes.bool,
|
|
33
|
+
// internal props
|
|
34
|
+
errorMessageId: PropTypes.string,
|
|
35
|
+
helpTextId: PropTypes.string,
|
|
31
36
|
};
|
|
32
37
|
|
|
33
38
|
generatorText(error: ReactFieldError) {
|
|
39
|
+
const { helpTextId, errorMessageId } = this.props;
|
|
40
|
+
const propsError = this.props.error;
|
|
41
|
+
let id = errorMessageId;
|
|
42
|
+
if (!propsError) {
|
|
43
|
+
id = helpTextId;
|
|
44
|
+
}
|
|
34
45
|
if (typeof error === 'string') {
|
|
35
|
-
return <span>{error}</span>;
|
|
46
|
+
return <span id={id}>{error}</span>;
|
|
36
47
|
} else if (Array.isArray(error)) {
|
|
37
48
|
const err = error.filter(e => e);
|
|
38
|
-
return err.length ? <span>{err.join(', ')}</span> : null;
|
|
49
|
+
return err.length ? <span id={id}>{err.join(', ')}</span> : null;
|
|
39
50
|
} else if (React.isValidElement(error)) {
|
|
40
51
|
return error;
|
|
41
52
|
}
|
package/form/hoc/withField.tsx
CHANGED
|
@@ -63,6 +63,7 @@ function withField<
|
|
|
63
63
|
extraText,
|
|
64
64
|
extraTextPosition,
|
|
65
65
|
pure,
|
|
66
|
+
id,
|
|
66
67
|
rest,
|
|
67
68
|
} = mergeProps(props);
|
|
68
69
|
let { options, shouldInject } = mergeOptions(opts, props);
|
|
@@ -406,11 +407,27 @@ function withField<
|
|
|
406
407
|
let mergeWrapperCol = wrapperCol || formProps.wrapperCol;
|
|
407
408
|
let mergeExtraPos = extraTextPosition || formProps.extraTextPosition || 'bottom';
|
|
408
409
|
|
|
410
|
+
// id attribute to improve a11y
|
|
411
|
+
const a11yId = id ? id : field;
|
|
412
|
+
const labelId = `${a11yId}-label`;
|
|
413
|
+
const helpTextId = `${a11yId}-helpText`;
|
|
414
|
+
const extraTextId = `${a11yId}-extraText`;
|
|
415
|
+
const errorMessageId = `${a11yId}-errormessage`;
|
|
416
|
+
|
|
409
417
|
let FieldComponent = (() => {
|
|
410
418
|
// prefer to use validateStatus which pass by user throught props
|
|
411
419
|
let blockStatus = validateStatus ? validateStatus : status;
|
|
412
420
|
|
|
421
|
+
const extraCls = classNames(`${prefix}-field-extra`, {
|
|
422
|
+
[`${prefix}-field-extra-string`]: typeof extraText === 'string',
|
|
423
|
+
[`${prefix}-field-extra-middle`]: mergeExtraPos === 'middle',
|
|
424
|
+
[`${prefix}-field-extra-botttom`]: mergeExtraPos === 'bottom',
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
const extraContent = extraText ? <div className={extraCls} id={extraTextId}>{extraText}</div> : null;
|
|
428
|
+
|
|
413
429
|
let newProps: Record<string, any> = {
|
|
430
|
+
id: a11yId,
|
|
414
431
|
disabled: formProps.disabled,
|
|
415
432
|
...rest,
|
|
416
433
|
ref,
|
|
@@ -418,8 +435,23 @@ function withField<
|
|
|
418
435
|
[options.onKeyChangeFnName]: handleChange,
|
|
419
436
|
[options.valueKey]: value,
|
|
420
437
|
validateStatus: blockStatus,
|
|
438
|
+
'aria-required': required,
|
|
439
|
+
'aria-labelledby': labelId,
|
|
421
440
|
};
|
|
422
441
|
|
|
442
|
+
if (helpText) {
|
|
443
|
+
newProps['aria-describedby'] = extraText ? `${helpTextId} ${extraTextId}` : helpTextId;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
if (extraText) {
|
|
447
|
+
newProps['aria-describedby'] = helpText ? `${helpTextId} ${extraTextId}` : extraTextId;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
if (status === 'error') {
|
|
451
|
+
newProps['aria-errormessage'] = errorMessageId;
|
|
452
|
+
newProps['aria-invalid'] = true;
|
|
453
|
+
}
|
|
454
|
+
|
|
423
455
|
const fieldCls = classNames({
|
|
424
456
|
[`${prefix}-field`]: true,
|
|
425
457
|
[`${prefix}-field-${name}`]: Boolean(name),
|
|
@@ -431,8 +463,10 @@ function withField<
|
|
|
431
463
|
|
|
432
464
|
if (mergeLabelPos === 'inset' && !noLabel) {
|
|
433
465
|
newProps.insetLabel = label || field;
|
|
466
|
+
newProps.insetLabelId = labelId;
|
|
434
467
|
if (typeof label === 'object' && !isElement(label)) {
|
|
435
468
|
newProps.insetLabel = label.text;
|
|
469
|
+
newProps.insetLabelId = labelId;
|
|
436
470
|
}
|
|
437
471
|
}
|
|
438
472
|
|
|
@@ -463,6 +497,7 @@ function withField<
|
|
|
463
497
|
labelContent = (
|
|
464
498
|
<Label
|
|
465
499
|
text={label || field}
|
|
500
|
+
id={labelId}
|
|
466
501
|
required={required}
|
|
467
502
|
name={name || field}
|
|
468
503
|
width={mergeLabelWidth}
|
|
@@ -472,14 +507,6 @@ function withField<
|
|
|
472
507
|
);
|
|
473
508
|
}
|
|
474
509
|
|
|
475
|
-
const extraCls = classNames(`${prefix}-field-extra`, {
|
|
476
|
-
[`${prefix}-field-extra-string`]: typeof extraText === 'string',
|
|
477
|
-
[`${prefix}-field-extra-middle`]: mergeExtraPos === 'middle',
|
|
478
|
-
[`${prefix}-field-extra-botttom`]: mergeExtraPos === 'bottom',
|
|
479
|
-
});
|
|
480
|
-
|
|
481
|
-
const extraContent = extraText ? <div className={extraCls}>{extraText}</div> : null;
|
|
482
|
-
|
|
483
510
|
const fieldMainContent = (
|
|
484
511
|
<div className={fieldMaincls}>
|
|
485
512
|
{mergeExtraPos === 'middle' ? extraContent : null}
|
|
@@ -489,6 +516,8 @@ function withField<
|
|
|
489
516
|
error={error}
|
|
490
517
|
validateStatus={blockStatus}
|
|
491
518
|
helpText={helpText}
|
|
519
|
+
helpTextId={helpTextId}
|
|
520
|
+
errorMessageId={errorMessageId}
|
|
492
521
|
showValidateIcon={formProps.showValidateIcon}
|
|
493
522
|
/>
|
|
494
523
|
) : null}
|
package/form/index.tsx
CHANGED
package/form/interface.ts
CHANGED
|
@@ -103,6 +103,7 @@ interface setValuesConfig {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
export interface BaseFormProps {
|
|
106
|
+
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
106
107
|
onSubmit?: (values: Record<string, any>) => void;
|
|
107
108
|
onSubmitFail?: (errors: Record<string, FieldError>, values: any) => void;
|
|
108
109
|
onReset?: () => void;
|
|
@@ -111,6 +112,7 @@ export interface BaseFormProps {
|
|
|
111
112
|
validateFields?: (values: Record<string, any>) => string | Record<string, any>;
|
|
112
113
|
/** Use this if you want to populate the form with initial values. */
|
|
113
114
|
initValues?: Record<string, any>;
|
|
115
|
+
id?: string;
|
|
114
116
|
/** getFormApi will be call once when Form mounted, u can save formApi reference in your component */
|
|
115
117
|
getFormApi?: (formApi: FormApi) => void;
|
|
116
118
|
style?: React.CSSProperties;
|
package/form/label.tsx
CHANGED
|
@@ -6,6 +6,7 @@ import { cssClasses } from '@douyinfe/semi-foundation/form/constants';
|
|
|
6
6
|
const prefixCls = cssClasses.PREFIX;
|
|
7
7
|
|
|
8
8
|
export interface LabelProps {
|
|
9
|
+
id?: string;
|
|
9
10
|
/** Whether to display the required * symbol */
|
|
10
11
|
required?: boolean;
|
|
11
12
|
/** Content of label */
|
|
@@ -31,6 +32,7 @@ export default class Label extends PureComponent<LabelProps> {
|
|
|
31
32
|
};
|
|
32
33
|
|
|
33
34
|
static propTypes = {
|
|
35
|
+
id: PropTypes.string,
|
|
34
36
|
children: PropTypes.node,
|
|
35
37
|
required: PropTypes.bool,
|
|
36
38
|
text: PropTypes.node,
|
|
@@ -44,7 +46,7 @@ export default class Label extends PureComponent<LabelProps> {
|
|
|
44
46
|
};
|
|
45
47
|
|
|
46
48
|
render() {
|
|
47
|
-
const { children, required, text, disabled, name, width, align, style, className, extra } = this.props;
|
|
49
|
+
const { children, required, text, disabled, name, width, align, style, className, extra, id } = this.props;
|
|
48
50
|
|
|
49
51
|
const labelCls = classNames(className, {
|
|
50
52
|
[`${prefixCls}-field-label`]: true,
|
|
@@ -71,7 +73,7 @@ export default class Label extends PureComponent<LabelProps> {
|
|
|
71
73
|
);
|
|
72
74
|
|
|
73
75
|
return (
|
|
74
|
-
<label className={labelCls} htmlFor={name} style={labelStyle}>
|
|
76
|
+
<label className={labelCls} htmlFor={name} style={labelStyle} id={id}>
|
|
75
77
|
{extra ? contentWithExtra : textContent}
|
|
76
78
|
</label>
|
|
77
79
|
);
|
package/input/index.tsx
CHANGED
|
@@ -26,6 +26,12 @@ export type ValidateStatus = "default" | "error" | "warning" | "success";
|
|
|
26
26
|
|
|
27
27
|
export interface InputProps extends
|
|
28
28
|
Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'prefix' | 'size' | 'autoFocus' | 'placeholder' | 'onFocus' | 'onBlur'> {
|
|
29
|
+
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
30
|
+
'aria-describedby'?: React.AriaAttributes['aria-describedby'];
|
|
31
|
+
'aria-errormessage'?: React.AriaAttributes['aria-errormessage'];
|
|
32
|
+
'aria-invalid'?: React.AriaAttributes['aria-invalid'];
|
|
33
|
+
'aria-labelledby'?: React.AriaAttributes['aria-labelledby'];
|
|
34
|
+
'aria-required'?: React.AriaAttributes['aria-required'];
|
|
29
35
|
addonBefore?: React.ReactNode;
|
|
30
36
|
addonAfter?: React.ReactNode;
|
|
31
37
|
prefix?: React.ReactNode;
|
|
@@ -41,6 +47,7 @@ export interface InputProps extends
|
|
|
41
47
|
hideSuffix?: boolean;
|
|
42
48
|
placeholder?: React.ReactText;
|
|
43
49
|
insetLabel?: React.ReactNode;
|
|
50
|
+
insetLabelId?: string;
|
|
44
51
|
size?: InputSize;
|
|
45
52
|
className?: string;
|
|
46
53
|
style?: React.CSSProperties;
|
|
@@ -73,6 +80,12 @@ export interface InputState {
|
|
|
73
80
|
|
|
74
81
|
class Input extends BaseComponent<InputProps, InputState> {
|
|
75
82
|
static propTypes = {
|
|
83
|
+
'aria-label': PropTypes.string,
|
|
84
|
+
'aria-labelledby': PropTypes.string,
|
|
85
|
+
'aria-invalid': PropTypes.bool,
|
|
86
|
+
'aria-errormessage': PropTypes.string,
|
|
87
|
+
'aria-describedby': PropTypes.string,
|
|
88
|
+
'aria-required': PropTypes.bool,
|
|
76
89
|
addonBefore: PropTypes.node,
|
|
77
90
|
addonAfter: PropTypes.node,
|
|
78
91
|
prefix: PropTypes.node,
|
|
@@ -101,6 +114,7 @@ class Input extends BaseComponent<InputProps, InputState> {
|
|
|
101
114
|
onKeyPress: PropTypes.func,
|
|
102
115
|
onEnterPress: PropTypes.func,
|
|
103
116
|
insetLabel: PropTypes.node,
|
|
117
|
+
insetLabelId: PropTypes.string,
|
|
104
118
|
inputStyle: PropTypes.object,
|
|
105
119
|
getValueLength: PropTypes.func,
|
|
106
120
|
};
|
|
@@ -207,6 +221,10 @@ class Input extends BaseComponent<InputProps, InputState> {
|
|
|
207
221
|
this.foundation.handleClear(e);
|
|
208
222
|
};
|
|
209
223
|
|
|
224
|
+
handleClearEnterPress = (e: React.KeyboardEvent<HTMLDivElement>) => {
|
|
225
|
+
this.foundation.handleClearEnterPress(e);
|
|
226
|
+
};
|
|
227
|
+
|
|
210
228
|
handleClick = (e: React.MouseEvent<HTMLDivElement>) => {
|
|
211
229
|
this.foundation.handleClick(e);
|
|
212
230
|
};
|
|
@@ -235,6 +253,10 @@ class Input extends BaseComponent<InputProps, InputState> {
|
|
|
235
253
|
this.foundation.handleMouseUp(e);
|
|
236
254
|
};
|
|
237
255
|
|
|
256
|
+
handleModeEnterPress = (e: React.KeyboardEvent<HTMLDivElement>) => {
|
|
257
|
+
this.foundation.handleModeEnterPress(e);
|
|
258
|
+
}
|
|
259
|
+
|
|
238
260
|
handleClickPrefixOrSuffix = (e: React.MouseEvent<HTMLInputElement>) => {
|
|
239
261
|
this.foundation.handleClickPrefixOrSuffix(e);
|
|
240
262
|
};
|
|
@@ -275,7 +297,14 @@ class Input extends BaseComponent<InputProps, InputState> {
|
|
|
275
297
|
// use onMouseDown to fix issue 1203
|
|
276
298
|
if (allowClear) {
|
|
277
299
|
return (
|
|
278
|
-
<div
|
|
300
|
+
<div
|
|
301
|
+
role="button"
|
|
302
|
+
tabIndex={0}
|
|
303
|
+
aria-label="Clear input value"
|
|
304
|
+
className={clearCls}
|
|
305
|
+
onMouseDown={this.handleClear}
|
|
306
|
+
onKeyPress={this.handleClearEnterPress}
|
|
307
|
+
>
|
|
279
308
|
<IconClear />
|
|
280
309
|
</div>
|
|
281
310
|
);
|
|
@@ -289,9 +318,19 @@ class Input extends BaseComponent<InputProps, InputState> {
|
|
|
289
318
|
const modeCls = cls(`${prefixCls}-modebtn`);
|
|
290
319
|
const modeIcon = eyeClosed ? <IconEyeClosedSolid /> : <IconEyeOpened />;
|
|
291
320
|
const showModeBtn = mode === 'password' && value && !disabled && (isFocus || isHovering);
|
|
321
|
+
const ariaLabel = eyeClosed ? 'Show password' : 'Hidden password';
|
|
292
322
|
if (showModeBtn) {
|
|
293
323
|
return (
|
|
294
|
-
<div
|
|
324
|
+
<div
|
|
325
|
+
role="button"
|
|
326
|
+
tabIndex={0}
|
|
327
|
+
aria-label={ariaLabel}
|
|
328
|
+
className={modeCls}
|
|
329
|
+
onClick={this.handleClickEye}
|
|
330
|
+
onMouseDown={this.handleMouseDown}
|
|
331
|
+
onMouseUp={this.handleMouseUp}
|
|
332
|
+
onKeyPress={this.handleModeEnterPress}
|
|
333
|
+
>
|
|
295
334
|
{modeIcon}
|
|
296
335
|
</div>
|
|
297
336
|
);
|
|
@@ -300,7 +339,7 @@ class Input extends BaseComponent<InputProps, InputState> {
|
|
|
300
339
|
}
|
|
301
340
|
|
|
302
341
|
renderPrefix() {
|
|
303
|
-
const { prefix, insetLabel } = this.props;
|
|
342
|
+
const { prefix, insetLabel, insetLabelId } = this.props;
|
|
304
343
|
const labelNode = prefix || insetLabel;
|
|
305
344
|
if (!labelNode) {
|
|
306
345
|
return null;
|
|
@@ -312,7 +351,8 @@ class Input extends BaseComponent<InputProps, InputState> {
|
|
|
312
351
|
[`${prefixCls}-prefix-icon`]: isSemiIcon(labelNode),
|
|
313
352
|
});
|
|
314
353
|
|
|
315
|
-
|
|
354
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
355
|
+
return <div className={prefixWrapperCls} onMouseDown={this.handlePreventMouseDown} onClick={this.handleClickPrefixOrSuffix} id={insetLabelId}>{labelNode}</div>;
|
|
316
356
|
}
|
|
317
357
|
|
|
318
358
|
showClearBtn() {
|
|
@@ -332,6 +372,7 @@ class Input extends BaseComponent<InputProps, InputState> {
|
|
|
332
372
|
[`${prefixCls }-suffix-icon`]: isSemiIcon(suffix),
|
|
333
373
|
[`${prefixCls}-suffix-hidden`]: suffixAllowClear && Boolean(hideSuffix),
|
|
334
374
|
});
|
|
375
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
335
376
|
return <div className={suffixWrapperCls} onMouseDown={this.handlePreventMouseDown} onClick={this.handleClickPrefixOrSuffix}>{suffix}</div>;
|
|
336
377
|
}
|
|
337
378
|
|
|
@@ -417,7 +458,11 @@ class Input extends BaseComponent<InputProps, InputState> {
|
|
|
417
458
|
if (stateMinLength) {
|
|
418
459
|
inputProps.minLength = stateMinLength;
|
|
419
460
|
}
|
|
461
|
+
if (validateStatus === 'error') {
|
|
462
|
+
inputProps['aria-invalid'] = "true";
|
|
463
|
+
}
|
|
420
464
|
return (
|
|
465
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
421
466
|
<div
|
|
422
467
|
className={wrapperCls}
|
|
423
468
|
style={style}
|
package/input/inputGroup.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import cls from 'classnames';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { cssClasses, strings } from '@douyinfe/semi-foundation/input/constants';
|
|
6
6
|
import BaseComponent from '../_base/baseComponent';
|
|
7
|
-
import Label from '../form/label';
|
|
7
|
+
import Label, { LabelProps } from '../form/label';
|
|
8
8
|
|
|
9
9
|
import { noop } from '@douyinfe/semi-foundation/utils/function';
|
|
10
10
|
import { isFunction } from 'lodash';
|
|
@@ -21,7 +21,7 @@ export interface InputGroupProps {
|
|
|
21
21
|
style?: Record<string, any>;
|
|
22
22
|
onBlur?: (e: React.FocusEvent<HTMLSpanElement>) => void;
|
|
23
23
|
onFocus?: (e: React.FocusEvent<HTMLSpanElement>) => void;
|
|
24
|
-
label?:
|
|
24
|
+
label?: LabelProps;
|
|
25
25
|
labelPosition?: string;
|
|
26
26
|
disabled?: boolean;
|
|
27
27
|
}
|
|
@@ -64,10 +64,12 @@ export default class inputGroup extends BaseComponent<InputGroupProps, InputGrou
|
|
|
64
64
|
}
|
|
65
65
|
);
|
|
66
66
|
// const labelCls = cls(label.className, '');
|
|
67
|
+
const defaultName = 'input-group';
|
|
67
68
|
return (
|
|
68
|
-
<div className={groupWrapperCls}>
|
|
69
|
-
{label && label.text ? <Label {...label} /> : null}
|
|
69
|
+
<div role="group" aria-label="Input group" aria-disabled={this.props.disabled} className={groupWrapperCls}>
|
|
70
|
+
{label && label.text ? <Label name={defaultName} {...label} /> : null}
|
|
70
71
|
<span
|
|
72
|
+
id={label && label.name || defaultName}
|
|
71
73
|
className={groupCls}
|
|
72
74
|
style={this.props.style}
|
|
73
75
|
onFocus={this.props.onFocus}
|
|
@@ -107,6 +109,9 @@ export default class inputGroup extends BaseComponent<InputGroupProps, InputGrou
|
|
|
107
109
|
|
|
108
110
|
return (
|
|
109
111
|
<span
|
|
112
|
+
role="group"
|
|
113
|
+
aria-label="Input group"
|
|
114
|
+
aria-disabled={this.props.disabled}
|
|
110
115
|
className={groupCls}
|
|
111
116
|
style={style}
|
|
112
117
|
onFocus={this.props.onFocus}
|
package/input/textarea.tsx
CHANGED
|
@@ -101,6 +101,7 @@ class TextArea extends BaseComponent<TextAreaProps, TextAreaState> {
|
|
|
101
101
|
libRef: React.RefObject<React.ReactNode>;
|
|
102
102
|
_resizeLock: boolean;
|
|
103
103
|
_resizeListener: any;
|
|
104
|
+
foundation: TextAreaFoundation;
|
|
104
105
|
|
|
105
106
|
constructor(props: TextAreaProps) {
|
|
106
107
|
super(props);
|
|
@@ -197,6 +198,10 @@ class TextArea extends BaseComponent<TextAreaProps, TextAreaState> {
|
|
|
197
198
|
this.foundation.handleClear(e);
|
|
198
199
|
};
|
|
199
200
|
|
|
201
|
+
handleClearEnterPress = (e: React.KeyboardEvent<HTMLDivElement>) => {
|
|
202
|
+
this.foundation.handleClearEnterPress(e);
|
|
203
|
+
}
|
|
204
|
+
|
|
200
205
|
renderClearBtn() {
|
|
201
206
|
const { showClear } = this.props;
|
|
202
207
|
const displayClearBtn = this.foundation.isAllowClear();
|
|
@@ -205,7 +210,14 @@ class TextArea extends BaseComponent<TextAreaProps, TextAreaState> {
|
|
|
205
210
|
});
|
|
206
211
|
if (showClear) {
|
|
207
212
|
return (
|
|
208
|
-
<div
|
|
213
|
+
<div
|
|
214
|
+
role="button"
|
|
215
|
+
tabIndex={0}
|
|
216
|
+
aria-label="Clear textarea value"
|
|
217
|
+
className={clearCls}
|
|
218
|
+
onClick={this.handleClear}
|
|
219
|
+
onKeyPress={this.handleClearEnterPress}
|
|
220
|
+
>
|
|
209
221
|
<IconClear />
|
|
210
222
|
</div>
|
|
211
223
|
);
|
|
@@ -214,10 +226,10 @@ class TextArea extends BaseComponent<TextAreaProps, TextAreaState> {
|
|
|
214
226
|
}
|
|
215
227
|
|
|
216
228
|
renderCounter() {
|
|
217
|
-
let counter,
|
|
218
|
-
current,
|
|
219
|
-
total,
|
|
220
|
-
countCls;
|
|
229
|
+
let counter: React.ReactNode,
|
|
230
|
+
current: number,
|
|
231
|
+
total: number,
|
|
232
|
+
countCls: string;
|
|
221
233
|
const { showCounter, maxCount, getValueLength } = this.props;
|
|
222
234
|
if (showCounter || maxCount) {
|
|
223
235
|
const { value } = this.state;
|
|
@@ -231,7 +243,14 @@ class TextArea extends BaseComponent<TextAreaProps, TextAreaState> {
|
|
|
231
243
|
}
|
|
232
244
|
);
|
|
233
245
|
counter = (
|
|
234
|
-
<div
|
|
246
|
+
<div
|
|
247
|
+
aria-label="Textarea value length counter"
|
|
248
|
+
aria-valuemax={maxCount}
|
|
249
|
+
aria-valuenow={current}
|
|
250
|
+
className={countCls}
|
|
251
|
+
>
|
|
252
|
+
{current}{total ? '/' : null}{total}
|
|
253
|
+
</div>
|
|
235
254
|
);
|
|
236
255
|
} else {
|
|
237
256
|
counter = null;
|
|
@@ -641,3 +641,15 @@ export const FormCustomInput = () => {
|
|
|
641
641
|
FormCustomInput.story = {
|
|
642
642
|
name: 'Form.CustomInput',
|
|
643
643
|
};
|
|
644
|
+
|
|
645
|
+
|
|
646
|
+
export const FixPrecision = () => {
|
|
647
|
+
const [value, setValue] = useState(5.12);
|
|
648
|
+
const [value2, setValue2] = useState(5.12);
|
|
649
|
+
return (
|
|
650
|
+
<div>
|
|
651
|
+
<InputNumber onChange={v => setValue(v)} value={value} style={{ width: 190 }} precision={2} />
|
|
652
|
+
<InputNumber keepFocus onBlur={() => console.log('blur')} onChange={v => setValue2(v)} value={value2} style={{ width: 190 }} precision={2} />
|
|
653
|
+
</div>
|
|
654
|
+
);
|
|
655
|
+
}
|