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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (357) hide show
  1. package/cjs/_virtual/_rollupPluginBabelHelpers.js +1 -1
  2. package/cjs/components/Avatar/Avatar.js +1 -15
  3. package/cjs/components/Avatar/Avatar.js.map +1 -1
  4. package/cjs/components/Calendar/CalendarBase/CalendarBase.js +1 -1
  5. package/cjs/components/Calendar/CalendarBase/CalendarBase.js.map +1 -1
  6. package/cjs/components/Calendar/CalendarDouble/CalendarDouble.js +1 -1
  7. package/cjs/components/Calendar/CalendarDouble/CalendarDouble.js.map +1 -1
  8. package/cjs/components/Calendar/hoc/withRange.js +1 -1
  9. package/cjs/components/Calendar/hoc/withRange.js.map +1 -1
  10. package/cjs/components/Calendar/hooks/useKeyNavigation.js +19 -19
  11. package/cjs/components/Calendar/hooks/useKeyNavigation.js.map +1 -1
  12. package/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js +3 -3
  13. package/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js.map +1 -1
  14. package/cjs/components/Calendar/ui/CalendarHeader/CalendarHeader.js +2 -2
  15. package/cjs/components/Calendar/ui/CalendarHeader/CalendarHeader.js.map +1 -1
  16. package/cjs/components/Calendar/ui/CalendarMonths/CalendarMonths.js +1 -1
  17. package/cjs/components/Calendar/ui/CalendarMonths/CalendarMonths.js.map +1 -1
  18. package/cjs/components/Calendar/ui/CalendarYears/CalendarYears.js +1 -1
  19. package/cjs/components/Calendar/ui/CalendarYears/CalendarYears.js.map +1 -1
  20. package/cjs/components/Chip/Chip.js +2 -2
  21. package/cjs/components/Chip/Chip.js.map +1 -1
  22. package/cjs/components/Combobox/Combobox.js +5 -5
  23. package/cjs/components/Combobox/Combobox.js.map +1 -1
  24. package/cjs/components/Combobox/hooks/useFocusController.js +9 -9
  25. package/cjs/components/Combobox/hooks/useFocusController.js.map +1 -1
  26. package/cjs/components/Combobox/ui/ComboboxChip/ComboboxChip.js +1 -1
  27. package/cjs/components/Combobox/ui/ComboboxChip/ComboboxChip.js.map +1 -1
  28. package/cjs/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js +6 -6
  29. package/cjs/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js.map +1 -1
  30. package/cjs/components/Drawer/DrawerContext.js +1 -1
  31. package/cjs/components/Drawer/DrawerContext.js.map +1 -1
  32. package/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.js +2 -2
  33. package/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.js.map +1 -1
  34. package/cjs/components/Modal/ModalContext.js +1 -1
  35. package/cjs/components/Modal/ModalContext.js.map +1 -1
  36. package/cjs/components/Overlay/Overlay.js +1 -1
  37. package/cjs/components/Overlay/Overlay.js.map +1 -1
  38. package/cjs/components/Pagination/Pagination.js +2 -2
  39. package/cjs/components/Pagination/Pagination.js.map +1 -1
  40. package/cjs/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js +1 -1
  41. package/cjs/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js.map +1 -1
  42. package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +1 -1
  43. package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js.map +1 -1
  44. package/cjs/components/Popover/Popover.js +7 -7
  45. package/cjs/components/Popover/Popover.js.map +1 -1
  46. package/cjs/components/Popup/Popup.js +1 -1
  47. package/cjs/components/Popup/Popup.js.map +1 -1
  48. package/cjs/components/Segment/ui/SegmentItem/SegmentItem.js +2 -2
  49. package/cjs/components/Segment/ui/SegmentItem/SegmentItem.js.map +1 -1
  50. package/cjs/components/Select/Select.js +5 -5
  51. package/cjs/components/Select/Select.js.map +1 -1
  52. package/cjs/components/Select/hooks/useKeyNavigation.js +12 -12
  53. package/cjs/components/Select/hooks/useKeyNavigation.js.map +1 -1
  54. package/cjs/components/Select/ui/SelectChip/SelectChip.js +1 -1
  55. package/cjs/components/Select/ui/SelectChip/SelectChip.js.map +1 -1
  56. package/cjs/components/Select/ui/SelectTarget/SelectTarget.js +2 -2
  57. package/cjs/components/Select/ui/SelectTarget/SelectTarget.js.map +1 -1
  58. package/cjs/components/Select/utils/index.js +2 -2
  59. package/cjs/components/Select/utils/index.js.map +1 -1
  60. package/cjs/components/Tabs/TabsContext.js +1 -2
  61. package/cjs/components/Tabs/TabsContext.js.map +1 -1
  62. package/cjs/components/Tabs/ui/TabItem/TabItem.js +1 -1
  63. package/cjs/components/Tabs/ui/TabItem/TabItem.js.map +1 -1
  64. package/cjs/components/Tabs/ui/Tabs/Tabs.js +2 -2
  65. package/cjs/components/Tabs/ui/Tabs/Tabs.js.map +1 -1
  66. package/cjs/components/TextArea/TextArea.js +1 -1
  67. package/cjs/components/TextArea/TextArea.js.map +1 -1
  68. package/cjs/components/TextField/TextField.js +2 -2
  69. package/cjs/components/TextField/TextField.js.map +1 -1
  70. package/cjs/components/TextField/hooks/useKeyNavigation.js +9 -9
  71. package/cjs/components/TextField/hooks/useKeyNavigation.js.map +1 -1
  72. package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js +1 -1
  73. package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js.map +1 -1
  74. package/cjs/components/Toast/ToastProvider/ToastProvider.js +2 -2
  75. package/cjs/components/Toast/ToastProvider/ToastProvider.js.map +1 -1
  76. package/cjs/components/Tooltip/Tooltip.js +1 -1
  77. package/cjs/components/Tooltip/Tooltip.js.map +1 -1
  78. package/es/_virtual/_rollupPluginBabelHelpers.js +1 -1
  79. package/es/components/Avatar/Avatar.js +1 -15
  80. package/es/components/Avatar/Avatar.js.map +1 -1
  81. package/es/components/Calendar/CalendarBase/CalendarBase.js +1 -1
  82. package/es/components/Calendar/CalendarBase/CalendarBase.js.map +1 -1
  83. package/es/components/Calendar/CalendarDouble/CalendarDouble.js +1 -1
  84. package/es/components/Calendar/CalendarDouble/CalendarDouble.js.map +1 -1
  85. package/es/components/Calendar/hoc/withRange.js +1 -1
  86. package/es/components/Calendar/hoc/withRange.js.map +1 -1
  87. package/es/components/Calendar/hooks/useKeyNavigation.js +19 -19
  88. package/es/components/Calendar/hooks/useKeyNavigation.js.map +1 -1
  89. package/es/components/Calendar/ui/CalendarDays/CalendarDays.js +3 -3
  90. package/es/components/Calendar/ui/CalendarDays/CalendarDays.js.map +1 -1
  91. package/es/components/Calendar/ui/CalendarHeader/CalendarHeader.js +2 -2
  92. package/es/components/Calendar/ui/CalendarHeader/CalendarHeader.js.map +1 -1
  93. package/es/components/Calendar/ui/CalendarMonths/CalendarMonths.js +1 -1
  94. package/es/components/Calendar/ui/CalendarMonths/CalendarMonths.js.map +1 -1
  95. package/es/components/Calendar/ui/CalendarYears/CalendarYears.js +1 -1
  96. package/es/components/Calendar/ui/CalendarYears/CalendarYears.js.map +1 -1
  97. package/es/components/Chip/Chip.js +2 -2
  98. package/es/components/Chip/Chip.js.map +1 -1
  99. package/es/components/Combobox/Combobox.js +5 -5
  100. package/es/components/Combobox/Combobox.js.map +1 -1
  101. package/es/components/Combobox/hooks/useFocusController.js +9 -9
  102. package/es/components/Combobox/hooks/useFocusController.js.map +1 -1
  103. package/es/components/Combobox/ui/ComboboxChip/ComboboxChip.js +1 -1
  104. package/es/components/Combobox/ui/ComboboxChip/ComboboxChip.js.map +1 -1
  105. package/es/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js +6 -6
  106. package/es/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js.map +1 -1
  107. package/es/components/Drawer/DrawerContext.js +1 -1
  108. package/es/components/Drawer/DrawerContext.js.map +1 -1
  109. package/es/components/Dropdown/ui/DropdownItem/DropdownItem.js +2 -2
  110. package/es/components/Dropdown/ui/DropdownItem/DropdownItem.js.map +1 -1
  111. package/es/components/Modal/ModalContext.js +1 -1
  112. package/es/components/Modal/ModalContext.js.map +1 -1
  113. package/es/components/Overlay/Overlay.js +1 -1
  114. package/es/components/Overlay/Overlay.js.map +1 -1
  115. package/es/components/Pagination/Pagination.js +2 -2
  116. package/es/components/Pagination/Pagination.js.map +1 -1
  117. package/es/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js +1 -1
  118. package/es/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js.map +1 -1
  119. package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +1 -1
  120. package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js.map +1 -1
  121. package/es/components/Popover/Popover.js +7 -7
  122. package/es/components/Popover/Popover.js.map +1 -1
  123. package/es/components/Popup/Popup.js +1 -1
  124. package/es/components/Popup/Popup.js.map +1 -1
  125. package/es/components/Segment/ui/SegmentItem/SegmentItem.js +2 -2
  126. package/es/components/Segment/ui/SegmentItem/SegmentItem.js.map +1 -1
  127. package/es/components/Select/Select.js +5 -5
  128. package/es/components/Select/Select.js.map +1 -1
  129. package/es/components/Select/hooks/useKeyNavigation.js +12 -12
  130. package/es/components/Select/hooks/useKeyNavigation.js.map +1 -1
  131. package/es/components/Select/ui/SelectChip/SelectChip.js +1 -1
  132. package/es/components/Select/ui/SelectChip/SelectChip.js.map +1 -1
  133. package/es/components/Select/ui/SelectTarget/SelectTarget.js +2 -2
  134. package/es/components/Select/ui/SelectTarget/SelectTarget.js.map +1 -1
  135. package/es/components/Select/utils/index.js +2 -2
  136. package/es/components/Select/utils/index.js.map +1 -1
  137. package/es/components/Tabs/TabsContext.js +1 -2
  138. package/es/components/Tabs/TabsContext.js.map +1 -1
  139. package/es/components/Tabs/ui/TabItem/TabItem.js +1 -1
  140. package/es/components/Tabs/ui/TabItem/TabItem.js.map +1 -1
  141. package/es/components/Tabs/ui/Tabs/Tabs.js +2 -2
  142. package/es/components/Tabs/ui/Tabs/Tabs.js.map +1 -1
  143. package/es/components/TextArea/TextArea.js +1 -1
  144. package/es/components/TextArea/TextArea.js.map +1 -1
  145. package/es/components/TextField/TextField.js +2 -2
  146. package/es/components/TextField/TextField.js.map +1 -1
  147. package/es/components/TextField/hooks/useKeyNavigation.js +9 -9
  148. package/es/components/TextField/hooks/useKeyNavigation.js.map +1 -1
  149. package/es/components/TextField/ui/TextFieldChip/TextFieldChip.js +1 -1
  150. package/es/components/TextField/ui/TextFieldChip/TextFieldChip.js.map +1 -1
  151. package/es/components/Toast/ToastProvider/ToastProvider.js +2 -2
  152. package/es/components/Toast/ToastProvider/ToastProvider.js.map +1 -1
  153. package/es/components/Tooltip/Tooltip.js +1 -1
  154. package/es/components/Tooltip/Tooltip.js.map +1 -1
  155. package/package.json +10 -10
  156. package/styled-components/cjs/components/Avatar/Avatar.js +2 -16
  157. package/styled-components/cjs/components/Avatar/Avatar.styles.js +1 -1
  158. package/styled-components/cjs/components/AvatarGroup/AvatarGroup.js +1 -1
  159. package/styled-components/cjs/components/Badge/Badge.js +1 -1
  160. package/styled-components/cjs/components/Badge/Badge.styles.js +1 -1
  161. package/styled-components/cjs/components/Button/Button.js +2 -2
  162. package/styled-components/cjs/components/Button/Button.styles.js +1 -1
  163. package/styled-components/cjs/components/ButtonGroup/ButtonGroup.js +1 -1
  164. package/styled-components/cjs/components/Calendar/CalendarBase/CalendarBase.js +2 -2
  165. package/styled-components/cjs/components/Calendar/CalendarBase/CalendarBase.styles.js +1 -1
  166. package/styled-components/cjs/components/Calendar/CalendarDouble/CalendarDouble.js +2 -2
  167. package/styled-components/cjs/components/Calendar/CalendarDouble/CalendarDouble.styles.js +1 -1
  168. package/styled-components/cjs/components/Calendar/hoc/withRange.js +2 -2
  169. package/styled-components/cjs/components/Calendar/hooks/useKeyNavigation.js +20 -20
  170. package/styled-components/cjs/components/Calendar/store/reducer.js +1 -1
  171. package/styled-components/cjs/components/Calendar/ui/CalendarDayItem/CalendarDayItem.js +1 -1
  172. package/styled-components/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js +4 -4
  173. package/styled-components/cjs/components/Calendar/ui/CalendarHeader/CalendarHeader.js +3 -3
  174. package/styled-components/cjs/components/Calendar/ui/CalendarMonths/CalendarMonths.js +2 -2
  175. package/styled-components/cjs/components/Calendar/ui/CalendarYears/CalendarYears.js +2 -2
  176. package/styled-components/cjs/components/Cell/Cell.js +1 -1
  177. package/styled-components/cjs/components/Cell/Cell.styles.js +1 -1
  178. package/styled-components/cjs/components/Checkbox/Checkbox.js +1 -1
  179. package/styled-components/cjs/components/Chip/Chip.js +3 -3
  180. package/styled-components/cjs/components/Chip/Chip.styles.js +1 -1
  181. package/styled-components/cjs/components/Combobox/Combobox.js +6 -6
  182. package/styled-components/cjs/components/Combobox/hooks/useFocusController.js +9 -9
  183. package/styled-components/cjs/components/Combobox/ui/ComboboxChip/ComboboxChip.js +2 -2
  184. package/styled-components/cjs/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js +7 -7
  185. package/styled-components/cjs/components/Counter/Counter.js +1 -1
  186. package/styled-components/cjs/components/Divider/Divider.js +2 -2
  187. package/styled-components/cjs/components/Drawer/Drawer.js +1 -1
  188. package/styled-components/cjs/components/Drawer/DrawerContext.js +1 -1
  189. package/styled-components/cjs/components/Drawer/hooks/useDrawer.js +1 -1
  190. package/styled-components/cjs/components/Drawer/ui/DrawerContent/DrawerContent.js +1 -1
  191. package/styled-components/cjs/components/Drawer/ui/DrawerFooter/DrawerFooter.js +1 -1
  192. package/styled-components/cjs/components/Drawer/ui/DrawerHeader/DrawerHeader.js +1 -1
  193. package/styled-components/cjs/components/Dropdown/Dropdown.js +1 -1
  194. package/styled-components/cjs/components/Dropdown/ui/DropdownDivider/DropdownDivider.js +1 -1
  195. package/styled-components/cjs/components/Dropdown/ui/DropdownFooter/DropdownFooter.js +1 -1
  196. package/styled-components/cjs/components/Dropdown/ui/DropdownGroup/DropdownGroup.js +1 -1
  197. package/styled-components/cjs/components/Dropdown/ui/DropdownHeader/DropdownHeader.js +1 -1
  198. package/styled-components/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.js +4 -4
  199. package/styled-components/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.styles.js +1 -1
  200. package/styled-components/cjs/components/Dropdown/utils/index.js +1 -1
  201. package/styled-components/cjs/components/Grid/Grid.js +2 -2
  202. package/styled-components/cjs/components/Grid/ui/Col/Col.js +2 -2
  203. package/styled-components/cjs/components/Grid/ui/Row/Row.js +1 -1
  204. package/styled-components/cjs/components/Grid/utils/index.js +1 -1
  205. package/styled-components/cjs/components/Header/HeaderRoot/HeaderRoot.js +1 -1
  206. package/styled-components/cjs/components/Header/ui/HeaderArrow/HeaderArrow.js +1 -1
  207. package/styled-components/cjs/components/Header/ui/HeaderLogo/HeaderLogo.js +1 -1
  208. package/styled-components/cjs/components/Header/ui/HeaderTitleWrapper/HeaderTitleWrapper.js +1 -1
  209. package/styled-components/cjs/components/Image/Image.js +2 -2
  210. package/styled-components/cjs/components/Image/Image.styles.js +1 -1
  211. package/styled-components/cjs/components/Indicator/Indicator.js +1 -1
  212. package/styled-components/cjs/components/Link/Link.js +1 -1
  213. package/styled-components/cjs/components/Modal/Modal.js +1 -1
  214. package/styled-components/cjs/components/Modal/ModalContext.js +1 -1
  215. package/styled-components/cjs/components/Modal/hooks/useModal.js +1 -1
  216. package/styled-components/cjs/components/Notification/Notification.js +1 -1
  217. package/styled-components/cjs/components/Notification/Notification.styles.js +1 -1
  218. package/styled-components/cjs/components/Notification/NotificationsPortal.js +1 -1
  219. package/styled-components/cjs/components/Notification/NotificationsStore.js +1 -1
  220. package/styled-components/cjs/components/Overlay/Overlay.js +2 -2
  221. package/styled-components/cjs/components/Pagination/Pagination.js +3 -3
  222. package/styled-components/cjs/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js +2 -2
  223. package/styled-components/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
  224. package/styled-components/cjs/components/Panel/Panel.js +2 -2
  225. package/styled-components/cjs/components/Panel/ui/PanelContent/PanelContent.js +1 -1
  226. package/styled-components/cjs/components/Panel/ui/PanelFooter/PanelFooter.js +1 -1
  227. package/styled-components/cjs/components/Panel/ui/PanelHeader/PanelHeader.js +1 -1
  228. package/styled-components/cjs/components/Popover/Popover.js +9 -9
  229. package/styled-components/cjs/components/Popup/Popup.js +2 -2
  230. package/styled-components/cjs/components/Popup/PopupContext.js +1 -1
  231. package/styled-components/cjs/components/Popup/PopupRoot.js +1 -1
  232. package/styled-components/cjs/components/Popup/hooks/usePopup.js +1 -1
  233. package/styled-components/cjs/components/Progress/Progress.js +1 -1
  234. package/styled-components/cjs/components/Progress/Progress.styles.js +1 -1
  235. package/styled-components/cjs/components/Radiobox/Radiobox.js +1 -1
  236. package/styled-components/cjs/components/SSRProvider/SSRProvider.js +1 -1
  237. package/styled-components/cjs/components/Segment/SegmentProvider/SegmentProvider.js +1 -1
  238. package/styled-components/cjs/components/Segment/ui/SegmentGroup/SegmentGroup.js +1 -1
  239. package/styled-components/cjs/components/Segment/ui/SegmentGroup/SegmentGroup.styles.js +1 -1
  240. package/styled-components/cjs/components/Segment/ui/SegmentItem/SegmentItem.js +3 -3
  241. package/styled-components/cjs/components/Segment/ui/SegmentItem/SegmentItem.styles.js +1 -1
  242. package/styled-components/cjs/components/Select/Select.js +6 -6
  243. package/styled-components/cjs/components/Select/hooks/useKeyNavigation.js +12 -12
  244. package/styled-components/cjs/components/Select/ui/SelectChip/SelectChip.js +2 -2
  245. package/styled-components/cjs/components/Select/ui/SelectTarget/SelectTarget.js +3 -3
  246. package/styled-components/cjs/components/Select/utils/index.js +3 -3
  247. package/styled-components/cjs/components/Skeleton/LineSkeleton/LineSkeleton.js +1 -1
  248. package/styled-components/cjs/components/Skeleton/LineSkeleton/LineSkeleton.styles.js +1 -1
  249. package/styled-components/cjs/components/Skeleton/RectSkeleton/RectSkeleton.js +1 -1
  250. package/styled-components/cjs/components/Skeleton/TextSkeleton/TextSkeleton.js +2 -2
  251. package/styled-components/cjs/components/Skeleton/hoc/withSkeleton.js +1 -1
  252. package/styled-components/cjs/components/Spinner/Spinner.js +1 -1
  253. package/styled-components/cjs/components/Spinner/Spinner.styles.js +1 -1
  254. package/styled-components/cjs/components/Spinner/utils/index.js +1 -1
  255. package/styled-components/cjs/components/Switch/Switch.js +1 -1
  256. package/styled-components/cjs/components/Tabs/TabsContext.js +2 -3
  257. package/styled-components/cjs/components/Tabs/createTabsController.js +1 -1
  258. package/styled-components/cjs/components/Tabs/ui/TabItem/TabItem.js +2 -2
  259. package/styled-components/cjs/components/Tabs/ui/TabItem/TabItem.styles.js +1 -1
  260. package/styled-components/cjs/components/Tabs/ui/Tabs/Tabs.js +3 -3
  261. package/styled-components/cjs/components/Tabs/ui/Tabs/Tabs.styles.js +1 -1
  262. package/styled-components/cjs/components/TextArea/TextArea.js +2 -2
  263. package/styled-components/cjs/components/TextField/TextField.js +3 -3
  264. package/styled-components/cjs/components/TextField/hooks/useKeyNavigation.js +9 -9
  265. package/styled-components/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js +2 -2
  266. package/styled-components/cjs/components/Toast/Toast.js +2 -2
  267. package/styled-components/cjs/components/Toast/Toast.styles.js +1 -1
  268. package/styled-components/cjs/components/Toast/ToastController.js +2 -2
  269. package/styled-components/cjs/components/Toast/ToastProvider/ToastProvider.js +3 -3
  270. package/styled-components/cjs/components/Toolbar/Toolbar.js +1 -1
  271. package/styled-components/cjs/components/Toolbar/ui/ToolbarDivider/ToolbarDivider.js +1 -1
  272. package/styled-components/cjs/components/Tooltip/Tooltip.js +2 -2
  273. package/styled-components/cjs/components/Typography/Old/Subtitle/Subtitle.js +2 -2
  274. package/styled-components/cjs/components/Typography/Old/TypographyOld.js +2 -2
  275. package/styled-components/cjs/components/Typography/Typography.js +2 -2
  276. package/styled-components/cjs/engines/common.js +1 -1
  277. package/styled-components/cjs/engines/styled-components.js +1 -1
  278. package/styled-components/cjs/examples/_helpers.js +1 -1
  279. package/styled-components/cjs/examples/plasma_b2c/components/Avatar/Avatar.stories.tsx +0 -1
  280. package/styled-components/cjs/examples/plasma_b2c/components/AvatarGroup/AvatarGroup.stories.tsx +18 -36
  281. package/styled-components/cjs/examples/plasma_b2c/components/Grid/Grid.config.js +1 -1
  282. package/styled-components/cjs/examples/plasma_web/components/Grid/Grid.config.js +1 -1
  283. package/styled-components/cjs/examples/sds_engineer/components/Grid/Grid.config.js +1 -1
  284. package/styled-components/cjs/mixins/applySpacing.js +1 -1
  285. package/styled-components/cjs/mixins/typography.js +1 -1
  286. package/styled-components/es/components/Avatar/Avatar.js +1 -15
  287. package/styled-components/es/components/Button/Button.js +1 -1
  288. package/styled-components/es/components/Calendar/CalendarBase/CalendarBase.js +1 -1
  289. package/styled-components/es/components/Calendar/CalendarDouble/CalendarDouble.js +1 -1
  290. package/styled-components/es/components/Calendar/hoc/withRange.js +1 -1
  291. package/styled-components/es/components/Calendar/hooks/useKeyNavigation.js +20 -20
  292. package/styled-components/es/components/Calendar/store/reducer.js +1 -1
  293. package/styled-components/es/components/Calendar/ui/CalendarDays/CalendarDays.js +3 -3
  294. package/styled-components/es/components/Calendar/ui/CalendarHeader/CalendarHeader.js +2 -2
  295. package/styled-components/es/components/Calendar/ui/CalendarMonths/CalendarMonths.js +1 -1
  296. package/styled-components/es/components/Calendar/ui/CalendarYears/CalendarYears.js +1 -1
  297. package/styled-components/es/components/Chip/Chip.js +2 -2
  298. package/styled-components/es/components/Combobox/Combobox.js +5 -5
  299. package/styled-components/es/components/Combobox/hooks/useFocusController.js +9 -9
  300. package/styled-components/es/components/Combobox/ui/ComboboxChip/ComboboxChip.js +1 -1
  301. package/styled-components/es/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js +6 -6
  302. package/styled-components/es/components/Divider/Divider.js +1 -1
  303. package/styled-components/es/components/Drawer/DrawerContext.js +1 -1
  304. package/styled-components/es/components/Drawer/hooks/useDrawer.js +1 -1
  305. package/styled-components/es/components/Drawer/ui/DrawerContent/DrawerContent.js +1 -1
  306. package/styled-components/es/components/Drawer/ui/DrawerFooter/DrawerFooter.js +1 -1
  307. package/styled-components/es/components/Drawer/ui/DrawerHeader/DrawerHeader.js +1 -1
  308. package/styled-components/es/components/Dropdown/ui/DropdownItem/DropdownItem.js +3 -3
  309. package/styled-components/es/components/Grid/Grid.js +1 -1
  310. package/styled-components/es/components/Grid/ui/Col/Col.js +1 -1
  311. package/styled-components/es/components/Grid/utils/index.js +1 -1
  312. package/styled-components/es/components/Image/Image.js +1 -1
  313. package/styled-components/es/components/Modal/ModalContext.js +1 -1
  314. package/styled-components/es/components/Modal/hooks/useModal.js +1 -1
  315. package/styled-components/es/components/Notification/NotificationsStore.js +1 -1
  316. package/styled-components/es/components/Overlay/Overlay.js +1 -1
  317. package/styled-components/es/components/Pagination/Pagination.js +2 -2
  318. package/styled-components/es/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js +1 -1
  319. package/styled-components/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +1 -1
  320. package/styled-components/es/components/Panel/Panel.js +1 -1
  321. package/styled-components/es/components/Popover/Popover.js +8 -8
  322. package/styled-components/es/components/Popup/Popup.js +1 -1
  323. package/styled-components/es/components/Popup/hooks/usePopup.js +1 -1
  324. package/styled-components/es/components/Segment/ui/SegmentItem/SegmentItem.js +2 -2
  325. package/styled-components/es/components/Select/Select.js +5 -5
  326. package/styled-components/es/components/Select/hooks/useKeyNavigation.js +12 -12
  327. package/styled-components/es/components/Select/ui/SelectChip/SelectChip.js +1 -1
  328. package/styled-components/es/components/Select/ui/SelectTarget/SelectTarget.js +2 -2
  329. package/styled-components/es/components/Select/utils/index.js +3 -3
  330. package/styled-components/es/components/Skeleton/TextSkeleton/TextSkeleton.js +1 -1
  331. package/styled-components/es/components/Skeleton/hoc/withSkeleton.js +1 -1
  332. package/styled-components/es/components/Spinner/utils/index.js +1 -1
  333. package/styled-components/es/components/Tabs/TabsContext.js +2 -3
  334. package/styled-components/es/components/Tabs/ui/TabItem/TabItem.js +1 -1
  335. package/styled-components/es/components/Tabs/ui/Tabs/Tabs.js +2 -2
  336. package/styled-components/es/components/TextArea/TextArea.js +1 -1
  337. package/styled-components/es/components/TextField/TextField.js +2 -2
  338. package/styled-components/es/components/TextField/hooks/useKeyNavigation.js +9 -9
  339. package/styled-components/es/components/TextField/ui/TextFieldChip/TextFieldChip.js +1 -1
  340. package/styled-components/es/components/Toast/Toast.js +1 -1
  341. package/styled-components/es/components/Toast/ToastController.js +1 -1
  342. package/styled-components/es/components/Toast/ToastProvider/ToastProvider.js +2 -2
  343. package/styled-components/es/components/Toolbar/ui/ToolbarDivider/ToolbarDivider.js +1 -1
  344. package/styled-components/es/components/Tooltip/Tooltip.js +1 -1
  345. package/styled-components/es/components/Typography/Old/Subtitle/Subtitle.js +1 -1
  346. package/styled-components/es/components/Typography/Old/TypographyOld.js +1 -1
  347. package/styled-components/es/components/Typography/Typography.js +1 -1
  348. package/styled-components/es/engines/common.js +1 -1
  349. package/styled-components/es/examples/_helpers.js +1 -1
  350. package/styled-components/es/examples/plasma_b2c/components/Avatar/Avatar.stories.tsx +0 -1
  351. package/styled-components/es/examples/plasma_b2c/components/AvatarGroup/AvatarGroup.stories.tsx +18 -36
  352. package/styled-components/es/examples/plasma_b2c/components/Grid/Grid.config.js +1 -1
  353. package/styled-components/es/examples/plasma_web/components/Grid/Grid.config.js +1 -1
  354. package/styled-components/es/examples/sds_engineer/components/Grid/Grid.config.js +1 -1
  355. package/styled-components/es/mixins/applySpacing.js +1 -1
  356. package/styled-components/es/mixins/typography.js +1 -1
  357. package/types/components/Avatar/Avatar.d.ts.map +1 -1
@@ -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,gBAAU,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,I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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;A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AI,EAAE;AACFoH,MAAAA,GAAG,EAAEE,WAAAA;KACR;AACDrH,IAAAA,IAAI,EAAE;AACFmH,MAAAA,GAAG,EAAEG,WAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNxH,IAAAA,IAAI,EAAE,SAAS;AACfC,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;;"}
@@ -43,17 +43,17 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
43
43
  selectChipIndex = _useState4[0],
44
44
  setSelectChipIndex = _useState4[1];
45
45
  React.useEffect(function () {
46
- var _itemsRefs$current, _itemsRefs$current$se;
46
+ var _itemsRefs$current;
47
47
  if (!opened) {
48
48
  setSelectItemIndex(-1);
49
49
  setSelectChipIndex(-1);
50
50
  return;
51
51
  }
52
- 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();
52
+ 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();
53
53
  }, [opened]);
54
54
  React.useEffect(function () {
55
- var _itemsRefs$current2, _itemsRefs$current2$s;
56
- 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();
55
+ var _itemsRefs$current2;
56
+ 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();
57
57
  }, [value, search]);
58
58
  var onKeyDownTarget = React.useCallback(function (event) {
59
59
  var _focusedItem;
@@ -92,7 +92,7 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
92
92
  var _ref2, _chipsRefs$current3;
93
93
  var _index2 = selectChipIndex - 1 <= 0 ? 0 : selectChipIndex - 1;
94
94
  newSelectChipIndex = chipsRefsCount === 0 ? -1 : _index2;
95
- 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];
95
+ 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];
96
96
  scrollIntoView = true;
97
97
  }
98
98
  if (code === Keys.ArrowUp || code === Keys.ArrowDown || code === Keys.Enter && componentType !== 'combobox' || code === Keys.Space && componentType !== 'combobox') {
@@ -108,10 +108,10 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
108
108
  }
109
109
  setSelectItemIndex(newSelectItemIndex);
110
110
  setSelectChipIndex(newSelectChipIndex);
111
- (_focusedItem = focusedItem) === null || _focusedItem === void 0 ? void 0 : _focusedItem.focus();
111
+ (_focusedItem = focusedItem) === null || _focusedItem === void 0 || _focusedItem.focus();
112
112
  if (scrollIntoView) {
113
113
  var _focusedItem2;
114
- (_focusedItem2 = focusedItem) === null || _focusedItem2 === void 0 ? void 0 : _focusedItem2.scrollIntoView({
114
+ (_focusedItem2 = focusedItem) === null || _focusedItem2 === void 0 || _focusedItem2.scrollIntoView({
115
115
  behavior: 'smooth',
116
116
  block: 'center',
117
117
  inline: 'center'
@@ -148,18 +148,18 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
148
148
  if (code === Keys.ArrowUp) {
149
149
  var _itemsRefs$current4;
150
150
  newSelectItemIndex = newSelectItemIndex - 1 === -1 ? itemsRefsCount - 1 : newSelectItemIndex - 1;
151
- focusedItem = itemsRefs === null || itemsRefs === void 0 ? void 0 : (_itemsRefs$current4 = itemsRefs.current) === null || _itemsRefs$current4 === void 0 ? void 0 : _itemsRefs$current4[newSelectItemIndex];
151
+ focusedItem = itemsRefs === null || itemsRefs === void 0 || (_itemsRefs$current4 = itemsRefs.current) === null || _itemsRefs$current4 === void 0 ? void 0 : _itemsRefs$current4[newSelectItemIndex];
152
152
  }
153
153
  if (code === Keys.ArrowDown) {
154
154
  var _itemsRefs$current5;
155
155
  newSelectItemIndex = newSelectItemIndex + 1 === itemsRefsCount ? 0 : newSelectItemIndex + 1;
156
- focusedItem = itemsRefs === null || itemsRefs === void 0 ? void 0 : (_itemsRefs$current5 = itemsRefs.current) === null || _itemsRefs$current5 === void 0 ? void 0 : _itemsRefs$current5[newSelectItemIndex];
156
+ focusedItem = itemsRefs === null || itemsRefs === void 0 || (_itemsRefs$current5 = itemsRefs.current) === null || _itemsRefs$current5 === void 0 ? void 0 : _itemsRefs$current5[newSelectItemIndex];
157
157
  }
158
158
  if ((code === Keys.ArrowRight || code === Keys.ArrowLeft) && valueType === 'multiple' && enumerationType === 'chip' && chipsRefsCount) {
159
159
  var _chipsRefs$current4;
160
160
  newSelectChipIndex = chipsRefsCount - 1;
161
161
  newSelectItemIndex = -1;
162
- focusedItem = chipsRefs === null || chipsRefs === void 0 ? void 0 : (_chipsRefs$current4 = chipsRefs.current) === null || _chipsRefs$current4 === void 0 ? void 0 : _chipsRefs$current4[newSelectChipIndex];
162
+ focusedItem = chipsRefs === null || chipsRefs === void 0 || (_chipsRefs$current4 = chipsRefs.current) === null || _chipsRefs$current4 === void 0 ? void 0 : _chipsRefs$current4[newSelectChipIndex];
163
163
  scrollIntoView = true;
164
164
  }
165
165
  if (code === Keys.Enter || code === Keys.Space && componentType !== 'combobox') {
@@ -185,10 +185,10 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
185
185
  updateOpened(newOpened, event);
186
186
  setSelectItemIndex(newSelectItemIndex);
187
187
  setSelectChipIndex(newSelectChipIndex);
188
- (_focusedItem3 = focusedItem) === null || _focusedItem3 === void 0 ? void 0 : _focusedItem3.focus();
188
+ (_focusedItem3 = focusedItem) === null || _focusedItem3 === void 0 || _focusedItem3.focus();
189
189
  if (scrollIntoView) {
190
190
  var _focusedItem4;
191
- (_focusedItem4 = focusedItem) === null || _focusedItem4 === void 0 ? void 0 : _focusedItem4.scrollIntoView({
191
+ (_focusedItem4 = focusedItem) === null || _focusedItem4 === void 0 || _focusedItem4.scrollIntoView({
192
192
  behavior: 'smooth',
193
193
  block: 'center',
194
194
  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","_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,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAAC,IAAA,EAUA;AAAA,EAAA,IAAAC,mBAAA,GAAAD,IAAA,CATzBE,cAAc;IAAIC,SAAS,GAAAF,mBAAA,CAATE,SAAS;IAAEC,SAAS,GAAAH,mBAAA,CAATG,SAAS;IAAEC,SAAS,GAAAJ,mBAAA,CAATI,SAAS;IAAEC,SAAS,GAAAL,mBAAA,CAATK,SAAS;IAAEC,QAAQ,GAAA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IAAA,IAAIU,cAAc,EAAE;AAAA,MAAA,IAAAkC,aAAA,CAAA;MAChB,CAAAA,aAAA,GAAA9B,WAAW,MAAA,IAAA,IAAA8B,aAAA,KAAXA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,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,CACIlD,MAAM,EACNa,eAAe,EACfI,eAAe,EACff,SAAS,EACTD,eAAe,EACfG,aAAa,EACbI,YAAY,EACZD,WAAW,CAEnB,CAAC,CAAA;EAED,OAAO;AAAEmB,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","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,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,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAAC,IAAA,EAUA;AAAA,EAAA,IAAAC,mBAAA,GAAAD,IAAA,CATzBE,cAAc;IAAIC,SAAS,GAAAF,mBAAA,CAATE,SAAS;IAAEC,SAAS,GAAAH,mBAAA,CAATG,SAAS;IAAEC,SAAS,GAAAJ,mBAAA,CAATI,SAAS;IAAEC,SAAS,GAAAL,mBAAA,CAATK,SAAS;IAAEC,QAAQ,GAAAN,mBAAA,CA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,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;;;;;"}
@@ -21,7 +21,7 @@ var SelectChip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
21
21
  onClear(value, text);
22
22
  }, [onClear, value, text]);
23
23
  var onKeyDownHandle = React.useCallback(function (event) {
24
- onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(value, text, index, event);
24
+ onKeyDown === null || onKeyDown === void 0 || onKeyDown(value, text, index, event);
25
25
  }, [onKeyDown]);
26
26
  return /*#__PURE__*/React.createElement(SelectChip_styles.StyledChip, {
27
27
  ref: ref,
@@ -1 +1 @@
1
- {"version":3,"file":"SelectChip.js","sources":["../../../../../src/components/Select/ui/SelectChip/SelectChip.tsx"],"sourcesContent":["import React, { forwardRef, useCallback } from 'react';\n\nimport { StyledChip } from './SelectChip.styles';\nimport type { SelectChipProps } from './SelectChip.types';\n\n/**\n * Чип, отображающий выбранный элемент\n */\nexport const SelectChip = forwardRef<HTMLButtonElement, SelectChipProps>(\n ({ value, text, index, disabled, readOnly, onClick, onClear, onKeyDown }, ref) => {\n const onClearHandle = useCallback(() => {\n onClear(value, text);\n }, [onClear, value, text]);\n\n const onKeyDownHandle = useCallback(\n (event: React.KeyboardEvent<HTMLButtonElement>) => {\n onKeyDown?.(value, text, index, event);\n },\n [onKeyDown],\n );\n\n return (\n <StyledChip\n ref={ref}\n tabIndex={-1}\n disabled={disabled}\n readOnly={readOnly}\n onClick={onClick}\n onClear={onClearHandle}\n onKeyDown={onKeyDownHandle}\n text={`${text}`}\n />\n );\n },\n);\n"],"names":["SelectChip","forwardRef","_ref","ref","value","text","index","disabled","readOnly","onClick","onClear","onKeyDown","onClearHandle","useCallback","onKeyDownHandle","event","React","createElement","StyledChip","tabIndex","concat"],"mappings":";;;;;;;AAKA;AACA;AACA;AACO,IAAMA,UAAU,gBAAGC,gBAAU,CAChC,UAAAC,IAAA,EAA0EC,GAAG,EAAK;AAAA,EAAA,IAA/EC,KAAK,GAAAF,IAAA,CAALE,KAAK;IAAEC,IAAI,GAAAH,IAAA,CAAJG,IAAI;IAAEC,KAAK,GAAAJ,IAAA,CAALI,KAAK;IAAEC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;IAAEC,QAAQ,GAAAN,IAAA,CAARM,QAAQ;IAAEC,OAAO,GAAAP,IAAA,CAAPO,OAAO;IAAEC,OAAO,GAAAR,IAAA,CAAPQ,OAAO;IAAEC,SAAS,GAAAT,IAAA,CAATS,SAAS,CAAA;AAClE,EAAA,IAAMC,aAAa,GAAGC,iBAAW,CAAC,YAAM;AACpCH,IAAAA,OAAO,CAACN,KAAK,EAAEC,IAAI,CAAC,CAAA;GACvB,EAAE,CAACK,OAAO,EAAEN,KAAK,EAAEC,IAAI,CAAC,CAAC,CAAA;AAE1B,EAAA,IAAMS,eAAe,GAAGD,iBAAW,CAC/B,UAACE,KAA6C,EAAK;AAC/CJ,IAAAA,SAAS,KAATA,IAAAA,IAAAA,SAAS,KAATA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,SAAS,CAAGP,KAAK,EAAEC,IAAI,EAAEC,KAAK,EAAES,KAAK,CAAC,CAAA;AAC1C,GAAC,EACD,CAACJ,SAAS,CACd,CAAC,CAAA;AAED,EAAA,oBACIK,KAAA,CAAAC,aAAA,CAACC,4BAAU,EAAA;AACPf,IAAAA,GAAG,EAAEA,GAAI;IACTgB,QAAQ,EAAE,CAAC,CAAE;AACbZ,IAAAA,QAAQ,EAAEA,QAAS;AACnBC,IAAAA,QAAQ,EAAEA,QAAS;AACnBC,IAAAA,OAAO,EAAEA,OAAQ;AACjBC,IAAAA,OAAO,EAAEE,aAAc;AACvBD,IAAAA,SAAS,EAAEG,eAAgB;IAC3BT,IAAI,EAAA,EAAA,CAAAe,MAAA,CAAKf,IAAI,CAAA;AAAG,GACnB,CAAC,CAAA;AAEV,CACJ;;;;"}
1
+ {"version":3,"file":"SelectChip.js","sources":["../../../../../src/components/Select/ui/SelectChip/SelectChip.tsx"],"sourcesContent":["import React, { forwardRef, useCallback } from 'react';\n\nimport { StyledChip } from './SelectChip.styles';\nimport type { SelectChipProps } from './SelectChip.types';\n\n/**\n * Чип, отображающий выбранный элемент\n */\nexport const SelectChip = forwardRef<HTMLButtonElement, SelectChipProps>(\n ({ value, text, index, disabled, readOnly, onClick, onClear, onKeyDown }, ref) => {\n const onClearHandle = useCallback(() => {\n onClear(value, text);\n }, [onClear, value, text]);\n\n const onKeyDownHandle = useCallback(\n (event: React.KeyboardEvent<HTMLButtonElement>) => {\n onKeyDown?.(value, text, index, event);\n },\n [onKeyDown],\n );\n\n return (\n <StyledChip\n ref={ref}\n tabIndex={-1}\n disabled={disabled}\n readOnly={readOnly}\n onClick={onClick}\n onClear={onClearHandle}\n onKeyDown={onKeyDownHandle}\n text={`${text}`}\n />\n );\n },\n);\n"],"names":["SelectChip","forwardRef","_ref","ref","value","text","index","disabled","readOnly","onClick","onClear","onKeyDown","onClearHandle","useCallback","onKeyDownHandle","event","React","createElement","StyledChip","tabIndex","concat"],"mappings":";;;;;;;AAKA;AACA;AACA;AACO,IAAMA,UAAU,gBAAGC,gBAAU,CAChC,UAAAC,IAAA,EAA0EC,GAAG,EAAK;AAAA,EAAA,IAA/EC,KAAK,GAAAF,IAAA,CAALE,KAAK;IAAEC,IAAI,GAAAH,IAAA,CAAJG,IAAI;IAAEC,KAAK,GAAAJ,IAAA,CAALI,KAAK;IAAEC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;IAAEC,QAAQ,GAAAN,IAAA,CAARM,QAAQ;IAAEC,OAAO,GAAAP,IAAA,CAAPO,OAAO;IAAEC,OAAO,GAAAR,IAAA,CAAPQ,OAAO;IAAEC,SAAS,GAAAT,IAAA,CAATS,SAAS,CAAA;AAClE,EAAA,IAAMC,aAAa,GAAGC,iBAAW,CAAC,YAAM;AACpCH,IAAAA,OAAO,CAACN,KAAK,EAAEC,IAAI,CAAC,CAAA;GACvB,EAAE,CAACK,OAAO,EAAEN,KAAK,EAAEC,IAAI,CAAC,CAAC,CAAA;AAE1B,EAAA,IAAMS,eAAe,GAAGD,iBAAW,CAC/B,UAACE,KAA6C,EAAK;AAC/CJ,IAAAA,SAAS,KAATA,IAAAA,IAAAA,SAAS,KAATA,KAAAA,CAAAA,IAAAA,SAAS,CAAGP,KAAK,EAAEC,IAAI,EAAEC,KAAK,EAAES,KAAK,CAAC,CAAA;AAC1C,GAAC,EACD,CAACJ,SAAS,CACd,CAAC,CAAA;AAED,EAAA,oBACIK,KAAA,CAAAC,aAAA,CAACC,4BAAU,EAAA;AACPf,IAAAA,GAAG,EAAEA,GAAI;IACTgB,QAAQ,EAAE,CAAC,CAAE;AACbZ,IAAAA,QAAQ,EAAEA,QAAS;AACnBC,IAAAA,QAAQ,EAAEA,QAAS;AACnBC,IAAAA,OAAO,EAAEA,OAAQ;AACjBC,IAAAA,OAAO,EAAEE,aAAc;AACvBD,IAAAA,SAAS,EAAEG,eAAgB;IAC3BT,IAAI,EAAA,EAAA,CAAAe,MAAA,CAAKf,IAAI,CAAA;AAAG,GACnB,CAAC,CAAA;AAEV,CACJ;;;;"}
@@ -69,8 +69,8 @@ var SelectTarget = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
69
69
  itemValue = _ref9[0];
70
70
  return itemValue;
71
71
  });
72
- chipsRefs === null || chipsRefs === void 0 ? void 0 : chipsRefs.current.splice(index, 1);
73
- onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
72
+ chipsRefs === null || chipsRefs === void 0 || chipsRefs.current.splice(index, 1);
73
+ onChange === null || onChange === void 0 || onChange(newValue);
74
74
  }, [values, onChange]);
75
75
  var onChipKeyDown = React.useCallback(function (value, text, index, event) {
76
76
  var code = event.code,
@@ -1 +1 @@
1
- {"version":3,"file":"SelectTarget.js","sources":["../../../../../src/components/Select/ui/SelectTarget/SelectTarget.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useRef } from 'react';\n\nimport { classes } from '../../Select.tokens';\nimport { cx } from '../../../../utils';\nimport { SelectChip } from '../SelectChip/SelectChip';\nimport type { SelectPrimitiveValue } from '../../Select.types';\nimport { Keys } from '../../hooks/useKeyNavigation';\n\nimport {\n StyledArrow,\n StyledChips,\n StyledChipsWrapper,\n StyledLabel,\n StyledSelectTarget,\n StyledText,\n} from './SelectTarget.styles';\nimport type { SelectTargetProps } from './SelectTarget.types';\n\nconst {\n hasNoFocus,\n hasChips,\n innerLabelUp,\n arrowInverse,\n selectTarget,\n selectTargetArrow,\n selectTargeText,\n selectTargetLabel,\n} = classes;\n\n/**\n * Элемент для выпадающего списка\n */\nexport const SelectTarget = forwardRef<HTMLButtonElement, SelectTargetProps>(\n (\n {\n values,\n target = 'textField-like',\n label,\n opened,\n readOnly,\n disabled,\n enumerationType,\n size,\n id,\n chipsRefs,\n onChange,\n onKeyDown,\n ...rest\n },\n ref,\n ) => {\n const hasText = Boolean(values?.some(([value]) => value));\n\n const hasLabel = label && size !== 'xs' && target === 'textField-like';\n const textContent = values?.map(([, text]) => text).join(', ');\n const contentRef = useRef<HTMLDivElement>(null);\n\n const withArrowInverse = opened ? arrowInverse : undefined;\n const withInnerLabelUp = hasLabel && hasText ? innerLabelUp : undefined;\n const withHasChips =\n hasText && enumerationType === 'chip' && target === 'textField-like' ? hasChips : undefined;\n\n const withNoFocus = target === 'textField-like' ? hasNoFocus : undefined;\n\n const isLabelVisible = !hasText || (hasLabel && enumerationType === 'comma');\n\n const onChipClick = useCallback((event: React.MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation();\n }, []);\n\n const onChipClear = useCallback(\n (value: SelectPrimitiveValue, text: SelectPrimitiveValue, index: number) => {\n const newValue = values\n ?.filter(([itemValue, itemText]) => !(itemValue === value && itemText === text))\n .map(([itemValue]) => itemValue);\n\n chipsRefs?.current.splice(index, 1);\n onChange?.(newValue);\n },\n [values, onChange],\n );\n\n const onChipKeyDown = useCallback(\n (\n value: SelectPrimitiveValue,\n text: SelectPrimitiveValue,\n index: number,\n event: React.KeyboardEvent<HTMLButtonElement>,\n ) => {\n const { code, shiftKey } = event;\n\n if (code === Keys.Tab || (code === Keys.Tab && shiftKey)) {\n event.preventDefault();\n }\n\n if (code === Keys.Backspace) {\n onChipClear(value, text, index);\n }\n },\n [onChipClear],\n );\n\n const onWheel = useCallback((event: React.WheelEvent<HTMLButtonElement>) => {\n const { deltaY } = event;\n\n if (contentRef.current) {\n contentRef.current.scrollLeft += Math.round(deltaY);\n }\n }, []);\n\n const getRef = useCallback((element: HTMLButtonElement | null, index: number) => {\n if (element && chipsRefs && chipsRefs.current) {\n chipsRefs.current[index] = element;\n }\n }, []);\n\n // INFO: Нужно очищать на каждый ререндер компонента для актуализации состояния рефов\n if (chipsRefs) {\n chipsRefs.current = [];\n }\n\n return (\n <StyledSelectTarget\n {...rest}\n ref={ref}\n opened={opened}\n target={target}\n readOnly={readOnly}\n disabled={disabled}\n title={textContent}\n aria-label={label}\n className={cx(withInnerLabelUp, withHasChips, withNoFocus, selectTarget)}\n onWheel={onWheel}\n onKeyDown={onKeyDown}\n stretching=\"filled\"\n >\n {hasText &&\n (enumerationType === 'comma' || target === 'button-like' ? (\n <StyledText className={selectTargeText}>{textContent}</StyledText>\n ) : (\n <StyledChipsWrapper ref={contentRef}>\n <StyledChips>\n {values?.map(([value, text], index) => (\n <SelectChip\n index={index}\n ref={(element) => getRef(element, index)}\n key={`${value}_${text}`}\n disabled={disabled}\n readOnly={readOnly}\n value={value}\n text={text}\n onClear={(v, t) => onChipClear(v, t, index)}\n onClick={onChipClick}\n onKeyDown={onChipKeyDown}\n />\n ))}\n </StyledChips>\n </StyledChipsWrapper>\n ))}\n {isLabelVisible && (\n <StyledLabel className={selectTargetLabel} htmlFor={id}>\n {label}\n </StyledLabel>\n )}\n <StyledArrow size=\"s\" color=\"inherit\" className={cx(selectTargetArrow, withArrowInverse)} />\n </StyledSelectTarget>\n );\n },\n);\n"],"names":["hasNoFocus","classes","hasChips","innerLabelUp","arrowInverse","selectTarget","selectTargetArrow","selectTargeText","selectTargetLabel","SelectTarget","forwardRef","_ref","ref","values","_ref$target","target","label","opened","readOnly","disabled","enumerationType","size","id","chipsRefs","onChange","onKeyDown","rest","_objectWithoutProperties","_excluded","hasText","Boolean","some","_ref2","_ref3","_slicedToArray","value","hasLabel","textContent","map","_ref4","_ref5","text","join","contentRef","useRef","withArrowInverse","undefined","withInnerLabelUp","withHasChips","withNoFocus","isLabelVisible","onChipClick","useCallback","event","stopPropagation","onChipClear","index","newValue","filter","_ref6","_ref7","itemValue","itemText","_ref8","_ref9","current","splice","onChipKeyDown","code","shiftKey","Keys","Tab","preventDefault","Backspace","onWheel","deltaY","scrollLeft","Math","round","getRef","element","React","createElement","StyledSelectTarget","_extends","title","className","cx","stretching","StyledText","StyledChipsWrapper","StyledChips","_ref10","_ref11","SelectChip","key","concat","onClear","v","t","onClick","StyledLabel","htmlFor","StyledArrow","color"],"mappings":";;;;;;;;;;;;;AAkBA,IACIA,UAAU,GAQVC,qBAAO,CARPD,UAAU;EACVE,QAAQ,GAORD,qBAAO,CAPPC,QAAQ;EACRC,YAAY,GAMZF,qBAAO,CANPE,YAAY;EACZC,YAAY,GAKZH,qBAAO,CALPG,YAAY;EACZC,YAAY,GAIZJ,qBAAO,CAJPI,YAAY;EACZC,iBAAiB,GAGjBL,qBAAO,CAHPK,iBAAiB;EACjBC,eAAe,GAEfN,qBAAO,CAFPM,eAAe;EACfC,iBAAiB,GACjBP,qBAAO,CADPO,iBAAiB,CAAA;;AAGrB;AACA;AACA;AACO,IAAMC,YAAY,gBAAGC,gBAAU,CAClC,UAAAC,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AA,QAAA,OAAK5C,WAAW,CAAC2C,CAAC,EAAEC,CAAC,EAAE3C,KAAK,CAAC,CAAA;OAAC;AAC5C4C,MAAAA,OAAO,EAAEjD,WAAY;AACrB1B,MAAAA,SAAS,EAAE0C,aAAAA;AAAc,KAC5B,CAAC,CAAA;GACL,CACQ,CACG,CACvB,CAAC,EACLjB,cAAc,iBACX+B,KAAA,CAAAC,aAAA,CAACmB,+BAAW,EAAA;AAACf,IAAAA,SAAS,EAAE9E,iBAAkB;AAAC8F,IAAAA,OAAO,EAAEhF,EAAAA;AAAG,GAAA,EAClDN,KACQ,CAChB,eACDiE,KAAA,CAAAC,aAAA,CAACqB,+BAAW,EAAA;AAAClF,IAAAA,IAAI,EAAC,GAAG;AAACmF,IAAAA,KAAK,EAAC,SAAS;AAAClB,IAAAA,SAAS,EAAEC,QAAE,CAACjF,iBAAiB,EAAEuC,gBAAgB,CAAA;AAAE,GAAE,CAC3E,CAAC,CAAA;AAE7B,CACJ;;;;"}
1
+ {"version":3,"file":"SelectTarget.js","sources":["../../../../../src/components/Select/ui/SelectTarget/SelectTarget.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useRef } from 'react';\n\nimport { classes } from '../../Select.tokens';\nimport { cx } from '../../../../utils';\nimport { SelectChip } from '../SelectChip/SelectChip';\nimport type { SelectPrimitiveValue } from '../../Select.types';\nimport { Keys } from '../../hooks/useKeyNavigation';\n\nimport {\n StyledArrow,\n StyledChips,\n StyledChipsWrapper,\n StyledLabel,\n StyledSelectTarget,\n StyledText,\n} from './SelectTarget.styles';\nimport type { SelectTargetProps } from './SelectTarget.types';\n\nconst {\n hasNoFocus,\n hasChips,\n innerLabelUp,\n arrowInverse,\n selectTarget,\n selectTargetArrow,\n selectTargeText,\n selectTargetLabel,\n} = classes;\n\n/**\n * Элемент для выпадающего списка\n */\nexport const SelectTarget = forwardRef<HTMLButtonElement, SelectTargetProps>(\n (\n {\n values,\n target = 'textField-like',\n label,\n opened,\n readOnly,\n disabled,\n enumerationType,\n size,\n id,\n chipsRefs,\n onChange,\n onKeyDown,\n ...rest\n },\n ref,\n ) => {\n const hasText = Boolean(values?.some(([value]) => value));\n\n const hasLabel = label && size !== 'xs' && target === 'textField-like';\n const textContent = values?.map(([, text]) => text).join(', ');\n const contentRef = useRef<HTMLDivElement>(null);\n\n const withArrowInverse = opened ? arrowInverse : undefined;\n const withInnerLabelUp = hasLabel && hasText ? innerLabelUp : undefined;\n const withHasChips =\n hasText && enumerationType === 'chip' && target === 'textField-like' ? hasChips : undefined;\n\n const withNoFocus = target === 'textField-like' ? hasNoFocus : undefined;\n\n const isLabelVisible = !hasText || (hasLabel && enumerationType === 'comma');\n\n const onChipClick = useCallback((event: React.MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation();\n }, []);\n\n const onChipClear = useCallback(\n (value: SelectPrimitiveValue, text: SelectPrimitiveValue, index: number) => {\n const newValue = values\n ?.filter(([itemValue, itemText]) => !(itemValue === value && itemText === text))\n .map(([itemValue]) => itemValue);\n\n chipsRefs?.current.splice(index, 1);\n onChange?.(newValue);\n },\n [values, onChange],\n );\n\n const onChipKeyDown = useCallback(\n (\n value: SelectPrimitiveValue,\n text: SelectPrimitiveValue,\n index: number,\n event: React.KeyboardEvent<HTMLButtonElement>,\n ) => {\n const { code, shiftKey } = event;\n\n if (code === Keys.Tab || (code === Keys.Tab && shiftKey)) {\n event.preventDefault();\n }\n\n if (code === Keys.Backspace) {\n onChipClear(value, text, index);\n }\n },\n [onChipClear],\n );\n\n const onWheel = useCallback((event: React.WheelEvent<HTMLButtonElement>) => {\n const { deltaY } = event;\n\n if (contentRef.current) {\n contentRef.current.scrollLeft += Math.round(deltaY);\n }\n }, []);\n\n const getRef = useCallback((element: HTMLButtonElement | null, index: number) => {\n if (element && chipsRefs && chipsRefs.current) {\n chipsRefs.current[index] = element;\n }\n }, []);\n\n // INFO: Нужно очищать на каждый ререндер компонента для актуализации состояния рефов\n if (chipsRefs) {\n chipsRefs.current = [];\n }\n\n return (\n <StyledSelectTarget\n {...rest}\n ref={ref}\n opened={opened}\n target={target}\n readOnly={readOnly}\n disabled={disabled}\n title={textContent}\n aria-label={label}\n className={cx(withInnerLabelUp, withHasChips, withNoFocus, selectTarget)}\n onWheel={onWheel}\n onKeyDown={onKeyDown}\n stretching=\"filled\"\n >\n {hasText &&\n (enumerationType === 'comma' || target === 'button-like' ? (\n <StyledText className={selectTargeText}>{textContent}</StyledText>\n ) : (\n <StyledChipsWrapper ref={contentRef}>\n <StyledChips>\n {values?.map(([value, text], index) => (\n <SelectChip\n index={index}\n ref={(element) => getRef(element, index)}\n key={`${value}_${text}`}\n disabled={disabled}\n readOnly={readOnly}\n value={value}\n text={text}\n onClear={(v, t) => onChipClear(v, t, index)}\n onClick={onChipClick}\n onKeyDown={onChipKeyDown}\n />\n ))}\n </StyledChips>\n </StyledChipsWrapper>\n ))}\n {isLabelVisible && (\n <StyledLabel className={selectTargetLabel} htmlFor={id}>\n {label}\n </StyledLabel>\n )}\n <StyledArrow size=\"s\" color=\"inherit\" className={cx(selectTargetArrow, withArrowInverse)} />\n </StyledSelectTarget>\n );\n },\n);\n"],"names":["hasNoFocus","classes","hasChips","innerLabelUp","arrowInverse","selectTarget","selectTargetArrow","selectTargeText","selectTargetLabel","SelectTarget","forwardRef","_ref","ref","values","_ref$target","target","label","opened","readOnly","disabled","enumerationType","size","id","chipsRefs","onChange","onKeyDown","rest","_objectWithoutProperties","_excluded","hasText","Boolean","some","_ref2","_ref3","_slicedToArray","value","hasLabel","textContent","map","_ref4","_ref5","text","join","contentRef","useRef","withArrowInverse","undefined","withInnerLabelUp","withHasChips","withNoFocus","isLabelVisible","onChipClick","useCallback","event","stopPropagation","onChipClear","index","newValue","filter","_ref6","_ref7","itemValue","itemText","_ref8","_ref9","current","splice","onChipKeyDown","code","shiftKey","Keys","Tab","preventDefault","Backspace","onWheel","deltaY","scrollLeft","Math","round","getRef","element","React","createElement","StyledSelectTarget","_extends","title","className","cx","stretching","StyledText","StyledChipsWrapper","StyledChips","_ref10","_ref11","SelectChip","key","concat","onClear","v","t","onClick","StyledLabel","htmlFor","StyledArrow","color"],"mappings":";;;;;;;;;;;;;AAkBA,IACIA,UAAU,GAQVC,qBAAO,CARPD,UAAU;EACVE,QAAQ,GAORD,qBAAO,CAPPC,QAAQ;EACRC,YAAY,GAMZF,qBAAO,CANPE,YAAY;EACZC,YAAY,GAKZH,qBAAO,CALPG,YAAY;EACZC,YAAY,GAIZJ,qBAAO,CAJPI,YAAY;EACZC,iBAAiB,GAGjBL,qBAAO,CAHPK,iBAAiB;EACjBC,eAAe,GAEfN,qBAAO,CAFPM,eAAe;EACfC,iBAAiB,GACjBP,qBAAO,CADPO,iBAAiB,CAAA;;AAGrB;AACA;AACA;AACO,IAAMC,YAAY,gBAAGC,gBAAU,CAClC,UAAAC,IAAA,EAgBIC,GAAG,EACF;AAAA,EAAA,IAfGC,MAAM,GAAAF,IAAA,CAANE,MAAM;IAAAC,WAAA,GAAAH,IAAA,CACNI,MAAM;AAANA,IAAAA,MAAM,GAAAD,WAAA,KAAG,KAAA,CAAA,GAAA,gBAAgB,GAAAA,WAAA;IACzBE,KAAK,GAAAL,IAAA,CAALK,KAAK;IACLC,MAAM,GAAAN,IAAA,CAANM,MAAM;IACNC,QAAQ,GAAAP,IAAA,CAARO,QAAQ;IACRC,QAAQ,GAAAR,IAAA,CAARQ,QAAQ;IACRC,eAAe,GAAAT,IAAA,CAAfS,eAAe;IACfC,IAAI,GAAAV,IAAA,CAAJU,IAAI;IACJC,EAAE,GAAAX,IAAA,CAAFW,EAAE;IACFC,SAAS,GAAAZ,IAAA,CAATY,SAAS;IACTC,QAAQ,GAAAb,IAAA,CAARa,QAAQ;IACRC,SAAS,GAAAd,IAAA,CAATc,SAAS;AACNC,IAAAA,IAAI,GAAAC,iDAAA,CAAAhB,IAAA,EAAAiB,SAAA,CAAA,CAAA;AAIX,EAAA,IAAMC,OAAO,GAAGC,OAAO,CAACjB,MAAM,KAAA,IAAA,IAANA,MAA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,EAAA;AACPtC,MAAAA,KAAK,EAAEA,KAAM;MACb5C,GAAG,EAAE,SAAAA,GAAAA,CAACoE,OAAO,EAAA;AAAA,QAAA,OAAKD,MAAM,CAACC,OAAO,EAAExB,KAAK,CAAC,CAAA;OAAC;MACzCuC,GAAG,EAAA,EAAA,CAAAC,MAAA,CAAK7D,KAAK,OAAA6D,MAAA,CAAIvD,IAAI,CAAG;AACxBtB,MAAAA,QAAQ,EAAEA,QAAS;AACnBD,MAAAA,QAAQ,EAAEA,QAAS;AACnBiB,MAAAA,KAAK,EAAEA,KAAM;AACbM,MAAAA,IAAI,EAAEA,IAAK;AACXwD,MAAAA,OAAO,EAAE,SAAAA,OAACC,CAAAA,CAAC,EAAEC,CAAC,EAAA;AAAA,QAAA,OAAK5C,WAAW,CAAC2C,CAAC,EAAEC,CAAC,EAAE3C,KAAK,CAAC,CAAA;OAAC;AAC5C4C,MAAAA,OAAO,EAAEjD,WAAY;AACrB1B,MAAAA,SAAS,EAAE0C,aAAAA;AAAc,KAC5B,CAAC,CAAA;GACL,CACQ,CACG,CACvB,CAAC,EACLjB,cAAc,iBACX+B,KAAA,CAAAC,aAAA,CAACmB,+BAAW,EAAA;AAACf,IAAAA,SAAS,EAAE9E,iBAAkB;AAAC8F,IAAAA,OAAO,EAAEhF,EAAAA;AAAG,GAAA,EAClDN,KACQ,CAChB,eACDiE,KAAA,CAAAC,aAAA,CAACqB,+BAAW,EAAA;AAAClF,IAAAA,IAAI,EAAC,GAAG;AAACmF,IAAAA,KAAK,EAAC,SAAS;AAAClB,IAAAA,SAAS,EAAEC,QAAE,CAACjF,iBAAiB,EAAEuC,gBAAgB,CAAA;AAAE,GAAE,CAC3E,CAAC,CAAA;AAE7B,CACJ;;;;"}
@@ -80,8 +80,8 @@ var updatePropsRecursively = function updatePropsRecursively(children, externalP
80
80
  },
81
81
  onClick: function onClick(event) {
82
82
  var _child$props$onClick, _child$props, _externalProps$onClic;
83
- (_child$props$onClick = (_child$props = child.props).onClick) === null || _child$props$onClick === void 0 ? void 0 : _child$props$onClick.call(_child$props, event);
84
- externalProps === null || externalProps === void 0 ? void 0 : (_externalProps$onClic = externalProps.onClick) === null || _externalProps$onClic === void 0 ? void 0 : _externalProps$onClic.call(externalProps, event);
83
+ (_child$props$onClick = (_child$props = child.props).onClick) === null || _child$props$onClick === void 0 || _child$props$onClick.call(_child$props, event);
84
+ externalProps === null || externalProps === void 0 || (_externalProps$onClic = externalProps.onClick) === null || _externalProps$onClic === void 0 || _externalProps$onClic.call(externalProps, event);
85
85
  }
86
86
  });
87
87
  var updatedChild = updatePropsRecursively(child.props.children, externalProps, value, search, filterFunction);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/Select/utils/index.ts"],"sourcesContent":["import { Children, MouseEvent, ReactElement, ReactNode, cloneElement, isValidElement } from 'react';\n\nimport { SelectPrimitiveValue, ValueType, SelectValue } from '../Select.types';\nimport { SelectItemProps } from '../ui/SelectItem/SelectItem.type';\n\ntype NewSelectedFunc = {\n (selected?: undefined | null, newValue?: undefined | null, type?: undefined | null): undefined;\n (selected?: SelectPrimitiveValue, newValue?: SelectPrimitiveValue, type?: ValueType): SelectPrimitiveValue;\n (selected?: Array<SelectPrimitiveValue>, newValue?: SelectPrimitiveValue, type?: ValueType): Array<\n SelectPrimitiveValue\n >;\n};\n\nexport const getNewSelected: NewSelectedFunc = (selected: any, newValue: any, type: any) => {\n if (newValue === undefined || newValue === null) {\n return newValue;\n }\n\n if (\n (type === 'single' || type === 'native') &&\n (typeof newValue === 'string' || typeof newValue === 'number' || typeof newValue === 'boolean')\n ) {\n return newValue;\n }\n\n const newSelected = selected || [];\n\n const set = new Set(newSelected);\n\n if (set.has(newValue)) {\n set.delete(newValue);\n } else {\n set.add(newValue);\n }\n\n return Array.from(set);\n};\n\nconst getChildrenInnerText = (children: ReactElement): string => {\n if (!children || typeof children === 'string') {\n return children;\n }\n\n return getChildrenInnerText(children.props.children);\n};\n\nexport const getValues = (items: ReactElement[], value?: SelectValue, result: Array<Array<string>> = []) => {\n items.forEach((item) => {\n if (item.props === undefined) {\n return result;\n }\n\n const { value: newValue } = item.props;\n\n if (item.props.children && Array.isArray(item.props.children)) {\n return getValues(item.props.children, value, result);\n }\n\n if (\n (!Array.isArray(value) && newValue === value) ||\n (Array.isArray(value) && value?.find((v) => newValue === v))\n ) {\n const index = (Array.isArray(value) && value?.findIndex((v) => newValue === v)) || 0;\n\n if (item.props.text) {\n const { text: newText } = item.props;\n result[index] = [newValue, newText];\n\n return;\n }\n\n const newText = getChildrenInnerText(item.props.children);\n result[index] = [newValue, newText];\n }\n\n return result;\n });\n\n return result;\n};\n\nconst getChildrenItemChecked = (value?: SelectValue, child?: ReactElement<SelectItemProps>) =>\n (!Array.isArray(value) && child?.props.value === value) ||\n (Array.isArray(value) && Boolean(value?.find((v) => child?.props.value === v)));\n\n// INFO: Функция для рекурсивного обновления пропсов\nexport const updatePropsRecursively = (\n children?: ReactElement<SelectItemProps>[],\n externalProps?: Record<string, any>,\n value?: SelectValue,\n search?: string,\n filterFunction?: (childText: string, filterValue?: string) => boolean,\n): ReactNode[] =>\n Children.map(children || [], (child) => {\n if (!isValidElement(child)) {\n return child;\n }\n\n const hasValue = 'value' in child?.props;\n\n const props = {\n key: `${value}$`,\n checked: getChildrenItemChecked(value, child),\n ...(hasValue && {\n ref: (element: HTMLDivElement) => {\n if (externalProps?.childrenRefs?.current && element) {\n externalProps.childrenRefs.current.push(element);\n }\n },\n onClick: (event: MouseEvent<HTMLDivElement>) => {\n child.props.onClick?.(event);\n externalProps?.onClick?.(event);\n },\n }),\n };\n\n const updatedChild = updatePropsRecursively(\n child.props.children as ReactElement<SelectItemProps>[],\n externalProps,\n value,\n search,\n filterFunction,\n );\n\n if (filterFunction) {\n const text = child.props?.text || '';\n\n return filterFunction(text, search) ? cloneElement(child, props, updatedChild) : null;\n }\n\n return cloneElement(child, props, updatedChild);\n });\n\nconst defaultFilterFunction = (text: string, filterValue = '') => text.includes(filterValue);\n\nexport const getChildren = (\n children: ReactElement<SelectItemProps>[],\n externalProps: Record<string, any>,\n value?: SelectValue,\n search?: string,\n filterFunction = defaultFilterFunction,\n) => {\n if (externalProps.childrenRefs) {\n externalProps.childrenRefs.current = [];\n }\n\n return updatePropsRecursively(children, externalProps, value, search, filterFunction);\n};\n"],"names":["getNewSelected","selected","newValue","type","undefined","newSelected","set","Set","has","add","Array","from","getChildrenInnerText","children","props","getValues","items","value","result","arguments","length","forEach","item","isArray","find","v","index","findIndex","text","newText","getChildrenItemChecked","child","Boolean","updatePropsRecursively","externalProps","search","filterFunction","Children","map","isValidElement","hasValue","_objectSpread","key","concat","checked","ref","element","_externalProps$childr","childrenRefs","current","push","onClick","event","_child$props$onClick","_child$props","_externalProps$onClic","call","updatedChild","_child$props2","cloneElement","defaultFilterFunction","filterValue","includes","getChildren"],"mappings":";;;;;;;AAaO,IAAMA,cAA+B,GAAG,SAAlCA,cAA+BA,CAAIC,QAAa,EAAEC,QAAa,EAAEC,IAAS,EAAK;AACxF,EAAA,IAAID,QAAQ,KAAKE,SAAS,IAAIF,QAAQ,KAAK,IAAI,EAAE;AAC7C,IAAA,OAAOA,QAAQ,CAAA;AACnB,GAAA;EAEA,IACI,CAACC,IAAI,KAAK,QAAQ,IAAIA,IAAI,KAAK,QAAQ,MACtC,OAAOD,QAAQ,KAAK,QAAQ,IAAI,OAAOA,QAAQ,KAAK,QAAQ,IAAI,OAAOA,QAAQ,KAAK,SAAS,CAAC,EACjG;AACE,IAAA,OAAOA,QAAQ,CAAA;AACnB,GAAA;AAEA,EAAA,IAAMG,WAAW,GAAGJ,QAAQ,IAAI,EAAE,CAAA;AAElC,EAAA,IAAMK,GAAG,GAAG,IAAIC,GAAG,CAACF,WAAW,CAAC,CAAA;AAEhC,EAAA,IAAIC,GAAG,CAACE,GAAG,CAACN,QAAQ,CAAC,EAAE;IACnBI,GAAG,CAAA,QAAA,CAAO,CAACJ,QAAQ,CAAC,CAAA;AACxB,GAAC,MAAM;A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A,aAAA,CAAa9B,IAAI,KAAI,EAAE,CAAA;AAEpC,MAAA,OAAOQ,cAAc,CAACR,IAAI,EAAEO,MAAM,CAAC,gBAAGwB,kBAAY,CAAC5B,KAAK,EAAEjB,KAAK,EAAE2C,YAAY,CAAC,GAAG,IAAI,CAAA;AACzF,KAAA;AAEA,IAAA,oBAAOE,kBAAY,CAAC5B,KAAK,EAAEjB,KAAK,EAAE2C,YAAY,CAAC,CAAA;AACnD,GAAC,CAAC,CAAA;AAAA,EAAA;AAEN,IAAMG,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAIhC,IAAY,EAAA;AAAA,EAAA,IAAEiC,WAAW,GAAA1C,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAf,SAAA,GAAAe,SAAA,CAAA,CAAA,CAAA,GAAG,EAAE,CAAA;AAAA,EAAA,OAAKS,IAAI,CAACkC,QAAQ,CAACD,WAAW,CAAC,CAAA;AAAA,CAAA,CAAA;AAE/EE,IAAAA,WAAW,GAAG,SAAdA,WAAWA,CACpBlD,QAAyC,EACzCqB,aAAkC,EAClCjB,KAAmB,EACnBkB,MAAe,EAEd;AAAA,EAAA,IADDC,cAAc,GAAAjB,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAf,SAAA,GAAAe,SAAA,CAAA,CAAA,CAAA,GAAGyC,qBAAqB,CAAA;EAEtC,IAAI1B,aAAa,CAACc,YAAY,EAAE;AAC5Bd,IAAAA,aAAa,CAACc,YAAY,CAACC,OAAO,GAAG,EAAE,CAAA;AAC3C,GAAA;EAEA,OAAOhB,sBAAsB,CAACpB,QAAQ,EAAEqB,aAAa,EAAEjB,KAAK,EAAEkB,MAAM,EAAEC,cAAc,CAAC,CAAA;AACzF;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/Select/utils/index.ts"],"sourcesContent":["import { Children, MouseEvent, ReactElement, ReactNode, cloneElement, isValidElement } from 'react';\n\nimport { SelectPrimitiveValue, ValueType, SelectValue } from '../Select.types';\nimport { SelectItemProps } from '../ui/SelectItem/SelectItem.type';\n\ntype NewSelectedFunc = {\n (selected?: undefined | null, newValue?: undefined | null, type?: undefined | null): undefined;\n (selected?: SelectPrimitiveValue, newValue?: SelectPrimitiveValue, type?: ValueType): SelectPrimitiveValue;\n (selected?: Array<SelectPrimitiveValue>, newValue?: SelectPrimitiveValue, type?: ValueType): Array<\n SelectPrimitiveValue\n >;\n};\n\nexport const getNewSelected: NewSelectedFunc = (selected: any, newValue: any, type: any) => {\n if (newValue === undefined || newValue === null) {\n return newValue;\n }\n\n if (\n (type === 'single' || type === 'native') &&\n (typeof newValue === 'string' || typeof newValue === 'number' || typeof newValue === 'boolean')\n ) {\n return newValue;\n }\n\n const newSelected = selected || [];\n\n const set = new Set(newSelected);\n\n if (set.has(newValue)) {\n set.delete(newValue);\n } else {\n set.add(newValue);\n }\n\n return Array.from(set);\n};\n\nconst getChildrenInnerText = (children: ReactElement): string => {\n if (!children || typeof children === 'string') {\n return children;\n }\n\n return getChildrenInnerText(children.props.children);\n};\n\nexport const getValues = (items: ReactElement[], value?: SelectValue, result: Array<Array<string>> = []) => {\n items.forEach((item) => {\n if (item.props === undefined) {\n return result;\n }\n\n const { value: newValue } = item.props;\n\n if (item.props.children && Array.isArray(item.props.children)) {\n return getValues(item.props.children, value, result);\n }\n\n if (\n (!Array.isArray(value) && newValue === value) ||\n (Array.isArray(value) && value?.find((v) => newValue === v))\n ) {\n const index = (Array.isArray(value) && value?.findIndex((v) => newValue === v)) || 0;\n\n if (item.props.text) {\n const { text: newText } = item.props;\n result[index] = [newValue, newText];\n\n return;\n }\n\n const newText = getChildrenInnerText(item.props.children);\n result[index] = [newValue, newText];\n }\n\n return result;\n });\n\n return result;\n};\n\nconst getChildrenItemChecked = (value?: SelectValue, child?: ReactElement<SelectItemProps>) =>\n (!Array.isArray(value) && child?.props.value === value) ||\n (Array.isArray(value) && Boolean(value?.find((v) => child?.props.value === v)));\n\n// INFO: Функция для рекурсивного обновления пропсов\nexport const updatePropsRecursively = (\n children?: ReactElement<SelectItemProps>[],\n externalProps?: Record<string, any>,\n value?: SelectValue,\n search?: string,\n filterFunction?: (childText: string, filterValue?: string) => boolean,\n): ReactNode[] =>\n Children.map(children || [], (child) => {\n if (!isValidElement(child)) {\n return child;\n }\n\n const hasValue = 'value' in child?.props;\n\n const props = {\n key: `${value}$`,\n checked: getChildrenItemChecked(value, child),\n ...(hasValue && {\n ref: (element: HTMLDivElement) => {\n if (externalProps?.childrenRefs?.current && element) {\n externalProps.childrenRefs.current.push(element);\n }\n },\n onClick: (event: MouseEvent<HTMLDivElement>) => {\n child.props.onClick?.(event);\n externalProps?.onClick?.(event);\n },\n }),\n };\n\n const updatedChild = updatePropsRecursively(\n child.props.children as ReactElement<SelectItemProps>[],\n externalProps,\n value,\n search,\n filterFunction,\n );\n\n if (filterFunction) {\n const text = child.props?.text || '';\n\n return filterFunction(text, search) ? cloneElement(child, props, updatedChild) : null;\n }\n\n return cloneElement(child, props, updatedChild);\n });\n\nconst defaultFilterFunction = (text: string, filterValue = '') => text.includes(filterValue);\n\nexport const getChildren = (\n children: ReactElement<SelectItemProps>[],\n externalProps: Record<string, any>,\n value?: SelectValue,\n search?: string,\n filterFunction = defaultFilterFunction,\n) => {\n if (externalProps.childrenRefs) {\n externalProps.childrenRefs.current = [];\n }\n\n return updatePropsRecursively(children, externalProps, value, search, filterFunction);\n};\n"],"names":["getNewSelected","selected","newValue","type","undefined","newSelected","set","Set","has","add","Array","from","getChildrenInnerText","children","props","getValues","items","value","result","arguments","length","forEach","item","isArray","find","v","index","findIndex","text","newText","getChildrenItemChecked","child","Boolean","updatePropsRecursively","externalProps","search","filterFunction","Children","map","isValidElement","hasValue","_objectSpread","key","concat","checked","ref","element","_externalProps$childr","childrenRefs","current","push","onClick","event","_child$props$onClick","_child$props","_externalProps$onClic","call","updatedChild","_child$props2","cloneElement","defaultFilterFunction","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AI,CAACkC,QAAQ,CAACD,WAAW,CAAC,CAAA;AAAA,CAAA,CAAA;AAE/EE,IAAAA,WAAW,GAAG,SAAdA,WAAWA,CACpBlD,QAAyC,EACzCqB,aAAkC,EAClCjB,KAAmB,EACnBkB,MAAe,EAEd;AAAA,EAAA,IADDC,cAAc,GAAAjB,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAf,SAAA,GAAAe,SAAA,CAAA,CAAA,CAAA,GAAGyC,qBAAqB,CAAA;EAEtC,IAAI1B,aAAa,CAACc,YAAY,EAAE;AAC5Bd,IAAAA,aAAa,CAACc,YAAY,CAACC,OAAO,GAAG,EAAE,CAAA;AAC3C,GAAA;EAEA,OAAOhB,sBAAsB,CAACpB,QAAQ,EAAEqB,aAAa,EAAEjB,KAAK,EAAEkB,MAAM,EAAEC,cAAc,CAAC,CAAA;AACzF;;;;;;;"}
@@ -12,7 +12,7 @@ var TabItemRefs = /*#__PURE__*/function () {
12
12
  _rollupPluginBabelHelpers.defineProperty(this, "current", 0);
13
13
  this.current = value || 0;
14
14
  }
15
- _rollupPluginBabelHelpers.createClass(TabItemRefs, [{
15
+ return _rollupPluginBabelHelpers.createClass(TabItemRefs, [{
16
16
  key: "register",
17
17
  value: function register(ref) {
18
18
  this.items.push(ref);
@@ -29,7 +29,6 @@ var TabItemRefs = /*#__PURE__*/function () {
29
29
  this.current = value;
30
30
  }
31
31
  }]);
32
- return TabItemRefs;
33
32
  }();
34
33
  var TabsContext = /*#__PURE__*/React.createContext(null);
35
34
 
@@ -1 +1 @@
1
- {"version":3,"file":"TabsContext.js","sources":["../../../src/components/Tabs/TabsContext.tsx"],"sourcesContent":["import { MutableRefObject, createContext } from 'react';\n\nexport class TabItemRefs {\n public items: MutableRefObject<HTMLElement | null>[] = [];\n\n public current = 0;\n\n constructor(value?: number) {\n this.current = value || 0;\n }\n\n public register(ref: MutableRefObject<HTMLElement | null>): number {\n this.items.push(ref);\n return this.items.length - 1;\n }\n\n public unregister(ref: MutableRefObject<HTMLElement | null>) {\n this.items.splice(this.items.indexOf(ref), 1);\n }\n\n public setCurrent(value: number) {\n this.current = value;\n }\n}\n\nexport const TabsContext = createContext<TabItemRefs | null>(null);\n"],"names":["TabItemRefs","value","_classCallCheck","_defineProperty","current","_createClass","key","register","ref","items","push","length","unregister","splice","indexOf","setCurrent","TabsContext","createContext"],"mappings":";;;;;;;AAEA,IAAaA,WAAW,gBAAA,YAAA;EAKpB,SAAAA,WAAAA,CAAYC,KAAc,EAAE;AAAAC,IAAAA,wCAAA,OAAAF,WAAA,CAAA,CAAA;AAAAG,IAAAA,wCAAA,gBAJ2B,EAAE,CAAA,CAAA;AAAAA,IAAAA,wCAAA,kBAExC,CAAC,CAAA,CAAA;AAGd,IAAA,IAAI,CAACC,OAAO,GAAGH,KAAK,IAAI,CAAC,CAAA;AAC7B,GAAA;AAACI,EAAAA,qCAAA,CAAAL,WAAA,EAAA,CAAA;IAAAM,GAAA,EAAA,UAAA;AAAAL,IAAAA,KAAA,EAED,SAAAM,QAAgBC,CAAAA,GAAyC,EAAU;AAC/D,MAAA,IAAI,CAACC,KAAK,CAACC,IAAI,CAACF,GAAG,CAAC,CAAA;AACpB,MAAA,OAAO,IAAI,CAACC,KAAK,CAACE,MAAM,GAAG,CAAC,CAAA;AAChC,KAAA;AAAC,GAAA,EAAA;IAAAL,GAAA,EAAA,YAAA;AAAAL,IAAAA,KAAA,EAED,SAAAW,UAAkBJ,CAAAA,GAAyC,EAAE;AACzD,MAAA,IAAI,CAACC,KAAK,CAACI,MAAM,CAAC,IAAI,CAACJ,KAAK,CAACK,OAAO,CAACN,GAAG,CAAC,EAAE,CAAC,CAAC,CAAA;AACjD,KAAA;AAAC,GAAA,EAAA;IAAAF,GAAA,EAAA,YAAA;AAAAL,IAAAA,KAAA,EAED,SAAAc,UAAkBd,CAAAA,KAAa,EAAE;MAC7B,IAAI,CAACG,OAAO,GAAGH,KAAK,CAAA;AACxB,KAAA;AAAC,GAAA,CAAA,CAAA,CAAA;AAAA,EAAA,OAAAD,WAAA,CAAA;AAAA,CAAA,GAAA;IAGQgB,WAAW,gBAAGC,mBAAa,CAAqB,IAAI;;;;;"}
1
+ {"version":3,"file":"TabsContext.js","sources":["../../../src/components/Tabs/TabsContext.tsx"],"sourcesContent":["import { MutableRefObject, createContext } from 'react';\n\nexport class TabItemRefs {\n public items: MutableRefObject<HTMLElement | null>[] = [];\n\n public current = 0;\n\n constructor(value?: number) {\n this.current = value || 0;\n }\n\n public register(ref: MutableRefObject<HTMLElement | null>): number {\n this.items.push(ref);\n return this.items.length - 1;\n }\n\n public unregister(ref: MutableRefObject<HTMLElement | null>) {\n this.items.splice(this.items.indexOf(ref), 1);\n }\n\n public setCurrent(value: number) {\n this.current = value;\n }\n}\n\nexport const TabsContext = createContext<TabItemRefs | null>(null);\n"],"names":["TabItemRefs","value","_classCallCheck","_defineProperty","current","_createClass","key","register","ref","items","push","length","unregister","splice","indexOf","setCurrent","TabsContext","createContext"],"mappings":";;;;;;;AAEA,IAAaA,WAAW,gBAAA,YAAA;EAKpB,SAAAA,WAAAA,CAAYC,KAAc,EAAE;AAAAC,IAAAA,wCAAA,OAAAF,WAAA,CAAA,CAAA;AAAAG,IAAAA,wCAAA,gBAJ2B,EAAE,CAAA,CAAA;AAAAA,IAAAA,wCAAA,kBAExC,CAAC,CAAA,CAAA;AAGd,IAAA,IAAI,CAACC,OAAO,GAAGH,KAAK,IAAI,CAAC,CAAA;AAC7B,GAAA;EAAC,OAAAI,qCAAA,CAAAL,WAAA,EAAA,CAAA;IAAAM,GAAA,EAAA,UAAA;AAAAL,IAAAA,KAAA,EAED,SAAAM,QAAgBC,CAAAA,GAAyC,EAAU;AAC/D,MAAA,IAAI,CAACC,KAAK,CAACC,IAAI,CAACF,GAAG,CAAC,CAAA;AACpB,MAAA,OAAO,IAAI,CAACC,KAAK,CAACE,MAAM,GAAG,CAAC,CAAA;AAChC,KAAA;AAAC,GAAA,EAAA;IAAAL,GAAA,EAAA,YAAA;AAAAL,IAAAA,KAAA,EAED,SAAAW,UAAkBJ,CAAAA,GAAyC,EAAE;AACzD,MAAA,IAAI,CAACC,KAAK,CAACI,MAAM,CAAC,IAAI,CAACJ,KAAK,CAACK,OAAO,CAACN,GAAG,CAAC,EAAE,CAAC,CAAC,CAAA;AACjD,KAAA;AAAC,GAAA,EAAA;IAAAF,GAAA,EAAA,YAAA;AAAAL,IAAAA,KAAA,EAED,SAAAc,UAAkBd,CAAAA,KAAa,EAAE;MAC7B,IAAI,CAACG,OAAO,GAAGH,KAAK,CAAA;AACxB,KAAA;AAAC,GAAA,CAAA,CAAA,CAAA;AAAA,CAAA,GAAA;IAGQe,WAAW,gBAAGC,mBAAa,CAAqB,IAAI;;;;;"}
@@ -71,7 +71,7 @@ var tabItemRoot = function tabItemRoot(Root) {
71
71
  if (focusIndex === refs.current) {
72
72
  return;
73
73
  }
74
- onIndexChange === null || onIndexChange === void 0 ? void 0 : onIndexChange(focusIndex);
74
+ onIndexChange === null || onIndexChange === void 0 || onIndexChange(focusIndex);
75
75
  refs.setCurrent(focusIndex);
76
76
  }, [refs, innerRef, onIndexChange, disabled]);
77
77
  return /*#__PURE__*/React.createElement(Root, _rollupPluginBabelHelpers.extends({
@@ -1 +1 @@
1
- {"version":3,"file":"TabItem.js","sources":["../../../../../src/components/Tabs/ui/TabItem/TabItem.tsx"],"sourcesContent":["import React, { forwardRef, useRef, useContext, useEffect, useCallback } from 'react';\nimport { useForkRef } from '@salutejs/plasma-core';\n\nimport { ComponentConfig, RootProps } from '../../../../engines';\nimport { classes } from '../../tokens';\nimport { cx } from '../../../../utils';\nimport { TabsContext } from '../../TabsContext';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { base as pilledCSS } from './variations/_pilled/base';\nimport { base as disabledCSS } from './variations/_disabled/base';\nimport { TabItemProps } from './TabItem.types';\nimport { LeftContent, RightContent, StyledContent, base } from './TabItem.styles';\n\nexport const tabItemRoot = (Root: RootProps<HTMLDivElement, TabItemProps>) =>\n forwardRef<HTMLDivElement, TabItemProps>((props, outerRef) => {\n const {\n size,\n view,\n isActive,\n selected,\n disabled = false,\n pilled = false,\n children,\n contentLeft,\n contentRight,\n animated = true,\n onIndexChange,\n itemIndex,\n tabIndex,\n ...rest\n } = props;\n\n const innerRef = useRef<HTMLDivElement>(null);\n const ref = useForkRef(outerRef, innerRef);\n const refs = useContext(TabsContext);\n\n const role = 'tab';\n\n const pilledAttr = view !== 'clear' && pilled;\n const animatedClass = animated ? classes.tabItemAnimated : undefined;\n const pilledClass = pilledAttr ? classes.tabsPilled : undefined;\n const selectedClass = isActive || selected ? classes.selectedTabsItem : undefined;\n const hasKeyNavigation = itemIndex !== undefined && onIndexChange !== undefined;\n const navigationTabIndex = !disabled && refs?.current === itemIndex ? 0 : -1;\n\n useEffect(() => {\n if (!refs) {\n return;\n }\n\n refs.register(innerRef);\n\n return () => refs.unregister(innerRef);\n }, [refs]);\n\n const onItemFocus = useCallback<React.FocusEventHandler>(\n (event) => {\n if (!hasKeyNavigation) {\n event.target.scrollIntoView({\n block: 'center',\n inline: 'center',\n behavior: 'smooth',\n });\n\n return;\n }\n\n if (disabled || !refs) {\n return;\n }\n\n const focusIndex = refs.items.findIndex((itemRef) => itemRef.current === event.target);\n\n if (focusIndex === refs.current) {\n return;\n }\n\n onIndexChange?.(focusIndex);\n refs.setCurrent(focusIndex);\n },\n [refs, innerRef, onIndexChange, disabled],\n );\n\n return (\n <Root\n ref={ref}\n disabled={disabled}\n pilled={pilled}\n role={role}\n view={view}\n size={size}\n onFocus={onItemFocus}\n tabIndex={hasKeyNavigation ? navigationTabIndex : tabIndex}\n className={cx(pilledClass, selectedClass, animatedClass)}\n {...rest}\n >\n <>\n {contentLeft && <LeftContent className={classes.tabLeftContent}>{contentLeft}</LeftContent>}\n <StyledContent className={classes.tabContent}>{children}</StyledContent>\n {contentRight && <RightContent className={classes.tabRightContent}>{contentRight}</RightContent>}\n </>\n </Root>\n );\n });\n\nexport const tabItemConfig: ComponentConfig = {\n name: 'TabItem',\n tag: 'button',\n layout: tabItemRoot,\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 },\n },\n defaults: {\n view: 'default',\n },\n};\n"],"names":["tabItemRoot","Root","forwardRef","props","outerRef","size","view","isActive","selected","_props$disabled","disabled","_props$pilled","pilled","children","contentLeft","contentRight","_props$animated","animated","onIndexChange","itemIndex","tabIndex","rest","_objectWithoutProperties","_excluded","innerRef","useRef","ref","useForkRef","refs","useContext","TabsContext","role","pilledAttr","animatedClass","classes","tabItemAnimated","undefined","pilledClass","tabsPilled","selectedClass","selectedTabsItem","hasKeyNavigation","navigationTabIndex","current","useEffect","register","unregister","onItemFocus","useCallback","event","target","scrollIntoView","block","inline","behavior","focusIndex","items","findIndex","itemRef","setCurrent","React","createElement","_extends","onFocus","className","cx","Fragment","LeftContent","tabLeftContent","StyledContent","tabContent","RightContent","tabRightContent","tabItemConfig","name","tag","layout","base","variations","css","sizeCSS","viewCSS","disabledCSS","attrs","pilledCSS","defaults"],"mappings":";;;;;;;;;;;;;;;;;IAeaA,WAAW,GAAG,SAAdA,WAAWA,CAAIC,IAA6C,EAAA;AAAA,EAAA,oBACrEC,gBAAU,CAA+B,UAACC,KAAK,EAAEC,QAAQ,EAAK;AAC1D,IAAA,IACIC,IAAI,GAcJF,KAAK,CAdLE,IAAI;MACJC,IAAI,GAaJH,KAAK,CAbLG,IAAI;MACJC,QAAQ,GAYRJ,KAAK,CAZLI,QAAQ;MACRC,QAAQ,GAWRL,KAAK,CAXLK,QAAQ;MAAAC,eAAA,GAWRN,KAAK,CAVLO,QAAQ;AAARA,MAAAA,QAAQ,GAAAD,eAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,eAAA;MAAAE,aAAA,GAUhBR,KAAK,CATLS,MAAM;AAANA,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AAA,IAAI,EAAJA,mBAAI;AACJC,EAAAA,UAAU,EAAE;AACRzE,IAAAA,IAAI,EAAE;AACF0E,MAAAA,GAAG,EAAEC,SAAAA;KACR;AACD1E,IAAAA,IAAI,EAAE;AACFyE,MAAAA,GAAG,EAAEE,WAAAA;KACR;AACDvE,IAAAA,QAAQ,EAAE;AACNqE,MAAAA,GAAG,EAAEG,WAAW;AAChBC,MAAAA,KAAK,EAAE,IAAA;KACV;AACDvE,IAAAA,MAAM,EAAE;AACJmE,MAAAA,GAAG,EAAEK,WAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACN/E,IAAAA,IAAI,EAAE,SAAA;AACV,GAAA;AACJ;;;;;"}
1
+ {"version":3,"file":"TabItem.js","sources":["../../../../../src/components/Tabs/ui/TabItem/TabItem.tsx"],"sourcesContent":["import React, { forwardRef, useRef, useContext, useEffect, useCallback } from 'react';\nimport { useForkRef } from '@salutejs/plasma-core';\n\nimport { ComponentConfig, RootProps } from '../../../../engines';\nimport { classes } from '../../tokens';\nimport { cx } from '../../../../utils';\nimport { TabsContext } from '../../TabsContext';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { base as pilledCSS } from './variations/_pilled/base';\nimport { base as disabledCSS } from './variations/_disabled/base';\nimport { TabItemProps } from './TabItem.types';\nimport { LeftContent, RightContent, StyledContent, base } from './TabItem.styles';\n\nexport const tabItemRoot = (Root: RootProps<HTMLDivElement, TabItemProps>) =>\n forwardRef<HTMLDivElement, TabItemProps>((props, outerRef) => {\n const {\n size,\n view,\n isActive,\n selected,\n disabled = false,\n pilled = false,\n children,\n contentLeft,\n contentRight,\n animated = true,\n onIndexChange,\n itemIndex,\n tabIndex,\n ...rest\n } = props;\n\n const innerRef = useRef<HTMLDivElement>(null);\n const ref = useForkRef(outerRef, innerRef);\n const refs = useContext(TabsContext);\n\n const role = 'tab';\n\n const pilledAttr = view !== 'clear' && pilled;\n const animatedClass = animated ? classes.tabItemAnimated : undefined;\n const pilledClass = pilledAttr ? classes.tabsPilled : undefined;\n const selectedClass = isActive || selected ? classes.selectedTabsItem : undefined;\n const hasKeyNavigation = itemIndex !== undefined && onIndexChange !== undefined;\n const navigationTabIndex = !disabled && refs?.current === itemIndex ? 0 : -1;\n\n useEffect(() => {\n if (!refs) {\n return;\n }\n\n refs.register(innerRef);\n\n return () => refs.unregister(innerRef);\n }, [refs]);\n\n const onItemFocus = useCallback<React.FocusEventHandler>(\n (event) => {\n if (!hasKeyNavigation) {\n event.target.scrollIntoView({\n block: 'center',\n inline: 'center',\n behavior: 'smooth',\n });\n\n return;\n }\n\n if (disabled || !refs) {\n return;\n }\n\n const focusIndex = refs.items.findIndex((itemRef) => itemRef.current === event.target);\n\n if (focusIndex === refs.current) {\n return;\n }\n\n onIndexChange?.(focusIndex);\n refs.setCurrent(focusIndex);\n },\n [refs, innerRef, onIndexChange, disabled],\n );\n\n return (\n <Root\n ref={ref}\n disabled={disabled}\n pilled={pilled}\n role={role}\n view={view}\n size={size}\n onFocus={onItemFocus}\n tabIndex={hasKeyNavigation ? navigationTabIndex : tabIndex}\n className={cx(pilledClass, selectedClass, animatedClass)}\n {...rest}\n >\n <>\n {contentLeft && <LeftContent className={classes.tabLeftContent}>{contentLeft}</LeftContent>}\n <StyledContent className={classes.tabContent}>{children}</StyledContent>\n {contentRight && <RightContent className={classes.tabRightContent}>{contentRight}</RightContent>}\n </>\n </Root>\n );\n });\n\nexport const tabItemConfig: ComponentConfig = {\n name: 'TabItem',\n tag: 'button',\n layout: tabItemRoot,\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 },\n },\n defaults: {\n view: 'default',\n },\n};\n"],"names":["tabItemRoot","Root","forwardRef","props","outerRef","size","view","isActive","selected","_props$disabled","disabled","_props$pilled","pilled","children","contentLeft","contentRight","_props$animated","animated","onIndexChange","itemIndex","tabIndex","rest","_objectWithoutProperties","_excluded","innerRef","useRef","ref","useForkRef","refs","useContext","TabsContext","role","pilledAttr","animatedClass","classes","tabItemAnimated","undefined","pilledClass","tabsPilled","selectedClass","selectedTabsItem","hasKeyNavigation","navigationTabIndex","current","useEffect","register","unregister","onItemFocus","useCallback","event","target","scrollIntoView","block","inline","behavior","focusIndex","items","findIndex","itemRef","setCurrent","React","createElement","_extends","onFocus","className","cx","Fragment","LeftContent","tabLeftContent","StyledContent","tabContent","RightContent","tabRightContent","tabItemConfig","name","tag","layout","base","variations","css","sizeCSS","viewCSS","disabledCSS","attrs","pilledCSS","defaults"],"mappings":";;;;;;;;;;;;;;;;;IAeaA,WAAW,GAAG,SAAdA,WAAWA,CAAIC,IAA6C,EAAA;AAAA,EAAA,oBACrEC,gBAAU,CAA+B,UAACC,KAAK,EAAEC,QAAQ,EAAK;AAC1D,IAAA,IACIC,IAAI,GAcJF,KAAK,CAdLE,IAAI;MACJC,IAAI,GAaJH,KAAK,CAbLG,IAAI;MACJC,QAAQ,GAYRJ,KAAK,CAZLI,QAAQ;MACRC,QAAQ,GAWRL,KAAK,CAXLK,QAAQ;MAAAC,eAAA,GAWRN,KAAK,CAVLO,QAAQ;AAARA,MAAAA,QAAQ,GAAAD,eAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,eAAA;MAAAE,aAAA,GAUhBR,KAAK,CATLS,MAAM;AAANA,MAAAA,MAAM,GAAAD,aAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,aAAA;MACdE,QAAQ,GAQRV,KAAK,CARLU,QAAQ;MACRC,WAAW,GAOXX,KAAK,CAPLW,WAAW;MACXC,YAAY,GAMZZ,KAAK,CANLY,YAAY;MAAAC,eAAA,GAMZb,KAAK,CALLc,QAAQ;AAARA,MAAAA,QAAQ,GAAAD,eAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,eAAA;MACfE,aAAa,GAIbf,KAAK,CAJLe,aAAa;MACbC,S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AAA,QAAQ,EAAE;AACN/E,IAAAA,IAAI,EAAE,SAAA;AACV,GAAA;AACJ;;;;;"}
@@ -123,8 +123,8 @@ var tabsRoot = function tabsRoot(Root) {
123
123
  if (nextIndex !== index$1) {
124
124
  var _refs$items$nextIndex, _refs$items$nextIndex2;
125
125
  event.preventDefault();
126
- (_refs$items$nextIndex = refs.items[nextIndex].current) === null || _refs$items$nextIndex === void 0 ? void 0 : _refs$items$nextIndex.focus();
127
- (_refs$items$nextIndex2 = refs.items[nextIndex].current) === null || _refs$items$nextIndex2 === void 0 ? void 0 : _refs$items$nextIndex2.scrollIntoView({
126
+ (_refs$items$nextIndex = refs.items[nextIndex].current) === null || _refs$items$nextIndex === void 0 || _refs$items$nextIndex.focus();
127
+ (_refs$items$nextIndex2 = refs.items[nextIndex].current) === null || _refs$items$nextIndex2 === void 0 || _refs$items$nextIndex2.scrollIntoView({
128
128
  block: 'center',
129
129
  inline: 'center',
130
130
  behavior: 'smooth'