@douyinfe/semi-ui 2.23.0 → 2.23.2

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 (51) hide show
  1. package/dist/css/semi.css +48 -1
  2. package/dist/css/semi.min.css +1 -1
  3. package/dist/umd/semi-ui.js +52 -90
  4. package/dist/umd/semi-ui.js.map +1 -1
  5. package/dist/umd/semi-ui.min.js +1 -1
  6. package/dist/umd/semi-ui.min.js.map +1 -1
  7. package/lib/cjs/button/Button.d.ts +1 -1
  8. package/lib/cjs/button/index.d.ts +1 -1
  9. package/lib/cjs/carousel/CarouselIndicator.d.ts +1 -1
  10. package/lib/cjs/carousel/index.d.ts +1 -1
  11. package/lib/cjs/datePicker/dateInput.d.ts +1 -1
  12. package/lib/cjs/datePicker/datePicker.d.ts +1 -1
  13. package/lib/cjs/datePicker/monthsGrid.d.ts +1 -1
  14. package/lib/cjs/input/index.d.ts +0 -2
  15. package/lib/cjs/input/index.js +1 -8
  16. package/lib/cjs/locale/source/vi_VN.js +1 -1
  17. package/lib/cjs/modal/Modal.js +6 -19
  18. package/lib/cjs/radio/radio.d.ts +1 -1
  19. package/lib/cjs/radio/radioGroup.d.ts +1 -1
  20. package/lib/cjs/sideSheet/index.js +6 -19
  21. package/lib/cjs/tagInput/index.js +4 -2
  22. package/lib/cjs/transfer/index.js +30 -25
  23. package/lib/cjs/typography/base.d.ts +1 -1
  24. package/lib/cjs/typography/numeral.d.ts +2 -2
  25. package/lib/cjs/typography/paragraph.d.ts +1 -1
  26. package/lib/cjs/typography/text.d.ts +1 -1
  27. package/lib/cjs/typography/title.d.ts +1 -1
  28. package/lib/cjs/upload/index.d.ts +1 -1
  29. package/lib/es/button/Button.d.ts +1 -1
  30. package/lib/es/button/index.d.ts +1 -1
  31. package/lib/es/carousel/CarouselIndicator.d.ts +1 -1
  32. package/lib/es/carousel/index.d.ts +1 -1
  33. package/lib/es/datePicker/dateInput.d.ts +1 -1
  34. package/lib/es/datePicker/datePicker.d.ts +1 -1
  35. package/lib/es/datePicker/monthsGrid.d.ts +1 -1
  36. package/lib/es/input/index.d.ts +0 -2
  37. package/lib/es/input/index.js +1 -8
  38. package/lib/es/locale/source/vi_VN.js +1 -1
  39. package/lib/es/modal/Modal.js +6 -19
  40. package/lib/es/radio/radio.d.ts +1 -1
  41. package/lib/es/radio/radioGroup.d.ts +1 -1
  42. package/lib/es/sideSheet/index.js +6 -19
  43. package/lib/es/tagInput/index.js +4 -2
  44. package/lib/es/transfer/index.js +30 -25
  45. package/lib/es/typography/base.d.ts +1 -1
  46. package/lib/es/typography/numeral.d.ts +2 -2
  47. package/lib/es/typography/paragraph.d.ts +1 -1
  48. package/lib/es/typography/text.d.ts +1 -1
  49. package/lib/es/typography/title.d.ts +1 -1
  50. package/lib/es/upload/index.d.ts +1 -1
  51. package/package.json +7 -7
@@ -46,8 +46,6 @@ class Modal extends BaseComponent {
46
46
  visible
47
47
  } = this.props;
48
48
  this.foundation.toggleDisplayNone(!visible);
49
- const shouldRender = this.props.visible || this.props.keepDOM && (!this.props.lazyRender || this._haveRendered);
50
- this.foundation.setShouldRender(shouldRender);
51
49
  };
52
50
 
53
51
  this.renderFooter = () => {
@@ -129,8 +127,11 @@ class Modal extends BaseComponent {
129
127
  const classList = cls(className, {
130
128
  ["".concat(cssClasses.DIALOG, "-displayNone")]: keepDOM && this.state.displayNone
131
129
  });
130
+ const shouldRender = this.props.visible || this.props.keepDOM && (!this.props.lazyRender || this._haveRendered) || this.props.motion && !this.state.displayNone
131
+ /* When there is animation, we use displayNone to judge whether animation is ended and judge whether to unmount content */
132
+ ;
132
133
 
133
- if (this.state.shouldRender) {
134
+ if (shouldRender) {
134
135
  this._haveRendered = true;
135
136
  }
136
137
 
@@ -161,7 +162,7 @@ class Modal extends BaseComponent {
161
162
  animationClassName: maskAnimationClassName,
162
163
  animationEventsNeedBind: maskAnimationEventsNeedBind
163
164
  } = _ref2;
164
- return this.state.shouldRender ? /*#__PURE__*/React.createElement(ModalContent, Object.assign({}, restProps, {
165
+ return shouldRender ? /*#__PURE__*/React.createElement(ModalContent, Object.assign({}, restProps, {
165
166
  contentExtraProps: animationEventsNeedBind,
166
167
  maskExtraProps: maskAnimationEventsNeedBind,
167
168
  isFullScreen: this.state.isFullScreen,
@@ -181,8 +182,7 @@ class Modal extends BaseComponent {
181
182
 
182
183
  this.state = {
183
184
  displayNone: !props.visible,
184
- isFullScreen: props.fullScreen,
185
- shouldRender: this.props.visible || this.props.keepDOM && !this.props.lazyRender
185
+ isFullScreen: props.fullScreen
186
186
  };
187
187
  this.foundation = new ModalFoundation(this.adapter);
188
188
  this.modalRef = /*#__PURE__*/React.createRef();
@@ -237,13 +237,6 @@ class Modal extends BaseComponent {
237
237
  isFullScreen
238
238
  });
239
239
  }
240
- },
241
- setShouldRender: shouldRender => {
242
- if (shouldRender !== this.state.shouldRender) {
243
- this.setState({
244
- shouldRender
245
- });
246
- }
247
240
  }
248
241
  });
249
242
  }
@@ -289,12 +282,6 @@ class Modal extends BaseComponent {
289
282
  this.foundation.beforeShow();
290
283
  }
291
284
 
292
- const shouldRender = this.props.visible || this.props.keepDOM && (!this.props.lazyRender || this._haveRendered);
293
-
294
- if (shouldRender === true && this.state.shouldRender === false) {
295
- this.foundation.setShouldRender(true);
296
- }
297
-
298
285
  if (!prevState.displayNone && this.state.displayNone) {
299
286
  this.foundation.afterHide();
300
287
  }
@@ -82,7 +82,7 @@ declare class Radio extends BaseComponent<RadioProps, RadioState> {
82
82
  prefixCls?: string;
83
83
  name?: string;
84
84
  onChange?: (e: RadioChangeEvent) => void;
85
- buttonSize?: "small" | "middle" | "large";
85
+ buttonSize?: "small" | "large" | "middle";
86
86
  isCardRadio?: boolean;
87
87
  isPureCardRadio?: boolean;
88
88
  };
@@ -48,7 +48,7 @@ declare class RadioGroup extends BaseComponent<RadioGroupProps, RadioGroupState>
48
48
  disabled: PropTypes.Requireable<boolean>;
49
49
  name: PropTypes.Requireable<string>;
50
50
  options: PropTypes.Requireable<any[]>;
51
- buttonSize: PropTypes.Requireable<"small" | "middle" | "large">;
51
+ buttonSize: PropTypes.Requireable<"small" | "large" | "middle">;
52
52
  type: PropTypes.Requireable<"default" | "button" | "card" | "pureCard">;
53
53
  value: PropTypes.Requireable<any>;
54
54
  onChange: PropTypes.Requireable<(...args: any[]) => any>;
@@ -40,14 +40,11 @@ export default class SideSheet extends BaseComponent {
40
40
  };
41
41
 
42
42
  this.updateState = () => {
43
- const shouldRender = this.props.visible || this.props.keepDOM;
44
- this.foundation.setShouldRender(shouldRender);
45
43
  this.foundation.toggleDisplayNone(!this.props.visible);
46
44
  };
47
45
 
48
46
  this.state = {
49
- displayNone: !this.props.visible,
50
- shouldRender: this.props.visible
47
+ displayNone: !this.props.visible
51
48
  };
52
49
  this.foundation = new SideSheetFoundation(this.adapter);
53
50
  }
@@ -94,13 +91,6 @@ export default class SideSheet extends BaseComponent {
94
91
  displayNone: displayNone
95
92
  });
96
93
  }
97
- },
98
- setShouldRender: shouldRender => {
99
- if (shouldRender !== this.state.shouldRender) {
100
- this.setState({
101
- shouldRender
102
- });
103
- }
104
94
  }
105
95
  });
106
96
  }
@@ -136,12 +126,6 @@ export default class SideSheet extends BaseComponent {
136
126
  this.foundation.afterHide();
137
127
  }
138
128
 
139
- const shouldRender = this.props.visible || this.props.keepDOM;
140
-
141
- if (shouldRender === true && this.state.shouldRender === false) {
142
- this.foundation.setShouldRender(true);
143
- }
144
-
145
129
  if (prevState.displayNone !== this.state.displayNone) {
146
130
  this.foundation.onVisibleChange(!this.state.displayNone);
147
131
  }
@@ -193,7 +177,10 @@ export default class SideSheet extends BaseComponent {
193
177
  width: sheetWidth,
194
178
  height: sheetHeight,
195
179
  onClose: this.handleCancel
196
- }); // Since user could change animate duration , we don't know which animation end first. So we call updateState func twice.
180
+ });
181
+ const shouldRender = this.props.visible || this.props.keepDOM || this.props.motion && !this.state.displayNone
182
+ /* When there is animation, we use displayNone to judge whether animation is ended and judge whether to unmount content */
183
+ ; // Since user could change animate duration , we don't know which animation end first. So we call updateState func twice.
197
184
 
198
185
  return /*#__PURE__*/React.createElement(CSSAnimation, {
199
186
  motion: this.props.motion,
@@ -218,7 +205,7 @@ export default class SideSheet extends BaseComponent {
218
205
  animationStyle,
219
206
  animationEventsNeedBind
220
207
  } = _ref2;
221
- return this.state.shouldRender ? /*#__PURE__*/React.createElement(SideSheetContent, Object.assign({}, contentProps, {
208
+ return shouldRender ? /*#__PURE__*/React.createElement(SideSheetContent, Object.assign({}, contentProps, {
222
209
  maskExtraProps: maskAnimationEventsNeedBind,
223
210
  wrapperExtraProps: animationEventsNeedBind,
224
211
  dialogClassName: animationClassName,
@@ -420,9 +420,11 @@ class TagInput extends BaseComponent {
420
420
  }));
421
421
 
422
422
  if (active && draggable && sortableListItems.length > 0) {
423
+ // helperClass:add styles to the helper(item being dragged) https://github.com/clauderic/react-sortable-hoc/issues/87
423
424
  // @ts-ignore skip SortableItem type check
424
425
  return /*#__PURE__*/React.createElement(SortableList, {
425
426
  useDragHandle: true,
427
+ helperClass: "".concat(prefixCls, "-drag-item-move"),
426
428
  items: sortableListItems,
427
429
  onSortEnd: this.onSortEnd,
428
430
  axis: "xy"
@@ -482,8 +484,8 @@ class TagInput extends BaseComponent {
482
484
  ["".concat(prefixCls, "-error")]: validateStatus === 'error',
483
485
  ["".concat(prefixCls, "-warning")]: validateStatus === 'warning'
484
486
  });
485
- const inputCls = cls("".concat(prefixCls, "-wrapper-input"));
486
- const wrapperCls = cls("".concat(prefixCls, "-wrapper"));
487
+ const inputCls = cls("".concat(prefixCls, "-wrapper-input"), "".concat(prefixCls, "-wrapper-input-").concat(size));
488
+ const wrapperCls = cls("".concat(prefixCls, "-wrapper"), "".concat(prefixCls, "-wrapper-").concat(size));
487
489
  return (
488
490
  /*#__PURE__*/
489
491
  // eslint-disable-next-line
@@ -19,7 +19,30 @@ import Spin from '../spin';
19
19
  import Button from '../button';
20
20
  import Tree from '../tree';
21
21
  import { IconClose, IconSearch, IconHandle } from '@douyinfe/semi-icons';
22
- const prefixcls = cssClasses.PREFIX;
22
+ const prefixcls = cssClasses.PREFIX; // SortableItem & SortableList should not be assigned inside of the render function
23
+
24
+ const SortableItem = SortableElement(props => props.item.node);
25
+ const SortableList = SortableContainer(_ref => {
26
+ let {
27
+ items
28
+ } = _ref;
29
+ return /*#__PURE__*/React.createElement("div", {
30
+ className: "".concat(prefixcls, "-right-list"),
31
+ role: "list",
32
+ "aria-label": "Selected list"
33
+ }, items.map((item, index) =>
34
+ /*#__PURE__*/
35
+ // @ts-ignore skip SortableItem type check
36
+ React.createElement(SortableItem, {
37
+ key: item.label,
38
+ index: index,
39
+ item: item
40
+ }))) // eslint-disable-next-line @typescript-eslint/ban-ts-comment
41
+ // @ts-ignore see reasons: https://github.com/clauderic/react-sortable-hoc/issues/206
42
+ ;
43
+ }, {
44
+ distance: 10
45
+ });
23
46
 
24
47
  class Transfer extends BaseComponent {
25
48
  constructor(props) {
@@ -462,34 +485,16 @@ class Transfer extends BaseComponent {
462
485
  }
463
486
 
464
487
  renderRightSortableList(selectedData) {
465
- // when choose some items && draggable is true
466
- const SortableItem = SortableElement(props => this.renderRightItem(props.item));
467
- const SortableList = SortableContainer(_ref => {
468
- let {
469
- items
470
- } = _ref;
471
- return /*#__PURE__*/React.createElement("div", {
472
- className: "".concat(prefixcls, "-right-list"),
473
- role: "list",
474
- "aria-label": "Selected list"
475
- }, items.map((item, index) =>
476
- /*#__PURE__*/
477
- // @ts-ignore skip SortableItem type check
478
- React.createElement(SortableItem, {
479
- key: item.label,
480
- index: index,
481
- item: item
482
- }))) // eslint-disable-next-line @typescript-eslint/ban-ts-comment
483
- // @ts-ignore see reasons: https://github.com/clauderic/react-sortable-hoc/issues/206
484
- ;
485
- }, {
486
- distance: 10
487
- }); // @ts-ignore skip SortableItem type check
488
+ const sortableListItems = selectedData.map(item => Object.assign(Object.assign({}, item), {
489
+ node: this.renderRightItem(item)
490
+ })); // helperClass:add styles to the helper(item being dragged) https://github.com/clauderic/react-sortable-hoc/issues/87
491
+ // @ts-ignore skip SortableItem type check
488
492
 
489
493
  const sortList = /*#__PURE__*/React.createElement(SortableList, {
490
494
  useDragHandle: true,
495
+ helperClass: "".concat(prefixcls, "-right-item-drag-item-move"),
491
496
  onSortEnd: this.onSortEnd,
492
- items: selectedData
497
+ items: sortableListItems
493
498
  });
494
499
  return sortList;
495
500
  }
@@ -64,7 +64,7 @@ export default class Base extends Component<BaseTypographyProps, BaseTypographyS
64
64
  spacing: PropTypes.Requireable<"normal" | "extended">;
65
65
  strong: PropTypes.Requireable<boolean>;
66
66
  size: PropTypes.Requireable<"small" | "normal">;
67
- type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
67
+ type: PropTypes.Requireable<"warning" | "success" | "primary" | "secondary" | "tertiary" | "danger" | "quaternary">;
68
68
  style: PropTypes.Requireable<object>;
69
69
  className: PropTypes.Requireable<string>;
70
70
  icon: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
@@ -28,7 +28,7 @@ export default class Numeral extends PureComponent<NumeralProps> {
28
28
  static propTypes: {
29
29
  rule: PropTypes.Requireable<"text" | "numbers" | "bytes-decimal" | "bytes-binary" | "percentages" | "exponential">;
30
30
  precision: PropTypes.Requireable<number>;
31
- truncate: PropTypes.Requireable<"ceil" | "floor" | "round">;
31
+ truncate: PropTypes.Requireable<"round" | "ceil" | "floor">;
32
32
  parser: PropTypes.Requireable<(...args: any[]) => any>;
33
33
  copyable: PropTypes.Requireable<NonNullable<boolean | object>>;
34
34
  delete: PropTypes.Requireable<boolean>;
@@ -38,7 +38,7 @@ export default class Numeral extends PureComponent<NumeralProps> {
38
38
  underline: PropTypes.Requireable<boolean>;
39
39
  link: PropTypes.Requireable<NonNullable<boolean | object>>;
40
40
  strong: PropTypes.Requireable<boolean>;
41
- type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
41
+ type: PropTypes.Requireable<"warning" | "success" | "primary" | "secondary" | "tertiary" | "danger" | "quaternary">;
42
42
  size: PropTypes.Requireable<"small" | "normal">;
43
43
  style: PropTypes.Requireable<object>;
44
44
  className: PropTypes.Requireable<string>;
@@ -29,7 +29,7 @@ export default class Paragraph extends PureComponent<ParagraphProps> {
29
29
  link: PropTypes.Requireable<NonNullable<boolean | object>>;
30
30
  underline: PropTypes.Requireable<boolean>;
31
31
  strong: PropTypes.Requireable<boolean>;
32
- type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
32
+ type: PropTypes.Requireable<"warning" | "success" | "primary" | "secondary" | "tertiary" | "danger" | "quaternary">;
33
33
  size: PropTypes.Requireable<"small" | "normal">;
34
34
  spacing: PropTypes.Requireable<"normal" | "extended">;
35
35
  style: PropTypes.Requireable<object>;
@@ -32,7 +32,7 @@ export default class Text extends PureComponent<TextProps> {
32
32
  underline: PropTypes.Requireable<boolean>;
33
33
  link: PropTypes.Requireable<NonNullable<boolean | object>>;
34
34
  strong: PropTypes.Requireable<boolean>;
35
- type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
35
+ type: PropTypes.Requireable<"warning" | "success" | "primary" | "secondary" | "tertiary" | "danger" | "quaternary">;
36
36
  size: PropTypes.Requireable<"small" | "normal">;
37
37
  style: PropTypes.Requireable<object>;
38
38
  className: PropTypes.Requireable<string>;
@@ -36,7 +36,7 @@ export default class Title extends PureComponent<TitleProps> {
36
36
  link: PropTypes.Requireable<NonNullable<boolean | object>>;
37
37
  underline: PropTypes.Requireable<boolean>;
38
38
  strong: PropTypes.Requireable<boolean>;
39
- type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
39
+ type: PropTypes.Requireable<"warning" | "success" | "primary" | "secondary" | "tertiary" | "danger" | "quaternary">;
40
40
  heading: PropTypes.Requireable<1 | 2 | 3 | 4 | 6 | 5>;
41
41
  style: PropTypes.Requireable<object>;
42
42
  className: PropTypes.Requireable<string>;
@@ -142,7 +142,7 @@ declare class Upload extends BaseComponent<UploadProps, UploadState> {
142
142
  style: PropTypes.Requireable<object>;
143
143
  timeout: PropTypes.Requireable<number>;
144
144
  transformFile: PropTypes.Requireable<(...args: any[]) => any>;
145
- uploadTrigger: PropTypes.Requireable<"auto" | "custom">;
145
+ uploadTrigger: PropTypes.Requireable<"custom" | "auto">;
146
146
  validateMessage: PropTypes.Requireable<PropTypes.ReactNodeLike>;
147
147
  validateStatus: PropTypes.Requireable<"default" | "error" | "warning" | "success">;
148
148
  withCredentials: PropTypes.Requireable<boolean>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.23.0",
3
+ "version": "2.23.2",
4
4
  "description": "",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es/index.js",
@@ -18,11 +18,11 @@
18
18
  ],
19
19
  "dependencies": {
20
20
  "@douyinfe/semi-animation": "2.12.0",
21
- "@douyinfe/semi-animation-react": "2.23.0",
22
- "@douyinfe/semi-foundation": "2.23.0",
23
- "@douyinfe/semi-icons": "2.23.0",
21
+ "@douyinfe/semi-animation-react": "2.23.2",
22
+ "@douyinfe/semi-foundation": "2.23.2",
23
+ "@douyinfe/semi-icons": "2.23.2",
24
24
  "@douyinfe/semi-illustrations": "2.15.0",
25
- "@douyinfe/semi-theme-default": "2.23.0",
25
+ "@douyinfe/semi-theme-default": "2.23.2",
26
26
  "async-validator": "^3.5.0",
27
27
  "classnames": "^2.2.6",
28
28
  "copy-text-to-clipboard": "^2.1.1",
@@ -69,13 +69,13 @@
69
69
  ],
70
70
  "author": "",
71
71
  "license": "MIT",
72
- "gitHead": "a5195872c7df1a97551c6c23357bdb941b8fa807",
72
+ "gitHead": "b7fc3d0d2fe9dafb8e3ec4706b9a68212bb5f6bc",
73
73
  "devDependencies": {
74
74
  "@babel/plugin-proposal-decorators": "^7.15.8",
75
75
  "@babel/plugin-transform-runtime": "^7.15.8",
76
76
  "@babel/preset-env": "^7.15.8",
77
77
  "@babel/preset-react": "^7.14.5",
78
- "@douyinfe/semi-scss-compile": "2.23.0",
78
+ "@douyinfe/semi-scss-compile": "2.23.2",
79
79
  "@storybook/addon-knobs": "^6.3.1",
80
80
  "@types/lodash": "^4.14.176",
81
81
  "@types/react": ">=16.0.0",