@salutejs/plasma-new-hope 0.71.3-canary.1161.8619854344.0 → 0.72.0-canary.1160.8612911363.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (442) hide show
  1. package/cjs/components/Cell/Cell.js +0 -2
  2. package/cjs/components/Cell/Cell.js.map +1 -1
  3. package/cjs/components/Combobox/Combobox.css +10 -10
  4. package/cjs/components/Combobox/Combobox.styles.js +5 -5
  5. package/cjs/components/Combobox/Combobox.styles.js.map +1 -1
  6. package/cjs/components/Combobox/{Combobox.styles_dw6hnk.css → Combobox.styles_17ei5vn.css} +1 -1
  7. package/cjs/components/Combobox/ui/ComboboxDivider/ComboboxDivider.css +4 -4
  8. package/cjs/components/Combobox/ui/ComboboxFooter/ComboboxFooter.css +4 -4
  9. package/cjs/components/Combobox/ui/ComboboxGroup/ComboboxGroup.css +4 -4
  10. package/cjs/components/Combobox/ui/ComboboxHeader/ComboboxHeader.css +4 -4
  11. package/cjs/components/Combobox/ui/ComboboxItem/ComboboxItem.css +4 -4
  12. package/cjs/components/Dropdown/Dropdown.css +4 -4
  13. package/cjs/components/Dropdown/Dropdown.js +1 -0
  14. package/cjs/components/Dropdown/Dropdown.js.map +1 -1
  15. package/cjs/components/Pagination/Pagination.css +9 -9
  16. package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +9 -9
  17. package/cjs/components/Popover/Popover.css +4 -4
  18. package/cjs/components/Popover/Popover.js +43 -33
  19. package/cjs/components/Popover/Popover.js.map +1 -1
  20. package/cjs/components/Popover/Popover.styles.js +1 -1
  21. package/cjs/components/Popover/Popover.styles.js.map +1 -1
  22. package/cjs/components/Popover/{Popover.styles_1ggb66y.css → Popover.styles_1rk9t6z.css} +1 -1
  23. package/cjs/components/Select/Select.css +9 -9
  24. package/cjs/components/Select/Select.styles.js +7 -7
  25. package/cjs/components/Select/Select.styles.js.map +1 -1
  26. package/{es/components/Select/Select.styles_1q3i6gw.css → cjs/components/Select/Select.styles_ls547o.css} +1 -1
  27. package/cjs/components/Select/ui/SelectItem/SelectItem.css +4 -4
  28. package/cjs/components/Select/ui/SelectTarget/SelectTarget.js +1 -2
  29. package/cjs/components/Select/ui/SelectTarget/SelectTarget.js.map +1 -1
  30. package/cjs/components/TextField/TextField.js +166 -40
  31. package/cjs/components/TextField/TextField.js.map +1 -1
  32. package/cjs/components/TextField/TextField.styles.js +27 -11
  33. package/cjs/components/TextField/TextField.styles.js.map +1 -1
  34. package/cjs/components/TextField/TextField.styles_1b1mddp.css +8 -0
  35. package/cjs/components/TextField/TextField.tokens.js +68 -20
  36. package/cjs/components/TextField/TextField.tokens.js.map +1 -1
  37. package/cjs/components/TextField/TextField_wctd2m.css +1 -0
  38. package/cjs/components/TextField/hooks/useKeyNavigation.js +131 -0
  39. package/cjs/components/TextField/hooks/useKeyNavigation.js.map +1 -0
  40. package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.css +19 -0
  41. package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js +38 -0
  42. package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js.map +1 -0
  43. package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.styles.js +26 -0
  44. package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.styles.js.map +1 -0
  45. package/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.styles_1y8n7la.css +1 -0
  46. package/cjs/components/{Select/ui/SelectDivider/variations/_view → TextField/variations/_disabled}/base.js +2 -2
  47. package/cjs/components/TextField/variations/_disabled/base.js.map +1 -0
  48. package/cjs/components/TextField/variations/_disabled/base_1tnjoy9.css +1 -0
  49. package/cjs/components/TextField/{_label-placement → variations/_label-placement}/base.js +1 -1
  50. package/cjs/components/TextField/variations/_label-placement/base.js.map +1 -0
  51. package/cjs/components/TextField/{_label-placement → variations/_label-placement}/inner.js +2 -2
  52. package/cjs/components/TextField/variations/_label-placement/inner.js.map +1 -0
  53. package/cjs/components/TextField/variations/_label-placement/inner_gqlcj2.css +1 -0
  54. package/cjs/components/TextField/{_label-placement → variations/_label-placement}/outer.js +2 -2
  55. package/cjs/components/TextField/variations/_label-placement/outer.js.map +1 -0
  56. package/cjs/components/TextField/variations/_label-placement/outer_is41nj.css +1 -0
  57. package/cjs/components/{Select/ui/SelectFooter/variations/_size → TextField/variations/_read-only}/base.js +2 -2
  58. package/cjs/components/TextField/variations/_read-only/base.js.map +1 -0
  59. package/cjs/components/TextField/variations/_read-only/base_134hshp.css +1 -0
  60. package/cjs/components/{Select/ui/SelectFooter/variations/_view → TextField/variations/_size}/base.js +2 -2
  61. package/cjs/components/TextField/variations/_size/base.js.map +1 -0
  62. package/cjs/components/TextField/variations/_size/base_1khzr9t.css +1 -0
  63. package/cjs/components/{Select/ui/SelectDivider/variations/_size → TextField/variations/_view}/base.js +2 -2
  64. package/cjs/components/TextField/variations/_view/base.js.map +1 -0
  65. package/cjs/components/TextField/variations/_view/base_1qd77x6.css +1 -0
  66. package/cjs/index.css +49 -42
  67. package/cjs/index.js +6 -41
  68. package/cjs/index.js.map +1 -1
  69. package/cjs/utils/index.js +1 -13
  70. package/cjs/utils/index.js.map +1 -1
  71. package/cjs/utils/react.js +2 -12
  72. package/cjs/utils/react.js.map +1 -1
  73. package/es/components/Cell/Cell.js +0 -2
  74. package/es/components/Cell/Cell.js.map +1 -1
  75. package/es/components/Combobox/Combobox.css +10 -10
  76. package/es/components/Combobox/Combobox.styles.js +5 -5
  77. package/es/components/Combobox/Combobox.styles.js.map +1 -1
  78. package/es/components/Combobox/{Combobox.styles_dw6hnk.css → Combobox.styles_17ei5vn.css} +1 -1
  79. package/es/components/Combobox/ui/ComboboxDivider/ComboboxDivider.css +4 -4
  80. package/es/components/Combobox/ui/ComboboxFooter/ComboboxFooter.css +4 -4
  81. package/es/components/Combobox/ui/ComboboxGroup/ComboboxGroup.css +4 -4
  82. package/es/components/Combobox/ui/ComboboxHeader/ComboboxHeader.css +4 -4
  83. package/es/components/Combobox/ui/ComboboxItem/ComboboxItem.css +4 -4
  84. package/es/components/Dropdown/Dropdown.css +4 -4
  85. package/es/components/Dropdown/Dropdown.js +1 -0
  86. package/es/components/Dropdown/Dropdown.js.map +1 -1
  87. package/es/components/Pagination/Pagination.css +9 -9
  88. package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +9 -9
  89. package/es/components/Popover/Popover.css +4 -4
  90. package/es/components/Popover/Popover.js +43 -33
  91. package/es/components/Popover/Popover.js.map +1 -1
  92. package/es/components/Popover/Popover.styles.js +1 -1
  93. package/es/components/Popover/Popover.styles.js.map +1 -1
  94. package/es/components/Popover/{Popover.styles_1ggb66y.css → Popover.styles_1rk9t6z.css} +1 -1
  95. package/es/components/Select/Select.css +9 -9
  96. package/es/components/Select/Select.styles.js +7 -7
  97. package/es/components/Select/Select.styles.js.map +1 -1
  98. package/{cjs/components/Select/Select.styles_1q3i6gw.css → es/components/Select/Select.styles_ls547o.css} +1 -1
  99. package/es/components/Select/ui/SelectItem/SelectItem.css +4 -4
  100. package/es/components/Select/ui/SelectTarget/SelectTarget.js +1 -2
  101. package/es/components/Select/ui/SelectTarget/SelectTarget.js.map +1 -1
  102. package/es/components/TextField/TextField.js +169 -44
  103. package/es/components/TextField/TextField.js.map +1 -1
  104. package/es/components/TextField/TextField.styles.js +25 -12
  105. package/es/components/TextField/TextField.styles.js.map +1 -1
  106. package/es/components/TextField/TextField.styles_1b1mddp.css +8 -0
  107. package/es/components/TextField/TextField.tokens.js +68 -21
  108. package/es/components/TextField/TextField.tokens.js.map +1 -1
  109. package/es/components/TextField/TextField_wctd2m.css +1 -0
  110. package/es/components/TextField/hooks/useKeyNavigation.js +126 -0
  111. package/es/components/TextField/hooks/useKeyNavigation.js.map +1 -0
  112. package/es/components/TextField/ui/TextFieldChip/TextFieldChip.css +19 -0
  113. package/es/components/TextField/ui/TextFieldChip/TextFieldChip.js +34 -0
  114. package/es/components/TextField/ui/TextFieldChip/TextFieldChip.js.map +1 -0
  115. package/es/components/TextField/ui/TextFieldChip/TextFieldChip.styles.js +22 -0
  116. package/es/components/TextField/ui/TextFieldChip/TextFieldChip.styles.js.map +1 -0
  117. package/es/components/TextField/ui/TextFieldChip/TextFieldChip.styles_1y8n7la.css +1 -0
  118. package/es/components/TextField/variations/_disabled/base.js +5 -0
  119. package/es/components/TextField/variations/_disabled/base.js.map +1 -0
  120. package/es/components/TextField/variations/_disabled/base_1tnjoy9.css +1 -0
  121. package/es/components/TextField/{_label-placement → variations/_label-placement}/base.js +1 -1
  122. package/es/components/TextField/variations/_label-placement/base.js.map +1 -0
  123. package/es/components/TextField/variations/_label-placement/inner.js +5 -0
  124. package/es/components/TextField/variations/_label-placement/inner.js.map +1 -0
  125. package/es/components/TextField/variations/_label-placement/inner_gqlcj2.css +1 -0
  126. package/es/components/TextField/variations/_label-placement/outer.js +5 -0
  127. package/es/components/TextField/variations/_label-placement/outer.js.map +1 -0
  128. package/es/components/TextField/variations/_label-placement/outer_is41nj.css +1 -0
  129. package/es/components/TextField/variations/_read-only/base.js +5 -0
  130. package/es/components/TextField/variations/_read-only/base.js.map +1 -0
  131. package/es/components/TextField/variations/_read-only/base_134hshp.css +1 -0
  132. package/es/components/TextField/variations/_size/base.js +5 -0
  133. package/es/components/TextField/variations/_size/base.js.map +1 -0
  134. package/es/components/TextField/variations/_size/base_1khzr9t.css +1 -0
  135. package/es/components/{Select/ui/SelectDivider/variations/_size → TextField/variations/_view}/base.js +2 -2
  136. package/es/components/TextField/variations/_view/base.js.map +1 -0
  137. package/es/components/TextField/variations/_view/base_1qd77x6.css +1 -0
  138. package/es/index.css +49 -42
  139. package/es/index.js +2 -15
  140. package/es/index.js.map +1 -1
  141. package/es/utils/index.js +2 -11
  142. package/es/utils/index.js.map +1 -1
  143. package/es/utils/react.js +2 -9
  144. package/es/utils/react.js.map +1 -1
  145. package/package.json +2 -2
  146. package/styled-components/cjs/components/Cell/Cell.js +0 -2
  147. package/styled-components/cjs/components/Combobox/Combobox.styles.js +1 -1
  148. package/styled-components/cjs/components/Dropdown/Dropdown.js +1 -0
  149. package/styled-components/cjs/components/Popover/Popover.js +43 -33
  150. package/styled-components/cjs/components/Popover/Popover.styles.js +1 -1
  151. package/styled-components/cjs/components/Select/Select.styles.js +1 -1
  152. package/styled-components/cjs/components/Select/ui/SelectTarget/SelectTarget.js +1 -2
  153. package/styled-components/cjs/components/TextField/TextField.js +173 -43
  154. package/styled-components/cjs/components/TextField/TextField.styles.js +18 -10
  155. package/styled-components/cjs/components/TextField/TextField.template-doc.mdx +24 -0
  156. package/styled-components/cjs/components/TextField/TextField.tokens.js +68 -21
  157. package/styled-components/cjs/components/TextField/hooks/index.js +12 -0
  158. package/styled-components/cjs/components/TextField/hooks/useKeyNavigation.js +137 -0
  159. package/styled-components/cjs/components/TextField/index.js +2 -2
  160. package/styled-components/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.js +39 -0
  161. package/styled-components/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.styles.js +25 -0
  162. package/styled-components/cjs/components/TextField/ui/TextFieldChip/TextFieldChip.types.js +5 -0
  163. package/styled-components/cjs/components/TextField/ui/index.js +12 -0
  164. package/styled-components/cjs/components/TextField/variations/_disabled/base.js +10 -0
  165. package/styled-components/cjs/components/TextField/variations/_label-placement/inner.js +10 -0
  166. package/styled-components/cjs/components/TextField/{_label-placement → variations/_label-placement}/outer.js +3 -3
  167. package/styled-components/cjs/components/TextField/variations/_read-only/base.js +10 -0
  168. package/styled-components/cjs/components/TextField/variations/_read-only/tokens.json +1 -0
  169. package/styled-components/cjs/components/TextField/variations/_size/base.js +10 -0
  170. package/styled-components/cjs/components/TextField/variations/_view/base.js +10 -0
  171. package/styled-components/cjs/examples/plasma_b2c/components/Popover/Popover.stories.tsx +7 -0
  172. package/styled-components/cjs/examples/plasma_b2c/components/TextField/TextField.config.js +43 -0
  173. package/styled-components/cjs/examples/plasma_b2c/components/TextField/TextField.js +11 -0
  174. package/styled-components/cjs/examples/plasma_b2c/components/TextField/TextField.stories.tsx +133 -0
  175. package/styled-components/cjs/examples/plasma_web/components/TextField/TextField.config.js +40 -0
  176. package/styled-components/cjs/examples/plasma_web/components/TextField/TextField.js +11 -0
  177. package/styled-components/cjs/examples/plasma_web/components/TextField/TextField.stories.tsx +133 -0
  178. package/styled-components/cjs/examples/sds_engineer/components/TextField/TextField.config.js +43 -0
  179. package/styled-components/cjs/examples/sds_engineer/components/TextField/TextField.js +11 -0
  180. package/styled-components/cjs/examples/sds_engineer/components/TextField/TextField.stories.tsx +133 -0
  181. package/styled-components/cjs/index.js +0 -22
  182. package/styled-components/es/components/Cell/Cell.js +0 -2
  183. package/styled-components/es/components/Combobox/Combobox.styles.js +1 -1
  184. package/styled-components/es/components/Dropdown/Dropdown.js +1 -0
  185. package/styled-components/es/components/Popover/Popover.js +43 -33
  186. package/styled-components/es/components/Popover/Popover.styles.js +1 -1
  187. package/styled-components/es/components/Select/Select.styles.js +1 -1
  188. package/styled-components/es/components/Select/ui/SelectTarget/SelectTarget.js +1 -2
  189. package/styled-components/es/components/TextField/TextField.js +177 -47
  190. package/styled-components/es/components/TextField/TextField.styles.js +17 -9
  191. package/styled-components/es/components/TextField/TextField.template-doc.mdx +24 -0
  192. package/styled-components/es/components/TextField/TextField.tokens.js +67 -20
  193. package/styled-components/es/components/TextField/hooks/index.js +1 -0
  194. package/styled-components/es/components/TextField/hooks/useKeyNavigation.js +131 -0
  195. package/styled-components/es/components/TextField/index.js +2 -2
  196. package/styled-components/es/components/TextField/ui/TextFieldChip/TextFieldChip.js +30 -0
  197. package/styled-components/es/components/TextField/ui/TextFieldChip/TextFieldChip.styles.js +19 -0
  198. package/styled-components/es/components/TextField/ui/TextFieldChip/TextFieldChip.types.js +1 -0
  199. package/styled-components/es/components/TextField/ui/index.js +1 -0
  200. package/styled-components/es/components/TextField/variations/_disabled/base.js +4 -0
  201. package/styled-components/es/components/TextField/variations/_label-placement/inner.js +4 -0
  202. package/styled-components/es/components/TextField/variations/_label-placement/outer.js +4 -0
  203. package/styled-components/es/components/TextField/variations/_read-only/base.js +4 -0
  204. package/styled-components/es/components/TextField/variations/_read-only/tokens.json +1 -0
  205. package/styled-components/es/components/TextField/variations/_size/base.js +4 -0
  206. package/styled-components/es/components/TextField/variations/_view/base.js +4 -0
  207. package/styled-components/es/examples/plasma_b2c/components/Popover/Popover.stories.tsx +7 -0
  208. package/styled-components/es/examples/plasma_b2c/components/TextField/TextField.config.js +37 -0
  209. package/styled-components/es/examples/plasma_b2c/components/TextField/TextField.js +5 -0
  210. package/styled-components/es/examples/plasma_b2c/components/TextField/TextField.stories.tsx +133 -0
  211. package/styled-components/es/examples/plasma_web/components/TextField/TextField.config.js +34 -0
  212. package/styled-components/es/examples/plasma_web/components/TextField/TextField.js +5 -0
  213. package/styled-components/es/examples/plasma_web/components/TextField/TextField.stories.tsx +133 -0
  214. package/styled-components/es/examples/sds_engineer/components/TextField/TextField.config.js +37 -0
  215. package/styled-components/es/examples/sds_engineer/components/TextField/TextField.js +5 -0
  216. package/styled-components/es/examples/sds_engineer/components/TextField/TextField.stories.tsx +133 -0
  217. package/styled-components/es/index.js +0 -2
  218. package/types/components/Cell/Cell.d.ts.map +1 -1
  219. package/types/components/Combobox/Combobox.styles.d.ts +8 -2
  220. package/types/components/Combobox/Combobox.styles.d.ts.map +1 -1
  221. package/types/components/Dropdown/Dropdown.d.ts.map +1 -1
  222. package/types/components/Dropdown/Dropdown.styles.d.ts +7 -1
  223. package/types/components/Dropdown/Dropdown.styles.d.ts.map +1 -1
  224. package/types/components/Popover/Popover.d.ts +2 -2
  225. package/types/components/Popover/Popover.d.ts.map +1 -1
  226. package/types/components/Popover/Popover.styles.d.ts.map +1 -1
  227. package/types/components/Popover/Popover.types.d.ts +19 -12
  228. package/types/components/Popover/Popover.types.d.ts.map +1 -1
  229. package/types/components/Select/Select.styles.d.ts +8 -2
  230. package/types/components/Select/Select.styles.d.ts.map +1 -1
  231. package/types/components/Select/ui/SelectTarget/SelectTarget.d.ts.map +1 -1
  232. package/types/components/TextField/TextField.d.ts +8 -3
  233. package/types/components/TextField/TextField.d.ts.map +1 -1
  234. package/types/components/TextField/TextField.styles.d.ts +6 -3
  235. package/types/components/TextField/TextField.styles.d.ts.map +1 -1
  236. package/types/components/TextField/TextField.tokens.d.ts +57 -8
  237. package/types/components/TextField/TextField.tokens.d.ts.map +1 -1
  238. package/types/components/TextField/TextField.types.d.ts +45 -3
  239. package/types/components/TextField/TextField.types.d.ts.map +1 -1
  240. package/types/components/TextField/hooks/index.d.ts +2 -0
  241. package/types/components/TextField/hooks/index.d.ts.map +1 -0
  242. package/types/components/TextField/hooks/useKeyNavigation.d.ts +17 -0
  243. package/types/components/TextField/hooks/useKeyNavigation.d.ts.map +1 -0
  244. package/types/components/TextField/index.d.ts +3 -2
  245. package/types/components/TextField/index.d.ts.map +1 -1
  246. package/types/components/TextField/ui/TextFieldChip/TextFieldChip.d.ts +7 -0
  247. package/types/components/TextField/ui/TextFieldChip/TextFieldChip.d.ts.map +1 -0
  248. package/types/components/TextField/ui/TextFieldChip/TextFieldChip.styles.d.ts +3 -0
  249. package/types/components/TextField/ui/TextFieldChip/TextFieldChip.styles.d.ts.map +1 -0
  250. package/types/components/TextField/ui/TextFieldChip/TextFieldChip.types.d.ts +37 -0
  251. package/types/components/TextField/ui/TextFieldChip/TextFieldChip.types.d.ts.map +1 -0
  252. package/types/components/TextField/ui/index.d.ts +2 -0
  253. package/types/components/TextField/ui/index.d.ts.map +1 -0
  254. package/types/components/TextField/variations/_disabled/base.d.ts.map +1 -0
  255. package/types/components/TextField/variations/_label-placement/base.d.ts.map +1 -0
  256. package/types/components/TextField/variations/_label-placement/index.d.ts.map +1 -0
  257. package/types/components/TextField/variations/_label-placement/inner.d.ts.map +1 -0
  258. package/types/components/TextField/variations/_label-placement/outer.d.ts.map +1 -0
  259. package/types/components/TextField/variations/_read-only/base.d.ts.map +1 -0
  260. package/types/components/TextField/variations/_size/base.d.ts.map +1 -0
  261. package/types/components/TextField/variations/_view/base.d.ts +2 -0
  262. package/types/components/TextField/variations/_view/base.d.ts.map +1 -0
  263. package/types/examples/plasma_b2c/components/Popover/Popover.d.ts +7 -1
  264. package/types/examples/plasma_b2c/components/Popover/Popover.d.ts.map +1 -1
  265. package/types/examples/plasma_b2c/components/TextField/TextField.config.d.ts +32 -0
  266. package/types/examples/plasma_b2c/components/TextField/TextField.config.d.ts.map +1 -0
  267. package/types/examples/plasma_b2c/components/TextField/TextField.d.ts +26 -0
  268. package/types/examples/plasma_b2c/components/TextField/TextField.d.ts.map +1 -0
  269. package/types/examples/plasma_web/components/Popover/Popover.d.ts +7 -1
  270. package/types/examples/plasma_web/components/Popover/Popover.d.ts.map +1 -1
  271. package/types/examples/plasma_web/components/TextField/TextField.config.d.ts +32 -0
  272. package/types/examples/plasma_web/components/TextField/TextField.config.d.ts.map +1 -0
  273. package/types/examples/plasma_web/components/TextField/TextField.d.ts +26 -0
  274. package/types/examples/plasma_web/components/TextField/TextField.d.ts.map +1 -0
  275. package/types/examples/sds_engineer/components/Popover/Popover.d.ts +7 -1
  276. package/types/examples/sds_engineer/components/Popover/Popover.d.ts.map +1 -1
  277. package/types/examples/sds_engineer/components/TextField/TextField.config.d.ts +32 -0
  278. package/types/examples/sds_engineer/components/TextField/TextField.config.d.ts.map +1 -0
  279. package/types/examples/sds_engineer/components/TextField/TextField.d.ts +26 -0
  280. package/types/examples/sds_engineer/components/TextField/TextField.d.ts.map +1 -0
  281. package/types/index.d.ts +0 -2
  282. package/types/index.d.ts.map +1 -1
  283. package/cjs/components/Select/ui/SelectDivider/SelectDivider.css +0 -23
  284. package/cjs/components/Select/ui/SelectDivider/SelectDivider.js +0 -40
  285. package/cjs/components/Select/ui/SelectDivider/SelectDivider.js.map +0 -1
  286. package/cjs/components/Select/ui/SelectDivider/SelectDivider.styles.js +0 -12
  287. package/cjs/components/Select/ui/SelectDivider/SelectDivider.styles.js.map +0 -1
  288. package/cjs/components/Select/ui/SelectDivider/SelectDivider.styles_673hj6.css +0 -1
  289. package/cjs/components/Select/ui/SelectDivider/variations/_size/base.js.map +0 -1
  290. package/cjs/components/Select/ui/SelectDivider/variations/_view/base.js.map +0 -1
  291. package/cjs/components/Select/ui/SelectFooter/SelectFooter.css +0 -23
  292. package/cjs/components/Select/ui/SelectFooter/SelectFooter.js +0 -40
  293. package/cjs/components/Select/ui/SelectFooter/SelectFooter.js.map +0 -1
  294. package/cjs/components/Select/ui/SelectFooter/SelectFooter.styles.js +0 -12
  295. package/cjs/components/Select/ui/SelectFooter/SelectFooter.styles.js.map +0 -1
  296. package/cjs/components/Select/ui/SelectFooter/SelectFooter.styles_11hk6tt.css +0 -1
  297. package/cjs/components/Select/ui/SelectFooter/variations/_size/base.js.map +0 -1
  298. package/cjs/components/Select/ui/SelectFooter/variations/_size/base_x642ct.css +0 -1
  299. package/cjs/components/Select/ui/SelectFooter/variations/_view/base.js.map +0 -1
  300. package/cjs/components/Select/ui/SelectFooter/variations/_view/base_x642ct.css +0 -1
  301. package/cjs/components/Select/ui/SelectGroup/SelectGroup.css +0 -23
  302. package/cjs/components/Select/ui/SelectGroup/SelectGroup.js +0 -40
  303. package/cjs/components/Select/ui/SelectGroup/SelectGroup.js.map +0 -1
  304. package/cjs/components/Select/ui/SelectGroup/SelectGroup.styles.js +0 -12
  305. package/cjs/components/Select/ui/SelectGroup/SelectGroup.styles.js.map +0 -1
  306. package/cjs/components/Select/ui/SelectGroup/SelectGroup.styles_mktu7e.css +0 -1
  307. package/cjs/components/Select/ui/SelectGroup/variations/_size/base.js +0 -9
  308. package/cjs/components/Select/ui/SelectGroup/variations/_size/base.js.map +0 -1
  309. package/cjs/components/Select/ui/SelectGroup/variations/_size/base_x642ct.css +0 -1
  310. package/cjs/components/Select/ui/SelectGroup/variations/_view/base.js +0 -9
  311. package/cjs/components/Select/ui/SelectGroup/variations/_view/base.js.map +0 -1
  312. package/cjs/components/Select/ui/SelectGroup/variations/_view/base_x642ct.css +0 -1
  313. package/cjs/components/Select/ui/SelectHeader/SelectHeader.css +0 -23
  314. package/cjs/components/Select/ui/SelectHeader/SelectHeader.js +0 -40
  315. package/cjs/components/Select/ui/SelectHeader/SelectHeader.js.map +0 -1
  316. package/cjs/components/Select/ui/SelectHeader/SelectHeader.styles.js +0 -12
  317. package/cjs/components/Select/ui/SelectHeader/SelectHeader.styles.js.map +0 -1
  318. package/cjs/components/Select/ui/SelectHeader/SelectHeader.styles_24gqog.css +0 -1
  319. package/cjs/components/Select/ui/SelectHeader/variations/_size/base.js +0 -9
  320. package/cjs/components/Select/ui/SelectHeader/variations/_size/base.js.map +0 -1
  321. package/cjs/components/Select/ui/SelectHeader/variations/_size/base_x642ct.css +0 -1
  322. package/cjs/components/Select/ui/SelectHeader/variations/_view/base.js +0 -9
  323. package/cjs/components/Select/ui/SelectHeader/variations/_view/base.js.map +0 -1
  324. package/cjs/components/Select/ui/SelectHeader/variations/_view/base_x642ct.css +0 -1
  325. package/cjs/components/TextField/TextField.styles_2qw1n8.css +0 -5
  326. package/cjs/components/TextField/TextField_1lzb2r1.css +0 -1
  327. package/cjs/components/TextField/_disabled/base.js +0 -9
  328. package/cjs/components/TextField/_disabled/base.js.map +0 -1
  329. package/cjs/components/TextField/_disabled/base_so3w81.css +0 -1
  330. package/cjs/components/TextField/_label-placement/base.js.map +0 -1
  331. package/cjs/components/TextField/_label-placement/base_x642ct.css +0 -1
  332. package/cjs/components/TextField/_label-placement/inner.js.map +0 -1
  333. package/cjs/components/TextField/_label-placement/inner_1tyuicp.css +0 -1
  334. package/cjs/components/TextField/_label-placement/outer.js.map +0 -1
  335. package/cjs/components/TextField/_label-placement/outer_19ekaek.css +0 -1
  336. package/cjs/components/TextField/_size/base.js +0 -9
  337. package/cjs/components/TextField/_size/base.js.map +0 -1
  338. package/cjs/components/TextField/_size/base_b5smyu.css +0 -1
  339. package/cjs/components/TextField/_view/base.js +0 -9
  340. package/cjs/components/TextField/_view/base.js.map +0 -1
  341. package/cjs/components/TextField/_view/base_5bqzed.css +0 -1
  342. package/es/components/Select/ui/SelectDivider/SelectDivider.css +0 -23
  343. package/es/components/Select/ui/SelectDivider/SelectDivider.js +0 -35
  344. package/es/components/Select/ui/SelectDivider/SelectDivider.js.map +0 -1
  345. package/es/components/Select/ui/SelectDivider/SelectDivider.styles.js +0 -7
  346. package/es/components/Select/ui/SelectDivider/SelectDivider.styles.js.map +0 -1
  347. package/es/components/Select/ui/SelectDivider/SelectDivider.styles_673hj6.css +0 -1
  348. package/es/components/Select/ui/SelectDivider/variations/_size/base.js.map +0 -1
  349. package/es/components/Select/ui/SelectDivider/variations/_size/base_x642ct.css +0 -1
  350. package/es/components/Select/ui/SelectDivider/variations/_view/base.js +0 -5
  351. package/es/components/Select/ui/SelectDivider/variations/_view/base.js.map +0 -1
  352. package/es/components/Select/ui/SelectDivider/variations/_view/base_x642ct.css +0 -1
  353. package/es/components/Select/ui/SelectFooter/SelectFooter.css +0 -23
  354. package/es/components/Select/ui/SelectFooter/SelectFooter.js +0 -35
  355. package/es/components/Select/ui/SelectFooter/SelectFooter.js.map +0 -1
  356. package/es/components/Select/ui/SelectFooter/SelectFooter.styles.js +0 -7
  357. package/es/components/Select/ui/SelectFooter/SelectFooter.styles.js.map +0 -1
  358. package/es/components/Select/ui/SelectFooter/SelectFooter.styles_11hk6tt.css +0 -1
  359. package/es/components/Select/ui/SelectFooter/variations/_size/base.js +0 -5
  360. package/es/components/Select/ui/SelectFooter/variations/_size/base.js.map +0 -1
  361. package/es/components/Select/ui/SelectFooter/variations/_size/base_x642ct.css +0 -1
  362. package/es/components/Select/ui/SelectFooter/variations/_view/base.js +0 -5
  363. package/es/components/Select/ui/SelectFooter/variations/_view/base.js.map +0 -1
  364. package/es/components/Select/ui/SelectFooter/variations/_view/base_x642ct.css +0 -1
  365. package/es/components/Select/ui/SelectGroup/SelectGroup.css +0 -23
  366. package/es/components/Select/ui/SelectGroup/SelectGroup.js +0 -35
  367. package/es/components/Select/ui/SelectGroup/SelectGroup.js.map +0 -1
  368. package/es/components/Select/ui/SelectGroup/SelectGroup.styles.js +0 -7
  369. package/es/components/Select/ui/SelectGroup/SelectGroup.styles.js.map +0 -1
  370. package/es/components/Select/ui/SelectGroup/SelectGroup.styles_mktu7e.css +0 -1
  371. package/es/components/Select/ui/SelectGroup/variations/_size/base.js +0 -5
  372. package/es/components/Select/ui/SelectGroup/variations/_size/base.js.map +0 -1
  373. package/es/components/Select/ui/SelectGroup/variations/_size/base_x642ct.css +0 -1
  374. package/es/components/Select/ui/SelectGroup/variations/_view/base.js +0 -5
  375. package/es/components/Select/ui/SelectGroup/variations/_view/base.js.map +0 -1
  376. package/es/components/Select/ui/SelectGroup/variations/_view/base_x642ct.css +0 -1
  377. package/es/components/Select/ui/SelectHeader/SelectHeader.css +0 -23
  378. package/es/components/Select/ui/SelectHeader/SelectHeader.js +0 -35
  379. package/es/components/Select/ui/SelectHeader/SelectHeader.js.map +0 -1
  380. package/es/components/Select/ui/SelectHeader/SelectHeader.styles.js +0 -7
  381. package/es/components/Select/ui/SelectHeader/SelectHeader.styles.js.map +0 -1
  382. package/es/components/Select/ui/SelectHeader/SelectHeader.styles_24gqog.css +0 -1
  383. package/es/components/Select/ui/SelectHeader/variations/_size/base.js +0 -5
  384. package/es/components/Select/ui/SelectHeader/variations/_size/base.js.map +0 -1
  385. package/es/components/Select/ui/SelectHeader/variations/_size/base_x642ct.css +0 -1
  386. package/es/components/Select/ui/SelectHeader/variations/_view/base.js +0 -5
  387. package/es/components/Select/ui/SelectHeader/variations/_view/base.js.map +0 -1
  388. package/es/components/Select/ui/SelectHeader/variations/_view/base_x642ct.css +0 -1
  389. package/es/components/TextField/TextField.styles_2qw1n8.css +0 -5
  390. package/es/components/TextField/TextField_1lzb2r1.css +0 -1
  391. package/es/components/TextField/_disabled/base.js +0 -5
  392. package/es/components/TextField/_disabled/base.js.map +0 -1
  393. package/es/components/TextField/_disabled/base_so3w81.css +0 -1
  394. package/es/components/TextField/_label-placement/base.js.map +0 -1
  395. package/es/components/TextField/_label-placement/base_x642ct.css +0 -1
  396. package/es/components/TextField/_label-placement/inner.js +0 -5
  397. package/es/components/TextField/_label-placement/inner.js.map +0 -1
  398. package/es/components/TextField/_label-placement/inner_1tyuicp.css +0 -1
  399. package/es/components/TextField/_label-placement/outer.js +0 -5
  400. package/es/components/TextField/_label-placement/outer.js.map +0 -1
  401. package/es/components/TextField/_label-placement/outer_19ekaek.css +0 -1
  402. package/es/components/TextField/_size/base.js +0 -5
  403. package/es/components/TextField/_size/base.js.map +0 -1
  404. package/es/components/TextField/_size/base_b5smyu.css +0 -1
  405. package/es/components/TextField/_view/base.js +0 -5
  406. package/es/components/TextField/_view/base.js.map +0 -1
  407. package/es/components/TextField/_view/base_5bqzed.css +0 -1
  408. package/styled-components/cjs/components/TextField/_disabled/base.js +0 -9
  409. package/styled-components/cjs/components/TextField/_label-placement/inner.js +0 -10
  410. package/styled-components/cjs/components/TextField/_size/base.js +0 -10
  411. package/styled-components/cjs/components/TextField/_view/base.js +0 -10
  412. package/styled-components/es/components/TextField/_disabled/base.js +0 -3
  413. package/styled-components/es/components/TextField/_label-placement/inner.js +0 -4
  414. package/styled-components/es/components/TextField/_label-placement/outer.js +0 -4
  415. package/styled-components/es/components/TextField/_size/base.js +0 -4
  416. package/styled-components/es/components/TextField/_view/base.js +0 -4
  417. package/types/components/TextField/_disabled/base.d.ts.map +0 -1
  418. package/types/components/TextField/_label-placement/base.d.ts.map +0 -1
  419. package/types/components/TextField/_label-placement/index.d.ts.map +0 -1
  420. package/types/components/TextField/_label-placement/inner.d.ts.map +0 -1
  421. package/types/components/TextField/_label-placement/outer.d.ts.map +0 -1
  422. package/types/components/TextField/_size/base.d.ts.map +0 -1
  423. package/types/components/TextField/_view/base.d.ts.map +0 -1
  424. /package/cjs/components/{Select/ui/SelectDivider/variations/_size → TextField/variations/_label-placement}/base_x642ct.css +0 -0
  425. /package/{cjs/components/Select/ui/SelectDivider/variations/_view → es/components/TextField/variations/_label-placement}/base_x642ct.css +0 -0
  426. /package/styled-components/cjs/components/TextField/{_disabled → variations/_disabled}/tokens.json +0 -0
  427. /package/styled-components/cjs/components/TextField/{_label-placement → variations/_label-placement}/base.js +0 -0
  428. /package/styled-components/cjs/components/TextField/{_label-placement → variations/_label-placement}/index.js +0 -0
  429. /package/styled-components/cjs/components/TextField/{_size → variations/_size}/tokens.json +0 -0
  430. /package/styled-components/cjs/components/TextField/{_view → variations/_view}/tokens.json +0 -0
  431. /package/styled-components/es/components/TextField/{_disabled → variations/_disabled}/tokens.json +0 -0
  432. /package/styled-components/es/components/TextField/{_label-placement → variations/_label-placement}/base.js +0 -0
  433. /package/styled-components/es/components/TextField/{_label-placement → variations/_label-placement}/index.js +0 -0
  434. /package/styled-components/es/components/TextField/{_size → variations/_size}/tokens.json +0 -0
  435. /package/styled-components/es/components/TextField/{_view → variations/_view}/tokens.json +0 -0
  436. /package/types/components/TextField/{_disabled → variations/_disabled}/base.d.ts +0 -0
  437. /package/types/components/TextField/{_label-placement → variations/_label-placement}/base.d.ts +0 -0
  438. /package/types/components/TextField/{_label-placement → variations/_label-placement}/index.d.ts +0 -0
  439. /package/types/components/TextField/{_label-placement → variations/_label-placement}/inner.d.ts +0 -0
  440. /package/types/components/TextField/{_label-placement → variations/_label-placement}/outer.d.ts +0 -0
  441. /package/types/components/TextField/{_size → variations/_read-only}/base.d.ts +0 -0
  442. /package/types/components/TextField/{_view → variations/_size}/base.d.ts +0 -0
@@ -1,91 +1,221 @@
1
- var _excluded = ["contentLeft", "contentRight", "children", "label", "labelPlacement", "placeholder", "leftHelper", "view", "size", "disabled", "onChange", "onSearch"];
1
+ var _excluded = ["id", "contentLeft", "contentRight", "label", "labelPlacement", "placeholder", "leftHelper", "enumerationType", "view", "size", "readOnly", "disabled", "values", "onChange", "onChangeChips", "onSearch"];
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
8
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
3
9
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
10
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
- import React, { forwardRef } from 'react';
6
- import { css } from 'styled-components';
11
+ import React, { forwardRef, useEffect, useRef, useState } from 'react';
7
12
  import { safeUseId } from '@salutejs/plasma-core';
8
- import { base as size } from './_size/base';
9
- import { base as view } from './_view/base';
10
- import { base as disabled } from './_disabled/base';
11
- import { base as labelPlacement } from './_label-placement/base';
12
- import { Input, LeftHelper, Label, InputWrapper, InputLabelWrapper } from './TextField.styles';
13
- var base = /*#__PURE__*/css(["display:block;"]);
13
+ import { css } from 'styled-components';
14
+ import { cx } from '../../utils';
15
+ import { base as sizeCSS } from './variations/_size/base';
16
+ import { base as viewCSS } from './variations/_view/base';
17
+ import { base as disabledCSS } from './variations/_disabled/base';
18
+ import { base as readOnlyCSS } from './variations/_read-only/base';
19
+ import { base as labelPlacementCSS } from './variations/_label-placement/base';
20
+ import { Input, LeftHelper, Label, InputWrapper, InputLabelWrapper, StyledContentLeft, StyledContentRight, StyledChips } from './TextField.styles';
21
+ import { classes } from './TextField.tokens';
22
+ import { TextFieldChip } from './ui';
23
+ import { useKeyNavigation } from './hooks/useKeyNavigation';
24
+ export var base = /*#__PURE__*/css(["display:block;overflow:hidden;"]);
14
25
  export var textFieldRoot = function textFieldRoot(Root) {
15
- return /*#__PURE__*/forwardRef(function (props, ref) {
16
- var contentLeft = props.contentLeft,
17
- contentRight = props.contentRight,
18
- children = props.children,
19
- label = props.label,
20
- labelPlacement = props.labelPlacement,
21
- placeholder = props.placeholder,
22
- leftHelper = props.leftHelper,
23
- view = props.view,
24
- size = props.size,
25
- disabled = props.disabled,
26
- onChange = props.onChange,
27
- onSearch = props.onSearch,
28
- rest = _objectWithoutProperties(props, _excluded);
26
+ return /*#__PURE__*/forwardRef(function (_ref, ref) {
27
+ var id = _ref.id,
28
+ contentLeft = _ref.contentLeft,
29
+ contentRight = _ref.contentRight,
30
+ label = _ref.label,
31
+ labelPlacement = _ref.labelPlacement,
32
+ placeholder = _ref.placeholder,
33
+ leftHelper = _ref.leftHelper,
34
+ _ref$enumerationType = _ref.enumerationType,
35
+ enumerationType = _ref$enumerationType === void 0 ? 'plain' : _ref$enumerationType,
36
+ view = _ref.view,
37
+ size = _ref.size,
38
+ _ref$readOnly = _ref.readOnly,
39
+ readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
40
+ _ref$disabled = _ref.disabled,
41
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
42
+ values = _ref.values,
43
+ onChange = _ref.onChange,
44
+ onChangeChips = _ref.onChangeChips,
45
+ onSearch = _ref.onSearch,
46
+ rest = _objectWithoutProperties(_ref, _excluded);
47
+ var contentRef = useRef(null);
48
+ var inputRef = useRef(null);
49
+ var chipsRefs = useRef([]);
50
+ var controlledRefs = {
51
+ contentRef: contentRef,
52
+ inputRef: inputRef,
53
+ chipsRefs: chipsRefs
54
+ };
55
+ var _useState = useState([]),
56
+ _useState2 = _slicedToArray(_useState, 2),
57
+ chips = _useState2[0],
58
+ setChips = _useState2[1];
59
+ var uniqId = safeUseId();
60
+ var innerId = id || uniqId;
61
+ var labelId = safeUseId();
62
+ var helperTextId = safeUseId();
63
+ var isChipEnumeration = enumerationType === 'chip';
64
+ var hideLabel = (size === 'xs' || isChipEnumeration) && labelPlacement === 'inner';
65
+ var labelInside = size !== 'xs' && labelPlacement === 'inner';
66
+ var innerLabelPlacementValue = hideLabel ? 'outer' : labelPlacement;
67
+ var innerPlaceholderValue = hideLabel ? label : placeholder;
68
+ var innerLabelValue = hideLabel ? undefined : label;
69
+ var isChipsVisible = isChipEnumeration && (chips === null || chips === void 0 ? void 0 : chips.length);
70
+ var withHasChips = isChipsVisible ? classes.hasChips : undefined;
71
+ var wrapperWithoutLeftContent = !contentLeft && isChipsVisible ? classes.hasEmptyContentLeft : undefined;
72
+ var wrapperWithoutRightContent = !contentRight && isChipsVisible ? classes.hasEmptyContentRight : undefined;
29
73
  var handleChange = function handleChange(event) {
74
+ if (disabled || readOnly) {
75
+ return;
76
+ }
30
77
  var _event$target = event.target,
31
78
  maxLength = _event$target.maxLength,
32
79
  value = _event$target.value;
33
- if (!onChange || maxLength !== -1 && value.length > maxLength) {
80
+ if (maxLength !== -1 && value.length > maxLength) {
81
+ return;
82
+ }
83
+ onChange === null || onChange === void 0 ? void 0 : onChange(event);
84
+ };
85
+ var updateChips = function updateChips(newChips, newValues) {
86
+ setChips(newChips);
87
+ onChangeChips === null || onChangeChips === void 0 ? void 0 : onChangeChips(newValues);
88
+ };
89
+ var _useKeyNavigation = useKeyNavigation({
90
+ controlledRefs: controlledRefs,
91
+ disabled: disabled,
92
+ readOnly: readOnly,
93
+ chips: chips,
94
+ enumerationType: enumerationType,
95
+ updateChips: updateChips,
96
+ onSearch: onSearch,
97
+ onChange: onChange
98
+ }),
99
+ handleInputKeydown = _useKeyNavigation.handleInputKeydown,
100
+ handleChipKeyDown = _useKeyNavigation.handleChipKeyDown,
101
+ onChipClear = _useKeyNavigation.onChipClear,
102
+ handleContentKeyDown = _useKeyNavigation.handleContentKeyDown;
103
+ var onChipClick = function onChipClick(event) {
104
+ return event.stopPropagation();
105
+ };
106
+ var handleInputFocus = function handleInputFocus() {
107
+ if (readOnly || disabled || !(inputRef !== null && inputRef !== void 0 && inputRef.current)) {
34
108
  return;
35
109
  }
36
- onChange(event);
110
+ inputRef.current.scrollIntoView({
111
+ behavior: 'smooth',
112
+ block: 'center',
113
+ inline: 'center'
114
+ });
115
+ inputRef.current.focus({
116
+ preventScroll: true
117
+ });
37
118
  };
38
- var handleKeyUp = function handleKeyUp(event) {
39
- if (event.key === 'Enter' && onSearch) {
40
- onSearch(event.target.value, event);
119
+ var getRef = function getRef(element, index) {
120
+ if (element && chipsRefs !== null && chipsRefs !== void 0 && chipsRefs.current) {
121
+ chipsRefs.current[index] = element;
41
122
  }
42
123
  };
43
- var labelInside = labelPlacement === 'inner';
44
- var lableId = safeUseId();
45
- var helperTextId = safeUseId();
124
+ useEffect(function () {
125
+ if (!isChipEnumeration && !(values !== null && values !== void 0 && values.length)) {
126
+ return;
127
+ }
128
+ var newChips = (values === null || values === void 0 ? void 0 : values.map(function (value, index) {
129
+ return {
130
+ id: "".concat(index, "_").concat(value),
131
+ text: value
132
+ };
133
+ })) || [];
134
+ setChips(newChips);
135
+ }, [isChipEnumeration, values]);
46
136
  return /*#__PURE__*/React.createElement(Root, {
137
+ ref: ref,
47
138
  view: view,
48
139
  size: size,
49
140
  disabled: disabled,
50
- labelPlacement: labelPlacement
51
- }, labelInside || label && /*#__PURE__*/React.createElement(Label, {
52
- id: lableId
53
- }, label), /*#__PURE__*/React.createElement(InputWrapper, null, contentLeft, /*#__PURE__*/React.createElement(InputLabelWrapper, null, /*#__PURE__*/React.createElement(Input, _extends({}, rest, {
54
- ref: ref,
55
- "aria-labelledby": lableId,
141
+ readOnly: !disabled && readOnly,
142
+ labelPlacement: innerLabelPlacementValue,
143
+ onClick: handleInputFocus
144
+ }, labelInside || innerLabelValue && /*#__PURE__*/React.createElement(Label, {
145
+ id: labelId,
146
+ htmlFor: id
147
+ }, innerLabelValue), /*#__PURE__*/React.createElement(InputWrapper, {
148
+ className: cx(withHasChips, wrapperWithoutLeftContent, wrapperWithoutRightContent)
149
+ }, contentLeft && /*#__PURE__*/React.createElement(StyledContentLeft, null, contentLeft), /*#__PURE__*/React.createElement(InputLabelWrapper, {
150
+ tabIndex: -1,
151
+ ref: contentRef,
152
+ onKeyDown: handleContentKeyDown,
153
+ className: withHasChips
154
+ }, isChipEnumeration && Boolean(chips === null || chips === void 0 ? void 0 : chips.length) && /*#__PURE__*/React.createElement(StyledChips, null, chips === null || chips === void 0 ? void 0 : chips.map(function (_ref2, index) {
155
+ var chipId = _ref2.id,
156
+ text = _ref2.text;
157
+ return /*#__PURE__*/React.createElement(TextFieldChip, {
158
+ ref: function ref(element) {
159
+ return getRef(element, index);
160
+ },
161
+ chipId: chipId,
162
+ key: "".concat(chipId, "_").concat(index),
163
+ disabled: disabled,
164
+ readOnly: readOnly,
165
+ value: text,
166
+ text: text,
167
+ onKeyDown: function onKeyDown(event) {
168
+ return handleChipKeyDown(event, chipId);
169
+ },
170
+ onClear: function onClear() {
171
+ return onChipClear(chipId);
172
+ },
173
+ onClick: onChipClick
174
+ });
175
+ })), /*#__PURE__*/React.createElement(Input, _extends({}, rest, {
176
+ ref: inputRef,
177
+ id: innerId,
178
+ "aria-labelledby": labelId,
56
179
  "aria-describedby": helperTextId,
57
- placeholder: placeholder,
180
+ placeholder: innerPlaceholderValue,
58
181
  disabled: disabled,
182
+ readOnly: !disabled && readOnly,
59
183
  onChange: handleChange,
60
- onKeyUp: handleKeyUp
184
+ onKeyDown: handleInputKeydown
61
185
  })), labelInside && /*#__PURE__*/React.createElement(Label, {
62
- id: lableId
63
- }, label)), contentRight), leftHelper && /*#__PURE__*/React.createElement(LeftHelper, {
186
+ id: labelId,
187
+ htmlFor: innerId
188
+ }, innerLabelValue)), contentRight && /*#__PURE__*/React.createElement(StyledContentRight, null, contentRight)), leftHelper && /*#__PURE__*/React.createElement(LeftHelper, {
64
189
  id: helperTextId
65
190
  }, leftHelper));
66
191
  });
67
192
  };
68
193
  export var textFieldConfig = {
69
194
  name: 'TextField',
70
- tag: 'label',
195
+ tag: 'div',
71
196
  layout: textFieldRoot,
72
197
  base: base,
73
198
  variations: {
74
199
  view: {
75
- css: view
200
+ css: viewCSS
76
201
  },
77
202
  size: {
78
- css: size
203
+ css: sizeCSS
79
204
  },
80
205
  disabled: {
81
- css: disabled,
206
+ css: disabledCSS,
207
+ attrs: true
208
+ },
209
+ readOnly: {
210
+ css: readOnlyCSS,
82
211
  attrs: true
83
212
  },
84
213
  labelPlacement: {
85
- css: labelPlacement
214
+ css: labelPlacementCSS
86
215
  }
87
216
  },
88
217
  defaults: {
89
- size: 'm'
218
+ size: 'm',
219
+ view: 'default'
90
220
  }
91
221
  };
@@ -1,18 +1,26 @@
1
1
  import styled from 'styled-components';
2
- export var Input = /*#__PURE__*/styled.input.withConfig({
2
+ import { classes, tokens } from './TextField.tokens';
3
+ export var InputWrapper = /*#__PURE__*/styled.div.withConfig({
3
4
  componentId: "plasma-new-hope__sc-g4vxbb-0"
4
- })(["box-sizing:border-box;appearance:none;border:0;padding:0;background-color:transparent;outline:none;"]);
5
+ })(["position:relative;display:flex;align-items:center;box-sizing:border-box;"]);
5
6
  export var InputLabelWrapper = /*#__PURE__*/styled.div.withConfig({
6
7
  componentId: "plasma-new-hope__sc-g4vxbb-1"
7
- })(["", "{width:100%;}"], Input);
8
-
9
- // NOTE: border-width is used in size border-color is used in view
10
- export var InputWrapper = /*#__PURE__*/styled.div.withConfig({
8
+ })(["flex:1;overflow:scroll;position:relative;width:100%;display:inline-flex;align-items:center;::-webkit-scrollbar{display:none;}scrollbar-width:none;overscroll-behavior:contain;&.", "{height:var(", ");border-radius:var(", ");}"], /*#__PURE__*/String(classes.hasChips), tokens.chipHeight, tokens.chipBorderRadius);
9
+ export var StyledChips = /*#__PURE__*/styled.div.withConfig({
11
10
  componentId: "plasma-new-hope__sc-g4vxbb-2"
12
- })(["position:relative;display:flex;align-items:center;box-shadow:inset 0 0 0 var(--plasma_private-textfield-border-width) var(--plasma_private-textfield-border-color);", "{flex-grow:1;}"], InputLabelWrapper);
13
- export var Label = /*#__PURE__*/styled.div.withConfig({
11
+ })(["display:flex;gap:var(", ");margin-right:var(", ");user-select:none;"], tokens.chipGap, tokens.chipGap);
12
+ export var Input = /*#__PURE__*/styled.input.withConfig({
14
13
  componentId: "plasma-new-hope__sc-g4vxbb-3"
14
+ })(["box-sizing:border-box;appearance:none;border:0;padding:0;background-color:transparent;outline:none;flex:1;min-width:60%;"]);
15
+ export var Label = /*#__PURE__*/styled.label.withConfig({
16
+ componentId: "plasma-new-hope__sc-g4vxbb-4"
15
17
  })([""]);
18
+ export var StyledContentLeft = /*#__PURE__*/styled.div.withConfig({
19
+ componentId: "plasma-new-hope__sc-g4vxbb-5"
20
+ })(["margin:var(", ");"], tokens.leftContentMargin);
21
+ export var StyledContentRight = /*#__PURE__*/styled.div.withConfig({
22
+ componentId: "plasma-new-hope__sc-g4vxbb-6"
23
+ })(["margin:var(", ");"], tokens.rightContentMargin);
16
24
  export var LeftHelper = /*#__PURE__*/styled.div.withConfig({
17
- componentId: "plasma-new-hope__sc-g4vxbb-4"
25
+ componentId: "plasma-new-hope__sc-g4vxbb-7"
18
26
  })([""]);
@@ -110,3 +110,27 @@ export function App() {
110
110
  );
111
111
  }
112
112
  ```
113
+
114
+ ### Режим ввода
115
+ С помощью свойства `enumarationType` можно вводить элементы как теги.
116
+ По нажатию Enter, после ввода нужного текста, он преобразуется в Chip:
117
+
118
+ ```tsx live
119
+ import React from 'react';
120
+ import { TextField } from '@salutejs/{{ package }};
121
+
122
+ export function App() {
123
+ return (
124
+ <div>
125
+ <TextField
126
+ placeholder="Введите значение"
127
+ defaultValue="Значение"
128
+ size="l"
129
+ enumerationType="chip"
130
+ helperText="Подсказка снизу"
131
+ values={["Значение 1"]}
132
+ />
133
+ </div>
134
+ );
135
+ }
136
+ ```
@@ -1,31 +1,42 @@
1
+ export var classes = {
2
+ hasChips: 'has-chips',
3
+ hasEmptyContentLeft: 'has-empty-content-left',
4
+ hasEmptyContentRight: 'has-empty-content-right'
5
+ };
1
6
  export var tokens = {
2
7
  color: '--plasma-textfield-color',
3
8
  backgroundColor: '--plasma-textfield-bg-color',
4
9
  backgroundColorHover: '--plasma-textfield-bg-color-hover',
5
10
  backgroundColorFocus: '--plasma-textfield-bg-color-focus',
6
- /** Цвет каретки */
7
- caretColor: '--plasma-textfield__caret-color',
8
- placeholderColor: '--plasma-textfield__placeholder-color',
9
11
  borderColor: '--plasma-textfield-border-color',
10
12
  borderColorHover: '--plasma-textfield-border-color-hover',
11
13
  borderColorFocus: '--plasma-textfield-border-color-focus',
14
+ /** Цвета для read-only состояния */
15
+ colorReadOnly: '--plasma-textfield-color-readonly',
16
+ backgroundColorReadOnly: '--plasma-textfield-bg-color-readonly',
17
+ borderColorReadOnly: '--plasma-textfield-border-color-readonly',
18
+ placeholderColorReadOnly: '--plasma-textfield__placeholder-color-readonly',
19
+ /** Цвет каретки */
20
+ caretColor: '--plasma-textfield__caret-color',
21
+ placeholderColor: '--plasma-textfield__placeholder-color',
12
22
  height: '--plasma-textfield-height',
13
23
  borderWidth: '--plasmas-textfield-border-width',
14
24
  borderRadius: '--plasma-textfield-border-radius',
15
- /** отступ от границы ТextField */
25
+ /** Отступ от границы ТextField */
16
26
  padding: '--plasma-textfield-padding',
17
- paddingWithContent: '--plasma-textfield-padding-with-content',
18
- /* Отступ между Иконками и текстом Инпута */
19
- /* Отступ при отсутствии Иконок сохраняется */
20
- contentOffset: '--plasma-textfield__content-offset',
27
+ paddingWithChips: '--plasma-textfield-padding-with-chips',
28
+ /* Токены для инпута */
29
+ leftContentMargin: '--plasma-textfield__left-content-margin',
30
+ rightContentMargin: '--plasma-textfield__right-content-margin',
21
31
  fontFamily: '--plasma-textfield-font-family',
22
32
  fontStyle: '--plasma-textfield-font-style',
23
33
  fontSize: '--plasma-textfield-font-size',
24
34
  fontWeight: '--plasma-textfield-font-weight',
25
35
  letterSpacing: '--plasma-textfield-letter-spacing',
26
36
  lineHeight: '--plasma-textfield-line-height',
27
- /** Цвет подписи */
37
+ /** Токены лейбла */
28
38
  labelColor: '--plasma-textfield__label-color',
39
+ labelColorReadOnly: '--plasma-textfield__label-color-readonly',
29
40
  labelOffset: '--plasma-textfield__label-offset',
30
41
  labelFontFamily: '--plasma-textfield__label-font-family',
31
42
  labelFontStyle: '--plasma-textfield__label-font-style',
@@ -40,16 +51,52 @@ export var tokens = {
40
51
  labelInnerFontWeight: '--plasma-textfield-placement_inner__label-font-weight',
41
52
  labelInnerLetterSpacing: '--plasma-textfield-placement_inner__label-letter-spacing',
42
53
  labelInnerLineHeight: '--plasma-textfield-placement_inner__label-line-height',
43
- leftHelperColor: '--plasma-textfield__leftHelper-color',
44
- leftHelperOffset: '--plasma-textfield__leftHelper-offset',
45
- leftHelperFontFamily: '--plasma-textfield__leftHelper-font-family',
46
- leftHelperFontStyle: '--plasma-textfield__leftHelper-font-style',
47
- leftHelperFontSize: '--plasma-textfield__leftHelper-font-size',
48
- leftHelperFontWeight: '--plasma-textfield__leftHelper-font-weight',
49
- leftHelperLetterSpacing: '--plasma-textfield__leftHelper-letter-spacing',
50
- leftHelperLineHeight: '--plasma-textfield__leftHelper-line-height',
51
- /* Дополнительный цвет который можно использовать в <Icon color="inheit" /> */
52
- contentColor: '--plasma-textfield__content-color',
54
+ labelInnerPadding: '--plasma-textfield-placement_inner__label-padding',
55
+ contentLabelInnerPadding: '--plasma-textfield-placement_inner__content-padding',
56
+ leftHelperColor: '--plasma-textfield__left-helper-color',
57
+ leftHelperColorReadOnly: '--plasma-textfield__left-helper-color-readonly',
58
+ leftHelperOffset: '--plasma-textfield__left-helper-offset',
59
+ leftHelperFontFamily: '--plasma-textfield__left-helper-font-family',
60
+ leftHelperFontStyle: '--plasma-textfield__left-helper-font-style',
61
+ leftHelperFontSize: '--plasma-textfield__left-helper-font-size',
62
+ leftHelperFontWeight: '--plasma-textfield__left-helper-font-weight',
63
+ leftHelperLetterSpacing: '--plasma-textfield__left-helper-letter-spacing',
64
+ leftHelperLineHeight: '--plasma-textfield__left-helper-line-height',
53
65
  /** Прозрачность для всего компонента в состоянии disabled */
54
- disabledOpacity: '--plasma-textfield-disabled-opacity'
66
+ disabledOpacity: '--plasma-textfield-disabled-opacity',
67
+ /** Токены чипа */
68
+ chipHeight: '--plasma-textfield__chip-height',
69
+ chipBorderRadius: '--plasma-textfield__chip-border-radius',
70
+ chipGap: '--plasma-textfield__chip-gap',
71
+ chipBackground: '--plasma-textfield__chip-background',
72
+ chipColor: '--plasma-textfield__chip-color',
73
+ chipBackgroundHover: '--plasma-textfield__chip-background-hover',
74
+ chipColorHover: '--plasma-textfield__chip-color-hover',
75
+ chipScaleHover: '--plasma-textfield__chip-scale-hover',
76
+ chipBackgroundReadOnly: '--plasma-textfield__chip-background-readonly',
77
+ chipColorReadOnly: '--plasma-textfield__chip-color-readonly',
78
+ chipBackgroundReadOnlyHover: '--plasma-textfield__chip-background-readonly-hover',
79
+ chipColorReadOnlyHover: '--plasma-textfield__chip-color-readonly-hover',
80
+ chipBackgroundActive: '--plasma-textfield__chip-background-active',
81
+ chipColorActive: '--plasma-textfield__chip-color-active',
82
+ chipScaleActive: '--plasma-textfield__chip-scale-active',
83
+ chipFocusColor: '--plasma-textfield__chip-focus-color',
84
+ chipCloseIconColor: '--plasma-textfield__chip-close-icon-color',
85
+ chipOutlineSize: '--plasma-textfield__chip-outline-size',
86
+ chipWidth: '--plasma-textfield__chip-width',
87
+ chipPaddingTop: '--plasma-textfield__chip-padding-top',
88
+ chipPaddingRight: '--plasma-textfield__chip-padding-right',
89
+ chipPaddingBottom: '--plasma-textfield__chip-padding-bottom',
90
+ chipPaddingLeft: '--plasma-textfield__chip-padding-left',
91
+ chipCloseIconSize: '--plasma-textfield__chip-close-icon-size',
92
+ chipFontFamily: '--plasma-textfield__chip-font-family',
93
+ chipFontSize: '--plasma-textfield__chip-font-size',
94
+ chipFontStyle: '--plasma-textfield__chip-font-style',
95
+ chipFontWeight: '--plasma-textfield__chip-font-weight',
96
+ chipLetterSpacing: '--plasma-textfield__chip-letter-spacing',
97
+ chipLineHeight: '--plasma-textfield__chip-line-height',
98
+ chipClearContentMarginLeft: '--plasma-textfield__chip-clear-content-margin-left',
99
+ chipClearContentMarginRight: '--plasma-textfield__chip-clear-content-margin-right',
100
+ chipOpacityReadonly: '--plasma-textfield__chip-opacity-readonly',
101
+ focusColor: '--plasma-textfield-focus-color'
55
102
  };
@@ -0,0 +1 @@
1
+ export { useKeyNavigation } from './useKeyNavigation';
@@ -0,0 +1,131 @@
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
4
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
5
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
10
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
+ import { useState } from 'react';
12
+ export var Keys = {
13
+ Enter: 'Enter',
14
+ Tab: 'Tab',
15
+ Escape: 'Escape',
16
+ ArrowLeft: 'ArrowLeft',
17
+ ArrowRight: 'ArrowRight',
18
+ Backspace: 'Backspace'
19
+ };
20
+ export var useKeyNavigation = function useKeyNavigation(_ref) {
21
+ var _ref$controlledRefs = _ref.controlledRefs,
22
+ chipsRefs = _ref$controlledRefs.chipsRefs,
23
+ contentRef = _ref$controlledRefs.contentRef,
24
+ inputRef = _ref$controlledRefs.inputRef,
25
+ disabled = _ref.disabled,
26
+ readOnly = _ref.readOnly,
27
+ chips = _ref.chips,
28
+ enumerationType = _ref.enumerationType,
29
+ updateChips = _ref.updateChips,
30
+ onChange = _ref.onChange,
31
+ onSearch = _ref.onSearch;
32
+ var _useState = useState(-1),
33
+ _useState2 = _slicedToArray(_useState, 2),
34
+ activeChipIndex = _useState2[0],
35
+ setActiveChipIndex = _useState2[1];
36
+ var handleInputKeydown = function handleInputKeydown(event) {
37
+ var _inputRef$current;
38
+ var _ref2 = event.target,
39
+ value = _ref2.value;
40
+ if (disabled || readOnly) {
41
+ return;
42
+ }
43
+ if (event.key === Keys.Enter && enumerationType === 'chip' && value) {
44
+ var nextIndex = (chips === null || chips === void 0 ? void 0 : chips.length) || 0;
45
+ var newChips = [].concat(_toConsumableArray(chips), [{
46
+ id: "".concat(nextIndex, "_").concat(value),
47
+ text: value
48
+ }]);
49
+ var newValues = newChips.map(function (_ref3) {
50
+ var text = _ref3.text;
51
+ return text;
52
+ });
53
+ updateChips(newChips, newValues);
54
+ event.target.value = '';
55
+ onChange === null || onChange === void 0 ? void 0 : onChange(event);
56
+ }
57
+ if (event.key === Keys.Enter && onSearch) {
58
+ onSearch(value, event);
59
+ }
60
+ if (event.key === Keys.Backspace && chips.length && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.selectionStart) === 0) {
61
+ var _newChips = _toConsumableArray(chips);
62
+ _newChips === null || _newChips === void 0 ? void 0 : _newChips.pop();
63
+ chipsRefs === null || chipsRefs === void 0 ? void 0 : chipsRefs.current.pop();
64
+ var _newValues = _newChips.map(function (_ref4) {
65
+ var text = _ref4.text;
66
+ return text;
67
+ });
68
+ updateChips(_newChips, _newValues);
69
+ }
70
+ };
71
+ var onChipClear = function onChipClear(clearId) {
72
+ if (!chips.length) {
73
+ return;
74
+ }
75
+ var newChips = (chips === null || chips === void 0 ? void 0 : chips.filter(function (_ref5) {
76
+ var chipId = _ref5.id;
77
+ return chipId !== clearId;
78
+ })) || [];
79
+ var newValues = newChips.map(function (_ref6) {
80
+ var text = _ref6.text;
81
+ return text;
82
+ });
83
+ updateChips(newChips, newValues);
84
+ };
85
+ var handleChipKeyDown = function handleChipKeyDown(event, chipId) {
86
+ if (event.key === Keys.Tab) {
87
+ event.preventDefault();
88
+ }
89
+ if (event.key === Keys.Backspace) {
90
+ onChipClear(chipId);
91
+ }
92
+ };
93
+ var handleContentKeyDown = function handleContentKeyDown(event) {
94
+ var _inputRef$current2, _focusedItem, _focusedItem2;
95
+ var chipsRefsCount = chips.length;
96
+ var currentCaretPosition = (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.selectionStart) || 0;
97
+ var newActiveChipIndex = activeChipIndex;
98
+ var focusedItem = null;
99
+ if (event.key === Keys.ArrowLeft && enumerationType === 'chip' && currentCaretPosition <= 0) {
100
+ var _chipsRefs$current;
101
+ var index = activeChipIndex - 1 <= 0 ? 0 : activeChipIndex - 1;
102
+ newActiveChipIndex = document.activeElement === (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) ? chipsRefsCount - 1 : index;
103
+ focusedItem = (_chipsRefs$current = chipsRefs.current) === null || _chipsRefs$current === void 0 ? void 0 : _chipsRefs$current[newActiveChipIndex];
104
+ }
105
+ if (event.key === Keys.ArrowRight && enumerationType === 'chip' && document.activeElement !== (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current)) {
106
+ var _chipsRefs$current2;
107
+ var _index = activeChipIndex + 1 >= chipsRefsCount ? activeChipIndex : activeChipIndex + 1;
108
+ newActiveChipIndex = document.activeElement === (contentRef === null || contentRef === void 0 ? void 0 : contentRef.current) ? 0 : _index;
109
+ focusedItem = _index === activeChipIndex ? inputRef === null || inputRef === void 0 ? void 0 : inputRef.current : (_chipsRefs$current2 = chipsRefs.current) === null || _chipsRefs$current2 === void 0 ? void 0 : _chipsRefs$current2[newActiveChipIndex];
110
+ }
111
+ if (event.key === Keys.Backspace && document.activeElement !== (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current)) {
112
+ var _chipsRefs$current3;
113
+ var _index2 = activeChipIndex - 1 <= 0 ? 0 : activeChipIndex - 1;
114
+ newActiveChipIndex = chipsRefsCount === 0 ? -1 : _index2;
115
+ focusedItem = chipsRefsCount === 0 ? inputRef === null || inputRef === void 0 ? void 0 : inputRef.current : chipsRefs === null || chipsRefs === void 0 ? void 0 : (_chipsRefs$current3 = chipsRefs.current) === null || _chipsRefs$current3 === void 0 ? void 0 : _chipsRefs$current3[newActiveChipIndex];
116
+ }
117
+ (_focusedItem = focusedItem) === null || _focusedItem === void 0 ? void 0 : _focusedItem.focus();
118
+ (_focusedItem2 = focusedItem) === null || _focusedItem2 === void 0 ? void 0 : _focusedItem2.scrollIntoView({
119
+ behavior: 'smooth',
120
+ block: 'center',
121
+ inline: 'center'
122
+ });
123
+ setActiveChipIndex(newActiveChipIndex);
124
+ };
125
+ return {
126
+ handleInputKeydown: handleInputKeydown,
127
+ handleChipKeyDown: handleChipKeyDown,
128
+ onChipClear: onChipClear,
129
+ handleContentKeyDown: handleContentKeyDown
130
+ };
131
+ };
@@ -1,4 +1,4 @@
1
- export { labelPlacement_inner as textField_labelPlacement_inner } from './_label-placement/inner';
2
- export { labelPlacement_outer as textField_labelPlacement_outer } from './_label-placement/outer';
1
+ export { labelPlacement_inner as textField_labelPlacement_inner } from './variations/_label-placement/inner';
2
+ export { labelPlacement_outer as textField_labelPlacement_outer } from './variations/_label-placement/outer';
3
3
  export { textFieldRoot, textFieldConfig } from './TextField';
4
4
  export { tokens as textFieldTokens } from './TextField.tokens';
@@ -0,0 +1,30 @@
1
+ import React, { forwardRef } from 'react';
2
+ import { StyledChip } from './TextFieldChip.styles';
3
+ /**
4
+ * Чип, отображающий выбранный элемент
5
+ */
6
+ export var TextFieldChip = /*#__PURE__*/forwardRef(function (_ref, ref) {
7
+ var chipId = _ref.chipId,
8
+ text = _ref.text,
9
+ disabled = _ref.disabled,
10
+ readOnly = _ref.readOnly,
11
+ onClick = _ref.onClick,
12
+ onClear = _ref.onClear,
13
+ onKeyDown = _ref.onKeyDown;
14
+ var onClearHandle = function onClearHandle() {
15
+ return onClear(chipId);
16
+ };
17
+ var onKeyDownHandle = function onKeyDownHandle(event) {
18
+ onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event, chipId);
19
+ };
20
+ return /*#__PURE__*/React.createElement(StyledChip, {
21
+ ref: ref,
22
+ tabIndex: -1,
23
+ disabled: disabled,
24
+ readOnly: readOnly,
25
+ onClick: onClick,
26
+ onClear: onClearHandle,
27
+ onKeyDown: onKeyDownHandle,
28
+ text: "".concat(text)
29
+ });
30
+ });