@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,9 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from 'react';
2
3
  import { OverflowTypography } from '../../OverflowTypography';
3
4
  import { StyledTag } from './styles';
4
5
  import { useLogic } from './useLogic';
5
- export const Tag = (props) => {
6
+ export const Tag = forwardRef((props, ref) => {
6
7
  const { onMouseDown } = useLogic();
7
8
  const { shrinks, isDisabled, label, ...restProps } = props;
8
- return (_jsx(StyledTag, { "$shrinks": shrinks, color: "grey", variant: "light", disabled: isDisabled, label: _jsx(OverflowTypography, { children: label }), ...restProps, onMouseDown: onMouseDown }));
9
- };
9
+ return (_jsx(StyledTag, { ref: ref, "$shrinks": shrinks, color: "grey", variant: "light", disabled: isDisabled, label: _jsx(OverflowTypography, { children: label }), ...restProps, onMouseDown: onMouseDown }));
10
+ });
@@ -1,5 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { CounterTag, Wrapper } from './styles';
2
+ import { CrossOutlineMd } from '../../icons/CrossOutlineMd';
3
+ import { IconButton } from '../IconButton';
4
+ import { NewPopover } from '../NewPopover';
5
+ import { Typography } from '../Typography';
6
+ import { POPOVER_CLOSE_TEXT, POPOVER_TITLE_TEXT } from './constants';
7
+ import { PopoverTags } from './PopoverTags';
8
+ import { CounterTag, PopoverContentWrapper, PopoverHeader, Wrapper, } from './styles';
3
9
  import { Tag } from './Tag';
4
10
  import { useLogic } from './useLogic';
5
11
  import { getKey } from './utils';
@@ -8,10 +14,10 @@ import { getKey } from './utils';
8
14
  * Не предназначен для использования в продуктах, не экспортируется из пакета
9
15
  */
10
16
  export const TagsList = (props) => {
11
- const { hiddenCount, tagsContainerRef, visibleOptions, getTagProps, showCounter, } = useLogic(props);
12
- const { className, keyId, isDisabled, onClick, getOptionLabel } = props;
17
+ const { hiddenCount, tagsContainerRef, counterRef, visibleOptions, getTagProps, showCounter, isPopoverOpen, isPopoverEnabled, setPopoverContentRef, popoverContentCssVars, stopPopoverEventPropagation, popoverAnchorEl, closePopover, startPopoverDelay, cancelPopoverDelay, handleTagClick, handleCounterClick, } = useLogic(props);
18
+ const { className, data = [], keyId, isDisabled, getOptionLabel } = props;
13
19
  return (_jsxs(Wrapper, { className: className, ref: tagsContainerRef, children: [visibleOptions?.map((option) => {
14
20
  const tagProps = getTagProps(option);
15
- return (_jsx(Tag, { isDisabled: isDisabled, onClick: onClick, ...tagProps }, getKey(option, keyId, getOptionLabel)));
16
- }), showCounter && (_jsx(CounterTag, { isDisabled: isDisabled, label: `+${hiddenCount}`, onClick: onClick }, "more"))] }));
21
+ return (_jsx(Tag, { isDisabled: isDisabled, onClick: handleTagClick, ...tagProps }, getKey(option, keyId, getOptionLabel)));
22
+ }), showCounter && (_jsx(CounterTag, { ref: counterRef, isDisabled: isDisabled, label: `+${hiddenCount}`, onClick: handleCounterClick, onMouseEnter: isPopoverEnabled ? startPopoverDelay : undefined, onMouseLeave: isPopoverEnabled ? cancelPopoverDelay : undefined }, "more")), _jsx(NewPopover, { isOpen: isPopoverOpen, anchorEl: popoverAnchorEl, disableAutoFocus: true, onClose: closePopover, children: _jsxs(PopoverContentWrapper, { ref: setPopoverContentRef, style: popoverContentCssVars, onClick: stopPopoverEventPropagation, onMouseDown: stopPopoverEventPropagation, children: [_jsxs(PopoverHeader, { children: [_jsx(Typography, { variant: "h5", children: POPOVER_TITLE_TEXT }), _jsx(IconButton, { variant: "text", title: POPOVER_CLOSE_TEXT, "aria-label": POPOVER_CLOSE_TEXT, onClick: closePopover, children: _jsx(CrossOutlineMd, {}) })] }), _jsx(PopoverTags, { data: data, keyId: keyId, isDisabled: isDisabled, getOptionLabel: getOptionLabel, getTagProps: getTagProps })] }) })] }));
17
23
  };
@@ -1,2 +1,37 @@
1
1
  export declare const MIN_AVAILABLE_WIDTH = 50;
2
2
  export declare const GAP_BETWEEN_TAGS = 4;
3
+ /**
4
+ * Задержка появления всплывающего окна при наведении на счётчик (мс)
5
+ */
6
+ export declare const POPOVER_HOVER_DELAY = 500;
7
+ /**
8
+ * Максимальная ширина всплывающего окна (px)
9
+ */
10
+ export declare const POPOVER_MAX_WIDTH = 480;
11
+ /**
12
+ * Максимальная высота всплывающего окна (px)
13
+ */
14
+ export declare const POPOVER_MAX_HEIGHT = 370;
15
+ /**
16
+ * Количество тэгов, которые всплывающее окно вмещает в строку в любом случае:
17
+ * задаёт его минимальную ширину
18
+ */
19
+ export declare const POPOVER_MIN_TAGS_IN_ROW = 2;
20
+ /**
21
+ * Отступ между тэгами во всплывающем окне в единицах theme.spacing.
22
+ * Используется и в стилях, и в расчёте минимальной ширины окна
23
+ */
24
+ export declare const POPOVER_TAGS_GAP_SPACING = 2;
25
+ /**
26
+ * Горизонтальный отступ контейнера тэгов во всплывающем окне в единицах
27
+ * theme.spacing. Используется и в стилях, и в расчёте минимальной ширины окна
28
+ */
29
+ export declare const POPOVER_TAGS_PADDING_SPACING = 4;
30
+ /**
31
+ * Заголовок всплывающего окна со списком выбранных элементов
32
+ */
33
+ export declare const POPOVER_TITLE_TEXT = "\u0412\u044B\u0431\u0440\u0430\u043D\u043D\u044B\u0435 \u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B";
34
+ /**
35
+ * Доступное имя кнопки, закрывающей всплывающее окно
36
+ */
37
+ export declare const POPOVER_CLOSE_TEXT = "\u0417\u0430\u043A\u0440\u044B\u0442\u044C";
@@ -1,2 +1,37 @@
1
1
  export const MIN_AVAILABLE_WIDTH = 50;
2
2
  export const GAP_BETWEEN_TAGS = 4; // 4px
3
+ /**
4
+ * Задержка появления всплывающего окна при наведении на счётчик (мс)
5
+ */
6
+ export const POPOVER_HOVER_DELAY = 500;
7
+ /**
8
+ * Максимальная ширина всплывающего окна (px)
9
+ */
10
+ export const POPOVER_MAX_WIDTH = 480;
11
+ /**
12
+ * Максимальная высота всплывающего окна (px)
13
+ */
14
+ export const POPOVER_MAX_HEIGHT = 370;
15
+ /**
16
+ * Количество тэгов, которые всплывающее окно вмещает в строку в любом случае:
17
+ * задаёт его минимальную ширину
18
+ */
19
+ export const POPOVER_MIN_TAGS_IN_ROW = 2;
20
+ /**
21
+ * Отступ между тэгами во всплывающем окне в единицах theme.spacing.
22
+ * Используется и в стилях, и в расчёте минимальной ширины окна
23
+ */
24
+ export const POPOVER_TAGS_GAP_SPACING = 2;
25
+ /**
26
+ * Горизонтальный отступ контейнера тэгов во всплывающем окне в единицах
27
+ * theme.spacing. Используется и в стилях, и в расчёте минимальной ширины окна
28
+ */
29
+ export const POPOVER_TAGS_PADDING_SPACING = 4;
30
+ /**
31
+ * Заголовок всплывающего окна со списком выбранных элементов
32
+ */
33
+ export const POPOVER_TITLE_TEXT = 'Выбранные элементы';
34
+ /**
35
+ * Доступное имя кнопки, закрывающей всплывающее окно
36
+ */
37
+ export const POPOVER_CLOSE_TEXT = 'Закрыть';
@@ -3,6 +3,14 @@ export declare const Wrapper: import("../styled").StyledComponent<{
3
3
  theme?: import("@emotion/react").Theme | undefined;
4
4
  as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
5
5
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
6
- export declare const CounterTag: import("../styled").StyledComponent<import("./Tag").TagProps & {
6
+ export declare const CounterTag: import("../styled").StyledComponent<import("./Tag").TagProps & import("react").RefAttributes<HTMLDivElement> & {
7
7
  theme?: import("@emotion/react").Theme | undefined;
8
8
  }, {}, {}>;
9
+ export declare const PopoverContentWrapper: import("../styled").StyledComponent<{
10
+ theme?: import("@emotion/react").Theme | undefined;
11
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
12
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
13
+ export declare const PopoverHeader: import("../styled").StyledComponent<{
14
+ theme?: import("@emotion/react").Theme | undefined;
15
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
16
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -1,6 +1,6 @@
1
1
  import { styled } from '../styled';
2
2
  import { tagClassnames } from '../Tag';
3
- import { GAP_BETWEEN_TAGS } from './constants';
3
+ import { GAP_BETWEEN_TAGS, POPOVER_MAX_WIDTH } from './constants';
4
4
  import { Tag } from './Tag';
5
5
  export const Wrapper = styled.div `
6
6
  overflow: hidden;
@@ -8,9 +8,28 @@ export const Wrapper = styled.div `
8
8
  column-gap: ${GAP_BETWEEN_TAGS}px;
9
9
  `;
10
10
  export const CounterTag = styled(Tag) `
11
+ cursor: pointer;
12
+
11
13
  overflow: unset;
12
14
 
13
15
  .${tagClassnames.label} {
14
16
  min-width: unset;
15
17
  }
16
18
  `;
19
+ export const PopoverContentWrapper = styled.div `
20
+ --tags-list-popover-width: ${POPOVER_MAX_WIDTH}px;
21
+ display: flex;
22
+ flex-direction: column;
23
+ gap: ${({ theme }) => theme.spacing(2)};
24
+
25
+ width: var(--tags-list-popover-width);
26
+ max-width: ${POPOVER_MAX_WIDTH}px;
27
+ padding-block: ${({ theme }) => theme.spacing(4)};
28
+ `;
29
+ export const PopoverHeader = styled.div `
30
+ display: flex;
31
+ align-items: center;
32
+ justify-content: space-between;
33
+
34
+ padding-inline: ${({ theme }) => theme.spacing(4)};
35
+ `;
@@ -31,6 +31,10 @@ export type TagsListProps<TData extends TagValue = TagValue> = {
31
31
  * Ref на внешний контейнер, чья ширина используется как база для расчёта доступного пространства..
32
32
  */
33
33
  inputContainerRef?: RefObject<HTMLElement | null>;
34
+ /**
35
+ * Ref на поле инпута
36
+ */
37
+ fieldRef: RefObject<HTMLElement | null>;
34
38
  /**
35
39
  * Зарезервированная ширина, которая будет вычтена из доступной ширины при расчете количества отображаемых тегов
36
40
  */
@@ -0,0 +1 @@
1
+ export * from './useHoverDelay';
@@ -0,0 +1 @@
1
+ export * from './useHoverDelay';
@@ -0,0 +1 @@
1
+ export * from './useHoverDelay';
@@ -0,0 +1 @@
1
+ export * from './useHoverDelay';
@@ -0,0 +1,20 @@
1
+ export type UseHoverDelayResult = {
2
+ /**
3
+ * Запускает отсчёт задержки. Повторный вызов перезапускает отсчёт
4
+ */
5
+ start: () => void;
6
+ /**
7
+ * Отменяет отсчёт, если он не завершился
8
+ */
9
+ cancel: () => void;
10
+ };
11
+ export type UseHoverDelayParams = {
12
+ /**
13
+ * Функция, вызывающаяся при hover-эффекте после задержки
14
+ */
15
+ onHover: () => void;
16
+ /**
17
+ * Задержка вызова функции в мс
18
+ */
19
+ delay: number;
20
+ };
@@ -0,0 +1,5 @@
1
+ import { type UseHoverDelayParams, type UseHoverDelayResult } from './types';
2
+ /**
3
+ * Откладывает вызов на время удержания указателя над элементом.
4
+ */
5
+ export declare const useHoverDelay: ({ delay, onHover, }: UseHoverDelayParams) => UseHoverDelayResult;
@@ -0,0 +1,27 @@
1
+ import { useEffect, useRef } from 'react';
2
+ /**
3
+ * Откладывает вызов на время удержания указателя над элементом.
4
+ */
5
+ export const useHoverDelay = ({ delay, onHover, }) => {
6
+ const timeoutRef = useRef(undefined);
7
+ const savedOnHoverRef = useRef(onHover);
8
+ useEffect(() => {
9
+ savedOnHoverRef.current = onHover;
10
+ });
11
+ const cancel = () => {
12
+ if (timeoutRef.current === undefined) {
13
+ return;
14
+ }
15
+ clearTimeout(timeoutRef.current);
16
+ timeoutRef.current = undefined;
17
+ };
18
+ const start = () => {
19
+ cancel();
20
+ timeoutRef.current = setTimeout(() => {
21
+ timeoutRef.current = undefined;
22
+ savedOnHoverRef.current();
23
+ }, delay);
24
+ };
25
+ useEffect(() => cancel, []);
26
+ return { start, cancel };
27
+ };
@@ -1,15 +1,27 @@
1
- /// <reference types="react" />
1
+ import { type CSSProperties, type MouseEvent, type SyntheticEvent } from 'react';
2
2
  import type { TagsListProps, TagValue } from '../types';
3
3
  type UseLogicParams<TData extends TagValue> = TagsListProps<TData>;
4
- export declare const useLogic: <TData extends TagValue>({ data, keyId, getOptionLabel, onChange, inputContainerRef, reservedWidth, }: UseLogicParams<TData>) => {
4
+ export declare const useLogic: <TData extends TagValue>({ data, keyId, isDisabled, getOptionLabel, onChange, onClick, inputContainerRef, fieldRef, reservedWidth, }: UseLogicParams<TData>) => {
5
5
  visibleOptions: TData[];
6
6
  hiddenCount: number;
7
7
  showCounter: boolean;
8
8
  tagsContainerRef: import("react").RefObject<HTMLDivElement | null>;
9
+ counterRef: import("react").RefObject<HTMLDivElement | null>;
9
10
  getTagProps: (option: TData) => {
10
11
  label: string | number;
11
12
  shrinks: boolean;
12
13
  onDelete: () => void;
13
14
  };
15
+ isPopoverOpen: boolean;
16
+ isPopoverEnabled: boolean;
17
+ setPopoverContentRef: (node: HTMLDivElement | null) => void;
18
+ popoverContentCssVars: CSSProperties;
19
+ stopPopoverEventPropagation: (event: SyntheticEvent) => void;
20
+ popoverAnchorEl: HTMLElement | null;
21
+ closePopover: () => void;
22
+ startPopoverDelay: () => void;
23
+ cancelPopoverDelay: () => void;
24
+ handleTagClick: (event: MouseEvent<HTMLDivElement>) => void;
25
+ handleCounterClick: (event: MouseEvent<HTMLDivElement>) => void;
14
26
  };
15
27
  export {};
@@ -1,13 +1,38 @@
1
- import { useEffect, useLayoutEffect, useRef, useState } from 'react';
1
+ import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, } from 'react';
2
2
  import { useTheme } from '../../theme/hooks/useTheme';
3
- import { MIN_AVAILABLE_WIDTH } from '../constants';
4
- import { calculateVisibleTagsCount, getAvailableWidth } from '../utils';
5
- export const useLogic = ({ data = [], keyId, getOptionLabel, onChange, inputContainerRef, reservedWidth = 0, }) => {
3
+ import { useClickAwayEffect } from '../../useClickAwayEffect';
4
+ import { useNewToggle } from '../../useNewToggle';
5
+ import { useViewportType } from '../../useViewportType';
6
+ import { MIN_AVAILABLE_WIDTH, POPOVER_HOVER_DELAY } from '../constants';
7
+ import { calculatePopoverWidth, calculateVisibleTagsCount, getAvailableWidth, } from '../utils';
8
+ import { useHoverDelay } from './hooks/useHoverDelay';
9
+ export const useLogic = ({ data = [], keyId, isDisabled, getOptionLabel, onChange, onClick, inputContainerRef, fieldRef, reservedWidth = 0, }) => {
6
10
  const [visibleOptions, setVisibleOptions] = useState([]);
7
11
  const [hiddenCount, setHiddenCount] = useState(0);
12
+ const [isPopoverOpen, togglePopover] = useNewToggle(false);
13
+ const [isPopoverContentMounted, togglePopoverContentMounted] = useNewToggle(false);
14
+ /**
15
+ * Ширина окна и якорь позиционирования фиксируются на момент открытия
16
+ * и дальше не пересчитываются
17
+ */
18
+ const [popoverWidth, setPopoverWidth] = useState(0);
19
+ const [popoverAnchorEl, setPopoverAnchorEl] = useState(null);
8
20
  const tagsContainerRef = useRef(null);
9
21
  const availableWidthRef = useRef(0);
22
+ const popoverContentRef = useRef(null);
23
+ const counterRef = useRef(null);
10
24
  const theme = useTheme();
25
+ const { isMobile } = useViewportType();
26
+ const openPopover = () => {
27
+ const field = fieldRef.current;
28
+ if (isPopoverOpen || !field) {
29
+ return;
30
+ }
31
+ setPopoverWidth(calculatePopoverWidth(field.getBoundingClientRect().width, data.map((item) => getOptionLabel(item).toString()), theme));
32
+ setPopoverAnchorEl(field);
33
+ togglePopover(true);
34
+ };
35
+ const closePopover = () => togglePopover(false);
11
36
  /**
12
37
  * Обновляет доступную ширину для расчета количества отображаемых тегов
13
38
  */
@@ -64,6 +89,7 @@ export const useLogic = ({ data = [], keyId, getOptionLabel, onChange, inputCont
64
89
  if (!data.length) {
65
90
  setVisibleOptions([]);
66
91
  setHiddenCount(0);
92
+ closePopover();
67
93
  return;
68
94
  }
69
95
  const resizeObserver = new ResizeObserver(() => {
@@ -102,11 +128,65 @@ export const useLogic = ({ data = [], keyId, getOptionLabel, onChange, inputCont
102
128
  return { label, shrinks: false, onDelete };
103
129
  };
104
130
  const showCounter = hiddenCount > 0;
131
+ const { start: startPopoverDelay, cancel: cancelPopoverDelay } = useHoverDelay({ onHover: openPopover, delay: POPOVER_HOVER_DELAY });
132
+ const setPopoverContentRef = useCallback((node) => {
133
+ popoverContentRef.current = node;
134
+ togglePopoverContentMounted(Boolean(node));
135
+ }, []);
136
+ const popoverExcludedNodes = useMemo(() => [counterRef], []);
137
+ useClickAwayEffect({
138
+ ref: popoverContentRef,
139
+ onClickAway: closePopover,
140
+ isActive: isPopoverOpen && isPopoverContentMounted,
141
+ excludeNodes: popoverExcludedNodes,
142
+ });
143
+ const isPopoverEnabled = !isMobile && !isDisabled;
144
+ const handleTagClick = (event) => {
145
+ event.stopPropagation();
146
+ onClick?.(event);
147
+ };
148
+ const handleCounterClick = (event) => {
149
+ event.stopPropagation();
150
+ cancelPopoverDelay();
151
+ // На мобильной ширине и в заблокированном поле у счётчика прежнее поведение — список опций
152
+ if (!isPopoverEnabled) {
153
+ onClick?.(event);
154
+ return;
155
+ }
156
+ if (isPopoverOpen) {
157
+ closePopover();
158
+ return;
159
+ }
160
+ openPopover();
161
+ };
162
+ /**
163
+ * Окно живёт в портале, но синтетические события React всплывают по дереву
164
+ * компонентов и доходят до обработчиков поля: у MUI Select это `handleMouseDown`,
165
+ * который переводит фокус на поле и открывает список, у TreeLike* — `onClick` поля
166
+ */
167
+ const stopPopoverEventPropagation = (event) => {
168
+ event.stopPropagation();
169
+ };
170
+ const popoverContentCssVars = {
171
+ '--tags-list-popover-width': `${popoverWidth}px`,
172
+ };
105
173
  return {
106
174
  visibleOptions,
107
175
  hiddenCount,
108
176
  showCounter,
109
177
  tagsContainerRef,
178
+ counterRef,
110
179
  getTagProps,
180
+ isPopoverOpen,
181
+ isPopoverEnabled,
182
+ setPopoverContentRef,
183
+ popoverContentCssVars,
184
+ stopPopoverEventPropagation,
185
+ popoverAnchorEl,
186
+ closePopover,
187
+ startPopoverDelay,
188
+ cancelPopoverDelay,
189
+ handleTagClick,
190
+ handleCounterClick,
111
191
  };
112
192
  };
@@ -0,0 +1,5 @@
1
+ import type { Theme } from '../../../theme/types';
2
+ /**
3
+ * Вычисляет ширину всплывающего окна
4
+ */
5
+ export declare const calculatePopoverWidth: (fieldWidth: number, tagLabels: string[], theme: Theme) => number;
@@ -0,0 +1,22 @@
1
+ import { POPOVER_MAX_WIDTH, POPOVER_MIN_TAGS_IN_ROW, POPOVER_TAGS_GAP_SPACING, POPOVER_TAGS_PADDING_SPACING, } from '../../constants';
2
+ import { getTagWidth } from '../getTagWidth';
3
+ const getSpacingValue = (theme, spacing) => parseInt(theme.spacing(spacing), 10);
4
+ /**
5
+ * Минимальная ширина popover: вмещает в строку POPOVER_MIN_TAGS_IN_ROW самых
6
+ * широких тэгов вместе с отступом между ними и отступами контейнера
7
+ */
8
+ const getMinWidth = (tagLabels, theme) => {
9
+ const widestTagWidths = tagLabels
10
+ .map((label) => getTagWidth(label, theme))
11
+ .sort((current, next) => next - current)
12
+ .slice(0, POPOVER_MIN_TAGS_IN_ROW);
13
+ const tagsWidth = widestTagWidths.reduce((width, tagWidth) => width + tagWidth, 0);
14
+ const gapsWidth = Math.max(widestTagWidths.length - 1, 0) *
15
+ getSpacingValue(theme, POPOVER_TAGS_GAP_SPACING);
16
+ const paddingsWidth = getSpacingValue(theme, POPOVER_TAGS_PADDING_SPACING) * 2;
17
+ return tagsWidth + gapsWidth + paddingsWidth;
18
+ };
19
+ /**
20
+ * Вычисляет ширину всплывающего окна
21
+ */
22
+ export const calculatePopoverWidth = (fieldWidth, tagLabels, theme) => Math.min(Math.max(fieldWidth, getMinWidth(tagLabels, theme)), POPOVER_MAX_WIDTH);
@@ -0,0 +1 @@
1
+ export * from './calculatePopoverWidth';
@@ -0,0 +1 @@
1
+ export * from './calculatePopoverWidth';
@@ -3,3 +3,4 @@ export { getKey } from './getKey';
3
3
  export { getTagWidth } from './getTagWidth';
4
4
  export { getAvailableWidth } from './getAvailableWidth';
5
5
  export { calculateVisibleTagsCount } from './calculateVisibleTagsCount';
6
+ export { calculatePopoverWidth } from './calculatePopoverWidth';
@@ -3,3 +3,4 @@ export { getKey } from './getKey';
3
3
  export { getTagWidth } from './getTagWidth';
4
4
  export { getAvailableWidth } from './getAvailableWidth';
5
5
  export { calculateVisibleTagsCount } from './calculateVisibleTagsCount';
6
+ export { calculatePopoverWidth } from './calculatePopoverWidth';
@@ -9,13 +9,14 @@ import { IconWrapper, StyledTagsList, StyledTextField } from './styles';
9
9
  import { useLogic } from './useLogic';
10
10
  const ClearButton = ({ disabled, onClick }) => (_jsx(IconButton, { variant: "text", color: "grey", disabled: disabled, onClick: onClick, title: CLEAR_TEXT, "aria-label": CLEAR_TEXT, children: _jsx(CrossOutlineMd, {}) }));
11
11
  export const Input = forwardRef(({ disabled, onChange: propsOnChange, value, inputRef, hideHelperText = false, onClick, isLoading, ...restProps }, forwardedRef) => {
12
- const { isVisibleClearButton, isVisibleTagsList, onChange, textFieldProps, onClearAll, } = useLogic({
12
+ const { isVisibleClearButton, isVisibleTagsList, onChange, textFieldProps, onClearAll, fieldRef, } = useLogic({
13
13
  inputRef,
14
+ InputProps: restProps.InputProps,
14
15
  value,
15
16
  onChange: propsOnChange,
16
17
  disabled,
17
18
  onClick,
18
19
  isLoading,
19
20
  });
20
- return (_jsx(StyledTextField, { ...restProps, hideHelperText: hideHelperText, ref: forwardedRef, disabled: disabled, inputProps: { readOnly: true }, ...textFieldProps, startAdornment: isVisibleTagsList && (_jsx(StyledTagsList, { data: value, keyId: "id", isDisabled: disabled, getOptionLabel: (option) => option.label, onClick: onClick, onChange: onChange })), endAdornment: _jsxs(IconWrapper, { children: [isVisibleClearButton && (_jsx(ClearButton, { disabled: disabled, onClick: onClearAll })), isLoading ? (_jsx(Loader, { size: "small" })) : (_jsx(IconButton, { variant: "text", color: "grey", disabled: disabled, children: _jsx(DownOutlineMd, {}) }))] }) }));
21
+ return (_jsx(StyledTextField, { ...restProps, hideHelperText: hideHelperText, ref: forwardedRef, disabled: disabled, inputProps: { readOnly: true }, ...textFieldProps, InputProps: { ...restProps.InputProps, ref: fieldRef }, startAdornment: isVisibleTagsList && (_jsx(StyledTagsList, { data: value, keyId: "id", isDisabled: disabled, fieldRef: fieldRef, getOptionLabel: (option) => option.label, onClick: onClick, onChange: onChange })), endAdornment: _jsxs(IconWrapper, { children: [isVisibleClearButton && (_jsx(ClearButton, { disabled: disabled, onClick: onClearAll })), isLoading ? (_jsx(Loader, { size: "small" })) : (_jsx(IconButton, { variant: "text", color: "grey", disabled: disabled, children: _jsx(DownOutlineMd, {}) }))] }) }));
21
22
  });
@@ -1,13 +1,14 @@
1
1
  import { type MouseEvent, type SyntheticEvent } from 'react';
2
2
  import { type TreeLikeAsyncAutocompleteValue } from '../../types';
3
3
  import type { InputProps } from '../types';
4
- type UseLogicParams = Pick<InputProps, 'value' | 'disabled' | 'inputRef' | 'onChange' | 'isLoading' | 'onClick'>;
5
- export declare const useLogic: ({ value, disabled, isLoading, inputRef: externalInputRef, onChange: propsOnChange, onClick: propsOnClick, }: UseLogicParams) => {
4
+ type UseLogicParams = Pick<InputProps, 'value' | 'disabled' | 'inputRef' | 'InputProps' | 'onChange' | 'isLoading' | 'onClick'>;
5
+ export declare const useLogic: ({ value, disabled, isLoading, inputRef: externalInputRef, InputProps: externalInputProps, onChange: propsOnChange, onClick: propsOnClick, }: UseLogicParams) => {
6
6
  isVisibleClearButton: boolean;
7
7
  onClearAll: (event: SyntheticEvent<HTMLButtonElement>) => void;
8
8
  onChange: (newValue: TreeLikeAsyncAutocompleteValue | undefined) => void;
9
9
  onClick: (event: MouseEvent<HTMLDivElement>) => void;
10
10
  isVisibleTagsList: boolean;
11
+ fieldRef: import("react").RefObject<HTMLElement | null>;
11
12
  textFieldProps: {
12
13
  value: string;
13
14
  $isHidden: boolean;
@@ -1,7 +1,8 @@
1
1
  import { useEffect, useRef, } from 'react';
2
2
  import { useForwardedRef } from '../../../useForwardedRef';
3
- export const useLogic = ({ value, disabled, isLoading, inputRef: externalInputRef, onChange: propsOnChange, onClick: propsOnClick, }) => {
3
+ export const useLogic = ({ value, disabled, isLoading, inputRef: externalInputRef, InputProps: externalInputProps, onChange: propsOnChange, onClick: propsOnClick, }) => {
4
4
  const inputRef = useForwardedRef(externalInputRef);
5
+ const fieldRef = useForwardedRef(externalInputProps?.ref);
5
6
  const prevValue = useRef(undefined);
6
7
  useEffect(() => {
7
8
  if (value && !prevValue.current) {
@@ -40,6 +41,7 @@ export const useLogic = ({ value, disabled, isLoading, inputRef: externalInputRe
40
41
  onChange,
41
42
  onClick,
42
43
  isVisibleTagsList: hasValue,
44
+ fieldRef,
43
45
  textFieldProps: {
44
46
  value: preparedValue,
45
47
  $isHidden: hasValue,
@@ -8,7 +8,7 @@ import { EndAdornmentWrapper, StyledLoader, StyledTagsList, StyledTextField, } f
8
8
  import { useLogic } from './useLogic';
9
9
  const ClearButton = ({ disabled, onClick }) => (_jsx(IconButton, { variant: "text", color: "grey", disabled: disabled, title: CLEAR_TEXT, "aria-label": CLEAR_TEXT, onClick: onClick, children: _jsx(CrossOutlineMd, {}) }));
10
10
  export const Input = forwardRef((props, forwardedRef) => {
11
- const { textFieldProps, isVisibleTagsList, isVisibleClearButton, handleChange, handleClearAll, } = useLogic(props);
11
+ const { textFieldProps, isVisibleTagsList, isVisibleClearButton, handleChange, handleClearAll, fieldRef, } = useLogic(props);
12
12
  const { value, valueToRender, disabled, isLoading, onChange, onClick, ...restProps } = props;
13
- return (_jsx(StyledTextField, { ...restProps, ref: forwardedRef, disabled: disabled, inputProps: { readOnly: true }, startAdornment: isVisibleTagsList && (_jsx(StyledTagsList, { data: valueToRender, keyId: "id", isDisabled: disabled, getOptionLabel: (option) => option.label, onClick: onClick, onChange: handleChange })), endAdornment: _jsxs(EndAdornmentWrapper, { children: [isLoading && _jsx(StyledLoader, {}), isVisibleClearButton && (_jsx(ClearButton, { disabled: disabled, onClick: handleClearAll })), _jsx(IconButton, { variant: "text", color: "grey", disabled: disabled, children: _jsx(DownOutlineMd, {}) })] }), onClick: onClick, ...textFieldProps }));
13
+ return (_jsx(StyledTextField, { ...restProps, ref: forwardedRef, disabled: disabled, inputProps: { readOnly: true }, InputProps: { ...restProps.InputProps, ref: fieldRef }, startAdornment: isVisibleTagsList && (_jsx(StyledTagsList, { data: valueToRender, keyId: "id", isDisabled: disabled, fieldRef: fieldRef, getOptionLabel: (option) => option.label, onClick: onClick, onChange: handleChange })), endAdornment: _jsxs(EndAdornmentWrapper, { children: [isLoading && _jsx(StyledLoader, {}), isVisibleClearButton && (_jsx(ClearButton, { disabled: disabled, onClick: handleClearAll })), _jsx(IconButton, { variant: "text", color: "grey", disabled: disabled, children: _jsx(DownOutlineMd, {}) })] }), onClick: onClick, ...textFieldProps }));
14
14
  });
@@ -2,12 +2,13 @@ import { type SyntheticEvent } from 'react';
2
2
  import { type TreeListData } from '../../../Tree';
3
3
  import type { TreeLikeAutocompleteValue } from '../../types';
4
4
  import { type InputProps } from '../types';
5
- export declare const useLogic: ({ value, disabled, isLoading, inputRef: externalInputRef, onChange, }: InputProps) => {
5
+ export declare const useLogic: ({ value, disabled, isLoading, inputRef: externalInputRef, InputProps: externalInputProps, onChange, }: InputProps) => {
6
6
  textFieldProps: {
7
7
  $isHidden: boolean;
8
8
  inputRef: import("react").RefObject<HTMLInputElement | null>;
9
9
  value: string | TreeLikeAutocompleteValue;
10
10
  };
11
+ fieldRef: import("react").RefObject<HTMLElement | null>;
11
12
  isVisibleTagsList: boolean;
12
13
  isVisibleClearButton: boolean;
13
14
  handleChange: (newValue: TreeListData[] | undefined) => void;
@@ -1,7 +1,8 @@
1
1
  import { useEffect, useRef, } from 'react';
2
2
  import { useForwardedRef } from '../../../useForwardedRef';
3
- export const useLogic = ({ value, disabled, isLoading, inputRef: externalInputRef, onChange, }) => {
3
+ export const useLogic = ({ value, disabled, isLoading, inputRef: externalInputRef, InputProps: externalInputProps, onChange, }) => {
4
4
  const inputRef = useForwardedRef(externalInputRef);
5
+ const fieldRef = useForwardedRef(externalInputProps?.ref);
5
6
  const prevValue = useRef(undefined);
6
7
  useEffect(() => {
7
8
  if (value && !prevValue.current) {
@@ -38,6 +39,7 @@ export const useLogic = ({ value, disabled, isLoading, inputRef: externalInputRe
38
39
  inputRef,
39
40
  value: preparedValue,
40
41
  },
42
+ fieldRef,
41
43
  isVisibleTagsList: hasValue,
42
44
  isVisibleClearButton,
43
45
  handleChange,
@@ -1,4 +1,4 @@
1
- import { useEffect, useState } from 'react';
1
+ import { useCallback, useEffect, useState } from 'react';
2
2
  import { pageLayoutClassnames } from '../PageLayoutContainer';
3
3
  import { useViewportType } from '../useViewportType';
4
4
  /**
@@ -23,13 +23,14 @@ export const useScrollManagement = ({ scrollRef, isEndReached, onLoadMore, virtu
23
23
  if (scrollRef?.current?.parentElement) {
24
24
  scrollRef.current.parentElement.style.position = 'relative';
25
25
  }
26
- }, [scrollRef]);
27
- const recalculateVerticalScroll = () => {
26
+ }, [scrollRef, isMobile]);
27
+ const recalculateVerticalScroll = useCallback(() => {
28
28
  const list = document.getElementById(virtuosoId);
29
- if (scrollRef?.current && list) {
30
- setHasVerticalScroll(list?.clientHeight > scrollRef.current?.clientHeight);
29
+ if (!scrollParent || !list) {
30
+ return;
31
31
  }
32
- };
32
+ setHasVerticalScroll(list.clientHeight > scrollParent.clientHeight);
33
+ }, [scrollParent, virtuosoId]);
33
34
  const handleEndReach = () => {
34
35
  if (!isEndReached && onLoadMore) {
35
36
  onLoadMore();
@@ -2,12 +2,21 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ActionCellBase = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const cva_1 = require("../utils/cva");
6
+ const constants_1 = require("./constants");
5
7
  const MainAction_1 = require("./MainAction");
6
8
  const SecondaryAction_1 = require("./SecondaryAction");
7
9
  const styles_1 = require("./styles");
10
+ const actionCellCva = (0, cva_1.cva)(constants_1.actionCellBaseClassnames.root, {
11
+ variants: {
12
+ hasMainActions: {
13
+ true: constants_1.actionCellBaseClassnames.hasMainActions,
14
+ },
15
+ },
16
+ });
8
17
  const ActionCellBase = ({ actions, isDisabledAction, handleWrapperClick, handleActionClick, }) => {
9
18
  const { main, secondary } = actions;
10
- return ((0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { onClick: handleWrapperClick, children: [main.map((action) => {
19
+ return ((0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { onClick: handleWrapperClick, className: actionCellCva({ hasMainActions: Boolean(main.length) }), children: [main.map((action) => {
11
20
  return ((0, jsx_runtime_1.jsx)(MainAction_1.MainAction, { action: action, onActionClick: handleActionClick, isDisabled: isDisabledAction }, action.name));
12
21
  }), secondary && ((0, jsx_runtime_1.jsx)(SecondaryAction_1.SecondaryActions, { actions: secondary, onActionClick: handleActionClick, isDisabled: isDisabledAction }))] }));
13
22
  };
@@ -6,12 +6,18 @@ const react_1 = require("react");
6
6
  const IconDropdownButton_1 = require("../../IconDropdownButton");
7
7
  const MenuItem_1 = require("../../MenuItem");
8
8
  const Tooltip_1 = require("../../Tooltip");
9
+ const useViewportType_1 = require("../../useViewportType");
9
10
  const MainIconButton_1 = require("./MainIconButton");
11
+ const MobileMainButton_1 = require("./MobileMainButton");
10
12
  const MainAction = ({ action, onActionClick, isDisabled, }) => {
13
+ const { isMobile } = (0, useViewportType_1.useViewportType)();
11
14
  if ('actions' in action) {
12
15
  const { disabled, icon, name, disabledReason, actions } = action;
13
16
  return ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { title: disabledReason || name, withoutContainer: !disabled, placement: "top", children: (0, jsx_runtime_1.jsx)(IconDropdownButton_1.IconDropdownButton, { icon: icon, variant: "text", disabled: isDisabled || disabled, children: actions.map(({ name: nestedActionName, onClick: onClickNested, ...props }) => ((0, react_1.createElement)(MenuItem_1.MenuItem, { ...props, key: nestedActionName, onClick: onActionClick(onClickNested) }, nestedActionName))) }) }, name));
14
17
  }
18
+ if (isMobile && action.isMobilePrimary) {
19
+ return ((0, jsx_runtime_1.jsx)(MobileMainButton_1.MobileMainButton, { action: action, onActionClick: onActionClick, isDisabled: isDisabled }));
20
+ }
15
21
  return ((0, jsx_runtime_1.jsx)(MainIconButton_1.MainIconButton, { action: action, onActionClick: onActionClick, isDisabled: isDisabled }));
16
22
  };
17
23
  exports.MainAction = MainAction;