@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
@@ -24,9 +24,9 @@ const dateCalcFns = {
24
24
  };
25
25
  var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
26
26
  #initDatePickerFromValue(values, refreshPicker = true) {
27
- const { monthLeft } = this._adapter.getStates();
27
+ const { monthLeft } = this.adapter.getStates();
28
28
  const newMonthLeft = { ...monthLeft };
29
- this._adapter.updateMonthOnLeft(newMonthLeft);
29
+ this.adapter.updateMonthOnLeft(newMonthLeft);
30
30
  const newSelected = /* @__PURE__ */ new Set();
31
31
  const isMultiple = this.#isMultiple();
32
32
  if (!isMultiple) {
@@ -39,7 +39,7 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
39
39
  if (!values?.some((item) => item && differenceInCalendarMonths(item, monthLeft.pickerDate) === 0)) this.#handleShowDateAndTime(strings.PANEL_TYPE_LEFT, values[0] || newMonthLeft.pickerDate);
40
40
  } else this.#handleShowDateAndTime(strings.PANEL_TYPE_LEFT, values[0] || newMonthLeft.pickerDate);
41
41
  } else this.#handleShowDateAndTime(strings.PANEL_TYPE_LEFT, newMonthLeft.pickerDate);
42
- this._adapter.updateDaySelected(newSelected);
42
+ this.adapter.updateDaySelected(newSelected);
43
43
  }
44
44
  #initDateRangePickerFromValue(values, withTime = false) {
45
45
  const monthLeft = this.getState("monthLeft");
@@ -69,9 +69,9 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
69
69
  let rangeStart = values[0] ? format(values[0], formatToken) : "";
70
70
  let rangeEnd = values[1] ? format(values[1], formatToken) : "";
71
71
  if (this.#isNeedSwap(rangeStart, rangeEnd)) [rangeStart, rangeEnd] = [rangeEnd, rangeStart];
72
- this._adapter.setRangeStart(rangeStart);
73
- this._adapter.setRangeEnd(rangeEnd);
74
- this._adapter.setHoverDay(rangeEnd);
72
+ this.adapter.setRangeStart(rangeStart);
73
+ this.adapter.setRangeEnd(rangeEnd);
74
+ this.adapter.setHoverDay(rangeEnd);
75
75
  }
76
76
  #initDateTimePickerFromValue(values) {
77
77
  this.#initDatePickerFromValue(values);
@@ -90,7 +90,7 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
90
90
  return isMultiple(this.getProps());
91
91
  }
92
92
  #mergeDateAndTime(date, time) {
93
- const dateFnsLocale = this._adapter.getProp("dateFnsLocale");
93
+ const dateFnsLocale = this.adapter.getProp("dateFnsLocale");
94
94
  const day = isValidDate(date) ? date : compatibleParse(date, strings.FORMAT_FULL_DATE, void 0, dateFnsLocale);
95
95
  return set(day, {
96
96
  hours: time.getHours(),
@@ -136,7 +136,7 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
136
136
  [rangeStart, rangeEnd] = [rangeEnd, rangeStart];
137
137
  [startDate, endDate] = [endDate, startDate];
138
138
  }
139
- if (!isControlledComponent) this._adapter.setRangeEnd(rangeEnd);
139
+ if (!isControlledComponent) this.adapter.setRangeEnd(rangeEnd);
140
140
  } else {
141
141
  startDate = this.#mergeDateAndTime(timeDate, timeDate);
142
142
  rangeStart = format(startDate, strings.FORMAT_DATE_TIME);
@@ -144,24 +144,24 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
144
144
  [rangeStart, rangeEnd] = [rangeEnd, rangeStart];
145
145
  [startDate, endDate] = [endDate, startDate];
146
146
  }
147
- if (!isControlledComponent) this._adapter.setRangeStart(rangeStart);
147
+ if (!isControlledComponent) this.adapter.setRangeStart(rangeStart);
148
148
  }
149
- this._adapter.notifySelectedChange([startDate, endDate]);
149
+ this.adapter.notifySelectedChange([startDate, endDate]);
150
150
  }
151
151
  }
152
152
  #updatePanelDetail(panelType, kvs) {
153
153
  const { monthLeft, monthRight } = this.getStates();
154
- if (panelType === strings.PANEL_TYPE_RIGHT) this._adapter.updateMonthOnRight({
154
+ if (panelType === strings.PANEL_TYPE_RIGHT) this.adapter.updateMonthOnRight({
155
155
  ...monthRight,
156
156
  ...kvs
157
157
  });
158
- else this._adapter.updateMonthOnLeft({
158
+ else this.adapter.updateMonthOnLeft({
159
159
  ...monthLeft,
160
160
  ...kvs
161
161
  });
162
162
  }
163
163
  #toMonth(panelType, target) {
164
- const { type } = this._adapter.getProps();
164
+ const { type } = this.adapter.getProps();
165
165
  const diff = this.#getDiff("month", target, panelType);
166
166
  this.#handleYearOrMonthChange(diff < 0 ? "prevMonth" : "nextMonth", panelType, Math.abs(diff), false);
167
167
  if (isRangeType(type)) this.handleSyncChangeMonths({
@@ -186,11 +186,11 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
186
186
  if (panelDateHasUpdate) {
187
187
  if (!isRange) {
188
188
  const { notifyValue, notifyDate } = toCallbackArgs(targetMonth, this.getProps());
189
- this._adapter.notifyPanelChange(notifyDate, notifyValue);
189
+ this.adapter.notifyPanelChange(notifyDate, notifyValue);
190
190
  } else if (!(isLeftPanelInRange && notSeparateInRange)) {
191
191
  const states = this.getStates();
192
192
  const { notifyValue, notifyDate } = toCallbackArgs([states.monthLeft.pickerDate, states.monthRight.pickerDate], this.getProps());
193
- this._adapter.notifyPanelChange(notifyDate, notifyValue);
193
+ this.adapter.notifyPanelChange(notifyDate, notifyValue);
194
194
  }
195
195
  }
196
196
  if (autoSwitchDate) this.#updateDateAfterChangeYM(type, targetMonth);
@@ -213,7 +213,7 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
213
213
  rangeStart,
214
214
  rangeEnd
215
215
  })) return;
216
- this._adapter.notifySelectedChange([fullDate], options);
216
+ this.adapter.notifySelectedChange([fullDate], options);
217
217
  }
218
218
  }
219
219
  #handleDateSelected(day, panelType) {
@@ -230,8 +230,8 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
230
230
  else if (!max || newSelected.size < max) newSelected.add(dateStr);
231
231
  const newSelectedDates = [...newSelected].map((_dateStr) => type === "dateTime" ? this.#mergeDateAndTime(_dateStr, time) : compatibleParse(_dateStr, strings.FORMAT_FULL_DATE, void 0, dateFnsLocale));
232
232
  this.#handleShowDateAndTime(panelType, time);
233
- if (!isControlledComponent) this._adapter.updateDaySelected(newSelected);
234
- this._adapter.notifySelectedChange(newSelectedDates);
233
+ if (!isControlledComponent) this.adapter.updateDaySelected(newSelected);
234
+ this.adapter.notifySelectedChange(newSelectedDates);
235
235
  }
236
236
  #handleShowDateAndTime(panelType, pickerDate, showDate) {
237
237
  const _showDate = showDate || pickerDate;
@@ -242,7 +242,7 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
242
242
  }
243
243
  #handleRangeSelected({ fullDate }) {
244
244
  let { rangeStart, rangeEnd } = this.getStates();
245
- const { startDateOffset, endDateOffset, type, dateFnsLocale, rangeInputFocus } = this._adapter.getProps();
245
+ const { startDateOffset, endDateOffset, type, dateFnsLocale, rangeInputFocus } = this.adapter.getProps();
246
246
  let rangeStartReset = false;
247
247
  let rangeEndReset = false;
248
248
  const isDateRangeAndHasOffset = (startDateOffset || endDateOffset) && type === "dateRange";
@@ -264,16 +264,16 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
264
264
  }
265
265
  if (isRangeType(type)) {
266
266
  if (isDateRangeAndHasOffset) {
267
- this._adapter.setRangeStart(rangeStart);
268
- this._adapter.setRangeEnd(rangeEnd);
267
+ this.adapter.setRangeStart(rangeStart);
268
+ this.adapter.setRangeEnd(rangeEnd);
269
269
  } else if (rangeInputFocus === "rangeEnd") {
270
- this._adapter.setRangeEnd(rangeEnd);
271
- if (rangeStartReset) this._adapter.setRangeStart(rangeStart);
272
- if (!this._adapter.hasOtherRangeInputBeenFocused("rangeEnd") || !rangeStart) this._adapter.setRangeInputFocus("rangeStart");
270
+ this.adapter.setRangeEnd(rangeEnd);
271
+ if (rangeStartReset) this.adapter.setRangeStart(rangeStart);
272
+ if (!this.adapter.hasOtherRangeInputBeenFocused("rangeEnd") || !rangeStart) this.adapter.setRangeInputFocus("rangeStart");
273
273
  } else if (rangeInputFocus === "rangeStart" || !rangeInputFocus) {
274
- this._adapter.setRangeStart(rangeStart);
275
- if (rangeEndReset) this._adapter.setRangeEnd(rangeEnd);
276
- if (!this._adapter.hasOtherRangeInputBeenFocused("rangeStart") || !rangeEnd) this._adapter.setRangeInputFocus("rangeEnd");
274
+ this.adapter.setRangeStart(rangeStart);
275
+ if (rangeEndReset) this.adapter.setRangeEnd(rangeEnd);
276
+ if (!this.adapter.hasOtherRangeInputBeenFocused("rangeStart") || !rangeEnd) this.adapter.setRangeInputFocus("rangeEnd");
277
277
  }
278
278
  }
279
279
  const dateFormat = MonthsGridFoundation.getValidDateFormat(this.getProps());
@@ -289,7 +289,7 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
289
289
  else date = [start, end];
290
290
  }
291
291
  const needCheckFocusRecord = !(type === "dateRange" && isDateRangeAndHasOffset);
292
- this._adapter.notifySelectedChange(date, {
292
+ this.adapter.notifySelectedChange(date, {
293
293
  needCheckFocusRecord,
294
294
  rangeInputFocus
295
295
  });
@@ -303,15 +303,15 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
303
303
  * - panelType=left, target=new Date('2021-12-01') and right panel is in '2021-12' => call it, right panel add one month to '2021-01'
304
304
  */
305
305
  handleSyncChangeMonths({ panelType, target }) {
306
- const { type } = this._adapter.getProps();
307
- const { monthLeft, monthRight } = this._adapter.getStates();
306
+ const { type } = this.adapter.getProps();
307
+ const { monthLeft, monthRight } = this.adapter.getStates();
308
308
  if (isRangeType(type)) {
309
309
  if (panelType === "right" && differenceInCalendarMonths(target, monthLeft.pickerDate) === 0) this.#handleYearOrMonthChange("prevMonth", "left", 1, true);
310
310
  else if (panelType === "left" && differenceInCalendarMonths(monthRight.pickerDate, target) === 0) this.#handleYearOrMonthChange("nextMonth", "right", 1, true);
311
311
  }
312
312
  }
313
313
  getTargetChangeDate({ panelType, switchType }) {
314
- const { monthRight, monthLeft } = this._adapter.getStates();
314
+ const { monthRight, monthLeft } = this.adapter.getStates();
315
315
  const currentDate = panelType === "left" ? monthLeft.pickerDate : monthRight.pickerDate;
316
316
  return dateCalcFns[switchType](currentDate, 1);
317
317
  }
@@ -373,9 +373,8 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
373
373
  return props.format || getDefaultFormatToken(props.type);
374
374
  }
375
375
  /** The disabled hours, minutes and seconds `disabledTime` gives the time panel of `panelType` */
376
- static calcDisabledTime({ disabledTime, type }, state, panelType) {
376
+ static calcDisabledTime({ disabledTime, type }, { rangeStart, rangeEnd, monthLeft }, panelType) {
377
377
  if (typeof disabledTime === "function" && panelType && isDateTimeType(type)) {
378
- const { rangeStart, rangeEnd, monthLeft } = state;
379
378
  const selected = [];
380
379
  if (type === "dateTimeRange") {
381
380
  if (rangeStart) selected.push(rangeStart);
@@ -447,7 +446,7 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
447
446
  this.updateSelectedFromProps(this.getProp("selectedValue"));
448
447
  }
449
448
  /** Moves the panels when `defaultPickerValue` changes; the first value is applied by getInitialState */
450
- initDefaultPickerValue() {
449
+ initDefaultPickerValue = () => {
451
450
  const { defaultPickerValue, type, format, dateFnsLocale } = this.getProps();
452
451
  if (defaultPickerValue === void 0) return;
453
452
  const { nowDate, nextDate } = getDefaultPickerDate({
@@ -459,8 +458,8 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
459
458
  this.#updatePanelDetail(strings.PANEL_TYPE_LEFT, { pickerDate: nowDate });
460
459
  this.#updatePanelDetail(strings.PANEL_TYPE_RIGHT, { pickerDate: nextDate });
461
460
  }
462
- }
463
- updateSelectedFromProps(values, refreshPicker = true) {
461
+ };
462
+ updateSelectedFromProps = (values, refreshPicker = true) => {
464
463
  const type = this.getProp("type");
465
464
  const { selected, rangeStart, rangeEnd } = this.getStates();
466
465
  if (values && values?.length) switch (type) {
@@ -476,28 +475,28 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
476
475
  case "dateTimeRange": this.#initDateTimeRangePickerFormValue(values);
477
476
  }
478
477
  else if (Array.isArray(values) && !values.length || !values) {
479
- if (selected instanceof Set && selected.size) this._adapter.updateDaySelected(/* @__PURE__ */ new Set());
480
- if (rangeStart) this._adapter.setRangeStart("");
481
- if (rangeEnd) this._adapter.setRangeEnd("");
478
+ if (selected instanceof Set && selected.size) this.adapter.updateDaySelected(/* @__PURE__ */ new Set());
479
+ if (rangeStart) this.adapter.setRangeStart("");
480
+ if (rangeEnd) this.adapter.setRangeEnd("");
482
481
  }
483
- }
484
- toYearMonth(panelType, target) {
482
+ };
483
+ toYearMonth = (panelType, target) => {
485
484
  this.#toYear(panelType, target);
486
485
  this.#toMonth(panelType, target);
487
- }
488
- prevMonth(panelType) {
486
+ };
487
+ prevMonth = (panelType) => {
489
488
  this.handleSwitchMonthOrYear("prevMonth", panelType);
490
- }
491
- nextMonth(panelType) {
489
+ };
490
+ nextMonth = (panelType) => {
492
491
  this.handleSwitchMonthOrYear("nextMonth", panelType);
493
- }
494
- prevYear(panelType) {
492
+ };
493
+ prevYear = (panelType) => {
495
494
  this.handleSwitchMonthOrYear("prevYear", panelType);
496
- }
497
- nextYear(panelType) {
495
+ };
496
+ nextYear = (panelType) => {
498
497
  this.handleSwitchMonthOrYear("nextYear", panelType);
499
- }
500
- handleDayClick(day, panelType) {
498
+ };
499
+ handleDayClick = (day, panelType) => {
501
500
  const type = this.getProp("type");
502
501
  switch (true) {
503
502
  case type === "date" || type === "dateTime":
@@ -505,18 +504,18 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
505
504
  break;
506
505
  case type === "dateRange" || type === "dateTimeRange": this.#handleRangeSelected(day);
507
506
  }
508
- }
509
- handleDayHover({ fullDate } = { fullDate: "" }) {
507
+ };
508
+ handleDayHover = ({ fullDate } = { fullDate: "" }) => {
510
509
  const { startDateOffset, endDateOffset, type } = this.getProps();
511
- this._adapter.setHoverDay(fullDate);
510
+ this.adapter.setHoverDay(fullDate);
512
511
  if ((startDateOffset || endDateOffset) && type === "dateRange") {
513
512
  const offsetRangeStart = getFullDateOffset(startDateOffset, fullDate);
514
513
  const offsetRangeEnd = getFullDateOffset(endDateOffset, fullDate);
515
- this._adapter.setOffsetRangeStart(offsetRangeStart);
516
- this._adapter.setOffsetRangeEnd(offsetRangeEnd);
514
+ this.adapter.setOffsetRangeStart(offsetRangeStart);
515
+ this.adapter.setOffsetRangeEnd(offsetRangeEnd);
517
516
  }
518
- }
519
- handleTimeChange(newTime, panelType) {
517
+ };
518
+ handleTimeChange = (newTime, panelType) => {
520
519
  const { rangeEnd, rangeStart } = this.getStates();
521
520
  const { type, dateFnsLocale } = this.getProps();
522
521
  const { showDate } = this.#getPanelDetail(panelType);
@@ -533,25 +532,25 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
533
532
  fullValidDate
534
533
  }, panelType);
535
534
  }
536
- }
537
- showYearPicker(panelType) {
535
+ };
536
+ showYearPicker = (panelType) => {
538
537
  this.#updatePanelDetail(panelType, {
539
538
  isTimePickerOpen: false,
540
539
  isYearPickerOpen: true
541
540
  });
542
- }
543
- showTimePicker(panelType) {
541
+ };
542
+ showTimePicker = (panelType) => {
544
543
  if (this.getProp("disabledTimePicker")) return;
545
544
  this.#updatePanelDetail(panelType, {
546
545
  isTimePickerOpen: true,
547
546
  isYearPickerOpen: false
548
547
  });
549
- }
550
- showDatePanel(panelType) {
548
+ };
549
+ showDatePanel = (panelType) => {
551
550
  this.#updatePanelDetail(panelType, {
552
551
  isTimePickerOpen: false,
553
552
  isYearPickerOpen: false
554
553
  });
555
- }
554
+ };
556
555
  };
557
556
  export { MonthsGridFoundation as default };
@@ -68,8 +68,8 @@ export default class YearAndMonthFoundation extends BaseFoundation<YearAndMonthA
68
68
  static getYearList(props: YearAndMonthFoundationProps, panelType: PanelType): YearScrollItem[];
69
69
  /** The month column of a panel; in the right panel of the same year no month may come before the left one */
70
70
  static getMonthList(props: YearAndMonthFoundationProps, panelType: PanelType): MonthScrollItem[];
71
- selectYear(item: YearScrollItem, panelType?: PanelType): void;
72
- selectMonth(item: MonthScrollItem, panelType?: PanelType): void;
73
- backToMain(): void;
71
+ selectYear: (item: YearScrollItem, panelType?: PanelType) => void;
72
+ selectMonth: (item: MonthScrollItem, panelType?: PanelType) => void;
73
+ backToMain: () => void;
74
74
  }
75
75
  export {};
@@ -6,7 +6,7 @@ import getYearAndMonth from "./_utils/get-year-and-month.js";
6
6
  const MONTHS = Array.from({ length: 12 }, (_v, idx) => idx + 1);
7
7
  var YearAndMonthFoundation = class YearAndMonthFoundation extends BaseFoundation {
8
8
  #autoSelectMonth(item, panelType, year, currentMonth) {
9
- const { disabledDate } = this._adapter.getProps();
9
+ const { disabledDate } = this.adapter.getProps();
10
10
  const oppositeType = panelType === strings.PANEL_TYPE_LEFT ? "right" : "left";
11
11
  const isValid = (month) => !disabledDate(new Date(item.year, month - 1));
12
12
  const isCurrentMonthDisabled = !isValid(currentMonth[panelType]);
@@ -38,7 +38,7 @@ var YearAndMonthFoundation = class YearAndMonthFoundation extends BaseFoundation
38
38
  right: currentMonth[panelType]
39
39
  };
40
40
  }
41
- this._adapter.notifySelect({
41
+ this.adapter.notifySelect({
42
42
  currentYear: finalYear,
43
43
  currentMonth: finalMonth
44
44
  });
@@ -77,7 +77,7 @@ var YearAndMonthFoundation = class YearAndMonthFoundation extends BaseFoundation
77
77
  value: locale.fullMonths[month]
78
78
  }));
79
79
  }
80
- selectYear(item, panelType) {
80
+ selectYear = (item, panelType) => {
81
81
  const { currentYear, currentMonth } = YearAndMonthFoundation.getYearAndMonth(this.getProps());
82
82
  const { type } = this.getProps();
83
83
  const left = strings.PANEL_TYPE_LEFT;
@@ -89,13 +89,13 @@ var YearAndMonthFoundation = class YearAndMonthFoundation extends BaseFoundation
89
89
  if (panelType === left && item.value > year[right] || panelType === left && isSameYearIllegalDate) year[right] = item.value + 1;
90
90
  else if (panelType === right && isSameYearIllegalDate) year[left] = item.value - 1;
91
91
  }
92
- this._adapter.notifySelect({
92
+ this.adapter.notifySelect({
93
93
  currentMonth,
94
94
  currentYear: year
95
95
  });
96
96
  if (type !== "year") this.#autoSelectMonth(item, panelType, year, currentMonth);
97
- }
98
- selectMonth(item, panelType) {
97
+ };
98
+ selectMonth = (item, panelType) => {
99
99
  const { currentMonth, currentYear } = YearAndMonthFoundation.getYearAndMonth(this.getProps());
100
100
  const { type } = this.getProps();
101
101
  const left = strings.PANEL_TYPE_LEFT;
@@ -103,13 +103,13 @@ var YearAndMonthFoundation = class YearAndMonthFoundation extends BaseFoundation
103
103
  const month = { ...currentMonth };
104
104
  month[panelType] = item.month;
105
105
  if (type === "monthRange" && panelType === left && currentYear[left] === currentYear[right] && item.month > month[right]) month[right] = item.month;
106
- this._adapter.notifySelect({
106
+ this.adapter.notifySelect({
107
107
  currentYear,
108
108
  currentMonth: month
109
109
  });
110
- }
111
- backToMain() {
112
- this._adapter.notifyBackToMain();
113
- }
110
+ };
111
+ backToMain = () => {
112
+ this.adapter.notifyBackToMain();
113
+ };
114
114
  };
115
115
  export { YearAndMonthFoundation as default };
@@ -25,7 +25,7 @@ export default class DragMoveFoundation<P extends DragMoveBaseProps = DragMoveBa
25
25
  * Prepares host children as they appear: the position strategy, a move cursor on the handler, and
26
26
  * `touch-action: none` so a touch drag is not taken over by scrolling.
27
27
  */
28
- prepareElements(elements: Element[]): void;
29
- updatePositionStrategy(): void;
28
+ prepareElements: (elements: Element[]) => void;
29
+ updatePositionStrategy: () => void;
30
30
  destroy(): void;
31
31
  }
@@ -58,7 +58,7 @@ var DragMoveFoundation = class extends BaseFoundation {
58
58
  #allowMove(e) {
59
59
  const { allowMove, allowInputDrag } = this.getProps();
60
60
  if (!allowInputDrag) {
61
- const target = e.target.tagName.toLowerCase();
61
+ const target = e.target instanceof Element ? e.target.tagName.toLowerCase() : "";
62
62
  if (target === "input" || target === "textarea") return false;
63
63
  }
64
64
  if (allowMove) return allowMove(e, this.#element);
@@ -100,16 +100,16 @@ var DragMoveFoundation = class extends BaseFoundation {
100
100
  }
101
101
  #onPointerMove = (e) => {
102
102
  if (e.pointerId !== this.#pointerId) return;
103
- if (this.#isTouch(e)) this._adapter.notifyTouchMove(e);
104
- else this._adapter.notifyMouseMove(e);
103
+ if (this.#isTouch(e)) this.adapter.notifyTouchMove(e);
104
+ else this.adapter.notifyMouseMove(e);
105
105
  this.#changePos(e);
106
106
  };
107
107
  #onPointerEnd = (e) => {
108
108
  if (e.pointerId !== this.#pointerId) return;
109
109
  this.#stopDrag();
110
- if (e.type === "pointercancel") this._adapter.notifyTouchCancel(e);
111
- else if (this.#isTouch(e)) this._adapter.notifyTouchEnd(e);
112
- else this._adapter.notifyMouseUp(e);
110
+ if (e.type === "pointercancel") this.adapter.notifyTouchCancel(e);
111
+ else if (this.#isTouch(e)) this.adapter.notifyTouchEnd(e);
112
+ else this.adapter.notifyMouseUp(e);
113
113
  };
114
114
  #stopDrag() {
115
115
  this.#dragController?.abort();
@@ -131,11 +131,13 @@ var DragMoveFoundation = class extends BaseFoundation {
131
131
  if (this.#dragController) return;
132
132
  if (isSecondaryPress(e)) return;
133
133
  const element = e.currentTarget;
134
- if (!this.#getHandler(element).contains(e.target)) return;
134
+ if (!(element instanceof HTMLElement)) return;
135
+ const handler = this.#getHandler(element);
136
+ if (!(e.target instanceof Node && handler.contains(e.target))) return;
135
137
  this.#element = element;
136
138
  this.#calcMoveRange();
137
- if (this.#isTouch(e)) this._adapter.notifyTouchStart(e);
138
- else this._adapter.notifyMouseDown(e);
139
+ if (this.#isTouch(e)) this.adapter.notifyTouchStart(e);
140
+ else this.adapter.notifyMouseDown(e);
139
141
  if (!this.#allowMove(e)) return;
140
142
  this.#pointerId = e.pointerId;
141
143
  const controller = new AbortController();
@@ -151,7 +153,7 @@ var DragMoveFoundation = class extends BaseFoundation {
151
153
  * Prepares host children as they appear: the position strategy, a move cursor on the handler, and
152
154
  * `touch-action: none` so a touch drag is not taken over by scrolling.
153
155
  */
154
- prepareElements(elements) {
156
+ prepareElements = (elements) => {
155
157
  for (const element of this.#elements) if (!element.isConnected) this.#elements.delete(element);
156
158
  for (const element of elements) {
157
159
  if (this.#elements.has(element)) continue;
@@ -164,10 +166,10 @@ var DragMoveFoundation = class extends BaseFoundation {
164
166
  });
165
167
  }
166
168
  this.#prepareHandlers();
167
- }
168
- updatePositionStrategy() {
169
+ };
170
+ updatePositionStrategy = () => {
169
171
  for (const element of this.#elements) this.#applyPositionStrategy(element);
170
- }
172
+ };
171
173
  destroy() {
172
174
  this.#stopDrag();
173
175
  this.#handlerObserver?.disconnect();
@@ -9,6 +9,8 @@ export interface DropdownAdapter<P extends DropdownBaseProps = DropdownBaseProps
9
9
  /** Hides the popup through Tooltip's hide(), without moving focus: a controlled one only reports the request */
10
10
  hidePopup(): void;
11
11
  }
12
+ /** The members of a keyboard event the foundation reads; DOM events and React synthetic events both satisfy it */
13
+ type DropdownKeyEvent = Pick<KeyboardEvent, 'defaultPrevented' | 'key' | 'preventDefault' | 'stopPropagation' | 'target'>;
12
14
  /** The props the foundation reads */
13
15
  export interface DropdownBaseProps {
14
16
  trigger?: string;
@@ -22,16 +24,17 @@ export default class DropdownFoundation<P extends DropdownBaseProps = DropdownBa
22
24
  #private;
23
25
  destroy(): void;
24
26
  /** Closes the menu without moving focus */
25
- close(): void;
27
+ close: () => void;
26
28
  /** Tooltip's onVisibleChange: an actual change when uncontrolled, only a request to the owner when controlled */
27
- handleVisibleChange(visible: boolean): void;
29
+ handleVisibleChange: (visible: boolean) => void;
28
30
  /**
29
31
  * Tooltip's initial focus of each opening, right after the popup is shown, controlled or not. Not deferred to
30
32
  * afterOpen: a keyboard user would wait out the enter animation.
31
33
  */
32
- handleOpened(): void;
34
+ handleOpened: () => void;
33
35
  /**
34
36
  * @param isMenuButton whether the trigger is a menu button: only then Up and Down open a closed menu
35
37
  */
36
- handleKeyDown(event: any, isMenuButton?: boolean): void;
37
- }
38
+ handleKeyDown: (event: DropdownKeyEvent, isMenuButton?: boolean) => void;
39
+ }
40
+ export {};
@@ -19,8 +19,9 @@ var DropdownFoundation = class extends BaseFoundation {
19
19
  return this.getProp("visible") ?? this.getState("popVisible");
20
20
  }
21
21
  #handleParentItemKeyDown(event, popup) {
22
+ const { target } = event;
22
23
  const popVisible = this.#isOpen();
23
- const openKey = this._adapter.getContext("direction") === "rtl" ? "ArrowLeft" : "ArrowRight";
24
+ const openKey = this.adapter.getContext("direction") === "rtl" ? "ArrowLeft" : "ArrowRight";
24
25
  const handled = event.defaultPrevented;
25
26
  switch (event.key) {
26
27
  case "Enter":
@@ -32,44 +33,45 @@ var DropdownFoundation = class extends BaseFoundation {
32
33
  this.#focusOnOpen = "first";
33
34
  const trigger = this.getProp("trigger");
34
35
  if (trigger === "click") {
35
- if (!handled) event.target.click();
36
- } else if (trigger === "hover" || trigger === "focus") {
37
- event.target.blur();
38
- event.target.focus();
36
+ if (!handled && target instanceof HTMLElement) target.click();
37
+ } else if ((trigger === "hover" || trigger === "focus") && target instanceof HTMLElement) {
38
+ target.blur();
39
+ target.focus();
39
40
  }
40
41
  }
41
42
  }
42
43
  }
43
44
  destroy() {
44
- this._adapter.setPopVisible(false);
45
+ this.adapter.setPopVisible(false);
45
46
  }
46
47
  /** Closes the menu without moving focus */
47
- close() {
48
- this._adapter.hidePopup();
49
- }
48
+ close = () => {
49
+ this.adapter.hidePopup();
50
+ };
50
51
  /** Tooltip's onVisibleChange: an actual change when uncontrolled, only a request to the owner when controlled */
51
- handleVisibleChange(visible) {
52
- if (this.getProp("visible") === void 0) this._adapter.setPopVisible(visible);
52
+ handleVisibleChange = (visible) => {
53
+ if (this.getProp("visible") === void 0) this.adapter.setPopVisible(visible);
53
54
  if (!visible) this.#focusOnOpen = null;
54
- this._adapter.notifyVisibleChange(visible);
55
- }
55
+ this.adapter.notifyVisibleChange(visible);
56
+ };
56
57
  /**
57
58
  * Tooltip's initial focus of each opening, right after the popup is shown, controlled or not. Not deferred to
58
59
  * afterOpen: a keyboard user would wait out the enter animation.
59
60
  */
60
- handleOpened() {
61
- const popup = this._adapter.getPopup();
61
+ handleOpened = () => {
62
+ const popup = this.adapter.getPopup();
62
63
  const trigger = popup && getMenuButton(popup.id, popup.getRootNode());
63
64
  const focusOnOpen = trigger?.contains(FocusTrapHandle.getActiveElement(trigger)) ? this.#focusOnOpen : null;
64
65
  if (["click", "contextMenu"].includes(this.getProp("trigger")) || focusOnOpen) this.#focusEdgeItem(popup, focusOnOpen ?? "first");
65
66
  this.#focusOnOpen = null;
66
- }
67
+ };
67
68
  /**
68
69
  * @param isMenuButton whether the trigger is a menu button: only then Up and Down open a closed menu
69
70
  */
70
- handleKeyDown(event, isMenuButton = false) {
71
- const popup = this._adapter.getPopup();
72
- if (this._adapter.getContext("menuDepth") > 0) {
71
+ handleKeyDown = (event, isMenuButton = false) => {
72
+ const { target } = event;
73
+ const popup = this.adapter.getPopup();
74
+ if (this.adapter.getContext("menuDepth") > 0) {
73
75
  this.#handleParentItemKeyDown(event, popup);
74
76
  return;
75
77
  }
@@ -77,9 +79,9 @@ var DropdownFoundation = class extends BaseFoundation {
77
79
  switch (event.key) {
78
80
  case " ":
79
81
  case "Enter":
80
- if (isTextEditor(event.target)) break;
81
- if (!event.defaultPrevented && !event.target.matches(NATIVE_KEY_CLICK_SELECTOR)) {
82
- event.target.click();
82
+ if (isTextEditor(target)) break;
83
+ if (!event.defaultPrevented && target instanceof HTMLElement && !target.matches(NATIVE_KEY_CLICK_SELECTOR)) {
84
+ target.click();
83
85
  event.preventDefault();
84
86
  }
85
87
  break;
@@ -102,19 +104,21 @@ var DropdownFoundation = class extends BaseFoundation {
102
104
  ].includes(trigger)) break;
103
105
  handlePrevent(event);
104
106
  this.#focusOnOpen = edge;
105
- if (trigger === "click") event.target.click();
106
- else {
107
- event.target.blur();
108
- event.target.focus();
107
+ if (target instanceof HTMLElement) {
108
+ if (trigger === "click") target.click();
109
+ else {
110
+ target.blur();
111
+ target.focus();
112
+ }
109
113
  }
110
114
  }
111
115
  break;
112
116
  }
113
117
  case "Tab": if (popVisible) {
114
118
  this.close();
115
- this._adapter.getContext("closeAll")?.();
119
+ this.adapter.getContext("closeAll")?.();
116
120
  }
117
121
  }
118
- }
122
+ };
119
123
  };
120
124
  export { DropdownFoundation as default };
@@ -32,5 +32,5 @@ export interface DropdownContextAdapter<P = object, S = object> extends DefaultA
32
32
  */
33
33
  export default class DropdownMenuFoundation<P extends object = object, S extends object = object> extends BaseFoundation<DropdownContextAdapter<P, S>, P, S> {
34
34
  #private;
35
- onMenuKeydown(event: any): void;
35
+ onMenuKeydown: (event: Pick<KeyboardEvent, "altKey" | "ctrlKey" | "currentTarget" | "defaultPrevented" | "key" | "metaKey" | "preventDefault" | "stopPropagation" | "target">) => void;
36
36
  }