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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (411) hide show
  1. package/cjs/_virtual/_rollupPluginBabelHelpers.js +1 -1
  2. package/cjs/components/Calendar/CalendarBase/CalendarBase.js +1 -1
  3. package/cjs/components/Calendar/CalendarBase/CalendarBase.js.map +1 -1
  4. package/cjs/components/Calendar/CalendarDouble/CalendarDouble.js +1 -1
  5. package/cjs/components/Calendar/CalendarDouble/CalendarDouble.js.map +1 -1
  6. package/cjs/components/Calendar/hoc/withRange.js +1 -1
  7. package/cjs/components/Calendar/hoc/withRange.js.map +1 -1
  8. package/cjs/components/Calendar/hooks/useKeyNavigation.js +19 -19
  9. package/cjs/components/Calendar/hooks/useKeyNavigation.js.map +1 -1
  10. package/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js +3 -3
  11. package/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js.map +1 -1
  12. package/cjs/components/Calendar/ui/CalendarHeader/CalendarHeader.js +2 -2
  13. package/cjs/components/Calendar/ui/CalendarHeader/CalendarHeader.js.map +1 -1
  14. package/cjs/components/Calendar/ui/CalendarMonths/CalendarMonths.js +1 -1
  15. package/cjs/components/Calendar/ui/CalendarMonths/CalendarMonths.js.map +1 -1
  16. package/cjs/components/Calendar/ui/CalendarYears/CalendarYears.js +1 -1
  17. package/cjs/components/Calendar/ui/CalendarYears/CalendarYears.js.map +1 -1
  18. package/cjs/components/Chip/Chip.css +2 -0
  19. package/cjs/components/Chip/Chip.js +16 -4
  20. package/cjs/components/Chip/Chip.js.map +1 -1
  21. package/cjs/components/Chip/Chip.tokens.js +5 -0
  22. package/cjs/components/Chip/Chip.tokens.js.map +1 -1
  23. package/cjs/components/Chip/variations/_pilled/base.js +9 -0
  24. package/cjs/components/Chip/variations/_pilled/base.js.map +1 -0
  25. package/cjs/components/Chip/variations/_pilled/base_3kce4h.css +1 -0
  26. package/cjs/components/Combobox/Combobox.css +2 -0
  27. package/cjs/components/Combobox/Combobox.js +5 -5
  28. package/cjs/components/Combobox/Combobox.js.map +1 -1
  29. package/cjs/components/Combobox/hooks/useFocusController.js +9 -9
  30. package/cjs/components/Combobox/hooks/useFocusController.js.map +1 -1
  31. package/cjs/components/Combobox/ui/ComboboxChip/ComboboxChip.css +2 -0
  32. package/cjs/components/Combobox/ui/ComboboxChip/ComboboxChip.js +1 -1
  33. package/cjs/components/Combobox/ui/ComboboxChip/ComboboxChip.js.map +1 -1
  34. package/cjs/components/Combobox/ui/ComboboxTarget/ComboboxTarget.css +2 -0
  35. package/cjs/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js +6 -6
  36. package/cjs/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js.map +1 -1
  37. package/cjs/components/Drawer/DrawerContext.js +1 -1
  38. package/cjs/components/Drawer/DrawerContext.js.map +1 -1
  39. package/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.js +2 -2
  40. package/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.js.map +1 -1
  41. package/cjs/components/Modal/ModalContext.js +1 -1
  42. package/cjs/components/Modal/ModalContext.js.map +1 -1
  43. package/cjs/components/Overlay/Overlay.js +1 -1
  44. package/cjs/components/Overlay/Overlay.js.map +1 -1
  45. package/cjs/components/Pagination/Pagination.css +2 -0
  46. package/cjs/components/Pagination/Pagination.js +2 -2
  47. package/cjs/components/Pagination/Pagination.js.map +1 -1
  48. package/cjs/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js +1 -1
  49. package/cjs/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js.map +1 -1
  50. package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +2 -0
  51. package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +1 -1
  52. package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js.map +1 -1
  53. package/cjs/components/Popover/Popover.js +7 -7
  54. package/cjs/components/Popover/Popover.js.map +1 -1
  55. package/cjs/components/Popup/Popup.js +1 -1
  56. package/cjs/components/Popup/Popup.js.map +1 -1
  57. package/cjs/components/Segment/ui/SegmentItem/SegmentItem.js +2 -2
  58. package/cjs/components/Segment/ui/SegmentItem/SegmentItem.js.map +1 -1
  59. package/cjs/components/Select/Select.css +2 -0
  60. package/cjs/components/Select/Select.js +5 -5
  61. package/cjs/components/Select/Select.js.map +1 -1
  62. package/cjs/components/Select/hooks/useKeyNavigation.js +12 -12
  63. package/cjs/components/Select/hooks/useKeyNavigation.js.map +1 -1
  64. package/cjs/components/Select/ui/SelectChip/SelectChip.css +2 -0
  65. package/cjs/components/Select/ui/SelectChip/SelectChip.js +1 -1
  66. package/cjs/components/Select/ui/SelectChip/SelectChip.js.map +1 -1
  67. package/cjs/components/Select/ui/SelectTarget/SelectTarget.css +2 -0
  68. package/cjs/components/Select/ui/SelectTarget/SelectTarget.js +2 -2
  69. package/cjs/components/Select/ui/SelectTarget/SelectTarget.js.map +1 -1
  70. package/cjs/components/Select/utils/index.js +2 -2
  71. package/cjs/components/Select/utils/index.js.map +1 -1
  72. package/cjs/components/Tabs/TabsContext.js +2 -1
  73. package/cjs/components/Tabs/TabsContext.js.map +1 -1
  74. package/cjs/components/Tabs/ui/TabItem/TabItem.js +1 -1
  75. package/cjs/components/Tabs/ui/TabItem/TabItem.js.map +1 -1
  76. package/cjs/components/Tabs/ui/Tabs/Tabs.js +2 -2
  77. package/cjs/components/Tabs/ui/Tabs/Tabs.js.map +1 -1
  78. package/cjs/components/TextArea/TextArea.js +1 -1
  79. package/cjs/components/TextArea/TextArea.js.map +1 -1
  80. package/cjs/components/TextField/TextField.js +2 -2
  81. package/cjs/components/TextField/TextField.js.map +1 -1
  82. package/cjs/components/TextField/hooks/useKeyNavigation.js +9 -9
  83. package/cjs/components/TextField/hooks/useKeyNavigation.js.map +1 -1
  84. package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.css +2 -0
  85. package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js +1 -1
  86. package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js.map +1 -1
  87. package/cjs/components/Toast/ToastProvider/ToastProvider.js +2 -2
  88. package/cjs/components/Toast/ToastProvider/ToastProvider.js.map +1 -1
  89. package/cjs/components/Tooltip/Tooltip.js +1 -1
  90. package/cjs/components/Tooltip/Tooltip.js.map +1 -1
  91. package/cjs/index.css +2 -0
  92. package/es/_virtual/_rollupPluginBabelHelpers.js +1 -1
  93. package/es/components/Calendar/CalendarBase/CalendarBase.js +1 -1
  94. package/es/components/Calendar/CalendarBase/CalendarBase.js.map +1 -1
  95. package/es/components/Calendar/CalendarDouble/CalendarDouble.js +1 -1
  96. package/es/components/Calendar/CalendarDouble/CalendarDouble.js.map +1 -1
  97. package/es/components/Calendar/hoc/withRange.js +1 -1
  98. package/es/components/Calendar/hoc/withRange.js.map +1 -1
  99. package/es/components/Calendar/hooks/useKeyNavigation.js +19 -19
  100. package/es/components/Calendar/hooks/useKeyNavigation.js.map +1 -1
  101. package/es/components/Calendar/ui/CalendarDays/CalendarDays.js +3 -3
  102. package/es/components/Calendar/ui/CalendarDays/CalendarDays.js.map +1 -1
  103. package/es/components/Calendar/ui/CalendarHeader/CalendarHeader.js +2 -2
  104. package/es/components/Calendar/ui/CalendarHeader/CalendarHeader.js.map +1 -1
  105. package/es/components/Calendar/ui/CalendarMonths/CalendarMonths.js +1 -1
  106. package/es/components/Calendar/ui/CalendarMonths/CalendarMonths.js.map +1 -1
  107. package/es/components/Calendar/ui/CalendarYears/CalendarYears.js +1 -1
  108. package/es/components/Calendar/ui/CalendarYears/CalendarYears.js.map +1 -1
  109. package/es/components/Chip/Chip.css +2 -0
  110. package/es/components/Chip/Chip.js +17 -5
  111. package/es/components/Chip/Chip.js.map +1 -1
  112. package/es/components/Chip/Chip.tokens.js +5 -1
  113. package/es/components/Chip/Chip.tokens.js.map +1 -1
  114. package/es/components/Chip/variations/_pilled/base.js +5 -0
  115. package/es/components/Chip/variations/_pilled/base.js.map +1 -0
  116. package/es/components/Chip/variations/_pilled/base_3kce4h.css +1 -0
  117. package/es/components/Combobox/Combobox.css +2 -0
  118. package/es/components/Combobox/Combobox.js +5 -5
  119. package/es/components/Combobox/Combobox.js.map +1 -1
  120. package/es/components/Combobox/hooks/useFocusController.js +9 -9
  121. package/es/components/Combobox/hooks/useFocusController.js.map +1 -1
  122. package/es/components/Combobox/ui/ComboboxChip/ComboboxChip.css +2 -0
  123. package/es/components/Combobox/ui/ComboboxChip/ComboboxChip.js +1 -1
  124. package/es/components/Combobox/ui/ComboboxChip/ComboboxChip.js.map +1 -1
  125. package/es/components/Combobox/ui/ComboboxTarget/ComboboxTarget.css +2 -0
  126. package/es/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js +6 -6
  127. package/es/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js.map +1 -1
  128. package/es/components/Drawer/DrawerContext.js +1 -1
  129. package/es/components/Drawer/DrawerContext.js.map +1 -1
  130. package/es/components/Dropdown/ui/DropdownItem/DropdownItem.js +2 -2
  131. package/es/components/Dropdown/ui/DropdownItem/DropdownItem.js.map +1 -1
  132. package/es/components/Modal/ModalContext.js +1 -1
  133. package/es/components/Modal/ModalContext.js.map +1 -1
  134. package/es/components/Overlay/Overlay.js +1 -1
  135. package/es/components/Overlay/Overlay.js.map +1 -1
  136. package/es/components/Pagination/Pagination.css +2 -0
  137. package/es/components/Pagination/Pagination.js +2 -2
  138. package/es/components/Pagination/Pagination.js.map +1 -1
  139. package/es/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js +1 -1
  140. package/es/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js.map +1 -1
  141. package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +2 -0
  142. package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +1 -1
  143. package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js.map +1 -1
  144. package/es/components/Popover/Popover.js +7 -7
  145. package/es/components/Popover/Popover.js.map +1 -1
  146. package/es/components/Popup/Popup.js +1 -1
  147. package/es/components/Popup/Popup.js.map +1 -1
  148. package/es/components/Segment/ui/SegmentItem/SegmentItem.js +2 -2
  149. package/es/components/Segment/ui/SegmentItem/SegmentItem.js.map +1 -1
  150. package/es/components/Select/Select.css +2 -0
  151. package/es/components/Select/Select.js +5 -5
  152. package/es/components/Select/Select.js.map +1 -1
  153. package/es/components/Select/hooks/useKeyNavigation.js +12 -12
  154. package/es/components/Select/hooks/useKeyNavigation.js.map +1 -1
  155. package/es/components/Select/ui/SelectChip/SelectChip.css +2 -0
  156. package/es/components/Select/ui/SelectChip/SelectChip.js +1 -1
  157. package/es/components/Select/ui/SelectChip/SelectChip.js.map +1 -1
  158. package/es/components/Select/ui/SelectTarget/SelectTarget.css +2 -0
  159. package/es/components/Select/ui/SelectTarget/SelectTarget.js +2 -2
  160. package/es/components/Select/ui/SelectTarget/SelectTarget.js.map +1 -1
  161. package/es/components/Select/utils/index.js +2 -2
  162. package/es/components/Select/utils/index.js.map +1 -1
  163. package/es/components/Tabs/TabsContext.js +2 -1
  164. package/es/components/Tabs/TabsContext.js.map +1 -1
  165. package/es/components/Tabs/ui/TabItem/TabItem.js +1 -1
  166. package/es/components/Tabs/ui/TabItem/TabItem.js.map +1 -1
  167. package/es/components/Tabs/ui/Tabs/Tabs.js +2 -2
  168. package/es/components/Tabs/ui/Tabs/Tabs.js.map +1 -1
  169. package/es/components/TextArea/TextArea.js +1 -1
  170. package/es/components/TextArea/TextArea.js.map +1 -1
  171. package/es/components/TextField/TextField.js +2 -2
  172. package/es/components/TextField/TextField.js.map +1 -1
  173. package/es/components/TextField/hooks/useKeyNavigation.js +9 -9
  174. package/es/components/TextField/hooks/useKeyNavigation.js.map +1 -1
  175. package/es/components/TextField/ui/TextFieldChip/TextFieldChip.css +2 -0
  176. package/es/components/TextField/ui/TextFieldChip/TextFieldChip.js +1 -1
  177. package/es/components/TextField/ui/TextFieldChip/TextFieldChip.js.map +1 -1
  178. package/es/components/Toast/ToastProvider/ToastProvider.js +2 -2
  179. package/es/components/Toast/ToastProvider/ToastProvider.js.map +1 -1
  180. package/es/components/Tooltip/Tooltip.js +1 -1
  181. package/es/components/Tooltip/Tooltip.js.map +1 -1
  182. package/es/index.css +2 -0
  183. package/package.json +10 -10
  184. package/styled-components/cjs/components/Avatar/Avatar.js +1 -1
  185. package/styled-components/cjs/components/Avatar/Avatar.styles.js +1 -1
  186. package/styled-components/cjs/components/AvatarGroup/AvatarGroup.js +1 -1
  187. package/styled-components/cjs/components/Badge/Badge.js +1 -1
  188. package/styled-components/cjs/components/Badge/Badge.styles.js +1 -1
  189. package/styled-components/cjs/components/Button/Button.js +2 -2
  190. package/styled-components/cjs/components/Button/Button.styles.js +1 -1
  191. package/styled-components/cjs/components/ButtonGroup/ButtonGroup.js +1 -1
  192. package/styled-components/cjs/components/Calendar/CalendarBase/CalendarBase.js +2 -2
  193. package/styled-components/cjs/components/Calendar/CalendarBase/CalendarBase.styles.js +1 -1
  194. package/styled-components/cjs/components/Calendar/CalendarDouble/CalendarDouble.js +2 -2
  195. package/styled-components/cjs/components/Calendar/CalendarDouble/CalendarDouble.styles.js +1 -1
  196. package/styled-components/cjs/components/Calendar/hoc/withRange.js +2 -2
  197. package/styled-components/cjs/components/Calendar/hooks/useKeyNavigation.js +20 -20
  198. package/styled-components/cjs/components/Calendar/store/reducer.js +1 -1
  199. package/styled-components/cjs/components/Calendar/ui/CalendarDayItem/CalendarDayItem.js +1 -1
  200. package/styled-components/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js +4 -4
  201. package/styled-components/cjs/components/Calendar/ui/CalendarHeader/CalendarHeader.js +3 -3
  202. package/styled-components/cjs/components/Calendar/ui/CalendarMonths/CalendarMonths.js +2 -2
  203. package/styled-components/cjs/components/Calendar/ui/CalendarYears/CalendarYears.js +2 -2
  204. package/styled-components/cjs/components/Cell/Cell.js +1 -1
  205. package/styled-components/cjs/components/Cell/Cell.styles.js +1 -1
  206. package/styled-components/cjs/components/Checkbox/Checkbox.js +1 -1
  207. package/styled-components/cjs/components/Chip/Chip.js +17 -5
  208. package/styled-components/cjs/components/Chip/Chip.styles.js +1 -1
  209. package/styled-components/cjs/components/Chip/Chip.template-doc.mdx +2 -2
  210. package/styled-components/cjs/components/Chip/Chip.tokens.js +5 -1
  211. package/styled-components/cjs/components/Chip/variations/_pilled/base.js +9 -0
  212. package/styled-components/cjs/components/Chip/variations/_pilled/tokens.json +4 -0
  213. package/styled-components/cjs/components/Combobox/Combobox.js +6 -6
  214. package/styled-components/cjs/components/Combobox/hooks/useFocusController.js +9 -9
  215. package/styled-components/cjs/components/Combobox/ui/ComboboxChip/ComboboxChip.js +2 -2
  216. package/styled-components/cjs/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js +7 -7
  217. package/styled-components/cjs/components/Counter/Counter.js +1 -1
  218. package/styled-components/cjs/components/Divider/Divider.js +2 -2
  219. package/styled-components/cjs/components/Drawer/Drawer.js +1 -1
  220. package/styled-components/cjs/components/Drawer/DrawerContext.js +1 -1
  221. package/styled-components/cjs/components/Drawer/hooks/useDrawer.js +1 -1
  222. package/styled-components/cjs/components/Drawer/ui/DrawerContent/DrawerContent.js +1 -1
  223. package/styled-components/cjs/components/Drawer/ui/DrawerFooter/DrawerFooter.js +1 -1
  224. package/styled-components/cjs/components/Drawer/ui/DrawerHeader/DrawerHeader.js +1 -1
  225. package/styled-components/cjs/components/Dropdown/Dropdown.js +1 -1
  226. package/styled-components/cjs/components/Dropdown/ui/DropdownDivider/DropdownDivider.js +1 -1
  227. package/styled-components/cjs/components/Dropdown/ui/DropdownFooter/DropdownFooter.js +1 -1
  228. package/styled-components/cjs/components/Dropdown/ui/DropdownGroup/DropdownGroup.js +1 -1
  229. package/styled-components/cjs/components/Dropdown/ui/DropdownHeader/DropdownHeader.js +1 -1
  230. package/styled-components/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.js +4 -4
  231. package/styled-components/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.styles.js +1 -1
  232. package/styled-components/cjs/components/Dropdown/utils/index.js +1 -1
  233. package/styled-components/cjs/components/Grid/Grid.js +2 -2
  234. package/styled-components/cjs/components/Grid/ui/Col/Col.js +2 -2
  235. package/styled-components/cjs/components/Grid/ui/Row/Row.js +1 -1
  236. package/styled-components/cjs/components/Grid/utils/index.js +1 -1
  237. package/styled-components/cjs/components/Header/HeaderRoot/HeaderRoot.js +1 -1
  238. package/styled-components/cjs/components/Header/ui/HeaderArrow/HeaderArrow.js +1 -1
  239. package/styled-components/cjs/components/Header/ui/HeaderLogo/HeaderLogo.js +1 -1
  240. package/styled-components/cjs/components/Header/ui/HeaderTitleWrapper/HeaderTitleWrapper.js +1 -1
  241. package/styled-components/cjs/components/Image/Image.js +2 -2
  242. package/styled-components/cjs/components/Image/Image.styles.js +1 -1
  243. package/styled-components/cjs/components/Indicator/Indicator.js +1 -1
  244. package/styled-components/cjs/components/Link/Link.js +1 -1
  245. package/styled-components/cjs/components/Modal/Modal.js +1 -1
  246. package/styled-components/cjs/components/Modal/ModalContext.js +1 -1
  247. package/styled-components/cjs/components/Modal/hooks/useModal.js +1 -1
  248. package/styled-components/cjs/components/Notification/Notification.js +1 -1
  249. package/styled-components/cjs/components/Notification/Notification.styles.js +1 -1
  250. package/styled-components/cjs/components/Notification/NotificationsPortal.js +1 -1
  251. package/styled-components/cjs/components/Notification/NotificationsStore.js +1 -1
  252. package/styled-components/cjs/components/Overlay/Overlay.js +2 -2
  253. package/styled-components/cjs/components/Pagination/Pagination.js +3 -3
  254. package/styled-components/cjs/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js +2 -2
  255. package/styled-components/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
  256. package/styled-components/cjs/components/Panel/Panel.js +2 -2
  257. package/styled-components/cjs/components/Panel/ui/PanelContent/PanelContent.js +1 -1
  258. package/styled-components/cjs/components/Panel/ui/PanelFooter/PanelFooter.js +1 -1
  259. package/styled-components/cjs/components/Panel/ui/PanelHeader/PanelHeader.js +1 -1
  260. package/styled-components/cjs/components/Popover/Popover.js +9 -9
  261. package/styled-components/cjs/components/Popup/Popup.js +2 -2
  262. package/styled-components/cjs/components/Popup/PopupContext.js +1 -1
  263. package/styled-components/cjs/components/Popup/PopupRoot.js +1 -1
  264. package/styled-components/cjs/components/Popup/hooks/usePopup.js +1 -1
  265. package/styled-components/cjs/components/Progress/Progress.js +1 -1
  266. package/styled-components/cjs/components/Progress/Progress.styles.js +1 -1
  267. package/styled-components/cjs/components/Radiobox/Radiobox.js +1 -1
  268. package/styled-components/cjs/components/SSRProvider/SSRProvider.js +1 -1
  269. package/styled-components/cjs/components/Segment/SegmentProvider/SegmentProvider.js +1 -1
  270. package/styled-components/cjs/components/Segment/ui/SegmentGroup/SegmentGroup.js +1 -1
  271. package/styled-components/cjs/components/Segment/ui/SegmentGroup/SegmentGroup.styles.js +1 -1
  272. package/styled-components/cjs/components/Segment/ui/SegmentItem/SegmentItem.js +3 -3
  273. package/styled-components/cjs/components/Segment/ui/SegmentItem/SegmentItem.styles.js +1 -1
  274. package/styled-components/cjs/components/Select/Select.js +6 -6
  275. package/styled-components/cjs/components/Select/hooks/useKeyNavigation.js +12 -12
  276. package/styled-components/cjs/components/Select/ui/SelectChip/SelectChip.js +2 -2
  277. package/styled-components/cjs/components/Select/ui/SelectTarget/SelectTarget.js +3 -3
  278. package/styled-components/cjs/components/Select/utils/index.js +3 -3
  279. package/styled-components/cjs/components/Skeleton/LineSkeleton/LineSkeleton.js +1 -1
  280. package/styled-components/cjs/components/Skeleton/LineSkeleton/LineSkeleton.styles.js +1 -1
  281. package/styled-components/cjs/components/Skeleton/RectSkeleton/RectSkeleton.js +1 -1
  282. package/styled-components/cjs/components/Skeleton/TextSkeleton/TextSkeleton.js +2 -2
  283. package/styled-components/cjs/components/Skeleton/hoc/withSkeleton.js +1 -1
  284. package/styled-components/cjs/components/Spinner/Spinner.js +1 -1
  285. package/styled-components/cjs/components/Spinner/Spinner.styles.js +1 -1
  286. package/styled-components/cjs/components/Spinner/utils/index.js +1 -1
  287. package/styled-components/cjs/components/Switch/Switch.js +1 -1
  288. package/styled-components/cjs/components/Tabs/TabsContext.js +3 -2
  289. package/styled-components/cjs/components/Tabs/createTabsController.js +1 -1
  290. package/styled-components/cjs/components/Tabs/ui/TabItem/TabItem.js +2 -2
  291. package/styled-components/cjs/components/Tabs/ui/TabItem/TabItem.styles.js +1 -1
  292. package/styled-components/cjs/components/Tabs/ui/Tabs/Tabs.js +3 -3
  293. package/styled-components/cjs/components/Tabs/ui/Tabs/Tabs.styles.js +1 -1
  294. package/styled-components/cjs/components/TextArea/TextArea.js +2 -2
  295. package/styled-components/cjs/components/TextField/TextField.js +3 -3
  296. package/styled-components/cjs/components/TextField/hooks/useKeyNavigation.js +9 -9
  297. package/styled-components/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js +2 -2
  298. package/styled-components/cjs/components/Toast/Toast.js +2 -2
  299. package/styled-components/cjs/components/Toast/Toast.styles.js +1 -1
  300. package/styled-components/cjs/components/Toast/ToastController.js +2 -2
  301. package/styled-components/cjs/components/Toast/ToastProvider/ToastProvider.js +3 -3
  302. package/styled-components/cjs/components/Toolbar/Toolbar.js +1 -1
  303. package/styled-components/cjs/components/Toolbar/ui/ToolbarDivider/ToolbarDivider.js +1 -1
  304. package/styled-components/cjs/components/Tooltip/Tooltip.js +2 -2
  305. package/styled-components/cjs/components/Typography/Old/Subtitle/Subtitle.js +2 -2
  306. package/styled-components/cjs/components/Typography/Old/TypographyOld.js +2 -2
  307. package/styled-components/cjs/components/Typography/Typography.js +2 -2
  308. package/styled-components/cjs/engines/common.js +1 -1
  309. package/styled-components/cjs/engines/styled-components.js +1 -1
  310. package/styled-components/cjs/examples/_helpers.js +1 -1
  311. package/styled-components/cjs/examples/plasma_b2c/components/Chip/Chip.config.js +10 -7
  312. package/styled-components/cjs/examples/plasma_b2c/components/Chip/Chip.stories.tsx +18 -2
  313. package/styled-components/cjs/examples/plasma_b2c/components/Grid/Grid.config.js +1 -1
  314. package/styled-components/cjs/examples/plasma_web/components/Chip/Chip.config.js +10 -7
  315. package/styled-components/cjs/examples/plasma_web/components/Chip/Chip.stories.tsx +18 -2
  316. package/styled-components/cjs/examples/plasma_web/components/Grid/Grid.config.js +1 -1
  317. package/styled-components/cjs/examples/sds_engineer/components/Grid/Grid.config.js +1 -1
  318. package/styled-components/cjs/mixins/applySpacing.js +1 -1
  319. package/styled-components/cjs/mixins/typography.js +1 -1
  320. package/styled-components/es/components/Button/Button.js +1 -1
  321. package/styled-components/es/components/Calendar/CalendarBase/CalendarBase.js +1 -1
  322. package/styled-components/es/components/Calendar/CalendarDouble/CalendarDouble.js +1 -1
  323. package/styled-components/es/components/Calendar/hoc/withRange.js +1 -1
  324. package/styled-components/es/components/Calendar/hooks/useKeyNavigation.js +20 -20
  325. package/styled-components/es/components/Calendar/store/reducer.js +1 -1
  326. package/styled-components/es/components/Calendar/ui/CalendarDays/CalendarDays.js +3 -3
  327. package/styled-components/es/components/Calendar/ui/CalendarHeader/CalendarHeader.js +2 -2
  328. package/styled-components/es/components/Calendar/ui/CalendarMonths/CalendarMonths.js +1 -1
  329. package/styled-components/es/components/Calendar/ui/CalendarYears/CalendarYears.js +1 -1
  330. package/styled-components/es/components/Chip/Chip.js +17 -5
  331. package/styled-components/es/components/Chip/Chip.template-doc.mdx +2 -2
  332. package/styled-components/es/components/Chip/Chip.tokens.js +4 -0
  333. package/styled-components/es/components/Chip/variations/_pilled/base.js +3 -0
  334. package/styled-components/es/components/Chip/variations/_pilled/tokens.json +4 -0
  335. package/styled-components/es/components/Combobox/Combobox.js +5 -5
  336. package/styled-components/es/components/Combobox/hooks/useFocusController.js +9 -9
  337. package/styled-components/es/components/Combobox/ui/ComboboxChip/ComboboxChip.js +1 -1
  338. package/styled-components/es/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js +6 -6
  339. package/styled-components/es/components/Divider/Divider.js +1 -1
  340. package/styled-components/es/components/Drawer/DrawerContext.js +1 -1
  341. package/styled-components/es/components/Drawer/hooks/useDrawer.js +1 -1
  342. package/styled-components/es/components/Drawer/ui/DrawerContent/DrawerContent.js +1 -1
  343. package/styled-components/es/components/Drawer/ui/DrawerFooter/DrawerFooter.js +1 -1
  344. package/styled-components/es/components/Drawer/ui/DrawerHeader/DrawerHeader.js +1 -1
  345. package/styled-components/es/components/Dropdown/ui/DropdownItem/DropdownItem.js +3 -3
  346. package/styled-components/es/components/Grid/Grid.js +1 -1
  347. package/styled-components/es/components/Grid/ui/Col/Col.js +1 -1
  348. package/styled-components/es/components/Grid/utils/index.js +1 -1
  349. package/styled-components/es/components/Image/Image.js +1 -1
  350. package/styled-components/es/components/Modal/ModalContext.js +1 -1
  351. package/styled-components/es/components/Modal/hooks/useModal.js +1 -1
  352. package/styled-components/es/components/Notification/NotificationsStore.js +1 -1
  353. package/styled-components/es/components/Overlay/Overlay.js +1 -1
  354. package/styled-components/es/components/Pagination/Pagination.js +2 -2
  355. package/styled-components/es/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js +1 -1
  356. package/styled-components/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +1 -1
  357. package/styled-components/es/components/Panel/Panel.js +1 -1
  358. package/styled-components/es/components/Popover/Popover.js +8 -8
  359. package/styled-components/es/components/Popup/Popup.js +1 -1
  360. package/styled-components/es/components/Popup/hooks/usePopup.js +1 -1
  361. package/styled-components/es/components/Segment/ui/SegmentItem/SegmentItem.js +2 -2
  362. package/styled-components/es/components/Select/Select.js +5 -5
  363. package/styled-components/es/components/Select/hooks/useKeyNavigation.js +12 -12
  364. package/styled-components/es/components/Select/ui/SelectChip/SelectChip.js +1 -1
  365. package/styled-components/es/components/Select/ui/SelectTarget/SelectTarget.js +2 -2
  366. package/styled-components/es/components/Select/utils/index.js +3 -3
  367. package/styled-components/es/components/Skeleton/TextSkeleton/TextSkeleton.js +1 -1
  368. package/styled-components/es/components/Skeleton/hoc/withSkeleton.js +1 -1
  369. package/styled-components/es/components/Spinner/utils/index.js +1 -1
  370. package/styled-components/es/components/Tabs/TabsContext.js +3 -2
  371. package/styled-components/es/components/Tabs/ui/TabItem/TabItem.js +1 -1
  372. package/styled-components/es/components/Tabs/ui/Tabs/Tabs.js +2 -2
  373. package/styled-components/es/components/TextArea/TextArea.js +1 -1
  374. package/styled-components/es/components/TextField/TextField.js +2 -2
  375. package/styled-components/es/components/TextField/hooks/useKeyNavigation.js +9 -9
  376. package/styled-components/es/components/TextField/ui/TextFieldChip/TextFieldChip.js +1 -1
  377. package/styled-components/es/components/Toast/Toast.js +1 -1
  378. package/styled-components/es/components/Toast/ToastController.js +1 -1
  379. package/styled-components/es/components/Toast/ToastProvider/ToastProvider.js +2 -2
  380. package/styled-components/es/components/Toolbar/ui/ToolbarDivider/ToolbarDivider.js +1 -1
  381. package/styled-components/es/components/Tooltip/Tooltip.js +1 -1
  382. package/styled-components/es/components/Typography/Old/Subtitle/Subtitle.js +1 -1
  383. package/styled-components/es/components/Typography/Old/TypographyOld.js +1 -1
  384. package/styled-components/es/components/Typography/Typography.js +1 -1
  385. package/styled-components/es/engines/common.js +1 -1
  386. package/styled-components/es/examples/_helpers.js +1 -1
  387. package/styled-components/es/examples/plasma_b2c/components/Chip/Chip.config.js +10 -7
  388. package/styled-components/es/examples/plasma_b2c/components/Chip/Chip.stories.tsx +18 -2
  389. package/styled-components/es/examples/plasma_b2c/components/Grid/Grid.config.js +1 -1
  390. package/styled-components/es/examples/plasma_web/components/Chip/Chip.config.js +10 -7
  391. package/styled-components/es/examples/plasma_web/components/Chip/Chip.stories.tsx +18 -2
  392. package/styled-components/es/examples/plasma_web/components/Grid/Grid.config.js +1 -1
  393. package/styled-components/es/examples/sds_engineer/components/Grid/Grid.config.js +1 -1
  394. package/styled-components/es/mixins/applySpacing.js +1 -1
  395. package/styled-components/es/mixins/typography.js +1 -1
  396. package/types/components/Chip/Chip.d.ts +4 -0
  397. package/types/components/Chip/Chip.d.ts.map +1 -1
  398. package/types/components/Chip/Chip.tokens.d.ts +4 -0
  399. package/types/components/Chip/Chip.tokens.d.ts.map +1 -1
  400. package/types/components/Chip/Chip.types.d.ts +6 -0
  401. package/types/components/Chip/Chip.types.d.ts.map +1 -1
  402. package/types/components/Chip/variations/_pilled/base.d.ts +2 -0
  403. package/types/components/Chip/variations/_pilled/base.d.ts.map +1 -0
  404. package/types/examples/plasma_b2c/components/Chip/Chip.config.d.ts +4 -1
  405. package/types/examples/plasma_b2c/components/Chip/Chip.config.d.ts.map +1 -1
  406. package/types/examples/plasma_b2c/components/Chip/Chip.d.ts +4 -1
  407. package/types/examples/plasma_b2c/components/Chip/Chip.d.ts.map +1 -1
  408. package/types/examples/plasma_web/components/Chip/Chip.config.d.ts +4 -1
  409. package/types/examples/plasma_web/components/Chip/Chip.config.d.ts.map +1 -1
  410. package/types/examples/plasma_web/components/Chip/Chip.d.ts +4 -1
  411. package/types/examples/plasma_web/components/Chip/Chip.d.ts.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"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,OAAO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AE,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","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;AACHI,IAAAA,GAAG,CAACG,GAAG,CAACP,QAAQ,CAAC,CAAA;AACrB,GAAA;AAEA,EAAA,OAAOQ,KAAK,CAACC,IAAI,CAACL,GAAG,CAAC,CAAA;AAC1B,EAAC;AAED,IAAMM,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAAIC,QAAsB,EAAa;AAC7D,EAAA,IAAI,CAACA,QAAQ,IAAI,OAAOA,QAAQ,KAAK,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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;;;;;;;"}
@@ -12,7 +12,7 @@ var TabItemRefs = /*#__PURE__*/function () {
12
12
  _rollupPluginBabelHelpers.defineProperty(this, "current", 0);
13
13
  this.current = value || 0;
14
14
  }
15
- return _rollupPluginBabelHelpers.createClass(TabItemRefs, [{
15
+ _rollupPluginBabelHelpers.createClass(TabItemRefs, [{
16
16
  key: "register",
17
17
  value: function register(ref) {
18
18
  this.items.push(ref);
@@ -29,6 +29,7 @@ var TabItemRefs = /*#__PURE__*/function () {
29
29
  this.current = value;
30
30
  }
31
31
  }]);
32
+ return TabItemRefs;
32
33
  }();
33
34
  var TabsContext = /*#__PURE__*/React.createContext(null);
34
35
 
@@ -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;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;;;;;"}
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;;;;;"}
@@ -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 || onIndexChange(focusIndex);
74
+ onIndexChange === null || onIndexChange === void 0 ? 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,C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ACU,2BAAY,EAAA;MAACP,SAAS,EAAE9B,cAAO,CAACsC,eAAAA;KAAkBzD,EAAAA,YAA2B,CACjG,CACA,CAAC,CAAA;AAEf,GAAC,CAAC,CAAA;AAAA,EAAA;AAEC,IAAM0D,aAA8B,GAAG;AAC1CC,EAAAA,IAAI,EAAE,SAAS;AACfC,EAAAA,GAAG,EAAE,QAAQ;AACbC,EAAAA,MAAM,EAAE5E,WAAW;AACnB6E,EAAAA,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;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,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;;;;;"}
@@ -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 || _refs$items$nextIndex.focus();
127
- (_refs$items$nextIndex2 = refs.items[nextIndex].current) === null || _refs$items$nextIndex2 === void 0 || _refs$items$nextIndex2.scrollIntoView({
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({
128
128
  block: 'center',
129
129
  inline: 'center',
130
130
  behavior: 'smooth'
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.js","sources":["../../../../../src/components/Tabs/ui/Tabs/Tabs.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useMemo, useState, useEffect, useRef, KeyboardEvent } from 'react';\nimport type { MutableRefObject } from 'react';\nimport { animatedScrollToX, safeUseId } from '@salutejs/plasma-core';\n\nimport type { RootProps } from '../../../../engines/types';\nimport { IconDisclosureLeft, IconDisclosureRight } from '../../../_Icon';\nimport { classes, tokens } from '../../tokens';\nimport { cx } from '../../../../utils';\nimport { TabItemRefs, TabsContext } from '../../TabsContext';\n\nimport { base as sizeCSS } from './variations/_size/base';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as disabledCSS } from './variations/_disabled/base';\nimport { base as pilledCSS } from './variations/_pilled/base';\nimport { base as stretchCSS } from './variations/_stretch/base';\nimport { StyledArrow, StyledContent, StyledContentWrapper, base } from './Tabs.styles';\nimport type { TabsProps } from './Tabs.types';\n\nenum Keys {\n end = 35,\n home = 36,\n left = 37,\n right = 39,\n}\n\nexport const tabsRoot = (Root: RootProps<HTMLDivElement, TabsProps>) =>\n forwardRef<HTMLDivElement, TabsProps>((props, outerRef) => {\n const { id, stretch = false, disabled = false, size, view, children, pilled, index, ...rest } = props;\n\n const [firstItemVisible, setFirstItemVisible] = useState(true);\n const [lastItemVisible, setLastItemVisible] = useState(true);\n\n const refs = useMemo(() => new TabItemRefs(index), []);\n\n const uniqId = safeUseId();\n const tabsId = id || uniqId;\n\n const isFilled = view === 'filled'; // outer padding is only for filled view\n const pilledAttr = view !== 'clear' && pilled;\n const pilledClass = pilledAttr ? classes.tabsPilled : undefined;\n\n const stretchClass = firstItemVisible && lastItemVisible && stretch ? classes.tabsStretch : undefined;\n const hasLeftArrowClass = !firstItemVisible ? classes.tabsHasLeftArrow : undefined;\n const hasRightArrowClass = !lastItemVisible ? classes.tabsHasRightArrow : undefined;\n\n const scrollRef = useRef<HTMLElement | null>(null);\n const trackRef = useRef<HTMLElement | null>(null);\n\n const onPrev = useCallback(() => {\n !disabled &&\n scrollRef.current &&\n animatedScrollToX(scrollRef.current, scrollRef.current.scrollLeft - scrollRef.current.offsetWidth / 2);\n }, [disabled, scrollRef]);\n\n const onNext = useCallback(() => {\n !disabled &&\n scrollRef.current &&\n animatedScrollToX(scrollRef.current, scrollRef.current.scrollLeft + scrollRef.current.offsetWidth / 2);\n }, [disabled, scrollRef]);\n\n const PreviousButton = useMemo(\n () => (\n <StyledArrow\n type=\"button\"\n aria-label=\"Предыдущий таб\"\n onClick={onPrev}\n tabIndex={disabled ? -1 : 0}\n disabled={disabled}\n isFilled={isFilled}\n isLeftArrow\n >\n <IconDisclosureLeft color={`var(${tokens.arrowColor})`} />\n </StyledArrow>\n ),\n [onPrev, disabled, isFilled],\n );\n\n const NextButton = useMemo(\n () => (\n <StyledArrow\n type=\"button\"\n aria-label=\"Следующий таб\"\n onClick={onNext}\n tabIndex={disabled ? -1 : 0}\n disabled={disabled}\n isFilled={isFilled}\n >\n <IconDisclosureRight color={`var(${tokens.arrowColor})`} />\n </StyledArrow>\n ),\n [onNext, disabled, isFilled],\n );\n\n const handleScroll = useCallback(\n (event: React.UIEvent<HTMLElement>): void => {\n event.stopPropagation();\n const maxScrollLeft = event.currentTarget.scrollWidth - event.currentTarget.clientWidth;\n\n setFirstItemVisible(event.currentTarget.scrollLeft <= 0);\n setLastItemVisible(event.currentTarget.scrollLeft >= maxScrollLeft);\n },\n [setFirstItemVisible, setLastItemVisible],\n );\n\n const onKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n if (index === undefined) {\n return;\n }\n\n const minIndex = 0;\n const maxIndex = refs.items.length - 1;\n let nextIndex: number;\n\n switch (event.keyCode) {\n case Keys.end:\n nextIndex = maxIndex;\n break;\n case Keys.left:\n nextIndex = index > minIndex ? index - 1 : index;\n break;\n case Keys.right:\n nextIndex = index < maxIndex ? index + 1 : index;\n break;\n case Keys.home:\n nextIndex = minIndex;\n break;\n default:\n return;\n }\n\n if (nextIndex !== index) {\n event.preventDefault();\n refs.items[nextIndex].current?.focus();\n refs.items[nextIndex].current?.scrollIntoView({\n block: 'center',\n inline: 'center',\n behavior: 'smooth',\n });\n }\n },\n [index],\n );\n\n useEffect(() => {\n setLastItemVisible(scrollRef.current?.scrollWidth === scrollRef.current?.clientWidth);\n }, []);\n\n return (\n <TabsContext.Provider value={refs}>\n <Root\n view={view}\n role=\"tablist\"\n size={size}\n pilled={pilled}\n id={tabsId}\n ref={outerRef}\n disabled={disabled}\n className={cx(pilledClass, stretchClass, hasLeftArrowClass, hasRightArrowClass)}\n onKeyDown={onKeyDown}\n {...rest}\n >\n {!firstItemVisible && PreviousButton}\n <StyledContentWrapper\n ref={scrollRef as MutableRefObject<HTMLDivElement | null>}\n onScroll={handleScroll}\n >\n <StyledContent ref={trackRef as MutableRefObject<HTMLDivElement | null>}>\n {children}\n </StyledContent>\n </StyledContentWrapper>\n {!lastItemVisible && NextButton}\n </Root>\n </TabsContext.Provider>\n );\n });\n\nexport const tabsConfig = {\n name: 'Tabs',\n tag: 'div',\n layout: tabsRoot,\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 stretch: {\n css: stretchCSS,\n attrs: true,\n },\n pilled: {\n css: pilledCSS,\n },\n },\n defaults: {\n view: 'clear',\n size: 'xs',\n },\n};\n"],"names":["Keys","tabsRoot","Root","forwardRef","props","outerRef","id","_props$stretch","stretch","_props$disabled","disabled","size","view","children","pilled","index","rest","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","firstItemVisible","setFirstItemVisible","_useState3","_useState4","lastItemVisible","setLastItemVisible","refs","useMemo","TabItemRefs","uniqId","safeUseId","tabsId","isFilled","pilledAttr","pilledClass","classes","tabsPilled","undefined","stretchClass","tabsStretch","hasLeftArrowClass","tabsHasLeftArrow","hasRightArrowClass","tabsHasRightArrow","scrollRef","useRef","trackRef","onPrev","useCallback","current","animatedScrollToX","scrollLeft","offsetWidth","onNext","PreviousButton","React","createElement","StyledArrow","type","onClick","tabIndex","isLeftArrow","IconDisclosureLeft","color","concat","tokens","arrowColor","NextButton","IconDisclosureRight","handleScroll","event","stopPropagation","maxScrollLeft","currentTarget","scrollWidth","clientWidth","onKeyDown","minIndex","maxIndex","items","length","nextIndex","keyCode","end","left","right","home","_refs$items$nextIndex","_refs$items$nextIndex2","preventDefault","focus","scrollIntoView","block","inline","behavior","useEffect","_scrollRef$current","_scrollRef$current2","TabsContext","Provider","value","_extends","role","ref","className","cx","StyledContentWrapper","onScroll","StyledContent","tabsConfig","name","tag","layout","base","variations","css","sizeCSS","viewCSS","disabledCSS","attrs","stretchCSS","pilledCSS","defaults"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAeuF,IAGlFA,IAAI,0BAAJA,IAAI,EAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,KAAA,CAAA,GAAA,EAAA,CAAA,GAAA,KAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,MAAA,CAAA,GAAA,EAAA,CAAA,GAAA,MAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,MAAA,CAAA,GAAA,EAAA,CAAA,GAAA,MAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,OAAA,CAAA,GAAA,EAAA,CAAA,GAAA,OAAA,CAAA;AAAA,EAAA,OAAJA,IAAI,CAAA;AAAA,CAAA,CAAJA,IAAI,IAAA,EAAA,CAAA,CAAA;IAOIC,QAAQ,GAAG,SAAXA,QAAQA,CAAIC,IAA0C,EAAA;AAAA,EAAA,oBAC/DC,gBAAU,CAA4B,UAACC,KAAK,EAAEC,QAAQ,EAAK;AACvD,IAAA,IAAQC,EAAE,GAAsFF,KAAK,CAA7FE,EAAE;MAAAC,cAAA,GAAsFH,KAAK,CAAzFI,OAAO;AAAPA,MAAAA,OAAO,GAAAD,cAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,cAAA;MAAAE,eAAA,GAAqEL,KAAK,CAAxEM,QAAQ;AAARA,MAAAA,QAAQ,GAAAD,eAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,eAAA;MAAEE,IAAI,GAA6CP,KAAK,CAAtDO,IAAI;MAAEC,IAAI,GAAuCR,KAAK,CAAhDQ,IAAI;MAAEC,QAAQ,GAA6BT,KAAK,CAA1CS,QAAQ;MAAEC,MAAM,GAAqBV,KAAK,CAAhCU,MAAM;MAAEC,OAAK,GA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D,EAAAA,IAAI,CAEP,EAAA,CAACO,gBAAgB,IAAIkC,cAAc,eACpCC,KAAA,CAAAC,aAAA,CAACkD,gCAAoB,EAAA;AACjBH,MAAAA,GAAG,EAAE3D,SAAqD;AAC1D+D,MAAAA,QAAQ,EAAEtC,YAAAA;AAAa,KAAA,eAEvBd,KAAA,CAAAC,aAAA,CAACoD,yBAAa,EAAA;AAACL,MAAAA,GAAG,EAAEzD,QAAAA;KACfpC,EAAAA,QACU,CACG,CAAC,EACtB,CAACc,eAAe,IAAI2C,UACnB,CACY,CAAC,CAAA;AAE/B,GAAC,CAAC,CAAA;AAAA,EAAA;AAEC,IAAM0C,UAAU,GAAG;AACtBC,EAAAA,IAAI,EAAE,MAAM;AACZC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAElH,QAAQ;AAChBmH,EAAAA,IAAI,EAAJA,gBAAI;AACJC,EAAAA,UAAU,EAAE;AACR1G,IAAAA,IAAI,EAAE;AACF2G,MAAAA,GAAG,EAAEC,SAAAA;KACR;AACD3G,IAAAA,IAAI,EAAE;AACF0G,MAAAA,GAAG,EAAEE,WAAAA;KACR;AACD9G,IAAAA,QAAQ,EAAE;AACN4G,MAAAA,GAAG,EAAEG,WAAW;AAChBC,MAAAA,KAAK,EAAE,IAAA;KACV;AACDlH,IAAAA,OAAO,EAAE;AACL8G,MAAAA,GAAG,EAAEK,WAAU;AACfD,MAAAA,KAAK,EAAE,IAAA;KACV;AACD5G,IAAAA,MAAM,EAAE;AACJwG,MAAAA,GAAG,EAAEM,WAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNjH,IAAAA,IAAI,EAAE,OAAO;AACbD,IAAAA,IAAI,EAAE,IAAA;AACV,GAAA;AACJ;;;;;"}
1
+ {"version":3,"file":"Tabs.js","sources":["../../../../../src/components/Tabs/ui/Tabs/Tabs.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useMemo, useState, useEffect, useRef, KeyboardEvent } from 'react';\nimport type { MutableRefObject } from 'react';\nimport { animatedScrollToX, safeUseId } from '@salutejs/plasma-core';\n\nimport type { RootProps } from '../../../../engines/types';\nimport { IconDisclosureLeft, IconDisclosureRight } from '../../../_Icon';\nimport { classes, tokens } from '../../tokens';\nimport { cx } from '../../../../utils';\nimport { TabItemRefs, TabsContext } from '../../TabsContext';\n\nimport { base as sizeCSS } from './variations/_size/base';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as disabledCSS } from './variations/_disabled/base';\nimport { base as pilledCSS } from './variations/_pilled/base';\nimport { base as stretchCSS } from './variations/_stretch/base';\nimport { StyledArrow, StyledContent, StyledContentWrapper, base } from './Tabs.styles';\nimport type { TabsProps } from './Tabs.types';\n\nenum Keys {\n end = 35,\n home = 36,\n left = 37,\n right = 39,\n}\n\nexport const tabsRoot = (Root: RootProps<HTMLDivElement, TabsProps>) =>\n forwardRef<HTMLDivElement, TabsProps>((props, outerRef) => {\n const { id, stretch = false, disabled = false, size, view, children, pilled, index, ...rest } = props;\n\n const [firstItemVisible, setFirstItemVisible] = useState(true);\n const [lastItemVisible, setLastItemVisible] = useState(true);\n\n const refs = useMemo(() => new TabItemRefs(index), []);\n\n const uniqId = safeUseId();\n const tabsId = id || uniqId;\n\n const isFilled = view === 'filled'; // outer padding is only for filled view\n const pilledAttr = view !== 'clear' && pilled;\n const pilledClass = pilledAttr ? classes.tabsPilled : undefined;\n\n const stretchClass = firstItemVisible && lastItemVisible && stretch ? classes.tabsStretch : undefined;\n const hasLeftArrowClass = !firstItemVisible ? classes.tabsHasLeftArrow : undefined;\n const hasRightArrowClass = !lastItemVisible ? classes.tabsHasRightArrow : undefined;\n\n const scrollRef = useRef<HTMLElement | null>(null);\n const trackRef = useRef<HTMLElement | null>(null);\n\n const onPrev = useCallback(() => {\n !disabled &&\n scrollRef.current &&\n animatedScrollToX(scrollRef.current, scrollRef.current.scrollLeft - scrollRef.current.offsetWidth / 2);\n }, [disabled, scrollRef]);\n\n const onNext = useCallback(() => {\n !disabled &&\n scrollRef.current &&\n animatedScrollToX(scrollRef.current, scrollRef.current.scrollLeft + scrollRef.current.offsetWidth / 2);\n }, [disabled, scrollRef]);\n\n const PreviousButton = useMemo(\n () => (\n <StyledArrow\n type=\"button\"\n aria-label=\"Предыдущий таб\"\n onClick={onPrev}\n tabIndex={disabled ? -1 : 0}\n disabled={disabled}\n isFilled={isFilled}\n isLeftArrow\n >\n <IconDisclosureLeft color={`var(${tokens.arrowColor})`} />\n </StyledArrow>\n ),\n [onPrev, disabled, isFilled],\n );\n\n const NextButton = useMemo(\n () => (\n <StyledArrow\n type=\"button\"\n aria-label=\"Следующий таб\"\n onClick={onNext}\n tabIndex={disabled ? -1 : 0}\n disabled={disabled}\n isFilled={isFilled}\n >\n <IconDisclosureRight color={`var(${tokens.arrowColor})`} />\n </StyledArrow>\n ),\n [onNext, disabled, isFilled],\n );\n\n const handleScroll = useCallback(\n (event: React.UIEvent<HTMLElement>): void => {\n event.stopPropagation();\n const maxScrollLeft = event.currentTarget.scrollWidth - event.currentTarget.clientWidth;\n\n setFirstItemVisible(event.currentTarget.scrollLeft <= 0);\n setLastItemVisible(event.currentTarget.scrollLeft >= maxScrollLeft);\n },\n [setFirstItemVisible, setLastItemVisible],\n );\n\n const onKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n if (index === undefined) {\n return;\n }\n\n const minIndex = 0;\n const maxIndex = refs.items.length - 1;\n let nextIndex: number;\n\n switch (event.keyCode) {\n case Keys.end:\n nextIndex = maxIndex;\n break;\n case Keys.left:\n nextIndex = index > minIndex ? index - 1 : index;\n break;\n case Keys.right:\n nextIndex = index < maxIndex ? index + 1 : index;\n break;\n case Keys.home:\n nextIndex = minIndex;\n break;\n default:\n return;\n }\n\n if (nextIndex !== index) {\n event.preventDefault();\n refs.items[nextIndex].current?.focus();\n refs.items[nextIndex].current?.scrollIntoView({\n block: 'center',\n inline: 'center',\n behavior: 'smooth',\n });\n }\n },\n [index],\n );\n\n useEffect(() => {\n setLastItemVisible(scrollRef.current?.scrollWidth === scrollRef.current?.clientWidth);\n }, []);\n\n return (\n <TabsContext.Provider value={refs}>\n <Root\n view={view}\n role=\"tablist\"\n size={size}\n pilled={pilled}\n id={tabsId}\n ref={outerRef}\n disabled={disabled}\n className={cx(pilledClass, stretchClass, hasLeftArrowClass, hasRightArrowClass)}\n onKeyDown={onKeyDown}\n {...rest}\n >\n {!firstItemVisible && PreviousButton}\n <StyledContentWrapper\n ref={scrollRef as MutableRefObject<HTMLDivElement | null>}\n onScroll={handleScroll}\n >\n <StyledContent ref={trackRef as MutableRefObject<HTMLDivElement | null>}>\n {children}\n </StyledContent>\n </StyledContentWrapper>\n {!lastItemVisible && NextButton}\n </Root>\n </TabsContext.Provider>\n );\n });\n\nexport const tabsConfig = {\n name: 'Tabs',\n tag: 'div',\n layout: tabsRoot,\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 stretch: {\n css: stretchCSS,\n attrs: true,\n },\n pilled: {\n css: pilledCSS,\n },\n },\n defaults: {\n view: 'clear',\n size: 'xs',\n },\n};\n"],"names":["Keys","tabsRoot","Root","forwardRef","props","outerRef","id","_props$stretch","stretch","_props$disabled","disabled","size","view","children","pilled","index","rest","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","firstItemVisible","setFirstItemVisible","_useState3","_useState4","lastItemVisible","setLastItemVisible","refs","useMemo","TabItemRefs","uniqId","safeUseId","tabsId","isFilled","pilledAttr","pilledClass","classes","tabsPilled","undefined","stretchClass","tabsStretch","hasLeftArrowClass","tabsHasLeftArrow","hasRightArrowClass","tabsHasRightArrow","scrollRef","useRef","trackRef","onPrev","useCallback","current","animatedScrollToX","scrollLeft","offsetWidth","onNext","PreviousButton","React","createElement","StyledArrow","type","onClick","tabIndex","isLeftArrow","IconDisclosureLeft","color","concat","tokens","arrowColor","NextButton","IconDisclosureRight","handleScroll","event","stopPropagation","maxScrollLeft","currentTarget","scrollWidth","clientWidth","onKeyDown","minIndex","maxIndex","items","length","nextIndex","keyCode","end","left","right","home","_refs$items$nextIndex","_refs$items$nextIndex2","preventDefault","focus","scrollIntoView","block","inline","behavior","useEffect","_scrollRef$current","_scrollRef$current2","TabsContext","Provider","value","_extends","role","ref","className","cx","StyledContentWrapper","onScroll","StyledContent","tabsConfig","name","tag","layout","base","variations","css","sizeCSS","viewCSS","disabledCSS","attrs","stretchCSS","pilledCSS","defaults"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAeuF,IAGlFA,IAAI,0BAAJA,IAAI,EAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,KAAA,CAAA,GAAA,EAAA,CAAA,GAAA,KAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,MAAA,CAAA,GAAA,EAAA,CAAA,GAAA,MAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,MAAA,CAAA,GAAA,EAAA,CAAA,GAAA,MAAA,CAAA;AAAJA,EAAAA,IAAI,CAAJA,IAAI,CAAA,OAAA,CAAA,GAAA,EAAA,CAAA,GAAA,OAAA,CAAA;AAAA,EAAA,OAAJA,IAAI,CAAA;AAAA,CAAA,CAAJA,IAAI,IAAA,EAAA,CAAA,CAAA;IAOIC,QAAQ,GAAG,SAAXA,QAAQA,CAAIC,IAA0C,EAAA;AAAA,EAAA,oBAC/DC,gBAAU,CAA4B,UAACC,KAAK,EAAEC,QAAQ,EAAK;AACvD,IAAA,IAAQC,EAAE,GAAsFF,KAAK,CAA7FE,EAAE;MAAAC,cAAA,GAAsFH,KAAK,CAAzFI,OAAO;AAAPA,MAAAA,OAAO,GAAAD,cAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,cAAA;MAAAE,eAAA,GAAqEL,KAAK,CAAxEM,QAAQ;AAARA,MAAAA,QAAQ,GAAAD,eAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,eAAA;MAA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jH,IAAAA,IAAI,EAAE,OAAO;AACbD,IAAAA,IAAI,EAAE,IAAA;AACV,GAAA;AACJ;;;;;"}
@@ -124,7 +124,7 @@ var textAreaRoot = function textAreaRoot(Root) {
124
124
  if (value === undefined) {
125
125
  setUncontrolledValue(event === null || event === void 0 ? void 0 : event.target.value);
126
126
  }
127
- onChange === null || onChange === void 0 || onChange(event);
127
+ onChange === null || onChange === void 0 ? void 0 : onChange(event);
128
128
  }, [value, onChange]);
129
129
  var dynamicLabelClasses = getDynamicLabelClasses({
130
130
  readOnly: readOnly,
@@ -1 +1 @@
1
- {"version":3,"file":"TextArea.js","sources":["../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import React, { forwardRef, useState, createRef, useCallback } from 'react';\nimport { css } from '@linaria/core';\nimport { useResizeObserver } from '@salutejs/plasma-core';\n\nimport { cx } from '../../utils';\nimport type { RootProps } from '../../engines/types';\n\nimport { applyDynamicLabel } from './mixins';\nimport { useAutoResize, ROOT_FONT_SIZE } from './hooks';\nimport {\n StyledContent,\n StyledHelpers,\n StyledLeftHelper,\n StyledRightHelper,\n StyledLabel,\n StyledPlaceholder,\n StyledTextArea,\n StyledTextAreaWrapper,\n StyledContainer,\n} from './TextArea.styles';\nimport { classes } from './TextArea.tokens';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { base as disabledCSS } from './variations/_disabled/base';\nimport type { TextAreaProps } from './TextArea.types';\n\nconst {\n innerPlaceholderUp,\n focusedOuterPlaceholderColor,\n hidePlaceHolder,\n styledContainer,\n styledTextArea,\n styledTextAreaWrapper,\n styledPlaceholder,\n styledHelpers,\n} = classes;\n\nconst base = css`\n ${applyDynamicLabel};\n\n position: relative;\n box-sizing: border-box;\n`;\n\n// TODO: Удалить после отказа от старых библиотек plasma-web / plasma-b2c\nconst fallbackStatusMap = {\n '': 'primary',\n success: 'positive',\n warning: 'warning',\n error: 'negative',\n};\n\n// TODO: Перенести этот метод в файл applyDynamicLabel.ts\nexport const getDynamicLabelClasses = (props: TextAreaProps, focused: boolean) => {\n const { readOnly, label, labelPlacement, autoResize, rows, value } = props;\n\n // Добавить класс отвечающий за изменение цвета плейсхолдера при фокусе\n const withFocusedOuterUpPlaceholder =\n !readOnly && focused && (!label || labelPlacement === 'outer') ? focusedOuterPlaceholderColor : undefined;\n\n // Добавить класс отвечающий за поднятие и уменьшение плейсхолдера\n const withInnerPlaceholderUp =\n labelPlacement === 'inner' &&\n label &&\n !autoResize &&\n !rows &&\n ((!readOnly && (value || focused)) || (readOnly && value))\n ? innerPlaceholderUp\n : undefined;\n\n // Добавить класс отвечающий за скрытие плейсхолдера\n const withHidePlaceholder =\n (value && !label) ||\n (labelPlacement === 'inner' && ((focused && !readOnly) || value) && label && (rows || autoResize)) ||\n (labelPlacement === 'outer' && value)\n ? hidePlaceHolder\n : undefined;\n\n return [withFocusedOuterUpPlaceholder, withInnerPlaceholderUp, withHidePlaceholder];\n};\n\nexport const textAreaRoot = (Root: RootProps<HTMLTextAreaElement, TextAreaProps>) =>\n forwardRef<HTMLTextAreaElement, TextAreaProps>((props, innerRef) => {\n const {\n helperText,\n status,\n resize,\n rightHelper,\n leftHelper,\n contentRight,\n autoResize = false,\n minAuto = 0,\n maxAuto,\n label,\n labelPlacement = 'inner',\n placeholder,\n defaultValue,\n height,\n width,\n value,\n disabled,\n size,\n view,\n id,\n style,\n className,\n readOnly,\n rows,\n cols,\n onChange,\n ...rest\n } = props;\n\n const [helperWidth, setHelperWidth] = useState<string>(width ? `${width}rem` : '100%');\n const [focused, setFocused] = useState(false);\n const [uncontrolledValue, setUncontrolledValue] = useState<string | undefined>();\n\n const outerRef = innerRef && 'current' in innerRef ? innerRef : createRef<HTMLTextAreaElement>();\n const hasHelper = Boolean(leftHelper || rightHelper || helperText);\n const overriddenView = status !== undefined ? fallbackStatusMap[status] : view;\n const textareaHelperId = id ? `${id}-helper` : undefined;\n const applyCustomWidth = resize !== 'horizontal' && resize !== 'both' && !cols;\n const placeLabel = labelPlacement === 'inner' && label ? label : placeholder;\n\n useResizeObserver(outerRef, (currentElement) => {\n const { width: inlineWidth, height: inlineHeight } = currentElement.style;\n\n if (inlineWidth || inlineHeight || cols) {\n const { width: elementWidth } = currentElement.getBoundingClientRect();\n setHelperWidth(`${elementWidth / ROOT_FONT_SIZE}rem`);\n }\n });\n\n useAutoResize(autoResize, outerRef, value, minAuto, maxAuto);\n\n const onFocusHandler = useCallback(() => {\n setFocused(true);\n }, []);\n const onBlurHandler = useCallback(() => {\n setFocused(false);\n }, []);\n\n const onChangeHandler = useCallback(\n (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n // INFO: Для крайне редких кейсов, когда value снаружи не контролируется\n if (value === undefined) {\n setUncontrolledValue(event?.target.value);\n }\n\n onChange?.(event);\n },\n [value, onChange],\n );\n\n const dynamicLabelClasses = getDynamicLabelClasses(\n { readOnly, label, labelPlacement, autoResize, rows, value: value || uncontrolledValue || defaultValue },\n focused,\n );\n\n return (\n <Root\n view={overriddenView}\n size={size}\n disabled={disabled}\n readOnly={readOnly}\n style={style}\n className={className}\n >\n {label && labelPlacement === 'outer' && <StyledLabel>{label}</StyledLabel>}\n <StyledContainer\n className={cx(styledContainer, ...dynamicLabelClasses)}\n width={helperWidth}\n onFocus={onFocusHandler}\n onBlur={onBlurHandler}\n >\n {contentRight && <StyledContent>{contentRight}</StyledContent>}\n <StyledTextAreaWrapper className={styledTextAreaWrapper} hasHelper={hasHelper}>\n <StyledTextArea\n className={styledTextArea}\n id={id}\n hasContentRight={Boolean(contentRight)}\n hasHelper={hasHelper}\n applyCustomWidth={applyCustomWidth}\n ref={outerRef}\n disabled={disabled}\n height={autoResize ? minAuto : height}\n width={width}\n placeholder={placeLabel}\n aria-describedby={textareaHelperId}\n value={value}\n readOnly={readOnly}\n rows={rows}\n cols={cols}\n resize={resize}\n defaultValue={defaultValue}\n onChange={onChangeHandler}\n {...rest}\n />\n </StyledTextAreaWrapper>\n {hasHelper && (\n <StyledHelpers className={styledHelpers} id={textareaHelperId}>\n {(leftHelper || helperText) && (\n <StyledLeftHelper>{leftHelper || helperText}</StyledLeftHelper>\n )}\n {rightHelper && <StyledRightHelper>{rightHelper}</StyledRightHelper>}\n </StyledHelpers>\n )}\n {placeLabel && (\n <StyledPlaceholder\n hasContentRight={Boolean(contentRight)}\n className={styledPlaceholder}\n htmlFor={id}\n >\n {placeLabel}\n </StyledPlaceholder>\n )}\n </StyledContainer>\n </Root>\n );\n });\n\nexport const textAreaConfig = {\n name: 'TextArea',\n tag: 'div',\n layout: textAreaRoot,\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 readOnly: {\n attrs: true,\n },\n },\n defaults: {\n size: 'm',\n view: 'primary',\n },\n};\n"],"names":["innerPlaceholderUp","classes","focusedOuterPlaceholderColor","hidePlaceHolder","styledContainer","styledTextArea","styledTextAreaWrapper","styledPlaceholder","styledHelpers","base","fallbackStatusMap","success","warning","error","getDynamicLabelClasses","props","focused","readOnly","label","labelPlacement","autoResize","rows","value","withFocusedOuterUpPlaceholder","undefined","withInnerPlaceholderUp","withHidePlaceholder","textAreaRoot","Root","forwardRef","innerRef","helperText","status","resize","rightHelper","leftHelper","contentRight","_props$autoResize","_props$minAuto","minAuto","maxAuto","_props$labelPlacement","placeholder","defaultValue","height","width","disabled","size","view","id","style","className","cols","onChange","rest","_excluded","_useState","useState","concat","_useState2","_slicedToArray","helperWidth","setHelperWidth","_useState3","_useState4","setFocused","_useState5","_useState6","uncontrolledValue","setUncontrolledValue","outerRef","createRef","hasHelper","Boolean","overriddenView","textareaHelperId","applyCustomWidth","placeLabel","useResizeObserver","currentElement","_currentElement$style","inlineWidth","inlineHeight","_currentElement$getBo","getBoundingClientRect","elementWidth","ROOT_FONT_SIZE","useAutoResize","onFocusHandler","useCallback","onBlurHandler","onChangeHandler","event","target","dynamicLabelClasses","React","createElement","StyledLabel","StyledContainer","cx","apply","_toConsumableArray","onFocus","onBlur","StyledContent","StyledTextAreaWrapper","StyledTextArea","_extends","hasContentRight","ref","StyledHelpers","StyledLeftHelper","StyledRightHelper","StyledPlaceholder","htmlFor","textAreaConfig","name","tag","layout","variations","css","sizeCSS","viewCSS","disabledCSS","attrs","defaults"],"mappings":";;;;;;;;;;;;;;;;AA0BA,IACIA,kBAAkB,GAQlBC,uBAAO,CARPD,kBAAkB;EAClBE,4BAA4B,GAO5BD,uBAAO,CAPPC,4BAA4B;EAC5BC,eAAe,GAMfF,uBAAO,CANPE,eAAe;EACfC,eAAe,GAKfH,uBAAO,CALPG,eAAe;EACfC,cAAc,GAIdJ,uBAAO,CAJPI,cAAc;EACdC,qBAAqB,GAGrBL,uBAAO,CAHPK,qBAAqB;EACrBC,iBAAiB,GAEjBN,uBAAO,CAFPM,iBAAiB;EACjBC,aAAAA,GACAP,uBAAO,CADPO,aAAAA,CAAAA;AAGJ,IAAMC,IAAI,GAKT,SAAA,CAAA;;AAED;AACA,IAAMC,iBAAiB,GAAG;AACtB,EAAA,EAAE,EAAE,SAAS;AACbC,EAAAA,OAAO,EAAE,UAAU;AACnBC,EAAAA,OAAO,EAAE,SAAS;AAClBC,EAAAA,KAAK,EAAE,UAAA;AACX,CAAC,CAAA;;AAED;AACO,IAAMC,sBAAsB,GAAGA,SAAzBA,sBAAsBA,CAAIC,KAAoB,EAAEC,OAAgB,EAAK;AAC9E,EAAA,IAAQC,QAAQ,GAAqDF,KAAK,CAAlEE,QAAQ;IAAEC,KAAK,GAA8CH,KAAK,CAAxDG,KAAK;IAAEC,cAAc,GAA8BJ,KAAK,CAAjDI,cAAc;IAAEC,UAAU,GAAkBL,KAAK,CAAjCK,UAAU;IAAEC,IAAI,GAAYN,KAAK,CAArBM,IAAI;IAAEC,KAAAA,GAAUP,KAAK,CAAfO,KAAAA,CAAAA;;AAE3D;AACA,EAAA,IAAMC,6BAA6B,GAC/B,CAACN,QAAQ,IAAID,OAAO,KAAK,CAACE,KAAK,IAAIC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AAAA;KAER4B,EAAAA,UACc,CAEV,CACf,CAAC,CAAA;AAEf,GAAC,CAAC,CAAA;AAAA,EAAA;AAEC,IAAMsC,cAAc,GAAG;AAC1BC,EAAAA,IAAI,EAAE,UAAU;AAChBC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE3F,YAAY;AACpBlB,EAAAA,IAAI,EAAJA,IAAI;AACJ8G,EAAAA,UAAU,EAAE;AACRxE,IAAAA,IAAI,EAAE;AACFyE,MAAAA,GAAG,EAAEC,WAAAA;KACR;AACDzE,IAAAA,IAAI,EAAE;AACFwE,MAAAA,GAAG,EAAEE,WAAAA;KACR;AACD5E,IAAAA,QAAQ,EAAE;AACN0E,MAAAA,GAAG,EAAEG,WAAW;AAChBC,MAAAA,KAAK,EAAE,IAAA;KACV;AACD3G,IAAAA,QAAQ,EAAE;AACN2G,MAAAA,KAAK,EAAE,IAAA;AACX,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACN9E,IAAAA,IAAI,EAAE,GAAG;AACTC,IAAAA,IAAI,EAAE,SAAA;AACV,GAAA;AACJ;;;;;;"}
1
+ {"version":3,"file":"TextArea.js","sources":["../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import React, { forwardRef, useState, createRef, useCallback } from 'react';\nimport { css } from '@linaria/core';\nimport { useResizeObserver } from '@salutejs/plasma-core';\n\nimport { cx } from '../../utils';\nimport type { RootProps } from '../../engines/types';\n\nimport { applyDynamicLabel } from './mixins';\nimport { useAutoResize, ROOT_FONT_SIZE } from './hooks';\nimport {\n StyledContent,\n StyledHelpers,\n StyledLeftHelper,\n StyledRightHelper,\n StyledLabel,\n StyledPlaceholder,\n StyledTextArea,\n StyledTextAreaWrapper,\n StyledContainer,\n} from './TextArea.styles';\nimport { classes } from './TextArea.tokens';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { base as disabledCSS } from './variations/_disabled/base';\nimport type { TextAreaProps } from './TextArea.types';\n\nconst {\n innerPlaceholderUp,\n focusedOuterPlaceholderColor,\n hidePlaceHolder,\n styledContainer,\n styledTextArea,\n styledTextAreaWrapper,\n styledPlaceholder,\n styledHelpers,\n} = classes;\n\nconst base = css`\n ${applyDynamicLabel};\n\n position: relative;\n box-sizing: border-box;\n`;\n\n// TODO: Удалить после отказа от старых библиотек plasma-web / plasma-b2c\nconst fallbackStatusMap = {\n '': 'primary',\n success: 'positive',\n warning: 'warning',\n error: 'negative',\n};\n\n// TODO: Перенести этот метод в файл applyDynamicLabel.ts\nexport const getDynamicLabelClasses = (props: TextAreaProps, focused: boolean) => {\n const { readOnly, label, labelPlacement, autoResize, rows, value } = props;\n\n // Добавить класс отвечающий за изменение цвета плейсхолдера при фокусе\n const withFocusedOuterUpPlaceholder =\n !readOnly && focused && (!label || labelPlacement === 'outer') ? focusedOuterPlaceholderColor : undefined;\n\n // Добавить класс отвечающий за поднятие и уменьшение плейсхолдера\n const withInnerPlaceholderUp =\n labelPlacement === 'inner' &&\n label &&\n !autoResize &&\n !rows &&\n ((!readOnly && (value || focused)) || (readOnly && value))\n ? innerPlaceholderUp\n : undefined;\n\n // Добавить класс отвечающий за скрытие плейсхолдера\n const withHidePlaceholder =\n (value && !label) ||\n (labelPlacement === 'inner' && ((focused && !readOnly) || value) && label && (rows || autoResize)) ||\n (labelPlacement === 'outer' && value)\n ? hidePlaceHolder\n : undefined;\n\n return [withFocusedOuterUpPlaceholder, withInnerPlaceholderUp, withHidePlaceholder];\n};\n\nexport const textAreaRoot = (Root: RootProps<HTMLTextAreaElement, TextAreaProps>) =>\n forwardRef<HTMLTextAreaElement, TextAreaProps>((props, innerRef) => {\n const {\n helperText,\n status,\n resize,\n rightHelper,\n leftHelper,\n contentRight,\n autoResize = false,\n minAuto = 0,\n maxAuto,\n label,\n labelPlacement = 'inner',\n placeholder,\n defaultValue,\n height,\n width,\n value,\n disabled,\n size,\n view,\n id,\n style,\n className,\n readOnly,\n rows,\n cols,\n onChange,\n ...rest\n } = props;\n\n const [helperWidth, setHelperWidth] = useState<string>(width ? `${width}rem` : '100%');\n const [focused, setFocused] = useState(false);\n const [uncontrolledValue, setUncontrolledValue] = useState<string | undefined>();\n\n const outerRef = innerRef && 'current' in innerRef ? innerRef : createRef<HTMLTextAreaElement>();\n const hasHelper = Boolean(leftHelper || rightHelper || helperText);\n const overriddenView = status !== undefined ? fallbackStatusMap[status] : view;\n const textareaHelperId = id ? `${id}-helper` : undefined;\n const applyCustomWidth = resize !== 'horizontal' && resize !== 'both' && !cols;\n const placeLabel = labelPlacement === 'inner' && label ? label : placeholder;\n\n useResizeObserver(outerRef, (currentElement) => {\n const { width: inlineWidth, height: inlineHeight } = currentElement.style;\n\n if (inlineWidth || inlineHeight || cols) {\n const { width: elementWidth } = currentElement.getBoundingClientRect();\n setHelperWidth(`${elementWidth / ROOT_FONT_SIZE}rem`);\n }\n });\n\n useAutoResize(autoResize, outerRef, value, minAuto, maxAuto);\n\n const onFocusHandler = useCallback(() => {\n setFocused(true);\n }, []);\n const onBlurHandler = useCallback(() => {\n setFocused(false);\n }, []);\n\n const onChangeHandler = useCallback(\n (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n // INFO: Для крайне редких кейсов, когда value снаружи не контролируется\n if (value === undefined) {\n setUncontrolledValue(event?.target.value);\n }\n\n onChange?.(event);\n },\n [value, onChange],\n );\n\n const dynamicLabelClasses = getDynamicLabelClasses(\n { readOnly, label, labelPlacement, autoResize, rows, value: value || uncontrolledValue || defaultValue },\n focused,\n );\n\n return (\n <Root\n view={overriddenView}\n size={size}\n disabled={disabled}\n readOnly={readOnly}\n style={style}\n className={className}\n >\n {label && labelPlacement === 'outer' && <StyledLabel>{label}</StyledLabel>}\n <StyledContainer\n className={cx(styledContainer, ...dynamicLabelClasses)}\n width={helperWidth}\n onFocus={onFocusHandler}\n onBlur={onBlurHandler}\n >\n {contentRight && <StyledContent>{contentRight}</StyledContent>}\n <StyledTextAreaWrapper className={styledTextAreaWrapper} hasHelper={hasHelper}>\n <StyledTextArea\n className={styledTextArea}\n id={id}\n hasContentRight={Boolean(contentRight)}\n hasHelper={hasHelper}\n applyCustomWidth={applyCustomWidth}\n ref={outerRef}\n disabled={disabled}\n height={autoResize ? minAuto : height}\n width={width}\n placeholder={placeLabel}\n aria-describedby={textareaHelperId}\n value={value}\n readOnly={readOnly}\n rows={rows}\n cols={cols}\n resize={resize}\n defaultValue={defaultValue}\n onChange={onChangeHandler}\n {...rest}\n />\n </StyledTextAreaWrapper>\n {hasHelper && (\n <StyledHelpers className={styledHelpers} id={textareaHelperId}>\n {(leftHelper || helperText) && (\n <StyledLeftHelper>{leftHelper || helperText}</StyledLeftHelper>\n )}\n {rightHelper && <StyledRightHelper>{rightHelper}</StyledRightHelper>}\n </StyledHelpers>\n )}\n {placeLabel && (\n <StyledPlaceholder\n hasContentRight={Boolean(contentRight)}\n className={styledPlaceholder}\n htmlFor={id}\n >\n {placeLabel}\n </StyledPlaceholder>\n )}\n </StyledContainer>\n </Root>\n );\n });\n\nexport const textAreaConfig = {\n name: 'TextArea',\n tag: 'div',\n layout: textAreaRoot,\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 readOnly: {\n attrs: true,\n },\n },\n defaults: {\n size: 'm',\n view: 'primary',\n },\n};\n"],"names":["innerPlaceholderUp","classes","focusedOuterPlaceholderColor","hidePlaceHolder","styledContainer","styledTextArea","styledTextAreaWrapper","styledPlaceholder","styledHelpers","base","fallbackStatusMap","success","warning","error","getDynamicLabelClasses","props","focused","readOnly","label","labelPlacement","autoResize","rows","value","withFocusedOuterUpPlaceholder","undefined","withInnerPlaceholderUp","withHidePlaceholder","textAreaRoot","Root","forwardRef","innerRef","helperText","status","resize","rightHelper","leftHelper","contentRight","_props$autoResize","_props$minAuto","minAuto","maxAuto","_props$labelPlacement","placeholder","defaultValue","height","width","disabled","size","view","id","style","className","cols","onChange","rest","_excluded","_useState","useState","concat","_useState2","_slicedToArray","helperWidth","setHelperWidth","_useState3","_useState4","setFocused","_useState5","_useState6","uncontrolledValue","setUncontrolledValue","outerRef","createRef","hasHelper","Boolean","overriddenView","textareaHelperId","applyCustomWidth","placeLabel","useResizeObserver","currentElement","_currentElement$style","inlineWidth","inlineHeight","_currentElement$getBo","getBoundingClientRect","elementWidth","ROOT_FONT_SIZE","useAutoResize","onFocusHandler","useCallback","onBlurHandler","onChangeHandler","event","target","dynamicLabelClasses","React","createElement","StyledLabel","StyledContainer","cx","apply","_toConsumableArray","onFocus","onBlur","StyledContent","StyledTextAreaWrapper","StyledTextArea","_extends","hasContentRight","ref","StyledHelpers","StyledLeftHelper","StyledRightHelper","StyledPlaceholder","htmlFor","textAreaConfig","name","tag","layout","variations","css","sizeCSS","viewCSS","disabledCSS","attrs","defaults"],"mappings":";;;;;;;;;;;;;;;;AA0BA,IACIA,kBAAkB,GAQlBC,uBAAO,CARPD,kBAAkB;EAClBE,4BAA4B,GAO5BD,uBAAO,CAPPC,4BAA4B;EAC5BC,eAAe,GAMfF,uBAAO,CANPE,eAAe;EACfC,eAAe,GAKfH,uBAAO,CALPG,eAAe;EACfC,cAAc,GAIdJ,uBAAO,CAJPI,cAAc;EACdC,qBAAqB,GAGrBL,uBAAO,CAHPK,qBAAqB;EACrBC,iBAAiB,GAEjBN,uBAAO,CAFPM,iBAAiB;EACjBC,aAAAA,GACAP,uBAAO,CADPO,aAAAA,CAAAA;AAGJ,IAAMC,IAAI,GAKT,SAAA,CAAA;;AAED;AACA,IAAMC,iBAAiB,GAAG;AACtB,EAAA,EAAE,EAAE,SAAS;AACbC,EAAAA,OAAO,EAAE,UAAU;AACnBC,EAAAA,OAAO,EAAE,SAAS;AAClBC,EAAAA,KAAK,EAAE,UAAA;AACX,CAAC,CAAA;;AAED;AACO,IAAMC,sBAAsB,GAAGA,SAAzBA,sBAAsBA,CAAIC,KAAoB,EAAEC,OAAgB,EAAK;AAC9E,EAAA,IAAQC,QAAQ,GAA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AAA,CAAAC,aAAA,CAACe,gCAAgB,EAAE5E,IAAAA,EAAAA,UAAU,IAAIJ,UAA6B,CACjE,EACAG,WAAW,iBAAI6D,KAAA,CAAAC,aAAA,CAACgB,iCAAiB,QAAE9E,WAA+B,CACxD,CAClB,EACA2C,UAAU,iBACPkB,KAAA,CAAAC,aAAA,CAACiB,iCAAiB,EAAA;AACdL,MAAAA,eAAe,EAAEnC,OAAO,CAACrC,YAAY,CAAE;AACvCe,MAAAA,SAAS,EAAE5C,iBAAkB;AAC7B2G,MAAAA,OAAO,EAAEjE,EAAAA;KAER4B,EAAAA,UACc,CAEV,CACf,CAAC,CAAA;AAEf,GAAC,CAAC,CAAA;AAAA,EAAA;AAEC,IAAMsC,cAAc,GAAG;AAC1BC,EAAAA,IAAI,EAAE,UAAU;AAChBC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE3F,YAAY;AACpBlB,EAAAA,IAAI,EAAJA,IAAI;AACJ8G,EAAAA,UAAU,EAAE;AACRxE,IAAAA,IAAI,EAAE;AACFyE,MAAAA,GAAG,EAAEC,WAAAA;KACR;AACDzE,IAAAA,IAAI,EAAE;AACFwE,MAAAA,GAAG,EAAEE,WAAAA;KACR;AACD5E,IAAAA,QAAQ,EAAE;AACN0E,MAAAA,GAAG,EAAEG,WAAW;AAChBC,MAAAA,KAAK,EAAE,IAAA;KACV;AACD3G,IAAAA,QAAQ,EAAE;AACN2G,MAAAA,KAAK,EAAE,IAAA;AACX,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACN9E,IAAAA,IAAI,EAAE,GAAG;AACTC,IAAAA,IAAI,EAAE,SAAA;AACV,GAAA;AACJ;;;;;;"}
@@ -77,11 +77,11 @@ var textFieldRoot = function textFieldRoot(Root) {
77
77
  if (maxLength !== -1 && value.length > maxLength) {
78
78
  return;
79
79
  }
80
- onChange === null || onChange === void 0 || onChange(event);
80
+ onChange === null || onChange === void 0 ? void 0 : onChange(event);
81
81
  };
82
82
  var updateChips = function updateChips(newChips, newValues) {
83
83
  setChips(newChips);
84
- onChangeChips === null || onChangeChips === void 0 || onChangeChips(newValues);
84
+ onChangeChips === null || onChangeChips === void 0 ? void 0 : onChangeChips(newValues);
85
85
  };
86
86
  var _useKeyNavigation = useKeyNavigation.useKeyNavigation({
87
87
  controlledRefs: controlledRefs,
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.js","sources":["../../../src/components/TextField/TextField.tsx"],"sourcesContent":["import React, { forwardRef, useEffect, useRef, useState } from 'react';\nimport type { ChangeEventHandler } from 'react';\nimport { safeUseId } from '@salutejs/plasma-core';\nimport { css } from '@linaria/core';\n\nimport type { RootProps } from '../../engines';\nimport { cx } from '../../utils';\n\nimport type { ChipValues, TextFieldPrimitiveValue, TextFieldProps } from './TextField.types';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as disabledCSS } from './variations/_disabled/base';\nimport { base as readOnlyCSS } from './variations/_read-only/base';\nimport { base as labelPlacementCSS } from './variations/_label-placement/base';\nimport {\n Input,\n LeftHelper,\n Label,\n InputWrapper,\n InputLabelWrapper,\n StyledContentLeft,\n StyledContentRight,\n StyledChips,\n} from './TextField.styles';\nimport { classes } from './TextField.tokens';\nimport { TextFieldChip } from './ui';\nimport { useKeyNavigation } from './hooks/useKeyNavigation';\n\nexport const base = css`\n /* NOTE: Webkit не применяет opacity к inline тегам */\n display: block;\n overflow: hidden;\n`;\n\nexport const textFieldRoot = (Root: RootProps<HTMLDivElement, TextFieldProps>) =>\n forwardRef<HTMLDivElement, TextFieldProps>(\n (\n {\n id,\n\n // layout\n contentLeft,\n contentRight,\n label,\n labelPlacement,\n placeholder,\n leftHelper,\n enumerationType = 'plain',\n\n // variations\n view,\n size,\n readOnly = false,\n disabled = false,\n\n // controlled\n chips: values,\n\n // events\n onChange,\n onChangeChips,\n onSearch,\n\n ...rest\n },\n ref,\n ) => {\n const contentRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const chipsRefs = useRef<Array<HTMLButtonElement>>([]);\n\n const controlledRefs = { contentRef, inputRef, chipsRefs };\n\n const [chips, setChips] = useState<Array<ChipValues>>([]);\n\n const uniqId = safeUseId();\n const innerId = id || uniqId;\n const labelId = safeUseId();\n const helperTextId = safeUseId();\n\n const isChipEnumeration = enumerationType === 'chip';\n const hideLabel = (size === 'xs' || isChipEnumeration) && labelPlacement === 'inner';\n const labelInside = size !== 'xs' && labelPlacement === 'inner';\n const innerLabelPlacementValue = hideLabel ? 'outer' : labelPlacement;\n const innerPlaceholderValue = hideLabel ? label : placeholder;\n const innerLabelValue = hideLabel ? undefined : label;\n\n const isChipsVisible = isChipEnumeration && chips?.length;\n const withHasChips = isChipsVisible ? classes.hasChips : undefined;\n const wrapperWithoutLeftContent = !contentLeft && isChipsVisible ? classes.hasEmptyContentLeft : undefined;\n const wrapperWithoutRightContent =\n !contentRight && isChipsVisible ? classes.hasEmptyContentRight : undefined;\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = (event) => {\n if (disabled || readOnly) {\n return;\n }\n\n const { maxLength, value } = event.target;\n\n if (maxLength !== -1 && value.length > maxLength) {\n return;\n }\n\n onChange?.(event);\n };\n\n const updateChips = (newChips: Array<ChipValues>, newValues: Array<TextFieldPrimitiveValue>) => {\n setChips(newChips);\n onChangeChips?.(newValues);\n };\n\n const { handleInputKeydown, handleChipKeyDown, onChipClear, handleContentKeyDown } = useKeyNavigation({\n controlledRefs,\n disabled,\n readOnly,\n chips,\n enumerationType,\n updateChips,\n onSearch,\n onChange,\n });\n\n const onChipClick = (event: React.MouseEvent<HTMLButtonElement>) => event.stopPropagation();\n\n const handleInputFocus = () => {\n if (readOnly || disabled || !inputRef?.current) {\n return;\n }\n\n inputRef.current.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'center',\n });\n inputRef.current.focus({ preventScroll: true });\n };\n\n const getRef = (element: HTMLButtonElement | null, index: number) => {\n if (element && chipsRefs?.current) {\n chipsRefs.current[index] = element;\n }\n };\n\n useEffect(() => {\n if (!isChipEnumeration && !values?.length) {\n return;\n }\n\n const newChips =\n values?.map((value, index) => ({\n id: `${index}_${value}`,\n text: value,\n })) || [];\n\n setChips(newChips);\n }, [isChipEnumeration, values]);\n\n return (\n <Root\n ref={ref}\n view={view}\n size={size}\n disabled={disabled}\n readOnly={!disabled && readOnly}\n labelPlacement={innerLabelPlacementValue}\n onClick={handleInputFocus}\n >\n {labelInside ||\n (innerLabelValue && (\n <Label id={labelId} htmlFor={id}>\n {innerLabelValue}\n </Label>\n ))}\n <InputWrapper className={cx(withHasChips, wrapperWithoutLeftContent, wrapperWithoutRightContent)}>\n {contentLeft && <StyledContentLeft>{contentLeft}</StyledContentLeft>}\n <InputLabelWrapper\n tabIndex={-1}\n ref={contentRef}\n onKeyDown={handleContentKeyDown}\n className={withHasChips}\n >\n {isChipEnumeration && Boolean(chips?.length) && (\n <StyledChips>\n {chips?.map(({ id: chipId, text }, index) => {\n return (\n <TextFieldChip\n id={chipId}\n ref={(element) => getRef(element, index)}\n key={`${chipId}_${index}`}\n disabled={disabled}\n readOnly={readOnly}\n value={text}\n text={text}\n onKeyDown={(event) => handleChipKeyDown(event, chipId, index)}\n onClear={() => onChipClear(chipId, index)}\n onClick={onChipClick}\n />\n );\n })}\n </StyledChips>\n )}\n <Input\n {...rest}\n ref={inputRef}\n id={innerId}\n aria-labelledby={labelId}\n aria-describedby={helperTextId}\n placeholder={innerPlaceholderValue}\n disabled={disabled}\n readOnly={!disabled && readOnly}\n onChange={handleChange}\n onKeyDown={handleInputKeydown}\n />\n {labelInside && (\n <Label id={labelId} htmlFor={innerId}>\n {innerLabelValue}\n </Label>\n )}\n </InputLabelWrapper>\n {contentRight && <StyledContentRight>{contentRight}</StyledContentRight>}\n </InputWrapper>\n {leftHelper && <LeftHelper id={helperTextId}>{leftHelper}</LeftHelper>}\n </Root>\n );\n },\n );\n\nexport const textFieldConfig = {\n name: 'TextField',\n tag: 'div',\n layout: textFieldRoot,\n base,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n disabled: {\n css: disabledCSS,\n attrs: true,\n },\n readOnly: {\n css: readOnlyCSS,\n attrs: true,\n },\n labelPlacement: {\n css: labelPlacementCSS,\n },\n },\n defaults: {\n size: 'm',\n view: 'default',\n },\n};\n"],"names":["base","textFieldRoot","Root","forwardRef","_ref","ref","id","contentLeft","contentRight","label","labelPlacement","placeholder","leftHelper","_ref$enumerationType","enumerationType","view","size","_ref$readOnly","readOnly","_ref$disabled","disabled","values","chips","onChange","onChangeChips","onSearch","rest","contentRef","useRef","inputRef","chipsRefs","controlledRefs","_useState","useState","_useState2","_slicedToArray","setChips","uniqId","safeUseId","innerId","labelId","helperTextId","isChipEnumeration","hideLabel","labelInside","innerLabelPlacementValue","innerPlaceholderValue","innerLabelValue","undefined","isChipsVisible","length","withHasChips","classes","hasChips","wrapperWithoutLeftContent","hasEmptyContentLeft","wrapperWithoutRightContent","hasEmptyContentRight","handleChange","event","_event$target","target","maxLength","value","updateChips","newChips","newValues","_useKeyNavigation","useKeyNavigation","handleInputKeydown","handleChipKeyDown","onChipClear","handleContentKeyDown","onChipClick","stopPropagation","handleInputFocus","current","scrollIntoView","behavior","block","inline","focus","preventScroll","getRef","element","index","useEffect","map","concat","text","React","createElement","onClick","Label","htmlFor","InputWrapper","className","cx","StyledContentLeft","InputLabelWrapper","tabIndex","onKeyDown","Boolean","StyledChips","_ref2","chipId","TextFieldChip","key","onClear","Input","_extends","StyledContentRight","LeftHelper","textFieldConfig","name","tag","layout","variations","css","viewCSS","sizeCSS","disabledCSS","attrs","readOnlyCSS","labelPlacementCSS","defaults"],"mappings":";;;;;;;;;;;;;;;;;;;AA4BO,IAAMA,IAAI,GAIhB,UAAA;IAEYC,aAAa,GAAGA,SAAhBA,aAAaA,CAAIC,IAA+C,EAAA;AAAA,EAAA,oBACzEC,gBAAU,CACN,UAAAC,IAAA,EA6BIC,GAAG,EACF;AAAA,I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C,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAEnH,aAAa;AACrBD,EAAAA,IAAI,EAAJA,IAAI;AACJqH,EAAAA,UAAU,EAAE;AACRtG,IAAAA,IAAI,EAAE;AACFuG,MAAAA,GAAG,EAAEC,WAAAA;KACR;AACDvG,IAAAA,IAAI,EAAE;AACFsG,MAAAA,GAAG,EAAEE,WAAAA;KACR;AACDpG,IAAAA,QAAQ,EAAE;AACNkG,MAAAA,GAAG,EAAEG,WAAW;AAChBC,MAAAA,KAAK,EAAE,IAAA;KACV;AACDxG,IAAAA,QAAQ,EAAE;AACNoG,MAAAA,GAAG,EAAEK,WAAW;AAChBD,MAAAA,KAAK,EAAE,IAAA;KACV;AACDhH,IAAAA,cAAc,EAAE;AACZ4G,MAAAA,GAAG,EAAEM,WAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACN7G,IAAAA,IAAI,EAAE,GAAG;AACTD,IAAAA,IAAI,EAAE,SAAA;AACV,GAAA;AACJ;;;;;;"}
1
+ {"version":3,"file":"TextField.js","sources":["../../../src/components/TextField/TextField.tsx"],"sourcesContent":["import React, { forwardRef, useEffect, useRef, useState } from 'react';\nimport type { ChangeEventHandler } from 'react';\nimport { safeUseId } from '@salutejs/plasma-core';\nimport { css } from '@linaria/core';\n\nimport type { RootProps } from '../../engines';\nimport { cx } from '../../utils';\n\nimport type { ChipValues, TextFieldPrimitiveValue, TextFieldProps } from './TextField.types';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as disabledCSS } from './variations/_disabled/base';\nimport { base as readOnlyCSS } from './variations/_read-only/base';\nimport { base as labelPlacementCSS } from './variations/_label-placement/base';\nimport {\n Input,\n LeftHelper,\n Label,\n InputWrapper,\n InputLabelWrapper,\n StyledContentLeft,\n StyledContentRight,\n StyledChips,\n} from './TextField.styles';\nimport { classes } from './TextField.tokens';\nimport { TextFieldChip } from './ui';\nimport { useKeyNavigation } from './hooks/useKeyNavigation';\n\nexport const base = css`\n /* NOTE: Webkit не применяет opacity к inline тегам */\n display: block;\n overflow: hidden;\n`;\n\nexport const textFieldRoot = (Root: RootProps<HTMLDivElement, TextFieldProps>) =>\n forwardRef<HTMLDivElement, TextFieldProps>(\n (\n {\n id,\n\n // layout\n contentLeft,\n contentRight,\n label,\n labelPlacement,\n placeholder,\n leftHelper,\n enumerationType = 'plain',\n\n // variations\n view,\n size,\n readOnly = false,\n disabled = false,\n\n // controlled\n chips: values,\n\n // events\n onChange,\n onChangeChips,\n onSearch,\n\n ...rest\n },\n ref,\n ) => {\n const contentRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const chipsRefs = useRef<Array<HTMLButtonElement>>([]);\n\n const controlledRefs = { contentRef, inputRef, chipsRefs };\n\n const [chips, setChips] = useState<Array<ChipValues>>([]);\n\n const uniqId = safeUseId();\n const innerId = id || uniqId;\n const labelId = safeUseId();\n const helperTextId = safeUseId();\n\n const isChipEnumeration = enumerationType === 'chip';\n const hideLabel = (size === 'xs' || isChipEnumeration) && labelPlacement === 'inner';\n const labelInside = size !== 'xs' && labelPlacement === 'inner';\n const innerLabelPlacementValue = hideLabel ? 'outer' : labelPlacement;\n const innerPlaceholderValue = hideLabel ? label : placeholder;\n const innerLabelValue = hideLabel ? undefined : label;\n\n const isChipsVisible = isChipEnumeration && chips?.length;\n const withHasChips = isChipsVisible ? classes.hasChips : undefined;\n const wrapperWithoutLeftContent = !contentLeft && isChipsVisible ? classes.hasEmptyContentLeft : undefined;\n const wrapperWithoutRightContent =\n !contentRight && isChipsVisible ? classes.hasEmptyContentRight : undefined;\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = (event) => {\n if (disabled || readOnly) {\n return;\n }\n\n const { maxLength, value } = event.target;\n\n if (maxLength !== -1 && value.length > maxLength) {\n return;\n }\n\n onChange?.(event);\n };\n\n const updateChips = (newChips: Array<ChipValues>, newValues: Array<TextFieldPrimitiveValue>) => {\n setChips(newChips);\n onChangeChips?.(newValues);\n };\n\n const { handleInputKeydown, handleChipKeyDown, onChipClear, handleContentKeyDown } = useKeyNavigation({\n controlledRefs,\n disabled,\n readOnly,\n chips,\n enumerationType,\n updateChips,\n onSearch,\n onChange,\n });\n\n const onChipClick = (event: React.MouseEvent<HTMLButtonElement>) => event.stopPropagation();\n\n const handleInputFocus = () => {\n if (readOnly || disabled || !inputRef?.current) {\n return;\n }\n\n inputRef.current.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'center',\n });\n inputRef.current.focus({ preventScroll: true });\n };\n\n const getRef = (element: HTMLButtonElement | null, index: number) => {\n if (element && chipsRefs?.current) {\n chipsRefs.current[index] = element;\n }\n };\n\n useEffect(() => {\n if (!isChipEnumeration && !values?.length) {\n return;\n }\n\n const newChips =\n values?.map((value, index) => ({\n id: `${index}_${value}`,\n text: value,\n })) || [];\n\n setChips(newChips);\n }, [isChipEnumeration, values]);\n\n return (\n <Root\n ref={ref}\n view={view}\n size={size}\n disabled={disabled}\n readOnly={!disabled && readOnly}\n labelPlacement={innerLabelPlacementValue}\n onClick={handleInputFocus}\n >\n {labelInside ||\n (innerLabelValue && (\n <Label id={labelId} htmlFor={id}>\n {innerLabelValue}\n </Label>\n ))}\n <InputWrapper className={cx(withHasChips, wrapperWithoutLeftContent, wrapperWithoutRightContent)}>\n {contentLeft && <StyledContentLeft>{contentLeft}</StyledContentLeft>}\n <InputLabelWrapper\n tabIndex={-1}\n ref={contentRef}\n onKeyDown={handleContentKeyDown}\n className={withHasChips}\n >\n {isChipEnumeration && Boolean(chips?.length) && (\n <StyledChips>\n {chips?.map(({ id: chipId, text }, index) => {\n return (\n <TextFieldChip\n id={chipId}\n ref={(element) => getRef(element, index)}\n key={`${chipId}_${index}`}\n disabled={disabled}\n readOnly={readOnly}\n value={text}\n text={text}\n onKeyDown={(event) => handleChipKeyDown(event, chipId, index)}\n onClear={() => onChipClear(chipId, index)}\n onClick={onChipClick}\n />\n );\n })}\n </StyledChips>\n )}\n <Input\n {...rest}\n ref={inputRef}\n id={innerId}\n aria-labelledby={labelId}\n aria-describedby={helperTextId}\n placeholder={innerPlaceholderValue}\n disabled={disabled}\n readOnly={!disabled && readOnly}\n onChange={handleChange}\n onKeyDown={handleInputKeydown}\n />\n {labelInside && (\n <Label id={labelId} htmlFor={innerId}>\n {innerLabelValue}\n </Label>\n )}\n </InputLabelWrapper>\n {contentRight && <StyledContentRight>{contentRight}</StyledContentRight>}\n </InputWrapper>\n {leftHelper && <LeftHelper id={helperTextId}>{leftHelper}</LeftHelper>}\n </Root>\n );\n },\n );\n\nexport const textFieldConfig = {\n name: 'TextField',\n tag: 'div',\n layout: textFieldRoot,\n base,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n disabled: {\n css: disabledCSS,\n attrs: true,\n },\n readOnly: {\n css: readOnlyCSS,\n attrs: true,\n },\n labelPlacement: {\n css: labelPlacementCSS,\n },\n },\n defaults: {\n size: 'm',\n view: 'default',\n },\n};\n"],"names":["base","textFieldRoot","Root","forwardRef","_ref","ref","id","contentLeft","contentRight","label","labelPlacement","placeholder","leftHelper","_ref$enumerationType","enumerationType","view","size","_ref$readOnly","readOnly","_ref$disabled","disabled","values","chips","onChange","onChangeChips","onSearch","rest","contentRef","useRef","inputRef","chipsRefs","controlledRefs","_useState","useState","_useState2","_slicedToArray","setChips","uniqId","safeUseId","innerId","labelId","helperTextId","isChipEnumeration","hideLabel","labelInside","innerLabelPlacementValue","innerPlaceholderValue","innerLabelValue","undefined","isChipsVisible","length","withHasChips","classes","hasChips","wrapperWithoutLeftContent","hasEmptyContentLeft","wrapperWithoutRightContent","hasEmptyContentRight","handleChange","event","_event$target","target","maxLength","value","updateChips","newChips","newValues","_useKeyNavigation","useKeyNavigation","handleInputKeydown","handleChipKeyDown","onChipClear","handleContentKeyDown","onChipClick","stopPropagation","handleInputFocus","current","scrollIntoView","behavior","block","inline","focus","preventScroll","getRef","element","index","useEffect","map","concat","text","React","createElement","onClick","Label","htmlFor","InputWrapper","className","cx","StyledContentLeft","InputLabelWrapper","tabIndex","onKeyDown","Boolean","StyledChips","_ref2","chipId","TextFieldChip","key","onClear","Input","_extends","StyledContentRight","LeftHelper","textFieldConfig","name","tag","layout","variations","css","viewCSS","sizeCSS","disabledCSS","attrs","readOnlyCSS","labelPlacementCSS","defaults"],"mappings":";;;;;;;;;;;;;;;;;;;AA4BO,IAAMA,IAAI,GAIhB,UAAA;IAEYC,aAAa,GAAGA,SAAhBA,aAAaA,CAAIC,IAA+C,EAAA;AAAA,EAAA,oBACzEC,gBAAU,CACN,UAAAC,IAAA,EA6BIC,GAAG,EACF;AAAA,IAAA,IA5BGC,EAAE,GAAAF,IAAA,CAAFE,EAAE;MAGFC,WAAW,GAAAH,IAAA,CAAXG,WAAW;MACXC,YAAY,GAAAJ,IAAA,CAAZI,YAAY;MACZC,KAAK,GAAAL,IAAA,CAALK,KAAK;MACLC,cAAc,GAAAN,IAAA,CAAdM,cAAc;MACdC,WAAW,GAAAP,IAAA,CAAXO,WAAW;MACXC,UAAU,GAAAR,IAAA,CAAVQ,UAAU;MAAAC,oBAAA,GAAAT,IAAA,CACVU,eAAe;AAAfA,MAAAA,eAAe,GAAAD,oBAAA,KAAG,KAAA,CAAA,GAAA,OAAO,GAAAA,oBAAA;MAGzBE,IAAI,GAAAX,IAAA,CAAJW,IAAI;MACJC,IAAI,GAAAZ,IAAA,CAAJY,IAAI;MAAAC,aAAA,GAAAb,IAAA,CACJc,QAAQ;AAARA,MAAAA,QAAQ,GAAAD,aAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,aAAA;MAAAE,aAAA,GAAAf,IAAA,CAChBgB,QAAQ;AAARA,MAAAA,QAAQ,GAAAD,aAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,aAAA;MAGTE,MAAM,GAAAjB,IAAA,CAAbkB,KAAK;MAGLC,QAAQ,GAAAnB,IAAA,CAARmB,QAAQ;MACRC,aAAa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AAA,CAACE,sBAAK,EAAA;AAACvF,MAAAA,EAAE,EAAEkC,OAAQ;AAACsD,MAAAA,OAAO,EAAEvD,OAAAA;KACxBQ,EAAAA,eACE,CAEI,CAAA,EAClBvC,YAAY,iBAAIkF,KAAA,CAAAC,aAAA,CAACoB,mCAAkB,QAAEvG,YAAiC,CAC7D,CAAA,EACbI,UAAU,iBAAI8E,KAAA,CAAAC,aAAA,CAACqB,2BAAU,EAAA;AAAC1G,MAAAA,EAAE,EAAEmC,YAAAA;KAAe7B,EAAAA,UAAuB,CACnE,CAAC,CAAA;AAEf,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMqG,eAAe,GAAG;AAC3BC,EAAAA,IAAI,EAAE,WAAW;AACjBC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAEnH,aAAa;AACrBD,EAAAA,IAAI,EAAJA,IAAI;AACJqH,EAAAA,UAAU,EAAE;AACRtG,IAAAA,IAAI,EAAE;AACFuG,MAAAA,GAAG,EAAEC,WAAAA;KACR;AACDvG,IAAAA,IAAI,EAAE;AACFsG,MAAAA,GAAG,EAAEE,WAAAA;KACR;AACDpG,IAAAA,QAAQ,EAAE;AACNkG,MAAAA,GAAG,EAAEG,WAAW;AAChBC,MAAAA,KAAK,EAAE,IAAA;KACV;AACDxG,IAAAA,QAAQ,EAAE;AACNoG,MAAAA,GAAG,EAAEK,WAAW;AAChBD,MAAAA,KAAK,EAAE,IAAA;KACV;AACDhH,IAAAA,cAAc,EAAE;AACZ4G,MAAAA,GAAG,EAAEM,WAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACN7G,IAAAA,IAAI,EAAE,GAAG;AACTD,IAAAA,IAAI,EAAE,SAAA;AACV,GAAA;AACJ;;;;;;"}
@@ -48,15 +48,15 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
48
48
  });
49
49
  updateChips(newChips, newValues);
50
50
  event.target.value = '';
51
- onChange === null || onChange === void 0 || onChange(event);
51
+ onChange === null || onChange === void 0 ? void 0 : onChange(event);
52
52
  }
53
53
  if (event.key === Keys.Enter && onSearch) {
54
54
  onSearch(value, event);
55
55
  }
56
- if (event.key === Keys.Backspace && chips.length && (inputRef === null || inputRef === void 0 || (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.selectionStart) === 0) {
56
+ if (event.key === Keys.Backspace && chips.length && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.selectionStart) === 0) {
57
57
  var _newChips = _rollupPluginBabelHelpers.toConsumableArray(chips);
58
- _newChips === null || _newChips === void 0 || _newChips.pop();
59
- chipsRefs === null || chipsRefs === void 0 || chipsRefs.current.pop();
58
+ _newChips === null || _newChips === void 0 ? void 0 : _newChips.pop();
59
+ chipsRefs === null || chipsRefs === void 0 ? void 0 : chipsRefs.current.pop();
60
60
  var _newValues = _newChips.map(function (_ref4) {
61
61
  var text = _ref4.text;
62
62
  return text;
@@ -76,7 +76,7 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
76
76
  var text = _ref6.text;
77
77
  return text;
78
78
  });
79
- chipsRefs === null || chipsRefs === void 0 || chipsRefs.current.splice(index, 1);
79
+ chipsRefs === null || chipsRefs === void 0 ? void 0 : chipsRefs.current.splice(index, 1);
80
80
  updateChips(newChips, newValues);
81
81
  };
82
82
  var handleChipKeyDown = function handleChipKeyDown(event, chipId, chipIndex) {
@@ -90,7 +90,7 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
90
90
  var handleContentKeyDown = function handleContentKeyDown(event) {
91
91
  var _inputRef$current2, _focusedItem, _focusedItem2;
92
92
  var chipsRefsCount = chipsRefs.current.length;
93
- var currentCaretPosition = (inputRef === null || inputRef === void 0 || (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.selectionStart) || 0;
93
+ var currentCaretPosition = (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.selectionStart) || 0;
94
94
  var newActiveChipIndex = activeChipIndex;
95
95
  var focusedItem = null;
96
96
  if (event.key === Keys.ArrowLeft && enumerationType === 'chip' && currentCaretPosition <= 0) {
@@ -109,10 +109,10 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
109
109
  var _chipsRefs$current3;
110
110
  var _index2 = activeChipIndex - 1 <= 0 ? 0 : activeChipIndex - 1;
111
111
  newActiveChipIndex = chipsRefsCount === 0 ? -1 : _index2;
112
- focusedItem = chipsRefsCount === 0 ? inputRef === null || inputRef === void 0 ? void 0 : inputRef.current : chipsRefs === null || chipsRefs === void 0 || (_chipsRefs$current3 = chipsRefs.current) === null || _chipsRefs$current3 === void 0 ? void 0 : _chipsRefs$current3[newActiveChipIndex];
112
+ focusedItem = chipsRefsCount === 0 ? inputRef === null || inputRef === void 0 ? void 0 : inputRef.current : chipsRefs === null || chipsRefs === void 0 ? void 0 : (_chipsRefs$current3 = chipsRefs.current) === null || _chipsRefs$current3 === void 0 ? void 0 : _chipsRefs$current3[newActiveChipIndex];
113
113
  }
114
- (_focusedItem = focusedItem) === null || _focusedItem === void 0 || _focusedItem.focus();
115
- (_focusedItem2 = focusedItem) === null || _focusedItem2 === void 0 || _focusedItem2.scrollIntoView({
114
+ (_focusedItem = focusedItem) === null || _focusedItem === void 0 ? void 0 : _focusedItem.focus();
115
+ (_focusedItem2 = focusedItem) === null || _focusedItem2 === void 0 ? void 0 : _focusedItem2.scrollIntoView({
116
116
  behavior: 'smooth',
117
117
  block: 'center',
118
118
  inline: 'center'