@astral/ui 4.105.0 → 4.106.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 (247) hide show
  1. package/components/ActionCellBase/ActionCellBase.js +10 -1
  2. package/components/ActionCellBase/MainAction/MainAction.js +6 -0
  3. package/components/ActionCellBase/MainAction/MainIconButton/MainIconButton.js +7 -4
  4. package/components/ActionCellBase/MainAction/MainIconButton/constants.d.ts +3 -0
  5. package/components/ActionCellBase/MainAction/MainIconButton/constants.js +4 -0
  6. package/components/ActionCellBase/MainAction/MainIconButton/styles.d.ts +11 -0
  7. package/components/ActionCellBase/MainAction/MainIconButton/styles.js +9 -0
  8. package/components/ActionCellBase/MainAction/MobileMainButton/MobileMainButton.d.ts +14 -0
  9. package/components/ActionCellBase/MainAction/MobileMainButton/MobileMainButton.js +17 -0
  10. package/components/ActionCellBase/MainAction/MobileMainButton/index.d.ts +1 -0
  11. package/components/ActionCellBase/MainAction/MobileMainButton/index.js +1 -0
  12. package/components/ActionCellBase/MainAction/MobileMainButton/styles.d.ts +11 -0
  13. package/components/ActionCellBase/MainAction/MobileMainButton/styles.js +7 -0
  14. package/components/ActionCellBase/SecondaryAction/SecondaryAction.js +2 -2
  15. package/components/ActionCellBase/SecondaryAction/styles.d.ts +4 -0
  16. package/components/ActionCellBase/SecondaryAction/styles.js +9 -0
  17. package/components/ActionCellBase/constants.d.ts +4 -0
  18. package/components/ActionCellBase/constants.js +5 -0
  19. package/components/ActionCellBase/styles.js +11 -0
  20. package/components/ActionCellBase/types.d.ts +25 -0
  21. package/components/InfiniteTreeList/InfiniteTreeList.js +16 -2
  22. package/components/InfiniteTreeList/InfiniteTreeListContext/InfiniteTreeListContext.d.ts +4 -0
  23. package/components/InfiniteTreeList/InfiniteTreeListContext/InfiniteTreeListContext.js +1 -0
  24. package/components/InfiniteTreeList/InfiniteTreeListContext/InfiniteTreeListContextProvider/InfiniteTreeListContextProvider.d.ts +2 -2
  25. package/components/InfiniteTreeList/InfiniteTreeListContext/InfiniteTreeListContextProvider/InfiniteTreeListContextProvider.js +3 -1
  26. package/components/InfiniteTreeList/InfiniteTreeListItem/ErrorPlaceholder/styles.js +8 -0
  27. package/components/InfiniteTreeList/InfiniteTreeListItem/InfiniteTreeListItem.js +7 -4
  28. package/components/InfiniteTreeList/InfiniteTreeListItem/constants.d.ts +2 -0
  29. package/components/InfiniteTreeList/InfiniteTreeListItem/constants.js +2 -0
  30. package/components/InfiniteTreeList/InfiniteTreeListItem/index.d.ts +1 -0
  31. package/components/InfiniteTreeList/InfiniteTreeListItem/index.js +1 -0
  32. package/components/InfiniteTreeList/InfiniteTreeListItem/styles.d.ts +14 -0
  33. package/components/InfiniteTreeList/InfiniteTreeListItem/styles.js +66 -2
  34. package/components/InfiniteTreeList/LevelHeader/LevelHeader.d.ts +5 -0
  35. package/components/InfiniteTreeList/LevelHeader/LevelHeader.js +17 -0
  36. package/components/InfiniteTreeList/LevelHeader/constants.d.ts +3 -0
  37. package/components/InfiniteTreeList/LevelHeader/constants.js +3 -0
  38. package/components/InfiniteTreeList/LevelHeader/index.d.ts +2 -0
  39. package/components/InfiniteTreeList/LevelHeader/index.js +2 -0
  40. package/components/InfiniteTreeList/LevelHeader/styles.d.ts +365 -0
  41. package/components/InfiniteTreeList/LevelHeader/styles.js +51 -0
  42. package/components/InfiniteTreeList/LevelHeader/types.d.ts +14 -0
  43. package/components/InfiniteTreeList/LevelHeader/types.js +1 -0
  44. package/components/InfiniteTreeList/ListFooter/styles.js +8 -0
  45. package/components/InfiniteTreeList/OnTopButton/styles.js +7 -0
  46. package/components/InfiniteTreeList/ParentItems/Item/Item.js +10 -2
  47. package/components/InfiniteTreeList/ParentItems/Item/useLogic/useLogic.d.ts +1 -0
  48. package/components/InfiniteTreeList/ParentItems/Item/useLogic/useLogic.js +10 -2
  49. package/components/InfiniteTreeList/TreeItem/ChildrenPlaceholder/NoDataRow/NoDataRow.js +2 -2
  50. package/components/InfiniteTreeList/TreeItem/ChildrenPlaceholder/NoDataRow/styles.d.ts +3 -0
  51. package/components/InfiniteTreeList/TreeItem/ChildrenPlaceholder/NoDataRow/styles.js +11 -0
  52. package/components/InfiniteTreeList/TreeItem/TreeItem.js +6 -3
  53. package/components/InfiniteTreeList/TreeItem/styles.js +19 -0
  54. package/components/InfiniteTreeList/TreeItem/useLogic/useLogic.d.ts +2 -1
  55. package/components/InfiniteTreeList/TreeItem/useLogic/useLogic.js +5 -4
  56. package/components/InfiniteTreeList/constants.d.ts +21 -0
  57. package/components/InfiniteTreeList/constants.js +21 -0
  58. package/components/InfiniteTreeList/hooks/index.d.ts +2 -0
  59. package/components/InfiniteTreeList/hooks/index.js +2 -0
  60. package/components/InfiniteTreeList/hooks/useLevelNavigation/index.d.ts +2 -0
  61. package/components/InfiniteTreeList/hooks/useLevelNavigation/index.js +2 -0
  62. package/components/InfiniteTreeList/hooks/useLevelNavigation/types.d.ts +15 -0
  63. package/components/InfiniteTreeList/hooks/useLevelNavigation/types.js +1 -0
  64. package/components/InfiniteTreeList/hooks/useLevelNavigation/useLevelNavigation.d.ts +15 -0
  65. package/components/InfiniteTreeList/hooks/useLevelNavigation/useLevelNavigation.js +48 -0
  66. package/components/InfiniteTreeList/hooks/useListScroll/hooks/index.d.ts +3 -0
  67. package/components/InfiniteTreeList/hooks/useListScroll/hooks/index.js +3 -0
  68. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/index.d.ts +2 -0
  69. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/index.js +2 -0
  70. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/types.d.ts +16 -0
  71. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/types.js +1 -0
  72. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/useLevelSnapshots.d.ts +12 -0
  73. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/useLevelSnapshots.js +42 -0
  74. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/index.d.ts +2 -0
  75. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/index.js +2 -0
  76. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/types.d.ts +12 -0
  77. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/types.js +1 -0
  78. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/useScrollToTopButton.d.ts +15 -0
  79. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/useScrollToTopButton.js +27 -0
  80. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/index.d.ts +2 -0
  81. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/index.js +2 -0
  82. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/types.d.ts +11 -0
  83. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/types.js +1 -0
  84. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/useTailWatcher.d.ts +12 -0
  85. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/useTailWatcher.js +39 -0
  86. package/components/InfiniteTreeList/hooks/useListScroll/types.d.ts +14 -2
  87. package/components/InfiniteTreeList/hooks/useListScroll/useListScroll.d.ts +9 -6
  88. package/components/InfiniteTreeList/hooks/useListScroll/useListScroll.js +192 -28
  89. package/components/InfiniteTreeList/hooks/useListScroll/utils/getOffsetTop/getOffsetTop.d.ts +4 -0
  90. package/components/InfiniteTreeList/hooks/useListScroll/utils/getOffsetTop/getOffsetTop.js +6 -0
  91. package/components/InfiniteTreeList/hooks/useListScroll/utils/getOffsetTop/index.d.ts +1 -0
  92. package/components/InfiniteTreeList/hooks/useListScroll/utils/getOffsetTop/index.js +1 -0
  93. package/components/InfiniteTreeList/hooks/useListScroll/utils/index.d.ts +1 -0
  94. package/components/InfiniteTreeList/hooks/useListScroll/utils/index.js +1 -0
  95. package/components/InfiniteTreeList/hooks/useNodeTitleValidation/index.d.ts +2 -0
  96. package/components/InfiniteTreeList/hooks/useNodeTitleValidation/index.js +2 -0
  97. package/components/InfiniteTreeList/hooks/useNodeTitleValidation/types.d.ts +14 -0
  98. package/components/InfiniteTreeList/hooks/useNodeTitleValidation/types.js +1 -0
  99. package/components/InfiniteTreeList/hooks/useNodeTitleValidation/useNodeTitleValidation.d.ts +5 -0
  100. package/components/InfiniteTreeList/hooks/useNodeTitleValidation/useNodeTitleValidation.js +18 -0
  101. package/components/InfiniteTreeList/styles.d.ts +5 -0
  102. package/components/InfiniteTreeList/styles.js +41 -0
  103. package/components/InfiniteTreeList/types.d.ts +4 -0
  104. package/components/InfiniteTreeList/useLogic/useLogic.d.ts +13 -5
  105. package/components/InfiniteTreeList/useLogic/useLogic.js +165 -27
  106. package/components/InfiniteTreeList/utils/checkHasFooterContent/checkHasFooterContent.d.ts +5 -0
  107. package/components/InfiniteTreeList/utils/checkHasFooterContent/checkHasFooterContent.js +4 -0
  108. package/components/InfiniteTreeList/utils/checkHasFooterContent/index.d.ts +1 -0
  109. package/components/InfiniteTreeList/utils/checkHasFooterContent/index.js +1 -0
  110. package/components/InfiniteTreeList/utils/checkHasNested/checkHasNested.d.ts +6 -0
  111. package/components/InfiniteTreeList/utils/checkHasNested/checkHasNested.js +5 -0
  112. package/components/InfiniteTreeList/utils/checkHasNested/index.d.ts +1 -0
  113. package/components/InfiniteTreeList/utils/checkHasNested/index.js +1 -0
  114. package/components/InfiniteTreeList/utils/createTailRegistry/createTailRegistry.d.ts +8 -3
  115. package/components/InfiniteTreeList/utils/createTailRegistry/createTailRegistry.js +30 -12
  116. package/components/InfiniteTreeList/utils/flattenTree/flattenTree.js +2 -1
  117. package/components/InfiniteTreeList/utils/getLevelKey/getLevelKey.d.ts +4 -0
  118. package/components/InfiniteTreeList/utils/getLevelKey/getLevelKey.js +5 -0
  119. package/components/InfiniteTreeList/utils/getLevelKey/index.d.ts +1 -0
  120. package/components/InfiniteTreeList/utils/getLevelKey/index.js +1 -0
  121. package/components/InfiniteTreeList/utils/index.d.ts +3 -0
  122. package/components/InfiniteTreeList/utils/index.js +3 -0
  123. package/components/useScrollManagement/useScrollManagement.js +7 -6
  124. package/node/components/ActionCellBase/ActionCellBase.js +10 -1
  125. package/node/components/ActionCellBase/MainAction/MainAction.js +6 -0
  126. package/node/components/ActionCellBase/MainAction/MainIconButton/MainIconButton.js +7 -4
  127. package/node/components/ActionCellBase/MainAction/MainIconButton/constants.d.ts +3 -0
  128. package/node/components/ActionCellBase/MainAction/MainIconButton/constants.js +7 -0
  129. package/node/components/ActionCellBase/MainAction/MainIconButton/styles.d.ts +11 -0
  130. package/node/components/ActionCellBase/MainAction/MainIconButton/styles.js +12 -0
  131. package/node/components/ActionCellBase/MainAction/MobileMainButton/MobileMainButton.d.ts +14 -0
  132. package/node/components/ActionCellBase/MainAction/MobileMainButton/MobileMainButton.js +21 -0
  133. package/node/components/ActionCellBase/MainAction/MobileMainButton/index.d.ts +1 -0
  134. package/node/components/ActionCellBase/MainAction/MobileMainButton/index.js +17 -0
  135. package/node/components/ActionCellBase/MainAction/MobileMainButton/styles.d.ts +11 -0
  136. package/node/components/ActionCellBase/MainAction/MobileMainButton/styles.js +10 -0
  137. package/node/components/ActionCellBase/SecondaryAction/SecondaryAction.js +2 -2
  138. package/node/components/ActionCellBase/SecondaryAction/styles.d.ts +4 -0
  139. package/node/components/ActionCellBase/SecondaryAction/styles.js +12 -0
  140. package/node/components/ActionCellBase/constants.d.ts +4 -0
  141. package/node/components/ActionCellBase/constants.js +8 -0
  142. package/node/components/ActionCellBase/styles.js +11 -0
  143. package/node/components/ActionCellBase/types.d.ts +25 -0
  144. package/node/components/InfiniteTreeList/InfiniteTreeList.js +16 -2
  145. package/node/components/InfiniteTreeList/InfiniteTreeListContext/InfiniteTreeListContext.d.ts +4 -0
  146. package/node/components/InfiniteTreeList/InfiniteTreeListContext/InfiniteTreeListContext.js +1 -0
  147. package/node/components/InfiniteTreeList/InfiniteTreeListContext/InfiniteTreeListContextProvider/InfiniteTreeListContextProvider.d.ts +2 -2
  148. package/node/components/InfiniteTreeList/InfiniteTreeListContext/InfiniteTreeListContextProvider/InfiniteTreeListContextProvider.js +3 -1
  149. package/node/components/InfiniteTreeList/InfiniteTreeListItem/ErrorPlaceholder/styles.js +8 -0
  150. package/node/components/InfiniteTreeList/InfiniteTreeListItem/InfiniteTreeListItem.js +6 -3
  151. package/node/components/InfiniteTreeList/InfiniteTreeListItem/constants.d.ts +2 -0
  152. package/node/components/InfiniteTreeList/InfiniteTreeListItem/constants.js +2 -0
  153. package/node/components/InfiniteTreeList/InfiniteTreeListItem/index.d.ts +1 -0
  154. package/node/components/InfiniteTreeList/InfiniteTreeListItem/index.js +3 -0
  155. package/node/components/InfiniteTreeList/InfiniteTreeListItem/styles.d.ts +14 -0
  156. package/node/components/InfiniteTreeList/InfiniteTreeListItem/styles.js +67 -3
  157. package/node/components/InfiniteTreeList/LevelHeader/LevelHeader.d.ts +5 -0
  158. package/node/components/InfiniteTreeList/LevelHeader/LevelHeader.js +21 -0
  159. package/node/components/InfiniteTreeList/LevelHeader/constants.d.ts +3 -0
  160. package/node/components/InfiniteTreeList/LevelHeader/constants.js +6 -0
  161. package/node/components/InfiniteTreeList/LevelHeader/index.d.ts +2 -0
  162. package/node/components/InfiniteTreeList/LevelHeader/index.js +18 -0
  163. package/node/components/InfiniteTreeList/LevelHeader/styles.d.ts +365 -0
  164. package/node/components/InfiniteTreeList/LevelHeader/styles.js +54 -0
  165. package/node/components/InfiniteTreeList/LevelHeader/types.d.ts +14 -0
  166. package/node/components/InfiniteTreeList/LevelHeader/types.js +2 -0
  167. package/node/components/InfiniteTreeList/ListFooter/styles.js +8 -0
  168. package/node/components/InfiniteTreeList/OnTopButton/styles.js +7 -0
  169. package/node/components/InfiniteTreeList/ParentItems/Item/Item.js +10 -2
  170. package/node/components/InfiniteTreeList/ParentItems/Item/useLogic/useLogic.d.ts +1 -0
  171. package/node/components/InfiniteTreeList/ParentItems/Item/useLogic/useLogic.js +10 -2
  172. package/node/components/InfiniteTreeList/TreeItem/ChildrenPlaceholder/NoDataRow/NoDataRow.js +2 -2
  173. package/node/components/InfiniteTreeList/TreeItem/ChildrenPlaceholder/NoDataRow/styles.d.ts +3 -0
  174. package/node/components/InfiniteTreeList/TreeItem/ChildrenPlaceholder/NoDataRow/styles.js +14 -0
  175. package/node/components/InfiniteTreeList/TreeItem/TreeItem.js +6 -3
  176. package/node/components/InfiniteTreeList/TreeItem/styles.js +19 -0
  177. package/node/components/InfiniteTreeList/TreeItem/useLogic/useLogic.d.ts +2 -1
  178. package/node/components/InfiniteTreeList/TreeItem/useLogic/useLogic.js +4 -3
  179. package/node/components/InfiniteTreeList/constants.d.ts +21 -0
  180. package/node/components/InfiniteTreeList/constants.js +22 -1
  181. package/node/components/InfiniteTreeList/hooks/index.d.ts +2 -0
  182. package/node/components/InfiniteTreeList/hooks/index.js +2 -0
  183. package/node/components/InfiniteTreeList/hooks/useLevelNavigation/index.d.ts +2 -0
  184. package/node/components/InfiniteTreeList/hooks/useLevelNavigation/index.js +18 -0
  185. package/node/components/InfiniteTreeList/hooks/useLevelNavigation/types.d.ts +15 -0
  186. package/node/components/InfiniteTreeList/hooks/useLevelNavigation/types.js +2 -0
  187. package/node/components/InfiniteTreeList/hooks/useLevelNavigation/useLevelNavigation.d.ts +15 -0
  188. package/node/components/InfiniteTreeList/hooks/useLevelNavigation/useLevelNavigation.js +52 -0
  189. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/index.d.ts +3 -0
  190. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/index.js +19 -0
  191. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/index.d.ts +2 -0
  192. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/index.js +18 -0
  193. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/types.d.ts +16 -0
  194. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/types.js +2 -0
  195. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/useLevelSnapshots.d.ts +12 -0
  196. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/useLevelSnapshots.js +46 -0
  197. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/index.d.ts +2 -0
  198. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/index.js +18 -0
  199. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/types.d.ts +12 -0
  200. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/types.js +2 -0
  201. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/useScrollToTopButton.d.ts +15 -0
  202. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/useScrollToTopButton.js +31 -0
  203. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/index.d.ts +2 -0
  204. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/index.js +18 -0
  205. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/types.d.ts +11 -0
  206. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/types.js +2 -0
  207. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/useTailWatcher.d.ts +12 -0
  208. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/useTailWatcher.js +43 -0
  209. package/node/components/InfiniteTreeList/hooks/useListScroll/types.d.ts +14 -2
  210. package/node/components/InfiniteTreeList/hooks/useListScroll/useListScroll.d.ts +9 -6
  211. package/node/components/InfiniteTreeList/hooks/useListScroll/useListScroll.js +190 -26
  212. package/node/components/InfiniteTreeList/hooks/useListScroll/utils/getOffsetTop/getOffsetTop.d.ts +4 -0
  213. package/node/components/InfiniteTreeList/hooks/useListScroll/utils/getOffsetTop/getOffsetTop.js +10 -0
  214. package/node/components/InfiniteTreeList/hooks/useListScroll/utils/getOffsetTop/index.d.ts +1 -0
  215. package/node/components/InfiniteTreeList/hooks/useListScroll/utils/getOffsetTop/index.js +17 -0
  216. package/node/components/InfiniteTreeList/hooks/useListScroll/utils/index.d.ts +1 -0
  217. package/node/components/InfiniteTreeList/hooks/useListScroll/utils/index.js +17 -0
  218. package/node/components/InfiniteTreeList/hooks/useNodeTitleValidation/index.d.ts +2 -0
  219. package/node/components/InfiniteTreeList/hooks/useNodeTitleValidation/index.js +18 -0
  220. package/node/components/InfiniteTreeList/hooks/useNodeTitleValidation/types.d.ts +14 -0
  221. package/node/components/InfiniteTreeList/hooks/useNodeTitleValidation/types.js +2 -0
  222. package/node/components/InfiniteTreeList/hooks/useNodeTitleValidation/useNodeTitleValidation.d.ts +5 -0
  223. package/node/components/InfiniteTreeList/hooks/useNodeTitleValidation/useNodeTitleValidation.js +22 -0
  224. package/node/components/InfiniteTreeList/styles.d.ts +5 -0
  225. package/node/components/InfiniteTreeList/styles.js +44 -0
  226. package/node/components/InfiniteTreeList/types.d.ts +4 -0
  227. package/node/components/InfiniteTreeList/useLogic/useLogic.d.ts +13 -5
  228. package/node/components/InfiniteTreeList/useLogic/useLogic.js +162 -24
  229. package/node/components/InfiniteTreeList/utils/checkHasFooterContent/checkHasFooterContent.d.ts +5 -0
  230. package/node/components/InfiniteTreeList/utils/checkHasFooterContent/checkHasFooterContent.js +8 -0
  231. package/node/components/InfiniteTreeList/utils/checkHasFooterContent/index.d.ts +1 -0
  232. package/node/components/InfiniteTreeList/utils/checkHasFooterContent/index.js +17 -0
  233. package/node/components/InfiniteTreeList/utils/checkHasNested/checkHasNested.d.ts +6 -0
  234. package/node/components/InfiniteTreeList/utils/checkHasNested/checkHasNested.js +9 -0
  235. package/node/components/InfiniteTreeList/utils/checkHasNested/index.d.ts +1 -0
  236. package/node/components/InfiniteTreeList/utils/checkHasNested/index.js +17 -0
  237. package/node/components/InfiniteTreeList/utils/createTailRegistry/createTailRegistry.d.ts +8 -3
  238. package/node/components/InfiniteTreeList/utils/createTailRegistry/createTailRegistry.js +30 -12
  239. package/node/components/InfiniteTreeList/utils/flattenTree/flattenTree.js +2 -1
  240. package/node/components/InfiniteTreeList/utils/getLevelKey/getLevelKey.d.ts +4 -0
  241. package/node/components/InfiniteTreeList/utils/getLevelKey/getLevelKey.js +9 -0
  242. package/node/components/InfiniteTreeList/utils/getLevelKey/index.d.ts +1 -0
  243. package/node/components/InfiniteTreeList/utils/getLevelKey/index.js +17 -0
  244. package/node/components/InfiniteTreeList/utils/index.d.ts +3 -0
  245. package/node/components/InfiniteTreeList/utils/index.js +3 -0
  246. package/node/components/useScrollManagement/useScrollManagement.js +6 -5
  247. package/package.json +1 -1
@@ -1,24 +1,38 @@
1
- import { useCallback, useRef } from 'react';
1
+ import { useCallback, useEffect, useLayoutEffect, useRef } from 'react';
2
2
  import { useScrollManagement } from '../../../useScrollManagement';
3
- import { infiniteTreeListClassnames, OVERSCAN, VIRTUOSO_CONTAINER_ID, } from '../../constants';
4
- import { createTailRegistry } from '../../utils';
3
+ import { infiniteTreeListClassnames, LEVEL_TRANSITION_TIMEOUT_MS, OVERSCAN, VIRTUOSO_CONTAINER_ID, } from '../../constants';
4
+ import { useLevelSnapshots, useScrollToTopButton, useTailWatcher, } from './hooks';
5
+ import { getOffsetTop } from './utils';
5
6
  /**
6
- * Скролл-обвязка списка: props для `Virtuoso`, кнопка «наверх» и реестр хвостов
7
- * вложенных веток. Хвосты регистрируют сами строки, хук создаёт реестр и на
8
- * смене видимого диапазона проверяет, попал ли хвост в кадр
7
+ * Скролл-обвязка списка: props для `Virtuoso`, переход между уровнями
8
+ * и сборка кнопки «наверх», реестра хвостов и памяти уровней
9
9
  */
10
- export const useListScroll = ({ scrollRef, isEndReached, onLoadMore, flatListRef, enterAnimation, }) => {
10
+ export const useListScroll = ({ scrollRef, isEndReached, onLoadMore, displayedList, enterAnimation, isRootLevel, levelKey, activeLevelKeys, }) => {
11
11
  const virtuosoRef = useRef(null);
12
- const scrollToTopButtonRef = useRef(null);
13
- const tailRegistryRef = useRef(null);
14
- if (!tailRegistryRef.current) {
15
- tailRegistryRef.current = createTailRegistry();
16
- }
17
- const tailRegistry = tailRegistryRef.current;
12
+ const listRef = useRef(null);
13
+ const pendingLevelRef = useRef(null);
14
+ const pinnedHeightRef = useRef(null);
15
+ const heldHeightRef = useRef(null);
16
+ const { tailRegistry, trackRange } = useTailWatcher({
17
+ displayedList,
18
+ levelKey,
19
+ });
20
+ const { updateVisibility: updateTopButtonVisibility, onTopButtonProps } = useScrollToTopButton({ scrollRef, virtuosoRef });
21
+ const { rememberLevel, forgetLevel, getLevelPosition, levelState } = useLevelSnapshots({ levelKey, activeLevelKeys, virtuosoRef });
22
+ const isRootLevelRef = useRef(isRootLevel);
23
+ useEffect(() => {
24
+ isRootLevelRef.current = isRootLevel;
25
+ }, [isRootLevel]);
26
+ const handleListLoadMore = useCallback(() => {
27
+ if (!isRootLevelRef.current) {
28
+ return;
29
+ }
30
+ onLoadMore?.();
31
+ }, [onLoadMore]);
18
32
  const { scrollParent, recalculateVerticalScroll, handleEndReach, isEndReachedWithScroll, } = useScrollManagement({
19
33
  scrollRef,
20
34
  isEndReached,
21
- onLoadMore,
35
+ onLoadMore: handleListLoadMore,
22
36
  virtuosoId: VIRTUOSO_CONTAINER_ID,
23
37
  });
24
38
  // Скролл виртуализации монтирует строки, которые появлением не считаются
@@ -28,32 +42,182 @@ export const useListScroll = ({ scrollRef, isEndReached, onLoadMore, flatListRef
28
42
  }
29
43
  }, [enterAnimation]);
30
44
  const handleRangeChanged = useCallback((range) => {
31
- scrollToTopButtonRef.current?.classList.toggle(infiniteTreeListClassnames.visibleScrollToTopButton, range.startIndex > 2);
32
- tailRegistry.checkRange(range.endIndex, (itemId) => flatListRef.current.findIndex((item) => item.id === itemId));
33
- }, [flatListRef, tailRegistry]);
34
- const handleScrollToTop = useCallback(() => {
35
- if (scrollRef.current) {
36
- scrollRef.current.style.scrollBehavior = 'auto';
37
- }
38
- virtuosoRef.current?.scrollToIndex(0);
39
- }, [scrollRef]);
45
+ updateTopButtonVisibility(range);
46
+ trackRange(range);
47
+ }, [updateTopButtonVisibility, trackRange]);
48
+ const getListTop = useCallback(() => {
49
+ const listElement = listRef.current;
50
+ if (!scrollParent || !listElement) {
51
+ return null;
52
+ }
53
+ return Math.max(getOffsetTop(listElement, scrollParent), 0);
54
+ }, [scrollParent]);
55
+ const saveLevelSnapshot = useCallback(() => {
56
+ const listTop = getListTop();
57
+ if (!scrollParent || listTop === null) {
58
+ return;
59
+ }
60
+ rememberLevel(scrollParent.scrollTop - listTop);
61
+ // Высота уходящего уровня держит список, пока новый не доехал
62
+ heldHeightRef.current = listRef.current?.offsetHeight ?? null;
63
+ }, [scrollParent, getListTop, rememberLevel]);
64
+ // Заданная высота снимается, когда строки уровня доехали и держат позицию сами
65
+ const releaseListHeight = useCallback(() => {
66
+ const listElement = listRef.current;
67
+ const pinnedHeight = pinnedHeightRef.current;
68
+ if (!scrollParent || !listElement || pinnedHeight === null) {
69
+ return;
70
+ }
71
+ const keptScrollTop = scrollParent.scrollTop;
72
+ pinnedHeightRef.current = null;
73
+ listElement.style.removeProperty('min-height');
74
+ if (scrollParent.scrollTop < keptScrollTop) {
75
+ pinnedHeightRef.current = pinnedHeight;
76
+ listElement.style.minHeight = `${pinnedHeight}px`;
77
+ scrollParent.scrollTop = keptScrollTop;
78
+ }
79
+ }, [scrollParent]);
80
+ const applyLevelPosition = useCallback(() => {
81
+ const pendingLevel = pendingLevelRef.current;
82
+ const listElement = listRef.current;
83
+ const listTop = getListTop();
84
+ if (!pendingLevel || !scrollParent || !listElement || listTop === null) {
85
+ return;
86
+ }
87
+ const offset = getLevelPosition(pendingLevel);
88
+ if (offset === undefined) {
89
+ pendingLevelRef.current = null;
90
+ scrollParent.scrollTop = Math.min(scrollParent.scrollTop, listTop);
91
+ return;
92
+ }
93
+ const target = Math.max(listTop + offset, 0);
94
+ // Строки уровня попадают в список на кадр позже, чем меняется сам уровень.
95
+ // Пока их нет, страница короткая, и до сохранённой позиции скролл просто
96
+ // не достаёт
97
+ if (target > scrollParent.scrollHeight - scrollParent.clientHeight) {
98
+ const pinnedHeight = Math.max(offset + scrollParent.clientHeight, pinnedHeightRef.current ?? 0);
99
+ pinnedHeightRef.current = pinnedHeight;
100
+ listElement.style.minHeight = `${pinnedHeight}px`;
101
+ }
102
+ scrollParent.scrollTop = target;
103
+ if (scrollParent.scrollTop < target) {
104
+ return;
105
+ }
106
+ pendingLevelRef.current = null;
107
+ }, [scrollParent, getListTop, getLevelPosition]);
108
+ const heightObserverRef = useRef(null);
109
+ const transitionTimerRef = useRef(null);
110
+ const stopWatchingLevelContent = useCallback(() => {
111
+ heightObserverRef.current?.disconnect();
112
+ heightObserverRef.current = null;
113
+ }, []);
114
+ // Переход открывает список и возвращает контейнеру `scroll-behavior: smooth`
115
+ const finishLevelTransition = useCallback(() => {
116
+ if (transitionTimerRef.current !== null) {
117
+ clearTimeout(transitionTimerRef.current);
118
+ transitionTimerRef.current = null;
119
+ }
120
+ listRef.current?.classList.remove(infiniteTreeListClassnames.levelTransition);
121
+ scrollParent?.style.removeProperty('scroll-behavior');
122
+ }, [scrollParent]);
123
+ const settleLevelTransition = useCallback(() => {
124
+ applyLevelPosition();
125
+ releaseListHeight();
126
+ if (pendingLevelRef.current || pinnedHeightRef.current !== null) {
127
+ return;
128
+ }
129
+ stopWatchingLevelContent();
130
+ finishLevelTransition();
131
+ }, [
132
+ applyLevelPosition,
133
+ releaseListHeight,
134
+ stopWatchingLevelContent,
135
+ finishLevelTransition,
136
+ ]);
137
+ const forceLevelTransitionEnd = useCallback(() => {
138
+ applyLevelPosition();
139
+ releaseListHeight();
140
+ stopWatchingLevelContent();
141
+ finishLevelTransition();
142
+ }, [
143
+ applyLevelPosition,
144
+ releaseListHeight,
145
+ stopWatchingLevelContent,
146
+ finishLevelTransition,
147
+ ]);
148
+ const startLevelTransition = useCallback(() => {
149
+ const listElement = listRef.current;
150
+ finishLevelTransition();
151
+ listElement?.classList.add(infiniteTreeListClassnames.levelTransition);
152
+ scrollParent?.style.setProperty('scroll-behavior', 'auto');
153
+ const heldHeight = heldHeightRef.current;
154
+ if (listElement && heldHeight !== null) {
155
+ pinnedHeightRef.current = heldHeight;
156
+ listElement.style.minHeight = `${heldHeight}px`;
157
+ }
158
+ transitionTimerRef.current = setTimeout(forceLevelTransitionEnd, LEVEL_TRANSITION_TIMEOUT_MS);
159
+ }, [finishLevelTransition, forceLevelTransitionEnd, scrollParent]);
160
+ const watchLevelContent = useCallback(() => {
161
+ if (heightObserverRef.current) {
162
+ return;
163
+ }
164
+ const contentElement = listRef.current?.querySelector(`#${VIRTUOSO_CONTAINER_ID}`);
165
+ if (!contentElement) {
166
+ settleLevelTransition();
167
+ return;
168
+ }
169
+ const observer = new ResizeObserver(([entry]) => {
170
+ // Первый замер приходит сразу за `observe`, когда список ещё пуст:
171
+ // снятый по нему переход показал бы обёртку без строк
172
+ if (!entry || entry.contentRect.height === 0) {
173
+ return;
174
+ }
175
+ settleLevelTransition();
176
+ });
177
+ observer.observe(contentElement);
178
+ heightObserverRef.current = observer;
179
+ }, [settleLevelTransition]);
180
+ useEffect(() => () => {
181
+ stopWatchingLevelContent();
182
+ finishLevelTransition();
183
+ }, [stopWatchingLevelContent, finishLevelTransition]);
184
+ const shownLevelRef = useRef(levelKey);
185
+ // Позиция выставляется до отрисовки кадра: из обычного эффекта уровень успел
186
+ // бы показаться с чужой позиции, и переход читался бы как прокрутка
187
+ useLayoutEffect(() => {
188
+ if (shownLevelRef.current === levelKey) {
189
+ return;
190
+ }
191
+ shownLevelRef.current = levelKey;
192
+ pendingLevelRef.current = levelKey;
193
+ // Высота, заданная прошлому переходу, к новому уровню не относится
194
+ pinnedHeightRef.current = null;
195
+ listRef.current?.style.removeProperty('min-height');
196
+ startLevelTransition();
197
+ applyLevelPosition();
198
+ watchLevelContent();
199
+ }, [levelKey, applyLevelPosition, watchLevelContent, startLevelTransition]);
40
200
  return {
41
201
  scrollParent,
202
+ listRef,
42
203
  tailRegistry,
43
204
  isEndReachedWithScroll,
205
+ saveLevelSnapshot,
206
+ dropLevelSnapshot: forgetLevel,
44
207
  virtuosoProps: {
45
208
  id: VIRTUOSO_CONTAINER_ID,
46
209
  ref: virtuosoRef,
47
210
  overscan: OVERSCAN,
211
+ restoreStateFrom: levelState,
212
+ // Из снимка нужны только высоты строк: позицию уровня список выставляет
213
+ // сам. Иначе `Virtuoso` уводит скролл в начало и возвращается к
214
+ // сохранённому месту собственной прокруткой
215
+ initialTopMostItemIndex: 0,
48
216
  rangeChanged: handleRangeChanged,
49
217
  endReached: handleEndReach,
50
218
  totalListHeightChanged: recalculateVerticalScroll,
51
219
  isScrolling: handleScrollingChange,
52
220
  },
53
- onTopButtonProps: {
54
- buttonRef: scrollToTopButtonRef,
55
- handleScrollToTop,
56
- scrollRef,
57
- },
221
+ onTopButtonProps,
58
222
  };
59
223
  };
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Смещение элемента внутри скролл-контейнера
3
+ */
4
+ export declare const getOffsetTop: (element: HTMLElement, scroller: HTMLElement) => number;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Смещение элемента внутри скролл-контейнера
3
+ */
4
+ export const getOffsetTop = (element, scroller) => element.getBoundingClientRect().top -
5
+ scroller.getBoundingClientRect().top +
6
+ scroller.scrollTop;
@@ -0,0 +1 @@
1
+ export * from './getOffsetTop';
@@ -0,0 +1 @@
1
+ export * from './getOffsetTop';
@@ -0,0 +1 @@
1
+ export * from './getOffsetTop';
@@ -0,0 +1 @@
1
+ export * from './getOffsetTop';
@@ -0,0 +1,2 @@
1
+ export * from './types';
2
+ export * from './useNodeTitleValidation';
@@ -0,0 +1,2 @@
1
+ export * from './types';
2
+ export * from './useNodeTitleValidation';
@@ -0,0 +1,14 @@
1
+ export type UseNodeTitleValidationParams = {
2
+ /**
3
+ * Флаг мобильного отображения
4
+ */
5
+ isMobile: boolean;
6
+ /**
7
+ * Id узла, чей уровень отображается
8
+ */
9
+ currentNodeId?: string;
10
+ /**
11
+ * Заголовок отображаемого узла из его данных
12
+ */
13
+ title?: string;
14
+ };
@@ -0,0 +1,5 @@
1
+ import type { UseNodeTitleValidationParams } from './types';
2
+ /**
3
+ * Проверяет, что у узла, содержимое которого отображается, задан `title`
4
+ */
5
+ export declare const useNodeTitleValidation: ({ isMobile, currentNodeId, title, }: UseNodeTitleValidationParams) => void;
@@ -0,0 +1,18 @@
1
+ import { useEffect, useRef } from 'react';
2
+ /**
3
+ * Проверяет, что у узла, содержимое которого отображается, задан `title`
4
+ */
5
+ export const useNodeTitleValidation = ({ isMobile, currentNodeId, title, }) => {
6
+ const warnedNodeIdsRef = useRef(new Set());
7
+ useEffect(() => {
8
+ if (!isMobile || !currentNodeId) {
9
+ return;
10
+ }
11
+ if (title || warnedNodeIdsRef.current.has(currentNodeId)) {
12
+ return;
13
+ }
14
+ warnedNodeIdsRef.current.add(currentNodeId);
15
+ // biome-ignore lint/suspicious/noConsole: Предупреждение для интеграторов
16
+ console.warn(`InfiniteTreeList: у узла "${currentNodeId}" не задан параметр title`);
17
+ }, [isMobile, currentNodeId, title]);
18
+ };
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export declare const InfiniteTreeListWrapper: import("../styled").StyledComponent<{
3
+ theme?: import("@emotion/react").Theme | undefined;
4
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
5
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -0,0 +1,41 @@
1
+ import { styled } from '../styled';
2
+ import { infiniteTreeListClassnames, VIRTUOSO_CONTAINER_ID } from './constants';
3
+ export const InfiniteTreeListWrapper = styled.div `
4
+ /* Убираем якорь на android устройствах */
5
+ /* stylelint-disable-next-line plugin/no-unsupported-browser-features */
6
+ overflow-anchor: none;
7
+
8
+ ${({ theme }) => theme.breakpoints.up('mobile')} {
9
+ &.${infiniteTreeListClassnames.loading},
10
+ &.${infiniteTreeListClassnames.error},
11
+ &.${infiniteTreeListClassnames.noData} {
12
+ height: 100%;
13
+ }
14
+ }
15
+
16
+ ${({ theme }) => theme.breakpoints.down('mobile')} {
17
+ overflow: hidden;
18
+
19
+ height: auto;
20
+ margin: ${({ theme }) => theme.spacing(0, 4, 4)};
21
+
22
+ background-color: ${({ theme }) => theme.palette.background.default};
23
+ border: 1px solid ${({ theme }) => theme.palette.components.border.default};
24
+ border-radius: ${({ theme }) => theme.shape.medium};
25
+
26
+ &.${infiniteTreeListClassnames.loading},
27
+ &.${infiniteTreeListClassnames.error},
28
+ &.${infiniteTreeListClassnames.noData} {
29
+ height: ${({ theme }) => `calc(100% - ${theme.spacing(4)})`};
30
+ }
31
+
32
+ /* Смена уровня пересоздаёт список: строки нового уровня встают на место
33
+ не в том же кадре, поэтому до их появления виден фон обёртки.
34
+ Высоту на это время держит min-height от самого списка */
35
+ &.${infiniteTreeListClassnames.levelTransition} {
36
+ #${VIRTUOSO_CONTAINER_ID} {
37
+ visibility: hidden;
38
+ }
39
+ }
40
+ }
41
+ `;
@@ -11,6 +11,10 @@ export type InfiniteTreeListDataBase = {
11
11
  * Статическое дерево описывается полем `children` и флага не требует
12
12
  */
13
13
  hasChildren?: boolean;
14
+ /**
15
+ * Заголовок узла в шапке уровня на мобильной ширине.
16
+ */
17
+ title?: string;
14
18
  /**
15
19
  * Дополнительные поля
16
20
  */
@@ -1,26 +1,35 @@
1
1
  /// <reference types="react" />
2
2
  import { type ContentStateProps } from '../../ContentState';
3
+ import type { LevelHeaderProps } from '../LevelHeader';
3
4
  import type { ListFooterContext } from '../ListFooter';
4
- import type { InfiniteTreeListData, InfiniteTreeListProps } from '../types';
5
+ import type { FlattenTree, InfiniteTreeListData, InfiniteTreeListProps } from '../types';
5
6
  type UseLogicParams<TData extends InfiniteTreeListData<TData>> = InfiniteTreeListProps<TData>;
6
7
  /**
7
8
  * Логика списка: сводит плоский список, данные дочерних элементов, скролл
8
9
  * и анимацию появления строк в props для `Virtuoso` и дочерних компонентов
9
10
  */
10
11
  export declare const useLogic: <TData extends InfiniteTreeListData<TData>>({ initialExpandedLevel, items, onRetry, errorMsg, isError, isLoading, scrollRef, isEndReached, onLoadMore, renderItem, renderParent, itemSkeleton, endOfScrollMsg, noDataImgSrc, errorImgSrc, }: UseLogicParams<TData>) => {
11
- flatList: import("../types").FlattenTree<TData>[];
12
- onToggle: ({ id: itemId }: InfiniteTreeListData) => void;
12
+ displayedList: FlattenTree<TData>[];
13
+ levelKey: string;
14
+ lastRowId: string | undefined;
15
+ levelHeaderProps: LevelHeaderProps | undefined;
16
+ onToggle: (item: InfiniteTreeListData) => void;
13
17
  nodePaginationMap: Record<string, import("../InfiniteTreeListContext").NodePagination>;
14
18
  registerChildren: (itemId: string, childrenState: import("../types").InfiniteTreeChildrenPagination) => void;
15
19
  notifyExpand: (itemId: string, onOpen?: (() => void) | undefined) => void;
16
- parentItems: import("../types").FlattenTree<TData>[];
20
+ parentItems: FlattenTree<TData>[];
17
21
  acquireParentSlot: (itemId: string) => HTMLDivElement | null;
18
22
  contentStateProps: Omit<ContentStateProps, "children">;
23
+ isNoData: boolean;
24
+ state: "error" | "loading" | "noData" | undefined;
19
25
  scrollParent: HTMLElement | null;
26
+ listRef: import("react").RefObject<HTMLDivElement | null>;
20
27
  virtuosoProps: {
21
28
  id: string;
22
29
  ref: import("react").RefObject<import("react-virtuoso").VirtuosoHandle | null>;
23
30
  overscan: number;
31
+ restoreStateFrom: import("react-virtuoso").StateSnapshot | undefined;
32
+ initialTopMostItemIndex: number;
24
33
  rangeChanged: (range: import("react-virtuoso").ListRange) => void;
25
34
  endReached: () => void;
26
35
  totalListHeightChanged: () => void;
@@ -39,7 +48,6 @@ export declare const useLogic: <TData extends InfiniteTreeListData<TData>>({ ini
39
48
  renderParent: (item: TData & {
40
49
  meta: import("../types").InfiniteTreeItemMeta;
41
50
  }) => import("react").ReactNode;
42
- items: TData[];
43
51
  onRetry: () => void;
44
52
  noDataImgSrc: string | undefined;
45
53
  enterAnimation: import("../hooks").EnterAnimationResult;