@douyinfe/semi-ui 2.10.2 → 2.11.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.
Files changed (143) hide show
  1. package/anchor/link.tsx +2 -2
  2. package/autoComplete/index.tsx +3 -3
  3. package/avatar/interface.ts +2 -2
  4. package/badge/index.tsx +1 -1
  5. package/banner/index.tsx +4 -4
  6. package/breadcrumb/bread-context.tsx +1 -1
  7. package/card/cardGroup.tsx +1 -1
  8. package/card/index.tsx +1 -1
  9. package/cascader/index.tsx +4 -4
  10. package/checkbox/checkbox.tsx +16 -6
  11. package/collapse/index.tsx +1 -1
  12. package/collapse/item.tsx +1 -1
  13. package/collapsible/index.tsx +1 -1
  14. package/datePicker/_story/datePicker.stories.js +48 -1
  15. package/datePicker/_story/v2/AutoFillTime.jsx +37 -0
  16. package/datePicker/_story/v2/InputFormat.jsx +29 -0
  17. package/datePicker/_story/v2/InputFormatConfirm.jsx +44 -0
  18. package/datePicker/_story/v2/InputFormatDisabled.jsx +27 -0
  19. package/datePicker/_story/v2/index.js +4 -0
  20. package/datePicker/dateInput.tsx +7 -0
  21. package/datePicker/datePicker.tsx +7 -11
  22. package/datePicker/monthsGrid.tsx +2 -1
  23. package/descriptions/item.tsx +1 -1
  24. package/dist/umd/semi-ui.js +521 -197
  25. package/dist/umd/semi-ui.js.map +1 -1
  26. package/dist/umd/semi-ui.min.js +1 -1
  27. package/dist/umd/semi-ui.min.js.map +1 -1
  28. package/empty/index.tsx +1 -1
  29. package/form/errorMessage.tsx +1 -1
  30. package/form/interface.ts +1 -1
  31. package/form/label.tsx +1 -1
  32. package/form/section.tsx +2 -2
  33. package/form/slot.tsx +1 -1
  34. package/layout/Sider.tsx +1 -1
  35. package/lib/cjs/anchor/link.d.ts +2 -2
  36. package/lib/cjs/autoComplete/index.d.ts +1 -1
  37. package/lib/cjs/autoComplete/index.js +1 -1
  38. package/lib/cjs/avatar/interface.d.ts +2 -2
  39. package/lib/cjs/badge/index.d.ts +1 -1
  40. package/lib/cjs/banner/index.d.ts +4 -4
  41. package/lib/cjs/breadcrumb/bread-context.d.ts +1 -1
  42. package/lib/cjs/card/cardGroup.d.ts +1 -1
  43. package/lib/cjs/card/index.d.ts +1 -1
  44. package/lib/cjs/cascader/index.d.ts +1 -1
  45. package/lib/cjs/checkbox/checkbox.d.ts +4 -0
  46. package/lib/cjs/checkbox/checkbox.js +23 -11
  47. package/lib/cjs/collapse/index.d.ts +1 -1
  48. package/lib/cjs/collapse/item.d.ts +1 -1
  49. package/lib/cjs/collapsible/index.d.ts +1 -1
  50. package/lib/cjs/datePicker/dateInput.d.ts +1 -0
  51. package/lib/cjs/datePicker/dateInput.js +5 -3
  52. package/lib/cjs/datePicker/datePicker.js +9 -12
  53. package/lib/cjs/datePicker/monthsGrid.js +2 -1
  54. package/lib/cjs/descriptions/item.d.ts +1 -1
  55. package/lib/cjs/empty/index.d.ts +1 -1
  56. package/lib/cjs/form/errorMessage.d.ts +1 -1
  57. package/lib/cjs/form/interface.d.ts +1 -1
  58. package/lib/cjs/form/label.d.ts +1 -1
  59. package/lib/cjs/form/section.d.ts +2 -2
  60. package/lib/cjs/form/slot.d.ts +1 -1
  61. package/lib/cjs/layout/Sider.d.ts +1 -1
  62. package/lib/cjs/list/index.d.ts +1 -1
  63. package/lib/cjs/list/item.d.ts +1 -1
  64. package/lib/cjs/modal/Modal.d.ts +5 -5
  65. package/lib/cjs/modal/ModalContent.d.ts +1 -1
  66. package/lib/cjs/modal/confirm.d.ts +4 -2
  67. package/lib/cjs/modal/useModal/index.d.ts +16 -23
  68. package/lib/cjs/navigation/Footer.d.ts +1 -1
  69. package/lib/cjs/radio/radio.d.ts +4 -0
  70. package/lib/cjs/radio/radio.js +26 -12
  71. package/lib/cjs/radio/radioGroup.d.ts +1 -1
  72. package/lib/cjs/select/index.d.ts +1 -1
  73. package/lib/cjs/sideSheet/SideSheetContent.d.ts +1 -1
  74. package/lib/cjs/table/interface.d.ts +1 -1
  75. package/lib/cjs/tag/group.d.ts +3 -3
  76. package/lib/cjs/timeline/index.d.ts +1 -1
  77. package/lib/cjs/timeline/item.d.ts +1 -1
  78. package/lib/cjs/tooltip/index.d.ts +1 -0
  79. package/lib/cjs/tooltip/index.js +6 -1
  80. package/lib/es/anchor/link.d.ts +2 -2
  81. package/lib/es/autoComplete/index.d.ts +1 -1
  82. package/lib/es/autoComplete/index.js +1 -1
  83. package/lib/es/avatar/interface.d.ts +2 -2
  84. package/lib/es/badge/index.d.ts +1 -1
  85. package/lib/es/banner/index.d.ts +4 -4
  86. package/lib/es/breadcrumb/bread-context.d.ts +1 -1
  87. package/lib/es/card/cardGroup.d.ts +1 -1
  88. package/lib/es/card/index.d.ts +1 -1
  89. package/lib/es/cascader/index.d.ts +1 -1
  90. package/lib/es/checkbox/checkbox.d.ts +4 -0
  91. package/lib/es/checkbox/checkbox.js +23 -11
  92. package/lib/es/collapse/index.d.ts +1 -1
  93. package/lib/es/collapse/item.d.ts +1 -1
  94. package/lib/es/collapsible/index.d.ts +1 -1
  95. package/lib/es/datePicker/dateInput.d.ts +1 -0
  96. package/lib/es/datePicker/dateInput.js +5 -3
  97. package/lib/es/datePicker/datePicker.js +9 -12
  98. package/lib/es/datePicker/monthsGrid.js +2 -1
  99. package/lib/es/descriptions/item.d.ts +1 -1
  100. package/lib/es/empty/index.d.ts +1 -1
  101. package/lib/es/form/errorMessage.d.ts +1 -1
  102. package/lib/es/form/interface.d.ts +1 -1
  103. package/lib/es/form/label.d.ts +1 -1
  104. package/lib/es/form/section.d.ts +2 -2
  105. package/lib/es/form/slot.d.ts +1 -1
  106. package/lib/es/layout/Sider.d.ts +1 -1
  107. package/lib/es/list/index.d.ts +1 -1
  108. package/lib/es/list/item.d.ts +1 -1
  109. package/lib/es/modal/Modal.d.ts +5 -5
  110. package/lib/es/modal/ModalContent.d.ts +1 -1
  111. package/lib/es/modal/confirm.d.ts +4 -2
  112. package/lib/es/modal/confirm.js +1 -1
  113. package/lib/es/modal/useModal/index.d.ts +16 -23
  114. package/lib/es/navigation/Footer.d.ts +1 -1
  115. package/lib/es/radio/radio.d.ts +4 -0
  116. package/lib/es/radio/radio.js +26 -12
  117. package/lib/es/radio/radioGroup.d.ts +1 -1
  118. package/lib/es/select/index.d.ts +1 -1
  119. package/lib/es/sideSheet/SideSheetContent.d.ts +1 -1
  120. package/lib/es/table/interface.d.ts +1 -1
  121. package/lib/es/tag/group.d.ts +3 -3
  122. package/lib/es/timeline/index.d.ts +1 -1
  123. package/lib/es/timeline/item.d.ts +1 -1
  124. package/lib/es/tooltip/index.d.ts +1 -0
  125. package/lib/es/tooltip/index.js +6 -1
  126. package/list/index.tsx +1 -1
  127. package/list/item.tsx +1 -1
  128. package/modal/Modal.tsx +7 -7
  129. package/modal/ModalContent.tsx +1 -1
  130. package/modal/confirm.tsx +10 -11
  131. package/modal/useModal/index.tsx +9 -1
  132. package/navigation/Footer.tsx +2 -2
  133. package/package.json +9 -9
  134. package/radio/radio.tsx +17 -7
  135. package/radio/radioGroup.tsx +1 -1
  136. package/select/index.tsx +8 -8
  137. package/sideSheet/SideSheetContent.tsx +1 -1
  138. package/table/interface.ts +1 -1
  139. package/tag/group.tsx +4 -4
  140. package/timeline/index.tsx +1 -1
  141. package/timeline/item.tsx +1 -1
  142. package/tooltip/index.tsx +5 -1
  143. package/treeSelect/index.tsx +1 -1
@@ -67,16 +67,12 @@ class Radio extends _baseComponent.default {
67
67
  };
68
68
 
69
69
  this.state = {
70
- hover: false
70
+ hover: false,
71
+ addonId: props.addonId,
72
+ extraId: props.extraId
71
73
  };
72
74
  this.foundation = new _radioFoundation.default(this.adapter);
73
75
  this.radioEntity = null;
74
- this.addonId = (0, _uuid.getUuidShort)({
75
- prefix: 'addon'
76
- });
77
- this.extraId = (0, _uuid.getUuidShort)({
78
- prefix: 'extra'
79
- });
80
76
  }
81
77
 
82
78
  get adapter() {
@@ -85,6 +81,20 @@ class Radio extends _baseComponent.default {
85
81
  this.setState({
86
82
  hover
87
83
  });
84
+ },
85
+ setAddonId: () => {
86
+ this.setState({
87
+ addonId: (0, _uuid.getUuidShort)({
88
+ prefix: 'addon'
89
+ })
90
+ });
91
+ },
92
+ setExtraId: () => {
93
+ this.setState({
94
+ extraId: (0, _uuid.getUuidShort)({
95
+ prefix: 'extra'
96
+ })
97
+ });
88
98
  }
89
99
  });
90
100
  }
@@ -121,7 +131,11 @@ class Radio extends _baseComponent.default {
121
131
  value: propValue
122
132
  } = this.props;
123
133
  let realChecked, isDisabled, realMode, isButtonRadioGroup, isCardRadioGroup, isPureCardRadioGroup, isButtonRadioComponent, buttonSize, realPrefixCls;
124
- const isHover = this.state.hover;
134
+ const {
135
+ hover: isHover,
136
+ addonId,
137
+ extraId
138
+ } = this.state;
125
139
  let props = {};
126
140
 
127
141
  if (this.isInGroup()) {
@@ -174,10 +188,10 @@ class Radio extends _baseComponent.default {
174
188
  const renderContent = () => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children ? /*#__PURE__*/_react.default.createElement("span", {
175
189
  className: addonCls,
176
190
  style: addonStyle,
177
- id: this.addonId
191
+ id: addonId
178
192
  }, children) : null, extra && !isButtonRadio ? /*#__PURE__*/_react.default.createElement("div", {
179
193
  className: "".concat(prefix, "-extra"),
180
- id: this.extraId
194
+ id: extraId
181
195
  }, extra) : null);
182
196
 
183
197
  return /*#__PURE__*/_react.default.createElement("label", {
@@ -194,8 +208,8 @@ class Radio extends _baseComponent.default {
194
208
  ref: ref => {
195
209
  this.radioEntity = ref;
196
210
  },
197
- addonId: children && this.addonId,
198
- extraId: extra && this.extraId
211
+ addonId: children && addonId,
212
+ extraId: extra && extraId
199
213
  })), isCardRadioGroup ? /*#__PURE__*/_react.default.createElement("div", {
200
214
  className: "".concat(prefix, "-isCardRadioGroup_content")
201
215
  }, renderContent()) : renderContent());
@@ -24,7 +24,7 @@ export declare type RadioGroupProps = {
24
24
  value?: string | number;
25
25
  onChange?: (event: RadioChangeEvent) => void;
26
26
  className?: string;
27
- children?: React.ReactNode | undefined;
27
+ children?: React.ReactNode;
28
28
  style?: React.CSSProperties;
29
29
  direction?: ArrayElement<typeof strings.DIRECTION_SET>;
30
30
  mode?: RadioMode;
@@ -19,7 +19,7 @@ declare type ExcludeInputType = {
19
19
  };
20
20
  export interface optionRenderProps {
21
21
  key?: any;
22
- label?: string | React.ReactNode | number;
22
+ label?: React.ReactNode;
23
23
  value?: string | number;
24
24
  style?: React.CSSProperties;
25
25
  className?: string;
@@ -13,7 +13,7 @@ export interface SideSheetContentProps {
13
13
  style: CSSProperties;
14
14
  bodyStyle?: CSSProperties;
15
15
  className: string;
16
- children?: React.ReactNode | undefined;
16
+ children?: React.ReactNode;
17
17
  footer?: React.ReactNode;
18
18
  'aria-label'?: string;
19
19
  }
@@ -211,7 +211,7 @@ export declare type GetCheckboxProps<RecordType> = (record: RecordType) => Check
211
211
  export declare type RowSelectionOnChange<RecordType> = (selectedRowKeys?: (string | number)[], selectedRows?: RecordType[]) => void;
212
212
  export declare type RowSelectionOnSelect<RecordType> = (record?: RecordType, selected?: boolean, selectedRows?: RecordType[], nativeEvent?: React.MouseEvent) => void;
213
213
  export declare type RowSelectionOnSelectAll<RecordType> = (selected?: boolean, selectedRows?: RecordType[], changedRows?: RecordType[]) => void;
214
- export declare type ExpandIcon = ((expanded?: boolean) => React.ReactNode) | React.ReactNode | boolean;
214
+ export declare type ExpandIcon = ((expanded?: boolean) => React.ReactNode) | React.ReactNode;
215
215
  export declare type ExpandedRowRender<RecordType> = (record?: RecordType, index?: number, expanded?: boolean) => React.ReactNode;
216
216
  export declare type Footer<RecordType> = ReactNode | ((pageData?: RecordType[]) => React.ReactNode);
217
217
  export declare type FormatPageText = ((pageInfo?: {
@@ -3,19 +3,19 @@ import PropTypes from 'prop-types';
3
3
  import Tag from './index';
4
4
  import { PopoverProps } from '../popover/index';
5
5
  import { AvatarShape, TagProps } from './interface';
6
- export interface TagGroupProps {
6
+ export interface TagGroupProps<T> {
7
7
  style?: React.CSSProperties;
8
8
  className?: string;
9
9
  maxTagCount?: number;
10
10
  restCount?: number;
11
- tagList?: (TagProps | React.ReactNode)[];
11
+ tagList?: (T extends 'custom' ? React.ReactNode : TagProps)[];
12
12
  size?: 'small' | 'large';
13
13
  showPopover?: boolean;
14
14
  popoverProps?: PopoverProps;
15
15
  avatarShape?: AvatarShape;
16
16
  mode?: string;
17
17
  }
18
- export default class TagGroup extends PureComponent<TagGroupProps> {
18
+ export default class TagGroup<T> extends PureComponent<TagGroupProps<T>> {
19
19
  static defaultProps: {
20
20
  style: {};
21
21
  className: string;
@@ -11,7 +11,7 @@ export interface TimelineProps extends Pick<React.AriaAttributes, 'aria-label'>
11
11
  className?: string;
12
12
  style?: React.CSSProperties;
13
13
  dataSource?: Data[];
14
- children?: React.ReactNode | undefined;
14
+ children?: React.ReactNode;
15
15
  }
16
16
  declare class Timeline extends PureComponent<TimelineProps> {
17
17
  static contextType: React.Context<import("../configProvider/context").ContextValue>;
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
3
3
  import '@douyinfe/semi-foundation/lib/cjs/timeline/timeline.css';
4
4
  export interface TimelineItemProps {
5
5
  color?: string;
6
- children?: React.ReactNode | undefined;
6
+ children?: React.ReactNode;
7
7
  time?: React.ReactNode;
8
8
  type?: 'default' | 'ongoing' | 'success' | 'warning' | 'error';
9
9
  dot?: React.ReactNode;
@@ -53,6 +53,7 @@ export interface TooltipProps extends BaseProps {
53
53
  guardFocus?: boolean;
54
54
  returnFocusOnClose?: boolean;
55
55
  onEscKeyDown?: (e: React.KeyboardEvent) => void;
56
+ wrapperId?: string;
56
57
  }
57
58
  interface TooltipState {
58
59
  visible: boolean;
@@ -334,7 +334,7 @@ class Tooltip extends _baseComponent.default {
334
334
  placement: props.position || 'top',
335
335
  transitionStyle: {},
336
336
  isPositionUpdated: false,
337
- id: (0, _uuid.getUuidShort)() // auto generate id, will be used by children.aria-describedby & content.id, improve a11y
337
+ id: props.wrapperId // auto generate id, will be used by children.aria-describedby & content.id, improve a11y
338
338
 
339
339
  };
340
340
  this.foundation = new _foundation.default(this.adapter);
@@ -603,6 +603,11 @@ class Tooltip extends _baseComponent.default {
603
603
  },
604
604
  notifyEscKeydown: event => {
605
605
  this.props.onEscKeyDown(event);
606
+ },
607
+ setId: () => {
608
+ this.setState({
609
+ id: (0, _uuid.getUuidShort)()
610
+ });
606
611
  }
607
612
  });
608
613
  }
@@ -5,9 +5,9 @@ import LinkFoundation, { LinkAdapter } from '@douyinfe/semi-foundation/lib/es/an
5
5
  import { AnchorContextType } from './anchor-context';
6
6
  export interface LinkProps {
7
7
  href?: string;
8
- title?: string | React.ReactNode;
8
+ title?: ReactNode;
9
9
  className?: string;
10
- children?: ReactNode | undefined;
10
+ children?: ReactNode;
11
11
  style?: React.CSSProperties;
12
12
  disabled?: boolean;
13
13
  }
@@ -36,7 +36,7 @@ export interface AutoCompleteProps<T extends AutoCompleteItems> {
36
36
  dropdownMatchSelectWidth?: boolean;
37
37
  dropdownClassName?: string;
38
38
  dropdownStyle?: React.CSSProperties;
39
- emptyContent?: React.ReactNode | null;
39
+ emptyContent?: React.ReactNode;
40
40
  getPopupContainer?: () => HTMLElement;
41
41
  insetLabel?: React.ReactNode;
42
42
  insetLabelId?: string;
@@ -65,7 +65,7 @@ class AutoComplete extends BaseComponent {
65
65
  this.triggerRef = /*#__PURE__*/React.createRef();
66
66
  this.optionsRef = /*#__PURE__*/React.createRef();
67
67
  this.clickOutsideHandler = null;
68
- warning('triggerRender' in this.props && typeof this.props.triggerRender === 'function', "[Semi AutoComplete] \n - If you are using the following props: 'suffix', 'prefix', 'showClear', 'validateStatus', and 'size', \n please notice that they will be removed in the next major version.\n Please use 'componentProps' to retrieve these props instead.\n - If you are using 'onBlur', 'onFocus', please try to avoid using them and look for changes in the future.");
68
+ warning('triggerRender' in this.props && typeof this.props.triggerRender === 'function', "[Semi AutoComplete]\n - If you are using the following props: 'suffix', 'prefix', 'showClear', 'validateStatus', and 'size',\n please notice that they will be removed in the next major version.\n Please use 'componentProps' to retrieve these props instead.\n - If you are using 'onBlur', 'onFocus', please try to avoid using them and look for changes in the future.");
69
69
  }
70
70
 
71
71
  get adapter() {
@@ -4,7 +4,7 @@ export declare type AvatarShape = 'circle' | 'square';
4
4
  export declare type AvatarSize = 'extra-extra-small' | 'extra-small' | 'small' | 'default' | 'medium' | 'large' | 'extra-large';
5
5
  export declare type AvatarColor = 'amber' | 'blue' | 'cyan' | 'green' | 'grey' | 'indigo' | 'light-blue' | 'light-green' | 'lime' | 'orange' | 'pink' | 'purple' | 'red' | 'teal' | 'violet' | 'yellow';
6
6
  export interface AvatarProps extends BaseProps {
7
- children?: React.ReactNode | undefined;
7
+ children?: React.ReactNode;
8
8
  color?: AvatarColor;
9
9
  shape?: AvatarShape;
10
10
  size?: AvatarSize;
@@ -22,7 +22,7 @@ export declare type AvatarGroupShape = 'circle' | 'square';
22
22
  export declare type AvatarGroupSize = 'extra-extra-small' | 'extra-small' | 'small' | 'medium' | 'large' | 'extra-large';
23
23
  export declare type AvatarGroupOverlapFrom = 'start' | 'end';
24
24
  export interface AvatarGroupProps {
25
- children?: React.ReactNode | undefined;
25
+ children?: React.ReactNode;
26
26
  shape?: AvatarGroupShape;
27
27
  size?: AvatarGroupSize;
28
28
  overlapFrom?: AvatarGroupOverlapFrom;
@@ -17,7 +17,7 @@ export interface BadgeProps {
17
17
  onMouseEnter?: (e: React.MouseEvent) => any;
18
18
  onMouseLeave?: (e: React.MouseEvent) => any;
19
19
  onClick?: (e: React.MouseEvent) => any;
20
- children?: React.ReactNode | undefined;
20
+ children?: React.ReactNode;
21
21
  }
22
22
  export default class Badge extends PureComponent<BadgeProps> {
23
23
  static contextType: React.Context<ContextValue>;
@@ -7,15 +7,15 @@ export declare type Type = 'info' | 'danger' | 'warning' | 'success';
7
7
  export interface BannerProps {
8
8
  type?: Type;
9
9
  className?: string;
10
- children?: React.ReactNode | undefined;
10
+ children?: React.ReactNode;
11
11
  fullMode?: boolean;
12
12
  title?: React.ReactNode;
13
13
  description?: React.ReactNode;
14
- icon?: string | React.ReactNode;
15
- closeIcon?: string | React.ReactNode;
14
+ icon?: React.ReactNode;
15
+ closeIcon?: React.ReactNode;
16
16
  style?: React.CSSProperties;
17
17
  bordered?: boolean;
18
- onClose?: (e: React.MouseEvent) => void;
18
+ onClose?(e: React.MouseEvent): void;
19
19
  }
20
20
  export interface BannerState {
21
21
  visible: boolean;
@@ -5,7 +5,7 @@ export interface BreadContextType {
5
5
  onClick?: (info: BreadcrumbItemInfo, event: React.MouseEvent) => void;
6
6
  showTooltip?: boolean | showToolTipProps;
7
7
  compact?: boolean;
8
- separator?: string | React.ReactNode;
8
+ separator?: React.ReactNode;
9
9
  }
10
10
  declare const BreadContext: React.Context<BreadContextType>;
11
11
  export default BreadContext;
@@ -4,7 +4,7 @@ export declare type CardGroupType = 'grid';
4
4
  export interface CardGroupProps {
5
5
  /** Card group style class name */
6
6
  className?: string;
7
- children?: React.ReactNode | undefined;
7
+ children?: React.ReactNode;
8
8
  /** Card Spacing */
9
9
  spacing?: number | number[];
10
10
  /** Card group inline style */
@@ -14,7 +14,7 @@ export interface CardProps {
14
14
  bordered?: boolean;
15
15
  /** Style class name */
16
16
  className?: string;
17
- children?: React.ReactNode | undefined;
17
+ children?: React.ReactNode;
18
18
  /** Cover */
19
19
  cover?: ReactNode;
20
20
  /** Additional additions to the right of the title */
@@ -33,7 +33,7 @@ export interface CascaderProps extends BasicCascaderProps {
33
33
  motion?: Motion;
34
34
  treeData?: Array<CascaderData>;
35
35
  restTagsPopoverProps?: PopoverProps;
36
- children?: React.ReactNode | undefined;
36
+ children?: React.ReactNode;
37
37
  value?: Value;
38
38
  prefix?: ReactNode;
39
39
  suffix?: ReactNode;
@@ -22,9 +22,13 @@ export interface CheckboxProps extends BaseCheckboxProps {
22
22
  'aria-label'?: React.AriaAttributes['aria-label'];
23
23
  role?: React.HTMLAttributes<HTMLSpanElement>['role'];
24
24
  tabIndex?: number;
25
+ addonId?: string;
26
+ extraId?: string;
25
27
  }
26
28
  interface CheckboxState {
27
29
  checked: boolean;
30
+ addonId?: string;
31
+ extraId?: string;
28
32
  }
29
33
  declare class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
30
34
  static contextType: React.Context<CheckboxContextType>;
@@ -26,15 +26,11 @@ class Checkbox extends BaseComponent {
26
26
 
27
27
  const checked = false;
28
28
  this.state = {
29
- checked: props.checked || props.defaultChecked || checked
29
+ checked: props.checked || props.defaultChecked || checked,
30
+ addonId: props.addonId,
31
+ extraId: props.extraId
30
32
  };
31
33
  this.checkboxEntity = null;
32
- this.addonId = getUuidShort({
33
- prefix: 'addon'
34
- });
35
- this.extraId = getUuidShort({
36
- prefix: 'extra'
37
- });
38
34
  this.foundation = new CheckboxFoundation(this.adapter);
39
35
  }
40
36
 
@@ -56,7 +52,21 @@ class Checkbox extends BaseComponent {
56
52
  notifyGroupChange: cbContent => {
57
53
  this.context.checkboxGroup.onChange(cbContent);
58
54
  },
59
- getGroupDisabled: () => this.context && this.context.checkboxGroup.disabled
55
+ getGroupDisabled: () => this.context && this.context.checkboxGroup.disabled,
56
+ setAddonId: () => {
57
+ this.setState({
58
+ addonId: getUuidShort({
59
+ prefix: 'addon'
60
+ })
61
+ });
62
+ },
63
+ setExtraId: () => {
64
+ this.setState({
65
+ extraId: getUuidShort({
66
+ prefix: 'extra'
67
+ })
68
+ });
69
+ }
60
70
  });
61
71
  }
62
72
 
@@ -99,7 +109,9 @@ class Checkbox extends BaseComponent {
99
109
  id
100
110
  } = this.props;
101
111
  const {
102
- checked
112
+ checked,
113
+ addonId,
114
+ extraId
103
115
  } = this.state;
104
116
  const props = {
105
117
  checked,
@@ -147,10 +159,10 @@ class Checkbox extends BaseComponent {
147
159
  });
148
160
 
149
161
  const renderContent = () => /*#__PURE__*/React.createElement(React.Fragment, null, children ? /*#__PURE__*/React.createElement("span", {
150
- id: this.addonId,
162
+ id: addonId,
151
163
  className: "".concat(prefix, "-addon")
152
164
  }, children) : null, extra ? /*#__PURE__*/React.createElement("div", {
153
- id: this.extraId,
165
+ id: extraId,
154
166
  className: extraCls
155
167
  }, extra) : null);
156
168
 
@@ -9,7 +9,7 @@ export { CollapsePanelProps } from './item';
9
9
  export interface CollapseReactProps extends CollapseProps {
10
10
  expandIcon?: React.ReactNode;
11
11
  collapseIcon?: React.ReactNode;
12
- children?: React.ReactNode | undefined;
12
+ children?: React.ReactNode;
13
13
  style?: CSSProperties;
14
14
  onChange?: (activeKey: CollapseProps['activeKey'], e: React.MouseEvent) => void;
15
15
  }
@@ -6,7 +6,7 @@ export interface CollapsePanelProps {
6
6
  extra?: ReactNode;
7
7
  header?: ReactNode;
8
8
  className?: string;
9
- children?: React.ReactNode | undefined;
9
+ children?: React.ReactNode;
10
10
  reCalcKey?: number | string;
11
11
  style?: CSSProperties;
12
12
  }
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  import { Motion } from '../_base/base';
4
4
  export interface CollapsibleProps {
5
5
  motion?: Motion;
6
- children?: React.ReactNode | undefined;
6
+ children?: React.ReactNode;
7
7
  isOpen?: boolean;
8
8
  duration?: number;
9
9
  keepDOM?: boolean;
@@ -43,6 +43,7 @@ export default class DateInput extends BaseComponent<DateInputProps, {}> {
43
43
  rangeSeparator: PropTypes.Requireable<string>;
44
44
  insetInput: PropTypes.Requireable<boolean>;
45
45
  insetInputValue: PropTypes.Requireable<object>;
46
+ defaultPickerValue: PropTypes.Requireable<string | number | object>;
46
47
  };
47
48
  static defaultProps: {
48
49
  showClear: boolean;
@@ -370,9 +370,10 @@ export default class DateInput extends BaseComponent {
370
370
  rangeInputFocus,
371
371
  rangeSeparator,
372
372
  insetInput,
373
- insetInputValue
373
+ insetInputValue,
374
+ defaultPickerValue
374
375
  } = _a,
375
- rest = __rest(_a, ["placeholder", "type", "value", "inputValue", "inputStyle", "disabled", "showClear", "inputReadOnly", "insetLabel", "validateStatus", "block", "prefixCls", "multiple", "dateFnsLocale", "onBlur", "onClear", "onFocus", "prefix", "autofocus", "size", "rangeInputStartRef", "rangeInputEndRef", "onRangeClear", "onRangeBlur", "onRangeEndTabPress", "rangeInputFocus", "rangeSeparator", "insetInput", "insetInputValue"]);
376
+ rest = __rest(_a, ["placeholder", "type", "value", "inputValue", "inputStyle", "disabled", "showClear", "inputReadOnly", "insetLabel", "validateStatus", "block", "prefixCls", "multiple", "dateFnsLocale", "onBlur", "onClear", "onFocus", "prefix", "autofocus", "size", "rangeInputStartRef", "rangeInputEndRef", "onRangeClear", "onRangeBlur", "onRangeEndTabPress", "rangeInputFocus", "rangeSeparator", "insetInput", "insetInputValue", "defaultPickerValue"]);
376
377
 
377
378
  const dateIcon = /*#__PURE__*/React.createElement(IconCalendar, {
378
379
  "aria-hidden": true
@@ -456,7 +457,8 @@ DateInput.propTypes = {
456
457
  rangeInputEndRef: PropTypes.object,
457
458
  rangeSeparator: PropTypes.string,
458
459
  insetInput: PropTypes.bool,
459
- insetInputValue: PropTypes.object
460
+ insetInputValue: PropTypes.object,
461
+ defaultPickerValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object, PropTypes.array])
460
462
  };
461
463
  DateInput.defaultProps = {
462
464
  showClear: true,
@@ -151,7 +151,8 @@ export default class DatePicker extends BaseComponent {
151
151
  insetInput,
152
152
  type,
153
153
  format,
154
- rangeSeparator
154
+ rangeSeparator,
155
+ defaultPickerValue
155
156
  } = this.props;
156
157
  const {
157
158
  insetInputValue,
@@ -173,7 +174,8 @@ export default class DatePicker extends BaseComponent {
173
174
  onInsetInputChange: this.handleInsetInputChange,
174
175
  rangeInputStartRef: this.rangeInputStartRef,
175
176
  rangeInputEndRef: this.rangeInputEndRef,
176
- density
177
+ density,
178
+ defaultPickerValue
177
179
  };
178
180
  return /*#__PURE__*/React.createElement("div", {
179
181
  ref: this.panelRef,
@@ -544,18 +546,11 @@ export default class DatePicker extends BaseComponent {
544
546
  insetInput
545
547
  } = this.props;
546
548
  const {
547
- value,
548
549
  cachedSelectedValue,
549
550
  motionEnd,
550
551
  rangeInputFocus
551
- } = this.state; // const cachedSelectedValue = this.adapter.getCache('cachedSelectedValue');
552
-
553
- let defaultValue = value;
554
-
555
- if (this.adapter.needConfirm()) {
556
- defaultValue = cachedSelectedValue;
557
- }
558
-
552
+ } = this.state;
553
+ const defaultValue = cachedSelectedValue;
559
554
  return /*#__PURE__*/React.createElement(MonthsGrid, {
560
555
  ref: this.monthGrid,
561
556
  locale: locale,
@@ -627,7 +622,8 @@ export default class DatePicker extends BaseComponent {
627
622
  size,
628
623
  inputReadOnly,
629
624
  rangeSeparator,
630
- insetInput
625
+ insetInput,
626
+ defaultPickerValue
631
627
  } = this.props;
632
628
  const {
633
629
  value,
@@ -653,6 +649,7 @@ export default class DatePicker extends BaseComponent {
653
649
  disabled: inputDisabled,
654
650
  inputValue,
655
651
  value: value,
652
+ defaultPickerValue,
656
653
  onChange: this.handleInputChange,
657
654
  onEnterPress: this.handleInputComplete,
658
655
  // TODO: remove in next major version
@@ -230,7 +230,8 @@ export default class MonthsGrid extends BaseComponent {
230
230
  } = this.props;
231
231
 
232
232
  if (prevProps.defaultValue !== defaultValue) {
233
- this.foundation.updateSelectedFromProps(defaultValue, false);
233
+ // we should always update panel state when value changes
234
+ this.foundation.updateSelectedFromProps(defaultValue);
234
235
  }
235
236
 
236
237
  if (prevProps.defaultPickerValue !== defaultPickerValue) {
@@ -5,7 +5,7 @@ import { DescriptionsContextValue } from './descriptions-context';
5
5
  export interface DescriptionsItemProps {
6
6
  hidden?: boolean;
7
7
  className?: string;
8
- children?: React.ReactNode | undefined | (() => React.ReactNode);
8
+ children?: React.ReactNode | (() => React.ReactNode);
9
9
  style?: React.CSSProperties;
10
10
  itemKey?: React.ReactNode;
11
11
  }
@@ -17,7 +17,7 @@ export interface EmptyProps {
17
17
  darkModeImage?: React.ReactNode | SVGNode;
18
18
  style?: React.CSSProperties;
19
19
  className?: string;
20
- children?: React.ReactNode | undefined;
20
+ children?: React.ReactNode;
21
21
  }
22
22
  interface EmptyState {
23
23
  mode: any;
@@ -1,6 +1,6 @@
1
1
  import React, { PureComponent } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- export declare type ReactFieldError = boolean | string | Array<any> | React.ReactNode | undefined;
3
+ export declare type ReactFieldError = Array<any> | React.ReactNode;
4
4
  export interface ErrorMessageProps {
5
5
  error?: ReactFieldError;
6
6
  className?: string;
@@ -15,7 +15,7 @@ export declare type CommonFieldProps = {
15
15
  /** Field is required (except Form. Checkbox within the Group, Form. Radio) */
16
16
  field: string;
17
17
  /** The label text of the form control is the same name as the field by default when it is not passed */
18
- label?: string | LabelProps | React.ReactNode | number;
18
+ label?: LabelProps | React.ReactNode;
19
19
  labelPosition?: 'top' | 'left' | 'inset';
20
20
  labelAlign?: 'left' | 'right';
21
21
  labelWidth?: number | string;
@@ -15,7 +15,7 @@ export interface LabelProps {
15
15
  width?: number | string;
16
16
  style?: React.CSSProperties;
17
17
  className?: string;
18
- children?: React.ReactNode | undefined;
18
+ children?: React.ReactNode;
19
19
  extra?: React.ReactNode;
20
20
  }
21
21
  export default class Label extends PureComponent<LabelProps> {
@@ -3,8 +3,8 @@ import PropTypes from 'prop-types';
3
3
  export interface SectionProps {
4
4
  className?: string;
5
5
  style?: React.CSSProperties;
6
- text?: React.ReactNode | string;
7
- children?: React.ReactNode | undefined;
6
+ text?: React.ReactNode;
7
+ children?: React.ReactNode;
8
8
  }
9
9
  export default class Section extends PureComponent<SectionProps> {
10
10
  static propTypes: {
@@ -4,7 +4,7 @@ import { ErrorMessageProps } from './errorMessage';
4
4
  export interface SlotProps {
5
5
  className?: string;
6
6
  style?: React.CSSProperties;
7
- label?: LabelProps | React.ReactNode | number | string;
7
+ label?: LabelProps | React.ReactNode;
8
8
  noLabel?: boolean;
9
9
  labelPosition?: 'top' | 'left';
10
10
  error?: ErrorMessageProps;
@@ -13,7 +13,7 @@ export interface SiderProps {
13
13
  prefixCls?: string;
14
14
  style?: CSSProperties;
15
15
  className?: string;
16
- children?: React.ReactNode | undefined;
16
+ children?: React.ReactNode;
17
17
  breakpoint?: Array<keyof ResponsiveMap>;
18
18
  onBreakpoint?: (screen: keyof ResponsiveMap, match: boolean) => void;
19
19
  'aria-label'?: React.AriaAttributes['aria-label'];
@@ -8,7 +8,7 @@ export { ListItemProps } from './item';
8
8
  export interface ListProps<T> {
9
9
  style?: React.CSSProperties;
10
10
  className?: string;
11
- children?: React.ReactNode | undefined;
11
+ children?: React.ReactNode;
12
12
  bordered?: boolean;
13
13
  footer?: React.ReactNode;
14
14
  header?: React.ReactNode;
@@ -7,7 +7,7 @@ export interface ListItemProps {
7
7
  main?: React.ReactNode;
8
8
  align?: 'flex-start' | 'flex-end' | 'center' | 'baseline' | 'stretch';
9
9
  className?: string;
10
- children?: React.ReactNode | undefined;
10
+ children?: React.ReactNode;
11
11
  style?: React.CSSProperties;
12
12
  onClick?: React.MouseEventHandler<HTMLLIElement>;
13
13
  onRightClick?: React.MouseEventHandler<HTMLLIElement>;