@douyinfe/semi-foundation 2.13.0 → 2.14.0-beta.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 (155) hide show
  1. package/anchor/foundation.ts +1 -2
  2. package/autoComplete/foundation.ts +29 -18
  3. package/avatar/avatar.scss +14 -0
  4. package/avatar/foundation.ts +17 -0
  5. package/avatar/variables.scss +3 -0
  6. package/base/foundation.ts +6 -0
  7. package/calendar/foundation.ts +2 -1
  8. package/cascader/cascader.scss +3 -0
  9. package/cascader/foundation.ts +3 -0
  10. package/checkbox/checkboxFoundation.ts +2 -1
  11. package/datePicker/foundation.ts +3 -3
  12. package/datePicker/inputFoundation.ts +1 -1
  13. package/datePicker/monthsGridFoundation.ts +8 -4
  14. package/form/utils.ts +5 -1
  15. package/input/foundation.ts +3 -11
  16. package/input/input.scss +6 -0
  17. package/input/textareaFoundation.ts +0 -9
  18. package/input/variables.scss +3 -0
  19. package/lib/cjs/anchor/foundation.d.ts +1 -2
  20. package/lib/cjs/autoComplete/foundation.d.ts +0 -1
  21. package/lib/cjs/autoComplete/foundation.js +35 -23
  22. package/lib/cjs/avatar/avatar.css +9 -0
  23. package/lib/cjs/avatar/avatar.scss +14 -0
  24. package/lib/cjs/avatar/foundation.d.ts +3 -0
  25. package/lib/cjs/avatar/foundation.js +20 -0
  26. package/lib/cjs/avatar/variables.scss +3 -0
  27. package/lib/cjs/base/foundation.js +12 -0
  28. package/lib/cjs/calendar/eventUtil.d.ts +1 -1
  29. package/lib/cjs/calendar/foundation.d.ts +1 -2
  30. package/lib/cjs/cascader/cascader.css +5 -0
  31. package/lib/cjs/cascader/cascader.scss +3 -0
  32. package/lib/cjs/cascader/foundation.d.ts +0 -11
  33. package/lib/cjs/cascader/foundation.js +5 -0
  34. package/lib/cjs/checkbox/checkboxFoundation.js +3 -1
  35. package/lib/cjs/datePicker/foundation.d.ts +3 -4
  36. package/lib/cjs/datePicker/inputFoundation.d.ts +1 -2
  37. package/lib/cjs/datePicker/monthsGridFoundation.d.ts +4 -5
  38. package/lib/cjs/form/utils.d.ts +5 -2
  39. package/lib/cjs/form/utils.js +4 -0
  40. package/lib/cjs/input/foundation.d.ts +0 -4
  41. package/lib/cjs/input/foundation.js +7 -13
  42. package/lib/cjs/input/input.css +6 -0
  43. package/lib/cjs/input/input.scss +6 -0
  44. package/lib/cjs/input/textareaFoundation.d.ts +0 -4
  45. package/lib/cjs/input/textareaFoundation.js +0 -12
  46. package/lib/cjs/input/variables.scss +3 -0
  47. package/lib/cjs/overflowList/foundation.d.ts +1 -0
  48. package/lib/cjs/overflowList/foundation.js +25 -0
  49. package/lib/cjs/radio/radio.css +6 -0
  50. package/lib/cjs/radio/radio.scss +8 -0
  51. package/lib/cjs/radio/radioFoundation.d.ts +3 -0
  52. package/lib/cjs/radio/radioFoundation.js +24 -0
  53. package/lib/cjs/radio/variables.scss +4 -0
  54. package/lib/cjs/select/foundation.js +2 -0
  55. package/lib/cjs/select/select.css +5 -0
  56. package/lib/cjs/select/select.scss +3 -0
  57. package/lib/cjs/switch/foundation.js +3 -1
  58. package/lib/cjs/tagInput/foundation.js +2 -0
  59. package/lib/cjs/tagInput/tagInput.css +1 -1
  60. package/lib/cjs/tagInput/variables.scss +1 -1
  61. package/lib/cjs/timePicker/foundation.js +4 -0
  62. package/lib/cjs/timePicker/utils/localeDate.js +5 -0
  63. package/lib/cjs/tree/tree.css +0 -20
  64. package/lib/cjs/tree/tree.scss +0 -20
  65. package/lib/cjs/tree/treeUtil.js +2 -0
  66. package/lib/cjs/tree/variables.scss +0 -18
  67. package/lib/cjs/treeSelect/foundation.js +10 -1
  68. package/lib/cjs/treeSelect/treeSelect.css +5 -0
  69. package/lib/cjs/treeSelect/treeSelect.scss +3 -0
  70. package/lib/cjs/utils/Logger.js +8 -0
  71. package/lib/cjs/utils/Store.js +1 -0
  72. package/lib/cjs/utils/date-fns-extra.js +4 -0
  73. package/lib/cjs/utils/isElement.js +1 -0
  74. package/lib/cjs/utils/isEscPress.js +1 -0
  75. package/lib/cjs/utils/set.js +1 -0
  76. package/lib/es/anchor/foundation.d.ts +1 -2
  77. package/lib/es/autoComplete/foundation.d.ts +0 -1
  78. package/lib/es/autoComplete/foundation.js +35 -23
  79. package/lib/es/avatar/avatar.css +9 -0
  80. package/lib/es/avatar/avatar.scss +14 -0
  81. package/lib/es/avatar/foundation.d.ts +3 -0
  82. package/lib/es/avatar/foundation.js +19 -0
  83. package/lib/es/avatar/variables.scss +3 -0
  84. package/lib/es/base/foundation.js +12 -0
  85. package/lib/es/calendar/eventUtil.d.ts +1 -1
  86. package/lib/es/calendar/foundation.d.ts +1 -2
  87. package/lib/es/cascader/cascader.css +5 -0
  88. package/lib/es/cascader/cascader.scss +3 -0
  89. package/lib/es/cascader/foundation.d.ts +0 -11
  90. package/lib/es/cascader/foundation.js +5 -0
  91. package/lib/es/checkbox/checkboxFoundation.js +2 -1
  92. package/lib/es/datePicker/foundation.d.ts +3 -4
  93. package/lib/es/datePicker/inputFoundation.d.ts +1 -2
  94. package/lib/es/datePicker/monthsGridFoundation.d.ts +4 -5
  95. package/lib/es/form/utils.d.ts +5 -2
  96. package/lib/es/form/utils.js +5 -0
  97. package/lib/es/input/foundation.d.ts +0 -4
  98. package/lib/es/input/foundation.js +6 -12
  99. package/lib/es/input/input.css +6 -0
  100. package/lib/es/input/input.scss +6 -0
  101. package/lib/es/input/textareaFoundation.d.ts +0 -4
  102. package/lib/es/input/textareaFoundation.js +0 -11
  103. package/lib/es/input/variables.scss +3 -0
  104. package/lib/es/overflowList/foundation.d.ts +1 -0
  105. package/lib/es/overflowList/foundation.js +25 -0
  106. package/lib/es/radio/radio.css +6 -0
  107. package/lib/es/radio/radio.scss +8 -0
  108. package/lib/es/radio/radioFoundation.d.ts +3 -0
  109. package/lib/es/radio/radioFoundation.js +23 -0
  110. package/lib/es/radio/variables.scss +4 -0
  111. package/lib/es/select/foundation.js +2 -0
  112. package/lib/es/select/select.css +5 -0
  113. package/lib/es/select/select.scss +3 -0
  114. package/lib/es/switch/foundation.js +2 -1
  115. package/lib/es/tagInput/foundation.js +2 -0
  116. package/lib/es/tagInput/tagInput.css +1 -1
  117. package/lib/es/tagInput/variables.scss +1 -1
  118. package/lib/es/timePicker/foundation.js +4 -0
  119. package/lib/es/timePicker/utils/localeDate.js +5 -0
  120. package/lib/es/tree/tree.css +0 -20
  121. package/lib/es/tree/tree.scss +0 -20
  122. package/lib/es/tree/treeUtil.js +2 -0
  123. package/lib/es/tree/variables.scss +0 -18
  124. package/lib/es/treeSelect/foundation.js +10 -1
  125. package/lib/es/treeSelect/treeSelect.css +5 -0
  126. package/lib/es/treeSelect/treeSelect.scss +3 -0
  127. package/lib/es/utils/Logger.js +8 -0
  128. package/lib/es/utils/Store.js +1 -0
  129. package/lib/es/utils/date-fns-extra.js +4 -0
  130. package/lib/es/utils/isElement.js +1 -0
  131. package/lib/es/utils/isEscPress.js +1 -0
  132. package/lib/es/utils/set.js +2 -0
  133. package/overflowList/foundation.ts +20 -0
  134. package/package.json +2 -2
  135. package/radio/radio.scss +8 -0
  136. package/radio/radioFoundation.ts +17 -0
  137. package/radio/variables.scss +4 -0
  138. package/select/foundation.ts +1 -0
  139. package/select/select.scss +3 -0
  140. package/switch/foundation.ts +2 -1
  141. package/tagInput/foundation.ts +1 -0
  142. package/tagInput/variables.scss +1 -1
  143. package/timePicker/foundation.ts +2 -1
  144. package/timePicker/utils/localeDate.ts +3 -0
  145. package/tree/tree.scss +0 -20
  146. package/tree/treeUtil.ts +1 -0
  147. package/tree/variables.scss +0 -18
  148. package/treeSelect/foundation.ts +7 -0
  149. package/treeSelect/treeSelect.scss +3 -0
  150. package/utils/Logger.ts +4 -0
  151. package/utils/Store.ts +1 -0
  152. package/utils/date-fns-extra.ts +2 -0
  153. package/utils/isElement.ts +1 -0
  154. package/utils/isEscPress.ts +1 -0
  155. package/utils/set.ts +1 -0
@@ -205,17 +205,6 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
205
205
  handleSingleSelect(e: any, item: BasicEntity | BasicData): void;
206
206
  _handleMultipleSelect(item: BasicEntity | BasicData): void;
207
207
  calcNonDisabledCheckedKeys(eventKey: string, targetStatus: boolean): {
208
- /**
209
- * The typical scenario is: suppose we select the 0-0 node, at this time
210
- * selectedKeys=Set('0-0'), the input box will display a 0-0 label. When
211
- * treeData is updated, assuming 0-0 does not exist in treeData at this
212
- * time, then selectedKeys=Set('not-exist-0-0'), at this time the input
213
- * box displays 0-0, which means not-exist -After the content. When treeData
214
- * is updated again, assuming that 0-0 exists in treeData at this time,
215
- * then selectedKeys=Set('0-0'), and the input box displays a label of
216
- * 0-0 at this time. The operation done here is for the 0-0 label to be
217
- * displayed normally after the second update in the example.
218
- */
219
208
  checkedKeys: Set<string>;
220
209
  halfCheckedKeys: Set<any>;
221
210
  };
@@ -535,6 +535,8 @@ export default class CascaderFoundation extends BaseFoundation {
535
535
  * A11y: simulate selection click
536
536
  */
537
537
 
538
+ /* istanbul ignore next */
539
+
538
540
 
539
541
  handleSelectionEnterPress(keyboardEvent) {
540
542
  if (isEnterPress(keyboardEvent)) {
@@ -976,6 +978,8 @@ export default class CascaderFoundation extends BaseFoundation {
976
978
  * A11y: simulate clear button click
977
979
  */
978
980
 
981
+ /* istanbul ignore next */
982
+
979
983
 
980
984
  handleClearEnterPress(keyboardEvent) {
981
985
  if (isEnterPress(keyboardEvent)) {
@@ -1060,6 +1064,7 @@ export default class CascaderFoundation extends BaseFoundation {
1060
1064
  } = this.getProps();
1061
1065
 
1062
1066
  if (disabled) {
1067
+ /* istanbul ignore next */
1063
1068
  return;
1064
1069
  }
1065
1070
 
@@ -2,6 +2,7 @@ import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign"
2
2
  import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
3
3
  import BaseFoundation from '../base/foundation';
4
4
  import isEnterPress from '../utils/isEnterPress';
5
+ import warning from '../utils/warning';
5
6
 
6
7
  class CheckboxFoundation extends BaseFoundation {
7
8
  constructor(adapter) {
@@ -23,7 +24,7 @@ class CheckboxFoundation extends BaseFoundation {
23
24
  this._adapter.setFocusVisible(true);
24
25
  }
25
26
  } catch (error) {
26
- console.warn('The current browser does not support the focus-visible');
27
+ warning(true, 'Warning: [Semi Checkbox] The current browser does not support the focus-visible');
27
28
  }
28
29
  };
29
30
 
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import BaseFoundation, { DefaultAdapter } from '../base/foundation';
3
2
  import { strings } from './constants';
4
3
  import { Type, DateInputFoundationProps, InsetInputValue } from './inputFoundation';
@@ -95,12 +94,12 @@ export interface DatePickerFoundationProps extends ElementProps, RenderProps, Ev
95
94
  disabledDate?: DisabledDateType;
96
95
  disabledTime?: DisabledTimeType;
97
96
  dropdownClassName?: string;
98
- dropdownStyle?: React.CSSProperties;
97
+ dropdownStyle?: Record<string, any>;
99
98
  endDateOffset?: DateOffsetType;
100
99
  format?: string;
101
100
  getPopupContainer?: () => HTMLElement;
102
101
  inputReadOnly?: boolean;
103
- inputStyle?: React.CSSProperties;
102
+ inputStyle?: Record<string, any>;
104
103
  max?: number;
105
104
  motion?: Motion;
106
105
  multiple?: boolean;
@@ -116,7 +115,7 @@ export interface DatePickerFoundationProps extends ElementProps, RenderProps, Ev
116
115
  spacing?: number;
117
116
  startDateOffset?: DateOffsetType;
118
117
  stopPropagation?: boolean | string;
119
- style?: React.CSSProperties;
118
+ style?: Record<string, any>;
120
119
  timePickerOpts?: any;
121
120
  timeZone?: string | number;
122
121
  type?: Type;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import BaseFoundation, { DefaultAdapter } from '../base/foundation';
3
2
  import { BaseValueType, ValidateStatus, ValueType } from './foundation';
4
3
  import { strings } from './constants';
@@ -27,7 +26,7 @@ export interface DateInputFoundationProps extends DateInputElementProps, DateInp
27
26
  type?: Type;
28
27
  showClear?: boolean;
29
28
  format?: string;
30
- inputStyle?: React.CSSProperties;
29
+ inputStyle?: Record<string, any>;
31
30
  inputReadOnly?: boolean;
32
31
  validateStatus?: ValidateStatus;
33
32
  prefixCls?: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import BaseFoundation, { DefaultAdapter } from '../base/foundation';
3
2
  import { strings } from './constants';
4
3
  import { WeekStartNumber } from './_utils/getMonthTable';
@@ -7,10 +6,10 @@ import { MonthDayInfo } from './monthFoundation';
7
6
  import { ArrayElement } from '../utils/type';
8
7
  declare type Type = ArrayElement<typeof strings.TYPE_SET>;
9
8
  interface MonthsGridElementProps {
10
- navPrev?: React.ReactNode;
11
- navNext?: React.ReactNode;
12
- renderDate?: () => React.ReactNode;
13
- renderFullDate?: () => React.ReactNode;
9
+ navPrev?: any;
10
+ navNext?: any;
11
+ renderDate?: () => any;
12
+ renderFullDate?: () => any;
14
13
  }
15
14
  export declare type PanelType = 'left' | 'right';
16
15
  export declare type YearMonthChangeType = 'prevMonth' | 'nextMonth' | 'prevYear' | 'nextYear';
@@ -1,7 +1,10 @@
1
- /// <reference types="react" />
2
1
  import AsyncValidator from 'async-validator';
3
2
  import { ComponentProps, WithFieldOption } from './interface';
4
- export declare function getDisplayName(WrappedComponent: React.ComponentType | any): string;
3
+ /**
4
+ *
5
+ * @param WrappedComponent React.ComponentType | any
6
+ */
7
+ export declare function getDisplayName(WrappedComponent: any): string;
5
8
  export declare function generateValidatesFromRules(field: string, rules?: any[]): AsyncValidator;
6
9
  export declare function isRequired(rules?: any[] | Record<string, any>): boolean;
7
10
  export declare function isValid(errors: any): boolean;
@@ -24,6 +24,11 @@ var __rest = this && this.__rest || function (s, e) {
24
24
 
25
25
 
26
26
  import AsyncValidator from 'async-validator';
27
+
28
+ /**
29
+ *
30
+ * @param WrappedComponent React.ComponentType | any
31
+ */
27
32
  export function getDisplayName(WrappedComponent) {
28
33
  const originName = WrappedComponent.displayName || WrappedComponent.name;
29
34
  return originName ? "SemiField".concat(originName) : 'SemiField';
@@ -75,10 +75,6 @@ declare class InputFoundation extends BaseFoundation<InputAdapter> {
75
75
  * @param {Event} e
76
76
  */
77
77
  handlePreventMouseDown(e: any): void;
78
- /**
79
- * A11y: simulate clear button click
80
- */
81
- handleClearEnterPress(e: any): void;
82
78
  /**
83
79
  * A11y: simulate password button click
84
80
  */
@@ -5,9 +5,9 @@ import _set from "lodash/set";
5
5
  import _noop from "lodash/noop";
6
6
  import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
7
7
  import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
8
+ import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
8
9
  import BaseFoundation from '../base/foundation';
9
10
  import { strings } from './constants';
10
- import isEnterPress from '../utils/isEnterPress';
11
11
  import { ENTER_KEY } from './../utils/keyCode';
12
12
 
13
13
  class InputFoundation extends BaseFoundation {
@@ -353,23 +353,17 @@ class InputFoundation extends BaseFoundation {
353
353
  e.preventDefault();
354
354
  }
355
355
  }
356
- /**
357
- * A11y: simulate clear button click
358
- */
359
-
360
-
361
- handleClearEnterPress(e) {
362
- if (isEnterPress(e)) {
363
- this.handleClear(e);
364
- }
365
- }
366
356
  /**
367
357
  * A11y: simulate password button click
368
358
  */
369
359
 
370
360
 
371
361
  handleModeEnterPress(e) {
372
- if (isEnterPress(e)) {
362
+ var _context;
363
+
364
+ // trigger by Enter or Space key
365
+ if (_includesInstanceProperty(_context = ['Enter', ' ']).call(_context, e === null || e === void 0 ? void 0 : e.key)) {
366
+ this.handlePreventMouseDown(e);
373
367
  this.handleClickEye(e);
374
368
  }
375
369
  }
@@ -138,6 +138,12 @@
138
138
  .semi-input-wrapper .semi-input-modebtn:hover .semi-icon {
139
139
  color: var(--semi-color-primary-hover);
140
140
  }
141
+ .semi-input-wrapper .semi-input-clearbtn:focus-visible,
142
+ .semi-input-wrapper .semi-input-modebtn:focus-visible {
143
+ border-radius: var(--semi-border-radius-small);
144
+ outline: 2px solid var(--semi-color-primary-light-active);
145
+ outline-offset: -1px;
146
+ }
141
147
  .semi-input-wrapper__with-suffix-icon.semi-input-wrapper-clearable:not(.semi-input-wrapper__with-suffix-hidden) .semi-input-clearbtn {
142
148
  min-width: 24px;
143
149
  justify-content: flex-end;
@@ -173,6 +173,12 @@ $module: #{$prefix}-input;
173
173
  color: $color-input-icon-hover;
174
174
  }
175
175
  }
176
+
177
+ &:focus-visible {
178
+ border-radius: $radius-input_wrapper;
179
+ outline: $width-input_icon-outline solid $color-input_icon-outline;
180
+ outline-offset: $width-input_icon-outlineOffset;
181
+ }
176
182
  }
177
183
 
178
184
  &__with-suffix-icon.#{$module}-wrapper-clearable:not(.#{$module}-wrapper__with-suffix-hidden) {
@@ -60,8 +60,4 @@ export default class TextAreaFoundation extends BaseFoundation<TextAreaAdapter>
60
60
  handleMouseLeave(e: any): void;
61
61
  isAllowClear(): boolean;
62
62
  handleClear(e: any): void;
63
- /**
64
- * A11y: simulate clear button click
65
- */
66
- handleClearEnterPress(e: any): void;
67
63
  }
@@ -7,7 +7,6 @@ import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instan
7
7
  import BaseFoundation from '../base/foundation';
8
8
  import calculateNodeHeight from './util/calculateNodeHeight';
9
9
  import getSizingData from './util/getSizingData';
10
- import isEnterPress from '../utils/isEnterPress';
11
10
  export default class TextAreaFoundation extends BaseFoundation {
12
11
  constructor(adapter) {
13
12
  super(_Object$assign(_Object$assign({}, TextAreaFoundation.textAreaDefaultAdapter), adapter));
@@ -273,15 +272,5 @@ export default class TextAreaFoundation extends BaseFoundation {
273
272
 
274
273
  this.stopPropagation(e);
275
274
  }
276
- /**
277
- * A11y: simulate clear button click
278
- */
279
-
280
-
281
- handleClearEnterPress(e) {
282
- if (isEnterPress(e)) {
283
- this.handleClear(e);
284
- }
285
- }
286
275
 
287
276
  }
@@ -11,6 +11,7 @@ $color-input_default-border-active: $color-input_default-bg-active; // 输入框
11
11
 
12
12
  $color-input_default-bg-focus: var(--semi-color-fill-0); // 输入框背景颜色 - 选中
13
13
  $color-input_default-border-focus: var(--semi-color-focus-border); // 输入框描边颜色 - 选中
14
+ $color-input_icon-outline: var(--semi-color-primary-light-active); // 输入框 icon outline 颜色
14
15
 
15
16
  // error
16
17
  $color-input_danger-bg-default: var(--semi-color-danger-light-default); // 错误输入框背景颜色 - 默认
@@ -75,6 +76,8 @@ $width-input_prepend-border: $border-thickness-control; // 前置标签描边宽
75
76
  $width-input_group_pseudo-border: $border-thickness-control;
76
77
  $width-input_wrapper-border: $border-thickness-control-focus; // 输入框描边宽度
77
78
  $width-input_wrapper_focus-border: $border-thickness-control-focus; // 输入框描边宽度 - 选中态
79
+ $width-input_icon-outline: 2px; // 输入框 icon outline 宽度
80
+ $width-input_icon-outlineOffset: -1px; // 输入框 icon outline-offset 宽度
78
81
 
79
82
  $radius-input_wrapper: var(--semi-border-radius-small); // 输入框圆角大小
80
83
  $spacing-input_icon-marginLeft: -$spacing-base-tight; // 输入框图标左侧内边距
@@ -6,6 +6,7 @@ export interface OverflowListAdapter extends DefaultAdapter {
6
6
  }
7
7
  declare class OverflowListFoundation extends BaseFoundation<OverflowListAdapter> {
8
8
  constructor(adapter: OverflowListAdapter);
9
+ previousY: any;
9
10
  isScrollMode: () => boolean;
10
11
  getOverflowItem(): Array<Array<Record<string, any>>>;
11
12
  handleIntersect(entries: Array<IntersectionObserverEntry>): void;
@@ -6,6 +6,7 @@ import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/inst
6
6
  import _lastIndexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/last-index-of";
7
7
  import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
8
8
  import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
9
+ import _valuesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/values";
9
10
  import BaseFoundation from '../base/foundation';
10
11
  import { strings } from './constants';
11
12
  const Boundary = strings.BOUNDARY_MAP;
@@ -14,6 +15,7 @@ const OverflowDirection = strings.OVERFLOW_DIR;
14
15
  class OverflowListFoundation extends BaseFoundation {
15
16
  constructor(adapter) {
16
17
  super(_Object$assign({}, adapter));
18
+ this.previousY = undefined;
17
19
 
18
20
  this.isScrollMode = () => {
19
21
  const {
@@ -66,6 +68,29 @@ class OverflowListFoundation extends BaseFoundation {
66
68
  visibleState.set(itemKey, visible);
67
69
  });
68
70
 
71
+ let someItemVisible = false;
72
+
73
+ for (const value of _valuesInstanceProperty(visibleState).call(visibleState)) {
74
+ if (value) {
75
+ someItemVisible = true;
76
+ break;
77
+ }
78
+ } // Any item is visible, indicating that the List is visible
79
+
80
+
81
+ const wholeListVisible = someItemVisible; // If scrolling in the vertical direction makes the List invisible, no processing is required.
82
+ // If this.previousY is undefined, it means that the List is mounted for the first time and will not be processed.
83
+
84
+ const [entry1] = entries;
85
+ const currentY = entry1.boundingClientRect.y;
86
+
87
+ if (!wholeListVisible && this.previousY !== undefined && currentY !== this.previousY) {
88
+ this.previousY = currentY;
89
+ return;
90
+ }
91
+
92
+ this.previousY = currentY;
93
+
69
94
  this._adapter.updateVisibleState(visibleState);
70
95
 
71
96
  this._adapter.notifyIntersect(res);
@@ -280,6 +280,12 @@
280
280
  padding-left: 24px;
281
281
  box-sizing: border-box;
282
282
  }
283
+ .semi-radio-focus {
284
+ outline: 2px solid var(--semi-color-primary-light-active);
285
+ }
286
+ .semi-radio-focus-border {
287
+ border: solid 1px var(--semi-color-focus-border);
288
+ }
283
289
 
284
290
  .semi-radioGroup {
285
291
  font-size: 14px;
@@ -379,6 +379,14 @@ $inner-width: $width-icon-medium;
379
379
  padding-left: $spacing-radio_extra-paddingLeft;
380
380
  box-sizing: border-box;
381
381
  }
382
+
383
+ &-focus {
384
+ outline: $width-radio-outline solid $color-radio_primary-outline-focus;
385
+
386
+ &-border {
387
+ border: solid $width-radio_hover-border $color-radio_default-border-hover;
388
+ }
389
+ }
382
390
  }
383
391
 
384
392
  .#{$module}Group {
@@ -3,8 +3,11 @@ export interface RadioAdapter extends DefaultAdapter {
3
3
  setHover: (hover: boolean) => void;
4
4
  setAddonId: () => void;
5
5
  setExtraId: () => void;
6
+ setFocusVisible: (focusVisible: boolean) => void;
6
7
  }
7
8
  export default class RadioFoundation extends BaseFoundation<RadioAdapter> {
8
9
  init(): void;
9
10
  setHover(hover: boolean): void;
11
+ handleFocusVisible: (event: any) => void;
12
+ handleBlur: () => void;
10
13
  }
@@ -1,5 +1,28 @@
1
1
  import BaseFoundation from '../base/foundation';
2
+ import warning from '../utils/warning';
2
3
  export default class RadioFoundation extends BaseFoundation {
4
+ constructor() {
5
+ super(...arguments);
6
+
7
+ this.handleFocusVisible = event => {
8
+ const {
9
+ target
10
+ } = event;
11
+
12
+ try {
13
+ if (target.matches(':focus-visible')) {
14
+ this._adapter.setFocusVisible(true);
15
+ }
16
+ } catch (error) {
17
+ warning(true, 'Warning: [Semi Radio] The current browser does not support the focus-visible');
18
+ }
19
+ };
20
+
21
+ this.handleBlur = () => {
22
+ this._adapter.setFocusVisible(false);
23
+ };
24
+ }
25
+
3
26
  init() {
4
27
  const {
5
28
  children,
@@ -48,6 +48,8 @@ $color-radio_card-bg-hover: var(--semi-color-white); // 单选圆点颜色
48
48
  $color-radio_card-bg-active: var(--semi-color-white); // 单选圆点颜色 - 按下态
49
49
  $color-radio_card-bg-default: var(--semi-color-white); // 单选圆点颜色 - 悬浮态
50
50
 
51
+ $color-radio_primary-outline-focus: var(--semi-color-primary-light-active); // 轮廓颜色 - 按键聚焦
52
+
51
53
  $radius-radio_cardRadioGroup: var(--semi-border-radius-small); // 卡片式单选圆角大小
52
54
  $radius-radio_addon_buttonRadio: var(--semi-border-radius-small); // 按钮式单选圆点圆角大小
53
55
  $radius-radio_buttonRadio: var(--semi-border-radius-small); // 按钮式单选圆角大小
@@ -58,6 +60,8 @@ $width-radio_hover-border: $border-thickness-control; // 描边宽度 - 悬浮
58
60
  $width-radio_disabled-border: $border-thickness-control; // 描边宽度 - 禁用态
59
61
  $width-radio_innder-border: $border-thickness-control; // 描边宽度 - 禁用态
60
62
 
63
+ $width-radio-outline: 2px; // 单选框轮廓宽度
64
+
61
65
  $height-radio_inner_min: 20px; // 单选按钮高度
62
66
  $width-radio_inner: $width-icon-medium; // 单选按钮宽度
63
67
  $spacing-radio_addon-paddingLeft: $spacing-tight; //单选标题到单选按钮左侧边距
@@ -1160,6 +1160,8 @@ export default class SelectFoundation extends BaseFoundation {
1160
1160
  this.handleClick(e);
1161
1161
  }
1162
1162
  }
1163
+ /* istanbul ignore next */
1164
+
1163
1165
 
1164
1166
  handleClearBtnEnterPress(e) {
1165
1167
  if (isEnterPress(e)) {
@@ -109,6 +109,11 @@
109
109
  min-height: 40px;
110
110
  line-height: 40px;
111
111
  }
112
+ .semi-select-large .semi-select-selection {
113
+ font-size: 16px;
114
+ line-height: 22px;
115
+ font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
116
+ }
112
117
  .semi-select-open, .semi-select-focus {
113
118
  border: 1px solid var(--semi-color-focus-border);
114
119
  outline: 0;
@@ -45,6 +45,9 @@ $multiple: #{$module}-multiple;
45
45
  &-large {
46
46
  min-height: $height-select_large;
47
47
  line-height: $height-select_large;
48
+ .#{$module}-selection {
49
+ @include font-size-header-6;
50
+ }
48
51
  }
49
52
 
50
53
  &-open,
@@ -1,5 +1,6 @@
1
1
  import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
2
2
  import BaseFoundation from '../base/foundation';
3
+ import warning from '../utils/warning';
3
4
  export default class SwitchFoundation extends BaseFoundation {
4
5
  constructor(adapter) {
5
6
  super(_Object$assign({}, adapter));
@@ -14,7 +15,7 @@ export default class SwitchFoundation extends BaseFoundation {
14
15
  this._adapter.setFocusVisible(true);
15
16
  }
16
17
  } catch (error) {
17
- console.warn('The current browser does not support the focus-visible');
18
+ warning(true, 'Warning: [Semi Switch] The current browser does not support the focus-visible');
18
19
  }
19
20
  };
20
21
 
@@ -170,6 +170,8 @@ class TagInputFoundation extends BaseFoundation {
170
170
  * A11y: simulate clear button click
171
171
  */
172
172
 
173
+ /* istanbul ignore next */
174
+
173
175
 
174
176
  handleClearEnterPress(e) {
175
177
  if (isEnterPress(e)) {
@@ -154,7 +154,7 @@
154
154
  color: var(--semi-color-text-2);
155
155
  }
156
156
  .semi-tagInput-suffix-text {
157
- color: var(--semi-color-text-1);
157
+ color: var(--semi-color-text-2);
158
158
  }
159
159
 
160
160
  .semi-rtl .semi-tagInput,
@@ -8,7 +8,7 @@ $color-tagInput-border-default: transparent; // 标签输入框描边颜色 -
8
8
  $color-tagInput-border-hover: transparent ; // 标签输入框描边颜色 - 悬浮
9
9
  $color-tagInput-border-focus: var(--semi-color-focus-border); // 标签输入框描边颜色 - 选中态
10
10
  $color-tagInput_prefix-default: var(--semi-color-text-2); // 标签输入框 prefix 颜色
11
- $color-tagInput_suffix-default: var(--semi-color-text-1); // 标签输入框 suffix 颜色
11
+ $color-tagInput_suffix-default: var(--semi-color-text-2); // 标签输入框 suffix 颜色
12
12
 
13
13
  $color-tagInput_default-bg-default: var(--semi-color-fill-0); // 标签输入框背景颜色 - 默认
14
14
  $color-tagInput_default-bg-hover: var(--semi-color-fill-1); // 标签输入框背景颜色 - 悬浮
@@ -249,6 +249,8 @@ class TimePickerFoundation extends BaseFoundation {
249
249
 
250
250
  this._adapter.notifyBlur(e);
251
251
  }
252
+ /* istanbul ignore next */
253
+
252
254
 
253
255
  handleVisibleChange(visible) {
254
256
  if (!this._isControlledComponent('open')) {
@@ -301,6 +303,8 @@ class TimePickerFoundation extends BaseFoundation {
301
303
  this._notifyChange(value, input);
302
304
  }
303
305
  }
306
+ /* istanbul ignore next */
307
+
304
308
 
305
309
  doValidate(args) {
306
310
  if (typeof args === 'string') {
@@ -1,5 +1,6 @@
1
1
  import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
2
2
  import { format as dateFnsFormat, parse as dateFnsParse } from 'date-fns';
3
+ /* istanbul ignore next */
3
4
 
4
5
  const replace = function replace(str, replacements) {
5
6
  let _str = str;
@@ -12,6 +13,8 @@ const replace = function replace(str, replacements) {
12
13
 
13
14
  return _str;
14
15
  };
16
+ /* istanbul ignore next */
17
+
15
18
 
16
19
  export function localeFormat(date, format) {
17
20
  let locale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
@@ -20,6 +23,8 @@ export function localeFormat(date, format) {
20
23
  str = replace(str, locale);
21
24
  return str;
22
25
  }
26
+ /* istanbul ignore next */
27
+
23
28
  export function localeParse(dateString, format) {
24
29
  let locale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
25
30
  let defaultDate = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
@@ -1,26 +1,6 @@
1
1
  /* shadow */
2
2
  /* sizing */
3
3
  /* spacing */
4
- .semi-tree {
5
- box-sizing: border-box;
6
- border-radius: var(--semi-border-radius-small);
7
- border: 1px solid transparent;
8
- height: 32px;
9
- line-height: 32px;
10
- font-weight: 400;
11
- background-color: var(--semi-color-fill-0);
12
- display: inline-block;
13
- vertical-align: middle;
14
- position: relative;
15
- cursor: pointer;
16
- }
17
- .semi-tree:hover {
18
- background-color: var(--semi-color-fill-1);
19
- }
20
- .semi-tree-focus {
21
- border: 1px solid var(--semi-color-focus-border);
22
- outline: 0;
23
- }
24
4
  .semi-tree-search-wrapper {
25
5
  padding: 8px 12px;
26
6
  }
@@ -3,26 +3,6 @@
3
3
  $module: #{$prefix}-tree;
4
4
 
5
5
  .#{$module} {
6
- box-sizing: border-box;
7
- border-radius: $radius-tree;
8
- border: 1px solid $color-tree_default-border-default;
9
- height: $height-tree_default;
10
- line-height: $height-tree_default;
11
- font-weight: $font-tree_default-fontWeight;
12
- background-color: $color-tree_default-bg-default;
13
- display: inline-block;
14
- vertical-align: middle;
15
- position: relative;
16
- cursor: pointer;
17
-
18
- &:hover {
19
- background-color: $color-tree_default-bg-hover;
20
- }
21
-
22
- &-focus {
23
- border: $width-tree_focus-border solid $color-tree_default-border-focus;
24
- outline: 0;
25
- }
26
6
 
27
7
  &-search-wrapper {
28
8
  padding: $spacing-tree_search_wrapper-paddingY $spacing-tree_search_wrapper-paddingX;
@@ -263,6 +263,8 @@ export function findChildKeys(keys, options) {
263
263
  });
264
264
  return res;
265
265
  }
266
+ /* istanbul ignore next */
267
+
266
268
  export function findLeafKeys(keys, options) {
267
269
  const res = [];
268
270