@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
|
@@ -73,7 +73,9 @@ class DropdownItem extends BaseComponent {
|
|
|
73
73
|
}, icon);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
return /*#__PURE__*/React.createElement("li", _Object$assign({
|
|
76
|
+
return /*#__PURE__*/React.createElement("li", _Object$assign({
|
|
77
|
+
role: "menuitem"
|
|
78
|
+
}, events, {
|
|
77
79
|
ref: ref => forwardRef(ref),
|
|
78
80
|
className: itemclass,
|
|
79
81
|
style: style
|
|
@@ -30,7 +30,10 @@ class DropdownMenu extends BaseComponent {
|
|
|
30
30
|
} = _a,
|
|
31
31
|
rest = __rest(_a, ["children", "className", "style"]);
|
|
32
32
|
|
|
33
|
-
return /*#__PURE__*/React.createElement("ul", _Object$assign({
|
|
33
|
+
return /*#__PURE__*/React.createElement("ul", _Object$assign({
|
|
34
|
+
role: "menu",
|
|
35
|
+
"aria-orientation": "vertical"
|
|
36
|
+
}, rest, {
|
|
34
37
|
className: classnames("".concat(prefixCls, "-menu"), className),
|
|
35
38
|
style: style
|
|
36
39
|
}), children);
|
package/lib/es/empty/index.js
CHANGED
|
@@ -98,7 +98,8 @@ export default class Empty extends BaseComponent {
|
|
|
98
98
|
};
|
|
99
99
|
return /*#__PURE__*/React.createElement("div", {
|
|
100
100
|
className: wrapperCls,
|
|
101
|
-
style: style
|
|
101
|
+
style: style,
|
|
102
|
+
"aria-label": "empty placeholder image"
|
|
102
103
|
}, /*#__PURE__*/React.createElement("div", {
|
|
103
104
|
className: "".concat(prefixCls, "-image"),
|
|
104
105
|
style: imageStyle
|
|
@@ -13,6 +13,7 @@ interface BaseFormState {
|
|
|
13
13
|
}
|
|
14
14
|
declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
|
|
15
15
|
static propTypes: {
|
|
16
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
16
17
|
onSubmit: PropTypes.Requireable<(...args: any[]) => any>;
|
|
17
18
|
onSubmitFail: PropTypes.Requireable<(...args: any[]) => any>;
|
|
18
19
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -36,6 +37,7 @@ declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
|
|
|
36
37
|
disabled: PropTypes.Requireable<boolean>;
|
|
37
38
|
showValidateIcon: PropTypes.Requireable<boolean>;
|
|
38
39
|
extraTextPosition: PropTypes.Requireable<string>;
|
|
40
|
+
id: PropTypes.Requireable<string>;
|
|
39
41
|
};
|
|
40
42
|
static defaultProps: {
|
|
41
43
|
onChange: (...args: any[]) => void;
|
|
@@ -53,8 +55,14 @@ declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
|
|
|
53
55
|
static TextArea: React.ComponentType<import("utility-types").Subtract<Omit<import("../input").TextAreaProps, "forwardRef"> & React.RefAttributes<HTMLTextAreaElement>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
54
56
|
static InputNumber: React.ComponentType<import("utility-types").Subtract<import("../inputNumber").InputNumberProps & React.RefAttributes<HTMLInputElement>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
55
57
|
static Select: React.ComponentType<import("utility-types").Subtract<{
|
|
58
|
+
'aria-describedby'?: string;
|
|
59
|
+
'aria-errormessage'?: string;
|
|
60
|
+
'aria-invalid'?: boolean | "true" | "false" | "grammar" | "spelling";
|
|
61
|
+
'aria-labelledby'?: string;
|
|
62
|
+
'aria-required'?: boolean | "true" | "false";
|
|
56
63
|
id?: string;
|
|
57
64
|
autoFocus?: boolean;
|
|
65
|
+
autoClearSearchValue?: boolean;
|
|
58
66
|
arrowIcon?: React.ReactNode;
|
|
59
67
|
defaultValue?: string | number | any[] | Record<string, any>;
|
|
60
68
|
value?: string | number | any[] | Record<string, any>;
|
|
@@ -90,6 +98,7 @@ declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
|
|
|
90
98
|
suffix?: React.ReactNode;
|
|
91
99
|
prefix?: React.ReactNode;
|
|
92
100
|
insetLabel?: React.ReactNode;
|
|
101
|
+
insetLabelId?: string;
|
|
93
102
|
inputProps?: import("utility-types").Subtract<import("../input").InputProps, {
|
|
94
103
|
value?: React.ReactText;
|
|
95
104
|
onFocus?: (e: React.FocusEvent<HTMLInputElement, Element>) => void;
|
package/lib/es/form/baseForm.js
CHANGED
|
@@ -220,6 +220,7 @@ class Form extends BaseComponent {
|
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
Form.propTypes = {
|
|
223
|
+
'aria-label': PropTypes.string,
|
|
223
224
|
onSubmit: PropTypes.func,
|
|
224
225
|
onSubmitFail: PropTypes.func,
|
|
225
226
|
|
|
@@ -245,7 +246,8 @@ Form.propTypes = {
|
|
|
245
246
|
autoScrollToError: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]),
|
|
246
247
|
disabled: PropTypes.bool,
|
|
247
248
|
showValidateIcon: PropTypes.bool,
|
|
248
|
-
extraTextPosition: PropTypes.oneOf(strings.EXTRA_POS)
|
|
249
|
+
extraTextPosition: PropTypes.oneOf(strings.EXTRA_POS),
|
|
250
|
+
id: PropTypes.string
|
|
249
251
|
};
|
|
250
252
|
Form.defaultProps = {
|
|
251
253
|
onChange: _noop,
|
|
@@ -9,6 +9,8 @@ export interface ErrorMessageProps {
|
|
|
9
9
|
validateStatus?: string;
|
|
10
10
|
helpText?: React.ReactNode;
|
|
11
11
|
isInInputGroup?: boolean;
|
|
12
|
+
errorMessageId?: string;
|
|
13
|
+
helpTextId?: string;
|
|
12
14
|
}
|
|
13
15
|
export default class ErrorMessage extends PureComponent<ErrorMessageProps> {
|
|
14
16
|
static propTypes: {
|
|
@@ -19,6 +21,8 @@ export default class ErrorMessage extends PureComponent<ErrorMessageProps> {
|
|
|
19
21
|
showValidateIcon: PropTypes.Requireable<boolean>;
|
|
20
22
|
helpText: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
21
23
|
isInInputGroup: PropTypes.Requireable<boolean>;
|
|
24
|
+
errorMessageId: PropTypes.Requireable<string>;
|
|
25
|
+
helpTextId: PropTypes.Requireable<string>;
|
|
22
26
|
};
|
|
23
27
|
generatorText(error: ReactFieldError): JSX.Element;
|
|
24
28
|
render(): JSX.Element;
|
|
@@ -10,12 +10,27 @@ import { IconAlertTriangle, IconAlertCircle } from '@douyinfe/semi-icons';
|
|
|
10
10
|
const prefix = cssClasses.PREFIX;
|
|
11
11
|
export default class ErrorMessage extends PureComponent {
|
|
12
12
|
generatorText(error) {
|
|
13
|
+
const {
|
|
14
|
+
helpTextId,
|
|
15
|
+
errorMessageId
|
|
16
|
+
} = this.props;
|
|
17
|
+
const propsError = this.props.error;
|
|
18
|
+
let id = errorMessageId;
|
|
19
|
+
|
|
20
|
+
if (!propsError) {
|
|
21
|
+
id = helpTextId;
|
|
22
|
+
}
|
|
23
|
+
|
|
13
24
|
if (typeof error === 'string') {
|
|
14
|
-
return /*#__PURE__*/React.createElement("span",
|
|
25
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
26
|
+
id: id
|
|
27
|
+
}, error);
|
|
15
28
|
} else if (_Array$isArray(error)) {
|
|
16
29
|
const err = _filterInstanceProperty(error).call(error, e => e);
|
|
17
30
|
|
|
18
|
-
return err.length ? /*#__PURE__*/React.createElement("span",
|
|
31
|
+
return err.length ? /*#__PURE__*/React.createElement("span", {
|
|
32
|
+
id: id
|
|
33
|
+
}, err.join(', ')) : null;
|
|
19
34
|
} else if ( /*#__PURE__*/React.isValidElement(error)) {
|
|
20
35
|
return error;
|
|
21
36
|
}
|
|
@@ -76,5 +91,8 @@ ErrorMessage.propTypes = {
|
|
|
76
91
|
validateStatus: PropTypes.string,
|
|
77
92
|
showValidateIcon: PropTypes.bool,
|
|
78
93
|
helpText: PropTypes.node,
|
|
79
|
-
isInInputGroup: PropTypes.bool
|
|
94
|
+
isInInputGroup: PropTypes.bool,
|
|
95
|
+
// internal props
|
|
96
|
+
errorMessageId: PropTypes.string,
|
|
97
|
+
helpTextId: PropTypes.string
|
|
80
98
|
};
|
package/lib/es/form/field.d.ts
CHANGED
|
@@ -3,8 +3,14 @@ declare const FormInput: import("react").ComponentType<import("utility-types").S
|
|
|
3
3
|
declare const FormInputNumber: import("react").ComponentType<import("utility-types").Subtract<import("../inputNumber/index").InputNumberProps & import("react").RefAttributes<HTMLInputElement>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
4
4
|
declare const FormTextArea: import("react").ComponentType<import("utility-types").Subtract<Omit<import("../input/textarea").TextAreaProps, "forwardRef"> & import("react").RefAttributes<HTMLTextAreaElement>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
5
5
|
declare const FormSelect: import("react").ComponentType<import("utility-types").Subtract<{
|
|
6
|
+
'aria-describedby'?: string;
|
|
7
|
+
'aria-errormessage'?: string;
|
|
8
|
+
'aria-invalid'?: boolean | "true" | "false" | "grammar" | "spelling";
|
|
9
|
+
'aria-labelledby'?: string;
|
|
10
|
+
'aria-required'?: boolean | "true" | "false";
|
|
6
11
|
id?: string;
|
|
7
12
|
autoFocus?: boolean;
|
|
13
|
+
autoClearSearchValue?: boolean;
|
|
8
14
|
arrowIcon?: import("react").ReactNode;
|
|
9
15
|
defaultValue?: string | number | any[] | Record<string, any>;
|
|
10
16
|
value?: string | number | any[] | Record<string, any>;
|
|
@@ -40,6 +46,7 @@ declare const FormSelect: import("react").ComponentType<import("utility-types").
|
|
|
40
46
|
suffix?: import("react").ReactNode;
|
|
41
47
|
prefix?: import("react").ReactNode;
|
|
42
48
|
insetLabel?: import("react").ReactNode;
|
|
49
|
+
insetLabelId?: string;
|
|
43
50
|
inputProps?: import("utility-types").Subtract<import("../input/index").InputProps, {
|
|
44
51
|
value?: import("react").ReactText;
|
|
45
52
|
onFocus?: (e: import("react").FocusEvent<HTMLInputElement, Element>) => void;
|
|
@@ -60,6 +60,7 @@ function withField(Component, opts) {
|
|
|
60
60
|
extraText,
|
|
61
61
|
extraTextPosition,
|
|
62
62
|
pure,
|
|
63
|
+
id,
|
|
63
64
|
rest
|
|
64
65
|
} = mergeProps(props);
|
|
65
66
|
let {
|
|
@@ -396,27 +397,62 @@ function withField(Component, opts) {
|
|
|
396
397
|
let mergeLabelAlign = labelAlign || formProps.labelAlign;
|
|
397
398
|
let mergeLabelCol = labelCol || formProps.labelCol;
|
|
398
399
|
let mergeWrapperCol = wrapperCol || formProps.wrapperCol;
|
|
399
|
-
let mergeExtraPos = extraTextPosition || formProps.extraTextPosition || 'bottom';
|
|
400
|
+
let mergeExtraPos = extraTextPosition || formProps.extraTextPosition || 'bottom'; // id attribute to improve a11y
|
|
401
|
+
|
|
402
|
+
const a11yId = id ? id : field;
|
|
403
|
+
const labelId = "".concat(a11yId, "-label");
|
|
404
|
+
const helpTextId = "".concat(a11yId, "-helpText");
|
|
405
|
+
const extraTextId = "".concat(a11yId, "-extraText");
|
|
406
|
+
const errorMessageId = "".concat(a11yId, "-errormessage");
|
|
400
407
|
|
|
401
408
|
let FieldComponent = (() => {
|
|
402
|
-
var
|
|
409
|
+
var _context3, _context5;
|
|
403
410
|
|
|
404
411
|
// prefer to use validateStatus which pass by user throught props
|
|
405
412
|
let blockStatus = validateStatus ? validateStatus : status;
|
|
413
|
+
const extraCls = classNames("".concat(prefix, "-field-extra"), {
|
|
414
|
+
["".concat(prefix, "-field-extra-string")]: typeof extraText === 'string',
|
|
415
|
+
["".concat(prefix, "-field-extra-middle")]: mergeExtraPos === 'middle',
|
|
416
|
+
["".concat(prefix, "-field-extra-botttom")]: mergeExtraPos === 'bottom'
|
|
417
|
+
});
|
|
418
|
+
const extraContent = extraText ? /*#__PURE__*/React.createElement("div", {
|
|
419
|
+
className: extraCls,
|
|
420
|
+
id: extraTextId
|
|
421
|
+
}, extraText) : null;
|
|
406
422
|
|
|
407
423
|
let newProps = _Object$assign(_Object$assign({
|
|
424
|
+
id: a11yId,
|
|
408
425
|
disabled: formProps.disabled
|
|
409
426
|
}, rest), {
|
|
410
427
|
ref,
|
|
411
428
|
onBlur: handleBlur,
|
|
412
429
|
[options.onKeyChangeFnName]: handleChange,
|
|
413
430
|
[options.valueKey]: value,
|
|
414
|
-
validateStatus: blockStatus
|
|
431
|
+
validateStatus: blockStatus,
|
|
432
|
+
'aria-required': required,
|
|
433
|
+
'aria-labelledby': labelId
|
|
415
434
|
});
|
|
416
435
|
|
|
436
|
+
if (helpText) {
|
|
437
|
+
var _context;
|
|
438
|
+
|
|
439
|
+
newProps['aria-describedby'] = extraText ? _concatInstanceProperty(_context = "".concat(helpTextId, " ")).call(_context, extraTextId) : helpTextId;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
if (extraText) {
|
|
443
|
+
var _context2;
|
|
444
|
+
|
|
445
|
+
newProps['aria-describedby'] = helpText ? _concatInstanceProperty(_context2 = "".concat(helpTextId, " ")).call(_context2, extraTextId) : extraTextId;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
if (status === 'error') {
|
|
449
|
+
newProps['aria-errormessage'] = errorMessageId;
|
|
450
|
+
newProps['aria-invalid'] = true;
|
|
451
|
+
}
|
|
452
|
+
|
|
417
453
|
const fieldCls = classNames({
|
|
418
454
|
["".concat(prefix, "-field")]: true,
|
|
419
|
-
[_concatInstanceProperty(
|
|
455
|
+
[_concatInstanceProperty(_context3 = "".concat(prefix, "-field-")).call(_context3, name)]: Boolean(name),
|
|
420
456
|
[fieldClassName]: Boolean(fieldClassName)
|
|
421
457
|
});
|
|
422
458
|
const fieldMaincls = classNames({
|
|
@@ -425,9 +461,11 @@ function withField(Component, opts) {
|
|
|
425
461
|
|
|
426
462
|
if (mergeLabelPos === 'inset' && !noLabel) {
|
|
427
463
|
newProps.insetLabel = label || field;
|
|
464
|
+
newProps.insetLabelId = labelId;
|
|
428
465
|
|
|
429
466
|
if (typeof label === 'object' && !isElement(label)) {
|
|
430
467
|
newProps.insetLabel = label.text;
|
|
468
|
+
newProps.insetLabelId = labelId;
|
|
431
469
|
}
|
|
432
470
|
}
|
|
433
471
|
|
|
@@ -438,11 +476,11 @@ function withField(Component, opts) {
|
|
|
438
476
|
}
|
|
439
477
|
|
|
440
478
|
if (pure) {
|
|
441
|
-
var
|
|
479
|
+
var _context4;
|
|
442
480
|
|
|
443
481
|
let pureCls = classNames(rest.className, {
|
|
444
482
|
["".concat(prefix, "-field-pure")]: true,
|
|
445
|
-
[_concatInstanceProperty(
|
|
483
|
+
[_concatInstanceProperty(_context4 = "".concat(prefix, "-field-")).call(_context4, name)]: Boolean(name),
|
|
446
484
|
[fieldClassName]: Boolean(fieldClassName)
|
|
447
485
|
});
|
|
448
486
|
newProps.className = pureCls;
|
|
@@ -450,7 +488,7 @@ function withField(Component, opts) {
|
|
|
450
488
|
}
|
|
451
489
|
|
|
452
490
|
let withCol = mergeLabelCol && mergeWrapperCol;
|
|
453
|
-
const labelColCls = mergeLabelAlign ? _concatInstanceProperty(
|
|
491
|
+
const labelColCls = mergeLabelAlign ? _concatInstanceProperty(_context5 = "".concat(prefix, "-col-")).call(_context5, mergeLabelAlign) : ''; // get label
|
|
454
492
|
|
|
455
493
|
let labelContent = null;
|
|
456
494
|
|
|
@@ -458,6 +496,7 @@ function withField(Component, opts) {
|
|
|
458
496
|
let needSpread = typeof label === 'object' && !isElement(label) ? label : {};
|
|
459
497
|
labelContent = /*#__PURE__*/React.createElement(Label, _Object$assign({
|
|
460
498
|
text: label || field,
|
|
499
|
+
id: labelId,
|
|
461
500
|
required: required,
|
|
462
501
|
name: name || field,
|
|
463
502
|
width: mergeLabelWidth,
|
|
@@ -465,20 +504,14 @@ function withField(Component, opts) {
|
|
|
465
504
|
}, needSpread));
|
|
466
505
|
}
|
|
467
506
|
|
|
468
|
-
const extraCls = classNames("".concat(prefix, "-field-extra"), {
|
|
469
|
-
["".concat(prefix, "-field-extra-string")]: typeof extraText === 'string',
|
|
470
|
-
["".concat(prefix, "-field-extra-middle")]: mergeExtraPos === 'middle',
|
|
471
|
-
["".concat(prefix, "-field-extra-botttom")]: mergeExtraPos === 'bottom'
|
|
472
|
-
});
|
|
473
|
-
const extraContent = extraText ? /*#__PURE__*/React.createElement("div", {
|
|
474
|
-
className: extraCls
|
|
475
|
-
}, extraText) : null;
|
|
476
507
|
const fieldMainContent = /*#__PURE__*/React.createElement("div", {
|
|
477
508
|
className: fieldMaincls
|
|
478
509
|
}, mergeExtraPos === 'middle' ? extraContent : null, com, !noErrorMessage ? /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
479
510
|
error: error,
|
|
480
511
|
validateStatus: blockStatus,
|
|
481
512
|
helpText: helpText,
|
|
513
|
+
helpTextId: helpTextId,
|
|
514
|
+
errorMessageId: errorMessageId,
|
|
482
515
|
showValidateIcon: formProps.showValidateIcon
|
|
483
516
|
}) : null, mergeExtraPos === 'bottom' ? extraContent : null);
|
|
484
517
|
const withColContent = /*#__PURE__*/React.createElement(React.Fragment, null, mergeLabelPos === 'top' ? /*#__PURE__*/React.createElement("div", {
|
package/lib/es/form/index.d.ts
CHANGED
|
@@ -11,7 +11,6 @@ import { useFormApi, useFormState, useFieldState, useFieldApi } from './hooks/in
|
|
|
11
11
|
import withField from './hoc/withField';
|
|
12
12
|
import withFormState from './hoc/withFormState';
|
|
13
13
|
import withFormApi from './hoc/withFormApi';
|
|
14
|
-
export * from './interface';
|
|
15
14
|
export { Form, ArrayField, withField, useFormApi, useFormState, useFieldApi, useFieldState, withFormState, withFormApi };
|
|
16
15
|
export * from './interface';
|
|
17
16
|
export { ArrayFieldProps } from './arrayField';
|
package/lib/es/form/index.js
CHANGED
|
@@ -14,6 +14,5 @@ import { useFormApi, useFormState, useFieldState, useFieldApi } from './hooks/in
|
|
|
14
14
|
import withField from './hoc/withField';
|
|
15
15
|
import withFormState from './hoc/withFormState';
|
|
16
16
|
import withFormApi from './hoc/withFormApi';
|
|
17
|
-
export * from './interface';
|
|
18
17
|
export { Form, ArrayField, withField, useFormApi, useFormState, useFieldApi, useFieldState, withFormState, withFormApi };
|
|
19
18
|
export * from './interface';
|
|
@@ -82,6 +82,7 @@ export interface FormFCChild<K extends Record<string, any> = any> {
|
|
|
82
82
|
formApi: FormApi<K>;
|
|
83
83
|
}
|
|
84
84
|
export interface BaseFormProps {
|
|
85
|
+
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
85
86
|
onSubmit?: (values: Record<string, any>) => void;
|
|
86
87
|
onSubmitFail?: (errors: Record<string, FieldError>, values: any) => void;
|
|
87
88
|
onReset?: () => void;
|
|
@@ -90,6 +91,7 @@ export interface BaseFormProps {
|
|
|
90
91
|
validateFields?: (values: Record<string, any>) => string | Record<string, any>;
|
|
91
92
|
/** Use this if you want to populate the form with initial values. */
|
|
92
93
|
initValues?: Record<string, any>;
|
|
94
|
+
id?: string;
|
|
93
95
|
/** getFormApi will be call once when Form mounted, u can save formApi reference in your component */
|
|
94
96
|
getFormApi?: (formApi: FormApi) => void;
|
|
95
97
|
style?: React.CSSProperties;
|
package/lib/es/form/label.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { PureComponent } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
export interface LabelProps {
|
|
4
|
+
id?: string;
|
|
4
5
|
/** Whether to display the required * symbol */
|
|
5
6
|
required?: boolean;
|
|
6
7
|
/** Content of label */
|
|
@@ -24,6 +25,7 @@ export default class Label extends PureComponent<LabelProps> {
|
|
|
24
25
|
className: string;
|
|
25
26
|
};
|
|
26
27
|
static propTypes: {
|
|
28
|
+
id: PropTypes.Requireable<string>;
|
|
27
29
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
28
30
|
required: PropTypes.Requireable<boolean>;
|
|
29
31
|
text: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
package/lib/es/form/label.js
CHANGED
|
@@ -15,7 +15,8 @@ export default class Label extends PureComponent {
|
|
|
15
15
|
align,
|
|
16
16
|
style,
|
|
17
17
|
className,
|
|
18
|
-
extra
|
|
18
|
+
extra,
|
|
19
|
+
id
|
|
19
20
|
} = this.props;
|
|
20
21
|
const labelCls = classNames(className, {
|
|
21
22
|
["".concat(prefixCls, "-field-label")]: true,
|
|
@@ -36,7 +37,8 @@ export default class Label extends PureComponent {
|
|
|
36
37
|
return /*#__PURE__*/React.createElement("label", {
|
|
37
38
|
className: labelCls,
|
|
38
39
|
htmlFor: name,
|
|
39
|
-
style: labelStyle
|
|
40
|
+
style: labelStyle,
|
|
41
|
+
id: id
|
|
40
42
|
}, extra ? contentWithExtra : textContent);
|
|
41
43
|
}
|
|
42
44
|
|
|
@@ -48,6 +50,7 @@ Label.defaultProps = {
|
|
|
48
50
|
className: ''
|
|
49
51
|
};
|
|
50
52
|
Label.propTypes = {
|
|
53
|
+
id: PropTypes.string,
|
|
51
54
|
children: PropTypes.node,
|
|
52
55
|
required: PropTypes.bool,
|
|
53
56
|
text: PropTypes.node,
|
package/lib/es/input/index.d.ts
CHANGED
|
@@ -9,6 +9,12 @@ export declare type InputSize = 'small' | 'large' | 'default';
|
|
|
9
9
|
export declare type InputMode = 'password';
|
|
10
10
|
export declare type ValidateStatus = "default" | "error" | "warning" | "success";
|
|
11
11
|
export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'prefix' | 'size' | 'autoFocus' | 'placeholder' | 'onFocus' | 'onBlur'> {
|
|
12
|
+
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
13
|
+
'aria-describedby'?: React.AriaAttributes['aria-describedby'];
|
|
14
|
+
'aria-errormessage'?: React.AriaAttributes['aria-errormessage'];
|
|
15
|
+
'aria-invalid'?: React.AriaAttributes['aria-invalid'];
|
|
16
|
+
'aria-labelledby'?: React.AriaAttributes['aria-labelledby'];
|
|
17
|
+
'aria-required'?: React.AriaAttributes['aria-required'];
|
|
12
18
|
addonBefore?: React.ReactNode;
|
|
13
19
|
addonAfter?: React.ReactNode;
|
|
14
20
|
prefix?: React.ReactNode;
|
|
@@ -24,6 +30,7 @@ export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElem
|
|
|
24
30
|
hideSuffix?: boolean;
|
|
25
31
|
placeholder?: React.ReactText;
|
|
26
32
|
insetLabel?: React.ReactNode;
|
|
33
|
+
insetLabelId?: string;
|
|
27
34
|
size?: InputSize;
|
|
28
35
|
className?: string;
|
|
29
36
|
style?: React.CSSProperties;
|
|
@@ -54,6 +61,12 @@ export interface InputState {
|
|
|
54
61
|
}
|
|
55
62
|
declare class Input extends BaseComponent<InputProps, InputState> {
|
|
56
63
|
static propTypes: {
|
|
64
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
65
|
+
'aria-labelledby': PropTypes.Requireable<string>;
|
|
66
|
+
'aria-invalid': PropTypes.Requireable<boolean>;
|
|
67
|
+
'aria-errormessage': PropTypes.Requireable<string>;
|
|
68
|
+
'aria-describedby': PropTypes.Requireable<string>;
|
|
69
|
+
'aria-required': PropTypes.Requireable<boolean>;
|
|
57
70
|
addonBefore: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
58
71
|
addonAfter: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
59
72
|
prefix: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
@@ -82,6 +95,7 @@ declare class Input extends BaseComponent<InputProps, InputState> {
|
|
|
82
95
|
onKeyPress: PropTypes.Requireable<(...args: any[]) => any>;
|
|
83
96
|
onEnterPress: PropTypes.Requireable<(...args: any[]) => any>;
|
|
84
97
|
insetLabel: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
98
|
+
insetLabelId: PropTypes.Requireable<string>;
|
|
85
99
|
inputStyle: PropTypes.Requireable<object>;
|
|
86
100
|
getValueLength: PropTypes.Requireable<(...args: any[]) => any>;
|
|
87
101
|
};
|
|
@@ -147,6 +161,7 @@ declare class Input extends BaseComponent<InputProps, InputState> {
|
|
|
147
161
|
static getDerivedStateFromProps(props: InputProps, state: InputState): Partial<InputState>;
|
|
148
162
|
componentDidUpdate(prevProps: InputProps): void;
|
|
149
163
|
handleClear: (e: React.MouseEvent<HTMLInputElement>) => void;
|
|
164
|
+
handleClearEnterPress: (e: React.KeyboardEvent<HTMLDivElement>) => void;
|
|
150
165
|
handleClick: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
151
166
|
handleMouseOver: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
152
167
|
handleMouseLeave: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
@@ -154,6 +169,7 @@ declare class Input extends BaseComponent<InputProps, InputState> {
|
|
|
154
169
|
handleClickEye: (e: React.MouseEvent<HTMLInputElement>) => void;
|
|
155
170
|
handleMouseDown: (e: React.MouseEvent<HTMLInputElement>) => void;
|
|
156
171
|
handleMouseUp: (e: React.MouseEvent<HTMLInputElement>) => void;
|
|
172
|
+
handleModeEnterPress: (e: React.KeyboardEvent<HTMLDivElement>) => void;
|
|
157
173
|
handleClickPrefixOrSuffix: (e: React.MouseEvent<HTMLInputElement>) => void;
|
|
158
174
|
handlePreventMouseDown: (e: React.MouseEvent<HTMLInputElement>) => void;
|
|
159
175
|
renderPrepend(): JSX.Element;
|
package/lib/es/input/index.js
CHANGED
|
@@ -41,6 +41,10 @@ class Input extends BaseComponent {
|
|
|
41
41
|
this.foundation.handleClear(e);
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
+
this.handleClearEnterPress = e => {
|
|
45
|
+
this.foundation.handleClearEnterPress(e);
|
|
46
|
+
};
|
|
47
|
+
|
|
44
48
|
this.handleClick = e => {
|
|
45
49
|
this.foundation.handleClick(e);
|
|
46
50
|
};
|
|
@@ -73,6 +77,10 @@ class Input extends BaseComponent {
|
|
|
73
77
|
this.foundation.handleMouseUp(e);
|
|
74
78
|
};
|
|
75
79
|
|
|
80
|
+
this.handleModeEnterPress = e => {
|
|
81
|
+
this.foundation.handleModeEnterPress(e);
|
|
82
|
+
};
|
|
83
|
+
|
|
76
84
|
this.handleClickPrefixOrSuffix = e => {
|
|
77
85
|
this.foundation.handleClickPrefixOrSuffix(e);
|
|
78
86
|
};
|
|
@@ -207,8 +215,12 @@ class Input extends BaseComponent {
|
|
|
207
215
|
|
|
208
216
|
if (allowClear) {
|
|
209
217
|
return /*#__PURE__*/React.createElement("div", {
|
|
218
|
+
role: "button",
|
|
219
|
+
tabIndex: 0,
|
|
220
|
+
"aria-label": "Clear input value",
|
|
210
221
|
className: clearCls,
|
|
211
|
-
onMouseDown: this.handleClear
|
|
222
|
+
onMouseDown: this.handleClear,
|
|
223
|
+
onKeyPress: this.handleClearEnterPress
|
|
212
224
|
}, /*#__PURE__*/React.createElement(IconClear, null));
|
|
213
225
|
}
|
|
214
226
|
|
|
@@ -229,13 +241,18 @@ class Input extends BaseComponent {
|
|
|
229
241
|
const modeCls = cls("".concat(prefixCls, "-modebtn"));
|
|
230
242
|
const modeIcon = eyeClosed ? /*#__PURE__*/React.createElement(IconEyeClosedSolid, null) : /*#__PURE__*/React.createElement(IconEyeOpened, null);
|
|
231
243
|
const showModeBtn = mode === 'password' && value && !disabled && (isFocus || isHovering);
|
|
244
|
+
const ariaLabel = eyeClosed ? 'Show password' : 'Hidden password';
|
|
232
245
|
|
|
233
246
|
if (showModeBtn) {
|
|
234
247
|
return /*#__PURE__*/React.createElement("div", {
|
|
248
|
+
role: "button",
|
|
249
|
+
tabIndex: 0,
|
|
250
|
+
"aria-label": ariaLabel,
|
|
235
251
|
className: modeCls,
|
|
236
252
|
onClick: this.handleClickEye,
|
|
237
253
|
onMouseDown: this.handleMouseDown,
|
|
238
|
-
onMouseUp: this.handleMouseUp
|
|
254
|
+
onMouseUp: this.handleMouseUp,
|
|
255
|
+
onKeyPress: this.handleModeEnterPress
|
|
239
256
|
}, modeIcon);
|
|
240
257
|
}
|
|
241
258
|
|
|
@@ -245,7 +262,8 @@ class Input extends BaseComponent {
|
|
|
245
262
|
renderPrefix() {
|
|
246
263
|
const {
|
|
247
264
|
prefix,
|
|
248
|
-
insetLabel
|
|
265
|
+
insetLabel,
|
|
266
|
+
insetLabelId
|
|
249
267
|
} = this.props;
|
|
250
268
|
const labelNode = prefix || insetLabel;
|
|
251
269
|
|
|
@@ -258,11 +276,13 @@ class Input extends BaseComponent {
|
|
|
258
276
|
["".concat(prefixCls, "-inset-label")]: insetLabel,
|
|
259
277
|
["".concat(prefixCls, "-prefix-text")]: labelNode && _isString(labelNode),
|
|
260
278
|
["".concat(prefixCls, "-prefix-icon")]: isSemiIcon(labelNode)
|
|
261
|
-
});
|
|
279
|
+
}); // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
280
|
+
|
|
262
281
|
return /*#__PURE__*/React.createElement("div", {
|
|
263
282
|
className: prefixWrapperCls,
|
|
264
283
|
onMouseDown: this.handlePreventMouseDown,
|
|
265
|
-
onClick: this.handleClickPrefixOrSuffix
|
|
284
|
+
onClick: this.handleClickPrefixOrSuffix,
|
|
285
|
+
id: insetLabelId
|
|
266
286
|
}, labelNode);
|
|
267
287
|
}
|
|
268
288
|
|
|
@@ -294,7 +314,8 @@ class Input extends BaseComponent {
|
|
|
294
314
|
["".concat(prefixCls, "-suffix-text")]: suffix && _isString(suffix),
|
|
295
315
|
["".concat(prefixCls, "-suffix-icon")]: isSemiIcon(suffix),
|
|
296
316
|
["".concat(prefixCls, "-suffix-hidden")]: suffixAllowClear && Boolean(hideSuffix)
|
|
297
|
-
});
|
|
317
|
+
}); // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
318
|
+
|
|
298
319
|
return /*#__PURE__*/React.createElement("div", {
|
|
299
320
|
className: suffixWrapperCls,
|
|
300
321
|
onMouseDown: this.handlePreventMouseDown,
|
|
@@ -398,20 +419,34 @@ class Input extends BaseComponent {
|
|
|
398
419
|
inputProps.minLength = stateMinLength;
|
|
399
420
|
}
|
|
400
421
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
422
|
+
if (validateStatus === 'error') {
|
|
423
|
+
inputProps['aria-invalid'] = "true";
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
return (
|
|
427
|
+
/*#__PURE__*/
|
|
428
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
429
|
+
React.createElement("div", {
|
|
430
|
+
className: wrapperCls,
|
|
431
|
+
style: style,
|
|
432
|
+
onMouseEnter: e => this.handleMouseOver(e),
|
|
433
|
+
onMouseLeave: e => this.handleMouseLeave(e),
|
|
434
|
+
onClick: e => this.handleClick(e)
|
|
435
|
+
}, this.renderPrepend(), this.renderPrefix(), /*#__PURE__*/React.createElement("input", _Object$assign({}, inputProps, {
|
|
436
|
+
ref: ref
|
|
437
|
+
})), this.renderClearBtn(), this.renderSuffix(suffixAllowClear), this.renderModeBtn(), this.renderAppend())
|
|
438
|
+
);
|
|
410
439
|
}
|
|
411
440
|
|
|
412
441
|
}
|
|
413
442
|
|
|
414
443
|
Input.propTypes = {
|
|
444
|
+
'aria-label': PropTypes.string,
|
|
445
|
+
'aria-labelledby': PropTypes.string,
|
|
446
|
+
'aria-invalid': PropTypes.bool,
|
|
447
|
+
'aria-errormessage': PropTypes.string,
|
|
448
|
+
'aria-describedby': PropTypes.string,
|
|
449
|
+
'aria-required': PropTypes.bool,
|
|
415
450
|
addonBefore: PropTypes.node,
|
|
416
451
|
addonAfter: PropTypes.node,
|
|
417
452
|
prefix: PropTypes.node,
|
|
@@ -440,6 +475,7 @@ Input.propTypes = {
|
|
|
440
475
|
onKeyPress: PropTypes.func,
|
|
441
476
|
onEnterPress: PropTypes.func,
|
|
442
477
|
insetLabel: PropTypes.node,
|
|
478
|
+
insetLabelId: PropTypes.string,
|
|
443
479
|
inputStyle: PropTypes.object,
|
|
444
480
|
getValueLength: PropTypes.func
|
|
445
481
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import BaseComponent from '../_base/baseComponent';
|
|
4
|
+
import { LabelProps } from '../form/label';
|
|
4
5
|
import { noop } from '@douyinfe/semi-foundation/lib/es/utils/function';
|
|
5
6
|
export declare type InputSize = 'small' | 'large' | 'default';
|
|
6
7
|
export interface InputGroupProps {
|
|
@@ -10,7 +11,7 @@ export interface InputGroupProps {
|
|
|
10
11
|
style?: Record<string, any>;
|
|
11
12
|
onBlur?: (e: React.FocusEvent<HTMLSpanElement>) => void;
|
|
12
13
|
onFocus?: (e: React.FocusEvent<HTMLSpanElement>) => void;
|
|
13
|
-
label?:
|
|
14
|
+
label?: LabelProps;
|
|
14
15
|
labelPosition?: string;
|
|
15
16
|
disabled?: boolean;
|
|
16
17
|
}
|
|
@@ -51,9 +51,16 @@ export default class inputGroup extends BaseComponent {
|
|
|
51
51
|
[_concatInstanceProperty(_context = "".concat(prefixCls, "-")).call(_context, size)]: size !== 'default'
|
|
52
52
|
}); // const labelCls = cls(label.className, '');
|
|
53
53
|
|
|
54
|
+
const defaultName = 'input-group';
|
|
54
55
|
return /*#__PURE__*/React.createElement("div", {
|
|
56
|
+
role: "group",
|
|
57
|
+
"aria-label": "Input group",
|
|
58
|
+
"aria-disabled": this.props.disabled,
|
|
55
59
|
className: groupWrapperCls
|
|
56
|
-
}, label && label.text ? /*#__PURE__*/React.createElement(Label, _Object$assign({
|
|
60
|
+
}, label && label.text ? /*#__PURE__*/React.createElement(Label, _Object$assign({
|
|
61
|
+
name: defaultName
|
|
62
|
+
}, label)) : null, /*#__PURE__*/React.createElement("span", {
|
|
63
|
+
id: label && label.name || defaultName,
|
|
57
64
|
className: groupCls,
|
|
58
65
|
style: this.props.style,
|
|
59
66
|
onFocus: this.props.onFocus,
|
|
@@ -109,6 +116,9 @@ export default class inputGroup extends BaseComponent {
|
|
|
109
116
|
}
|
|
110
117
|
|
|
111
118
|
return /*#__PURE__*/React.createElement("span", {
|
|
119
|
+
role: "group",
|
|
120
|
+
"aria-label": "Input group",
|
|
121
|
+
"aria-disabled": this.props.disabled,
|
|
112
122
|
className: groupCls,
|
|
113
123
|
style: style,
|
|
114
124
|
onFocus: this.props.onFocus,
|