@astral/ui 4.105.0 → 4.107.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 (333) 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/Autocomplete/Autocomplete.js +2 -3
  22. package/components/InfiniteTreeList/InfiniteTreeList.js +16 -2
  23. package/components/InfiniteTreeList/InfiniteTreeListContext/InfiniteTreeListContext.d.ts +4 -0
  24. package/components/InfiniteTreeList/InfiniteTreeListContext/InfiniteTreeListContext.js +1 -0
  25. package/components/InfiniteTreeList/InfiniteTreeListContext/InfiniteTreeListContextProvider/InfiniteTreeListContextProvider.d.ts +2 -2
  26. package/components/InfiniteTreeList/InfiniteTreeListContext/InfiniteTreeListContextProvider/InfiniteTreeListContextProvider.js +3 -1
  27. package/components/InfiniteTreeList/InfiniteTreeListItem/ErrorPlaceholder/styles.js +8 -0
  28. package/components/InfiniteTreeList/InfiniteTreeListItem/InfiniteTreeListItem.js +7 -4
  29. package/components/InfiniteTreeList/InfiniteTreeListItem/constants.d.ts +2 -0
  30. package/components/InfiniteTreeList/InfiniteTreeListItem/constants.js +2 -0
  31. package/components/InfiniteTreeList/InfiniteTreeListItem/index.d.ts +1 -0
  32. package/components/InfiniteTreeList/InfiniteTreeListItem/index.js +1 -0
  33. package/components/InfiniteTreeList/InfiniteTreeListItem/styles.d.ts +14 -0
  34. package/components/InfiniteTreeList/InfiniteTreeListItem/styles.js +66 -2
  35. package/components/InfiniteTreeList/LevelHeader/LevelHeader.d.ts +5 -0
  36. package/components/InfiniteTreeList/LevelHeader/LevelHeader.js +17 -0
  37. package/components/InfiniteTreeList/LevelHeader/constants.d.ts +3 -0
  38. package/components/InfiniteTreeList/LevelHeader/constants.js +3 -0
  39. package/components/InfiniteTreeList/LevelHeader/index.d.ts +2 -0
  40. package/components/InfiniteTreeList/LevelHeader/index.js +2 -0
  41. package/components/InfiniteTreeList/LevelHeader/styles.d.ts +365 -0
  42. package/components/InfiniteTreeList/LevelHeader/styles.js +51 -0
  43. package/components/InfiniteTreeList/LevelHeader/types.d.ts +14 -0
  44. package/components/InfiniteTreeList/LevelHeader/types.js +1 -0
  45. package/components/InfiniteTreeList/ListFooter/styles.js +8 -0
  46. package/components/InfiniteTreeList/OnTopButton/styles.js +7 -0
  47. package/components/InfiniteTreeList/ParentItems/Item/Item.js +10 -2
  48. package/components/InfiniteTreeList/ParentItems/Item/useLogic/useLogic.d.ts +1 -0
  49. package/components/InfiniteTreeList/ParentItems/Item/useLogic/useLogic.js +10 -2
  50. package/components/InfiniteTreeList/TreeItem/ChildrenPlaceholder/NoDataRow/NoDataRow.js +2 -2
  51. package/components/InfiniteTreeList/TreeItem/ChildrenPlaceholder/NoDataRow/styles.d.ts +3 -0
  52. package/components/InfiniteTreeList/TreeItem/ChildrenPlaceholder/NoDataRow/styles.js +11 -0
  53. package/components/InfiniteTreeList/TreeItem/TreeItem.js +6 -3
  54. package/components/InfiniteTreeList/TreeItem/styles.js +19 -0
  55. package/components/InfiniteTreeList/TreeItem/useLogic/useLogic.d.ts +2 -1
  56. package/components/InfiniteTreeList/TreeItem/useLogic/useLogic.js +5 -4
  57. package/components/InfiniteTreeList/constants.d.ts +21 -0
  58. package/components/InfiniteTreeList/constants.js +21 -0
  59. package/components/InfiniteTreeList/hooks/index.d.ts +2 -0
  60. package/components/InfiniteTreeList/hooks/index.js +2 -0
  61. package/components/InfiniteTreeList/hooks/useLevelNavigation/index.d.ts +2 -0
  62. package/components/InfiniteTreeList/hooks/useLevelNavigation/index.js +2 -0
  63. package/components/InfiniteTreeList/hooks/useLevelNavigation/types.d.ts +15 -0
  64. package/components/InfiniteTreeList/hooks/useLevelNavigation/types.js +1 -0
  65. package/components/InfiniteTreeList/hooks/useLevelNavigation/useLevelNavigation.d.ts +15 -0
  66. package/components/InfiniteTreeList/hooks/useLevelNavigation/useLevelNavigation.js +48 -0
  67. package/components/InfiniteTreeList/hooks/useListScroll/hooks/index.d.ts +3 -0
  68. package/components/InfiniteTreeList/hooks/useListScroll/hooks/index.js +3 -0
  69. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/index.d.ts +2 -0
  70. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/index.js +2 -0
  71. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/types.d.ts +16 -0
  72. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/types.js +1 -0
  73. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/useLevelSnapshots.d.ts +12 -0
  74. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/useLevelSnapshots.js +42 -0
  75. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/index.d.ts +2 -0
  76. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/index.js +2 -0
  77. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/types.d.ts +12 -0
  78. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/types.js +1 -0
  79. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/useScrollToTopButton.d.ts +15 -0
  80. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/useScrollToTopButton.js +27 -0
  81. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/index.d.ts +2 -0
  82. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/index.js +2 -0
  83. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/types.d.ts +11 -0
  84. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/types.js +1 -0
  85. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/useTailWatcher.d.ts +12 -0
  86. package/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/useTailWatcher.js +39 -0
  87. package/components/InfiniteTreeList/hooks/useListScroll/types.d.ts +14 -2
  88. package/components/InfiniteTreeList/hooks/useListScroll/useListScroll.d.ts +9 -6
  89. package/components/InfiniteTreeList/hooks/useListScroll/useListScroll.js +192 -28
  90. package/components/InfiniteTreeList/hooks/useListScroll/utils/getOffsetTop/getOffsetTop.d.ts +4 -0
  91. package/components/InfiniteTreeList/hooks/useListScroll/utils/getOffsetTop/getOffsetTop.js +6 -0
  92. package/components/InfiniteTreeList/hooks/useListScroll/utils/getOffsetTop/index.d.ts +1 -0
  93. package/components/InfiniteTreeList/hooks/useListScroll/utils/getOffsetTop/index.js +1 -0
  94. package/components/InfiniteTreeList/hooks/useListScroll/utils/index.d.ts +1 -0
  95. package/components/InfiniteTreeList/hooks/useListScroll/utils/index.js +1 -0
  96. package/components/InfiniteTreeList/hooks/useNodeTitleValidation/index.d.ts +2 -0
  97. package/components/InfiniteTreeList/hooks/useNodeTitleValidation/index.js +2 -0
  98. package/components/InfiniteTreeList/hooks/useNodeTitleValidation/types.d.ts +14 -0
  99. package/components/InfiniteTreeList/hooks/useNodeTitleValidation/types.js +1 -0
  100. package/components/InfiniteTreeList/hooks/useNodeTitleValidation/useNodeTitleValidation.d.ts +5 -0
  101. package/components/InfiniteTreeList/hooks/useNodeTitleValidation/useNodeTitleValidation.js +18 -0
  102. package/components/InfiniteTreeList/styles.d.ts +5 -0
  103. package/components/InfiniteTreeList/styles.js +41 -0
  104. package/components/InfiniteTreeList/types.d.ts +4 -0
  105. package/components/InfiniteTreeList/useLogic/useLogic.d.ts +13 -5
  106. package/components/InfiniteTreeList/useLogic/useLogic.js +165 -27
  107. package/components/InfiniteTreeList/utils/checkHasFooterContent/checkHasFooterContent.d.ts +5 -0
  108. package/components/InfiniteTreeList/utils/checkHasFooterContent/checkHasFooterContent.js +4 -0
  109. package/components/InfiniteTreeList/utils/checkHasFooterContent/index.d.ts +1 -0
  110. package/components/InfiniteTreeList/utils/checkHasFooterContent/index.js +1 -0
  111. package/components/InfiniteTreeList/utils/checkHasNested/checkHasNested.d.ts +6 -0
  112. package/components/InfiniteTreeList/utils/checkHasNested/checkHasNested.js +5 -0
  113. package/components/InfiniteTreeList/utils/checkHasNested/index.d.ts +1 -0
  114. package/components/InfiniteTreeList/utils/checkHasNested/index.js +1 -0
  115. package/components/InfiniteTreeList/utils/createTailRegistry/createTailRegistry.d.ts +8 -3
  116. package/components/InfiniteTreeList/utils/createTailRegistry/createTailRegistry.js +30 -12
  117. package/components/InfiniteTreeList/utils/flattenTree/flattenTree.js +2 -1
  118. package/components/InfiniteTreeList/utils/getLevelKey/getLevelKey.d.ts +4 -0
  119. package/components/InfiniteTreeList/utils/getLevelKey/getLevelKey.js +5 -0
  120. package/components/InfiniteTreeList/utils/getLevelKey/index.d.ts +1 -0
  121. package/components/InfiniteTreeList/utils/getLevelKey/index.js +1 -0
  122. package/components/InfiniteTreeList/utils/index.d.ts +3 -0
  123. package/components/InfiniteTreeList/utils/index.js +3 -0
  124. package/components/Onboarding/ui/StepStrategy/steps/HighlightStep/styles.d.ts +1 -1
  125. package/components/Select/Select.js +4 -3
  126. package/components/Select/useLogic/useLogic.d.ts +11 -2
  127. package/components/Select/useLogic/useLogic.js +4 -1
  128. package/components/TagsList/PopoverTags/PopoverTags.d.ts +7 -0
  129. package/components/TagsList/PopoverTags/PopoverTags.js +8 -0
  130. package/components/TagsList/PopoverTags/index.d.ts +2 -0
  131. package/components/TagsList/PopoverTags/index.js +2 -0
  132. package/components/TagsList/PopoverTags/styles.d.ts +8 -0
  133. package/components/TagsList/PopoverTags/styles.js +15 -0
  134. package/components/TagsList/PopoverTags/types.d.ts +24 -0
  135. package/components/TagsList/PopoverTags/types.js +1 -0
  136. package/components/TagsList/Tag/Tag.d.ts +9 -1
  137. package/components/TagsList/Tag/Tag.js +4 -3
  138. package/components/TagsList/TagsList.js +11 -5
  139. package/components/TagsList/constants.d.ts +35 -0
  140. package/components/TagsList/constants.js +35 -0
  141. package/components/TagsList/styles.d.ts +9 -1
  142. package/components/TagsList/styles.js +20 -1
  143. package/components/TagsList/types.d.ts +4 -0
  144. package/components/TagsList/useLogic/hooks/index.d.ts +1 -0
  145. package/components/TagsList/useLogic/hooks/index.js +1 -0
  146. package/components/TagsList/useLogic/hooks/useHoverDelay/index.d.ts +1 -0
  147. package/components/TagsList/useLogic/hooks/useHoverDelay/index.js +1 -0
  148. package/components/TagsList/useLogic/hooks/useHoverDelay/types.d.ts +20 -0
  149. package/components/TagsList/useLogic/hooks/useHoverDelay/types.js +1 -0
  150. package/components/TagsList/useLogic/hooks/useHoverDelay/useHoverDelay.d.ts +5 -0
  151. package/components/TagsList/useLogic/hooks/useHoverDelay/useHoverDelay.js +27 -0
  152. package/components/TagsList/useLogic/useLogic.d.ts +14 -2
  153. package/components/TagsList/useLogic/useLogic.js +84 -4
  154. package/components/TagsList/utils/calculatePopoverWidth/calculatePopoverWidth.d.ts +5 -0
  155. package/components/TagsList/utils/calculatePopoverWidth/calculatePopoverWidth.js +22 -0
  156. package/components/TagsList/utils/calculatePopoverWidth/index.d.ts +1 -0
  157. package/components/TagsList/utils/calculatePopoverWidth/index.js +1 -0
  158. package/components/TagsList/utils/index.d.ts +1 -0
  159. package/components/TagsList/utils/index.js +1 -0
  160. package/components/TreeLikeAsyncAutocomplete/Input/Input.js +3 -2
  161. package/components/TreeLikeAsyncAutocomplete/Input/useLogic/useLogic.d.ts +3 -2
  162. package/components/TreeLikeAsyncAutocomplete/Input/useLogic/useLogic.js +3 -1
  163. package/components/TreeLikeAutocomplete/Input/Input.js +2 -2
  164. package/components/TreeLikeAutocomplete/Input/useLogic/useLogic.d.ts +2 -1
  165. package/components/TreeLikeAutocomplete/Input/useLogic/useLogic.js +3 -1
  166. package/components/useScrollManagement/useScrollManagement.js +7 -6
  167. package/node/components/ActionCellBase/ActionCellBase.js +10 -1
  168. package/node/components/ActionCellBase/MainAction/MainAction.js +6 -0
  169. package/node/components/ActionCellBase/MainAction/MainIconButton/MainIconButton.js +7 -4
  170. package/node/components/ActionCellBase/MainAction/MainIconButton/constants.d.ts +3 -0
  171. package/node/components/ActionCellBase/MainAction/MainIconButton/constants.js +7 -0
  172. package/node/components/ActionCellBase/MainAction/MainIconButton/styles.d.ts +11 -0
  173. package/node/components/ActionCellBase/MainAction/MainIconButton/styles.js +12 -0
  174. package/node/components/ActionCellBase/MainAction/MobileMainButton/MobileMainButton.d.ts +14 -0
  175. package/node/components/ActionCellBase/MainAction/MobileMainButton/MobileMainButton.js +21 -0
  176. package/node/components/ActionCellBase/MainAction/MobileMainButton/index.d.ts +1 -0
  177. package/node/components/ActionCellBase/MainAction/MobileMainButton/index.js +17 -0
  178. package/node/components/ActionCellBase/MainAction/MobileMainButton/styles.d.ts +11 -0
  179. package/node/components/ActionCellBase/MainAction/MobileMainButton/styles.js +10 -0
  180. package/node/components/ActionCellBase/SecondaryAction/SecondaryAction.js +2 -2
  181. package/node/components/ActionCellBase/SecondaryAction/styles.d.ts +4 -0
  182. package/node/components/ActionCellBase/SecondaryAction/styles.js +12 -0
  183. package/node/components/ActionCellBase/constants.d.ts +4 -0
  184. package/node/components/ActionCellBase/constants.js +8 -0
  185. package/node/components/ActionCellBase/styles.js +11 -0
  186. package/node/components/ActionCellBase/types.d.ts +25 -0
  187. package/node/components/Autocomplete/Autocomplete.js +2 -3
  188. package/node/components/InfiniteTreeList/InfiniteTreeList.js +16 -2
  189. package/node/components/InfiniteTreeList/InfiniteTreeListContext/InfiniteTreeListContext.d.ts +4 -0
  190. package/node/components/InfiniteTreeList/InfiniteTreeListContext/InfiniteTreeListContext.js +1 -0
  191. package/node/components/InfiniteTreeList/InfiniteTreeListContext/InfiniteTreeListContextProvider/InfiniteTreeListContextProvider.d.ts +2 -2
  192. package/node/components/InfiniteTreeList/InfiniteTreeListContext/InfiniteTreeListContextProvider/InfiniteTreeListContextProvider.js +3 -1
  193. package/node/components/InfiniteTreeList/InfiniteTreeListItem/ErrorPlaceholder/styles.js +8 -0
  194. package/node/components/InfiniteTreeList/InfiniteTreeListItem/InfiniteTreeListItem.js +6 -3
  195. package/node/components/InfiniteTreeList/InfiniteTreeListItem/constants.d.ts +2 -0
  196. package/node/components/InfiniteTreeList/InfiniteTreeListItem/constants.js +2 -0
  197. package/node/components/InfiniteTreeList/InfiniteTreeListItem/index.d.ts +1 -0
  198. package/node/components/InfiniteTreeList/InfiniteTreeListItem/index.js +3 -0
  199. package/node/components/InfiniteTreeList/InfiniteTreeListItem/styles.d.ts +14 -0
  200. package/node/components/InfiniteTreeList/InfiniteTreeListItem/styles.js +67 -3
  201. package/node/components/InfiniteTreeList/LevelHeader/LevelHeader.d.ts +5 -0
  202. package/node/components/InfiniteTreeList/LevelHeader/LevelHeader.js +21 -0
  203. package/node/components/InfiniteTreeList/LevelHeader/constants.d.ts +3 -0
  204. package/node/components/InfiniteTreeList/LevelHeader/constants.js +6 -0
  205. package/node/components/InfiniteTreeList/LevelHeader/index.d.ts +2 -0
  206. package/node/components/InfiniteTreeList/LevelHeader/index.js +18 -0
  207. package/node/components/InfiniteTreeList/LevelHeader/styles.d.ts +365 -0
  208. package/node/components/InfiniteTreeList/LevelHeader/styles.js +54 -0
  209. package/node/components/InfiniteTreeList/LevelHeader/types.d.ts +14 -0
  210. package/node/components/InfiniteTreeList/LevelHeader/types.js +2 -0
  211. package/node/components/InfiniteTreeList/ListFooter/styles.js +8 -0
  212. package/node/components/InfiniteTreeList/OnTopButton/styles.js +7 -0
  213. package/node/components/InfiniteTreeList/ParentItems/Item/Item.js +10 -2
  214. package/node/components/InfiniteTreeList/ParentItems/Item/useLogic/useLogic.d.ts +1 -0
  215. package/node/components/InfiniteTreeList/ParentItems/Item/useLogic/useLogic.js +10 -2
  216. package/node/components/InfiniteTreeList/TreeItem/ChildrenPlaceholder/NoDataRow/NoDataRow.js +2 -2
  217. package/node/components/InfiniteTreeList/TreeItem/ChildrenPlaceholder/NoDataRow/styles.d.ts +3 -0
  218. package/node/components/InfiniteTreeList/TreeItem/ChildrenPlaceholder/NoDataRow/styles.js +14 -0
  219. package/node/components/InfiniteTreeList/TreeItem/TreeItem.js +6 -3
  220. package/node/components/InfiniteTreeList/TreeItem/styles.js +19 -0
  221. package/node/components/InfiniteTreeList/TreeItem/useLogic/useLogic.d.ts +2 -1
  222. package/node/components/InfiniteTreeList/TreeItem/useLogic/useLogic.js +4 -3
  223. package/node/components/InfiniteTreeList/constants.d.ts +21 -0
  224. package/node/components/InfiniteTreeList/constants.js +22 -1
  225. package/node/components/InfiniteTreeList/hooks/index.d.ts +2 -0
  226. package/node/components/InfiniteTreeList/hooks/index.js +2 -0
  227. package/node/components/InfiniteTreeList/hooks/useLevelNavigation/index.d.ts +2 -0
  228. package/node/components/InfiniteTreeList/hooks/useLevelNavigation/index.js +18 -0
  229. package/node/components/InfiniteTreeList/hooks/useLevelNavigation/types.d.ts +15 -0
  230. package/node/components/InfiniteTreeList/hooks/useLevelNavigation/types.js +2 -0
  231. package/node/components/InfiniteTreeList/hooks/useLevelNavigation/useLevelNavigation.d.ts +15 -0
  232. package/node/components/InfiniteTreeList/hooks/useLevelNavigation/useLevelNavigation.js +52 -0
  233. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/index.d.ts +3 -0
  234. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/index.js +19 -0
  235. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/index.d.ts +2 -0
  236. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/index.js +18 -0
  237. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/types.d.ts +16 -0
  238. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/types.js +2 -0
  239. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/useLevelSnapshots.d.ts +12 -0
  240. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/useLevelSnapshots.js +46 -0
  241. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/index.d.ts +2 -0
  242. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/index.js +18 -0
  243. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/types.d.ts +12 -0
  244. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/types.js +2 -0
  245. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/useScrollToTopButton.d.ts +15 -0
  246. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/useScrollToTopButton.js +31 -0
  247. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/index.d.ts +2 -0
  248. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/index.js +18 -0
  249. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/types.d.ts +11 -0
  250. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/types.js +2 -0
  251. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/useTailWatcher.d.ts +12 -0
  252. package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/useTailWatcher.js +43 -0
  253. package/node/components/InfiniteTreeList/hooks/useListScroll/types.d.ts +14 -2
  254. package/node/components/InfiniteTreeList/hooks/useListScroll/useListScroll.d.ts +9 -6
  255. package/node/components/InfiniteTreeList/hooks/useListScroll/useListScroll.js +190 -26
  256. package/node/components/InfiniteTreeList/hooks/useListScroll/utils/getOffsetTop/getOffsetTop.d.ts +4 -0
  257. package/node/components/InfiniteTreeList/hooks/useListScroll/utils/getOffsetTop/getOffsetTop.js +10 -0
  258. package/node/components/InfiniteTreeList/hooks/useListScroll/utils/getOffsetTop/index.d.ts +1 -0
  259. package/node/components/InfiniteTreeList/hooks/useListScroll/utils/getOffsetTop/index.js +17 -0
  260. package/node/components/InfiniteTreeList/hooks/useListScroll/utils/index.d.ts +1 -0
  261. package/node/components/InfiniteTreeList/hooks/useListScroll/utils/index.js +17 -0
  262. package/node/components/InfiniteTreeList/hooks/useNodeTitleValidation/index.d.ts +2 -0
  263. package/node/components/InfiniteTreeList/hooks/useNodeTitleValidation/index.js +18 -0
  264. package/node/components/InfiniteTreeList/hooks/useNodeTitleValidation/types.d.ts +14 -0
  265. package/node/components/InfiniteTreeList/hooks/useNodeTitleValidation/types.js +2 -0
  266. package/node/components/InfiniteTreeList/hooks/useNodeTitleValidation/useNodeTitleValidation.d.ts +5 -0
  267. package/node/components/InfiniteTreeList/hooks/useNodeTitleValidation/useNodeTitleValidation.js +22 -0
  268. package/node/components/InfiniteTreeList/styles.d.ts +5 -0
  269. package/node/components/InfiniteTreeList/styles.js +44 -0
  270. package/node/components/InfiniteTreeList/types.d.ts +4 -0
  271. package/node/components/InfiniteTreeList/useLogic/useLogic.d.ts +13 -5
  272. package/node/components/InfiniteTreeList/useLogic/useLogic.js +162 -24
  273. package/node/components/InfiniteTreeList/utils/checkHasFooterContent/checkHasFooterContent.d.ts +5 -0
  274. package/node/components/InfiniteTreeList/utils/checkHasFooterContent/checkHasFooterContent.js +8 -0
  275. package/node/components/InfiniteTreeList/utils/checkHasFooterContent/index.d.ts +1 -0
  276. package/node/components/InfiniteTreeList/utils/checkHasFooterContent/index.js +17 -0
  277. package/node/components/InfiniteTreeList/utils/checkHasNested/checkHasNested.d.ts +6 -0
  278. package/node/components/InfiniteTreeList/utils/checkHasNested/checkHasNested.js +9 -0
  279. package/node/components/InfiniteTreeList/utils/checkHasNested/index.d.ts +1 -0
  280. package/node/components/InfiniteTreeList/utils/checkHasNested/index.js +17 -0
  281. package/node/components/InfiniteTreeList/utils/createTailRegistry/createTailRegistry.d.ts +8 -3
  282. package/node/components/InfiniteTreeList/utils/createTailRegistry/createTailRegistry.js +30 -12
  283. package/node/components/InfiniteTreeList/utils/flattenTree/flattenTree.js +2 -1
  284. package/node/components/InfiniteTreeList/utils/getLevelKey/getLevelKey.d.ts +4 -0
  285. package/node/components/InfiniteTreeList/utils/getLevelKey/getLevelKey.js +9 -0
  286. package/node/components/InfiniteTreeList/utils/getLevelKey/index.d.ts +1 -0
  287. package/node/components/InfiniteTreeList/utils/getLevelKey/index.js +17 -0
  288. package/node/components/InfiniteTreeList/utils/index.d.ts +3 -0
  289. package/node/components/InfiniteTreeList/utils/index.js +3 -0
  290. package/node/components/Onboarding/ui/StepStrategy/steps/HighlightStep/styles.d.ts +1 -1
  291. package/node/components/Select/Select.js +4 -3
  292. package/node/components/Select/useLogic/useLogic.d.ts +11 -2
  293. package/node/components/Select/useLogic/useLogic.js +4 -1
  294. package/node/components/TagsList/PopoverTags/PopoverTags.d.ts +7 -0
  295. package/node/components/TagsList/PopoverTags/PopoverTags.js +12 -0
  296. package/node/components/TagsList/PopoverTags/index.d.ts +2 -0
  297. package/node/components/TagsList/PopoverTags/index.js +18 -0
  298. package/node/components/TagsList/PopoverTags/styles.d.ts +8 -0
  299. package/node/components/TagsList/PopoverTags/styles.js +18 -0
  300. package/node/components/TagsList/PopoverTags/types.d.ts +24 -0
  301. package/node/components/TagsList/PopoverTags/types.js +2 -0
  302. package/node/components/TagsList/Tag/Tag.d.ts +9 -1
  303. package/node/components/TagsList/Tag/Tag.js +4 -4
  304. package/node/components/TagsList/TagsList.js +10 -4
  305. package/node/components/TagsList/constants.d.ts +35 -0
  306. package/node/components/TagsList/constants.js +36 -1
  307. package/node/components/TagsList/styles.d.ts +9 -1
  308. package/node/components/TagsList/styles.js +20 -1
  309. package/node/components/TagsList/types.d.ts +4 -0
  310. package/node/components/TagsList/useLogic/hooks/index.d.ts +1 -0
  311. package/node/components/TagsList/useLogic/hooks/index.js +17 -0
  312. package/node/components/TagsList/useLogic/hooks/useHoverDelay/index.d.ts +1 -0
  313. package/node/components/TagsList/useLogic/hooks/useHoverDelay/index.js +17 -0
  314. package/node/components/TagsList/useLogic/hooks/useHoverDelay/types.d.ts +20 -0
  315. package/node/components/TagsList/useLogic/hooks/useHoverDelay/types.js +2 -0
  316. package/node/components/TagsList/useLogic/hooks/useHoverDelay/useHoverDelay.d.ts +5 -0
  317. package/node/components/TagsList/useLogic/hooks/useHoverDelay/useHoverDelay.js +31 -0
  318. package/node/components/TagsList/useLogic/useLogic.d.ts +14 -2
  319. package/node/components/TagsList/useLogic/useLogic.js +81 -1
  320. package/node/components/TagsList/utils/calculatePopoverWidth/calculatePopoverWidth.d.ts +5 -0
  321. package/node/components/TagsList/utils/calculatePopoverWidth/calculatePopoverWidth.js +26 -0
  322. package/node/components/TagsList/utils/calculatePopoverWidth/index.d.ts +1 -0
  323. package/node/components/TagsList/utils/calculatePopoverWidth/index.js +17 -0
  324. package/node/components/TagsList/utils/index.d.ts +1 -0
  325. package/node/components/TagsList/utils/index.js +3 -1
  326. package/node/components/TreeLikeAsyncAutocomplete/Input/Input.js +3 -2
  327. package/node/components/TreeLikeAsyncAutocomplete/Input/useLogic/useLogic.d.ts +3 -2
  328. package/node/components/TreeLikeAsyncAutocomplete/Input/useLogic/useLogic.js +3 -1
  329. package/node/components/TreeLikeAutocomplete/Input/Input.js +2 -2
  330. package/node/components/TreeLikeAutocomplete/Input/useLogic/useLogic.d.ts +2 -1
  331. package/node/components/TreeLikeAutocomplete/Input/useLogic/useLogic.js +3 -1
  332. package/node/components/useScrollManagement/useScrollManagement.js +6 -5
  333. package/package.json +1 -1
@@ -1,14 +1,16 @@
1
- import { useCallback, useContext, useMemo, useRef } from 'react';
1
+ import { useCallback, useContext, useEffect, useMemo, useRef } from 'react';
2
2
  import { ConfigContext } from '../../ConfigProvider';
3
+ import { useViewportType } from '../../useViewportType';
3
4
  import { CHILDREN_SKELETON_COUNT } from '../constants';
4
- import { useChildrenState, useEnterAnimation, useExpandNotifier, useFlatTree, useListScroll, } from '../hooks';
5
- import { createParentSlots } from '../utils';
5
+ import { useChildrenState, useEnterAnimation, useExpandNotifier, useFlatTree, useLevelNavigation, useListScroll, useNodeTitleValidation, } from '../hooks';
6
+ import { checkHasFooterContent, countDirectChildren, createParentSlots, getLevelKey, } from '../utils';
6
7
  /**
7
8
  * Логика списка: сводит плоский список, данные дочерних элементов, скролл
8
9
  * и анимацию появления строк в props для `Virtuoso` и дочерних компонентов
9
10
  */
10
11
  export const useLogic = ({ initialExpandedLevel, items, onRetry, errorMsg, isError, isLoading, scrollRef, isEndReached, onLoadMore, renderItem, renderParent, itemSkeleton, endOfScrollMsg, noDataImgSrc, errorImgSrc, }) => {
11
12
  const { imagesMap } = useContext(ConfigContext);
13
+ const { isMobile } = useViewportType();
12
14
  const enterAnimation = useEnterAnimation();
13
15
  const parentSlotsRef = useRef(null);
14
16
  if (!parentSlotsRef.current) {
@@ -25,6 +27,7 @@ export const useLogic = ({ initialExpandedLevel, items, onRetry, errorMsg, isErr
25
27
  enterAnimation,
26
28
  onCollapse: resetExpandNotification,
27
29
  });
30
+ const skeletonCount = itemSkeleton ? CHILDREN_SKELETON_COUNT : 1;
28
31
  const { registerChildren, nodePaginationMap, parentItems } = useChildrenState({
29
32
  items,
30
33
  flatList,
@@ -34,49 +37,185 @@ export const useLogic = ({ initialExpandedLevel, items, onRetry, errorMsg, isErr
34
37
  enterAnimation,
35
38
  insertChildren,
36
39
  syncChildrenPlaceholders,
37
- skeletonCount: itemSkeleton ? CHILDREN_SKELETON_COUNT : 1,
40
+ skeletonCount,
38
41
  releaseParentSlot,
39
42
  });
40
- const { scrollParent, tailRegistry, isEndReachedWithScroll, virtuosoProps, onTopButtonProps, } = useListScroll({
43
+ const checkNodeExists = useCallback((nodeId) => flatList.some(({ id }) => id === nodeId), [flatList]);
44
+ const { currentNodeId, baseNodeId, activeLevelKeys, hasUpperLevel, isRootLevel, enterNode, leaveNode, } = useLevelNavigation({ items, isMobile, checkNodeExists });
45
+ const isBaseNodeExpanded = Boolean(baseNodeId && expandedIds.has(baseNodeId));
46
+ // Если корневой узел 1, то базовым уровнем становятся его дочерние элементы на
47
+ // мобильных устройствах
48
+ useEffect(() => {
49
+ if (!isMobile || !baseNodeId || isBaseNodeExpanded) {
50
+ return;
51
+ }
52
+ onToggle({ id: baseNodeId });
53
+ }, [isMobile, baseNodeId, isBaseNodeExpanded, onToggle]);
54
+ const currentNode = useMemo(() => {
55
+ if (!currentNodeId) {
56
+ return undefined;
57
+ }
58
+ return flatList.find(({ id }) => id === currentNodeId);
59
+ }, [currentNodeId, flatList]);
60
+ const levelTitle = currentNode?.title;
61
+ useNodeTitleValidation({
62
+ isMobile,
63
+ currentNodeId: currentNode?.id,
64
+ title: levelTitle,
65
+ });
66
+ const displayedList = useMemo(() => {
67
+ if (!isMobile) {
68
+ return flatList;
69
+ }
70
+ if (!currentNodeId) {
71
+ return flatList.filter((item) => item.meta.level === 0);
72
+ }
73
+ return flatList.filter((item) => item.meta.parentId === currentNodeId);
74
+ }, [isMobile, flatList, currentNodeId]);
75
+ // Уровни живут только на мобильной ширине
76
+ const levelKey = getLevelKey(isMobile ? currentNodeId : undefined);
77
+ const { scrollParent, listRef, tailRegistry, isEndReachedWithScroll, virtuosoProps, onTopButtonProps, saveLevelSnapshot, dropLevelSnapshot, } = useListScroll({
41
78
  scrollRef,
42
79
  isEndReached,
43
80
  onLoadMore,
44
- flatListRef,
81
+ displayedList,
45
82
  enterAnimation,
83
+ isRootLevel,
84
+ levelKey,
85
+ activeLevelKeys,
46
86
  });
47
- const contentStateProps = useMemo(() => {
48
- const isNoData = !items?.length;
49
- return {
50
- // Проверка на текущие элементы списка необходима для рендера loading состояния при подгрузке данных
51
- // вместо общего LoadingPlaceholder на всю страницу
52
- isLoading: isNoData && isLoading,
53
- isError: isNoData && isError,
54
- loadingTitle: 'Загрузка данных',
55
- errorState: {
56
- imgAlt: 'Что-то пошло не так',
57
- errorList: [errorMsg || ''],
58
- imgSrc: errorImgSrc ?? imagesMap.defaultErrorImgSrc,
59
- onRetry,
60
- },
61
- };
62
- }, [items, isLoading, isError, errorMsg, errorImgSrc, onRetry, imagesMap]);
87
+ // Смена уровня — не появление строк, анимировать их не нужно
88
+ const prevLevelKeyRef = useRef(levelKey);
89
+ useEffect(() => {
90
+ if (prevLevelKeyRef.current === levelKey) {
91
+ return;
92
+ }
93
+ prevLevelKeyRef.current = levelKey;
94
+ enterAnimation.reset();
95
+ }, [levelKey, enterAnimation]);
96
+ const prepareNodeChildren = useCallback((listItem) => {
97
+ if (!expandedIdsRef.current.has(listItem.id)) {
98
+ onToggle(listItem);
99
+ }
100
+ const hasChildrenInList = Boolean(listItem.children?.length) ||
101
+ countDirectChildren(flatListRef.current, listItem.id) > 0;
102
+ if (!hasChildrenInList) {
103
+ syncChildrenPlaceholders(listItem.id, true, skeletonCount);
104
+ }
105
+ }, [
106
+ onToggle,
107
+ flatListRef,
108
+ expandedIdsRef,
109
+ syncChildrenPlaceholders,
110
+ skeletonCount,
111
+ ]);
112
+ // На мобильной ширине дети узла открываются отдельным уровнем
113
+ const handleEnterNode = useCallback((item) => {
114
+ const listItem = flatListRef.current.find(({ id }) => id === item.id);
115
+ if (!listItem?.meta.hasNested) {
116
+ return;
117
+ }
118
+ prepareNodeChildren(listItem);
119
+ // Открытие уровня — не появление строк, анимировать их не нужно
120
+ enterAnimation.reset();
121
+ saveLevelSnapshot();
122
+ // Переход внутрь узла показывает уровень с начала
123
+ dropLevelSnapshot(getLevelKey(item.id));
124
+ enterNode(item.id);
125
+ }, [
126
+ flatListRef,
127
+ prepareNodeChildren,
128
+ enterAnimation,
129
+ saveLevelSnapshot,
130
+ dropLevelSnapshot,
131
+ enterNode,
132
+ ]);
133
+ const handleToggle = useCallback((item) => {
134
+ if (isMobile) {
135
+ handleEnterNode(item);
136
+ return;
137
+ }
138
+ onToggle(item);
139
+ }, [isMobile, handleEnterNode, onToggle]);
140
+ const handleLeaveLevel = useCallback(() => {
141
+ enterAnimation.reset();
142
+ saveLevelSnapshot();
143
+ leaveNode();
144
+ }, [saveLevelSnapshot, leaveNode, enterAnimation]);
145
+ const isNoData = !items?.length;
146
+ const state = useMemo(() => {
147
+ if (!isNoData) {
148
+ return undefined;
149
+ }
150
+ if (isLoading) {
151
+ return 'loading';
152
+ }
153
+ if (isError) {
154
+ return 'error';
155
+ }
156
+ return 'noData';
157
+ }, [isNoData, isLoading, isError]);
158
+ const contentStateProps = useMemo(() => ({
159
+ isLoading: state === 'loading',
160
+ isError: state === 'error',
161
+ loadingTitle: 'Загрузка данных',
162
+ errorState: {
163
+ imgAlt: 'Что-то пошло не так',
164
+ errorList: [errorMsg || ''],
165
+ imgSrc: errorImgSrc ?? imagesMap.defaultErrorImgSrc,
166
+ onRetry,
167
+ },
168
+ }), [state, errorMsg, errorImgSrc, onRetry, imagesMap]);
169
+ // Футер отвечает за корневой список
63
170
  const footerContext = useMemo(() => ({
171
+ isLoading: isRootLevel && isLoading,
172
+ isError: isRootLevel && isError,
173
+ isEndReached: isRootLevel && isEndReachedWithScroll,
174
+ endOfScrollMsg,
175
+ onRetry,
176
+ }), [
177
+ isRootLevel,
64
178
  isLoading,
65
179
  isError,
66
- isEndReached: isEndReachedWithScroll,
180
+ isEndReachedWithScroll,
67
181
  endOfScrollMsg,
68
182
  onRetry,
69
- }), [isLoading, isError, isEndReachedWithScroll, endOfScrollMsg, onRetry]);
183
+ ]);
184
+ const lastRowId = useMemo(() => {
185
+ if (checkHasFooterContent(footerContext)) {
186
+ return undefined;
187
+ }
188
+ return displayedList[displayedList.length - 1]?.id;
189
+ }, [footerContext, displayedList]);
190
+ const levelHeaderProps = useMemo(() => {
191
+ if (!isMobile || !currentNodeId) {
192
+ return undefined;
193
+ }
194
+ if (!levelTitle && !hasUpperLevel) {
195
+ return undefined;
196
+ }
197
+ return {
198
+ title: levelTitle,
199
+ hasBackButton: hasUpperLevel,
200
+ onBack: handleLeaveLevel,
201
+ };
202
+ }, [isMobile, currentNodeId, levelTitle, hasUpperLevel, handleLeaveLevel]);
70
203
  return {
71
- flatList,
72
- onToggle,
204
+ displayedList,
205
+ levelKey,
206
+ lastRowId,
207
+ levelHeaderProps,
208
+ onToggle: handleToggle,
73
209
  nodePaginationMap,
74
210
  registerChildren,
75
211
  notifyExpand,
76
212
  parentItems,
77
213
  acquireParentSlot,
78
214
  contentStateProps,
215
+ isNoData,
216
+ state,
79
217
  scrollParent,
218
+ listRef,
80
219
  virtuosoProps,
81
220
  footerContext,
82
221
  onTopButtonProps,
@@ -85,7 +224,6 @@ export const useLogic = ({ initialExpandedLevel, items, onRetry, errorMsg, isErr
85
224
  // Fallback подставляется один раз: ниже по дереву строка выбирает функцию по
86
225
  // типу узла, не проверяя, передал ли потребитель renderParent
87
226
  renderParent: renderParent ?? renderItem,
88
- items,
89
227
  onRetry,
90
228
  noDataImgSrc,
91
229
  enterAnimation,
@@ -0,0 +1,5 @@
1
+ import type { ListFooterContext } from '../../ListFooter';
2
+ /**
3
+ * Проверяет, покажет ли футер списка placeholder
4
+ */
5
+ export declare const checkHasFooterContent: ({ isLoading, isError, isEndReached, }: ListFooterContext) => boolean;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Проверяет, покажет ли футер списка placeholder
3
+ */
4
+ export const checkHasFooterContent = ({ isLoading, isError, isEndReached, }) => Boolean(isLoading || isError || isEndReached);
@@ -0,0 +1 @@
1
+ export * from './checkHasFooterContent';
@@ -0,0 +1 @@
1
+ export * from './checkHasFooterContent';
@@ -0,0 +1,6 @@
1
+ import type { InfiniteTreeListData } from '../../types';
2
+ /**
3
+ * Проверяет, есть ли у элемента вложенность: тем же признаком список решает,
4
+ * рисовать ли строке Chevron, а мобильный режим — уводит ли строка внутрь узла
5
+ */
6
+ export declare const checkHasNested: <TData extends InfiniteTreeListData<TData>>(item: TData) => boolean;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Проверяет, есть ли у элемента вложенность: тем же признаком список решает,
3
+ * рисовать ли строке Chevron, а мобильный режим — уводит ли строка внутрь узла
4
+ */
5
+ export const checkHasNested = (item) => Boolean(item.children) || item.hasChildren === true;
@@ -0,0 +1 @@
1
+ export * from './checkHasNested';
@@ -0,0 +1 @@
1
+ export * from './checkHasNested';
@@ -1,7 +1,8 @@
1
1
  export type TailRegistry = {
2
2
  /**
3
3
  * Регистрирует хвост ветки. Тот же `parentId` и `itemId` — обновляет callback.
4
- * Новый `itemId` сбрасывает `isLoadMoreRequested`
4
+ * Новый `itemId` сбрасывает `isLoadMoreRequested` и сразу проверяет хвост
5
+ * по последнему известному диапазону
5
6
  */
6
7
  register: (parentId: string, itemId: string, endReached: () => void) => void;
7
8
  /**
@@ -9,10 +10,14 @@ export type TailRegistry = {
9
10
  */
10
11
  unregister: (parentId: string, itemId?: string) => void;
11
12
  /**
12
- * Вызывает `endReached` для хвостов, чей индекс попадает в видимый диапазон.
13
- * `getIndex === -1` пропускает запись
13
+ * Запоминает видимый диапазон и вызывает `endReached` для хвостов, чей индекс
14
+ * в него попадает. `getIndex === -1` пропускает запись
14
15
  */
15
16
  checkRange: (endIndex: number, getIndex: (itemId: string) => number) => void;
17
+ /**
18
+ * Забывает запомненный диапазон: он относится к прежнему набору строк
19
+ */
20
+ forgetRange: () => void;
16
21
  };
17
22
  /**
18
23
  * Реестр хвостов вложенных веток. Живёт на экземпляре списка и переживает
@@ -4,6 +4,22 @@
4
4
  */
5
5
  export const createTailRegistry = () => {
6
6
  const entries = new Map();
7
+ // Диапазон приходит от виртуализации раньше, чем монтируется строка хвоста:
8
+ // без запоминания диапазона хвост, видимый с первого кадра уровня, не
9
+ // сработал бы вовсе
10
+ let lastEndIndex = null;
11
+ let lastGetIndex = null;
12
+ const checkEntry = (entry) => {
13
+ if (entry.isLoadMoreRequested || lastEndIndex === null || !lastGetIndex) {
14
+ return;
15
+ }
16
+ const index = lastGetIndex(entry.itemId);
17
+ if (index === -1 || lastEndIndex < index) {
18
+ return;
19
+ }
20
+ entry.isLoadMoreRequested = true;
21
+ entry.endReached();
22
+ };
7
23
  return {
8
24
  register(parentId, itemId, endReached) {
9
25
  const existing = entries.get(parentId);
@@ -11,7 +27,13 @@ export const createTailRegistry = () => {
11
27
  existing.endReached = endReached;
12
28
  return;
13
29
  }
14
- entries.set(parentId, { itemId, endReached, isLoadMoreRequested: false });
30
+ const entry = {
31
+ itemId,
32
+ endReached,
33
+ isLoadMoreRequested: false,
34
+ };
35
+ entries.set(parentId, entry);
36
+ checkEntry(entry);
15
37
  },
16
38
  unregister(parentId, itemId) {
17
39
  if (itemId === undefined) {
@@ -24,17 +46,13 @@ export const createTailRegistry = () => {
24
46
  }
25
47
  },
26
48
  checkRange(endIndex, getIndex) {
27
- entries.forEach((entry) => {
28
- if (entry.isLoadMoreRequested) {
29
- return;
30
- }
31
- const index = getIndex(entry.itemId);
32
- if (index === -1 || endIndex < index) {
33
- return;
34
- }
35
- entry.isLoadMoreRequested = true;
36
- entry.endReached();
37
- });
49
+ lastEndIndex = endIndex;
50
+ lastGetIndex = getIndex;
51
+ entries.forEach(checkEntry);
52
+ },
53
+ forgetRange() {
54
+ lastEndIndex = null;
55
+ lastGetIndex = null;
38
56
  },
39
57
  };
40
58
  };
@@ -1,3 +1,4 @@
1
+ import { checkHasNested } from '../checkHasNested';
1
2
  /**
2
3
  * Проверяет, подгружаются ли дочерние элементы узла отдельно.
3
4
  */
@@ -15,7 +16,7 @@ export const flattenTree = (items, expandedIds, parentPath = [], level = 0, pare
15
16
  const flattenedItem = {
16
17
  ...item,
17
18
  meta: {
18
- hasNested: Boolean(item.children) || item.hasChildren === true,
19
+ hasNested: checkHasNested(item),
19
20
  isChildrenAsync,
20
21
  level,
21
22
  path,
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Ключ уровня для снимков скролла и пересоздания списка
3
+ */
4
+ export declare const getLevelKey: (nodeId?: string) => string;
@@ -0,0 +1,5 @@
1
+ import { NODE_LEVEL_KEY_PREFIX, ROOT_LEVEL_KEY } from '../../constants';
2
+ /**
3
+ * Ключ уровня для снимков скролла и пересоздания списка
4
+ */
5
+ export const getLevelKey = (nodeId) => nodeId === undefined ? ROOT_LEVEL_KEY : `${NODE_LEVEL_KEY_PREFIX}${nodeId}`;
@@ -0,0 +1 @@
1
+ export * from './getLevelKey';
@@ -0,0 +1 @@
1
+ export * from './getLevelKey';
@@ -1,3 +1,5 @@
1
+ export * from './checkHasFooterContent';
2
+ export * from './checkHasNested';
1
3
  export * from './checkHasSkeletonPlaceholders';
2
4
  export * from './checkIsChildrenPlaceholder';
3
5
  export * from './checkIsChildrenPlaceholderOf';
@@ -12,6 +14,7 @@ export * from './flattenTree';
12
14
  export * from './getEnteringChildren';
13
15
  export * from './getIdsToKeep';
14
16
  export * from './getInitialExpandedIds';
17
+ export * from './getLevelKey';
15
18
  export * from './getNestedItems';
16
19
  export * from './insertChildren';
17
20
  export * from './removeChildren';
@@ -1,3 +1,5 @@
1
+ export * from './checkHasFooterContent';
2
+ export * from './checkHasNested';
1
3
  export * from './checkHasSkeletonPlaceholders';
2
4
  export * from './checkIsChildrenPlaceholder';
3
5
  export * from './checkIsChildrenPlaceholderOf';
@@ -12,6 +14,7 @@ export * from './flattenTree';
12
14
  export * from './getEnteringChildren';
13
15
  export * from './getIdsToKeep';
14
16
  export * from './getInitialExpandedIds';
17
+ export * from './getLevelKey';
15
18
  export * from './getNestedItems';
16
19
  export * from './insertChildren';
17
20
  export * from './removeChildren';
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- export declare const StepPopover: import("../../../../../styled").StyledComponent<Omit<import("../../../../../NewPopover").NewPopoverProps, "title" | "disableMobileDrawer" | "hasArrow"> & {
2
+ export declare const StepPopover: import("../../../../../styled").StyledComponent<Omit<import("../../../../../NewPopover").NewPopoverProps, "title" | "hasArrow" | "disableMobileDrawer"> & {
3
3
  variant?: import("../../../../../HintPopover").HintPopoverVariant | undefined;
4
4
  title?: import("react").ReactNode;
5
5
  action?: import("react").ReactNode;
@@ -18,7 +18,7 @@ import { EndAdornmentWrapper, Placeholder, StateWrapper, StyledSelect, } from '.
18
18
  import { useLogic } from './useLogic';
19
19
  const ClearButton = forwardRef(({ onClick, disabled }, ref) => (_jsx(IconButton, { disabled: disabled, ref: ref, onClick: onClick, variant: "text", title: CLEAR_TEXT, "aria-label": CLEAR_TEXT, children: _jsx(CrossOutlineMd, {}) })));
20
20
  const SelectInner = ({ required, getOptionLabel, placeholder, helperText, hideHelperText = false, loading, success, children, disabled, error, label, fullWidth, onChange: externalOnChange, isShowClearButton, isEnableAllSelection = false, valueOptions, value, onSelectAll, onUnselectAll, ...props }, ref) => {
21
- const { isOpened, isShowingClearButton, isNoData, onClearAll, openSelect, closeSelect, resetButtonRef, isShowingSelectAll, handleChangeOption, isSelectedAll, isIndeterminate, handleChangeArrayValue, selectAllClassName, findMenuItemsLabel, isShowingPlaceholder, } = useLogic({
21
+ const { isOpened, isShowingClearButton, isNoData, onClearAll, openSelect, closeSelect, resetButtonRef, isShowingSelectAll, handleChangeOption, isSelectedAll, isIndeterminate, handleChangeArrayValue, selectAllClassName, findMenuItemsLabel, isShowingPlaceholder, fieldRef, } = useLogic({
22
22
  ...props,
23
23
  children,
24
24
  value,
@@ -30,11 +30,12 @@ const SelectInner = ({ required, getOptionLabel, placeholder, helperText, hideHe
30
30
  onSelectAll,
31
31
  onUnselectAll,
32
32
  loading,
33
+ ref,
33
34
  });
34
35
  const renderValue = (selectedOptions) => {
35
36
  // Массив с выбранными опциями
36
37
  if (Array.isArray(selectedOptions) && selectedOptions.length) {
37
- return (_jsx(TagsList, { data: selectedOptions, getOptionLabel: getOptionLabel || ((optionLabel) => optionLabel), onChange: handleChangeArrayValue, onClick: openSelect }));
38
+ return (_jsx(TagsList, { data: selectedOptions, getOptionLabel: getOptionLabel || ((optionLabel) => optionLabel), fieldRef: fieldRef, onChange: handleChangeArrayValue, onClick: openSelect }));
38
39
  }
39
40
  // Пустой массив или пустая строка
40
41
  if ((Array.isArray(selectedOptions) || typeof selectedOptions === 'string') &&
@@ -47,6 +48,6 @@ const SelectInner = ({ required, getOptionLabel, placeholder, helperText, hideHe
47
48
  }
48
49
  return findMenuItemsLabel(children, selectedOptions);
49
50
  };
50
- return (_jsxs(FormControl, { error: error, fullWidth: fullWidth, children: [label && (_jsx(InputLabel, { htmlFor: "grouped-select", required: required, disabled: disabled, children: label })), _jsxs(StyledSelect, { ...props, value: value === null || value === undefined ? '' : value, open: isOpened, disabled: disabled, onOpen: openSelect, onClose: closeSelect, renderValue: renderValue, IconComponent: () => null, displayEmpty: true, ref: ref, fullWidth: fullWidth, onChange: handleChangeOption, "$isShowingPlaceholder": isShowingPlaceholder, endAdornment: _jsxs(EndAdornmentWrapper, { children: [loading && _jsx(Loader, { color: "primary", size: "small" }), !loading && isShowingClearButton && (_jsx(ClearButton, { disabled: disabled, ref: resetButtonRef, onClick: onClearAll })), !loading && (_jsx(IconButton, { variant: "text", disabled: disabled, onClick: openSelect, children: !isOpened ? _jsx(DownOutlineMd, {}) : _jsx(UpOutlineMd, {}) }))] }), children: [_jsx(Placeholder, { value: "", children: placeholder }), !loading && isShowingSelectAll && (_jsxs(MenuItem, { className: selectAllClassName, selected: isSelectedAll, value: SELECT_ALL_VALUE, children: [_jsx(ListItemIcon, { children: _jsx(Checkbox, { checked: isSelectedAll, indeterminate: isIndeterminate }) }), "\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0432\u0441\u0435"] })), !loading && children, !loading && isNoData && _jsx(StateWrapper, { children: "\u041D\u0435\u0442 \u0434\u0430\u043D\u043D\u044B\u0445" })] }), _jsx(FormHelperText, { error: error, success: success, hideHelperText: hideHelperText, children: helperText })] }));
51
+ return (_jsxs(FormControl, { error: error, fullWidth: fullWidth, children: [label && (_jsx(InputLabel, { htmlFor: "grouped-select", required: required, disabled: disabled, children: label })), _jsxs(StyledSelect, { ...props, value: value === null || value === undefined ? '' : value, open: isOpened, disabled: disabled, onOpen: openSelect, onClose: closeSelect, renderValue: renderValue, IconComponent: () => null, displayEmpty: true, ref: fieldRef, fullWidth: fullWidth, onChange: handleChangeOption, "$isShowingPlaceholder": isShowingPlaceholder, endAdornment: _jsxs(EndAdornmentWrapper, { children: [loading && _jsx(Loader, { color: "primary", size: "small" }), !loading && isShowingClearButton && (_jsx(ClearButton, { disabled: disabled, ref: resetButtonRef, onClick: onClearAll })), !loading && (_jsx(IconButton, { variant: "text", disabled: disabled, onClick: openSelect, children: !isOpened ? _jsx(DownOutlineMd, {}) : _jsx(UpOutlineMd, {}) }))] }), children: [_jsx(Placeholder, { value: "", children: placeholder }), !loading && isShowingSelectAll && (_jsxs(MenuItem, { className: selectAllClassName, selected: isSelectedAll, value: SELECT_ALL_VALUE, children: [_jsx(ListItemIcon, { children: _jsx(Checkbox, { checked: isSelectedAll, indeterminate: isIndeterminate }) }), "\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0432\u0441\u0435"] })), !loading && children, !loading && isNoData && _jsx(StateWrapper, { children: "\u041D\u0435\u0442 \u0434\u0430\u043D\u043D\u044B\u0445" })] }), _jsx(FormHelperText, { error: error, success: success, hideHelperText: hideHelperText, children: helperText })] }));
51
52
  };
52
53
  export const Select = forwardRefWithGeneric(SelectInner);
@@ -1,6 +1,13 @@
1
- import { type ReactNode, type SyntheticEvent } from 'react';
1
+ import { type ForwardedRef, type ReactNode, type SyntheticEvent } from 'react';
2
2
  import { type SelectProps } from '../types';
3
- export declare const useLogic: <TValue>({ value, onChange, children, open: externalIsOpened, defaultOpen, multiple, isEnableAllSelection, isShowClearButton, valueOptions, onSelectAll, onUnselectAll, name, placeholder, onClose, onOpen, loading, }: SelectProps<TValue>) => {
3
+ type UseLogicParams<TValue> = Omit<SelectProps<TValue>, 'ref'> & {
4
+ /**
5
+ * Ref, пробрасываемый на контейнер поля: по нему считается ширина
6
+ * всплывающего окна тэгов и он служит якорем его позиционирования
7
+ */
8
+ ref: ForwardedRef<HTMLDivElement>;
9
+ };
10
+ export declare const useLogic: <TValue>({ value, onChange, children, open: externalIsOpened, defaultOpen, multiple, isEnableAllSelection, isShowClearButton, valueOptions, onSelectAll, onUnselectAll, name, placeholder, onClose, onOpen, loading, ref, }: UseLogicParams<TValue>) => {
4
11
  isOpened: boolean;
5
12
  isNoData: boolean;
6
13
  isShowingClearButton: boolean;
@@ -17,4 +24,6 @@ export declare const useLogic: <TValue>({ value, onChange, children, open: exter
17
24
  selectAllClassName: string | undefined;
18
25
  findMenuItemsLabel: (nodes: ReactNode, selectedValue: TValue) => ReactNode;
19
26
  isShowingPlaceholder: boolean;
27
+ fieldRef: import("react").RefObject<HTMLDivElement | null>;
20
28
  };
29
+ export {};
@@ -1,12 +1,14 @@
1
1
  import { menuItemClasses } from '@mui/material/MenuItem';
2
2
  import { Children, isValidElement, useRef, useState, } from 'react';
3
3
  import { MenuItem } from '../../MenuItem';
4
+ import { useForwardedRef } from '../../useForwardedRef';
4
5
  import { getNodeText } from '../../utils/getNodeText';
5
6
  import { isSyncReactElement } from '../../utils/isSyncReactElement';
6
7
  import { SELECT_ALL_VALUE } from '../constants';
7
8
  import { isShowingPlaceholder } from './utils/isShowingPlaceholder';
8
- export const useLogic = ({ value, onChange, children, open: externalIsOpened, defaultOpen, multiple, isEnableAllSelection, isShowClearButton = true, valueOptions, onSelectAll, onUnselectAll, name, placeholder, onClose, onOpen, loading, }) => {
9
+ export const useLogic = ({ value, onChange, children, open: externalIsOpened, defaultOpen, multiple, isEnableAllSelection, isShowClearButton = true, valueOptions, onSelectAll, onUnselectAll, name, placeholder, onClose, onOpen, loading, ref, }) => {
9
10
  const [isOpened, setOpened] = useState(!loading && (defaultOpen || externalIsOpened || false));
11
+ const fieldRef = useForwardedRef(ref);
10
12
  const resetButtonRef = useRef(null);
11
13
  const optionsLength = Array.isArray(valueOptions)
12
14
  ? valueOptions?.length
@@ -129,5 +131,6 @@ export const useLogic = ({ value, onChange, children, open: externalIsOpened, de
129
131
  selectAllClassName,
130
132
  findMenuItemsLabel,
131
133
  isShowingPlaceholder: isShowingPlaceholder(value, placeholder),
134
+ fieldRef,
132
135
  };
133
136
  };
@@ -0,0 +1,7 @@
1
+ import type { TagValue } from '../types';
2
+ import { type PopoverTagsProps } from './types';
3
+ /**
4
+ * Показывает все выбранные элементы тэгами с переносом по строкам.
5
+ * Используется как содержимое всплывающего окна TagsList
6
+ */
7
+ export declare const PopoverTags: <TData extends TagValue>({ data, keyId, isDisabled, getOptionLabel, getTagProps, }: PopoverTagsProps<TData>) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { getKey } from '../utils';
3
+ import { StyledTag, Wrapper } from './styles';
4
+ /**
5
+ * Показывает все выбранные элементы тэгами с переносом по строкам.
6
+ * Используется как содержимое всплывающего окна TagsList
7
+ */
8
+ export const PopoverTags = ({ data, keyId, isDisabled, getOptionLabel, getTagProps, }) => (_jsx(Wrapper, { children: data.map((option) => (_jsx(StyledTag, { isDisabled: isDisabled, ...getTagProps(option) }, getKey(option, keyId, getOptionLabel)))) }));
@@ -0,0 +1,2 @@
1
+ export * from './PopoverTags';
2
+ export * from './types';
@@ -0,0 +1,2 @@
1
+ export * from './PopoverTags';
2
+ export * from './types';
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ export declare const Wrapper: 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>, {}>;
6
+ export declare const StyledTag: import("../../styled").StyledComponent<import("../Tag").TagProps & import("react").RefAttributes<HTMLDivElement> & {
7
+ theme?: import("@emotion/react").Theme | undefined;
8
+ }, {}, {}>;
@@ -0,0 +1,15 @@
1
+ import { styled } from '../../styled';
2
+ import { POPOVER_MAX_HEIGHT, POPOVER_TAGS_GAP_SPACING, POPOVER_TAGS_PADDING_SPACING, } from '../constants';
3
+ import { Tag } from '../Tag';
4
+ export const Wrapper = styled.div `
5
+ overflow-y: auto;
6
+ display: flex;
7
+ flex-wrap: wrap;
8
+ gap: ${({ theme }) => theme.spacing(POPOVER_TAGS_GAP_SPACING)};
9
+
10
+ max-height: ${POPOVER_MAX_HEIGHT}px;
11
+ padding-inline: ${({ theme }) => theme.spacing(POPOVER_TAGS_PADDING_SPACING)};
12
+ `;
13
+ export const StyledTag = styled(Tag) `
14
+ max-width: 100%;
15
+ `;
@@ -0,0 +1,24 @@
1
+ import { type TagProps } from '../Tag';
2
+ import { type TagValue } from '../types';
3
+ export type PopoverTagsProps<TData extends TagValue = TagValue> = {
4
+ /**
5
+ * Полный список выбранных элементов
6
+ */
7
+ data: TData[];
8
+ /**
9
+ * Поле, используемое в качестве ключа списка
10
+ */
11
+ keyId?: TData extends object ? keyof TData : never;
12
+ /**
13
+ * Если `true`, то тэги будут недоступны для взаимодействия
14
+ */
15
+ isDisabled?: boolean;
16
+ /**
17
+ * Используется для определения строкового значения опции
18
+ */
19
+ getOptionLabel: (value: TData) => string | number;
20
+ /**
21
+ * Возвращает пропсы тэга, включая обработчик удаления
22
+ */
23
+ getTagProps: (option: TData) => Pick<TagProps, 'label' | 'onDelete'>;
24
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -21,9 +21,17 @@ export type TagProps = {
21
21
  * Хендлер клика по тегу
22
22
  */
23
23
  onClick?: (value: MouseEvent<HTMLDivElement>) => void;
24
+ /**
25
+ * Хендлер наведения указателя на тег
26
+ */
27
+ onMouseEnter?: (value: MouseEvent<HTMLDivElement>) => void;
28
+ /**
29
+ * Хендлер увода указателя с тега
30
+ */
31
+ onMouseLeave?: (value: MouseEvent<HTMLDivElement>) => void;
24
32
  /**
25
33
  * Название класса, применяется к корневому компоненту
26
34
  */
27
35
  className?: string;
28
36
  };
29
- export declare const Tag: (props: TagProps) => import("react/jsx-runtime").JSX.Element;
37
+ export declare const Tag: import("react").ForwardRefExoticComponent<TagProps & import("react").RefAttributes<HTMLDivElement>>;