@douyinfe/semi-ui 2.10.4 → 2.10.5

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 (108) hide show
  1. package/cascader/index.tsx +16 -15
  2. package/checkbox/checkbox.tsx +1 -0
  3. package/checkbox/checkboxInner.tsx +10 -1
  4. package/datePicker/datePicker.tsx +7 -4
  5. package/dist/umd/semi-ui.js +194 -51
  6. package/dist/umd/semi-ui.js.map +1 -1
  7. package/dist/umd/semi-ui.min.js +1 -1
  8. package/dist/umd/semi-ui.min.js.map +1 -1
  9. package/input/index.tsx +5 -1
  10. package/inputNumber/index.tsx +5 -2
  11. package/lib/cjs/cascader/index.d.ts +1 -0
  12. package/lib/cjs/cascader/index.js +9 -2
  13. package/lib/cjs/checkbox/checkbox.d.ts +1 -0
  14. package/lib/cjs/checkbox/checkbox.js +2 -1
  15. package/lib/cjs/checkbox/checkboxInner.d.ts +8 -0
  16. package/lib/cjs/checkbox/checkboxInner.js +11 -2
  17. package/lib/cjs/datePicker/datePicker.d.ts +1 -0
  18. package/lib/cjs/datePicker/datePicker.js +21 -5
  19. package/lib/cjs/form/baseForm.d.ts +2 -1
  20. package/lib/cjs/form/field.d.ts +2 -1
  21. package/lib/cjs/input/index.d.ts +2 -0
  22. package/lib/cjs/input/index.js +11 -4
  23. package/lib/cjs/inputNumber/index.d.ts +1 -0
  24. package/lib/cjs/inputNumber/index.js +8 -2
  25. package/lib/cjs/modal/ModalContent.d.ts +1 -0
  26. package/lib/cjs/modal/ModalContent.js +14 -3
  27. package/lib/cjs/modal/confirm.d.ts +5 -0
  28. package/lib/cjs/radio/radio.d.ts +5 -0
  29. package/lib/cjs/radio/radio.js +2 -1
  30. package/lib/cjs/radio/radioInner.d.ts +8 -0
  31. package/lib/cjs/radio/radioInner.js +11 -2
  32. package/lib/cjs/rating/index.d.ts +2 -0
  33. package/lib/cjs/rating/index.js +12 -5
  34. package/lib/cjs/rating/item.d.ts +10 -0
  35. package/lib/cjs/rating/item.js +4 -1
  36. package/lib/cjs/select/index.d.ts +2 -0
  37. package/lib/cjs/select/index.js +15 -3
  38. package/lib/cjs/tabs/index.d.ts +1 -0
  39. package/lib/cjs/tabs/index.js +2 -1
  40. package/lib/cjs/tabs/interface.d.ts +1 -0
  41. package/lib/cjs/tagInput/index.d.ts +2 -0
  42. package/lib/cjs/tagInput/index.js +13 -4
  43. package/lib/cjs/timePicker/TimeInput.d.ts +2 -1
  44. package/lib/cjs/timePicker/TimeInput.js +7 -3
  45. package/lib/cjs/timePicker/TimePicker.d.ts +2 -0
  46. package/lib/cjs/timePicker/TimePicker.js +2 -1
  47. package/lib/cjs/timePicker/index.d.ts +1 -0
  48. package/lib/cjs/tooltip/index.d.ts +3 -0
  49. package/lib/cjs/tooltip/index.js +8 -2
  50. package/lib/cjs/tree/index.d.ts +1 -0
  51. package/lib/cjs/tree/index.js +9 -2
  52. package/lib/cjs/typography/title.d.ts +1 -1
  53. package/lib/es/cascader/index.d.ts +1 -0
  54. package/lib/es/cascader/index.js +9 -2
  55. package/lib/es/checkbox/checkbox.d.ts +1 -0
  56. package/lib/es/checkbox/checkbox.js +2 -1
  57. package/lib/es/checkbox/checkboxInner.d.ts +8 -0
  58. package/lib/es/checkbox/checkboxInner.js +11 -2
  59. package/lib/es/datePicker/datePicker.d.ts +1 -0
  60. package/lib/es/datePicker/datePicker.js +21 -5
  61. package/lib/es/form/baseForm.d.ts +2 -1
  62. package/lib/es/form/field.d.ts +2 -1
  63. package/lib/es/input/index.d.ts +2 -0
  64. package/lib/es/input/index.js +11 -4
  65. package/lib/es/inputNumber/index.d.ts +1 -0
  66. package/lib/es/inputNumber/index.js +8 -2
  67. package/lib/es/modal/ModalContent.d.ts +1 -0
  68. package/lib/es/modal/ModalContent.js +14 -3
  69. package/lib/es/modal/confirm.d.ts +5 -0
  70. package/lib/es/radio/radio.d.ts +5 -0
  71. package/lib/es/radio/radio.js +2 -1
  72. package/lib/es/radio/radioInner.d.ts +8 -0
  73. package/lib/es/radio/radioInner.js +11 -2
  74. package/lib/es/rating/index.d.ts +2 -0
  75. package/lib/es/rating/index.js +12 -5
  76. package/lib/es/rating/item.d.ts +10 -0
  77. package/lib/es/rating/item.js +4 -1
  78. package/lib/es/select/index.d.ts +2 -0
  79. package/lib/es/select/index.js +15 -3
  80. package/lib/es/tabs/index.d.ts +1 -0
  81. package/lib/es/tabs/index.js +2 -1
  82. package/lib/es/tabs/interface.d.ts +1 -0
  83. package/lib/es/tagInput/index.d.ts +2 -0
  84. package/lib/es/tagInput/index.js +13 -4
  85. package/lib/es/timePicker/TimeInput.d.ts +2 -1
  86. package/lib/es/timePicker/TimeInput.js +7 -3
  87. package/lib/es/timePicker/TimePicker.d.ts +2 -0
  88. package/lib/es/timePicker/TimePicker.js +2 -1
  89. package/lib/es/timePicker/index.d.ts +1 -0
  90. package/lib/es/tooltip/index.d.ts +3 -0
  91. package/lib/es/tooltip/index.js +9 -2
  92. package/lib/es/tree/index.d.ts +1 -0
  93. package/lib/es/tree/index.js +9 -2
  94. package/lib/es/typography/title.d.ts +1 -1
  95. package/modal/ModalContent.tsx +6 -3
  96. package/package.json +9 -9
  97. package/radio/radio.tsx +5 -0
  98. package/radio/radioInner.tsx +10 -1
  99. package/rating/index.tsx +6 -4
  100. package/rating/item.tsx +11 -0
  101. package/select/index.tsx +6 -2
  102. package/tabs/index.tsx +1 -0
  103. package/tabs/interface.ts +1 -0
  104. package/tagInput/index.tsx +6 -3
  105. package/timePicker/TimeInput.tsx +5 -3
  106. package/timePicker/TimePicker.tsx +2 -0
  107. package/tooltip/index.tsx +5 -1
  108. package/tree/index.tsx +3 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.10.4",
3
+ "version": "2.10.5",
4
4
  "description": "",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es/index.js",
@@ -14,12 +14,12 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "@babel/runtime-corejs3": "^7.15.4",
17
- "@douyinfe/semi-animation": "2.10.4",
18
- "@douyinfe/semi-animation-react": "2.10.4",
19
- "@douyinfe/semi-foundation": "2.10.4",
20
- "@douyinfe/semi-icons": "2.10.4",
21
- "@douyinfe/semi-illustrations": "2.10.4",
22
- "@douyinfe/semi-theme-default": "2.10.4",
17
+ "@douyinfe/semi-animation": "2.10.5",
18
+ "@douyinfe/semi-animation-react": "2.10.5",
19
+ "@douyinfe/semi-foundation": "2.10.5",
20
+ "@douyinfe/semi-icons": "2.10.5",
21
+ "@douyinfe/semi-illustrations": "2.10.5",
22
+ "@douyinfe/semi-theme-default": "2.10.5",
23
23
  "@types/react-window": "^1.8.2",
24
24
  "async-validator": "^3.5.0",
25
25
  "classnames": "^2.2.6",
@@ -69,13 +69,13 @@
69
69
  ],
70
70
  "author": "",
71
71
  "license": "MIT",
72
- "gitHead": "5c0370819f1ab319ceded2fbf0c9c7a12e4f1b77",
72
+ "gitHead": "17a549be94b38a44d7cd9a4d3f77c23da7df460a",
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.10.4",
78
+ "@douyinfe/semi-scss-compile": "2.10.5",
79
79
  "@storybook/addon-knobs": "^6.3.1",
80
80
  "@types/lodash": "^4.14.176",
81
81
  "babel-loader": "^8.2.2",
package/radio/radio.tsx CHANGED
@@ -41,6 +41,10 @@ export type RadioProps = {
41
41
  addonClassName?: string;
42
42
  type?: RadioType;
43
43
  'aria-label'?: React.AriaAttributes['aria-label'];
44
+ addonId?: string;
45
+ extraId?: string;
46
+ name?: string;
47
+ preventScroll?: boolean;
44
48
  };
45
49
 
46
50
  export interface RadioState {
@@ -71,6 +75,7 @@ class Radio extends BaseComponent<RadioProps, RadioState> {
71
75
  addonClassName: PropTypes.string,
72
76
  type: PropTypes.oneOf([strings.TYPE_DEFAULT, strings.TYPE_BUTTON, strings.TYPE_CARD, strings.TYPE_PURECARD]), // Button style type
73
77
  'aria-label': PropTypes.string,
78
+ preventScroll: PropTypes.bool,
74
79
  };
75
80
 
76
81
  static defaultProps: Partial<RadioProps> = {
@@ -23,6 +23,10 @@ export interface RadioInnerProps extends BaseProps {
23
23
  addonId?: string;
24
24
  extraId?: string;
25
25
  'aria-label'?: React.AriaAttributes['aria-label'];
26
+ focusInner?: boolean;
27
+ onInputFocus?: (e: any) => void;
28
+ onInputBlur?: (e: any) => void;
29
+ preventScroll?: boolean;
26
30
  }
27
31
 
28
32
  interface RadioInnerState {
@@ -39,6 +43,10 @@ class RadioInner extends BaseComponent<RadioInnerProps, RadioInnerState> {
39
43
  onChange: PropTypes.func,
40
44
  mode: PropTypes.oneOf(['advanced', '']),
41
45
  'aria-label': PropTypes.string,
46
+ focusInner: PropTypes.bool,
47
+ onInputFocus: PropTypes.func,
48
+ onInputBlur: PropTypes.func,
49
+ preventScroll: PropTypes.bool,
42
50
  };
43
51
 
44
52
  static defaultProps = {
@@ -89,7 +97,8 @@ class RadioInner extends BaseComponent<RadioInnerProps, RadioInnerState> {
89
97
  }
90
98
 
91
99
  focus() {
92
- this.inputEntity.focus();
100
+ const { preventScroll } = this.props;
101
+ this.inputEntity.focus({ preventScroll });
93
102
  }
94
103
 
95
104
  onChange(e: React.ChangeEvent<HTMLInputElement>) {
package/rating/index.tsx CHANGED
@@ -41,6 +41,7 @@ export interface RatingProps {
41
41
  size?: 'small' | 'default' | number;
42
42
  tooltips?: string[];
43
43
  id?: string;
44
+ preventScroll?: boolean;
44
45
  }
45
46
 
46
47
  export interface RatingState {
@@ -79,6 +80,7 @@ export default class Rating extends BaseComponent<RatingProps, RatingState> {
79
80
  size: PropTypes.oneOfType([PropTypes.oneOf(strings.SIZE_SET), PropTypes.number]),
80
81
  tooltips: PropTypes.arrayOf(PropTypes.string),
81
82
  id: PropTypes.string,
83
+ preventScroll: PropTypes.bool,
82
84
  };
83
85
 
84
86
  static defaultProps = {
@@ -127,9 +129,9 @@ export default class Rating extends BaseComponent<RatingProps, RatingState> {
127
129
  return {
128
130
  ...super.adapter,
129
131
  focus: () => {
130
- const { disabled } = this.props;
132
+ const { disabled, preventScroll } = this.props;
131
133
  if (!disabled) {
132
- this.rate.focus();
134
+ this.rate.focus({ preventScroll });
133
135
  }
134
136
  },
135
137
  getStarDOM: (index: number) => {
@@ -217,9 +219,9 @@ export default class Rating extends BaseComponent<RatingProps, RatingState> {
217
219
  };
218
220
 
219
221
  focus = () => {
220
- const { disabled } = this.props;
222
+ const { disabled, preventScroll } = this.props;
221
223
  if (!disabled) {
222
- this.rate.focus();
224
+ this.rate.focus({ preventScroll });
223
225
  }
224
226
  };
225
227
 
package/rating/item.tsx CHANGED
@@ -21,6 +21,14 @@ export interface RatingItemProps {
21
21
  count: number;
22
22
  size: number | ArrayElement<typeof strings.SIZE_SET>;
23
23
  'aria-describedby'?: React.AriaAttributes['aria-describedby'];
24
+ onFocus?: (e: React.FocusEvent) => void;
25
+ onBlur?: (e: React.FocusEvent) => void;
26
+ preventScroll?: boolean;
27
+ }
28
+
29
+ export interface RatingItemState {
30
+ firstStarFocus: boolean,
31
+ secondStarFocus: boolean,
24
32
  }
25
33
 
26
34
  export default class Item extends PureComponent<RatingItemProps> {
@@ -40,6 +48,9 @@ export default class Item extends PureComponent<RatingItemProps> {
40
48
  PropTypes.number,
41
49
  ]),
42
50
  'aria-describedby': PropTypes.string,
51
+ onFocus: PropTypes.func,
52
+ onBlur: PropTypes.func,
53
+ preventScroll: PropTypes.bool,
43
54
  };
44
55
 
45
56
  onHover: React.MouseEventHandler = e => {
package/select/index.tsx CHANGED
@@ -152,6 +152,7 @@ export type SelectProps = {
152
152
  onBlur?: (e: React.FocusEvent) => void;
153
153
  onListScroll?: (e: React.UIEvent<HTMLDivElement>) => void;
154
154
  children?: React.ReactNode;
155
+ preventScroll?: boolean;
155
156
  } & Pick<
156
157
  TooltipProps,
157
158
  | 'spacing'
@@ -271,6 +272,7 @@ class Select extends BaseComponent<SelectProps, SelectState> {
271
272
  renderOptionItem: PropTypes.func,
272
273
  onListScroll: PropTypes.func,
273
274
  arrowIcon: PropTypes.node,
275
+ preventScroll: PropTypes.bool,
274
276
  // open: PropTypes.bool,
275
277
  // tagClosable: PropTypes.bool,
276
278
  };
@@ -396,8 +398,9 @@ class Select extends BaseComponent<SelectProps, SelectState> {
396
398
  });
397
399
  },
398
400
  focusInput: () => {
401
+ const { preventScroll } = this.props;
399
402
  if (this.inputRef && this.inputRef.current) {
400
- this.inputRef.current.focus();
403
+ this.inputRef.current.focus({ preventScroll });
401
404
  }
402
405
  },
403
406
  };
@@ -526,8 +529,9 @@ class Select extends BaseComponent<SelectProps, SelectState> {
526
529
  },
527
530
  focusTrigger: () => {
528
531
  try {
532
+ const { preventScroll } = this.props;
529
533
  const el = (this.triggerRef.current) as any;
530
- el.focus();
534
+ el.focus({ preventScroll });
531
535
  } catch (error) {
532
536
 
533
537
  }
package/tabs/index.tsx CHANGED
@@ -48,6 +48,7 @@ class Tabs extends BaseComponent<TabsProps, TabsState> {
48
48
  tabPosition: PropTypes.oneOf(strings.POSITION_MAP),
49
49
  type: PropTypes.oneOf(strings.TYPE_MAP),
50
50
  onTabClose: PropTypes.func,
51
+ preventScroll: PropTypes.bool,
51
52
  };
52
53
 
53
54
  static defaultProps: TabsProps = {
package/tabs/interface.ts CHANGED
@@ -36,6 +36,7 @@ export interface TabsProps {
36
36
  tabPosition?: TabPosition;
37
37
  type?: TabType;
38
38
  onTabClose?: (tabKey: string) => void;
39
+ preventScroll?: boolean;
39
40
  }
40
41
 
41
42
  export interface TabBarProps {
@@ -58,6 +58,7 @@ export interface TagInputProps {
58
58
  value?: string[] | undefined;
59
59
  autoFocus?: boolean;
60
60
  'aria-label'?: string;
61
+ preventScroll?: boolean;
61
62
  }
62
63
 
63
64
  export interface TagInputState {
@@ -105,6 +106,7 @@ class TagInput extends BaseComponent<TagInputProps, TagInputState> {
105
106
  prefix: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
106
107
  suffix: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
107
108
  'aria-label': PropTypes.string,
109
+ preventScroll: PropTypes.bool,
108
110
  };
109
111
 
110
112
  static defaultProps = {
@@ -198,9 +200,9 @@ class TagInput extends BaseComponent<TagInputProps, TagInputState> {
198
200
  }
199
201
 
200
202
  componentDidMount() {
201
- const { disabled, autoFocus } = this.props;
203
+ const { disabled, autoFocus, preventScroll } = this.props;
202
204
  if (!disabled && autoFocus) {
203
- this.inputRef.current.focus();
205
+ this.inputRef.current.focus({ preventScroll });
204
206
  }
205
207
  }
206
208
 
@@ -381,7 +383,8 @@ class TagInput extends BaseComponent<TagInputProps, TagInputState> {
381
383
  }
382
384
 
383
385
  focus() {
384
- this.inputRef.current.focus();
386
+ const { preventScroll } = this.props;
387
+ this.inputRef.current.focus({ preventScroll });
385
388
  }
386
389
 
387
390
  render() {
@@ -33,7 +33,8 @@ export type TimeInputProps = Pick<TimePickerProps,
33
33
  'locale' |
34
34
  'localeCode' |
35
35
  'insetLabel' |
36
- 'validateStatus'> & BaseProps & {
36
+ 'validateStatus' |
37
+ 'preventScroll'> & BaseProps & {
37
38
  onChange?: (value: string) => void;
38
39
  onEsc?: () => void;
39
40
  onClick?: React.MouseEventHandler;
@@ -69,6 +70,7 @@ class TimeInput extends BaseComponent<TimeInputProps, any> {
69
70
  localeCode: PropTypes.string,
70
71
  insetLabel: PropTypes.node,
71
72
  validateStatus: PropTypes.string,
73
+ preventScroll: PropTypes.bool,
72
74
  };
73
75
 
74
76
  static defaultProps = {
@@ -96,13 +98,13 @@ class TimeInput extends BaseComponent<TimeInputProps, any> {
96
98
 
97
99
  componentDidMount() {
98
100
  super.componentDidMount();
99
- const { focusOnOpen } = this.props;
101
+ const { focusOnOpen, preventScroll } = this.props;
100
102
  if (focusOnOpen) {
101
103
  const requestAnimationFrame = window.requestAnimationFrame || window.setTimeout;
102
104
  requestAnimationFrame(() => {
103
105
  const inputNode = this.adapter.getCache('inputNode');
104
106
  if (inputNode) {
105
- inputNode.focus();
107
+ inputNode.focus({ preventScroll });
106
108
  inputNode.select();
107
109
  }
108
110
  });
@@ -75,6 +75,7 @@ export type TimePickerProps = {
75
75
  popupStyle?: React.CSSProperties;
76
76
  position?: Position;
77
77
  prefixCls?: string;
78
+ preventScroll?: boolean;
78
79
  rangeSeparator?: string;
79
80
  scrollItemProps?: ScrollItemProps<any>;
80
81
  secondStep?: number;
@@ -164,6 +165,7 @@ export default class TimePicker extends BaseComponent<TimePickerProps, TimePicke
164
165
  autoAdjustOverflow: PropTypes.bool,
165
166
  ...PanelShape,
166
167
  inputStyle: PropTypes.object,
168
+ preventScroll: PropTypes.bool,
167
169
  };
168
170
 
169
171
  static defaultProps = {
package/tooltip/index.tsx CHANGED
@@ -75,6 +75,8 @@ export interface TooltipProps extends BaseProps {
75
75
  guardFocus?: boolean;
76
76
  returnFocusOnClose?: boolean;
77
77
  onEscKeyDown?: (e: React.KeyboardEvent) => void;
78
+ wrapperId?: string;
79
+ preventScroll?: boolean;
78
80
  }
79
81
  interface TooltipState {
80
82
  visible: boolean;
@@ -135,6 +137,7 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
135
137
  wrapWhenSpecial: PropTypes.bool, // when trigger has special status such as "disabled" or "loading", wrap span
136
138
  guardFocus: PropTypes.bool,
137
139
  returnFocusOnClose: PropTypes.bool,
140
+ preventScroll: PropTypes.bool,
138
141
  };
139
142
 
140
143
  static defaultProps = {
@@ -421,9 +424,10 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
421
424
  return getActiveElement();
422
425
  },
423
426
  setInitialFocus: () => {
427
+ const { preventScroll } = this.props;
424
428
  const focusRefNode = get(this, 'initialFocusRef.current');
425
429
  if (focusRefNode && 'focus' in focusRefNode) {
426
- focusRefNode.focus();
430
+ focusRefNode.focus({ preventScroll });
427
431
  }
428
432
  },
429
433
  notifyEscKeydown: (event: React.KeyboardEvent) => {
package/tree/index.tsx CHANGED
@@ -114,6 +114,7 @@ class Tree extends BaseComponent<TreeProps, TreeState> {
114
114
  labelEllipsis: PropTypes.bool,
115
115
  checkRelation: PropTypes.string,
116
116
  'aria-label': PropTypes.string,
117
+ preventScroll: PropTypes.bool,
117
118
  };
118
119
 
119
120
  static defaultProps = {
@@ -445,8 +446,9 @@ class Tree extends BaseComponent<TreeProps, TreeState> {
445
446
  this.setState({ inputValue: value });
446
447
  },
447
448
  focusInput: () => {
449
+ const { preventScroll } = this.props;
448
450
  if (this.inputRef && this.inputRef.current) {
449
- (this.inputRef.current as any).focus();
451
+ (this.inputRef.current as any).focus({ preventScroll });
450
452
  }
451
453
  },
452
454
  };