@salutejs/plasma-new-hope 0.76.2-canary.1184.8705168480.0 → 0.76.2-dev.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (411) hide show
  1. package/cjs/_virtual/_rollupPluginBabelHelpers.js +1 -1
  2. package/cjs/components/Calendar/CalendarBase/CalendarBase.js +1 -1
  3. package/cjs/components/Calendar/CalendarBase/CalendarBase.js.map +1 -1
  4. package/cjs/components/Calendar/CalendarDouble/CalendarDouble.js +1 -1
  5. package/cjs/components/Calendar/CalendarDouble/CalendarDouble.js.map +1 -1
  6. package/cjs/components/Calendar/hoc/withRange.js +1 -1
  7. package/cjs/components/Calendar/hoc/withRange.js.map +1 -1
  8. package/cjs/components/Calendar/hooks/useKeyNavigation.js +19 -19
  9. package/cjs/components/Calendar/hooks/useKeyNavigation.js.map +1 -1
  10. package/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js +3 -3
  11. package/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js.map +1 -1
  12. package/cjs/components/Calendar/ui/CalendarHeader/CalendarHeader.js +2 -2
  13. package/cjs/components/Calendar/ui/CalendarHeader/CalendarHeader.js.map +1 -1
  14. package/cjs/components/Calendar/ui/CalendarMonths/CalendarMonths.js +1 -1
  15. package/cjs/components/Calendar/ui/CalendarMonths/CalendarMonths.js.map +1 -1
  16. package/cjs/components/Calendar/ui/CalendarYears/CalendarYears.js +1 -1
  17. package/cjs/components/Calendar/ui/CalendarYears/CalendarYears.js.map +1 -1
  18. package/cjs/components/Chip/Chip.css +2 -0
  19. package/cjs/components/Chip/Chip.js +16 -4
  20. package/cjs/components/Chip/Chip.js.map +1 -1
  21. package/cjs/components/Chip/Chip.tokens.js +5 -0
  22. package/cjs/components/Chip/Chip.tokens.js.map +1 -1
  23. package/cjs/components/Chip/variations/_pilled/base.js +9 -0
  24. package/cjs/components/Chip/variations/_pilled/base.js.map +1 -0
  25. package/cjs/components/Chip/variations/_pilled/base_3kce4h.css +1 -0
  26. package/cjs/components/Combobox/Combobox.css +2 -0
  27. package/cjs/components/Combobox/Combobox.js +5 -5
  28. package/cjs/components/Combobox/Combobox.js.map +1 -1
  29. package/cjs/components/Combobox/hooks/useFocusController.js +9 -9
  30. package/cjs/components/Combobox/hooks/useFocusController.js.map +1 -1
  31. package/cjs/components/Combobox/ui/ComboboxChip/ComboboxChip.css +2 -0
  32. package/cjs/components/Combobox/ui/ComboboxChip/ComboboxChip.js +1 -1
  33. package/cjs/components/Combobox/ui/ComboboxChip/ComboboxChip.js.map +1 -1
  34. package/cjs/components/Combobox/ui/ComboboxTarget/ComboboxTarget.css +2 -0
  35. package/cjs/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js +6 -6
  36. package/cjs/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js.map +1 -1
  37. package/cjs/components/Drawer/DrawerContext.js +1 -1
  38. package/cjs/components/Drawer/DrawerContext.js.map +1 -1
  39. package/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.js +2 -2
  40. package/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.js.map +1 -1
  41. package/cjs/components/Modal/ModalContext.js +1 -1
  42. package/cjs/components/Modal/ModalContext.js.map +1 -1
  43. package/cjs/components/Overlay/Overlay.js +1 -1
  44. package/cjs/components/Overlay/Overlay.js.map +1 -1
  45. package/cjs/components/Pagination/Pagination.css +2 -0
  46. package/cjs/components/Pagination/Pagination.js +2 -2
  47. package/cjs/components/Pagination/Pagination.js.map +1 -1
  48. package/cjs/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js +1 -1
  49. package/cjs/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js.map +1 -1
  50. package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +2 -0
  51. package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +1 -1
  52. package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js.map +1 -1
  53. package/cjs/components/Popover/Popover.js +7 -7
  54. package/cjs/components/Popover/Popover.js.map +1 -1
  55. package/cjs/components/Popup/Popup.js +1 -1
  56. package/cjs/components/Popup/Popup.js.map +1 -1
  57. package/cjs/components/Segment/ui/SegmentItem/SegmentItem.js +2 -2
  58. package/cjs/components/Segment/ui/SegmentItem/SegmentItem.js.map +1 -1
  59. package/cjs/components/Select/Select.css +2 -0
  60. package/cjs/components/Select/Select.js +5 -5
  61. package/cjs/components/Select/Select.js.map +1 -1
  62. package/cjs/components/Select/hooks/useKeyNavigation.js +12 -12
  63. package/cjs/components/Select/hooks/useKeyNavigation.js.map +1 -1
  64. package/cjs/components/Select/ui/SelectChip/SelectChip.css +2 -0
  65. package/cjs/components/Select/ui/SelectChip/SelectChip.js +1 -1
  66. package/cjs/components/Select/ui/SelectChip/SelectChip.js.map +1 -1
  67. package/cjs/components/Select/ui/SelectTarget/SelectTarget.css +2 -0
  68. package/cjs/components/Select/ui/SelectTarget/SelectTarget.js +2 -2
  69. package/cjs/components/Select/ui/SelectTarget/SelectTarget.js.map +1 -1
  70. package/cjs/components/Select/utils/index.js +2 -2
  71. package/cjs/components/Select/utils/index.js.map +1 -1
  72. package/cjs/components/Tabs/TabsContext.js +2 -1
  73. package/cjs/components/Tabs/TabsContext.js.map +1 -1
  74. package/cjs/components/Tabs/ui/TabItem/TabItem.js +1 -1
  75. package/cjs/components/Tabs/ui/TabItem/TabItem.js.map +1 -1
  76. package/cjs/components/Tabs/ui/Tabs/Tabs.js +2 -2
  77. package/cjs/components/Tabs/ui/Tabs/Tabs.js.map +1 -1
  78. package/cjs/components/TextArea/TextArea.js +1 -1
  79. package/cjs/components/TextArea/TextArea.js.map +1 -1
  80. package/cjs/components/TextField/TextField.js +2 -2
  81. package/cjs/components/TextField/TextField.js.map +1 -1
  82. package/cjs/components/TextField/hooks/useKeyNavigation.js +9 -9
  83. package/cjs/components/TextField/hooks/useKeyNavigation.js.map +1 -1
  84. package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.css +2 -0
  85. package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js +1 -1
  86. package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js.map +1 -1
  87. package/cjs/components/Toast/ToastProvider/ToastProvider.js +2 -2
  88. package/cjs/components/Toast/ToastProvider/ToastProvider.js.map +1 -1
  89. package/cjs/components/Tooltip/Tooltip.js +1 -1
  90. package/cjs/components/Tooltip/Tooltip.js.map +1 -1
  91. package/cjs/index.css +2 -0
  92. package/es/_virtual/_rollupPluginBabelHelpers.js +1 -1
  93. package/es/components/Calendar/CalendarBase/CalendarBase.js +1 -1
  94. package/es/components/Calendar/CalendarBase/CalendarBase.js.map +1 -1
  95. package/es/components/Calendar/CalendarDouble/CalendarDouble.js +1 -1
  96. package/es/components/Calendar/CalendarDouble/CalendarDouble.js.map +1 -1
  97. package/es/components/Calendar/hoc/withRange.js +1 -1
  98. package/es/components/Calendar/hoc/withRange.js.map +1 -1
  99. package/es/components/Calendar/hooks/useKeyNavigation.js +19 -19
  100. package/es/components/Calendar/hooks/useKeyNavigation.js.map +1 -1
  101. package/es/components/Calendar/ui/CalendarDays/CalendarDays.js +3 -3
  102. package/es/components/Calendar/ui/CalendarDays/CalendarDays.js.map +1 -1
  103. package/es/components/Calendar/ui/CalendarHeader/CalendarHeader.js +2 -2
  104. package/es/components/Calendar/ui/CalendarHeader/CalendarHeader.js.map +1 -1
  105. package/es/components/Calendar/ui/CalendarMonths/CalendarMonths.js +1 -1
  106. package/es/components/Calendar/ui/CalendarMonths/CalendarMonths.js.map +1 -1
  107. package/es/components/Calendar/ui/CalendarYears/CalendarYears.js +1 -1
  108. package/es/components/Calendar/ui/CalendarYears/CalendarYears.js.map +1 -1
  109. package/es/components/Chip/Chip.css +2 -0
  110. package/es/components/Chip/Chip.js +17 -5
  111. package/es/components/Chip/Chip.js.map +1 -1
  112. package/es/components/Chip/Chip.tokens.js +5 -1
  113. package/es/components/Chip/Chip.tokens.js.map +1 -1
  114. package/es/components/Chip/variations/_pilled/base.js +5 -0
  115. package/es/components/Chip/variations/_pilled/base.js.map +1 -0
  116. package/es/components/Chip/variations/_pilled/base_3kce4h.css +1 -0
  117. package/es/components/Combobox/Combobox.css +2 -0
  118. package/es/components/Combobox/Combobox.js +5 -5
  119. package/es/components/Combobox/Combobox.js.map +1 -1
  120. package/es/components/Combobox/hooks/useFocusController.js +9 -9
  121. package/es/components/Combobox/hooks/useFocusController.js.map +1 -1
  122. package/es/components/Combobox/ui/ComboboxChip/ComboboxChip.css +2 -0
  123. package/es/components/Combobox/ui/ComboboxChip/ComboboxChip.js +1 -1
  124. package/es/components/Combobox/ui/ComboboxChip/ComboboxChip.js.map +1 -1
  125. package/es/components/Combobox/ui/ComboboxTarget/ComboboxTarget.css +2 -0
  126. package/es/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js +6 -6
  127. package/es/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js.map +1 -1
  128. package/es/components/Drawer/DrawerContext.js +1 -1
  129. package/es/components/Drawer/DrawerContext.js.map +1 -1
  130. package/es/components/Dropdown/ui/DropdownItem/DropdownItem.js +2 -2
  131. package/es/components/Dropdown/ui/DropdownItem/DropdownItem.js.map +1 -1
  132. package/es/components/Modal/ModalContext.js +1 -1
  133. package/es/components/Modal/ModalContext.js.map +1 -1
  134. package/es/components/Overlay/Overlay.js +1 -1
  135. package/es/components/Overlay/Overlay.js.map +1 -1
  136. package/es/components/Pagination/Pagination.css +2 -0
  137. package/es/components/Pagination/Pagination.js +2 -2
  138. package/es/components/Pagination/Pagination.js.map +1 -1
  139. package/es/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js +1 -1
  140. package/es/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js.map +1 -1
  141. package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +2 -0
  142. package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +1 -1
  143. package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js.map +1 -1
  144. package/es/components/Popover/Popover.js +7 -7
  145. package/es/components/Popover/Popover.js.map +1 -1
  146. package/es/components/Popup/Popup.js +1 -1
  147. package/es/components/Popup/Popup.js.map +1 -1
  148. package/es/components/Segment/ui/SegmentItem/SegmentItem.js +2 -2
  149. package/es/components/Segment/ui/SegmentItem/SegmentItem.js.map +1 -1
  150. package/es/components/Select/Select.css +2 -0
  151. package/es/components/Select/Select.js +5 -5
  152. package/es/components/Select/Select.js.map +1 -1
  153. package/es/components/Select/hooks/useKeyNavigation.js +12 -12
  154. package/es/components/Select/hooks/useKeyNavigation.js.map +1 -1
  155. package/es/components/Select/ui/SelectChip/SelectChip.css +2 -0
  156. package/es/components/Select/ui/SelectChip/SelectChip.js +1 -1
  157. package/es/components/Select/ui/SelectChip/SelectChip.js.map +1 -1
  158. package/es/components/Select/ui/SelectTarget/SelectTarget.css +2 -0
  159. package/es/components/Select/ui/SelectTarget/SelectTarget.js +2 -2
  160. package/es/components/Select/ui/SelectTarget/SelectTarget.js.map +1 -1
  161. package/es/components/Select/utils/index.js +2 -2
  162. package/es/components/Select/utils/index.js.map +1 -1
  163. package/es/components/Tabs/TabsContext.js +2 -1
  164. package/es/components/Tabs/TabsContext.js.map +1 -1
  165. package/es/components/Tabs/ui/TabItem/TabItem.js +1 -1
  166. package/es/components/Tabs/ui/TabItem/TabItem.js.map +1 -1
  167. package/es/components/Tabs/ui/Tabs/Tabs.js +2 -2
  168. package/es/components/Tabs/ui/Tabs/Tabs.js.map +1 -1
  169. package/es/components/TextArea/TextArea.js +1 -1
  170. package/es/components/TextArea/TextArea.js.map +1 -1
  171. package/es/components/TextField/TextField.js +2 -2
  172. package/es/components/TextField/TextField.js.map +1 -1
  173. package/es/components/TextField/hooks/useKeyNavigation.js +9 -9
  174. package/es/components/TextField/hooks/useKeyNavigation.js.map +1 -1
  175. package/es/components/TextField/ui/TextFieldChip/TextFieldChip.css +2 -0
  176. package/es/components/TextField/ui/TextFieldChip/TextFieldChip.js +1 -1
  177. package/es/components/TextField/ui/TextFieldChip/TextFieldChip.js.map +1 -1
  178. package/es/components/Toast/ToastProvider/ToastProvider.js +2 -2
  179. package/es/components/Toast/ToastProvider/ToastProvider.js.map +1 -1
  180. package/es/components/Tooltip/Tooltip.js +1 -1
  181. package/es/components/Tooltip/Tooltip.js.map +1 -1
  182. package/es/index.css +2 -0
  183. package/package.json +10 -10
  184. package/styled-components/cjs/components/Avatar/Avatar.js +1 -1
  185. package/styled-components/cjs/components/Avatar/Avatar.styles.js +1 -1
  186. package/styled-components/cjs/components/AvatarGroup/AvatarGroup.js +1 -1
  187. package/styled-components/cjs/components/Badge/Badge.js +1 -1
  188. package/styled-components/cjs/components/Badge/Badge.styles.js +1 -1
  189. package/styled-components/cjs/components/Button/Button.js +2 -2
  190. package/styled-components/cjs/components/Button/Button.styles.js +1 -1
  191. package/styled-components/cjs/components/ButtonGroup/ButtonGroup.js +1 -1
  192. package/styled-components/cjs/components/Calendar/CalendarBase/CalendarBase.js +2 -2
  193. package/styled-components/cjs/components/Calendar/CalendarBase/CalendarBase.styles.js +1 -1
  194. package/styled-components/cjs/components/Calendar/CalendarDouble/CalendarDouble.js +2 -2
  195. package/styled-components/cjs/components/Calendar/CalendarDouble/CalendarDouble.styles.js +1 -1
  196. package/styled-components/cjs/components/Calendar/hoc/withRange.js +2 -2
  197. package/styled-components/cjs/components/Calendar/hooks/useKeyNavigation.js +20 -20
  198. package/styled-components/cjs/components/Calendar/store/reducer.js +1 -1
  199. package/styled-components/cjs/components/Calendar/ui/CalendarDayItem/CalendarDayItem.js +1 -1
  200. package/styled-components/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js +4 -4
  201. package/styled-components/cjs/components/Calendar/ui/CalendarHeader/CalendarHeader.js +3 -3
  202. package/styled-components/cjs/components/Calendar/ui/CalendarMonths/CalendarMonths.js +2 -2
  203. package/styled-components/cjs/components/Calendar/ui/CalendarYears/CalendarYears.js +2 -2
  204. package/styled-components/cjs/components/Cell/Cell.js +1 -1
  205. package/styled-components/cjs/components/Cell/Cell.styles.js +1 -1
  206. package/styled-components/cjs/components/Checkbox/Checkbox.js +1 -1
  207. package/styled-components/cjs/components/Chip/Chip.js +17 -5
  208. package/styled-components/cjs/components/Chip/Chip.styles.js +1 -1
  209. package/styled-components/cjs/components/Chip/Chip.template-doc.mdx +2 -2
  210. package/styled-components/cjs/components/Chip/Chip.tokens.js +5 -1
  211. package/styled-components/cjs/components/Chip/variations/_pilled/base.js +9 -0
  212. package/styled-components/cjs/components/Chip/variations/_pilled/tokens.json +4 -0
  213. package/styled-components/cjs/components/Combobox/Combobox.js +6 -6
  214. package/styled-components/cjs/components/Combobox/hooks/useFocusController.js +9 -9
  215. package/styled-components/cjs/components/Combobox/ui/ComboboxChip/ComboboxChip.js +2 -2
  216. package/styled-components/cjs/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js +7 -7
  217. package/styled-components/cjs/components/Counter/Counter.js +1 -1
  218. package/styled-components/cjs/components/Divider/Divider.js +2 -2
  219. package/styled-components/cjs/components/Drawer/Drawer.js +1 -1
  220. package/styled-components/cjs/components/Drawer/DrawerContext.js +1 -1
  221. package/styled-components/cjs/components/Drawer/hooks/useDrawer.js +1 -1
  222. package/styled-components/cjs/components/Drawer/ui/DrawerContent/DrawerContent.js +1 -1
  223. package/styled-components/cjs/components/Drawer/ui/DrawerFooter/DrawerFooter.js +1 -1
  224. package/styled-components/cjs/components/Drawer/ui/DrawerHeader/DrawerHeader.js +1 -1
  225. package/styled-components/cjs/components/Dropdown/Dropdown.js +1 -1
  226. package/styled-components/cjs/components/Dropdown/ui/DropdownDivider/DropdownDivider.js +1 -1
  227. package/styled-components/cjs/components/Dropdown/ui/DropdownFooter/DropdownFooter.js +1 -1
  228. package/styled-components/cjs/components/Dropdown/ui/DropdownGroup/DropdownGroup.js +1 -1
  229. package/styled-components/cjs/components/Dropdown/ui/DropdownHeader/DropdownHeader.js +1 -1
  230. package/styled-components/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.js +4 -4
  231. package/styled-components/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.styles.js +1 -1
  232. package/styled-components/cjs/components/Dropdown/utils/index.js +1 -1
  233. package/styled-components/cjs/components/Grid/Grid.js +2 -2
  234. package/styled-components/cjs/components/Grid/ui/Col/Col.js +2 -2
  235. package/styled-components/cjs/components/Grid/ui/Row/Row.js +1 -1
  236. package/styled-components/cjs/components/Grid/utils/index.js +1 -1
  237. package/styled-components/cjs/components/Header/HeaderRoot/HeaderRoot.js +1 -1
  238. package/styled-components/cjs/components/Header/ui/HeaderArrow/HeaderArrow.js +1 -1
  239. package/styled-components/cjs/components/Header/ui/HeaderLogo/HeaderLogo.js +1 -1
  240. package/styled-components/cjs/components/Header/ui/HeaderTitleWrapper/HeaderTitleWrapper.js +1 -1
  241. package/styled-components/cjs/components/Image/Image.js +2 -2
  242. package/styled-components/cjs/components/Image/Image.styles.js +1 -1
  243. package/styled-components/cjs/components/Indicator/Indicator.js +1 -1
  244. package/styled-components/cjs/components/Link/Link.js +1 -1
  245. package/styled-components/cjs/components/Modal/Modal.js +1 -1
  246. package/styled-components/cjs/components/Modal/ModalContext.js +1 -1
  247. package/styled-components/cjs/components/Modal/hooks/useModal.js +1 -1
  248. package/styled-components/cjs/components/Notification/Notification.js +1 -1
  249. package/styled-components/cjs/components/Notification/Notification.styles.js +1 -1
  250. package/styled-components/cjs/components/Notification/NotificationsPortal.js +1 -1
  251. package/styled-components/cjs/components/Notification/NotificationsStore.js +1 -1
  252. package/styled-components/cjs/components/Overlay/Overlay.js +2 -2
  253. package/styled-components/cjs/components/Pagination/Pagination.js +3 -3
  254. package/styled-components/cjs/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js +2 -2
  255. package/styled-components/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
  256. package/styled-components/cjs/components/Panel/Panel.js +2 -2
  257. package/styled-components/cjs/components/Panel/ui/PanelContent/PanelContent.js +1 -1
  258. package/styled-components/cjs/components/Panel/ui/PanelFooter/PanelFooter.js +1 -1
  259. package/styled-components/cjs/components/Panel/ui/PanelHeader/PanelHeader.js +1 -1
  260. package/styled-components/cjs/components/Popover/Popover.js +9 -9
  261. package/styled-components/cjs/components/Popup/Popup.js +2 -2
  262. package/styled-components/cjs/components/Popup/PopupContext.js +1 -1
  263. package/styled-components/cjs/components/Popup/PopupRoot.js +1 -1
  264. package/styled-components/cjs/components/Popup/hooks/usePopup.js +1 -1
  265. package/styled-components/cjs/components/Progress/Progress.js +1 -1
  266. package/styled-components/cjs/components/Progress/Progress.styles.js +1 -1
  267. package/styled-components/cjs/components/Radiobox/Radiobox.js +1 -1
  268. package/styled-components/cjs/components/SSRProvider/SSRProvider.js +1 -1
  269. package/styled-components/cjs/components/Segment/SegmentProvider/SegmentProvider.js +1 -1
  270. package/styled-components/cjs/components/Segment/ui/SegmentGroup/SegmentGroup.js +1 -1
  271. package/styled-components/cjs/components/Segment/ui/SegmentGroup/SegmentGroup.styles.js +1 -1
  272. package/styled-components/cjs/components/Segment/ui/SegmentItem/SegmentItem.js +3 -3
  273. package/styled-components/cjs/components/Segment/ui/SegmentItem/SegmentItem.styles.js +1 -1
  274. package/styled-components/cjs/components/Select/Select.js +6 -6
  275. package/styled-components/cjs/components/Select/hooks/useKeyNavigation.js +12 -12
  276. package/styled-components/cjs/components/Select/ui/SelectChip/SelectChip.js +2 -2
  277. package/styled-components/cjs/components/Select/ui/SelectTarget/SelectTarget.js +3 -3
  278. package/styled-components/cjs/components/Select/utils/index.js +3 -3
  279. package/styled-components/cjs/components/Skeleton/LineSkeleton/LineSkeleton.js +1 -1
  280. package/styled-components/cjs/components/Skeleton/LineSkeleton/LineSkeleton.styles.js +1 -1
  281. package/styled-components/cjs/components/Skeleton/RectSkeleton/RectSkeleton.js +1 -1
  282. package/styled-components/cjs/components/Skeleton/TextSkeleton/TextSkeleton.js +2 -2
  283. package/styled-components/cjs/components/Skeleton/hoc/withSkeleton.js +1 -1
  284. package/styled-components/cjs/components/Spinner/Spinner.js +1 -1
  285. package/styled-components/cjs/components/Spinner/Spinner.styles.js +1 -1
  286. package/styled-components/cjs/components/Spinner/utils/index.js +1 -1
  287. package/styled-components/cjs/components/Switch/Switch.js +1 -1
  288. package/styled-components/cjs/components/Tabs/TabsContext.js +3 -2
  289. package/styled-components/cjs/components/Tabs/createTabsController.js +1 -1
  290. package/styled-components/cjs/components/Tabs/ui/TabItem/TabItem.js +2 -2
  291. package/styled-components/cjs/components/Tabs/ui/TabItem/TabItem.styles.js +1 -1
  292. package/styled-components/cjs/components/Tabs/ui/Tabs/Tabs.js +3 -3
  293. package/styled-components/cjs/components/Tabs/ui/Tabs/Tabs.styles.js +1 -1
  294. package/styled-components/cjs/components/TextArea/TextArea.js +2 -2
  295. package/styled-components/cjs/components/TextField/TextField.js +3 -3
  296. package/styled-components/cjs/components/TextField/hooks/useKeyNavigation.js +9 -9
  297. package/styled-components/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js +2 -2
  298. package/styled-components/cjs/components/Toast/Toast.js +2 -2
  299. package/styled-components/cjs/components/Toast/Toast.styles.js +1 -1
  300. package/styled-components/cjs/components/Toast/ToastController.js +2 -2
  301. package/styled-components/cjs/components/Toast/ToastProvider/ToastProvider.js +3 -3
  302. package/styled-components/cjs/components/Toolbar/Toolbar.js +1 -1
  303. package/styled-components/cjs/components/Toolbar/ui/ToolbarDivider/ToolbarDivider.js +1 -1
  304. package/styled-components/cjs/components/Tooltip/Tooltip.js +2 -2
  305. package/styled-components/cjs/components/Typography/Old/Subtitle/Subtitle.js +2 -2
  306. package/styled-components/cjs/components/Typography/Old/TypographyOld.js +2 -2
  307. package/styled-components/cjs/components/Typography/Typography.js +2 -2
  308. package/styled-components/cjs/engines/common.js +1 -1
  309. package/styled-components/cjs/engines/styled-components.js +1 -1
  310. package/styled-components/cjs/examples/_helpers.js +1 -1
  311. package/styled-components/cjs/examples/plasma_b2c/components/Chip/Chip.config.js +10 -7
  312. package/styled-components/cjs/examples/plasma_b2c/components/Chip/Chip.stories.tsx +18 -2
  313. package/styled-components/cjs/examples/plasma_b2c/components/Grid/Grid.config.js +1 -1
  314. package/styled-components/cjs/examples/plasma_web/components/Chip/Chip.config.js +10 -7
  315. package/styled-components/cjs/examples/plasma_web/components/Chip/Chip.stories.tsx +18 -2
  316. package/styled-components/cjs/examples/plasma_web/components/Grid/Grid.config.js +1 -1
  317. package/styled-components/cjs/examples/sds_engineer/components/Grid/Grid.config.js +1 -1
  318. package/styled-components/cjs/mixins/applySpacing.js +1 -1
  319. package/styled-components/cjs/mixins/typography.js +1 -1
  320. package/styled-components/es/components/Button/Button.js +1 -1
  321. package/styled-components/es/components/Calendar/CalendarBase/CalendarBase.js +1 -1
  322. package/styled-components/es/components/Calendar/CalendarDouble/CalendarDouble.js +1 -1
  323. package/styled-components/es/components/Calendar/hoc/withRange.js +1 -1
  324. package/styled-components/es/components/Calendar/hooks/useKeyNavigation.js +20 -20
  325. package/styled-components/es/components/Calendar/store/reducer.js +1 -1
  326. package/styled-components/es/components/Calendar/ui/CalendarDays/CalendarDays.js +3 -3
  327. package/styled-components/es/components/Calendar/ui/CalendarHeader/CalendarHeader.js +2 -2
  328. package/styled-components/es/components/Calendar/ui/CalendarMonths/CalendarMonths.js +1 -1
  329. package/styled-components/es/components/Calendar/ui/CalendarYears/CalendarYears.js +1 -1
  330. package/styled-components/es/components/Chip/Chip.js +17 -5
  331. package/styled-components/es/components/Chip/Chip.template-doc.mdx +2 -2
  332. package/styled-components/es/components/Chip/Chip.tokens.js +4 -0
  333. package/styled-components/es/components/Chip/variations/_pilled/base.js +3 -0
  334. package/styled-components/es/components/Chip/variations/_pilled/tokens.json +4 -0
  335. package/styled-components/es/components/Combobox/Combobox.js +5 -5
  336. package/styled-components/es/components/Combobox/hooks/useFocusController.js +9 -9
  337. package/styled-components/es/components/Combobox/ui/ComboboxChip/ComboboxChip.js +1 -1
  338. package/styled-components/es/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js +6 -6
  339. package/styled-components/es/components/Divider/Divider.js +1 -1
  340. package/styled-components/es/components/Drawer/DrawerContext.js +1 -1
  341. package/styled-components/es/components/Drawer/hooks/useDrawer.js +1 -1
  342. package/styled-components/es/components/Drawer/ui/DrawerContent/DrawerContent.js +1 -1
  343. package/styled-components/es/components/Drawer/ui/DrawerFooter/DrawerFooter.js +1 -1
  344. package/styled-components/es/components/Drawer/ui/DrawerHeader/DrawerHeader.js +1 -1
  345. package/styled-components/es/components/Dropdown/ui/DropdownItem/DropdownItem.js +3 -3
  346. package/styled-components/es/components/Grid/Grid.js +1 -1
  347. package/styled-components/es/components/Grid/ui/Col/Col.js +1 -1
  348. package/styled-components/es/components/Grid/utils/index.js +1 -1
  349. package/styled-components/es/components/Image/Image.js +1 -1
  350. package/styled-components/es/components/Modal/ModalContext.js +1 -1
  351. package/styled-components/es/components/Modal/hooks/useModal.js +1 -1
  352. package/styled-components/es/components/Notification/NotificationsStore.js +1 -1
  353. package/styled-components/es/components/Overlay/Overlay.js +1 -1
  354. package/styled-components/es/components/Pagination/Pagination.js +2 -2
  355. package/styled-components/es/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js +1 -1
  356. package/styled-components/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +1 -1
  357. package/styled-components/es/components/Panel/Panel.js +1 -1
  358. package/styled-components/es/components/Popover/Popover.js +8 -8
  359. package/styled-components/es/components/Popup/Popup.js +1 -1
  360. package/styled-components/es/components/Popup/hooks/usePopup.js +1 -1
  361. package/styled-components/es/components/Segment/ui/SegmentItem/SegmentItem.js +2 -2
  362. package/styled-components/es/components/Select/Select.js +5 -5
  363. package/styled-components/es/components/Select/hooks/useKeyNavigation.js +12 -12
  364. package/styled-components/es/components/Select/ui/SelectChip/SelectChip.js +1 -1
  365. package/styled-components/es/components/Select/ui/SelectTarget/SelectTarget.js +2 -2
  366. package/styled-components/es/components/Select/utils/index.js +3 -3
  367. package/styled-components/es/components/Skeleton/TextSkeleton/TextSkeleton.js +1 -1
  368. package/styled-components/es/components/Skeleton/hoc/withSkeleton.js +1 -1
  369. package/styled-components/es/components/Spinner/utils/index.js +1 -1
  370. package/styled-components/es/components/Tabs/TabsContext.js +3 -2
  371. package/styled-components/es/components/Tabs/ui/TabItem/TabItem.js +1 -1
  372. package/styled-components/es/components/Tabs/ui/Tabs/Tabs.js +2 -2
  373. package/styled-components/es/components/TextArea/TextArea.js +1 -1
  374. package/styled-components/es/components/TextField/TextField.js +2 -2
  375. package/styled-components/es/components/TextField/hooks/useKeyNavigation.js +9 -9
  376. package/styled-components/es/components/TextField/ui/TextFieldChip/TextFieldChip.js +1 -1
  377. package/styled-components/es/components/Toast/Toast.js +1 -1
  378. package/styled-components/es/components/Toast/ToastController.js +1 -1
  379. package/styled-components/es/components/Toast/ToastProvider/ToastProvider.js +2 -2
  380. package/styled-components/es/components/Toolbar/ui/ToolbarDivider/ToolbarDivider.js +1 -1
  381. package/styled-components/es/components/Tooltip/Tooltip.js +1 -1
  382. package/styled-components/es/components/Typography/Old/Subtitle/Subtitle.js +1 -1
  383. package/styled-components/es/components/Typography/Old/TypographyOld.js +1 -1
  384. package/styled-components/es/components/Typography/Typography.js +1 -1
  385. package/styled-components/es/engines/common.js +1 -1
  386. package/styled-components/es/examples/_helpers.js +1 -1
  387. package/styled-components/es/examples/plasma_b2c/components/Chip/Chip.config.js +10 -7
  388. package/styled-components/es/examples/plasma_b2c/components/Chip/Chip.stories.tsx +18 -2
  389. package/styled-components/es/examples/plasma_b2c/components/Grid/Grid.config.js +1 -1
  390. package/styled-components/es/examples/plasma_web/components/Chip/Chip.config.js +10 -7
  391. package/styled-components/es/examples/plasma_web/components/Chip/Chip.stories.tsx +18 -2
  392. package/styled-components/es/examples/plasma_web/components/Grid/Grid.config.js +1 -1
  393. package/styled-components/es/examples/sds_engineer/components/Grid/Grid.config.js +1 -1
  394. package/styled-components/es/mixins/applySpacing.js +1 -1
  395. package/styled-components/es/mixins/typography.js +1 -1
  396. package/types/components/Chip/Chip.d.ts +4 -0
  397. package/types/components/Chip/Chip.d.ts.map +1 -1
  398. package/types/components/Chip/Chip.tokens.d.ts +4 -0
  399. package/types/components/Chip/Chip.tokens.d.ts.map +1 -1
  400. package/types/components/Chip/Chip.types.d.ts +6 -0
  401. package/types/components/Chip/Chip.types.d.ts.map +1 -1
  402. package/types/components/Chip/variations/_pilled/base.d.ts +2 -0
  403. package/types/components/Chip/variations/_pilled/base.d.ts.map +1 -0
  404. package/types/examples/plasma_b2c/components/Chip/Chip.config.d.ts +4 -1
  405. package/types/examples/plasma_b2c/components/Chip/Chip.config.d.ts.map +1 -1
  406. package/types/examples/plasma_b2c/components/Chip/Chip.d.ts +4 -1
  407. package/types/examples/plasma_b2c/components/Chip/Chip.d.ts.map +1 -1
  408. package/types/examples/plasma_web/components/Chip/Chip.config.d.ts +4 -1
  409. package/types/examples/plasma_web/components/Chip/Chip.config.d.ts.map +1 -1
  410. package/types/examples/plasma_web/components/Chip/Chip.d.ts +4 -1
  411. package/types/examples/plasma_web/components/Chip/Chip.d.ts.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.js","sources":["../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import React, { useRef, useCallback, useEffect, useState, forwardRef } from 'react';\nimport type { CSSProperties } from 'react';\nimport ReactDOM from 'react-dom';\nimport { usePopper } from 'react-popper';\nimport { useFocusTrap, useForkRef } from '@salutejs/plasma-core';\n\nimport type { RootProps } from '../../engines/types';\nimport { cx } from '../../utils';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport type { PopoverPlacement, PopoverProps } from './Popover.types';\nimport { StyledArrow, StyledPopover, StyledRoot, StyledWrapper } from './Popover.styles';\nimport { classes } from './Popover.tokens';\n\nexport const ESCAPE_KEYCODE = 27;\nexport const POPOVER_PORTAL_ID = 'plasma-popover-root';\n\n/**\n * Всплывающее окно с возможностью позиционирования\n * и вызова по клику либо ховеру.\n */\nexport const popoverRoot = (Root: RootProps<HTMLDivElement, PopoverProps>) =>\n forwardRef<HTMLDivElement, PopoverProps>(\n (\n {\n target,\n children,\n isOpen,\n trigger = 'click',\n hasArrow,\n frame = 'document',\n className,\n placement = 'auto',\n offset = [0, 0],\n zIndex,\n isFocusTrapped = true,\n closeOnEsc = true,\n preventOverflow = true,\n usePortal = false,\n view,\n onToggle,\n closeOnOverlayClick,\n ...rest\n },\n outerRootRef,\n ) => {\n const rootRef = useRef<HTMLDivElement | null>(null);\n const popoverRef = useRef<HTMLDivElement | null>(null);\n const handleRef = useForkRef<HTMLDivElement>(rootRef, outerRootRef);\n const portalRef = useRef<HTMLElement | null>(null);\n\n const trapRef = useFocusTrap(isOpen && isFocusTrapped);\n\n const popoverForkRef = useForkRef<HTMLDivElement>(popoverRef, trapRef);\n\n const [arrowElement, setArrowElement] = useState<HTMLSpanElement | null>(null);\n\n const [, forceRender] = useState(false);\n\n const isAutoArray = Array.isArray(placement);\n const isAuto = isAutoArray || (placement as PopoverPlacement).startsWith('auto');\n\n const initialStyles = {\n visibility: isOpen ? 'visible' : 'hidden',\n opacity: isOpen ? 1 : 0,\n } as CSSProperties;\n\n const { styles, attributes, forceUpdate } = usePopper(rootRef.current, popoverRef.current, {\n // TODO: #1121\n // eslint-disable-next-line no-nested-ternary\n placement: isAutoArray\n ? placement[0]?.endsWith('start')\n ? 'auto-start'\n : 'auto'\n : (placement as PopoverPlacement),\n modifiers: [\n {\n name: 'preventOverflow',\n options: {\n mainAxis: preventOverflow,\n },\n },\n { name: 'offset', options: { offset: [offset[0], offset[1]] } },\n {\n name: 'flip',\n enabled: isAuto,\n options: {\n allowedAutoPlacements: isAutoArray ? (placement as PopoverPlacement[]) : [],\n },\n },\n {\n name: 'arrow',\n options: {\n element: arrowElement,\n },\n },\n ],\n });\n\n const onEscape = useCallback(\n (event: KeyboardEvent) => {\n if (isOpen && closeOnEsc && event.keyCode === ESCAPE_KEYCODE) {\n onToggle?.(false, event);\n }\n },\n [closeOnEsc, isOpen, onToggle],\n );\n\n const onDocumentClick = useCallback(\n (event: MouseEvent) => {\n if (isOpen && closeOnOverlayClick && onToggle) {\n const targetIsRoot = event.target === rootRef.current;\n const rootHasTarget = rootRef.current?.contains(event.target as Element);\n\n if (!targetIsRoot && !rootHasTarget) {\n onToggle(false, event);\n }\n }\n },\n [closeOnOverlayClick, isOpen, onToggle],\n );\n\n const onClick = useCallback<React.MouseEventHandler>(\n (event) => {\n if (trigger === 'click') {\n const targetIsPopover = event.target === popoverRef.current;\n const rootHasTarget = popoverRef.current?.contains(event.target as Element);\n\n if (!targetIsPopover && !rootHasTarget) {\n onToggle?.(!isOpen, event);\n }\n }\n },\n [trigger, isOpen, onToggle],\n );\n\n const onMouseEnter = useCallback<React.MouseEventHandler>(\n (event) => {\n if (trigger === 'hover') {\n onToggle?.(true, event);\n }\n },\n [trigger, onToggle],\n );\n\n const onMouseLeave = useCallback<React.MouseEventHandler>(\n (event) => {\n if (trigger === 'hover') {\n onToggle?.(false, event);\n }\n },\n [trigger, onToggle],\n );\n\n const onFocus = useCallback<React.FocusEventHandler>(\n (event) => {\n if (trigger === 'hover') {\n onToggle?.(true, event);\n }\n },\n [trigger, onToggle],\n );\n\n const onBlur = useCallback<React.FocusEventHandler>(\n (event) => {\n if (trigger === 'hover') {\n onToggle?.(false, event);\n }\n },\n [trigger, onToggle],\n );\n\n useEffect(() => {\n document.addEventListener('click', onDocumentClick);\n return () => document.removeEventListener('click', onDocumentClick);\n }, [isOpen, onToggle]);\n\n useEffect(() => {\n window.addEventListener('keydown', onEscape);\n return () => window.removeEventListener('keydown', onEscape);\n }, [closeOnEsc, isOpen, onToggle]);\n\n useEffect(() => {\n let portal = document.getElementById(POPOVER_PORTAL_ID);\n\n if (typeof frame !== 'string' && frame && frame.current) {\n portal = frame.current;\n }\n\n if (!usePortal) {\n portal = rootRef.current;\n }\n\n if (!portal) {\n portal = document.createElement('div');\n portal.setAttribute('id', POPOVER_PORTAL_ID);\n\n if (typeof frame === 'string' && frame !== 'document') {\n document.getElementById(frame)?.appendChild(portal);\n } else {\n document.body.appendChild(portal);\n }\n }\n\n portalRef.current = portal;\n\n /**\n * Изменение стейта нужно для того, чтобы Popup\n * отобразился после записи DOM элемента в portalRef.current\n */\n forceRender(true);\n }, []);\n\n useEffect(() => {\n if (!isOpen || !forceUpdate) {\n return;\n }\n\n /*\n * INFO: Метод forceUpdate содержит в себе flushSync и приводит\n * к повторному рендеру компонента, который уже находится в процессе рендера.\n * Данный хак, нужен для того, чтобы это поведение избежать и перенаправить\n * вызов метода в очередь микрозадач.\n */\n Promise.resolve().then(forceUpdate);\n }, [isOpen, children, forceUpdate]);\n\n return (\n <StyledWrapper className={classes.wrapper} onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}>\n <StyledRoot\n ref={handleRef}\n onClick={onClick}\n onFocus={onFocus}\n onBlur={onBlur}\n className={cx(className, classes.target)}\n >\n {target}\n </StyledRoot>\n {children &&\n portalRef.current &&\n ReactDOM.createPortal(\n <Root view={view} className={className} {...rest}>\n <StyledPopover\n {...attributes.popper}\n className={classes.root}\n ref={popoverForkRef}\n style={{\n ...styles.popper,\n ...{ display: isOpen ? 'block' : 'none' },\n ...initialStyles,\n }}\n zIndex={zIndex}\n >\n {hasArrow && (\n <StyledArrow\n className={classes.arrow}\n ref={setArrowElement}\n style={styles.arrow}\n {...attributes.arrow}\n />\n )}\n {children}\n </StyledPopover>\n </Root>,\n portalRef.current,\n )}\n </StyledWrapper>\n );\n },\n );\n\nexport const popoverConfig = {\n name: 'Popover',\n tag: 'div',\n layout: popoverRoot,\n base: '',\n variations: {\n view: {\n css: viewCSS,\n },\n },\n defaults: {\n view: 'default',\n },\n};\n"],"names":["ESCAPE_KEYCODE","POPOVER_PORTAL_ID","popoverRoot","Root","forwardRef","_ref","outerRootRef","_placement$","target","children","isOpen","_ref$trigger","trigger","hasArrow","_ref$frame","frame","className","_ref$placement","placement","_ref$offset","offset","zIndex","_ref$isFocusTrapped","isFocusTrapped","_ref$closeOnEsc","closeOnEsc","_ref$preventOverflow","preventOverflow","_ref$usePortal","usePortal","view","onToggle","closeOnOverlayClick","rest","_objectWithoutProperties","_excluded","rootRef","useRef","popoverRef","handleRef","useForkRef","portalRef","trapRef","useFocusTrap","popoverForkRef","_useState","useState","_useState2","_slicedToArray","arrowElement","setArrowElement","_useState3","_useState4","forceRender","isAutoArray","Array","isArray","isAuto","startsWith","initialStyles","visibility","opacity","_usePopper","usePopper","current","endsWith","modifiers","name","options","mainAxis","enabled","allowedAutoPlacements","element","styles","attributes","forceUpdate","onEscape","useCallback","event","keyCode","onDocumentClick","_rootRef$current","targetIsRoot","rootHasTarget","contains","onClick","_popoverRef$current","targetIsPopover","onMouseEnter","onMouseLeave","onFocus","onBlur","useEffect","document","addEventListener","removeEventListener","window","portal","getElementById","createElement","setAttribute","_document$getElementB","appendChild","body","Promise","resolve","then","React","StyledWrapper","classes","wrapper","StyledRoot","ref","cx","ReactDOM","createPortal","_extends","StyledPopover","popper","root","style","_objectSpread","display","StyledArrow","arrow","popoverConfig","tag","layout","base","variations","css","viewCSS","defaults"],"mappings":";;;;;;;;;;;AAcO,IAAMA,cAAc,GAAG,GAAE;AACzB,IAAMC,iBAAiB,GAAG,sBAAqB;;AAEtD;AACA;AACA;AACA;IACaC,WAAW,GAAG,SAAdA,WAAWA,CAAIC,IAA6C,EAAA;AAAA,EAAA,oBACrEC,UAAU,CACN,UAAAC,IAAA,EAqBIC,YAAY,EACX;AAAA,IAAA,IAAAC,WAAA,CAAA;AAAA,IAAA,IApBGC,MAAM,GAAAH,IAAA,CAANG,MAAM;MACNC,QAAQ,GAAAJ,IAAA,CAARI,QAAQ;MACRC,MAAM,GAAAL,IAAA,CAANK,MAAM;MAAAC,YAAA,GAAAN,IAAA,CACNO,OAAO;AAAPA,MAAAA,OAAO,GAAAD,YAAA,KAAG,KAAA,CAAA,GAAA,OAAO,GAAAA,YAAA;MACjBE,QAAQ,GAAAR,IAAA,CAARQ,QAAQ;MAAAC,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A,IAAI,EAAE;AACFoG,MAAAA,GAAG,EAAEC,IAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNtG,IAAAA,IAAI,EAAE,SAAA;AACV,GAAA;AACJ;;;;"}
1
+ {"version":3,"file":"Popover.js","sources":["../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import React, { useRef, useCallback, useEffect, useState, forwardRef } from 'react';\nimport type { CSSProperties } from 'react';\nimport ReactDOM from 'react-dom';\nimport { usePopper } from 'react-popper';\nimport { useFocusTrap, useForkRef } from '@salutejs/plasma-core';\n\nimport type { RootProps } from '../../engines/types';\nimport { cx } from '../../utils';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport type { PopoverPlacement, PopoverProps } from './Popover.types';\nimport { StyledArrow, StyledPopover, StyledRoot, StyledWrapper } from './Popover.styles';\nimport { classes } from './Popover.tokens';\n\nexport const ESCAPE_KEYCODE = 27;\nexport const POPOVER_PORTAL_ID = 'plasma-popover-root';\n\n/**\n * Всплывающее окно с возможностью позиционирования\n * и вызова по клику либо ховеру.\n */\nexport const popoverRoot = (Root: RootProps<HTMLDivElement, PopoverProps>) =>\n forwardRef<HTMLDivElement, PopoverProps>(\n (\n {\n target,\n children,\n isOpen,\n trigger = 'click',\n hasArrow,\n frame = 'document',\n className,\n placement = 'auto',\n offset = [0, 0],\n zIndex,\n isFocusTrapped = true,\n closeOnEsc = true,\n preventOverflow = true,\n usePortal = false,\n view,\n onToggle,\n closeOnOverlayClick,\n ...rest\n },\n outerRootRef,\n ) => {\n const rootRef = useRef<HTMLDivElement | null>(null);\n const popoverRef = useRef<HTMLDivElement | null>(null);\n const handleRef = useForkRef<HTMLDivElement>(rootRef, outerRootRef);\n const portalRef = useRef<HTMLElement | null>(null);\n\n const trapRef = useFocusTrap(isOpen && isFocusTrapped);\n\n const popoverForkRef = useForkRef<HTMLDivElement>(popoverRef, trapRef);\n\n const [arrowElement, setArrowElement] = useState<HTMLSpanElement | null>(null);\n\n const [, forceRender] = useState(false);\n\n const isAutoArray = Array.isArray(placement);\n const isAuto = isAutoArray || (placement as PopoverPlacement).startsWith('auto');\n\n const initialStyles = {\n visibility: isOpen ? 'visible' : 'hidden',\n opacity: isOpen ? 1 : 0,\n } as CSSProperties;\n\n const { styles, attributes, forceUpdate } = usePopper(rootRef.current, popoverRef.current, {\n // TODO: #1121\n // eslint-disable-next-line no-nested-ternary\n placement: isAutoArray\n ? placement[0]?.endsWith('start')\n ? 'auto-start'\n : 'auto'\n : (placement as PopoverPlacement),\n modifiers: [\n {\n name: 'preventOverflow',\n options: {\n mainAxis: preventOverflow,\n },\n },\n { name: 'offset', options: { offset: [offset[0], offset[1]] } },\n {\n name: 'flip',\n enabled: isAuto,\n options: {\n allowedAutoPlacements: isAutoArray ? (placement as PopoverPlacement[]) : [],\n },\n },\n {\n name: 'arrow',\n options: {\n element: arrowElement,\n },\n },\n ],\n });\n\n const onEscape = useCallback(\n (event: KeyboardEvent) => {\n if (isOpen && closeOnEsc && event.keyCode === ESCAPE_KEYCODE) {\n onToggle?.(false, event);\n }\n },\n [closeOnEsc, isOpen, onToggle],\n );\n\n const onDocumentClick = useCallback(\n (event: MouseEvent) => {\n if (isOpen && closeOnOverlayClick && onToggle) {\n const targetIsRoot = event.target === rootRef.current;\n const rootHasTarget = rootRef.current?.contains(event.target as Element);\n\n if (!targetIsRoot && !rootHasTarget) {\n onToggle(false, event);\n }\n }\n },\n [closeOnOverlayClick, isOpen, onToggle],\n );\n\n const onClick = useCallback<React.MouseEventHandler>(\n (event) => {\n if (trigger === 'click') {\n const targetIsPopover = event.target === popoverRef.current;\n const rootHasTarget = popoverRef.current?.contains(event.target as Element);\n\n if (!targetIsPopover && !rootHasTarget) {\n onToggle?.(!isOpen, event);\n }\n }\n },\n [trigger, isOpen, onToggle],\n );\n\n const onMouseEnter = useCallback<React.MouseEventHandler>(\n (event) => {\n if (trigger === 'hover') {\n onToggle?.(true, event);\n }\n },\n [trigger, onToggle],\n );\n\n const onMouseLeave = useCallback<React.MouseEventHandler>(\n (event) => {\n if (trigger === 'hover') {\n onToggle?.(false, event);\n }\n },\n [trigger, onToggle],\n );\n\n const onFocus = useCallback<React.FocusEventHandler>(\n (event) => {\n if (trigger === 'hover') {\n onToggle?.(true, event);\n }\n },\n [trigger, onToggle],\n );\n\n const onBlur = useCallback<React.FocusEventHandler>(\n (event) => {\n if (trigger === 'hover') {\n onToggle?.(false, event);\n }\n },\n [trigger, onToggle],\n );\n\n useEffect(() => {\n document.addEventListener('click', onDocumentClick);\n return () => document.removeEventListener('click', onDocumentClick);\n }, [isOpen, onToggle]);\n\n useEffect(() => {\n window.addEventListener('keydown', onEscape);\n return () => window.removeEventListener('keydown', onEscape);\n }, [closeOnEsc, isOpen, onToggle]);\n\n useEffect(() => {\n let portal = document.getElementById(POPOVER_PORTAL_ID);\n\n if (typeof frame !== 'string' && frame && frame.current) {\n portal = frame.current;\n }\n\n if (!usePortal) {\n portal = rootRef.current;\n }\n\n if (!portal) {\n portal = document.createElement('div');\n portal.setAttribute('id', POPOVER_PORTAL_ID);\n\n if (typeof frame === 'string' && frame !== 'document') {\n document.getElementById(frame)?.appendChild(portal);\n } else {\n document.body.appendChild(portal);\n }\n }\n\n portalRef.current = portal;\n\n /**\n * Изменение стейта нужно для того, чтобы Popup\n * отобразился после записи DOM элемента в portalRef.current\n */\n forceRender(true);\n }, []);\n\n useEffect(() => {\n if (!isOpen || !forceUpdate) {\n return;\n }\n\n /*\n * INFO: Метод forceUpdate содержит в себе flushSync и приводит\n * к повторному рендеру компонента, который уже находится в процессе рендера.\n * Данный хак, нужен для того, чтобы это поведение избежать и перенаправить\n * вызов метода в очередь микрозадач.\n */\n Promise.resolve().then(forceUpdate);\n }, [isOpen, children, forceUpdate]);\n\n return (\n <StyledWrapper className={classes.wrapper} onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}>\n <StyledRoot\n ref={handleRef}\n onClick={onClick}\n onFocus={onFocus}\n onBlur={onBlur}\n className={cx(className, classes.target)}\n >\n {target}\n </StyledRoot>\n {children &&\n portalRef.current &&\n ReactDOM.createPortal(\n <Root view={view} className={className} {...rest}>\n <StyledPopover\n {...attributes.popper}\n className={classes.root}\n ref={popoverForkRef}\n style={{\n ...styles.popper,\n ...{ display: isOpen ? 'block' : 'none' },\n ...initialStyles,\n }}\n zIndex={zIndex}\n >\n {hasArrow && (\n <StyledArrow\n className={classes.arrow}\n ref={setArrowElement}\n style={styles.arrow}\n {...attributes.arrow}\n />\n )}\n {children}\n </StyledPopover>\n </Root>,\n portalRef.current,\n )}\n </StyledWrapper>\n );\n },\n );\n\nexport const popoverConfig = {\n name: 'Popover',\n tag: 'div',\n layout: popoverRoot,\n base: '',\n variations: {\n view: {\n css: viewCSS,\n },\n },\n defaults: {\n view: 'default',\n },\n};\n"],"names":["ESCAPE_KEYCODE","POPOVER_PORTAL_ID","popoverRoot","Root","forwardRef","_ref","outerRootRef","_placement$","target","children","isOpen","_ref$trigger","trigger","hasArrow","_ref$frame","frame","className","_ref$placement","placement","_ref$offset","offset","zIndex","_ref$isFocusTrapped","isFocusTrapped","_ref$closeOnEsc","closeOnEsc","_ref$preventOverflow","preventOverflow","_ref$usePortal","usePortal","view","onToggle","closeOnOverlayClick","rest","_objectWithoutProperties","_excluded","rootRef","useRef","popoverRef","handleRef","useForkRef","portalRef","trapRef","useFocusTrap","popoverForkRef","_useState","useState","_useState2","_slicedToArray","arrowElement","setArrowElement","_useState3","_useState4","forceRender","isAutoArray","Array","isArray","isAuto","startsWith","initialStyles","visibility","opacity","_usePopper","usePopper","current","endsWith","modifiers","name","options","mainAxis","enabled","allowedAutoPlacements","element","styles","attributes","forceUpdate","onEscape","useCallback","event","keyCode","onDocumentClick","_rootRef$current","targetIsRoot","rootHasTarget","contains","onClick","_popoverRef$current","targetIsPopover","onMouseEnter","onMouseLeave","onFocus","onBlur","useEffect","document","addEventListener","removeEventListener","window","portal","getElementById","createElement","setAttribute","_document$getElementB","appendChild","body","Promise","resolve","then","React","StyledWrapper","classes","wrapper","StyledRoot","ref","cx","ReactDOM","createPortal","_extends","StyledPopover","popper","root","style","_objectSpread","display","StyledArrow","arrow","popoverConfig","tag","layout","base","variations","css","viewCSS","defaults"],"mappings":";;;;;;;;;;;AAcO,IAAMA,cAAc,GAAG,GAAE;AACzB,IAAMC,iBAAiB,GAAG,sBAAqB;;AAEtD;AACA;AACA;AACA;IACaC,WAAW,GAAG,SAAdA,WAAWA,CAAIC,IAA6C,EAAA;AAAA,EAAA,oBACrEC,UAAU,CACN,UAAAC,IAAA,EAqBIC,YAAY,EACX;AAAA,IAAA,IAAAC,WAAA,CAAA;AAAA,IAAA,IApBGC,MAAM,GAAAH,IAAA,CAANG,MAAM;MACNC,QAAQ,GAAAJ,IAAA,CAARI,QAAQ;MACRC,MAAM,GAAAL,IAAA,CAANK,MAAM;MAAAC,YAAA,GAAAN,IAAA,CACNO,OAAO;AAAPA,MAAAA,OAAO,GAAAD,YAAA,KAAG,KAAA,CAAA,GAAA,OAAO,GAAAA,YAAA;MACjBE,QAAQ,GAAAR,IAAA,CAARQ,QAAQ;MAAAC,UAAA,GAAAT,IAAA,CACRU,KAAK;AAALA,MAAAA,KAAK,GAAAD,UAAA,KAAG,KAAA,CAAA,GAAA,UAAU,GAAAA,UAAA;MAClBE,SAAS,GAAAX,IAAA,CAATW,SAAS;MAAAC,cAAA,GAAAZ,IAAA,CACTa,SAAS;AAATA,MAAAA,SAAS,GAAAD,cAAA,KAAG,KAAA,CAAA,GAAA,MAAM,GAAAA,cAAA;MAAAE,WAAA,GAAAd,IAAA,CAClBe,MAAM;MAANA,MAAM,GAAAD,WAAA,KAAG,KAAA,CAAA,GAAA,CAAC,CAAC,EAAE,CAAC,CAAC,GAAAA,WAAA;MACfE,MAAM,GAAAhB,IAAA,CAANgB,MAAM;MAAAC,mBAAA,GAAAjB,IAAA,CACNkB,cAAc;AAAdA,MAAAA,cAAc,GAAAD,mBAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,mBAAA;MAAAE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E,cAAe;MACpB4E,KAAK,EAAAC,cAAA,CAAAA,cAAA,CAAAA,cAAA,CACEhD,EAAAA,EAAAA,MAAM,CAAC6C,MAAM,CACb,EAAA;AAAEI,QAAAA,OAAO,EAAEhH,MAAM,GAAG,OAAO,GAAG,MAAA;OAAQ,CAAA,EACtCiD,aAAa,CAClB;AACFtC,MAAAA,MAAM,EAAEA,MAAAA;KAEPR,CAAAA,EAAAA,QAAQ,iBACL8F,KAAA,CAAAR,aAAA,CAACwB,WAAW,EAAAP,QAAA,CAAA;MACRpG,SAAS,EAAE6F,OAAO,CAACe,KAAM;AACzBZ,MAAAA,GAAG,EAAE9D,eAAgB;MACrBsE,KAAK,EAAE/C,MAAM,CAACmD,KAAAA;AAAM,KAAA,EAChBlD,UAAU,CAACkD,KAAK,CACvB,CACJ,EACAnH,QACU,CACb,CAAC,EACPgC,SAAS,CAACuB,OACd,CACO,CAAC,CAAA;AAExB,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAM6D,aAAa,GAAG;AACzB1D,EAAAA,IAAI,EAAE,SAAS;AACf2D,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE7H,WAAW;AACnB8H,EAAAA,IAAI,EAAE,EAAE;AACRC,EAAAA,UAAU,EAAE;AACRnG,IAAAA,IAAI,EAAE;AACFoG,MAAAA,GAAG,EAAEC,IAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNtG,IAAAA,IAAI,EAAE,SAAA;AACV,GAAA;AACJ;;;;"}
@@ -119,7 +119,7 @@ var popupRoot = function popupRoot(Root) {
119
119
  portal.style.width = '0';
120
120
  if (typeof frame === 'string' && frame !== 'document') {
121
121
  var _document$getElementB;
122
- (_document$getElementB = document.getElementById(frame)) === null || _document$getElementB === void 0 || _document$getElementB.appendChild(portal);
122
+ (_document$getElementB = document.getElementById(frame)) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.appendChild(portal);
123
123
  } else {
124
124
  document.body.appendChild(portal);
125
125
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Popup.js","sources":["../../../src/components/Popup/Popup.tsx"],"sourcesContent":["import React, { forwardRef, useEffect, useRef, useState } from 'react';\nimport ReactDOM from 'react-dom';\nimport { useForkRef, safeUseId } from '@salutejs/plasma-core';\n\nimport { RootProps } from '../../engines/types';\nimport { cx } from '../../utils';\n\nimport type { PopupPlacementBasic, PopupPlacement, PopupPositionType, PopupProps } from './Popup.types';\nimport { POPUP_PORTAL_ID } from './PopupContext';\nimport { PopupRoot } from './PopupRoot';\nimport { usePopup } from './hooks';\nimport { classes } from './Popup.tokens';\n\nexport const handlePosition = (\n placement: PopupPlacement,\n offset: [number, number] | [string, string],\n): PopupPositionType => {\n let x = '0rem';\n let y = '0rem';\n\n if (offset) {\n const [_x, _y] = offset;\n x = typeof _x === 'number' ? `${_x}rem` : _x;\n y = typeof _y === 'number' ? `${_y}rem` : _y;\n }\n\n if (!placement || placement === 'center') {\n return {\n left: `calc(50% + ${x})`,\n top: `calc(50% - ${y})`,\n transform: 'translate(-50%, -50%)',\n };\n }\n\n let left;\n let right;\n let top;\n let bottom;\n let transform;\n const placements = placement.split('-') as PopupPlacementBasic[];\n\n placements.forEach((placement: PopupPlacementBasic) => {\n switch (placement) {\n case 'left':\n left = x;\n break;\n case 'right':\n right = x;\n break;\n case 'top':\n top = y;\n break;\n case 'bottom':\n bottom = y;\n break;\n default:\n break;\n }\n });\n\n const isCenteredX = left === undefined && right === undefined;\n const isCenteredY = top === undefined && bottom === undefined;\n\n if (isCenteredX) {\n transform = 'translateX(-50%)';\n }\n\n if (isCenteredY) {\n transform = 'translateY(-50%)';\n }\n\n return {\n left: isCenteredX ? `calc(50% + ${x})` : left,\n right,\n top: isCenteredY ? `calc(50% - ${y})` : top,\n bottom,\n transform,\n };\n};\n\n/**\n * Базовый копмонент Popup.\n */\nexport const popupRoot = (Root: RootProps<HTMLDivElement, PopupProps>) =>\n forwardRef<HTMLDivElement, PopupProps>(\n (\n {\n id,\n isOpen = false,\n placement = 'center',\n offset = [0, 0],\n frame = 'document',\n children,\n overlay,\n role,\n zIndex,\n popupInfo,\n withAnimation = false,\n className,\n ...rest\n },\n outerRootRef,\n ) => {\n const uniqId = safeUseId();\n const innerId = id || uniqId;\n\n const { isVisible, animationInfo, setVisible } = usePopup({\n isOpen,\n id: innerId,\n popupInfo,\n withAnimation,\n });\n\n const portalRef = useRef<HTMLElement | null>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n\n const innerRef = useForkRef<HTMLDivElement>(contentRef, outerRootRef);\n\n const [, forceRender] = useState(false);\n\n useEffect(() => {\n let portal = document.getElementById(POPUP_PORTAL_ID);\n\n if (typeof frame !== 'string' && frame && frame.current) {\n portal = frame.current;\n }\n\n if (!portal) {\n portal = document.createElement('div');\n portal.setAttribute('id', POPUP_PORTAL_ID);\n /**\n * Нужно для того, чтобы во фрейме не происходило скачков контента\n * при анимации через transform, если есть элемент с шириной/высотой в 100% (Overlay)\n */\n portal.style.width = '0';\n\n if (typeof frame === 'string' && frame !== 'document') {\n document.getElementById(frame)?.appendChild(portal);\n } else {\n document.body.appendChild(portal);\n }\n }\n\n portalRef.current = portal;\n\n /**\n * Изменение стейта нужно для того, чтобы Popup\n * отобразился после записи DOM элемента в portalRef.current\n */\n forceRender(true);\n }, []);\n\n if (!isVisible && !isOpen) {\n return null;\n }\n\n const cls = cx(\n className,\n animationInfo?.endAnimation ? classes.endAnimation : '',\n animationInfo?.endTransition ? classes.endTransition : '',\n );\n\n return (\n <>\n {portalRef.current &&\n ReactDOM.createPortal(\n <Root className={cls} {...rest}>\n {overlay}\n <PopupRoot\n id={innerId}\n ref={innerRef}\n position={handlePosition(placement, offset)}\n frame={frame}\n zIndex={zIndex}\n animationInfo={animationInfo}\n setVisible={setVisible}\n >\n {children}\n </PopupRoot>\n </Root>,\n portalRef.current,\n )}\n </>\n );\n },\n );\n\nexport const popupConfig = {\n name: 'Popup',\n tag: 'div',\n layout: popupRoot,\n base: '',\n variations: {},\n defaults: {},\n};\n"],"names":["handlePosition","placement","offset","x","y","_offset","_slicedToArray","_x","_y","concat","left","top","transform","right","bottom","placements","split","forEach","isCenteredX","undefined","isCenteredY","popupRoot","Root","forwardRef","_ref","outerRootRef","id","_ref$isOpen","isOpen","_ref$placement","_ref$offset","_ref$frame","frame","children","overlay","zIndex","popupInfo","_ref$withAnimation","withAnimation","className","rest","_objectWithoutProperties","_excluded","uniqId","safeUseId","innerId","_usePopup","usePopup","isVisible","animationInfo","setVisible","portalRef","useRef","contentRef","innerRef","useForkRef","_useState","useState","_useState2","forceRender","useEffect","portal","document","getElementById","POPUP_PORTAL_ID","current","createElement","setAttribute","style","width","_document$getElementB","appendChild","body","cls","cx","endAnimation","classes","endTransition","React","Fragment","ReactDOM","createPortal","_extends","PopupRoot","ref","position","popupConfig","name","tag","layout","base","variations","defaults"],"mappings":";;;;;;;;;;;AAaO,IAAMA,cAAc,GAAG,SAAjBA,cAAcA,CACvBC,SAAyB,EACzBC,MAA2C,EACvB;EACpB,IAAIC,CAAC,GAAG,MAAM,CAAA;EACd,IAAIC,CAAC,GAAG,MAAM,CAAA;AAEd,EAAA,IAAIF,MAAM,EAAE;AACR,IAAA,IAAAG,OAAA,GAAAC,cAAA,CAAiBJ,MAAM,EAAA,CAAA,CAAA;AAAhBK,MAAAA,EAAE,GAAAF,OAAA,CAAA,CAAA,CAAA;AAAEG,MAAAA,EAAE,GAAAH,OAAA,CAAA,CAAA,CAAA,CAAA;IACbF,CAAC,GAAG,OAAOI,EAAE,KAAK,QAAQ,MAAAE,MAAA,CAAMF,EAAE,EAAA,KAAA,CAAA,GAAQA,EAAE,CAAA;IAC5CH,CAAC,GAAG,OAAOI,EAAE,KAAK,QAAQ,MAAAC,MAAA,CAAMD,EAAE,EAAA,KAAA,CAAA,GAAQA,EAAE,CAAA;AAChD,GAAA;AAEA,EAAA,IAAI,CAACP,SAAS,IAAIA,SAAS,KAAK,QAAQ,EAAE;IACtC,OAAO;AACHS,MAAA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AAA,CAAAY,KAAA,CAAAC,QAAA,EACK5B,IAAAA,EAAAA,SAAS,CAACc,OAAO,iBACde,QAAQ,CAACC,YAAY,eACjBH,KAAA,CAAAZ,aAAA,CAAC5C,IAAI,EAAA4D,QAAA,CAAA;AAAC3C,MAAAA,SAAS,EAAEkC,GAAAA;KAASjC,EAAAA,IAAI,GACzBN,OAAO,eACR4C,KAAA,CAAAZ,aAAA,CAACiB,SAAS,EAAA;AACNzD,MAAAA,EAAE,EAAEmB,OAAQ;AACZuC,MAAAA,GAAG,EAAE9B,QAAS;AACd+B,MAAAA,QAAQ,EAAErF,cAAc,CAACC,SAAS,EAAEC,MAAM,CAAE;AAC5C8B,MAAAA,KAAK,EAAEA,KAAM;AACbG,MAAAA,MAAM,EAAEA,MAAO;AACfc,MAAAA,aAAa,EAAEA,aAAc;AAC7BC,MAAAA,UAAU,EAAEA,UAAAA;KAEXjB,EAAAA,QACM,CACT,CAAC,EACPkB,SAAS,CAACc,OACd,CACN,CAAC,CAAA;AAEX,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMqB,WAAW,GAAG;AACvBC,EAAAA,IAAI,EAAE,OAAO;AACbC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAEpE,SAAS;AACjBqE,EAAAA,IAAI,EAAE,EAAE;EACRC,UAAU,EAAE,EAAE;AACdC,EAAAA,QAAQ,EAAE,EAAC;AACf;;;;"}
1
+ {"version":3,"file":"Popup.js","sources":["../../../src/components/Popup/Popup.tsx"],"sourcesContent":["import React, { forwardRef, useEffect, useRef, useState } from 'react';\nimport ReactDOM from 'react-dom';\nimport { useForkRef, safeUseId } from '@salutejs/plasma-core';\n\nimport { RootProps } from '../../engines/types';\nimport { cx } from '../../utils';\n\nimport type { PopupPlacementBasic, PopupPlacement, PopupPositionType, PopupProps } from './Popup.types';\nimport { POPUP_PORTAL_ID } from './PopupContext';\nimport { PopupRoot } from './PopupRoot';\nimport { usePopup } from './hooks';\nimport { classes } from './Popup.tokens';\n\nexport const handlePosition = (\n placement: PopupPlacement,\n offset: [number, number] | [string, string],\n): PopupPositionType => {\n let x = '0rem';\n let y = '0rem';\n\n if (offset) {\n const [_x, _y] = offset;\n x = typeof _x === 'number' ? `${_x}rem` : _x;\n y = typeof _y === 'number' ? `${_y}rem` : _y;\n }\n\n if (!placement || placement === 'center') {\n return {\n left: `calc(50% + ${x})`,\n top: `calc(50% - ${y})`,\n transform: 'translate(-50%, -50%)',\n };\n }\n\n let left;\n let right;\n let top;\n let bottom;\n let transform;\n const placements = placement.split('-') as PopupPlacementBasic[];\n\n placements.forEach((placement: PopupPlacementBasic) => {\n switch (placement) {\n case 'left':\n left = x;\n break;\n case 'right':\n right = x;\n break;\n case 'top':\n top = y;\n break;\n case 'bottom':\n bottom = y;\n break;\n default:\n break;\n }\n });\n\n const isCenteredX = left === undefined && right === undefined;\n const isCenteredY = top === undefined && bottom === undefined;\n\n if (isCenteredX) {\n transform = 'translateX(-50%)';\n }\n\n if (isCenteredY) {\n transform = 'translateY(-50%)';\n }\n\n return {\n left: isCenteredX ? `calc(50% + ${x})` : left,\n right,\n top: isCenteredY ? `calc(50% - ${y})` : top,\n bottom,\n transform,\n };\n};\n\n/**\n * Базовый копмонент Popup.\n */\nexport const popupRoot = (Root: RootProps<HTMLDivElement, PopupProps>) =>\n forwardRef<HTMLDivElement, PopupProps>(\n (\n {\n id,\n isOpen = false,\n placement = 'center',\n offset = [0, 0],\n frame = 'document',\n children,\n overlay,\n role,\n zIndex,\n popupInfo,\n withAnimation = false,\n className,\n ...rest\n },\n outerRootRef,\n ) => {\n const uniqId = safeUseId();\n const innerId = id || uniqId;\n\n const { isVisible, animationInfo, setVisible } = usePopup({\n isOpen,\n id: innerId,\n popupInfo,\n withAnimation,\n });\n\n const portalRef = useRef<HTMLElement | null>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n\n const innerRef = useForkRef<HTMLDivElement>(contentRef, outerRootRef);\n\n const [, forceRender] = useState(false);\n\n useEffect(() => {\n let portal = document.getElementById(POPUP_PORTAL_ID);\n\n if (typeof frame !== 'string' && frame && frame.current) {\n portal = frame.current;\n }\n\n if (!portal) {\n portal = document.createElement('div');\n portal.setAttribute('id', POPUP_PORTAL_ID);\n /**\n * Нужно для того, чтобы во фрейме не происходило скачков контента\n * при анимации через transform, если есть элемент с шириной/высотой в 100% (Overlay)\n */\n portal.style.width = '0';\n\n if (typeof frame === 'string' && frame !== 'document') {\n document.getElementById(frame)?.appendChild(portal);\n } else {\n document.body.appendChild(portal);\n }\n }\n\n portalRef.current = portal;\n\n /**\n * Изменение стейта нужно для того, чтобы Popup\n * отобразился после записи DOM элемента в portalRef.current\n */\n forceRender(true);\n }, []);\n\n if (!isVisible && !isOpen) {\n return null;\n }\n\n const cls = cx(\n className,\n animationInfo?.endAnimation ? classes.endAnimation : '',\n animationInfo?.endTransition ? classes.endTransition : '',\n );\n\n return (\n <>\n {portalRef.current &&\n ReactDOM.createPortal(\n <Root className={cls} {...rest}>\n {overlay}\n <PopupRoot\n id={innerId}\n ref={innerRef}\n position={handlePosition(placement, offset)}\n frame={frame}\n zIndex={zIndex}\n animationInfo={animationInfo}\n setVisible={setVisible}\n >\n {children}\n </PopupRoot>\n </Root>,\n portalRef.current,\n )}\n </>\n );\n },\n );\n\nexport const popupConfig = {\n name: 'Popup',\n tag: 'div',\n layout: popupRoot,\n base: '',\n variations: {},\n defaults: {},\n};\n"],"names":["handlePosition","placement","offset","x","y","_offset","_slicedToArray","_x","_y","concat","left","top","transform","right","bottom","placements","split","forEach","isCenteredX","undefined","isCenteredY","popupRoot","Root","forwardRef","_ref","outerRootRef","id","_ref$isOpen","isOpen","_ref$placement","_ref$offset","_ref$frame","frame","children","overlay","zIndex","popupInfo","_ref$withAnimation","withAnimation","className","rest","_objectWithoutProperties","_excluded","uniqId","safeUseId","innerId","_usePopup","usePopup","isVisible","animationInfo","setVisible","portalRef","useRef","contentRef","innerRef","useForkRef","_useState","useState","_useState2","forceRender","useEffect","portal","document","getElementById","POPUP_PORTAL_ID","current","createElement","setAttribute","style","width","_document$getElementB","appendChild","body","cls","cx","endAnimation","classes","endTransition","React","Fragment","ReactDOM","createPortal","_extends","PopupRoot","ref","position","popupConfig","name","tag","layout","base","variations","defaults"],"mappings":";;;;;;;;;;;AAaO,IAAMA,cAAc,GAAG,SAAjBA,cAAcA,CACvBC,SAAyB,EACzBC,MAA2C,EACvB;EACpB,IAAIC,CAAC,GAAG,MAAM,CAAA;EACd,IAAIC,CAAC,GAAG,MAAM,CAAA;AAEd,EAAA,IAAIF,MAAM,EAAE;AACR,IAAA,IAAAG,OAAA,GAAAC,cAAA,CAAiBJ,MAAM,EAAA,CAAA,CAAA;AAAhBK,MAAAA,EAAE,GAAAF,OAAA,CAAA,CAAA,CAAA;AAAEG,MAAAA,EAAE,GAAAH,OAAA,CAAA,CAAA,CAAA,CAAA;IACbF,CAAC,GAAG,OAAOI,EAAE,KAAK,QAAQ,MAAAE,MAAA,CAAMF,EAAE,EAAA,KAAA,CAAA,GAAQA,EAAE,CAAA;IAC5CH,CAAC,GAAG,OAAOI,EAAE,KAAK,QAAQ,MAAAC,MAAA,CAAMD,EAAE,EAAA,KAAA,CAAA,GAAQA,EAAE,CAAA;AAChD,GAAA;AAEA,EAAA,IAAI,CAACP,SAAS,IAAIA,SAAS,KAAK,QAAQ,EAAE;IACtC,OAAO;AACHS,MAAAA,IAAI,EAAAD,aAAAA,CAAAA,MAAA,CAAgBN,CAAC,EAAG,GAAA,CAAA;AACxBQ,MAAAA,GAAG,EAAAF,aAAAA,CAAAA,MAAA,CAAgBL,CAAC,EAAG,GAAA,CAAA;AACvBQ,MAAAA,SAAS,EAAE,uBAAA;KACd,CAAA;AACL,GAAA;AAEA,EAAA,IAAIF,IAAI,CAAA;AACR,EAAA,IAAIG,KAAK,CAAA;AACT,EAAA,IAAIF,GAAG,CAAA;AACP,EAAA,IAAIG,MAAM,CAAA;AACV,EAAA,IAAIF,SAAS,CAAA;AACb,EAAA,IAAMG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F,cAAc,CAACC,SAAS,EAAEC,MAAM,CAAE;AAC5C8B,MAAAA,KAAK,EAAEA,KAAM;AACbG,MAAAA,MAAM,EAAEA,MAAO;AACfc,MAAAA,aAAa,EAAEA,aAAc;AAC7BC,MAAAA,UAAU,EAAEA,UAAAA;KAEXjB,EAAAA,QACM,CACT,CAAC,EACPkB,SAAS,CAACc,OACd,CACN,CAAC,CAAA;AAEX,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMqB,WAAW,GAAG;AACvBC,EAAAA,IAAI,EAAE,OAAO;AACbC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAEpE,SAAS;AACjBqE,EAAAA,IAAI,EAAE,EAAE;EACRC,UAAU,EAAE,EAAE;AACdC,EAAAA,QAAQ,EAAE,EAAC;AACf;;;;"}
@@ -41,8 +41,8 @@ var segmentItemRoot = function segmentItemRoot(Root) {
41
41
  if (disabledGroup) {
42
42
  return;
43
43
  }
44
- customHandleSelect === null || customHandleSelect === void 0 || customHandleSelect(event);
45
- handleSelect === null || handleSelect === void 0 || handleSelect(value || ariaLabelDefault);
44
+ customHandleSelect === null || customHandleSelect === void 0 ? void 0 : customHandleSelect(event);
45
+ handleSelect === null || handleSelect === void 0 ? void 0 : handleSelect(value || ariaLabelDefault);
46
46
  }, [selectionMode]);
47
47
  return /*#__PURE__*/React.createElement(Root, _extends({
48
48
  view: view,
@@ -1 +1 @@
1
- {"version":3,"file":"SegmentItem.js","sources":["../../../../../src/components/Segment/ui/SegmentItem/SegmentItem.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useMemo } from 'react';\nimport type { MouseEvent } from 'react';\nimport { safeUseId } from '@salutejs/plasma-core';\n\nimport type { RootProps } from '../../../../engines/types';\nimport { cx, extractTextFrom } from '../../../../utils';\nimport { classes } from '../../tokens';\nimport { useSegmentInner } from '../../SegmentProvider/SegmentProvider';\n\nimport { base as sizeCSS } from './variations/_size/base';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as disabledCSS } from './variations/_disabled/base';\nimport { base as pilledCSS } from './variations/_pilled/base';\nimport type { SegmentItemProps } from './SegmentItem.types';\nimport { StyledContent, base } from './SegmentItem.styles';\n\nexport const segmentItemRoot = (Root: RootProps<HTMLLabelElement, SegmentItemProps>) =>\n forwardRef<HTMLLabelElement, SegmentItemProps>((props, outerRef) => {\n const {\n size,\n view,\n id,\n label,\n value,\n pilled,\n customHandleSelect,\n 'aria-label': ariaLabelExternal,\n ...rest\n } = props;\n const { selectionMode, disabledGroup, handleSelect, selectedSegmentItems } = useSegmentInner();\n\n const uniqId = safeUseId();\n const segmentId = id || `label-${uniqId}`;\n\n const ariaLabelDefault = useMemo(() => extractTextFrom(label), [label]);\n const pilledAttr = view !== 'clear' && pilled;\n const pilledClass = pilledAttr ? classes.segmentPilled : undefined;\n\n const isSelected = selectedSegmentItems?.includes(value || ariaLabelDefault);\n const selectedClass = isSelected ? classes.selectedSegmentItem : undefined;\n\n const handleSelectSegment = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n if (disabledGroup) {\n return;\n }\n\n customHandleSelect?.(event);\n handleSelect?.(value || ariaLabelDefault);\n },\n [selectionMode],\n );\n\n return (\n <Root\n view={view}\n size={size}\n id={segmentId}\n ref={outerRef}\n aria-label={ariaLabelExternal || ariaLabelDefault}\n value={value}\n pilled={pilledAttr}\n className={cx(selectedClass, pilledClass)}\n onClick={handleSelectSegment}\n tabIndex={disabledGroup ? -1 : 0}\n disabled={disabledGroup}\n {...rest}\n >\n <StyledContent>{label || value}</StyledContent>\n </Root>\n );\n });\n\nexport const segmentItemConfig = {\n name: 'SegmentItem',\n tag: 'button',\n layout: segmentItemRoot,\n base,\n variations: {\n size: {\n css: sizeCSS,\n },\n view: {\n css: viewCSS,\n },\n disabled: {\n css: disabledCSS,\n attrs: true,\n },\n pilled: {\n css: pilledCSS,\n attrs: true,\n },\n },\n defaults: {\n view: 'clear',\n size: 'xs',\n },\n};\n"],"names":["segmentItemRoot","Root","forwardRef","props","outerRef","size","view","id","label","value","pilled","customHandleSelect","ariaLabelExternal","rest","_objectWithoutProperties","_excluded","_useSegmentInner","useSegmentInner","selectionMode","disabledGroup","handleSelect","selectedSegmentItems","uniqId","safeUseId","segmentId","concat","ariaLabelDefault","useMemo","extractTextFrom","pilledAttr","pilledClass","classes","segmentPilled","undefined","isSelected","includes","selectedClass","selectedSegmentItem","handleSelectSegment","useCallback","event","React","createElement","_extends","ref","className","cx","onClick","tabIndex","disabled","StyledContent","segmentItemConfig","name","tag","layout","base","variations","css","sizeCSS","viewCSS","disabledCSS","attrs","pilledCSS","defaults"],"mappings":";;;;;;;;;;;;;;IAgBaA,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,IAAmD,EAAA;AAAA,EAAA,oBAC/EC,UAAU,CAAqC,UAACC,KAAK,EAAEC,QAAQ,EAAK;AAChE,IAAA,IACIC,IAAI,GASJF,KAAK,CATLE,IAAI;MACJC,IAAI,GAQJH,KAAK,CARLG,IAAI;MACJC,EAAE,GAOFJ,KAAK,CAPLI,EAAE;MACFC,KAAK,GAMLL,KAAK,CANLK,KAAK;MACLC,KAAK,GAKLN,KAAK,CALLM,KAAK;MACLC,MAAM,GAINP,KAAK,CAJLO,MAAM;MACNC,kBAAkB,GAGlBR,KAAK,CAHLQ,kBAAkB;MACJC,iBAAiB,GAE/BT,KAAK,CAFL,YAAY,CAAA;AACTU,MAAAA,IAAI,GAAAC,wBAAA,CACPX,KAAK,EAAAY,SAAA,CAAA,CAAA;AACT,IAAA,IAAAC,gBAAA,GAA6EC,eAAe,EAAE;MAAtFC,aAAa,GAAAF,gBAAA,CAAbE,aAAa;MAAEC,aAAa,GAAAH,gBAAA,CAAbG,aAAa;MAAEC,YAAY,GAAAJ,gBAAA,CAAZI,YAAY;MAAEC,oBAAoB,GAAAL,gBAAA,CAApBK,oBAAoB,CAAA;AAExE,IAAA,IAAMC,MAAM,GAAGC,SAAS,EAAE,CAAA;AAC1B,IAAA,IAAMC,SAAS,GAAGjB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AAiB;AAClDjB,MAAAA,KAAK,EAAEA,KAAM;AACbC,MAAAA,MAAM,EAAEmB,UAAW;AACnBgB,MAAAA,SAAS,EAAEC,EAAE,CAACV,aAAa,EAAEN,WAAW,CAAE;AAC1CiB,MAAAA,OAAO,EAAET,mBAAoB;AAC7BU,MAAAA,QAAQ,EAAE7B,aAAa,GAAG,CAAC,CAAC,GAAG,CAAE;AACjC8B,MAAAA,QAAQ,EAAE9B,aAAAA;AAAc,KAAA,EACpBN,IAAI,CAAA,eAER4B,KAAA,CAAAC,aAAA,CAACQ,aAAa,EAAA,IAAA,EAAE1C,KAAK,IAAIC,KAAqB,CAC5C,CAAC,CAAA;AAEf,GAAC,CAAC,CAAA;AAAA,EAAA;AAEC,IAAM0C,iBAAiB,GAAG;AAC7BC,EAAAA,IAAI,EAAE,aAAa;AACnBC,EAAAA,GAAG,EAAE,QAAQ;AACbC,EAAAA,MAAM,EAAEtD,eAAe;AACvBuD,EAAAA,IAAI,EAAJA,IAAI;AACJC,EAAAA,UAAU,EAAE;AACRnD,IAAAA,IAAI,EAAE;AACFoD,MAAAA,GAAG,EAAEC,MAAAA;KACR;AACDpD,IAAAA,IAAI,EAAE;AACFmD,MAAAA,GAAG,EAAEE,MAAAA;KACR;AACDV,IAAAA,QAAQ,EAAE;AACNQ,MAAAA,GAAG,EAAEG,MAAW;AAChBC,MAAAA,KAAK,EAAE,IAAA;KACV;AACDnD,IAAAA,MAAM,EAAE;AACJ+C,MAAAA,GAAG,EAAEK,MAAS;AACdD,MAAAA,KAAK,EAAE,IAAA;AACX,KAAA;GACH;AACDE,EAAAA,QAAQ,EAAE;AACNzD,IAAAA,IAAI,EAAE,OAAO;AACbD,IAAAA,IAAI,EAAE,IAAA;AACV,GAAA;AACJ;;;;"}
1
+ {"version":3,"file":"SegmentItem.js","sources":["../../../../../src/components/Segment/ui/SegmentItem/SegmentItem.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useMemo } from 'react';\nimport type { MouseEvent } from 'react';\nimport { safeUseId } from '@salutejs/plasma-core';\n\nimport type { RootProps } from '../../../../engines/types';\nimport { cx, extractTextFrom } from '../../../../utils';\nimport { classes } from '../../tokens';\nimport { useSegmentInner } from '../../SegmentProvider/SegmentProvider';\n\nimport { base as sizeCSS } from './variations/_size/base';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as disabledCSS } from './variations/_disabled/base';\nimport { base as pilledCSS } from './variations/_pilled/base';\nimport type { SegmentItemProps } from './SegmentItem.types';\nimport { StyledContent, base } from './SegmentItem.styles';\n\nexport const segmentItemRoot = (Root: RootProps<HTMLLabelElement, SegmentItemProps>) =>\n forwardRef<HTMLLabelElement, SegmentItemProps>((props, outerRef) => {\n const {\n size,\n view,\n id,\n label,\n value,\n pilled,\n customHandleSelect,\n 'aria-label': ariaLabelExternal,\n ...rest\n } = props;\n const { selectionMode, disabledGroup, handleSelect, selectedSegmentItems } = useSegmentInner();\n\n const uniqId = safeUseId();\n const segmentId = id || `label-${uniqId}`;\n\n const ariaLabelDefault = useMemo(() => extractTextFrom(label), [label]);\n const pilledAttr = view !== 'clear' && pilled;\n const pilledClass = pilledAttr ? classes.segmentPilled : undefined;\n\n const isSelected = selectedSegmentItems?.includes(value || ariaLabelDefault);\n const selectedClass = isSelected ? classes.selectedSegmentItem : undefined;\n\n const handleSelectSegment = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n if (disabledGroup) {\n return;\n }\n\n customHandleSelect?.(event);\n handleSelect?.(value || ariaLabelDefault);\n },\n [selectionMode],\n );\n\n return (\n <Root\n view={view}\n size={size}\n id={segmentId}\n ref={outerRef}\n aria-label={ariaLabelExternal || ariaLabelDefault}\n value={value}\n pilled={pilledAttr}\n className={cx(selectedClass, pilledClass)}\n onClick={handleSelectSegment}\n tabIndex={disabledGroup ? -1 : 0}\n disabled={disabledGroup}\n {...rest}\n >\n <StyledContent>{label || value}</StyledContent>\n </Root>\n );\n });\n\nexport const segmentItemConfig = {\n name: 'SegmentItem',\n tag: 'button',\n layout: segmentItemRoot,\n base,\n variations: {\n size: {\n css: sizeCSS,\n },\n view: {\n css: viewCSS,\n },\n disabled: {\n css: disabledCSS,\n attrs: true,\n },\n pilled: {\n css: pilledCSS,\n attrs: true,\n },\n },\n defaults: {\n view: 'clear',\n size: 'xs',\n },\n};\n"],"names":["segmentItemRoot","Root","forwardRef","props","outerRef","size","view","id","label","value","pilled","customHandleSelect","ariaLabelExternal","rest","_objectWithoutProperties","_excluded","_useSegmentInner","useSegmentInner","selectionMode","disabledGroup","handleSelect","selectedSegmentItems","uniqId","safeUseId","segmentId","concat","ariaLabelDefault","useMemo","extractTextFrom","pilledAttr","pilledClass","classes","segmentPilled","undefined","isSelected","includes","selectedClass","selectedSegmentItem","handleSelectSegment","useCallback","event","React","createElement","_extends","ref","className","cx","onClick","tabIndex","disabled","StyledContent","segmentItemConfig","name","tag","layout","base","variations","css","sizeCSS","viewCSS","disabledCSS","attrs","pilledCSS","defaults"],"mappings":";;;;;;;;;;;;;;IAgBaA,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,IAAmD,EAAA;AAAA,EAAA,oBAC/EC,UAAU,CAAqC,UAACC,KAAK,EAAEC,QAAQ,EAAK;AAChE,IAAA,IACIC,IAAI,GASJF,KAAK,CATLE,IAAI;MACJC,IAAI,GAQJH,KAAK,CARLG,IAAI;MACJC,EAAE,GAOFJ,KAAK,CAPLI,EAAE;MACFC,KAAK,GAMLL,KAAK,CANLK,KAAK;MACLC,KAAK,GAKLN,KAAK,CALLM,KAAK;MACLC,MAAM,GAINP,KAAK,CAJLO,MAAM;MACNC,kBAAkB,GAGlBR,KAAK,CAHLQ,kBAAkB;MACJC,iBAAiB,GAE/BT,KAAK,CAFL,YAAY,CAAA;AACTU,MAAAA,IAAI,GAAAC,wBAAA,CACPX,KAAK,EAAAY,SAAA,CAAA,CAAA;AACT,IAAA,IAAAC,gBAAA,GAA6EC,eAAe,EAAE;MAAtFC,aAAa,GAAAF,gBAAA,CAAbE,aAAa;MAAEC,a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DE,EAAAA,QAAQ,EAAE;AACNzD,IAAAA,IAAI,EAAE,OAAO;AACbD,IAAAA,IAAI,EAAE,IAAA;AACV,GAAA;AACJ;;;;"}
@@ -35,6 +35,8 @@
35
35
 
36
36
  .base_kgtz8x_b16hf96__46a206b1{--plasma_private-chip-outline-size:var(--plasma-chip-outline-size,0.125rem);position:relative;}.base_kgtz8x_b16hf96__46a206b1:focus{outline:none;}.base_kgtz8x_b16hf96__46a206b1::before{content:'';position:absolute;top:calc(-1 * var(--plasma_private-chip-outline-size));left:calc(-1 * var(--plasma_private-chip-outline-size));right:calc(-1 * var(--plasma_private-chip-outline-size));bottom:calc(-1 * var(--plasma_private-chip-outline-size));z-index:1;display:block;box-sizing:content-box;border:var(--plasma_private-chip-outline-size) solid transparent;border-radius:calc(var(--plasma-chip-border-radius) + var(--plasma_private-chip-outline-size));-webkit-transition:box-shadow 0.2s ease-in-out;transition:box-shadow 0.2s ease-in-out;pointer-events:none;}.base_kgtz8x_b16hf96__46a206b1.base_kgtz8x_focusVisible__46a206b1:focus::before,.base_kgtz8x_b16hf96__46a206b1[data-focus-visible-added]::before{outline:none;box-shadow:0 0 0 var(--plasma_private-chip-outline-size) var(--plasma-chip-focus-color);}
37
37
 
38
+ .base_3kce4h_bvcavwi__c6ad5ca5.base_3kce4h_chipPilled__c6ad5ca5{border-radius:var(--plasma-chip-pilled-border-radius);}
39
+
38
40
  .Chip_styles_1mwwhiw_bol5daj__07da4d18{position:relative;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;box-sizing:border-box;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;cursor:pointer;-webkit-tap-highlight-color:rgba(0,0,0,0);}
39
41
  .Chip_styles_1mwwhiw_sj20on5__07da4d18{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;margin-left:var(--plasma-chip-left-content-margin-left);margin-right:var(--plasma-chip-left-content-margin-right);}
40
42
  .Chip_styles_1mwwhiw_s1ror4o9__07da4d18{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
@@ -108,12 +108,12 @@ var selectRoot = function selectRoot(Root) {
108
108
  if (rest.valueType === 'multiple') {
109
109
  var _rest$onChangeValue;
110
110
  var _newSelected = getNewSelected(rest.value, newValue, rest.valueType);
111
- (_rest$onChangeValue = rest.onChangeValue) === null || _rest$onChangeValue === void 0 || _rest$onChangeValue.call(rest, _newSelected);
111
+ (_rest$onChangeValue = rest.onChangeValue) === null || _rest$onChangeValue === void 0 ? void 0 : _rest$onChangeValue.call(rest, _newSelected);
112
112
  return;
113
113
  }
114
114
  var newSelected = getNewSelected(rest.value, newValue, 'single');
115
- (_rest$onChangeValue2 = rest.onChangeValue) === null || _rest$onChangeValue2 === void 0 || _rest$onChangeValue2.call(rest, newSelected);
116
- onInnerToggle === null || onInnerToggle === void 0 || onInnerToggle(false, event);
115
+ (_rest$onChangeValue2 = rest.onChangeValue) === null || _rest$onChangeValue2 === void 0 ? void 0 : _rest$onChangeValue2.call(rest, newSelected);
116
+ onInnerToggle === null || onInnerToggle === void 0 ? void 0 : onInnerToggle(false, event);
117
117
  }, [rest.value, rest.valueType, rest.onChangeValue, onToggle, onInnerToggle]);
118
118
  var onClickChildrenItem = useCallback(function (event) {
119
119
  // INFO: Для корректной работы компонента Popper
@@ -128,14 +128,14 @@ var selectRoot = function selectRoot(Root) {
128
128
  }
129
129
  var newValue = event.target.value;
130
130
  var newSelected = getNewSelected(rest.value, newValue, 'native');
131
- (_rest$onChangeValue3 = rest.onChangeValue) === null || _rest$onChangeValue3 === void 0 || _rest$onChangeValue3.call(rest, newSelected);
131
+ (_rest$onChangeValue3 = rest.onChangeValue) === null || _rest$onChangeValue3 === void 0 ? void 0 : _rest$onChangeValue3.call(rest, newSelected);
132
132
  }, [rest.value, rest.valueType, rest.onChangeValue]);
133
133
  var onChangeChipValue = useCallback(function (newValue) {
134
134
  var _rest$onChangeValue4;
135
135
  if (rest.valueType !== 'multiple') {
136
136
  return;
137
137
  }
138
- (_rest$onChangeValue4 = rest.onChangeValue) === null || _rest$onChangeValue4 === void 0 || _rest$onChangeValue4.call(rest, newValue);
138
+ (_rest$onChangeValue4 = rest.onChangeValue) === null || _rest$onChangeValue4 === void 0 ? void 0 : _rest$onChangeValue4.call(rest, newValue);
139
139
  }, [rest.valueType]);
140
140
  var _useKeyNavigation = useKeyNavigation({
141
141
  controlledRefs: controlledRefs,
@@ -1 +1 @@
1
- {"version":3,"file":"Select.js","sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import React, { Children, forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { safeUseId, useForkRef } from '@salutejs/plasma-core';\n\nimport { RootProps } from '../../engines';\nimport { cx } from '../../utils';\nimport { getPlacements } from '../Dropdown/utils';\nimport { useDidMountEffect, useForceUpdate } from '../../hooks';\n\nimport { base as targetCSS } from './variations/_target/base';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { SelectTarget } from './ui';\nimport { getChildren, getNewSelected, getValues } from './utils';\nimport { classes } from './Select.tokens';\nimport { StyledNativeSelect, StyledPopover, StyledRoot, StyledSelect } from './Select.styles';\nimport type { SelectPrimitiveValue, SelectProps } from './Select.types';\nimport { useKeyNavigation } from './hooks';\n\n/**\n * Выпадающий список без внешнего контроля видимости.\n */\nexport const selectRoot = (Root: RootProps<HTMLSelectElement, SelectProps>) =>\n forwardRef<HTMLSelectElement, SelectProps>(\n (\n {\n name,\n form,\n readOnly,\n disabled,\n label,\n id,\n children,\n role,\n target,\n view,\n size,\n frame,\n usePortal,\n enumerationType = 'comma',\n opened = false,\n placement = 'bottom',\n onToggle,\n ...rest\n },\n outerRootRef,\n ) => {\n const forceUpdate = useForceUpdate();\n const uniqId = safeUseId();\n const innerId = id || uniqId;\n const { valueType = 'single', value } = rest;\n const offset = [0, 4] as [number, number];\n\n const [ref, setRef] = useState<HTMLSelectElement | null>(null);\n const rootRef = useRef<HTMLSelectElement | null>(null);\n const handleRef = useForkRef<HTMLSelectElement>(rootRef, outerRootRef);\n\n const targetRef = useRef<HTMLButtonElement>(null);\n const chipsRefs = useRef<Array<HTMLButtonElement>>([]);\n const selectRef = useRef<HTMLDivElement>(null);\n const itemsRefs = useRef<Array<HTMLDivElement>>([]);\n const controlledRefs = { targetRef, chipsRefs, selectRef, itemsRefs };\n\n const [innerOpened, setOpened] = useState(opened);\n\n // INFO: нужно высчитывать для корректной работы портала\n const dynamicTargetWidth = targetRef.current?.offsetWidth;\n const withNativeSelectVisible = valueType === 'native' ? classes.nativeSelectVisible : undefined;\n\n // INFO: Из-за того, что классы передаются через ref,\n // состояние пропсов после изменения view, size, target\n // всегда предыдущее, поэтому нужно делать форс-ререндер\n useDidMountEffect(() => {\n forceUpdate();\n }, [view, size, target]);\n\n useEffect(() => {\n if (disabled || readOnly) {\n return;\n }\n\n setOpened(opened);\n }, [opened, disabled, readOnly]);\n\n const onInnerToggle = useCallback(\n (openValue: boolean, event: React.SyntheticEvent | Event) => {\n if (disabled || readOnly) {\n return;\n }\n\n if (onToggle) {\n onToggle(openValue, event);\n return;\n }\n\n setOpened(openValue);\n },\n [disabled, readOnly, onToggle],\n );\n\n const updateValue = useCallback(\n (item: HTMLElement, event: React.SyntheticEvent | Event) => {\n const {\n dataset: { value: newValue },\n } = item;\n\n if (rest.valueType === 'multiple') {\n const newSelected = getNewSelected(rest.value, newValue, rest.valueType);\n rest.onChangeValue?.(newSelected);\n\n return;\n }\n\n const newSelected = getNewSelected(rest.value, newValue, 'single');\n\n rest.onChangeValue?.(newSelected);\n\n onInnerToggle?.(false, event);\n },\n [rest.value, rest.valueType, rest.onChangeValue, onToggle, onInnerToggle],\n );\n\n const onClickChildrenItem = useCallback(\n (event: React.MouseEvent<HTMLDivElement>) => {\n // INFO: Для корректной работы компонента Popper\n event.stopPropagation();\n\n const item = event.currentTarget as HTMLElement;\n\n updateValue(item, event);\n },\n [updateValue],\n );\n\n const onNativeSelectChange = useCallback(\n (event: React.ChangeEvent<HTMLSelectElement>) => {\n if (rest.valueType === 'multiple') {\n return;\n }\n\n const { value: newValue } = event.target;\n const newSelected = getNewSelected(rest.value, newValue, 'native');\n\n rest.onChangeValue?.(newSelected);\n },\n [rest.value, rest.valueType, rest.onChangeValue],\n );\n\n const onChangeChipValue = useCallback(\n (newValue?: Array<SelectPrimitiveValue>) => {\n if (rest.valueType !== 'multiple') {\n return;\n }\n\n rest.onChangeValue?.(newValue);\n },\n [rest.valueType],\n );\n\n const { onKeyDownTarget, onKeyDownSelect } = useKeyNavigation({\n controlledRefs,\n opened: innerOpened,\n enumerationType,\n valueType,\n value,\n updateOpened: onInnerToggle,\n updateValue,\n });\n\n const childrenArray = useMemo(() => Children.toArray(children), [children]) as React.ReactElement[];\n\n const childrenMemo = useMemo(\n () => getChildren(childrenArray, { onClick: onClickChildrenItem, childrenRefs: itemsRefs }, value),\n [childrenArray, value, innerOpened],\n );\n\n const values = useMemo(() => getValues(childrenArray, value), [childrenArray, value]);\n\n return (\n <StyledRoot ref={selectRef}>\n <StyledNativeSelect\n aria-invalid=\"false\"\n aria-hidden=\"true\"\n aria-readonly={readOnly}\n tabIndex={valueType === 'native' ? 0 : -1}\n form={form}\n name={name}\n ref={handleRef}\n value={`${value}`}\n disabled={disabled || readOnly}\n onChange={onNativeSelectChange}\n className={cx(ref?.classList.toString(), withNativeSelectVisible)}\n >\n {valueType === 'native' && childrenMemo}\n </StyledNativeSelect>\n <StyledPopover\n role={role}\n isOpen={innerOpened}\n onToggle={onInnerToggle}\n target={\n <SelectTarget\n tabIndex={valueType === 'native' ? -1 : 0}\n opened={innerOpened}\n target={target}\n values={values}\n label={label}\n enumerationType={enumerationType}\n readOnly={readOnly}\n disabled={disabled}\n size={size}\n ref={targetRef}\n chipsRefs={chipsRefs}\n id={innerId}\n onChange={onChangeChipValue}\n onKeyDown={onKeyDownTarget}\n />\n }\n className={cx(ref?.classList.toString())} // INFO: Прокидываем стили для Popover\n id={innerId}\n offset={offset}\n frame={frame}\n placement={getPlacements(placement)}\n trigger=\"click\"\n usePortal={usePortal}\n selectWidth={dynamicTargetWidth}\n isFocusTrapped={false}\n preventOverflow={false}\n closeOnEsc={false}\n closeOnOverlayClick\n >\n <Root ref={setRef} target={target} view={view} size={size} {...rest}>\n {valueType !== 'native' && (\n <StyledSelect onKeyDown={onKeyDownSelect}>{childrenMemo}</StyledSelect>\n )}\n </Root>\n </StyledPopover>\n </StyledRoot>\n );\n },\n );\n\nexport const selectConfig = {\n name: 'Select',\n tag: 'div',\n layout: selectRoot,\n base: '',\n variations: {\n target: {\n css: targetCSS,\n },\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n },\n defaults: {\n view: 'default',\n size: 'm',\n },\n};\n"],"names":["selectRoot","Root","forwardRef","_ref","outerRootRef","_targetRef$current","name","form","readOnly","disabled","label","id","children","role","target","view","size","frame","usePortal","_ref$enumerationType","enumerationType","_ref$opened","opened","_ref$placement","placement","onToggle","rest","_objectWithoutProperties","_excluded","forceUpdate","useForceUpdate","uniqId","safeUseId","innerId","_rest$valueType","valueType","value","offset","_useState","useState","_useState2","_slicedToArray","ref","setRef","rootRef","useRef","handleRef","useForkRef","targetRef","chipsRefs","selectRef","itemsRefs","controlledRefs","_useState3","_useState4","innerOpened","setOpened","dynamicTargetWidth","current","offsetWidth","withNativeSelectVisible","classes","nativeSelectVisible","undefined","useDidMountEffect","useEffect","onInnerToggle","useCallback","openValue","event","updateValue","item","_rest$onChangeValue2","newValue","dataset","_rest$onChangeValue","newSelected","getNewSelected","onChangeValue","call","onClickChildrenItem","stopPropagation","currentTarget","onNativeSelectChange","_rest$onChangeValue3","onChangeChipValue","_rest$onChangeValue4","_useKeyNavigation","useKeyNavigation","updateOpened","onKeyDownTarget","onKeyDownSelect","childrenArray","useMemo","Children","toArray","childrenMemo","getChildren","onClick","childrenRefs","values","getValues","React","createElement","StyledRoot","StyledNativeSelect","tabIndex","concat","onChange","className","cx","classList","toString","StyledPopover","isOpen","SelectTarget","onKeyDown","getPlacements","trigger","selectWidth","isFocusTrapped","preventOverflow","closeOnEsc","closeOnOverlayClick","_extends","StyledSelect","selectConfig","tag","layout","base","variations","css","targetCSS","viewCSS","sizeCSS","defaults"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAkBA;AACA;AACA;IACaA,UAAU,GAAG,SAAbA,UAAUA,CAAIC,IAA+C,EAAA;AAAA,EAAA,oBACtEC,UAAU,CACN,UAAAC,IAAA,EAqBIC,YAAY,EACX;AAAA,IAAA,IAAAC,kBAAA,CAAA;AAAA,IAAA,IApBGC,IAAI,GAAAH,IAAA,CAAJG,IAAI;MACJC,IAAI,GAAAJ,IAAA,CAAJI,IAAI;MACJC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;MACRC,QAAQ,GAAAN,IAAA,CAARM,QAAQ;MACRC,KAAK,GAAAP,IAAA,CAALO,KAAK;MACLC,EAAE,GAAAR,IAAA,CAAFQ,EAAE;MACFC,QAAQ,GAAAT,IAAA,CAARS,QAAQ;MACRC,IAAI,GAAAV,IAAA,CAAJU,IAAI;MACJC,MAAM,GAAAX,IAAA,CAANW,MAAM;MACNC,IAAI,GAAAZ,IAAA,CAAJY,IAAI;MACJC,IAAI,GAAAb,IAAA,CAAJa,IAAI;MACJC,KAAK,GAAAd,IAAA,CAALc,KAAK;MACLC,SAAS,GAAAf,IAAA,CAATe,SAAS;MAAAC,oBAAA,GAAAhB,IAAA,CACTiB,eAAe;AAAfA,MAAAA,eAAe,GAAAD,oBAAA,KAAG,KAAA,CAAA,GAAA,OAAO,GAAAA,oBAAA;MAAAE,WAAA,GAAAlB,IAAA,CACzBmB,MAAM;AAANA,MAAAA,MAAM,GAAAD,WAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,WAAA;MAAAE,cAAA,GAAApB,IAAA,CACdqB,SAAS;AAATA,MAAAA,SAAS,GAAAD,cAAA,KAAG,KAAA,CAAA,GAAA,Q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B,YAAY,GAAG;AACxBxH,EAAAA,IAAI,EAAE,QAAQ;AACdyH,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAEhI,UAAU;AAClBiI,EAAAA,IAAI,EAAE,EAAE;AACRC,EAAAA,UAAU,EAAE;AACRpH,IAAAA,MAAM,EAAE;AACJqH,MAAAA,GAAG,EAAEC,IAAAA;KACR;AACDrH,IAAAA,IAAI,EAAE;AACFoH,MAAAA,GAAG,EAAEE,MAAAA;KACR;AACDrH,IAAAA,IAAI,EAAE;AACFmH,MAAAA,GAAG,EAAEG,MAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNxH,IAAAA,IAAI,EAAE,SAAS;AACfC,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
1
+ {"version":3,"file":"Select.js","sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import React, { Children, forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { safeUseId, useForkRef } from '@salutejs/plasma-core';\n\nimport { RootProps } from '../../engines';\nimport { cx } from '../../utils';\nimport { getPlacements } from '../Dropdown/utils';\nimport { useDidMountEffect, useForceUpdate } from '../../hooks';\n\nimport { base as targetCSS } from './variations/_target/base';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { SelectTarget } from './ui';\nimport { getChildren, getNewSelected, getValues } from './utils';\nimport { classes } from './Select.tokens';\nimport { StyledNativeSelect, StyledPopover, StyledRoot, StyledSelect } from './Select.styles';\nimport type { SelectPrimitiveValue, SelectProps } from './Select.types';\nimport { useKeyNavigation } from './hooks';\n\n/**\n * Выпадающий список без внешнего контроля видимости.\n */\nexport const selectRoot = (Root: RootProps<HTMLSelectElement, SelectProps>) =>\n forwardRef<HTMLSelectElement, SelectProps>(\n (\n {\n name,\n form,\n readOnly,\n disabled,\n label,\n id,\n children,\n role,\n target,\n view,\n size,\n frame,\n usePortal,\n enumerationType = 'comma',\n opened = false,\n placement = 'bottom',\n onToggle,\n ...rest\n },\n outerRootRef,\n ) => {\n const forceUpdate = useForceUpdate();\n const uniqId = safeUseId();\n const innerId = id || uniqId;\n const { valueType = 'single', value } = rest;\n const offset = [0, 4] as [number, number];\n\n const [ref, setRef] = useState<HTMLSelectElement | null>(null);\n const rootRef = useRef<HTMLSelectElement | null>(null);\n const handleRef = useForkRef<HTMLSelectElement>(rootRef, outerRootRef);\n\n const targetRef = useRef<HTMLButtonElement>(null);\n const chipsRefs = useRef<Array<HTMLButtonElement>>([]);\n const selectRef = useRef<HTMLDivElement>(null);\n const itemsRefs = useRef<Array<HTMLDivElement>>([]);\n const controlledRefs = { targetRef, chipsRefs, selectRef, itemsRefs };\n\n const [innerOpened, setOpened] = useState(opened);\n\n // INFO: нужно высчитывать для корректной работы портала\n const dynamicTargetWidth = targetRef.current?.offsetWidth;\n const withNativeSelectVisible = valueType === 'native' ? classes.nativeSelectVisible : undefined;\n\n // INFO: Из-за того, что классы передаются через ref,\n // состояние пропсов после изменения view, size, target\n // всегда предыдущее, поэтому нужно делать форс-ререндер\n useDidMountEffect(() => {\n forceUpdate();\n }, [view, size, target]);\n\n useEffect(() => {\n if (disabled || readOnly) {\n return;\n }\n\n setOpened(opened);\n }, [opened, disabled, readOnly]);\n\n const onInnerToggle = useCallback(\n (openValue: boolean, event: React.SyntheticEvent | Event) => {\n if (disabled || readOnly) {\n return;\n }\n\n if (onToggle) {\n onToggle(openValue, event);\n return;\n }\n\n setOpened(openValue);\n },\n [disabled, readOnly, onToggle],\n );\n\n const updateValue = useCallback(\n (item: HTMLElement, event: React.SyntheticEvent | Event) => {\n const {\n dataset: { value: newValue },\n } = item;\n\n if (rest.valueType === 'multiple') {\n const newSelected = getNewSelected(rest.value, newValue, rest.valueType);\n rest.onChangeValue?.(newSelected);\n\n return;\n }\n\n const newSelected = getNewSelected(rest.value, newValue, 'single');\n\n rest.onChangeValue?.(newSelected);\n\n onInnerToggle?.(false, event);\n },\n [rest.value, rest.valueType, rest.onChangeValue, onToggle, onInnerToggle],\n );\n\n const onClickChildrenItem = useCallback(\n (event: React.MouseEvent<HTMLDivElement>) => {\n // INFO: Для корректной работы компонента Popper\n event.stopPropagation();\n\n const item = event.currentTarget as HTMLElement;\n\n updateValue(item, event);\n },\n [updateValue],\n );\n\n const onNativeSelectChange = useCallback(\n (event: React.ChangeEvent<HTMLSelectElement>) => {\n if (rest.valueType === 'multiple') {\n return;\n }\n\n const { value: newValue } = event.target;\n const newSelected = getNewSelected(rest.value, newValue, 'native');\n\n rest.onChangeValue?.(newSelected);\n },\n [rest.value, rest.valueType, rest.onChangeValue],\n );\n\n const onChangeChipValue = useCallback(\n (newValue?: Array<SelectPrimitiveValue>) => {\n if (rest.valueType !== 'multiple') {\n return;\n }\n\n rest.onChangeValue?.(newValue);\n },\n [rest.valueType],\n );\n\n const { onKeyDownTarget, onKeyDownSelect } = useKeyNavigation({\n controlledRefs,\n opened: innerOpened,\n enumerationType,\n valueType,\n value,\n updateOpened: onInnerToggle,\n updateValue,\n });\n\n const childrenArray = useMemo(() => Children.toArray(children), [children]) as React.ReactElement[];\n\n const childrenMemo = useMemo(\n () => getChildren(childrenArray, { onClick: onClickChildrenItem, childrenRefs: itemsRefs }, value),\n [childrenArray, value, innerOpened],\n );\n\n const values = useMemo(() => getValues(childrenArray, value), [childrenArray, value]);\n\n return (\n <StyledRoot ref={selectRef}>\n <StyledNativeSelect\n aria-invalid=\"false\"\n aria-hidden=\"true\"\n aria-readonly={readOnly}\n tabIndex={valueType === 'native' ? 0 : -1}\n form={form}\n name={name}\n ref={handleRef}\n value={`${value}`}\n disabled={disabled || readOnly}\n onChange={onNativeSelectChange}\n className={cx(ref?.classList.toString(), withNativeSelectVisible)}\n >\n {valueType === 'native' && childrenMemo}\n </StyledNativeSelect>\n <StyledPopover\n role={role}\n isOpen={innerOpened}\n onToggle={onInnerToggle}\n target={\n <SelectTarget\n tabIndex={valueType === 'native' ? -1 : 0}\n opened={innerOpened}\n target={target}\n values={values}\n label={label}\n enumerationType={enumerationType}\n readOnly={readOnly}\n disabled={disabled}\n size={size}\n ref={targetRef}\n chipsRefs={chipsRefs}\n id={innerId}\n onChange={onChangeChipValue}\n onKeyDown={onKeyDownTarget}\n />\n }\n className={cx(ref?.classList.toString())} // INFO: Прокидываем стили для Popover\n id={innerId}\n offset={offset}\n frame={frame}\n placement={getPlacements(placement)}\n trigger=\"click\"\n usePortal={usePortal}\n selectWidth={dynamicTargetWidth}\n isFocusTrapped={false}\n preventOverflow={false}\n closeOnEsc={false}\n closeOnOverlayClick\n >\n <Root ref={setRef} target={target} view={view} size={size} {...rest}>\n {valueType !== 'native' && (\n <StyledSelect onKeyDown={onKeyDownSelect}>{childrenMemo}</StyledSelect>\n )}\n </Root>\n </StyledPopover>\n </StyledRoot>\n );\n },\n );\n\nexport const selectConfig = {\n name: 'Select',\n tag: 'div',\n layout: selectRoot,\n base: '',\n variations: {\n target: {\n css: targetCSS,\n },\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n },\n defaults: {\n view: 'default',\n size: 'm',\n },\n};\n"],"names":["selectRoot","Root","forwardRef","_ref","outerRootRef","_targetRef$current","name","form","readOnly","disabled","label","id","children","role","target","view","size","frame","usePortal","_ref$enumerationType","enumerationType","_ref$opened","opened","_ref$placement","placement","onToggle","rest","_objectWithoutProperties","_excluded","forceUpdate","useForceUpdate","uniqId","safeUseId","innerId","_rest$valueType","valueType","value","offset","_useState","useState","_useState2","_slicedToArray","ref","setRef","rootRef","useRef","handleRef","useForkRef","targetRef","chipsRefs","selectRef","itemsRefs","controlledRefs","_useState3","_useState4","innerOpened","setOpened","dynamicTargetWidth","current","offsetWidth","withNativeSelectVisible","classes","nativeSelectVisible","undefined","useDidMountEffect","useEffect","onInnerToggle","useCallback","openValue","event","updateValue","item","_rest$onChangeValue2","newValue","dataset","_rest$onChangeValue","newSelected","getNewSelected","onChangeValue","call","onClickChildrenItem","stopPropagation","currentTarget","onNativeSelectChange","_rest$onChangeValue3","onChangeChipValue","_rest$onChangeValue4","_useKeyNavigation","useKeyNavigation","updateOpened","onKeyDownTarget","onKeyDownSelect","childrenArray","useMemo","Children","toArray","childrenMemo","getChildren","onClick","childrenRefs","values","getValues","React","createElement","StyledRoot","StyledNativeSelect","tabIndex","concat","onChange","className","cx","classList","toString","StyledPopover","isOpen","SelectTarget","onKeyDown","getPlacements","trigger","selectWidth","isFocusTrapped","preventOverflow","closeOnEsc","closeOnOverlayClick","_extends","StyledSelect","selectConfig","tag","layout","base","variations","css","targetCSS","viewCSS","sizeCSS","defaults"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAkBA;AACA;AACA;IACaA,UAAU,GAAG,SAAbA,UAAUA,CAAIC,IAA+C,EAAA;AAAA,EAAA,oBACtEC,UAAU,CACN,UAAAC,IAAA,EAqBIC,YAAY,EACX;AAAA,IAAA,IAAAC,kBAAA,CAAA;AAAA,IAAA,IApBGC,IAAI,GAAAH,IAAA,CAAJG,IAAI;MACJC,IAAI,GAAAJ,IAAA,CAAJI,IAAI;MACJC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;MACRC,QAAQ,GAAAN,IAAA,CAARM,QAAQ;MACRC,KAAK,GAAAP,IAAA,CAALO,KAAK;MACLC,EAAE,GAAAR,IAAA,CAAFQ,EAAE;MACFC,QAAQ,GAAAT,IAAA,CAARS,QAAQ;MACRC,IAAI,GAAAV,IAAA,CAAJU,IAAI;MACJC,MAAM,GAAAX,IAAA,CAANW,MAAM;MACNC,IAAI,GAAAZ,IAAA,CAAJY,IAAI;MACJC,IAAI,GAAAb,IAAA,CAAJa,IAAI;MACJC,KAAK,GAAAd,IAAA,CAALc,KAAK;MACLC,SAAS,GAAAf,IAAA,CAATe,SAAS;MAAAC,oBAAA,GAAAhB,IAAA,CACTiB,eAAe;AAAfA,MAAAA,eAAe,GAAAD,oBAAA,KAAG,KAAA,CAAA,GAAA,OAAO,GAAAA,oBAAA;MAAAE,WAAA,GAAAlB,IAAA,CACz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AI,EAAEA,IAAK;AAACC,MAAAA,IAAI,EAAEA,IAAAA;KAAUU,EAAAA,IAAI,CAC9DS,EAAAA,SAAS,KAAK,QAAQ,iBACnBmE,KAAA,CAAAC,aAAA,CAACsB,YAAY,EAAA;AAACT,MAAAA,SAAS,EAAEzB,eAAAA;AAAgB,KAAA,EAAEK,YAA2B,CAExE,CACK,CACP,CAAC,CAAA;AAErB,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAM8B,YAAY,GAAG;AACxBxH,EAAAA,IAAI,EAAE,QAAQ;AACdyH,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAEhI,UAAU;AAClBiI,EAAAA,IAAI,EAAE,EAAE;AACRC,EAAAA,UAAU,EAAE;AACRpH,IAAAA,MAAM,EAAE;AACJqH,MAAAA,GAAG,EAAEC,IAAAA;KACR;AACDrH,IAAAA,IAAI,EAAE;AACFoH,MAAAA,GAAG,EAAEE,MAAAA;KACR;AACDrH,IAAAA,IAAI,EAAE;AACFmH,MAAAA,GAAG,EAAEG,MAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNxH,IAAAA,IAAI,EAAE,SAAS;AACfC,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
@@ -39,17 +39,17 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
39
39
  selectChipIndex = _useState4[0],
40
40
  setSelectChipIndex = _useState4[1];
41
41
  useEffect(function () {
42
- var _itemsRefs$current;
42
+ var _itemsRefs$current, _itemsRefs$current$se;
43
43
  if (!opened) {
44
44
  setSelectItemIndex(-1);
45
45
  setSelectChipIndex(-1);
46
46
  return;
47
47
  }
48
- itemsRefs === null || itemsRefs === void 0 || (_itemsRefs$current = itemsRefs.current) === null || _itemsRefs$current === void 0 || (_itemsRefs$current = _itemsRefs$current[selectItemIndex]) === null || _itemsRefs$current === void 0 || _itemsRefs$current.focus();
48
+ itemsRefs === null || itemsRefs === void 0 ? void 0 : (_itemsRefs$current = itemsRefs.current) === null || _itemsRefs$current === void 0 ? void 0 : (_itemsRefs$current$se = _itemsRefs$current[selectItemIndex]) === null || _itemsRefs$current$se === void 0 ? void 0 : _itemsRefs$current$se.focus();
49
49
  }, [opened]);
50
50
  useEffect(function () {
51
- var _itemsRefs$current2;
52
- itemsRefs === null || itemsRefs === void 0 || (_itemsRefs$current2 = itemsRefs.current) === null || _itemsRefs$current2 === void 0 || (_itemsRefs$current2 = _itemsRefs$current2[selectItemIndex]) === null || _itemsRefs$current2 === void 0 || _itemsRefs$current2.focus();
51
+ var _itemsRefs$current2, _itemsRefs$current2$s;
52
+ itemsRefs === null || itemsRefs === void 0 ? void 0 : (_itemsRefs$current2 = itemsRefs.current) === null || _itemsRefs$current2 === void 0 ? void 0 : (_itemsRefs$current2$s = _itemsRefs$current2[selectItemIndex]) === null || _itemsRefs$current2$s === void 0 ? void 0 : _itemsRefs$current2$s.focus();
53
53
  }, [value, search]);
54
54
  var onKeyDownTarget = useCallback(function (event) {
55
55
  var _focusedItem;
@@ -88,7 +88,7 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
88
88
  var _ref2, _chipsRefs$current3;
89
89
  var _index2 = selectChipIndex - 1 <= 0 ? 0 : selectChipIndex - 1;
90
90
  newSelectChipIndex = chipsRefsCount === 0 ? -1 : _index2;
91
- focusedItem = chipsRefsCount === 0 ? (_ref2 = inputRef || targetRef) === null || _ref2 === void 0 ? void 0 : _ref2.current : chipsRefs === null || chipsRefs === void 0 || (_chipsRefs$current3 = chipsRefs.current) === null || _chipsRefs$current3 === void 0 ? void 0 : _chipsRefs$current3[_index2];
91
+ focusedItem = chipsRefsCount === 0 ? (_ref2 = inputRef || targetRef) === null || _ref2 === void 0 ? void 0 : _ref2.current : chipsRefs === null || chipsRefs === void 0 ? void 0 : (_chipsRefs$current3 = chipsRefs.current) === null || _chipsRefs$current3 === void 0 ? void 0 : _chipsRefs$current3[_index2];
92
92
  scrollIntoView = true;
93
93
  }
94
94
  if (code === Keys.ArrowUp || code === Keys.ArrowDown || code === Keys.Enter && componentType !== 'combobox' || code === Keys.Space && componentType !== 'combobox') {
@@ -104,10 +104,10 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
104
104
  }
105
105
  setSelectItemIndex(newSelectItemIndex);
106
106
  setSelectChipIndex(newSelectChipIndex);
107
- (_focusedItem = focusedItem) === null || _focusedItem === void 0 || _focusedItem.focus();
107
+ (_focusedItem = focusedItem) === null || _focusedItem === void 0 ? void 0 : _focusedItem.focus();
108
108
  if (scrollIntoView) {
109
109
  var _focusedItem2;
110
- (_focusedItem2 = focusedItem) === null || _focusedItem2 === void 0 || _focusedItem2.scrollIntoView({
110
+ (_focusedItem2 = focusedItem) === null || _focusedItem2 === void 0 ? void 0 : _focusedItem2.scrollIntoView({
111
111
  behavior: 'smooth',
112
112
  block: 'center',
113
113
  inline: 'center'
@@ -144,18 +144,18 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
144
144
  if (code === Keys.ArrowUp) {
145
145
  var _itemsRefs$current4;
146
146
  newSelectItemIndex = newSelectItemIndex - 1 === -1 ? itemsRefsCount - 1 : newSelectItemIndex - 1;
147
- focusedItem = itemsRefs === null || itemsRefs === void 0 || (_itemsRefs$current4 = itemsRefs.current) === null || _itemsRefs$current4 === void 0 ? void 0 : _itemsRefs$current4[newSelectItemIndex];
147
+ focusedItem = itemsRefs === null || itemsRefs === void 0 ? void 0 : (_itemsRefs$current4 = itemsRefs.current) === null || _itemsRefs$current4 === void 0 ? void 0 : _itemsRefs$current4[newSelectItemIndex];
148
148
  }
149
149
  if (code === Keys.ArrowDown) {
150
150
  var _itemsRefs$current5;
151
151
  newSelectItemIndex = newSelectItemIndex + 1 === itemsRefsCount ? 0 : newSelectItemIndex + 1;
152
- focusedItem = itemsRefs === null || itemsRefs === void 0 || (_itemsRefs$current5 = itemsRefs.current) === null || _itemsRefs$current5 === void 0 ? void 0 : _itemsRefs$current5[newSelectItemIndex];
152
+ focusedItem = itemsRefs === null || itemsRefs === void 0 ? void 0 : (_itemsRefs$current5 = itemsRefs.current) === null || _itemsRefs$current5 === void 0 ? void 0 : _itemsRefs$current5[newSelectItemIndex];
153
153
  }
154
154
  if ((code === Keys.ArrowRight || code === Keys.ArrowLeft) && valueType === 'multiple' && enumerationType === 'chip' && chipsRefsCount) {
155
155
  var _chipsRefs$current4;
156
156
  newSelectChipIndex = chipsRefsCount - 1;
157
157
  newSelectItemIndex = -1;
158
- focusedItem = chipsRefs === null || chipsRefs === void 0 || (_chipsRefs$current4 = chipsRefs.current) === null || _chipsRefs$current4 === void 0 ? void 0 : _chipsRefs$current4[newSelectChipIndex];
158
+ focusedItem = chipsRefs === null || chipsRefs === void 0 ? void 0 : (_chipsRefs$current4 = chipsRefs.current) === null || _chipsRefs$current4 === void 0 ? void 0 : _chipsRefs$current4[newSelectChipIndex];
159
159
  scrollIntoView = true;
160
160
  }
161
161
  if (code === Keys.Enter || code === Keys.Space && componentType !== 'combobox') {
@@ -181,10 +181,10 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
181
181
  updateOpened(newOpened, event);
182
182
  setSelectItemIndex(newSelectItemIndex);
183
183
  setSelectChipIndex(newSelectChipIndex);
184
- (_focusedItem3 = focusedItem) === null || _focusedItem3 === void 0 || _focusedItem3.focus();
184
+ (_focusedItem3 = focusedItem) === null || _focusedItem3 === void 0 ? void 0 : _focusedItem3.focus();
185
185
  if (scrollIntoView) {
186
186
  var _focusedItem4;
187
- (_focusedItem4 = focusedItem) === null || _focusedItem4 === void 0 || _focusedItem4.scrollIntoView({
187
+ (_focusedItem4 = focusedItem) === null || _focusedItem4 === void 0 ? void 0 : _focusedItem4.scrollIntoView({
188
188
  behavior: 'smooth',
189
189
  block: 'center',
190
190
  inline: 'center'
@@ -1 +1 @@
1
- {"version":3,"file":"useKeyNavigation.js","sources":["../../../../src/components/Select/hooks/useKeyNavigation.ts"],"sourcesContent":["import { KeyboardEvent, useCallback, useEffect, useState } from 'react';\n\nimport type { UseKeyNavigationProps } from '../Select.types';\n\nexport const Keys = {\n Enter: 'Enter',\n Space: 'Space',\n Tab: 'Tab',\n Escape: 'Escape',\n ArrowLeft: 'ArrowLeft',\n ArrowRight: 'ArrowRight',\n ArrowUp: 'ArrowUp',\n ArrowDown: 'ArrowDown',\n Backspace: 'Backspace',\n ShiftLeft: 'ShiftLeft',\n ShiftRight: 'ShiftRight',\n};\n\nexport const useKeyNavigation = ({\n controlledRefs: { targetRef, chipsRefs, selectRef, itemsRefs, inputRef },\n opened,\n enumerationType,\n valueType,\n componentType = 'select',\n value,\n search,\n updateValue,\n updateOpened,\n}: UseKeyNavigationProps) => {\n const [selectItemIndex, setSelectItemIndex] = useState(-1);\n const [selectChipIndex, setSelectChipIndex] = useState(-1);\n\n useEffect(() => {\n if (!opened) {\n setSelectItemIndex(-1);\n setSelectChipIndex(-1);\n\n return;\n }\n\n itemsRefs?.current?.[selectItemIndex]?.focus();\n }, [opened]);\n\n useEffect(() => {\n itemsRefs?.current?.[selectItemIndex]?.focus();\n }, [value, search]);\n\n const onKeyDownTarget = useCallback(\n (event: KeyboardEvent<HTMLButtonElement | HTMLInputElement>) => {\n const { code } = event;\n\n const chipsRefsCount = chipsRefs.current.length;\n let scrollIntoView = false;\n let newOpened = opened;\n let newSelectItemIndex = selectItemIndex;\n let newSelectChipIndex = selectChipIndex;\n let focusedItem: HTMLElement | HTMLInputElement | null = null;\n\n if (code === Keys.Enter || (code === Keys.Space && componentType !== 'combobox')) {\n event.preventDefault();\n }\n\n if (code === Keys.Escape) {\n newOpened = false;\n newSelectItemIndex = -1;\n newSelectChipIndex = -1;\n focusedItem = targetRef.current;\n }\n\n if (code === Keys.ArrowLeft && valueType === 'multiple' && enumerationType === 'chip') {\n const index = selectChipIndex - 1 <= 0 ? 0 : selectChipIndex - 1;\n\n newSelectChipIndex = document.activeElement === targetRef.current ? 0 : index;\n newSelectChipIndex =\n document.activeElement === inputRef?.current ? chipsRefsCount - 1 : newSelectChipIndex;\n\n focusedItem = chipsRefs.current?.[newSelectChipIndex];\n\n scrollIntoView = true;\n }\n\n if (code === Keys.ArrowRight && valueType === 'multiple' && enumerationType === 'chip') {\n const index = selectChipIndex + 1 === chipsRefsCount ? selectChipIndex : selectChipIndex + 1;\n\n newSelectChipIndex = document.activeElement === targetRef.current ? 0 : index;\n focusedItem =\n index === selectChipIndex\n ? (inputRef?.current as HTMLInputElement)\n : chipsRefs.current?.[newSelectChipIndex];\n\n scrollIntoView = true;\n }\n\n if (code === Keys.Backspace && document.activeElement !== inputRef?.current) {\n const index = selectChipIndex - 1 <= 0 ? 0 : selectChipIndex - 1;\n\n newSelectChipIndex = chipsRefsCount === 0 ? -1 : index;\n focusedItem = chipsRefsCount === 0 ? (inputRef || targetRef)?.current : chipsRefs?.current?.[index];\n\n scrollIntoView = true;\n }\n\n if (\n code === Keys.ArrowUp ||\n code === Keys.ArrowDown ||\n (code === Keys.Enter && componentType !== 'combobox') ||\n (code === Keys.Space && componentType !== 'combobox')\n ) {\n newOpened = true;\n newSelectItemIndex = selectItemIndex === -1 ? 0 : selectItemIndex;\n focusedItem = itemsRefs.current?.[newSelectItemIndex];\n }\n\n // INFO: Для кейсов, когда поведение закрытия может контролироваться снаружи\n if (code !== Keys.Enter || componentType !== 'combobox') {\n updateOpened(newOpened, event);\n }\n\n setSelectItemIndex(newSelectItemIndex);\n setSelectChipIndex(newSelectChipIndex);\n\n focusedItem?.focus();\n\n if (scrollIntoView) {\n focusedItem?.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'center',\n });\n }\n },\n [opened, selectItemIndex, selectChipIndex, valueType, enumerationType, componentType, updateOpened],\n );\n\n const onKeyDownSelect = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n const { code, shiftKey } = event;\n\n const itemsRefsCount = itemsRefs.current.length;\n const chipsRefsCount = chipsRefs.current.length;\n let scrollIntoView = false;\n let newOpened = opened;\n let newSelectItemIndex = selectItemIndex;\n let newSelectChipIndex = selectChipIndex;\n let focusedItem: HTMLElement | HTMLInputElement | null = null;\n\n if (code === Keys.Enter || code === Keys.Tab) {\n event.preventDefault();\n }\n\n if (code === Keys.Escape) {\n newOpened = false;\n newSelectItemIndex = -1;\n newSelectChipIndex = -1;\n focusedItem = (inputRef || targetRef).current;\n }\n\n if (code === Keys.Tab) {\n newOpened = false;\n newSelectItemIndex = -1;\n newSelectChipIndex = -1;\n focusedItem = (shiftKey\n ? selectRef.current?.previousSibling\n : selectRef.current?.nextSibling) as HTMLElement;\n }\n\n if (code === Keys.ArrowUp) {\n newSelectItemIndex = newSelectItemIndex - 1 === -1 ? itemsRefsCount - 1 : newSelectItemIndex - 1;\n focusedItem = itemsRefs?.current?.[newSelectItemIndex];\n }\n\n if (code === Keys.ArrowDown) {\n newSelectItemIndex = newSelectItemIndex + 1 === itemsRefsCount ? 0 : newSelectItemIndex + 1;\n focusedItem = itemsRefs?.current?.[newSelectItemIndex];\n }\n\n if (\n (code === Keys.ArrowRight || code === Keys.ArrowLeft) &&\n valueType === 'multiple' &&\n enumerationType === 'chip' &&\n chipsRefsCount\n ) {\n newSelectChipIndex = chipsRefsCount - 1;\n newSelectItemIndex = -1;\n focusedItem = chipsRefs?.current?.[newSelectChipIndex];\n\n scrollIntoView = true;\n }\n\n if (code === Keys.Enter || (code === Keys.Space && componentType !== 'combobox')) {\n const item = itemsRefs.current[newSelectItemIndex] as HTMLElement;\n\n // TODO: #1016\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (item.ariaDisabled) {\n return;\n }\n\n updateValue(item, event);\n\n newOpened = valueType === 'single' ? false : opened;\n focusedItem = valueType === 'single' ? targetRef.current : focusedItem;\n }\n\n const isValidKeyCode = [\n Keys.ShiftLeft,\n Keys.ShiftRight,\n Keys.ArrowDown,\n Keys.ArrowLeft,\n Keys.ArrowRight,\n Keys.ArrowUp,\n Keys.Enter,\n Keys.Escape,\n Keys.Tab,\n ].includes(code);\n\n if (componentType === 'combobox' && !isValidKeyCode) {\n event.stopPropagation();\n\n focusedItem = inputRef?.current as HTMLInputElement;\n newSelectItemIndex = -1;\n newSelectChipIndex = -1;\n }\n\n updateOpened(newOpened, event);\n setSelectItemIndex(newSelectItemIndex);\n setSelectChipIndex(newSelectChipIndex);\n\n focusedItem?.focus();\n\n if (scrollIntoView) {\n focusedItem?.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'center',\n });\n }\n },\n [\n opened,\n selectItemIndex,\n selectChipIndex,\n valueType,\n enumerationType,\n componentType,\n updateOpened,\n updateValue,\n ],\n );\n\n return { onKeyDownTarget, onKeyDownSelect } as const;\n};\n"],"names":["Keys","Enter","Space","Tab","Escape","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","ShiftLeft","ShiftRight","useKeyNavigation","_ref","_ref$controlledRefs","controlledRefs","targetRef","chipsRefs","selectRef","itemsRefs","inputRef","opened","enumerationType","valueType","_ref$componentType","componentType","value","search","updateValue","updateOpened","_useState","useState","_useState2","_slicedToArray","selectItemIndex","setSelectItemIndex","_useState3","_useState4","selectChipIndex","setSelectChipIndex","useEffect","_itemsRefs$current","current","focus","_itemsRefs$current2","onKeyDownTarget","useCallback","event","_focusedItem","code","chipsRefsCount","length","scrollIntoView","newOpened","newSelectItemIndex","newSelectChipIndex","focusedItem","preventDefault","_chipsRefs$current","index","document","activeElement","_chipsRefs$current2","_ref2","_chipsRefs$current3","_itemsRefs$current3","_focusedItem2","behavior","block","inline","onKeyDownSelect","_focusedItem3","shiftKey","itemsRefsCount","_selectRef$current","_selectRef$current2","previousSibling","nextSibling","_itemsRefs$current4","_itemsRefs$current5","_chipsRefs$current4","item","ariaDisabled","isValidKeyCode","includes","stopPropagation","_focusedItem4"],"mappings":";;;AAIO,IAAMA,IAAI,GAAG;AAChBC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,SAAS,EAA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AG,CAAC,CAAC,CAAA;AAC3B,KAAA;AAEA1B,IAAAA,YAAY,CAACwB,SAAS,EAAEN,KAAK,CAAC,CAAA;IAC9BZ,kBAAkB,CAACmB,kBAAkB,CAAC,CAAA;IACtCf,kBAAkB,CAACgB,kBAAkB,CAAC,CAAA;IAEtC,CAAAgB,aAAA,GAAAf,WAAW,MAAAe,IAAAA,IAAAA,aAAA,eAAXA,aAAA,CAAa5B,KAAK,EAAE,CAAA;AAEpB,IAAA,IAAIS,cAAc,EAAE;AAAA,MAAA,IAAAkC,aAAA,CAAA;MAChB,CAAAA,aAAA,GAAA9B,WAAW,MAAA,IAAA,IAAA8B,aAAA,KAAXA,KAAAA,CAAAA,IAAAA,aAAA,CAAalC,cAAc,CAAC;AACxBe,QAAAA,QAAQ,EAAE,QAAQ;AAClBC,QAAAA,KAAK,EAAE,QAAQ;AACfC,QAAAA,MAAM,EAAE,QAAA;AACZ,OAAC,CAAC,CAAA;AACN,KAAA;AACJ,GAAC,EACD,CACIhD,MAAM,EACNa,eAAe,EACfI,eAAe,EACff,SAAS,EACTD,eAAe,EACfG,aAAa,EACbI,YAAY,EACZD,WAAW,CAEnB,CAAC,CAAA;EAED,OAAO;AAAEiB,IAAAA,eAAe,EAAfA,eAAe;AAAEyB,IAAAA,eAAe,EAAfA,eAAAA;GAAiB,CAAA;AAC/C;;;;"}
1
+ {"version":3,"file":"useKeyNavigation.js","sources":["../../../../src/components/Select/hooks/useKeyNavigation.ts"],"sourcesContent":["import { KeyboardEvent, useCallback, useEffect, useState } from 'react';\n\nimport type { UseKeyNavigationProps } from '../Select.types';\n\nexport const Keys = {\n Enter: 'Enter',\n Space: 'Space',\n Tab: 'Tab',\n Escape: 'Escape',\n ArrowLeft: 'ArrowLeft',\n ArrowRight: 'ArrowRight',\n ArrowUp: 'ArrowUp',\n ArrowDown: 'ArrowDown',\n Backspace: 'Backspace',\n ShiftLeft: 'ShiftLeft',\n ShiftRight: 'ShiftRight',\n};\n\nexport const useKeyNavigation = ({\n controlledRefs: { targetRef, chipsRefs, selectRef, itemsRefs, inputRef },\n opened,\n enumerationType,\n valueType,\n componentType = 'select',\n value,\n search,\n updateValue,\n updateOpened,\n}: UseKeyNavigationProps) => {\n const [selectItemIndex, setSelectItemIndex] = useState(-1);\n const [selectChipIndex, setSelectChipIndex] = useState(-1);\n\n useEffect(() => {\n if (!opened) {\n setSelectItemIndex(-1);\n setSelectChipIndex(-1);\n\n return;\n }\n\n itemsRefs?.current?.[selectItemIndex]?.focus();\n }, [opened]);\n\n useEffect(() => {\n itemsRefs?.current?.[selectItemIndex]?.focus();\n }, [value, search]);\n\n const onKeyDownTarget = useCallback(\n (event: KeyboardEvent<HTMLButtonElement | HTMLInputElement>) => {\n const { code } = event;\n\n const chipsRefsCount = chipsRefs.current.length;\n let scrollIntoView = false;\n let newOpened = opened;\n let newSelectItemIndex = selectItemIndex;\n let newSelectChipIndex = selectChipIndex;\n let focusedItem: HTMLElement | HTMLInputElement | null = null;\n\n if (code === Keys.Enter || (code === Keys.Space && componentType !== 'combobox')) {\n event.preventDefault();\n }\n\n if (code === Keys.Escape) {\n newOpened = false;\n newSelectItemIndex = -1;\n newSelectChipIndex = -1;\n focusedItem = targetRef.current;\n }\n\n if (code === Keys.ArrowLeft && valueType === 'multiple' && enumerationType === 'chip') {\n const index = selectChipIndex - 1 <= 0 ? 0 : selectChipIndex - 1;\n\n newSelectChipIndex = document.activeElement === targetRef.current ? 0 : index;\n newSelectChipIndex =\n document.activeElement === inputRef?.current ? chipsRefsCount - 1 : newSelectChipIndex;\n\n focusedItem = chipsRefs.current?.[newSelectChipIndex];\n\n scrollIntoView = true;\n }\n\n if (code === Keys.ArrowRight && valueType === 'multiple' && enumerationType === 'chip') {\n const index = selectChipIndex + 1 === chipsRefsCount ? selectChipIndex : selectChipIndex + 1;\n\n newSelectChipIndex = document.activeElement === targetRef.current ? 0 : index;\n focusedItem =\n index === selectChipIndex\n ? (inputRef?.current as HTMLInputElement)\n : chipsRefs.current?.[newSelectChipIndex];\n\n scrollIntoView = true;\n }\n\n if (code === Keys.Backspace && document.activeElement !== inputRef?.current) {\n const index = selectChipIndex - 1 <= 0 ? 0 : selectChipIndex - 1;\n\n newSelectChipIndex = chipsRefsCount === 0 ? -1 : index;\n focusedItem = chipsRefsCount === 0 ? (inputRef || targetRef)?.current : chipsRefs?.current?.[index];\n\n scrollIntoView = true;\n }\n\n if (\n code === Keys.ArrowUp ||\n code === Keys.ArrowDown ||\n (code === Keys.Enter && componentType !== 'combobox') ||\n (code === Keys.Space && componentType !== 'combobox')\n ) {\n newOpened = true;\n newSelectItemIndex = selectItemIndex === -1 ? 0 : selectItemIndex;\n focusedItem = itemsRefs.current?.[newSelectItemIndex];\n }\n\n // INFO: Для кейсов, когда поведение закрытия может контролироваться снаружи\n if (code !== Keys.Enter || componentType !== 'combobox') {\n updateOpened(newOpened, event);\n }\n\n setSelectItemIndex(newSelectItemIndex);\n setSelectChipIndex(newSelectChipIndex);\n\n focusedItem?.focus();\n\n if (scrollIntoView) {\n focusedItem?.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'center',\n });\n }\n },\n [opened, selectItemIndex, selectChipIndex, valueType, enumerationType, componentType, updateOpened],\n );\n\n const onKeyDownSelect = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n const { code, shiftKey } = event;\n\n const itemsRefsCount = itemsRefs.current.length;\n const chipsRefsCount = chipsRefs.current.length;\n let scrollIntoView = false;\n let newOpened = opened;\n let newSelectItemIndex = selectItemIndex;\n let newSelectChipIndex = selectChipIndex;\n let focusedItem: HTMLElement | HTMLInputElement | null = null;\n\n if (code === Keys.Enter || code === Keys.Tab) {\n event.preventDefault();\n }\n\n if (code === Keys.Escape) {\n newOpened = false;\n newSelectItemIndex = -1;\n newSelectChipIndex = -1;\n focusedItem = (inputRef || targetRef).current;\n }\n\n if (code === Keys.Tab) {\n newOpened = false;\n newSelectItemIndex = -1;\n newSelectChipIndex = -1;\n focusedItem = (shiftKey\n ? selectRef.current?.previousSibling\n : selectRef.current?.nextSibling) as HTMLElement;\n }\n\n if (code === Keys.ArrowUp) {\n newSelectItemIndex = newSelectItemIndex - 1 === -1 ? itemsRefsCount - 1 : newSelectItemIndex - 1;\n focusedItem = itemsRefs?.current?.[newSelectItemIndex];\n }\n\n if (code === Keys.ArrowDown) {\n newSelectItemIndex = newSelectItemIndex + 1 === itemsRefsCount ? 0 : newSelectItemIndex + 1;\n focusedItem = itemsRefs?.current?.[newSelectItemIndex];\n }\n\n if (\n (code === Keys.ArrowRight || code === Keys.ArrowLeft) &&\n valueType === 'multiple' &&\n enumerationType === 'chip' &&\n chipsRefsCount\n ) {\n newSelectChipIndex = chipsRefsCount - 1;\n newSelectItemIndex = -1;\n focusedItem = chipsRefs?.current?.[newSelectChipIndex];\n\n scrollIntoView = true;\n }\n\n if (code === Keys.Enter || (code === Keys.Space && componentType !== 'combobox')) {\n const item = itemsRefs.current[newSelectItemIndex] as HTMLElement;\n\n // TODO: #1016\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (item.ariaDisabled) {\n return;\n }\n\n updateValue(item, event);\n\n newOpened = valueType === 'single' ? false : opened;\n focusedItem = valueType === 'single' ? targetRef.current : focusedItem;\n }\n\n const isValidKeyCode = [\n Keys.ShiftLeft,\n Keys.ShiftRight,\n Keys.ArrowDown,\n Keys.ArrowLeft,\n Keys.ArrowRight,\n Keys.ArrowUp,\n Keys.Enter,\n Keys.Escape,\n Keys.Tab,\n ].includes(code);\n\n if (componentType === 'combobox' && !isValidKeyCode) {\n event.stopPropagation();\n\n focusedItem = inputRef?.current as HTMLInputElement;\n newSelectItemIndex = -1;\n newSelectChipIndex = -1;\n }\n\n updateOpened(newOpened, event);\n setSelectItemIndex(newSelectItemIndex);\n setSelectChipIndex(newSelectChipIndex);\n\n focusedItem?.focus();\n\n if (scrollIntoView) {\n focusedItem?.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'center',\n });\n }\n },\n [\n opened,\n selectItemIndex,\n selectChipIndex,\n valueType,\n enumerationType,\n componentType,\n updateOpened,\n updateValue,\n ],\n );\n\n return { onKeyDownTarget, onKeyDownSelect } as const;\n};\n"],"names":["Keys","Enter","Space","Tab","Escape","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","ShiftLeft","ShiftRight","useKeyNavigation","_ref","_ref$controlledRefs","controlledRefs","targetRef","chipsRefs","selectRef","itemsRefs","inputRef","opened","enumerationType","valueType","_ref$componentType","componentType","value","search","updateValue","updateOpened","_useState","useState","_useState2","_slicedToArray","selectItemIndex","setSelectItemIndex","_useState3","_useState4","selectChipIndex","setSelectChipIndex","useEffect","_itemsRefs$current","_itemsRefs$current$se","current","focus","_itemsRefs$current2","_itemsRefs$current2$s","onKeyDownTarget","useCallback","event","_focusedItem","code","chipsRefsCount","length","scrollIntoView","newOpened","newSelectItemIndex","newSelectChipIndex","focusedItem","preventDefault","_chipsRefs$current","index","document","activeElement","_chipsRefs$current2","_ref2","_chipsRefs$current3","_itemsRefs$current3","_focusedItem2","behavior","block","inline","onKeyDownSelect","_focusedItem3","shiftKey","itemsRefsCount","_selectRef$current","_selectRef$current2","previousSibling","nextSibling","_itemsRefs$current4","_itemsRefs$current5","_chipsRefs$current4","item","ariaDisabled","isValidKeyCode","includes","stopPropagation","_focusedItem4"],"mappings":";;;AAIO,IAAMA,IAAI,GAAG;AAChBC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,SAAS,EAAE,WAAW;AACtBC,EAAAA,UAAU,EAAE,YAAY;AACxBC,EAAAA,OAAO,EAAE,SAAS;AAClBC,EAAAA,SAAS,EAAE,WAAW;AACtBC,EAAAA,SAAS,EAAE,WAAW;AACtBC,EAAAA,SAAS,EAAE,WAAW;AACtBC,EAAAA,UAAU,EAAE,YAAA;AAChB,EAAC;IAEYC,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