@salutejs/plasma-new-hope 0.77.0-canary.1185.8720195819.0 → 0.77.0-canary.1195.8808345201.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (612) hide show
  1. package/cjs/_virtual/_rollupPluginBabelHelpers.js +1 -1
  2. package/cjs/components/Avatar/Avatar.js +28 -3
  3. package/cjs/components/Avatar/Avatar.js.map +1 -1
  4. package/cjs/components/Calendar/CalendarBase/CalendarBase.js +1 -1
  5. package/cjs/components/Calendar/CalendarBase/CalendarBase.js.map +1 -1
  6. package/cjs/components/Calendar/CalendarDouble/CalendarDouble.js +1 -1
  7. package/cjs/components/Calendar/CalendarDouble/CalendarDouble.js.map +1 -1
  8. package/cjs/components/Calendar/hoc/withRange.js +1 -1
  9. package/cjs/components/Calendar/hoc/withRange.js.map +1 -1
  10. package/cjs/components/Calendar/hooks/useKeyNavigation.js +19 -19
  11. package/cjs/components/Calendar/hooks/useKeyNavigation.js.map +1 -1
  12. package/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js +3 -3
  13. package/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js.map +1 -1
  14. package/cjs/components/Calendar/ui/CalendarHeader/CalendarHeader.js +2 -2
  15. package/cjs/components/Calendar/ui/CalendarHeader/CalendarHeader.js.map +1 -1
  16. package/cjs/components/Calendar/ui/CalendarMonths/CalendarMonths.js +1 -1
  17. package/cjs/components/Calendar/ui/CalendarMonths/CalendarMonths.js.map +1 -1
  18. package/cjs/components/Calendar/ui/CalendarYears/CalendarYears.js +1 -1
  19. package/cjs/components/Calendar/ui/CalendarYears/CalendarYears.js.map +1 -1
  20. package/cjs/components/Chip/Chip.js +2 -2
  21. package/cjs/components/Chip/Chip.js.map +1 -1
  22. package/cjs/components/Combobox/Combobox.css +2 -2
  23. package/cjs/components/Combobox/Combobox.js +5 -5
  24. package/cjs/components/Combobox/Combobox.js.map +1 -1
  25. package/cjs/components/Combobox/hooks/useFocusController.js +9 -9
  26. package/cjs/components/Combobox/hooks/useFocusController.js.map +1 -1
  27. package/cjs/components/Combobox/ui/ComboboxChip/ComboboxChip.js +1 -1
  28. package/cjs/components/Combobox/ui/ComboboxChip/ComboboxChip.js.map +1 -1
  29. package/cjs/components/Combobox/ui/ComboboxDivider/ComboboxDivider.css +2 -2
  30. package/cjs/components/Combobox/ui/ComboboxDivider/ComboboxDivider.js +1 -1
  31. package/cjs/components/Combobox/ui/ComboboxFooter/ComboboxFooter.css +2 -2
  32. package/cjs/components/Combobox/ui/ComboboxFooter/ComboboxFooter.js +1 -1
  33. package/cjs/components/Combobox/ui/ComboboxGroup/ComboboxGroup.css +2 -2
  34. package/cjs/components/Combobox/ui/ComboboxGroup/ComboboxGroup.js +1 -1
  35. package/cjs/components/Combobox/ui/ComboboxHeader/ComboboxHeader.css +2 -2
  36. package/cjs/components/Combobox/ui/ComboboxHeader/ComboboxHeader.js +1 -1
  37. package/cjs/components/Combobox/ui/ComboboxItem/ComboboxItem.css +2 -2
  38. package/cjs/components/Combobox/ui/ComboboxItem/ComboboxItem.js +1 -1
  39. package/cjs/components/Combobox/ui/ComboboxItem/ComboboxItem.styles.js +1 -1
  40. package/cjs/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js +6 -6
  41. package/cjs/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js.map +1 -1
  42. package/cjs/components/Drawer/DrawerContext.js +1 -1
  43. package/cjs/components/Drawer/DrawerContext.js.map +1 -1
  44. package/cjs/components/Dropdown/Dropdown.css +2 -2
  45. package/cjs/components/Dropdown/Dropdown.js +4 -27
  46. package/cjs/components/Dropdown/Dropdown.js.map +1 -1
  47. package/cjs/components/Dropdown/Dropdown.styles.js +1 -1
  48. package/cjs/components/Dropdown/Dropdown.styles.js.map +1 -1
  49. package/cjs/components/Dropdown/{Dropdown.styles_13400l5.css → Dropdown.styles_1daxhqh.css} +1 -1
  50. package/cjs/components/Dropdown/Dropdown.tokens.js +0 -1
  51. package/cjs/components/Dropdown/Dropdown.tokens.js.map +1 -1
  52. package/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.js +5 -7
  53. package/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.js.map +1 -1
  54. package/cjs/components/Dropdown/utils/index.js +0 -43
  55. package/cjs/components/Dropdown/utils/index.js.map +1 -1
  56. package/cjs/components/IconButton/IconButton.css +27 -0
  57. package/cjs/components/IconButton/IconButton.js +84 -0
  58. package/cjs/components/IconButton/IconButton.js.map +1 -0
  59. package/cjs/components/IconButton/IconButton.styles.js +27 -0
  60. package/cjs/components/IconButton/IconButton.styles.js.map +1 -0
  61. package/cjs/components/IconButton/IconButton.styles_gh8fim.css +4 -0
  62. package/cjs/components/IconButton/IconButton.tokens.js +36 -0
  63. package/cjs/components/IconButton/IconButton.tokens.js.map +1 -0
  64. package/cjs/components/IconButton/variations/_disabled/base.js +9 -0
  65. package/cjs/components/IconButton/variations/_disabled/base.js.map +1 -0
  66. package/cjs/components/IconButton/variations/_disabled/base_x642ct.css +1 -0
  67. package/cjs/components/IconButton/variations/_focused/base.js +9 -0
  68. package/cjs/components/IconButton/variations/_focused/base.js.map +1 -0
  69. package/cjs/components/IconButton/variations/_focused/base_x642ct.css +1 -0
  70. package/cjs/components/IconButton/variations/_size/base.js +9 -0
  71. package/cjs/components/IconButton/variations/_size/base.js.map +1 -0
  72. package/cjs/components/IconButton/variations/_size/base_x642ct.css +1 -0
  73. package/cjs/components/IconButton/variations/_view/base.js +9 -0
  74. package/cjs/components/IconButton/variations/_view/base.js.map +1 -0
  75. package/cjs/components/IconButton/variations/_view/base_x642ct.css +1 -0
  76. package/cjs/components/Modal/ModalContext.js +1 -1
  77. package/cjs/components/Modal/ModalContext.js.map +1 -1
  78. package/cjs/components/Overlay/Overlay.js +1 -1
  79. package/cjs/components/Overlay/Overlay.js.map +1 -1
  80. package/cjs/components/Pagination/Pagination.css +2 -2
  81. package/cjs/components/Pagination/Pagination.js +2 -2
  82. package/cjs/components/Pagination/Pagination.js.map +1 -1
  83. package/cjs/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js +1 -1
  84. package/cjs/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js.map +1 -1
  85. package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +2 -2
  86. package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +1 -1
  87. package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js.map +1 -1
  88. package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.js +1 -1
  89. package/cjs/components/Popover/Popover.js +7 -7
  90. package/cjs/components/Popover/Popover.js.map +1 -1
  91. package/cjs/components/Popup/Popup.js +1 -1
  92. package/cjs/components/Popup/Popup.js.map +1 -1
  93. package/cjs/components/Segment/ui/SegmentItem/SegmentItem.js +2 -2
  94. package/cjs/components/Segment/ui/SegmentItem/SegmentItem.js.map +1 -1
  95. package/cjs/components/Select/Select.css +2 -2
  96. package/cjs/components/Select/Select.js +5 -5
  97. package/cjs/components/Select/Select.js.map +1 -1
  98. package/cjs/components/Select/hooks/useKeyNavigation.js +12 -12
  99. package/cjs/components/Select/hooks/useKeyNavigation.js.map +1 -1
  100. package/cjs/components/Select/ui/SelectChip/SelectChip.js +1 -1
  101. package/cjs/components/Select/ui/SelectChip/SelectChip.js.map +1 -1
  102. package/cjs/components/Select/ui/SelectDivider/SelectDivider.css +2 -2
  103. package/cjs/components/Select/ui/SelectDivider/SelectDivider.js +1 -1
  104. package/cjs/components/Select/ui/SelectFooter/SelectFooter.css +2 -2
  105. package/cjs/components/Select/ui/SelectFooter/SelectFooter.js +1 -1
  106. package/cjs/components/Select/ui/SelectGroup/SelectGroup.css +2 -2
  107. package/cjs/components/Select/ui/SelectGroup/SelectGroup.js +1 -1
  108. package/cjs/components/Select/ui/SelectHeader/SelectHeader.css +2 -2
  109. package/cjs/components/Select/ui/SelectHeader/SelectHeader.js +1 -1
  110. package/cjs/components/Select/ui/SelectItem/SelectItem.css +2 -2
  111. package/cjs/components/Select/ui/SelectItem/SelectItem.js +1 -1
  112. package/cjs/components/Select/ui/SelectItem/SelectItem.styles.js +1 -1
  113. package/cjs/components/Select/ui/SelectTarget/SelectTarget.js +2 -2
  114. package/cjs/components/Select/ui/SelectTarget/SelectTarget.js.map +1 -1
  115. package/cjs/components/Select/utils/index.js +2 -2
  116. package/cjs/components/Select/utils/index.js.map +1 -1
  117. package/cjs/components/Tabs/TabsContext.js +1 -2
  118. package/cjs/components/Tabs/TabsContext.js.map +1 -1
  119. package/cjs/components/Tabs/ui/TabItem/TabItem.js +1 -1
  120. package/cjs/components/Tabs/ui/TabItem/TabItem.js.map +1 -1
  121. package/cjs/components/Tabs/ui/Tabs/Tabs.js +2 -2
  122. package/cjs/components/Tabs/ui/Tabs/Tabs.js.map +1 -1
  123. package/cjs/components/TextArea/TextArea.js +1 -1
  124. package/cjs/components/TextArea/TextArea.js.map +1 -1
  125. package/cjs/components/TextField/TextField.js +2 -2
  126. package/cjs/components/TextField/TextField.js.map +1 -1
  127. package/cjs/components/TextField/hooks/useKeyNavigation.js +9 -9
  128. package/cjs/components/TextField/hooks/useKeyNavigation.js.map +1 -1
  129. package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js +1 -1
  130. package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js.map +1 -1
  131. package/cjs/components/Toast/ToastProvider/ToastProvider.js +2 -2
  132. package/cjs/components/Toast/ToastProvider/ToastProvider.js.map +1 -1
  133. package/cjs/components/Tooltip/Tooltip.js +1 -1
  134. package/cjs/components/Tooltip/Tooltip.js.map +1 -1
  135. package/cjs/index.css +7 -2
  136. package/cjs/index.js +6 -2
  137. package/cjs/index.js.map +1 -1
  138. package/es/_virtual/_rollupPluginBabelHelpers.js +1 -1
  139. package/es/components/Avatar/Avatar.js +29 -4
  140. package/es/components/Avatar/Avatar.js.map +1 -1
  141. package/es/components/Calendar/CalendarBase/CalendarBase.js +1 -1
  142. package/es/components/Calendar/CalendarBase/CalendarBase.js.map +1 -1
  143. package/es/components/Calendar/CalendarDouble/CalendarDouble.js +1 -1
  144. package/es/components/Calendar/CalendarDouble/CalendarDouble.js.map +1 -1
  145. package/es/components/Calendar/hoc/withRange.js +1 -1
  146. package/es/components/Calendar/hoc/withRange.js.map +1 -1
  147. package/es/components/Calendar/hooks/useKeyNavigation.js +19 -19
  148. package/es/components/Calendar/hooks/useKeyNavigation.js.map +1 -1
  149. package/es/components/Calendar/ui/CalendarDays/CalendarDays.js +3 -3
  150. package/es/components/Calendar/ui/CalendarDays/CalendarDays.js.map +1 -1
  151. package/es/components/Calendar/ui/CalendarHeader/CalendarHeader.js +2 -2
  152. package/es/components/Calendar/ui/CalendarHeader/CalendarHeader.js.map +1 -1
  153. package/es/components/Calendar/ui/CalendarMonths/CalendarMonths.js +1 -1
  154. package/es/components/Calendar/ui/CalendarMonths/CalendarMonths.js.map +1 -1
  155. package/es/components/Calendar/ui/CalendarYears/CalendarYears.js +1 -1
  156. package/es/components/Calendar/ui/CalendarYears/CalendarYears.js.map +1 -1
  157. package/es/components/Chip/Chip.js +2 -2
  158. package/es/components/Chip/Chip.js.map +1 -1
  159. package/es/components/Combobox/Combobox.css +2 -2
  160. package/es/components/Combobox/Combobox.js +5 -5
  161. package/es/components/Combobox/Combobox.js.map +1 -1
  162. package/es/components/Combobox/hooks/useFocusController.js +9 -9
  163. package/es/components/Combobox/hooks/useFocusController.js.map +1 -1
  164. package/es/components/Combobox/ui/ComboboxChip/ComboboxChip.js +1 -1
  165. package/es/components/Combobox/ui/ComboboxChip/ComboboxChip.js.map +1 -1
  166. package/es/components/Combobox/ui/ComboboxDivider/ComboboxDivider.css +2 -2
  167. package/es/components/Combobox/ui/ComboboxDivider/ComboboxDivider.js +1 -1
  168. package/es/components/Combobox/ui/ComboboxFooter/ComboboxFooter.css +2 -2
  169. package/es/components/Combobox/ui/ComboboxFooter/ComboboxFooter.js +1 -1
  170. package/es/components/Combobox/ui/ComboboxGroup/ComboboxGroup.css +2 -2
  171. package/es/components/Combobox/ui/ComboboxGroup/ComboboxGroup.js +1 -1
  172. package/es/components/Combobox/ui/ComboboxHeader/ComboboxHeader.css +2 -2
  173. package/es/components/Combobox/ui/ComboboxHeader/ComboboxHeader.js +1 -1
  174. package/es/components/Combobox/ui/ComboboxItem/ComboboxItem.css +2 -2
  175. package/es/components/Combobox/ui/ComboboxItem/ComboboxItem.js +1 -1
  176. package/es/components/Combobox/ui/ComboboxItem/ComboboxItem.styles.js +1 -1
  177. package/es/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js +6 -6
  178. package/es/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js.map +1 -1
  179. package/es/components/Drawer/DrawerContext.js +1 -1
  180. package/es/components/Drawer/DrawerContext.js.map +1 -1
  181. package/es/components/Dropdown/Dropdown.css +2 -2
  182. package/es/components/Dropdown/Dropdown.js +6 -29
  183. package/es/components/Dropdown/Dropdown.js.map +1 -1
  184. package/es/components/Dropdown/Dropdown.styles.js +1 -1
  185. package/es/components/Dropdown/Dropdown.styles.js.map +1 -1
  186. package/es/components/Dropdown/{Dropdown.styles_13400l5.css → Dropdown.styles_1daxhqh.css} +1 -1
  187. package/es/components/Dropdown/Dropdown.tokens.js +0 -1
  188. package/es/components/Dropdown/Dropdown.tokens.js.map +1 -1
  189. package/es/components/Dropdown/ui/DropdownItem/DropdownItem.js +5 -7
  190. package/es/components/Dropdown/ui/DropdownItem/DropdownItem.js.map +1 -1
  191. package/es/components/Dropdown/utils/index.js +3 -45
  192. package/es/components/Dropdown/utils/index.js.map +1 -1
  193. package/es/components/IconButton/IconButton.css +27 -0
  194. package/es/components/IconButton/IconButton.js +79 -0
  195. package/es/components/IconButton/IconButton.js.map +1 -0
  196. package/es/components/IconButton/IconButton.styles.js +22 -0
  197. package/es/components/IconButton/IconButton.styles.js.map +1 -0
  198. package/es/components/IconButton/IconButton.styles_gh8fim.css +4 -0
  199. package/es/components/IconButton/IconButton.tokens.js +31 -0
  200. package/es/components/IconButton/IconButton.tokens.js.map +1 -0
  201. package/es/components/IconButton/variations/_disabled/base.js +5 -0
  202. package/es/components/IconButton/variations/_disabled/base.js.map +1 -0
  203. package/es/components/IconButton/variations/_disabled/base_x642ct.css +1 -0
  204. package/es/components/IconButton/variations/_focused/base.js +5 -0
  205. package/es/components/IconButton/variations/_focused/base.js.map +1 -0
  206. package/es/components/IconButton/variations/_focused/base_x642ct.css +1 -0
  207. package/es/components/IconButton/variations/_size/base.js +5 -0
  208. package/es/components/IconButton/variations/_size/base.js.map +1 -0
  209. package/es/components/IconButton/variations/_size/base_x642ct.css +1 -0
  210. package/es/components/IconButton/variations/_view/base.js +5 -0
  211. package/es/components/IconButton/variations/_view/base.js.map +1 -0
  212. package/es/components/IconButton/variations/_view/base_x642ct.css +1 -0
  213. package/es/components/Modal/ModalContext.js +1 -1
  214. package/es/components/Modal/ModalContext.js.map +1 -1
  215. package/es/components/Overlay/Overlay.js +1 -1
  216. package/es/components/Overlay/Overlay.js.map +1 -1
  217. package/es/components/Pagination/Pagination.css +2 -2
  218. package/es/components/Pagination/Pagination.js +2 -2
  219. package/es/components/Pagination/Pagination.js.map +1 -1
  220. package/es/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js +1 -1
  221. package/es/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js.map +1 -1
  222. package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +2 -2
  223. package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +1 -1
  224. package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js.map +1 -1
  225. package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.js +1 -1
  226. package/es/components/Popover/Popover.js +7 -7
  227. package/es/components/Popover/Popover.js.map +1 -1
  228. package/es/components/Popup/Popup.js +1 -1
  229. package/es/components/Popup/Popup.js.map +1 -1
  230. package/es/components/Segment/ui/SegmentItem/SegmentItem.js +2 -2
  231. package/es/components/Segment/ui/SegmentItem/SegmentItem.js.map +1 -1
  232. package/es/components/Select/Select.css +2 -2
  233. package/es/components/Select/Select.js +5 -5
  234. package/es/components/Select/Select.js.map +1 -1
  235. package/es/components/Select/hooks/useKeyNavigation.js +12 -12
  236. package/es/components/Select/hooks/useKeyNavigation.js.map +1 -1
  237. package/es/components/Select/ui/SelectChip/SelectChip.js +1 -1
  238. package/es/components/Select/ui/SelectChip/SelectChip.js.map +1 -1
  239. package/es/components/Select/ui/SelectDivider/SelectDivider.css +2 -2
  240. package/es/components/Select/ui/SelectDivider/SelectDivider.js +1 -1
  241. package/es/components/Select/ui/SelectFooter/SelectFooter.css +2 -2
  242. package/es/components/Select/ui/SelectFooter/SelectFooter.js +1 -1
  243. package/es/components/Select/ui/SelectGroup/SelectGroup.css +2 -2
  244. package/es/components/Select/ui/SelectGroup/SelectGroup.js +1 -1
  245. package/es/components/Select/ui/SelectHeader/SelectHeader.css +2 -2
  246. package/es/components/Select/ui/SelectHeader/SelectHeader.js +1 -1
  247. package/es/components/Select/ui/SelectItem/SelectItem.css +2 -2
  248. package/es/components/Select/ui/SelectItem/SelectItem.js +1 -1
  249. package/es/components/Select/ui/SelectItem/SelectItem.styles.js +1 -1
  250. package/es/components/Select/ui/SelectTarget/SelectTarget.js +2 -2
  251. package/es/components/Select/ui/SelectTarget/SelectTarget.js.map +1 -1
  252. package/es/components/Select/utils/index.js +2 -2
  253. package/es/components/Select/utils/index.js.map +1 -1
  254. package/es/components/Tabs/TabsContext.js +1 -2
  255. package/es/components/Tabs/TabsContext.js.map +1 -1
  256. package/es/components/Tabs/ui/TabItem/TabItem.js +1 -1
  257. package/es/components/Tabs/ui/TabItem/TabItem.js.map +1 -1
  258. package/es/components/Tabs/ui/Tabs/Tabs.js +2 -2
  259. package/es/components/Tabs/ui/Tabs/Tabs.js.map +1 -1
  260. package/es/components/TextArea/TextArea.js +1 -1
  261. package/es/components/TextArea/TextArea.js.map +1 -1
  262. package/es/components/TextField/TextField.js +2 -2
  263. package/es/components/TextField/TextField.js.map +1 -1
  264. package/es/components/TextField/hooks/useKeyNavigation.js +9 -9
  265. package/es/components/TextField/hooks/useKeyNavigation.js.map +1 -1
  266. package/es/components/TextField/ui/TextFieldChip/TextFieldChip.js +1 -1
  267. package/es/components/TextField/ui/TextFieldChip/TextFieldChip.js.map +1 -1
  268. package/es/components/Toast/ToastProvider/ToastProvider.js +2 -2
  269. package/es/components/Toast/ToastProvider/ToastProvider.js.map +1 -1
  270. package/es/components/Tooltip/Tooltip.js +1 -1
  271. package/es/components/Tooltip/Tooltip.js.map +1 -1
  272. package/es/index.css +7 -2
  273. package/es/index.js +2 -1
  274. package/es/index.js.map +1 -1
  275. package/package.json +12 -12
  276. package/styled-components/cjs/components/Avatar/Avatar.js +34 -4
  277. package/styled-components/cjs/components/Avatar/Avatar.styles.js +1 -1
  278. package/styled-components/cjs/components/Avatar/Avatar.template-doc.mdx +52 -2
  279. package/styled-components/cjs/components/AvatarGroup/AvatarGroup.js +1 -1
  280. package/styled-components/cjs/components/Badge/Badge.js +1 -1
  281. package/styled-components/cjs/components/Badge/Badge.styles.js +1 -1
  282. package/styled-components/cjs/components/Button/Button.js +2 -2
  283. package/styled-components/cjs/components/Button/Button.styles.js +1 -1
  284. package/styled-components/cjs/components/ButtonGroup/ButtonGroup.js +1 -1
  285. package/styled-components/cjs/components/Calendar/CalendarBase/CalendarBase.js +2 -2
  286. package/styled-components/cjs/components/Calendar/CalendarBase/CalendarBase.styles.js +1 -1
  287. package/styled-components/cjs/components/Calendar/CalendarDouble/CalendarDouble.js +2 -2
  288. package/styled-components/cjs/components/Calendar/CalendarDouble/CalendarDouble.styles.js +1 -1
  289. package/styled-components/cjs/components/Calendar/hoc/withRange.js +2 -2
  290. package/styled-components/cjs/components/Calendar/hooks/useKeyNavigation.js +20 -20
  291. package/styled-components/cjs/components/Calendar/store/reducer.js +1 -1
  292. package/styled-components/cjs/components/Calendar/ui/CalendarDayItem/CalendarDayItem.js +1 -1
  293. package/styled-components/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js +4 -4
  294. package/styled-components/cjs/components/Calendar/ui/CalendarHeader/CalendarHeader.js +3 -3
  295. package/styled-components/cjs/components/Calendar/ui/CalendarMonths/CalendarMonths.js +2 -2
  296. package/styled-components/cjs/components/Calendar/ui/CalendarYears/CalendarYears.js +2 -2
  297. package/styled-components/cjs/components/Cell/Cell.js +1 -1
  298. package/styled-components/cjs/components/Cell/Cell.styles.js +1 -1
  299. package/styled-components/cjs/components/Checkbox/Checkbox.js +1 -1
  300. package/styled-components/cjs/components/Chip/Chip.js +3 -3
  301. package/styled-components/cjs/components/Chip/Chip.styles.js +1 -1
  302. package/styled-components/cjs/components/Combobox/Combobox.js +6 -6
  303. package/styled-components/cjs/components/Combobox/hooks/useFocusController.js +9 -9
  304. package/styled-components/cjs/components/Combobox/ui/ComboboxChip/ComboboxChip.js +2 -2
  305. package/styled-components/cjs/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js +7 -7
  306. package/styled-components/cjs/components/Counter/Counter.js +1 -1
  307. package/styled-components/cjs/components/Divider/Divider.js +2 -2
  308. package/styled-components/cjs/components/Drawer/Drawer.js +1 -1
  309. package/styled-components/cjs/components/Drawer/DrawerContext.js +1 -1
  310. package/styled-components/cjs/components/Drawer/hooks/useDrawer.js +1 -1
  311. package/styled-components/cjs/components/Drawer/ui/DrawerContent/DrawerContent.js +1 -1
  312. package/styled-components/cjs/components/Drawer/ui/DrawerFooter/DrawerFooter.js +1 -1
  313. package/styled-components/cjs/components/Drawer/ui/DrawerHeader/DrawerHeader.js +1 -1
  314. package/styled-components/cjs/components/Dropdown/Dropdown.js +7 -29
  315. package/styled-components/cjs/components/Dropdown/Dropdown.styles.js +1 -1
  316. package/styled-components/cjs/components/Dropdown/Dropdown.tokens.js +0 -1
  317. package/styled-components/cjs/components/Dropdown/index.js +1 -9
  318. package/styled-components/cjs/components/Dropdown/ui/DropdownDivider/DropdownDivider.js +1 -1
  319. package/styled-components/cjs/components/Dropdown/ui/DropdownFooter/DropdownFooter.js +1 -1
  320. package/styled-components/cjs/components/Dropdown/ui/DropdownGroup/DropdownGroup.js +1 -1
  321. package/styled-components/cjs/components/Dropdown/ui/DropdownHeader/DropdownHeader.js +1 -1
  322. package/styled-components/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.js +7 -9
  323. package/styled-components/cjs/components/Dropdown/ui/DropdownItem/DropdownItem.styles.js +1 -1
  324. package/styled-components/cjs/components/Dropdown/utils/index.js +2 -49
  325. package/styled-components/cjs/components/Grid/Grid.js +2 -2
  326. package/styled-components/cjs/components/Grid/ui/Col/Col.js +2 -2
  327. package/styled-components/cjs/components/Grid/ui/Row/Row.js +1 -1
  328. package/styled-components/cjs/components/Grid/utils/index.js +1 -1
  329. package/styled-components/cjs/components/Header/HeaderRoot/HeaderRoot.js +1 -1
  330. package/styled-components/cjs/components/Header/ui/HeaderArrow/HeaderArrow.js +1 -1
  331. package/styled-components/cjs/components/Header/ui/HeaderLogo/HeaderLogo.js +1 -1
  332. package/styled-components/cjs/components/Header/ui/HeaderTitleWrapper/HeaderTitleWrapper.js +1 -1
  333. package/styled-components/cjs/components/IconButton/IconButton.js +86 -0
  334. package/styled-components/cjs/components/IconButton/IconButton.styles.js +29 -0
  335. package/styled-components/cjs/components/IconButton/IconButton.tokens.js +34 -0
  336. package/styled-components/cjs/components/IconButton/IconButton.types.js +5 -0
  337. package/styled-components/cjs/components/IconButton/index.js +31 -0
  338. package/styled-components/cjs/components/IconButton/variations/_disabled/base.js +8 -0
  339. package/styled-components/cjs/components/IconButton/variations/_disabled/tokens.json +1 -0
  340. package/styled-components/cjs/components/IconButton/variations/_focused/base.js +8 -0
  341. package/styled-components/cjs/components/IconButton/variations/_focused/tokens.json +1 -0
  342. package/styled-components/cjs/components/IconButton/variations/_size/base.js +8 -0
  343. package/styled-components/cjs/components/IconButton/variations/_size/tokens.json +1 -0
  344. package/styled-components/cjs/components/IconButton/variations/_view/base.js +8 -0
  345. package/styled-components/cjs/components/IconButton/variations/_view/tokens.json +1 -0
  346. package/styled-components/cjs/components/Image/Image.js +2 -2
  347. package/styled-components/cjs/components/Image/Image.styles.js +1 -1
  348. package/styled-components/cjs/components/Indicator/Indicator.js +1 -1
  349. package/styled-components/cjs/components/Link/Link.js +1 -1
  350. package/styled-components/cjs/components/Modal/Modal.js +1 -1
  351. package/styled-components/cjs/components/Modal/ModalContext.js +1 -1
  352. package/styled-components/cjs/components/Modal/hooks/useModal.js +1 -1
  353. package/styled-components/cjs/components/Notification/Notification.js +1 -1
  354. package/styled-components/cjs/components/Notification/Notification.styles.js +1 -1
  355. package/styled-components/cjs/components/Notification/NotificationsPortal.js +1 -1
  356. package/styled-components/cjs/components/Notification/NotificationsStore.js +1 -1
  357. package/styled-components/cjs/components/Overlay/Overlay.js +2 -2
  358. package/styled-components/cjs/components/Pagination/Pagination.js +3 -3
  359. package/styled-components/cjs/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js +2 -2
  360. package/styled-components/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
  361. package/styled-components/cjs/components/Panel/Panel.js +2 -2
  362. package/styled-components/cjs/components/Panel/ui/PanelContent/PanelContent.js +1 -1
  363. package/styled-components/cjs/components/Panel/ui/PanelFooter/PanelFooter.js +1 -1
  364. package/styled-components/cjs/components/Panel/ui/PanelHeader/PanelHeader.js +1 -1
  365. package/styled-components/cjs/components/Popover/Popover.js +9 -9
  366. package/styled-components/cjs/components/Popup/Popup.js +2 -2
  367. package/styled-components/cjs/components/Popup/PopupContext.js +1 -1
  368. package/styled-components/cjs/components/Popup/PopupRoot.js +1 -1
  369. package/styled-components/cjs/components/Popup/hooks/usePopup.js +1 -1
  370. package/styled-components/cjs/components/Progress/Progress.js +1 -1
  371. package/styled-components/cjs/components/Progress/Progress.styles.js +1 -1
  372. package/styled-components/cjs/components/Radiobox/Radiobox.js +1 -1
  373. package/styled-components/cjs/components/SSRProvider/SSRProvider.js +1 -1
  374. package/styled-components/cjs/components/Segment/SegmentProvider/SegmentProvider.js +1 -1
  375. package/styled-components/cjs/components/Segment/ui/SegmentGroup/SegmentGroup.js +1 -1
  376. package/styled-components/cjs/components/Segment/ui/SegmentGroup/SegmentGroup.styles.js +1 -1
  377. package/styled-components/cjs/components/Segment/ui/SegmentItem/SegmentItem.js +3 -3
  378. package/styled-components/cjs/components/Segment/ui/SegmentItem/SegmentItem.styles.js +1 -1
  379. package/styled-components/cjs/components/Select/Select.js +6 -6
  380. package/styled-components/cjs/components/Select/hooks/useKeyNavigation.js +12 -12
  381. package/styled-components/cjs/components/Select/ui/SelectChip/SelectChip.js +2 -2
  382. package/styled-components/cjs/components/Select/ui/SelectTarget/SelectTarget.js +3 -3
  383. package/styled-components/cjs/components/Select/utils/index.js +3 -3
  384. package/styled-components/cjs/components/Skeleton/LineSkeleton/LineSkeleton.js +1 -1
  385. package/styled-components/cjs/components/Skeleton/LineSkeleton/LineSkeleton.styles.js +1 -1
  386. package/styled-components/cjs/components/Skeleton/RectSkeleton/RectSkeleton.js +1 -1
  387. package/styled-components/cjs/components/Skeleton/TextSkeleton/TextSkeleton.js +2 -2
  388. package/styled-components/cjs/components/Skeleton/hoc/withSkeleton.js +1 -1
  389. package/styled-components/cjs/components/Spinner/Spinner.js +1 -1
  390. package/styled-components/cjs/components/Spinner/Spinner.styles.js +1 -1
  391. package/styled-components/cjs/components/Spinner/utils/index.js +1 -1
  392. package/styled-components/cjs/components/Switch/Switch.js +1 -1
  393. package/styled-components/cjs/components/Tabs/TabsContext.js +2 -3
  394. package/styled-components/cjs/components/Tabs/createTabsController.js +1 -1
  395. package/styled-components/cjs/components/Tabs/ui/TabItem/TabItem.js +2 -2
  396. package/styled-components/cjs/components/Tabs/ui/TabItem/TabItem.styles.js +1 -1
  397. package/styled-components/cjs/components/Tabs/ui/Tabs/Tabs.js +3 -3
  398. package/styled-components/cjs/components/Tabs/ui/Tabs/Tabs.styles.js +1 -1
  399. package/styled-components/cjs/components/TextArea/TextArea.js +2 -2
  400. package/styled-components/cjs/components/TextField/TextField.js +3 -3
  401. package/styled-components/cjs/components/TextField/hooks/useKeyNavigation.js +9 -9
  402. package/styled-components/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js +2 -2
  403. package/styled-components/cjs/components/Toast/Toast.js +2 -2
  404. package/styled-components/cjs/components/Toast/Toast.styles.js +1 -1
  405. package/styled-components/cjs/components/Toast/ToastController.js +2 -2
  406. package/styled-components/cjs/components/Toast/ToastProvider/ToastProvider.js +3 -3
  407. package/styled-components/cjs/components/Toolbar/Toolbar.js +1 -1
  408. package/styled-components/cjs/components/Toolbar/ui/ToolbarDivider/ToolbarDivider.js +1 -1
  409. package/styled-components/cjs/components/Tooltip/Tooltip.js +2 -2
  410. package/styled-components/cjs/components/Typography/Old/Subtitle/Subtitle.js +2 -2
  411. package/styled-components/cjs/components/Typography/Old/TypographyOld.js +2 -2
  412. package/styled-components/cjs/components/Typography/Typography.js +2 -2
  413. package/styled-components/cjs/engines/common.js +1 -1
  414. package/styled-components/cjs/engines/styled-components.js +1 -1
  415. package/styled-components/cjs/examples/_helpers.js +1 -1
  416. package/styled-components/cjs/examples/plasma_b2c/components/Avatar/Avatar.stories.tsx +26 -1
  417. package/styled-components/cjs/examples/plasma_b2c/components/AvatarGroup/AvatarGroup.stories.tsx +36 -18
  418. package/styled-components/cjs/examples/plasma_b2c/components/Button/Button.stories.tsx +27 -11
  419. package/styled-components/cjs/examples/plasma_b2c/components/Dropdown/Normal/Dropdown.config.js +1 -1
  420. package/styled-components/cjs/examples/plasma_b2c/components/Dropdown/Normal/Dropdown.stories.tsx +7 -27
  421. package/styled-components/cjs/examples/plasma_b2c/components/Dropdown/Tight/Dropdown.config.js +1 -1
  422. package/styled-components/cjs/examples/plasma_b2c/components/Dropdown/Tight/Dropdown.stories.tsx +11 -30
  423. package/styled-components/cjs/examples/plasma_b2c/components/Grid/Grid.config.js +1 -1
  424. package/styled-components/cjs/examples/plasma_b2c/components/IconButton/IconButton.config.js +45 -0
  425. package/styled-components/cjs/examples/plasma_b2c/components/IconButton/IconButton.js +11 -0
  426. package/styled-components/cjs/examples/plasma_b2c/components/IconButton/IconButton.stories.tsx +65 -0
  427. package/styled-components/cjs/examples/plasma_b2c/components/Radiobox/Radiobox.stories.tsx +37 -43
  428. package/styled-components/cjs/examples/plasma_web/components/Avatar/Avatar.stories.tsx +26 -1
  429. package/styled-components/cjs/examples/plasma_web/components/Dropdown/Normal/Dropdown.config.js +1 -1
  430. package/styled-components/cjs/examples/plasma_web/components/Dropdown/Normal/Dropdown.stories.tsx +8 -27
  431. package/styled-components/cjs/examples/plasma_web/components/Dropdown/Tight/Dropdown.config.js +1 -1
  432. package/styled-components/cjs/examples/plasma_web/components/Dropdown/Tight/Dropdown.stories.tsx +11 -30
  433. package/styled-components/cjs/examples/plasma_web/components/Grid/Grid.config.js +1 -1
  434. package/styled-components/cjs/examples/plasma_web/components/IconButton/IconButton.config.js +45 -0
  435. package/styled-components/cjs/examples/plasma_web/components/IconButton/IconButton.js +11 -0
  436. package/styled-components/cjs/examples/plasma_web/components/IconButton/IconButton.stories.tsx +65 -0
  437. package/styled-components/cjs/examples/plasma_web/components/Radiobox/Radiobox.stories.tsx +37 -43
  438. package/styled-components/cjs/examples/sds_engineer/components/Avatar/Avatar.stories.tsx +27 -1
  439. package/styled-components/cjs/examples/sds_engineer/components/Grid/Grid.config.js +1 -1
  440. package/styled-components/cjs/index.js +11 -0
  441. package/styled-components/cjs/mixins/applySpacing.js +1 -1
  442. package/styled-components/cjs/mixins/typography.js +1 -1
  443. package/styled-components/es/components/Avatar/Avatar.js +34 -3
  444. package/styled-components/es/components/Avatar/Avatar.template-doc.mdx +52 -2
  445. package/styled-components/es/components/Button/Button.js +1 -1
  446. package/styled-components/es/components/Calendar/CalendarBase/CalendarBase.js +1 -1
  447. package/styled-components/es/components/Calendar/CalendarDouble/CalendarDouble.js +1 -1
  448. package/styled-components/es/components/Calendar/hoc/withRange.js +1 -1
  449. package/styled-components/es/components/Calendar/hooks/useKeyNavigation.js +20 -20
  450. package/styled-components/es/components/Calendar/store/reducer.js +1 -1
  451. package/styled-components/es/components/Calendar/ui/CalendarDays/CalendarDays.js +3 -3
  452. package/styled-components/es/components/Calendar/ui/CalendarHeader/CalendarHeader.js +2 -2
  453. package/styled-components/es/components/Calendar/ui/CalendarMonths/CalendarMonths.js +1 -1
  454. package/styled-components/es/components/Calendar/ui/CalendarYears/CalendarYears.js +1 -1
  455. package/styled-components/es/components/Chip/Chip.js +2 -2
  456. package/styled-components/es/components/Combobox/Combobox.js +5 -5
  457. package/styled-components/es/components/Combobox/hooks/useFocusController.js +9 -9
  458. package/styled-components/es/components/Combobox/ui/ComboboxChip/ComboboxChip.js +1 -1
  459. package/styled-components/es/components/Combobox/ui/ComboboxTarget/ComboboxTarget.js +6 -6
  460. package/styled-components/es/components/Divider/Divider.js +1 -1
  461. package/styled-components/es/components/Drawer/DrawerContext.js +1 -1
  462. package/styled-components/es/components/Drawer/hooks/useDrawer.js +1 -1
  463. package/styled-components/es/components/Drawer/ui/DrawerContent/DrawerContent.js +1 -1
  464. package/styled-components/es/components/Drawer/ui/DrawerFooter/DrawerFooter.js +1 -1
  465. package/styled-components/es/components/Drawer/ui/DrawerHeader/DrawerHeader.js +1 -1
  466. package/styled-components/es/components/Dropdown/Dropdown.js +6 -29
  467. package/styled-components/es/components/Dropdown/Dropdown.styles.js +1 -1
  468. package/styled-components/es/components/Dropdown/Dropdown.tokens.js +0 -1
  469. package/styled-components/es/components/Dropdown/index.js +0 -1
  470. package/styled-components/es/components/Dropdown/ui/DropdownItem/DropdownItem.js +6 -8
  471. package/styled-components/es/components/Dropdown/utils/index.js +1 -48
  472. package/styled-components/es/components/Grid/Grid.js +1 -1
  473. package/styled-components/es/components/Grid/ui/Col/Col.js +1 -1
  474. package/styled-components/es/components/Grid/utils/index.js +1 -1
  475. package/styled-components/es/components/IconButton/IconButton.js +77 -0
  476. package/styled-components/es/components/IconButton/IconButton.styles.js +22 -0
  477. package/styled-components/es/components/IconButton/IconButton.tokens.js +28 -0
  478. package/styled-components/es/components/IconButton/IconButton.types.js +1 -0
  479. package/styled-components/es/components/IconButton/index.js +2 -0
  480. package/styled-components/es/components/IconButton/variations/_disabled/base.js +2 -0
  481. package/styled-components/es/components/IconButton/variations/_disabled/tokens.json +1 -0
  482. package/styled-components/es/components/IconButton/variations/_focused/base.js +2 -0
  483. package/styled-components/es/components/IconButton/variations/_focused/tokens.json +1 -0
  484. package/styled-components/es/components/IconButton/variations/_size/base.js +2 -0
  485. package/styled-components/es/components/IconButton/variations/_size/tokens.json +1 -0
  486. package/styled-components/es/components/IconButton/variations/_view/base.js +2 -0
  487. package/styled-components/es/components/IconButton/variations/_view/tokens.json +1 -0
  488. package/styled-components/es/components/Image/Image.js +1 -1
  489. package/styled-components/es/components/Modal/ModalContext.js +1 -1
  490. package/styled-components/es/components/Modal/hooks/useModal.js +1 -1
  491. package/styled-components/es/components/Notification/NotificationsStore.js +1 -1
  492. package/styled-components/es/components/Overlay/Overlay.js +1 -1
  493. package/styled-components/es/components/Pagination/Pagination.js +2 -2
  494. package/styled-components/es/components/Pagination/ui/PaginationQuickJumpToPage/PaginationQuickJumpToPage.js +1 -1
  495. package/styled-components/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +1 -1
  496. package/styled-components/es/components/Panel/Panel.js +1 -1
  497. package/styled-components/es/components/Popover/Popover.js +8 -8
  498. package/styled-components/es/components/Popup/Popup.js +1 -1
  499. package/styled-components/es/components/Popup/hooks/usePopup.js +1 -1
  500. package/styled-components/es/components/Segment/ui/SegmentItem/SegmentItem.js +2 -2
  501. package/styled-components/es/components/Select/Select.js +5 -5
  502. package/styled-components/es/components/Select/hooks/useKeyNavigation.js +12 -12
  503. package/styled-components/es/components/Select/ui/SelectChip/SelectChip.js +1 -1
  504. package/styled-components/es/components/Select/ui/SelectTarget/SelectTarget.js +2 -2
  505. package/styled-components/es/components/Select/utils/index.js +3 -3
  506. package/styled-components/es/components/Skeleton/TextSkeleton/TextSkeleton.js +1 -1
  507. package/styled-components/es/components/Skeleton/hoc/withSkeleton.js +1 -1
  508. package/styled-components/es/components/Spinner/utils/index.js +1 -1
  509. package/styled-components/es/components/Tabs/TabsContext.js +2 -3
  510. package/styled-components/es/components/Tabs/ui/TabItem/TabItem.js +1 -1
  511. package/styled-components/es/components/Tabs/ui/Tabs/Tabs.js +2 -2
  512. package/styled-components/es/components/TextArea/TextArea.js +1 -1
  513. package/styled-components/es/components/TextField/TextField.js +2 -2
  514. package/styled-components/es/components/TextField/hooks/useKeyNavigation.js +9 -9
  515. package/styled-components/es/components/TextField/ui/TextFieldChip/TextFieldChip.js +1 -1
  516. package/styled-components/es/components/Toast/Toast.js +1 -1
  517. package/styled-components/es/components/Toast/ToastController.js +1 -1
  518. package/styled-components/es/components/Toast/ToastProvider/ToastProvider.js +2 -2
  519. package/styled-components/es/components/Toolbar/ui/ToolbarDivider/ToolbarDivider.js +1 -1
  520. package/styled-components/es/components/Tooltip/Tooltip.js +1 -1
  521. package/styled-components/es/components/Typography/Old/Subtitle/Subtitle.js +1 -1
  522. package/styled-components/es/components/Typography/Old/TypographyOld.js +1 -1
  523. package/styled-components/es/components/Typography/Typography.js +1 -1
  524. package/styled-components/es/engines/common.js +1 -1
  525. package/styled-components/es/examples/_helpers.js +1 -1
  526. package/styled-components/es/examples/plasma_b2c/components/Avatar/Avatar.stories.tsx +26 -1
  527. package/styled-components/es/examples/plasma_b2c/components/AvatarGroup/AvatarGroup.stories.tsx +36 -18
  528. package/styled-components/es/examples/plasma_b2c/components/Button/Button.stories.tsx +27 -11
  529. package/styled-components/es/examples/plasma_b2c/components/Dropdown/Normal/Dropdown.config.js +1 -1
  530. package/styled-components/es/examples/plasma_b2c/components/Dropdown/Normal/Dropdown.stories.tsx +7 -27
  531. package/styled-components/es/examples/plasma_b2c/components/Dropdown/Tight/Dropdown.config.js +1 -1
  532. package/styled-components/es/examples/plasma_b2c/components/Dropdown/Tight/Dropdown.stories.tsx +11 -30
  533. package/styled-components/es/examples/plasma_b2c/components/Grid/Grid.config.js +1 -1
  534. package/styled-components/es/examples/plasma_b2c/components/IconButton/IconButton.config.js +39 -0
  535. package/styled-components/es/examples/plasma_b2c/components/IconButton/IconButton.js +5 -0
  536. package/styled-components/es/examples/plasma_b2c/components/IconButton/IconButton.stories.tsx +65 -0
  537. package/styled-components/es/examples/plasma_b2c/components/Radiobox/Radiobox.stories.tsx +37 -43
  538. package/styled-components/es/examples/plasma_web/components/Avatar/Avatar.stories.tsx +26 -1
  539. package/styled-components/es/examples/plasma_web/components/Dropdown/Normal/Dropdown.config.js +1 -1
  540. package/styled-components/es/examples/plasma_web/components/Dropdown/Normal/Dropdown.stories.tsx +8 -27
  541. package/styled-components/es/examples/plasma_web/components/Dropdown/Tight/Dropdown.config.js +1 -1
  542. package/styled-components/es/examples/plasma_web/components/Dropdown/Tight/Dropdown.stories.tsx +11 -30
  543. package/styled-components/es/examples/plasma_web/components/Grid/Grid.config.js +1 -1
  544. package/styled-components/es/examples/plasma_web/components/IconButton/IconButton.config.js +39 -0
  545. package/styled-components/es/examples/plasma_web/components/IconButton/IconButton.js +5 -0
  546. package/styled-components/es/examples/plasma_web/components/IconButton/IconButton.stories.tsx +65 -0
  547. package/styled-components/es/examples/plasma_web/components/Radiobox/Radiobox.stories.tsx +37 -43
  548. package/styled-components/es/examples/sds_engineer/components/Avatar/Avatar.stories.tsx +27 -1
  549. package/styled-components/es/examples/sds_engineer/components/Grid/Grid.config.js +1 -1
  550. package/styled-components/es/index.js +1 -0
  551. package/styled-components/es/mixins/applySpacing.js +1 -1
  552. package/styled-components/es/mixins/typography.js +1 -1
  553. package/types/components/Avatar/Avatar.d.ts +3 -1
  554. package/types/components/Avatar/Avatar.d.ts.map +1 -1
  555. package/types/components/Avatar/Avatar.types.d.ts +7 -0
  556. package/types/components/Avatar/Avatar.types.d.ts.map +1 -1
  557. package/types/components/Dropdown/Dropdown.d.ts.map +1 -1
  558. package/types/components/Dropdown/Dropdown.tokens.d.ts +0 -1
  559. package/types/components/Dropdown/Dropdown.tokens.d.ts.map +1 -1
  560. package/types/components/Dropdown/Dropdown.types.d.ts +2 -7
  561. package/types/components/Dropdown/Dropdown.types.d.ts.map +1 -1
  562. package/types/components/Dropdown/index.d.ts +0 -1
  563. package/types/components/Dropdown/index.d.ts.map +1 -1
  564. package/types/components/Dropdown/ui/DropdownItem/DropdownItem.d.ts.map +1 -1
  565. package/types/components/Dropdown/utils/index.d.ts +2 -5
  566. package/types/components/Dropdown/utils/index.d.ts.map +1 -1
  567. package/types/components/IconButton/IconButton.d.ts +30 -0
  568. package/types/components/IconButton/IconButton.d.ts.map +1 -0
  569. package/types/components/IconButton/IconButton.styles.d.ts +21 -0
  570. package/types/components/IconButton/IconButton.styles.d.ts.map +1 -0
  571. package/types/components/IconButton/IconButton.tokens.d.ts +29 -0
  572. package/types/components/IconButton/IconButton.tokens.d.ts.map +1 -0
  573. package/types/components/IconButton/IconButton.types.d.ts +13 -0
  574. package/types/components/IconButton/IconButton.types.d.ts.map +1 -0
  575. package/types/components/IconButton/index.d.ts +4 -0
  576. package/types/components/IconButton/index.d.ts.map +1 -0
  577. package/types/components/IconButton/variations/_disabled/base.d.ts +2 -0
  578. package/types/components/IconButton/variations/_disabled/base.d.ts.map +1 -0
  579. package/types/components/IconButton/variations/_focused/base.d.ts +2 -0
  580. package/types/components/IconButton/variations/_focused/base.d.ts.map +1 -0
  581. package/types/components/IconButton/variations/_size/base.d.ts +2 -0
  582. package/types/components/IconButton/variations/_size/base.d.ts.map +1 -0
  583. package/types/components/IconButton/variations/_view/base.d.ts +2 -0
  584. package/types/components/IconButton/variations/_view/base.d.ts.map +1 -0
  585. package/types/examples/plasma_b2c/components/Avatar/Avatar.d.ts +2 -0
  586. package/types/examples/plasma_b2c/components/Avatar/Avatar.d.ts.map +1 -1
  587. package/types/examples/plasma_b2c/components/Dropdown/Normal/Dropdown.config.d.ts.map +1 -1
  588. package/types/examples/plasma_b2c/components/Dropdown/Tight/Dropdown.config.d.ts.map +1 -1
  589. package/types/examples/plasma_b2c/components/IconButton/IconButton.config.d.ts +38 -0
  590. package/types/examples/plasma_b2c/components/IconButton/IconButton.config.d.ts.map +1 -0
  591. package/types/examples/plasma_b2c/components/IconButton/IconButton.d.ts +32 -0
  592. package/types/examples/plasma_b2c/components/IconButton/IconButton.d.ts.map +1 -0
  593. package/types/examples/plasma_web/components/Avatar/Avatar.d.ts +2 -0
  594. package/types/examples/plasma_web/components/Avatar/Avatar.d.ts.map +1 -1
  595. package/types/examples/plasma_web/components/Dropdown/Normal/Dropdown.config.d.ts.map +1 -1
  596. package/types/examples/plasma_web/components/Dropdown/Tight/Dropdown.config.d.ts.map +1 -1
  597. package/types/examples/plasma_web/components/IconButton/IconButton.config.d.ts +38 -0
  598. package/types/examples/plasma_web/components/IconButton/IconButton.config.d.ts.map +1 -0
  599. package/types/examples/plasma_web/components/IconButton/IconButton.d.ts +32 -0
  600. package/types/examples/plasma_web/components/IconButton/IconButton.d.ts.map +1 -0
  601. package/types/examples/sds_engineer/components/Avatar/Avatar.d.ts +1 -0
  602. package/types/examples/sds_engineer/components/Avatar/Avatar.d.ts.map +1 -1
  603. package/types/index.d.ts +1 -0
  604. package/types/index.d.ts.map +1 -1
  605. package/cjs/components/Dropdown/hooks/useKeyboardNavigation.js +0 -81
  606. package/cjs/components/Dropdown/hooks/useKeyboardNavigation.js.map +0 -1
  607. package/es/components/Dropdown/hooks/useKeyboardNavigation.js +0 -76
  608. package/es/components/Dropdown/hooks/useKeyboardNavigation.js.map +0 -1
  609. package/styled-components/cjs/components/Dropdown/hooks/useKeyboardNavigation.js +0 -83
  610. package/styled-components/es/components/Dropdown/hooks/useKeyboardNavigation.js +0 -77
  611. package/types/components/Dropdown/hooks/useKeyboardNavigation.d.ts +0 -13
  612. package/types/components/Dropdown/hooks/useKeyboardNavigation.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ToastProvider.js","sources":["../../../../src/components/Toast/ToastProvider/ToastProvider.tsx"],"sourcesContent":["import React, { createContext, useCallback, useContext, useEffect, useRef, useState } from 'react';\nimport type { ReactNode, FC } from 'react';\n\nimport type { CustomToastProps, ToastControllerProps, ToastProps } from '../Toast.types';\nimport { DEFAULT_FADE, DEFAULT_POSITION, TIMER_DELAY } from '../utils';\n\nimport type { ShowToast, ShowToastArgs, ShowToastCallSignature, ToastContextType } from './ToastProvider.types';\n\nexport const ToastContext = createContext<ToastContextType | null>(null);\n\nexport const useToastInner = () => {\n const context = useContext(ToastContext);\n if (!context) {\n throw new Error('useToast must be used within a ToastProvider');\n }\n return context;\n};\n\nexport const useToast = () => {\n const { showToast, hideToast } = useToastInner();\n return { showToast, hideToast };\n};\n\nconst initialToastData = {\n text: undefined,\n offset: undefined,\n position: DEFAULT_POSITION,\n fade: DEFAULT_FADE,\n timeout: undefined,\n contentLeft: undefined,\n role: undefined,\n pilled: undefined,\n hasClose: undefined,\n width: undefined,\n size: 'm',\n view: 'primary',\n} as CustomToastProps;\n\nconst getShowToastCallSignature = (args: ShowToastCallSignature) => {\n if (typeof args[0] === 'object' && 'text' in args[0]) {\n return args[0];\n }\n\n // TODO: issue https://github.com/salute-developers/plasma/issues/333\n const [text, position, timeout, fade, contentLeft, role, offset, pilled, width, hasClose, size, view] = args;\n\n return { text, position, timeout, fade, contentLeft, role, offset, pilled, width, hasClose, size, view };\n};\n\nexport const ToastProviderHoc = <T extends ToastProps>(ToastComponent: FC<T>) =>\n function ToastProvider({ children }: { children: ReactNode }) {\n const [isVisible, setIsVisible] = useState(false);\n const [isHidden, setIsHidden] = useState(true);\n const hideTimeout = useRef<number | null>(null);\n const animationRunTimeout = useRef<number | null>(null);\n\n const [toastProps, setToastProps] = useState<ToastControllerProps>(initialToastData);\n const [toastInfo, setToastInfo] = useState<Pick<ShowToastArgs, 'timeout' | 'onHide'>>({\n timeout: undefined,\n onHide: undefined,\n });\n\n const showToastCallback: ShowToast = (...args: ShowToastCallSignature) => {\n if (isVisible) {\n return;\n }\n\n const {\n text,\n offset,\n position = DEFAULT_POSITION,\n fade = DEFAULT_FADE,\n timeout,\n contentLeft,\n role,\n pilled,\n hasClose,\n size,\n view,\n width,\n onHide,\n onShow,\n } = getShowToastCallSignature(args);\n\n setToastProps({\n text,\n width,\n position,\n offset,\n fade,\n contentLeft,\n role,\n pilled,\n hasClose,\n size,\n view,\n });\n\n setToastInfo({ timeout, onHide });\n\n setIsHidden(false);\n setIsVisible(true);\n onShow?.();\n };\n\n const showToast = useCallback(showToastCallback, []);\n\n const { onHide, timeout } = toastInfo;\n\n const hideToast = useCallback(() => {\n if (!isVisible) {\n return;\n }\n\n if (hideTimeout?.current) {\n clearTimeout(hideTimeout.current);\n hideTimeout.current = null;\n }\n\n onHide?.();\n setIsVisible(false);\n\n animationRunTimeout.current = setTimeout(() => {\n setIsHidden(true);\n setToastProps(initialToastData);\n }, TIMER_DELAY);\n }, [onHide, isVisible, isHidden]);\n\n useEffect(() => {\n if (timeout === null && animationRunTimeout.current !== null) {\n clearTimeout(animationRunTimeout.current);\n animationRunTimeout.current = null;\n }\n }, [timeout]);\n\n useEffect(() => {\n if (timeout && isVisible) {\n hideTimeout.current = setTimeout(() => {\n hideToast();\n }, timeout);\n }\n }, [isVisible, timeout]);\n\n return (\n <ToastContext.Provider value={{ showToast, hideToast, isVisible, hideTimeout, animationRunTimeout }}>\n {children}\n {!isHidden && <ToastComponent {...(toastProps as T)} />}\n </ToastContext.Provider>\n );\n };\n"],"names":["ToastContext","createContext","useToastInner","context","useContext","Error","useToast","_useToastInner","showToast","hideToast","initialToastData","text","undefined","offset","position","DEFAULT_POSITION","fade","DEFAULT_FADE","timeout","contentLeft","role","pilled","hasClose","width","size","view","getShowToastCallSignature","args","_typeof","_args","_slicedToArray","ToastProviderHoc","ToastComponent","ToastProvider","_ref","children","_useState","useState","_useState2","isVisible","setIsVisible","_useState3","_useState4","isHidden","setIsHidden","hideTimeout","useRef","animationRunTimeout","_useState5","_useState6","toastProps","setToastProps","_useState7","onHide","_useState8","toastInfo","setToastInfo","showToastCallback","_len","arguments","length","Array","_key","_getShowToastCallSign","_getShowToastCallSign2","_getShowToastCallSign3","onShow","useCallback","current","clearTimeout","setTimeout","TIMER_DELAY","useEffect","React","createElement","Provider","value"],"mappings":";;;;;;;;IAQaA,YAAY,gBAAGC,mBAAa,CAA0B,IAAI,EAAC;IAE3DC,aAAa,GAAG,SAAhBA,aAAaA,GAAS;AAC/B,EAAA,IAAMC,OAAO,GAAGC,gBAAU,CAACJ,YAAY,CAAC,CAAA;EACxC,IAAI,CAACG,OAAO,EAAE;AACV,IAAA,MAAM,IAAIE,KAAK,CAAC,8CAA8C,CAAC,CAAA;AACnE,GAAA;AACA,EAAA,OAAOF,OAAO,CAAA;AAClB,EAAC;IAEYG,QAAQ,GAAG,SAAXA,QAAQA,GAAS;AAC1B,EAAA,IAAAC,cAAA,GAAiCL,aAAa,EAAE;IAAxCM,SAAS,GAAAD,cAAA,CAATC,SAAS;IAAEC,SAAS,GAAAF,cAAA,CAATE,SAAS,CAAA;EAC5B,OAAO;AAAED,IAAAA,SAAS,EAATA,SAAS;AAAEC,IAAAA,SAAS,EAATA,SAAAA;GAAW,CAAA;AACnC,EAAC;AAED,IAAMC,gBAAgB,GAAG;AACrBC,EAAAA,IAAI,EAAEC,SAAS;AACfC,EAAAA,MAAM,EAAED,SAAS;AACjBE,EAAAA,QAAQ,EAAEC,sBAAgB;AAC1BC,EAAAA,IAAI,EAAEC,kBAAY;AAClBC,EAAAA,OAAO,EAAEN,SAAS;AAClBO,EAAAA,WAAW,EAAEP,SAAS;AACtBQ,EAAAA,IAAI,EAAER,SAAS;AACfS,EAAAA,MAAM,EAAET,SAAS;AACjBU,EAAAA,QAAQ,EAAEV,SAAS;AACnBW,EAAAA,KAAK,EAAEX,SAAS;AAChBY,EAAAA,IAAI,EAAE,GAAG;AACTC,EAAAA,IAAI,EAAE,SAAA;AACV,CAAqB,CAAA;AAErB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AA,oBACIuD,KAAA,CAAAC,aAAA,CAAC1E,YAAY,CAAC2E,QAAQ,EAAA;AAACC,MAAAA,KAAK,EAAE;AAAEpE,QAAAA,SAAS,EAATA,SAAS;AAAEC,QAAAA,SAAS,EAATA,SAAS;AAAE8B,QAAAA,SAAS,EAATA,SAAS;AAAEM,QAAAA,WAAW,EAAXA,WAAW;AAAEE,QAAAA,mBAAmB,EAAnBA,mBAAAA;AAAoB,OAAA;AAAE,KAAA,EAC/FZ,QAAQ,EACR,CAACQ,QAAQ,iBAAI8B,KAAA,CAAAC,aAAA,CAAC1C,cAAc,EAAMkB,UAAmB,CACnC,CAAC,CAAA;GAE/B,CAAA;AAAA;;;;;;;"}
1
+ {"version":3,"file":"ToastProvider.js","sources":["../../../../src/components/Toast/ToastProvider/ToastProvider.tsx"],"sourcesContent":["import React, { createContext, useCallback, useContext, useEffect, useRef, useState } from 'react';\nimport type { ReactNode, FC } from 'react';\n\nimport type { CustomToastProps, ToastControllerProps, ToastProps } from '../Toast.types';\nimport { DEFAULT_FADE, DEFAULT_POSITION, TIMER_DELAY } from '../utils';\n\nimport type { ShowToast, ShowToastArgs, ShowToastCallSignature, ToastContextType } from './ToastProvider.types';\n\nexport const ToastContext = createContext<ToastContextType | null>(null);\n\nexport const useToastInner = () => {\n const context = useContext(ToastContext);\n if (!context) {\n throw new Error('useToast must be used within a ToastProvider');\n }\n return context;\n};\n\nexport const useToast = () => {\n const { showToast, hideToast } = useToastInner();\n return { showToast, hideToast };\n};\n\nconst initialToastData = {\n text: undefined,\n offset: undefined,\n position: DEFAULT_POSITION,\n fade: DEFAULT_FADE,\n timeout: undefined,\n contentLeft: undefined,\n role: undefined,\n pilled: undefined,\n hasClose: undefined,\n width: undefined,\n size: 'm',\n view: 'primary',\n} as CustomToastProps;\n\nconst getShowToastCallSignature = (args: ShowToastCallSignature) => {\n if (typeof args[0] === 'object' && 'text' in args[0]) {\n return args[0];\n }\n\n // TODO: issue https://github.com/salute-developers/plasma/issues/333\n const [text, position, timeout, fade, contentLeft, role, offset, pilled, width, hasClose, size, view] = args;\n\n return { text, position, timeout, fade, contentLeft, role, offset, pilled, width, hasClose, size, view };\n};\n\nexport const ToastProviderHoc = <T extends ToastProps>(ToastComponent: FC<T>) =>\n function ToastProvider({ children }: { children: ReactNode }) {\n const [isVisible, setIsVisible] = useState(false);\n const [isHidden, setIsHidden] = useState(true);\n const hideTimeout = useRef<number | null>(null);\n const animationRunTimeout = useRef<number | null>(null);\n\n const [toastProps, setToastProps] = useState<ToastControllerProps>(initialToastData);\n const [toastInfo, setToastInfo] = useState<Pick<ShowToastArgs, 'timeout' | 'onHide'>>({\n timeout: undefined,\n onHide: undefined,\n });\n\n const showToastCallback: ShowToast = (...args: ShowToastCallSignature) => {\n if (isVisible) {\n return;\n }\n\n const {\n text,\n offset,\n position = DEFAULT_POSITION,\n fade = DEFAULT_FADE,\n timeout,\n contentLeft,\n role,\n pilled,\n hasClose,\n size,\n view,\n width,\n onHide,\n onShow,\n } = getShowToastCallSignature(args);\n\n setToastProps({\n text,\n width,\n position,\n offset,\n fade,\n contentLeft,\n role,\n pilled,\n hasClose,\n size,\n view,\n });\n\n setToastInfo({ timeout, onHide });\n\n setIsHidden(false);\n setIsVisible(true);\n onShow?.();\n };\n\n const showToast = useCallback(showToastCallback, []);\n\n const { onHide, timeout } = toastInfo;\n\n const hideToast = useCallback(() => {\n if (!isVisible) {\n return;\n }\n\n if (hideTimeout?.current) {\n clearTimeout(hideTimeout.current);\n hideTimeout.current = null;\n }\n\n onHide?.();\n setIsVisible(false);\n\n animationRunTimeout.current = setTimeout(() => {\n setIsHidden(true);\n setToastProps(initialToastData);\n }, TIMER_DELAY);\n }, [onHide, isVisible, isHidden]);\n\n useEffect(() => {\n if (timeout === null && animationRunTimeout.current !== null) {\n clearTimeout(animationRunTimeout.current);\n animationRunTimeout.current = null;\n }\n }, [timeout]);\n\n useEffect(() => {\n if (timeout && isVisible) {\n hideTimeout.current = setTimeout(() => {\n hideToast();\n }, timeout);\n }\n }, [isVisible, timeout]);\n\n return (\n <ToastContext.Provider value={{ showToast, hideToast, isVisible, hideTimeout, animationRunTimeout }}>\n {children}\n {!isHidden && <ToastComponent {...(toastProps as T)} />}\n </ToastContext.Provider>\n );\n };\n"],"names":["ToastContext","createContext","useToastInner","context","useContext","Error","useToast","_useToastInner","showToast","hideToast","initialToastData","text","undefined","offset","position","DEFAULT_POSITION","fade","DEFAULT_FADE","timeout","contentLeft","role","pilled","hasClose","width","size","view","getShowToastCallSignature","args","_typeof","_args","_slicedToArray","ToastProviderHoc","ToastComponent","ToastProvider","_ref","children","_useState","useState","_useState2","isVisible","setIsVisible","_useState3","_useState4","isHidden","setIsHidden","hideTimeout","useRef","animationRunTimeout","_useState5","_useState6","toastProps","setToastProps","_useState7","onHide","_useState8","toastInfo","setToastInfo","showToastCallback","_len","arguments","length","Array","_key","_getShowToastCallSign","_getShowToastCallSign2","_getShowToastCallSign3","onShow","useCallback","current","clearTimeout","setTimeout","TIMER_DELAY","useEffect","React","createElement","Provider","value"],"mappings":";;;;;;;;IAQaA,YAAY,gBAAGC,mBAAa,CAA0B,IAAI,EAAC;IAE3DC,aAAa,GAAG,SAAhBA,aAAaA,GAAS;AAC/B,EAAA,IAAMC,OAAO,GAAGC,gBAAU,CAACJ,YAAY,CAAC,CAAA;EACxC,IAAI,CAACG,OAAO,EAAE;AACV,IAAA,MAAM,IAAIE,KAAK,CAAC,8CAA8C,CAAC,CAAA;AACnE,GAAA;AACA,EAAA,OAAOF,OAAO,CAAA;AAClB,EAAC;IAEYG,QAAQ,GAAG,SAAXA,QAAQA,GAAS;AAC1B,EAAA,IAAAC,cAAA,GAAiCL,aAAa,EAAE;IAAxCM,SAAS,GAAAD,cAAA,CAATC,SAAS;IAAEC,SAAS,GAAAF,cAAA,CAATE,SAAS,CAAA;EAC5B,OAAO;AAAED,IAAAA,SAAS,EAATA,SAAS;AAAEC,IAAAA,SAAS,EAATA,SAAAA;GAAW,CAAA;AACnC,EAAC;A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qB,OAAO,CAAC,CAAA;QACzCrB,mBAAmB,CAACqB,OAAO,GAAG,IAAI,CAAA;AACtC,OAAA;AACJ,KAAC,EAAE,CAAClD,OAAO,CAAC,CAAC,CAAA;AAEbsD,IAAAA,eAAS,CAAC,YAAM;MACZ,IAAItD,OAAO,IAAIqB,SAAS,EAAE;AACtBM,QAAAA,WAAW,CAACuB,OAAO,GAAGE,UAAU,CAAC,YAAM;AACnC7D,UAAAA,SAAS,EAAE,CAAA;SACd,EAAES,OAAO,CAAC,CAAA;AACf,OAAA;AACJ,KAAC,EAAE,CAACqB,SAAS,EAAErB,OAAO,CAAC,CAAC,CAAA;AAExB,IAAA,oBACIuD,KAAA,CAAAC,aAAA,CAAC1E,YAAY,CAAC2E,QAAQ,EAAA;AAACC,MAAAA,KAAK,EAAE;AAAEpE,QAAAA,SAAS,EAATA,SAAS;AAAEC,QAAAA,SAAS,EAATA,SAAS;AAAE8B,QAAAA,SAAS,EAATA,SAAS;AAAEM,QAAAA,WAAW,EAAXA,WAAW;AAAEE,QAAAA,mBAAmB,EAAnBA,mBAAAA;AAAoB,OAAA;AAAE,KAAA,EAC/FZ,QAAQ,EACR,CAACQ,QAAQ,iBAAI8B,KAAA,CAAAC,aAAA,CAAC1C,cAAc,EAAMkB,UAAmB,CACnC,CAAC,CAAA;GAE/B,CAAA;AAAA;;;;;;;"}
@@ -75,7 +75,7 @@ var tooltipRoot = function tooltipRoot(Root) {
75
75
  React.useEffect(function () {
76
76
  var onKeyDown = function onKeyDown(event) {
77
77
  if (event.keyCode === ESCAPE_KEYCODE) {
78
- onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
78
+ onDismiss === null || onDismiss === void 0 || onDismiss();
79
79
  }
80
80
  };
81
81
  window.addEventListener('keydown', onKeyDown);
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.js","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import React, { useEffect, forwardRef, useState } from 'react';\nimport { styled } from '@linaria/react';\n\nimport { RootProps, component } from '../../engines';\nimport { popoverClasses, popoverConfig, popoverTokens } from '../Popover';\nimport { cx } from '../../utils';\n\nimport { TooltipProps } from './Tooltip.types';\nimport { StyledContentLeft, TooltipRoot } from './Tooltip.styles';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { classes, tokens } from './Tooltip.tokens';\n\nconst ESCAPE_KEYCODE = 27;\n\nconst getStringValue = (value?: number | string) => {\n return typeof value === 'number' ? `${value}rem` : value;\n};\n\nconst Popover = component(popoverConfig);\n\nconst StyledPopover = styled(Popover)`\n ${popoverTokens.arrowMaskWidth}: var(${tokens.arrowMaskWidth});\n ${popoverTokens.arrowMaskHeight}: var(${tokens.arrowMaskHeight});\n ${popoverTokens.arrowMaskImage}: var(${tokens.arrowMaskImage});\n ${popoverTokens.arrowBackground}: var(${tokens.arrowBackground});\n ${popoverTokens.arrowHeight}: var(${tokens.arrowHeight});\n ${popoverTokens.arrowEdgeMargin}: var(${tokens.arrowEdgeMargin});\n\n &.${classes.animated} .${popoverClasses.root} {\n transition: opacity 200ms ease-in-out, visibility 200ms ease-in-out;\n }\n`;\n\n/**\n * Компонент для текстовых подсказок. Основное предназначение — подписи к блокам.\n */\n\nexport const tooltipRoot = (Root: RootProps<HTMLDivElement, Omit<TooltipProps, 'isOpen' | 'text'>>) =>\n forwardRef<HTMLDivElement, TooltipProps>(\n (\n {\n id,\n text,\n isOpen,\n isVisible,\n hasArrow = true,\n arrow,\n animated,\n offset = [0, 8],\n minWidth,\n maxWidth,\n placement = 'bottom',\n usePortal = true,\n target,\n children,\n onDismiss,\n view,\n size,\n contentLeft,\n zIndex = '9200',\n className,\n ...rest\n },\n outerRef,\n ) => {\n const [ref, setRef] = useState<HTMLDivElement | null>(null);\n\n // TODO убрать после отказа от старого API\n const innerIsOpen = isVisible || isOpen;\n const innerHasArrow = arrow || hasArrow;\n const showTooltip = innerIsOpen && Boolean(text?.length);\n\n const animatedClass = animated ? classes.animated : undefined;\n\n useEffect(() => {\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.keyCode === ESCAPE_KEYCODE) {\n onDismiss?.();\n }\n };\n\n window.addEventListener('keydown', onKeyDown);\n\n return () => {\n window.removeEventListener('keydown', onKeyDown);\n };\n }, []);\n\n const withContentLeft = contentLeft ? classes.hasContentLeft : undefined;\n\n return (\n <StyledPopover\n isOpen={showTooltip}\n placement={placement}\n offset={offset}\n zIndex={zIndex}\n target={target || children}\n usePortal={usePortal}\n hasArrow={innerHasArrow}\n aria-hidden={!innerIsOpen}\n aria-live=\"polite\"\n role=\"tooltip\"\n className={cx(ref?.classList.toString(), animatedClass, className)}\n // INFO: Прокидываем стили для Popover из Root Tooltip-а\n\n {...rest}\n >\n <Root view={view} size={size} ref={setRef}>\n <TooltipRoot\n ref={outerRef}\n id={id}\n className={cx(withContentLeft)}\n maxWidth={getStringValue(maxWidth)}\n minWidth={getStringValue(minWidth)}\n >\n {contentLeft && <StyledContentLeft>{contentLeft}</StyledContentLeft>}\n {text}\n </TooltipRoot>\n </Root>\n </StyledPopover>\n );\n },\n );\n\nexport const tooltipConfig = {\n name: 'Tooltip',\n tag: 'div',\n layout: tooltipRoot,\n base: '',\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n },\n defaults: {\n view: 'default',\n size: 'm',\n },\n};\n"],"names":["ESCAPE_KEYCODE","getStringValue","value","concat","Popover","component","popoverConfig","_exp","StyledPopover","styled","name","class","propsAsIs","tooltipRoot","Root","forwardRef","_ref","outerRef","id","text","isOpen","isVisible","_ref$hasArrow","hasArrow","arrow","animated","_ref$offset","offset","minWidth","maxWidth","_ref$placement","placement","_ref$usePortal","usePortal","target","children","onDismiss","view","size","contentLeft","_ref$zIndex","zIndex","className","rest","_useState","useState","_useState2","_slicedToArray","ref","setRef","innerIsOpen","innerHasArrow","showTooltip","Boolean","length","animatedClass","classes","undefined","useEffect","onKeyDown","event","keyCode","window","addEventListener","removeEventListener","withContentLeft","hasContentLeft","React","createElement","_extends","role","cx","classList","toString","TooltipRoot","StyledContentLeft","tooltipConfig","tag","layout","base","variations","css","viewCSS","sizeCSS","defaults"],"mappings":";;;;;;;;;;;;;;;;;AAaA,IAAMA,cAAc,GAAG,EAAE,CAAA;AAEzB,IAAMC,cAAc,GAAGA,SAAjBA,cAAcA,CAAIC,KAAuB,EAAK;EAChD,OAAO,OAAOA,KAAK,KAAK,QAAQ,MAAAC,MAAA,CAAMD,KAAM,EAAA,KAAA,CAAA,GAAOA,KAAK,CAAA;AAC5D,CAAC,CAAA;AAED,IAAME,OAAO,gBAAGC,gBAAS,CAACC,uBAAa,CAAC,CAAA;AAAC,IAAAC,IAAA,GAlBvBA,SAkBuBA,IAAAA,GAAA;AAAA,EAAA,OAEZH,OAAO,CAAA;AAAA,CAAA,CAAA;AAApC,IAAMI,aAAa,gBAAGC,YAAM,CAAAF,IAAA,EAAA,CAAA,CAAA;AAAAG,EAAAA,IAAA,EAAA,eAAA;AAAAC,EAAAA,OAAAA,EAAA,UAAA;AAAAC,EAAAA,SAAA,EAAA,IAAA;AAAA,CAW3B,CAAA,CAAA;;AAED;AACA;AACA;;IAEaC,WAAW,GAAGA,SAAdA,WAAWA,CAAIC,IAAsE,EAAA;AAAA,EAAA,oBAC9FC,gBAAU,CACN,UAAAC,IAAA,EAwBIC,QAAQ,EACP;AAAA,IAAA,IAvBGC,EAAE,GAAAF,IAAA,CAAFE,EAAE;MACFC,IAAI,GAAAH,IAAA,CAAJG,IAAI;MACJC,MAAM,GAAAJ,IAAA,CAANI,MAAM;MACNC,SAAS,GAAAL,IAAA,CAATK,SAAS;MAAAC,aAAA,GAAAN,IAAA,CACTO,QAAQ;AAARA,MAAAA,QAAQ,GAAAD,aAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,aAAA;MACfE,KAAK,GAAAR,IAAA,CAALQ,KAAK;MACLC,QAAQ,GAAAT,IAAA,CAARS,QAAQ;MAAAC,WAAA,GAAAV,IAAA,CACR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AAAA,QAAQ,EAAE;AACN/C,IAAAA,IAAI,EAAE,SAAS;AACfC,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;;"}
1
+ {"version":3,"file":"Tooltip.js","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import React, { useEffect, forwardRef, useState } from 'react';\nimport { styled } from '@linaria/react';\n\nimport { RootProps, component } from '../../engines';\nimport { popoverClasses, popoverConfig, popoverTokens } from '../Popover';\nimport { cx } from '../../utils';\n\nimport { TooltipProps } from './Tooltip.types';\nimport { StyledContentLeft, TooltipRoot } from './Tooltip.styles';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { classes, tokens } from './Tooltip.tokens';\n\nconst ESCAPE_KEYCODE = 27;\n\nconst getStringValue = (value?: number | string) => {\n return typeof value === 'number' ? `${value}rem` : value;\n};\n\nconst Popover = component(popoverConfig);\n\nconst StyledPopover = styled(Popover)`\n ${popoverTokens.arrowMaskWidth}: var(${tokens.arrowMaskWidth});\n ${popoverTokens.arrowMaskHeight}: var(${tokens.arrowMaskHeight});\n ${popoverTokens.arrowMaskImage}: var(${tokens.arrowMaskImage});\n ${popoverTokens.arrowBackground}: var(${tokens.arrowBackground});\n ${popoverTokens.arrowHeight}: var(${tokens.arrowHeight});\n ${popoverTokens.arrowEdgeMargin}: var(${tokens.arrowEdgeMargin});\n\n &.${classes.animated} .${popoverClasses.root} {\n transition: opacity 200ms ease-in-out, visibility 200ms ease-in-out;\n }\n`;\n\n/**\n * Компонент для текстовых подсказок. Основное предназначение — подписи к блокам.\n */\n\nexport const tooltipRoot = (Root: RootProps<HTMLDivElement, Omit<TooltipProps, 'isOpen' | 'text'>>) =>\n forwardRef<HTMLDivElement, TooltipProps>(\n (\n {\n id,\n text,\n isOpen,\n isVisible,\n hasArrow = true,\n arrow,\n animated,\n offset = [0, 8],\n minWidth,\n maxWidth,\n placement = 'bottom',\n usePortal = true,\n target,\n children,\n onDismiss,\n view,\n size,\n contentLeft,\n zIndex = '9200',\n className,\n ...rest\n },\n outerRef,\n ) => {\n const [ref, setRef] = useState<HTMLDivElement | null>(null);\n\n // TODO убрать после отказа от старого API\n const innerIsOpen = isVisible || isOpen;\n const innerHasArrow = arrow || hasArrow;\n const showTooltip = innerIsOpen && Boolean(text?.length);\n\n const animatedClass = animated ? classes.animated : undefined;\n\n useEffect(() => {\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.keyCode === ESCAPE_KEYCODE) {\n onDismiss?.();\n }\n };\n\n window.addEventListener('keydown', onKeyDown);\n\n return () => {\n window.removeEventListener('keydown', onKeyDown);\n };\n }, []);\n\n const withContentLeft = contentLeft ? classes.hasContentLeft : undefined;\n\n return (\n <StyledPopover\n isOpen={showTooltip}\n placement={placement}\n offset={offset}\n zIndex={zIndex}\n target={target || children}\n usePortal={usePortal}\n hasArrow={innerHasArrow}\n aria-hidden={!innerIsOpen}\n aria-live=\"polite\"\n role=\"tooltip\"\n className={cx(ref?.classList.toString(), animatedClass, className)}\n // INFO: Прокидываем стили для Popover из Root Tooltip-а\n\n {...rest}\n >\n <Root view={view} size={size} ref={setRef}>\n <TooltipRoot\n ref={outerRef}\n id={id}\n className={cx(withContentLeft)}\n maxWidth={getStringValue(maxWidth)}\n minWidth={getStringValue(minWidth)}\n >\n {contentLeft && <StyledContentLeft>{contentLeft}</StyledContentLeft>}\n {text}\n </TooltipRoot>\n </Root>\n </StyledPopover>\n );\n },\n );\n\nexport const tooltipConfig = {\n name: 'Tooltip',\n tag: 'div',\n layout: tooltipRoot,\n base: '',\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n },\n defaults: {\n view: 'default',\n size: 'm',\n },\n};\n"],"names":["ESCAPE_KEYCODE","getStringValue","value","concat","Popover","component","popoverConfig","_exp","StyledPopover","styled","name","class","propsAsIs","tooltipRoot","Root","forwardRef","_ref","outerRef","id","text","isOpen","isVisible","_ref$hasArrow","hasArrow","arrow","animated","_ref$offset","offset","minWidth","maxWidth","_ref$placement","placement","_ref$usePortal","usePortal","target","children","onDismiss","view","size","contentLeft","_ref$zIndex","zIndex","className","rest","_useState","useState","_useState2","_slicedToArray","ref","setRef","innerIsOpen","innerHasArrow","showTooltip","Boolean","length","animatedClass","classes","undefined","useEffect","onKeyDown","event","keyCode","window","addEventListener","removeEventListener","withContentLeft","hasContentLeft","React","createElement","_extends","role","cx","classList","toString","TooltipRoot","StyledContentLeft","tooltipConfig","tag","layout","base","variations","css","viewCSS","sizeCSS","defaults"],"mappings":";;;;;;;;;;;;;;;;;AAaA,IAAMA,cAAc,GAAG,EAAE,CAAA;AAEzB,IAAMC,cAAc,GAAGA,SAAjBA,cAAcA,CAAIC,KAAuB,EAAK;EAChD,OAAO,OAAOA,KAAK,KAAK,QAAQ,MAAAC,MAAA,CAAMD,KAAM,EAAA,KAAA,CAAA,GAAOA,KAAK,CAAA;AAC5D,CAAC,CAAA;AAED,IAAME,OAAO,gBAAGC,gBAAS,CAACC,uBAAa,CAAC,CAAA;AAAC,IAAAC,IAAA,GAlBvBA,SAkBuBA,IAAAA,GAAA;AAAA,EAAA,OAEZH,OAAO,CAAA;AAAA,CAAA,CAAA;AAApC,IAAMI,aAAa,gBAAGC,YAAM,CAAAF,IAAA,EAAA,CAAA,CAAA;AAAAG,EAAAA,IAAA,EAAA,eAAA;AAAAC,EAAAA,OAAAA,EAAA,UAAA;AAAAC,EAAAA,SAAA,EAAA,IAAA;AAAA,CAW3B,CAAA,CAAA;;AAED;AACA;AACA;;IAEaC,WAAW,GAAGA,SAAdA,WAAWA,CAAIC,IAAsE,EAAA;AAAA,EAAA,oBAC9FC,gBAAU,CACN,UAAAC,IAAA,EAwBIC,QAAQ,EACP;AAAA,IAAA,IAvBGC,EAAE,GAAAF,IAAA,CAAFE,EAAE;MACFC,IAAI,GAAAH,IAAA,CAAJG,IAAI;MACJC,MAAM,GAAAJ,IAAA,CAANI,MAAM;MACNC,SAAS,GAAAL,IAAA,CAATK,SAA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BkE,EAAAA,IAAI,EAAE,EAAE;AACRC,EAAAA,UAAU,EAAE;AACR3C,IAAAA,IAAI,EAAE;AACF4C,MAAAA,GAAG,EAAEC,SAAAA;KACR;AACD5C,IAAAA,IAAI,EAAE;AACF2C,MAAAA,GAAG,EAAEE,WAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACN/C,IAAAA,IAAI,EAAE,SAAS;AACfC,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;;"}
package/cjs/index.css CHANGED
@@ -14,6 +14,11 @@
14
14
  .Button_styles_uqvh6u_l4dfhbg__b7cda4d5{position:absolute;}
15
15
  .Button_styles_uqvh6u_srdlazt__b7cda4d5{--plasma-spinner-size:var(--plasma-button-spinner-size);--plasma-spinner-color:var(--plasma-button-spinner-color);}
16
16
 
17
+ .IconButton_styles_gh8fim_b1ua728l__7324c12e.IconButton_styles_gh8fim_b1ua728l__7324c12e.IconButton_styles_gh8fim_iconButtonItem__7324c12e{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}
18
+ .IconButton_styles_gh8fim_i5roq7j__7324c12e{--plasma-button-color:var(--plasma-icon-button-color);--plasma-button-background-color:var(--plasma-icon-button-background-color);--plasma-button-color-hover:var(--plasma-icon-button-color-hover);--plasma-button-background-color-hover:var(--plasma-icon-button-background-color-hover);--plasma-button-color-active:var(--plasma-icon-button-color-active);--plasma-button-background-color-active:var(--plasma-icon-button-background-color-active);--plasma-button-font-family:var(--plasma-icon-button-font-family);--plasma-button-font-size:var(--plasma-icon-button-font-size);--plasma-button-font-style:var(--plasma-icon-button-font-style);--plasma-button-font-weight:var(--plasma-icon-button-font-weight);--plasma-button-letter-spacing:var(--plasma-icon-button-letter-spacing);--plasma-button-line-height:var(--plasma-icon-button-line-height);--plasma-button-width:var(--plasma-icon-button-width);--plasma-button-height:var(--plasma-icon-button-height);--plasma-button-radius:var(--plasma-icon-button-radius);--plasma-button-disabled-opacity:var(--plasma-icon-button-disabled-opacity);--plasma-button-focus-color:var(--plasma-icon-button-focus-color);--plasma-button-spinner-size:var(--plasma-icon-button-spinner-size);--plasma-button-spinner-color:var(--plasma-icon-button-spinner-color);}
19
+ .IconButton_styles_gh8fim_lhwest8__7324c12e{position:absolute;}
20
+ .IconButton_styles_gh8fim_sudin8m__7324c12e{--plasma-spinner-size:var(--plasma-icon-button-spinner-size);--plasma-spinner-color:var(--plasma-icon-button-spinner-color);}
21
+
17
22
  .base_6k3uip_b7jdqtc__e6616a37.base_6k3uip_buttonGroupOverrideStyles__e6616a37 .base_6k3uip_buttonItem__e6616a37{--plasma-button-color:var(--plasma-button-group-item-color);--plasma-button-background-color:var(--plasma-button-group-item-background-color);--plasma-button-color-hover:var(--plasma-button-group-item-color-hover);--plasma-button-background-color-hover:var(--plasma-button-group-item-background-color-hover);--plasma-button-color-active:var(--plasma-button-group-item-color-active);--plasma-button-background-color-active:var(--plasma-button-group-item-background-color-active);}
18
23
 
19
24
  .base_xxxewc_bc0nfse__e70323a1.base_xxxewc_buttonGroupOverrideStyles__e70323a1 .base_xxxewc_buttonItem__e70323a1{--plasma-button-height:var(--plasma-button-group-item-height);--plasma-button-padding:var(--plasma-button-group-item-padding);---plasma-button-scale-active:var(--plasma-button-group-item-scale-active);--plasma-button-scale-hover:var(--plasma-button-group-item-scale-hover);--plasma-button-font-family:var(--plasma-button-group-item-font-family);--plasma-button-font-size:var(--plasma-button-group-item-font-size);--plasma-button-font-style:var(--plasma-button-group-item-font-style);--plasma-button-font-weight:var(--plasma-button-group-item-font-weight);--plasma-button-letter-spacing:var(--plasma-button-group-item-letter-spacing);--plasma-button-line-height:var(--plasma-button-group-item-line-height);}
@@ -275,8 +280,8 @@
275
280
 
276
281
  .base_ydejlv_b175yas1__99ab42b5{--plasma-panel-border-radius:var(--plasma-drawer-border-radius);}
277
282
 
278
- .Dropdown_styles_13400l5_sn7uamp__84327758 .Dropdown_styles_13400l5_popoverWrapper__84327758,.Dropdown_styles_13400l5_sn7uamp__84327758 .Dropdown_styles_13400l5_popoverTarget__84327758{display:block;}
279
- .Dropdown_styles_13400l5_sjr7fmv__84327758{box-sizing:border-box;background:var(--plasma-dropdown-background);box-shadow:var(--plasma-dropdown-box-shadow);border-radius:var(--plasma-dropdown-border-radius);width:var(--plasma-dropdown-width);height:var(--plasma-dropdown-height);padding:var(--plasma-dropdown-padding-top) var(--plasma-dropdown-padding-right) var(--plasma-dropdown-padding-bottom) var(--plasma-dropdown-padding-left);}
283
+ .Dropdown_styles_1daxhqh_sn7uamp__488e0a19 .Dropdown_styles_1daxhqh_popoverTarget__488e0a19{display:block;}
284
+ .Dropdown_styles_1daxhqh_sjr7fmv__488e0a19{box-sizing:border-box;background:var(--plasma-dropdown-background);box-shadow:var(--plasma-dropdown-box-shadow);border-radius:var(--plasma-dropdown-border-radius);width:var(--plasma-dropdown-width);height:var(--plasma-dropdown-height);padding:var(--plasma-dropdown-padding-top) var(--plasma-dropdown-padding-right) var(--plasma-dropdown-padding-bottom) var(--plasma-dropdown-padding-left);}
280
285
 
281
286
  .DropdownDivider_styles_v3xor1_s1brpi5d__3a791565{background:var(--plasma-dropdown-divider-color);width:var(--plasma-dropdown-divider-width);height:var(--plasma-dropdown-divider-height);margin:var(--plasma-dropdown-divider-margin-top) var(--plasma-dropdown-divider-margin-right) var(--plasma-dropdown-divider-margin-bottom) var(--plasma-dropdown-divider-margin-left);}
282
287
 
package/cjs/index.js CHANGED
@@ -20,6 +20,8 @@ var useDidMountEffect = require('./hooks/useDidMountEffect.js');
20
20
  var index$1 = require('./utils/index.js');
21
21
  var Button = require('./components/Button/Button.js');
22
22
  var Button_tokens = require('./components/Button/Button.tokens.js');
23
+ var IconButton = require('./components/IconButton/IconButton.js');
24
+ var IconButton_tokens = require('./components/IconButton/IconButton.tokens.js');
23
25
  var ButtonGroup = require('./components/ButtonGroup/ButtonGroup.js');
24
26
  var ButtonGroup_tokens = require('./components/ButtonGroup/ButtonGroup.tokens.js');
25
27
  var Chip = require('./components/Chip/Chip.js');
@@ -90,7 +92,6 @@ var DrawerHeader = require('./components/Drawer/ui/DrawerHeader/DrawerHeader.js'
90
92
  var Drawer_tokens = require('./components/Drawer/Drawer.tokens.js');
91
93
  var Dropdown = require('./components/Dropdown/Dropdown.js');
92
94
  var Dropdown_tokens = require('./components/Dropdown/Dropdown.tokens.js');
93
- var useKeyboardNavigation = require('./components/Dropdown/hooks/useKeyboardNavigation.js');
94
95
  var DropdownDivider = require('./components/Dropdown/ui/DropdownDivider/DropdownDivider.js');
95
96
  var DropdownFooter = require('./components/Dropdown/ui/DropdownFooter/DropdownFooter.js');
96
97
  var DropdownGroup = require('./components/Dropdown/ui/DropdownGroup/DropdownGroup.js');
@@ -253,6 +254,10 @@ exports.buttonConfig = Button.buttonConfig;
253
254
  exports.buttonRoot = Button.buttonRoot;
254
255
  exports.buttonClasses = Button_tokens.classes;
255
256
  exports.buttonTokens = Button_tokens.tokens;
257
+ exports.iconButtonConfig = IconButton.iconButtonConfig;
258
+ exports.iconButtonRoot = IconButton.iconButtonRoot;
259
+ exports.iconButtonClasses = IconButton_tokens.classes;
260
+ exports.iconButtonTokens = IconButton_tokens.tokens;
256
261
  exports.buttonGroupConfig = ButtonGroup.buttonGroupConfig;
257
262
  exports.buttonGroupRoot = ButtonGroup.buttonGroupRoot;
258
263
  exports.buttonGroupClasses = ButtonGroup_tokens.classes;
@@ -371,7 +376,6 @@ exports.dropdownConfig = Dropdown.dropdownConfig;
371
376
  exports.dropdownRoot = Dropdown.dropdownRoot;
372
377
  exports.dropdownClasses = Dropdown_tokens.classes;
373
378
  exports.dropdownTokens = Dropdown_tokens.tokens;
374
- exports.useDropdownKeyNavigation = useKeyboardNavigation.useKeyNavigation;
375
379
  exports.dropdownDividerConfig = DropdownDivider.dropdownDividerConfig;
376
380
  exports.dropdownDividerRoot = DropdownDivider.dropdownDividerRoot;
377
381
  exports.dropdownFooterConfig = DropdownFooter.dropdownFooterConfig;
package/cjs/index.js.map CHANGED
@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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -58,7 +58,7 @@ function _toPrimitive(t, r) {
58
58
  }
59
59
  function _toPropertyKey(t) {
60
60
  var i = _toPrimitive(t, "string");
61
- return "symbol" == typeof i ? i : String(i);
61
+ return "symbol" == typeof i ? i : i + "";
62
62
  }
63
63
  function _typeof(o) {
64
64
  "@babel/helpers - typeof";
@@ -1,5 +1,5 @@
1
1
  import './Avatar_13f2qzh.css';
2
- import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
+ import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
3
3
  import React, { forwardRef, useMemo } from 'react';
4
4
  import { styled } from '@linaria/react';
5
5
  import '@linaria/core';
@@ -12,7 +12,11 @@ import { base as base$1 } from './variations/_size/base.js';
12
12
  import { base as base$2 } from './variations/_focused/base.js';
13
13
  import { getInitialsForName } from './utils/getInitialsForName.js';
14
14
 
15
- var _excluded = ["size", "name", "url", "customText", "status", "className", "focused", "isScalable"];
15
+ var _excluded = ["size", "name", "url", "customText", "status", "className", "focused", "isScalable", "statusLabels"];
16
+ var StatusLabelsDefault = {
17
+ active: 'Активен',
18
+ inactive: 'Неактивен'
19
+ };
16
20
  var getAvatarContent = function getAvatarContent(_ref) {
17
21
  var customText = _ref.customText,
18
22
  url = _ref.url,
@@ -29,14 +33,28 @@ var getAvatarContent = function getAvatarContent(_ref) {
29
33
  }
30
34
  return /*#__PURE__*/React.createElement(Text, null, initials);
31
35
  };
36
+ var getAriaLabel = function getAriaLabel(_ref2) {
37
+ var url = _ref2.url,
38
+ name = _ref2.name,
39
+ status = _ref2.status,
40
+ ariaLabelProp = _ref2['aria-label'],
41
+ statusLabels = _ref2.statusLabels;
42
+ if (!url) {
43
+ return;
44
+ }
45
+
46
+ // INFO: включаем aria-label чтобы озвучить что на изображении
47
+ var ariaLabel = !ariaLabelProp || ariaLabelProp.trim() === '' ? name : ariaLabelProp;
48
+ return status ? "".concat(ariaLabel, ". ").concat(statusLabels[status]) : ariaLabel;
49
+ };
32
50
  var mergedConfig = /*#__PURE__*/mergeConfig(indicatorConfig);
33
51
  var Indicator = /*#__PURE__*/component(mergedConfig);
34
52
  var _exp = function _exp() {
35
53
  return Indicator;
36
54
  };
37
55
  var _exp5 = function _exp5() {
38
- return function (_ref2) {
39
- var status = _ref2.status;
56
+ return function (_ref3) {
57
+ var status = _ref3.status;
40
58
  return status === 'active' ? "var(".concat(tokens.statusOnlineColor, ")") : "var(".concat(tokens.statusOfflineColor, ")");
41
59
  };
42
60
  };
@@ -59,14 +77,20 @@ var avatarRoot = function avatarRoot(Root) {
59
77
  _props$focused = props.focused,
60
78
  focused = _props$focused === void 0 ? true : _props$focused,
61
79
  isScalable = props.isScalable,
80
+ _props$statusLabels = props.statusLabels,
81
+ statusLabels = _props$statusLabels === void 0 ? StatusLabelsDefault : _props$statusLabels,
62
82
  rest = _objectWithoutProperties(props, _excluded);
63
83
  var initials = useMemo(function () {
64
84
  return getInitialsForName(name);
65
85
  }, [name]);
86
+ var ariaLabel = getAriaLabel(_objectSpread2(_objectSpread2({}, props), {}, {
87
+ statusLabels: statusLabels
88
+ }));
66
89
  return /*#__PURE__*/React.createElement(Root, _extends({
67
90
  ref: ref,
68
91
  size: avatarSize,
69
92
  className: cx(classes.avatarItem, className),
93
+ "aria-label": ariaLabel,
70
94
  focused: focused
71
95
  }, rest), /*#__PURE__*/React.createElement(Wrapper, {
72
96
  isScalable: isScalable
@@ -76,6 +100,7 @@ var avatarRoot = function avatarRoot(Root) {
76
100
  initials: initials,
77
101
  name: name
78
102
  })), status && /*#__PURE__*/React.createElement(StatusIcon, null, /*#__PURE__*/React.createElement(StyledIndicator, {
103
+ "aria-label": statusLabels[status],
79
104
  status: status
80
105
  })));
81
106
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Avatar.js","sources":["../../../src/components/Avatar/Avatar.tsx"],"sourcesContent":["import React, { forwardRef, useMemo, ReactElement } from 'react';\nimport { styled } from '@linaria/react';\n\nimport { RootProps, component, mergeConfig } from '../../engines';\nimport { cx } from '../../utils';\nimport { indicatorConfig, indicatorTokens } from '../Indicator';\n\nimport { classes, tokens } from './Avatar.tokens';\nimport { base, Wrapper, Image, StatusIcon, Text } from './Avatar.styles';\nimport { AvatarProps } from './Avatar.types';\nimport { base as viewCSS } from './variations/_size/base';\nimport { base as focusedCSS } from './variations/_focused/base';\nimport { getInitialsForName } from './utils';\n\nconst getAvatarContent = ({\n customText,\n url,\n initials,\n name,\n}: Omit<AvatarProps, 'size'> & { initials?: string }): ReactElement => {\n if (customText) {\n return <Text>{customText}</Text>;\n }\n\n if (url) {\n return <Image src={url} alt={name} />;\n }\n\n return <Text>{initials}</Text>;\n};\n\nconst mergedConfig = mergeConfig(indicatorConfig);\nconst Indicator: React.FunctionComponent<\n React.HTMLAttributes<HTMLDivElement> & { status: AvatarProps['status'] }\n> = component(mergedConfig) as never;\n\nconst StyledIndicator = styled(Indicator)`\n ${indicatorTokens.size}: var(${tokens.statusIconSize});\n ${indicatorTokens.color}: ${({ status }) =>\n status === 'active' ? `var(${tokens.statusOnlineColor})` : `var(${tokens.statusOfflineColor})`}\n`;\n\nexport const avatarRoot = (Root: RootProps<HTMLDivElement, AvatarProps>) => {\n return forwardRef<HTMLDivElement, AvatarProps>((props, ref) => {\n const {\n size: avatarSize,\n name,\n url,\n customText,\n status,\n className,\n focused = true,\n isScalable,\n ...rest\n } = props;\n\n const initials = useMemo(() => getInitialsForName(name), [name]);\n\n return (\n <Root ref={ref} size={avatarSize} className={cx(classes.avatarItem, className)} focused={focused} {...rest}>\n <Wrapper isScalable={isScalable}>{getAvatarContent({ customText, url, initials, name })}</Wrapper>\n\n {status && (\n <StatusIcon>\n <StyledIndicator status={status} />\n </StatusIcon>\n )}\n </Root>\n );\n });\n};\n\nexport const avatarConfig = {\n name: 'Avatar',\n tag: 'div',\n layout: avatarRoot,\n base,\n variations: {\n size: {\n css: viewCSS,\n },\n focused: {\n css: focusedCSS,\n },\n },\n defaults: {\n size: 'm',\n },\n};\n"],"names":["getAvatarContent","_ref","customText","url","initials","name","React","createElement","Text","Image","src","alt","mergedConfig","mergeConfig","indicatorConfig","Indicator","component","_exp","_exp5","_ref2","status","concat","tokens","statusOnlineColor","statusOfflineColor","StyledIndicator","styled","class","propsAsIs","vars","avatarRoot","Root","forwardRef","props","ref","avatarSize","size","className","_props$focused","focused","isScalable","rest","_excluded","useMemo","getInitialsForName","_extends","cx","classes","avatarItem","Wrapper","StatusIcon","avatarConfig","tag","layout","base","variations","css","viewCSS","focusedCSS","defaults"],"mappings":";;;;;;;;;;;;;;AAcA,IAAMA,gBAAgB,GAAGA,SAAnBA,gBAAgBA,CAAAC,IAAA,EAKiD;AAAA,EAAA,IAJnEC,UAAU,GAAAD,IAAA,CAAVC,UAAU;IACVC,GAAG,GAAAF,IAAA,CAAHE,GAAG;IACHC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;IACRC,IAAAA,GAAAA,IAAAA,CAAAA,IAAAA,CAAAA;AAEA,EAAA,IAAIH,UAAU,EAAE;AACZ,IAAA,oBAAOI,KAAA,CAAAC,aAAA,CAACC,IAAI,EAAA,IAAA,EAAEN,UAAiB,CAAC,CAAA;AACpC,GAAA;AAEA,EAAA,IAAIC,GAAG,EAAE;AACL,IAAA,oBAAOG,KAAA,CAAAC,aAAA,CAACE,KAAK,EAAA;AAACC,MAAAA,GAAG,EAAEP,GAAI;AAACQ,MAAAA,GAAG,EAAEN,IAAAA;AAAK,KAAG,CAAA,CAAA;AACzC,GAAA;AAEA,EAAA,oBAAOC,KAAA,CAAAC,aAAA,CAACC,IAAI,EAAA,IAAA,EAAEJ,QAAe,CAAC,CAAA;AAClC,CAAC,CAAA;AAED,IAAMQ,YAAY,gBAAGC,WAAW,CAACC,eAAe,CAAC,CAAA;AACjD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AAE;AACRnB,IAAAA,IAAI,EAAE;AACFoB,MAAAA,GAAG,EAAEC,MAAAA;KACR;AACDlB,IAAAA,OAAO,EAAE;AACLiB,MAAAA,GAAG,EAAEE,MAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNvB,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
1
+ {"version":3,"file":"Avatar.js","sources":["../../../src/components/Avatar/Avatar.tsx"],"sourcesContent":["import React, { forwardRef, useMemo, ReactElement } from 'react';\nimport { styled } from '@linaria/react';\n\nimport { RootProps, component, mergeConfig } from '../../engines';\nimport { cx } from '../../utils';\nimport { indicatorConfig, indicatorTokens } from '../Indicator';\n\nimport { classes, tokens } from './Avatar.tokens';\nimport { base, Wrapper, Image, StatusIcon, Text } from './Avatar.styles';\nimport { base as viewCSS } from './variations/_size/base';\nimport { base as focusedCSS } from './variations/_focused/base';\nimport { getInitialsForName } from './utils';\nimport type { AvatarProps, StatusLabels } from './Avatar.types';\n\nconst StatusLabelsDefault: StatusLabels = {\n active: 'Активен',\n inactive: 'Неактивен',\n};\n\nconst getAvatarContent = ({\n customText,\n url,\n initials,\n name,\n}: Omit<AvatarProps, 'size'> & { initials?: string }): ReactElement => {\n if (customText) {\n return <Text>{customText}</Text>;\n }\n\n if (url) {\n return <Image src={url} alt={name} />;\n }\n\n return <Text>{initials}</Text>;\n};\n\nconst getAriaLabel = ({\n url,\n name,\n status,\n 'aria-label': ariaLabelProp,\n statusLabels,\n}: Pick<AvatarProps, 'url' | 'status' | 'name' | 'aria-label'> & {\n statusLabels: StatusLabels;\n}) => {\n if (!url) {\n return;\n }\n\n // INFO: включаем aria-label чтобы озвучить что на изображении\n const ariaLabel = !ariaLabelProp || ariaLabelProp.trim() === '' ? name : ariaLabelProp;\n\n return status ? `${ariaLabel}. ${statusLabels[status]}` : ariaLabel;\n};\n\nconst mergedConfig = mergeConfig(indicatorConfig);\n\nconst Indicator: React.FunctionComponent<\n React.HTMLAttributes<HTMLDivElement> & { status: AvatarProps['status'] }\n> = component(mergedConfig) as never;\n\nconst StyledIndicator = styled(Indicator)`\n ${indicatorTokens.size}: var(${tokens.statusIconSize});\n ${indicatorTokens.color}: ${({ status }) =>\n status === 'active' ? `var(${tokens.statusOnlineColor})` : `var(${tokens.statusOfflineColor})`}\n`;\n\nexport const avatarRoot = (Root: RootProps<HTMLDivElement, AvatarProps>) => {\n return forwardRef<HTMLDivElement, AvatarProps>((props, ref) => {\n const {\n size: avatarSize,\n name,\n url,\n customText,\n status,\n className,\n focused = true,\n isScalable,\n statusLabels = StatusLabelsDefault,\n ...rest\n } = props;\n\n const initials = useMemo(() => getInitialsForName(name), [name]);\n const ariaLabel = getAriaLabel({\n ...props,\n statusLabels,\n });\n\n return (\n <Root\n ref={ref}\n size={avatarSize}\n className={cx(classes.avatarItem, className)}\n aria-label={ariaLabel}\n focused={focused}\n {...rest}\n >\n <Wrapper isScalable={isScalable}>{getAvatarContent({ customText, url, initials, name })}</Wrapper>\n\n {status && (\n <StatusIcon>\n <StyledIndicator aria-label={statusLabels[status]} status={status} />\n </StatusIcon>\n )}\n </Root>\n );\n });\n};\n\nexport const avatarConfig = {\n name: 'Avatar',\n tag: 'div',\n layout: avatarRoot,\n base,\n variations: {\n size: {\n css: viewCSS,\n },\n focused: {\n css: focusedCSS,\n },\n },\n defaults: {\n size: 'm',\n },\n};\n"],"names":["StatusLabelsDefault","active","inactive","getAvatarContent","_ref","customText","url","initials","name","React","createElement","Text","Image","src","alt","getAriaLabel","_ref2","status","ariaLabelProp","statusLabels","ariaLabel","trim","concat","mergedConfig","mergeConfig","indicatorConfig","Indicator","component","_exp","_exp5","_ref3","tokens","statusOnlineColor","statusOfflineColor","StyledIndicator","styled","class","propsAsIs","vars","avatarRoot","Root","forwardRef","props","ref","avatarSize","size","className","_props$focused","focused","isScalable","_props$statusLabels","rest","_excluded","useMemo","getInitialsForName","_objectSpread","_extends","cx","classes","avatarItem","Wrapper","StatusIcon","avatarConf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aAAA,CAACkD,OAAO,EAAA;AAACX,MAAAA,UAAU,EAAEA,UAAAA;AAAW,KAAA,EAAE9C,gBAAgB,CAAC;AAAEE,MAAAA,UAAU,EAAVA,UAAU;AAAEC,MAAAA,GAAG,EAAHA,GAAG;AAAEC,MAAAA,QAAQ,EAARA,QAAQ;AAAEC,MAAAA,IAAAA,EAAAA,IAAAA;AAAK,KAAC,CAAW,CAAA,EAEhGS,MAAM,iBACHR,KAAA,CAAAC,aAAA,CAACmD,UAAU,EACPpD,IAAAA,eAAAA,KAAA,CAAAC,aAAA,CAACwB,eAAe,EAAA;MAAC,YAAYf,EAAAA,YAAY,CAACF,MAAM,CAAE;AAACA,MAAAA,MAAM,EAAEA,MAAAA;KAAO,CAC1D,CAEd,CAAC,CAAA;AAEf,GAAC,CAAC,CAAA;AACN,EAAC;AAEM,IAAM6C,YAAY,GAAG;AACxBtD,EAAAA,IAAI,EAAE,QAAQ;AACduD,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAEzB,UAAU;AAClB0B,EAAAA,IAAI,EAAJA,IAAI;AACJC,EAAAA,UAAU,EAAE;AACRrB,IAAAA,IAAI,EAAE;AACFsB,MAAAA,GAAG,EAAEC,MAAAA;KACR;AACDpB,IAAAA,OAAO,EAAE;AACLmB,MAAAA,GAAG,EAAEE,MAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNzB,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
@@ -149,7 +149,7 @@ var calendarBaseRoot = function calendarBaseRoot(Root) {
149
149
  isOutOfRange = _useKeyNavigation2[4];
150
150
  var handleOnChangeDay = useCallback(function (newDate, coord) {
151
151
  var newDay = new Date(newDate.year, newDate.monthIndex, newDate.day);
152
- onChangeValue === null || onChangeValue === void 0 ? void 0 : onChangeValue(newDay);
152
+ onChangeValue === null || onChangeValue === void 0 || onChangeValue(newDay);
153
153
  onSelectIndexes(coord);
154
154
  }, [onChangeValue, onSelectIndexes]);
155
155
  var handleOnChangeMonth = useCallback(function (monthIndex) {
@@ -1 +1 @@
1
- {"version":3,"file":"CalendarBase.js","sources":["../../../../src/components/Calendar/CalendarBase/CalendarBase.tsx"],"sourcesContent":["import React, { useCallback, useMemo, useReducer, useState, KeyboardEvent, HTMLAttributes, forwardRef } from 'react';\n\nimport type { Calendar, DateObject, UseKeyNavigationProps } from '../Calendar.types';\nimport type { CalendarStateType } from '../store/types';\nimport { getInitialState, reducer } from '../store/reducer';\nimport { ActionType, CalendarState } from '../store/types';\nimport { isValueUpdate, YEAR_RENDER_COUNT } from '../utils';\nimport { useKeyNavigation } from '../hooks';\nimport { CalendarDays, CalendarHeader, CalendarMonths, CalendarYears } from '../ui';\nimport { RootProps } from '../../../engines';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { IsOutOfRange, StyledCalendar } from './CalendarBase.styles';\n\nexport type CalendarBaseProps = HTMLAttributes<HTMLDivElement> &\n Calendar & {\n /**\n * Тип отображения календаря: дни, месяца, года.\n */\n type?: CalendarStateType;\n };\n\n/**\n * Компонент календаря.\n */\nexport const calendarBaseRoot = (Root: RootProps<HTMLDivElement, HTMLAttributes<HTMLDivElement>>) =>\n forwardRef<HTMLDivElement, CalendarBaseProps>(\n (\n { value: externalValue, min, max, type = 'Days', eventList, disabledList, onChangeValue, ...rest },\n outerRootRef,\n ) => {\n const [firstValue, secondValue] = useMemo(\n () => (Array.isArray(externalValue) ? externalValue : [externalValue]),\n [externalValue],\n );\n const value = secondValue || firstValue;\n const [hoveredDay, setHoveredDay] = useState<DateObject | undefined>();\n const [prevType, setPrevType] = useState(type);\n const [prevValue, setPrevValue] = useState(value);\n const [outOfRangeKey, setOutOfRangeKey] = useState<number>(0);\n\n const [state, dispatch] = useReducer(reducer, getInitialState(value, [5, 6], type));\n\n const { date, calendarState, startYear, size } = state;\n\n const handlePrev = useCallback<UseKeyNavigationProps['onPrev']>(\n (withShift = false) => {\n if (calendarState === CalendarState.Days) {\n if (withShift) {\n dispatch({\n type: ActionType.PREVIOUS_YEAR,\n payload: { step: 1 },\n });\n\n return;\n }\n\n dispatch({\n type: ActionType.PREVIOUS_MONTH,\n payload: { monthIndex: date.monthIndex, year: date.year },\n });\n\n return;\n }\n\n if (calendarState === CalendarState.Months) {\n dispatch({ type: ActionType.PREVIOUS_YEAR, payload: { step: 1 } });\n\n return;\n }\n\n if (calendarState === CalendarState.Years) {\n dispatch({ type: ActionType.PREVIOUS_START_YEAR, payload: { yearsCount: YEAR_RENDER_COUNT } });\n }\n },\n [date, calendarState],\n );\n\n const handleNext = useCallback<UseKeyNavigationProps['onNext']>(\n (withShift = false) => {\n if (calendarState === CalendarState.Days) {\n if (withShift) {\n dispatch({\n type: ActionType.NEXT_YEAR,\n payload: { step: 1 },\n });\n\n return;\n }\n\n dispatch({\n type: ActionType.NEXT_MONTH,\n payload: { monthIndex: date.monthIndex, year: date.year },\n });\n\n return;\n }\n\n if (calendarState === CalendarState.Months) {\n dispatch({ type: ActionType.NEXT_YEAR, payload: { step: 1 } });\n\n return;\n }\n\n if (calendarState === CalendarState.Years) {\n dispatch({ type: ActionType.NEXT_START_YEAR, payload: { yearsCount: YEAR_RENDER_COUNT } });\n }\n },\n [date, calendarState],\n );\n\n const [selectIndexes, onKeyDown, onSelectIndexes, outerRefs, isOutOfRange] = useKeyNavigation({\n size,\n onNext: handleNext,\n onPrev: handlePrev,\n });\n\n const handleOnChangeDay = useCallback(\n (newDate: DateObject, coord: number[]) => {\n const newDay = new Date(newDate.year, newDate.monthIndex, newDate.day);\n onChangeValue?.(newDay);\n\n onSelectIndexes(coord);\n },\n [onChangeValue, onSelectIndexes],\n );\n\n const handleOnChangeMonth = useCallback((monthIndex: number) => {\n dispatch({\n type: ActionType.UPDATE_MONTH,\n payload: { calendarState: CalendarState.Days, monthIndex, size: [5, 6] },\n });\n }, []);\n\n const handleOnChangeYear = useCallback((year: number) => {\n dispatch({\n type: ActionType.UPDATE_YEAR,\n payload: { calendarState: CalendarState.Months, year },\n });\n }, []);\n\n const handleUpdateCalendarState = useCallback(\n (newCalendarState: CalendarStateType, newSize: [number, number]) => {\n dispatch({\n type: ActionType.UPDATE_CALENDAR_STATE,\n payload: { calendarState: newCalendarState, size: newSize },\n });\n },\n [],\n );\n\n if (value && prevValue && isValueUpdate(value, prevValue)) {\n dispatch({\n type: ActionType.UPDATE_DATE,\n payload: { value },\n });\n\n setPrevValue(value);\n }\n\n if (prevType !== type) {\n dispatch({\n type: ActionType.UPDATE_CALENDAR_STATE,\n payload: { calendarState: type },\n });\n\n setPrevType(type);\n }\n\n // Изменяем ключ каждый раз как пытаемся перейти на даты которые находятся за пределами min/max ограничений.\n // Это необходимо для того чтобы screen-reader корректно озвучивал уведомление aria-live=\"assertive\"\n // о том что нет доступных дат\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n setOutOfRangeKey((previousState) => Number(!previousState));\n\n onKeyDown(event);\n },\n [onKeyDown],\n );\n\n return (\n <Root ref={outerRootRef} aria-label=\"Выбор даты\" {...rest}>\n {isOutOfRange && (\n <IsOutOfRange\n key={outOfRangeKey}\n aria-atomic=\"true\"\n role=\"alert\"\n aria-live=\"assertive\"\n aria-relevant=\"additions\"\n >\n Далее нет доступных дат.\n </IsOutOfRange>\n )}\n <CalendarHeader\n firstDate={date}\n startYear={startYear}\n type={calendarState}\n onPrev={handlePrev}\n onNext={handleNext}\n onUpdateCalendarState={handleUpdateCalendarState}\n />\n {calendarState === CalendarState.Days && (\n <CalendarDays\n eventList={eventList}\n disabledList={disabledList}\n min={min}\n max={max}\n value={externalValue}\n date={date}\n hoveredDay={hoveredDay}\n selectIndexes={selectIndexes}\n onChangeDay={handleOnChangeDay}\n onHoverDay={setHoveredDay}\n onSetSelected={onSelectIndexes}\n onKeyDown={handleKeyDown}\n outerRefs={outerRefs}\n />\n )}\n {calendarState === CalendarState.Months && (\n <CalendarMonths\n date={date}\n selectIndexes={selectIndexes}\n onChangeMonth={handleOnChangeMonth}\n onSetSelected={onSelectIndexes}\n onKeyDown={onKeyDown}\n outerRefs={outerRefs}\n />\n )}\n {calendarState === CalendarState.Years && (\n <CalendarYears\n date={date}\n startYear={startYear}\n selectIndexes={selectIndexes}\n onChangeYear={handleOnChangeYear}\n onSetSelected={onSelectIndexes}\n onKeyDown={onKeyDown}\n outerRefs={outerRefs}\n />\n )}\n </Root>\n );\n },\n );\n\nexport const calendarBaseConfig = {\n name: 'CalendarBase',\n tag: 'div',\n layout: calendarBaseRoot,\n base: StyledCalendar,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n },\n defaults: {\n view: 'primary',\n size: 'm',\n },\n};\n"],"names":["calendarBaseRoot","Root","forwardRef","_ref","outerRootRef","externalValue","value","min","max","_ref$type","type","eventList","disabledList","onChangeValue","rest","_objectWithoutProperties","_excluded","_useMemo","useMemo","Array","isArray","_useMemo2","_slicedToArray","firstValue","secondValue","_useState","useState","_useState2","hoveredDay","setHoveredDay","_useState3","_useState4","prevType","setPrevType","_useState5","_useState6","prevValue","setPrevValue","_useState7","_useState8","outOfRangeKey","setOutOfRangeKey","_useReducer","useReducer","reducer","getInitialState","_useReducer2","state","dispatch","date","calendarState","startYear","size","handlePrev","useCallback","withShift","arguments","length","undefined","CalendarState","Days","ActionType","PREVIOUS_YEAR","payload","step","PREVIOUS_MONTH","monthIndex","year","Months","Years","PREVIOUS_START_YEAR","yearsCount","YEAR_RENDER_COUNT","handleNext","NEXT_YEAR","NEXT_MONTH","NEXT_START_YEAR","_useKeyNavigation","useKeyNavigation","onNext","onPrev","_useKeyNavigation2","selectIndexes","onKeyDown","onSelectIndexes","outerRefs","isOutOfRange","handleOnChangeDay","newDate","coord","newDay","Date","day","handleOnChangeMonth","UPDATE_MONTH","handleOnChangeYear","UPDATE_YEAR","handleUpdateCalendarState","newCalendarState","newSize","UPDATE_CALENDAR_STATE","isValueUpdate","UPDATE_DATE","handleKeyDown","event","previousState","Number","React","createElement","_extends","ref","IsOutOfRange","key","role","CalendarHeader","firstDate","onUpdateCalendarState","CalendarDays","onChangeDay","onHoverDay","onSetSelected","CalendarMonths","onChangeMonth","CalendarYears","onChangeYear","calendarBaseConfig","name","tag","layout","base","StyledCalendar","variations","view","css","viewCSS","sizeCSS","defaults"],"mappings":";;;;;;;;;;;;;;;AAuBA;AACA;AACA;IACaA,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,IAA+D,EAAA;AAAA,EAAA,oBAC5FC,UAAU,CACN,UAAAC,IAAA,EAEIC,YAAY,EACX;AAAA,IAAA,IAFQC,aAAa,GAAAF,IAAA,CAApBG,KAAK;MAAiBC,GAAG,GAAAJ,IAAA,CAAHI,GAAG;MAAEC,GAAG,GAAAL,IAAA,CAAHK,GAAG;MAAAC,SAAA,GAAAN,IAAA,CAAEO,IAAI;AAAJA,MAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,MAAM,GAAAA,SAAA;MAAEE,SAAS,GAAAR,IAAA,CAATQ,SAAS;MAAEC,YAAY,GAAAT,IAAA,CAAZS,YAAY;MAAEC,aAAa,GAAAV,IAAA,CAAbU,aAAa;AAAKC,MAAAA,IAAI,GAAAC,wBAAA,CAAAZ,IAAA,EAAAa,SAAA,CAAA,CAAA;IAGhG,IAAAC,QAAA,GAAkCC,OAAO,CACrC,YAAA;QAAA,OAAOC,KAAK,CAACC,OAAO,CAACf,aAAa,CAAC,GAAGA,aAAa,GAAG,CAACA,aAAa,CAAC,CAAA;AAAA,OAAC,EACtE,CAACA,aAAa,CAClB,CAAC;MAAAgB,SAAA,GAAAC,cAAA,CAAAL,QAAA,EAAA,CAAA,CAAA;AAHMM,MAAAA,UAAU,GAAAF,SAAA,CAAA,CAAA,CAAA;AAAEG,MAAAA,WAAW,GAAAH,SAAA,CAAA,CAAA,CAAA,CAAA;AAI9B,IAAA,IAAMf,KAAK,GAAGkB,WAAW,IAAID,UAAU,CAAA;AACvC,IAAA,IAAAE,SAA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EAAEA,SAAAA;AAAU,KACxB,CAEH,CAAC,CAAA;AAEf,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMwC,kBAAkB,GAAG;AAC9BC,EAAAA,IAAI,EAAE,cAAc;AACpBC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAEhI,gBAAgB;AACxBiI,EAAAA,IAAI,EAAEC,cAAc;AACpBC,EAAAA,UAAU,EAAE;AACRC,IAAAA,IAAI,EAAE;AACFC,MAAAA,GAAG,EAAEC,IAAAA;KACR;AACDlF,IAAAA,IAAI,EAAE;AACFiF,MAAAA,GAAG,EAAEE,MAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNJ,IAAAA,IAAI,EAAE,SAAS;AACfhF,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
1
+ {"version":3,"file":"CalendarBase.js","sources":["../../../../src/components/Calendar/CalendarBase/CalendarBase.tsx"],"sourcesContent":["import React, { useCallback, useMemo, useReducer, useState, KeyboardEvent, HTMLAttributes, forwardRef } from 'react';\n\nimport type { Calendar, DateObject, UseKeyNavigationProps } from '../Calendar.types';\nimport type { CalendarStateType } from '../store/types';\nimport { getInitialState, reducer } from '../store/reducer';\nimport { ActionType, CalendarState } from '../store/types';\nimport { isValueUpdate, YEAR_RENDER_COUNT } from '../utils';\nimport { useKeyNavigation } from '../hooks';\nimport { CalendarDays, CalendarHeader, CalendarMonths, CalendarYears } from '../ui';\nimport { RootProps } from '../../../engines';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { IsOutOfRange, StyledCalendar } from './CalendarBase.styles';\n\nexport type CalendarBaseProps = HTMLAttributes<HTMLDivElement> &\n Calendar & {\n /**\n * Тип отображения календаря: дни, месяца, года.\n */\n type?: CalendarStateType;\n };\n\n/**\n * Компонент календаря.\n */\nexport const calendarBaseRoot = (Root: RootProps<HTMLDivElement, HTMLAttributes<HTMLDivElement>>) =>\n forwardRef<HTMLDivElement, CalendarBaseProps>(\n (\n { value: externalValue, min, max, type = 'Days', eventList, disabledList, onChangeValue, ...rest },\n outerRootRef,\n ) => {\n const [firstValue, secondValue] = useMemo(\n () => (Array.isArray(externalValue) ? externalValue : [externalValue]),\n [externalValue],\n );\n const value = secondValue || firstValue;\n const [hoveredDay, setHoveredDay] = useState<DateObject | undefined>();\n const [prevType, setPrevType] = useState(type);\n const [prevValue, setPrevValue] = useState(value);\n const [outOfRangeKey, setOutOfRangeKey] = useState<number>(0);\n\n const [state, dispatch] = useReducer(reducer, getInitialState(value, [5, 6], type));\n\n const { date, calendarState, startYear, size } = state;\n\n const handlePrev = useCallback<UseKeyNavigationProps['onPrev']>(\n (withShift = false) => {\n if (calendarState === CalendarState.Days) {\n if (withShift) {\n dispatch({\n type: ActionType.PREVIOUS_YEAR,\n payload: { step: 1 },\n });\n\n return;\n }\n\n dispatch({\n type: ActionType.PREVIOUS_MONTH,\n payload: { monthIndex: date.monthIndex, year: date.year },\n });\n\n return;\n }\n\n if (calendarState === CalendarState.Months) {\n dispatch({ type: ActionType.PREVIOUS_YEAR, payload: { step: 1 } });\n\n return;\n }\n\n if (calendarState === CalendarState.Years) {\n dispatch({ type: ActionType.PREVIOUS_START_YEAR, payload: { yearsCount: YEAR_RENDER_COUNT } });\n }\n },\n [date, calendarState],\n );\n\n const handleNext = useCallback<UseKeyNavigationProps['onNext']>(\n (withShift = false) => {\n if (calendarState === CalendarState.Days) {\n if (withShift) {\n dispatch({\n type: ActionType.NEXT_YEAR,\n payload: { step: 1 },\n });\n\n return;\n }\n\n dispatch({\n type: ActionType.NEXT_MONTH,\n payload: { monthIndex: date.monthIndex, year: date.year },\n });\n\n return;\n }\n\n if (calendarState === CalendarState.Months) {\n dispatch({ type: ActionType.NEXT_YEAR, payload: { step: 1 } });\n\n return;\n }\n\n if (calendarState === CalendarState.Years) {\n dispatch({ type: ActionType.NEXT_START_YEAR, payload: { yearsCount: YEAR_RENDER_COUNT } });\n }\n },\n [date, calendarState],\n );\n\n const [selectIndexes, onKeyDown, onSelectIndexes, outerRefs, isOutOfRange] = useKeyNavigation({\n size,\n onNext: handleNext,\n onPrev: handlePrev,\n });\n\n const handleOnChangeDay = useCallback(\n (newDate: DateObject, coord: number[]) => {\n const newDay = new Date(newDate.year, newDate.monthIndex, newDate.day);\n onChangeValue?.(newDay);\n\n onSelectIndexes(coord);\n },\n [onChangeValue, onSelectIndexes],\n );\n\n const handleOnChangeMonth = useCallback((monthIndex: number) => {\n dispatch({\n type: ActionType.UPDATE_MONTH,\n payload: { calendarState: CalendarState.Days, monthIndex, size: [5, 6] },\n });\n }, []);\n\n const handleOnChangeYear = useCallback((year: number) => {\n dispatch({\n type: ActionType.UPDATE_YEAR,\n payload: { calendarState: CalendarState.Months, year },\n });\n }, []);\n\n const handleUpdateCalendarState = useCallback(\n (newCalendarState: CalendarStateType, newSize: [number, number]) => {\n dispatch({\n type: ActionType.UPDATE_CALENDAR_STATE,\n payload: { calendarState: newCalendarState, size: newSize },\n });\n },\n [],\n );\n\n if (value && prevValue && isValueUpdate(value, prevValue)) {\n dispatch({\n type: ActionType.UPDATE_DATE,\n payload: { value },\n });\n\n setPrevValue(value);\n }\n\n if (prevType !== type) {\n dispatch({\n type: ActionType.UPDATE_CALENDAR_STATE,\n payload: { calendarState: type },\n });\n\n setPrevType(type);\n }\n\n // Изменяем ключ каждый раз как пытаемся перейти на даты которые находятся за пределами min/max ограничений.\n // Это необходимо для того чтобы screen-reader корректно озвучивал уведомление aria-live=\"assertive\"\n // о том что нет доступных дат\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n setOutOfRangeKey((previousState) => Number(!previousState));\n\n onKeyDown(event);\n },\n [onKeyDown],\n );\n\n return (\n <Root ref={outerRootRef} aria-label=\"Выбор даты\" {...rest}>\n {isOutOfRange && (\n <IsOutOfRange\n key={outOfRangeKey}\n aria-atomic=\"true\"\n role=\"alert\"\n aria-live=\"assertive\"\n aria-relevant=\"additions\"\n >\n Далее нет доступных дат.\n </IsOutOfRange>\n )}\n <CalendarHeader\n firstDate={date}\n startYear={startYear}\n type={calendarState}\n onPrev={handlePrev}\n onNext={handleNext}\n onUpdateCalendarState={handleUpdateCalendarState}\n />\n {calendarState === CalendarState.Days && (\n <CalendarDays\n eventList={eventList}\n disabledList={disabledList}\n min={min}\n max={max}\n value={externalValue}\n date={date}\n hoveredDay={hoveredDay}\n selectIndexes={selectIndexes}\n onChangeDay={handleOnChangeDay}\n onHoverDay={setHoveredDay}\n onSetSelected={onSelectIndexes}\n onKeyDown={handleKeyDown}\n outerRefs={outerRefs}\n />\n )}\n {calendarState === CalendarState.Months && (\n <CalendarMonths\n date={date}\n selectIndexes={selectIndexes}\n onChangeMonth={handleOnChangeMonth}\n onSetSelected={onSelectIndexes}\n onKeyDown={onKeyDown}\n outerRefs={outerRefs}\n />\n )}\n {calendarState === CalendarState.Years && (\n <CalendarYears\n date={date}\n startYear={startYear}\n selectIndexes={selectIndexes}\n onChangeYear={handleOnChangeYear}\n onSetSelected={onSelectIndexes}\n onKeyDown={onKeyDown}\n outerRefs={outerRefs}\n />\n )}\n </Root>\n );\n },\n );\n\nexport const calendarBaseConfig = {\n name: 'CalendarBase',\n tag: 'div',\n layout: calendarBaseRoot,\n base: StyledCalendar,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n },\n defaults: {\n view: 'primary',\n size: 'm',\n },\n};\n"],"names":["calendarBaseRoot","Root","forwardRef","_ref","outerRootRef","externalValue","value","min","max","_ref$type","type","eventList","disabledList","onChangeValue","rest","_objectWithoutProperties","_excluded","_useMemo","useMemo","Array","isArray","_useMemo2","_slicedToArray","firstValue","secondValue","_useState","useState","_useState2","hoveredDay","setHoveredDay","_useState3","_useState4","prevType","setPrevType","_useState5","_useState6","prevValue","setPrevValue","_useState7","_useState8","outOfRangeKey","setOutOfRangeKey","_useReducer","useReducer","reducer","getInitialState","_useReducer2","state","dispatch","date","calendarState","startYear","size","handlePrev","useCallback","withShift","arguments","length","undefined","CalendarState","Days","ActionType","PREVIOUS_YEAR","payload","step","PREVIOUS_MONTH","monthIndex","year","Months","Years","PREVIOUS_START_YEAR","yearsCount","YEAR_RENDER_COUNT","handleNext","NEXT_YEAR","NEXT_MONTH","NEXT_START_YEAR","_useKeyNavigation","useKeyNavigation","onNext","onPrev","_useKeyNavigation2","selectIndexes","onKeyDown","onSelectIndexes","outerRefs","isOutOfRange","handleOnChangeDay","newDate","coord","newDay","Date","day","handleOnChangeMonth","UPDATE_MONTH","handleOnChangeYear","UPDATE_YEAR","handleUpdateCalendarState","newCalendarState","newSize","UPDATE_CALENDAR_STATE","isValueUpdate","UPDATE_DATE","handleKeyDown","event","previousState","Number","React","createElement","_extends","ref","IsOutOfRange","key","role","CalendarHeader","firstDate","onUpdateCalendarState","CalendarDays","onChangeDay","onHoverDay","onSetSelected","CalendarMonths","onChangeMonth","CalendarYears","onChangeYear","calendarBaseConfig","name","tag","layout","base","StyledCalendar","variations","view","css","viewCSS","sizeCSS","defaults"],"mappings":";;;;;;;;;;;;;;;AAuBA;AACA;AACA;IACaA,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,IAA+D,EAAA;AAAA,EAAA,oBAC5FC,UAAU,CACN,UAAAC,IAAA,EAEIC,YAAY,EACX;AAAA,IAAA,IAFQC,aAAa,GAAAF,IAAA,CAApBG,KAAK;MAAiBC,GAAG,GAAAJ,IAAA,CAAHI,GAAG;MAAEC,GAAG,GAAAL,IAAA,CAAHK,GAAG;MAAAC,SAAA,GAAAN,IAAA,CAAEO,IAAI;AAAJA,MAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,MAAM,GAAAA,SAAA;MAAEE,SAAS,GAAAR,IAAA,CAATQ,SAAS;MAAEC,YAAY,GAAAT,IAAA,CAAZS,YAAY;MAAEC,aAAa,GAAAV,IAAA,CAAbU,aAAa;AAAKC,MAAAA,IAAI,GAAAC,wBAAA,CAAA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AoB;AACnC2B,MAAAA,aAAa,EAAEpC,eAAgB;AAC/BD,MAAAA,SAAS,EAAEA,SAAU;AACrBE,MAAAA,SAAS,EAAEA,SAAAA;AAAU,KACxB,CACJ,EACAnC,aAAa,KAAKS,aAAa,CAACU,KAAK,iBAClCsC,KAAA,CAAAC,aAAA,CAACe,aAAa,EAAA;AACV1E,MAAAA,IAAI,EAAEA,IAAK;AACXE,MAAAA,SAAS,EAAEA,SAAU;AACrB+B,MAAAA,aAAa,EAAEA,aAAc;AAC7B0C,MAAAA,YAAY,EAAE7B,kBAAmB;AACjCyB,MAAAA,aAAa,EAAEpC,eAAgB;AAC/BD,MAAAA,SAAS,EAAEA,SAAU;AACrBE,MAAAA,SAAS,EAAEA,SAAAA;AAAU,KACxB,CAEH,CAAC,CAAA;AAEf,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMwC,kBAAkB,GAAG;AAC9BC,EAAAA,IAAI,EAAE,cAAc;AACpBC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAEhI,gBAAgB;AACxBiI,EAAAA,IAAI,EAAEC,cAAc;AACpBC,EAAAA,UAAU,EAAE;AACRC,IAAAA,IAAI,EAAE;AACFC,MAAAA,GAAG,EAAEC,IAAAA;KACR;AACDlF,IAAAA,IAAI,EAAE;AACFiF,MAAAA,GAAG,EAAEE,MAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNJ,IAAAA,IAAI,EAAE,SAAS;AACfhF,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
@@ -89,7 +89,7 @@ var calendarDoubleRoot = function calendarDoubleRoot(Root) {
89
89
  outerRefs = _useKeyNavigation2[3];
90
90
  var handleOnChangeDay = useCallback(function (newDate, coord) {
91
91
  var newDay = new Date(newDate.year, newDate.monthIndex, newDate.day);
92
- onChangeValue === null || onChangeValue === void 0 ? void 0 : onChangeValue(newDay);
92
+ onChangeValue === null || onChangeValue === void 0 || onChangeValue(newDay);
93
93
  onSelectIndexes(coord);
94
94
  }, [onChangeValue, onSelectIndexes]);
95
95
  var firstDate = useMemo(function () {
@@ -1 +1 @@
1
- {"version":3,"file":"CalendarDouble.js","sources":["../../../../src/components/Calendar/CalendarDouble/CalendarDouble.tsx"],"sourcesContent":["import React, { useState, useCallback, useMemo, forwardRef, HTMLAttributes } from 'react';\n\nimport type { Calendar, DateObject } from '../Calendar.types';\nimport { getDateFromValue, getNextDate, getPrevDate, isValueUpdate } from '../utils';\nimport { useKeyNavigation } from '../hooks';\nimport { CalendarDays, CalendarHeader } from '../ui';\nimport { RootProps } from '../../../engines/types';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport { StyledCalendar, StyledSeparator, StyledWrapper } from './CalendarDouble.styles';\n\nexport type CalendarDoubleProps = HTMLAttributes<HTMLDivElement> & Calendar;\n\n/**\n * Компонент двойного календаря.\n */\nexport const calendarDoubleRoot = (Root: RootProps<HTMLDivElement, HTMLAttributes<HTMLDivElement>>) =>\n forwardRef<HTMLDivElement, CalendarDoubleProps>(\n ({ value: externalValue, min, max, eventList, disabledList, onChangeValue, ...rest }, outerRootRef) => {\n const [firstValue, secondValue] = useMemo(\n () => (Array.isArray(externalValue) ? externalValue : [externalValue]),\n [externalValue],\n );\n const value = secondValue || firstValue;\n const [hoveredDay, setHoveredDay] = useState<DateObject | undefined>();\n\n const [date, setDate] = useState<DateObject>(getDateFromValue(value));\n const [prevValue, setPrevValue] = useState(value);\n const [doubleDate, setMonths] = useState(() => {\n const nextDate = getDateFromValue(firstValue);\n const [initialYear, initialMonth] = getNextDate(nextDate.year, nextDate.monthIndex);\n\n return {\n monthIndex: [nextDate.monthIndex, initialMonth],\n year: [nextDate.year, initialYear],\n };\n });\n\n const handleMonth = useCallback(\n (getDate: (currentYear: number, currentMonth: number) => number[]) => {\n const [newCurrentYear, newCurrentMonth] = getDate(doubleDate.year[0], doubleDate.monthIndex[0]);\n const [newNextYear, newNextMonth] = getDate(doubleDate.year[1], doubleDate.monthIndex[1]);\n\n setMonths({\n monthIndex: [newCurrentMonth, newNextMonth],\n year: [newCurrentYear, newNextYear],\n });\n },\n [doubleDate],\n );\n\n const handlePrev = useCallback(() => {\n handleMonth(getPrevDate);\n }, [handleMonth]);\n\n const handleNext = useCallback(() => {\n handleMonth(getNextDate);\n }, [handleMonth]);\n\n const [selectIndexes, onKeyDown, onSelectIndexes, outerRefs] = useKeyNavigation({\n isDouble: true,\n size: [11, 6],\n onNext: handleNext,\n onPrev: handlePrev,\n });\n\n const handleOnChangeDay = useCallback(\n (newDate: DateObject, coord: number[]) => {\n const newDay = new Date(newDate.year, newDate.monthIndex, newDate.day);\n onChangeValue?.(newDay);\n\n onSelectIndexes(coord);\n },\n [onChangeValue, onSelectIndexes],\n );\n\n const firstDate = useMemo(\n () => ({\n day: date.day,\n year: doubleDate.year[0],\n monthIndex: doubleDate.monthIndex[0],\n }),\n [date, doubleDate],\n );\n\n const secondDate = useMemo(\n () => ({\n day: date.day,\n year: doubleDate.year[1],\n monthIndex: doubleDate.monthIndex[1],\n }),\n [date, doubleDate],\n );\n\n if (value && prevValue && isValueUpdate(value, prevValue)) {\n const newDate = getDateFromValue(value);\n\n const { year, monthIndex } = newDate;\n\n const {\n monthIndex: [, prevMonthIndex],\n year: [, prevYear],\n } = doubleDate;\n\n if (prevMonthIndex !== monthIndex || prevYear !== year) {\n const [nextYear, nextMonthIndex] = getNextDate(year, monthIndex);\n\n setDate(newDate);\n\n setMonths({\n monthIndex: [monthIndex, nextMonthIndex],\n year: [year, nextYear],\n });\n }\n\n setPrevValue(value);\n }\n\n return (\n <Root ref={outerRootRef} aria-label=\"Выбор даты\" {...rest}>\n <CalendarHeader\n isDouble\n firstDate={firstDate}\n secondDate={secondDate}\n onPrev={handlePrev}\n onNext={handleNext}\n />\n\n <StyledWrapper>\n <CalendarDays\n isDouble\n eventList={eventList}\n disabledList={disabledList}\n min={min}\n max={max}\n value={externalValue}\n date={firstDate}\n hoveredDay={hoveredDay}\n selectIndexes={selectIndexes}\n onChangeDay={handleOnChangeDay}\n onHoverDay={setHoveredDay}\n onSetSelected={onSelectIndexes}\n onKeyDown={onKeyDown}\n outerRefs={outerRefs}\n />\n <StyledSeparator />\n <CalendarDays\n isDouble\n isSecond\n eventList={eventList}\n disabledList={disabledList}\n min={min}\n max={max}\n value={externalValue}\n date={secondDate}\n hoveredDay={hoveredDay}\n selectIndexes={selectIndexes}\n onChangeDay={handleOnChangeDay}\n onHoverDay={setHoveredDay}\n onSetSelected={onSelectIndexes}\n onKeyDown={onKeyDown}\n outerRefs={outerRefs}\n />\n </StyledWrapper>\n </Root>\n );\n },\n );\n\nexport const calendarDoubleConfig = {\n name: 'CalendarDouble',\n tag: 'div',\n layout: calendarDoubleRoot,\n base: StyledCalendar,\n variations: {\n view: {\n css: viewCSS,\n },\n },\n defaults: {\n view: 'primary',\n size: 'm',\n },\n};\n"],"names":["calendarDoubleRoot","Root","forwardRef","_ref","outerRootRef","externalValue","value","min","max","eventList","disabledList","onChangeValue","rest","_objectWithoutProperties","_excluded","_useMemo","useMemo","Array","isArray","_useMemo2","_slicedToArray","firstValue","secondValue","_useState","useState","_useState2","hoveredDay","setHoveredDay","_useState3","getDateFromValue","_useState4","date","setDate","_useState5","_useState6","prevValue","setPrevValue","_useState7","nextDate","_getNextDate","getNextDate","year","monthIndex","_getNextDate2","initialYear","initialMonth","_useState8","doubleDate","setMonths","handleMonth","useCallback","getDate","_getDate","_getDate2","newCurrentYear","newCurrentMonth","_getDate3","_getDate4","newNextYear","newNextMonth","handlePrev","getPrevDate","handleNext","_useKeyNavigation","useKeyNavigation","isDouble","size","onNext","onPrev","_useKeyNavigation2","selectIndexes","onKeyDown","onSelectIndexes","outerRefs","handleOnChangeDay","newDate","coord","newDay","Date","day","firstDate","secondDate","isValueUpdate","_doubleDate$monthInde","prevMonthIndex","_doubleDate$year","prevYear","_getNextDate3","_getNextDate4","nextYear","nextMonthIndex","React","createElement","_extends","ref","CalendarHeader","StyledWrapper","CalendarDays","onChangeDay","onHoverDay","onSetSelected","_StyledSeparator","StyledSeparator","isSecond","calendarDoubleConfig","name","tag","layout","base","StyledCalendar","variations","view","css","viewCSS","defaults"],"mappings":";;;;;;;;;;;;;AAaA;AACA;AACA;IACaA,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAIC,IAA+D,EAAA;AAAA,EAAA,oBAC9FC,UAAU,CACN,UAAAC,IAAA,EAAsFC,YAAY,EAAK;AAAA,IAAA,IAA7FC,aAAa,GAAAF,IAAA,CAApBG,KAAK;MAAiBC,GAAG,GAAAJ,IAAA,CAAHI,GAAG;MAAEC,GAAG,GAAAL,IAAA,CAAHK,GAAG;MAAEC,SAAS,GAAAN,IAAA,CAATM,SAAS;MAAEC,YAAY,GAAAP,IAAA,CAAZO,YAAY;MAAEC,aAAa,GAAAR,IAAA,CAAbQ,aAAa;AAAKC,MAAAA,IAAI,GAAAC,wBAAA,CAAAV,IAAA,EAAAW,SAAA,CAAA,CAAA;IAC9E,IAAAC,QAAA,GAAkCC,OAAO,CACrC,YAAA;QAAA,OAAOC,KAAK,CAACC,OAAO,CAACb,aAAa,CAAC,GAAGA,aAAa,GAAG,CAACA,aAAa,CAAC,CAAA;AAAA,OAAC,EACtE,CAACA,aAAa,CAClB,CAAC;MAAAc,SAAA,GAAAC,cAAA,CAAAL,QAAA,EAAA,CAAA,CAAA;AAHMM,MAAAA,UAAU,GAAAF,SAAA,CAAA,CAAA,CAAA;AAAEG,MAAAA,WAAW,GAAAH,SAAA,CAAA,CAAA,CAAA,CAAA;AAI9B,IAAA,IAAMb,KAAK,GAAGgB,WAAW,IAAID,UAAU,CAAA;AACvC,IAAA,IAAAE,SAAA,GAAoCC,QAAQ,EAA0B;MAAAC,UAAA,GAAAL,cAAA,CAAAG,SAAA,EAAA,CAAA,CAAA;AAA/DG,MAAAA,UAAU,GAAAD,UAAA,CAAA,CAAA,CAAA;AAAEE,MAAAA,aAAa,GAAAF,UAAA,CAAA,CAAA,CAAA,CAAA;IAEhC,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A;MACThC,QAAQ,EAAA,IAAA;MACRsC,QAAQ,EAAA,IAAA;AACR9F,MAAAA,SAAS,EAAEA,SAAU;AACrBC,MAAAA,YAAY,EAAEA,YAAa;AAC3BH,MAAAA,GAAG,EAAEA,GAAI;AACTC,MAAAA,GAAG,EAAEA,GAAI;AACTF,MAAAA,KAAK,EAAED,aAAc;AACrB0B,MAAAA,IAAI,EAAEkD,UAAW;AACjBvD,MAAAA,UAAU,EAAEA,UAAW;AACvB4C,MAAAA,aAAa,EAAEA,aAAc;AAC7B4B,MAAAA,WAAW,EAAExB,iBAAkB;AAC/ByB,MAAAA,UAAU,EAAExE,aAAc;AAC1ByE,MAAAA,aAAa,EAAE5B,eAAgB;AAC/BD,MAAAA,SAAS,EAAEA,SAAU;AACrBE,MAAAA,SAAS,EAAEA,SAAAA;KACd,CACU,CACb,CAAC,CAAA;AAEf,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAM+B,oBAAoB,GAAG;AAChCC,EAAAA,IAAI,EAAE,gBAAgB;AACtBC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE3G,kBAAkB;AAC1B4G,EAAAA,IAAI,EAAEC,cAAc;AACpBC,EAAAA,UAAU,EAAE;AACRC,IAAAA,IAAI,EAAE;AACFC,MAAAA,GAAG,EAAEC,IAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNH,IAAAA,IAAI,EAAE,SAAS;AACf7C,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
1
+ {"version":3,"file":"CalendarDouble.js","sources":["../../../../src/components/Calendar/CalendarDouble/CalendarDouble.tsx"],"sourcesContent":["import React, { useState, useCallback, useMemo, forwardRef, HTMLAttributes } from 'react';\n\nimport type { Calendar, DateObject } from '../Calendar.types';\nimport { getDateFromValue, getNextDate, getPrevDate, isValueUpdate } from '../utils';\nimport { useKeyNavigation } from '../hooks';\nimport { CalendarDays, CalendarHeader } from '../ui';\nimport { RootProps } from '../../../engines/types';\n\nimport { base as viewCSS } from './variations/_view/base';\nimport { StyledCalendar, StyledSeparator, StyledWrapper } from './CalendarDouble.styles';\n\nexport type CalendarDoubleProps = HTMLAttributes<HTMLDivElement> & Calendar;\n\n/**\n * Компонент двойного календаря.\n */\nexport const calendarDoubleRoot = (Root: RootProps<HTMLDivElement, HTMLAttributes<HTMLDivElement>>) =>\n forwardRef<HTMLDivElement, CalendarDoubleProps>(\n ({ value: externalValue, min, max, eventList, disabledList, onChangeValue, ...rest }, outerRootRef) => {\n const [firstValue, secondValue] = useMemo(\n () => (Array.isArray(externalValue) ? externalValue : [externalValue]),\n [externalValue],\n );\n const value = secondValue || firstValue;\n const [hoveredDay, setHoveredDay] = useState<DateObject | undefined>();\n\n const [date, setDate] = useState<DateObject>(getDateFromValue(value));\n const [prevValue, setPrevValue] = useState(value);\n const [doubleDate, setMonths] = useState(() => {\n const nextDate = getDateFromValue(firstValue);\n const [initialYear, initialMonth] = getNextDate(nextDate.year, nextDate.monthIndex);\n\n return {\n monthIndex: [nextDate.monthIndex, initialMonth],\n year: [nextDate.year, initialYear],\n };\n });\n\n const handleMonth = useCallback(\n (getDate: (currentYear: number, currentMonth: number) => number[]) => {\n const [newCurrentYear, newCurrentMonth] = getDate(doubleDate.year[0], doubleDate.monthIndex[0]);\n const [newNextYear, newNextMonth] = getDate(doubleDate.year[1], doubleDate.monthIndex[1]);\n\n setMonths({\n monthIndex: [newCurrentMonth, newNextMonth],\n year: [newCurrentYear, newNextYear],\n });\n },\n [doubleDate],\n );\n\n const handlePrev = useCallback(() => {\n handleMonth(getPrevDate);\n }, [handleMonth]);\n\n const handleNext = useCallback(() => {\n handleMonth(getNextDate);\n }, [handleMonth]);\n\n const [selectIndexes, onKeyDown, onSelectIndexes, outerRefs] = useKeyNavigation({\n isDouble: true,\n size: [11, 6],\n onNext: handleNext,\n onPrev: handlePrev,\n });\n\n const handleOnChangeDay = useCallback(\n (newDate: DateObject, coord: number[]) => {\n const newDay = new Date(newDate.year, newDate.monthIndex, newDate.day);\n onChangeValue?.(newDay);\n\n onSelectIndexes(coord);\n },\n [onChangeValue, onSelectIndexes],\n );\n\n const firstDate = useMemo(\n () => ({\n day: date.day,\n year: doubleDate.year[0],\n monthIndex: doubleDate.monthIndex[0],\n }),\n [date, doubleDate],\n );\n\n const secondDate = useMemo(\n () => ({\n day: date.day,\n year: doubleDate.year[1],\n monthIndex: doubleDate.monthIndex[1],\n }),\n [date, doubleDate],\n );\n\n if (value && prevValue && isValueUpdate(value, prevValue)) {\n const newDate = getDateFromValue(value);\n\n const { year, monthIndex } = newDate;\n\n const {\n monthIndex: [, prevMonthIndex],\n year: [, prevYear],\n } = doubleDate;\n\n if (prevMonthIndex !== monthIndex || prevYear !== year) {\n const [nextYear, nextMonthIndex] = getNextDate(year, monthIndex);\n\n setDate(newDate);\n\n setMonths({\n monthIndex: [monthIndex, nextMonthIndex],\n year: [year, nextYear],\n });\n }\n\n setPrevValue(value);\n }\n\n return (\n <Root ref={outerRootRef} aria-label=\"Выбор даты\" {...rest}>\n <CalendarHeader\n isDouble\n firstDate={firstDate}\n secondDate={secondDate}\n onPrev={handlePrev}\n onNext={handleNext}\n />\n\n <StyledWrapper>\n <CalendarDays\n isDouble\n eventList={eventList}\n disabledList={disabledList}\n min={min}\n max={max}\n value={externalValue}\n date={firstDate}\n hoveredDay={hoveredDay}\n selectIndexes={selectIndexes}\n onChangeDay={handleOnChangeDay}\n onHoverDay={setHoveredDay}\n onSetSelected={onSelectIndexes}\n onKeyDown={onKeyDown}\n outerRefs={outerRefs}\n />\n <StyledSeparator />\n <CalendarDays\n isDouble\n isSecond\n eventList={eventList}\n disabledList={disabledList}\n min={min}\n max={max}\n value={externalValue}\n date={secondDate}\n hoveredDay={hoveredDay}\n selectIndexes={selectIndexes}\n onChangeDay={handleOnChangeDay}\n onHoverDay={setHoveredDay}\n onSetSelected={onSelectIndexes}\n onKeyDown={onKeyDown}\n outerRefs={outerRefs}\n />\n </StyledWrapper>\n </Root>\n );\n },\n );\n\nexport const calendarDoubleConfig = {\n name: 'CalendarDouble',\n tag: 'div',\n layout: calendarDoubleRoot,\n base: StyledCalendar,\n variations: {\n view: {\n css: viewCSS,\n },\n },\n defaults: {\n view: 'primary',\n size: 'm',\n },\n};\n"],"names":["calendarDoubleRoot","Root","forwardRef","_ref","outerRootRef","externalValue","value","min","max","eventList","disabledList","onChangeValue","rest","_objectWithoutProperties","_excluded","_useMemo","useMemo","Array","isArray","_useMemo2","_slicedToArray","firstValue","secondValue","_useState","useState","_useState2","hoveredDay","setHoveredDay","_useState3","getDateFromValue","_useState4","date","setDate","_useState5","_useState6","prevValue","setPrevValue","_useState7","nextDate","_getNextDate","getNextDate","year","monthIndex","_getNextDate2","initialYear","initialMonth","_useState8","doubleDate","setMonths","handleMonth","useCallback","getDate","_getDate","_getDate2","newCurrentYear","newCurrentMonth","_getDate3","_getDate4","newNextYear","newNextMonth","handlePrev","getPrevDate","handleNext","_useKeyNavigation","useKeyNavigation","isDouble","size","onNext","onPrev","_useKeyNavigation2","selectIndexes","onKeyDown","onSelectIndexes","outerRefs","handleOnChangeDay","newDate","coord","newDay","Date","day","firstDate","secondDate","isValueUpdate","_doubleDate$monthInde","prevMonthIndex","_doubleDate$year","prevYear","_getNextDate3","_getNextDate4","nextYear","nextMonthIndex","React","createElement","_extends","ref","CalendarHeader","StyledWrapper","CalendarDays","onChangeDay","onHoverDay","onSetSelected","_StyledSeparator","StyledSeparator","isSecond","calendarDoubleConfig","name","tag","layout","base","StyledCalendar","variations","view","css","viewCSS","defaults"],"mappings":";;;;;;;;;;;;;AAaA;AACA;AACA;IACaA,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAIC,IAA+D,EAAA;AAAA,EAAA,oBAC9FC,UAAU,CACN,UAAAC,IAAA,EAAsFC,YAAY,EAAK;AAAA,IAAA,IAA7FC,aAAa,GAAAF,IAAA,CAApBG,KAAK;MAAiBC,GAAG,GAAAJ,IAAA,CAAHI,GAAG;MAAEC,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,aAAc;AAC1ByE,MAAAA,aAAa,EAAE5B,eAAgB;AAC/BD,MAAAA,SAAS,EAAEA,SAAU;AACrBE,MAAAA,SAAS,EAAEA,SAAAA;KACd,CACU,CACb,CAAC,CAAA;AAEf,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAM+B,oBAAoB,GAAG;AAChCC,EAAAA,IAAI,EAAE,gBAAgB;AACtBC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE3G,kBAAkB;AAC1B4G,EAAAA,IAAI,EAAEC,cAAc;AACpBC,EAAAA,UAAU,EAAE;AACRC,IAAAA,IAAI,EAAE;AACFC,MAAAA,GAAG,EAAEC,IAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNH,IAAAA,IAAI,EAAE,SAAS;AACf7C,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
@@ -40,7 +40,7 @@ var withRange = function withRange(Component) {
40
40
  var handleOnChangeDay = useCallback(function (newDay) {
41
41
  if (endValue) {
42
42
  setValues([newDay, undefined]);
43
- onChangeStartOfRange === null || onChangeStartOfRange === void 0 ? void 0 : onChangeStartOfRange(newDay);
43
+ onChangeStartOfRange === null || onChangeStartOfRange === void 0 || onChangeStartOfRange(newDay);
44
44
  return;
45
45
  }
46
46
  setValues([startValue, newDay]);
@@ -1 +1 @@
1
- {"version":3,"file":"withRange.js","sources":["../../../../src/components/Calendar/hoc/withRange.tsx"],"sourcesContent":["import React, { useMemo, useState, useCallback, ReactElement } from 'react';\n\nimport type { Calendar, CalendarRange } from '../Calendar.types';\nimport { getSortedValues, isValueUpdate } from '../utils';\n\n/**\n * HOC для календаря, дающий возможность выбора диапазона даты\n */\nexport const withRange = <T extends Calendar>(Component: React.FC<Calendar>) => ({\n value,\n disabledList,\n eventList,\n min,\n max,\n onChangeValue,\n onChangeStartOfRange,\n ...rest\n}: CalendarRange<T>): ReactElement<T> => {\n const [startExternalValue, endExternalValue] = useMemo(() => value, [value]);\n const [[startValue, endValue], setValues] = useState<[Date, Date?]>([startExternalValue, endExternalValue]);\n const [prevValue, setPrevValue] = useState(value);\n\n if (isValueUpdate(value, prevValue)) {\n setValues([startExternalValue, endExternalValue]);\n\n setPrevValue(value);\n }\n\n const handleOnChangeDay = useCallback(\n (newDay: Date) => {\n if (endValue) {\n setValues([newDay, undefined]);\n\n onChangeStartOfRange?.(newDay);\n\n return;\n }\n\n setValues([startValue, newDay]);\n\n const [first, second] = getSortedValues([startValue, newDay]);\n\n if (first) {\n onChangeValue([first, second]);\n }\n },\n [onChangeValue, onChangeStartOfRange, startValue, endValue],\n );\n\n return (\n <Component\n value={[startValue, endValue]}\n onChangeValue={handleOnChangeDay}\n disabledList={disabledList}\n eventList={eventList}\n min={min}\n max={max}\n {...rest}\n />\n );\n};\n"],"names":["withRange","Component","_ref","value","disabledList","eventList","min","max","onChangeValue","onChangeStartOfRange","rest","_objectWithoutProperties","_excluded","_useMemo","useMemo","_useMemo2","_slicedToArray","startExternalValue","endExternalValue","_useState","useState","_useState2","_useState2$","startValue","endValue","setValues","_useState3","_useState4","prevValue","setPrevValue","isValueUpdate","handleOnChangeDay","useCallback","newDay","undefined","_getSortedValues","getSortedValues","_getSortedValues2","first","second","React","createElement","_extends"],"mappings":";;;;;;AAKA;AACA;AACA;IACaA,SAAS,GAAG,SAAZA,SAASA,CAAwBC,SAA6B,EAAA;EAAA,OAAK,UAAAC,IAAA,EASvC;AAAA,IAAA,IARrCC,KAAK,GAAAD,IAAA,CAALC,KAAK;MACLC,YAAY,GAAAF,IAAA,CAAZE,YAAY;MACZC,SAAS,GAAAH,IAAA,CAATG,SAAS;MACTC,GAAG,GAAAJ,IAAA,CAAHI,GAAG;MACHC,GAAG,GAAAL,IAAA,CAAHK,GAAG;MACHC,aAAa,GAAAN,IAAA,CAAbM,aAAa;MACbC,oBAAoB,GAAAP,IAAA,CAApBO,oBAAoB;AACjBC,MAAAA,IAAI,GAAAC,wBAAA,CAAAT,IAAA,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AS,CAAC,CAACQ,MAAM,EAAEC,SAAS,CAAC,CAAC,CAAA;AAE9BzB,QAAAA,oBAAoB,aAApBA,oBAAoB,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAApBA,oBAAoB,CAAGwB,MAAM,CAAC,CAAA;AAE9B,QAAA,OAAA;AACJ,OAAA;AAEAR,MAAAA,SAAS,CAAC,CAACF,UAAU,EAAEU,MAAM,CAAC,CAAC,CAAA;MAE/B,IAAAE,gBAAA,GAAwBC,eAAe,CAAC,CAACb,UAAU,EAAEU,MAAM,CAAC,CAAC;QAAAI,iBAAA,GAAArB,cAAA,CAAAmB,gBAAA,EAAA,CAAA,CAAA;AAAtDG,QAAAA,KAAK,GAAAD,iBAAA,CAAA,CAAA,CAAA;AAAEE,QAAAA,MAAM,GAAAF,iBAAA,CAAA,CAAA,CAAA,CAAA;AAEpB,MAAA,IAAIC,KAAK,EAAE;AACP9B,QAAAA,aAAa,CAAC,CAAC8B,KAAK,EAAEC,MAAM,CAAC,CAAC,CAAA;AAClC,OAAA;KACH,EACD,CAAC/B,aAAa,EAAEC,oBAAoB,EAAEc,UAAU,EAAEC,QAAQ,CAC9D,CAAC,CAAA;AAED,IAAA,oBACIgB,KAAA,CAAAC,aAAA,CAACxC,SAAS,EAAAyC,QAAA,CAAA;AACNvC,MAAAA,KAAK,EAAE,CAACoB,UAAU,EAAEC,QAAQ,CAAE;AAC9BhB,MAAAA,aAAa,EAAEuB,iBAAkB;AACjC3B,MAAAA,YAAY,EAAEA,YAAa;AAC3BC,MAAAA,SAAS,EAAEA,SAAU;AACrBC,MAAAA,GAAG,EAAEA,GAAI;AACTC,MAAAA,GAAG,EAAEA,GAAAA;KACDG,EAAAA,IAAI,CACX,CAAC,CAAA;GAET,CAAA;AAAA;;;;"}
1
+ {"version":3,"file":"withRange.js","sources":["../../../../src/components/Calendar/hoc/withRange.tsx"],"sourcesContent":["import React, { useMemo, useState, useCallback, ReactElement } from 'react';\n\nimport type { Calendar, CalendarRange } from '../Calendar.types';\nimport { getSortedValues, isValueUpdate } from '../utils';\n\n/**\n * HOC для календаря, дающий возможность выбора диапазона даты\n */\nexport const withRange = <T extends Calendar>(Component: React.FC<Calendar>) => ({\n value,\n disabledList,\n eventList,\n min,\n max,\n onChangeValue,\n onChangeStartOfRange,\n ...rest\n}: CalendarRange<T>): ReactElement<T> => {\n const [startExternalValue, endExternalValue] = useMemo(() => value, [value]);\n const [[startValue, endValue], setValues] = useState<[Date, Date?]>([startExternalValue, endExternalValue]);\n const [prevValue, setPrevValue] = useState(value);\n\n if (isValueUpdate(value, prevValue)) {\n setValues([startExternalValue, endExternalValue]);\n\n setPrevValue(value);\n }\n\n const handleOnChangeDay = useCallback(\n (newDay: Date) => {\n if (endValue) {\n setValues([newDay, undefined]);\n\n onChangeStartOfRange?.(newDay);\n\n return;\n }\n\n setValues([startValue, newDay]);\n\n const [first, second] = getSortedValues([startValue, newDay]);\n\n if (first) {\n onChangeValue([first, second]);\n }\n },\n [onChangeValue, onChangeStartOfRange, startValue, endValue],\n );\n\n return (\n <Component\n value={[startValue, endValue]}\n onChangeValue={handleOnChangeDay}\n disabledList={disabledList}\n eventList={eventList}\n min={min}\n max={max}\n {...rest}\n />\n );\n};\n"],"names":["withRange","Component","_ref","value","disabledList","eventList","min","max","onChangeValue","onChangeStartOfRange","rest","_objectWithoutProperties","_excluded","_useMemo","useMemo","_useMemo2","_slicedToArray","startExternalValue","endExternalValue","_useState","useState","_useState2","_useState2$","startValue","endValue","setValues","_useState3","_useState4","prevValue","setPrevValue","isValueUpdate","handleOnChangeDay","useCallback","newDay","undefined","_getSortedValues","getSortedValues","_getSortedValues2","first","second","React","createElement","_extends"],"mappings":";;;;;;AAKA;AACA;AACA;IACaA,SAAS,GAAG,SAAZA,SAASA,CAAwBC,SAA6B,EAAA;EAAA,OAAK,UAAAC,IAAA,EASvC;AAAA,IAAA,IARrCC,KAAK,GAAAD,IAAA,CAALC,KAAK;MACLC,YAAY,GAAAF,IAAA,CAAZE,Y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