@salutejs/plasma-new-hope 0.160.1-canary.1454.11177563590.0 → 0.161.0-canary.1392.11178979637.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (342) hide show
  1. package/cjs/components/Attach/Attach.js +9 -13
  2. package/cjs/components/Attach/Attach.js.map +1 -1
  3. package/cjs/components/Attach/utils/truncateFilename.js +24 -0
  4. package/cjs/components/Attach/utils/truncateFilename.js.map +1 -0
  5. package/cjs/components/Breadcrumbs/Breadcrumbs.styles.js +2 -2
  6. package/cjs/components/Breadcrumbs/Breadcrumbs.styles.js.map +1 -1
  7. package/cjs/components/Calendar/ui/CalendarHeader/CalendarHeader.js +5 -5
  8. package/cjs/components/Calendar/ui/CalendarHeader/CalendarHeader.js.map +1 -1
  9. package/cjs/components/Segment/tokens.js +14 -1
  10. package/cjs/components/Segment/tokens.js.map +1 -1
  11. package/cjs/components/Segment/ui/SegmentGroup/SegmentGroup.css +8 -9
  12. package/cjs/components/Segment/ui/SegmentGroup/SegmentGroup.js +68 -112
  13. package/cjs/components/Segment/ui/SegmentGroup/SegmentGroup.js.map +1 -1
  14. package/cjs/components/Segment/ui/SegmentGroup/SegmentGroup.styles.js +1 -7
  15. package/cjs/components/Segment/ui/SegmentGroup/SegmentGroup.styles.js.map +1 -1
  16. package/cjs/components/Segment/ui/SegmentGroup/SegmentGroup.styles_klze6h.css +3 -0
  17. package/cjs/components/Segment/ui/SegmentGroup/variations/_filledBackgound/base.js +1 -1
  18. package/cjs/components/Segment/ui/SegmentGroup/variations/_filledBackgound/base.js.map +1 -1
  19. package/cjs/components/Segment/ui/SegmentGroup/variations/_filledBackgound/base_a7w5s0.css +1 -0
  20. package/cjs/components/Segment/ui/SegmentGroup/variations/_orientation/base.js +9 -0
  21. package/cjs/components/Segment/ui/SegmentGroup/variations/_orientation/base.js.map +1 -0
  22. package/cjs/components/Segment/ui/SegmentGroup/variations/_orientation/base_1ejecy9.css +1 -0
  23. package/cjs/components/Segment/ui/SegmentGroup/variations/_pilled/base.js +1 -1
  24. package/cjs/components/Segment/ui/SegmentGroup/variations/_pilled/base.js.map +1 -1
  25. package/cjs/components/Segment/ui/SegmentGroup/variations/_pilled/base_pxl3nb.css +1 -0
  26. package/cjs/components/Segment/ui/SegmentGroup/variations/_size/base.js +1 -1
  27. package/cjs/components/Segment/ui/SegmentGroup/variations/_size/base.js.map +1 -1
  28. package/cjs/components/Segment/ui/SegmentGroup/variations/_size/base_18cpjsq.css +1 -0
  29. package/cjs/components/Segment/ui/SegmentItem/SegmentItem.css +6 -4
  30. package/cjs/components/Segment/ui/SegmentItem/SegmentItem.js +17 -7
  31. package/cjs/components/Segment/ui/SegmentItem/SegmentItem.js.map +1 -1
  32. package/cjs/components/Segment/ui/SegmentItem/SegmentItem.styles.js +30 -1
  33. package/cjs/components/Segment/ui/SegmentItem/SegmentItem.styles.js.map +1 -1
  34. package/cjs/components/Segment/ui/SegmentItem/SegmentItem.styles_1ir79py.css +4 -0
  35. package/cjs/components/Segment/ui/SegmentItem/variations/_pilled/base.js +1 -1
  36. package/cjs/components/Segment/ui/SegmentItem/variations/_pilled/base.js.map +1 -1
  37. package/cjs/components/Segment/ui/SegmentItem/variations/_pilled/{base_15s0fel.css → base_omc5u1.css} +1 -1
  38. package/cjs/components/Segment/ui/SegmentItem/variations/_view/base.js +1 -1
  39. package/cjs/components/Segment/ui/SegmentItem/variations/_view/base.js.map +1 -1
  40. package/cjs/components/Segment/ui/SegmentItem/variations/_view/base_dettiq.css +1 -0
  41. package/cjs/components/Tabs/ui/Tabs/Tabs.js +6 -6
  42. package/cjs/components/Tabs/ui/Tabs/Tabs.js.map +1 -1
  43. package/cjs/components/_Icon/Icon.assets/{DisclosureLeft.js → DisclosureLeftCentered.js} +3 -3
  44. package/cjs/components/_Icon/Icon.assets/DisclosureLeftCentered.js.map +1 -0
  45. package/cjs/components/_Icon/Icon.assets/DisclosureRight.js +3 -4
  46. package/cjs/components/_Icon/Icon.assets/DisclosureRight.js.map +1 -1
  47. package/cjs/components/_Icon/Icons/{IconDisclosureLeft.js → IconDisclosureLeftCentered.js} +5 -5
  48. package/cjs/components/_Icon/Icons/IconDisclosureLeftCentered.js.map +1 -0
  49. package/cjs/index.css +14 -11
  50. package/emotion/cjs/components/Attach/Attach.js +6 -9
  51. package/emotion/cjs/components/Attach/utils/index.js +7 -9
  52. package/emotion/cjs/components/Attach/utils/truncateFilename.js +23 -0
  53. package/emotion/cjs/components/Breadcrumbs/Breadcrumbs.styles.js +4 -4
  54. package/emotion/cjs/components/Calendar/ui/CalendarHeader/CalendarHeader.js +2 -2
  55. package/emotion/cjs/components/Segment/README.md +61 -0
  56. package/emotion/cjs/components/Segment/tokens.js +14 -1
  57. package/emotion/cjs/components/Segment/ui/SegmentGroup/SegmentGroup.js +66 -115
  58. package/emotion/cjs/components/Segment/ui/SegmentGroup/SegmentGroup.styles.js +15 -33
  59. package/emotion/cjs/components/Segment/ui/SegmentGroup/variations/_filledBackgound/base.js +1 -1
  60. package/emotion/cjs/components/Segment/ui/SegmentGroup/variations/_orientation/base.js +10 -0
  61. package/emotion/cjs/components/Segment/ui/SegmentGroup/variations/_orientation/tokens.json +1 -0
  62. package/emotion/cjs/components/Segment/ui/SegmentGroup/variations/_pilled/base.js +1 -1
  63. package/emotion/cjs/components/Segment/ui/SegmentGroup/variations/_size/base.js +1 -1
  64. package/emotion/cjs/components/Segment/ui/SegmentItem/SegmentItem.js +17 -7
  65. package/emotion/cjs/components/Segment/ui/SegmentItem/SegmentItem.styles.js +21 -7
  66. package/emotion/cjs/components/Segment/ui/SegmentItem/variations/_pilled/base.js +1 -1
  67. package/emotion/cjs/components/Segment/ui/SegmentItem/variations/_view/base.js +2 -1
  68. package/emotion/cjs/components/Tabs/ui/Tabs/Tabs.js +4 -4
  69. package/emotion/cjs/components/_Icon/Icon.assets/DisclosureDown.js +21 -0
  70. package/emotion/cjs/components/_Icon/Icon.assets/DisclosureLeft.js +3 -4
  71. package/emotion/cjs/components/_Icon/Icon.assets/DisclosureLeftCentered.js +22 -0
  72. package/emotion/cjs/components/_Icon/Icon.assets/DisclosureRight.js +3 -4
  73. package/emotion/cjs/components/_Icon/Icon.assets/DisclosureUp.js +21 -0
  74. package/emotion/cjs/components/_Icon/Icons/IconDisclosureDown.js +22 -0
  75. package/emotion/cjs/components/_Icon/Icons/IconDisclosureLeftCentered.js +22 -0
  76. package/emotion/cjs/components/_Icon/Icons/IconDisclosureUp.js +22 -0
  77. package/emotion/cjs/components/_Icon/index.js +21 -0
  78. package/emotion/cjs/examples/plasma_b2c/components/Editable/Editable.stories.tsx +2 -2
  79. package/emotion/cjs/examples/plasma_b2c/components/Notification/Notification.stories.tsx +6 -3
  80. package/emotion/cjs/examples/plasma_b2c/components/Segment/Segment.stories.tsx +118 -42
  81. package/emotion/cjs/examples/plasma_b2c/components/Segment/SegmentGroup.config.js +13 -10
  82. package/emotion/cjs/examples/plasma_b2c/components/Segment/SegmentItem.config.js +9 -9
  83. package/emotion/cjs/examples/plasma_b2c/components/Tooltip/Tooltip.stories.tsx +2 -2
  84. package/emotion/cjs/examples/plasma_web/components/Editable/Editable.stories.tsx +2 -2
  85. package/emotion/cjs/examples/plasma_web/components/Notification/Notification.stories.tsx +6 -3
  86. package/emotion/cjs/examples/plasma_web/components/Segment/Segment.stories.tsx +119 -42
  87. package/emotion/cjs/examples/plasma_web/components/Segment/SegmentGroup.config.js +15 -9
  88. package/emotion/cjs/examples/plasma_web/components/Segment/SegmentItem.config.js +9 -9
  89. package/emotion/cjs/examples/plasma_web/components/Tooltip/Tooltip.stories.tsx +2 -2
  90. package/emotion/es/components/Attach/Attach.js +7 -10
  91. package/emotion/es/components/Attach/utils/index.js +1 -2
  92. package/emotion/es/components/Attach/utils/truncateFilename.js +17 -0
  93. package/emotion/es/components/Breadcrumbs/Breadcrumbs.styles.js +5 -5
  94. package/emotion/es/components/Calendar/ui/CalendarHeader/CalendarHeader.js +3 -3
  95. package/emotion/es/components/Segment/README.md +61 -0
  96. package/emotion/es/components/Segment/tokens.js +14 -1
  97. package/emotion/es/components/Segment/ui/SegmentGroup/SegmentGroup.js +69 -118
  98. package/emotion/es/components/Segment/ui/SegmentGroup/SegmentGroup.styles.js +14 -32
  99. package/emotion/es/components/Segment/ui/SegmentGroup/variations/_filledBackgound/base.js +1 -1
  100. package/emotion/es/components/Segment/ui/SegmentGroup/variations/_orientation/base.js +4 -0
  101. package/emotion/es/components/Segment/ui/SegmentGroup/variations/_orientation/tokens.json +1 -0
  102. package/emotion/es/components/Segment/ui/SegmentGroup/variations/_pilled/base.js +1 -1
  103. package/emotion/es/components/Segment/ui/SegmentGroup/variations/_size/base.js +1 -1
  104. package/emotion/es/components/Segment/ui/SegmentItem/SegmentItem.js +18 -8
  105. package/emotion/es/components/Segment/ui/SegmentItem/SegmentItem.styles.js +21 -7
  106. package/emotion/es/components/Segment/ui/SegmentItem/variations/_pilled/base.js +1 -1
  107. package/emotion/es/components/Segment/ui/SegmentItem/variations/_view/base.js +2 -1
  108. package/emotion/es/components/Tabs/ui/Tabs/Tabs.js +5 -5
  109. package/emotion/es/components/_Icon/Icon.assets/DisclosureDown.js +14 -0
  110. package/emotion/es/components/_Icon/Icon.assets/DisclosureLeft.js +3 -4
  111. package/emotion/es/components/_Icon/Icon.assets/DisclosureLeftCentered.js +15 -0
  112. package/emotion/es/components/_Icon/Icon.assets/DisclosureRight.js +3 -4
  113. package/emotion/es/components/_Icon/Icon.assets/DisclosureUp.js +14 -0
  114. package/emotion/es/components/_Icon/Icons/IconDisclosureDown.js +15 -0
  115. package/emotion/es/components/_Icon/Icons/IconDisclosureLeftCentered.js +15 -0
  116. package/emotion/es/components/_Icon/Icons/IconDisclosureUp.js +15 -0
  117. package/emotion/es/components/_Icon/index.js +3 -0
  118. package/emotion/es/examples/plasma_b2c/components/Editable/Editable.stories.tsx +2 -2
  119. package/emotion/es/examples/plasma_b2c/components/Notification/Notification.stories.tsx +6 -3
  120. package/emotion/es/examples/plasma_b2c/components/Segment/Segment.stories.tsx +118 -42
  121. package/emotion/es/examples/plasma_b2c/components/Segment/SegmentGroup.config.js +13 -10
  122. package/emotion/es/examples/plasma_b2c/components/Segment/SegmentItem.config.js +9 -9
  123. package/emotion/es/examples/plasma_b2c/components/Tooltip/Tooltip.stories.tsx +2 -2
  124. package/emotion/es/examples/plasma_web/components/Editable/Editable.stories.tsx +2 -2
  125. package/emotion/es/examples/plasma_web/components/Notification/Notification.stories.tsx +6 -3
  126. package/emotion/es/examples/plasma_web/components/Segment/Segment.stories.tsx +119 -42
  127. package/emotion/es/examples/plasma_web/components/Segment/SegmentGroup.config.js +15 -9
  128. package/emotion/es/examples/plasma_web/components/Segment/SegmentItem.config.js +9 -9
  129. package/emotion/es/examples/plasma_web/components/Tooltip/Tooltip.stories.tsx +2 -2
  130. package/es/components/Attach/Attach.js +9 -13
  131. package/es/components/Attach/Attach.js.map +1 -1
  132. package/es/components/Attach/utils/truncateFilename.js +20 -0
  133. package/es/components/Attach/utils/truncateFilename.js.map +1 -0
  134. package/es/components/Breadcrumbs/Breadcrumbs.styles.js +2 -2
  135. package/es/components/Breadcrumbs/Breadcrumbs.styles.js.map +1 -1
  136. package/es/components/Calendar/ui/CalendarHeader/CalendarHeader.js +5 -5
  137. package/es/components/Calendar/ui/CalendarHeader/CalendarHeader.js.map +1 -1
  138. package/es/components/Segment/tokens.js +14 -1
  139. package/es/components/Segment/tokens.js.map +1 -1
  140. package/es/components/Segment/ui/SegmentGroup/SegmentGroup.css +8 -9
  141. package/es/components/Segment/ui/SegmentGroup/SegmentGroup.js +73 -118
  142. package/es/components/Segment/ui/SegmentGroup/SegmentGroup.js.map +1 -1
  143. package/es/components/Segment/ui/SegmentGroup/SegmentGroup.styles.js +2 -7
  144. package/es/components/Segment/ui/SegmentGroup/SegmentGroup.styles.js.map +1 -1
  145. package/es/components/Segment/ui/SegmentGroup/SegmentGroup.styles_klze6h.css +3 -0
  146. package/es/components/Segment/ui/SegmentGroup/variations/_filledBackgound/base.js +1 -1
  147. package/es/components/Segment/ui/SegmentGroup/variations/_filledBackgound/base.js.map +1 -1
  148. package/es/components/Segment/ui/SegmentGroup/variations/_filledBackgound/base_a7w5s0.css +1 -0
  149. package/es/components/Segment/ui/SegmentGroup/variations/_orientation/base.js +5 -0
  150. package/es/components/Segment/ui/SegmentGroup/variations/_orientation/base.js.map +1 -0
  151. package/es/components/Segment/ui/SegmentGroup/variations/_orientation/base_1ejecy9.css +1 -0
  152. package/es/components/Segment/ui/SegmentGroup/variations/_pilled/base.js +1 -1
  153. package/es/components/Segment/ui/SegmentGroup/variations/_pilled/base.js.map +1 -1
  154. package/es/components/Segment/ui/SegmentGroup/variations/_pilled/base_pxl3nb.css +1 -0
  155. package/es/components/Segment/ui/SegmentGroup/variations/_size/base.js +1 -1
  156. package/es/components/Segment/ui/SegmentGroup/variations/_size/base.js.map +1 -1
  157. package/es/components/Segment/ui/SegmentGroup/variations/_size/base_18cpjsq.css +1 -0
  158. package/es/components/Segment/ui/SegmentItem/SegmentItem.css +6 -4
  159. package/es/components/Segment/ui/SegmentItem/SegmentItem.js +18 -8
  160. package/es/components/Segment/ui/SegmentItem/SegmentItem.js.map +1 -1
  161. package/es/components/Segment/ui/SegmentItem/SegmentItem.styles.js +29 -2
  162. package/es/components/Segment/ui/SegmentItem/SegmentItem.styles.js.map +1 -1
  163. package/es/components/Segment/ui/SegmentItem/SegmentItem.styles_1ir79py.css +4 -0
  164. package/es/components/Segment/ui/SegmentItem/variations/_pilled/base.js +1 -1
  165. package/es/components/Segment/ui/SegmentItem/variations/_pilled/base.js.map +1 -1
  166. package/es/components/Segment/ui/SegmentItem/variations/_pilled/{base_15s0fel.css → base_omc5u1.css} +1 -1
  167. package/es/components/Segment/ui/SegmentItem/variations/_view/base.js +1 -1
  168. package/es/components/Segment/ui/SegmentItem/variations/_view/base.js.map +1 -1
  169. package/es/components/Segment/ui/SegmentItem/variations/_view/base_dettiq.css +1 -0
  170. package/es/components/Tabs/ui/Tabs/Tabs.js +6 -6
  171. package/es/components/Tabs/ui/Tabs/Tabs.js.map +1 -1
  172. package/es/components/_Icon/Icon.assets/{DisclosureLeft.js → DisclosureLeftCentered.js} +3 -3
  173. package/es/components/_Icon/Icon.assets/DisclosureLeftCentered.js.map +1 -0
  174. package/es/components/_Icon/Icon.assets/DisclosureRight.js +3 -4
  175. package/es/components/_Icon/Icon.assets/DisclosureRight.js.map +1 -1
  176. package/es/components/_Icon/Icons/{IconDisclosureLeft.js → IconDisclosureLeftCentered.js} +5 -5
  177. package/es/components/_Icon/Icons/IconDisclosureLeftCentered.js.map +1 -0
  178. package/es/index.css +14 -11
  179. package/package.json +2 -2
  180. package/styled-components/cjs/components/Attach/Attach.js +6 -9
  181. package/styled-components/cjs/components/Attach/utils/index.js +7 -9
  182. package/styled-components/cjs/components/Attach/utils/truncateFilename.js +23 -0
  183. package/styled-components/cjs/components/Breadcrumbs/Breadcrumbs.styles.js +1 -1
  184. package/styled-components/cjs/components/Calendar/ui/CalendarHeader/CalendarHeader.js +2 -2
  185. package/styled-components/cjs/components/Segment/README.md +61 -0
  186. package/styled-components/cjs/components/Segment/tokens.js +14 -1
  187. package/styled-components/cjs/components/Segment/ui/SegmentGroup/SegmentGroup.js +66 -115
  188. package/styled-components/cjs/components/Segment/ui/SegmentGroup/SegmentGroup.styles.js +4 -13
  189. package/styled-components/cjs/components/Segment/ui/SegmentGroup/variations/_filledBackgound/base.js +1 -1
  190. package/styled-components/cjs/components/Segment/ui/SegmentGroup/variations/_orientation/base.js +10 -0
  191. package/styled-components/cjs/components/Segment/ui/SegmentGroup/variations/_orientation/tokens.json +1 -0
  192. package/styled-components/cjs/components/Segment/ui/SegmentGroup/variations/_pilled/base.js +1 -1
  193. package/styled-components/cjs/components/Segment/ui/SegmentGroup/variations/_size/base.js +1 -1
  194. package/styled-components/cjs/components/Segment/ui/SegmentItem/SegmentItem.js +17 -7
  195. package/styled-components/cjs/components/Segment/ui/SegmentItem/SegmentItem.styles.js +17 -5
  196. package/styled-components/cjs/components/Segment/ui/SegmentItem/variations/_pilled/base.js +1 -1
  197. package/styled-components/cjs/components/Segment/ui/SegmentItem/variations/_view/base.js +2 -1
  198. package/styled-components/cjs/components/Tabs/ui/Tabs/Tabs.js +4 -4
  199. package/styled-components/cjs/components/_Icon/Icon.assets/DisclosureDown.js +21 -0
  200. package/styled-components/cjs/components/_Icon/Icon.assets/DisclosureLeft.js +3 -4
  201. package/styled-components/cjs/components/_Icon/Icon.assets/DisclosureLeftCentered.js +22 -0
  202. package/styled-components/cjs/components/_Icon/Icon.assets/DisclosureRight.js +3 -4
  203. package/styled-components/cjs/components/_Icon/Icon.assets/DisclosureUp.js +21 -0
  204. package/styled-components/cjs/components/_Icon/Icons/IconDisclosureDown.js +22 -0
  205. package/styled-components/cjs/components/_Icon/Icons/IconDisclosureLeftCentered.js +22 -0
  206. package/styled-components/cjs/components/_Icon/Icons/IconDisclosureUp.js +22 -0
  207. package/styled-components/cjs/components/_Icon/index.js +21 -0
  208. package/styled-components/cjs/examples/plasma_b2c/components/Editable/Editable.stories.tsx +2 -2
  209. package/styled-components/cjs/examples/plasma_b2c/components/Notification/Notification.stories.tsx +6 -3
  210. package/styled-components/cjs/examples/plasma_b2c/components/Segment/Segment.stories.tsx +118 -42
  211. package/styled-components/cjs/examples/plasma_b2c/components/Segment/SegmentGroup.config.js +10 -7
  212. package/styled-components/cjs/examples/plasma_b2c/components/Segment/SegmentItem.config.js +8 -8
  213. package/styled-components/cjs/examples/plasma_b2c/components/Tooltip/Tooltip.stories.tsx +2 -2
  214. package/styled-components/cjs/examples/plasma_web/components/Editable/Editable.stories.tsx +2 -2
  215. package/styled-components/cjs/examples/plasma_web/components/Notification/Notification.stories.tsx +6 -3
  216. package/styled-components/cjs/examples/plasma_web/components/Segment/Segment.stories.tsx +119 -42
  217. package/styled-components/cjs/examples/plasma_web/components/Segment/SegmentGroup.config.js +13 -7
  218. package/styled-components/cjs/examples/plasma_web/components/Segment/SegmentItem.config.js +8 -8
  219. package/styled-components/cjs/examples/plasma_web/components/Tooltip/Tooltip.stories.tsx +2 -2
  220. package/styled-components/es/components/Attach/Attach.js +7 -10
  221. package/styled-components/es/components/Attach/utils/index.js +1 -2
  222. package/styled-components/es/components/Attach/utils/truncateFilename.js +17 -0
  223. package/styled-components/es/components/Breadcrumbs/Breadcrumbs.styles.js +2 -2
  224. package/styled-components/es/components/Calendar/ui/CalendarHeader/CalendarHeader.js +3 -3
  225. package/styled-components/es/components/Segment/README.md +61 -0
  226. package/styled-components/es/components/Segment/tokens.js +14 -1
  227. package/styled-components/es/components/Segment/ui/SegmentGroup/SegmentGroup.js +69 -118
  228. package/styled-components/es/components/Segment/ui/SegmentGroup/SegmentGroup.styles.js +3 -12
  229. package/styled-components/es/components/Segment/ui/SegmentGroup/variations/_filledBackgound/base.js +1 -1
  230. package/styled-components/es/components/Segment/ui/SegmentGroup/variations/_orientation/base.js +4 -0
  231. package/styled-components/es/components/Segment/ui/SegmentGroup/variations/_orientation/tokens.json +1 -0
  232. package/styled-components/es/components/Segment/ui/SegmentGroup/variations/_pilled/base.js +1 -1
  233. package/styled-components/es/components/Segment/ui/SegmentGroup/variations/_size/base.js +1 -1
  234. package/styled-components/es/components/Segment/ui/SegmentItem/SegmentItem.js +18 -8
  235. package/styled-components/es/components/Segment/ui/SegmentItem/SegmentItem.styles.js +17 -5
  236. package/styled-components/es/components/Segment/ui/SegmentItem/variations/_pilled/base.js +1 -1
  237. package/styled-components/es/components/Segment/ui/SegmentItem/variations/_view/base.js +2 -1
  238. package/styled-components/es/components/Tabs/ui/Tabs/Tabs.js +5 -5
  239. package/styled-components/es/components/_Icon/Icon.assets/DisclosureDown.js +14 -0
  240. package/styled-components/es/components/_Icon/Icon.assets/DisclosureLeft.js +3 -4
  241. package/styled-components/es/components/_Icon/Icon.assets/DisclosureLeftCentered.js +15 -0
  242. package/styled-components/es/components/_Icon/Icon.assets/DisclosureRight.js +3 -4
  243. package/styled-components/es/components/_Icon/Icon.assets/DisclosureUp.js +14 -0
  244. package/styled-components/es/components/_Icon/Icons/IconDisclosureDown.js +15 -0
  245. package/styled-components/es/components/_Icon/Icons/IconDisclosureLeftCentered.js +15 -0
  246. package/styled-components/es/components/_Icon/Icons/IconDisclosureUp.js +15 -0
  247. package/styled-components/es/components/_Icon/index.js +3 -0
  248. package/styled-components/es/examples/plasma_b2c/components/Editable/Editable.stories.tsx +2 -2
  249. package/styled-components/es/examples/plasma_b2c/components/Notification/Notification.stories.tsx +6 -3
  250. package/styled-components/es/examples/plasma_b2c/components/Segment/Segment.stories.tsx +118 -42
  251. package/styled-components/es/examples/plasma_b2c/components/Segment/SegmentGroup.config.js +10 -7
  252. package/styled-components/es/examples/plasma_b2c/components/Segment/SegmentItem.config.js +8 -8
  253. package/styled-components/es/examples/plasma_b2c/components/Tooltip/Tooltip.stories.tsx +2 -2
  254. package/styled-components/es/examples/plasma_web/components/Editable/Editable.stories.tsx +2 -2
  255. package/styled-components/es/examples/plasma_web/components/Notification/Notification.stories.tsx +6 -3
  256. package/styled-components/es/examples/plasma_web/components/Segment/Segment.stories.tsx +119 -42
  257. package/styled-components/es/examples/plasma_web/components/Segment/SegmentGroup.config.js +13 -7
  258. package/styled-components/es/examples/plasma_web/components/Segment/SegmentItem.config.js +8 -8
  259. package/styled-components/es/examples/plasma_web/components/Tooltip/Tooltip.stories.tsx +2 -2
  260. package/types/components/Attach/Attach.d.ts.map +1 -1
  261. package/types/components/Attach/utils/index.d.ts +1 -2
  262. package/types/components/Attach/utils/index.d.ts.map +1 -1
  263. package/types/components/Attach/utils/truncateFilename.d.ts +7 -0
  264. package/types/components/Attach/utils/truncateFilename.d.ts.map +1 -0
  265. package/types/components/Segment/tokens.d.ts +13 -0
  266. package/types/components/Segment/tokens.d.ts.map +1 -1
  267. package/types/components/Segment/ui/SegmentGroup/SegmentGroup.d.ts +10 -1
  268. package/types/components/Segment/ui/SegmentGroup/SegmentGroup.d.ts.map +1 -1
  269. package/types/components/Segment/ui/SegmentGroup/SegmentGroup.styles.d.ts +0 -1
  270. package/types/components/Segment/ui/SegmentGroup/SegmentGroup.styles.d.ts.map +1 -1
  271. package/types/components/Segment/ui/SegmentGroup/SegmentGroup.types.d.ts +19 -1
  272. package/types/components/Segment/ui/SegmentGroup/SegmentGroup.types.d.ts.map +1 -1
  273. package/types/components/Segment/ui/SegmentGroup/variations/_filledBackgound/base.d.ts.map +1 -1
  274. package/types/components/Segment/ui/SegmentGroup/variations/_orientation/base.d.ts +2 -0
  275. package/types/components/Segment/ui/SegmentGroup/variations/_orientation/base.d.ts.map +1 -0
  276. package/types/components/Segment/ui/SegmentGroup/variations/_pilled/base.d.ts.map +1 -1
  277. package/types/components/Segment/ui/SegmentGroup/variations/_size/base.d.ts.map +1 -1
  278. package/types/components/Segment/ui/SegmentItem/SegmentItem.d.ts +8 -2
  279. package/types/components/Segment/ui/SegmentItem/SegmentItem.d.ts.map +1 -1
  280. package/types/components/Segment/ui/SegmentItem/SegmentItem.styles.d.ts +7 -1
  281. package/types/components/Segment/ui/SegmentItem/SegmentItem.styles.d.ts.map +1 -1
  282. package/types/components/Segment/ui/SegmentItem/SegmentItem.types.d.ts +14 -1
  283. package/types/components/Segment/ui/SegmentItem/SegmentItem.types.d.ts.map +1 -1
  284. package/types/components/Segment/ui/SegmentItem/variations/_pilled/base.d.ts.map +1 -1
  285. package/types/components/Segment/ui/SegmentItem/variations/_view/base.d.ts.map +1 -1
  286. package/types/components/Tabs/ui/Tabs/Tabs.d.ts.map +1 -1
  287. package/types/components/_Icon/Icon.assets/DisclosureDown.d.ts +4 -0
  288. package/types/components/_Icon/Icon.assets/DisclosureDown.d.ts.map +1 -0
  289. package/types/components/_Icon/Icon.assets/DisclosureLeft.d.ts.map +1 -1
  290. package/types/components/_Icon/Icon.assets/DisclosureLeftCentered.d.ts +4 -0
  291. package/types/components/_Icon/Icon.assets/DisclosureLeftCentered.d.ts.map +1 -0
  292. package/types/components/_Icon/Icon.assets/DisclosureRight.d.ts.map +1 -1
  293. package/types/components/_Icon/Icon.assets/DisclosureUp.d.ts +4 -0
  294. package/types/components/_Icon/Icon.assets/DisclosureUp.d.ts.map +1 -0
  295. package/types/components/_Icon/Icons/IconDisclosureDown.d.ts +4 -0
  296. package/types/components/_Icon/Icons/IconDisclosureDown.d.ts.map +1 -0
  297. package/types/components/_Icon/Icons/IconDisclosureLeftCentered.d.ts +4 -0
  298. package/types/components/_Icon/Icons/IconDisclosureLeftCentered.d.ts.map +1 -0
  299. package/types/components/_Icon/Icons/IconDisclosureUp.d.ts +4 -0
  300. package/types/components/_Icon/Icons/IconDisclosureUp.d.ts.map +1 -0
  301. package/types/components/_Icon/index.d.ts +3 -0
  302. package/types/components/_Icon/index.d.ts.map +1 -1
  303. package/types/examples/plasma_b2c/components/Segment/Segment.d.ts +10 -1
  304. package/types/examples/plasma_b2c/components/Segment/Segment.d.ts.map +1 -1
  305. package/types/examples/plasma_b2c/components/Segment/SegmentGroup.config.d.ts +3 -0
  306. package/types/examples/plasma_b2c/components/Segment/SegmentGroup.config.d.ts.map +1 -1
  307. package/types/examples/plasma_b2c/components/Segment/SegmentItem.config.d.ts.map +1 -1
  308. package/types/examples/plasma_web/components/Segment/Segment.d.ts +13 -1
  309. package/types/examples/plasma_web/components/Segment/Segment.d.ts.map +1 -1
  310. package/types/examples/plasma_web/components/Segment/SegmentGroup.config.d.ts +6 -0
  311. package/types/examples/plasma_web/components/Segment/SegmentGroup.config.d.ts.map +1 -1
  312. package/types/examples/plasma_web/components/Segment/SegmentItem.config.d.ts.map +1 -1
  313. package/cjs/components/Attach/utils/addSeparator.js +0 -18
  314. package/cjs/components/Attach/utils/addSeparator.js.map +0 -1
  315. package/cjs/components/Attach/utils/index.js +0 -11
  316. package/cjs/components/Attach/utils/index.js.map +0 -1
  317. package/cjs/components/Segment/ui/SegmentGroup/SegmentGroup.styles_m9i9p0.css +0 -4
  318. package/cjs/components/Segment/ui/SegmentGroup/variations/_filledBackgound/base_escgtx.css +0 -1
  319. package/cjs/components/Segment/ui/SegmentGroup/variations/_pilled/base_fqbatz.css +0 -1
  320. package/cjs/components/Segment/ui/SegmentGroup/variations/_size/base_m358nl.css +0 -1
  321. package/cjs/components/Segment/ui/SegmentItem/SegmentItem.styles_18h1p52.css +0 -2
  322. package/cjs/components/Segment/ui/SegmentItem/variations/_view/base_1m1u2ys.css +0 -1
  323. package/cjs/components/_Icon/Icon.assets/DisclosureLeft.js.map +0 -1
  324. package/cjs/components/_Icon/Icons/IconDisclosureLeft.js.map +0 -1
  325. package/emotion/cjs/components/Attach/utils/addSeparator.js +0 -16
  326. package/emotion/es/components/Attach/utils/addSeparator.js +0 -10
  327. package/es/components/Attach/utils/addSeparator.js +0 -14
  328. package/es/components/Attach/utils/addSeparator.js.map +0 -1
  329. package/es/components/Attach/utils/index.js +0 -7
  330. package/es/components/Attach/utils/index.js.map +0 -1
  331. package/es/components/Segment/ui/SegmentGroup/SegmentGroup.styles_m9i9p0.css +0 -4
  332. package/es/components/Segment/ui/SegmentGroup/variations/_filledBackgound/base_escgtx.css +0 -1
  333. package/es/components/Segment/ui/SegmentGroup/variations/_pilled/base_fqbatz.css +0 -1
  334. package/es/components/Segment/ui/SegmentGroup/variations/_size/base_m358nl.css +0 -1
  335. package/es/components/Segment/ui/SegmentItem/SegmentItem.styles_18h1p52.css +0 -2
  336. package/es/components/Segment/ui/SegmentItem/variations/_view/base_1m1u2ys.css +0 -1
  337. package/es/components/_Icon/Icon.assets/DisclosureLeft.js.map +0 -1
  338. package/es/components/_Icon/Icons/IconDisclosureLeft.js.map +0 -1
  339. package/styled-components/cjs/components/Attach/utils/addSeparator.js +0 -16
  340. package/styled-components/es/components/Attach/utils/addSeparator.js +0 -10
  341. package/types/components/Attach/utils/addSeparator.d.ts +0 -2
  342. package/types/components/Attach/utils/addSeparator.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Attach.js","sources":["../../../src/components/Attach/Attach.tsx"],"sourcesContent":["import React, { forwardRef, useEffect, useRef, useState } from 'react';\nimport { useForkRef, useIsomorphicLayoutEffect } from '@salutejs/plasma-core';\n\nimport { RootProps } from '../../engines';\nimport { cx } from '../../utils';\nimport { IconCloseCircleOutline } from '../_Icon';\n\nimport { AttachProps } from './Attach.types';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base, StyledHiddenInput, StyledHiddenInputHelper } from './Attach.styles';\nimport { StyledCell } from './ui/Cell/Cell';\nimport { extractExtension, getFileicon, addSeparator, separator } from './utils';\nimport { classes } from './Attach.tokens';\nimport { AttachButton } from './components/AttachButton';\nimport { StyledIconButtonCancel } from './ui/IconButton/IconButton.styles';\n\nexport const attachRoot = (Root: RootProps<HTMLDivElement, AttachProps>) =>\n forwardRef<HTMLDivElement, AttachProps>((props, outerRef) => {\n const {\n flow = 'auto',\n buttonType = 'button',\n hasAttachment = true,\n acceptedFileFormats,\n size,\n view,\n className,\n style,\n isLoading,\n disabled,\n ...rest\n } = props;\n\n const innerRef = useRef<HTMLDivElement>(null);\n const ref = useForkRef(outerRef, innerRef);\n\n const inputRef = useRef<HTMLInputElement | null>(null);\n const inputHelperRef = useRef<HTMLDivElement | null>(null);\n const cellRef = useRef<HTMLDivElement | null>(null);\n const buttonRef = useRef<HTMLButtonElement | null>(null);\n\n const emptyTextCellWidth = useRef<number | null>(null);\n\n const [filename, setFilename] = useState<string>('');\n const [truncatedFilename, setTruncatedFilename] = useState<string>('');\n\n const horizontalClass = flow === 'horizontal' ? classes.horizontal : undefined;\n const verticalClass = flow === 'vertical' ? classes.vertical : undefined;\n const autoClass = flow === 'auto' ? classes.auto : undefined;\n const cellHiddenClass = truncatedFilename.length === 0 ? classes.cellHidden : undefined;\n\n const accept = acceptedFileFormats?.join(',');\n const extension = extractExtension(filename);\n const cellContentLeft = getFileicon(extension, size);\n\n useEffect(() => {\n emptyTextCellWidth.current = cellRef.current?.offsetWidth || 0;\n }, []);\n\n useIsomorphicLayoutEffect(() => {\n if (\n !cellRef.current ||\n !cellRef.current.parentElement ||\n !inputHelperRef.current ||\n !inputHelperRef.current.textContent ||\n !emptyTextCellWidth.current ||\n !buttonRef.current\n ) {\n return;\n }\n\n const { offsetWidth: textWidth } = inputHelperRef.current;\n const { offsetWidth: buttonWidth } = buttonRef.current;\n const { width: parentWidth, left: parentLeft } = cellRef.current.parentElement.getBoundingClientRect();\n const { left: cellLeft } = cellRef.current.getBoundingClientRect();\n const leftDiff = cellLeft - parentLeft;\n let currentTextWidth = textWidth;\n\n if (\n currentTextWidth + emptyTextCellWidth.current + leftDiff <= parentWidth ||\n currentTextWidth + emptyTextCellWidth.current < buttonWidth\n ) {\n setTruncatedFilename(filename);\n return;\n }\n\n let currFilename = addSeparator(filename, separator);\n for (let i = currFilename.indexOf(separator) - 1; i > 0; i -= 1) {\n if (currentTextWidth + emptyTextCellWidth.current + leftDiff <= parentWidth) {\n break;\n }\n\n const left = currFilename.slice(0, i);\n const right = currFilename.slice(i + 1);\n const newFilename = `${left}${right}`;\n inputHelperRef.current.textContent = newFilename;\n currentTextWidth = inputHelperRef.current.offsetWidth;\n\n if (currentTextWidth + emptyTextCellWidth.current < buttonWidth) {\n break;\n }\n\n currFilename = newFilename;\n }\n\n inputHelperRef.current.textContent = filename;\n setTruncatedFilename(currFilename);\n });\n\n const handleClick = () => {\n if (!inputRef.current) {\n return;\n }\n\n inputRef.current.click();\n };\n\n const handleChange = () => {\n if (!inputRef.current || !inputRef.current.files) {\n return;\n }\n\n setFilename(inputRef.current.files[0].name);\n };\n\n const handleClear = () => {\n if (!inputRef.current) {\n return;\n }\n\n inputRef.current.value = '';\n setFilename('');\n setTruncatedFilename('');\n };\n\n return (\n <Root\n className={cx(horizontalClass, verticalClass, autoClass, className)}\n style={style}\n size={size}\n view={view}\n ref={ref}\n >\n <StyledHiddenInput\n ref={inputRef}\n accept={accept}\n type=\"file\"\n id=\"attachHiddenInput\"\n name=\"attachHiddenInput\"\n onChange={handleChange}\n />\n <StyledHiddenInputHelper ref={inputHelperRef} id=\"attachHiddenInputHelper\">\n {filename}\n </StyledHiddenInputHelper>\n\n <AttachButton\n buttonType={buttonType}\n view={view}\n size={size}\n onClick={handleClick}\n isLoading={isLoading}\n disabled={disabled}\n ref={buttonRef}\n {...rest}\n />\n {hasAttachment && (\n <StyledCell\n stretching=\"fixed\"\n className={cellHiddenClass}\n ref={cellRef}\n size={size}\n title={truncatedFilename}\n contentLeft={cellContentLeft}\n contentRight={\n <StyledIconButtonCancel view={view} size={size} onClick={handleClear}>\n <IconCloseCircleOutline size=\"xs\" color=\"inherit\" />\n </StyledIconButtonCancel>\n }\n />\n )}\n </Root>\n );\n });\n\nexport const attachConfig = {\n name: 'Attach',\n tag: 'div',\n layout: attachRoot,\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":["attachRoot","Root","forwardRef","props","outerRef","_props$flow","flow","_props$buttonType","buttonType","_props$hasAttachment","hasAttachment","acceptedFileFormats","size","view","className","style","isLoading","disabled","rest","_objectWithoutProperties","_excluded","innerRef","useRef","ref","useForkRef","inputRef","inputHelperRef","cellRef","buttonRef","emptyTextCellWidth","_useState","useState","_useState2","_slicedToArray","filename","setFilename","_useState3","_useState4","truncatedFilename","setTruncatedFilename","horizontalClass","classes","horizontal","undefined","verticalClass","vertical","autoClass","auto","cellHiddenClass","length","cellHidden","accept","join","extension","extractExtension","cellContentLeft","getFileicon","useEffect","_cellRef$current","current","offsetWidth","useIsomorphicLayoutEffect","parentElement","textContent","textWidth","buttonWidth","_cellRef$current$pare","getBoundingClientRect","parentWidth","width","parentLeft","left","_cellRef$current$getB","cellLeft","leftDiff","currentTextWidth","currFilename","addSeparator","separator","i","indexOf","slice","right","newFilename","concat","handleClick","click","handleChange","files","name","handleClear","value","React","createElement","cx","StyledHiddenInput","type","id","onChange","StyledHiddenInputHelper","AttachButton","_extends","onClick","StyledCell","stretching","title","contentLeft","contentRight","StyledIconButtonCancel","_IconCloseCircleOutli","IconCloseCircleOutline","color","attachConfig","tag","layout","base","variations","css","viewCSS","size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AA;AAC3B,KACJ,CAEH,CAAC,CAAA;AAEf,GAAC,CAAC,CAAA;AAAA,EAAA;AAEC,IAAMC,YAAY,GAAG;AACxBvB,EAAAA,IAAI,EAAE,QAAQ;AACdwB,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAElH,UAAU;AAClBmH,EAAAA,IAAI,EAAJA,IAAI;AACJC,EAAAA,UAAU,EAAE;AACRvG,IAAAA,IAAI,EAAE;AACFwG,MAAAA,GAAG,EAAEC,MAAAA;KACR;AACD1G,IAAAA,IAAI,EAAE;AACFyG,MAAAA,GAAG,EAAEE,MAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACN3G,IAAAA,IAAI,EAAE,SAAS;AACfD,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
1
+ {"version":3,"file":"Attach.js","sources":["../../../src/components/Attach/Attach.tsx"],"sourcesContent":["import React, { forwardRef, useEffect, useRef, useState } from 'react';\nimport { useForkRef, useIsomorphicLayoutEffect } from '@salutejs/plasma-core';\n\nimport { RootProps } from '../../engines';\nimport { cx } from '../../utils';\nimport { IconCloseCircleOutline } from '../_Icon';\n\nimport { AttachProps } from './Attach.types';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base, StyledHiddenInput, StyledHiddenInputHelper } from './Attach.styles';\nimport { StyledCell } from './ui/Cell/Cell';\nimport { extractExtension, getFileicon, truncateFilename } from './utils';\nimport { classes } from './Attach.tokens';\nimport { AttachButton } from './components/AttachButton';\nimport { StyledIconButtonCancel } from './ui/IconButton/IconButton.styles';\n\nexport const attachRoot = (Root: RootProps<HTMLDivElement, AttachProps>) =>\n forwardRef<HTMLDivElement, AttachProps>((props, outerRef) => {\n const {\n flow = 'auto',\n buttonType = 'button',\n hasAttachment = true,\n acceptedFileFormats,\n size,\n view,\n className,\n style,\n isLoading,\n disabled,\n ...rest\n } = props;\n\n const innerRef = useRef<HTMLDivElement>(null);\n const ref = useForkRef(outerRef, innerRef);\n\n const inputRef = useRef<HTMLInputElement | null>(null);\n const inputHelperRef = useRef<HTMLDivElement | null>(null);\n const cellRef = useRef<HTMLDivElement | null>(null);\n const buttonRef = useRef<HTMLButtonElement | null>(null);\n\n const emptyTextCellWidth = useRef<number | null>(null);\n\n const [filename, setFilename] = useState<string>('');\n const [truncatedFilename, setTruncatedFilename] = useState<string>('');\n\n const horizontalClass = flow === 'horizontal' ? classes.horizontal : undefined;\n const verticalClass = flow === 'vertical' ? classes.vertical : undefined;\n const autoClass = flow === 'auto' ? classes.auto : undefined;\n const cellHiddenClass = truncatedFilename.length === 0 ? classes.cellHidden : undefined;\n\n const accept = acceptedFileFormats?.join(',');\n const extension = extractExtension(filename);\n const cellContentLeft = getFileicon(extension, size);\n\n useEffect(() => {\n emptyTextCellWidth.current = cellRef.current?.offsetWidth || 0;\n }, []);\n\n useIsomorphicLayoutEffect(() => {\n if (\n !cellRef.current ||\n !cellRef.current.parentElement ||\n !inputHelperRef.current ||\n !inputHelperRef.current.textContent ||\n !emptyTextCellWidth.current ||\n !buttonRef.current\n ) {\n return;\n }\n\n const { offsetWidth: textWidth } = inputHelperRef.current;\n const { offsetWidth: buttonWidth } = buttonRef.current;\n const { width: parentWidth, left: parentLeft } = cellRef.current.parentElement.getBoundingClientRect();\n const { left: cellLeft } = cellRef.current.getBoundingClientRect();\n const leftDiff = cellLeft - parentLeft;\n\n let currentTextWidth = textWidth;\n let currFilename = filename;\n\n for (let i = filename.length - 1; i > 0; i -= 1) {\n if (currentTextWidth + emptyTextCellWidth.current + leftDiff <= parentWidth) {\n break;\n }\n\n const newFilename = truncateFilename({\n filename: inputHelperRef.current.textContent,\n startNameTruncationIndex: i,\n });\n inputHelperRef.current.textContent = newFilename;\n currentTextWidth = inputHelperRef.current.offsetWidth;\n\n if (currentTextWidth + emptyTextCellWidth.current < buttonWidth) {\n break;\n }\n\n currFilename = newFilename;\n }\n\n inputHelperRef.current.textContent = filename;\n setTruncatedFilename(currFilename);\n });\n\n const handleClick = () => {\n if (!inputRef.current) {\n return;\n }\n\n inputRef.current.click();\n };\n\n const handleChange = () => {\n if (!inputRef.current || !inputRef.current.files) {\n return;\n }\n\n setFilename(inputRef.current.files[0].name);\n };\n\n const handleClear = () => {\n if (!inputRef.current) {\n return;\n }\n\n inputRef.current.value = '';\n setFilename('');\n setTruncatedFilename('');\n };\n\n return (\n <Root\n className={cx(horizontalClass, verticalClass, autoClass, className)}\n style={style}\n size={size}\n view={view}\n ref={ref}\n >\n <StyledHiddenInput\n ref={inputRef}\n accept={accept}\n type=\"file\"\n id=\"attachHiddenInput\"\n name=\"attachHiddenInput\"\n onChange={handleChange}\n />\n <StyledHiddenInputHelper ref={inputHelperRef} id=\"attachHiddenInputHelper\">\n {filename}\n </StyledHiddenInputHelper>\n\n <AttachButton\n buttonType={buttonType}\n view={view}\n size={size}\n onClick={handleClick}\n isLoading={isLoading}\n disabled={disabled}\n ref={buttonRef}\n {...rest}\n />\n {hasAttachment && (\n <StyledCell\n stretching=\"fixed\"\n className={cellHiddenClass}\n ref={cellRef}\n size={size}\n title={truncatedFilename}\n contentLeft={cellContentLeft}\n contentRight={\n <StyledIconButtonCancel view={view} size={size} onClick={handleClear}>\n <IconCloseCircleOutline size=\"xs\" color=\"inherit\" />\n </StyledIconButtonCancel>\n }\n />\n )}\n </Root>\n );\n });\n\nexport const attachConfig = {\n name: 'Attach',\n tag: 'div',\n layout: attachRoot,\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":["attachRoot","Root","forwardRef","props","outerRef","_props$flow","flow","_props$buttonType","buttonType","_props$hasAttachment","hasAttachment","acceptedFileFormats","size","view","className","style","isLoading","disabled","rest","_objectWithoutProperties","_excluded","innerRef","useRef","ref","useForkRef","inputRef","inputHelperRef","cellRef","buttonRef","emptyTextCellWidth","_useState","useState","_useState2","_slicedToArray","filename","setFilename","_useState3","_useState4","truncatedFilename","setTruncatedFilename","horizontalClass","classes","horizontal","undefined","verticalClass","vertical","autoClass","auto","cellHiddenClass","length","cellHidden","accept","join","extension","extractExtension","cellContentLeft","getFileicon","useEffect","_cellRef$current","current","offsetWidth","useIsomorphicLayoutEffect","parentElement","textContent","textWidth","buttonWidth","_cellRef$current$pare","getBoundingClientRect","parentWidth","width","parentLeft","left","_cellRef$current$getB","cellLeft","leftDiff","currentTextWidth","currFilename","i","newFilename","truncateFilename","startNameTruncationIndex","handleClick","click","handleChange","files","name","handleClear","value","React","createElement","cx","StyledHiddenInput","type","id","onChange","StyledHiddenInputHelper","AttachButton","_extends","onClick","StyledCell","stretching","title","contentLeft","contentRight","StyledIconButtonCancel","_IconCloseCircleOutli","IconCloseCircleOutline","color","attachConfig","tag","layout","base","variations","css","viewCSS","sizeCSS","defaults"],"mappings":";;;;;;;;;;;;;;;;;;;IAiBaA,UAAU,GAAG,SAAbA,UAAUA,CAAIC,IAA4C,EAAA;AAAA,EAAA,oBACnEC,UAAU,CAA8B,UAACC,KAAK,EAAEC,QAAQ,EAAK;AACzD,IAAA,IAAAC,WAAA,GAYIF,KAAK,CAXLG,IAAI;AAAJA,MAAAA,IAAI,GAAAD,WAAA,KAAG,KAAA,CAAA,GAAA,MAAM,GAAAA,WAAA;MAAAE,iBAAA,GAWbJ,KAAK,CAVLK,UAAU;AAAVA,MAAAA,UAAU,GAAAD,iBAAA,KAAG,KAAA,CAAA,GAAA,QAAQ,GAAAA,iBAAA;MAAAE,oBAAA,GAUrBN,KAAK,CATLO,aAAa;AAAbA,MAAAA,aAAa,GAAAD,oBAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,oBAAA;MACpBE,mBAAmB,GAQnBR,KAAK,CARLQ,mBAAmB;MACnBC,IAAI,GAOJT,KAAK,CAPLS,IAAI;MACJC,IAAI,GAMJV,KAAK,CANLU,IAAI;MACJC,SAAS,GAKTX,KAAK,CALLW,SAAS;MACTC,KAAK,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,qBAAA,gBACjEjB,KAAA,CAAAC,aAAA,CAACiB,sBAAsB,EAAA;AAAC9F,QAAAA,IAAI,EAAC,IAAI;AAAC+F,QAAAA,KAAK,EAAC,SAAA;AAAS,OAAE,CAAC,CAChC,CAAA;AAC3B,KACJ,CAEH,CAAC,CAAA;AAEf,GAAC,CAAC,CAAA;AAAA,EAAA;AAEC,IAAMC,YAAY,GAAG;AACxBvB,EAAAA,IAAI,EAAE,QAAQ;AACdwB,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE9G,UAAU;AAClB+G,EAAAA,IAAI,EAAJA,IAAI;AACJC,EAAAA,UAAU,EAAE;AACRnG,IAAAA,IAAI,EAAE;AACFoG,MAAAA,GAAG,EAAEC,MAAAA;KACR;AACDtG,IAAAA,IAAI,EAAE;AACFqG,MAAAA,GAAG,EAAEE,MAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNvG,IAAAA,IAAI,EAAE,SAAS;AACfD,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;"}
@@ -0,0 +1,20 @@
1
+ var truncateFilename = function truncateFilename(_ref) {
2
+ var filename = _ref.filename,
3
+ startNameTruncationIndex = _ref.startNameTruncationIndex,
4
+ _ref$separator = _ref.separator,
5
+ separator = _ref$separator === void 0 ? '...' : _ref$separator,
6
+ _ref$minNameLength = _ref.minNameLength,
7
+ minNameLength = _ref$minNameLength === void 0 ? 5 : _ref$minNameLength;
8
+ var strings = filename.split('.');
9
+ var extension = strings.length > 1 ? strings[strings.length - 1] : null;
10
+ var name = strings.length > 1 ? strings.slice(0, -1).join('.') : strings[0];
11
+ if (name.length <= minNameLength || startNameTruncationIndex >= name.length - 1) {
12
+ return filename;
13
+ }
14
+ var lastNameLetter = name[name.length - 1];
15
+ var truncatedName = "".concat(name.substring(0, startNameTruncationIndex)).concat(separator).concat(lastNameLetter);
16
+ return extension ? "".concat(truncatedName, ".").concat(extension) : truncatedName;
17
+ };
18
+
19
+ export { truncateFilename };
20
+ //# sourceMappingURL=truncateFilename.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"truncateFilename.js","sources":["../../../../src/components/Attach/utils/truncateFilename.ts"],"sourcesContent":["export const truncateFilename = ({\n filename,\n startNameTruncationIndex,\n separator = '...',\n minNameLength = 5,\n}: {\n filename: string;\n startNameTruncationIndex: number;\n separator?: string;\n minNameLength?: number;\n}) => {\n const strings = filename.split('.');\n const extension = strings.length > 1 ? strings[strings.length - 1] : null;\n const name = strings.length > 1 ? strings.slice(0, -1).join('.') : strings[0];\n\n if (name.length <= minNameLength || startNameTruncationIndex >= name.length - 1) {\n return filename;\n }\n\n const lastNameLetter = name[name.length - 1];\n const truncatedName = `${name.substring(0, startNameTruncationIndex)}${separator}${lastNameLetter}`;\n\n return extension ? `${truncatedName}.${extension}` : truncatedName;\n};\n"],"names":["truncateFilename","_ref","filename","startNameTruncationIndex","_ref$separator","separator","_ref$minNameLength","minNameLength","strings","split","extension","length","name","slice","join","lastNameLetter","truncatedName","concat","substring"],"mappings":"IAAaA,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAAC,IAAA,EAUvB;AAAA,EAAA,IATFC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRC,wBAAwB,GAAAF,IAAA,CAAxBE,wBAAwB;IAAAC,cAAA,GAAAH,IAAA,CACxBI,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,cAAA;IAAAE,kBAAA,GAAAL,IAAA,CACjBM,aAAa;AAAbA,IAAAA,aAAa,GAAAD,kBAAA,KAAG,KAAA,CAAA,GAAA,CAAC,GAAAA,kBAAA,CAAA;AAOjB,EAAA,IAAME,OAAO,GAAGN,QAAQ,CAACO,KAAK,CAAC,GAAG,CAAC,CAAA;AACnC,EAAA,IAAMC,SAAS,GAAGF,OAAO,CAACG,MAAM,GAAG,CAAC,GAAGH,OAAO,CAACA,OAAO,CAACG,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,CAAA;EACzE,IAAMC,IAAI,GAAGJ,OAAO,CAACG,MAAM,GAAG,CAAC,GAAGH,OAAO,CAACK,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC,GAAGN,OAAO,CAAC,CAAC,CAAC,CAAA;AAE7E,EAAA,IAAII,IAAI,CAACD,MAAM,IAAIJ,aAAa,IAAIJ,wBAAwB,IAAIS,IAAI,CAACD,MAAM,GAAG,CAAC,EAAE;AAC7E,IAAA,OAAOT,QAAQ,CAAA;AACnB,GAAA;EAEA,IAAMa,cAAc,GAAGH,IAAI,CAACA,IAAI,CAACD,MAAM,GAAG,CAAC,CAAC,CAAA;EAC5C,IAAMK,aAAa,MAAAC,MAAA,CAAML,IAAI,CAACM,SAAS,CAAC,CAAC,EAAEf,wBAAwB,CAAC,CAAA,CAAAc,MAAA,CAAGZ,SAAS,EAAAY,MAAA,CAAGF,cAAc,CAAE,CAAA;EAEnG,OAAOL,SAAS,GAAAO,EAAAA,CAAAA,MAAA,CAAMD,aAAa,OAAAC,MAAA,CAAIP,SAAS,CAAA,GAAKM,aAAa,CAAA;AACtE;;;;"}
@@ -4,7 +4,7 @@ import { linkConfig } from '../Link/Link.js';
4
4
  import '@linaria/core';
5
5
  import { component, mergeConfig } from '../../engines/common.js';
6
6
  import 'react';
7
- import { IconDisclosureRight } from '../_Icon/Icons/IconDisclosureRight.js';
7
+ import { IconDisclosureRightCentered } from '../_Icon/Icons/IconDisclosureRightCentered.js';
8
8
  import { tokens } from './Breadcrumbs.tokens.js';
9
9
 
10
10
  var mergedLinkConfig = /*#__PURE__*/mergeConfig(linkConfig);
@@ -28,7 +28,7 @@ var StyledLink = /*#__PURE__*/styled(_exp())({
28
28
  });
29
29
  var base = "bkgt5xr";
30
30
  var _exp12 = function _exp12() {
31
- return IconDisclosureRight;
31
+ return IconDisclosureRightCentered;
32
32
  };
33
33
  var Separator = /*#__PURE__*/styled(_exp12())({
34
34
  name: "Separator",
@@ -1 +1 @@
1
- {"version":3,"file":"Breadcrumbs.styles.js","sources":["../../../src/components/Breadcrumbs/Breadcrumbs.styles.ts"],"sourcesContent":["import { styled } from '@linaria/react';\nimport { css } from '@linaria/core';\n\nimport { linkConfig } from '../Link';\nimport { component, mergeConfig } from '../../engines';\nimport { IconDisclosureRight } from '../_Icon';\nimport { addFocus } from '../../mixins';\n\nimport { tokens } from './Breadcrumbs.tokens';\n\nconst mergedLinkConfig = mergeConfig(linkConfig);\nconst Link = component(mergedLinkConfig);\n\nexport const StyledLink = styled(Link)<{ isHref: boolean }>`\n opacity: ${({ isHref }) => (isHref ? 1 : `var(${tokens.breadcrumbsOpacity})`)};\n\n ${addFocus({\n outlineOffset: '0rem',\n outlineSize: '0.125rem',\n outlineRadius: '0rem',\n outlineColor: `var(${tokens.breadcrumbsFocusOutlineColor})`,\n })}\n`;\n\nexport const base = css`\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: var(${tokens.breadcrumbsGap});\n\n color: var(${tokens.breadcrumbsColor});\n font-family: var(${tokens.breadcrumbsFontFamily});\n font-size: var(${tokens.breadcrumbsFontSize});\n font-weight: var(${tokens.breadcrumbsFontWeight});\n font-style: var(${tokens.breadcrumbsFontStyle});\n letter-spacing: var(${tokens.breadcrumbsLetterSpacing});\n line-height: var(${tokens.breadcrumbsLineHeight});\n`;\n\nexport const Separator = styled(IconDisclosureRight)`\n color: var(${tokens.breadcrumbsColor});\n opacity: var(${tokens.breadcrumbsOpacity});\n`;\n"],"names":["mergedLinkConfig","mergeConfig","linkConfig","Link","component","_exp","_exp2","_ref","isHref","concat","tokens","breadcrumbsOpacity","StyledLink","styled","name","class","propsAsIs","vars","base","_exp12","IconDisclosureRight","Separator"],"mappings":";;;;;;;;AAUA,IAAMA,gBAAgB,gBAAGC,WAAW,CAACC,UAAU,CAAC,CAAA;AAChD,IAAMC,IAAI,gBAAGC,SAAS,CAACJ,gBAAgB,CAAC,CAAA;AAAC,IAAAK,IAAA,GAVvBA,SAUuBA,IAAAA,GAAA;AAAA,EAAA,OAERF,IAAI,CAAA;AAAA,CAAA,CAAA;AAAA,IAAAG,KAAA,GAZnBA,SAYmBA,KAAAA,GAAA;AAAA,EAAA,OACtB,UAAAC,IAAA,EAAA;AAAA,IAAA,IAAGC,MAAAA,GAAAA,IAAAA,CAAAA,MAAAA,CAAAA;IAAAA,OAAcA,MAAM,GAAG,CAAC,GAAA,MAAA,CAAAC,MAAA,CAAUC,MAAM,CAACC,kBAAmB,EAAG,GAAA,CAAA,CAAA;AAAA,GAAA,CAAA;AAAA,CAAA,CAAA;AAD1E,IAAMC,UAAU,gBAAGC,MAAM,CAAAR,IAAA,EAAA,CAAA,CAAA;AAAAS,EAAAA,IAAA,EAAA,YAAA;AAAAC,EAAAA,OAAAA,EAAA,SAAA;AAAAC,EAAAA,SAAA,EAAA,IAAA;AAAAC,EAAAA,IAAA,EAAA;AAAA,IAAA,WAAA,EAAA,cACjBX,KAAkE,EAAA,CAAA;AAAA,GAAA;AAAA,CAQhF,EAAA;AAEM,IAAMY,IAAI,GAahB,UAAA;AAAC,IAAAC,MAAA,GApCgBA,SAoChBA,MAAAA,GAAA;AAAA,EAAA,OAE8BC,mBAAmB,CAAA;AAAA,CAAA,CAAA;AAA5C,IAAMC,SAAS,gBAAGR,MAAM,CAAAM,MAAA,EAAA,CAAA,CAAA;AAAAL,EAAAA,IAAA,EAAA,WAAA;AAAAC,EAAAA,OAAAA,EAAA,SAAA;AAAAC,EAAAA,SAAA,EAAA,IAAA;AAAA,CAG9B;;;;"}
1
+ {"version":3,"file":"Breadcrumbs.styles.js","sources":["../../../src/components/Breadcrumbs/Breadcrumbs.styles.ts"],"sourcesContent":["import { styled } from '@linaria/react';\nimport { css } from '@linaria/core';\n\nimport { linkConfig } from '../Link';\nimport { component, mergeConfig } from '../../engines';\nimport { IconDisclosureRightCentered } from '../_Icon';\nimport { addFocus } from '../../mixins';\n\nimport { tokens } from './Breadcrumbs.tokens';\n\nconst mergedLinkConfig = mergeConfig(linkConfig);\nconst Link = component(mergedLinkConfig);\n\nexport const StyledLink = styled(Link)<{ isHref: boolean }>`\n opacity: ${({ isHref }) => (isHref ? 1 : `var(${tokens.breadcrumbsOpacity})`)};\n\n ${addFocus({\n outlineOffset: '0rem',\n outlineSize: '0.125rem',\n outlineRadius: '0rem',\n outlineColor: `var(${tokens.breadcrumbsFocusOutlineColor})`,\n })}\n`;\n\nexport const base = css`\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: var(${tokens.breadcrumbsGap});\n\n color: var(${tokens.breadcrumbsColor});\n font-family: var(${tokens.breadcrumbsFontFamily});\n font-size: var(${tokens.breadcrumbsFontSize});\n font-weight: var(${tokens.breadcrumbsFontWeight});\n font-style: var(${tokens.breadcrumbsFontStyle});\n letter-spacing: var(${tokens.breadcrumbsLetterSpacing});\n line-height: var(${tokens.breadcrumbsLineHeight});\n`;\n\nexport const Separator = styled(IconDisclosureRightCentered)`\n color: var(${tokens.breadcrumbsColor});\n opacity: var(${tokens.breadcrumbsOpacity});\n`;\n"],"names":["mergedLinkConfig","mergeConfig","linkConfig","Link","component","_exp","_exp2","_ref","isHref","concat","tokens","breadcrumbsOpacity","StyledLink","styled","name","class","propsAsIs","vars","base","_exp12","IconDisclosureRightCentered","Separator"],"mappings":";;;;;;;;AAUA,IAAMA,gBAAgB,gBAAGC,WAAW,CAACC,UAAU,CAAC,CAAA;AAChD,IAAMC,IAAI,gBAAGC,SAAS,CAACJ,gBAAgB,CAAC,CAAA;AAAC,IAAAK,IAAA,GAVvBA,SAUuBA,IAAAA,GAAA;AAAA,EAAA,OAERF,IAAI,CAAA;AAAA,CAAA,CAAA;AAAA,IAAAG,KAAA,GAZnBA,SAYmBA,KAAAA,GAAA;AAAA,EAAA,OACtB,UAAAC,IAAA,EAAA;AAAA,IAAA,IAAGC,MAAAA,GAAAA,IAAAA,CAAAA,MAAAA,CAAAA;IAAAA,OAAcA,MAAM,GAAG,CAAC,GAAA,MAAA,CAAAC,MAAA,CAAUC,MAAM,CAACC,kBAAmB,EAAG,GAAA,CAAA,CAAA;AAAA,GAAA,CAAA;AAAA,CAAA,CAAA;AAD1E,IAAMC,UAAU,gBAAGC,MAAM,CAAAR,IAAA,EAAA,CAAA,CAAA;AAAAS,EAAAA,IAAA,EAAA,YAAA;AAAAC,EAAAA,OAAAA,EAAA,SAAA;AAAAC,EAAAA,SAAA,EAAA,IAAA;AAAAC,EAAAA,IAAA,EAAA;AAAA,IAAA,WAAA,EAAA,cACjBX,KAAkE,EAAA,CAAA;AAAA,GAAA;AAAA,CAQhF,EAAA;AAEM,IAAMY,IAAI,GAahB,UAAA;AAAC,IAAAC,MAAA,GApCgBA,SAoChBA,MAAAA,GAAA;AAAA,EAAA,OAE8BC,2BAA2B,CAAA;AAAA,CAAA,CAAA;AAApD,IAAMC,SAAS,gBAAGR,MAAM,CAAAM,MAAA,EAAA,CAAA,CAAA;AAAAL,EAAAA,IAAA,EAAA,WAAA;AAAAC,EAAAA,OAAAA,EAAA,SAAA;AAAAC,EAAAA,SAAA,EAAA,IAAA;AAAA,CAG9B;;;;"}
@@ -1,8 +1,8 @@
1
1
  import React, { useCallback, useMemo } from 'react';
2
- import { IconDisclosureLeft } from '../../../_Icon/Icons/IconDisclosureLeft.js';
3
- import { IconDisclosureRight } from '../../../_Icon/Icons/IconDisclosureRight.js';
4
- import { IconDisclosureDownFill } from '../../../_Icon/Icons/IconDisclosureDownFill.js';
5
2
  import '@linaria/react';
3
+ import { IconDisclosureDownFill } from '../../../_Icon/Icons/IconDisclosureDownFill.js';
4
+ import { IconDisclosureLeftCentered } from '../../../_Icon/Icons/IconDisclosureLeftCentered.js';
5
+ import { IconDisclosureRightCentered } from '../../../_Icon/Icons/IconDisclosureRightCentered.js';
6
6
  import { CalendarState } from '../../store/types.js';
7
7
  import { MONTH_NAMES, YEAR_RENDER_COUNT } from '../../utils/constants.js';
8
8
  import { getCalendarType } from '../../utils/calendarGridHelper.js';
@@ -67,7 +67,7 @@ var CalendarHeader = function CalendarHeader(_ref) {
67
67
  onClick: function onClick() {
68
68
  return onPrev();
69
69
  }
70
- }, /*#__PURE__*/React.createElement(IconDisclosureLeft, {
70
+ }, /*#__PURE__*/React.createElement(IconDisclosureLeftCentered, {
71
71
  color: "inherit",
72
72
  size: size === 'xs' ? 'xs' : 's'
73
73
  }));
@@ -78,7 +78,7 @@ var CalendarHeader = function CalendarHeader(_ref) {
78
78
  onClick: function onClick() {
79
79
  return onNext();
80
80
  }
81
- }, /*#__PURE__*/React.createElement(IconDisclosureRight, {
81
+ }, /*#__PURE__*/React.createElement(IconDisclosureRightCentered, {
82
82
  color: "inherit",
83
83
  size: size === 'xs' ? 'xs' : 's'
84
84
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"CalendarHeader.js","sources":["../../../../../src/components/Calendar/ui/CalendarHeader/CalendarHeader.tsx"],"sourcesContent":["import React, { useCallback, useMemo } from 'react';\n\nimport { IconDisclosureDownFill, IconDisclosureLeft, IconDisclosureRight } from '../../../_Icon';\nimport { CalendarState } from '../../store/types';\nimport { getCalendarType, MONTH_NAMES, YEAR_RENDER_COUNT } from '../../utils';\nimport type { DateObject } from '../../Calendar.types';\nimport { classes } from '../../Calendar.tokens';\nimport { sizeMap } from '../../store/reducer';\n\nimport type { CalendarHeaderProps } from './CalendarHeader.types';\nimport {\n StyledArrow,\n StyledArrows,\n StyledCalendarHeader,\n StyledDoubleHeaderWrapper,\n StyledHeader,\n StyledHeaderDate,\n StyledHeaderDouble,\n StyledNavigation,\n} from './CalendarHeader.styles';\n\n/**\n * Компонент шапки календаря.\n */\nexport const CalendarHeader: React.FC<CalendarHeaderProps> = ({\n type = 'Days',\n startYear = 0,\n size,\n firstDate,\n secondDate,\n isDouble,\n onPrev,\n onNext,\n onUpdateCalendarState,\n locale,\n}) => {\n const handleCalendarState = useCallback(() => {\n const newSize: [number, number] = isDouble ? sizeMap.Months.double : sizeMap.Months.single;\n\n if (type === CalendarState.Days) {\n onUpdateCalendarState?.(CalendarState.Months, newSize);\n }\n\n if (type === CalendarState.Months || type === CalendarState.Quarters) {\n onUpdateCalendarState?.(CalendarState.Years, newSize);\n }\n }, [type, onUpdateCalendarState]);\n\n const getHeaderContent = useCallback(\n (date?: DateObject, secondPart?: boolean) => {\n if (!date) {\n return '';\n }\n\n if (type === CalendarState.Days) {\n return (\n <>\n <StyledHeaderDate>{MONTH_NAMES[locale][date.monthIndex]}</StyledHeaderDate>\n <StyledHeaderDate>\n {date.year}\n <IconDisclosureDownFill color=\"inherit\" size={size === 'xs' ? 'xs' : 's'} />\n </StyledHeaderDate>\n </>\n );\n }\n\n if (type === CalendarState.Months || type === CalendarState.Quarters) {\n return (\n <StyledHeaderDate>\n {date.year}\n <IconDisclosureDownFill color=\"inherit\" size={size === 'xs' ? 'xs' : 's'} />\n </StyledHeaderDate>\n );\n }\n\n if (type === CalendarState.Years) {\n const yearValue = secondPart ? startYear + 12 : startYear;\n\n return (\n <StyledHeaderDate>\n {yearValue}—{yearValue + YEAR_RENDER_COUNT - 1}\n <IconDisclosureDownFill color=\"inherit\" size={size === 'xs' ? 'xs' : 's'} />\n </StyledHeaderDate>\n );\n }\n\n return '';\n },\n [type, startYear, size, locale],\n );\n\n const currentCalendarType = getCalendarType(type);\n\n const PreviousButton = useMemo(\n () => (\n <StyledArrow aria-label={`Предыдущий ${currentCalendarType}`} onClick={() => onPrev()}>\n <IconDisclosureLeft color=\"inherit\" size={size === 'xs' ? 'xs' : 's'} />\n </StyledArrow>\n ),\n [currentCalendarType, size, onPrev],\n );\n\n const NextButton = useMemo(\n () => (\n <StyledArrow aria-label={`Следующий ${currentCalendarType}`} onClick={() => onNext()}>\n <IconDisclosureRight color=\"inherit\" size={size === 'xs' ? 'xs' : 's'} />\n </StyledArrow>\n ),\n [currentCalendarType, size, onNext],\n );\n\n return (\n <StyledCalendarHeader>\n {isDouble ? (\n <StyledNavigation>\n <StyledDoubleHeaderWrapper>\n {PreviousButton}\n <StyledHeaderDouble onClick={handleCalendarState} aria-live=\"polite\">\n {getHeaderContent(firstDate)}\n </StyledHeaderDouble>\n </StyledDoubleHeaderWrapper>\n <StyledDoubleHeaderWrapper className={classes.doubleHeaderLastDateWrapper}>\n <StyledHeaderDouble onClick={handleCalendarState} aria-live=\"polite\">\n {getHeaderContent(secondDate, true)}\n </StyledHeaderDouble>\n {NextButton}\n </StyledDoubleHeaderWrapper>\n </StyledNavigation>\n ) : (\n <>\n <StyledHeader\n type=\"button\"\n aria-live=\"polite\"\n id=\"id-grid-label\"\n onClick={handleCalendarState}\n tabIndex={0}\n >\n {getHeaderContent(firstDate)}\n </StyledHeader>\n <StyledArrows>\n {PreviousButton}\n {NextButton}\n </StyledArrows>\n </>\n )}\n </StyledCalendarHeader>\n );\n};\n"],"names":["CalendarHeader","_ref","_ref$type","type","_ref$startYear","startYear","size","firstDate","secondDate","isDouble","onPrev","onNext","onUpdateCalendarState","locale","handleCalendarState","useCallback","newSize","sizeMap","Months","single","CalendarState","Days","Quarters","Years","getHeaderContent","date","secondPart","React","createElement","Fragment","StyledHeaderDate","MONTH_NAMES","monthIndex","year","IconDisclosureDownFill","color","yearValue","YEAR_RENDER_COUNT","currentCalendarType","getCalendarType","PreviousButton","useMemo","StyledArrow","concat","onClick","IconDisclosureLeft","NextButton","IconDisclosureRight","StyledCalendarHeader","StyledNavigation","StyledDoubleHeaderWrapper","StyledHeaderDouble","className","classes","doubleHeaderLastDateWrapper","StyledHeader","id","tabIndex","StyledArrows"],"mappings":";;;;;;;;;;;;AAqBA;AACA;AACA;IACaA,cAA6C,GAAG,SAAhDA,cAA6CA,CAAAC,IAAA,EAWpD;AAAA,EAAA,IAAAC,SAAA,GAAAD,IAAA,CAVFE,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,MAAM,GAAAA,SAAA;IAAAE,cAAA,GAAAH,IAAA,CACbI,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAG,KAAA,CAAA,GA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,IAAI,EAAEK,MAAM,CACtC,CAAC,CAAA;EAED,oBACIgB,KAAA,CAAAC,aAAA,CAACoB,oBAAoB,EAChBvC,IAAAA,EAAAA,QAAQ,gBACLkB,KAAA,CAAAC,aAAA,CAACqB,gBAAgB,qBACbtB,KAAA,CAAAC,aAAA,CAACsB,yBAAyB,EAAA,IAAA,EACrBV,cAAc,eACfb,KAAA,CAAAC,aAAA,CAACuB,kBAAkB,EAAA;AAACP,IAAAA,OAAO,EAAE9B,mBAAoB;IAAC,WAAU,EAAA,QAAA;GACvDU,EAAAA,gBAAgB,CAACjB,SAAS,CACX,CACG,CAAC,eAC5BoB,KAAA,CAAAC,aAAA,CAACsB,yBAAyB,EAAA;IAACE,SAAS,EAAEC,OAAO,CAACC,2BAAAA;AAA4B,GAAA,eACtE3B,KAAA,CAAAC,aAAA,CAACuB,kBAAkB,EAAA;AAACP,IAAAA,OAAO,EAAE9B,mBAAoB;IAAC,WAAU,EAAA,QAAA;GACvDU,EAAAA,gBAAgB,CAAChB,UAAU,EAAE,IAAI,CAClB,CAAC,EACpBsC,UACsB,CACb,CAAC,gBAEnBnB,KAAA,CAAAC,aAAA,CAAAD,KAAA,CAAAE,QAAA,qBACIF,KAAA,CAAAC,aAAA,CAAC2B,YAAY,EAAA;AACTpD,IAAAA,IAAI,EAAC,QAAQ;AACb,IAAA,WAAA,EAAU,QAAQ;AAClBqD,IAAAA,EAAE,EAAC,eAAe;AAClBZ,IAAAA,OAAO,EAAE9B,mBAAoB;AAC7B2C,IAAAA,QAAQ,EAAE,CAAA;AAAE,GAAA,EAEXjC,gBAAgB,CAACjB,SAAS,CACjB,CAAC,eACfoB,KAAA,CAAAC,aAAA,CAAC8B,YAAY,EACRlB,IAAAA,EAAAA,cAAc,EACdM,UACS,CAChB,CAEY,CAAC,CAAA;AAE/B;;;;"}
1
+ {"version":3,"file":"CalendarHeader.js","sources":["../../../../../src/components/Calendar/ui/CalendarHeader/CalendarHeader.tsx"],"sourcesContent":["import React, { useCallback, useMemo } from 'react';\n\nimport { IconDisclosureDownFill, IconDisclosureLeftCentered, IconDisclosureRightCentered } from '../../../_Icon';\nimport { CalendarState } from '../../store/types';\nimport { getCalendarType, MONTH_NAMES, YEAR_RENDER_COUNT } from '../../utils';\nimport type { DateObject } from '../../Calendar.types';\nimport { classes } from '../../Calendar.tokens';\nimport { sizeMap } from '../../store/reducer';\n\nimport type { CalendarHeaderProps } from './CalendarHeader.types';\nimport {\n StyledArrow,\n StyledArrows,\n StyledCalendarHeader,\n StyledDoubleHeaderWrapper,\n StyledHeader,\n StyledHeaderDate,\n StyledHeaderDouble,\n StyledNavigation,\n} from './CalendarHeader.styles';\n\n/**\n * Компонент шапки календаря.\n */\nexport const CalendarHeader: React.FC<CalendarHeaderProps> = ({\n type = 'Days',\n startYear = 0,\n size,\n firstDate,\n secondDate,\n isDouble,\n onPrev,\n onNext,\n onUpdateCalendarState,\n locale,\n}) => {\n const handleCalendarState = useCallback(() => {\n const newSize: [number, number] = isDouble ? sizeMap.Months.double : sizeMap.Months.single;\n\n if (type === CalendarState.Days) {\n onUpdateCalendarState?.(CalendarState.Months, newSize);\n }\n\n if (type === CalendarState.Months || type === CalendarState.Quarters) {\n onUpdateCalendarState?.(CalendarState.Years, newSize);\n }\n }, [type, onUpdateCalendarState]);\n\n const getHeaderContent = useCallback(\n (date?: DateObject, secondPart?: boolean) => {\n if (!date) {\n return '';\n }\n\n if (type === CalendarState.Days) {\n return (\n <>\n <StyledHeaderDate>{MONTH_NAMES[locale][date.monthIndex]}</StyledHeaderDate>\n <StyledHeaderDate>\n {date.year}\n <IconDisclosureDownFill color=\"inherit\" size={size === 'xs' ? 'xs' : 's'} />\n </StyledHeaderDate>\n </>\n );\n }\n\n if (type === CalendarState.Months || type === CalendarState.Quarters) {\n return (\n <StyledHeaderDate>\n {date.year}\n <IconDisclosureDownFill color=\"inherit\" size={size === 'xs' ? 'xs' : 's'} />\n </StyledHeaderDate>\n );\n }\n\n if (type === CalendarState.Years) {\n const yearValue = secondPart ? startYear + 12 : startYear;\n\n return (\n <StyledHeaderDate>\n {yearValue}—{yearValue + YEAR_RENDER_COUNT - 1}\n <IconDisclosureDownFill color=\"inherit\" size={size === 'xs' ? 'xs' : 's'} />\n </StyledHeaderDate>\n );\n }\n\n return '';\n },\n [type, startYear, size, locale],\n );\n\n const currentCalendarType = getCalendarType(type);\n\n const PreviousButton = useMemo(\n () => (\n <StyledArrow aria-label={`Предыдущий ${currentCalendarType}`} onClick={() => onPrev()}>\n <IconDisclosureLeftCentered color=\"inherit\" size={size === 'xs' ? 'xs' : 's'} />\n </StyledArrow>\n ),\n [currentCalendarType, size, onPrev],\n );\n\n const NextButton = useMemo(\n () => (\n <StyledArrow aria-label={`Следующий ${currentCalendarType}`} onClick={() => onNext()}>\n <IconDisclosureRightCentered color=\"inherit\" size={size === 'xs' ? 'xs' : 's'} />\n </StyledArrow>\n ),\n [currentCalendarType, size, onNext],\n );\n\n return (\n <StyledCalendarHeader>\n {isDouble ? (\n <StyledNavigation>\n <StyledDoubleHeaderWrapper>\n {PreviousButton}\n <StyledHeaderDouble onClick={handleCalendarState} aria-live=\"polite\">\n {getHeaderContent(firstDate)}\n </StyledHeaderDouble>\n </StyledDoubleHeaderWrapper>\n <StyledDoubleHeaderWrapper className={classes.doubleHeaderLastDateWrapper}>\n <StyledHeaderDouble onClick={handleCalendarState} aria-live=\"polite\">\n {getHeaderContent(secondDate, true)}\n </StyledHeaderDouble>\n {NextButton}\n </StyledDoubleHeaderWrapper>\n </StyledNavigation>\n ) : (\n <>\n <StyledHeader\n type=\"button\"\n aria-live=\"polite\"\n id=\"id-grid-label\"\n onClick={handleCalendarState}\n tabIndex={0}\n >\n {getHeaderContent(firstDate)}\n </StyledHeader>\n <StyledArrows>\n {PreviousButton}\n {NextButton}\n </StyledArrows>\n </>\n )}\n </StyledCalendarHeader>\n );\n};\n"],"names":["CalendarHeader","_ref","_ref$type","type","_ref$startYear","startYear","size","firstDate","secondDate","isDouble","onPrev","onNext","onUpdateCalendarState","locale","handleCalendarState","useCallback","newSize","sizeMap","Months","single","CalendarState","Days","Quarters","Years","getHeaderContent","date","secondPart","React","createElement","Fragment","StyledHeaderDate","MONTH_NAMES","monthIndex","year","IconDisclosureDownFill","color","yearValue","YEAR_RENDER_COUNT","currentCalendarType","getCalendarType","PreviousButton","useMemo","StyledArrow","concat","onClick","IconDisclosureLeftCentered","NextButton","IconDisclosureRightCentered","StyledCalendarHeader","StyledNavigation","StyledDoubleHeaderWrapper","StyledHeaderDouble","className","classes","doubleHeaderLastDateWrapper","StyledHeader","id","tabIndex","StyledArrows"],"mappings":";;;;;;;;;;;;AAqBA;AACA;AACA;IACaA,cAA6C,GAAG,SAAhDA,cAA6CA,CAAAC,IAAA,EAWpD;AAAA,EAAA,IAAAC,SAAA,GAAAD,IAAA,CAVFE,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,MAAM,GAAAA,SAAA;IAAAE,cAAA,GAAAH,IAAA,CACbI,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAG,KAAA,CAAA,GAAA,CAAC,GAAAA,cAAA;IACbE,IAAI,GAAAL,IAAA,CAAJK,IAAI;IACJC,SAAS,GAAAN,IAAA,CAATM,SAAS;IACTC,UAAU,GAAAP,IAAA,CAAVO,UAAU;IACVC,QAAQ,GAAAR,IAAA,CAARQ,QAAQ;IACRC,MAAM,GAAAT,IAAA,CAANS,MAAM;IACNC,MAAM,GAAAV,IAAA,CAANU,MAAM;IACNC,qBAAqB,GAAAX,IAAA,CAArBW,qBAAqB;IACrBC,MAAM,GAAAZ,IAAA,CAANY,MAAM,CAAA;AAEN,EAAA,IAAMC,mBAAmB,GAAGC,WAAW,CAAC,YAAM;AAC1C,IAAA,IAAMC,OAAyB,GAAGP,QAAQ,GAAGQ,OAAO,CAACC,MAAM,CAAA,QAAA,CAAO,GAAGD,OAAO,CAACC,MAAM,CAACC,MAAM,CAAA;AAE1F,IAAA,IAAIhB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AAAA,OAAO,EAAE9B,mBAAoB;IAAC,WAAU,EAAA,QAAA;GACvDU,EAAAA,gBAAgB,CAAChB,UAAU,EAAE,IAAI,CAClB,CAAC,EACpBsC,UACsB,CACb,CAAC,gBAEnBnB,KAAA,CAAAC,aAAA,CAAAD,KAAA,CAAAE,QAAA,qBACIF,KAAA,CAAAC,aAAA,CAAC2B,YAAY,EAAA;AACTpD,IAAAA,IAAI,EAAC,QAAQ;AACb,IAAA,WAAA,EAAU,QAAQ;AAClBqD,IAAAA,EAAE,EAAC,eAAe;AAClBZ,IAAAA,OAAO,EAAE9B,mBAAoB;AAC7B2C,IAAAA,QAAQ,EAAE,CAAA;AAAE,GAAA,EAEXjC,gBAAgB,CAACjB,SAAS,CACjB,CAAC,eACfoB,KAAA,CAAAC,aAAA,CAAC8B,YAAY,EACRlB,IAAAA,EAAAA,cAAc,EACdM,UACS,CAChB,CAEY,CAAC,CAAA;AAE/B;;;;"}
@@ -2,7 +2,11 @@ var classes = {
2
2
  selectedSegmentItem: 'selected-segment-item',
3
3
  segmentPilled: 'segment-pilled',
4
4
  segmentGroupFilledBackground: 'segment-group-filled-background',
5
- segmentStretch: 'segment-stretched'
5
+ segmentStretch: 'segment-stretched',
6
+ segmentVertical: 'segment-vertical',
7
+ segmentArrowPadding: 'segment-arrow-padding',
8
+ segmentXsSize: 'segment-xs-size',
9
+ segmentAdditionalText: 'segment-additional-text'
6
10
  };
7
11
  var tokens = {
8
12
  fontFamily: '--plasma-segment-item-font-family',
@@ -17,6 +21,8 @@ var tokens = {
17
21
  groupPilledBorderRadius: '--plasma-segment-group-pilled-border-radius',
18
22
  groupWidth: '--plasma-segment-group-width',
19
23
  groupHeight: '--plasma-segment-group-height',
24
+ groupArrowPadding: '--plasma-segment-group-arrow-padding',
25
+ groupVerticalArrowPadding: '--plasma-segment-group-vertical-arrow-padding',
20
26
  groupBackgroundColor: '--plasma-segment-group-background-color',
21
27
  groupFilledBackgroundColor: '--plasma-segment-group-filled-background-color',
22
28
  itemBorderRadius: '--plasma-segment-item-border-radius',
@@ -24,15 +30,22 @@ var tokens = {
24
30
  itemWidth: '--plasma-segment-item-width',
25
31
  itemHeight: '--plasma-segment-item-height',
26
32
  itemPadding: '--plasma-segment-item-padding',
33
+ itemPilledPadding: '--plasma-segment-item-pilled-padding',
27
34
  itemMarginLeft: '--plasma-segment-item-margin-left',
35
+ itemContentPadding: '--plasma-segment-item-content-padding',
36
+ itemIconMargin: '--plasma-segment-item-content-icon-margin',
28
37
  itemColor: '--plasma-segment-item-color',
29
38
  itemBackgroundColor: '--plasma-segment-item-background-color',
30
39
  itemColorHover: '--plasma-segment-item-color-hover',
31
40
  itemBackgroundColorHover: '--plasma-segment-item-background-color-hover',
41
+ itemAdditionalColor: '--plasma-segment-item-additional-color',
42
+ itemAdditionalColorHover: '--plasma-segment-item-additional-color-hover',
32
43
  itemSelectedColor: '--plasma-segment-item-selected-color',
33
44
  itemSelectedBackgroundColor: '--plasma-segment-item-selected-background-color',
34
45
  itemSelectedColorHover: '--plasma-segment-item-selected-color-hover',
35
46
  itemSelectedBackgroundColorHover: '--plasma-segment-item-selected-background-color-hover',
47
+ itemSelectedAdditionalColor: '--plasma-segment-item-selected-additional-color',
48
+ itemSelectedAdditionalColorHover: '--plasma-segment-item-selected-additional-color-hover',
36
49
  disabledOpacity: '--plasma-segment-disabled-opacity'
37
50
  };
38
51
 
@@ -1 +1 @@
1
- {"version":3,"file":"tokens.js","sources":["../../../src/components/Segment/tokens.ts"],"sourcesContent":["export const classes = {\n selectedSegmentItem: 'selected-segment-item',\n segmentPilled: 'segment-pilled',\n segmentGroupFilledBackground: 'segment-group-filled-background',\n segmentStretch: 'segment-stretched',\n};\n\nexport const tokens = {\n fontFamily: '--plasma-segment-item-font-family',\n fontSize: '--plasma-segment-item-font-size',\n fontStyle: '--plasma-segment-item-font-style',\n fontWeight: '--plasma-segment-item-font-weight',\n letterSpacing: '--plasma-segment-item-letter-spacing',\n lineHeight: '--plasma-segment-item-lineheight',\n\n outlineFocusColor: '--plasma-segment-outline-focus-color',\n\n arrowColor: '--plasma-segment-arrow-color',\n\n groupBorderRadius: '--plasma-segment-group-border-radius',\n groupPilledBorderRadius: '--plasma-segment-group-pilled-border-radius',\n groupWidth: '--plasma-segment-group-width',\n groupHeight: '--plasma-segment-group-height',\n\n groupBackgroundColor: '--plasma-segment-group-background-color',\n groupFilledBackgroundColor: '--plasma-segment-group-filled-background-color',\n\n itemBorderRadius: '--plasma-segment-item-border-radius',\n itemPilledBorderRadius: '--plasma-segment-item-pilled-border-radius',\n itemWidth: '--plasma-segment-item-width',\n itemHeight: '--plasma-segment-item-height',\n itemPadding: '--plasma-segment-item-padding',\n itemMarginLeft: '--plasma-segment-item-margin-left',\n\n itemColor: '--plasma-segment-item-color',\n itemBackgroundColor: '--plasma-segment-item-background-color',\n itemColorHover: '--plasma-segment-item-color-hover',\n itemBackgroundColorHover: '--plasma-segment-item-background-color-hover',\n\n itemSelectedColor: '--plasma-segment-item-selected-color',\n itemSelectedBackgroundColor: '--plasma-segment-item-selected-background-color',\n itemSelectedColorHover: '--plasma-segment-item-selected-color-hover',\n itemSelectedBackgroundColorHover: '--plasma-segment-item-selected-background-color-hover',\n\n disabledOpacity: '--plasma-segment-disabled-opacity',\n};\n"],"names":["classes","selectedSegmentItem","segmentPilled","segmentGroupFilledBackground","segmentStretch","tokens","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","outlineFocusColor","arrowColor","groupBorderRadius","groupPilledBorderRadius","groupWidth","groupHeight","groupBackgroundColor","groupFilledBackgroundColor","itemBorderRadius","itemPilledBorderRadius","itemWidth","itemHeight","itemPadding","itemMarginLeft","itemColor","itemBackgroundColor","itemColorHover","itemBackgroundColorHover","itemSelectedColor","itemSelectedBackgroundColor","itemSelectedColorHover","itemSelectedBackgroundColorHover","disabledOpacity"],"mappings":"AAAO,IAAMA,OAAO,GAAG;AACnBC,EAAAA,mBAAmB,EAAE,uBAAuB;AAC5CC,EAAAA,aAAa,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../../src/components/Segment/tokens.ts"],"sourcesContent":["export const classes = {\n selectedSegmentItem: 'selected-segment-item',\n segmentPilled: 'segment-pilled',\n segmentGroupFilledBackground: 'segment-group-filled-background',\n segmentStretch: 'segment-stretched',\n segmentVertical: 'segment-vertical',\n segmentArrowPadding: 'segment-arrow-padding',\n segmentXsSize: 'segment-xs-size',\n segmentAdditionalText: 'segment-additional-text',\n};\n\nexport const tokens = {\n fontFamily: '--plasma-segment-item-font-family',\n fontSize: '--plasma-segment-item-font-size',\n fontStyle: '--plasma-segment-item-font-style',\n fontWeight: '--plasma-segment-item-font-weight',\n letterSpacing: '--plasma-segment-item-letter-spacing',\n lineHeight: '--plasma-segment-item-lineheight',\n\n outlineFocusColor: '--plasma-segment-outline-focus-color',\n\n arrowColor: '--plasma-segment-arrow-color',\n\n groupBorderRadius: '--plasma-segment-group-border-radius',\n groupPilledBorderRadius: '--plasma-segment-group-pilled-border-radius',\n groupWidth: '--plasma-segment-group-width',\n groupHeight: '--plasma-segment-group-height',\n groupArrowPadding: '--plasma-segment-group-arrow-padding',\n groupVerticalArrowPadding: '--plasma-segment-group-vertical-arrow-padding',\n\n groupBackgroundColor: '--plasma-segment-group-background-color',\n groupFilledBackgroundColor: '--plasma-segment-group-filled-background-color',\n\n itemBorderRadius: '--plasma-segment-item-border-radius',\n itemPilledBorderRadius: '--plasma-segment-item-pilled-border-radius',\n itemWidth: '--plasma-segment-item-width',\n itemHeight: '--plasma-segment-item-height',\n itemPadding: '--plasma-segment-item-padding',\n itemPilledPadding: '--plasma-segment-item-pilled-padding',\n itemMarginLeft: '--plasma-segment-item-margin-left',\n itemContentPadding: '--plasma-segment-item-content-padding',\n itemIconMargin: '--plasma-segment-item-content-icon-margin',\n\n itemColor: '--plasma-segment-item-color',\n itemBackgroundColor: '--plasma-segment-item-background-color',\n itemColorHover: '--plasma-segment-item-color-hover',\n itemBackgroundColorHover: '--plasma-segment-item-background-color-hover',\n itemAdditionalColor: '--plasma-segment-item-additional-color',\n itemAdditionalColorHover: '--plasma-segment-item-additional-color-hover',\n\n itemSelectedColor: '--plasma-segment-item-selected-color',\n itemSelectedBackgroundColor: '--plasma-segment-item-selected-background-color',\n itemSelectedColorHover: '--plasma-segment-item-selected-color-hover',\n itemSelectedBackgroundColorHover: '--plasma-segment-item-selected-background-color-hover',\n itemSelectedAdditionalColor: '--plasma-segment-item-selected-additional-color',\n itemSelectedAdditionalColorHover: '--plasma-segment-item-selected-additional-color-hover',\n\n disabledOpacity: '--plasma-segment-disabled-opacity',\n};\n"],"names":["classes","selectedSegmentItem","segmentPilled","segmentGroupFilledBackground","segmentStretch","segmentVertical","segmentArrowPadding","segmentXsSize","segmentAdditionalText","tokens","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","outlineFocusColor","arrowColor","groupBorderRadius","groupPilledBorderRadius","groupWidth","groupHeight","groupArrowPadding","groupVerticalArrowPadding","groupBackgroundColor","groupFilledBackgroundColor","itemBorderRadius","itemPilledBorderRadius","itemWidth","itemHeight","itemPadding","itemPilledPadding","itemMarginLeft","itemContentPadding","itemIconMargin","itemColor","itemBackgroundColor","itemColorHover","itemBackgroundColorHover","itemAdditionalColor","itemAdditionalColorHover","itemSelectedColor","itemSelectedBackgroundColor","itemSelectedColorHover","itemSelectedBackgroundColorHover","itemSelectedAdditionalColor","itemSelectedAdditionalColorHover","disabledOpacity"],"mappings":"AAAO,IAAMA,OAAO,GAAG;AACnBC,EAAAA,mBAAmB,EAAE,uBAAuB;AAC5CC,EAAAA,aAAa,EAAE,gBAAgB;AAC/BC,EAAAA,4BAA4B,EAAE,iCAAiC;AAC/DC,EAAAA,cAAc,EAAE,mBAAmB;AACnCC,EAAAA,eAAe,EAAE,kBAAkB;AACnCC,EAAAA,mBAAmB,EAAE,uBAAuB;AAC5CC,EAAAA,aAAa,EAAE,iBAAiB;AAChCC,EAAAA,qBAAqB,EAAE,yBAAA;AAC3B,EAAC;AAEM,IAAMC,MAAM,GAAG;AAClBC,EAAAA,UAAU,E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AACpEC,EAAAA,gCAAgC,EAAE,uDAAuD;AACzFC,EAAAA,2BAA2B,EAAE,iDAAiD;AAC9EC,EAAAA,gCAAgC,EAAE,uDAAuD;AAEzFC,EAAAA,eAAe,EAAE,mCAAA;AACrB;;;;"}
@@ -1,18 +1,17 @@
1
- .IconRoot_7pl7ig_svvlqhf__32c458a1{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;width:var(--svvlqhf-0);height:var(--svvlqhf-0);-webkit-flex:0 0 var(--svvlqhf-0);-ms-flex:0 0 var(--svvlqhf-0);flex:0 0 var(--svvlqhf-0);}
2
-
3
- .base_m358nl_b16s69xg__c51d77df{width:var(--plasma-segment-group-width);height:var(--plasma-segment-group-height);--plasma_private-outline-radius:var(--plasma-segment-group-border-radius);border-radius:var(--plasma-segment-group-border-radius);}
1
+ .base_18cpjsq_b16s69xg__2d529a83{width:var(--plasma-segment-group-width);height:var(--plasma-segment-group-height);}.base_18cpjsq_b16s69xg__2d529a83:before{border-radius:var(--plasma-segment-group-border-radius);}
4
2
 
5
3
  .base_hsx1sr_bo2wq9n__1e99adcc{background-color:var(--plasma-segment-group-background-color);}
6
4
 
7
5
  .base_1n8kaiq_bvqq8jn__3fd538b8[disabled]{opacity:var(--plasma-segment-disabled-opacity);cursor:not-allowed;}
8
6
 
9
- .base_fqbatz_b1re0ohg__24d92a6d.base_fqbatz_segmentPilled__24d92a6d{--plasma_private-outline-radius:var(--plasma-segment-group-pilled-border-radius);border-radius:var(--plasma-segment-group-pilled-border-radius);}
7
+ .base_pxl3nb_b1re0ohg__002ee1a3.base_pxl3nb_segmentPilled__002ee1a3:before{border-radius:var(--plasma-segment-group-pilled-border-radius);}
10
8
 
11
- .base_escgtx_b13sjoz1__a1f0e6e1.base_escgtx_segmentGroupFilledBackground__a1f0e6e1{background-color:var(--plasma-segment-group-filled-background-color);}
9
+ .base_a7w5s0_b13sjoz1__a0df01cb{position:relative;}.base_a7w5s0_b13sjoz1__a0df01cb.base_a7w5s0_segmentGroupFilledBackground__a0df01cb:before{content:'';position:absolute;inset:-0.125rem;background-color:var(--plasma-segment-group-filled-background-color);}
12
10
 
13
11
  .base_74wj10_b1bb2stb__3b76a172.base_74wj10_segmentStretched__3b76a172{width:100%;}.base_74wj10_b1bb2stb__3b76a172.base_74wj10_segmentStretched__3b76a172 .base_74wj10_spuzt9m__3b76a172,.base_74wj10_b1bb2stb__3b76a172.base_74wj10_segmentStretched__3b76a172 .base_74wj10_sin9wo2__3b76a172,.base_74wj10_b1bb2stb__3b76a172.base_74wj10_segmentStretched__3b76a172 .base_74wj10_sin9wo2__3b76a172 > button{width:100%;}
14
12
 
15
- .SegmentGroup_styles_m9i9p0_b2sori2__a29c0677{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}
16
- .SegmentGroup_styles_m9i9p0_sin9wo2__a29c0677{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}
17
- .SegmentGroup_styles_m9i9p0_spuzt9m__a29c0677{position:relative;height:100%;margin:0;padding:0.25rem;overflow-x:auto;overflow-y:hidden;-webkit-scroll-behavior:smooth;-moz-scroll-behavior:smooth;-ms-scroll-behavior:smooth;scroll-behavior:smooth;-webkit-scroll-snap-type:x mandatory;-moz-scroll-snap-type:x mandatory;-ms-scroll-snap-type:x mandatory;scroll-snap-type:x mandatory;}.SegmentGroup_styles_m9i9p0_spuzt9m__a29c0677::-webkit-scrollbar{display:none;}
18
- .SegmentGroup_styles_m9i9p0_s1qf4oye__a29c0677{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;cursor:pointer;border:none;background-color:transparent;padding:0;outline:none;position:relative;}.SegmentGroup_styles_m9i9p0_s1qf4oye__a29c0677::before{content:'';position:absolute;top:-0.125rem;left:-0.125rem;right:-0.125rem;bottom:-0.125rem;z-index:1;display:block;box-sizing:content-box;border:0.063rem solid transparent;border-radius:calc(var(--plasma_private-outline-radius) - 0.063rem);-webkit-transition:box-shadow 0.2s ease-in-out;transition:box-shadow 0.2s ease-in-out;pointer-events:none;}.SegmentGroup_styles_m9i9p0_s1qf4oye__a29c0677.SegmentGroup_styles_m9i9p0_focusVisible__a29c0677:focus::before,.SegmentGroup_styles_m9i9p0_s1qf4oye__a29c0677[data-focus-visible-added]::before{outline:none;box-shadow:0 0 0 0.063rem var(--plasma-segment-outline-focus-color);}.SegmentGroup_styles_m9i9p0_s1qf4oye__a29c0677[disabled]{cursor:not-allowed;}
13
+ .base_1ejecy9_bb2d6sr__61b9631c.base_1ejecy9_segmentVertical__61b9631c{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}.base_1ejecy9_bb2d6sr__61b9631c.base_1ejecy9_segmentVertical__61b9631c .base_1ejecy9_spuzt9m__61b9631c{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}.base_1ejecy9_bb2d6sr__61b9631c.base_1ejecy9_segmentVertical__61b9631c .base_1ejecy9_sin9wo2__61b9631c{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}
14
+
15
+ .SegmentGroup_styles_klze6h_b2sori2__dfb131db{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;max-width:100%;}.SegmentGroup_styles_klze6h_b2sori2__dfb131db:before{border-radius:var(--plasma-segment-group-border-radius);}
16
+ .SegmentGroup_styles_klze6h_sin9wo2__dfb131db{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;max-width:100%;}
17
+ .SegmentGroup_styles_klze6h_spuzt9m__dfb131db{position:relative;height:100%;width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}
@@ -1,164 +1,117 @@
1
- import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
2
- import React, { forwardRef, useState, Children, useCallback, useMemo, useEffect } from 'react';
3
- import { safeUseId, useCarousel } from '@salutejs/plasma-core';
4
- import { IconDisclosureLeft } from '../../../_Icon/Icons/IconDisclosureLeft.js';
5
- import { IconDisclosureRight } from '../../../_Icon/Icons/IconDisclosureRight.js';
6
- import '@linaria/react';
7
- import { tokens, classes } from '../../tokens.js';
1
+ import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
2
+ import React, { forwardRef, useRef, useCallback, useEffect } from 'react';
3
+ import { safeUseId } from '@salutejs/plasma-core';
4
+ import { classes } from '../../tokens.js';
8
5
  import { cx } from '../../../../utils/index.js';
9
6
  import { useSegmentInner } from '../../SegmentProvider/SegmentProvider.js';
10
7
  import { base as base$1 } from './variations/_size/base.js';
11
8
  import { base as base$2 } from './variations/_view/base.js';
12
9
  import { base as base$3 } from './variations/_disabled/base.js';
13
10
  import { base as base$4 } from './variations/_pilled/base.js';
14
- import { base as base$6 } from './variations/_filledBackgound/base.js';
11
+ import { base as base$7 } from './variations/_filledBackgound/base.js';
15
12
  import { base as base$5 } from './variations/_stretch/base.js';
16
- import { StyledArrow, StyledContentWrapper, StyledContent, base } from './SegmentGroup.styles.js';
13
+ import { base as base$6 } from './variations/_orientation/base.js';
14
+ import { StyledContentWrapper, StyledContent, base } from './SegmentGroup.styles.js';
17
15
 
18
- var _excluded = ["id", "selectionMode", "pilled", "stretch", "filledBackground", "disabled", "size", "view", "children"];
16
+ var _excluded = ["id", "selectionMode", "pilled", "stretch", "orientation", "filledBackground", "hasBackground", "disabled", "size", "view", "children"];
17
+ var Keys = /*#__PURE__*/function (Keys) {
18
+ Keys[Keys["end"] = 35] = "end";
19
+ Keys[Keys["home"] = 36] = "home";
20
+ Keys[Keys["left"] = 37] = "left";
21
+ Keys[Keys["right"] = 39] = "right";
22
+ return Keys;
23
+ }(Keys || {});
24
+ var getChildNodes = function getChildNodes(wrapper) {
25
+ var container = wrapper === null || wrapper === void 0 ? void 0 : wrapper.firstChild;
26
+ return container ? Array.from(container === null || container === void 0 ? void 0 : container.childNodes) : [];
27
+ };
19
28
  var segmentGroupRoot = function segmentGroupRoot(Root) {
20
29
  return /*#__PURE__*/forwardRef(function (props, outerRef) {
21
30
  var id = props.id,
22
31
  selectionMode = props.selectionMode,
23
32
  pilled = props.pilled,
24
33
  stretch = props.stretch,
34
+ _props$orientation = props.orientation,
35
+ orientation = _props$orientation === void 0 ? 'horizontal' : _props$orientation,
25
36
  _props$filledBackgrou = props.filledBackground,
26
37
  filledBackground = _props$filledBackgrou === void 0 ? false : _props$filledBackgrou,
38
+ _props$hasBackground = props.hasBackground,
39
+ hasBackground = _props$hasBackground === void 0 ? false : _props$hasBackground,
27
40
  _props$disabled = props.disabled,
28
41
  disabled = _props$disabled === void 0 ? false : _props$disabled,
29
42
  size = props.size,
30
43
  view = props.view,
31
44
  children = props.children,
32
45
  rest = _objectWithoutProperties(props, _excluded);
46
+ var scrollRef = useRef(null);
47
+ var trackRef = useRef(null);
33
48
  var _useSegmentInner = useSegmentInner(),
34
49
  setSelectionMode = _useSegmentInner.setSelectionMode,
35
50
  setDisabledGroup = _useSegmentInner.setDisabledGroup;
36
- var _useState = useState(0),
37
- _useState2 = _slicedToArray(_useState, 2),
38
- index = _useState2[0],
39
- setIndex = _useState2[1];
40
- var _useState3 = useState(false),
41
- _useState4 = _slicedToArray(_useState3, 2),
42
- firstItemVisible = _useState4[0],
43
- setFirstItemVisible = _useState4[1];
44
- var _useState5 = useState(false),
45
- _useState6 = _slicedToArray(_useState5, 2),
46
- lastItemVisible = _useState6[0],
47
- setLastItemVisible = _useState6[1];
48
51
  var uniqId = safeUseId();
49
52
  var segmentGroupId = id || uniqId;
50
- var pilledAttr = view !== 'clear' && pilled;
51
- var filledBackgroundAttr = view !== 'clear' && filledBackground;
53
+ var isVertical = orientation === 'vertical';
54
+ var pilledAttr = hasBackground && pilled;
55
+ var filledBackgroundAttr = filledBackground || hasBackground;
56
+ var stretchClass = stretch ? classes.segmentStretch : undefined;
57
+ var orientationClass = isVertical ? classes.segmentVertical : undefined;
52
58
  var pilledClass = pilledAttr ? classes.segmentPilled : undefined;
53
59
  var filledClass = filledBackgroundAttr ? classes.segmentGroupFilledBackground : undefined;
54
- var stretchClass = firstItemVisible && lastItemVisible && stretch ? classes.segmentStretch : undefined;
55
- var items = (Children === null || Children === void 0 ? void 0 : Children.map(children, function (child) {
56
- return child;
57
- })) || [];
58
- var onPrev = useCallback(function () {
59
- !disabled && setIndex(function (prevIndex) {
60
- return prevIndex > 0 ? prevIndex - 1 : 0;
61
- });
62
- }, [disabled]);
63
- var onNext = useCallback(function () {
64
- !disabled && setIndex(function (prevIndex) {
65
- return prevIndex < items.length - 1 ? prevIndex + 1 : prevIndex;
60
+ var onKeyDown = useCallback(function (event) {
61
+ var childNodes = getChildNodes(scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current);
62
+ var index = childNodes.findIndex(function (child) {
63
+ return document.activeElement === child;
66
64
  });
67
- }, [disabled]);
68
- var onIntersecting = function onIntersecting(setVisible) {
69
- return function (entries) {
70
- /*
71
- * Пробегаемся по элементам на которых есть слушатель события появления.
72
- * Если элемент находится в зоне видимости или выходит из нее, меняем значение флага видимости
73
- */
74
- entries.forEach(function (entry) {
75
- if (entry.isIntersecting) {
76
- setVisible(true);
77
- } else {
78
- setVisible(false);
79
- }
65
+ var minIndex = 0;
66
+ var maxIndex = childNodes.length - 1;
67
+ var nextIndex;
68
+ switch (event.keyCode) {
69
+ case Keys.end:
70
+ nextIndex = maxIndex;
71
+ break;
72
+ case Keys.left:
73
+ nextIndex = index > minIndex ? index - 1 : index;
74
+ break;
75
+ case Keys.right:
76
+ nextIndex = index < maxIndex ? index + 1 : index;
77
+ break;
78
+ case Keys.home:
79
+ nextIndex = minIndex;
80
+ break;
81
+ default:
82
+ return;
83
+ }
84
+ if (nextIndex !== index) {
85
+ var _childNodes$nextIndex, _childNodes$nextIndex2;
86
+ event.preventDefault();
87
+ (_childNodes$nextIndex = childNodes[nextIndex]) === null || _childNodes$nextIndex === void 0 || _childNodes$nextIndex.focus();
88
+ (_childNodes$nextIndex2 = childNodes[nextIndex]) === null || _childNodes$nextIndex2 === void 0 || _childNodes$nextIndex2.scrollIntoView({
89
+ block: 'center',
90
+ inline: 'center',
91
+ behavior: 'smooth'
80
92
  });
81
- };
82
- };
83
- var _useCarousel = useCarousel({
84
- index: index,
85
- axis: 'x',
86
- scrollAlign: 'start',
87
- detectActive: true,
88
- debounceMs: 250,
89
- onIndexChange: setIndex
90
- }),
91
- scrollRef = _useCarousel.scrollRef,
92
- trackRef = _useCarousel.trackRef;
93
- var PreviousButton = useMemo(function () {
94
- return /*#__PURE__*/React.createElement(StyledArrow, {
95
- type: "button",
96
- "aria-label": "\u041F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0438\u0439 \u0441\u0435\u0433\u043C\u0435\u043D\u0442",
97
- onClick: onPrev,
98
- tabIndex: disabled ? -1 : 0,
99
- disabled: disabled
100
- }, /*#__PURE__*/React.createElement(IconDisclosureLeft, {
101
- color: "var(".concat(tokens.arrowColor, ")")
102
- }));
103
- }, [onPrev]);
104
- var NextButton = useMemo(function () {
105
- return /*#__PURE__*/React.createElement(StyledArrow, {
106
- type: "button",
107
- "aria-label": "\u0421\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0439 \u0441\u0435\u0433\u043C\u0435\u043D\u0442",
108
- onClick: onNext,
109
- tabIndex: disabled ? -1 : 0,
110
- disabled: disabled
111
- }, /*#__PURE__*/React.createElement(IconDisclosureRight, {
112
- color: "var(".concat(tokens.arrowColor, ")")
113
- }));
114
- }, [onNext]);
93
+ }
94
+ }, []);
115
95
  useEffect(function () {
116
96
  selectionMode && setSelectionMode(selectionMode);
117
97
  setDisabledGroup(disabled);
118
98
  }, [selectionMode, disabled]);
119
- useEffect(function () {
120
- var _trackRef$current;
121
- // Intersection observer для первого сегмента
122
- var observeFirstItem = new IntersectionObserver(onIntersecting(setFirstItemVisible), {
123
- root: null,
124
- rootMargin: '0px',
125
- threshold: 0.5
126
- });
127
-
128
- // Intersection observer для последнего сегмента
129
- var observeLastItem = new IntersectionObserver(onIntersecting(setLastItemVisible), {
130
- root: null,
131
- rootMargin: '0px',
132
- threshold: 0.5
133
- });
134
-
135
- // получаем список сегментов внутри SegmentGroup
136
- var childrenArray = Array.from(((_trackRef$current = trackRef.current) === null || _trackRef$current === void 0 ? void 0 : _trackRef$current.children) || []);
137
- if (childrenArray.length) {
138
- // подписываемся на событие появление внутри SegmentGroup
139
- observeFirstItem.observe(childrenArray[0]);
140
- observeLastItem.observe(childrenArray[childrenArray.length - 1]);
141
- }
142
- return function () {
143
- // отписываемся от события появления внутри SegmentGroup
144
- observeFirstItem.disconnect();
145
- observeLastItem.disconnect();
146
- };
147
- }, [children]);
148
99
  return /*#__PURE__*/React.createElement(Root, _extends({
149
100
  view: view,
150
101
  size: size,
102
+ orientation: orientation,
151
103
  id: segmentGroupId,
152
104
  ref: outerRef,
153
105
  filledBackground: filledBackgroundAttr,
154
106
  disabled: disabled,
155
107
  pilled: pilledAttr,
156
- className: cx(pilledClass, filledClass, stretchClass)
157
- }, rest), !firstItemVisible && PreviousButton, /*#__PURE__*/React.createElement(StyledContentWrapper, {
108
+ className: cx(pilledClass, filledClass, stretchClass, orientationClass),
109
+ onKeyDown: onKeyDown
110
+ }, rest), /*#__PURE__*/React.createElement(StyledContentWrapper, {
158
111
  ref: scrollRef
159
112
  }, /*#__PURE__*/React.createElement(StyledContent, {
160
113
  ref: trackRef
161
- }, children)), !lastItemVisible && NextButton);
114
+ }, children)));
162
115
  });
163
116
  };
164
117
  var segmentGroupConfig = {
@@ -185,16 +138,18 @@ var segmentGroupConfig = {
185
138
  css: base$5,
186
139
  attrs: true
187
140
  },
141
+ orientation: {
142
+ css: base$6
143
+ },
188
144
  filledBackground: {
189
- css: base$6,
145
+ css: base$7,
190
146
  attrs: true
191
147
  }
192
148
  },
193
149
  defaults: {
194
- view: 'clear',
195
150
  size: 'xs'
196
151
  }
197
152
  };
198
153
 
199
- export { segmentGroupConfig, segmentGroupRoot };
154
+ export { getChildNodes, segmentGroupConfig, segmentGroupRoot };
200
155
  //# sourceMappingURL=SegmentGroup.js.map