@fibrae/semi-foundation 0.1.1 → 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 (282) hide show
  1. package/dist/anchor/foundation.d.ts +1 -4
  2. package/dist/anchor/foundation.js +21 -22
  3. package/dist/audio-player/foundation.d.ts +10 -13
  4. package/dist/audio-player/foundation.js +19 -20
  5. package/dist/auto-complete/foundation.d.ts +12 -14
  6. package/dist/auto-complete/foundation.js +51 -52
  7. package/dist/avatar/foundation.d.ts +5 -6
  8. package/dist/avatar/foundation.js +16 -16
  9. package/dist/avatar/variables.scss +0 -1
  10. package/dist/backtop/foundation.d.ts +2 -5
  11. package/dist/backtop/foundation.js +7 -8
  12. package/dist/banner/foundation.d.ts +1 -1
  13. package/dist/banner/foundation.js +4 -4
  14. package/dist/base/auto-close-foundation.d.ts +8 -9
  15. package/dist/base/auto-close-foundation.js +15 -15
  16. package/dist/base/foundation.d.ts +4 -4
  17. package/dist/base/foundation.js +12 -11
  18. package/dist/base/list-store.d.ts +0 -1
  19. package/dist/breadcrumb/foundation.d.ts +5 -5
  20. package/dist/breadcrumb/foundation.js +9 -10
  21. package/dist/breadcrumb/item-foundation.d.ts +3 -3
  22. package/dist/breadcrumb/item-foundation.js +6 -6
  23. package/dist/calendar/event-util.d.ts +0 -10
  24. package/dist/calendar/event-util.js +1 -11
  25. package/dist/calendar/foundation.d.ts +1 -6
  26. package/dist/calendar/foundation.js +5 -9
  27. package/dist/calendar/month-foundation.d.ts +2 -3
  28. package/dist/calendar/month-foundation.js +6 -7
  29. package/dist/carousel/foundation.d.ts +17 -19
  30. package/dist/carousel/foundation.js +51 -51
  31. package/dist/cascader/foundation.d.ts +36 -32
  32. package/dist/cascader/foundation.js +145 -132
  33. package/dist/cascader/util.d.ts +1 -8
  34. package/dist/cascader/util.js +1 -8
  35. package/dist/checkbox/checkbox-foundation.d.ts +3 -7
  36. package/dist/checkbox/checkbox-foundation.js +15 -17
  37. package/dist/checkbox/checkbox-group-foundation.d.ts +2 -3
  38. package/dist/checkbox/checkbox-group-foundation.js +8 -8
  39. package/dist/code-highlight/index.d.ts +1 -2
  40. package/dist/code-highlight/index.js +3 -3
  41. package/dist/collapse/foundation.d.ts +2 -2
  42. package/dist/collapse/foundation.js +7 -7
  43. package/dist/collapsible/foundation.d.ts +3 -3
  44. package/dist/collapsible/foundation.js +8 -8
  45. package/dist/color-picker/alpha-slider-foundation.d.ts +2 -4
  46. package/dist/color-picker/alpha-slider-foundation.js +10 -10
  47. package/dist/color-picker/color-choose-area-foundation.d.ts +2 -5
  48. package/dist/color-picker/color-choose-area-foundation.js +14 -14
  49. package/dist/color-picker/color-picker.scss +0 -2
  50. package/dist/color-picker/color-slider-foundation.d.ts +2 -4
  51. package/dist/color-picker/color-slider-foundation.js +10 -10
  52. package/dist/color-picker/data-part-foundation.d.ts +5 -5
  53. package/dist/color-picker/data-part-foundation.js +11 -11
  54. package/dist/color-picker/foundation.d.ts +4 -4
  55. package/dist/color-picker/foundation.js +10 -10
  56. package/dist/color-picker/interface.d.ts +0 -1
  57. package/dist/config-provider/breakpoint-observer.d.ts +3 -3
  58. package/dist/config-provider/breakpoint-observer.js +6 -6
  59. package/dist/config-provider/responsive-types.d.ts +0 -16
  60. package/dist/cropper/foundation.d.ts +15 -16
  61. package/dist/cropper/foundation.js +26 -24
  62. package/dist/date-picker/_utils/get-default-picker-date.d.ts +0 -3
  63. package/dist/date-picker/_utils/get-default-picker-date.js +0 -3
  64. package/dist/date-picker/_utils/get-inset-input-format-token.d.ts +0 -2
  65. package/dist/date-picker/_utils/get-inset-input-format-token.js +0 -2
  66. package/dist/date-picker/_utils/get-inset-input-value-from-inset-input-str.d.ts +0 -2
  67. package/dist/date-picker/_utils/get-inset-input-value-from-inset-input-str.js +0 -2
  68. package/dist/date-picker/_utils/parser.d.ts +0 -3
  69. package/dist/date-picker/_utils/parser.js +0 -7
  70. package/dist/date-picker/_utils/picker-type.d.ts +1 -3
  71. package/dist/date-picker/_utils/picker-type.js +0 -2
  72. package/dist/date-picker/_utils/to-callback-args.d.ts +0 -1
  73. package/dist/date-picker/_utils/to-callback-args.js +0 -1
  74. package/dist/date-picker/date-picker.scss +0 -3
  75. package/dist/date-picker/foundation.d.ts +39 -58
  76. package/dist/date-picker/foundation.js +126 -153
  77. package/dist/date-picker/input-foundation.d.ts +10 -16
  78. package/dist/date-picker/input-foundation.js +28 -30
  79. package/dist/date-picker/month-foundation.d.ts +0 -3
  80. package/dist/date-picker/month-foundation.js +0 -2
  81. package/dist/date-picker/months-grid-foundation.d.ts +17 -26
  82. package/dist/date-picker/months-grid-foundation.js +65 -75
  83. package/dist/date-picker/year-and-month-foundation.d.ts +3 -3
  84. package/dist/date-picker/year-and-month-foundation.js +11 -11
  85. package/dist/drag-move/foundation.d.ts +2 -3
  86. package/dist/drag-move/foundation.js +15 -13
  87. package/dist/dropdown/foundation.d.ts +8 -7
  88. package/dist/dropdown/foundation.js +32 -28
  89. package/dist/dropdown/menu-foundation.d.ts +1 -2
  90. package/dist/dropdown/menu-foundation.js +11 -11
  91. package/dist/feedback/foundation.d.ts +9 -10
  92. package/dist/feedback/foundation.js +33 -33
  93. package/dist/feedback/variables.scss +1 -5
  94. package/dist/float-button/float-button.css +0 -1
  95. package/dist/float-button/float-button.scss +0 -2
  96. package/dist/form/form-api-proxy.d.ts +8 -7
  97. package/dist/form/form-api-proxy.js +25 -25
  98. package/dist/form/form.scss +0 -12
  99. package/dist/form/foundation.d.ts +5 -5
  100. package/dist/form/foundation.js +60 -76
  101. package/dist/form/interface.d.ts +2 -15
  102. package/dist/form/utils.d.ts +0 -8
  103. package/dist/form/utils.js +0 -7
  104. package/dist/form/variables.scss +1 -4
  105. package/dist/grid/variables.scss +0 -10
  106. package/dist/highlight/foundation.d.ts +0 -2
  107. package/dist/highlight/foundation.js +1 -3
  108. package/dist/hot-keys/foundation.d.ts +2 -3
  109. package/dist/hot-keys/foundation.js +5 -5
  110. package/dist/image/image-foundation.d.ts +4 -6
  111. package/dist/image/image-foundation.js +10 -10
  112. package/dist/image/preview-footer-foundation.d.ts +3 -4
  113. package/dist/image/preview-footer-foundation.js +10 -10
  114. package/dist/image/preview-foundation.d.ts +0 -3
  115. package/dist/image/preview-foundation.js +7 -6
  116. package/dist/image/preview-image-foundation.d.ts +6 -9
  117. package/dist/image/preview-image-foundation.js +14 -14
  118. package/dist/image/preview-inner-foundation.d.ts +9 -10
  119. package/dist/image/preview-inner-foundation.js +38 -38
  120. package/dist/input/foundation.d.ts +10 -11
  121. package/dist/input/foundation.js +47 -49
  122. package/dist/input/text-entry-foundation.d.ts +3 -5
  123. package/dist/input/text-entry-foundation.js +14 -15
  124. package/dist/input/textarea-foundation.d.ts +7 -8
  125. package/dist/input/textarea-foundation.js +36 -36
  126. package/dist/input-number/caret.d.ts +0 -1
  127. package/dist/input-number/caret.js +0 -1
  128. package/dist/input-number/foundation.d.ts +16 -19
  129. package/dist/input-number/foundation.js +54 -58
  130. package/dist/json-viewer/foundation.d.ts +8 -10
  131. package/dist/json-viewer/foundation.js +23 -24
  132. package/dist/locale/interface.d.ts +0 -3
  133. package/dist/lottie/foundation.d.ts +1 -1
  134. package/dist/lottie/foundation.js +4 -4
  135. package/dist/markdown-render/foundation.d.ts +2 -7
  136. package/dist/markdown-render/foundation.js +5 -9
  137. package/dist/modal/modal-content-foundation.d.ts +7 -7
  138. package/dist/modal/modal-content-foundation.js +20 -20
  139. package/dist/modal/modal-foundation.d.ts +6 -6
  140. package/dist/modal/modal-foundation.js +24 -24
  141. package/dist/navigation/foundation.d.ts +1 -8
  142. package/dist/navigation/foundation.js +14 -20
  143. package/dist/navigation/item-foundation.d.ts +1 -1
  144. package/dist/navigation/item-foundation.js +8 -8
  145. package/dist/navigation/sub-nav-foundation.d.ts +3 -4
  146. package/dist/navigation/sub-nav-foundation.js +17 -17
  147. package/dist/notification/notification-list-foundation.d.ts +7 -8
  148. package/dist/notification/notification-list-foundation.js +12 -13
  149. package/dist/notification/variables.scss +0 -1
  150. package/dist/overflow-list/foundation.d.ts +4 -6
  151. package/dist/overflow-list/foundation.js +18 -19
  152. package/dist/pagination/foundation.d.ts +8 -10
  153. package/dist/pagination/foundation.js +28 -28
  154. package/dist/pincode/foundation.d.ts +6 -9
  155. package/dist/pincode/foundation.js +23 -26
  156. package/dist/popconfirm/popconfirm-foundation.d.ts +7 -9
  157. package/dist/popconfirm/popconfirm-foundation.js +26 -26
  158. package/dist/progress/generates.d.ts +1 -4
  159. package/dist/progress/generates.js +1 -4
  160. package/dist/progress/utils.d.ts +1 -1
  161. package/dist/progress/utils.js +1 -1
  162. package/dist/radio/radio-foundation.d.ts +5 -9
  163. package/dist/radio/radio-foundation.js +15 -16
  164. package/dist/radio/radio-group-foundation.d.ts +2 -3
  165. package/dist/radio/radio-group-foundation.js +9 -9
  166. package/dist/rating/foundation.d.ts +10 -15
  167. package/dist/rating/foundation.js +35 -38
  168. package/dist/resizable/group/index.d.ts +6 -10
  169. package/dist/resizable/group/index.js +40 -44
  170. package/dist/resizable/resizable.scss +0 -1
  171. package/dist/resizable/single/index.d.ts +3 -7
  172. package/dist/resizable/single/index.js +10 -13
  173. package/dist/scroll-list/item-foundation.d.ts +7 -9
  174. package/dist/scroll-list/item-foundation.js +35 -36
  175. package/dist/scroll-list/variables.scss +1 -6
  176. package/dist/select/foundation.d.ts +42 -57
  177. package/dist/select/foundation.js +214 -279
  178. package/dist/select/option-foundation.d.ts +23 -28
  179. package/dist/select/option-foundation.js +10 -19
  180. package/dist/select/variables.scss +1 -8
  181. package/dist/side-sheet/side-sheet-foundation.d.ts +7 -12
  182. package/dist/side-sheet/side-sheet-foundation.js +23 -27
  183. package/dist/side-sheet/variables.scss +1 -3
  184. package/dist/slider/foundation.d.ts +17 -28
  185. package/dist/slider/foundation.js +47 -59
  186. package/dist/slider/variables.scss +1 -5
  187. package/dist/sortable/accessibility.d.ts +1 -1
  188. package/dist/sortable/accessibility.js +2 -2
  189. package/dist/spin/foundation.d.ts +2 -4
  190. package/dist/spin/foundation.js +6 -7
  191. package/dist/spin/variables.scss +1 -3
  192. package/dist/steps/utils.d.ts +1 -1
  193. package/dist/switch/foundation.d.ts +2 -3
  194. package/dist/switch/foundation.js +7 -7
  195. package/dist/switch/switch.scss +1 -1
  196. package/dist/switch/variables.scss +1 -5
  197. package/dist/table/foundation.d.ts +24 -33
  198. package/dist/table/foundation.js +144 -108
  199. package/dist/table/table.scss +0 -1
  200. package/dist/table/utils.d.ts +2 -10
  201. package/dist/table/utils.js +0 -13
  202. package/dist/table/variables.scss +1 -5
  203. package/dist/tabs/foundation.d.ts +5 -14
  204. package/dist/tabs/foundation.js +17 -21
  205. package/dist/tabs/tabs.scss +1 -1
  206. package/dist/tag/focus.js +0 -1
  207. package/dist/tag-input/foundation.d.ts +11 -13
  208. package/dist/tag-input/foundation.js +52 -53
  209. package/dist/tag-input/tag-input.scss +0 -1
  210. package/dist/tag-input/utils/tag-focus.d.ts +0 -1
  211. package/dist/tag-input/utils/tag-focus.js +0 -1
  212. package/dist/time-picker/combox-foundation.d.ts +3 -11
  213. package/dist/time-picker/combox-foundation.js +3 -10
  214. package/dist/time-picker/foundation.d.ts +13 -23
  215. package/dist/time-picker/foundation.js +39 -48
  216. package/dist/time-picker/input-foundation.d.ts +4 -4
  217. package/dist/time-picker/input-foundation.js +13 -13
  218. package/dist/time-picker/utils/index.d.ts +0 -11
  219. package/dist/time-picker/utils/index.js +0 -11
  220. package/dist/toast/toast-list-foundation.d.ts +7 -7
  221. package/dist/toast/toast-list-foundation.js +14 -14
  222. package/dist/tooltip/adjust-position.d.ts +1 -2
  223. package/dist/tooltip/constants.d.ts +0 -3
  224. package/dist/tooltip/constants.js +0 -3
  225. package/dist/tooltip/foundation.d.ts +9 -12
  226. package/dist/tooltip/foundation.js +67 -63
  227. package/dist/tooltip/position.scss +0 -1
  228. package/dist/transfer/foundation.d.ts +22 -13
  229. package/dist/transfer/foundation.js +38 -24
  230. package/dist/tree/foundation.d.ts +14 -16
  231. package/dist/tree/foundation.js +61 -62
  232. package/dist/tree/shared.d.ts +2 -4
  233. package/dist/tree/shared.js +0 -2
  234. package/dist/tree/tree-util.d.ts +0 -5
  235. package/dist/tree/tree-util.js +0 -5
  236. package/dist/tree-select/foundation.d.ts +26 -22
  237. package/dist/tree-select/foundation.js +91 -86
  238. package/dist/typography/ellipsis.d.ts +5 -7
  239. package/dist/typography/ellipsis.js +8 -10
  240. package/dist/typography/format-numeral.d.ts +1 -1
  241. package/dist/typography/format-numeral.js +2 -2
  242. package/dist/typography/typography.scss +0 -1
  243. package/dist/upload/constants.d.ts +1 -1
  244. package/dist/upload/foundation.d.ts +17 -23
  245. package/dist/upload/foundation.js +93 -103
  246. package/dist/upload/utils.d.ts +3 -8
  247. package/dist/upload/utils.js +6 -11
  248. package/dist/user-guide/foundation.d.ts +3 -5
  249. package/dist/user-guide/foundation.js +19 -19
  250. package/dist/utils/a11y.d.ts +2 -6
  251. package/dist/utils/a11y.js +1 -4
  252. package/dist/utils/announcer.d.ts +2 -2
  253. package/dist/utils/announcer.js +4 -4
  254. package/dist/utils/array.d.ts +0 -6
  255. package/dist/utils/array.js +0 -6
  256. package/dist/utils/date-fns-extra.js +1 -5
  257. package/dist/utils/dom.d.ts +0 -1
  258. package/dist/utils/dom.js +0 -1
  259. package/dist/utils/escape-html.js +0 -3
  260. package/dist/utils/field-sizing.d.ts +0 -2
  261. package/dist/utils/field-sizing.js +0 -2
  262. package/dist/utils/focus-handle.d.ts +1 -2
  263. package/dist/utils/focus-handle.js +1 -3
  264. package/dist/utils/focus-scope.d.ts +5 -6
  265. package/dist/utils/focus-scope.js +10 -11
  266. package/dist/utils/is-promise.d.ts +1 -1
  267. package/dist/utils/release-holder.d.ts +2 -2
  268. package/dist/utils/release-holder.js +4 -4
  269. package/dist/utils/scroll-lock.d.ts +3 -4
  270. package/dist/utils/scroll-lock.js +3 -4
  271. package/dist/utils/tween.d.ts +0 -1
  272. package/dist/utils/tween.js +0 -1
  273. package/dist/utils/uuid.d.ts +0 -1
  274. package/dist/utils/uuid.js +0 -1
  275. package/dist/utils/warning.d.ts +0 -1
  276. package/dist/utils/warning.js +0 -1
  277. package/dist/video-player/foundation.d.ts +15 -15
  278. package/dist/video-player/foundation.js +89 -89
  279. package/dist/video-player/progress-foundation.d.ts +2 -3
  280. package/dist/video-player/progress-foundation.js +12 -13
  281. package/dist/video-player/variables.scss +1 -1
  282. package/package.json +2 -2
@@ -56,7 +56,7 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
56
56
  constructor(adapter) {
57
57
  super({ ...adapter });
58
58
  this.#throttledDragOverUpdate = throttle((dropPosition) => {
59
- this._adapter.updateState({ dropPosition });
59
+ this.adapter.updateState({ dropPosition });
60
60
  }, 16);
61
61
  }
62
62
  #isMultiple() {
@@ -83,7 +83,7 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
83
83
  const data = this.getProp("treeDataSimpleJson");
84
84
  const selectedPath = normalizedArr(key).map((i) => i.split(strings.JSON_KEY_SPLIT));
85
85
  const value = pick$1(data, selectedPath);
86
- this._adapter.notifyChange(value);
86
+ this.adapter.notifyChange(value);
87
87
  }
88
88
  #notifyMultipleChange(key) {
89
89
  const { keyEntities } = this.getStates();
@@ -96,7 +96,7 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
96
96
  const nodes = keyList.map((key) => keyEntities[key] ? keyEntities[key].data : getDataForKeyNotInKeyEntities(key, props));
97
97
  if (this.getProp("onChangeWithObject")) value = nodes;
98
98
  else value = getValueOrKey(nodes, keyMaps);
99
- this._adapter.notifyChange(value);
99
+ this.adapter.notifyChange(value);
100
100
  }
101
101
  #notifyChange(key) {
102
102
  const isMultiple = this.#isMultiple();
@@ -111,26 +111,26 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
111
111
  const { data } = get(keyEntities, key);
112
112
  value = getValueOrKey(data, keyMaps);
113
113
  }
114
- this._adapter.notifyChange(value);
114
+ this.adapter.notifyChange(value);
115
115
  }
116
116
  }
117
117
  #handleSingleSelect(_e, { selected, eventKey, data }) {
118
118
  let selectedKeys = [...this.getState("selectedKeys")];
119
119
  const targetSelected = !selected;
120
- this._adapter.notifySelect(eventKey, true, data);
120
+ this.adapter.notifySelect(eventKey, true, data);
121
121
  if (!targetSelected) return;
122
122
  if (!selectedKeys.includes(eventKey)) {
123
123
  selectedKeys = [eventKey];
124
124
  this.#notifyChange(eventKey);
125
- if (!this._isControlledComponent()) this._adapter.updateState({ selectedKeys });
125
+ if (!this.isControlledComponent()) this.adapter.updateState({ selectedKeys });
126
126
  }
127
127
  }
128
128
  #handleMultipleSelect(_e, treeNode) {
129
129
  const result = getMultipleSelectResult(treeNode, this.getProps(), this.getStates());
130
130
  if (!result) return;
131
- this._adapter.notifySelect(treeNode.eventKey, result.targetStatus, treeNode.data);
131
+ this.adapter.notifySelect(treeNode.eventKey, result.targetStatus, treeNode.data);
132
132
  this.#notifyChange(result.keys);
133
- if (!this._isControlledComponent()) this._adapter.updateState(result.state);
133
+ if (!this.isControlledComponent()) this.adapter.updateState(result.state);
134
134
  }
135
135
  #setExpandedStatus({ eventKey, expanded, data }) {
136
136
  const { inputValue, treeData, filteredShownKeys, keyEntities } = this.getStates();
@@ -145,7 +145,7 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
145
145
  expandedKeys.delete(eventKey);
146
146
  motionType = "hide";
147
147
  }
148
- this._adapter.setCachedFlattenNodes(motionType === "hide" && this.#isAnimated() ? this.getState("flattenNodes") : void 0);
148
+ this.adapter.setCachedFlattenNodes(motionType === "hide" && this.#isAnimated() ? this.getState("flattenNodes") : void 0);
149
149
  if (!this.#isExpandControlled()) {
150
150
  const flattenNodes = flattenTreeData(treeData, expandedKeys, keyMaps, isSearching && showFilteredOnly && filteredShownKeys);
151
151
  let motionKeys = this.#isAnimated() ? getMotionKeys(eventKey, expandedKeys, keyEntities) : [];
@@ -156,7 +156,7 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
156
156
  motionKeys: new Set(motionKeys),
157
157
  motionType
158
158
  };
159
- this._adapter.updateState(newState);
159
+ this.adapter.updateState(newState);
160
160
  }
161
161
  return {
162
162
  expandedKeys,
@@ -178,7 +178,7 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
178
178
  }
179
179
  #clearDragState() {
180
180
  this.#clearDragEnterTimers();
181
- this._adapter.updateState({
181
+ this.adapter.updateState({
182
182
  dragOverNodeKey: "",
183
183
  dragging: false
184
184
  });
@@ -311,7 +311,6 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
311
311
  newState.prevProps = { ...props };
312
312
  return newState;
313
313
  }
314
- /** The state of a new tree: the empty state with what the props imply */
315
314
  static getInitialState(props) {
316
315
  const state = {
317
316
  inputValue: "",
@@ -350,14 +349,14 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
350
349
  this.#clearDragEnterTimers();
351
350
  }
352
351
  /** Writes the state derived from new props back, so handlers read what was rendered */
353
- syncDerivedState(derived) {
354
- this._adapter.updateState(derived);
355
- }
356
- scrollTo({ key, align = "center" }) {
357
- if (key && this.getState("flattenNodes")?.some((node) => node.key === key)) this._adapter.scrollToNode(key, align);
358
- }
359
- handleInputChange(sugInput) {
360
- this._adapter.updateInputValue(sugInput);
352
+ syncDerivedState = (derived) => {
353
+ this.adapter.updateState(derived);
354
+ };
355
+ scrollTo = ({ key, align = "center" }) => {
356
+ if (key && this.getState("flattenNodes")?.some((node) => node.key === key)) this.adapter.scrollToNode(key, align);
357
+ };
358
+ handleInputChange = (sugInput) => {
359
+ this.adapter.updateInputValue(sugInput);
361
360
  const { selectedKeys, keyEntities, treeData } = this.getStates();
362
361
  const expandedKeys = new Set(this.getState("expandedKeys"));
363
362
  const { showFilteredOnly, filterTreeNode, treeNodeFilterProp, keyMaps } = this.getProps();
@@ -380,8 +379,8 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
380
379
  flattenNodes = flattenTreeData(treeData, new Set(expandedOptsKeys), keyMaps, showFilteredOnly && filteredShownKeys);
381
380
  }
382
381
  const newFilteredExpandedKeys = new Set(expandedOptsKeys);
383
- this._adapter.notifySearch(sugInput, Array.from(newFilteredExpandedKeys));
384
- this._adapter.updateState({
382
+ this.adapter.notifySearch(sugInput, Array.from(newFilteredExpandedKeys));
383
+ this.adapter.updateState({
385
384
  expandedKeys,
386
385
  flattenNodes,
387
386
  motionKeys: /* @__PURE__ */ new Set([]),
@@ -389,29 +388,29 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
389
388
  filteredExpandedKeys: newFilteredExpandedKeys,
390
389
  filteredShownKeys
391
390
  });
392
- }
393
- handleNodeSelect(e, treeNode) {
391
+ };
392
+ handleNodeSelect = (e, treeNode) => {
394
393
  if (this.#isDisabled(treeNode)) return;
395
394
  if (!this.#isMultiple()) this.#handleSingleSelect(e, treeNode);
396
395
  else this.#handleMultipleSelect(e, treeNode);
397
- }
398
- handleNodeRightClick(e, treeNode) {
399
- this._adapter.notifyRightClick(e, treeNode.data);
400
- }
401
- handleNodeDoubleClick(e, treeNode) {
402
- this._adapter.notifyDoubleClick(e, treeNode.data);
403
- }
404
- handleNodeExpand(_e, treeNode) {
396
+ };
397
+ handleNodeRightClick = (e, treeNode) => {
398
+ this.adapter.notifyRightClick(e, treeNode.data);
399
+ };
400
+ handleNodeDoubleClick = (e, treeNode) => {
401
+ this.adapter.notifyDoubleClick(e, treeNode.data);
402
+ };
403
+ handleNodeExpand = (_e, treeNode) => {
405
404
  const { loadData } = this.getProps();
406
405
  if (!loadData && (!treeNode.children || !treeNode.children.length)) return;
407
406
  if (isTreeNodeLeaf(treeNode, loadData)) return;
408
407
  const { expandedKeys, data, expanded } = this.#setExpandedStatus(treeNode);
409
- this._adapter.notifyExpand(expandedKeys, {
408
+ this.adapter.notifyExpand(expandedKeys, {
410
409
  expanded,
411
410
  node: data
412
411
  });
413
412
  if (expanded && loadData) this.handleNodeLoad(treeNode.eventKey, data);
414
- }
413
+ };
415
414
  /** Loads a node's children once; `key` is the node's entity key, which keyMaps may take from another field */
416
415
  handleNodeLoad(key, data) {
417
416
  const { loadData } = this.getProps();
@@ -423,20 +422,20 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
423
422
  const newLoadedKeys = prevLoadedKeys.add(key);
424
423
  const newLoadingKeys = new Set(prevLoadingKeys);
425
424
  newLoadingKeys.delete(key);
426
- this._adapter.notifyLoad(newLoadedKeys, data);
427
- if (!this.#isLoadControlled()) this._adapter.updateState({ loadedKeys: newLoadedKeys });
428
- this._adapter.updateState({ loadingKeys: newLoadingKeys });
425
+ this.adapter.notifyLoad(newLoadedKeys, data);
426
+ if (!this.#isLoadControlled()) this.adapter.updateState({ loadedKeys: newLoadedKeys });
427
+ this.adapter.updateState({ loadingKeys: newLoadingKeys });
429
428
  }).finally(() => {
430
429
  const currentLoadingKeys = this.getState("loadingKeys");
431
430
  if (currentLoadingKeys.has(key)) {
432
431
  const newLoadingKeys = new Set(currentLoadingKeys);
433
432
  newLoadingKeys.delete(key);
434
- this._adapter.updateState({ loadingKeys: newLoadingKeys });
433
+ this.adapter.updateState({ loadingKeys: newLoadingKeys });
435
434
  }
436
435
  });
437
- this._adapter.updateState({ loadingKeys: new Set(loadingKeys).add(key) });
436
+ this.adapter.updateState({ loadingKeys: new Set(loadingKeys).add(key) });
438
437
  }
439
- handleNodeDragStart(e, treeNode) {
438
+ handleNodeDragStart = (e, treeNode) => {
440
439
  const { keyEntities } = this.getStates();
441
440
  const { hideDraggingNode, renderDraggingNode } = this.getProps();
442
441
  const { eventKey, nodeInstance, data } = treeNode;
@@ -452,13 +451,13 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
452
451
  setTimeout(() => dragImg.remove());
453
452
  }
454
453
  this.#dragNode = treeNode;
455
- this._adapter.updateState({
454
+ this.adapter.updateState({
456
455
  dragging: true,
457
456
  dragNodesKeys: new Set(getDragNodesKeys(eventKey, keyEntities))
458
457
  });
459
- this._adapter.notifyDragStart(this.#dragProps(e, treeNode));
460
- }
461
- handleNodeDragEnter(e, treeNode) {
458
+ this.adapter.notifyDragStart(this.#dragProps(e, treeNode));
459
+ };
460
+ handleNodeDragEnter = (e, treeNode) => {
462
461
  const { dragNodesKeys } = this.getStates();
463
462
  const { autoExpandWhenDragEnter } = this.getProps();
464
463
  const { eventKey, expanded } = treeNode;
@@ -466,7 +465,7 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
466
465
  if (!dragNode || dragNodesKeys.has(eventKey)) return;
467
466
  const dropPosition = calcDropRelativePosition(e, treeNode);
468
467
  if (dragNode.eventKey === eventKey && dropPosition === 0) {
469
- this._adapter.updateState({
468
+ this.adapter.updateState({
470
469
  dragOverNodeKey: "",
471
470
  dropPosition: null
472
471
  });
@@ -474,26 +473,26 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
474
473
  }
475
474
  const timer = setTimeout(() => {
476
475
  this.#dragEnterTimers.delete(timer);
477
- this._adapter.updateState({
476
+ this.adapter.updateState({
478
477
  dragOverNodeKey: eventKey,
479
478
  dropPosition
480
479
  });
481
480
  if (!autoExpandWhenDragEnter || expanded) {
482
- this._adapter.notifyDragEnter(this.#dragProps(e, treeNode));
481
+ this.adapter.notifyDragEnter(this.#dragProps(e, treeNode));
483
482
  return;
484
483
  }
485
484
  clearTimeout(this.#autoExpandTimer);
486
485
  this.#autoExpandTimer = setTimeout(() => {
487
486
  const { expandedKeys: newExpandedKeys } = this.#setExpandedStatus(treeNode);
488
- this._adapter.notifyDragEnter({
487
+ this.adapter.notifyDragEnter({
489
488
  ...this.#dragProps(e, treeNode),
490
489
  expandedKeys: [...newExpandedKeys]
491
490
  });
492
491
  }, 400);
493
492
  }, 0);
494
493
  this.#dragEnterTimers.add(timer);
495
- }
496
- handleNodeDragOver(e, treeNode) {
494
+ };
495
+ handleNodeDragOver = (e, treeNode) => {
497
496
  const { dropPosition, dragNodesKeys, dragOverNodeKey } = this.getStates();
498
497
  const { eventKey } = treeNode;
499
498
  if (dragNodesKeys.has(eventKey)) return;
@@ -502,21 +501,21 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
502
501
  if (dropPosition === newPos) return;
503
502
  this.#throttledDragOverUpdate(newPos);
504
503
  }
505
- this._adapter.notifyDragOver(this.#dragProps(e, treeNode));
506
- }
507
- handleNodeDragLeave(e, treeNode) {
504
+ this.adapter.notifyDragOver(this.#dragProps(e, treeNode));
505
+ };
506
+ handleNodeDragLeave = (e, treeNode) => {
508
507
  this.#throttledDragOverUpdate.cancel();
509
508
  clearTimeout(this.#autoExpandTimer);
510
- this._adapter.updateState({ dragOverNodeKey: "" });
511
- this._adapter.notifyDragLeave(this.#dragProps(e, treeNode));
512
- }
513
- handleNodeDragEnd(e, treeNode) {
509
+ this.adapter.updateState({ dragOverNodeKey: "" });
510
+ this.adapter.notifyDragLeave(this.#dragProps(e, treeNode));
511
+ };
512
+ handleNodeDragEnd = (e, treeNode) => {
514
513
  this.#throttledDragOverUpdate.flush();
515
514
  this.#clearDragState();
516
- this._adapter.notifyDragEnd(this.#dragProps(e, treeNode));
515
+ this.adapter.notifyDragEnd(this.#dragProps(e, treeNode));
517
516
  this.#dragNode = null;
518
- }
519
- handleNodeDrop(e, treeNode) {
517
+ };
518
+ handleNodeDrop = (e, treeNode) => {
520
519
  this.#throttledDragOverUpdate.flush();
521
520
  const { dropPosition, dragNodesKeys } = this.getStates();
522
521
  const { eventKey, pos } = treeNode;
@@ -529,11 +528,11 @@ var TreeFoundation = class TreeFoundation extends BaseFoundation {
529
528
  dropPosition: calcDropActualPosition(pos, dropPosition),
530
529
  dropToGap: dropPosition !== 0
531
530
  };
532
- this._adapter.notifyDrop({
531
+ this.adapter.notifyDrop({
533
532
  ...this.#dragProps(e, treeNode),
534
533
  ...dropRes
535
534
  });
536
535
  this.#dragNode = null;
537
- }
536
+ };
538
537
  };
539
538
  export { TreeFoundation as default, treeDerivedPropKeys };
@@ -1,7 +1,6 @@
1
1
  import { BasicFlattenNode, BasicTreeInnerData, BasicTreeNodeProps, BasicTreeProps, TreeMotionType } from "./foundation.js";
2
2
  import { Typeahead } from "../utils/a11y.js";
3
3
  type CheckState = Pick<BasicTreeInnerData, 'keyEntities' | 'checkedKeys' | 'halfCheckedKeys' | 'disabledKeys'>;
4
- /** The props a tree node renders with */
5
4
  export declare function getTreeNodeProps(key: string, { expandedKeys, selectedKeys, checkedKeys, halfCheckedKeys, realCheckedKeys, keyEntities, filteredKeys, inputValue, loadedKeys, loadingKeys, filteredExpandedKeys, filteredShownKeys, disabledKeys, treeData }: Partial<Omit<BasicTreeInnerData, 'prevProps'>>, props: Pick<BasicTreeProps, 'checkRelation' | 'disableStrictly' | 'showFilteredOnly'>): BasicTreeNodeProps | null;
6
5
  /** Whether a node renders as a leaf, with no expand arrow; with loadData a node is a branch until it loads empty */
7
6
  export declare function isTreeNodeLeaf({ isLeaf, children, loaded }: Pick<BasicTreeNodeProps, 'isLeaf' | 'children' | 'loaded'>, loadData: unknown): boolean;
@@ -23,13 +22,12 @@ export interface TreeRowAria {
23
22
  'aria-selected'?: boolean;
24
23
  'aria-setsize': number;
25
24
  }
26
- /** The treeitem attributes of a row: a multiple tree states each row's check, a single one its selection */
27
25
  export declare function getTreeRowAria(row: BasicTreeNodeProps, { disabled, isLeaf, multiple }: {
28
26
  disabled: boolean;
29
27
  isLeaf: boolean;
30
28
  multiple?: boolean;
31
29
  }): TreeRowAria;
32
- /** What a row's classes depend on besides its own state; `fullLabel` is whether a custom full label renders it */
30
+ /** `fullLabel` is whether a custom full label renders the row */
33
31
  export interface TreeRowFlags {
34
32
  disabled: boolean;
35
33
  focused?: boolean;
@@ -54,7 +52,7 @@ export declare function sameKeys(a: {
54
52
  */
55
53
  export declare function getTransitionNodes<T extends {
56
54
  key?: string;
57
- }>(nodes: T[], motionKeys: Set<string>, motionType: TreeMotionType | null | undefined, flattenList?: T[]): (T | T[])[];
55
+ }>(nodes: T[], motionKeys: Set<string>, motionType?: TreeMotionType | null, flattenList?: T[]): (T | T[])[];
58
56
  export type TreeKeyAction = {
59
57
  type: 'move';
60
58
  index: number;
@@ -29,7 +29,6 @@ function getShownSiblings(entity, keyEntities, filteredShownKeys) {
29
29
  }
30
30
  return shown;
31
31
  }
32
- /** The props a tree node renders with */
33
32
  function getTreeNodeProps(key, { expandedKeys = /* @__PURE__ */ new Set([]), selectedKeys = [], checkedKeys = /* @__PURE__ */ new Set([]), halfCheckedKeys = /* @__PURE__ */ new Set([]), realCheckedKeys = /* @__PURE__ */ new Set([]), keyEntities = {}, filteredKeys = /* @__PURE__ */ new Set([]), inputValue = "", loadedKeys = /* @__PURE__ */ new Set([]), loadingKeys = /* @__PURE__ */ new Set([]), filteredExpandedKeys = /* @__PURE__ */ new Set([]), filteredShownKeys = /* @__PURE__ */ new Set([]), disabledKeys = /* @__PURE__ */ new Set([]), treeData = [] }, props) {
34
33
  const { checkRelation } = props;
35
34
  const entity = keyEntities[key];
@@ -100,7 +99,6 @@ function buildRowProps(node, state, props) {
100
99
  function nodeId(baseId, key) {
101
100
  return `${baseId}-${encodeURIComponent(key)}`;
102
101
  }
103
- /** The treeitem attributes of a row: a multiple tree states each row's check, a single one its selection */
104
102
  function getTreeRowAria(row, { disabled, isLeaf, multiple }) {
105
103
  return {
106
104
  "aria-busy": row.loading || void 0,
@@ -21,7 +21,6 @@ export interface KeyMapProps {
21
21
  icon?: string;
22
22
  }
23
23
  export declare function getPosition(parentPos: string, index: number): string;
24
- /** Flattens nested tree data into a list, as the virtual list renders it. */
25
24
  export declare function flattenTreeData(treeNodeList: any[], expandedKeys: Set<string>, keyMaps: KeyMapProps, filteredShownKeys?: boolean | Set<any>): any[];
26
25
  export declare function convertJsonToData(treeJson: TreeDataSimpleJson): any[];
27
26
  export interface TraversedNode {
@@ -53,10 +52,6 @@ export declare function calcMotionKeys(oldKeySet: Set<string>, newKeySet: Set<st
53
52
  motionType: "show" | "hide";
54
53
  motionKeys: string[];
55
54
  };
56
- /**
57
- * @returns whether option includes searchValue.
58
- * When filterTreeNode is a function,returns the result of filterTreeNode which called with (searchValue, target, option).
59
- */
60
55
  export declare function matchTreeNode(searchValue: string, option: any, filterTreeNode: any, filterProps: any): any;
61
56
  /** The node field a search keyword is matched against: the default 'label' follows keyMaps.label. */
62
57
  export declare function getFilterProp(treeNodeFilterProp: string, keyMaps?: KeyMapProps): string;
@@ -11,7 +11,6 @@ const DRAG_OFFSET = .45;
11
11
  function getPosition(parentPos, index) {
12
12
  return `${parentPos}-${index}`;
13
13
  }
14
- /** Flattens nested tree data into a list, as the virtual list renders it. */
15
14
  function flattenTreeData(treeNodeList, expandedKeys, keyMaps, filteredShownKeys = false) {
16
15
  const flattenList = [];
17
16
  const filterSearch = Boolean(filteredShownKeys);
@@ -254,10 +253,6 @@ function calcMotionKeys(oldKeySet, newKeySet, keyEntities) {
254
253
  motionKeys: diffKeys.length === 1 ? findDescendantKeys(diffKeys, keyEntities, false) : []
255
254
  };
256
255
  }
257
- /**
258
- * @returns whether option includes searchValue.
259
- * When filterTreeNode is a function,returns the result of filterTreeNode which called with (searchValue, target, option).
260
- */
261
256
  function matchTreeNode(searchValue, option, filterTreeNode, filterProps) {
262
257
  if (!filterTreeNode) return true;
263
258
  let filterFn = filterTreeNode;
@@ -124,10 +124,9 @@ export default class TreeSelectFoundation<P extends BasicTreeSelectProps = Basic
124
124
  * that writes the result back settles.
125
125
  */
126
126
  static deriveState(props: BasicTreeSelectProps, prevState: BasicTreeSelectInnerData): Partial<BasicTreeSelectInnerData> | null;
127
- /** The state of a new TreeSelect: the empty state with what the props imply */
128
127
  static getInitialState(props: BasicTreeSelectProps): BasicTreeSelectInnerData;
129
128
  /** The keys the trigger shows: the selection, or in multiple mode the checked keys merged as onChange reports them */
130
- static getTriggerKeys(props: Pick<BasicTreeSelectProps, 'multiple' | 'checkRelation' | 'autoMergeValue' | 'leafOnly'>, state: Pick<BasicTreeSelectInnerData, 'selectedKeys' | 'checkedKeys' | 'realCheckedKeys' | 'keyEntities'>): string[];
129
+ static getTriggerKeys(props: Pick<BasicTreeSelectProps, 'multiple' | 'checkRelation' | 'autoMergeValue' | 'leafOnly'>, { checkedKeys, realCheckedKeys, keyEntities, selectedKeys }: Pick<BasicTreeSelectInnerData, 'selectedKeys' | 'checkedKeys' | 'realCheckedKeys' | 'keyEntities'>): string[];
131
130
  static hasValue(props: Pick<BasicTreeSelectProps, 'multiple' | 'checkRelation'>, { selectedKeys, checkedKeys, realCheckedKeys }: Pick<BasicTreeSelectInnerData, 'selectedKeys' | 'checkedKeys' | 'realCheckedKeys'>): boolean;
132
131
  /** What the trigger shows for the single selection; pure, so render can call it */
133
132
  static getRenderTextInSingle(props: Record<string, any>, { selectedKeys, keyEntities }: Pick<BasicTreeSelectInnerData, 'selectedKeys' | 'keyEntities'>): any;
@@ -138,39 +137,44 @@ export default class TreeSelectFoundation<P extends BasicTreeSelectProps = Basic
138
137
  static getNodeData(key: string, keyEntities: BasicTreeSelectInnerData['keyEntities'], props: Parameters<typeof getDataForKeyNotInKeyEntities>[1]): BasicTreeNodeData | undefined;
139
138
  init(): void;
140
139
  /** Writes the state derived from new props back, so handlers read what was rendered */
141
- syncDerivedState(derived: Partial<BasicTreeSelectInnerData>): void;
142
- /** Searches as if `value` were typed, opening the dropdown first */
143
- search(value: string): void;
140
+ syncDerivedState: (derived: Partial<BasicTreeSelectInnerData>) => void;
141
+ search: (value: string) => void;
144
142
  /** Focus entering the trigger (its search input, tags, clear button) or the dropdown from outside */
145
- handleTriggerFocus(e: FocusEvent): void;
143
+ handleTriggerFocus: (e: FocusEvent) => void;
146
144
  /**
147
145
  * Reports the blur once per focus: on a mousedown outside, a single pick that closes, or the focus leaving the
148
146
  * trigger and the dropdown (the component checks where it went)
149
147
  */
150
148
  handleTriggerBlur(e: E | MouseEvent | FocusEvent): void;
149
+ /**
150
+ * The focus left the trigger and the dropdown (the component checks where it went): reports the blur, and closes
151
+ * an open dropdown when the focus went to another element (APG combobox). A window blur has no target and keeps
152
+ * the dropdown, as the native select does.
153
+ */
154
+ handleFocusLeave: (e: FocusEvent) => void;
151
155
  /** A mousedown outside the trigger and the dropdown, listened to while the TreeSelect is focused or open */
152
- handleClickOutside(e: MouseEvent): void;
153
- handleKeyDown(e: Pick<KeyboardEvent, 'key' | 'preventDefault'>): void;
154
- onClickSingleTriggerSearchItem(): void;
155
- close(): void;
156
- handleClick(e: E & Pick<UIEvent, 'detail' | 'target' | 'currentTarget'>): void;
156
+ handleClickOutside: (e: MouseEvent) => void;
157
+ handleKeyDown: (e: Pick<KeyboardEvent, "key" | "preventDefault">) => void;
158
+ onClickSingleTriggerSearchItem: () => void;
159
+ close: () => void;
160
+ handleClick: (e: E & Pick<UIEvent, "detail" | "target" | "currentTarget">) => void;
157
161
  /**
158
162
  * Enter toggles the popup like a click; Down and Up open a closed one (APG combobox). Outside a text field (the
159
163
  * select-only combobox) Space toggles it like Enter, and Home and End open a closed one: the view moves to the
160
164
  * first or the last row, which lives in the view.
161
165
  */
162
- handleSelectionKeyDown(e: E & Pick<KeyboardEvent, 'key' | 'preventDefault' | 'detail' | 'target' | 'currentTarget'>): void;
163
- handleClear(e: any): void;
164
- removeTag(eventKey: BasicTreeNodeData['key']): void;
165
- handleNodeSelect(e: any, treeNode: BasicTreeNodeProps): void;
166
- handleNodeExpand(e: any, treeNode: BasicTreeNodeProps): void;
167
- handleInputTriggerBlur(e?: {
166
+ handleSelectionKeyDown: (e: E & Pick<KeyboardEvent, "key" | "preventDefault" | "detail" | "target" | "currentTarget">) => void;
167
+ handleClear: (e?: E) => void;
168
+ removeTag: (eventKey: BasicTreeNodeData["key"]) => void;
169
+ handleNodeSelect: (e: E, treeNode: BasicTreeNodeProps) => void;
170
+ handleNodeExpand: (e: E, treeNode: BasicTreeNodeProps) => void;
171
+ handleInputTriggerBlur: (e?: {
168
172
  relatedTarget: EventTarget | null;
169
- }): void;
170
- handleInputTriggerFocus(e?: {
173
+ }) => void;
174
+ handleInputTriggerFocus: (e?: {
171
175
  relatedTarget: EventTarget | null;
172
- }): void;
173
- handlePopoverOpen(): void;
174
- handleAfterClose(): void;
176
+ }) => void;
177
+ handlePopoverOpen: () => void;
178
+ handleAfterClose: () => void;
175
179
  }
176
180
  export type { Size };