@douyinfe/semi-ui 2.17.1 → 2.19.0-alpha.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.
Files changed (172) hide show
  1. package/anchor/index.tsx +1 -1
  2. package/anchor/link.tsx +3 -4
  3. package/autoComplete/__test__/autoComplete.test.js +6 -6
  4. package/autoComplete/index.tsx +1 -1
  5. package/autoComplete/option.tsx +164 -0
  6. package/calendar/__test__/calendar.test.js +21 -2
  7. package/calendar/_story/calendar.stories.js +31 -0
  8. package/calendar/index.tsx +3 -1
  9. package/calendar/interface.ts +2 -1
  10. package/carousel/index.tsx +5 -5
  11. package/checkbox/checkbox.tsx +10 -2
  12. package/checkbox/checkboxGroup.tsx +2 -0
  13. package/dist/css/semi.css +160 -22
  14. package/dist/css/semi.min.css +1 -1
  15. package/dist/umd/semi-ui.js +15144 -16407
  16. package/dist/umd/semi-ui.js.map +1 -1
  17. package/dist/umd/semi-ui.min.js +1 -1
  18. package/dist/umd/semi-ui.min.js.map +1 -1
  19. package/form/_story/FieldProps/labelOptional.jsx +30 -0
  20. package/form/_story/form.stories.js +7 -0
  21. package/form/hoc/withField.tsx +1 -0
  22. package/form/label.tsx +21 -7
  23. package/gulpfile.js +3 -1
  24. package/lib/cjs/_base/base.css +35 -0
  25. package/lib/cjs/anchor/index.js +2 -1
  26. package/lib/cjs/anchor/link.d.ts +1 -1
  27. package/lib/cjs/anchor/link.js +9 -5
  28. package/lib/cjs/autoComplete/index.d.ts +1 -1
  29. package/lib/cjs/autoComplete/index.js +1 -1
  30. package/lib/cjs/autoComplete/option.d.ts +50 -0
  31. package/lib/cjs/autoComplete/option.js +218 -0
  32. package/lib/cjs/calendar/index.d.ts +2 -0
  33. package/lib/cjs/calendar/index.js +3 -1
  34. package/lib/cjs/calendar/interface.d.ts +2 -1
  35. package/lib/cjs/carousel/index.js +2 -2
  36. package/lib/cjs/checkbox/checkbox.d.ts +4 -0
  37. package/lib/cjs/checkbox/checkbox.js +9 -3
  38. package/lib/cjs/checkbox/checkboxGroup.js +4 -2
  39. package/lib/cjs/form/baseForm.d.ts +1 -1
  40. package/lib/cjs/form/field.d.ts +1 -1
  41. package/lib/cjs/form/hoc/withField.js +2 -1
  42. package/lib/cjs/form/label.d.ts +8 -5
  43. package/lib/cjs/form/label.js +15 -4
  44. package/lib/cjs/locale/interface.d.ts +3 -0
  45. package/lib/cjs/locale/source/ar.js +3 -0
  46. package/lib/cjs/locale/source/de.js +3 -0
  47. package/lib/cjs/locale/source/en_GB.js +3 -0
  48. package/lib/cjs/locale/source/en_US.js +3 -0
  49. package/lib/cjs/locale/source/es.js +3 -0
  50. package/lib/cjs/locale/source/fr.js +3 -0
  51. package/lib/cjs/locale/source/id_ID.js +3 -0
  52. package/lib/cjs/locale/source/it.js +3 -0
  53. package/lib/cjs/locale/source/ja_JP.js +3 -0
  54. package/lib/cjs/locale/source/ko_KR.js +3 -0
  55. package/lib/cjs/locale/source/ms_MY.js +3 -0
  56. package/lib/cjs/locale/source/pt_BR.js +3 -0
  57. package/lib/cjs/locale/source/ru_RU.js +3 -0
  58. package/lib/cjs/locale/source/th_TH.js +3 -0
  59. package/lib/cjs/locale/source/tr_TR.js +3 -0
  60. package/lib/cjs/locale/source/vi_VN.js +3 -0
  61. package/lib/cjs/locale/source/zh_CN.js +3 -0
  62. package/lib/cjs/locale/source/zh_TW.js +3 -0
  63. package/lib/cjs/modal/Modal.js +0 -8
  64. package/lib/cjs/modal/ModalContent.js +4 -1
  65. package/lib/cjs/radio/radio.d.ts +2 -0
  66. package/lib/cjs/radio/radio.js +33 -8
  67. package/lib/cjs/radio/radioGroup.js +4 -2
  68. package/lib/cjs/tag/group.d.ts +3 -0
  69. package/lib/cjs/tag/group.js +24 -6
  70. package/lib/cjs/tag/index.d.ts +2 -1
  71. package/lib/cjs/tag/index.js +7 -5
  72. package/lib/cjs/tag/interface.d.ts +2 -1
  73. package/lib/cjs/tree/index.d.ts +3 -1
  74. package/lib/cjs/tree/index.js +23 -0
  75. package/lib/cjs/tree/interface.d.ts +4 -0
  76. package/lib/cjs/typography/title.d.ts +1 -1
  77. package/lib/es/_base/base.css +35 -0
  78. package/lib/es/anchor/index.js +2 -1
  79. package/lib/es/anchor/link.d.ts +1 -1
  80. package/lib/es/anchor/link.js +9 -5
  81. package/lib/es/autoComplete/index.d.ts +1 -1
  82. package/lib/es/autoComplete/index.js +1 -1
  83. package/lib/es/autoComplete/option.d.ts +50 -0
  84. package/lib/es/autoComplete/option.js +188 -0
  85. package/lib/es/calendar/index.d.ts +2 -0
  86. package/lib/es/calendar/index.js +3 -1
  87. package/lib/es/calendar/interface.d.ts +2 -1
  88. package/lib/es/carousel/index.js +2 -2
  89. package/lib/es/checkbox/checkbox.d.ts +4 -0
  90. package/lib/es/checkbox/checkbox.js +10 -4
  91. package/lib/es/checkbox/checkboxGroup.js +4 -2
  92. package/lib/es/form/baseForm.d.ts +1 -1
  93. package/lib/es/form/field.d.ts +1 -1
  94. package/lib/es/form/hoc/withField.js +2 -1
  95. package/lib/es/form/label.d.ts +8 -5
  96. package/lib/es/form/label.js +13 -4
  97. package/lib/es/locale/interface.d.ts +3 -0
  98. package/lib/es/locale/source/ar.js +3 -0
  99. package/lib/es/locale/source/de.js +3 -0
  100. package/lib/es/locale/source/en_GB.js +3 -0
  101. package/lib/es/locale/source/en_US.js +3 -0
  102. package/lib/es/locale/source/es.js +3 -0
  103. package/lib/es/locale/source/fr.js +3 -0
  104. package/lib/es/locale/source/id_ID.js +3 -0
  105. package/lib/es/locale/source/it.js +3 -0
  106. package/lib/es/locale/source/ja_JP.js +3 -0
  107. package/lib/es/locale/source/ko_KR.js +3 -0
  108. package/lib/es/locale/source/ms_MY.js +3 -0
  109. package/lib/es/locale/source/pt_BR.js +3 -0
  110. package/lib/es/locale/source/ru_RU.js +3 -0
  111. package/lib/es/locale/source/th_TH.js +3 -0
  112. package/lib/es/locale/source/tr_TR.js +3 -0
  113. package/lib/es/locale/source/vi_VN.js +3 -0
  114. package/lib/es/locale/source/zh_CN.js +3 -0
  115. package/lib/es/locale/source/zh_TW.js +3 -0
  116. package/lib/es/modal/Modal.js +0 -8
  117. package/lib/es/modal/ModalContent.js +4 -1
  118. package/lib/es/radio/radio.d.ts +2 -0
  119. package/lib/es/radio/radio.js +31 -8
  120. package/lib/es/radio/radioGroup.js +4 -2
  121. package/lib/es/tag/group.d.ts +3 -0
  122. package/lib/es/tag/group.js +24 -6
  123. package/lib/es/tag/index.d.ts +2 -1
  124. package/lib/es/tag/index.js +7 -5
  125. package/lib/es/tag/interface.d.ts +2 -1
  126. package/lib/es/tree/index.d.ts +3 -1
  127. package/lib/es/tree/index.js +22 -0
  128. package/lib/es/tree/interface.d.ts +4 -0
  129. package/lib/es/typography/title.d.ts +1 -1
  130. package/locale/interface.ts +3 -0
  131. package/locale/source/ar.ts +3 -0
  132. package/locale/source/de.ts +3 -0
  133. package/locale/source/en_GB.ts +3 -0
  134. package/locale/source/en_US.ts +3 -0
  135. package/locale/source/es.ts +3 -0
  136. package/locale/source/fr.ts +3 -0
  137. package/locale/source/id_ID.ts +3 -0
  138. package/locale/source/it.ts +3 -0
  139. package/locale/source/ja_JP.ts +3 -0
  140. package/locale/source/ko_KR.ts +3 -0
  141. package/locale/source/ms_MY.ts +3 -0
  142. package/locale/source/pt_BR.ts +3 -0
  143. package/locale/source/ru_RU.ts +3 -0
  144. package/locale/source/th_TH.ts +3 -0
  145. package/locale/source/tr_TR.ts +4 -1
  146. package/locale/source/vi_VN.ts +3 -0
  147. package/locale/source/zh_CN.ts +3 -0
  148. package/locale/source/zh_TW.ts +3 -0
  149. package/modal/Modal.tsx +0 -6
  150. package/modal/ModalContent.tsx +4 -1
  151. package/modal/__test__/modal.test.js +1 -1
  152. package/modal/_story/__snapshots__/modal.stories.tsx.snap +203 -0
  153. package/package.json +7 -7
  154. package/radio/_story/radio.stories.js +2 -2
  155. package/radio/radio.tsx +27 -5
  156. package/radio/radioGroup.tsx +2 -0
  157. package/rating/__test__/rating.test.js +1 -1
  158. package/select/__test__/select.test.js +11 -17
  159. package/select/_story/select.stories.js +6 -6
  160. package/steps/_story/steps.stories.js +3 -3
  161. package/switch/_story/switch.stories.js +4 -4
  162. package/switch/_story/switch.stories.tsx +4 -4
  163. package/tag/_story/tag.stories.js +57 -1
  164. package/tag/group.tsx +20 -3
  165. package/tag/index.tsx +6 -5
  166. package/tag/interface.ts +2 -1
  167. package/transfer/_story/transfer.stories.js +2 -2
  168. package/tree/_story/tree.stories.js +152 -3
  169. package/tree/index.tsx +16 -1
  170. package/tree/interface.ts +6 -0
  171. package/upload/_story/upload.stories.js +2 -2
  172. package/webpack.config.js +10 -2
@@ -151,7 +151,8 @@ class Checkbox extends _baseComponent.default {
151
151
  value,
152
152
  role,
153
153
  tabIndex,
154
- id
154
+ id,
155
+ type
155
156
  } = this.props;
156
157
  const {
157
158
  checked,
@@ -184,6 +185,9 @@ class Checkbox extends _baseComponent.default {
184
185
  props.isCardType = isCardType;
185
186
  props.isPureCardType = isPureCardType;
186
187
  props['name'] = this.context.checkboxGroup.name;
188
+ } else {
189
+ props.isPureCardType = type === _constants.strings.TYPE_PURECARD;
190
+ props.isCardType = type === _constants.strings.TYPE_CARD || props.isPureCardType;
187
191
  }
188
192
 
189
193
  const prefix = prefixCls || _constants.checkboxClasses.PREFIX;
@@ -274,14 +278,16 @@ Checkbox.propTypes = {
274
278
  index: _propTypes.default.number,
275
279
  'aria-label': _propTypes.default.string,
276
280
  tabIndex: _propTypes.default.number,
277
- preventScroll: _propTypes.default.bool
281
+ preventScroll: _propTypes.default.bool,
282
+ type: _propTypes.default.string
278
283
  };
279
284
  Checkbox.defaultProps = {
280
285
  defaultChecked: false,
281
286
  indeterminate: false,
282
287
  onChange: _noop2.default,
283
288
  onMouseEnter: _noop2.default,
284
- onMouseLeave: _noop2.default
289
+ onMouseLeave: _noop2.default,
290
+ type: 'default'
285
291
  };
286
292
  var _default = Checkbox;
287
293
  exports.default = _default;
@@ -118,7 +118,8 @@ class CheckboxGroup extends _baseComponent.default {
118
118
  key: index,
119
119
  disabled: this.props.disabled,
120
120
  value: option,
121
- prefixCls: prefixCls
121
+ prefixCls: prefixCls,
122
+ type: type
122
123
  }, option);
123
124
  } else {
124
125
  return /*#__PURE__*/_react.default.createElement(_checkbox.default, {
@@ -130,7 +131,8 @@ class CheckboxGroup extends _baseComponent.default {
130
131
  extra: option.extra,
131
132
  className: option.className,
132
133
  style: option.style,
133
- onChange: option.onChange
134
+ onChange: option.onChange,
135
+ type: type
134
136
  }, option.label);
135
137
  }
136
138
  });
@@ -126,7 +126,7 @@ declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
126
126
  onListScroll?: (e: React.UIEvent<HTMLDivElement, UIEvent>) => void;
127
127
  children?: React.ReactNode;
128
128
  preventScroll?: boolean;
129
- } & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "getPopupContainer" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & React.RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
129
+ } & Pick<import("../tooltip").TooltipProps, "getPopupContainer" | "stopPropagation" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & React.RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
130
130
  static Checkbox: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox").CheckboxProps & import("./interface").RCIncludeType>;
131
131
  static CheckboxGroup: React.ComponentType<import("utility-types").Subtract<import("../checkbox").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & React.RefAttributes<any>>;
132
132
  static Radio: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../radio").RadioProps & import("./interface").RCIncludeType>;
@@ -74,7 +74,7 @@ declare const FormSelect: import("react").ComponentType<import("utility-types").
74
74
  onListScroll?: (e: import("react").UIEvent<HTMLDivElement, UIEvent>) => void;
75
75
  children?: import("react").ReactNode;
76
76
  preventScroll?: boolean;
77
- } & Pick<import("../tooltip").TooltipProps, "stopPropagation" | "getPopupContainer" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & import("react").RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
77
+ } & Pick<import("../tooltip").TooltipProps, "getPopupContainer" | "stopPropagation" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & import("react").RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
78
78
  declare const FormCheckboxGroup: import("react").ComponentType<import("utility-types").Subtract<import("../checkbox/checkboxGroup").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & import("react").RefAttributes<any>>;
79
79
  declare const FormCheckbox: import("react").ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox/checkbox").CheckboxProps & import("./interface").RCIncludeType>;
80
80
  declare const FormRadioGroup: import("react").ComponentType<import("utility-types").Subtract<import("../radio/radioGroup").RadioGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps & import("react").RefAttributes<any>>;
@@ -136,7 +136,8 @@ function withField(Component, opts) {
136
136
  if (arrayFieldState) {
137
137
  initVal = arrayFieldState.shouldUseInitValue && typeof initValue !== 'undefined' ? initValue : initValueInFormOpts;
138
138
  }
139
- } catch (err) {}
139
+ } catch (err) {} // FIXME typeof initVal
140
+
140
141
 
141
142
  const [value, setValue, getVal] = (0, _index.useStateWithGetter)(typeof initVal !== undefined ? initVal : null);
142
143
  const validateOnMount = (0, _includes.default)(trigger).call(trigger, 'mount');
@@ -1,22 +1,23 @@
1
1
  import React, { PureComponent } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  export interface LabelProps {
4
+ /** text-align of label */
5
+ align?: string;
6
+ className?: string;
7
+ children?: React.ReactNode;
8
+ disabled?: boolean;
4
9
  id?: string;
5
10
  /** Whether to display the required * symbol */
6
11
  required?: boolean;
7
12
  /** Content of label */
8
13
  text?: React.ReactNode;
9
- disabled?: boolean;
10
14
  /** Used to configure the htmlFor attribute of the label tag */
11
15
  name?: string;
12
- /** text-align of label */
13
- align?: string;
14
16
  /** width of label */
15
17
  width?: number | string;
16
18
  style?: React.CSSProperties;
17
- className?: string;
18
- children?: React.ReactNode;
19
19
  extra?: React.ReactNode;
20
+ optional?: boolean;
20
21
  }
21
22
  export default class Label extends PureComponent<LabelProps> {
22
23
  static defaultProps: {
@@ -24,6 +25,7 @@ export default class Label extends PureComponent<LabelProps> {
24
25
  name: string;
25
26
  align: string;
26
27
  className: string;
28
+ optional: boolean;
27
29
  };
28
30
  static propTypes: {
29
31
  id: PropTypes.Requireable<string>;
@@ -37,6 +39,7 @@ export default class Label extends PureComponent<LabelProps> {
37
39
  style: PropTypes.Requireable<object>;
38
40
  className: PropTypes.Requireable<string>;
39
41
  extra: PropTypes.Requireable<PropTypes.ReactNodeLike>;
42
+ optional: PropTypes.Requireable<boolean>;
40
43
  };
41
44
  render(): JSX.Element;
42
45
  }
@@ -22,6 +22,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
22
22
 
23
23
  var _constants = require("@douyinfe/semi-foundation/lib/cjs/form/constants");
24
24
 
25
+ var _localeConsumer = _interopRequireDefault(require("../locale/localeConsumer"));
26
+
25
27
  function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
26
28
 
27
29
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -41,7 +43,8 @@ class Label extends _react.PureComponent {
41
43
  style,
42
44
  className,
43
45
  extra,
44
- id
46
+ id,
47
+ optional
45
48
  } = this.props;
46
49
  const labelCls = (0, _classnames.default)(className, {
47
50
  ["".concat(prefixCls, "-field-label")]: true,
@@ -54,10 +57,16 @@ class Label extends _react.PureComponent {
54
57
  const labelStyle = style ? style : {};
55
58
  width ? labelStyle.width = width : null;
56
59
 
60
+ const optionalText = /*#__PURE__*/_react.default.createElement(_localeConsumer.default, {
61
+ componentName: "Form"
62
+ }, locale => /*#__PURE__*/_react.default.createElement("span", {
63
+ className: "".concat(prefixCls, "-field-label-optional-text")
64
+ }, locale.optional));
65
+
57
66
  const textContent = /*#__PURE__*/_react.default.createElement("div", {
58
67
  className: "".concat(prefixCls, "-field-label-text"),
59
68
  "x-semi-prop": "label"
60
- }, typeof text !== 'undefined' ? text : children);
69
+ }, typeof text !== 'undefined' ? text : children, optional ? optionalText : null);
61
70
 
62
71
  const contentWithExtra = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, textContent, /*#__PURE__*/_react.default.createElement("div", {
63
72
  className: "".concat(prefixCls, "-field-label-extra")
@@ -78,7 +87,8 @@ Label.defaultProps = {
78
87
  required: false,
79
88
  name: '',
80
89
  align: 'left',
81
- className: ''
90
+ className: '',
91
+ optional: false
82
92
  };
83
93
  Label.propTypes = {
84
94
  id: _propTypes.default.string,
@@ -91,5 +101,6 @@ Label.propTypes = {
91
101
  width: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
92
102
  style: _propTypes.default.object,
93
103
  className: _propTypes.default.string,
94
- extra: _propTypes.default.node
104
+ extra: _propTypes.default.node,
105
+ optional: _propTypes.default.bool
95
106
  };
@@ -148,4 +148,7 @@ export interface Locale {
148
148
  total: string;
149
149
  selected: string;
150
150
  };
151
+ Form: {
152
+ optional: string;
153
+ };
151
154
  }
@@ -158,6 +158,9 @@ const local = {
158
158
  clearSelectAll: 'إلغاء تحديد الكل',
159
159
  total: 'مجموع ${total} العناصر',
160
160
  selected: '${total} العناصر المحدد'
161
+ },
162
+ Form: {
163
+ optional: '(اختياري)'
161
164
  }
162
165
  }; // [i18n-Arabic]
163
166
 
@@ -158,6 +158,9 @@ const local = {
158
158
  clearSelectAll: 'Alles abwählen',
159
159
  total: 'Gesamt ${total} Artikel',
160
160
  selected: '${total} ausgewählte Artikel'
161
+ },
162
+ Form: {
163
+ optional: '(Optional)'
161
164
  }
162
165
  }; // [i18n-German]
163
166
 
@@ -158,6 +158,9 @@ const local = {
158
158
  clearSelectAll: 'Unselect all',
159
159
  total: 'Total ${total} items',
160
160
  selected: '${total} items selected'
161
+ },
162
+ Form: {
163
+ optional: '(optional)'
161
164
  }
162
165
  }; // [i18n-English(GB)]
163
166
 
@@ -158,6 +158,9 @@ const local = {
158
158
  clearSelectAll: 'Unselect all',
159
159
  total: 'Total ${total} items',
160
160
  selected: '${total} items selected'
161
+ },
162
+ Form: {
163
+ optional: '(optional)'
161
164
  }
162
165
  }; // [i18n-English(US)]
163
166
 
@@ -162,6 +162,9 @@ const locale = {
162
162
  clearSelectAll: 'Deseleccionar todo',
163
163
  total: 'Total ${total} objetos',
164
164
  selected: '${total} objetos seleccionados'
165
+ },
166
+ Form: {
167
+ optional: '(opcional)'
165
168
  }
166
169
  };
167
170
  var _default = locale;
@@ -158,6 +158,9 @@ const local = {
158
158
  clearSelectAll: 'Désélectionner tout',
159
159
  total: 'Totale ${total} articles',
160
160
  selected: '${total} articles sélectionnés'
161
+ },
162
+ Form: {
163
+ optional: '(optionnel)'
161
164
  }
162
165
  }; // [i18n-French]
163
166
 
@@ -158,6 +158,9 @@ const local = {
158
158
  clearSelectAll: 'Nyahpilih Semua',
159
159
  total: 'Total ${total} proyek',
160
160
  selected: '${total} item dipilih'
161
+ },
162
+ Form: {
163
+ optional: '(opsional)'
161
164
  }
162
165
  }; // [i18n-Indonesia(ID)]
163
166
 
@@ -158,6 +158,9 @@ const local = {
158
158
  clearSelectAll: 'Deseleziona tutto',
159
159
  total: 'Totale ${total} elementi',
160
160
  selected: '${total} elementi selezionati'
161
+ },
162
+ Form: {
163
+ optional: '(opzionale)'
161
164
  }
162
165
  }; // [i18n-Italian]
163
166
 
@@ -159,6 +159,9 @@ const local = {
159
159
  clearSelectAll: 'すべてを選択解除',
160
160
  total: '合計 ${total} アイテム',
161
161
  selected: '選択済み ${total} アイテム'
162
+ },
163
+ Form: {
164
+ optional: '(オプション)'
162
165
  }
163
166
  }; // [i18n-Japan]
164
167
 
@@ -159,6 +159,9 @@ const local = {
159
159
  clearSelectAll: '모두 선택 취소',
160
160
  total: '총 {total} 개 항목',
161
161
  selected: '선택된 {Total} 개 항목'
162
+ },
163
+ Form: {
164
+ optional: '(선택 과목)'
162
165
  }
163
166
  }; // [i18n-Korea]
164
167
 
@@ -158,6 +158,9 @@ const local = {
158
158
  clearSelectAll: 'Nyahpilih semua',
159
159
  total: 'Jumlah ${total} item',
160
160
  selected: '${total} projek dipilih'
161
+ },
162
+ Form: {
163
+ optional: '(pilihan)'
161
164
  }
162
165
  }; // [i18n-Malaysia(MY)]
163
166
 
@@ -166,6 +166,9 @@ const local = {
166
166
  clearSelectAll: 'Cancelar selecionar tudo',
167
167
  total: 'Total de ${total} itens',
168
168
  selected: '${total} itens selecionados'
169
+ },
170
+ Form: {
171
+ optional: '(opcional)'
169
172
  }
170
173
  }; // 葡萄牙语
171
174
 
@@ -161,6 +161,9 @@ const local = {
161
161
  clearSelectAll: 'Снять выделение',
162
162
  total: 'Всего ${total} элементов',
163
163
  selected: 'Выбрано ${total} элементов'
164
+ },
165
+ Form: {
166
+ optional: '(по желанию)'
164
167
  }
165
168
  }; // [i18n-Russia] 俄罗斯语
166
169
 
@@ -162,6 +162,9 @@ const local = {
162
162
  clearSelectAll: 'ยกเลิกการเลือกทั้งหมด',
163
163
  total: 'รวม ${total} รายการ',
164
164
  selected: 'เลือก ${total} รายการ'
165
+ },
166
+ Form: {
167
+ optional: '(ไม่จำเป็น)'
165
168
  }
166
169
  }; // [i18n-Thai]
167
170
 
@@ -161,6 +161,9 @@ const local = {
161
161
  clearSelectAll: 'Tümünün seçimini kaldır',
162
162
  total: 'Toplam ${total} öğe',
163
163
  selected: '${total} öğe seçildi'
164
+ },
165
+ Form: {
166
+ optional: '(isteğe bağlı)'
164
167
  }
165
168
  }; // [i18n-Turkish]
166
169
 
@@ -161,6 +161,9 @@ const local = {
161
161
  clearSelectAll: 'Bỏ chọn tất cả',
162
162
  total: 'Tổng số ${total} mặt hàng',
163
163
  selected: '${total} mục được chọn'
164
+ },
165
+ Form: {
166
+ optional: '(không bắt buộc)'
164
167
  }
165
168
  }; // [i18n-Vietnam] 越南语
166
169
 
@@ -159,6 +159,9 @@ const local = {
159
159
  clearSelectAll: '取消全选',
160
160
  total: '共 ${total} 项',
161
161
  selected: '已选 ${total} 项'
162
+ },
163
+ Form: {
164
+ optional: '(可选)'
162
165
  }
163
166
  }; // 中文
164
167
 
@@ -159,6 +159,9 @@ const local = {
159
159
  clearSelectAll: '取消全選',
160
160
  total: '共 ${total} 項',
161
161
  selected: '已選 ${total} 項'
162
+ },
163
+ Form: {
164
+ optional: '(可選)'
162
165
  }
163
166
  }; // 中文
164
167
 
@@ -164,14 +164,6 @@ class Modal extends _baseComponent.default {
164
164
  let style = styleFromProps;
165
165
  const maskStyle = maskStyleFromProps;
166
166
  const renderFooter = 'footer' in this.props ? footer : this.renderFooter();
167
-
168
- if (this.props.centered) {
169
- style = (0, _assign.default)({
170
- transform: 'translateY(-50%)',
171
- top: '50%'
172
- }, style);
173
- }
174
-
175
167
  let wrapperStyle = {
176
168
  zIndex
177
169
  };
@@ -376,7 +376,10 @@ class ModalContent extends _baseComponent.default {
376
376
  }, this.getMaskElement(), /*#__PURE__*/_react.default.createElement("div", {
377
377
  role: "none",
378
378
  tabIndex: -1,
379
- className: "".concat(_constants.cssClasses.DIALOG, "-wrap"),
379
+ className: (0, _classnames.default)({
380
+ ["".concat(_constants.cssClasses.DIALOG, "-wrap")]: true,
381
+ ["".concat(_constants.cssClasses.DIALOG, "-wrap-center")]: this.props.centered
382
+ }),
380
383
  onClick: maskClosable ? this.onMaskClick : null,
381
384
  onMouseUp: maskClosable ? this.onMaskMouseUp : null
382
385
  }, this.getDialogElement())); // eslint-disable-next-line max-len
@@ -39,6 +39,7 @@ export interface RadioState {
39
39
  addonId?: string;
40
40
  extraId?: string;
41
41
  focusVisible?: boolean;
42
+ checked?: boolean;
42
43
  }
43
44
  export { RadioChangeEvent };
44
45
  declare class Radio extends BaseComponent<RadioProps, RadioState> {
@@ -71,6 +72,7 @@ declare class Radio extends BaseComponent<RadioProps, RadioState> {
71
72
  addonId: string;
72
73
  extraId: string;
73
74
  constructor(props: RadioProps);
75
+ componentDidUpdate(prevProps: RadioProps): void;
74
76
  get adapter(): RadioAdapter;
75
77
  isInGroup(): {
76
78
  value?: string | number;
@@ -14,6 +14,10 @@ var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
14
14
 
15
15
  var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
16
16
 
17
+ var _isBoolean2 = _interopRequireDefault(require("lodash/isBoolean"));
18
+
19
+ var _isUndefined2 = _interopRequireDefault(require("lodash/isUndefined"));
20
+
17
21
  var _noop2 = _interopRequireDefault(require("lodash/noop"));
18
22
 
19
23
  var _react = _interopRequireDefault(require("react"));
@@ -53,6 +57,7 @@ class Radio extends _baseComponent.default {
53
57
  radioGroup.onChange && radioGroup.onChange(e);
54
58
  }
55
59
 
60
+ !('checked' in this.props) && this.foundation.setChecked(e.target.checked);
56
61
  onChange && onChange(e);
57
62
  };
58
63
 
@@ -77,12 +82,23 @@ class Radio extends _baseComponent.default {
77
82
  this.state = {
78
83
  hover: false,
79
84
  addonId: props.addonId,
80
- extraId: props.extraId
85
+ extraId: props.extraId,
86
+ checked: props.checked || props.defaultChecked || false
81
87
  };
82
88
  this.foundation = new _radioFoundation.default(this.adapter);
83
89
  this.radioEntity = null;
84
90
  }
85
91
 
92
+ componentDidUpdate(prevProps) {
93
+ if (this.props.checked !== prevProps.checked) {
94
+ if ((0, _isUndefined2.default)(this.props.checked)) {
95
+ this.foundation.setChecked(false);
96
+ } else if ((0, _isBoolean2.default)(this.props.checked)) {
97
+ this.foundation.setChecked(this.props.checked);
98
+ }
99
+ }
100
+ }
101
+
86
102
  get adapter() {
87
103
  return (0, _assign.default)((0, _assign.default)({}, super.adapter), {
88
104
  setHover: hover => {
@@ -97,6 +113,11 @@ class Radio extends _baseComponent.default {
97
113
  })
98
114
  });
99
115
  },
116
+ setChecked: checked => {
117
+ this.setState({
118
+ checked
119
+ });
120
+ },
100
121
  setExtraId: () => {
101
122
  this.setState({
102
123
  extraId: (0, _uuid.getUuidShort)({
@@ -131,7 +152,6 @@ class Radio extends _baseComponent.default {
131
152
  const {
132
153
  addonClassName,
133
154
  addonStyle,
134
- checked,
135
155
  disabled,
136
156
  style,
137
157
  className,
@@ -149,9 +169,13 @@ class Radio extends _baseComponent.default {
149
169
  hover: isHover,
150
170
  addonId,
151
171
  extraId,
152
- focusVisible
172
+ focusVisible,
173
+ checked
153
174
  } = this.state;
154
- let props = {};
175
+ const props = {
176
+ checked,
177
+ disabled
178
+ };
155
179
 
156
180
  if (this.isInGroup()) {
157
181
  realChecked = this.context.radioGroup.value === propValue;
@@ -162,16 +186,17 @@ class Radio extends _baseComponent.default {
162
186
  isPureCardRadioGroup = this.context.radioGroup.isPureCardRadio;
163
187
  buttonSize = this.context.radioGroup.buttonSize;
164
188
  realPrefixCls = prefixCls || this.context.radioGroup.prefixCls;
165
- props = {
166
- checked: realChecked,
167
- disabled: isDisabled
168
- };
189
+ props.checked = realChecked;
190
+ props.disabled = isDisabled;
169
191
  } else {
170
192
  realChecked = checked;
171
193
  isDisabled = disabled;
172
194
  realMode = mode;
173
195
  isButtonRadioComponent = type === 'button';
174
196
  realPrefixCls = prefixCls;
197
+ isButtonRadioGroup = type === _constants.strings.TYPE_BUTTON;
198
+ isPureCardRadioGroup = type === _constants.strings.TYPE_PURECARD;
199
+ isCardRadioGroup = type === _constants.strings.TYPE_CARD || isPureCardRadioGroup;
175
200
  }
176
201
 
177
202
  const isButtonRadio = typeof isButtonRadioGroup === 'undefined' ? isButtonRadioComponent : isButtonRadioGroup;
@@ -124,7 +124,8 @@ class RadioGroup extends _baseComponent.default {
124
124
  return /*#__PURE__*/_react.default.createElement(_radio.default, {
125
125
  key: index,
126
126
  disabled: this.props.disabled,
127
- value: option
127
+ value: option,
128
+ type: type
128
129
  }, option);
129
130
  } else {
130
131
  return /*#__PURE__*/_react.default.createElement(_radio.default, {
@@ -133,7 +134,8 @@ class RadioGroup extends _baseComponent.default {
133
134
  value: option.value,
134
135
  extra: option.extra,
135
136
  className: option.className,
136
- style: option.style
137
+ style: option.style,
138
+ type: type
137
139
  }, option.label);
138
140
  }
139
141
  });
@@ -14,6 +14,7 @@ export interface TagGroupProps<T> {
14
14
  popoverProps?: PopoverProps;
15
15
  avatarShape?: AvatarShape;
16
16
  mode?: string;
17
+ onTagClose: (tagChildren: React.ReactNode, event: React.MouseEvent<HTMLElement>, tagKey: string | number) => void;
17
18
  }
18
19
  export default class TagGroup<T> extends PureComponent<TagGroupProps<T>> {
19
20
  static defaultProps: {
@@ -21,6 +22,7 @@ export default class TagGroup<T> extends PureComponent<TagGroupProps<T>> {
21
22
  className: string;
22
23
  size: string;
23
24
  avatarShape: string;
25
+ onTagClose: () => any;
24
26
  };
25
27
  static propTypes: {
26
28
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
@@ -31,6 +33,7 @@ export default class TagGroup<T> extends PureComponent<TagGroupProps<T>> {
31
33
  tagList: PropTypes.Requireable<any[]>;
32
34
  size: PropTypes.Requireable<string>;
33
35
  mode: PropTypes.Requireable<string>;
36
+ onTagClose: PropTypes.Requireable<(...args: any[]) => any>;
34
37
  showPopover: PropTypes.Requireable<boolean>;
35
38
  popoverProps: PropTypes.Requireable<object>;
36
39
  avatarShape: PropTypes.Requireable<string>;
@@ -100,9 +100,10 @@ class TagGroup extends _react.PureComponent {
100
100
  tagList,
101
101
  size,
102
102
  mode,
103
- avatarShape
103
+ avatarShape,
104
+ onTagClose
104
105
  } = this.props;
105
- const renderTags = (0, _map.default)(tagList).call(tagList, (tag, index) => {
106
+ const renderTags = (0, _map.default)(tagList).call(tagList, tag => {
106
107
  if (mode === 'custom') {
107
108
  return tag;
108
109
  }
@@ -115,9 +116,24 @@ class TagGroup extends _react.PureComponent {
115
116
  tag.avatarShape = avatarShape;
116
117
  }
117
118
 
118
- return /*#__PURE__*/_react.default.createElement(_index.default, (0, _assign.default)({
119
- key: "".concat(index, "-tag")
120
- }, tag));
119
+ if (!tag.tagKey) {
120
+ if (typeof tag.children === 'string' || typeof tag.children === 'number') {
121
+ tag.tagKey = tag.children;
122
+ } else {
123
+ tag.tagKey = Math.random();
124
+ }
125
+ }
126
+
127
+ return /*#__PURE__*/_react.default.createElement(_index.default, (0, _assign.default)({}, tag, {
128
+ key: tag.tagKey,
129
+ onClose: (tagChildren, e, tagKey) => {
130
+ if (tag.onClose) {
131
+ tag.onClose(tagChildren, e, tagKey);
132
+ }
133
+
134
+ onTagClose && onTagClose(tagChildren, e, tagKey);
135
+ }
136
+ }));
121
137
  });
122
138
  return renderTags;
123
139
  }
@@ -150,7 +166,8 @@ TagGroup.defaultProps = {
150
166
  style: {},
151
167
  className: '',
152
168
  size: tagSize[0],
153
- avatarShape: 'square'
169
+ avatarShape: 'square',
170
+ onTagClose: () => undefined
154
171
  };
155
172
  TagGroup.propTypes = {
156
173
  children: _propTypes.default.node,
@@ -161,6 +178,7 @@ TagGroup.propTypes = {
161
178
  tagList: _propTypes.default.array,
162
179
  size: _propTypes.default.oneOf(tagSize),
163
180
  mode: _propTypes.default.string,
181
+ onTagClose: _propTypes.default.func,
164
182
  showPopover: _propTypes.default.bool,
165
183
  popoverProps: _propTypes.default.object,
166
184
  avatarShape: _propTypes.default.oneOf(avatarShapeSet)