@fibrae/semi-foundation 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. package/dist/anchor/foundation.d.ts +0 -3
  2. package/dist/anchor/foundation.js +0 -1
  3. package/dist/audio-player/foundation.d.ts +0 -3
  4. package/dist/audio-player/foundation.js +0 -1
  5. package/dist/auto-complete/foundation.d.ts +0 -2
  6. package/dist/auto-complete/foundation.js +0 -1
  7. package/dist/avatar/foundation.d.ts +0 -1
  8. package/dist/avatar/variables.scss +0 -1
  9. package/dist/backtop/foundation.d.ts +0 -3
  10. package/dist/backtop/foundation.js +0 -1
  11. package/dist/base/auto-close-foundation.d.ts +0 -1
  12. package/dist/base/foundation.d.ts +0 -1
  13. package/dist/base/list-store.d.ts +0 -1
  14. package/dist/calendar/event-util.d.ts +0 -10
  15. package/dist/calendar/event-util.js +0 -10
  16. package/dist/calendar/foundation.d.ts +1 -6
  17. package/dist/calendar/foundation.js +1 -5
  18. package/dist/calendar/month-foundation.d.ts +0 -1
  19. package/dist/calendar/month-foundation.js +0 -1
  20. package/dist/carousel/foundation.d.ts +0 -2
  21. package/dist/cascader/foundation.d.ts +2 -6
  22. package/dist/cascader/foundation.js +2 -11
  23. package/dist/cascader/util.d.ts +1 -8
  24. package/dist/cascader/util.js +1 -8
  25. package/dist/checkbox/checkbox-foundation.d.ts +1 -5
  26. package/dist/checkbox/checkbox-foundation.js +0 -2
  27. package/dist/checkbox/checkbox-group-foundation.d.ts +0 -1
  28. package/dist/code-highlight/index.d.ts +0 -1
  29. package/dist/color-picker/color-picker.scss +0 -2
  30. package/dist/color-picker/interface.d.ts +0 -1
  31. package/dist/config-provider/responsive-types.d.ts +0 -16
  32. package/dist/cropper/foundation.d.ts +0 -1
  33. package/dist/cropper/foundation.js +0 -1
  34. package/dist/date-picker/_utils/get-default-picker-date.d.ts +0 -3
  35. package/dist/date-picker/_utils/get-default-picker-date.js +0 -3
  36. package/dist/date-picker/_utils/get-inset-input-format-token.d.ts +0 -2
  37. package/dist/date-picker/_utils/get-inset-input-format-token.js +0 -2
  38. package/dist/date-picker/_utils/get-inset-input-value-from-inset-input-str.d.ts +0 -2
  39. package/dist/date-picker/_utils/get-inset-input-value-from-inset-input-str.js +0 -2
  40. package/dist/date-picker/_utils/parser.d.ts +0 -3
  41. package/dist/date-picker/_utils/parser.js +0 -7
  42. package/dist/date-picker/_utils/picker-type.d.ts +0 -2
  43. package/dist/date-picker/_utils/picker-type.js +0 -2
  44. package/dist/date-picker/_utils/to-callback-args.d.ts +0 -1
  45. package/dist/date-picker/_utils/to-callback-args.js +0 -1
  46. package/dist/date-picker/date-picker.scss +0 -3
  47. package/dist/date-picker/foundation.d.ts +3 -22
  48. package/dist/date-picker/foundation.js +1 -24
  49. package/dist/date-picker/input-foundation.d.ts +1 -7
  50. package/dist/date-picker/input-foundation.js +0 -2
  51. package/dist/date-picker/month-foundation.d.ts +0 -3
  52. package/dist/date-picker/month-foundation.js +0 -2
  53. package/dist/date-picker/months-grid-foundation.d.ts +1 -10
  54. package/dist/date-picker/months-grid-foundation.js +1 -10
  55. package/dist/drag-move/foundation.d.ts +0 -1
  56. package/dist/dropdown/foundation.d.ts +0 -2
  57. package/dist/dropdown/menu-foundation.d.ts +0 -1
  58. package/dist/feedback/foundation.d.ts +0 -1
  59. package/dist/feedback/variables.scss +1 -5
  60. package/dist/float-button/float-button.css +0 -1
  61. package/dist/float-button/float-button.scss +0 -2
  62. package/dist/form/form.scss +0 -12
  63. package/dist/form/foundation.js +0 -15
  64. package/dist/form/interface.d.ts +2 -15
  65. package/dist/form/utils.d.ts +0 -8
  66. package/dist/form/utils.js +0 -7
  67. package/dist/form/variables.scss +1 -4
  68. package/dist/grid/variables.scss +0 -10
  69. package/dist/highlight/foundation.d.ts +0 -2
  70. package/dist/highlight/foundation.js +0 -2
  71. package/dist/hot-keys/foundation.d.ts +0 -1
  72. package/dist/image/image-foundation.d.ts +0 -2
  73. package/dist/image/preview-footer-foundation.d.ts +0 -1
  74. package/dist/image/preview-foundation.d.ts +0 -3
  75. package/dist/image/preview-image-foundation.d.ts +0 -1
  76. package/dist/image/preview-inner-foundation.d.ts +0 -1
  77. package/dist/input/foundation.d.ts +0 -1
  78. package/dist/input/text-entry-foundation.d.ts +0 -2
  79. package/dist/input/text-entry-foundation.js +0 -1
  80. package/dist/input/textarea-foundation.d.ts +0 -1
  81. package/dist/input-number/caret.d.ts +0 -1
  82. package/dist/input-number/caret.js +0 -1
  83. package/dist/input-number/foundation.d.ts +0 -5
  84. package/dist/input-number/foundation.js +0 -5
  85. package/dist/json-viewer/foundation.d.ts +0 -2
  86. package/dist/json-viewer/foundation.js +0 -1
  87. package/dist/locale/interface.d.ts +0 -3
  88. package/dist/markdown-render/foundation.d.ts +1 -6
  89. package/dist/markdown-render/foundation.js +1 -5
  90. package/dist/navigation/foundation.d.ts +0 -7
  91. package/dist/navigation/foundation.js +0 -6
  92. package/dist/navigation/sub-nav-foundation.d.ts +0 -1
  93. package/dist/notification/notification-list-foundation.d.ts +0 -1
  94. package/dist/notification/notification-list-foundation.js +0 -1
  95. package/dist/notification/variables.scss +0 -1
  96. package/dist/overflow-list/foundation.d.ts +0 -2
  97. package/dist/overflow-list/foundation.js +0 -1
  98. package/dist/pagination/foundation.d.ts +0 -2
  99. package/dist/pincode/foundation.d.ts +1 -4
  100. package/dist/pincode/foundation.js +1 -4
  101. package/dist/popconfirm/popconfirm-foundation.d.ts +0 -2
  102. package/dist/progress/generates.d.ts +1 -4
  103. package/dist/progress/generates.js +1 -4
  104. package/dist/progress/utils.d.ts +1 -1
  105. package/dist/progress/utils.js +1 -1
  106. package/dist/radio/radio-foundation.d.ts +0 -4
  107. package/dist/radio/radio-foundation.js +0 -1
  108. package/dist/radio/radio-group-foundation.d.ts +0 -1
  109. package/dist/rating/foundation.d.ts +0 -5
  110. package/dist/rating/foundation.js +0 -3
  111. package/dist/resizable/group/index.d.ts +0 -4
  112. package/dist/resizable/group/index.js +0 -4
  113. package/dist/resizable/resizable.scss +0 -1
  114. package/dist/resizable/single/index.d.ts +1 -5
  115. package/dist/resizable/single/index.js +1 -4
  116. package/dist/scroll-list/item-foundation.d.ts +0 -2
  117. package/dist/scroll-list/item-foundation.js +0 -1
  118. package/dist/scroll-list/variables.scss +1 -6
  119. package/dist/select/foundation.d.ts +0 -1
  120. package/dist/select/option-foundation.d.ts +2 -3
  121. package/dist/select/option-foundation.js +0 -1
  122. package/dist/select/variables.scss +1 -8
  123. package/dist/side-sheet/side-sheet-foundation.d.ts +1 -6
  124. package/dist/side-sheet/side-sheet-foundation.js +1 -5
  125. package/dist/side-sheet/variables.scss +1 -3
  126. package/dist/slider/foundation.d.ts +1 -12
  127. package/dist/slider/foundation.js +1 -13
  128. package/dist/slider/variables.scss +1 -5
  129. package/dist/spin/foundation.d.ts +0 -2
  130. package/dist/spin/foundation.js +0 -1
  131. package/dist/spin/variables.scss +1 -3
  132. package/dist/switch/foundation.d.ts +0 -1
  133. package/dist/switch/switch.scss +1 -1
  134. package/dist/switch/variables.scss +1 -5
  135. package/dist/table/foundation.d.ts +12 -21
  136. package/dist/table/foundation.js +51 -15
  137. package/dist/table/table.scss +0 -1
  138. package/dist/table/utils.d.ts +0 -8
  139. package/dist/table/utils.js +0 -13
  140. package/dist/table/variables.scss +1 -5
  141. package/dist/tabs/foundation.d.ts +0 -9
  142. package/dist/tabs/foundation.js +0 -4
  143. package/dist/tabs/tabs.scss +1 -1
  144. package/dist/tag/focus.js +0 -1
  145. package/dist/tag-input/foundation.d.ts +0 -2
  146. package/dist/tag-input/foundation.js +0 -1
  147. package/dist/tag-input/tag-input.scss +0 -1
  148. package/dist/tag-input/utils/tag-focus.d.ts +0 -1
  149. package/dist/tag-input/utils/tag-focus.js +0 -1
  150. package/dist/time-picker/combox-foundation.d.ts +3 -11
  151. package/dist/time-picker/combox-foundation.js +3 -10
  152. package/dist/time-picker/foundation.d.ts +0 -10
  153. package/dist/time-picker/foundation.js +0 -9
  154. package/dist/time-picker/utils/index.d.ts +0 -11
  155. package/dist/time-picker/utils/index.js +0 -11
  156. package/dist/tooltip/adjust-position.d.ts +1 -2
  157. package/dist/tooltip/constants.d.ts +0 -3
  158. package/dist/tooltip/constants.js +0 -3
  159. package/dist/tooltip/foundation.d.ts +0 -3
  160. package/dist/tooltip/foundation.js +0 -2
  161. package/dist/tooltip/position.scss +0 -1
  162. package/dist/transfer/foundation.d.ts +0 -4
  163. package/dist/transfer/foundation.js +0 -1
  164. package/dist/tree/foundation.d.ts +0 -2
  165. package/dist/tree/foundation.js +0 -1
  166. package/dist/tree/shared.d.ts +1 -3
  167. package/dist/tree/shared.js +0 -2
  168. package/dist/tree/tree-util.d.ts +0 -5
  169. package/dist/tree/tree-util.js +0 -5
  170. package/dist/tree-select/foundation.d.ts +0 -2
  171. package/dist/tree-select/foundation.js +0 -3
  172. package/dist/typography/ellipsis.d.ts +1 -3
  173. package/dist/typography/ellipsis.js +0 -2
  174. package/dist/typography/typography.scss +0 -1
  175. package/dist/upload/constants.d.ts +1 -1
  176. package/dist/upload/foundation.d.ts +0 -6
  177. package/dist/upload/foundation.js +1 -11
  178. package/dist/upload/utils.d.ts +0 -5
  179. package/dist/upload/utils.js +0 -5
  180. package/dist/user-guide/foundation.d.ts +0 -2
  181. package/dist/utils/a11y.d.ts +1 -5
  182. package/dist/utils/a11y.js +1 -4
  183. package/dist/utils/array.d.ts +0 -6
  184. package/dist/utils/array.js +0 -6
  185. package/dist/utils/date-fns-extra.js +1 -5
  186. package/dist/utils/dom.d.ts +0 -1
  187. package/dist/utils/dom.js +0 -1
  188. package/dist/utils/escape-html.js +0 -3
  189. package/dist/utils/field-sizing.d.ts +0 -2
  190. package/dist/utils/field-sizing.js +0 -2
  191. package/dist/utils/focus-handle.d.ts +0 -1
  192. package/dist/utils/focus-handle.js +0 -1
  193. package/dist/utils/focus-scope.d.ts +0 -1
  194. package/dist/utils/focus-scope.js +0 -1
  195. package/dist/utils/scroll-lock.d.ts +3 -4
  196. package/dist/utils/scroll-lock.js +3 -4
  197. package/dist/utils/tween.d.ts +0 -1
  198. package/dist/utils/tween.js +0 -1
  199. package/dist/utils/uuid.d.ts +0 -1
  200. package/dist/utils/uuid.js +0 -1
  201. package/dist/utils/warning.d.ts +0 -1
  202. package/dist/utils/warning.js +0 -1
  203. package/dist/video-player/progress-foundation.d.ts +0 -1
  204. package/dist/video-player/progress-foundation.js +0 -1
  205. package/dist/video-player/variables.scss +1 -1
  206. package/package.json +2 -2
@@ -4,7 +4,6 @@ export interface RadioGroupAdapter<P extends RadioGroupBaseProps = RadioGroupBas
4
4
  notifyChange: (e: RadioChangeEvent) => void;
5
5
  setValue: (value: any) => void;
6
6
  }
7
- /** The props the foundation reads with getProp */
8
7
  export interface RadioGroupBaseProps {
9
8
  mode?: string;
10
9
  value?: unknown;
@@ -42,10 +42,8 @@ export interface RatingState {
42
42
  value: number;
43
43
  hoverValue: number;
44
44
  clearedValue: number;
45
- /** index of the star that holds keyboard focus */
46
45
  focusVisibleStar?: number;
47
46
  }
48
- /** The props the foundation reads with getProps */
49
47
  export interface RatingBaseProps extends RatingValueProps {
50
48
  count?: number;
51
49
  allowHalf?: boolean;
@@ -75,7 +73,6 @@ export default class RatingFoundation<P extends RatingBaseProps = RatingBaseProp
75
73
  disabled: boolean;
76
74
  firstTabStop: boolean;
77
75
  }): RatingItemModel;
78
- /** Whether a focus on `value` belongs to the first (half) radio of the star at `index` */
79
76
  static isFirstRadio(value: number, index: number, allowHalf: boolean): boolean;
80
77
  /**
81
78
  * The value a click selects through the radio it hit, or undefined when it is an ordinary pointer click. Detail 0 is
@@ -83,7 +80,6 @@ export default class RatingFoundation<P extends RatingBaseProps = RatingBaseProp
83
80
  * activated radio decides the value
84
81
  */
85
82
  static resolveClickRadio(detail: number, radioValue?: number): number | undefined;
86
- /** What Enter or Space on a radio does: whether to `preventDefault` the key, and the value to select if any */
87
83
  static resolveKeyActivation(key: string, radioValue: number | undefined, value: number): {
88
84
  preventDefault: boolean;
89
85
  selectValue?: number;
@@ -96,7 +92,6 @@ export default class RatingFoundation<P extends RatingBaseProps = RatingBaseProp
96
92
  handleHover: (event: Pick<MouseEvent, "pageX">, index: number) => void;
97
93
  handleMouseLeave: () => void;
98
94
  handleClick: (event: CE & Pick<MouseEvent, "pageX">, index: number) => void;
99
- /** Commits `newValue` for the star at `index`; selecting the current value clears it when allowClear is on */
100
95
  handleSelect: (event: CE, index: number, newValue: number) => void;
101
96
  handleFocus: (e: FE) => void;
102
97
  /** A radio of the star at `index` got focus; index === count is the empty star */
@@ -64,7 +64,6 @@ var RatingFoundation = class RatingFoundation extends BaseFoundation {
64
64
  secondPosInSet: allowHalf ? isEmpty ? 2 * count + 1 : 2 * (index + 1) : index + 1
65
65
  };
66
66
  }
67
- /** Whether a focus on `value` belongs to the first (half) radio of the star at `index` */
68
67
  static isFirstRadio(value, index, allowHalf) {
69
68
  return allowHalf && value - index === .5;
70
69
  }
@@ -76,7 +75,6 @@ var RatingFoundation = class RatingFoundation extends BaseFoundation {
76
75
  static resolveClickRadio(detail, radioValue) {
77
76
  return detail === 0 ? radioValue : void 0;
78
77
  }
79
- /** What Enter or Space on a radio does: whether to `preventDefault` the key, and the value to select if any */
80
78
  static resolveKeyActivation(key, radioValue, value) {
81
79
  const isSpace = key === " ";
82
80
  if (key !== "Enter" && !isSpace || radioValue === void 0) return { preventDefault: false };
@@ -110,7 +108,6 @@ var RatingFoundation = class RatingFoundation extends BaseFoundation {
110
108
  handleClick = (event, index) => {
111
109
  this.handleSelect(event, index, this.getStarValue(index, event.pageX));
112
110
  };
113
- /** Commits `newValue` for the star at `index`; selecting the current value clears it when allowClear is on */
114
111
  handleSelect = (event, index, newValue) => {
115
112
  const { allowClear } = this.getProps();
116
113
  const value = RatingFoundation.deriveValue(this.getProps(), this.getStates());
@@ -19,7 +19,6 @@ export interface ResizeGroupAdapter<P extends ResizeGroupBaseProps = ResizeGroup
19
19
  getItemEnd: (index: number) => ResizeCallback | undefined;
20
20
  getItemDefaultSize: (index: number) => string | number | undefined;
21
21
  }
22
- /** The props the foundation reads with getProp */
23
22
  export interface ResizeGroupBaseProps {
24
23
  direction?: 'horizontal' | 'vertical';
25
24
  }
@@ -38,9 +37,6 @@ export declare class ResizeGroupFoundation<P extends ResizeGroupBaseProps = Resi
38
37
  * Re-runs initSpace the first time the group is measurable (#3336); later resizes must not, or the drag is lost.
39
38
  */
40
39
  handleGroupResize: () => void;
41
- /**
42
- * Moves each item's inline size to the new axis, where the handlers take a different length
43
- */
44
40
  handleDirectionChange: () => void;
45
41
  /**
46
42
  * Keyboard resize, reported like a drag: arrows move 1% of the group (Shift: 10%), Home and End go to the
@@ -185,7 +185,6 @@ var ResizeGroupFoundation = class extends BaseFoundation {
185
185
  nextItemSize: (this.#direction === "horizontal" ? nextItem.offsetWidth : nextItem.offsetHeight) + this.#itemMinusMap.get(handlerIndex + 1)
186
186
  };
187
187
  }
188
- /** Returns false when either item's onResizeStart returned false */
189
188
  #notifyResizeStart(handlerIndex, e) {
190
189
  const [lastDir, nextDir] = getItemDirection(this.#direction);
191
190
  const lastResult = this.adapter.getItemStart(handlerIndex)?.(e, lastDir);
@@ -203,9 +202,6 @@ var ResizeGroupFoundation = class extends BaseFoundation {
203
202
  handleGroupResize = () => {
204
203
  if (!this.#sizeInitialized && this.#groupSize > 0) this.#initSpace();
205
204
  };
206
- /**
207
- * Moves each item's inline size to the new axis, where the handlers take a different length
208
- */
209
205
  handleDirectionChange = () => {
210
206
  const [stale, current] = this.#direction === "horizontal" ? ["height", "width"] : ["width", "height"];
211
207
  this.#measureHandlerRoom();
@@ -111,7 +111,6 @@ $module: #{$prefix}-resizable;
111
111
  &-handler {
112
112
  @include flex-center;
113
113
  z-index: $z-resizable_handler;
114
- // a touch drag would otherwise scroll the page and cancel the pointer
115
114
  touch-action: none;
116
115
  user-select: none;
117
116
  background-color: var(--semi-color-fill-0);
@@ -1,6 +1,5 @@
1
1
  import BaseFoundation, { DefaultAdapter } from "../../base/foundation.js";
2
2
  import { Direction, ResizeCallback, ResizeStartCallback, Size } from "../types.js";
3
- /** The props the foundation reads */
4
3
  export interface ResizableBaseProps extends SizeProps {
5
4
  grid?: [number, number];
6
5
  snap?: {
@@ -73,10 +72,7 @@ export declare class ResizableFoundation<P extends ResizableBaseProps = Resizabl
73
72
  height: string;
74
73
  };
75
74
  init(): void;
76
- /**
77
- * Reads the size and limits for aria-valuenow, -valuemin and -valuemax. A change of the limits alone goes
78
- * unnoticed until the next resize.
79
- */
75
+ /** A change of the limits alone goes unnoticed until the next resize. */
80
76
  updateAriaRange: () => void;
81
77
  /**
82
78
  * Keyboard resize along the axis of the edge, KEYBOARD_STEP px per press, reported like a drag.
@@ -367,10 +367,7 @@ var ResizableFoundation = class ResizableFoundation extends BaseFoundation {
367
367
  init() {
368
368
  this.updateAriaRange();
369
369
  }
370
- /**
371
- * Reads the size and limits for aria-valuenow, -valuemin and -valuemax. A change of the limits alone goes
372
- * unnoticed until the next resize.
373
- */
370
+ /** A change of the limits alone goes unnoticed until the next resize. */
374
371
  updateAriaRange = () => {
375
372
  if (this.getStates().isResizing) return;
376
373
  this.#resizable = this.adapter.getResizable();
@@ -6,7 +6,6 @@ export interface Item {
6
6
  text?: string;
7
7
  disabled?: boolean;
8
8
  }
9
- /** The props the foundation reads with getProp */
10
9
  export interface ScrollItemBaseProps<I extends Item = Item> {
11
10
  cycled?: boolean;
12
11
  list?: I[];
@@ -51,6 +50,5 @@ export default class ItemFoundation<I extends Item = Item, P extends ScrollItemB
51
50
  syncList: () => void;
52
51
  /** The owner changed `selectedIndex` */
53
52
  syncSelectedIndex: (selectedIndex: number, previous: number) => void;
54
- /** Centres the item last selected */
55
53
  scrollToSelected: (duration?: number) => void;
56
54
  }
@@ -328,7 +328,6 @@ var ItemFoundation = class extends BaseFoundation {
328
328
  this.#cacheSelectedNode(this.#willSelectNode);
329
329
  this.scrollToSelected();
330
330
  };
331
- /** Centres the item last selected */
332
331
  scrollToSelected = (duration = numbers.DEFAULT_SCROLL_DURATION) => {
333
332
  this.#scrollToNode(this.#selectedNode, duration);
334
333
  };
@@ -1,5 +1,5 @@
1
1
  @use 'semi:theme' as *;
2
- // Color
2
+
3
3
  $color-scrollList-bg: var(--semi-color-bg-3); // 滚动列表背景色
4
4
  $color-scrollList-border: var(--semi-color-border); // 滚动列表描边颜色
5
5
  $color-scrollList_header-bg: transparent; // 滚动列表 header 背景色
@@ -14,7 +14,6 @@ $color-scrollList_selected_item-text: var(--semi-color-text-0); // 滚动列表
14
14
  $color-scrollList_selected_item-icon: var(--semi-color-text-2); // 滚动列表选中选项图标颜色
15
15
  $color-scrollList_footer-border: var(--semi-color-border); // 滚动列表底部描边颜色
16
16
 
17
- // Width/Height
18
17
  $height-scrollList: 300px;
19
18
  $height-scrollList_item: 36px;
20
19
  $width-scrollList_item-border: $border-thickness-control;
@@ -23,7 +22,6 @@ $width-scrollList_item_wheel_selector-border: $border-thickness-control;
23
22
  $height-scrollList_line: 1px;
24
23
  $width-scrollList_footer-border: $border-thickness-control;
25
24
 
26
- // Spacing
27
25
  $spacing-scrollList_header-paddingY: 0;
28
26
  $spacing-scrollList_header-paddingX: 16px;
29
27
  $spacing-scrollList_header_title-paddingY: $spacing-base;
@@ -39,12 +37,9 @@ $spacing-scrollList_item_wheel_list_shade_pre-marginTop: -1 * ($height-scrollLis
39
37
  $spacing-scrollList_item_wheel_list_shade_post-marginTop: $height-scrollList_item * 0.5 + $border-thickness-control;
40
38
  $spacing-scrollList_footer-padding: 10px;
41
39
 
42
- // Radius
43
40
  $radius-scrollList: var(--semi-border-radius-medium);
44
41
 
45
- // Font
46
42
  $font-scrollList_header_title-fontWeight: $font-weight-bold;
47
43
  $font-scrollList_item_wheel_item_selected-fontWeight: $font-weight-bold;
48
44
 
49
- // Other
50
45
  $shadow-scrollList: var(--semi-shadow-elevated);
@@ -1,7 +1,6 @@
1
1
  import BaseFoundation, { DefaultAdapter } from "../base/foundation.js";
2
2
  import { isComposing } from "../utils/key-code.js";
3
3
  import { BasicOptionProps, OptionRecord } from "./option-foundation.js";
4
- /** The props the foundation reads with getProps */
5
4
  export interface SelectBaseProps {
6
5
  allowCreate?: boolean;
7
6
  autoClearSearchValue?: boolean;
@@ -9,8 +9,8 @@ export interface BasicOptionProps {
9
9
  style?: Record<string, any>;
10
10
  }
11
11
  /**
12
- * What Select keeps for an option. `data` is what the host read from an optionList item or an option child, and is
13
- * all that callbacks and the selections receive; the rest is Select's own state, kept off the user's object.
12
+ * `data` is what the host read from an optionList item or an option child, and is all that callbacks and the
13
+ * selections receive; the rest is Select's own state, kept off the user's object.
14
14
  */
15
15
  export interface OptionRecord<D = BasicOptionProps, G = {
16
16
  label?: unknown;
@@ -37,7 +37,6 @@ export interface OptionRun<R extends {
37
37
  index: number;
38
38
  }[];
39
39
  }
40
- /** Splits the visible options into runs of adjacent options of the same group, keeping each option's visible index */
41
40
  export declare function getOptionRuns<R extends {
42
41
  group?: {
43
42
  key?: unknown;
@@ -9,7 +9,6 @@ function toOptionRecord(data, index, group, childKey) {
9
9
  selected: false
10
10
  };
11
11
  }
12
- /** Splits the visible options into runs of adjacent options of the same group, keeping each option's visible index */
13
12
  function getOptionRuns(options) {
14
13
  const runs = [];
15
14
  options.forEach((option, index) => {
@@ -1,5 +1,5 @@
1
1
  @use 'semi:theme' as *;
2
- // Color
2
+
3
3
  $color-select-bg-default: var(--semi-color-fill-0); // 选择器输入框背景色 - 默认态
4
4
  $color-select-bg-hover: var(--semi-color-fill-1); // 选择器输入框背景色 - 悬停态
5
5
  $color-select-bg-active: var(--semi-color-fill-2); // 选择器输入框背景色 - 按下态
@@ -35,7 +35,6 @@ $color-select_main-text-default: var(--semi-color-text-0); // 选择器输入框
35
35
  $color-select-icon-default: var(--semi-color-text-2); // 选择器输入框图标颜色
36
36
  $color-select_clearBtn-text-default: var(--semi-color-text-2); // 选择器输入框清空按钮颜色 - 默认态
37
37
  $color-select_clearBtn-text-hover: var(--semi-color-primary); // 选择器输入框清空按钮颜色 - 悬停态
38
- // $color-select_input-bg-default: transparent; // 选择器输入框清空按钮颜色 - 悬停态
39
38
  $color-select_input_disabled-bg: var(--semi-color-disabled-fill); // 禁用选择器输入框背景色
40
39
  $color-select_input_disabled-border-focus: transparent; // 禁用选择器输入框描边颜色 - 聚焦态
41
40
  $color-select_input_disabled-text: var(--semi-color-disabled-text); // 禁用选择器输入框回填内容文字颜色
@@ -50,7 +49,6 @@ $color-select_option-icon-default: transparent; // 选择器下拉菜单选项
50
49
  $color-select_option-bg-hover: var(--semi-color-fill-0); // 选择器下拉菜单选项背景颜色 - 悬停态
51
50
  $color-select_option-bg-active: var(--semi-color-fill-1); // 选择器下拉菜单选项背景颜色 - 按下态
52
51
  $color-select_option_disabled-text: var(--semi-color-disabled-text); // 禁用选择器下拉菜单选项文字颜色
53
- // $color-select_option_disabled-bg: transparent; // 禁用选择器下拉菜单选项背景颜色
54
52
  $color-select_option-icon-active: var(--semi-color-text-2); // 选择器下拉菜单选项图标颜色 - 选中态
55
53
  $color-select_option-border-default: var(--semi-color-border); // 选择器下拉菜单分组标题分割线颜色
56
54
  $color-select-option-bg-selected: transparent; // 选择器下拉菜单选项背景颜色 - 选中态
@@ -59,7 +57,6 @@ $color-select_group-text: var(--semi-color-text-2); // 选择器下拉菜单分
59
57
 
60
58
  $color-select_prefix_suffix_text-default: var(--semi-color-text-2); // 选择器输入框前后缀文本颜色
61
59
 
62
- // Width/Height
63
60
  $height-select_large: $height-control-large; // 选择器输入框高度 - 大尺寸
64
61
  $height-select_small: $height-control-small; // 选择器输入框高度 - 小尺寸
65
62
  $height-select_default: $height-control-default; // 选择器输入框高度 - 默认尺寸
@@ -77,7 +74,6 @@ $height-select_multiple_input_large: 24px; // 大尺寸多项选择器输入框I
77
74
  $width-select-border-hover: $width-select-border; // 选择器输入框描边宽度 - 悬浮
78
75
  $width-select-border-focus: $width-select-border-hover; // 选择器输入框描边宽度 - 按下
79
76
  $width-select-border-active: $width-select-border-focus; // 选择器输入框描边宽度 - 选中
80
- // Spacing
81
77
  $spacing-select_option_tick-marginRight: $spacing-tight; // 选择器下拉菜单选中对勾右侧外边距
82
78
  $spacing-select_prefix_suffix_text-marginX: $spacing-base-tight; // 选择器输入框前后缀文本水平内边距
83
79
  $spacing-select_prefix_suffix_text-marginY: 0px; // 选择器输入框前后缀文本垂直内边距
@@ -115,14 +111,11 @@ $spacing-select_dropdown_input_paddingBottom: 8px; // 下拉搜索框底部内
115
111
  $spacing-select_dropdown_input_paddingRight: 12px; // 下拉搜索框右侧内边距
116
112
  $spacing-select_dropdown_input_paddingLeft: 12px; // 下拉搜索框左侧内边距
117
113
 
118
- // Radius
119
114
  $radius-select: var(--semi-border-radius-small); // 选择器输入框圆角
120
115
  $radius-select_option: 0px; // 选择器待选项圆角
121
116
 
122
- // Font
123
117
  $font-select-fontWeight: $font-weight-regular; // 选择器文本字重
124
118
  $font-select_keyword-fontWeight: 600; // 选择器搜索结果命关键词中文本字重
125
119
  $font-select_prefix_suffix-fontWeight: $font-weight-bold; // 选择器输入框前后缀文本字重
126
120
 
127
- // Other
128
121
  $opacity-select_selection_text_inactive: 0.4;
@@ -46,17 +46,12 @@ export interface SideSheetAdapter<P extends SideSheetProps = SideSheetProps, S e
46
46
  /** Traps focus in the sheet; a no-op without mask, which is not modal */
47
47
  trapFocus: () => void;
48
48
  releaseFocus: () => void;
49
- /** Focuses the element focused before the sheet opened */
50
49
  restoreFocus: () => void;
51
50
  toggleDisplayNone: (displayNone: boolean) => void;
52
51
  }
53
52
  export default class SideSheetFoundation<P extends SideSheetProps = SideSheetProps, S extends SideSheetState = SideSheetState> extends BaseFoundation<SideSheetAdapter<P, S>, P, S> {
54
53
  #private;
55
- /**
56
- * A top or bottom sheet spans the width unless `canVerticalSetWidth`, and takes `height` (448 by default); a left or
57
- * right sheet spans the height. Without a mask the width goes on the outer element and the dialog fills it: a
58
- * percentage repeated on the dialog would compound.
59
- */
54
+ /** Without a mask the width goes on the outer element and the dialog fills it: a percentage repeated on the dialog would compound. */
60
55
  static getSheetSize({ placement, canVerticalSetWidth, width, height, mask }: Pick<SideSheetProps, 'placement' | 'width' | 'height' | 'mask'> & {
61
56
  canVerticalSetWidth?: boolean;
62
57
  }): SheetSize;
@@ -7,11 +7,7 @@ var SideSheetFoundation = class extends BaseFoundation {
7
7
  this.handleCancel(e);
8
8
  return true;
9
9
  };
10
- /**
11
- * A top or bottom sheet spans the width unless `canVerticalSetWidth`, and takes `height` (448 by default); a left or
12
- * right sheet spans the height. Without a mask the width goes on the outer element and the dialog fills it: a
13
- * percentage repeated on the dialog would compound.
14
- */
10
+ /** Without a mask the width goes on the outer element and the dialog fills it: a percentage repeated on the dialog would compound. */
15
11
  static getSheetSize({ placement, canVerticalSetWidth, width, height, mask }) {
16
12
  const horizontal = placement === "top" || placement === "bottom";
17
13
  const sheetWidth = horizontal && !canVerticalSetWidth ? "100%" : width;
@@ -1,11 +1,10 @@
1
1
  @use 'semi:theme' as *;
2
- // Color
2
+
3
3
  $color-sideSheet_mask-bg: var(--semi-color-overlay-bg); // 侧边栏打开后蒙层颜色
4
4
  $color-sideSheet-bg: var(--semi-color-bg-2); // 侧边栏背景颜色
5
5
  $color-sideSheet_main-text: var(--semi-color-text-0); // 侧边栏默认文本颜色
6
6
  $color-sideSheet_header-borderBottom: var(--semi-color-border); // 侧边栏 header 底部边框颜色
7
7
 
8
- // Spacing
9
8
  $spacing-sideSheet-margin: 0; // 侧边栏整体外边距
10
9
  $spacing-sideSheet_title-margin: 0; // 侧边栏标题外边距
11
10
  $spacing-sideSheet_header-padding: $spacing-loose; // 侧边栏 header 内边距
@@ -19,7 +18,6 @@ $width-sideSheet_size-small: 448px; // 小尺寸侧边栏宽度
19
18
  $width-sideSheet_size-medium: 684px; // 中尺寸侧边栏宽度
20
19
  $width-sideSheet_size-large: 920px; // 大尺寸侧边栏宽度
21
20
 
22
- // Font
23
21
  $font-sideSheet_title-fontWeight: $font-weight-bold; // 侧边栏标题文本字重
24
22
  $font-sideSheet_title-fontSize: $font-size-header-5; // 侧边栏标题文本字号
25
23
 
@@ -66,9 +66,6 @@ export default class SliderFoundation<P extends SliderProps = SliderProps, S ext
66
66
  x: number;
67
67
  y: number;
68
68
  };
69
- /**
70
- * Clamps a pointer position to the slider's start and end
71
- */
72
69
  protected checkMeetMinMax(position: number): number;
73
70
  /** Position to value snapped to step; false when nothing changes or the slider has no layout */
74
71
  protected transPosToValue(mousePos: number, isMin: boolean): any;
@@ -77,16 +74,11 @@ export default class SliderFoundation<P extends SliderProps = SliderProps, S ext
77
74
  protected calculateOutputValue(position: number, isMin: boolean): undefined | number | number[];
78
75
  protected checkWhichHandle(pagePos: number): boolean;
79
76
  static getInitialState(props: SliderProps): SliderState;
80
- /**
81
- * Percentages of the current value; they increase with value whatever the visual direction.
82
- */
77
+ /** The percentages increase with value whatever the visual direction. */
83
78
  static getMinAndMaxPercent({ range, min, max }: SliderProps, value: SliderState['currentValue']): {
84
79
  min: number;
85
80
  max: number;
86
81
  };
87
- /**
88
- * Whether each handle shows its tooltip, and the tooltip contents
89
- */
90
82
  static computeHandleVisibleVal({ tooltipVisible, tipFormatter: formatter, range, step, min }: SliderProps, { activeHandle, currentValue, isInRenderTree }: SliderState): {
91
83
  tipVisible: {
92
84
  min: boolean;
@@ -128,9 +120,6 @@ export default class SliderFoundation<P extends SliderProps = SliderProps, S ext
128
120
  destroy(): void;
129
121
  /** An event handler, so the tooltips follow a container that was hidden */
130
122
  syncIsInRenderTree: () => void;
131
- /**
132
- * Syncs a changed value prop, clamped to min and max
133
- */
134
123
  handleValueChange: (nextValue: SliderProps["value"]) => void;
135
124
  /** A value prop back to undefined (a Form reset) returns to the default position */
136
125
  resetValue: () => void;
@@ -77,7 +77,6 @@ var SliderFoundation = class SliderFoundation extends BaseFoundation {
77
77
  #notifyAfterChange() {
78
78
  this.adapter.notifyAfterChange(this.normalizeValue(this.getState("currentValue")));
79
79
  }
80
- /** A controlled value only moves through the value prop */
81
80
  #moveHandle(nextValue, callback) {
82
81
  this.syncIsInRenderTree();
83
82
  if (!this.getState("isInRenderTree")) return;
@@ -134,9 +133,6 @@ var SliderFoundation = class SliderFoundation extends BaseFoundation {
134
133
  y: clientY - parentY
135
134
  };
136
135
  }
137
- /**
138
- * Clamps a pointer position to the slider's start and end
139
- */
140
136
  checkMeetMinMax(position) {
141
137
  const { vertical, verticalReverse } = this.adapter.getProps();
142
138
  const isRTL = this.adapter.getContext("direction") === "rtl" && !vertical;
@@ -220,9 +216,7 @@ var SliderFoundation = class SliderFoundation extends BaseFoundation {
220
216
  focusVisibleHandle: ""
221
217
  };
222
218
  }
223
- /**
224
- * Percentages of the current value; they increase with value whatever the visual direction.
225
- */
219
+ /** The percentages increase with value whatever the visual direction. */
226
220
  static getMinAndMaxPercent({ range, min, max }, value) {
227
221
  const minPercent = range ? (value[0] - min) / (max - min) : (value - min) / (max - min);
228
222
  const maxPercent = range ? (value[1] - min) / (max - min) : 1;
@@ -231,9 +225,6 @@ var SliderFoundation = class SliderFoundation extends BaseFoundation {
231
225
  max: clamp(maxPercent, 0, 1)
232
226
  };
233
227
  }
234
- /**
235
- * Whether each handle shows its tooltip, and the tooltip contents
236
- */
237
228
  static computeHandleVisibleVal({ tooltipVisible, tipFormatter: formatter, range, step, min }, { activeHandle, currentValue, isInRenderTree }) {
238
229
  const visible = tooltipVisible && isInRenderTree;
239
230
  const output = (value) => SliderFoundation.normalizeValue(step, min, activeHandle, value);
@@ -318,9 +309,6 @@ var SliderFoundation = class SliderFoundation extends BaseFoundation {
318
309
  const isInRenderTree = Boolean(slider && (slider.offsetWidth || slider.offsetHeight || slider.getClientRects().length));
319
310
  if (isInRenderTree !== this.getState("isInRenderTree")) this.setState({ isInRenderTree });
320
311
  };
321
- /**
322
- * Syncs a changed value prop, clamped to min and max
323
- */
324
312
  handleValueChange = (nextValue) => {
325
313
  if (!this.valueFormatIsCorrect(nextValue)) return;
326
314
  this.setState({ currentValue: this.#clampToRange(nextValue) });
@@ -1,6 +1,6 @@
1
1
  @use 'semi:theme' as *;
2
2
  @use '../base/mixin' as *;
3
- // Color
3
+
4
4
  $color-slider-text-default: var(--semi-color-text-0); // 滑动条文本颜色 - 默认
5
5
  $color-slider_dot-bg-default: var(--semi-color-white); // 滑动条圆形刻度点颜色 - 默认态
6
6
  $color-slider_dot-border-active: var(--semi-color-white); // 滑动条圆形刻度点描边颜色 - 按下态
@@ -18,7 +18,6 @@ $color-slider_track_disabled-bg: var(--semi-color-primary-disabled); // 禁用
18
18
  $color-slider_handle-focus: $color-focus-ring; // 圆形按钮轮廓 - 聚焦
19
19
  $color-slider_handle_dot: var(--semi-color-primary); // 圆形按钮内部圆点颜色
20
20
 
21
- // Spacing
22
21
  $spacing-slider-paddingX: 13px; // 滑动条整体水平内边距
23
22
  $spacing-slider-paddingY: 0px; // 滑动条整体垂直内边距
24
23
  $spacing-slider-margin: 0px; // 滑动条整体外边距
@@ -45,11 +44,9 @@ $spacing-slider_vertical_handle-translateX: 0px; // 垂直滑动条原型按钮
45
44
  $spacing-slider_dot-translateX: 0px; // 水平滑动条圆形刻度点水平偏移量
46
45
  $spacing-slider_vertical_dot-translateY: 0px; // 垂直滑动条圆形刻度点垂直偏移量
47
46
 
48
- // Radius
49
47
  $radius-slider_rail: var(--semi-border-radius-small); // 滚动条未填充轨道圆角
50
48
  $radius-slider_track: var(--semi-border-radius-small); // 滚动条已填充轨道圆角
51
49
 
52
- // Width/Height
53
50
  $height-slider_wrapper: 32px; // 滚动条容器整体高度
54
51
  $height-slider_vertical_wrapper: 4px; // 垂直滚动条整体宽度
55
52
  $height-slider_rail: 4px; // 滚动条未填充轨道高度
@@ -61,7 +58,6 @@ $width-slider_handle_border_disabled: 1px; // 禁用滚动条圆形按钮按下
61
58
  $width-slider_handle-focus: $width-focus-ring; // 圆形按钮轮廓 - 聚焦
62
59
  $width-slider_handle_dot: 4px; // 圆形按钮内部圆点宽度
63
60
 
64
- // Font
65
61
  $font-slider_rail-fontSize: 14px; // 滚动条轨道文本字号
66
62
  $font-slider_marks-fontSize: 14px; // 滚动条刻度标签字号
67
63
  $font-slider_rail-lineHeight: 1.5; // 滚动条轨道文本行高倍数
@@ -2,13 +2,11 @@ import BaseFoundation, { DefaultAdapter } from "../base/foundation.js";
2
2
  export interface SpinAdapter<P extends SpinBaseProps = SpinBaseProps, S extends object = object> extends DefaultAdapter<P, S> {
3
3
  setLoading: (val: boolean) => void;
4
4
  }
5
- /** The props the foundation reads with getProps */
6
5
  export interface SpinBaseProps {
7
6
  delay?: number;
8
7
  }
9
8
  export default class SpinFoundation<P extends SpinBaseProps = SpinBaseProps, S extends object = object> extends BaseFoundation<SpinAdapter<P, S>, P, S> {
10
9
  #private;
11
- /** Shows the spinner after `delay`; stopping hides it at once and drops a pending show */
12
10
  handleSpinningChange: (spinning: boolean) => void;
13
11
  /**
14
12
  * Called when the content under `root` becomes inert (`blocked`) or interactive again. inert drops focus to <body> on
@@ -8,7 +8,6 @@ var SpinFoundation = class extends BaseFoundation {
8
8
  clearTimeout(this.#timer);
9
9
  this.#timer = null;
10
10
  }
11
- /** Shows the spinner after `delay`; stopping hides it at once and drops a pending show */
12
11
  handleSpinningChange = (spinning) => {
13
12
  this.#clearTimer();
14
13
  const { delay } = this.getProps();
@@ -1,11 +1,9 @@
1
1
  @use 'semi:theme' as *;
2
- // Color
2
+
3
3
  $color-spin-bg: var(--semi-color-primary); // 加载图标背景颜色
4
4
 
5
- // Width
6
5
  $width-spin_large: 32px; // 加载图标尺寸 - 大
7
6
  $width-spin_middle: 20px; // 加载图标尺寸 - 中
8
7
  $width-spin_small: 14px; // 加载图标尺寸 - 小
9
8
 
10
- // Other
11
9
  $opacity-spin_children: 0.5; // 加载图标透明度
@@ -11,7 +11,6 @@ interface SwitchCheckedProps {
11
11
  export interface SwitchState {
12
12
  checked?: boolean;
13
13
  }
14
- /** The props the foundation reads with getProps */
15
14
  export interface SwitchBaseProps extends SwitchCheckedProps {
16
15
  loading?: boolean;
17
16
  }
@@ -136,7 +136,7 @@ $module: #{$prefix}-switch;
136
136
  top: 0;
137
137
  width: 100%;
138
138
  height: 100%;
139
- margin: 0; // reset the UA margin
139
+ margin: 0;
140
140
  pointer-events: auto;
141
141
  cursor: inherit;
142
142
  opacity: 0;
@@ -1,6 +1,6 @@
1
1
  @use 'semi:theme' as *;
2
2
  @use '../base/mixin' as *;
3
- // Other
3
+
4
4
  $spacing-switch_unchecked-translateX: 2px; // 未选中态开关滑块位移距离
5
5
  $spacing-switch_spin_unchecked-translateX: 2px; // 未选中态加载图标位移距离
6
6
  $spacing-switch_checked-translateX: 18px; // 选中态开关滑块位移距离
@@ -17,7 +17,6 @@ $spacing-switch_checked_small-translateX: 11px; // 小尺寸选中态开关滑
17
17
  $spacing-switch_spin_checked_small-translateX: 10px; // 小尺寸选中态加载图标位移距离
18
18
  $motion-switch-transitionDuration: 200ms; // 开关动画时长
19
19
 
20
- // Color
21
20
  $color-switch_default-bg-default: var(--semi-color-fill-0); // 关闭态(未选中)开关背景色 - 默认
22
21
  $color-switch_default-bg-hover: var(--semi-color-fill-1); // 关闭态开关背景色 - 悬浮
23
22
  $color-switch_default-bg-active: var(--semi-color-fill-2); // 关闭态开关背景色 - 按下
@@ -42,7 +41,6 @@ $color-switch_spin_checked-bg-default: var(--semi-color-success-hover); // 已
42
41
  $color-switch_spin_unchecked-bg-default: var(--semi-color-fill-1); // 已关闭开关加载态loading背景颜色
43
42
  $color-switch_primary-outline-focus: $color-focus-ring; // 开关轮廓 - 聚焦
44
43
 
45
- // Width/Height
46
44
  $width-switch: 40px; // 开关宽度
47
45
  $height-switch: 24px; // 开关高度
48
46
  $width-switch_knob_expand: 6px; // 开关滑块按压时延展宽度
@@ -63,13 +61,11 @@ $width-switch_spin-default: 18px; // 默认尺寸开关加载 spin 宽度
63
61
  $width-switch_spin-large: 28px; // 大尺寸开关加载 spin 宽度
64
62
  $width-switch-outline: $width-focus-ring; // 开关轮廓宽度
65
63
 
66
- // Spacing
67
64
  $spacing-switch_knob-padding: 2px; // 开关滑块顶部边距
68
65
  $spacing-switch_knob_large-padding: 3px; // 大尺寸开关滑块顶部边距
69
66
  $spacing-switch_knob_small-padding: 1px; // 小尺寸开关滑块顶部边距
70
67
  $spacing-switch_knob-left: 0px; // 开关滑块左侧偏移距离
71
68
 
72
- // Radius
73
69
  $radius-switch: $height-switch * 0.5; // 开关圆角
74
70
  $radius-switch_large: $height-switch_large * 0.5; // 大尺寸开关圆角
75
71
  $radius-switch_small: $height-switch_small * 0.5; // 小尺寸开关圆角