@douyinfe/semi-ui 2.9.0-beta.0 → 2.9.1
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/baseComponent.tsx +2 -1
- package/_portal/index.tsx +2 -1
- package/anchor/__test__/anchor.test.js +1 -0
- package/anchor/_story/anchor.stories.js +23 -1
- package/anchor/index.tsx +2 -1
- package/anchor/link.tsx +2 -1
- package/autoComplete/index.tsx +2 -2
- package/avatar/interface.ts +2 -2
- package/backtop/index.tsx +1 -0
- package/badge/_story/badge.stories.js +34 -2
- package/badge/index.tsx +4 -2
- package/banner/index.tsx +1 -0
- package/breadcrumb/bread-context.tsx +2 -2
- package/breadcrumb/index.tsx +2 -2
- package/breadcrumb/item.tsx +11 -3
- package/button/Button.tsx +2 -1
- package/button/buttonGroup.tsx +2 -1
- package/calendar/_story/Demo.tsx +3 -3
- package/card/cardGroup.tsx +1 -0
- package/card/index.tsx +1 -0
- package/cascader/_story/cascader.stories.js +17 -2
- package/cascader/index.tsx +4 -3
- package/cascader/item.tsx +3 -1
- package/checkbox/_story/checkbox.stories.js +1 -1
- package/checkbox/checkbox.tsx +4 -2
- package/checkbox/checkboxGroup.tsx +1 -1
- package/checkbox/context.ts +3 -3
- package/collapse/index.tsx +1 -0
- package/collapse/item.tsx +5 -0
- package/collapsible/index.tsx +2 -2
- package/configProvider/context.tsx +1 -1
- package/datePicker/_story/datePicker.stories.js +37 -0
- package/datePicker/datePicker.tsx +2 -1
- package/descriptions/index.tsx +2 -1
- package/descriptions/item.tsx +4 -1
- package/dist/css/semi.css +2 -2
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +7560 -3681
- 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/context.ts +6 -1
- package/dropdown/dropdownItem.tsx +2 -1
- package/dropdown/dropdownTitle.tsx +2 -1
- package/dropdown/index.tsx +3 -1
- package/empty/index.tsx +1 -1
- package/form/arrayField.tsx +1 -0
- package/form/baseForm.tsx +3 -2
- package/form/group.tsx +2 -0
- package/form/hoc/withField.tsx +9 -6
- package/form/label.tsx +1 -0
- package/form/section.tsx +1 -1
- package/form/slot.tsx +2 -0
- package/grid/col.tsx +3 -1
- package/grid/row.tsx +5 -1
- package/input/__test__/input.test.js +12 -3
- package/input/__test__/textArea.test.js +53 -0
- package/layout/Sider.tsx +3 -1
- package/layout/index.tsx +2 -0
- package/layout/layout-context.ts +1 -1
- package/lib/cjs/_base/baseComponent.d.ts +2 -1
- package/lib/cjs/_portal/index.d.ts +3 -1
- package/lib/cjs/anchor/index.d.ts +2 -1
- package/lib/cjs/anchor/link.d.ts +3 -2
- package/lib/cjs/autoComplete/index.d.ts +2 -2
- package/lib/cjs/avatar/avatarGroup.d.ts +1 -1
- package/lib/cjs/avatar/interface.d.ts +2 -2
- package/lib/cjs/backtop/index.d.ts +1 -0
- package/lib/cjs/badge/index.d.ts +4 -2
- package/lib/cjs/banner/index.d.ts +2 -1
- package/lib/cjs/breadcrumb/bread-context.d.ts +2 -2
- package/lib/cjs/breadcrumb/index.d.ts +2 -2
- package/lib/cjs/breadcrumb/item.d.ts +15 -3
- package/lib/cjs/button/Button.d.ts +2 -1
- package/lib/cjs/button/buttonGroup.d.ts +1 -0
- package/lib/cjs/button/index.d.ts +1 -1
- package/lib/cjs/calendar/timeCol.d.ts +1 -1
- package/lib/cjs/card/cardGroup.d.ts +1 -0
- package/lib/cjs/card/index.d.ts +2 -1
- package/lib/cjs/cascader/index.d.ts +5 -3
- package/lib/cjs/cascader/index.js +1 -1
- package/lib/cjs/cascader/item.d.ts +3 -1
- package/lib/cjs/checkbox/checkbox.d.ts +5 -11
- package/lib/cjs/checkbox/checkbox.js +1 -1
- package/lib/cjs/checkbox/checkboxGroup.d.ts +1 -1
- package/lib/cjs/checkbox/checkboxInner.d.ts +1 -10
- package/lib/cjs/checkbox/context.d.ts +3 -3
- package/lib/cjs/collapse/index.d.ts +1 -0
- package/lib/cjs/collapse/item.d.ts +2 -0
- package/lib/cjs/collapse/item.js +4 -2
- package/lib/cjs/collapsible/index.d.ts +1 -1
- package/lib/cjs/configProvider/index.d.ts +1 -1
- package/lib/cjs/datePicker/datePicker.d.ts +3 -1
- package/lib/cjs/datePicker/insetInput.d.ts +1 -0
- package/lib/cjs/descriptions/index.d.ts +4 -3
- package/lib/cjs/descriptions/item.d.ts +4 -1
- package/lib/cjs/dropdown/context.d.ts +5 -3
- package/lib/cjs/dropdown/dropdownItem.d.ts +3 -3
- package/lib/cjs/dropdown/dropdownMenu.d.ts +1 -0
- package/lib/cjs/dropdown/dropdownTitle.d.ts +3 -3
- package/lib/cjs/dropdown/index.d.ts +3 -3
- package/lib/cjs/empty/index.d.ts +1 -1
- package/lib/cjs/form/arrayField.d.ts +1 -0
- package/lib/cjs/form/baseForm.d.ts +2 -2
- package/lib/cjs/form/baseForm.js +1 -1
- package/lib/cjs/form/errorMessage.d.ts +1 -1
- package/lib/cjs/form/group.d.ts +3 -1
- package/lib/cjs/form/hoc/withField.js +6 -4
- package/lib/cjs/form/label.d.ts +1 -0
- package/lib/cjs/form/section.d.ts +1 -1
- package/lib/cjs/form/slot.js +2 -0
- package/lib/cjs/grid/col.d.ts +3 -3
- package/lib/cjs/grid/row.d.ts +4 -3
- package/lib/cjs/iconButton/index.d.ts +1 -1
- package/lib/cjs/inputNumber/index.d.ts +1 -1
- package/lib/cjs/layout/Sider.d.ts +4 -1
- package/lib/cjs/layout/index.d.ts +2 -0
- package/lib/cjs/list/index.d.ts +1 -0
- package/lib/cjs/list/item.d.ts +5 -1
- package/lib/cjs/list/item.js +5 -1
- package/lib/cjs/modal/Modal.d.ts +1 -0
- package/lib/cjs/modal/Modal.js +3 -0
- package/lib/cjs/modal/ModalContent.d.ts +7 -2
- package/lib/cjs/modal/confirm.d.ts +10 -5
- package/lib/cjs/modal/useModal/index.d.ts +1 -0
- package/lib/cjs/navigation/Footer.d.ts +3 -5
- package/lib/cjs/navigation/Header.d.ts +4 -6
- package/lib/cjs/navigation/Item.d.ts +4 -6
- package/lib/cjs/navigation/OpenIconTransition.d.ts +2 -1
- package/lib/cjs/navigation/SubNav.d.ts +3 -5
- package/lib/cjs/navigation/SubNav.js +2 -2
- package/lib/cjs/navigation/SubNavTransition.d.ts +1 -1
- package/lib/cjs/navigation/index.d.ts +2 -2
- package/lib/cjs/navigation/nav-context.d.ts +21 -5
- package/lib/cjs/notification/NoticeTransition.d.ts +2 -2
- package/lib/cjs/notification/index.d.ts +3 -1
- package/lib/cjs/notification/notice.d.ts +3 -1
- package/lib/cjs/notification/useNotification/index.d.ts +1 -0
- package/lib/cjs/overflowList/intersectionObserver.d.ts +3 -2
- package/lib/cjs/pagination/index.d.ts +3 -1
- package/lib/cjs/pagination/index.js +15 -11
- package/lib/cjs/popconfirm/index.d.ts +4 -2
- package/lib/cjs/popover/index.d.ts +4 -2
- package/lib/cjs/progress/index.d.ts +1 -1
- package/lib/cjs/radio/radio.d.ts +1 -0
- package/lib/cjs/radio/radioGroup.d.ts +1 -0
- package/lib/cjs/scrollList/scrollItem.js +5 -1
- package/lib/cjs/select/index.d.ts +3 -1
- package/lib/cjs/select/optionGroup.d.ts +1 -1
- package/lib/cjs/sideSheet/SideSheetContent.d.ts +1 -0
- package/lib/cjs/sideSheet/SideSheetTransition.d.ts +1 -1
- package/lib/cjs/sideSheet/index.d.ts +3 -1
- package/lib/cjs/table/Body/BaseRow.d.ts +1 -1
- package/lib/cjs/table/Body/ExpandedRow.d.ts +4 -2
- package/lib/cjs/table/Body/SectionRow.d.ts +3 -1
- package/lib/cjs/table/Column.d.ts +1 -1
- package/lib/cjs/table/ColumnShape.d.ts +1 -1
- package/lib/cjs/table/CustomExpandIcon.d.ts +1 -1
- package/lib/cjs/table/Table.d.ts +10 -8
- package/lib/cjs/table/TableCell.d.ts +5 -3
- package/lib/cjs/table/TableHeaderRow.d.ts +3 -1
- package/lib/cjs/table/index.d.ts +4 -4
- package/lib/cjs/table/table-context.d.ts +7 -6
- package/lib/cjs/tabs/TabPane.d.ts +3 -1
- package/lib/cjs/tabs/TabPane.js +4 -0
- package/lib/cjs/tabs/index.js +2 -0
- package/lib/cjs/tabs/interface.d.ts +2 -1
- package/lib/cjs/tag/group.d.ts +1 -1
- package/lib/cjs/timePicker/Combobox.d.ts +1 -0
- package/lib/cjs/timeline/index.d.ts +2 -1
- package/lib/cjs/timeline/item.d.ts +1 -0
- package/lib/cjs/toast/ToastTransition.d.ts +1 -1
- package/lib/cjs/toast/index.d.ts +8 -16
- package/lib/cjs/toast/toast.d.ts +4 -2
- package/lib/cjs/toast/useToast/index.d.ts +1 -0
- package/lib/cjs/tooltip/index.d.ts +4 -2
- package/lib/cjs/tooltip/index.js +1 -1
- package/lib/cjs/transfer/index.d.ts +4 -3
- package/lib/cjs/transfer/index.js +5 -2
- package/lib/cjs/tree/index.d.ts +13 -11
- package/lib/cjs/tree/nodeList.d.ts +1 -1
- package/lib/cjs/tree/treeContext.d.ts +10 -10
- package/lib/cjs/tree/treeNode.d.ts +11 -9
- package/lib/cjs/tree/treeNode.js +2 -0
- package/lib/cjs/treeSelect/index.d.ts +7 -5
- package/lib/cjs/typography/copyable.d.ts +1 -1
- package/lib/cjs/upload/index.d.ts +2 -2
- package/lib/es/_base/baseComponent.d.ts +2 -1
- package/lib/es/_portal/index.d.ts +3 -1
- package/lib/es/anchor/index.d.ts +2 -1
- package/lib/es/anchor/link.d.ts +3 -2
- package/lib/es/autoComplete/index.d.ts +2 -2
- package/lib/es/avatar/avatarGroup.d.ts +1 -1
- package/lib/es/avatar/interface.d.ts +2 -2
- package/lib/es/backtop/index.d.ts +1 -0
- package/lib/es/badge/index.d.ts +4 -2
- package/lib/es/banner/index.d.ts +2 -1
- package/lib/es/breadcrumb/bread-context.d.ts +2 -2
- package/lib/es/breadcrumb/index.d.ts +2 -2
- package/lib/es/breadcrumb/item.d.ts +15 -3
- package/lib/es/button/Button.d.ts +2 -1
- package/lib/es/button/buttonGroup.d.ts +1 -0
- package/lib/es/button/index.d.ts +1 -1
- package/lib/es/calendar/timeCol.d.ts +1 -1
- package/lib/es/card/cardGroup.d.ts +1 -0
- package/lib/es/card/index.d.ts +2 -1
- package/lib/es/cascader/index.d.ts +5 -3
- package/lib/es/cascader/index.js +1 -1
- package/lib/es/cascader/item.d.ts +3 -1
- package/lib/es/checkbox/checkbox.d.ts +5 -11
- package/lib/es/checkbox/checkbox.js +1 -1
- package/lib/es/checkbox/checkboxGroup.d.ts +1 -1
- package/lib/es/checkbox/checkboxInner.d.ts +1 -10
- package/lib/es/checkbox/context.d.ts +3 -3
- package/lib/es/collapse/index.d.ts +1 -0
- package/lib/es/collapse/item.d.ts +2 -0
- package/lib/es/collapse/item.js +4 -2
- package/lib/es/collapsible/index.d.ts +1 -1
- package/lib/es/configProvider/index.d.ts +1 -1
- package/lib/es/datePicker/datePicker.d.ts +3 -1
- package/lib/es/datePicker/insetInput.d.ts +1 -0
- package/lib/es/descriptions/index.d.ts +4 -3
- package/lib/es/descriptions/item.d.ts +4 -1
- package/lib/es/dropdown/context.d.ts +5 -3
- package/lib/es/dropdown/dropdownItem.d.ts +3 -3
- package/lib/es/dropdown/dropdownMenu.d.ts +1 -0
- package/lib/es/dropdown/dropdownTitle.d.ts +3 -3
- package/lib/es/dropdown/index.d.ts +3 -3
- package/lib/es/empty/index.d.ts +1 -1
- package/lib/es/form/arrayField.d.ts +1 -0
- package/lib/es/form/baseForm.d.ts +2 -2
- package/lib/es/form/baseForm.js +1 -1
- package/lib/es/form/errorMessage.d.ts +1 -1
- package/lib/es/form/group.d.ts +3 -1
- package/lib/es/form/hoc/withField.js +6 -4
- package/lib/es/form/label.d.ts +1 -0
- package/lib/es/form/section.d.ts +1 -1
- package/lib/es/form/slot.js +2 -0
- package/lib/es/grid/col.d.ts +3 -3
- package/lib/es/grid/row.d.ts +4 -3
- package/lib/es/iconButton/index.d.ts +1 -1
- package/lib/es/inputNumber/index.d.ts +1 -1
- package/lib/es/layout/Sider.d.ts +4 -1
- package/lib/es/layout/index.d.ts +2 -0
- package/lib/es/list/index.d.ts +1 -0
- package/lib/es/list/item.d.ts +5 -1
- package/lib/es/list/item.js +5 -1
- package/lib/es/modal/Modal.d.ts +1 -0
- package/lib/es/modal/Modal.js +3 -0
- package/lib/es/modal/ModalContent.d.ts +7 -2
- package/lib/es/modal/confirm.d.ts +10 -5
- package/lib/es/modal/useModal/index.d.ts +1 -0
- package/lib/es/navigation/Footer.d.ts +3 -5
- package/lib/es/navigation/Header.d.ts +4 -6
- package/lib/es/navigation/Item.d.ts +4 -6
- package/lib/es/navigation/OpenIconTransition.d.ts +2 -1
- package/lib/es/navigation/SubNav.d.ts +3 -5
- package/lib/es/navigation/SubNav.js +2 -2
- package/lib/es/navigation/SubNavTransition.d.ts +1 -1
- package/lib/es/navigation/index.d.ts +2 -2
- package/lib/es/navigation/nav-context.d.ts +21 -5
- package/lib/es/notification/NoticeTransition.d.ts +2 -2
- package/lib/es/notification/index.d.ts +3 -1
- package/lib/es/notification/notice.d.ts +3 -1
- package/lib/es/notification/useNotification/index.d.ts +1 -0
- package/lib/es/overflowList/intersectionObserver.d.ts +3 -2
- package/lib/es/pagination/index.d.ts +3 -1
- package/lib/es/pagination/index.js +15 -11
- package/lib/es/popconfirm/index.d.ts +4 -2
- package/lib/es/popover/index.d.ts +4 -2
- package/lib/es/progress/index.d.ts +1 -1
- package/lib/es/radio/radio.d.ts +1 -0
- package/lib/es/radio/radioGroup.d.ts +1 -0
- package/lib/es/scrollList/scrollItem.js +5 -1
- package/lib/es/select/index.d.ts +3 -1
- package/lib/es/select/optionGroup.d.ts +1 -1
- package/lib/es/sideSheet/SideSheetContent.d.ts +1 -0
- package/lib/es/sideSheet/SideSheetTransition.d.ts +1 -1
- package/lib/es/sideSheet/index.d.ts +3 -1
- package/lib/es/table/Body/BaseRow.d.ts +1 -1
- package/lib/es/table/Body/ExpandedRow.d.ts +4 -2
- package/lib/es/table/Body/SectionRow.d.ts +3 -1
- package/lib/es/table/Column.d.ts +1 -1
- package/lib/es/table/ColumnShape.d.ts +1 -1
- package/lib/es/table/CustomExpandIcon.d.ts +1 -1
- package/lib/es/table/Table.d.ts +10 -8
- package/lib/es/table/TableCell.d.ts +5 -3
- package/lib/es/table/TableHeaderRow.d.ts +3 -1
- package/lib/es/table/index.d.ts +4 -4
- package/lib/es/table/table-context.d.ts +7 -6
- package/lib/es/tabs/TabPane.d.ts +3 -1
- package/lib/es/tabs/TabPane.js +4 -0
- package/lib/es/tabs/index.js +2 -0
- package/lib/es/tabs/interface.d.ts +2 -1
- package/lib/es/tag/group.d.ts +1 -1
- package/lib/es/timePicker/Combobox.d.ts +1 -0
- package/lib/es/timeline/index.d.ts +2 -1
- package/lib/es/timeline/item.d.ts +1 -0
- package/lib/es/toast/ToastTransition.d.ts +1 -1
- package/lib/es/toast/index.d.ts +8 -16
- package/lib/es/toast/toast.d.ts +4 -2
- package/lib/es/toast/useToast/index.d.ts +1 -0
- package/lib/es/tooltip/index.d.ts +4 -2
- package/lib/es/tooltip/index.js +1 -1
- package/lib/es/transfer/index.d.ts +4 -3
- package/lib/es/transfer/index.js +6 -2
- package/lib/es/tree/index.d.ts +13 -11
- package/lib/es/tree/nodeList.d.ts +1 -1
- package/lib/es/tree/treeContext.d.ts +10 -10
- package/lib/es/tree/treeNode.d.ts +11 -9
- package/lib/es/tree/treeNode.js +2 -0
- package/lib/es/treeSelect/index.d.ts +7 -5
- package/lib/es/typography/copyable.d.ts +1 -1
- package/lib/es/upload/index.d.ts +2 -2
- package/list/index.tsx +1 -0
- package/list/item.tsx +6 -1
- package/modal/Modal.tsx +3 -0
- package/modal/ModalContent.tsx +9 -3
- package/modal/confirm.tsx +1 -1
- package/navigation/Footer.tsx +3 -1
- package/navigation/Header.tsx +3 -1
- package/navigation/Item.tsx +4 -3
- package/navigation/OpenIconTransition.tsx +2 -1
- package/navigation/SubNav.tsx +4 -3
- package/navigation/SubNavTransition.tsx +1 -1
- package/navigation/nav-context.ts +22 -1
- package/notification/NoticeTransition.tsx +1 -1
- package/notification/index.tsx +3 -1
- package/notification/notice.tsx +3 -1
- package/overflowList/_story/overflowList.stories.js +44 -0
- package/overflowList/intersectionObserver.tsx +2 -1
- package/package.json +9 -9
- package/pagination/index.tsx +4 -1
- package/popconfirm/index.tsx +3 -1
- package/popover/index.tsx +3 -1
- package/radio/radio.tsx +1 -0
- package/radio/radioGroup.tsx +1 -0
- package/scrollList/_story/SingleWheelList/index.js +72 -0
- package/scrollList/_story/scrolllist.stories.js +7 -0
- package/scrollList/scrollItem.tsx +4 -1
- package/select/index.tsx +2 -1
- package/select/utils.tsx +1 -1
- package/sideSheet/SideSheetContent.tsx +1 -0
- package/sideSheet/SideSheetTransition.tsx +1 -1
- package/sideSheet/index.tsx +3 -2
- package/table/Body/ExpandedRow.tsx +3 -1
- package/table/Body/SectionRow.tsx +3 -1
- package/table/Body/index.tsx +3 -2
- package/table/Table.tsx +4 -3
- package/table/TableCell.tsx +6 -4
- package/table/TableHeaderRow.tsx +3 -1
- package/table/__test__/table.test.js +1 -0
- package/table/table-context.ts +10 -6
- package/tabs/TabPane.tsx +4 -0
- package/tabs/_story/tabs.stories.js +72 -0
- package/tabs/index.tsx +3 -2
- package/tabs/interface.ts +2 -1
- package/tag/group.tsx +5 -5
- package/tagInput/_story/tagInput.stories.js +14 -1
- package/timePicker/TimePicker.tsx +2 -2
- package/timePicker/_story/timepicker.stories.js +20 -1
- package/timeline/index.tsx +1 -0
- package/timeline/item.tsx +1 -0
- package/toast/ToastTransition.tsx +1 -1
- package/toast/toast.tsx +3 -1
- package/tooltip/_story/tooltip.stories.js +127 -15
- package/tooltip/index.tsx +3 -2
- package/transfer/index.tsx +7 -2
- package/tree/index.tsx +12 -11
- package/tree/treeContext.tsx +10 -10
- package/tree/treeNode.tsx +10 -7
- package/treeSelect/index.tsx +5 -4
- package/typography/__test__/typography.test.js +1 -0
- package/upload/__test__/upload.test.js +2 -0
- package/upload/_story/upload.stories.js +2 -2
- package/upload/index.tsx +1 -1
package/_base/baseComponent.tsx
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* The Semi Foundation / Adapter architecture split was inspired by Material Component For Web. (https://github.com/material-components/material-components-web)
|
|
3
3
|
* We re-implemented our own code based on the principle and added more functions we need according to actual needs.
|
|
4
4
|
*/
|
|
5
|
-
import React, { Component } from 'react';
|
|
5
|
+
import React, { Component, ReactNode } from 'react';
|
|
6
6
|
import log from '@douyinfe/semi-foundation/utils/log';
|
|
7
7
|
import { DefaultAdapter } from '@douyinfe/semi-foundation/base/foundation';
|
|
8
8
|
import { VALIDATE_STATUS } from '@douyinfe/semi-foundation/base/constants';
|
|
@@ -15,6 +15,7 @@ export type ValidateStatus = ArrayElement<typeof VALIDATE_STATUS>;
|
|
|
15
15
|
export interface BaseProps {
|
|
16
16
|
style?: React.CSSProperties;
|
|
17
17
|
className?: string;
|
|
18
|
+
children?: ReactNode | undefined | any;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
// eslint-disable-next-line
|
package/_portal/index.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { createPortal } from 'react-dom';
|
|
|
3
3
|
import { BASE_CLASS_PREFIX } from '@douyinfe/semi-foundation/base/constants';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import classnames from 'classnames';
|
|
6
|
-
import ConfigContext from '../configProvider/context';
|
|
6
|
+
import ConfigContext, { ContextValue } from '../configProvider/context';
|
|
7
7
|
import '@douyinfe/semi-foundation/_portal/portal.scss';
|
|
8
8
|
|
|
9
9
|
export interface PortalProps {
|
|
@@ -37,6 +37,7 @@ class Portal extends PureComponent<PortalProps, PortalState> {
|
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
el: HTMLElement;
|
|
40
|
+
context: ContextValue;
|
|
40
41
|
constructor(props: PortalProps) {
|
|
41
42
|
super(props);
|
|
42
43
|
try {
|
|
@@ -23,6 +23,7 @@ describe('Anchor', () => {
|
|
|
23
23
|
it('anchor small size', () => {
|
|
24
24
|
const smallAnchor = mount(<Anchor size="small" />);
|
|
25
25
|
expect(smallAnchor.find(`.${BASE_CLASS_PREFIX}-anchor-size-small`)).toHaveLength(1);
|
|
26
|
+
smallAnchor.unmount();
|
|
26
27
|
});
|
|
27
28
|
|
|
28
29
|
it('anchor rail theme', () => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import Button from '../../button';
|
|
2
3
|
import { Anchor } from '../../index';
|
|
3
4
|
|
|
4
5
|
export default {
|
|
@@ -264,3 +265,24 @@ export const FixContainerScrollBug1158 = () => (
|
|
|
264
265
|
</div>
|
|
265
266
|
</div>
|
|
266
267
|
);
|
|
268
|
+
|
|
269
|
+
export const AutoCollapse = () => {
|
|
270
|
+
const [href, setHref] = useState('#设计语言');
|
|
271
|
+
return (
|
|
272
|
+
<div>
|
|
273
|
+
<Anchor autoCollapse>
|
|
274
|
+
<Anchor.Link href="#动态展示" title="1. 动态展示">
|
|
275
|
+
<Anchor.Link href="#组件" title="1.1 组件">
|
|
276
|
+
<Anchor.Link href="#头像" title="1.1.1 Avatar" />
|
|
277
|
+
<Anchor.Link href="#按钮" title="1.1.2 Button" />
|
|
278
|
+
<Anchor.Link href="#图标" title="1.1.3 Icon" />
|
|
279
|
+
</Anchor.Link>
|
|
280
|
+
<Anchor.Link href="#物料" title="1.2 物料" />
|
|
281
|
+
<Anchor.Link href="#主题商店" title="1.3 主题商店" />
|
|
282
|
+
</Anchor.Link>
|
|
283
|
+
<Anchor.Link href={href} title="2. 设计语言" />
|
|
284
|
+
</Anchor>
|
|
285
|
+
<Button onClick={()=>{console.log('sdf');setHref('#我改变啦')}}>setHref</Button>
|
|
286
|
+
</div>
|
|
287
|
+
)
|
|
288
|
+
};
|
package/anchor/index.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
import cls from 'classnames';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { cssClasses, strings } from '@douyinfe/semi-foundation/anchor/constants';
|
|
@@ -17,6 +17,7 @@ export { LinkProps } from './link';
|
|
|
17
17
|
export interface AnchorProps {
|
|
18
18
|
autoCollapse?: boolean;
|
|
19
19
|
className?: string;
|
|
20
|
+
children?: ReactNode | undefined;
|
|
20
21
|
defaultAnchor?: string;
|
|
21
22
|
getContainer?: () => HTMLElement | Window;
|
|
22
23
|
maxHeight?: string | number;
|
package/anchor/link.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
import cls from 'classnames';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import BaseComponent from '../_base/baseComponent';
|
|
@@ -13,6 +13,7 @@ export interface LinkProps {
|
|
|
13
13
|
href?: string;
|
|
14
14
|
title?: string | React.ReactNode;
|
|
15
15
|
className?: string;
|
|
16
|
+
children?: ReactNode | undefined;
|
|
16
17
|
style?: React.CSSProperties;
|
|
17
18
|
disabled?: boolean;
|
|
18
19
|
}
|
package/autoComplete/index.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/ban-types, max-len */
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { ReactNode } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import cls from 'classnames';
|
|
5
5
|
import { isEqual, noop } from 'lodash';
|
|
@@ -48,7 +48,7 @@ export interface AutoCompleteProps<T extends AutoCompleteItems> {
|
|
|
48
48
|
autoAdjustOverflow?: boolean;
|
|
49
49
|
autoFocus?: boolean;
|
|
50
50
|
className?: string;
|
|
51
|
-
children?:
|
|
51
|
+
children?: ReactNode | undefined;
|
|
52
52
|
data?: T[];
|
|
53
53
|
disabled?: boolean;
|
|
54
54
|
defaultOpen?: boolean;
|
package/avatar/interface.ts
CHANGED
|
@@ -22,7 +22,7 @@ export type AvatarColor =
|
|
|
22
22
|
| 'yellow';
|
|
23
23
|
|
|
24
24
|
export interface AvatarProps extends BaseProps {
|
|
25
|
-
children?: React.ReactNode;
|
|
25
|
+
children?: React.ReactNode | undefined;
|
|
26
26
|
color?: AvatarColor;
|
|
27
27
|
shape?: AvatarShape;
|
|
28
28
|
size?: AvatarSize;
|
|
@@ -42,7 +42,7 @@ export type AvatarGroupSize = 'extra-extra-small' | 'extra-small' | 'small' | 'm
|
|
|
42
42
|
export type AvatarGroupOverlapFrom = 'start' | 'end';
|
|
43
43
|
|
|
44
44
|
export interface AvatarGroupProps {
|
|
45
|
-
children?: React.ReactNode;
|
|
45
|
+
children?: React.ReactNode | undefined;
|
|
46
46
|
shape?: AvatarGroupShape;
|
|
47
47
|
size?: AvatarGroupSize;
|
|
48
48
|
overlapFrom?: AvatarGroupOverlapFrom;
|
package/backtop/index.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import Badge from '
|
|
2
|
+
import { Avatar, Badge } from '../../index';
|
|
3
|
+
import { IconLock } from '@douyinfe/semi-icons';
|
|
3
4
|
|
|
4
5
|
export default {
|
|
5
6
|
title: 'Badge',
|
|
@@ -88,4 +89,35 @@ export const Theme = () => (
|
|
|
88
89
|
<a style={style}></a>
|
|
89
90
|
</Badge>
|
|
90
91
|
</div>
|
|
91
|
-
);
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
export const AvatarBadge = () => {
|
|
95
|
+
const style = {
|
|
96
|
+
width: '42px',
|
|
97
|
+
height: '42px',
|
|
98
|
+
borderRadius: '4px',
|
|
99
|
+
};
|
|
100
|
+
return (
|
|
101
|
+
<div>
|
|
102
|
+
<Badge count={5}>
|
|
103
|
+
<Avatar color='blue' shape='square' style={style}>BM</Avatar>
|
|
104
|
+
</Badge>
|
|
105
|
+
<br/>
|
|
106
|
+
<br/>
|
|
107
|
+
<Badge dot>
|
|
108
|
+
<Avatar color='blue' shape='square' style={style}>YL</Avatar>
|
|
109
|
+
</Badge>
|
|
110
|
+
<br/>
|
|
111
|
+
<br/>
|
|
112
|
+
<Badge count={<IconLock style={{color:'var(--semi-color-primary)'}}/>}>
|
|
113
|
+
<Avatar color='light-blue' shape='square' style={style}>XZ</Avatar>
|
|
114
|
+
</Badge>
|
|
115
|
+
<br/>
|
|
116
|
+
<br/>
|
|
117
|
+
<Badge count='NEW' >
|
|
118
|
+
<Avatar color='light-blue' shape='square' style={style}>WF</Avatar>
|
|
119
|
+
</Badge>
|
|
120
|
+
</div>
|
|
121
|
+
);
|
|
122
|
+
};
|
|
123
|
+
AvatarBadge.storyName = '头像 badge';
|
package/badge/index.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import React, { PureComponent } from 'react';
|
|
|
2
2
|
import cls from 'classnames';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { isNumber, isString, noop } from 'lodash';
|
|
5
|
-
import ConfigContext from '../configProvider/context';
|
|
5
|
+
import ConfigContext, { ContextValue } from '../configProvider/context';
|
|
6
6
|
import { cssClasses, strings } from '@douyinfe/semi-foundation/badge/constants';
|
|
7
7
|
import '@douyinfe/semi-foundation/badge/badge.scss';
|
|
8
8
|
|
|
@@ -21,10 +21,10 @@ export interface BadgeProps {
|
|
|
21
21
|
overflowCount?: number;
|
|
22
22
|
style?: React.CSSProperties;
|
|
23
23
|
className?: string;
|
|
24
|
-
children?: React.ReactNode;
|
|
25
24
|
onMouseEnter?: (e: React.MouseEvent) => any;
|
|
26
25
|
onMouseLeave?: (e: React.MouseEvent) => any;
|
|
27
26
|
onClick?: (e: React.MouseEvent) => any;
|
|
27
|
+
children?: React.ReactNode | undefined;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export default class Badge extends PureComponent<BadgeProps> {
|
|
@@ -54,6 +54,8 @@ export default class Badge extends PureComponent<BadgeProps> {
|
|
|
54
54
|
onMouseLeave: () => noop,
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
+
context: ContextValue;
|
|
58
|
+
|
|
57
59
|
render() {
|
|
58
60
|
const { direction } = this.context;
|
|
59
61
|
// DefaultPosition here, static can't get this
|
package/banner/index.tsx
CHANGED
|
@@ -20,6 +20,7 @@ export type Type = 'info' | 'danger' | 'warning' | 'success';
|
|
|
20
20
|
export interface BannerProps {
|
|
21
21
|
type?: Type;
|
|
22
22
|
className?: string;
|
|
23
|
+
children?: React.ReactNode | undefined;
|
|
23
24
|
fullMode?: boolean;
|
|
24
25
|
title?: React.ReactNode;
|
|
25
26
|
description?: React.ReactNode;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { showToolTipProps } from './index';
|
|
3
3
|
import { BreadcrumbItemInfo } from './item';
|
|
4
|
-
export interface
|
|
4
|
+
export interface BreadContextType {
|
|
5
5
|
onClick?: (info: BreadcrumbItemInfo, event: React.MouseEvent) => void;
|
|
6
6
|
showTooltip?: boolean | showToolTipProps;
|
|
7
7
|
compact?: boolean;
|
|
8
8
|
separator?: string | React.ReactNode;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
const BreadContext = React.createContext<
|
|
11
|
+
const BreadContext = React.createContext<BreadContextType>({});
|
|
12
12
|
|
|
13
13
|
export default BreadContext;
|
package/breadcrumb/index.tsx
CHANGED
|
@@ -11,7 +11,7 @@ import { noop } from '@douyinfe/semi-foundation/utils/function';
|
|
|
11
11
|
import BaseComponent, { BaseProps } from '../_base/baseComponent';
|
|
12
12
|
import Popover from '../popover';
|
|
13
13
|
import BreadcrumbItem, { RouteProps, BreadcrumbItemInfo } from './item';
|
|
14
|
-
import BreadContext, {
|
|
14
|
+
import BreadContext, { BreadContextType } from './bread-context';
|
|
15
15
|
import { TooltipProps } from '../tooltip';
|
|
16
16
|
import { IconMore } from '@douyinfe/semi-icons';
|
|
17
17
|
|
|
@@ -49,7 +49,7 @@ interface BreadcrumbState {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
class Breadcrumb extends BaseComponent<BreadcrumbProps, BreadcrumbState> {
|
|
52
|
-
static contextType: React.Context<
|
|
52
|
+
static contextType: React.Context<BreadContextType> = BreadContext;
|
|
53
53
|
|
|
54
54
|
static Item: typeof BreadcrumbItem = BreadcrumbItem;
|
|
55
55
|
|
package/breadcrumb/item.tsx
CHANGED
|
@@ -5,8 +5,8 @@ import { cssClasses } from '@douyinfe/semi-foundation/breadcrumb/constants';
|
|
|
5
5
|
import BreadcrumbItemFoundation, { BreadcrumbItemAdapter, BreadcrumbItemInfo, Route } from '@douyinfe/semi-foundation/breadcrumb/itemFoundation';
|
|
6
6
|
import BaseComponent, { BaseProps } from '../_base/baseComponent';
|
|
7
7
|
import { noop } from '@douyinfe/semi-foundation/utils/function';
|
|
8
|
-
import BreadContext from './bread-context';
|
|
9
|
-
import Typography from '../typography';
|
|
8
|
+
import BreadContext, { BreadContextType } from './bread-context';
|
|
9
|
+
import Typography, { EllipsisPos, ShowTooltip as ShowTooltipType } from '../typography';
|
|
10
10
|
import { merge, isUndefined, isNull } from 'lodash';
|
|
11
11
|
|
|
12
12
|
const clsPrefix = cssClasses.PREFIX;
|
|
@@ -29,6 +29,12 @@ export interface BreadcrumbItemProps extends BaseProps {
|
|
|
29
29
|
|
|
30
30
|
type BreadcrumbItemState = Record<string, never>;
|
|
31
31
|
|
|
32
|
+
interface GetTooltipOptType {
|
|
33
|
+
width: number;
|
|
34
|
+
ellipsisPos: EllipsisPos;
|
|
35
|
+
opts?: ShowTooltipType['opts'];
|
|
36
|
+
}
|
|
37
|
+
|
|
32
38
|
export default class BreadcrumbItem extends BaseComponent<BreadcrumbItemProps, BreadcrumbItemState> {
|
|
33
39
|
static isBreadcrumbItem = true;
|
|
34
40
|
static contextType = BreadContext;
|
|
@@ -50,6 +56,8 @@ export default class BreadcrumbItem extends BaseComponent<BreadcrumbItemProps, B
|
|
|
50
56
|
shouldRenderSeparator: true
|
|
51
57
|
};
|
|
52
58
|
|
|
59
|
+
context: BreadContextType;
|
|
60
|
+
|
|
53
61
|
get adapter(): BreadcrumbItemAdapter<BreadcrumbItemProps, BreadcrumbItemState> {
|
|
54
62
|
return {
|
|
55
63
|
...super.adapter,
|
|
@@ -129,7 +137,7 @@ export default class BreadcrumbItem extends BaseComponent<BreadcrumbItemProps, B
|
|
|
129
137
|
const showTooltip = this.getTooltipOpt();
|
|
130
138
|
const icon = this.renderIcon();
|
|
131
139
|
if (Boolean(children) && typeof children === 'string') {
|
|
132
|
-
const { opts, ellipsisPos, width } = showTooltip;
|
|
140
|
+
const { opts, ellipsisPos, width } = showTooltip as GetTooltipOptType;
|
|
133
141
|
return (
|
|
134
142
|
<Fragment>
|
|
135
143
|
{icon}
|
package/button/Button.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable react/destructuring-assignment */
|
|
2
|
-
import React, { PureComponent } from 'react';
|
|
2
|
+
import React, { PureComponent, ReactNode } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { cssClasses, strings } from '@douyinfe/semi-foundation/button/constants';
|
|
@@ -18,6 +18,7 @@ export interface ButtonProps {
|
|
|
18
18
|
id?: string;
|
|
19
19
|
block?: boolean;
|
|
20
20
|
circle?: boolean;
|
|
21
|
+
children?: ReactNode | undefined;
|
|
21
22
|
disabled?: boolean;
|
|
22
23
|
className?: string;
|
|
23
24
|
icon?: React.ReactNode;
|
package/button/buttonGroup.tsx
CHANGED
|
@@ -15,6 +15,7 @@ export interface ButtonGroupProps extends BaseProps {
|
|
|
15
15
|
size?: Size;
|
|
16
16
|
theme?: Theme;
|
|
17
17
|
className?: string;
|
|
18
|
+
children?: React.ReactChild;
|
|
18
19
|
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
19
20
|
}
|
|
20
21
|
|
|
@@ -43,7 +44,7 @@ export default class ButtonGroup extends BaseComponent<ButtonGroupProps> {
|
|
|
43
44
|
const cls = classNames(`${prefixCls}-group`, className);
|
|
44
45
|
|
|
45
46
|
if (children) {
|
|
46
|
-
inner = ((Array.isArray(children) ? children : [children])).map((itm, index) => (
|
|
47
|
+
inner = ((Array.isArray(children) ? children : [children])).map((itm: React.ReactChild, index) => (
|
|
47
48
|
isValidElement(itm)
|
|
48
49
|
? cloneElement(itm, { disabled, size, type, ...itm.props, ...rest, key: index })
|
|
49
50
|
: itm
|
package/calendar/_story/Demo.tsx
CHANGED
package/card/cardGroup.tsx
CHANGED
|
@@ -11,6 +11,7 @@ export type CardGroupType = 'grid';
|
|
|
11
11
|
export interface CardGroupProps {
|
|
12
12
|
/** Card group style class name */
|
|
13
13
|
className?: string;
|
|
14
|
+
children?: React.ReactNode | undefined;
|
|
14
15
|
/** Card Spacing */
|
|
15
16
|
spacing?: number | number[];
|
|
16
17
|
/** Card group inline style */
|
package/card/index.tsx
CHANGED
|
@@ -697,7 +697,8 @@ export const ShowClear = () => {
|
|
|
697
697
|
<Cascader
|
|
698
698
|
style={{ marginLeft: 700, width: 300 }}
|
|
699
699
|
treeData={treeData1}
|
|
700
|
-
placeholder="Please select"
|
|
700
|
+
placeholder="Please select when multiple"
|
|
701
|
+
multiple
|
|
701
702
|
showClear
|
|
702
703
|
/>
|
|
703
704
|
<br />
|
|
@@ -1434,4 +1435,18 @@ export const DynamicTreeData = () => {
|
|
|
1434
1435
|
<br />
|
|
1435
1436
|
</div>
|
|
1436
1437
|
);
|
|
1437
|
-
}
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
|
|
1441
|
+
export const SuperLongList = () => {
|
|
1442
|
+
let treeData = new Array(100).fill().map(() => ({ label: '浙江省', value: 'zhejiang' }));
|
|
1443
|
+
treeData.push({ label: '到底啦', value: 'bottom' })
|
|
1444
|
+
return (
|
|
1445
|
+
<Cascader
|
|
1446
|
+
style={{ width: 300 }}
|
|
1447
|
+
treeData={treeData}
|
|
1448
|
+
placeholder="请选择所在地区"
|
|
1449
|
+
onListScroll={()=>{console.log(123)}}
|
|
1450
|
+
/>
|
|
1451
|
+
);
|
|
1452
|
+
};
|
package/cascader/index.tsx
CHANGED
|
@@ -19,7 +19,7 @@ import '@douyinfe/semi-foundation/cascader/cascader.scss';
|
|
|
19
19
|
import { IconClear, IconChevronDown } from '@douyinfe/semi-icons';
|
|
20
20
|
import { findKeysForValues, convertDataToEntities, calcMergeType } from '@douyinfe/semi-foundation/cascader/util';
|
|
21
21
|
import { calcCheckedKeys, normalizeKeyList, calcDisabledKeys } from '@douyinfe/semi-foundation/tree/treeUtil';
|
|
22
|
-
import ConfigContext from '../configProvider/context';
|
|
22
|
+
import ConfigContext, { ContextValue } from '../configProvider/context';
|
|
23
23
|
import BaseComponent, { ValidateStatus } from '../_base/baseComponent';
|
|
24
24
|
import Input from '../input/index';
|
|
25
25
|
import Popover, { PopoverProps } from '../popover/index';
|
|
@@ -62,7 +62,7 @@ export interface CascaderProps extends BasicCascaderProps {
|
|
|
62
62
|
motion?: Motion;
|
|
63
63
|
treeData?: Array<CascaderData>;
|
|
64
64
|
restTagsPopoverProps?: PopoverProps;
|
|
65
|
-
children?: ReactNode;
|
|
65
|
+
children?: React.ReactNode | undefined;
|
|
66
66
|
value?: Value;
|
|
67
67
|
prefix?: ReactNode;
|
|
68
68
|
suffix?: ReactNode;
|
|
@@ -209,6 +209,7 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
209
209
|
optionsRef: React.RefObject<any>;
|
|
210
210
|
clickOutsideHandler: any;
|
|
211
211
|
mergeType: string;
|
|
212
|
+
context: ContextValue;
|
|
212
213
|
|
|
213
214
|
constructor(props: CascaderProps) {
|
|
214
215
|
super(props);
|
|
@@ -827,7 +828,7 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
827
828
|
*/
|
|
828
829
|
handleClearEnterPress = (e: KeyboardEvent) => {
|
|
829
830
|
e && e.stopPropagation();
|
|
830
|
-
this.foundation.handleClearEnterPress();
|
|
831
|
+
this.foundation.handleClearEnterPress(e);
|
|
831
832
|
};
|
|
832
833
|
|
|
833
834
|
showClearBtn = () => {
|
package/cascader/item.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
|
|
|
4
4
|
import { cssClasses, strings } from '@douyinfe/semi-foundation/cascader/constants';
|
|
5
5
|
import isEnterPress from '@douyinfe/semi-foundation/utils/isEnterPress';
|
|
6
6
|
import { includes } from 'lodash';
|
|
7
|
-
import ConfigContext from '../configProvider/context';
|
|
7
|
+
import ConfigContext, { ContextValue } from '../configProvider/context';
|
|
8
8
|
import LocaleConsumer from '../locale/localeConsumer';
|
|
9
9
|
import { IconChevronRight, IconTick } from '@douyinfe/semi-icons';
|
|
10
10
|
import { Locale } from '../locale/interface';
|
|
@@ -85,6 +85,8 @@ export default class Item extends PureComponent<CascaderItemProps> {
|
|
|
85
85
|
empty: false,
|
|
86
86
|
};
|
|
87
87
|
|
|
88
|
+
context: ContextValue;
|
|
89
|
+
|
|
88
90
|
onClick = (e: React.MouseEvent | React.KeyboardEvent, item: Entity | Data) => {
|
|
89
91
|
const { onItemClick } = this.props;
|
|
90
92
|
if (item.data.disabled || ('disabled' in item && item.disabled)) {
|
package/checkbox/checkbox.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import CheckboxFoundation, { CheckboxAdapter, BasicCheckboxEvent, BasicTargetObj
|
|
|
7
7
|
import CheckboxInner from './checkboxInner';
|
|
8
8
|
import BaseComponent from '../_base/baseComponent';
|
|
9
9
|
import '@douyinfe/semi-foundation/checkbox/checkbox.scss';
|
|
10
|
-
import { Context } from './context';
|
|
10
|
+
import { Context, CheckboxContextType } from './context';
|
|
11
11
|
import { isUndefined, isBoolean, noop } from 'lodash';
|
|
12
12
|
import { getUuidShort } from '@douyinfe/semi-foundation/utils/uuid';
|
|
13
13
|
export type CheckboxEvent = BasicCheckboxEvent;
|
|
@@ -19,6 +19,7 @@ export interface CheckboxProps extends BaseCheckboxProps {
|
|
|
19
19
|
'aria-invalid'?: React.AriaAttributes['aria-invalid'];
|
|
20
20
|
'aria-labelledby'?: React.AriaAttributes['aria-labelledby'];
|
|
21
21
|
'aria-required'?: React.AriaAttributes['aria-required'];
|
|
22
|
+
children?: React.ReactNode | undefined;
|
|
22
23
|
onChange?: (e: CheckboxEvent) => any;
|
|
23
24
|
// TODO, docs
|
|
24
25
|
style?: React.CSSProperties;
|
|
@@ -71,6 +72,7 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
71
72
|
onMouseLeave: noop,
|
|
72
73
|
};
|
|
73
74
|
checkboxEntity: CheckboxInner;
|
|
75
|
+
context: CheckboxContextType;
|
|
74
76
|
|
|
75
77
|
get adapter(): CheckboxAdapter<CheckboxProps, CheckboxState> {
|
|
76
78
|
return {
|
|
@@ -120,7 +122,7 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
120
122
|
}
|
|
121
123
|
|
|
122
124
|
isInGroup() {
|
|
123
|
-
return this.context && this.context.checkboxGroup;
|
|
125
|
+
return Boolean(this.context && this.context.checkboxGroup);
|
|
124
126
|
}
|
|
125
127
|
|
|
126
128
|
focus() {
|
|
@@ -24,7 +24,7 @@ export type CheckboxGroupProps = {
|
|
|
24
24
|
options?: any[];
|
|
25
25
|
value?: any[];
|
|
26
26
|
onChange?: (value: any[]) => void;
|
|
27
|
-
children?: React.ReactNode;
|
|
27
|
+
children?: React.ReactNode | undefined;
|
|
28
28
|
prefixCls?: string;
|
|
29
29
|
direction?: CheckboxDirection;
|
|
30
30
|
style?: React.CSSProperties;
|
package/checkbox/context.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BasicCheckboxEvent } from '@douyinfe/semi-foundation/checkbox/checkboxFoundation';
|
|
3
|
-
type
|
|
3
|
+
type CheckboxContextType = {
|
|
4
4
|
checkboxGroup?: {
|
|
5
5
|
onChange: (evt: BasicCheckboxEvent) => void;
|
|
6
6
|
value: any[];
|
|
@@ -10,5 +10,5 @@ type CheckboxContext = {
|
|
|
10
10
|
isPureCardType: boolean;
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
|
-
const Context = React.createContext<
|
|
14
|
-
export { Context };
|
|
13
|
+
const Context = React.createContext<CheckboxContextType>({});
|
|
14
|
+
export { Context, CheckboxContextType };
|
package/collapse/index.tsx
CHANGED
|
@@ -20,6 +20,7 @@ export { CollapsePanelProps } from './item';
|
|
|
20
20
|
export interface CollapseReactProps extends CollapseProps{
|
|
21
21
|
expandIcon?: React.ReactNode;
|
|
22
22
|
collapseIcon?: React.ReactNode;
|
|
23
|
+
children?: React.ReactNode | undefined;
|
|
23
24
|
style?: CSSProperties;
|
|
24
25
|
onChange?: (activeKey: CollapseProps['activeKey'], e: React.MouseEvent) => void;
|
|
25
26
|
}
|
package/collapse/item.tsx
CHANGED
|
@@ -12,6 +12,7 @@ export interface CollapsePanelProps {
|
|
|
12
12
|
extra?: ReactNode;
|
|
13
13
|
header?: ReactNode;
|
|
14
14
|
className?: string;
|
|
15
|
+
children?: React.ReactNode | undefined;
|
|
15
16
|
reCalcKey?: number | string;
|
|
16
17
|
style?: CSSProperties;
|
|
17
18
|
}
|
|
@@ -35,6 +36,8 @@ export default class CollapsePanel extends PureComponent<CollapsePanelProps> {
|
|
|
35
36
|
|
|
36
37
|
private ariaID = getUuidShort({});
|
|
37
38
|
|
|
39
|
+
context: CollapseContextType;
|
|
40
|
+
|
|
38
41
|
renderHeader(active: boolean, expandIconEnable = true) {
|
|
39
42
|
const {
|
|
40
43
|
header,
|
|
@@ -86,6 +89,8 @@ export default class CollapsePanel extends PureComponent<CollapsePanelProps> {
|
|
|
86
89
|
children,
|
|
87
90
|
itemKey,
|
|
88
91
|
reCalcKey,
|
|
92
|
+
header,
|
|
93
|
+
extra,
|
|
89
94
|
...restProps
|
|
90
95
|
} = this.props;
|
|
91
96
|
const {
|
package/collapsible/index.tsx
CHANGED
|
@@ -11,7 +11,7 @@ const ease = 'cubicBezier(.25,.1,.25,1)';
|
|
|
11
11
|
|
|
12
12
|
export interface CollapsibleProps {
|
|
13
13
|
motion?: Motion;
|
|
14
|
-
children?: React.ReactNode;
|
|
14
|
+
children?: React.ReactNode | undefined;
|
|
15
15
|
isOpen?: boolean;
|
|
16
16
|
duration?: number;
|
|
17
17
|
keepDOM?: boolean;
|
|
@@ -72,7 +72,7 @@ const Collapsible = (props: CollapsibleProps) => {
|
|
|
72
72
|
return isOpen || !shouldKeepDOM() && !motion ? 'none' : collapseHeight;
|
|
73
73
|
}, [collapseHeight, motion, isOpen, shouldKeepDOM]);
|
|
74
74
|
|
|
75
|
-
const renderChildren = (transitionStyle: Record<string, any>) => {
|
|
75
|
+
const renderChildren = (transitionStyle: Record<string, any> | null) => {
|
|
76
76
|
const transition =
|
|
77
77
|
transitionStyle && typeof transitionStyle === 'object' ?
|
|
78
78
|
formatStyle(transitionStyle) :
|
|
@@ -814,3 +814,40 @@ export const FixTriggerRenderClosePanel = () => {
|
|
|
814
814
|
};
|
|
815
815
|
FixTriggerRenderClosePanel.storyName = "fix triggerRender close bug"
|
|
816
816
|
|
|
817
|
+
export const A11yKeyboardDemo = () => {
|
|
818
|
+
const [value, setValue] = useState(new Date('2022-08-08 00:00'));
|
|
819
|
+
const [rangeValue, setRangeValue] = useState([new Date('2022-08-08 00:00'), new Date('2022-08-09 12:00')]);
|
|
820
|
+
|
|
821
|
+
const handleChange = v => {
|
|
822
|
+
console.log('change', v);
|
|
823
|
+
setValue(v);
|
|
824
|
+
};
|
|
825
|
+
|
|
826
|
+
const handleRangeChange = v => {
|
|
827
|
+
console.log('change', v);
|
|
828
|
+
setRangeValue(v);
|
|
829
|
+
};
|
|
830
|
+
|
|
831
|
+
return (
|
|
832
|
+
<Space vertical align='start' data-cy="space">
|
|
833
|
+
<div data-cy="dateRange">
|
|
834
|
+
<DatePicker
|
|
835
|
+
value={rangeValue}
|
|
836
|
+
type="dateRange"
|
|
837
|
+
onChange={handleRangeChange}
|
|
838
|
+
showClear
|
|
839
|
+
/>
|
|
840
|
+
</div>
|
|
841
|
+
<div data-cy="date">
|
|
842
|
+
<DatePicker
|
|
843
|
+
onChange={handleChange}
|
|
844
|
+
showClear
|
|
845
|
+
multiple
|
|
846
|
+
/>
|
|
847
|
+
</div>
|
|
848
|
+
</Space>
|
|
849
|
+
);
|
|
850
|
+
};
|
|
851
|
+
|
|
852
|
+
A11yKeyboardDemo.storyName = "a11y keyboard demo"
|
|
853
|
+
|
|
@@ -6,7 +6,7 @@ import React from 'react';
|
|
|
6
6
|
import classnames from 'classnames';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { noop, stubFalse, isDate, get, isFunction, isEqual } from 'lodash';
|
|
9
|
-
import ConfigContext from '../configProvider/context';
|
|
9
|
+
import ConfigContext, { ContextValue } from '../configProvider/context';
|
|
10
10
|
import DatePickerFoundation, { DatePickerAdapter, DatePickerFoundationProps, DatePickerFoundationState, DayStatusType, PresetType, Type, RangeType } from '@douyinfe/semi-foundation/datePicker/foundation';
|
|
11
11
|
import { cssClasses, strings, numbers } from '@douyinfe/semi-foundation/datePicker/constants';
|
|
12
12
|
import { strings as popoverStrings, numbers as popoverNumbers } from '@douyinfe/semi-foundation/popover/constants';
|
|
@@ -175,6 +175,7 @@ export default class DatePicker extends BaseComponent<DatePickerProps, DatePicke
|
|
|
175
175
|
_mounted: boolean;
|
|
176
176
|
|
|
177
177
|
foundation: DatePickerFoundation;
|
|
178
|
+
context: ContextValue;
|
|
178
179
|
|
|
179
180
|
constructor(props: DatePickerProps) {
|
|
180
181
|
super(props);
|