@fibrae/semi-foundation 0.1.1 → 0.2.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 (194) hide show
  1. package/dist/anchor/foundation.d.ts +1 -1
  2. package/dist/anchor/foundation.js +21 -21
  3. package/dist/audio-player/foundation.d.ts +10 -10
  4. package/dist/audio-player/foundation.js +19 -19
  5. package/dist/auto-complete/foundation.d.ts +12 -12
  6. package/dist/auto-complete/foundation.js +51 -51
  7. package/dist/avatar/foundation.d.ts +5 -5
  8. package/dist/avatar/foundation.js +16 -16
  9. package/dist/backtop/foundation.d.ts +2 -2
  10. package/dist/backtop/foundation.js +7 -7
  11. package/dist/banner/foundation.d.ts +1 -1
  12. package/dist/banner/foundation.js +4 -4
  13. package/dist/base/auto-close-foundation.d.ts +8 -8
  14. package/dist/base/auto-close-foundation.js +15 -15
  15. package/dist/base/foundation.d.ts +4 -3
  16. package/dist/base/foundation.js +12 -11
  17. package/dist/breadcrumb/foundation.d.ts +5 -5
  18. package/dist/breadcrumb/foundation.js +9 -10
  19. package/dist/breadcrumb/item-foundation.d.ts +3 -3
  20. package/dist/breadcrumb/item-foundation.js +6 -6
  21. package/dist/calendar/event-util.js +1 -1
  22. package/dist/calendar/foundation.js +4 -4
  23. package/dist/calendar/month-foundation.d.ts +2 -2
  24. package/dist/calendar/month-foundation.js +6 -6
  25. package/dist/carousel/foundation.d.ts +17 -17
  26. package/dist/carousel/foundation.js +51 -51
  27. package/dist/cascader/foundation.d.ts +34 -26
  28. package/dist/cascader/foundation.js +143 -121
  29. package/dist/checkbox/checkbox-foundation.d.ts +2 -2
  30. package/dist/checkbox/checkbox-foundation.js +15 -15
  31. package/dist/checkbox/checkbox-group-foundation.d.ts +2 -2
  32. package/dist/checkbox/checkbox-group-foundation.js +8 -8
  33. package/dist/code-highlight/index.d.ts +1 -1
  34. package/dist/code-highlight/index.js +3 -3
  35. package/dist/collapse/foundation.d.ts +2 -2
  36. package/dist/collapse/foundation.js +7 -7
  37. package/dist/collapsible/foundation.d.ts +3 -3
  38. package/dist/collapsible/foundation.js +8 -8
  39. package/dist/color-picker/alpha-slider-foundation.d.ts +2 -4
  40. package/dist/color-picker/alpha-slider-foundation.js +10 -10
  41. package/dist/color-picker/color-choose-area-foundation.d.ts +2 -5
  42. package/dist/color-picker/color-choose-area-foundation.js +14 -14
  43. package/dist/color-picker/color-slider-foundation.d.ts +2 -4
  44. package/dist/color-picker/color-slider-foundation.js +10 -10
  45. package/dist/color-picker/data-part-foundation.d.ts +5 -5
  46. package/dist/color-picker/data-part-foundation.js +11 -11
  47. package/dist/color-picker/foundation.d.ts +4 -4
  48. package/dist/color-picker/foundation.js +10 -10
  49. package/dist/config-provider/breakpoint-observer.d.ts +3 -3
  50. package/dist/config-provider/breakpoint-observer.js +6 -6
  51. package/dist/cropper/foundation.d.ts +15 -15
  52. package/dist/cropper/foundation.js +26 -23
  53. package/dist/date-picker/_utils/picker-type.d.ts +1 -1
  54. package/dist/date-picker/foundation.d.ts +36 -36
  55. package/dist/date-picker/foundation.js +125 -129
  56. package/dist/date-picker/input-foundation.d.ts +9 -9
  57. package/dist/date-picker/input-foundation.js +28 -28
  58. package/dist/date-picker/months-grid-foundation.d.ts +16 -16
  59. package/dist/date-picker/months-grid-foundation.js +64 -65
  60. package/dist/date-picker/year-and-month-foundation.d.ts +3 -3
  61. package/dist/date-picker/year-and-month-foundation.js +11 -11
  62. package/dist/drag-move/foundation.d.ts +2 -2
  63. package/dist/drag-move/foundation.js +15 -13
  64. package/dist/dropdown/foundation.d.ts +8 -5
  65. package/dist/dropdown/foundation.js +32 -28
  66. package/dist/dropdown/menu-foundation.d.ts +1 -1
  67. package/dist/dropdown/menu-foundation.js +11 -11
  68. package/dist/feedback/foundation.d.ts +9 -9
  69. package/dist/feedback/foundation.js +33 -33
  70. package/dist/form/form-api-proxy.d.ts +8 -7
  71. package/dist/form/form-api-proxy.js +25 -25
  72. package/dist/form/foundation.d.ts +5 -5
  73. package/dist/form/foundation.js +60 -61
  74. package/dist/highlight/foundation.js +1 -1
  75. package/dist/hot-keys/foundation.d.ts +2 -2
  76. package/dist/hot-keys/foundation.js +5 -5
  77. package/dist/image/image-foundation.d.ts +4 -4
  78. package/dist/image/image-foundation.js +10 -10
  79. package/dist/image/preview-footer-foundation.d.ts +3 -3
  80. package/dist/image/preview-footer-foundation.js +10 -10
  81. package/dist/image/preview-foundation.js +7 -6
  82. package/dist/image/preview-image-foundation.d.ts +6 -8
  83. package/dist/image/preview-image-foundation.js +14 -14
  84. package/dist/image/preview-inner-foundation.d.ts +9 -9
  85. package/dist/image/preview-inner-foundation.js +38 -38
  86. package/dist/input/foundation.d.ts +10 -10
  87. package/dist/input/foundation.js +47 -49
  88. package/dist/input/text-entry-foundation.d.ts +3 -3
  89. package/dist/input/text-entry-foundation.js +14 -14
  90. package/dist/input/textarea-foundation.d.ts +7 -7
  91. package/dist/input/textarea-foundation.js +36 -36
  92. package/dist/input-number/foundation.d.ts +16 -14
  93. package/dist/input-number/foundation.js +54 -53
  94. package/dist/json-viewer/foundation.d.ts +8 -8
  95. package/dist/json-viewer/foundation.js +23 -23
  96. package/dist/lottie/foundation.d.ts +1 -1
  97. package/dist/lottie/foundation.js +4 -4
  98. package/dist/markdown-render/foundation.d.ts +1 -1
  99. package/dist/markdown-render/foundation.js +4 -4
  100. package/dist/modal/modal-content-foundation.d.ts +7 -7
  101. package/dist/modal/modal-content-foundation.js +20 -20
  102. package/dist/modal/modal-foundation.d.ts +6 -6
  103. package/dist/modal/modal-foundation.js +24 -24
  104. package/dist/navigation/foundation.d.ts +1 -1
  105. package/dist/navigation/foundation.js +14 -14
  106. package/dist/navigation/item-foundation.d.ts +1 -1
  107. package/dist/navigation/item-foundation.js +8 -8
  108. package/dist/navigation/sub-nav-foundation.d.ts +3 -3
  109. package/dist/navigation/sub-nav-foundation.js +17 -17
  110. package/dist/notification/notification-list-foundation.d.ts +7 -7
  111. package/dist/notification/notification-list-foundation.js +12 -12
  112. package/dist/overflow-list/foundation.d.ts +4 -4
  113. package/dist/overflow-list/foundation.js +18 -18
  114. package/dist/pagination/foundation.d.ts +8 -8
  115. package/dist/pagination/foundation.js +28 -28
  116. package/dist/pincode/foundation.d.ts +5 -5
  117. package/dist/pincode/foundation.js +22 -22
  118. package/dist/popconfirm/popconfirm-foundation.d.ts +7 -7
  119. package/dist/popconfirm/popconfirm-foundation.js +26 -26
  120. package/dist/radio/radio-foundation.d.ts +5 -5
  121. package/dist/radio/radio-foundation.js +15 -15
  122. package/dist/radio/radio-group-foundation.d.ts +2 -2
  123. package/dist/radio/radio-group-foundation.js +9 -9
  124. package/dist/rating/foundation.d.ts +10 -10
  125. package/dist/rating/foundation.js +35 -35
  126. package/dist/resizable/group/index.d.ts +6 -6
  127. package/dist/resizable/group/index.js +40 -40
  128. package/dist/resizable/single/index.d.ts +2 -2
  129. package/dist/resizable/single/index.js +9 -9
  130. package/dist/scroll-list/item-foundation.d.ts +7 -7
  131. package/dist/scroll-list/item-foundation.js +35 -35
  132. package/dist/select/foundation.d.ts +42 -56
  133. package/dist/select/foundation.js +214 -279
  134. package/dist/select/option-foundation.d.ts +23 -27
  135. package/dist/select/option-foundation.js +10 -18
  136. package/dist/side-sheet/side-sheet-foundation.d.ts +6 -6
  137. package/dist/side-sheet/side-sheet-foundation.js +22 -22
  138. package/dist/slider/foundation.d.ts +16 -16
  139. package/dist/slider/foundation.js +46 -46
  140. package/dist/sortable/accessibility.d.ts +1 -1
  141. package/dist/sortable/accessibility.js +2 -2
  142. package/dist/spin/foundation.d.ts +2 -2
  143. package/dist/spin/foundation.js +6 -6
  144. package/dist/steps/utils.d.ts +1 -1
  145. package/dist/switch/foundation.d.ts +2 -2
  146. package/dist/switch/foundation.js +7 -7
  147. package/dist/table/foundation.d.ts +14 -14
  148. package/dist/table/foundation.js +93 -93
  149. package/dist/table/utils.d.ts +2 -2
  150. package/dist/tabs/foundation.d.ts +5 -5
  151. package/dist/tabs/foundation.js +17 -17
  152. package/dist/tag-input/foundation.d.ts +11 -11
  153. package/dist/tag-input/foundation.js +52 -52
  154. package/dist/time-picker/foundation.d.ts +13 -13
  155. package/dist/time-picker/foundation.js +39 -39
  156. package/dist/time-picker/input-foundation.d.ts +4 -4
  157. package/dist/time-picker/input-foundation.js +13 -13
  158. package/dist/toast/toast-list-foundation.d.ts +7 -7
  159. package/dist/toast/toast-list-foundation.js +14 -14
  160. package/dist/tooltip/foundation.d.ts +9 -9
  161. package/dist/tooltip/foundation.js +67 -61
  162. package/dist/transfer/foundation.d.ts +22 -9
  163. package/dist/transfer/foundation.js +38 -23
  164. package/dist/tree/foundation.d.ts +14 -14
  165. package/dist/tree/foundation.js +61 -61
  166. package/dist/tree/shared.d.ts +1 -1
  167. package/dist/tree-select/foundation.d.ts +26 -20
  168. package/dist/tree-select/foundation.js +91 -83
  169. package/dist/typography/ellipsis.d.ts +4 -4
  170. package/dist/typography/ellipsis.js +8 -8
  171. package/dist/typography/format-numeral.d.ts +1 -1
  172. package/dist/typography/format-numeral.js +2 -2
  173. package/dist/upload/constants.d.ts +1 -1
  174. package/dist/upload/foundation.d.ts +17 -17
  175. package/dist/upload/foundation.js +92 -92
  176. package/dist/upload/utils.d.ts +3 -3
  177. package/dist/upload/utils.js +6 -6
  178. package/dist/user-guide/foundation.d.ts +3 -3
  179. package/dist/user-guide/foundation.js +19 -19
  180. package/dist/utils/a11y.d.ts +1 -1
  181. package/dist/utils/announcer.d.ts +2 -2
  182. package/dist/utils/announcer.js +4 -4
  183. package/dist/utils/focus-handle.d.ts +1 -1
  184. package/dist/utils/focus-handle.js +1 -2
  185. package/dist/utils/focus-scope.d.ts +5 -5
  186. package/dist/utils/focus-scope.js +10 -10
  187. package/dist/utils/is-promise.d.ts +1 -1
  188. package/dist/utils/release-holder.d.ts +2 -2
  189. package/dist/utils/release-holder.js +4 -4
  190. package/dist/video-player/foundation.d.ts +15 -15
  191. package/dist/video-player/foundation.js +89 -89
  192. package/dist/video-player/progress-foundation.d.ts +2 -2
  193. package/dist/video-player/progress-foundation.js +12 -12
  194. package/package.json +2 -2
@@ -10,7 +10,7 @@ var PaginationFoundation = class PaginationFoundation extends BaseFoundation {
10
10
  page = Math.trunc(page);
11
11
  if (page > totalPageNum) page = totalPageNum;
12
12
  if (page <= 0) page = 1;
13
- this._adapter.updateQuickJumpPage("");
13
+ this.adapter.updateQuickJumpPage("");
14
14
  this.goPage(page);
15
15
  }
16
16
  static getInitialState(props) {
@@ -126,50 +126,50 @@ var PaginationFoundation = class PaginationFoundation extends BaseFoundation {
126
126
  const firstLargerIndex = pageSizeOpts.findIndex((el) => el > pageSize);
127
127
  return firstLargerIndex === -1 ? [...pageSizeOpts, pageSize] : pageSizeOpts.toSpliced(firstLargerIndex, 0, pageSize);
128
128
  }
129
- goPage(targetPageIndex) {
129
+ goPage = (targetPageIndex) => {
130
130
  if (targetPageIndex === "...") return;
131
131
  const { pageSize, currentPage } = this.getStates();
132
132
  if (targetPageIndex === currentPage) return;
133
- if (!this._isControlledComponent("currentPage")) this.updatePage(targetPageIndex);
134
- this._adapter.notifyPageChange(targetPageIndex);
135
- this._adapter.notifyChange(targetPageIndex, pageSize);
136
- }
137
- updatePage(targetPageIndex = 1, pageSize) {
133
+ if (!this.isControlledComponent("currentPage")) this.updatePage(targetPageIndex);
134
+ this.adapter.notifyPageChange(targetPageIndex);
135
+ this.adapter.notifyChange(targetPageIndex, pageSize);
136
+ };
137
+ updatePage = (targetPageIndex = 1, pageSize) => {
138
138
  const { currentPage, pageSize: currentPageSize } = this.getStates();
139
139
  const newPageSize = pageSize ?? currentPageSize;
140
- if (targetPageIndex !== currentPage) this._adapter.setCurrentPage(targetPageIndex);
141
- if (newPageSize !== currentPageSize) this._adapter.updatePageSize(newPageSize);
142
- }
143
- goPrev() {
140
+ if (targetPageIndex !== currentPage) this.adapter.setCurrentPage(targetPageIndex);
141
+ if (newPageSize !== currentPageSize) this.adapter.updatePageSize(newPageSize);
142
+ };
143
+ goPrev = () => {
144
144
  const { currentPage } = this.getStates();
145
145
  if (currentPage > 1) this.goPage(currentPage - 1);
146
- }
147
- goNext() {
146
+ };
147
+ goNext = () => {
148
148
  const { currentPage, pageSize } = this.getStates();
149
149
  if (currentPage <= PaginationFoundation.getTotalPageNumber(this.getProp("total"), pageSize) - 1) this.goPage(currentPage + 1);
150
- }
151
- changePageSize(newPageSize) {
150
+ };
151
+ changePageSize = (newPageSize) => {
152
152
  const { pageSize, currentPage } = this.getStates();
153
- this._adapter.updatePageSize(newPageSize);
154
- this._adapter.notifyPageSizeChange(newPageSize);
153
+ this.adapter.updatePageSize(newPageSize);
154
+ this.adapter.notifyPageSizeChange(newPageSize);
155
155
  let newCurrentPage = currentPage;
156
156
  if (!this.getProp("preventPageChangeOnPageSizeChange")) {
157
157
  const currentPageFirstItemIndex = (currentPage - 1) * pageSize + 1;
158
158
  newCurrentPage = Math.ceil(currentPageFirstItemIndex / newPageSize);
159
159
  }
160
- if (!this._isControlledComponent("currentPage")) this.updatePage(newCurrentPage, newPageSize);
161
- if (currentPage !== newCurrentPage) this._adapter.notifyPageChange(newCurrentPage);
162
- this._adapter.notifyChange(newCurrentPage, newPageSize);
163
- }
164
- handleQuickJumpNumberChange(targetPage) {
165
- this._adapter.updateQuickJumpPage(targetPage);
166
- }
167
- handleQuickJumpBlur() {
160
+ if (!this.isControlledComponent("currentPage")) this.updatePage(newCurrentPage, newPageSize);
161
+ if (currentPage !== newCurrentPage) this.adapter.notifyPageChange(newCurrentPage);
162
+ this.adapter.notifyChange(newCurrentPage, newPageSize);
163
+ };
164
+ handleQuickJumpNumberChange = (targetPage) => {
165
+ this.adapter.updateQuickJumpPage(targetPage);
166
+ };
167
+ handleQuickJumpBlur = () => {
168
168
  const { quickJumpPage } = this.getStates();
169
169
  if (typeof quickJumpPage === "string" && quickJumpPage || typeof quickJumpPage === "number") this.#handleQuickJump(quickJumpPage);
170
- }
171
- handleQuickJumpEnterPress(targetPage) {
170
+ };
171
+ handleQuickJumpEnterPress = (targetPage) => {
172
172
  this.#handleQuickJump(targetPage);
173
- }
173
+ };
174
174
  };
175
175
  export { PaginationFoundation as default };
@@ -23,17 +23,17 @@ export interface PinCodeAdapter<P extends PinCodeBaseProps = PinCodeBaseProps, S
23
23
  export default class PinCodeFoundation<P extends PinCodeBaseProps = PinCodeBaseProps, S extends PinCodeBaseState = PinCodeBaseState> extends BaseFoundation<PinCodeAdapter<P, S>, P, S> {
24
24
  static numberReg: RegExp;
25
25
  static mixedReg: RegExp;
26
- handleCurrentActiveIndexChange(index: number, state: 'focus' | 'blur'): void;
26
+ handleCurrentActiveIndexChange: (index: number, state: "focus" | "blur") => void;
27
27
  completeSingleInput(i: number, singleInputValue: string): Promise<void>;
28
28
  /** `data` is the InputEvent or CompositionEvent data of the change, if any */
29
- handleCellChange(index: number, value: string, data?: string | null): void;
29
+ handleCellChange: (index: number, value: string, data?: string | null) => void;
30
30
  validateValue(value?: string): boolean;
31
- updateValueList(newValueList: PinCodeBaseState['valueList']): Promise<void>;
32
- handlePaste(e: ClipboardEvent, startInputIndex: number): Promise<void>;
31
+ updateValueList: (newValueList: PinCodeBaseState["valueList"]) => Promise<void>;
32
+ handlePaste: (e: ClipboardEvent, startInputIndex: number) => Promise<void>;
33
33
  /**
34
34
  * Removes the character and closes the gap. Also covers a cell emptied without Backspace or Delete (cut, a
35
35
  * virtual keyboard's delete).
36
36
  */
37
37
  removeCell(index: number): void;
38
- handleKeyDownOnSingleInput(e: KeyboardEvent, index: number): void;
38
+ handleKeyDownOnSingleInput: (e: KeyboardEvent, index: number) => void;
39
39
  }
@@ -3,31 +3,31 @@ import BaseFoundation from "../base/foundation.js";
3
3
  var PinCodeFoundation = class PinCodeFoundation extends BaseFoundation {
4
4
  static numberReg = /^\d*$/;
5
5
  static mixedReg = /^[0-9a-zA-Z]$/;
6
- handleCurrentActiveIndexChange(index, state) {
7
- if (state === "focus") this._adapter.onCurrentActiveIndexChange(index);
8
- }
6
+ handleCurrentActiveIndexChange = (index, state) => {
7
+ if (state === "focus") this.adapter.onCurrentActiveIndexChange(index);
8
+ };
9
9
  async completeSingleInput(i, singleInputValue) {
10
- const isControlledComponent = this._isControlledComponent("value");
10
+ const isControlledComponent = this.isControlledComponent("value");
11
11
  const index = Math.min(i, this.getState("valueList").length);
12
- await this._adapter.onCurrentActiveIndexChange(index + 1);
12
+ await this.adapter.onCurrentActiveIndexChange(index + 1);
13
13
  const valueList = [...this.getState("valueList")];
14
14
  valueList[index] = singleInputValue;
15
- this._adapter.notifyValueChange(valueList);
15
+ this.adapter.notifyValueChange(valueList);
16
16
  if (!isControlledComponent) await this.updateValueList(valueList);
17
17
  const count = this.getProp("count");
18
- if (index + 1 > count - 1) this._adapter.changeSpecificInputFocusState(index, "blur");
19
- else this._adapter.changeSpecificInputFocusState(index + 1, "focus");
20
- if (valueList.length === count) this._adapter.notifyComplete(valueList.join(""));
18
+ if (index + 1 > count - 1) this.adapter.changeSpecificInputFocusState(index, "blur");
19
+ else this.adapter.changeSpecificInputFocusState(index + 1, "focus");
20
+ if (valueList.length === count) this.adapter.notifyComplete(valueList.join(""));
21
21
  }
22
22
  /** `data` is the InputEvent or CompositionEvent data of the change, if any */
23
- handleCellChange(index, value, data) {
23
+ handleCellChange = (index, value, data) => {
24
24
  if (value === "") {
25
25
  this.removeCell(index);
26
26
  return;
27
27
  }
28
28
  const char = data && Array.from(data).length === 1 ? data : Array.from(value).at(-1);
29
29
  if (this.validateValue(char)) this.completeSingleInput(index, char);
30
- }
30
+ };
31
31
  validateValue(value = "") {
32
32
  const format = this.getProp("format");
33
33
  let validateFunction = (_value) => true;
@@ -41,10 +41,10 @@ var PinCodeFoundation = class PinCodeFoundation extends BaseFoundation {
41
41
  else if (typeof format === "function") validateFunction = format;
42
42
  return validateFunction(value);
43
43
  }
44
- async updateValueList(newValueList) {
45
- await this._adapter.updateValueList(newValueList);
46
- }
47
- async handlePaste(e, startInputIndex) {
44
+ updateValueList = async (newValueList) => {
45
+ await this.adapter.updateValueList(newValueList);
46
+ };
47
+ handlePaste = async (e, startInputIndex) => {
48
48
  e.preventDefault();
49
49
  const textWillPaste = Array.from(e.clipboardData.getData("text"));
50
50
  const count = this.getProp("count");
@@ -54,7 +54,7 @@ var PinCodeFoundation = class PinCodeFoundation extends BaseFoundation {
54
54
  if (this.validateValue(currentChar)) await this.completeSingleInput(i, currentChar);
55
55
  else break;
56
56
  }
57
- }
57
+ };
58
58
  /**
59
59
  * Removes the character and closes the gap. Also covers a cell emptied without Backspace or Delete (cut, a
60
60
  * virtual keyboard's delete).
@@ -62,25 +62,25 @@ var PinCodeFoundation = class PinCodeFoundation extends BaseFoundation {
62
62
  removeCell(index) {
63
63
  const valueList = this.getState("valueList").toSpliced(index, 1);
64
64
  this.updateValueList(valueList);
65
- this._adapter.notifyValueChange(valueList);
65
+ this.adapter.notifyValueChange(valueList);
66
66
  }
67
- handleKeyDownOnSingleInput(e, index) {
67
+ handleKeyDownOnSingleInput = (e, index) => {
68
68
  const lastIndex = this.getProp("count") - 1;
69
69
  if (e.key === "Backspace") {
70
70
  this.removeCell(index);
71
- this._adapter.changeSpecificInputFocusState(Math.max(0, index - 1), "focus");
71
+ this.adapter.changeSpecificInputFocusState(Math.max(0, index - 1), "focus");
72
72
  e.preventDefault();
73
73
  } else if (e.key === "Delete") {
74
74
  this.removeCell(index);
75
75
  e.preventDefault();
76
76
  } else if (e.altKey || e.ctrlKey || e.metaKey) return;
77
77
  else if (e.key === "ArrowLeft") {
78
- this._adapter.changeSpecificInputFocusState(Math.max(0, index - 1), "focus");
78
+ this.adapter.changeSpecificInputFocusState(Math.max(0, index - 1), "focus");
79
79
  e.preventDefault();
80
80
  } else if (e.key === "ArrowRight") {
81
- this._adapter.changeSpecificInputFocusState(Math.min(lastIndex, index + 1), "focus");
81
+ this.adapter.changeSpecificInputFocusState(Math.min(lastIndex, index + 1), "focus");
82
82
  e.preventDefault();
83
83
  }
84
- }
84
+ };
85
85
  };
86
86
  export { PinCodeFoundation as default };
@@ -3,8 +3,8 @@ export interface PopconfirmAdapter<P extends PopconfirmBaseProps = PopconfirmBas
3
3
  setVisible: (visible: boolean) => void;
4
4
  updateConfirmLoading: (loading: boolean) => void;
5
5
  updateCancelLoading: (loading: boolean) => void;
6
- notifyConfirm: (e: any) => unknown;
7
- notifyCancel: (e: any) => unknown;
6
+ notifyConfirm: (e: MouseEvent) => unknown;
7
+ notifyCancel: (e: MouseEvent) => unknown;
8
8
  notifyVisibleChange: (visible: boolean) => void;
9
9
  focusCancelButton: () => void;
10
10
  focusOkButton: () => void;
@@ -27,12 +27,12 @@ export interface PopconfirmBaseState {
27
27
  }
28
28
  export default class PopConfirmFoundation<P extends PopconfirmBaseProps = PopconfirmBaseProps, S extends PopconfirmBaseState = PopconfirmBaseState> extends BaseFoundation<PopconfirmAdapter<P, S>, P, S> {
29
29
  #private;
30
- handleCancel(e: any): void;
31
- handleConfirm(e: any): void;
32
- handleVisibleChange(visible: boolean): void;
30
+ handleCancel: (e: MouseEvent) => void;
31
+ handleConfirm: (e: MouseEvent) => void;
32
+ handleVisibleChange: (visible: boolean) => void;
33
33
  /** Hosts call this when the popup really opens, whoever set `visible` */
34
- handlePopupOpen(): void;
34
+ handlePopupOpen: () => void;
35
35
  /** Hosts call this when the popup really closes, whoever set `visible`; the card is still mounted */
36
- handlePopupClose(): void;
36
+ handlePopupClose: () => void;
37
37
  }
38
38
  export {};
@@ -4,54 +4,54 @@ import isPromise from "../utils/is-promise.js";
4
4
  var PopConfirmFoundation = class extends BaseFoundation {
5
5
  #closeCount = 0;
6
6
  #isOpen() {
7
- return Boolean(this._isControlledComponent("visible") ? this.getProps().visible : this.getStates().visible);
7
+ return Boolean(this.isControlledComponent("visible") ? this.getProps().visible : this.getStates().visible);
8
8
  }
9
9
  #closeIfUnchanged(closeCountAtStart) {
10
10
  if (closeCountAtStart === this.#closeCount && this.#isOpen()) this.handleVisibleChange(false);
11
11
  }
12
- handleCancel(e) {
12
+ handleCancel = (e) => {
13
13
  if (this.getStates().cancelLoading) return;
14
14
  const closeCountAtStart = this.#closeCount;
15
- const maybePromise = this._adapter.notifyCancel(e);
15
+ const maybePromise = this.adapter.notifyCancel(e);
16
16
  if (isPromise(maybePromise)) {
17
- this._adapter.updateCancelLoading(true);
17
+ this.adapter.updateCancelLoading(true);
18
18
  maybePromise.then(() => {
19
19
  this.#closeIfUnchanged(closeCountAtStart);
20
- this._adapter.updateCancelLoading(false);
20
+ this.adapter.updateCancelLoading(false);
21
21
  }, () => {
22
- this._adapter.updateCancelLoading(false);
22
+ this.adapter.updateCancelLoading(false);
23
23
  });
24
24
  } else this.handleVisibleChange(false);
25
- }
26
- handleConfirm(e) {
25
+ };
26
+ handleConfirm = (e) => {
27
27
  const closeCountAtStart = this.#closeCount;
28
- const maybePromise = this._adapter.notifyConfirm(e);
28
+ const maybePromise = this.adapter.notifyConfirm(e);
29
29
  if (isPromise(maybePromise)) {
30
- this._adapter.updateConfirmLoading(true);
30
+ this.adapter.updateConfirmLoading(true);
31
31
  maybePromise.then(() => {
32
- this._adapter.updateConfirmLoading(false);
32
+ this.adapter.updateConfirmLoading(false);
33
33
  this.#closeIfUnchanged(closeCountAtStart);
34
34
  }, () => {
35
- this._adapter.updateConfirmLoading(false);
35
+ this.adapter.updateConfirmLoading(false);
36
36
  });
37
37
  } else this.handleVisibleChange(false);
38
- }
39
- handleVisibleChange(visible) {
40
- if (!this._isControlledComponent("visible") || !visible) this._adapter.setVisible(visible);
38
+ };
39
+ handleVisibleChange = (visible) => {
40
+ if (!this.isControlledComponent("visible") || !visible) this.adapter.setVisible(visible);
41
41
  if (!visible) this.#closeCount++;
42
- this._adapter.notifyVisibleChange(visible);
43
- }
42
+ this.adapter.notifyVisibleChange(visible);
43
+ };
44
44
  /** Hosts call this when the popup really opens, whoever set `visible` */
45
- handlePopupOpen() {
46
- const { cancelButtonProps, okButtonProps } = this._adapter.getProps();
47
- if (cancelButtonProps?.autoFocus && !cancelButtonProps.disabled) this._adapter.focusCancelButton();
48
- else if (okButtonProps?.autoFocus && !okButtonProps.disabled) this._adapter.focusOkButton();
49
- }
45
+ handlePopupOpen = () => {
46
+ const { cancelButtonProps, okButtonProps } = this.adapter.getProps();
47
+ if (cancelButtonProps?.autoFocus && !cancelButtonProps.disabled) this.adapter.focusCancelButton();
48
+ else if (okButtonProps?.autoFocus && !okButtonProps.disabled) this.adapter.focusOkButton();
49
+ };
50
50
  /** Hosts call this when the popup really closes, whoever set `visible`; the card is still mounted */
51
- handlePopupClose() {
52
- this._adapter.setVisible(false);
51
+ handlePopupClose = () => {
52
+ this.adapter.setVisible(false);
53
53
  this.#closeCount++;
54
- this._adapter.focusPrevFocusElement();
55
- }
54
+ this.adapter.focusPrevFocusElement();
55
+ };
56
56
  };
57
57
  export { PopConfirmFoundation as default };
@@ -67,12 +67,12 @@ export default class RadioFoundation<P extends RadioBaseProps = RadioBaseProps,
67
67
  static deriveView(props: RadioBaseProps, state: RadioBaseState, context?: RadioContextView | null): RadioView;
68
68
  init(): void;
69
69
  destroy(): void;
70
- setChecked(checked: boolean): void;
70
+ setChecked: (checked: boolean) => void;
71
71
  /** `checked` is the value the native input reports, or false for the uncheck of advanced mode */
72
- handleChange(checked: boolean, e: RadioSourceEvent): void;
73
- handleClick(e: RadioSourceEvent): void;
74
- handleKeyUp(e: RadioSourceEvent & {
72
+ handleChange: (checked: boolean, e: RadioSourceEvent) => void;
73
+ handleClick: (e: RadioSourceEvent) => void;
74
+ handleKeyUp: (e: RadioSourceEvent & {
75
75
  key: string;
76
- }): void;
76
+ }) => void;
77
77
  }
78
78
  export {};
@@ -7,14 +7,14 @@ var RadioFoundation = class RadioFoundation extends BaseFoundation {
7
7
  return RadioFoundation.deriveView(this.getProps(), this.getStates(), this.getContexts());
8
8
  }
9
9
  #isStandalone() {
10
- return !this.getContexts()?.radioGroup && !this._isControlledComponent("checked");
10
+ return !this.getContexts()?.radioGroup && !this.isControlledComponent("checked");
11
11
  }
12
12
  /** Unchecks, without notifying, the standalone radios that share this one's native group (same form and name) */
13
13
  #uncheckPeers() {
14
- const input = this._adapter.getInput();
14
+ const input = this.adapter.getInput();
15
15
  if (!input?.name || !this.#isStandalone()) return;
16
16
  for (const peer of RadioFoundation.#standalone) {
17
- const peerInput = peer._adapter.getInput();
17
+ const peerInput = peer.adapter.getInput();
18
18
  if (peer !== this && peer.#isStandalone() && peerInput?.name === input.name && peerInput.form === input.form && peerInput.getRootNode() === input.getRootNode() && peer.getState("checked")) peer.setChecked(false);
19
19
  }
20
20
  }
@@ -54,11 +54,11 @@ var RadioFoundation = class RadioFoundation extends BaseFoundation {
54
54
  destroy() {
55
55
  RadioFoundation.#standalone.delete(this);
56
56
  }
57
- setChecked(checked) {
58
- this._adapter.setChecked(checked);
59
- }
57
+ setChecked = (checked) => {
58
+ this.adapter.setChecked(checked);
59
+ };
60
60
  /** `checked` is the value the native input reports, or false for the uncheck of advanced mode */
61
- handleChange(checked, e) {
61
+ handleChange = (checked, e) => {
62
62
  const props = this.getProps();
63
63
  const group = this.getContexts()?.radioGroup;
64
64
  const event = {
@@ -72,23 +72,23 @@ var RadioFoundation = class RadioFoundation extends BaseFoundation {
72
72
  stopPropagation: () => e.stopPropagation(),
73
73
  preventDefault: () => e.preventDefault()
74
74
  };
75
- this._adapter.notifyGroupChange(event);
76
- if (!this._isControlledComponent("checked")) {
75
+ this.adapter.notifyGroupChange(event);
76
+ if (!this.isControlledComponent("checked")) {
77
77
  if (checked) this.#uncheckPeers();
78
78
  this.setChecked(checked);
79
79
  }
80
- this._adapter.notifyChange(event);
81
- }
82
- handleClick(e) {
80
+ this.adapter.notifyChange(event);
81
+ };
82
+ handleClick = (e) => {
83
83
  const { checked, mode } = this.#getView();
84
84
  if (mode === "advanced" && checked) this.handleChange(false, e);
85
- }
86
- handleKeyUp(e) {
85
+ };
86
+ handleKeyUp = (e) => {
87
87
  const { checked, mode } = this.#getView();
88
88
  if (e.key === " " && mode === "advanced" && checked) {
89
89
  e.preventDefault();
90
90
  this.handleChange(false, e);
91
91
  }
92
- }
92
+ };
93
93
  };
94
94
  export { RadioFoundation as default };
@@ -13,6 +13,6 @@ export interface RadioGroupBaseState {
13
13
  value?: any;
14
14
  }
15
15
  export default class RadioGroupFoundation<P extends RadioGroupBaseProps = RadioGroupBaseProps, S extends RadioGroupBaseState = RadioGroupBaseState> extends BaseFoundation<RadioGroupAdapter<P, S>, P, S> {
16
- handleChange(evt: RadioChangeEvent): void;
17
- handlePropValueChange(propValue: string | number | boolean): void;
16
+ handleChange: (evt: RadioChangeEvent) => void;
17
+ handlePropValueChange: (propValue: string | number | boolean) => void;
18
18
  }
@@ -1,11 +1,11 @@
1
1
  import BaseFoundation from "../base/foundation.js";
2
2
  // src/radio/radio-group-foundation.ts
3
3
  var RadioGroupFoundation = class extends BaseFoundation {
4
- handleChange(evt) {
4
+ handleChange = (evt) => {
5
5
  const mode = this.getProp("mode");
6
6
  const lastValue = this.getState("value");
7
7
  const { checked, value } = evt.target;
8
- const isControlledComponent = this._isControlledComponent();
8
+ const isControlledComponent = this.isControlledComponent();
9
9
  const cbValue = {
10
10
  ...evt,
11
11
  target: {
@@ -15,13 +15,13 @@ var RadioGroupFoundation = class extends BaseFoundation {
15
15
  };
16
16
  if (mode === "advanced" && !checked) cbValue.target.value = void 0;
17
17
  if (!isControlledComponent) {
18
- if (mode === "advanced" && !checked) this._adapter.setValue(void 0);
19
- else this._adapter.setValue(value);
18
+ if (mode === "advanced" && !checked) this.adapter.setValue(void 0);
19
+ else this.adapter.setValue(value);
20
20
  }
21
- if (mode === "advanced" || lastValue !== value) this._adapter.notifyChange(cbValue);
22
- }
23
- handlePropValueChange(propValue) {
24
- this._adapter.setValue(propValue);
25
- }
21
+ if (mode === "advanced" || lastValue !== value) this.adapter.notifyChange(cbValue);
22
+ };
23
+ handlePropValueChange = (propValue) => {
24
+ this.adapter.setValue(propValue);
25
+ };
26
26
  };
27
27
  export { RadioGroupFoundation as default };
@@ -92,18 +92,18 @@ export default class RatingFoundation<P extends RatingBaseProps = RatingBaseProp
92
92
  static isTipVisible(index: number, hoverValue?: number, focusVisibleStar?: number, tip?: string): boolean;
93
93
  init(): void;
94
94
  /** A value prop that goes back to undefined (a form reset) returns to defaultValue, like Slider (Switch and Checkbox become unchecked) */
95
- resetValue(): void;
96
- handleHover(event: Pick<MouseEvent, 'pageX'>, index: number): void;
97
- handleMouseLeave(): void;
98
- handleClick(event: CE & Pick<MouseEvent, 'pageX'>, index: number): void;
95
+ resetValue: () => void;
96
+ handleHover: (event: Pick<MouseEvent, "pageX">, index: number) => void;
97
+ handleMouseLeave: () => void;
98
+ handleClick: (event: CE & Pick<MouseEvent, "pageX">, index: number) => void;
99
99
  /** Commits `newValue` for the star at `index`; selecting the current value clears it when allowClear is on */
100
- handleSelect(event: CE, index: number, newValue: number): void;
101
- handleFocus(e: FE): void;
100
+ handleSelect: (event: CE, index: number, newValue: number) => void;
101
+ handleFocus: (e: FE) => void;
102
102
  /** A radio of the star at `index` got focus; index === count is the empty star */
103
- handleStarFocus(e: {
103
+ handleStarFocus: (e: {
104
104
  target: Element;
105
- }, index: number): void;
106
- handleBlur(e: FE): void;
107
- handleKeyDown(event: KE, value: number): void;
105
+ }, index: number) => void;
106
+ handleBlur: (e: FE) => void;
107
+ handleKeyDown: (event: KE, value: number) => void;
108
108
  }
109
109
  export {};
@@ -6,20 +6,20 @@ var RatingFoundation = class RatingFoundation extends BaseFoundation {
6
6
  return el.getBoundingClientRect().left + el.ownerDocument.defaultView.scrollX;
7
7
  }
8
8
  #changeHover(hoverValue, clearedValue) {
9
- this._adapter.setHover(hoverValue, clearedValue);
10
- this._adapter.notifyHoverChange(hoverValue);
9
+ this.adapter.setHover(hoverValue, clearedValue);
10
+ this.adapter.notifyHoverChange(hoverValue);
11
11
  }
12
12
  #updateValue(value) {
13
- if (!this._isControlledComponent()) this._adapter.setValue(value);
14
- this._adapter.notifyChange(value);
13
+ if (!this.isControlledComponent()) this.adapter.setValue(value);
14
+ this.adapter.notifyChange(value);
15
15
  }
16
16
  getStarValue(index, pos) {
17
17
  const { allowHalf, count } = this.getProps();
18
18
  if (index === count) return 0;
19
- const reverse = this._adapter.getContext("direction") === "rtl";
19
+ const reverse = this.adapter.getContext("direction") === "rtl";
20
20
  let value = index + 1;
21
21
  if (allowHalf) {
22
- const starEle = this._adapter.getStarDOM(index);
22
+ const starEle = this.adapter.getStarDOM(index);
23
23
  if (!starEle) return value;
24
24
  const leftDis = this.#getOffsetLeft(starEle);
25
25
  const width = starEle.clientWidth;
@@ -93,51 +93,51 @@ var RatingFoundation = class RatingFoundation extends BaseFoundation {
93
93
  if (this.#initialized) return;
94
94
  this.#initialized = true;
95
95
  const { autoFocus, disabled } = this.getProps();
96
- if (autoFocus && !disabled) this._adapter.focusStar(RatingFoundation.deriveValue(this.getProps(), this.getStates()));
96
+ if (autoFocus && !disabled) this.adapter.focusStar(RatingFoundation.deriveValue(this.getProps(), this.getStates()));
97
97
  }
98
98
  /** A value prop that goes back to undefined (a form reset) returns to defaultValue, like Slider (Switch and Checkbox become unchecked) */
99
- resetValue() {
100
- this._adapter.setValue(this.getProps().defaultValue);
101
- }
102
- handleHover(event, index) {
99
+ resetValue = () => {
100
+ this.adapter.setValue(this.getProps().defaultValue);
101
+ };
102
+ handleHover = (event, index) => {
103
103
  const currValue = this.getStarValue(index, event.pageX);
104
104
  const { clearedValue, hoverValue } = this.getStates();
105
105
  if (currValue !== hoverValue && currValue !== clearedValue) this.#changeHover(currValue, null);
106
- }
107
- handleMouseLeave() {
106
+ };
107
+ handleMouseLeave = () => {
108
108
  this.#changeHover(void 0, null);
109
- }
110
- handleClick(event, index) {
109
+ };
110
+ handleClick = (event, index) => {
111
111
  this.handleSelect(event, index, this.getStarValue(index, event.pageX));
112
- }
112
+ };
113
113
  /** Commits `newValue` for the star at `index`; selecting the current value clears it when allowClear is on */
114
- handleSelect(event, index, newValue) {
114
+ handleSelect = (event, index, newValue) => {
115
115
  const { allowClear } = this.getProps();
116
116
  const value = RatingFoundation.deriveValue(this.getProps(), this.getStates());
117
117
  const isReset = allowClear ? newValue === value : false;
118
118
  this.#updateValue(isReset ? 0 : newValue);
119
119
  if (isReset) this.#changeHover(void 0, newValue);
120
- else this._adapter.setClearedValue(null);
121
- this._adapter.notifyClick(event, index);
122
- }
123
- handleFocus(e) {
124
- if (!e.currentTarget.contains(e.relatedTarget)) this._adapter.notifyFocus(e);
125
- }
120
+ else this.adapter.setClearedValue(null);
121
+ this.adapter.notifyClick(event, index);
122
+ };
123
+ handleFocus = (e) => {
124
+ if (!e.currentTarget.contains(e.relatedTarget)) this.adapter.notifyFocus(e);
125
+ };
126
126
  /** A radio of the star at `index` got focus; index === count is the empty star */
127
- handleStarFocus(e, index) {
128
- if (e.target.matches(":focus-visible") || this.getStates().focusVisibleStar !== void 0) this._adapter.setFocusVisibleStar(index);
129
- }
130
- handleBlur(e) {
127
+ handleStarFocus = (e, index) => {
128
+ if (e.target.matches(":focus-visible") || this.getStates().focusVisibleStar !== void 0) this.adapter.setFocusVisibleStar(index);
129
+ };
130
+ handleBlur = (e) => {
131
131
  if (!e.currentTarget.contains(e.relatedTarget)) {
132
- this._adapter.notifyBlur(e);
133
- this._adapter.setFocusVisibleStar(void 0);
132
+ this.adapter.notifyBlur(e);
133
+ this.adapter.setFocusVisibleStar(void 0);
134
134
  }
135
- }
136
- handleKeyDown(event, value) {
135
+ };
136
+ handleKeyDown = (event, value) => {
137
137
  if (event.altKey || event.ctrlKey || event.metaKey) return;
138
138
  const { key } = event;
139
139
  const { count, allowHalf } = this.getProps();
140
- const reverse = this._adapter.getContext("direction") === "rtl";
140
+ const reverse = this.adapter.getContext("direction") === "rtl";
141
141
  const step = allowHalf ? .5 : 1;
142
142
  const next = (Math.floor(value / step) + 1) * step;
143
143
  const previous = (Math.ceil(value / step) - 1) * step;
@@ -156,12 +156,12 @@ var RatingFoundation = class RatingFoundation extends BaseFoundation {
156
156
  "ArrowLeft",
157
157
  "ArrowDown"
158
158
  ].includes(key)) {
159
- this._adapter.notifyKeyDown(event);
159
+ this.adapter.notifyKeyDown(event);
160
160
  this.#updateValue(newValue);
161
- this._adapter.focusStar(newValue);
161
+ this.adapter.focusStar(newValue);
162
162
  event.preventDefault();
163
163
  this.#changeHover(void 0, null);
164
164
  }
165
- }
165
+ };
166
166
  };
167
167
  export { RatingFoundation as default };
@@ -37,19 +37,19 @@ export declare class ResizeGroupFoundation<P extends ResizeGroupBaseProps = Resi
37
37
  /**
38
38
  * Re-runs initSpace the first time the group is measurable (#3336); later resizes must not, or the drag is lost.
39
39
  */
40
- handleGroupResize(): void;
40
+ handleGroupResize: () => void;
41
41
  /**
42
42
  * Moves each item's inline size to the new axis, where the handlers take a different length
43
43
  */
44
- handleDirectionChange(): void;
44
+ handleDirectionChange: () => void;
45
45
  /**
46
46
  * Keyboard resize, reported like a drag: arrows move 1% of the group (Shift: 10%), Home and End go to the
47
47
  * limits. Returns whether the key was handled.
48
48
  */
49
- resizeByKey(handlerIndex: number, e: KeyboardEvent): boolean;
50
- onResizeStart(handlerIndex: number, e: PointerEvent): void;
51
- onResizing(e: PointerEvent): void;
52
- onResizeEnd(e: PointerEvent): void;
49
+ resizeByKey: (handlerIndex: number, e: KeyboardEvent) => boolean;
50
+ onResizeStart: (handlerIndex: number, e: PointerEvent) => void;
51
+ onResizing: (e: PointerEvent) => void;
52
+ onResizeEnd: (e: PointerEvent) => void;
53
53
  ensureConstraint: import("es-toolkit").DebouncedFunction<() => void>;
54
54
  destroy(): void;
55
55
  }