@salutejs/plasma-new-hope 0.174.0-canary.1505.11518120718.0 → 0.174.0-dev.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (245) 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/Drawer/Drawer.js +2 -1
  6. package/cjs/components/Drawer/Drawer.js.map +1 -1
  7. package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
  8. package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js.map +1 -1
  9. package/cjs/components/Select/Select.js +25 -13
  10. package/cjs/components/Select/Select.js.map +1 -1
  11. package/cjs/components/Select/hooks/useKeyboardNavigation.js +1 -1
  12. package/cjs/components/Select/hooks/useKeyboardNavigation.js.map +1 -1
  13. package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
  14. package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js.map +1 -1
  15. package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +1 -1
  16. package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js.map +1 -1
  17. package/cjs/components/Select/utils/getButtonLabel.js +1 -1
  18. package/cjs/components/Select/utils/getButtonLabel.js.map +1 -1
  19. package/cjs/components/Select/utils/initialItemsTransform.js +6 -9
  20. package/cjs/components/Select/utils/initialItemsTransform.js.map +1 -1
  21. package/cjs/components/ViewContainer/ViewContainer.js +38 -0
  22. package/cjs/components/ViewContainer/ViewContainer.js.map +1 -0
  23. package/cjs/components/ViewContainer/ViewContainer_yiqfcb.css +1 -0
  24. package/cjs/components/ViewContainer/_view/base.js +9 -0
  25. package/cjs/components/ViewContainer/_view/base.js.map +1 -0
  26. package/cjs/components/ViewContainer/_view/base_x642ct.css +1 -0
  27. package/cjs/index.css +2 -0
  28. package/cjs/index.js +3 -0
  29. package/cjs/index.js.map +1 -1
  30. package/emotion/cjs/components/Combobox/ComboboxNew/Combobox.js +22 -26
  31. package/emotion/cjs/components/Combobox/ComboboxNew/utils/index.js +1 -8
  32. package/emotion/cjs/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -19
  33. package/emotion/cjs/components/Drawer/Drawer.js +4 -3
  34. package/emotion/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
  35. package/emotion/cjs/components/Select/Select.js +25 -12
  36. package/emotion/cjs/components/Select/hooks/useKeyboardNavigation.js +1 -1
  37. package/emotion/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
  38. package/emotion/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +13 -13
  39. package/emotion/cjs/components/Select/utils/getButtonLabel.js +1 -1
  40. package/emotion/cjs/components/Select/utils/index.js +1 -8
  41. package/emotion/cjs/components/Select/utils/initialItemsTransform.js +6 -19
  42. package/emotion/cjs/components/ViewContainer/ViewContainer.js +49 -0
  43. package/emotion/cjs/components/ViewContainer/ViewContainer.template-doc.mdx +82 -0
  44. package/emotion/cjs/components/ViewContainer/_view/base.js +8 -0
  45. package/emotion/cjs/components/ViewContainer/_view/tokens.json +1 -0
  46. package/emotion/cjs/components/ViewContainer/index.js +18 -0
  47. package/emotion/cjs/examples/_helpers.js +3 -14
  48. package/emotion/cjs/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +0 -6
  49. package/emotion/cjs/examples/plasma_b2c/components/ViewContainer/ViewContainer.config.js +16 -0
  50. package/emotion/cjs/examples/plasma_b2c/components/ViewContainer/ViewContainer.js +11 -0
  51. package/emotion/cjs/examples/plasma_b2c/components/ViewContainer/ViewContainer.stories.tsx +65 -0
  52. package/emotion/cjs/examples/plasma_web/components/Combobox/Combobox.stories.tsx +0 -6
  53. package/emotion/cjs/examples/plasma_web/components/ViewContainer/ViewContainer.config.js +16 -0
  54. package/emotion/cjs/examples/plasma_web/components/ViewContainer/ViewContainer.js +11 -0
  55. package/emotion/cjs/examples/plasma_web/components/ViewContainer/ViewContainer.stories.tsx +65 -0
  56. package/emotion/cjs/index.js +11 -0
  57. package/emotion/es/components/Combobox/ComboboxNew/Combobox.js +23 -27
  58. package/emotion/es/components/Combobox/ComboboxNew/utils/index.js +1 -2
  59. package/emotion/es/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -19
  60. package/emotion/es/components/Drawer/Drawer.js +2 -1
  61. package/emotion/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
  62. package/emotion/es/components/Select/Select.js +26 -13
  63. package/emotion/es/components/Select/hooks/useKeyboardNavigation.js +1 -1
  64. package/emotion/es/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
  65. package/emotion/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +13 -13
  66. package/emotion/es/components/Select/utils/getButtonLabel.js +1 -1
  67. package/emotion/es/components/Select/utils/index.js +1 -2
  68. package/emotion/es/components/Select/utils/initialItemsTransform.js +6 -19
  69. package/emotion/es/components/ViewContainer/ViewContainer.js +40 -0
  70. package/emotion/es/components/ViewContainer/ViewContainer.template-doc.mdx +82 -0
  71. package/emotion/es/components/ViewContainer/_view/base.js +2 -0
  72. package/emotion/es/components/ViewContainer/_view/tokens.json +1 -0
  73. package/emotion/es/components/ViewContainer/index.js +1 -0
  74. package/emotion/es/examples/_helpers.js +3 -14
  75. package/emotion/es/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +0 -6
  76. package/emotion/es/examples/plasma_b2c/components/ViewContainer/ViewContainer.config.js +10 -0
  77. package/emotion/es/examples/plasma_b2c/components/ViewContainer/ViewContainer.js +5 -0
  78. package/emotion/es/examples/plasma_b2c/components/ViewContainer/ViewContainer.stories.tsx +65 -0
  79. package/emotion/es/examples/plasma_web/components/Combobox/Combobox.stories.tsx +0 -6
  80. package/emotion/es/examples/plasma_web/components/ViewContainer/ViewContainer.config.js +10 -0
  81. package/emotion/es/examples/plasma_web/components/ViewContainer/ViewContainer.js +5 -0
  82. package/emotion/es/examples/plasma_web/components/ViewContainer/ViewContainer.stories.tsx +65 -0
  83. package/emotion/es/index.js +2 -1
  84. package/es/components/Combobox/ComboboxNew/Combobox.js +22 -27
  85. package/es/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
  86. package/es/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -9
  87. package/es/components/Combobox/ComboboxNew/utils/initialItemsTransform.js.map +1 -1
  88. package/es/components/Drawer/Drawer.js +2 -1
  89. package/es/components/Drawer/Drawer.js.map +1 -1
  90. package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
  91. package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js.map +1 -1
  92. package/es/components/Select/Select.js +26 -14
  93. package/es/components/Select/Select.js.map +1 -1
  94. package/es/components/Select/hooks/useKeyboardNavigation.js +1 -1
  95. package/es/components/Select/hooks/useKeyboardNavigation.js.map +1 -1
  96. package/es/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
  97. package/es/components/Select/ui/Target/ui/Textfield/Textfield.js.map +1 -1
  98. package/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +1 -1
  99. package/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js.map +1 -1
  100. package/es/components/Select/utils/getButtonLabel.js +1 -1
  101. package/es/components/Select/utils/getButtonLabel.js.map +1 -1
  102. package/es/components/Select/utils/initialItemsTransform.js +6 -9
  103. package/es/components/Select/utils/initialItemsTransform.js.map +1 -1
  104. package/es/components/ViewContainer/ViewContainer.js +33 -0
  105. package/es/components/ViewContainer/ViewContainer.js.map +1 -0
  106. package/es/components/ViewContainer/ViewContainer_yiqfcb.css +1 -0
  107. package/es/components/ViewContainer/_view/base.js +5 -0
  108. package/es/components/ViewContainer/_view/base.js.map +1 -0
  109. package/es/components/ViewContainer/_view/base_x642ct.css +1 -0
  110. package/es/index.css +2 -0
  111. package/es/index.js +1 -0
  112. package/es/index.js.map +1 -1
  113. package/package.json +3 -2
  114. package/styled-components/cjs/components/Combobox/ComboboxNew/Combobox.js +22 -26
  115. package/styled-components/cjs/components/Combobox/ComboboxNew/utils/index.js +1 -8
  116. package/styled-components/cjs/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -19
  117. package/styled-components/cjs/components/Drawer/Drawer.js +4 -3
  118. package/styled-components/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
  119. package/styled-components/cjs/components/Select/Select.js +25 -12
  120. package/styled-components/cjs/components/Select/hooks/useKeyboardNavigation.js +1 -1
  121. package/styled-components/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
  122. package/styled-components/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +1 -1
  123. package/styled-components/cjs/components/Select/utils/getButtonLabel.js +1 -1
  124. package/styled-components/cjs/components/Select/utils/index.js +1 -8
  125. package/styled-components/cjs/components/Select/utils/initialItemsTransform.js +6 -19
  126. package/styled-components/cjs/components/ViewContainer/ViewContainer.js +40 -0
  127. package/styled-components/cjs/components/ViewContainer/ViewContainer.template-doc.mdx +82 -0
  128. package/styled-components/cjs/components/ViewContainer/_view/base.js +8 -0
  129. package/styled-components/cjs/components/ViewContainer/_view/tokens.json +1 -0
  130. package/styled-components/cjs/components/ViewContainer/index.js +18 -0
  131. package/styled-components/cjs/examples/_helpers.js +3 -14
  132. package/styled-components/cjs/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +0 -6
  133. package/styled-components/cjs/examples/plasma_b2c/components/ViewContainer/ViewContainer.config.js +16 -0
  134. package/styled-components/cjs/examples/plasma_b2c/components/ViewContainer/ViewContainer.js +11 -0
  135. package/styled-components/cjs/examples/plasma_b2c/components/ViewContainer/ViewContainer.stories.tsx +65 -0
  136. package/styled-components/cjs/examples/plasma_web/components/Combobox/Combobox.stories.tsx +0 -6
  137. package/styled-components/cjs/examples/plasma_web/components/ViewContainer/ViewContainer.config.js +16 -0
  138. package/styled-components/cjs/examples/plasma_web/components/ViewContainer/ViewContainer.js +11 -0
  139. package/styled-components/cjs/examples/plasma_web/components/ViewContainer/ViewContainer.stories.tsx +65 -0
  140. package/styled-components/cjs/index.js +11 -0
  141. package/styled-components/es/components/Combobox/ComboboxNew/Combobox.js +23 -27
  142. package/styled-components/es/components/Combobox/ComboboxNew/utils/index.js +1 -2
  143. package/styled-components/es/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -19
  144. package/styled-components/es/components/Drawer/Drawer.js +2 -1
  145. package/styled-components/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
  146. package/styled-components/es/components/Select/Select.js +26 -13
  147. package/styled-components/es/components/Select/hooks/useKeyboardNavigation.js +1 -1
  148. package/styled-components/es/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
  149. package/styled-components/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +1 -1
  150. package/styled-components/es/components/Select/utils/getButtonLabel.js +1 -1
  151. package/styled-components/es/components/Select/utils/index.js +1 -2
  152. package/styled-components/es/components/Select/utils/initialItemsTransform.js +6 -19
  153. package/styled-components/es/components/ViewContainer/ViewContainer.js +31 -0
  154. package/styled-components/es/components/ViewContainer/ViewContainer.template-doc.mdx +82 -0
  155. package/styled-components/es/components/ViewContainer/_view/base.js +2 -0
  156. package/styled-components/es/components/ViewContainer/_view/tokens.json +1 -0
  157. package/styled-components/es/components/ViewContainer/index.js +1 -0
  158. package/styled-components/es/examples/_helpers.js +3 -14
  159. package/styled-components/es/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +0 -6
  160. package/styled-components/es/examples/plasma_b2c/components/ViewContainer/ViewContainer.config.js +10 -0
  161. package/styled-components/es/examples/plasma_b2c/components/ViewContainer/ViewContainer.js +5 -0
  162. package/styled-components/es/examples/plasma_b2c/components/ViewContainer/ViewContainer.stories.tsx +65 -0
  163. package/styled-components/es/examples/plasma_web/components/Combobox/Combobox.stories.tsx +0 -6
  164. package/styled-components/es/examples/plasma_web/components/ViewContainer/ViewContainer.config.js +10 -0
  165. package/styled-components/es/examples/plasma_web/components/ViewContainer/ViewContainer.js +5 -0
  166. package/styled-components/es/examples/plasma_web/components/ViewContainer/ViewContainer.stories.tsx +65 -0
  167. package/styled-components/es/index.js +2 -1
  168. package/types/components/Combobox/ComboboxNew/Combobox.d.ts.map +1 -1
  169. package/types/components/Combobox/ComboboxNew/Combobox.types.d.ts +3 -14
  170. package/types/components/Combobox/ComboboxNew/Combobox.types.d.ts.map +1 -1
  171. package/types/components/Combobox/ComboboxNew/utils/index.d.ts +0 -1
  172. package/types/components/Combobox/ComboboxNew/utils/index.d.ts.map +1 -1
  173. package/types/components/Combobox/ComboboxNew/utils/initialItemsTransform.d.ts.map +1 -1
  174. package/types/components/Drawer/Drawer.d.ts.map +1 -1
  175. package/types/components/Select/Select.d.ts.map +1 -1
  176. package/types/components/Select/Select.types.d.ts +0 -1
  177. package/types/components/Select/Select.types.d.ts.map +1 -1
  178. package/types/components/Select/hooks/useKeyboardNavigation.d.ts +2 -2
  179. package/types/components/Select/hooks/useKeyboardNavigation.d.ts.map +1 -1
  180. package/types/components/Select/ui/Target/Target.types.d.ts +2 -2
  181. package/types/components/Select/ui/Target/Target.types.d.ts.map +1 -1
  182. package/types/components/Select/ui/Target/ui/Textfield/Textfield.styles.d.ts +4 -4
  183. package/types/components/Select/ui/Target/ui/Textfield/Textfield.styles.d.ts.map +1 -1
  184. package/types/components/Select/utils/index.d.ts +0 -1
  185. package/types/components/Select/utils/index.d.ts.map +1 -1
  186. package/types/components/Select/utils/initialItemsTransform.d.ts.map +1 -1
  187. package/types/components/ViewContainer/ViewContainer.d.ts +26 -0
  188. package/types/components/ViewContainer/ViewContainer.d.ts.map +1 -0
  189. package/types/components/ViewContainer/_view/base.d.ts +2 -0
  190. package/types/components/ViewContainer/_view/base.d.ts.map +1 -0
  191. package/types/components/ViewContainer/index.d.ts +2 -0
  192. package/types/components/ViewContainer/index.d.ts.map +1 -0
  193. package/types/examples/_helpers.d.ts.map +1 -1
  194. package/types/examples/plasma_b2c/components/Combobox/Combobox.d.ts +6 -30
  195. package/types/examples/plasma_b2c/components/Combobox/Combobox.d.ts.map +1 -1
  196. package/types/examples/plasma_b2c/components/ViewContainer/ViewContainer.config.d.ts +9 -0
  197. package/types/examples/plasma_b2c/components/ViewContainer/ViewContainer.config.d.ts.map +1 -0
  198. package/types/examples/plasma_b2c/components/ViewContainer/ViewContainer.d.ts +8 -0
  199. package/types/examples/plasma_b2c/components/ViewContainer/ViewContainer.d.ts.map +1 -0
  200. package/types/examples/plasma_web/components/Combobox/Combobox.d.ts +6 -30
  201. package/types/examples/plasma_web/components/Combobox/Combobox.d.ts.map +1 -1
  202. package/types/examples/plasma_web/components/ViewContainer/ViewContainer.config.d.ts +9 -0
  203. package/types/examples/plasma_web/components/ViewContainer/ViewContainer.config.d.ts.map +1 -0
  204. package/types/examples/plasma_web/components/ViewContainer/ViewContainer.d.ts +8 -0
  205. package/types/examples/plasma_web/components/ViewContainer/ViewContainer.d.ts.map +1 -0
  206. package/types/index.d.ts +1 -0
  207. package/types/index.d.ts.map +1 -1
  208. package/cjs/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -21
  209. package/cjs/components/Combobox/ComboboxNew/utils/getInitialValue.js.map +0 -1
  210. package/cjs/components/Select/utils/getInitialValue.js +0 -21
  211. package/cjs/components/Select/utils/getInitialValue.js.map +0 -1
  212. package/emotion/cjs/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -20
  213. package/emotion/cjs/components/Select/utils/getInitialValue.js +0 -20
  214. package/emotion/cjs/examples/themes/declaration.d.ts +0 -4
  215. package/emotion/cjs/examples/themes/index.js +0 -15
  216. package/emotion/cjs/examples/themes/plasma_b2c.module.css +0 -984
  217. package/emotion/cjs/examples/themes/plasma_web.module.css +0 -984
  218. package/emotion/es/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -14
  219. package/emotion/es/components/Select/utils/getInitialValue.js +0 -14
  220. package/emotion/es/examples/themes/declaration.d.ts +0 -4
  221. package/emotion/es/examples/themes/index.js +0 -7
  222. package/emotion/es/examples/themes/plasma_b2c.module.css +0 -984
  223. package/emotion/es/examples/themes/plasma_web.module.css +0 -984
  224. package/es/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -17
  225. package/es/components/Combobox/ComboboxNew/utils/getInitialValue.js.map +0 -1
  226. package/es/components/Select/utils/getInitialValue.js +0 -17
  227. package/es/components/Select/utils/getInitialValue.js.map +0 -1
  228. package/styled-components/cjs/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -20
  229. package/styled-components/cjs/components/Select/utils/getInitialValue.js +0 -20
  230. package/styled-components/cjs/examples/themes/declaration.d.ts +0 -4
  231. package/styled-components/cjs/examples/themes/index.js +0 -15
  232. package/styled-components/cjs/examples/themes/plasma_b2c.module.css +0 -984
  233. package/styled-components/cjs/examples/themes/plasma_web.module.css +0 -984
  234. package/styled-components/es/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -14
  235. package/styled-components/es/components/Select/utils/getInitialValue.js +0 -14
  236. package/styled-components/es/examples/themes/declaration.d.ts +0 -4
  237. package/styled-components/es/examples/themes/index.js +0 -7
  238. package/styled-components/es/examples/themes/plasma_b2c.module.css +0 -984
  239. package/styled-components/es/examples/themes/plasma_web.module.css +0 -984
  240. package/types/components/Combobox/ComboboxNew/utils/getInitialValue.d.ts +0 -4
  241. package/types/components/Combobox/ComboboxNew/utils/getInitialValue.d.ts.map +0 -1
  242. package/types/components/Select/utils/getInitialValue.d.ts +0 -4
  243. package/types/components/Select/utils/getInitialValue.d.ts.map +0 -1
  244. package/types/examples/themes/index.d.ts +0 -6
  245. package/types/examples/themes/index.d.ts.map +0 -1
@@ -1,4 +1,4 @@
1
- var _excluded = ["multiple", "value", "onChange", "isTargetAmount", "targetAmount", "items", "placement", "label", "placeholder", "helperText", "contentLeft", "textBefore", "textAfter", "variant", "listOverflow", "listHeight", "listWidth", "portal", "renderItem", "view", "size", "labelPlacement", "readOnly", "disabled", "alwaysOpened", "filter", "closeAfterSelect", "renderValue"];
1
+ var _excluded = ["multiple", "value", "onChange", "isTargetAmount", "items", "placement", "label", "placeholder", "helperText", "contentLeft", "textBefore", "textAfter", "variant", "listOverflow", "listHeight", "listWidth", "portal", "renderItem", "view", "size", "labelPlacement", "readOnly", "disabled", "alwaysOpened", "filter", "closeAfterSelect"];
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
3
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
4
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -16,7 +16,7 @@ import { sizeToIconSize } from '../../Select/utils';
16
16
  import { classes } from './Combobox.tokens';
17
17
  import { FloatingPopover } from './FloatingPopover';
18
18
  import { useKeyNavigation, getItemByFocused } from './hooks/useKeyboardNavigation';
19
- import { initialItemsTransform, updateAncestors, updateDescendants, updateSingleAncestors, filterItems, getItemId, getInitialValue } from './utils';
19
+ import { initialItemsTransform, updateAncestors, updateDescendants, updateSingleAncestors, filterItems, getItemId } from './utils';
20
20
  import { Inner, StyledTextField } from './ui';
21
21
  import { pathReducer, focusedPathReducer } from './reducers';
22
22
  import { getPathMap, getTreeMaps } from './hooks/getPathMaps';
@@ -35,7 +35,6 @@ export var comboboxRoot = function comboboxRoot(Root) {
35
35
  outerValue = props.value,
36
36
  outerOnChange = props.onChange,
37
37
  isTargetAmount = props.isTargetAmount,
38
- targetAmount = props.targetAmount,
39
38
  items = props.items,
40
39
  _props$placement = props.placement,
41
40
  placement = _props$placement === void 0 ? 'bottom-start' : _props$placement,
@@ -63,15 +62,10 @@ export var comboboxRoot = function comboboxRoot(Root) {
63
62
  alwaysOpened = _props$alwaysOpened === void 0 ? false : _props$alwaysOpened,
64
63
  filter = props.filter,
65
64
  outerCloseAfterSelect = props.closeAfterSelect,
66
- renderValue = props.renderValue,
67
65
  rest = _objectWithoutProperties(props, _excluded);
68
- var transformedItems = useMemo(function () {
69
- return initialItemsTransform(items || []);
70
- }, [items]);
71
-
72
66
  // Создаем структуры для быстрой работы с деревом
73
67
  var _useMemo = useMemo(function () {
74
- return getTreeMaps(transformedItems);
68
+ return getTreeMaps(items);
75
69
  }, [items]),
76
70
  _useMemo2 = _slicedToArray(_useMemo, 3),
77
71
  valueToCheckedMap = _useMemo2[0],
@@ -85,11 +79,14 @@ export var comboboxRoot = function comboboxRoot(Root) {
85
79
  _useState4 = _slicedToArray(_useState3, 2),
86
80
  internalValue = _useState4[0],
87
81
  setInternalValue = _useState4[1];
88
- var value = outerValue !== null && outerValue !== undefined ? getInitialValue(outerValue, valueToItemMap) : internalValue;
82
+ var value = outerValue || internalValue;
89
83
  var inputRef = useRef(null);
90
84
  var floatingPopoverRef = useRef(null);
91
85
  var inputForkRef = useForkRef(inputRef, ref);
92
86
  var treeId = safeUseId();
87
+ var transformedItems = useMemo(function () {
88
+ return initialItemsTransform(items || []);
89
+ }, [items]);
93
90
  var filteredItems = filterItems(transformedItems, textValue, (_valueToItemMap$get2 = valueToItemMap.get(value)) === null || _valueToItemMap$get2 === void 0 ? void 0 : _valueToItemMap$get2.label, filter);
94
91
  var _useMemo3 = useMemo(function () {
95
92
  return getPathMap(filteredItems);
@@ -256,7 +253,16 @@ export var comboboxRoot = function comboboxRoot(Root) {
256
253
  if (e) {
257
254
  e.stopPropagation();
258
255
  }
259
- var isCurrentChecked = checked.get(item.value);
256
+ var checkedCopy = new Map(checked);
257
+ var isCurrentChecked = checkedCopy.get(item.value);
258
+ checkedCopy.forEach(function (_, key) {
259
+ checkedCopy.set(key, false);
260
+ });
261
+ if (!isCurrentChecked) {
262
+ checkedCopy.set(item.value, 'done');
263
+ updateSingleAncestors(item, checkedCopy, 'dot');
264
+ }
265
+ setTextValue(isCurrentChecked ? '' : item.label);
260
266
  if (!alwaysOpened && closeAfterSelect) {
261
267
  dispatchPath({
262
268
  type: 'reset'
@@ -270,18 +276,14 @@ export var comboboxRoot = function comboboxRoot(Root) {
270
276
  }
271
277
  };
272
278
  var getChips = function getChips() {
273
- if (multiple && Array.isArray(value)) {
279
+ if (multiple) {
274
280
  if (value.length === 0) return [];
275
281
  if (isTargetAmount) {
276
- return ["\u0412\u044B\u0431\u0440\u0430\u043D\u043E ".concat(targetAmount || value.length)];
282
+ return ["\u0412\u044B\u0431\u0440\u0430\u043D\u043E ".concat(value.length)];
277
283
  }
278
- var renderValueMapper = renderValue && function (stringValue) {
279
- return renderValue(valueToItemMap.get(stringValue));
280
- };
281
- var valueToItemMapper = function valueToItemMapper(stringValue) {
282
- return valueToItemMap.get(stringValue).label;
283
- };
284
- return value.map(renderValueMapper || valueToItemMapper);
284
+ return value.map(function (value) {
285
+ return valueToItemMap.get(value).label;
286
+ });
285
287
  }
286
288
  return [];
287
289
  };
@@ -309,7 +311,6 @@ export var comboboxRoot = function comboboxRoot(Root) {
309
311
  // В данном эффекте мы следим за изменениями value снаружи и вносим коррективы в дерево чекбоксов.
310
312
  // Пример: когда юзер очистил value извне, тогда нужно пройтись по элементам и выключить все чекбоксы.
311
313
  useLayoutEffect(function () {
312
- var _valueToItemMap$get4;
313
314
  var checkedCopy = new Map(checked);
314
315
  checkedCopy.forEach(function (_, key) {
315
316
  checkedCopy.set(key, false);
@@ -327,12 +328,7 @@ export var comboboxRoot = function comboboxRoot(Root) {
327
328
  }
328
329
  }
329
330
  setChecked(checkedCopy);
330
- setTextValue(((_valueToItemMap$get4 = valueToItemMap.get(outerValue)) === null || _valueToItemMap$get4 === void 0 ? void 0 : _valueToItemMap$get4.label) || '');
331
-
332
- // В deps мы кладем именно outerValue и internalValue, а не просто value.
333
- // Т.к. вначале нужно отфильтровать и провалидировать outerValue и результат положить в переменную.
334
- // А переменную, содержащую сложные типы данных, нельзя помещать в deps.
335
- }, [outerValue, internalValue, items]);
331
+ }, [value]);
336
332
  return /*#__PURE__*/React.createElement(Root, {
337
333
  size: size,
338
334
  view: view,
@@ -4,5 +4,4 @@ export { updateAncestors } from './updateAncestors';
4
4
  export { updateSingleAncestors } from './updateSingleAncestors';
5
5
  export { sizeToIconSize } from './sizeToIconSize';
6
6
  export { filterItems } from './filterItems';
7
- export { getItemId } from './getItemId';
8
- export { getInitialValue } from './getInitialValue';
7
+ export { getItemId } from './getItemId';
@@ -1,25 +1,11 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
8
- 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."); }
9
- 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); }
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 _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; }
13
1
  // Проходимся по массиву items и добавляем в каждый item ключ parent, который ссылается на item родителя.
14
2
  // Дает возможность прохода к корневому элементу (снизу вверх).
15
- // На выходе получаем глубокую копию исходного массива items.
16
3
  export var initialItemsTransform = function initialItemsTransform(items, parent) {
17
- return _toConsumableArray(items).map(function (item) {
18
- var itemCopy = _objectSpread({}, item);
19
- itemCopy.parent = parent;
20
- if (itemCopy.items) {
21
- itemCopy.items = initialItemsTransform(itemCopy.items, itemCopy);
4
+ items.forEach(function (item) {
5
+ item.parent = parent;
6
+ if (item.items) {
7
+ item.items = initialItemsTransform(item.items, item);
22
8
  }
23
- return itemCopy;
24
9
  });
10
+ return items;
25
11
  };
@@ -3,13 +3,14 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
3
3
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
4
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
5
  import React, { forwardRef, useMemo } from 'react';
6
- import { useFocusTrap, useForkRef, safeUseId } from '@salutejs/plasma-core';
6
+ import { useForkRef, safeUseId } from '@salutejs/plasma-core';
7
7
  import { component, mergeConfig } from '../../engines';
8
8
  import { usePopupContext } from '../Popup';
9
9
  import { Overlay } from '../Overlay';
10
10
  import { DEFAULT_Z_INDEX } from '../Popup/utils';
11
11
  import { panelConfig } from '../Panel';
12
12
  import { cx, getSizeValueFromProp } from '../../utils';
13
+ import { useFocusTrap } from '../../hooks';
13
14
  import { classes, tokens } from './Drawer.tokens';
14
15
  import { base as viewCSS } from './variations/_view/base';
15
16
  import { base as sizeCSS } from './variations/_size/base';
@@ -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
  });