@salutejs/plasma-new-hope 0.174.0-canary.1505.11515852860.0 → 0.174.0-canary.1511.11518967304.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (411) hide show
  1. package/cjs/components/Combobox/ComboboxNew/Combobox.js +22 -27
  2. package/cjs/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
  3. package/cjs/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -9
  4. package/cjs/components/Combobox/ComboboxNew/utils/initialItemsTransform.js.map +1 -1
  5. package/cjs/components/NumberInput/NumberInput.css +54 -0
  6. package/cjs/components/NumberInput/NumberInput.js +188 -0
  7. package/cjs/components/NumberInput/NumberInput.js.map +1 -0
  8. package/cjs/components/NumberInput/NumberInput.styles.js +9 -0
  9. package/cjs/components/NumberInput/NumberInput.styles.js.map +1 -0
  10. package/cjs/components/NumberInput/NumberInput.styles_jeawjl.css +1 -0
  11. package/cjs/components/NumberInput/NumberInput.tokens.js +90 -0
  12. package/cjs/components/NumberInput/NumberInput.tokens.js.map +1 -0
  13. package/cjs/components/NumberInput/ui/ActionButton/ActionButton.js +19 -0
  14. package/cjs/components/NumberInput/ui/ActionButton/ActionButton.js.map +1 -0
  15. package/cjs/components/NumberInput/ui/ActionButton/ActionButton.styles.js +22 -0
  16. package/cjs/components/NumberInput/ui/ActionButton/ActionButton.styles.js.map +1 -0
  17. package/cjs/components/NumberInput/ui/ActionButton/ActionButton.styles_x642ct.css +1 -0
  18. package/cjs/components/NumberInput/ui/Input/Input.css +15 -0
  19. package/cjs/components/NumberInput/ui/Input/Input.js +190 -0
  20. package/cjs/components/NumberInput/ui/Input/Input.js.map +1 -0
  21. package/cjs/components/NumberInput/ui/Input/Input.styles.js +96 -0
  22. package/cjs/components/NumberInput/ui/Input/Input.styles.js.map +1 -0
  23. package/cjs/components/NumberInput/ui/Input/Input.styles_jszc0c.css +8 -0
  24. package/cjs/components/NumberInput/utils/index.js +8 -0
  25. package/cjs/components/NumberInput/utils/index.js.map +1 -0
  26. package/cjs/components/NumberInput/variations/_background-type/base.js +9 -0
  27. package/cjs/components/NumberInput/variations/_background-type/base.js.map +1 -0
  28. package/cjs/components/NumberInput/variations/_background-type/base_1jmdljr.css +1 -0
  29. package/cjs/components/NumberInput/variations/_clear/base.js +9 -0
  30. package/cjs/components/NumberInput/variations/_clear/base.js.map +1 -0
  31. package/cjs/components/NumberInput/variations/_clear/base_3l8dqb.css +1 -0
  32. package/cjs/components/NumberInput/variations/_disabled/base.js +9 -0
  33. package/cjs/components/NumberInput/variations/_disabled/base.js.map +1 -0
  34. package/cjs/components/NumberInput/variations/_disabled/base_1sl0mh8.css +1 -0
  35. package/cjs/components/NumberInput/variations/_segmentation/base.js +9 -0
  36. package/cjs/components/NumberInput/variations/_segmentation/base.js.map +1 -0
  37. package/cjs/components/NumberInput/variations/_segmentation/base_nl8ve.css +1 -0
  38. package/cjs/components/NumberInput/variations/_shape/base.js +9 -0
  39. package/cjs/components/NumberInput/variations/_shape/base.js.map +1 -0
  40. package/cjs/components/NumberInput/variations/_shape/base_k05biw.css +1 -0
  41. package/cjs/components/NumberInput/variations/_size/base.js +9 -0
  42. package/cjs/components/NumberInput/variations/_size/base.js.map +1 -0
  43. package/cjs/components/NumberInput/variations/_size/base_1pju5qf.css +1 -0
  44. package/cjs/components/NumberInput/variations/_view/base.js +9 -0
  45. package/cjs/components/NumberInput/variations/_view/base.js.map +1 -0
  46. package/cjs/components/NumberInput/variations/_view/base_cghr9q.css +1 -0
  47. package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
  48. package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js.map +1 -1
  49. package/cjs/components/Select/Select.js +25 -13
  50. package/cjs/components/Select/Select.js.map +1 -1
  51. package/cjs/components/Select/hooks/useKeyboardNavigation.js +1 -1
  52. package/cjs/components/Select/hooks/useKeyboardNavigation.js.map +1 -1
  53. package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
  54. package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js.map +1 -1
  55. package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +1 -1
  56. package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js.map +1 -1
  57. package/cjs/components/Select/utils/getButtonLabel.js +1 -1
  58. package/cjs/components/Select/utils/getButtonLabel.js.map +1 -1
  59. package/cjs/components/Select/utils/initialItemsTransform.js +6 -9
  60. package/cjs/components/Select/utils/initialItemsTransform.js.map +1 -1
  61. package/cjs/index.css +25 -0
  62. package/cjs/index.js +6 -0
  63. package/cjs/index.js.map +1 -1
  64. package/emotion/cjs/components/Combobox/ComboboxNew/Combobox.js +22 -26
  65. package/emotion/cjs/components/Combobox/ComboboxNew/utils/index.js +1 -8
  66. package/emotion/cjs/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -19
  67. package/emotion/cjs/components/NumberInput/NumberInput.js +198 -0
  68. package/emotion/cjs/components/NumberInput/NumberInput.styles.js +17 -0
  69. package/emotion/cjs/components/NumberInput/NumberInput.tokens.js +87 -0
  70. package/emotion/cjs/components/NumberInput/NumberInput.types.js +5 -0
  71. package/emotion/cjs/components/NumberInput/index.js +31 -0
  72. package/emotion/cjs/components/NumberInput/ui/ActionButton/ActionButton.js +18 -0
  73. package/emotion/cjs/components/NumberInput/ui/ActionButton/ActionButton.styles.js +16 -0
  74. package/emotion/cjs/components/NumberInput/ui/ActionButton/ActionButton.types.js +5 -0
  75. package/emotion/cjs/components/NumberInput/ui/Input/Input.js +198 -0
  76. package/emotion/cjs/components/NumberInput/ui/Input/Input.styles.js +82 -0
  77. package/emotion/cjs/components/NumberInput/ui/Input/Input.types.js +5 -0
  78. package/emotion/cjs/components/NumberInput/ui/index.js +19 -0
  79. package/emotion/cjs/components/NumberInput/utils/index.js +7 -0
  80. package/emotion/cjs/components/NumberInput/variations/_background-type/base.js +10 -0
  81. package/emotion/cjs/components/NumberInput/variations/_background-type/tokens.json +6 -0
  82. package/emotion/cjs/components/NumberInput/variations/_clear/base.js +12 -0
  83. package/emotion/cjs/components/NumberInput/variations/_clear/tokens.json +5 -0
  84. package/emotion/cjs/components/NumberInput/variations/_disabled/base.js +9 -0
  85. package/emotion/cjs/components/NumberInput/variations/_disabled/tokens.json +4 -0
  86. package/emotion/cjs/components/NumberInput/variations/_segmentation/base.js +12 -0
  87. package/emotion/cjs/components/NumberInput/variations/_segmentation/tokens.json +1 -0
  88. package/emotion/cjs/components/NumberInput/variations/_shape/base.js +11 -0
  89. package/emotion/cjs/components/NumberInput/variations/_shape/tokens.json +1 -0
  90. package/emotion/cjs/components/NumberInput/variations/_size/base.js +13 -0
  91. package/emotion/cjs/components/NumberInput/variations/_size/tokens.json +22 -0
  92. package/emotion/cjs/components/NumberInput/variations/_view/base.js +13 -0
  93. package/emotion/cjs/components/NumberInput/variations/_view/tokens.json +14 -0
  94. package/emotion/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
  95. package/emotion/cjs/components/Select/Select.js +25 -12
  96. package/emotion/cjs/components/Select/hooks/useKeyboardNavigation.js +1 -1
  97. package/emotion/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
  98. package/emotion/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +13 -13
  99. package/emotion/cjs/components/Select/utils/getButtonLabel.js +1 -1
  100. package/emotion/cjs/components/Select/utils/index.js +1 -8
  101. package/emotion/cjs/components/Select/utils/initialItemsTransform.js +6 -19
  102. package/emotion/cjs/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +0 -6
  103. package/emotion/cjs/examples/plasma_b2c/components/NumberInput/NumberInput.config.js +48 -0
  104. package/emotion/cjs/examples/plasma_b2c/components/NumberInput/NumberInput.js +11 -0
  105. package/emotion/cjs/examples/plasma_b2c/components/NumberInput/NumberInput.stories.tsx +109 -0
  106. package/emotion/cjs/examples/plasma_web/components/Combobox/Combobox.stories.tsx +0 -6
  107. package/emotion/cjs/examples/plasma_web/components/NumberInput/NumberInput.config.js +48 -0
  108. package/emotion/cjs/examples/plasma_web/components/NumberInput/NumberInput.js +11 -0
  109. package/emotion/cjs/examples/plasma_web/components/NumberInput/NumberInput.stories.tsx +109 -0
  110. package/emotion/cjs/index.js +11 -0
  111. package/emotion/es/components/Combobox/ComboboxNew/Combobox.js +23 -27
  112. package/emotion/es/components/Combobox/ComboboxNew/utils/index.js +1 -2
  113. package/emotion/es/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -19
  114. package/emotion/es/components/NumberInput/NumberInput.js +190 -0
  115. package/emotion/es/components/NumberInput/NumberInput.styles.js +11 -0
  116. package/emotion/es/components/NumberInput/NumberInput.tokens.js +81 -0
  117. package/emotion/es/components/NumberInput/NumberInput.types.js +1 -0
  118. package/emotion/es/components/NumberInput/index.js +2 -0
  119. package/emotion/es/components/NumberInput/ui/ActionButton/ActionButton.js +11 -0
  120. package/emotion/es/components/NumberInput/ui/ActionButton/ActionButton.styles.js +9 -0
  121. package/emotion/es/components/NumberInput/ui/ActionButton/ActionButton.types.js +1 -0
  122. package/emotion/es/components/NumberInput/ui/Input/Input.js +189 -0
  123. package/emotion/es/components/NumberInput/ui/Input/Input.styles.js +75 -0
  124. package/emotion/es/components/NumberInput/ui/Input/Input.types.js +1 -0
  125. package/emotion/es/components/NumberInput/ui/index.js +2 -0
  126. package/emotion/es/components/NumberInput/utils/index.js +1 -0
  127. package/emotion/es/components/NumberInput/variations/_background-type/base.js +4 -0
  128. package/emotion/es/components/NumberInput/variations/_background-type/tokens.json +6 -0
  129. package/emotion/es/components/NumberInput/variations/_clear/base.js +6 -0
  130. package/emotion/es/components/NumberInput/variations/_clear/tokens.json +5 -0
  131. package/emotion/es/components/NumberInput/variations/_disabled/base.js +3 -0
  132. package/emotion/es/components/NumberInput/variations/_disabled/tokens.json +4 -0
  133. package/emotion/es/components/NumberInput/variations/_segmentation/base.js +6 -0
  134. package/emotion/es/components/NumberInput/variations/_segmentation/tokens.json +1 -0
  135. package/emotion/es/components/NumberInput/variations/_shape/base.js +5 -0
  136. package/emotion/es/components/NumberInput/variations/_shape/tokens.json +1 -0
  137. package/emotion/es/components/NumberInput/variations/_size/base.js +7 -0
  138. package/emotion/es/components/NumberInput/variations/_size/tokens.json +22 -0
  139. package/emotion/es/components/NumberInput/variations/_view/base.js +7 -0
  140. package/emotion/es/components/NumberInput/variations/_view/tokens.json +14 -0
  141. package/emotion/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
  142. package/emotion/es/components/Select/Select.js +26 -13
  143. package/emotion/es/components/Select/hooks/useKeyboardNavigation.js +1 -1
  144. package/emotion/es/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
  145. package/emotion/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +13 -13
  146. package/emotion/es/components/Select/utils/getButtonLabel.js +1 -1
  147. package/emotion/es/components/Select/utils/index.js +1 -2
  148. package/emotion/es/components/Select/utils/initialItemsTransform.js +6 -19
  149. package/emotion/es/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +0 -6
  150. package/emotion/es/examples/plasma_b2c/components/NumberInput/NumberInput.config.js +42 -0
  151. package/emotion/es/examples/plasma_b2c/components/NumberInput/NumberInput.js +5 -0
  152. package/emotion/es/examples/plasma_b2c/components/NumberInput/NumberInput.stories.tsx +109 -0
  153. package/emotion/es/examples/plasma_web/components/Combobox/Combobox.stories.tsx +0 -6
  154. package/emotion/es/examples/plasma_web/components/NumberInput/NumberInput.config.js +42 -0
  155. package/emotion/es/examples/plasma_web/components/NumberInput/NumberInput.js +5 -0
  156. package/emotion/es/examples/plasma_web/components/NumberInput/NumberInput.stories.tsx +109 -0
  157. package/emotion/es/index.js +2 -1
  158. package/es/components/Combobox/ComboboxNew/Combobox.js +22 -27
  159. package/es/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
  160. package/es/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -9
  161. package/es/components/Combobox/ComboboxNew/utils/initialItemsTransform.js.map +1 -1
  162. package/es/components/NumberInput/NumberInput.css +54 -0
  163. package/es/components/NumberInput/NumberInput.js +183 -0
  164. package/es/components/NumberInput/NumberInput.js.map +1 -0
  165. package/es/components/NumberInput/NumberInput.styles.js +5 -0
  166. package/es/components/NumberInput/NumberInput.styles.js.map +1 -0
  167. package/es/components/NumberInput/NumberInput.styles_jeawjl.css +1 -0
  168. package/es/components/NumberInput/NumberInput.tokens.js +84 -0
  169. package/es/components/NumberInput/NumberInput.tokens.js.map +1 -0
  170. package/es/components/NumberInput/ui/ActionButton/ActionButton.js +15 -0
  171. package/es/components/NumberInput/ui/ActionButton/ActionButton.js.map +1 -0
  172. package/es/components/NumberInput/ui/ActionButton/ActionButton.styles.js +18 -0
  173. package/es/components/NumberInput/ui/ActionButton/ActionButton.styles.js.map +1 -0
  174. package/es/components/NumberInput/ui/ActionButton/ActionButton.styles_x642ct.css +1 -0
  175. package/es/components/NumberInput/ui/Input/Input.css +15 -0
  176. package/es/components/NumberInput/ui/Input/Input.js +186 -0
  177. package/es/components/NumberInput/ui/Input/Input.js.map +1 -0
  178. package/es/components/NumberInput/ui/Input/Input.styles.js +85 -0
  179. package/es/components/NumberInput/ui/Input/Input.styles.js.map +1 -0
  180. package/es/components/NumberInput/ui/Input/Input.styles_jszc0c.css +8 -0
  181. package/es/components/NumberInput/utils/index.js +4 -0
  182. package/es/components/NumberInput/utils/index.js.map +1 -0
  183. package/es/components/NumberInput/variations/_background-type/base.js +5 -0
  184. package/es/components/NumberInput/variations/_background-type/base.js.map +1 -0
  185. package/es/components/NumberInput/variations/_background-type/base_1jmdljr.css +1 -0
  186. package/es/components/NumberInput/variations/_clear/base.js +5 -0
  187. package/es/components/NumberInput/variations/_clear/base.js.map +1 -0
  188. package/es/components/NumberInput/variations/_clear/base_3l8dqb.css +1 -0
  189. package/es/components/NumberInput/variations/_disabled/base.js +5 -0
  190. package/es/components/NumberInput/variations/_disabled/base.js.map +1 -0
  191. package/es/components/NumberInput/variations/_disabled/base_1sl0mh8.css +1 -0
  192. package/es/components/NumberInput/variations/_segmentation/base.js +5 -0
  193. package/es/components/NumberInput/variations/_segmentation/base.js.map +1 -0
  194. package/es/components/NumberInput/variations/_segmentation/base_nl8ve.css +1 -0
  195. package/es/components/NumberInput/variations/_shape/base.js +5 -0
  196. package/es/components/NumberInput/variations/_shape/base.js.map +1 -0
  197. package/es/components/NumberInput/variations/_shape/base_k05biw.css +1 -0
  198. package/es/components/NumberInput/variations/_size/base.js +5 -0
  199. package/es/components/NumberInput/variations/_size/base.js.map +1 -0
  200. package/es/components/NumberInput/variations/_size/base_1pju5qf.css +1 -0
  201. package/es/components/NumberInput/variations/_view/base.js +5 -0
  202. package/es/components/NumberInput/variations/_view/base.js.map +1 -0
  203. package/es/components/NumberInput/variations/_view/base_cghr9q.css +1 -0
  204. package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
  205. package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js.map +1 -1
  206. package/es/components/Select/Select.js +26 -14
  207. package/es/components/Select/Select.js.map +1 -1
  208. package/es/components/Select/hooks/useKeyboardNavigation.js +1 -1
  209. package/es/components/Select/hooks/useKeyboardNavigation.js.map +1 -1
  210. package/es/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
  211. package/es/components/Select/ui/Target/ui/Textfield/Textfield.js.map +1 -1
  212. package/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +1 -1
  213. package/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js.map +1 -1
  214. package/es/components/Select/utils/getButtonLabel.js +1 -1
  215. package/es/components/Select/utils/getButtonLabel.js.map +1 -1
  216. package/es/components/Select/utils/initialItemsTransform.js +6 -9
  217. package/es/components/Select/utils/initialItemsTransform.js.map +1 -1
  218. package/es/index.css +25 -0
  219. package/es/index.js +2 -0
  220. package/es/index.js.map +1 -1
  221. package/package.json +2 -2
  222. package/styled-components/cjs/components/Combobox/ComboboxNew/Combobox.js +22 -26
  223. package/styled-components/cjs/components/Combobox/ComboboxNew/utils/index.js +1 -8
  224. package/styled-components/cjs/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -19
  225. package/styled-components/cjs/components/NumberInput/NumberInput.js +198 -0
  226. package/styled-components/cjs/components/NumberInput/NumberInput.styles.js +8 -0
  227. package/styled-components/cjs/components/NumberInput/NumberInput.tokens.js +87 -0
  228. package/styled-components/cjs/components/NumberInput/NumberInput.types.js +5 -0
  229. package/styled-components/cjs/components/NumberInput/index.js +31 -0
  230. package/styled-components/cjs/components/NumberInput/ui/ActionButton/ActionButton.js +18 -0
  231. package/styled-components/cjs/components/NumberInput/ui/ActionButton/ActionButton.styles.js +15 -0
  232. package/styled-components/cjs/components/NumberInput/ui/ActionButton/ActionButton.types.js +5 -0
  233. package/styled-components/cjs/components/NumberInput/ui/Input/Input.js +198 -0
  234. package/styled-components/cjs/components/NumberInput/ui/Input/Input.styles.js +49 -0
  235. package/styled-components/cjs/components/NumberInput/ui/Input/Input.types.js +5 -0
  236. package/styled-components/cjs/components/NumberInput/ui/index.js +19 -0
  237. package/styled-components/cjs/components/NumberInput/utils/index.js +7 -0
  238. package/styled-components/cjs/components/NumberInput/variations/_background-type/base.js +10 -0
  239. package/styled-components/cjs/components/NumberInput/variations/_background-type/tokens.json +6 -0
  240. package/styled-components/cjs/components/NumberInput/variations/_clear/base.js +12 -0
  241. package/styled-components/cjs/components/NumberInput/variations/_clear/tokens.json +5 -0
  242. package/styled-components/cjs/components/NumberInput/variations/_disabled/base.js +9 -0
  243. package/styled-components/cjs/components/NumberInput/variations/_disabled/tokens.json +4 -0
  244. package/styled-components/cjs/components/NumberInput/variations/_segmentation/base.js +12 -0
  245. package/styled-components/cjs/components/NumberInput/variations/_segmentation/tokens.json +1 -0
  246. package/styled-components/cjs/components/NumberInput/variations/_shape/base.js +11 -0
  247. package/styled-components/cjs/components/NumberInput/variations/_shape/tokens.json +1 -0
  248. package/styled-components/cjs/components/NumberInput/variations/_size/base.js +13 -0
  249. package/styled-components/cjs/components/NumberInput/variations/_size/tokens.json +22 -0
  250. package/styled-components/cjs/components/NumberInput/variations/_view/base.js +13 -0
  251. package/styled-components/cjs/components/NumberInput/variations/_view/tokens.json +14 -0
  252. package/styled-components/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
  253. package/styled-components/cjs/components/Select/Select.js +25 -12
  254. package/styled-components/cjs/components/Select/hooks/useKeyboardNavigation.js +1 -1
  255. package/styled-components/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
  256. package/styled-components/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +1 -1
  257. package/styled-components/cjs/components/Select/utils/getButtonLabel.js +1 -1
  258. package/styled-components/cjs/components/Select/utils/index.js +1 -8
  259. package/styled-components/cjs/components/Select/utils/initialItemsTransform.js +6 -19
  260. package/styled-components/cjs/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +0 -6
  261. package/styled-components/cjs/examples/plasma_b2c/components/NumberInput/NumberInput.config.js +48 -0
  262. package/styled-components/cjs/examples/plasma_b2c/components/NumberInput/NumberInput.js +11 -0
  263. package/styled-components/cjs/examples/plasma_b2c/components/NumberInput/NumberInput.stories.tsx +109 -0
  264. package/styled-components/cjs/examples/plasma_web/components/Combobox/Combobox.stories.tsx +0 -6
  265. package/styled-components/cjs/examples/plasma_web/components/NumberInput/NumberInput.config.js +48 -0
  266. package/styled-components/cjs/examples/plasma_web/components/NumberInput/NumberInput.js +11 -0
  267. package/styled-components/cjs/examples/plasma_web/components/NumberInput/NumberInput.stories.tsx +109 -0
  268. package/styled-components/cjs/index.js +11 -0
  269. package/styled-components/es/components/Combobox/ComboboxNew/Combobox.js +23 -27
  270. package/styled-components/es/components/Combobox/ComboboxNew/utils/index.js +1 -2
  271. package/styled-components/es/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -19
  272. package/styled-components/es/components/NumberInput/NumberInput.js +190 -0
  273. package/styled-components/es/components/NumberInput/NumberInput.styles.js +2 -0
  274. package/styled-components/es/components/NumberInput/NumberInput.tokens.js +81 -0
  275. package/styled-components/es/components/NumberInput/NumberInput.types.js +1 -0
  276. package/styled-components/es/components/NumberInput/index.js +2 -0
  277. package/styled-components/es/components/NumberInput/ui/ActionButton/ActionButton.js +11 -0
  278. package/styled-components/es/components/NumberInput/ui/ActionButton/ActionButton.styles.js +8 -0
  279. package/styled-components/es/components/NumberInput/ui/ActionButton/ActionButton.types.js +1 -0
  280. package/styled-components/es/components/NumberInput/ui/Input/Input.js +189 -0
  281. package/styled-components/es/components/NumberInput/ui/Input/Input.styles.js +42 -0
  282. package/styled-components/es/components/NumberInput/ui/Input/Input.types.js +1 -0
  283. package/styled-components/es/components/NumberInput/ui/index.js +2 -0
  284. package/styled-components/es/components/NumberInput/utils/index.js +1 -0
  285. package/styled-components/es/components/NumberInput/variations/_background-type/base.js +4 -0
  286. package/styled-components/es/components/NumberInput/variations/_background-type/tokens.json +6 -0
  287. package/styled-components/es/components/NumberInput/variations/_clear/base.js +6 -0
  288. package/styled-components/es/components/NumberInput/variations/_clear/tokens.json +5 -0
  289. package/styled-components/es/components/NumberInput/variations/_disabled/base.js +3 -0
  290. package/styled-components/es/components/NumberInput/variations/_disabled/tokens.json +4 -0
  291. package/styled-components/es/components/NumberInput/variations/_segmentation/base.js +6 -0
  292. package/styled-components/es/components/NumberInput/variations/_segmentation/tokens.json +1 -0
  293. package/styled-components/es/components/NumberInput/variations/_shape/base.js +5 -0
  294. package/styled-components/es/components/NumberInput/variations/_shape/tokens.json +1 -0
  295. package/styled-components/es/components/NumberInput/variations/_size/base.js +7 -0
  296. package/styled-components/es/components/NumberInput/variations/_size/tokens.json +22 -0
  297. package/styled-components/es/components/NumberInput/variations/_view/base.js +7 -0
  298. package/styled-components/es/components/NumberInput/variations/_view/tokens.json +14 -0
  299. package/styled-components/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
  300. package/styled-components/es/components/Select/Select.js +26 -13
  301. package/styled-components/es/components/Select/hooks/useKeyboardNavigation.js +1 -1
  302. package/styled-components/es/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
  303. package/styled-components/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +1 -1
  304. package/styled-components/es/components/Select/utils/getButtonLabel.js +1 -1
  305. package/styled-components/es/components/Select/utils/index.js +1 -2
  306. package/styled-components/es/components/Select/utils/initialItemsTransform.js +6 -19
  307. package/styled-components/es/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +0 -6
  308. package/styled-components/es/examples/plasma_b2c/components/NumberInput/NumberInput.config.js +42 -0
  309. package/styled-components/es/examples/plasma_b2c/components/NumberInput/NumberInput.js +5 -0
  310. package/styled-components/es/examples/plasma_b2c/components/NumberInput/NumberInput.stories.tsx +109 -0
  311. package/styled-components/es/examples/plasma_web/components/Combobox/Combobox.stories.tsx +0 -6
  312. package/styled-components/es/examples/plasma_web/components/NumberInput/NumberInput.config.js +42 -0
  313. package/styled-components/es/examples/plasma_web/components/NumberInput/NumberInput.js +5 -0
  314. package/styled-components/es/examples/plasma_web/components/NumberInput/NumberInput.stories.tsx +109 -0
  315. package/styled-components/es/index.js +2 -1
  316. package/types/components/Combobox/ComboboxNew/Combobox.d.ts.map +1 -1
  317. package/types/components/Combobox/ComboboxNew/Combobox.types.d.ts +3 -14
  318. package/types/components/Combobox/ComboboxNew/Combobox.types.d.ts.map +1 -1
  319. package/types/components/Combobox/ComboboxNew/utils/index.d.ts +0 -1
  320. package/types/components/Combobox/ComboboxNew/utils/index.d.ts.map +1 -1
  321. package/types/components/Combobox/ComboboxNew/utils/initialItemsTransform.d.ts.map +1 -1
  322. package/types/components/NumberInput/NumberInput.d.ts +42 -0
  323. package/types/components/NumberInput/NumberInput.d.ts.map +1 -0
  324. package/types/components/NumberInput/NumberInput.styles.d.ts +2 -0
  325. package/types/components/NumberInput/NumberInput.styles.d.ts.map +1 -0
  326. package/types/components/NumberInput/NumberInput.tokens.d.ts +76 -0
  327. package/types/components/NumberInput/NumberInput.tokens.d.ts.map +1 -0
  328. package/types/components/NumberInput/NumberInput.types.d.ts +112 -0
  329. package/types/components/NumberInput/NumberInput.types.d.ts.map +1 -0
  330. package/types/components/NumberInput/index.d.ts +3 -0
  331. package/types/components/NumberInput/index.d.ts.map +1 -0
  332. package/types/components/NumberInput/ui/ActionButton/ActionButton.d.ts +4 -0
  333. package/types/components/NumberInput/ui/ActionButton/ActionButton.d.ts.map +1 -0
  334. package/types/components/NumberInput/ui/ActionButton/ActionButton.styles.d.ts +45 -0
  335. package/types/components/NumberInput/ui/ActionButton/ActionButton.styles.d.ts.map +1 -0
  336. package/types/components/NumberInput/ui/ActionButton/ActionButton.types.d.ts +7 -0
  337. package/types/components/NumberInput/ui/ActionButton/ActionButton.types.d.ts.map +1 -0
  338. package/types/components/NumberInput/ui/Input/Input.d.ts +16 -0
  339. package/types/components/NumberInput/ui/Input/Input.d.ts.map +1 -0
  340. package/types/components/NumberInput/ui/Input/Input.styles.d.ts +30 -0
  341. package/types/components/NumberInput/ui/Input/Input.styles.d.ts.map +1 -0
  342. package/types/components/NumberInput/ui/Input/Input.types.d.ts +16 -0
  343. package/types/components/NumberInput/ui/Input/Input.types.d.ts.map +1 -0
  344. package/types/components/NumberInput/ui/index.d.ts +3 -0
  345. package/types/components/NumberInput/ui/index.d.ts.map +1 -0
  346. package/types/components/NumberInput/utils/index.d.ts +2 -0
  347. package/types/components/NumberInput/utils/index.d.ts.map +1 -0
  348. package/types/components/NumberInput/variations/_background-type/base.d.ts +2 -0
  349. package/types/components/NumberInput/variations/_background-type/base.d.ts.map +1 -0
  350. package/types/components/NumberInput/variations/_clear/base.d.ts +2 -0
  351. package/types/components/NumberInput/variations/_clear/base.d.ts.map +1 -0
  352. package/types/components/NumberInput/variations/_disabled/base.d.ts +2 -0
  353. package/types/components/NumberInput/variations/_disabled/base.d.ts.map +1 -0
  354. package/types/components/NumberInput/variations/_segmentation/base.d.ts +2 -0
  355. package/types/components/NumberInput/variations/_segmentation/base.d.ts.map +1 -0
  356. package/types/components/NumberInput/variations/_shape/base.d.ts +2 -0
  357. package/types/components/NumberInput/variations/_shape/base.d.ts.map +1 -0
  358. package/types/components/NumberInput/variations/_size/base.d.ts +2 -0
  359. package/types/components/NumberInput/variations/_size/base.d.ts.map +1 -0
  360. package/types/components/NumberInput/variations/_view/base.d.ts +2 -0
  361. package/types/components/NumberInput/variations/_view/base.d.ts.map +1 -0
  362. package/types/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.d.ts +8 -8
  363. package/types/components/Select/Select.d.ts +2 -2
  364. package/types/components/Select/Select.d.ts.map +1 -1
  365. package/types/components/Select/Select.types.d.ts +1 -2
  366. package/types/components/Select/Select.types.d.ts.map +1 -1
  367. package/types/components/Select/hooks/useKeyboardNavigation.d.ts +2 -2
  368. package/types/components/Select/hooks/useKeyboardNavigation.d.ts.map +1 -1
  369. package/types/components/Select/ui/Target/Target.types.d.ts +2 -2
  370. package/types/components/Select/ui/Target/Target.types.d.ts.map +1 -1
  371. package/types/components/Select/ui/Target/ui/Textfield/Textfield.styles.d.ts +4 -4
  372. package/types/components/Select/ui/Target/ui/Textfield/Textfield.styles.d.ts.map +1 -1
  373. package/types/components/Select/utils/index.d.ts +0 -1
  374. package/types/components/Select/utils/index.d.ts.map +1 -1
  375. package/types/components/Select/utils/initialItemsTransform.d.ts.map +1 -1
  376. package/types/examples/plasma_b2c/components/Combobox/Combobox.d.ts +6 -30
  377. package/types/examples/plasma_b2c/components/Combobox/Combobox.d.ts.map +1 -1
  378. package/types/examples/plasma_b2c/components/NumberInput/NumberInput.config.d.ts +41 -0
  379. package/types/examples/plasma_b2c/components/NumberInput/NumberInput.config.d.ts.map +1 -0
  380. package/types/examples/plasma_b2c/components/NumberInput/NumberInput.d.ts +84 -0
  381. package/types/examples/plasma_b2c/components/NumberInput/NumberInput.d.ts.map +1 -0
  382. package/types/examples/plasma_b2c/components/Select/Select.d.ts +8 -8
  383. package/types/examples/plasma_web/components/Combobox/Combobox.d.ts +6 -30
  384. package/types/examples/plasma_web/components/Combobox/Combobox.d.ts.map +1 -1
  385. package/types/examples/plasma_web/components/NumberInput/NumberInput.config.d.ts +41 -0
  386. package/types/examples/plasma_web/components/NumberInput/NumberInput.config.d.ts.map +1 -0
  387. package/types/examples/plasma_web/components/NumberInput/NumberInput.d.ts +84 -0
  388. package/types/examples/plasma_web/components/NumberInput/NumberInput.d.ts.map +1 -0
  389. package/types/examples/plasma_web/components/Select/Select.d.ts +8 -8
  390. package/types/index.d.ts +1 -0
  391. package/types/index.d.ts.map +1 -1
  392. package/cjs/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -21
  393. package/cjs/components/Combobox/ComboboxNew/utils/getInitialValue.js.map +0 -1
  394. package/cjs/components/Select/utils/getInitialValue.js +0 -21
  395. package/cjs/components/Select/utils/getInitialValue.js.map +0 -1
  396. package/emotion/cjs/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -20
  397. package/emotion/cjs/components/Select/utils/getInitialValue.js +0 -20
  398. package/emotion/es/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -14
  399. package/emotion/es/components/Select/utils/getInitialValue.js +0 -14
  400. package/es/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -17
  401. package/es/components/Combobox/ComboboxNew/utils/getInitialValue.js.map +0 -1
  402. package/es/components/Select/utils/getInitialValue.js +0 -17
  403. package/es/components/Select/utils/getInitialValue.js.map +0 -1
  404. package/styled-components/cjs/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -20
  405. package/styled-components/cjs/components/Select/utils/getInitialValue.js +0 -20
  406. package/styled-components/es/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -14
  407. package/styled-components/es/components/Select/utils/getInitialValue.js +0 -14
  408. package/types/components/Combobox/ComboboxNew/utils/getInitialValue.d.ts +0 -4
  409. package/types/components/Combobox/ComboboxNew/utils/getInitialValue.d.ts.map +0 -1
  410. package/types/components/Select/utils/getInitialValue.d.ts +0 -4
  411. package/types/components/Select/utils/getInitialValue.d.ts.map +0 -1
@@ -0,0 +1,81 @@
1
+ export var classes = {
2
+ actionButtonDecrement: 'action-button-decrement',
3
+ actionButtonDecrementDisabled: 'action-button-decrement-disabled',
4
+ actionButtonIncrement: 'action-button-increment',
5
+ actionButtonIncrementDisabled: 'action-button-increment-disabled',
6
+ textBefore: 'text-before',
7
+ textAfter: 'text-after',
8
+ solidView: 'solid-view',
9
+ segmentedView: 'segmented-view',
10
+ clearView: 'clear-view',
11
+ errorAnimation: 'error-animation',
12
+ disabled: 'number-input-disabled'
13
+ };
14
+ export var privateTokens = {
15
+ inputWidth: '--plasma_private-number-input_width',
16
+ segmentationBorderRadius: '--plasma_private-segemntation-border-radius'
17
+ };
18
+ export var tokens = {
19
+ // Root size tokens
20
+ rootMinWidth: '--plasma-number-input_min-width',
21
+ disabledOpacity: '--plasma-number-input_disabled-opacity',
22
+ // Action button view tokens
23
+ iconButtonColor: '--plasma-number-input_icon-button_color',
24
+ iconButtonBackgroundColor: '--plasma-number-input_icon-button_background-color',
25
+ iconButtonColorHover: '--plasma-number-input_icon-button_color-hover',
26
+ iconButtonBackgroundColorHover: '--plasma-number-input_icon-button_background-color-hover',
27
+ iconButtonColorActive: '--plasma-number-input_icon-button_color-active',
28
+ iconButtonBackgroundColorActive: '--plasma-number-input_icon-button_background-color-active',
29
+ iconButtonColorClear: '--plasma-number-input_icon-button_color-clear',
30
+ actionButtonDisabledOpacity: '--plasma-number-input_action-button_disabled-opacity',
31
+ // Action button size tokens
32
+ iconButtonHeight: '--plasma-number-input_icon-button_height',
33
+ iconButtonWidth: '--plasma-number-input_icon-button_width',
34
+ iconButtonPadding: '--plasma-number-input_icon-button_padding',
35
+ iconButtonRadius: '--plasma-number-input_icon-button_radius',
36
+ iconButtonSegmentationRadius: '--plasma-number-input_icon-button_segmentation_radius',
37
+ iconButtonFontFamily: '--plasma-number-input_icon-button_font-family',
38
+ iconButtonFontSize: '--plasma-number-input_icon-button_font-size',
39
+ iconButtonFontStyle: '--plasma-number-input_icon-button_font-style',
40
+ iconButtonFontWeight: '--plasma-number-input_icon-button_font-weight',
41
+ iconButtonLetterSpacing: '--plasma-number-input_icon-button_letter-spacing',
42
+ iconButtonLineHeight: '--plasma-number-input_icon-button_line-height',
43
+ // Input size tokens
44
+ inputWrapperBorderWidth: '--plasma-number-input_input-wrapper_border-width',
45
+ inputWrapperMargin: '--plasma-number-input_input-wrapper_margin',
46
+ inputWrapperBorderRadius: '--plasma-number-input_input-wrapper_border-radius',
47
+ textWrapperHeight: '--plasma-number-input_text-wrapper_height',
48
+ textWrapperPadding: '--plasma-number-input_text-wrapper_padding',
49
+ fontFamily: '--plasma-number-input_font-family',
50
+ fontStyle: '--plasma-number-input_font-style',
51
+ fontSize: '--plasma-number-input_font-size',
52
+ fontWeight: '--plasma-number-input_font-weight',
53
+ letterSpacing: '--plasma-number-input_letter-spacing',
54
+ lineHeight: '--plasma-number-input_line-height',
55
+ textBeforeMarginRight: '--plasma-number-input_text-before_margin-right',
56
+ textAfterMarginLeft: '--plasma-number-input_text-after_margin-left',
57
+ // Input view tokens
58
+ caretColor: '--plasma-number-input_caret_color',
59
+ caretColorSolid: '--plasma-number-input_caret_color-solid',
60
+ color: '--plasma-number-input_color',
61
+ colorSolid: '--plasma-number-input_color-solid',
62
+ colorClear: '--plasma-number-input_color-clear',
63
+ backgroundColor: '--plasma-number-input_background-color',
64
+ backgroundColorHover: '--plasma-number-input_background-color-hover',
65
+ backgroundColorFocus: '--plasma-number-input_background-color-focus',
66
+ backgroundColorSolidFocus: '--plasma-number-input_background-color-solid-focus',
67
+ backgroundColorSolid: '--plasma-number-input_background-color-solid',
68
+ borderColor: '--plasma-number-input_border-color',
69
+ borderColorHover: '--plasma-number-input_border-color-hover',
70
+ borderColorFocus: '--plasma-number-input_border-color-focus',
71
+ borderColorSolidFocus: '--plasma-number-input_border-color-solid-focus',
72
+ borderColorSolid: '--plasma-number-input_border-color-solid',
73
+ additionalTextColor: '--plasma-number-input_additional-text_color',
74
+ additionalTextColorSolid: '--plasma-number-input_additional-text_color-solid',
75
+ additionalTextColorClear: '--plasma-number-input_additional-text_color-clear',
76
+ errorColor: '--plasma-number-input_error-color',
77
+ // Loader tokens
78
+ loaderSpinnerSize: '--plasma-number-input_loader-spinner_size',
79
+ loaderSpinnerColor: '--plasma-number-input_loader-spinner_color',
80
+ loaderSpinnerColorSolid: '--plasma-number-input_loader-spinner_color-solid'
81
+ };
@@ -0,0 +1,2 @@
1
+ export { numberInputRoot, numberInputConfig } from './NumberInput';
2
+ export { tokens as numberInputTokens, classes as numberInputClasses } from './NumberInput.tokens';
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { StyledIconButton } from './ActionButton.styles';
3
+ export var ActionButton = function ActionButton(_ref) {
4
+ var icon = _ref.icon,
5
+ className = _ref.className,
6
+ onClick = _ref.onClick;
7
+ return /*#__PURE__*/React.createElement(StyledIconButton, {
8
+ className: className,
9
+ onClick: onClick
10
+ }, icon);
11
+ };
@@ -0,0 +1,8 @@
1
+ import styled from 'styled-components';
2
+ import { iconButtonConfig } from '../../../IconButton';
3
+ import { component, mergeConfig } from '../../../../engines';
4
+ var mergedIconButtonConfig = /*#__PURE__*/mergeConfig(iconButtonConfig);
5
+ var IconButton = /*#__PURE__*/component(mergedIconButtonConfig);
6
+ export var StyledIconButton = /*#__PURE__*/styled(IconButton).withConfig({
7
+ componentId: "plasma-new-hope__sc-kcpqrq-0"
8
+ })([""]);
@@ -0,0 +1,189 @@
1
+ var _StyledSpinner;
2
+ var _excluded = ["value", "min", "max", "isLoading", "loader", "disabled", "segmentation", "textBefore", "textAfter", "isManualInput", "setInnerValue", "onChange", "onBlur", "onKeyDown"];
3
+ 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); }
4
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
5
+ 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."); }
6
+ 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); }
7
+ 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; }
8
+ 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; } }
9
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
10
+ 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; }
11
+ 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; }
12
+ import React, { forwardRef, useEffect, useRef, useState } from 'react';
13
+ import { useForkRef } from '@salutejs/plasma-core';
14
+ import { classes } from '../../NumberInput.tokens';
15
+ import { cx, isNumber } from '../../../../utils';
16
+ import { useDidMountEffect } from '../../../../hooks';
17
+ import { numberPettern } from '../../utils';
18
+ import { keyCodes } from '../../../../utils/constants';
19
+ import { AdditionalText, Input, InputWrapper, DynamicInput, InputWidthHelper, TextWrapper, StyledSpinner, Loader } from './Input.styles';
20
+ export var NumberInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
21
+ var value = _ref.value,
22
+ min = _ref.min,
23
+ max = _ref.max,
24
+ isLoading = _ref.isLoading,
25
+ loader = _ref.loader,
26
+ disabled = _ref.disabled,
27
+ segmentation = _ref.segmentation,
28
+ textBefore = _ref.textBefore,
29
+ textAfter = _ref.textAfter,
30
+ isManualInput = _ref.isManualInput,
31
+ setInnerValue = _ref.setInnerValue,
32
+ onChange = _ref.onChange,
33
+ onBlur = _ref.onBlur,
34
+ onKeyDown = _ref.onKeyDown,
35
+ rest = _objectWithoutProperties(_ref, _excluded);
36
+ var _useState = useState(value ? "".concat(String(value).length, "ch") : '1ch'),
37
+ _useState2 = _slicedToArray(_useState, 2),
38
+ dynamicWidth = _useState2[0],
39
+ setDynamicWidth = _useState2[1];
40
+ var _useState3 = useState(Number(value)),
41
+ _useState4 = _slicedToArray(_useState3, 2),
42
+ lastValidValue = _useState4[0],
43
+ setLastValidValue = _useState4[1];
44
+ var _useState5 = useState(undefined),
45
+ _useState6 = _slicedToArray(_useState5, 2),
46
+ errorClass = _useState6[0],
47
+ setErrorClass = _useState6[1];
48
+ var _useState7 = useState(),
49
+ _useState8 = _slicedToArray(_useState7, 2),
50
+ errorValue = _useState8[0],
51
+ setErrorValue = _useState8[1];
52
+ var inputHelperRef = useRef(null);
53
+ var wrapperRef = useRef(null);
54
+ var textWrapperRef = useRef(null);
55
+ var inputRef = useRef(null);
56
+ var inputForkRef = useForkRef(inputRef, ref);
57
+ var solidViewClass = segmentation === 'solid' ? classes.solidView : undefined;
58
+ var handleClickInputWrapper = function handleClickInputWrapper() {
59
+ var _inputRef$current;
60
+ if (!isManualInput) {
61
+ return;
62
+ }
63
+ inputRef === null || inputRef === void 0 || (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
64
+ };
65
+ var getInputWidth = function getInputWidth() {
66
+ var _inputHelperRef$curre;
67
+ var firstRender = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
68
+ if (!firstRender && (_inputHelperRef$curre = inputHelperRef.current) !== null && _inputHelperRef$curre !== void 0 && _inputHelperRef$curre.clientWidth) {
69
+ var _inputHelperRef$curre2;
70
+ return "".concat((_inputHelperRef$curre2 = inputHelperRef.current) === null || _inputHelperRef$curre2 === void 0 ? void 0 : _inputHelperRef$curre2.clientWidth, "px");
71
+ }
72
+ if (value) {
73
+ return "".concat(String(value).length, "ch");
74
+ }
75
+ return '1ch';
76
+ };
77
+ var setValues = function setValues(event, newValue) {
78
+ setLastValidValue(newValue);
79
+ setInnerValue(newValue);
80
+ if (onChange) {
81
+ onChange(event, newValue);
82
+ }
83
+ };
84
+ var handleManualInputChange = function handleManualInputChange(event) {
85
+ var _textWrapperRef$curre, _wrapperRef$current;
86
+ if (!isManualInput || disabled) {
87
+ return;
88
+ }
89
+ var newValue = event.target.value;
90
+ if (!newValue) {
91
+ setInnerValue('');
92
+ if (onChange) {
93
+ onChange(event, '');
94
+ }
95
+ return;
96
+ }
97
+ var cleanValue = newValue.replace(/[^-.\d]/g, '');
98
+ if (cleanValue.endsWith('.')) {
99
+ setInnerValue(cleanValue);
100
+ if (onChange) {
101
+ onChange(event, cleanValue);
102
+ }
103
+ return;
104
+ }
105
+ var isValid = numberPettern.test(cleanValue);
106
+ if (!isValid) {
107
+ setValues(event, lastValidValue);
108
+ return;
109
+ }
110
+ var resValue = Number(cleanValue);
111
+ if (max && resValue > max) {
112
+ setErrorClass(classes.errorAnimation);
113
+ setErrorValue(max);
114
+ return;
115
+ }
116
+ if (min && resValue < min) {
117
+ setErrorClass(classes.errorAnimation);
118
+ setErrorValue(min);
119
+ return;
120
+ }
121
+ if (textWrapperRef !== null && textWrapperRef !== void 0 && textWrapperRef.current && wrapperRef !== null && wrapperRef !== void 0 && wrapperRef.current && (textWrapperRef === null || textWrapperRef === void 0 || (_textWrapperRef$curre = textWrapperRef.current) === null || _textWrapperRef$curre === void 0 ? void 0 : _textWrapperRef$curre.clientWidth) > (wrapperRef === null || wrapperRef === void 0 || (_wrapperRef$current = wrapperRef.current) === null || _wrapperRef$current === void 0 ? void 0 : _wrapperRef$current.clientWidth)) {
122
+ wrapperRef.current.scrollLeft = textWrapperRef.current.offsetWidth - textWrapperRef.current.offsetLeft || 0;
123
+ }
124
+ setValues(event, resValue);
125
+ };
126
+ var handleBlur = function handleBlur(event) {
127
+ if (!value || !isNumber(value)) {
128
+ setValues(null, lastValidValue);
129
+ } else if (String(value).endsWith('.')) {
130
+ setValues(null, Number(value));
131
+ }
132
+ if (onBlur) {
133
+ onBlur(event);
134
+ }
135
+ };
136
+ var handleKeyDown = function handleKeyDown(event) {
137
+ if (!isManualInput || disabled) {
138
+ return;
139
+ }
140
+ if (event.keyCode === keyCodes.Enter) {
141
+ event.preventDefault();
142
+ if (!value || !isNumber(value)) {
143
+ setValues(null, lastValidValue);
144
+ } else if (String(value).endsWith('.')) {
145
+ setValues(null, Number(value));
146
+ }
147
+ if (onKeyDown) {
148
+ onKeyDown(event);
149
+ }
150
+ }
151
+ };
152
+ var handleEndErrorAnimation = function handleEndErrorAnimation(correctValue) {
153
+ setErrorClass(undefined);
154
+ setValues(null, correctValue);
155
+ };
156
+ useEffect(function () {
157
+ setDynamicWidth(getInputWidth());
158
+ }, []);
159
+ useDidMountEffect(function () {
160
+ setDynamicWidth(getInputWidth(false));
161
+ }, [value]);
162
+ return /*#__PURE__*/React.createElement(InputWrapper, {
163
+ ref: wrapperRef,
164
+ className: cx(solidViewClass),
165
+ isManualInput: Boolean(isManualInput),
166
+ onClick: handleClickInputWrapper
167
+ }, /*#__PURE__*/React.createElement(TextWrapper, {
168
+ ref: textWrapperRef
169
+ }, textBefore && /*#__PURE__*/React.createElement(AdditionalText, {
170
+ className: classes.textBefore
171
+ }, textBefore), isLoading ? /*#__PURE__*/React.createElement(Loader, null, loader || _StyledSpinner || (_StyledSpinner = /*#__PURE__*/React.createElement(StyledSpinner, null))) : /*#__PURE__*/React.createElement(DynamicInput, null, /*#__PURE__*/React.createElement(Input, _extends({
172
+ ref: inputForkRef,
173
+ className: cx(errorClass),
174
+ dynamicWidth: dynamicWidth,
175
+ value: value,
176
+ isManualInput: Boolean(isManualInput),
177
+ tabIndex: disabled || !isManualInput ? -1 : 0,
178
+ onChange: handleManualInputChange,
179
+ onBlur: handleBlur,
180
+ onKeyDown: handleKeyDown,
181
+ onAnimationEnd: function onAnimationEnd() {
182
+ return handleEndErrorAnimation(Number(errorValue));
183
+ }
184
+ }, rest)), /*#__PURE__*/React.createElement(InputWidthHelper, {
185
+ ref: inputHelperRef
186
+ }, value)), textAfter && /*#__PURE__*/React.createElement(AdditionalText, {
187
+ className: classes.textAfter
188
+ }, textAfter)));
189
+ });
@@ -0,0 +1,42 @@
1
+ import styled from 'styled-components';
2
+ import { component, mergeConfig } from '../../../../engines';
3
+ import { spinnerConfig } from '../../../Spinner';
4
+ import { classes, tokens } from '../../NumberInput.tokens';
5
+ var mergedConfig = /*#__PURE__*/mergeConfig(spinnerConfig);
6
+ var Spinner = /*#__PURE__*/component(mergedConfig);
7
+ export var InputWrapper = /*#__PURE__*/styled.div.withConfig({
8
+ componentId: "plasma-new-hope__sc-i0o2ki-0"
9
+ })(["overflow-x:auto;overflow-y:hidden;flex:1;cursor:", ";::-webkit-scrollbar{display:none;}scrollbar-width:none;overscroll-behavior:contain;"], function (_ref) {
10
+ var isManualInput = _ref.isManualInput;
11
+ return isManualInput ? 'text' : 'default';
12
+ });
13
+ export var TextWrapper = /*#__PURE__*/styled.div.withConfig({
14
+ componentId: "plasma-new-hope__sc-i0o2ki-1"
15
+ })(["display:flex;align-items:center;justify-content:center;width:fit-content;margin:0 auto;box-sizing:border-box;"]);
16
+ export var AdditionalText = /*#__PURE__*/styled.span.withConfig({
17
+ componentId: "plasma-new-hope__sc-i0o2ki-2"
18
+ })([""]);
19
+ export var Loader = /*#__PURE__*/styled.div.withConfig({
20
+ componentId: "plasma-new-hope__sc-i0o2ki-3"
21
+ })([""]);
22
+ export var StyledSpinner = /*#__PURE__*/styled(Spinner).withConfig({
23
+ componentId: "plasma-new-hope__sc-i0o2ki-4"
24
+ })([""]);
25
+ export var DynamicInput = /*#__PURE__*/styled.div.withConfig({
26
+ componentId: "plasma-new-hope__sc-i0o2ki-5"
27
+ })(["position:relative;"]);
28
+ export var Input = /*#__PURE__*/styled.input.withConfig({
29
+ componentId: "plasma-new-hope__sc-i0o2ki-6"
30
+ })(["box-sizing:border-box;appearance:none;border:0;padding:0;background-color:transparent;outline:none;width:", ";box-sizing:border-box;cursor:", ";pointer-events:", ";transition:width 0.1s;&&.", "{color:var(", ");animation:shakingError 0.5s forwards;}@keyframes shakingError{0%{opacity:1;}12.5%{transform:translateX(0.188rem);}25%{transform:translateX(-0.188rem);}37.5%{transform:translateX(0.188rem);}50%{opacity:1;transform:translateX(-0.188rem);}62.5%{transform:translateX(0.188rem);}75%{transform:translateX(-0.188rem);}87.5%{transform:translateX(0.188rem);}100%{opacity:0;transform:translateX(-0.188rem);}}"], function (_ref2) {
31
+ var dynamicWidth = _ref2.dynamicWidth;
32
+ return dynamicWidth;
33
+ }, function (_ref3) {
34
+ var isManualInput = _ref3.isManualInput;
35
+ return isManualInput ? 'text' : 'default';
36
+ }, function (_ref4) {
37
+ var isManualInput = _ref4.isManualInput;
38
+ return isManualInput ? 'initial' : 'none';
39
+ }, classes.errorAnimation, tokens.errorColor);
40
+ export var InputWidthHelper = /*#__PURE__*/styled.span.withConfig({
41
+ componentId: "plasma-new-hope__sc-i0o2ki-7"
42
+ })(["position:absolute;z-index:-999;visibility:hidden;top:0;left:0;opacity:0;height:0;white-space:pre;"]);
@@ -0,0 +1,2 @@
1
+ export { ActionButton } from './ActionButton/ActionButton';
2
+ export { NumberInput } from './Input/Input';
@@ -0,0 +1 @@
1
+ export var numberPettern = /^(-)?\d+(\.\d+)?$/;
@@ -0,0 +1,4 @@
1
+ import { css } from 'styled-components';
2
+ import { tokens } from '../../NumberInput.tokens';
3
+ import { InputWrapper } from '../../ui/Input/Input.styles';
4
+ export var base = /*#__PURE__*/css(["", "{background-color:var(", ");box-shadow:inset 0 0 0 var(", ") var(", ");&:hover{background-color:var(", ");box-shadow:inset 0 0 0 var(", ") var(", ");}}"], InputWrapper, tokens.backgroundColor, tokens.inputWrapperBorderWidth, tokens.borderColor, tokens.backgroundColorHover, tokens.inputWrapperBorderWidth, tokens.borderColorHover);
@@ -0,0 +1,6 @@
1
+ [
2
+ "--plasma-number-input_background-color",
3
+ "--plasma-number-input_background-color-hover",
4
+ "--plasma-number-input_border-color",
5
+ "--plasma-number-input_border-color-hover"
6
+ ]
@@ -0,0 +1,6 @@
1
+ import { css } from 'styled-components';
2
+ import { classes, tokens } from '../../NumberInput.tokens';
3
+ import { iconButtonTokens } from '../../../IconButton';
4
+ import { StyledIconButton } from '../../ui/ActionButton/ActionButton.styles';
5
+ import { AdditionalText, Input, InputWrapper } from '../../ui/Input/Input.styles';
6
+ export var base = /*#__PURE__*/css(["&.", "{background:transparent;", "{", ":var(", ");", ":transparent;", ":var(", ");", ":transparent;", ":var(", ");", ":transparent;:hover,:active{color:var(", ");background-color:transparent;}&.", ",&.", "{:hover,:active{color:var(", ");background-color:transparent;}}}&& ", "{background-color:transparent;box-shadow:transparent;&:focus-within{background-color:var(", ");box-shadow:inset 0 0 0 var(", ") var(", ");}}", "{caret-color:var(", ");&:not(.", "){color:var(", ");}}", "{color:var(", ");}}"], classes.clearView, StyledIconButton, iconButtonTokens.iconButtonColor, tokens.iconButtonColorClear, iconButtonTokens.iconButtonBackgroundColor, iconButtonTokens.iconButtonColorHover, tokens.iconButtonColorClear, iconButtonTokens.iconButtonBackgroundColorHover, iconButtonTokens.iconButtonColorActive, tokens.iconButtonColorClear, iconButtonTokens.iconButtonBackgroundColorActive, tokens.iconButtonColorClear, classes.actionButtonDecrementDisabled, classes.actionButtonIncrementDisabled, tokens.iconButtonColorClear, InputWrapper, tokens.backgroundColorFocus, tokens.inputWrapperBorderWidth, tokens.borderColorFocus, Input, tokens.caretColor, classes.errorAnimation, tokens.colorClear, AdditionalText, tokens.additionalTextColorClear);
@@ -0,0 +1,5 @@
1
+ [
2
+ "--plasma-number-input_icon-button_color-clear",
3
+ "--plasma-number-input_color-clear",
4
+ "--plasma-number-input_additional-text_color-clear"
5
+ ]
@@ -0,0 +1,3 @@
1
+ import { css } from 'styled-components';
2
+ import { classes, tokens } from '../../NumberInput.tokens';
3
+ export var base = /*#__PURE__*/css(["&&.", "{pointer-events:none;opacity:var(", ");cursor:not-allowed;}"], classes.disabled, tokens.disabledOpacity);
@@ -0,0 +1,4 @@
1
+ {
2
+ "type": "boolean",
3
+ "tokens": ["--plasma-number-input_disabled-opacity"]
4
+ }
@@ -0,0 +1,6 @@
1
+ import { css } from 'styled-components';
2
+ import { classes, privateTokens, tokens } from '../../NumberInput.tokens';
3
+ import { StyledIconButton } from '../../ui/ActionButton/ActionButton.styles';
4
+ import { AdditionalText, Input, InputWrapper, StyledSpinner } from '../../ui/Input/Input.styles';
5
+ import { spinnerTokens } from '../../../Spinner';
6
+ export var base = /*#__PURE__*/css(["", "{", ":var(", ");&.", ",&.", "{", ":var(", ",var(", "));}&.", "{border-radius:var(", ") var(", ") var(", ") var(", ");}&.", "{border-radius:var(", ") var(", ") var(", ") var(", ");}&.", "{background:transparent;:hover{background-color:var(", ");}:active{background-color:var(", ");}&.", ",&.", "{:hover,:active{background-color:transparent;}}}&.", "{&.", ",&.", "{opacity:1;svg{opacity:var(", ");}:hover,:active{svg{opacity:var(", ");}}}}}&.", "{background:var(", ");border-radius:var(", ");", "{position:relative;color:var(", ");&:focus-within{background-color:var(", ");box-shadow:inset 0 0 0 var(", ") var(", ");}}", "{", ":var(", ");}", "{caret-color:var(", ",var(", "));&:not(.", "){color:var(", ");}}", "{color:var(", ");}}"], StyledIconButton, privateTokens.segmentationBorderRadius, tokens.iconButtonRadius, classes.segmentedView, classes.solidView, privateTokens.segmentationBorderRadius, tokens.iconButtonSegmentationRadius, tokens.iconButtonRadius, classes.actionButtonDecrement, tokens.iconButtonRadius, privateTokens.segmentationBorderRadius, privateTokens.segmentationBorderRadius, tokens.iconButtonRadius, classes.actionButtonIncrement, privateTokens.segmentationBorderRadius, tokens.iconButtonRadius, tokens.iconButtonRadius, privateTokens.segmentationBorderRadius, classes.solidView, tokens.iconButtonBackgroundColorHover, tokens.iconButtonBackgroundColorActive, classes.actionButtonDecrementDisabled, classes.actionButtonIncrementDisabled, classes.solidView, classes.actionButtonDecrementDisabled, classes.actionButtonIncrementDisabled, tokens.actionButtonDisabledOpacity, tokens.actionButtonDisabledOpacity, classes.solidView, tokens.backgroundColorSolid, tokens.iconButtonRadius, InputWrapper, tokens.colorSolid, tokens.backgroundColorSolidFocus, tokens.inputWrapperBorderWidth, tokens.borderColorSolidFocus, StyledSpinner, spinnerTokens.color, tokens.loaderSpinnerColorSolid, Input, tokens.caretColorSolid, tokens.caretColor, classes.errorAnimation, tokens.colorSolid, AdditionalText, tokens.additionalTextColorSolid);
@@ -0,0 +1 @@
1
+ ["--plasma-number-input_icon-button_segmentation_radius", "--plasma-number-input_background-color-solid"]
@@ -0,0 +1,5 @@
1
+ import { css } from 'styled-components';
2
+ import { tokens } from '../../NumberInput.tokens';
3
+ import { iconButtonTokens } from '../../../IconButton';
4
+ import { StyledIconButton } from '../../ui/ActionButton/ActionButton.styles';
5
+ export var base = /*#__PURE__*/css(["", "{", ":var(", ");}"], StyledIconButton, iconButtonTokens.iconButtonRadius, tokens.iconButtonRadius);
@@ -0,0 +1 @@
1
+ ["--plasma-number-input_icon-button_radius"]
@@ -0,0 +1,7 @@
1
+ import { css } from 'styled-components';
2
+ import { classes, privateTokens, tokens } from '../../NumberInput.tokens';
3
+ import { iconButtonTokens } from '../../../IconButton';
4
+ import { StyledIconButton } from '../../ui/ActionButton/ActionButton.styles';
5
+ import { AdditionalText, DynamicInput, Input, InputWrapper, StyledSpinner, TextWrapper } from '../../ui/Input/Input.styles';
6
+ import { spinnerTokens } from '../../../Spinner';
7
+ export var base = /*#__PURE__*/css(["width:var(", ");min-width:var(", ");", "{", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");}", "{margin:var(", ");border-radius:var(", ");}", "{height:var(", ");padding:var(", ");}", ",", ",", "{font-family:var(", ");font-size:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");}", "{&.", "{margin-right:var(", ");}&.", "{margin-left:var(", ");}}", "{", ":var(", ");}"], privateTokens.inputWidth, tokens.rootMinWidth, StyledIconButton, iconButtonTokens.iconButtonHeight, tokens.iconButtonHeight, iconButtonTokens.iconButtonWidth, tokens.iconButtonWidth, iconButtonTokens.iconButtonPadding, tokens.iconButtonPadding, iconButtonTokens.iconButtonFontFamily, tokens.iconButtonFontFamily, iconButtonTokens.iconButtonFontSize, tokens.iconButtonFontSize, iconButtonTokens.iconButtonFontStyle, tokens.iconButtonFontStyle, iconButtonTokens.iconButtonFontWeight, tokens.iconButtonFontWeight, iconButtonTokens.iconButtonLetterSpacing, tokens.iconButtonLetterSpacing, iconButtonTokens.iconButtonLineHeight, tokens.iconButtonLineHeight, InputWrapper, tokens.inputWrapperMargin, tokens.inputWrapperBorderRadius, TextWrapper, tokens.textWrapperHeight, tokens.textWrapperPadding, DynamicInput, Input, AdditionalText, tokens.fontFamily, tokens.fontSize, tokens.fontStyle, tokens.fontWeight, tokens.letterSpacing, tokens.lineHeight, AdditionalText, classes.textBefore, tokens.textBeforeMarginRight, classes.textAfter, tokens.textAfterMarginLeft, StyledSpinner, spinnerTokens.size, tokens.loaderSpinnerSize);
@@ -0,0 +1,22 @@
1
+ [
2
+ "--plasma-number-input_icon-button_height",
3
+ "--plasma-number-input_icon-button_width",
4
+ "--plasma-number-input_icon-button_padding",
5
+ "--plasma-number-input_icon-button_font-family",
6
+ "--plasma-number-input_icon-button_font-size",
7
+ "--plasma-number-input_icon-button_font-style",
8
+ "--plasma-number-input_icon-button_font-weight",
9
+ "--plasma-number-input_icon-button_letter-spacing",
10
+ "--plasma-number-input_icon-button_line-height",
11
+ "--plasma-number-input_font-family",
12
+ "--plasma-number-input_font-style",
13
+ "--plasma-number-input_font-size",
14
+ "--plasma-number-input_font-weight",
15
+ "--plasma-number-input_letter-spacing",
16
+ "--plasma-number-input_line-height",
17
+ "--plasma-number-input_text-wrapper_height",
18
+ "--plasma-number-input_text-wrapper_padding",
19
+ "--plasma-number-input_loader-spinner_size",
20
+ "--plasma-number-input_text-before_margin-right",
21
+ "--plasma-number-input_text-after_margin-left"
22
+ ]
@@ -0,0 +1,7 @@
1
+ import { css } from 'styled-components';
2
+ import { classes, tokens } from '../../NumberInput.tokens';
3
+ import { iconButtonTokens } from '../../../IconButton';
4
+ import { StyledIconButton } from '../../ui/ActionButton/ActionButton.styles';
5
+ import { AdditionalText, Input, InputWrapper, StyledSpinner } from '../../ui/Input/Input.styles';
6
+ import { spinnerTokens } from '../../../Spinner';
7
+ export var base = /*#__PURE__*/css(["", "{", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");", ":var(", ");&.", ",&.", "{opacity:var(", ");cursor:not-allowed;:hover,:active{scale:none;color:var(", ");background-color:var(", ");}}}&& ", "{&:focus-within{background-color:var(", ");box-shadow:inset 0 0 0 var(", ") var(", ");}}", "{", ":var(", ");}", "{color:var(", ");caret-color:var(", ");}", "{color:var(", ");}"], StyledIconButton, iconButtonTokens.iconButtonColor, tokens.iconButtonColor, iconButtonTokens.iconButtonBackgroundColor, tokens.iconButtonBackgroundColor, iconButtonTokens.iconButtonColorHover, tokens.iconButtonColorHover, iconButtonTokens.iconButtonBackgroundColorHover, tokens.iconButtonBackgroundColorHover, iconButtonTokens.iconButtonColorActive, tokens.iconButtonColorActive, iconButtonTokens.iconButtonBackgroundColorActive, tokens.iconButtonBackgroundColorActive, classes.actionButtonDecrementDisabled, classes.actionButtonIncrementDisabled, tokens.actionButtonDisabledOpacity, tokens.iconButtonColor, tokens.iconButtonBackgroundColor, InputWrapper, tokens.backgroundColorFocus, tokens.inputWrapperBorderWidth, tokens.borderColorFocus, StyledSpinner, spinnerTokens.color, tokens.loaderSpinnerColor, Input, tokens.color, tokens.caretColor, AdditionalText, tokens.additionalTextColor);
@@ -0,0 +1,14 @@
1
+ [
2
+ "--plasma-number-input_icon-button_color",
3
+ "--plasma-number-input_icon-button_background-color",
4
+ "--plasma-number-input_icon-button_color-hover",
5
+ "--plasma-number-input_icon-button_background-color-hover",
6
+ "--plasma-number-input_icon-button_color-active",
7
+ "--plasma-number-input_icon-button_background-color-active",
8
+ "--plasma-number-input_loader-spinner_color",
9
+ "--plasma-number-input_color",
10
+ "--plasma-number-input_additional-text_color",
11
+ "--plasma-number-input_action-button_disabled-opacity",
12
+ "--plasma-number-input_background-color-focus",
13
+ "--plasma-number-input_border-color-focus"
14
+ ]
@@ -17,8 +17,8 @@ export var PaginationSelectPerPage = function PaginationSelectPerPage(_ref) {
17
17
  listWidth = _ref.listWidth,
18
18
  rest = _objectWithoutProperties(_ref, _excluded);
19
19
  var handleSelectChange = function handleSelectChange(newValue) {
20
- if (newValue && !Array.isArray(newValue) && onChangeValue) {
21
- onChangeValue(Number(newValue));
20
+ if (newValue) {
21
+ onChangeValue === null || onChangeValue === void 0 || onChangeValue(Number(newValue));
22
22
  }
23
23
  };
24
24
  var transformedList = perPageList.map(function (num) {
@@ -12,7 +12,7 @@ import React, { forwardRef, useState, useReducer, useMemo, createContext, useLay
12
12
  import { isEmpty, getPlacements } from '../../utils';
13
13
  import { useOutsideClick } from '../../hooks';
14
14
  import { useKeyNavigation } from './hooks/useKeyboardNavigation';
15
- import { initialItemsTransform, updateAncestors, updateDescendants, updateSingleAncestors, getView, getInitialValue } from './utils';
15
+ import { initialItemsTransform, updateAncestors, updateDescendants, updateSingleAncestors, getView } from './utils';
16
16
  import { Inner, Target } from './ui';
17
17
  import { pathReducer, focusedPathReducer, focusedChipIndexReducer } from './reducers';
18
18
  import { usePathMaps } from './hooks/usePathMaps';
@@ -58,6 +58,17 @@ export var selectRoot = function selectRoot(Root) {
58
58
  separator = props.separator,
59
59
  outerCloseAfterSelect = props.closeAfterSelect,
60
60
  rest = _objectWithoutProperties(props, _excluded);
61
+ var _useState = useState(outerValue || props.multiselect ? [] : ''),
62
+ _useState2 = _slicedToArray(_useState, 2),
63
+ internalValue = _useState2[0],
64
+ setInternalValue = _useState2[1];
65
+ var value = outerValue || internalValue;
66
+ var onChange = function onChange(e) {
67
+ if (outerOnChange) {
68
+ outerOnChange(e);
69
+ }
70
+ setInternalValue(e);
71
+ };
61
72
  var transformedItems = useMemo(function () {
62
73
  return initialItemsTransform(items || []);
63
74
  }, [items]);
@@ -67,12 +78,6 @@ export var selectRoot = function selectRoot(Root) {
67
78
  focusedToValueMap = _usePathMaps2[1],
68
79
  valueToCheckedMap = _usePathMaps2[2],
69
80
  valueToItemMap = _usePathMaps2[3];
70
- var value = getInitialValue(outerValue, valueToItemMap);
71
- var onChange = function onChange(e) {
72
- if (outerOnChange) {
73
- outerOnChange(e);
74
- }
75
- };
76
81
  var _useReducer = useReducer(pathReducer, []),
77
82
  _useReducer2 = _slicedToArray(_useReducer, 2),
78
83
  path = _useReducer2[0],
@@ -85,10 +90,10 @@ export var selectRoot = function selectRoot(Root) {
85
90
  _useReducer6 = _slicedToArray(_useReducer5, 2),
86
91
  focusedChipIndex = _useReducer6[0],
87
92
  dispatchFocusedChipIndex = _useReducer6[1];
88
- var _useState = useState(valueToCheckedMap),
89
- _useState2 = _slicedToArray(_useState, 2),
90
- checked = _useState2[0],
91
- setChecked = _useState2[1];
93
+ var _useState3 = useState(valueToCheckedMap),
94
+ _useState4 = _slicedToArray(_useState3, 2),
95
+ checked = _useState4[0],
96
+ setChecked = _useState4[1];
92
97
  var closeAfterSelect = outerCloseAfterSelect !== null && outerCloseAfterSelect !== void 0 ? outerCloseAfterSelect : !props.multiselect;
93
98
  var targetRef = useOutsideClick(function () {
94
99
  if (focusedChipIndex != null) {
@@ -154,7 +159,15 @@ export var selectRoot = function selectRoot(Root) {
154
159
  if (e) {
155
160
  e.stopPropagation();
156
161
  }
157
- var isCurrentChecked = checked.get(item.value);
162
+ var checkedCopy = new Map(checked);
163
+ var isCurrentChecked = checkedCopy.get(item.value);
164
+ checkedCopy.forEach(function (_, key) {
165
+ checkedCopy.set(key, false);
166
+ });
167
+ if (!isCurrentChecked) {
168
+ checkedCopy.set(item.value, 'done');
169
+ updateSingleAncestors(item, checkedCopy, 'dot');
170
+ }
158
171
  if (closeAfterSelect) {
159
172
  dispatchPath({
160
173
  type: 'reset'
@@ -226,7 +239,7 @@ export var selectRoot = function selectRoot(Root) {
226
239
  }
227
240
  }
228
241
  setChecked(checkedCopy);
229
- }, [outerValue, items]);
242
+ }, [value]);
230
243
  return /*#__PURE__*/React.createElement(Root, _extends({
231
244
  ref: ref,
232
245
  size: size,
@@ -153,7 +153,7 @@ export var useKeyNavigation = function useKeyNavigation(_ref) {
153
153
  }
154
154
  case keys.Backspace:
155
155
  {
156
- if (!multiselect || !Array.isArray(value)) break;
156
+ if (!multiselect) break;
157
157
  if (focusedChipIndex !== null) {
158
158
  var _currentItem = valueToItemMap.get(value[focusedChipIndex]);
159
159
  handlePressDown(_currentItem);
@@ -34,7 +34,7 @@ var getLabel = function getLabel(_ref) {
34
34
  text: renderValue ? renderValue(valueToItemMap.get(currentValue)) : itemLabel,
35
35
  onClick: function onClick(e) {
36
36
  e.stopPropagation();
37
- onChipClick(currentValue.toString());
37
+ onChipClick(currentValue);
38
38
  },
39
39
  focused: focusedChipIndex === index
40
40
  });
@@ -47,7 +47,7 @@ export var ChipWrapper = /*#__PURE__*/styled.div.withConfig({
47
47
  })(["width:100%;display:flex;min-width:0;padding:", ";gap:0.25rem;overflow-x:scroll;border-top-right-radius:var(", ");border-bottom-right-radius:var(", ");-ms-overflow-style:none;scrollbar-width:none;&::-webkit-scrollbar{display:none;}"], function (_ref6) {
48
48
  var multiselect = _ref6.multiselect,
49
49
  value = _ref6.value;
50
- return "calc(".concat(constants.focusSize, " + ").concat(multiselect && value && value.toString().length > 0 ? "var(".concat(tokens.focusOffset, ")") : 0, ")");
50
+ return "calc(".concat(constants.focusSize, " + ").concat(multiselect && value && value.length > 0 ? "var(".concat(tokens.focusOffset, ")") : 0, ")");
51
51
  }, tokens.chipBorderRadius, tokens.chipBorderRadius);
52
52
  export var Label = /*#__PURE__*/styled.label.withConfig({
53
53
  componentId: "plasma-new-hope__sc-1akl2tk-6"
@@ -16,7 +16,7 @@ export var getButtonLabel = function getButtonLabel(_ref3) {
16
16
  if (isEmpty(value) && typeof value !== 'number') {
17
17
  return label || '';
18
18
  }
19
- if (selectProps.multiselect && Array.isArray(value) && selectProps.isTargetAmount) {
19
+ if (selectProps.multiselect && selectProps.isTargetAmount) {
20
20
  return "\u0412\u044B\u0431\u0440\u0430\u043D\u043E: ".concat(value.length);
21
21
  }
22
22
  if (selectProps.multiselect && Array.isArray(value)) {