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

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